[PATCH v1 0/2] media: i2c: add Sony IMX111 CMOS camera sensor driver

Svyatoslav Ryhel posted 2 patches 5 months, 3 weeks ago
There is a newer version of this series
.../bindings/media/i2c/sony,imx111.yaml       |  126 ++
drivers/media/i2c/Kconfig                     |   10 +
drivers/media/i2c/Makefile                    |    1 +
drivers/media/i2c/imx111.c                    | 1616 +++++++++++++++++
4 files changed, 1753 insertions(+)
create mode 100644 Documentation/devicetree/bindings/media/i2c/sony,imx111.yaml
create mode 100644 drivers/media/i2c/imx111.c
[PATCH v1 0/2] media: i2c: add Sony IMX111 CMOS camera sensor driver
Posted by Svyatoslav Ryhel 5 months, 3 weeks ago
Add driver for Sony IMX111 CMOS sensor found in LG Optimus 4X and Vu
smartphones.

Svyatoslav Ryhel (2):
  dt-bindings: media: i2c: document Sony IMX111 CMOS sensor
  media: i2c: add Sony IMX111 CMOS camera sensor driver

 .../bindings/media/i2c/sony,imx111.yaml       |  126 ++
 drivers/media/i2c/Kconfig                     |   10 +
 drivers/media/i2c/Makefile                    |    1 +
 drivers/media/i2c/imx111.c                    | 1616 +++++++++++++++++
 4 files changed, 1753 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/sony,imx111.yaml
 create mode 100644 drivers/media/i2c/imx111.c

-- 
2.48.1
Re: [PATCH v1 0/2] media: i2c: add Sony IMX111 CMOS camera sensor driver
Posted by Sakari Ailus 5 months, 1 week ago
Hi Svyatoslaw,

On Tue, Aug 19, 2025 at 03:04:25PM +0300, Svyatoslav Ryhel wrote:
> Add driver for Sony IMX111 CMOS sensor found in LG Optimus 4X and Vu
> smartphones.

Thanks for the set.

I wonder how would the sensor work with the CCS driver. The register layout
appears to be very much aligned with that (I haven't checked whether there
are MSRs that depend on the mode).

-- 
Kind regards,

Sakari Ailus
Re: [PATCH v1 0/2] media: i2c: add Sony IMX111 CMOS camera sensor driver
Posted by Svyatoslav Ryhel 5 months, 1 week ago
чт, 28 серп. 2025 р. о 19:12 Sakari Ailus <sakari.ailus@linux.intel.com> пише:
>
> Hi Svyatoslaw,
>
> On Tue, Aug 19, 2025 at 03:04:25PM +0300, Svyatoslav Ryhel wrote:
> > Add driver for Sony IMX111 CMOS sensor found in LG Optimus 4X and Vu
> > smartphones.
>
> Thanks for the set.
>
> I wonder how would the sensor work with the CCS driver. The register layout
> appears to be very much aligned with that (I haven't checked whether there
> are MSRs that depend on the mode).
>

After deeper testing I have found that imx111 may be nokia,smia
compatible, at least most of general registers and CCS logic is
applicable. Some of registers may cause issues, for example,
"phy_ctrl_capability" = 0, 0x0 and some insane pll ranges. Maybe that
can be addressed with a firmware patch idk. The trickiest part is that
each mode requires non-standard and non-common manufacturer code
(0x3xxx ranges). If you can explain how to address these issues, I
would love to add imx111 and a few other modules into list of CCS
supported devices.

> --
> Kind regards,
>
> Sakari Ailus
Re: [PATCH v1 0/2] media: i2c: add Sony IMX111 CMOS camera sensor driver
Posted by Sakari Ailus 3 months, 1 week ago
Hi Svyatoslav,

On Fri, Aug 29, 2025 at 09:20:10PM +0300, Svyatoslav Ryhel wrote:
> чт, 28 серп. 2025 р. о 19:12 Sakari Ailus <sakari.ailus@linux.intel.com> пише:
> >
> > Hi Svyatoslaw,
> >
> > On Tue, Aug 19, 2025 at 03:04:25PM +0300, Svyatoslav Ryhel wrote:
> > > Add driver for Sony IMX111 CMOS sensor found in LG Optimus 4X and Vu
> > > smartphones.
> >
> > Thanks for the set.
> >
> > I wonder how would the sensor work with the CCS driver. The register layout
> > appears to be very much aligned with that (I haven't checked whether there
> > are MSRs that depend on the mode).
> >
> 
> After deeper testing I have found that imx111 may be nokia,smia
> compatible, at least most of general registers and CCS logic is
> applicable. Some of registers may cause issues, for example,
> "phy_ctrl_capability" = 0, 0x0 and some insane pll ranges. Maybe that
> can be addressed with a firmware patch idk. The trickiest part is that
> each mode requires non-standard and non-common manufacturer code
> (0x3xxx ranges). If you can explain how to address these issues, I
> would love to add imx111 and a few other modules into list of CCS
> supported devices.

On a closer look, only the image size related configuration and a little
more appears to be CCS-like. That's not enough to configure the sensor;
this is conveyed in the MSR space which indeed makes the sensor difficult
to control using the CCS driver, unfortunately.

Let me review v2.

-- 
Kind regards,

Sakari Ailus
Re: [PATCH v1 0/2] media: i2c: add Sony IMX111 CMOS camera sensor driver
Posted by Sakari Ailus 3 months, 1 week ago
On Tue, Oct 28, 2025 at 06:24:25PM +0200, Sakari Ailus wrote:
> Hi Svyatoslav,
> 
> On Fri, Aug 29, 2025 at 09:20:10PM +0300, Svyatoslav Ryhel wrote:
> > чт, 28 серп. 2025 р. о 19:12 Sakari Ailus <sakari.ailus@linux.intel.com> пише:
> > >
> > > Hi Svyatoslaw,
> > >
> > > On Tue, Aug 19, 2025 at 03:04:25PM +0300, Svyatoslav Ryhel wrote:
> > > > Add driver for Sony IMX111 CMOS sensor found in LG Optimus 4X and Vu
> > > > smartphones.
> > >
> > > Thanks for the set.
> > >
> > > I wonder how would the sensor work with the CCS driver. The register layout
> > > appears to be very much aligned with that (I haven't checked whether there
> > > are MSRs that depend on the mode).
> > >
> > 
> > After deeper testing I have found that imx111 may be nokia,smia
> > compatible, at least most of general registers and CCS logic is
> > applicable. Some of registers may cause issues, for example,
> > "phy_ctrl_capability" = 0, 0x0 and some insane pll ranges. Maybe that
> > can be addressed with a firmware patch idk. The trickiest part is that
> > each mode requires non-standard and non-common manufacturer code
> > (0x3xxx ranges). If you can explain how to address these issues, I
> > would love to add imx111 and a few other modules into list of CCS
> > supported devices.
> 
> On a closer look, only the image size related configuration and a little
> more appears to be CCS-like. That's not enough to configure the sensor;
> this is conveyed in the MSR space which indeed makes the sensor difficult
> to control using the CCS driver, unfortunately.

Ok, the driver appears to be doing quite a bit of register writes outside
the register lists, which is good, and what's there appears indeed largely
CCS compliant. The MSRs remain an issue; it'd take quite a bit of reverse
engineering to figure out what the registers are and how to configure them
in a generic way. I think that's doable but I'm not sure it is justifiable
considering the expected effort.

-- 
Sakari Ailus
Re: [PATCH v1 0/2] media: i2c: add Sony IMX111 CMOS camera sensor driver
Posted by Svyatoslav Ryhel 3 months, 1 week ago
вт, 28 жовт. 2025 р. о 18:31 Sakari Ailus <sakari.ailus@linux.intel.com> пише:
>
> On Tue, Oct 28, 2025 at 06:24:25PM +0200, Sakari Ailus wrote:
> > Hi Svyatoslav,
> >
> > On Fri, Aug 29, 2025 at 09:20:10PM +0300, Svyatoslav Ryhel wrote:
> > > чт, 28 серп. 2025 р. о 19:12 Sakari Ailus <sakari.ailus@linux.intel.com> пише:
> > > >
> > > > Hi Svyatoslaw,
> > > >
> > > > On Tue, Aug 19, 2025 at 03:04:25PM +0300, Svyatoslav Ryhel wrote:
> > > > > Add driver for Sony IMX111 CMOS sensor found in LG Optimus 4X and Vu
> > > > > smartphones.
> > > >
> > > > Thanks for the set.
> > > >
> > > > I wonder how would the sensor work with the CCS driver. The register layout
> > > > appears to be very much aligned with that (I haven't checked whether there
> > > > are MSRs that depend on the mode).
> > > >
> > >
> > > After deeper testing I have found that imx111 may be nokia,smia
> > > compatible, at least most of general registers and CCS logic is
> > > applicable. Some of registers may cause issues, for example,
> > > "phy_ctrl_capability" = 0, 0x0 and some insane pll ranges. Maybe that
> > > can be addressed with a firmware patch idk. The trickiest part is that
> > > each mode requires non-standard and non-common manufacturer code
> > > (0x3xxx ranges). If you can explain how to address these issues, I
> > > would love to add imx111 and a few other modules into list of CCS
> > > supported devices.
> >
> > On a closer look, only the image size related configuration and a little
> > more appears to be CCS-like. That's not enough to configure the sensor;
> > this is conveyed in the MSR space which indeed makes the sensor difficult
> > to control using the CCS driver, unfortunately.
>
> Ok, the driver appears to be doing quite a bit of register writes outside
> the register lists, which is good, and what's there appears indeed largely
> CCS compliant. The MSRs remain an issue; it'd take quite a bit of reverse
> engineering to figure out what the registers are and how to configure them
> in a generic way. I think that's doable but I'm not sure it is justifiable
> considering the expected effort.
>

I have deciphered a lot already since downstream provides only
register writing sequences. Everything that left is 0x3xxx which seems
to refer a vendor region and it is not documented anywhere.

> --
> Sakari Ailus
Re: [PATCH v1 0/2] media: i2c: add Sony IMX111 CMOS camera sensor driver
Posted by Sakari Ailus 3 months, 1 week ago
On Tue, Oct 28, 2025 at 06:34:15PM +0200, Svyatoslav Ryhel wrote:
> вт, 28 жовт. 2025 р. о 18:31 Sakari Ailus <sakari.ailus@linux.intel.com> пише:
> >
> > On Tue, Oct 28, 2025 at 06:24:25PM +0200, Sakari Ailus wrote:
> > > Hi Svyatoslav,
> > >
> > > On Fri, Aug 29, 2025 at 09:20:10PM +0300, Svyatoslav Ryhel wrote:
> > > > чт, 28 серп. 2025 р. о 19:12 Sakari Ailus <sakari.ailus@linux.intel.com> пише:
> > > > >
> > > > > Hi Svyatoslaw,
> > > > >
> > > > > On Tue, Aug 19, 2025 at 03:04:25PM +0300, Svyatoslav Ryhel wrote:
> > > > > > Add driver for Sony IMX111 CMOS sensor found in LG Optimus 4X and Vu
> > > > > > smartphones.
> > > > >
> > > > > Thanks for the set.
> > > > >
> > > > > I wonder how would the sensor work with the CCS driver. The register layout
> > > > > appears to be very much aligned with that (I haven't checked whether there
> > > > > are MSRs that depend on the mode).
> > > > >
> > > >
> > > > After deeper testing I have found that imx111 may be nokia,smia
> > > > compatible, at least most of general registers and CCS logic is
> > > > applicable. Some of registers may cause issues, for example,
> > > > "phy_ctrl_capability" = 0, 0x0 and some insane pll ranges. Maybe that
> > > > can be addressed with a firmware patch idk. The trickiest part is that
> > > > each mode requires non-standard and non-common manufacturer code
> > > > (0x3xxx ranges). If you can explain how to address these issues, I
> > > > would love to add imx111 and a few other modules into list of CCS
> > > > supported devices.
> > >
> > > On a closer look, only the image size related configuration and a little
> > > more appears to be CCS-like. That's not enough to configure the sensor;
> > > this is conveyed in the MSR space which indeed makes the sensor difficult
> > > to control using the CCS driver, unfortunately.
> >
> > Ok, the driver appears to be doing quite a bit of register writes outside
> > the register lists, which is good, and what's there appears indeed largely
> > CCS compliant. The MSRs remain an issue; it'd take quite a bit of reverse
> > engineering to figure out what the registers are and how to configure them
> > in a generic way. I think that's doable but I'm not sure it is justifiable
> > considering the expected effort.
> >
> 
> I have deciphered a lot already since downstream provides only
> register writing sequences. Everything that left is 0x3xxx which seems
> to refer a vendor region and it is not documented anywhere.

That's what I'd expect, too, with the possible exception of the datasheet,
but even sensor datasheets often omit a lot of information.

I believe you're already aware of
<URL:https://www.mipi.org/specifications/camera-command-set>?

-- 
Sakari Ailus
Re: [PATCH v1 0/2] media: i2c: add Sony IMX111 CMOS camera sensor driver
Posted by Svyatoslav Ryhel 3 months, 1 week ago
вт, 28 жовт. 2025 р. о 18:38 Sakari Ailus <sakari.ailus@linux.intel.com> пише:
>
> On Tue, Oct 28, 2025 at 06:34:15PM +0200, Svyatoslav Ryhel wrote:
> > вт, 28 жовт. 2025 р. о 18:31 Sakari Ailus <sakari.ailus@linux.intel.com> пише:
> > >
> > > On Tue, Oct 28, 2025 at 06:24:25PM +0200, Sakari Ailus wrote:
> > > > Hi Svyatoslav,
> > > >
> > > > On Fri, Aug 29, 2025 at 09:20:10PM +0300, Svyatoslav Ryhel wrote:
> > > > > чт, 28 серп. 2025 р. о 19:12 Sakari Ailus <sakari.ailus@linux.intel.com> пише:
> > > > > >
> > > > > > Hi Svyatoslaw,
> > > > > >
> > > > > > On Tue, Aug 19, 2025 at 03:04:25PM +0300, Svyatoslav Ryhel wrote:
> > > > > > > Add driver for Sony IMX111 CMOS sensor found in LG Optimus 4X and Vu
> > > > > > > smartphones.
> > > > > >
> > > > > > Thanks for the set.
> > > > > >
> > > > > > I wonder how would the sensor work with the CCS driver. The register layout
> > > > > > appears to be very much aligned with that (I haven't checked whether there
> > > > > > are MSRs that depend on the mode).
> > > > > >
> > > > >
> > > > > After deeper testing I have found that imx111 may be nokia,smia
> > > > > compatible, at least most of general registers and CCS logic is
> > > > > applicable. Some of registers may cause issues, for example,
> > > > > "phy_ctrl_capability" = 0, 0x0 and some insane pll ranges. Maybe that
> > > > > can be addressed with a firmware patch idk. The trickiest part is that
> > > > > each mode requires non-standard and non-common manufacturer code
> > > > > (0x3xxx ranges). If you can explain how to address these issues, I
> > > > > would love to add imx111 and a few other modules into list of CCS
> > > > > supported devices.
> > > >
> > > > On a closer look, only the image size related configuration and a little
> > > > more appears to be CCS-like. That's not enough to configure the sensor;
> > > > this is conveyed in the MSR space which indeed makes the sensor difficult
> > > > to control using the CCS driver, unfortunately.
> > >
> > > Ok, the driver appears to be doing quite a bit of register writes outside
> > > the register lists, which is good, and what's there appears indeed largely
> > > CCS compliant. The MSRs remain an issue; it'd take quite a bit of reverse
> > > engineering to figure out what the registers are and how to configure them
> > > in a generic way. I think that's doable but I'm not sure it is justifiable
> > > considering the expected effort.
> > >
> >
> > I have deciphered a lot already since downstream provides only
> > register writing sequences. Everything that left is 0x3xxx which seems
> > to refer a vendor region and it is not documented anywhere.
>
> That's what I'd expect, too, with the possible exception of the datasheet,
> but even sensor datasheets often omit a lot of information.
>

There is no commonly available datasheet for this model. From what I
have seen from similar models, 0x3xxx is vendor region and as you said
"datasheets often omit a lot of information" which is the case.

> I believe you're already aware of
> <URL:https://www.mipi.org/specifications/camera-command-set>?
>

Yes, but since this module is from pre-CCS era or was created right
before this standard was introduced, the module lacks a quite a bit of
registers and configurations required by CCS. Keep in mind that sensor
is used in the phone from 2012.

> --
> Sakari Ailus
Re: [PATCH v1 0/2] media: i2c: add Sony IMX111 CMOS camera sensor driver
Posted by Sakari Ailus 3 months, 1 week ago
On Tue, Oct 28, 2025 at 06:55:11PM +0200, Svyatoslav Ryhel wrote:
> вт, 28 жовт. 2025 р. о 18:38 Sakari Ailus <sakari.ailus@linux.intel.com> пише:
> >
> > On Tue, Oct 28, 2025 at 06:34:15PM +0200, Svyatoslav Ryhel wrote:
> > > вт, 28 жовт. 2025 р. о 18:31 Sakari Ailus <sakari.ailus@linux.intel.com> пише:
> > > >
> > > > On Tue, Oct 28, 2025 at 06:24:25PM +0200, Sakari Ailus wrote:
> > > > > Hi Svyatoslav,
> > > > >
> > > > > On Fri, Aug 29, 2025 at 09:20:10PM +0300, Svyatoslav Ryhel wrote:
> > > > > > чт, 28 серп. 2025 р. о 19:12 Sakari Ailus <sakari.ailus@linux.intel.com> пише:
> > > > > > >
> > > > > > > Hi Svyatoslaw,
> > > > > > >
> > > > > > > On Tue, Aug 19, 2025 at 03:04:25PM +0300, Svyatoslav Ryhel wrote:
> > > > > > > > Add driver for Sony IMX111 CMOS sensor found in LG Optimus 4X and Vu
> > > > > > > > smartphones.
> > > > > > >
> > > > > > > Thanks for the set.
> > > > > > >
> > > > > > > I wonder how would the sensor work with the CCS driver. The register layout
> > > > > > > appears to be very much aligned with that (I haven't checked whether there
> > > > > > > are MSRs that depend on the mode).
> > > > > > >
> > > > > >
> > > > > > After deeper testing I have found that imx111 may be nokia,smia
> > > > > > compatible, at least most of general registers and CCS logic is
> > > > > > applicable. Some of registers may cause issues, for example,
> > > > > > "phy_ctrl_capability" = 0, 0x0 and some insane pll ranges. Maybe that
> > > > > > can be addressed with a firmware patch idk. The trickiest part is that
> > > > > > each mode requires non-standard and non-common manufacturer code
> > > > > > (0x3xxx ranges). If you can explain how to address these issues, I
> > > > > > would love to add imx111 and a few other modules into list of CCS
> > > > > > supported devices.
> > > > >
> > > > > On a closer look, only the image size related configuration and a little
> > > > > more appears to be CCS-like. That's not enough to configure the sensor;
> > > > > this is conveyed in the MSR space which indeed makes the sensor difficult
> > > > > to control using the CCS driver, unfortunately.
> > > >
> > > > Ok, the driver appears to be doing quite a bit of register writes outside
> > > > the register lists, which is good, and what's there appears indeed largely
> > > > CCS compliant. The MSRs remain an issue; it'd take quite a bit of reverse
> > > > engineering to figure out what the registers are and how to configure them
> > > > in a generic way. I think that's doable but I'm not sure it is justifiable
> > > > considering the expected effort.
> > > >
> > >
> > > I have deciphered a lot already since downstream provides only
> > > register writing sequences. Everything that left is 0x3xxx which seems
> > > to refer a vendor region and it is not documented anywhere.
> >
> > That's what I'd expect, too, with the possible exception of the datasheet,
> > but even sensor datasheets often omit a lot of information.
> >
> 
> There is no commonly available datasheet for this model. From what I
> have seen from similar models, 0x3xxx is vendor region and as you said
> "datasheets often omit a lot of information" which is the case.
> 
> > I believe you're already aware of
> > <URL:https://www.mipi.org/specifications/camera-command-set>?
> >
> 
> Yes, but since this module is from pre-CCS era or was created right
> before this standard was introduced, the module lacks a quite a bit of
> registers and configurations required by CCS. Keep in mind that sensor
> is used in the phone from 2012.

Ah, I wasn't aware it was that old. ;) Well, there was another driver
merged recently which was for a sensor from 2014.

-- 
Sakari Ailus
Re: [PATCH v1 0/2] media: i2c: add Sony IMX111 CMOS camera sensor driver
Posted by Svyatoslav Ryhel 5 months, 1 week ago
чт, 28 серп. 2025 р. о 19:12 Sakari Ailus <sakari.ailus@linux.intel.com> пише:
>
> Hi Svyatoslaw,
>
> On Tue, Aug 19, 2025 at 03:04:25PM +0300, Svyatoslav Ryhel wrote:
> > Add driver for Sony IMX111 CMOS sensor found in LG Optimus 4X and Vu
> > smartphones.
>
> Thanks for the set.
>
> I wonder how would the sensor work with the CCS driver. The register layout
> appears to be very much aligned with that (I haven't checked whether there
> are MSRs that depend on the mode).
>

It seems to be compatible, moreover, I have a few modules which should
be compatible as well. If you had not answer I might never found this
driver, maybe you, as its maintainer, could consider adding module
names into compatible with fallback to mipi-ccs? Something like

compatible =  "sony,imx111", "mipi-ccs-1.0";

This would allow more people find this driver by grepping their sensor
model through source and reflect hardware installed in the device
better.

> --
> Kind regards,
>
> Sakari Ailus