summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Marek <jonathan@marek.ca>2021-12-22 03:37:42 +0300
committerMauro Carvalho Chehab <mchehab@kernel.org>2022-01-23 23:18:41 +0300
commite54ef952d5b0ede16d51ac9ee37c511046d88ada (patch)
tree5601e78385871e545e0f34cba4b6c431db64ff96
parentee780cd7be3b5608550bafe7d5f113db2140e99b (diff)
downloadlinux-e54ef952d5b0ede16d51ac9ee37c511046d88ada.tar.xz
media: camss: csid: allow csid to work without a regulator
At least for titan HW, CSID don't have an associated regulator. This change is necessary to be able to model this in the CSID resources. Signed-off-by: Jonathan Marek <jonathan@marek.ca> Reviewed-by: Robert Foss <robert.foss@linaro.org> Tested-by: Julian Grahsl <jgrahsl@snap.com> Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
-rw-r--r--drivers/media/platform/qcom/camss/camss-csid.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/media/platform/qcom/camss/camss-csid.c b/drivers/media/platform/qcom/camss/camss-csid.c
index a1637b78568b..1226913c623b 100644
--- a/drivers/media/platform/qcom/camss/camss-csid.c
+++ b/drivers/media/platform/qcom/camss/camss-csid.c
@@ -160,7 +160,7 @@ static int csid_set_power(struct v4l2_subdev *sd, int on)
if (ret < 0)
return ret;
- ret = regulator_enable(csid->vdda);
+ ret = csid->vdda ? regulator_enable(csid->vdda) : 0;
if (ret < 0) {
pm_runtime_put_sync(dev);
return ret;
@@ -168,14 +168,16 @@ static int csid_set_power(struct v4l2_subdev *sd, int on)
ret = csid_set_clock_rates(csid);
if (ret < 0) {
- regulator_disable(csid->vdda);
+ if (csid->vdda)
+ regulator_disable(csid->vdda);
pm_runtime_put_sync(dev);
return ret;
}
ret = camss_enable_clocks(csid->nclocks, csid->clock, dev);
if (ret < 0) {
- regulator_disable(csid->vdda);
+ if (csid->vdda)
+ regulator_disable(csid->vdda);
pm_runtime_put_sync(dev);
return ret;
}
@@ -186,7 +188,8 @@ static int csid_set_power(struct v4l2_subdev *sd, int on)
if (ret < 0) {
disable_irq(csid->irq);
camss_disable_clocks(csid->nclocks, csid->clock);
- regulator_disable(csid->vdda);
+ if (csid->vdda)
+ regulator_disable(csid->vdda);
pm_runtime_put_sync(dev);
return ret;
}
@@ -195,7 +198,7 @@ static int csid_set_power(struct v4l2_subdev *sd, int on)
} else {
disable_irq(csid->irq);
camss_disable_clocks(csid->nclocks, csid->clock);
- ret = regulator_disable(csid->vdda);
+ ret = csid->vdda ? regulator_disable(csid->vdda) : 0;
pm_runtime_put_sync(dev);
}
@@ -631,7 +634,9 @@ int msm_csid_subdev_init(struct camss *camss, struct csid_device *csid,
/* Regulator */
- csid->vdda = devm_regulator_get(dev, res->regulator[0]);
+ csid->vdda = NULL;
+ if (res->regulator[0])
+ csid->vdda = devm_regulator_get(dev, res->regulator[0]);
if (IS_ERR(csid->vdda)) {
dev_err(dev, "could not get regulator\n");
return PTR_ERR(csid->vdda);