Commit e54ef952 authored by Jonathan Marek's avatar Jonathan Marek Committed by Mauro Carvalho Chehab
Browse files

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: default avatarJonathan Marek <jonathan@marek.ca>
Reviewed-by: default avatarRobert Foss <robert.foss@linaro.org>
Tested-by: default avatarJulian Grahsl <jgrahsl@snap.com>
Tested-by: default avatarBryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: default avatarBryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent ee780cd7
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -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,6 +168,7 @@ static int csid_set_power(struct v4l2_subdev *sd, int on)

		ret = csid_set_clock_rates(csid);
		if (ret < 0) {
			if (csid->vdda)
				regulator_disable(csid->vdda);
			pm_runtime_put_sync(dev);
			return ret;
@@ -175,6 +176,7 @@ static int csid_set_power(struct v4l2_subdev *sd, int on)

		ret = camss_enable_clocks(csid->nclocks, csid->clock, dev);
		if (ret < 0) {
			if (csid->vdda)
				regulator_disable(csid->vdda);
			pm_runtime_put_sync(dev);
			return ret;
@@ -186,6 +188,7 @@ 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);
			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,6 +634,8 @@ int msm_csid_subdev_init(struct camss *camss, struct csid_device *csid,

	/* Regulator */

	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");