summaryrefslogtreecommitdiff
path: root/drivers/media/i2c
AgeCommit message (Collapse)Author
10 daystreewide: Switch/rename to timer_delete[_sync]()Thomas Gleixner
timer_delete[_sync]() replaces del_timer[_sync](). Convert the whole tree over and remove the historical wrapper inlines. Conversion was done with coccinelle plus manual fixups where necessary. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@kernel.org>
2025-03-06media: i2c: tda1997x: Call of_node_put(ep) only once in tda1997x_parse_dt()Markus Elfring
An of_node_put(ep) call was immediately used after a return value check for a v4l2_fwnode_endpoint_parse() call in this function implementation. Thus call such a function only once instead directly before the check. This issue was transformed by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-03-06media: ccs-pll: Make variables const where appropriateLaurent Pinchart
Many functions operate on data structures that are read only, both in the implementation and by design. Mark them as const to increase readability and avoid future mistakes. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-03-06media: i2c: add lt6911uxe hdmi bridge driverDongcheng Yan
Lontium LT9611UXE is a HDMI to MIPI CSI-2 bridge. The device supports modes up to 4k@60fps, obtains the video information and switches the current mode once the video signal changes. Signed-off-by: Dongcheng Yan <dongcheng.yan@intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> [hverkuil: fix smatch warning: missing error code 'ret'] [hverkuil: fix coccinelle IRQF_ONESHOT warning]
2025-03-04media: ov08x40: Log chip ID when identifying the chipHans de Goede
Debug log the chip ID after successfully identifying the chip, this is useful to see if the identification is done on probe() time or if it is delayed till the first stream on. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-03-04media: ov08x40: Fix value of reset GPIO when requesting itHans de Goede
We should put/leave the sensor in reset when requesting the GPIO, after requesting it there are 2 possible scenarios and having the GPIO driven low is no good in either scenario: 1. The sensor was in ACPI D0 before probe() runs, in this case ov08x40_power_on() + ov08x40_identify_module() will run immediately after requesting the GPIO and ov08x40_power_on() starts with driving the GPIO high. So if the GPIO was already high it will very shortly be driven low, more of a spike to low then actually properly be driven low. Which may leave the sensor in a confused state. If we request the GPIO to be high at request time then power_on() will driver it high again (no-op) and then sleep for 1-2 ms, so no spike. 2. The sensor was in ACPI D3 / off before probe(), in this case probe() leaves the sensor alone. But when the sensor is off its reset line should be driven high not low. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-03-04media: imx335: Set vblank immediatelyPaul Elder
When the vblank v4l2 control is set, it does not get written to the hardware unless exposure is also changed. Change the behavior such that the vblank is written immediately when the control is set, as setting the vblank without changing the exposure is a valid use case (such as for changing the frame rate). Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-03-04media: i2c: ov9282: add AEC Manual register definitionRichard Leitner
Add #define's for the "AEC MANUAL" (0x3503) register and its values/flags. Use those in the registers single usage within the `common_regs` struct. All values are based on the OV9281 datasheet v1.01 (09.18.2015). Signed-off-by: Richard Leitner <richard.leitner@linux.dev> Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-03-04media: i2c: ov9282: use register definitionsRichard Leitner
For better readability use already available register definitions in hard-coded common and mode register structs. Signed-off-by: Richard Leitner <richard.leitner@linux.dev> Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-03-04media: vgxy61: Replace nested min() with single min3()Qasim Ijaz
Use min3() macro instead of nesting min() to simplify the return statement. Signed-off-by: Qasim Ijaz <qasdev00@gmail.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-03-04media: i2c: imx219: Only use higher LLP_MIN for binned resolutionsJai Luthra
The LLP_MIN of 3560 is only needed to fix artefacts seen with binned resolutions. As increasing the LLP reduces the highest possible framerate by ~3%, use the old default minimum of 3448 if we are not doing 2x2 analog binning. Also restore the fll_def value for non-binned modes in the modes definition to restore the default mode framerate to 30fps. Suggested-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Link: https://lore.kernel.org/linux-media/CAPY8ntC1-S6zKtDvmc6EgyxP+j6rTShuG8Dr8PKb9XQr2PeS_w@mail.gmail.com/ Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-03-04media: i2c: imx219: Use subdev state to calculate binning and pixelrateJai Luthra
The pixel rate and binning calculations need the format and resolution of the sensor, so pass the v4l2 subdev state directly instead of always operating on the active state. Suggested-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Link: https://lore.kernel.org/linux-media/sejl7xskif6rlpdsg3jhczjwe5gi6rs53ehbyka6omv2zeg7qq@4iis7i2lla5p/ Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-03-04media: i2c: imx219: Simplify binning modeJai Luthra
The imx219_get_binning() function currently returns two separate pieces of information, the return value is the binning mode enum, and the bin_h and bin_v references are updated with whether to perform binning in horizontal and vertical dimensions. It is simpler to combine both of these pieces of information, and directly update the bin_h and bin_v references with the register value that we will write to the sensor, which includes if the binning is digital or analog mode, thus allowing us to remove the superfluous binning mode enum. This is only a style change for the driver, with no functionality updated. Suggested-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Link: https://lore.kernel.org/linux-media/ubuuob7mb3o5bxoumrxv4rufutgk3lvdmdery6d3bfc6rytfti@tcchhlechzzp/ Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-03-04media: i2c: imx283: Drop runtime suspend/resume functionsTarang Raval
The imx283_runtime_suspend and imx283_runtime_resume functions simply call imx283_power_off and imx283_power_on, respectively. Since these functions do not add any additional logic, they are unnecessary and can be removed. Signed-off-by: Tarang Raval <tarang.raval@siliconsignals.io> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-03-04media: i2c: imx219: remove context around caseCosmin Tanislav
There are no longer variable declarations here, the context is useless. Signed-off-by: Cosmin Tanislav <demonsingur@gmail.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-03-04media: i2c: imx214: Fix uninitialized variable in imx214_set_ctrl()Dan Carpenter
You can't pass uninitialized "ret" variables to cci_write(). It has to start as zero. Fixes: 4f0aeba4f155 ("media: i2c: imx214: Convert to CCI register access helpers") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: André Apitzsch <git@apitzsch.eu> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-03-03media: v4l2-ctrls: add support for V4L2_CTRL_WHICH_MIN/MAX_VALHans Verkuil
Add the capability of retrieving the min and max values of a compound control. [Ricardo: Added static to v4l2_ctrl_type_op_(maximum|minimum) proto] [Ricardo: Fix documentation] Signed-off-by: Yunke Cao <yunkec@google.com> Tested-by: Yunke Cao <yunkec@google.com> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org> Link: https://lore.kernel.org/r/20250203-uvc-roi-v17-2-5900a9fed613@chromium.org Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> [hverkuil: fix small alignment checkpatch warning]
2025-02-25media: adv7180: Disable test-pattern control on adv7180Niklas Söderlund
The register that enables selecting a test-pattern to be outputted in free-run mode (FREE_RUN_PAT_SEL[2:0]) is only available on adv7280 based devices, not the adv7180 based ones. Add a flag to mark devices that are capable of generating test-patterns, and those that are not. And only register the control on supported devices. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-02-25media: hi556: remove redundant assignment to variable enableColin Ian King
The variable enable is being assigned a value that is never read afterwards. The assignment is redundant and can be removed. Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-02-25media: tc358746: fix locking issueMatthias Fend
In tc358746_link_validate() an attempt is made to get the state lock of the subdev, but since this is already held by the calling function v4l2_subdev_link_validate(), this leads to a deadlock. Another problem is that this function queries the link frequency of the source device. Since some image sensors use the lock of the v4l2 control handler as a state lock, which is already held at this point, a deadlock can also occur here. Move the calculation of the FIFO size from tc358746_link_validate() to tc358746_apply_misc_config() to avoid the deadlocks mentioned. Signed-off-by: Matthias Fend <matthias.fend@emfend.at> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-02-25media: tc358746: improve calculation of the D-PHY timing registersMatthias Fend
When calculating D-PHY registers, using data rates that are not multiples of 16 can lead to precision loss in division operations. This can result in register values that produce timing violations against the MIPI standard. An example: cfg->hs_clk_rate = 294MHz hf_clk = 18 If the desired value in cfg->init is 100us, which is the minimum allowed value, then the LINEINITCNT register is calculated as 1799. But since the actual clock is 18.375MHz instead of 18MHz, this setting results in a time that is shorter than 100us and thus violates the standard. The correct value for LINEINITCNT would be 1837. Improve the precision of calculations by using Hz instead of MHz as unit. Signed-off-by: Matthias Fend <matthias.fend@emfend.at> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-02-25media: tc358746: add support for 8/10/12/14-bit RAW Bayer formatsMatthias Fend
The TC358746 supports RAW formats with 8, 10, 12, and 14-bit depths. Since pixel data is transported transparently without modifying the pixel arrangement, all Bayer patterns (RGGB, BGGR, GRBG, GBRG) are supported. Signed-off-by: Matthias Fend <matthias.fend@emfend.at> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-02-21media: i2c: adv748x: Fix test pattern selection maskNiklas Söderlund
The mask to select the test-pattern in register ADV748X_SDP_FRP is incorrect, it's the lower 3 bits which controls the pattern. The GENMASK() macro is used incorrectly and the generated mask is 0x0e instead of 0x07. The result is that not all test patterns are selectable, and that in some cases the wrong test pattern is activated. Fix this by correcting the GENMASK(). Fixes: 3e89586a64df ("media: i2c: adv748x: add adv748x driver") Cc: stable@vger.kernel.org Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> [hverkuil: fixed tiny typo in commit log: my -> by]
2025-02-21media: video-i2c: Use HWMON_CHANNEL_INFO macro to simplify codeHuisong Li
Use HWMON_CHANNEL_INFO macro to simplify code. Signed-off-by: Huisong Li <lihuisong@huawei.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-02-18media: adv7511-v4l2: add support for the EEODBHans Verkuil
Support the HDMI Forum EDID Extension Override Data Block by using the new v4l2_num_edid_blocks helper function. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2025-02-15media: dw9719: Add DW9761 supportHans de Goede
Add support for the DW9761 VCM controller, which is very similar to the DW9719. The new support is based on drivers/external_drivers/camera/drivers/media/i2c/micam/dw9761.c from the Xiaomi kernel sources for the Mi Pad 2. The DW9761 support has been tested on a Xiaomi Mi Pad 2 tablet and DW9719 support has been tested (to avoid regressions) on a Microsoft Surface Go tablet. Link: https://github.com/MiCode/Xiaomi_Kernel_OpenSource/ Signed-off-by: Hans de Goede <hdegoede@redhat.com> Tested-by: André Apitzsch <git@apitzsch.eu> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-02-15media: i2c: imx219: Scale the pixel rate for analog binningJai Luthra
When the analog binning mode is used for high framerate operation, the pixel rate is effectively doubled. Account for this when setting up the pixel clock rate, and applying the vblank and exposure controls. The previous logic only used analog binning for RAW8, but normal binning limits the framerate on RAW10 480p [1]. So with this patch we switch to using special binning (with 2x pixel rate) wherever possible. [1]: https://github.com/raspberrypi/linux/issues/5493 Co-developed-by: Naushir Patuck <naush@raspberrypi.com> Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Co-developed-by: Vinay Varma <varmavinaym@gmail.com> Signed-off-by: Vinay Varma <varmavinaym@gmail.com> Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-02-15media: i2c: imx219: Increase minimum LLP to fix blocky artefactsJai Luthra
The sensor's internal ADC supports a minimum line length of 3448 pixels, which may be too small to use with analog binning, where ADC operates on two lines together. Switch to a higher minimum line length of 3560 pixels to fix the blocky artefacts seen with analog binning [1]. To keep the same default framerate as before for all the modes, lower the default fll value to compensate for the increase in llp. [1]: https://github.com/raspberrypi/rpicam-apps/issues/281#issuecomment-1082894118 Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-02-15media: i2c: imx219: make HBLANK r/w to allow longer exposuresDave Stevenson
The HBLANK control was read-only, and always configured such that the sensor line length register was 3448. This limited the maximum exposure time that could be achieved to around 1.26 secs. Make HBLANK read/write so that the line time can be extended, and thereby allow longer exposures (and slower frame rates). Retain the overall line length setting when changing modes rather than resetting it to a default. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-02-15media: i2c: imx219: Rename VTS to FRM_LENGTHJai Luthra
The IMX219 datasheet refers to the vertical length + blanking as FRM_LENGTH instead of VTS. Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-02-15media: i2c: imx219: Correct the minimum vblanking valueDavid Plowman
The datasheet for this sensor documents the minimum vblanking as being 32 lines. It does fix some problems with occasional black lines at the bottom of images (tested on Raspberry Pi). Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-02-15media: imx219: Adjust PLL settings based on the number of MIPI lanesDave Stevenson
Commit ceddfd4493b3 ("media: i2c: imx219: Support four-lane operation") added support for device tree to allow configuration of the sensor to use 4 lanes with a link frequency of 363MHz, and amended the advertised pixel rate to 280.8MPix/s. However it didn't change any of the PLL settings, so actually it would have been running overclocked in the MIPI block, and with the frame rate and exposure calculations being wrong as the pixel rate was unchanged. The pixel rate and link frequency advertised were taken from the "Clock Setting Example" section of the datasheet. However those are based on an external clock of 12MHz, and are unachievable with a clock of 24MHz - it seems PREPLLCLK_VT_DIV and PREPLLCK_OP_DIV can ONLY be set via the automatic configuration documented in "9-1-2 EXCK_FREQ setting depend on INCK frequency", not by writing the registers. The closest we can get with a 24MHz clock is 281.6MPix/s and 364MHz. Dropping all support for the 363MHz link frequency would cause problems for existing users, so allow it, but log a warning that the requested value is being changed to the supported one. Fixes: ceddfd4493b3 ("media: i2c: imx219: Support four-lane operation") Cc: stable@vger.kernel.org Co-developed-by: Peyton Howe <peyton.howe@bellsouth.net> Signed-off-by: Peyton Howe <peyton.howe@bellsouth.net> Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-02-15media: i2c: imx415: Link frequencies are not exclusive to num lanesDave Stevenson
The link frequencies are equally valid in 2 or 4 lane modes, but they change the hmax_min value for the mode as the MIPI block has to have sufficient time to send the pixel data for each line. Remove the association with number of lanes, and add hmax_min configuration for both lane options. Reviewed-by: Michael Riesch <michael.riesch@wolfvision.net> Reviewed-by: Gerald Loacker <gerald.loacker@wolfvision.net> Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-02-15media: i2c: imx415: Make HBLANK controllable and in consistent unitsDave Stevenson
The control of HMAX documented in the datasheet is consistent with being in terms of a scaled INCK, being always 72MHz or 74.25MHz. It is NOT link frequency dependent, but the minimum value for HMAX is dictated by the link frequency. If PIXEL_RATE is defined as being 12 times the 72 or 74.25MHz, and all values are scaled down again when writing HMAX, then the numbers all work out regardless of INCK or link frequency. Retain an hmax_min (set to the same value as the previous fixed hmax register value) to set as the default value to avoid changing the behaviour for existing users. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Reviewed-by: Michael Riesch <michael.riesch@wolfvision.net> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-02-15media: i2c: imx415: Add read/write control of VBLANKDave Stevenson
This also requires that the ranges for the exposure control are updated. Reviewed-by: Michael Riesch <michael.riesch@wolfvision.net> Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-02-15media: v4l: Convert the users of v4l2_get_link_freq to call it on a padSakari Ailus
Call v4l2_get_link_freq() on a pad, instead of a control handler. This way we can soon convert v4l2_get_link_freq() to be callable only on a pad and remove the compatibility code. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Acked-by: Naushir Patuck <naush@raspberrypi.com> # rp1-cfe Acked-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com> # st-mipid02 Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-02-15media: i2c: ov7251: Introduce 1 ms delay between regulators and en GPIOSakari Ailus
Lift the xshutdown (enable) GPIO 1 ms after enabling the regulators, as required by the sensor's power-up sequence. Fixes: d30bb512da3d ("media: Add a driver for the ov7251 camera sensor") Cc: stable@vger.kernel.org Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-02-15media: i2c: ov7251: Set enable GPIO low in probeSakari Ailus
Set the enable GPIO low when acquiring it. Fixes: d30bb512da3d ("media: Add a driver for the ov7251 camera sensor") Cc: stable@vger.kernel.org Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-02-15media: i2c: imx319: Rectify runtime PM handling probe and removeSakari Ailus
Idle the device only after the async sub-device has been successfully registered. In error handling, set the device's runtime PM status to suspended only if it has been set to active previously in probe. Also set the device's runtime PM status to suspended in remove only if it wasn't so already. Fixes: 8a89dc62f28c ("media: add imx319 camera sensor driver") Cc: stable@vger.kernel.org # for >= v6.12 Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-02-15media: i2c: imx219: Rectify runtime PM handling in probe and removeSakari Ailus
Set the device's runtime PM status and enable runtime PM before registering the async sub-device. This is needed to avoid the case where the device is runtime PM resumed while runtime PM has not been enabled yet. Also set the device's runtime PM status to suspended in remove only if it wasn't so already. Fixes: 1283b3b8f82b ("media: i2c: Add driver for Sony IMX219 sensor") Cc: stable@vger.kernel.org # for >= v6.6 Reviewed-by: Bingbu Cao <bingbu.cao@intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-02-15media: i2c: ccs: Set the device's runtime PM status correctly in probeSakari Ailus
Set the device's runtime PM status to suspended in probe error paths where it was previously set to active. Fixes: 9447082ae666 ("[media] smiapp: Implement power-on and power-off sequences without runtime PM") Cc: stable@vger.kernel.org # for >= v5.15 Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-02-15media: i2c: ccs: Set the device's runtime PM status correctly in removeSakari Ailus
Set the device's runtime PM status to suspended in device removal only if it wasn't suspended already. Fixes: 9447082ae666 ("[media] smiapp: Implement power-on and power-off sequences without runtime PM") Cc: stable@vger.kernel.org # for >= v5.15 Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-02-15media: i2c: ov2740: Small cleanupsSakari Ailus
Small cleanups for the driver, namely removal of OV2740_NUM_SUPPLIES macro, use of unsigned int for a loop and printing the missing "0x" for a hexadecimal number. Co-developed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-02-15media: i2c: ov2740: Free control handler on error pathSakari Ailus
The control handler wasn't freed if v4l2_fwnode_device_parse() failed. Do that now. Co-developed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-02-15media: i2c: imx214: Fix link frequency validationAndré Apitzsch
The driver defines IMX214_DEFAULT_LINK_FREQ 480000000, and then IMX214_DEFAULT_PIXEL_RATE ((IMX214_DEFAULT_LINK_FREQ * 8LL) / 10), which works out as 384MPix/s. (The 8 is 4 lanes and DDR.) Parsing the PLL registers with the defined 24MHz input. We're in single PLL mode, so MIPI frequency is directly linked to pixel rate. VTCK ends up being 1200MHz, and VTPXCK and OPPXCK both are 120MHz. Section 5.3 "Frame rate calculation formula" says "Pixel rate [pixels/s] = VTPXCK [MHz] * 4", so 120 * 4 = 480MPix/s, which basically agrees with my number above. 3.1.4. MIPI global timing setting says "Output bitrate = OPPXCK * reg 0x113[7:0]", so 120MHz * 10, or 1200Mbit/s. That would be a link frequency of 600MHz due to DDR. That also matches to 480MPix/s * 10bpp / 4 lanes / 2 for DDR. Keep the previous link frequency for backward compatibility. Acked-by: Ricardo Ribalda <ribalda@chromium.org> Signed-off-by: André Apitzsch <git@apitzsch.eu> Fixes: 436190596241 ("media: imx214: Add imx214 camera sensor driver") Cc: stable@vger.kernel.org Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-02-15media: i2c: imx214: Add test pattern controlAndré Apitzsch
This adds V4L2_CID_TEST_PATTERN control support. Acked-by: Ricardo Ribalda <ribalda@chromium.org> Signed-off-by: André Apitzsch <git@apitzsch.eu> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-02-15media: i2c: imx214: Verify chip IDAndré Apitzsch
Check the chip ID and stop probing if it is no imx214 sensor. Acked-by: Ricardo Ribalda <ribalda@chromium.org> Signed-off-by: André Apitzsch <git@apitzsch.eu> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-02-15media: i2c: imx214: Add analogue/digital gain controlAndré Apitzsch
The imx214 sensor supports analogue gain up to 8x and digital gain up to 16x. Implement the corresponding controls in the driver. Default gain values are not modified by this patch. Acked-by: Ricardo Ribalda <ribalda@chromium.org> Signed-off-by: André Apitzsch <git@apitzsch.eu> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-02-15media: i2c: imx214: Implement vflip/hflip controlsAndré Apitzsch
The imx214 sensor supports horizontal and vertical flipping. Add appropriate controls to the driver. Acked-by: Ricardo Ribalda <ribalda@chromium.org> Signed-off-by: André Apitzsch <git@apitzsch.eu> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-02-15media: i2c: imx214: Add vblank and hblank controlsAndré Apitzsch
Add vblank control to allow changing the framerate / higher exposure values. The vblank and hblank controls are needed for libcamera support. While at it, fix the minimal exposure time according to the datasheet. Signed-off-by: André Apitzsch <git@apitzsch.eu> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>