linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Marek <jonathan@marek.ca>
To: linux-arm-msm@vger.kernel.org
Cc: robert.foss@linaro.org, andrey.konovalov@linaro.org,
	Todor Tomov <todor.too@gmail.com>, Andy Gross <agross@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-media@vger.kernel.org (open list:QUALCOMM CAMERA SUBSYSTEM
	DRIVER), linux-kernel@vger.kernel.org (open list)
Subject: [PATCH 09/17] media: camss: csid: allow csid to work without a regulator
Date: Tue,  8 Jun 2021 18:34:58 -0400	[thread overview]
Message-ID: <20210608223513.23193-10-jonathan@marek.ca> (raw)
In-Reply-To: <20210608223513.23193-1-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>
---
 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 cc11fbfdae132..528674dea06ca 100644
--- a/drivers/media/platform/qcom/camss/camss-csid.c
+++ b/drivers/media/platform/qcom/camss/camss-csid.c
@@ -162,7 +162,7 @@ static int csid_set_power(struct v4l2_subdev *sd, int on)
 			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;
@@ -170,14 +170,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;
 		}
@@ -188,7 +190,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;
 		}
@@ -197,7 +200,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);
 	}
 
@@ -634,7 +637,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.26.1


  parent reply	other threads:[~2021-06-08 22:38 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-08 22:34 [PATCH 00/17] CAMSS: SM8250 support (and some fixes) Jonathan Marek
2021-06-08 22:34 ` [PATCH 01/17] media: camss: csiphy-3ph: don't print HW version as an error Jonathan Marek
2021-06-08 22:34 ` [PATCH 02/17] media: camss: csiphy-3ph: disable interrupts Jonathan Marek
2021-06-08 22:34 ` [PATCH 03/17] media: camss: csiphy-3ph: add support for SM8250 CSI DPHY Jonathan Marek
2021-06-08 22:34 ` [PATCH 04/17] media: camss: csid-170: fix non-10bit formats Jonathan Marek
2021-06-08 22:34 ` [PATCH 05/17] media: camss: csid-170: don't enable unused irqs Jonathan Marek
2021-06-08 22:34 ` [PATCH 06/17] media: camss: csid-170: remove stray comment Jonathan Marek
2021-06-08 22:34 ` [PATCH 07/17] media: camss: csid-170: support more than one lite vfe Jonathan Marek
2021-06-08 22:34 ` [PATCH 08/17] media: camss: csid-170: set the right HALT_CMD when disabled Jonathan Marek
2021-06-08 22:34 ` Jonathan Marek [this message]
2021-06-10  8:01   ` [PATCH 09/17] media: camss: csid: allow csid to work without a regulator Robert Foss
2021-06-08 22:34 ` [PATCH 10/17] media: camss: remove vdda-csiN from sdm845 resources Jonathan Marek
2021-06-08 22:35 ` [PATCH 11/17] media: camss: fix VFE irq name Jonathan Marek
2021-06-08 22:35 ` [PATCH 12/17] media: camss: remove some vfe ops and clean up dead vfe-170 code Jonathan Marek
2021-06-09  3:23   ` kernel test robot
2021-06-10  5:23   ` kernel test robot
2021-06-10 12:37   ` Robert Foss
2021-06-08 22:35 ` [PATCH 13/17] media: camss: vfe-170: fix "VFE halt timeout" error Jonathan Marek
2021-06-08 22:35 ` [PATCH 14/17] media: camss: Add initial support for VFE hardware version Titan 480 Jonathan Marek
2021-06-10 12:40   ` Robert Foss
2021-06-08 22:35 ` [PATCH 15/17] media: camss: add support for V4L2_PIX_FMT_GREY for sdm845 HW Jonathan Marek
2021-06-08 22:35 ` [PATCH 16/17] media: camss: add support for SM8250 camss Jonathan Marek
2021-06-10  8:03   ` Robert Foss
2021-06-08 22:35 ` [PATCH 17/17] media: dt-bindings: media: camss: Add qcom,sm8250-camss binding Jonathan Marek
2021-06-09 16:16   ` Rob Herring
2021-06-09 22:10   ` Rob Herring
2021-06-09 22:32     ` Jonathan Marek
2021-06-16 18:16 ` [PATCH 00/17] CAMSS: SM8250 support (and some fixes) Andrey Konovalov
  -- strict thread matches above, loose matches on Subject: below --
2021-05-11 18:07 Jonathan Marek
2021-05-11 18:07 ` [PATCH 09/17] media: camss: csid: allow csid to work without a regulator Jonathan Marek
2021-05-20 12:14   ` Robert Foss

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=20210608223513.23193-10-jonathan@marek.ca \
    --to=jonathan@marek.ca \
    --cc=agross@kernel.org \
    --cc=andrey.konovalov@linaro.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=robert.foss@linaro.org \
    --cc=todor.too@gmail.com \
    --subject='Re: [PATCH 09/17] media: camss: csid: allow csid to work without a regulator' \
    /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

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).