linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
To: linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org,
	robert.foss@linaro.org, jonathan@marek.ca
Cc: andrey.konovalov@linaro.org, todor.too@gmail.com,
	agross@kernel.org, bjorn.andersson@linaro.org,
	mchehab@kernel.org, jgrahsl@snap.com, hfink@snap.com,
	bryan.odonoghue@linaro.org
Subject: [RESEND PATCH 10/18] media: camss: csid: allow csid to work without a regulator
Date: Thu, 11 Nov 2021 16:15:34 +0000	[thread overview]
Message-ID: <20211111161542.3936425-11-bryan.odonoghue@linaro.org> (raw)
In-Reply-To: <20211111161542.3936425-1-bryan.odonoghue@linaro.org>

From: Jonathan Marek <jonathan@marek.ca>

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: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 drivers/media/platform/qcom/camss/camss-csid.c | 17 +++++++++++------
 1 file 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);
-- 
2.33.0


  parent reply	other threads:[~2021-11-11 16:13 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-11 16:15 [RESEND PATCH 00/18] CAMSS: Add SM8250 support Bryan O'Donoghue
2021-11-11 16:15 ` [RESEND PATCH 01/18] media: dt-bindings: media: camss: Add qcom,sm8250-camss binding Bryan O'Donoghue
2021-11-11 16:15 ` [RESEND PATCH 02/18] media: camss: csiphy-3ph: don't print HW version as an error Bryan O'Donoghue
2021-11-11 16:15 ` [RESEND PATCH 03/18] media: camss: csiphy-3ph: disable interrupts Bryan O'Donoghue
2021-11-11 16:15 ` [RESEND PATCH 04/18] media: camss: csiphy-3ph: add support for SM8250 CSI DPHY Bryan O'Donoghue
2021-11-11 16:15 ` [RESEND PATCH 05/18] media: camss: csid-170: fix non-10bit formats Bryan O'Donoghue
2021-11-11 16:15 ` [RESEND PATCH 06/18] media: camss: csid-170: don't enable unused irqs Bryan O'Donoghue
2021-11-11 16:15 ` [RESEND PATCH 07/18] media: camss: csid-170: remove stray comment Bryan O'Donoghue
2021-11-11 16:15 ` [RESEND PATCH 08/18] media: camss: csid-170: support more than one lite vfe Bryan O'Donoghue
2021-11-11 16:15 ` [RESEND PATCH 09/18] media: camss: csid-170: set the right HALT_CMD when disabled Bryan O'Donoghue
2021-11-11 16:15 ` Bryan O'Donoghue [this message]
2021-11-11 16:15 ` [RESEND PATCH 11/18] media: camss: remove vdda-csiN from sdm845 resources Bryan O'Donoghue
2021-11-11 16:15 ` [RESEND PATCH 12/18] media: camss: fix VFE irq name Bryan O'Donoghue
2021-11-11 16:15 ` [RESEND PATCH 13/18] media: camss: vfe-170: fix "VFE halt timeout" error Bryan O'Donoghue
2021-11-11 16:15 ` [RESEND PATCH 14/18] media: camss: Add initial support for VFE hardware version Titan 480 Bryan O'Donoghue
2021-11-18 11:40   ` Robert Foss
2021-11-11 16:15 ` [RESEND PATCH 15/18] media: camss: add support for V4L2_PIX_FMT_GREY for sdm845 HW Bryan O'Donoghue
2021-11-11 16:15 ` [RESEND PATCH 16/18] media: camss: add support for SM8250 camss Bryan O'Donoghue
2021-11-18 11:39   ` Robert Foss
2021-11-11 16:15 ` [RESEND PATCH 17/18] media: camss: Add SM8250 bandwdith configuration support Bryan O'Donoghue
2021-11-11 16:15 ` [RESEND PATCH 18/18] media: camss: Do vfe_get/vfe_put for csid on sm8250 Bryan O'Donoghue
2021-11-18 12:02   ` Robert Foss
2021-11-22 19:40 ` [RESEND PATCH 00/18] CAMSS: Add SM8250 support Julian Grahsl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211111161542.3936425-11-bryan.odonoghue@linaro.org \
    --to=bryan.odonoghue@linaro.org \
    --cc=agross@kernel.org \
    --cc=andrey.konovalov@linaro.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=hfink@snap.com \
    --cc=jgrahsl@snap.com \
    --cc=jonathan@marek.ca \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=robert.foss@linaro.org \
    --cc=todor.too@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).