- Mar 28, 2023
-
-
Alexander Stein authored
Should be upstream commit 783ecfe5556a The imx290 driver can be used for both imx290 and imx327 as they have a similar register set and configuration. imx327 lacks 8 lanes LVDS and 120 FPS support. Signed-off-by:
Alexander Stein <alexander.stein@ew.tq-group.com> Acked-by:
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by:
Sakari Ailus <sakari.ailus@linux.intel.com>
-
Dave Stevenson authored
Should be upstream commit f0c720ff2d21 The IMX290 module is available as either monochrome or colour and the variant is not detectable at runtime. Add a new compatible string for the monochrome version, based on the full device name IMX290LLR. For consistency, add a new compatible string for the colour version based on the IMX290LQR full device name, and deprecate the current ambiguous compatible string. Signed-off-by:
Dave Stevenson <dave.stevenson@raspberrypi.com> Acked-by:
Rob Herring <robh@kernel.org> Reviewed-by:
Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by:
Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by:
Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by:
Sakari Ailus <sakari.ailus@linux.intel.com>
-
Laurent Pinchart authored
Upstream commit a96dfea1 Convert the Sony IMX290 DT binding from text to YAML. Add Manivannan as a maintainer given that he is listed in MAINTAINERS for the file, as volunteering myself. The name of the input clock, "xclk", is wrong as the hardware manual names it INCK. As the device has a single clock, the name could be omitted, but that would require a corresponding change to the driver and is thus a candidate for further patches. Signed-off-by:
Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by:
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by:
Sakari Ailus <sakari.ailus@linux.intel.com>
-
Dave Stevenson authored
Signed-off-by:
Dave Stevenson <dave.stevenson@raspberrypi.com>
-
Laurent Pinchart authored
Upstream commit 05ef7ec4 Check the error status returned by imx290_set_data_lanes() in its caller and propagate it. Signed-off-by:
Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by:
Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by:
Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Laurent Pinchart authored
Upstream commit 76c00128 There's no need to check for an incorrect number of data lanes in imx290_set_data_lanes() as the value is validated at probe() time. Drop the check. The PHY_LANE_NUM and CSI_LANE_MODE registers are programmed with a value equal to the number of lanes minus one. Compute it instead of handling it in the switch/case. Signed-off-by:
Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by:
Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by:
Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Laurent Pinchart authored
Upstream commit 7d399658 There's no need to configure the data lanes in the runtime PM resume handler. Do so in imx290_start_streaming() instead. Signed-off-by:
Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by:
Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by:
Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Laurent Pinchart authored
Upstream commit 02852c01 Initializing the subdev before runtime PM means that no subdev initialization can interact with the runtime PM framework. This can be problematic when modifying controls, as the .s_ctrl() handler commonly calls pm_runtime_get_if_in_use(). These code paths are not trivial, making the driver fragile and possibly causing subtle bugs. To make the subdev initialization more robust, initialize runtime PM first. Signed-off-by:
Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by:
Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by:
Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Laurent Pinchart authored
Upstream commit a8c3e0c1 Use runtime PM autosuspend to avoid powering off the sensor during fast stop-reconfigure-restart cycles. This also fixes runtime PM handling in the probe function that didn't suspend the device, effectively leaving it resumed forever. While at it, improve documentation of power management in probe() and remove(). Signed-off-by:
Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by:
Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by:
Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Laurent Pinchart authored
Upstream commit 10591fe6 The imx290_pixfmt structure contains information about formats, currently limited to the bpp value. Extend it with the register settings for each format, and rename it to imx290_format_info to make its purpose clearer. Add a function named imx290_format_info() to look up format info for a media bus code, and use it through the code. This allows dropping the imx290 bpp field as the value is now looked up dynamically. The error handling in imx290_setup_format() can also be dropped, as the format is guaranteed by imx290_set_fmt() to be valid. Signed-off-by:
Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by:
Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by:
Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Laurent Pinchart authored
Upstream commit a2514b9a Use the V4L2 subdev active state API to store the active format. This simplifies the driver not only by dropping the imx290 current_format field, but it also allows dropping the imx290 lock, replaced with the state lock. The lock check in imx290_ctrl_update() can be dropped as imx290_set_fmt() can't be called anywmore with which set to ACTIVE before controls are initialized. Signed-off-by:
Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by:
Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by:
Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Laurent Pinchart authored
Upstream commit e5d363ca Move the external clock initialization code from probe() to a separate function to improve readability. No functional change intended. Signed-off-by:
Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by:
Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by:
Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Laurent Pinchart authored
Upstream commit 63127235 Improve error handling in the probe() function with dev_err_probe(). Signed-off-by:
Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by:
Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by:
Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Laurent Pinchart authored
Upstream commit 6b69c522 Make the probe() function more readable by factoring out the DT parsing code to a separate function. No functional change intended. Signed-off-by:
Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by:
Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by:
Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Laurent Pinchart authored
Upstream commit ee4ce893 The black level programmed in the BLKLEVEL register depends on the output format. The black level value computation is currently performed in imx290_set_ctrl(), in addition to having different black level values in the output-specific register value tables. Move it to a separate function to simplify the imx290_set_ctrl() code. Signed-off-by:
Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by:
Alexander Stein <alexander.stein@ew.tq-group.com> Reviewed-by:
Dave Stevenson <dave.stevenson@raspberrypi.com> Signed-off-by:
Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Laurent Pinchart authored
Upstream commit 693b5cb5 The hblank, vblank, pixel rate and link frequency values and limits are currently computed when creating controls, in imx290_ctrl_init(), and updated in imx290_ctrl_update(). This duplicates the logic in different places. Simplify the code by setting the control values and limits to hardcoded values when creating the controls, and call imx290_ctrl_update() to then update them. Signed-off-by:
Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by:
Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by:
Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Laurent Pinchart authored
Upstream commit 31b54a42 Avoid accessing the imx290 current_format and current_mode fields in imx290_calc_pixel_rate() to prepare for the removal of those fields. Among the two callers of the function, imx290_ctrl_update() has an explicit mode pointer already, and we can also give it a format pointer. Use those explicitly. While at it, inline the imx290_get_link_freq() function in imx290_calc_pixel_rate() as it is only called there. Signed-off-by:
Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by:
Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by:
Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Laurent Pinchart authored
Upstream commit 70bbf56a The imx290_get_link_freq_index() function hides the fact that it relies on the imx290 current_mode field, which obfuscates the code instead of making it more readable. Inline it in the callers, and use the mode pointer we already have in imx290_ctrl_update() instead of using the current_mode field. Signed-off-by:
Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by:
Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by:
Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Laurent Pinchart authored
Upstream commit a7941da3 Move the control update code to a separate function to group it with all the control-related code and make imx290_set_fmt() more readable. Signed-off-by:
Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by:
Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by:
Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Laurent Pinchart authored
Upstream commit dfb704da . The probe() function is large. Make it more readable by factoring the subdev initialization code out. While at it, rename the error labels as the "free_" prefix isn't accurate. No functional change intended. Signed-off-by:
Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by:
Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by:
Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Laurent Pinchart authored
Upstream commit cb7e1c8d Move functions around to group them in logical sections, in order to improve readability. As a result, the IMX290_NUM_SUPPLIES macro has to be changed. No other code change is included, only moves. Signed-off-by:
Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by:
Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by:
Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
-
Laurent Pinchart authored
Upstream commit 3dd10515 The IMX290 gain register controls the analogue gain. Replace the V4L2_CID_GAIN control with V4L2_CID_ANALOGUE_GAIN. Signed-off-by:
Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by:
Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by:
Sakari Ailus <sakari.ailus@linux.intel.com>
-
Laurent Pinchart authored
Upstream commit b4ab57b0 . Implement read-only access to crop selection rectangles to expose the analogue crop rectangle. The public (leaked) IMX290 documentation is not very clear on how cropping is implemented and configured exactly, so the margins may not be entirely accurate. Signed-off-by:
Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by:
Sakari Ailus <sakari.ailus@linux.intel.com>
-
Laurent Pinchart authored
Upstream commit b25537ef The driver duplicates the same pattern to access the try or active format in multiple locations. Factor it out to a separate function. Signed-off-by:
Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by:
Sakari Ailus <sakari.ailus@linux.intel.com>
-
Laurent Pinchart authored
Upstream commit 0b274ef2 . Registers 0x3012, 0x3013 and 0x3480 are not documented and are set in the per-mode register arrays with values indentical for all modes. Move them to the common array. Signed-off-by:
Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by:
Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by:
Sakari Ailus <sakari.ailus@linux.intel.com>
-
Laurent Pinchart authored
Upstream commit 4c9c93cf . Create the V4L2_CID_ORIENTATION and V4L2_CID_ROTATION controls to expose the corresponding fwnode properties. Signed-off-by:
Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by:
Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by:
Sakari Ailus <sakari.ailus@linux.intel.com>
-
Laurent Pinchart authored
Upstream commit 0c3b56c9 . Add support for the V4L2_CID_HBLANK and V4L2_CID_VBLANK controls to the imx290 driver. Make the controls read-only to start with, to report the values to userspace for timing calculation. Signed-off-by:
Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by:
Sakari Ailus <sakari.ailus@linux.intel.com>
-
Laurent Pinchart authored
Upstream commit 72c87b7a . The imx290_probe() function is too large. Split control initialzation to a dedicated function to increase code readability. Signed-off-by:
Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by:
Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by:
Sakari Ailus <sakari.ailus@linux.intel.com>
-
Laurent Pinchart authored
Upstream commit 6d7a87f2 . The gain is expressed in multiple of 0.3dB, as a value between 0.0dB and 72.0dB. Gains between 0.0dB and 30.0dB (included) apply analog gain only, higher gains from 30.3dB to 72dB apply additional digital gain. The maximum gain value is erroneously set to 72. Increase it to 100 to cover the whole analog gain range. Support for digital gain can be added separately if needed. The IMX327 and IMX462 are largely compatible with the IMX290, but have an analog gain range of 0.0dB to 29.4dB and 42dB of digital gain. When support for those sensors gets added to the driver, the gain control should be adjusted accordingly. Signed-off-by:
Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by:
Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by:
Sakari Ailus <sakari.ailus@linux.intel.com>
-
Laurent Pinchart authored
Upstream commit 827c7e69 . Support configuring the exposure time, which is expressed as the complement of the exposure time (frame period minus integration time). The frame period is currently fixed. Signed-off-by:
Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by:
Alexander Stein <alexander.stein@ew.tq-group.com> Reviewed-by:
Dave Stevenson <dave.stevenson@raspberrypi.com> Signed-off-by:
Sakari Ailus <sakari.ailus@linux.intel.com>
-
Laurent Pinchart authored
Upstream commit 79d99ae8 . Define macros for all registers programmed by the driver for which documentation is available to increase readability. This starts making use of 16-bit registers in the register arrays, so the value field has to be increased to 32 bits. Signed-off-by:
Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by:
Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by:
Sakari Ailus <sakari.ailus@linux.intel.com>
-
Laurent Pinchart authored
Upstream commit e611f3da . Error handling for register writes requires checking the error status of every single write. This makes the code complex, or incorrect when the checks are omitted. Simplify this by passing a pointer to an error code to the imx290_write_reg() function, which allows writing multiple registers in a row and only checking for errors at the end. While at it, rename imx290_write_reg() to imx290_write() as there's nothing else than registers to write, and rename imx290_read_reg() accordingly. Signed-off-by:
Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by:
Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by:
Sakari Ailus <sakari.ailus@linux.intel.com>
-
Laurent Pinchart authored
Upstream commit 454a86f3 . Define registers with the appropriate size, using the variable-size register access mechanism that has just been introduced. This simplifies the code. Signed-off-by:
Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by:
Sakari Ailus <sakari.ailus@linux.intel.com>
-
Laurent Pinchart authored
Upstream commit e70abe88 . The IMX290 has registers of different sizes. To simplify the code, handle this in the read/write functions instead of in the callers by encoding the register size in the symbolic name macros. All registers are defined as 8-bit for now, a subsequent change will move to larger registers where applicable. Signed-off-by:
Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by:
Sakari Ailus <sakari.ailus@linux.intel.com>
-
Laurent Pinchart authored
Upstream commit 72825bc6 . The HMAX value specifies the total line length in pixels. It's thus more readable in decimal than hexadecimal. Fix it. Signed-off-by:
Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by:
Sakari Ailus <sakari.ailus@linux.intel.com>
-
Laurent Pinchart authored
Upstream commit 72e4bf6d . Only two registers are ever read, and once only. There's no need to cache values. Signed-off-by:
Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by:
Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by:
Sakari Ailus <sakari.ailus@linux.intel.com>
-
Laurent Pinchart authored
Upstream commit b817888a . The imx290_write_buffered_reg() function wraps a register write with register hold, to enable changing multiple registers synchronously. It is used for the gain only, which is an 8-bit register, defeating its purpose. The feature is useful, but should be implemented differently. Drop the function for now, to prepare for a rework of register access. Signed-off-by:
Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by:
Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by:
Sakari Ailus <sakari.ailus@linux.intel.com>
-
Laurent Pinchart authored
Upstream commit 2548df53 . Use ARRAY_SIZE(imx290->supplies) for code that needs the size of the array, instead of relying on the IMX290_NUM_SUPPLIES. The result is less error-prone as it ties the size to the array. Signed-off-by:
Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by:
Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by:
Sakari Ailus <sakari.ailus@linux.intel.com>
-
Laurent Pinchart authored
Upstream commit fbe0a89d . Knowing why I2C transfers fail is useful for debugging. Extend the error message to print the error code. Signed-off-by:
Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by:
Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by:
Sakari Ailus <sakari.ailus@linux.intel.com>
-
Laurent Pinchart authored
Upstream commit 08878cbc . The link frequency and pixel rate controls are set without holding the control handler lock, resulting in kernel warnings. As the value of those controls depend on the format, the simplest fix is to use the device lock for the control handler. Signed-off-by:
Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by:
Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by:
Sakari Ailus <sakari.ailus@linux.intel.com>
-