Repository navigation
Conversation
Add bindings for the AMSOSRAM Mira220 image sensor. Acked-by: Conor Dooley <conor.dooley@microchip.com> Signed-off-by: Philippe Baetens <philippebaetens@gmail.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Update the Mira220 driver to the version sent upstream for inclusion in Linux v7.5. The driver is available in the linux-media committers tree in the next branch: https://gitlab.freedesktop.org/linux-media/media-committers/-/commit/d71751a7f67ffd31b78b0e93c5510f6d6810ee43 Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Add bindings for the ams OSRAM Mira016 image sensor. Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Acked-by: Conor Dooley <conor.dooley@microchip.com>
Add driver for the ams OSRAM Mira016 sensor. Backport the driver from the version sent for upstream inclusion in Linux v7.5. The driver is available the linux-media committers tree in the next branch: https://gitlab.freedesktop.org/linux-media/media-committers/-/commit/ab4a4c39c611a8fdf6fe20558186e8aa61e7c3b2 Reviewed-by: Tarang Raval <tarang.raval@siliconsignals.io> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Update dts overlays for the Mira220 image sensor. Remove a few stray blank lines, the unused gpio.h inclusion and add an overlay for the regulator node, to specify the startup and ramp-down delays and allow to fully support connecting the camera to the 'cam0' connector. Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Add overlays for AMS-OSRAM Mira016 image sensor. Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
71d09c3 to
f979626
Compare
| cam0-mira016 = <&mux_in0>, "remote-endpoint:0=",<&mira016_0_ep>, | ||
| <&mira016_0_ep>, "remote-endpoint:0=",<&mux_in0>, | ||
| <&mux_in0>, "clock-noncontinuous?", | ||
| <&mira016_0>, "status=okay"; |
There was a problem hiding this comment.
Mira016 only supports a single data lane, I'm not sure how I should specify it here..
There was a problem hiding this comment.
Copy ov7251 which also only supports a single data lane.
<0>,"+102-103";
There was a problem hiding this comment.
AH thanks, I wasn't familiar with that syntax and searching around for data-lanes didn't help.
I've updated the MR.
The last item I'm not sure about is Mira016 only supports clock-noncontinuous so I'm not sure if the ? in
<&mux_in0>, "clock-noncontinuous?",
is correct
There was a problem hiding this comment.
Theoretically somebody could write "dtoverlay=...,cam0-mira016=off" which would delete clock-noncontinuous (it is unlikely though). But if you have a constant value, embed it in one of the fragments (which you have) and don't mention it in the parameter declarations.
There was a problem hiding this comment.
ah, if the "clock-noncontinuous?" syntax is conditional to the presence of clock-noncontinuous in the sensor's endpoint, I think we should be fine then ? Otherwise should I simply remove ? from
<&mux_in0>, "clock-noncontinuous?",
?
There was a problem hiding this comment.
<&mux_in0>, "clock-noncontinuous?" means set or clear the boolean (?) property clock-noncontinuous on the node with label mux_in0 based on the value given to the parameter. A parameter used without a value is treated as if it was given the value 1/true/on/okay. But because we don't want the value of the boolean to change, just delete that part of the parameter declaration, as you guessed.
There was a problem hiding this comment.
sorry, this is dragging for longer than expected: should I also add a fragment like
fragment@108 {
target = <&mux_in0>;
__dormant__ {
clock-noncontinuous;
};
};
(and 109, 110 and 111 for the other mux input ports)
and refer to it in the sensor node like I've done for data-lanes ?
<&mira016_0_ep>, "remote-endpoint:0=",<&mux_in0>,
<&mira016_0>, "status=okay",
<0>,"+100-101",
<0>,"+108";
There was a problem hiding this comment.
So it needs the flag on both ends? You could just leave the parameter as it was - the same syntax is used for plenty of other cameras.
The simplest change to guarantee the property exists is to include a literal assignment:
<&mux_in0>, "clock-noncontinuous?=0",
but I'm not convinced it's worth the effort.
There was a problem hiding this comment.
So it needs the flag on both ends? You could just leave the parameter as it was - the same syntax is used for plenty of other cameras.
I think when it comes to the actual physical link protocol it is the transmitter side that optionally operates the clock in non-cont mode and the receiver adjusts to it.
The unicam dts bindings however allow for the property to be specified
Documentation/devicetree/bindings/media/brcm,bcm2835-unicam.yaml: clock-noncontinuous: true
and the driver actually uses it
/* Enable clock lane and set up terminations */
val = 0;
if (unicam->bus_type == V4L2_MBUS_CSI2_DPHY) {
/* CSI2 */
unicam_set_field(&val, 1, UNICAM_CLE);
unicam_set_field(&val, 1, UNICAM_CLLPE);
if (!(unicam->bus_flags & V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK)) {
unicam_set_field(&val, 1, UNICAM_CLTRE);
unicam_set_field(&val, 1, UNICAM_CLHSE);
}
Maybe @6by9 has some insights here ?
The simplest change to guarantee the property exists is to include a literal assignment:
<&mux_in0>, "clock-noncontinuous?=0",but I'm not convinced it's worth the effort.
Neither am I but let's first clarify the property is required in the receiver node as well
There was a problem hiding this comment.
This is one of the bits I think DRM has got right for DSI, and V4L2 isn't as great.
If the link is operated in continuous clock mode, then the source needs to know in order to set the appropriate registers.
The receiver also needs to know, as it has to engage the HS termination resistors on the clock lane at all times, and not look for LP<->HS transitions to control them. See https://download.tek.com/document/61W_25772_0_HR.pdf for an intro to MIPI D-PHY and what happens in those transitions.
There is get_mbus_config available through the subdev API which can set the number of lanes and the flags, but the maintainers say that should only be used if the source changes the configuration dynamically (eg tc358743), not to pass the configuration from source to receiver normally. If the configuration is static we have to have the information duplicated in DT/ACPI at both ends of the link :-(
The video-mux has to implement get_mbus_config as the different inputs to the mux can have different bus parameters, so it is actually the input pads to the mux that matter rather than those on Unicam/CFE. That's a downstream patch as any discussion of video-mux upstream generally ends up being that it needs to be rewritten to work in a different manner using (IIRC) the streams API, except that still isn't fully merged.
Yes, a literal assignment in the dt override would probably be the better approach here.
DRM by contrast passes a struct mipi_dsi_device from sink to transmitter to configure the number of lanes, modes, etc, so configuration comes from one place.
| <&mira016_0>, "status=okay"; | ||
| cam0-mira220 = <&mux_in0>, "remote-endpoint:0=",<&mira220_0_ep>, | ||
| <&mira220_0_ep>, "remote-endpoint:0=",<&mux_in0>, | ||
| <&mira220_0>, "status=okay"; |
There was a problem hiding this comment.
Mira220 only supports continuous clock, that's why I removed the
<&mux_in0>, "clock-noncontinuous?",
line from here.
|
The 4port overlay is missing the clk_38mhz declaration, but otherwise the checker is happy with it. I'll also give it a read through. |
fixed, sorry for missing it |
f979626 to
6dfd6cd
Compare
No apology needed. Thank you for the contribution. |
Add Mira016 and Mira220 to the camera-mux 2 and 4 ports overlays and update the README file accordingly. Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
The analogue gain control is created with a 1..1 range, which is only valid for the 12-bit format, while init_state applies the 8-bit format. The gain cannot be changed until userspace sets the active format. Make the 12-bit format the default, and initialise row_length to the matching value so the blanking, pixel rate and exposure limits are computed for it. The issue was found by code inspection with an LLM, build tested only. Signed-off-by: David Carlier <devnexen@gmail.com> Acked-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
The analogue gain handling is currently modeled using tables that
contains the values of the three registers that control the gain
(ADC_GAIN, RG_MULT and GDIG_PREAMP).
The undelying gain model has been characterized as
analogue_gain = 57 * 2^(2 - RG_MULT) / (ADC_GAIN + 21)
In 8-bits mode the output of the 10-bit ADC is scaled to 8-bit allowing
an additional 4x digital gain, for a total achievable 16x gain, compared
to the 4x available in 10-bits mode.
Implement the calculation of the [ADC_GAIN, RG_MULT, GDIG_PREAMP]
registers values in mira016_fine_gain() and remove the tables.
The expected gain code is the desired gain value multiplied by 1000 to
perform all calculations with integers arithmetic.
Signed-off-by: Philippe Baetens <philippebaetens@gmail.com>
Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Slightly adjust the 8-bits mode gain init sequence. Register 0xe024 controls the additional digital gain only available in 8-bits mode. Initialize it to the unit 1x value. Also adjut the 0x005d register that controls the desired black level pedestal to the 8-bits default value of 0x06. Signed-off-by: Philippe Baetens <philippebaetens@gmail.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
6dfd6cd to
7410c16
Compare
The Mira220 and Mira016 sensor drivers are on their way to Linux v7.5
Mira220 was already in the RaspberryPi BSP, while Mira016 was not.
Update the Mira220 driver in the RaspberryPi BSP to match the mainline version and introduce Mira016 by applying the patches sent to linux-media for v7.5.
The libcamera PR that updates Mira220 support and add Mira016 will follow soon.