summaryrefslogtreecommitdiffstats
path: root/drivers (follow)
Commit message (Collapse)AuthorAgeFilesLines
* media: rkisp1: resizer: Constify argument and local variablesLaurent Pinchart2023-10-121-6/+6
| | | | | | | | | Pointers to v4l2_mbus_framefmt and v4l2_rect instances don't need to be modified when configuring the resizer. Make them const. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: rkisp1: Program RKISP1_CIF_MI_SP_Y_PIC_SIZE registerLaurent Pinchart2023-10-121-1/+3
| | | | | | | | | | | | The self path has a Y_PIC_SIZE register that needs to be programmed to the total number of pixels, including the stride. This isn't done by the driver, fix it. While at it, reorder the register write order to sort them by address. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: rkisp1: Remove dual crop control register from config structureLaurent Pinchart2023-10-121-7/+4
| | | | | | | | | | The dual crop register is the same for both the MP and SP channels. Drop it from the rkisp1_rsz_config structure and use the RKISP1_CIF_DUAL_CROP_CTRL macro directly in the code. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: rkisp1: Fix line stride calculationLaurent Pinchart2023-10-121-7/+13
| | | | | | | | | | The line stride is expressed in the hardware as a number of pixels for the first plane. The bytesperline must thus be a multiple of the first plane's bpp value. Enforce this constraint. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: rkisp1: Constify rkisp1_v12_params_opsLaurent Pinchart2023-10-121-1/+1
| | | | | | | | | The rkisp1_v12_params_ops global variable doesn't need to be modified. Make it const. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: rkisp1: Convert hex constants to lowercaseLaurent Pinchart2023-10-122-311/+311
| | | | | | | | | | | Hex constants in the media subsystem are typically in lowercase. The rkisp1 driver mostly follows that convention already, except in the register definitions. Convert all hex constants to lowercase for consistency. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: rkisp1: csi: Use V4L2 subdev active stateLaurent Pinchart2023-10-122-80/+33
| | | | | | | | | | | | Use the V4L2 subdev active state API to store the active format and crop rectangle. This simplifies the driver not only by dropping the state stored in the rkisp1_csi structure, but also by replacing the ops_lock with the state lock. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: rkisp1: isp: Use V4L2 subdev active stateLaurent Pinchart2023-10-122-165/+102
| | | | | | | | | | | | | | | | | Use the V4L2 subdev active state API to store the active format and crop rectangle. This simplifies the driver not only by dropping the state stored in the rkisp1_isp structure, but also by replacing the ops_lock with the state lock. The rkisp1_isp.sink_fmt field needs to be kept, as it is accessed from the stats interrupt handler. To simplify the rkisp1_isp_set_sink_fmt() implementation, the field is now set when starting the ISP, instead of when setting the format. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: rkisp1: resizer: Use V4L2 subdev active stateLaurent Pinchart2023-10-122-124/+66
| | | | | | | | | | | | Use the V4L2 subdev active state API to store the active format and crop rectangle. This simplifies the driver not only by dropping the state stored in the rkisp1_resizer structure, but also by replacing the ops_lock with the state lock. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: ccs: Fix a (harmless) lockdep warningSakari Ailus2023-10-121-5/+12
| | | | | | | | | | The v4l2_subdev_init_finalize() is a macro that creates an unique lockdep key and name. As the CCS driver initialises all three of its sub-devices using the same call site, this creates a lockdep warning. Address it. Fixes: d8bca3ed1d70 ("media: ccs: Use sub-device active state") Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: ccs: Rework initialising sub-device stateSakari Ailus2023-10-121-17/+28
| | | | | | | | | | Initialise sub-device state in init_cfg callback using ccs_propagate() to the extent it covers of the initialisation. This fixes a bug where the driver configuration was incorrectly initialised. Fixes: d8bca3ed1d70 ("media: ccs: Use sub-device active state") Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: i2c: mt9m114: Fix missing error unwind in probe()Laurent Pinchart2023-10-121-2/+2
| | | | | | | | | | Two paths in the probe function return directly instead of jumping to error handling. Fix them. Fixes: 24d756e914fc ("media: i2c: Add driver for onsemi MT9M114 camera sensor") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: ti: Add CSI2RX support for J721EJai Luthra2023-10-124-0/+1174
| | | | | | | | | | | | | | | | | | | | | | | | | | | TI's J721E uses the Cadence CSI2RX and DPHY peripherals to facilitate capture over a CSI-2 bus. The Cadence CSI2RX IP acts as a bridge between the TI specific parts and the CSI-2 protocol parts. TI then has a wrapper on top of this bridge called the SHIM layer. It takes in data from stream 0, repacks it, and sends it to memory over PSI-L DMA. This driver acts as the "front end" to V4L2 client applications. It implements the required ioctls and buffer operations, passes the necessary calls on to the bridge, programs the SHIM layer, and performs DMA via the dmaengine API to finally return the data to a buffer supplied by the application. Co-developed-by: Pratyush Yadav <p.yadav@ti.com> Signed-off-by: Pratyush Yadav <p.yadav@ti.com> Co-developed-by: Vaishnav Achath <vaishnav.a@ti.com> Signed-off-by: Vaishnav Achath <vaishnav.a@ti.com> Tested-by: Vaishnav Achath <vaishnav.a@ti.com> Tested-by: Julien Massot <julien.massot@collabora.com> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Signed-off-by: Jai Luthra <j-luthra@ti.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: cadence: csi2rx: Add link validationPratyush Yadav2023-10-121-0/+5
| | | | | | | | | | | | | | Add media link validation to make sure incorrectly configured pipelines are caught. Signed-off-by: Pratyush Yadav <p.yadav@ti.com> Tested-by: Julien Massot <julien.massot@collabora.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Maxime Ripard <mripard@kernel.org> Signed-off-by: Jai Luthra <j-luthra@ti.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: cadence: csi2rx: Populate subdev devnodePratyush Yadav2023-10-121-0/+1
| | | | | | | | | | | | | | | The devnode can be used by media-ctl and other userspace tools to perform configurations on the subdev. Without it, media-ctl returns ENOENT when setting format on the sensor subdev. Signed-off-by: Pratyush Yadav <p.yadav@ti.com> Tested-by: Julien Massot <julien.massot@collabora.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Maxime Ripard <mripard@kernel.org> Signed-off-by: Jai Luthra <j-luthra@ti.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: cadence: csi2rx: Fix stream data configurationPratyush Yadav2023-10-121-3/+5
| | | | | | | | | | | | | | | | | | | | | | Firstly, there is no VC_EN bit present in the STREAM_DATA_CFG register. Bit 31 is part of the VL_SELECT field. Remove it completely. Secondly, it makes little sense to enable ith virtual channel for ith stream. Sure, there might be a use-case that demands it. But there might also be a use case that demands all streams to use the 0th virtual channel. Prefer this case over the former because it is less arbitrary and also makes it very clear what the limitations of the current driver is instead of giving a false impression that multiple virtual channels are supported. Signed-off-by: Pratyush Yadav <p.yadav@ti.com> Tested-by: Julien Massot <julien.massot@collabora.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Maxime Ripard <mripard@kernel.org> Signed-off-by: Jai Luthra <j-luthra@ti.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: cadence: csi2rx: Set the STOP bit when stopping a streamPratyush Yadav2023-10-121-1/+18
| | | | | | | | | | | | | | | The stream stop procedure says that the STOP bit should be set when the stream is to be stopped, and then the ready bit in stream status register polled to make sure the STOP operation is finished. Signed-off-by: Pratyush Yadav <p.yadav@ti.com> Tested-by: Julien Massot <julien.massot@collabora.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Maxime Ripard <mripard@kernel.org> Signed-off-by: Jai Luthra <j-luthra@ti.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: cadence: csi2rx: Soft reset the streams before starting capturePratyush Yadav2023-10-121-1/+13
| | | | | | | | | | | | | | | | This resets the stream state machines and FIFOs, giving them a clean slate. On J721E if the streams are not reset before starting the capture, the captured frame gets wrapped around vertically on every run after the first. Signed-off-by: Pratyush Yadav <p.yadav@ti.com> Tested-by: Julien Massot <julien.massot@collabora.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Maxime Ripard <mripard@kernel.org> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Signed-off-by: Jai Luthra <j-luthra@ti.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: cadence: csi2rx: Configure DPHY using link freqPratyush Yadav2023-10-121-0/+24
| | | | | | | | | | | | | | | | Some platforms like TI's J721E can have the CSI2RX paired with an external DPHY. Use the generic PHY framework to configure the DPHY with the correct link frequency. Signed-off-by: Pratyush Yadav <p.yadav@ti.com> Tested-by: Julien Massot <julien.massot@collabora.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Maxime Ripard <mripard@kernel.org> Co-developed-by: Jai Luthra <j-luthra@ti.com> Signed-off-by: Jai Luthra <j-luthra@ti.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: cadence: csi2rx: Add get_fmt and set_fmt pad opsPratyush Yadav2023-10-121-1/+95
| | | | | | | | | | | | | | | | | | | | | The format is needed to calculate the link speed for the external DPHY configuration. It is not right to query the format from the source subdev. Add get_fmt and set_fmt pad operations so that the format can be configured and correct bpp be selected. Initialize and use the v4l2 subdev active state to keep track of the active formats. Also propagate the new format from the sink pad to all the source pads. Signed-off-by: Pratyush Yadav <p.yadav@ti.com> Tested-by: Julien Massot <julien.massot@collabora.com> Reviewed-by: Maxime Ripard <mripard@kernel.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Co-developed-by: Jai Luthra <j-luthra@ti.com> Signed-off-by: Jai Luthra <j-luthra@ti.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: cadence: csi2rx: Cleanup media entity properlyPratyush Yadav2023-10-121-0/+2
| | | | | | | | | | | | | | | Call media_entity_cleanup() in probe error path and remove to make sure the media entity is cleaned up properly. Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Pratyush Yadav <p.yadav@ti.com> Tested-by: Julien Massot <julien.massot@collabora.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Maxime Ripard <mripard@kernel.org> Signed-off-by: Jai Luthra <j-luthra@ti.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: cadence: csi2rx: Unregister v4l2 async notifierPratyush Yadav2023-10-121-1/+6
| | | | | | | | | | | | | | | | | | | | The notifier is added to the global notifier list when registered. When the module is removed, the struct csi2rx_priv in which the notifier is embedded, is destroyed. As a result the notifier list has a reference to a notifier that no longer exists. This causes invalid memory accesses when the list is iterated over. Similar for when the probe fails. Unregister and clean up the notifier to avoid this. Fixes: 1fc3b37f34f6 ("media: v4l: cadence: Add Cadence MIPI-CSI2 RX driver") Signed-off-by: Pratyush Yadav <p.yadav@ti.com> Tested-by: Julien Massot <julien.massot@collabora.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Maxime Ripard <mripard@kernel.org> Signed-off-by: Jai Luthra <j-luthra@ti.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* staging: media: ipu3: remove ftrace-like loggingRicardo B. Marliere2023-10-121-6/+0
| | | | | | | | | | | | | | | | | | | | | This patch fixes the following checkpatch.pl warnings in ipu3.c: WARNING: Unnecessary ftrace-like logging - prefer using ftrace + dev_dbg(dev, "enter %s\n", __func__); WARNING: Unnecessary ftrace-like logging - prefer using ftrace + dev_dbg(dev, "leave %s\n", __func__); WARNING: Unnecessary ftrace-like logging - prefer using ftrace + dev_dbg(dev, "enter %s\n", __func__); WARNING: Unnecessary ftrace-like logging - prefer using ftrace + dev_dbg(dev, "leave %s\n", __func__); Fixes: 7fc7af649ca7 ("media: staging/intel-ipu3: Add imgu top level pci device driver") Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: lirc: drop trailing space from scancode transmitSean Young2023-10-111-1/+5
| | | | | | | | | | | When transmitting, infrared drivers expect an odd number of samples; iow without a trailing space. No problems have been observed so far, so this is just belt and braces. Fixes: 9b6192589be7 ("media: lirc: implement scancode sending") Cc: stable@vger.kernel.org Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: sharp: fix sharp encodingSean Young2023-10-111-3/+5
| | | | | | | | | | | | | The Sharp protocol[1] encoding has incorrect timings for bit space. [1] https://www.sbprojects.net/knowledge/ir/sharp.php Fixes: d35afc5fe097 ("[media] rc: ir-sharp-decoder: Add encode capability") Cc: stable@vger.kernel.org Reported-by: Joe Ferner <joe.m.ferner@gmail.com> Closes: https://sourceforge.net/p/lirc/mailman/message/38604507/ Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* staging: media: atomisp: improve unwindingHans Verkuil2023-10-111-6/+12
| | | | | | | | | | | This fixes two smatch warnings: drivers/staging/media/atomisp/pci/atomisp_cmd.c:2779 atomisp_cp_dvs_6axis_config() warn: missing unwind goto? drivers/staging/media/atomisp/pci/atomisp_cmd.c:2878 atomisp_cp_morph_table() warn: missing unwind goto? Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> CC: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
* media: i2c: tc358746: check fmt validityHans Verkuil2023-10-111-1/+5
| | | | | | | | | | | | Check if the format was really found. Fixes smatch warning: drivers/media/i2c/tc358746.c:790 tc358746_set_fmt() error: 'fmt' dereferencing possible ERR_PTR() Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> CC: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
* staging: media: atomisp: drop check for reentrant .s_stream()Hans Verkuil2023-10-111-6/+0
| | | | | | | | | | | | | | The subdev .s_stream() operation shall not be called to start streaming on an already started subdev, or stop streaming on a stopped subdev. Remove the check that guards against that condition. Also fixes a smatch warning: drivers/staging/media/atomisp/i2c/atomisp-gc0310.c:446 gc0310_s_stream() warn: missing error code 'ret' Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> CC: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
* media: imon: fix access to invalid resource for the second interfaceTakashi Iwai2023-10-071-0/+6
| | | | | | | | | | | | | | | | | | | | | | | imon driver probes two USB interfaces, and at the probe of the second interface, the driver assumes blindly that the first interface got bound with the same imon driver. It's usually true, but it's still possible that the first interface is bound with another driver via a malformed descriptor. Then it may lead to a memory corruption, as spotted by syzkaller; imon driver accesses the data from drvdata as struct imon_context object although it's a completely different one that was assigned by another driver. This patch adds a sanity check -- whether the first interface is really bound with the imon driver or not -- for avoiding the problem above at the probe time. Reported-by: syzbot+59875ffef5cb9c9b29e9@syzkaller.appspotmail.com Closes: https://lore.kernel.org/all/000000000000a838aa0603cc74d6@google.com/ Tested-by: Ricardo B. Marliere <ricardo@marliere.net> Link: https://lore.kernel.org/r/20230922005152.163640-1-ricardo@marliere.net Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: rc: keymaps: add missing MODULE_DESCRIPTION to keymapsHans Verkuil2023-10-07133-0/+133
| | | | | | | | | | | | | | | | | When building the modules 'modpost' warns about missing MODULE_DESCRIPTION. Since almost none of the rc keymap modules have this, it produces a lot of warnings. As a first step to fixing all media modules, add this line to all keymaps. The description should be a human-readable string describing the remote or the remote controller that the keymap can be used with. Note that keymaps/rc-cec.c is actually compiled into the rc-core, so that is the sole keymap source that didn't need this. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Sean Young <sean@mess.org>
* media: mc: Check pad flag validitySakari Ailus2023-10-071-1/+14
| | | | | | | | | Check the validity of pad flags on entity init. Exactly one of the flags must be set. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: v4l: subdev: Print debug information on frame descriptorSakari Ailus2023-10-071-1/+30
| | | | | | | | Print debug level information on returned frame descriptors. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: v4l: subdev: Clear frame descriptor before get_frame_descSakari Ailus2023-10-075-8/+9
| | | | | | | | | | Clear frame descriptor before calling transmitter's get_frame_desc() op. Also remove the corresponding memset() calls from drivers. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: ov2740: Return -EPROBE_DEFER if no endpoint is foundSakari Ailus2023-10-071-1/+1
| | | | | | | | | With ipu bridge, endpoints may only be created when ipu bridge has initialised. This may happen after the sensor driver has first probed. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: ov2740: Use sub-device active stateSakari Ailus2023-10-071-67/+42
| | | | | | | | | Use sub-device active state. Rely on control handler lock to serialise access to the active state. Also clean up locking on s_stream handler. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: ov2740: Enable runtime PM before registering the async subdevSakari Ailus2023-10-071-6/+8
| | | | | | | | | | Enable runtime PM before registering the async subdev as the driver UAPI may become accessible immediately after the registration. Runtime PM needs to be enabled by that time. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: ccs: Drop re-entrant s_stream supportSakari Ailus2023-10-071-3/+0
| | | | | | | | | | The s_stream is called to enable and to disable streaming on a sub-device. The caller may only call it to change the state, enabling streaming is not allowed when it is already disabled, and similarly for disabling streaming. Remove the check from the CCS driver. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: ccs: Partially revert "media: i2c: Use pm_runtime_resume_and_get()"Sakari Ailus2023-10-071-3/+3
| | | | | | | | | | ccs_pm_get_init() depends on the return values > 0 of pm_runtime_get_sync(), thus it can't use pm_runtime_resume_and_get(). There's even a comment in the driver on this, a few lines above the code. Fixes: aa0adb399d09 ("media: i2c: Use pm_runtime_resume_and_get()") Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: ccs: Use sub-device active stateSakari Ailus2023-10-072-186/+104
| | | | | | | | | | | | Make use of sub-device active state. In most cases the effect on need for acquiring the mutex is non-existent as access to the driver's core data structure still needs to be serialised. This still removes a lot of code as the code paths for active and try state are the same in many cases. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: ccs: Obtain media bus formats before initialising up sub-devicesSakari Ailus2023-10-071-6/+6
| | | | | | | | | | | The available mbus codes will soon be needed earlier, at the time sub-devices are initialisaed. This is due to calling init_cfg() op via the v4l2_subdev_init_finalize(). Move ccs_get_mbus_formats() before ccs_init_subdev() calls. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: ccs: Move media_entity_pads_init to init from registerSakari Ailus2023-10-071-39/+36
| | | | | | | | The media entity will soon need to be initialised before the sub-device init finalisation that allocates memory for sub-device state. Do that now. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: ccs: Rename ccs_create_subdev as ccs_init_subdevSakari Ailus2023-10-071-9/+9
| | | | | | | | | The ccs_create_subdev() function initialises a sub-device in the CCS driver, including CCS specific needs. Rename it as ccs_init_subdev() as it better reflects what the function does. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: ccs: Switch to init_cfgSakari Ailus2023-10-071-11/+6
| | | | | | | | | Use init_cfg() instead of manually setting up defaults in file handle open. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: ccs: Correct error handling in ccs_register_subdevSakari Ailus2023-10-071-3/+10
| | | | | | | | | ccs_register_subdev() did not clean up the media entity in error case, do that now. Also switch to goto based error handling. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: ccs: Correctly initialise try compose rectangleSakari Ailus2023-10-071-1/+1
| | | | | | | | | | | | | Initialise the try sink compose rectangle size to the sink compose rectangle for binner and scaler sub-devices. This was missed due to the faulty condition that lead to the compose rectangles to be initialised for the pixel array sub-device where it is not relevant. Fixes: ccfc97bdb5ae ("[media] smiapp: Add driver") Cc: stable@vger.kernel.org Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: ccs: Fix driver quirk struct documentationSakari Ailus2023-10-071-3/+1
| | | | | | | | | | Fix documentation for struct ccs_quirk, a device specific struct for managing deviations from the standard. The flags field was drifted away from where it should have been. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: i2c: imx219: Move variables to inner scopeLaurent Pinchart2023-10-071-1/+4
| | | | | | | | | | | The exposure_max, exposure_def and hblank variables are only used in an inner scope in the imx219_set_pad_format() function. Move them to that scope to keep them closer to their usage and improve readability. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: i2c: imx219: Name all subdev state variables 'state'Laurent Pinchart2023-10-071-7/+7
| | | | | | | | | | Subdev state variables are named with a mix of 'state' and 'sd_state' through the driver. To improve consistency, name them all 'state'. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
* media: i2c: imx219: Calculate crop rectangle dynamicallyLaurent Pinchart2023-10-071-30/+15
| | | | | | | | | | | Calculate the crop rectangle size and location dynamically when setting the format, instead of storing it in the imx219_mode structure. This removes duplicated information from the mode, to guarantee consistency. Signed-off-by: Laurent Pinchart <laurent.pinchart@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-cisco@xs4all.nl>
* media: i2c: imx219: Separate horizontal and vertical binningLaurent Pinchart2023-10-071-12/+27
| | | | | | | | | | The IMX219 has distinct binning registers for the horizontal and vertical directions. Calculate their value and write them separately. Signed-off-by: Laurent Pinchart <laurent.pinchart@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-cisco@xs4all.nl>