| Message ID | 20260908084544.274613-2-sam.legros@gmail.com |
|---|---|
| State | New |
| Headers | show |
| Series |
|
| Related | show |
Hi Samuel, Quoting Samuel LEGROS (2026-09-08 09:45:44) > Add the camera sensor properties and camera sensor helper entries for the > Sony IMX363, the rear sensor of the Google Pixel 3 and Pixel 3a. > > Values were taken from the driver and confirmed on a Pixel 3a running > postmarketOS (imx363 3-001a): I don't see any driver support for the imx363 in the linux kernel: https://lore.kernel.org/all/?q=imx363 has some close matches for some dt additions but not the driver work. Is there work in progress to get this driver upstream? -- Regards Kieran > > - The pixel array is 4032x3024 within a 4048x3168 native area, and the > sensor is a 12.2 MP type 1/2.55" part, giving a 1.4 um pixel pitch > (4032 * 1.4 um = 5.64 mm across). > > - The driver exposes the same test pattern menu as the IMX258 and the > IMX355: > > static const char * const imx363_test_pattern_menu[] = { > "Disabled", > "Solid Colour", > "Eight Vertical Colour Bars", > "Colour Bars With Fade to Grey", > "Pseudorandom Sequence (PN9)", > }; > > - Analogue gain is written to ANALOG_GAIN_GLOBAL (0x0204) and ranges from > 0 to 480, the same limit as the IMX258, which corresponds to the > 512/(512 - x) gain model and a 16x maximum. The IMX355 uses the same > formula scaled to 1024 with a limit of 960. > > - The black level follows the value documented for the sibling sensors, > 0x40 at 10 bits. > > Signed-off-by: Samuel LEGROS <sam.legros@gmail.com> > --- > src/ipa/libipa/camera_sensor_helper.cpp | 12 ++++++++++++ > .../sensor/camera_sensor_properties.cpp | 16 ++++++++++++++++ > 2 files changed, 28 insertions(+) > > diff --git a/src/ipa/libipa/camera_sensor_helper.cpp b/src/ipa/libipa/camera_sensor_helper.cpp > index 82bf255..c3ae412 100644 > --- a/src/ipa/libipa/camera_sensor_helper.cpp > +++ b/src/ipa/libipa/camera_sensor_helper.cpp > @@ -629,6 +629,18 @@ public: > }; > REGISTER_CAMERA_SENSOR_HELPER("imx355", CameraSensorHelperImx355) > > +class CameraSensorHelperImx363 : public CameraSensorHelper > +{ > +public: > + CameraSensorHelperImx363() > + { > + /* From datasheet: 0x40 at 10bits. */ > + blackLevel_ = 4096; > + gain_ = AnalogueGainLinear{ 0, 512, -1, 512 }; > + } > +}; > +REGISTER_CAMERA_SENSOR_HELPER("imx363", CameraSensorHelperImx363) > + > class CameraSensorHelperImx415 : public CameraSensorHelper > { > public: > diff --git a/src/libcamera/sensor/camera_sensor_properties.cpp b/src/libcamera/sensor/camera_sensor_properties.cpp > index ecf523c..10095f2 100644 > --- a/src/libcamera/sensor/camera_sensor_properties.cpp > +++ b/src/libcamera/sensor/camera_sensor_properties.cpp > @@ -281,6 +281,22 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen > .hblankDelay = 2 > }, > } }, > + { "imx363", { > + .unitCellSize = { 1400, 1400 }, > + .testPatternModes = { > + { controls::draft::TestPatternModeOff, 0 }, > + { controls::draft::TestPatternModeSolidColor, 1 }, > + { controls::draft::TestPatternModeColorBars, 2 }, > + { controls::draft::TestPatternModeColorBarsFadeToGray, 3 }, > + { controls::draft::TestPatternModePn9, 4 }, > + }, > + .sensorDelays = { > + .exposureDelay = 2, > + .gainDelay = 2, > + .vblankDelay = 2, > + .hblankDelay = 2 > + }, > + } }, > { "imx415", { > .unitCellSize = { 1450, 1450 }, > .testPatternModes = {}, > -- > 2.53.0 >
Hi Kieran, Thanks for looking at this so quickly. Le mar. 8 sept. 2026 à 12:25, Kieran Bingham <kieran.bingham@ideasonboard.com> a écrit : > > [...] > > Quoting Samuel LEGROS (2026-09-08 09:45:44) > > Add the camera sensor properties and camera sensor helper entries for the > > Sony IMX363, the rear sensor of the Google Pixel 3 and Pixel 3a. > > > > Values were taken from the driver and confirmed on a Pixel 3a running > > postmarketOS (imx363 3-001a): > > > I don't see any driver support for the imx363 in the linux kernel: > > https://lore.kernel.org/all/?q=imx363 > [...] You are right, and I should have been explicit about it in the commit message. It comes from the driver that lives in the sdm670-mainline tree : https://gitlab.com/sdm670-mainline/linux and originates from the sdm845-mainline work done for the Pocophone F1, which shares the sensor. postmarketOS ships it as a module. What is worth noting is the authorship the module declares: author: Yeh, Andy <andy.yeh@intel.com> author: Chiang, Alan author: Chen, Jason description: Sony IMX363 sensor driver license: GPL v2 Those are the same authors as imx355 and imx258, both of which did make it upstream. The imx363 looks like the one sibling of that Intel series that was never submitted, rather than an out-of-tree driver written from scratch. It is also not stale: it links against v4l2_cci on the device here, so it has been carried forward onto the current kernel API rather than frozen at its original form. I have no standing to speak for that tree, so I would rather ask than assume: what is libcamera's policy for sensor properties whose kernel driver is not upstream yet? If the preference is to wait until the driver lands in mainline, I am happy for this patch to be parked or dropped, and I can resend it when that happens. One request either way: patch 1/2 is unrelated to any of this. It fixes an inverted test pattern mapping in the existing imx355 entry, where TestPatternModeColorBars and TestPatternModeSolidColor are swapped relative to what the driver exposes, verified with v4l2-ctl on the device. It would be a shame for that one to be held up by the imx363 discussion. Thanks,
On Tue, Sep 08, 2026 at 01:47:33PM +0200, Sam Gnu wrote: > Hi Kieran, > Thanks for looking at this so quickly. > > Le mar. 8 sept. 2026 à 12:25, Kieran Bingham a écrit : > > > > [...] > > > > Quoting Samuel LEGROS (2026-09-08 09:45:44) > > > Add the camera sensor properties and camera sensor helper entries for the > > > Sony IMX363, the rear sensor of the Google Pixel 3 and Pixel 3a. > > > > > > Values were taken from the driver and confirmed on a Pixel 3a running > > > postmarketOS (imx363 3-001a): > > > > > > I don't see any driver support for the imx363 in the linux kernel: > > > > https://lore.kernel.org/all/?q=imx363 > > [...] > > You are right, and I should have been explicit about it in the commit message. > It comes from the driver that lives in the sdm670-mainline tree : > https://gitlab.com/sdm670-mainline/linux > and originates from the sdm845-mainline work done for the Pocophone > F1, which shares the sensor. postmarketOS ships it as a module. > > What is worth noting is the authorship the module declares: > author: Yeh, Andy <andy.yeh@intel.com> > author: Chiang, Alan > author: Chen, Jason > description: Sony IMX363 sensor driver > license: GPL v2 > > Those are the same authors as imx355 and imx258, both of which did > make it upstream. > The imx363 looks like the one sibling of that Intel series that was > never submitted, rather than an out-of-tree driver written from > scratch. > It is also not stale: it links against v4l2_cci on the device here, so > it has been carried forward onto the current kernel API rather than > frozen at its original form. > > I have no standing to speak for that tree, so I would rather ask than > assume: what is libcamera's policy for sensor properties whose kernel > driver is not upstream yet? > If the preference is to wait until the driver lands in mainline, I am > happy for this patch to be parked or dropped, and I can resend it when > that happens. Our policy is that the kernel driver must be on its way to upstream with a reasonable chance to be merged in a not too distant future. It needs to be posted to the linux-media mailing list and be in a reasonable shape, with active work to address review comments. > One request either way: patch 1/2 is unrelated to any of this. > It fixes an inverted test pattern mapping in the existing imx355 > entry, where TestPatternModeColorBars and TestPatternModeSolidColor > are swapped relative to what the driver exposes, verified with > v4l2-ctl on the device. > It would be a shame for that one to be held up by the imx363 discussion. The two can be handled separately, there's no issue there.
Le mar. 8 sept. 2026 à 16:01, Laurent Pinchart <laurent.pinchart@ideasonboard.com> a écrit : > > On Tue, Sep 08, 2026 at 01:47:33PM +0200, Sam Gnu wrote: > > Hi Kieran, > > Thanks for looking at this so quickly. > > > > Le mar. 8 sept. 2026 à 12:25, Kieran Bingham a écrit : > > > > > > [...] > > > > > > Quoting Samuel LEGROS (2026-09-08 09:45:44) > > > > Add the camera sensor properties and camera sensor helper entries for the > > > > Sony IMX363, the rear sensor of the Google Pixel 3 and Pixel 3a. > > > > > > > > Values were taken from the driver and confirmed on a Pixel 3a running > > > > postmarketOS (imx363 3-001a): > > > > > > I don't see any driver support for the imx363 in the linux kernel: > > > > > > https://lore.kernel.org/all/?q=imx363 > > > [...] > > > > [...] > > If the preference is to wait until the driver lands in mainline, I am > > happy for this patch to be parked or dropped, and I can resend it when > > that happens. > > Our policy is that the kernel driver must be on its way to upstream with > a reasonable chance to be merged in a not too distant future. It needs > to be posted to the linux-media mailing list and be in a reasonable > shape, with active work to address review comments. > > > One request either way: patch 1/2 is unrelated to any of this. > > [...] > > The two can be handled separately, there's no issue there. > > Laurent Pinchart Hi Laurent, Thanks for the clear answer, that policy makes complete sense to me: the sensor properties are only useful if people can actually run the driver they describe. To answer Kieran's question explicitly, since I skipped it in my last message: no, as far as I know there is no work in progress to get the imx363 driver upstream. It has been carried in the sdm845 and sdm670-mainline trees for years without ever being posted to linux-media. Please consider patch 2/2 dropped for now. I will look into what it would take to get the driver posted, and I will resend the libcamera side with a link to that submission once it exists. Good to know that 1/2 can go on its own, thank you. On a personal note, this is my first contribution to libcamera, and I was a little nervous sending it. Getting prompt, patient and welcoming replies from both of you made it a really nice experience. Thank you for that, it is much appreciated.
diff --git a/src/ipa/libipa/camera_sensor_helper.cpp b/src/ipa/libipa/camera_sensor_helper.cpp index 82bf255..c3ae412 100644 --- a/src/ipa/libipa/camera_sensor_helper.cpp +++ b/src/ipa/libipa/camera_sensor_helper.cpp @@ -629,6 +629,18 @@ public: }; REGISTER_CAMERA_SENSOR_HELPER("imx355", CameraSensorHelperImx355) +class CameraSensorHelperImx363 : public CameraSensorHelper +{ +public: + CameraSensorHelperImx363() + { + /* From datasheet: 0x40 at 10bits. */ + blackLevel_ = 4096; + gain_ = AnalogueGainLinear{ 0, 512, -1, 512 }; + } +}; +REGISTER_CAMERA_SENSOR_HELPER("imx363", CameraSensorHelperImx363) + class CameraSensorHelperImx415 : public CameraSensorHelper { public: diff --git a/src/libcamera/sensor/camera_sensor_properties.cpp b/src/libcamera/sensor/camera_sensor_properties.cpp index ecf523c..10095f2 100644 --- a/src/libcamera/sensor/camera_sensor_properties.cpp +++ b/src/libcamera/sensor/camera_sensor_properties.cpp @@ -281,6 +281,22 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen .hblankDelay = 2 }, } }, + { "imx363", { + .unitCellSize = { 1400, 1400 }, + .testPatternModes = { + { controls::draft::TestPatternModeOff, 0 }, + { controls::draft::TestPatternModeSolidColor, 1 }, + { controls::draft::TestPatternModeColorBars, 2 }, + { controls::draft::TestPatternModeColorBarsFadeToGray, 3 }, + { controls::draft::TestPatternModePn9, 4 }, + }, + .sensorDelays = { + .exposureDelay = 2, + .gainDelay = 2, + .vblankDelay = 2, + .hblankDelay = 2 + }, + } }, { "imx415", { .unitCellSize = { 1450, 1450 }, .testPatternModes = {},
Add the camera sensor properties and camera sensor helper entries for the Sony IMX363, the rear sensor of the Google Pixel 3 and Pixel 3a. Values were taken from the driver and confirmed on a Pixel 3a running postmarketOS (imx363 3-001a): - The pixel array is 4032x3024 within a 4048x3168 native area, and the sensor is a 12.2 MP type 1/2.55" part, giving a 1.4 um pixel pitch (4032 * 1.4 um = 5.64 mm across). - The driver exposes the same test pattern menu as the IMX258 and the IMX355: static const char * const imx363_test_pattern_menu[] = { "Disabled", "Solid Colour", "Eight Vertical Colour Bars", "Colour Bars With Fade to Grey", "Pseudorandom Sequence (PN9)", }; - Analogue gain is written to ANALOG_GAIN_GLOBAL (0x0204) and ranges from 0 to 480, the same limit as the IMX258, which corresponds to the 512/(512 - x) gain model and a 16x maximum. The IMX355 uses the same formula scaled to 1024 with a limit of 960. - The black level follows the value documented for the sibling sensors, 0x40 at 10 bits. Signed-off-by: Samuel LEGROS <sam.legros@gmail.com> --- src/ipa/libipa/camera_sensor_helper.cpp | 12 ++++++++++++ .../sensor/camera_sensor_properties.cpp | 16 ++++++++++++++++ 2 files changed, 28 insertions(+)