summaryrefslogtreecommitdiff
path: root/drivers/media/i2c
diff options
context:
space:
mode:
authorBingbu Cao <bingbu.cao@intel.com>2021-07-06 11:18:49 +0200
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2021-08-04 14:43:51 +0200
commitd84a2e4900ff43daba4e19b0a7cc56326fe8642a (patch)
treec65cea985d4ab7bc63b5962c07379bf4af6da91d /drivers/media/i2c
parent0e2b8552660c5e3f9416c252e42632e780cdbb7b (diff)
media: ov8856: ignore gpio and regulator for ov8856 with ACPI
For ov8856 working with ACPI, it does not depend on the reset gpio and regulator to do reset and power control, so should get the gpio and regulator for non-ACPI cases only, otherwise it will break ov8856 with ACPI. [Sakari Ailus: Wrap a line over 80 chars.] Signed-off-by: Bingbu Cao <bingbu.cao@intel.com> Signed-off-by: Tianshu Qiu <tian.shu.qiu@intel.com> Cc: Robert Foss <robert.foss@linaro.org> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/media/i2c')
-rw-r--r--drivers/media/i2c/ov8856.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/drivers/media/i2c/ov8856.c b/drivers/media/i2c/ov8856.c
index 88e19f30d376..aa74744b91c7 100644
--- a/drivers/media/i2c/ov8856.c
+++ b/drivers/media/i2c/ov8856.c
@@ -2304,25 +2304,26 @@ static int ov8856_get_hwcfg(struct ov8856 *ov8856, struct device *dev)
clk_set_rate(ov8856->xvclk, xvclk_rate);
xvclk_rate = clk_get_rate(ov8856->xvclk);
+
+ ov8856->reset_gpio = devm_gpiod_get_optional(dev, "reset",
+ GPIOD_OUT_LOW);
+ if (IS_ERR(ov8856->reset_gpio))
+ return PTR_ERR(ov8856->reset_gpio);
+
+ for (i = 0; i < ARRAY_SIZE(ov8856_supply_names); i++)
+ ov8856->supplies[i].supply = ov8856_supply_names[i];
+
+ ret = devm_regulator_bulk_get(dev,
+ ARRAY_SIZE(ov8856_supply_names),
+ ov8856->supplies);
+ if (ret)
+ return ret;
}
if (xvclk_rate != OV8856_XVCLK_19_2)
dev_warn(dev, "external clock rate %u is unsupported",
xvclk_rate);
- ov8856->reset_gpio = devm_gpiod_get_optional(dev, "reset",
- GPIOD_OUT_LOW);
- if (IS_ERR(ov8856->reset_gpio))
- return PTR_ERR(ov8856->reset_gpio);
-
- for (i = 0; i < ARRAY_SIZE(ov8856_supply_names); i++)
- ov8856->supplies[i].supply = ov8856_supply_names[i];
-
- ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(ov8856_supply_names),
- ov8856->supplies);
- if (ret)
- return ret;
-
ep = fwnode_graph_get_next_endpoint(fwnode, NULL);
if (!ep)
return -ENXIO;