summaryrefslogtreecommitdiff
path: root/drivers/i2c
diff options
context:
space:
mode:
authorHsin-Yi Wang <hsinyi@chromium.org>2021-05-27 10:55:55 +0300
committerWolfram Sang <wsa@kernel.org>2021-05-28 22:06:38 +0300
commit9029b9b2ae1355366530e43890fd6aa5db39e91e (patch)
treecc272431afa31247282c963cba6ceb834ce414dd /drivers/i2c
parentc021087c43c8f9b0bb070a85d49f2e3ac450c43e (diff)
downloadlinux-9029b9b2ae1355366530e43890fd6aa5db39e91e.tar.xz
i2c: mediatek: mt65xx: add optional vbus-supply
Add vbus-supply which provides power to SCL/SDA. Pass this regulator into core so it can be turned on/off for low power mode support. Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org> Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com> Reviewed-by: Qii Wang <qii.wang@mediatek.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-mt65xx.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c
index ea337ba46938..cb7fc7639396 100644
--- a/drivers/i2c/busses/i2c-mt65xx.c
+++ b/drivers/i2c/busses/i2c-mt65xx.c
@@ -1220,6 +1220,13 @@ static int mtk_i2c_probe(struct platform_device *pdev)
i2c->adap.quirks = i2c->dev_comp->quirks;
i2c->adap.timeout = 2 * HZ;
i2c->adap.retries = 1;
+ i2c->adap.bus_regulator = devm_regulator_get_optional(&pdev->dev, "vbus");
+ if (IS_ERR(i2c->adap.bus_regulator)) {
+ if (PTR_ERR(i2c->adap.bus_regulator) == -ENODEV)
+ i2c->adap.bus_regulator = NULL;
+ else
+ return PTR_ERR(i2c->adap.bus_regulator);
+ }
ret = mtk_i2c_parse_dt(pdev->dev.of_node, i2c);
if (ret)