mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v9 00/15] media: Add Lenovo Yoga Book camera support
@ 2026-10-02  8:35 Maurizio Casciano
  2026-10-02  8:35 ` [PATCH v9 01/15] media: ov8858: Extract digital gain programming Maurizio Casciano
  2026-10-02  8:51 ` [PATCH v9 00/15] media: Add Lenovo Yoga Book camera support Dan Carpenter
  0 siblings, 2 replies; 4+ messages in thread
From: Maurizio Casciano @ 2026-10-02  8:35 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, linux-media
  Cc: Maurizio Casciano, Sakari Ailus, Bingbu Cao, Jacopo Mondi,
	Nicholas Roth, Dan Scally, Hans de Goede, Andy Shevchenko,
	Andy Shevchenko, Greg Kroah-Hartman, linux-staging, linux-kernel

Add camera support for the Lenovo Yoga Book YB1-X91L. The tablet uses
an AtomISP ISP2401 with an OV2740 front sensor, an OV8858 rear sensor
and a WV517S rear-camera lens actuator.

The series adds the missing ACPI and bridge configuration, selects the
OV2740 link frequency through the existing IPU PCI-ID mechanism, derives
AtomISP CSI-2 timing from the sensor link frequency, enables raw Bayer
capture and adds the sensor controls and actuator driver needed by the
hardware.

Runtime validation used the same functional 15-patch content on the
current media_stage.git master. The final media-committers.git next rebase
and review edits only change source formatting and equivalent frequency
notation:

- W=1 builds and sparse builds of all eight affected objects passed after
  the rebase. The OV8858 object passed both again after the v9 review
  edits.
- A full x86_64 Debian binary package build passed and produced kernel
  7.3.0-rc1-yogabook-media-v8-20261002-001605.
- The kernel booted on a Lenovo Yoga Book YB1-X91L with AtomISP PCI ID
  8086:22b8. OV2740 negotiated 288 MHz and OV8858 negotiated 360 MHz;
  both sensors bound and AtomISP registered two cameras.
- OV8858 digital, red and blue gains were changed during streaming and
  read back correctly. Continuous raw capture produced changing frames
  from both sensors (6/8 unique rear samples and 8/8 unique front
  samples), including front-to-rear-to-front switching without OV8858,
  I2C or CSI errors.
- Both front and rear cameras were also exercised successfully with
  Cheese.
- v4l2-compliance 1.32.0 completed 47 tests on the AtomISP capture node:
  40 succeeded and 7 failed in invalid-ioctl, multiple-open, input,
  control enumeration, stream-parameter and buffer tests. These failures
  remain a validation limitation; this series does not claim to make the
  staging AtomISP driver fully compliant.

Only the Yoga Book 19.2 MHz OV8858 path was hardware-tested; the existing
24 MHz paths received build and static-analysis coverage but were not
tested on separate hardware.

---
Changes in v9:

- Express both OV8858 input-clock rates with HZ_PER_KHZ.
- Drop trailing commas from the terminators of all four new OV8858 clock
  register tables.
- Resend the series because the v8 mail transport wrapped patch lines and
  produced patches that do not apply. There are no functional changes from
  v8.

Changes in v8:

- Keep patch 2's commit message focused on the implementation, remove the
  invalid review Link and move runtime results to this cover letter.
- Express OV8858 frequencies with HZ_PER_MHZ/HZ_PER_KHZ, name clock
  tables by their input and link frequencies, and remove platform names
  from the sensor driver.
- Explain that V4L2 exposes standard red and blue balance controls but no
  standard green-balance control, so green remains the unity reference.
- Replace the per-sensor link-frequency override with the IPU bridge's
  existing PCI-ID matching mechanism. Add an 8086:22b8-specific OV2740
  288 MHz entry before the generic 360 MHz fallback. This removes the
  associated AtomISP hand-off patch and reduces the series to 15 patches.
- Add the introducing commit to the OV2740 group-hold fix and mark it for
  stable backporting.
- Use the documented Assisted-by tag syntax.
- Keep the padding helper as a normal static function and avoid a
  single-use raw-format descriptor structure.
- Retain Andy's Reviewed-by tags only where the corresponding patches did
  not change materially. In particular, drop the tag from the redesigned
  IPU bridge frequency patch.

v8 (transport-corrupted):
https://lore.kernel.org/linux-media/CAO7O_xi61=0kUtYkYFKonaSEJRC_KiXKvgMLSwRbnDTVfmQsPg@mail.gmail.com/
v7: https://lore.kernel.org/linux-media/cover.1788360629.git.mauriziocasciano7@gmail.com/

Maurizio Casciano (15):
  media: ov8858: Extract digital gain programming
  media: ov8858: support 19.2 MHz clock and manual white balance
  media: ov2740: Use C99 initializers for ACPI IDs
  media: ov2740: Add OVTI2740 ACPI ID
  media: ov8858: Add INT3477 ACPI ID
  media: intel: ipu-bridge: Add Yoga Book camera sensors
  media: atomisp: Add Yoga Book camera configuration
  media: ov2740: support 288 MHz link frequency
  media: intel: ipu-bridge: select OV2740 frequency by IPU ID
  media: atomisp: derive CSI-2 timing from sensor link frequency
  media: ov2740: release group hold after gain write errors
  media: ov2740: add manual white balance controls
  media: atomisp: Use struct v4l2_area for padding
  media: atomisp: allow raw Bayer capture
  media: i2c: Add WV517S lens actuator driver

 MAINTAINERS                                   |   1 +
 drivers/media/i2c/Kconfig                     |  11 +
 drivers/media/i2c/Makefile                    |   1 +
 drivers/media/i2c/ov2740.c                    | 114 +++++++--
 drivers/media/i2c/ov8858.c                    | 221 ++++++++++++++----
 drivers/media/i2c/wv517s.c                    | 208 +++++++++++++++++
 drivers/media/pci/intel/ipu-bridge.c          |  13 ++
 .../staging/media/atomisp/pci/atomisp_cmd.c   |  81 ++++---
 .../staging/media/atomisp/pci/atomisp_cmd.h   |   6 +-
 .../staging/media/atomisp/pci/atomisp_csi2.c  |  20 +-
 .../media/atomisp/pci/atomisp_csi2_bridge.c   |  19 +-
 .../staging/media/atomisp/pci/atomisp_ioctl.c |  32 ++-
 .../media/atomisp/pci/atomisp_subdev.c        |   4 +-
 .../media/atomisp/pci/atomisp_subdev.h        |   3 +-
 14 files changed, 605 insertions(+), 129 deletions(-)
 create mode 100644 drivers/media/i2c/wv517s.c


base-commit: 4a069a763e8a86821edac4159f7c59a20015631b

With Best Regards,
Maurizio Casciano
-- 
2.53.0

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

* [PATCH v9 01/15] media: ov8858: Extract digital gain programming
  2026-10-02  8:35 [PATCH v9 00/15] media: Add Lenovo Yoga Book camera support Maurizio Casciano
@ 2026-10-02  8:35 ` Maurizio Casciano
  2026-10-02  8:51 ` [PATCH v9 00/15] media: Add Lenovo Yoga Book camera support Dan Carpenter
  1 sibling, 0 replies; 4+ messages in thread
From: Maurizio Casciano @ 2026-10-02  8:35 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, linux-media
  Cc: Maurizio Casciano, Sakari Ailus, Bingbu Cao, Jacopo Mondi,
	Nicholas Roth, Dan Scally, Hans de Goede, Andy Shevchenko,
	Andy Shevchenko, Greg Kroah-Hartman, linux-staging, linux-kernel

Move the existing packed digital-gain register programming into a
helper so clock-specific gain handling can be added separately.

This is a pure refactoring: preserve both the register packing and the
explanatory comment without changing the bytes written to the sensor.

Assisted-by: LLM sparse
Signed-off-by: Maurizio Casciano <mauriziocasciano7@gmail.com>
---
 drivers/media/i2c/ov8858.c | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/drivers/media/i2c/ov8858.c b/drivers/media/i2c/ov8858.c
index 0bfc4350a8c9..2a0e2b08b9aa 100644
--- a/drivers/media/i2c/ov8858.c
+++ b/drivers/media/i2c/ov8858.c
@@ -1524,6 +1524,23 @@ static int ov8858_enable_test_pattern(struct
ov8858 *ov8858, u32 pattern)
 	return ov8858_write(ov8858, OV8858_REG_TEST_PATTERN, val, NULL);
 }

+static int ov8858_set_long_digital_gain(struct ov8858 *ov8858, u32 gain)
+{
+	u16 long_gain;
+
+	/*
+	 * Digital gain is assembled as:
+	 * 0x350a[7:0] = dgain[13:6]
+	 * 0x350b[5:0] = dgain[5:0]
+	 * Reassemble the control value to write it in one go.
+	 */
+	long_gain = (gain & OV8858_LONG_DIGIGAIN_L_MASK) |
+		    ((gain & OV8858_LONG_DIGIGAIN_H_MASK) <<
+		     OV8858_LONG_DIGIGAIN_H_SHIFT);
+
+	return ov8858_write(ov8858, OV8858_REG_LONG_DIGIGAIN, long_gain, NULL);
+}
+
 static int ov8858_set_ctrl(struct v4l2_ctrl *ctrl)
 {
 	struct ov8858 *ov8858 = container_of(ctrl->handler,
@@ -1532,7 +1549,6 @@ static int ov8858_set_ctrl(struct v4l2_ctrl *ctrl)
 	struct i2c_client *client = v4l2_get_subdevdata(&ov8858->subdev);
 	struct v4l2_mbus_framefmt *format;
 	struct v4l2_subdev_state *state;
-	u16 digi_gain;
 	s64 max_exp;
 	int ret;

@@ -1571,17 +1587,7 @@ static int ov8858_set_ctrl(struct v4l2_ctrl *ctrl)
 				   ctrl->val, NULL);
 		break;
 	case V4L2_CID_DIGITAL_GAIN:
-		/*
-		 * Digital gain is assembled as:
-		 * 0x350a[7:0] = dgain[13:6]
-		 * 0x350b[5:0] = dgain[5:0]
-		 * Reassemble the control value to write it in one go.
-		 */
-		digi_gain = (ctrl->val & OV8858_LONG_DIGIGAIN_L_MASK)
-			  | ((ctrl->val & OV8858_LONG_DIGIGAIN_H_MASK) <<
-			      OV8858_LONG_DIGIGAIN_H_SHIFT);
-		ret = ov8858_write(ov8858, OV8858_REG_LONG_DIGIGAIN,
-				   digi_gain, NULL);
+		ret = ov8858_set_long_digital_gain(ov8858, ctrl->val);
 		break;
 	case V4L2_CID_VBLANK:
 		ret = ov8858_write(ov8858, OV8858_REG_VTS,
-- 
2.53.0

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

* Re: [PATCH v9 00/15] media: Add Lenovo Yoga Book camera support
  2026-10-02  8:35 [PATCH v9 00/15] media: Add Lenovo Yoga Book camera support Maurizio Casciano
  2026-10-02  8:35 ` [PATCH v9 01/15] media: ov8858: Extract digital gain programming Maurizio Casciano
@ 2026-10-02  8:51 ` Dan Carpenter
  2026-10-02  9:12   ` Maurizio Casciano
  1 sibling, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2026-10-02  8:51 UTC (permalink / raw)
  To: Maurizio Casciano
  Cc: Mauro Carvalho Chehab, linux-media, Sakari Ailus, Bingbu Cao,
	Jacopo Mondi, Nicholas Roth, Dan Scally, Hans de Goede,
	Andy Shevchenko, Andy Shevchenko, Greg Kroah-Hartman,
	linux-staging, linux-kernel

Please, wait a day between resends...

regards,
dan carpenter


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

* Re: [PATCH v9 00/15] media: Add Lenovo Yoga Book camera support
  2026-10-02  8:51 ` [PATCH v9 00/15] media: Add Lenovo Yoga Book camera support Dan Carpenter
@ 2026-10-02  9:12   ` Maurizio Casciano
  0 siblings, 0 replies; 4+ messages in thread
From: Maurizio Casciano @ 2026-10-02  9:12 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Mauro Carvalho Chehab, linux-media, Sakari Ailus, Bingbu Cao,
	Jacopo Mondi, Nicholas Roth, Dan Scally, Hans de Goede,
	Andy Shevchenko, Andy Shevchenko, Greg Kroah-Hartman,
	linux-staging, linux-kernel

You're right. I missed your reply before sending v10. That was too soon,
and I should have waited.

I will not send another revision for at least a day. Any further revision
will also wait for the v10 review and CI results.

With Best Regards,
Maurizio Casciano

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

end of thread, other threads:[~2026-10-02  9:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-02  8:35 [PATCH v9 00/15] media: Add Lenovo Yoga Book camera support Maurizio Casciano
2026-10-02  8:35 ` [PATCH v9 01/15] media: ov8858: Extract digital gain programming Maurizio Casciano
2026-10-02  8:51 ` [PATCH v9 00/15] media: Add Lenovo Yoga Book camera support Dan Carpenter
2026-10-02  9:12   ` Maurizio Casciano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®