stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: ov8856: Do not check for for module version
@ 2023-03-23 22:44 Ricardo Ribalda
  2023-03-31  8:49 ` Sakari Ailus
  0 siblings, 1 reply; 2+ messages in thread
From: Ricardo Ribalda @ 2023-03-23 22:44 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Bingbu Cao, Dongchun Zhu, Sakari Ailus
  Cc: Jimmy Su, stable, Ricardo Ribalda, Mauro Carvalho Chehab,
	Max Staudt, linux-media, linux-kernel

It the device is probed in non-zero ACPI D state, the module
identification is delayed until the first streamon.

The module identification has two parts: deviceID and version. To rea
the version we have to enable OTP read. This cannot be done during
streamon, becase it modifies REG_MODE_SELECT.

Since the driver has the same behaviour for all the module versions, do
not read the module version from the sensor's OTP.

Cc: stable@vger.kernel.org
Fixes: 0e014f1a8d54 ("media: ov8856: support device probe in non-zero ACPI D state")
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
To: Dongchun Zhu <dongchun.zhu@mediatek.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>
To: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Bingbu Cao <bingbu.cao@intel.com>
Cc: Max Staudt <mstaudt@chromium.org>
Cc: Jimmy Su <jimmy.su@intel.com>
Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Cc: linux-media@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/media/i2c/ov8856.c | 40 ----------------------------------------
 1 file changed, 40 deletions(-)

diff --git a/drivers/media/i2c/ov8856.c b/drivers/media/i2c/ov8856.c
index cf8384e09413..b5c7881383ca 100644
--- a/drivers/media/i2c/ov8856.c
+++ b/drivers/media/i2c/ov8856.c
@@ -1709,46 +1709,6 @@ static int ov8856_identify_module(struct ov8856 *ov8856)
 		return -ENXIO;
 	}
 
-	ret = ov8856_write_reg(ov8856, OV8856_REG_MODE_SELECT,
-			       OV8856_REG_VALUE_08BIT, OV8856_MODE_STREAMING);
-	if (ret)
-		return ret;
-
-	ret = ov8856_write_reg(ov8856, OV8856_OTP_MODE_CTRL,
-			       OV8856_REG_VALUE_08BIT, OV8856_OTP_MODE_AUTO);
-	if (ret) {
-		dev_err(&client->dev, "failed to set otp mode");
-		return ret;
-	}
-
-	ret = ov8856_write_reg(ov8856, OV8856_OTP_LOAD_CTRL,
-			       OV8856_REG_VALUE_08BIT,
-			       OV8856_OTP_LOAD_CTRL_ENABLE);
-	if (ret) {
-		dev_err(&client->dev, "failed to enable load control");
-		return ret;
-	}
-
-	ret = ov8856_read_reg(ov8856, OV8856_MODULE_REVISION,
-			      OV8856_REG_VALUE_08BIT, &val);
-	if (ret) {
-		dev_err(&client->dev, "failed to read module revision");
-		return ret;
-	}
-
-	dev_info(&client->dev, "OV8856 revision %x (%s) at address 0x%02x\n",
-		 val,
-		 val == OV8856_2A_MODULE ? "2A" :
-		 val == OV8856_1B_MODULE ? "1B" : "unknown revision",
-		 client->addr);
-
-	ret = ov8856_write_reg(ov8856, OV8856_REG_MODE_SELECT,
-			       OV8856_REG_VALUE_08BIT, OV8856_MODE_STANDBY);
-	if (ret) {
-		dev_err(&client->dev, "failed to exit streaming mode");
-		return ret;
-	}
-
 	ov8856->identified = true;
 
 	return 0;

---
base-commit: 9fd6ba5420ba2b637d1ecc6de8613ec8b9c87e5a
change-id: 20230323-ov8856-otp-112f3cdc74b1

Best regards,
-- 
Ricardo Ribalda <ribalda@chromium.org>

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] media: ov8856: Do not check for for module version
  2023-03-23 22:44 [PATCH] media: ov8856: Do not check for for module version Ricardo Ribalda
@ 2023-03-31  8:49 ` Sakari Ailus
  0 siblings, 0 replies; 2+ messages in thread
From: Sakari Ailus @ 2023-03-31  8:49 UTC (permalink / raw)
  To: Ricardo Ribalda
  Cc: Mauro Carvalho Chehab, Bingbu Cao, Dongchun Zhu, Jimmy Su,
	stable, Mauro Carvalho Chehab, Max Staudt, linux-media,
	linux-kernel

Hi Ricardo,

On Thu, Mar 23, 2023 at 11:44:20PM +0100, Ricardo Ribalda wrote:
> It the device is probed in non-zero ACPI D state, the module
> identification is delayed until the first streamon.
> 
> The module identification has two parts: deviceID and version. To rea
> the version we have to enable OTP read. This cannot be done during
> streamon, becase it modifies REG_MODE_SELECT.
> 
> Since the driver has the same behaviour for all the module versions, do
> not read the module version from the sensor's OTP.
> 
> Cc: stable@vger.kernel.org
> Fixes: 0e014f1a8d54 ("media: ov8856: support device probe in non-zero ACPI D state")
> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>

I guess the identification could be done from pre_streamon() callback
instead, but the driver doesn't implement it. But the information isn't
used for anything indeed so I'll just take this.

Thanks.

-- 
Kind regards,

Sakari Ailus

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-03-31  8:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-23 22:44 [PATCH] media: ov8856: Do not check for for module version Ricardo Ribalda
2023-03-31  8:49 ` Sakari Ailus

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