summaryrefslogtreecommitdiff
path: root/drivers/media
AgeCommit message (Collapse)AuthorFilesLines
2023-12-13media: s5p-mfc: Add initial support for MFCv12Aakarsh Jain9-35/+172
Add support for MFCv12, with a new register file and necessary hw control, decoder, encoder and structural changes. Add luma dbp, chroma dpb and mv sizes for each codec as per the UM for MFCv12, along with appropriate alignment. Cc: linux-fsd@tesla.com Signed-off-by: Smitha T Murthy <smithatmurthy@gmail.com> Signed-off-by: Aakarsh Jain <aakarsh.jain@samsung.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13media: s5p-mfc: Rename IS_MFCV10 macroAakarsh Jain3-20/+20
Renames macro IS_MFCV10 to IS_MFCV10_PLUS so that the MFCv10 code can be resued for MFCv12 support. Since some part of MFCv10 specific code holds good for MFCv12 also. Cc: linux-fsd@tesla.com Signed-off-by: Smitha T Murthy <smithatmurthy@gmail.com> Signed-off-by: Aakarsh Jain <aakarsh.jain@samsung.com> Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13media: i2c: Add driver for OmniVision OV64A40Jacopo Mondi3-0/+3701
Add a driver for the OmniVision OV64A40 image sensor. Co-developed-by: Lee Jackson <lee.jackson@arducam.com> Signed-off-by: Lee Jackson <lee.jackson@arducam.com> Signed-off-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>
2023-12-13media: i2c: imx335: Support 2592x1940 10-bit modeUmang Jain1-7/+71
In addition to the existing 2592x1940 12-bit mode, introduce support for 2592x1940 10-bit mode. Following are the register set which control the 10/12 bit mode setting: MDBIT 0x319d ADBIT 0x3050 ADBIT1 0x341c 0x341d Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13media: i2c: imx335: Fix hblank min/max valuesKieran Bingham1-2/+2
The V4L2_CID_HBLANK control is marked as readonly and can only be a single value. Set the minimum and maximum value to match the mode value. Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13media: i2c: imx335: Implement get selection APIKieran Bingham1-0/+45
Support reporting of the Sensor Native and Active pixel array areas through the Selection API. The implementation reports a single target crop only for the mode that is presently exposed by the driver. Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13media: i2c: imx335: Enable regulator suppliesKieran Bingham1-2/+34
Provide support for enabling and disabling regulator supplies to control power to the camera sensor. While updating the power on function, document that a sleep is represented as 'T4' in the datasheet power on sequence. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13media: i2c: imx335: Improve configuration error reportingKieran Bingham1-1/+5
The existing imx335_parse_hw_config function has two paths that can be taken without reporting to the user the reason for failing to accept the hardware configuration. Extend the error reporting paths to identify failures when probing the device. Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13media: i2c: imx335: Fix logging line endingsKieran Bingham1-21/+21
The use of \n as a line ending throughout the driver is inconsistent. While it is possible for logging messages to automatically have newlines added by the kernel printk mechanisms, this is specifically to support continued lines with PR_CONT and the lack of a new line character indicates that the text is a fragment of a continuation line. As each of these lines are whole and not fragments, explicitly define the newline for consistency. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13media: i2c: imx214: Add sensor's pixel matrix sizeAndré Apitzsch1-7/+32
Set effective and active sensor pixel sizes as shown in product brief[1]. [1]: https://www.mouser.com/datasheet/2/897/ProductBrief_IMX214_20150428-1289331.pdf Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: André Apitzsch <git@apitzsch.eu> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13media: i2c: imx214: Read orientation and rotation from system firmwareAndré Apitzsch1-1/+8
Obtain rotation and orientation information from system firmware and register the appropriate controls. While at it, update number of pre-allocated control slots. Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-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-cisco@xs4all.nl>
2023-12-13media: i2c: imx214: Move controls init to separate functionAndré Apitzsch1-48/+67
Code refinement. While at it, don't destroy the mutex not initialized yet if the controls are initialized incorrectly. Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-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-cisco@xs4all.nl>
2023-12-13media: i2c: imx214: Explain some magic numbersAndré Apitzsch1-4/+18
Code refinement, no functional changes. Reviewed-by: Ricardo Ribalda <ribalda@chromium.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: André Apitzsch <git@apitzsch.eu> [Sakari Ailus: The control handler remains in the context struct still.] Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13media: i2c: gc0308: new driverSebastian Reichel3-0/+1462
Introduce new driver for GalaxyCore GC0308, which is a cheap 640x480 with an on-chip ISP sensor sold since 2010. Data is provided via parallel bus. Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Sebastian Reichel <sre@kernel.org> [Sakari Ailus: Changed MAINTAINERS to match GC2145 entry.] Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13media: v4l: Safely to call v4l2_subdev_cleanup on an uninitialised subdevSakari Ailus1-1/+2
Graciously handle an uninitialised (but still zeroed) sub-device in v4l2_subdev_cleanup(). The list_empty() check there is unnecessary, too, so replace that by cheking whether the lists's next field is NULL. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13media: ipu-bridge: Change ov2740 link-frequency to 180 MHzHans de Goede1-1/+1
The only known devices that use an ov2740 sensor in combination with the ipu-bridge code are various Lenovo ThinkPad models, which all need the link-frequency to be 180 MHz for things to work properly. The ov2740 driver used to only support 360 MHz link-frequency, which is why the ipu-bridge entry used 360 MHz, but now the ov2740 driver has been extended to also support 180 MHz. The ov2740 is actually used with 360 MHz link-frequency on Chromebooks. On Chromebooks the camera/sensor fwnode graph is part of the ACPI tables. The ipu-bridge code is used to dynamically generate the graph when it is missing, so it is not used on Chromebooks and the ov2740 will keep using 360 MHz link-frequency there as before. 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-cisco@xs4all.nl>
2023-12-13media: ov2740: Add a sleep after resetting the sensorHans de Goede1-2/+9
Split the resetting of the sensor out of the link_freq_config reg_list and add a delay after this. This hopefully fixes the stream sometimes not starting, this was taken from the ov2740 sensor driver in the out of tree IPU6 driver: https://github.com/intel/ipu6-drivers/ 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-cisco@xs4all.nl>
2023-12-13media: ov2740: Add support for 180 MHz link frequencyHans de Goede1-24/+239
On various Lenovo Thinkpad models with an ov2740 sensor the 360 MHz link frequency is not supported. Add support for 180 MHz link frequency, even though this has half the pixel clock, this supports the same framerate by using half the VTS value (significantly reducing the amount of empty lines send during vblank). Normally if there are multiple link-frequencies then the sensor driver choses the lowest link-frequency still usable for the chosen resolution. In this case the board supports only 1 link-frequency. Which frequency is supported is checked in ov2740_check_hwcfg() and then a different set of supported_modes (using only the supported link-freq) is selected. The register settings for this were taken from the ov2740 sensor driver in the out of tree IPU6 driver: https://github.com/intel/ipu6-drivers/ 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-cisco@xs4all.nl>
2023-12-13media: ov2740: Check hwcfg after allocating the ov2740 structHans de Goede1-6/+7
Alloc ov2740_data and set up the drvdata pointer before calling ov2740_check_hwcfg(). This is a preparation patch to allow ov2740_check_hwcfg() to store some of the parsed data in the ov2740 struct. 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-cisco@xs4all.nl>
2023-12-13media: ov2740: Fix hts valueHans de Goede1-14/+3
HTS must be more then width, so the 1080 value clearly is wrong, this is then corrected with some weird math dividing clocks in to_pixels_per_line() which results in the hts getting multiplied by 2, resulting in 2160. Instead just directly set hts to the correct value of 2160 and drop to_pixels_per_line(). 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-cisco@xs4all.nl>
2023-12-13media: ov2740: Improve ov2740_check_hwcfg() error reportingHans de Goede1-2/+3
Make ov2740_check_hwcfg() report an error on failure in all error paths, so that it is always clear why the probe() failed. 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-cisco@xs4all.nl>
2023-12-13media: ov2740: Move fwnode_graph_get_next_endpoint() call upHans de Goede1-6/+14
If the bridge has not yet setup the fwnode-graph then the fwnode_property_read_u32("clock-frequency") call will fail. Move the fwnode_graph_get_next_endpoint() call to above reading the clock-frequency. 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-cisco@xs4all.nl>
2023-12-13media: ov2740: Add support for external clockHans de Goede1-0/+13
On some ACPI platforms, such as Chromebooks the ACPI methods to change the power-state (_PS0 and _PS3) fully take care of powering on/off the sensor. On other ACPI platforms, such as e.g. various ThinkPad models with IPU6 + ov2740 sensor, the sensor driver must control the reset GPIO and the sensor's clock itself. Add support for having the driver control an optional clock. Reviewed-by: Bingbu Cao <bingbu.cao@intel.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-cisco@xs4all.nl>
2023-12-13media: ov2740: Add support for reset GPIOHans de Goede1-2/+46
On some ACPI platforms, such as Chromebooks the ACPI methods to change the power-state (_PS0 and _PS3) fully take care of powering on/off the sensor. On other ACPI platforms, such as e.g. various ThinkPad models with IPU6 + ov2740 sensor, the sensor driver must control the reset GPIO and the sensor's clock itself. Add support for having the driver control an optional reset GPIO. Reviewed-by: Bingbu Cao <bingbu.cao@intel.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-cisco@xs4all.nl>
2023-12-13media: i2c: Add support for alvium cameraTommaso Merciai4-0/+3033
The Alvium camera is shipped with sensor + isp in the same housing. The camera can be equipped with one out of various sensor and abstract the user from this. Camera is connected via MIPI CSI-2. Most of the camera module features are supported, with the main exception being fw update. The driver provides all mandatory, optional and recommended V4L2 controls for maximum compatibility with libcamera References: - https://www.alliedvision.com/en/products/embedded-vision-solutions Signed-off-by: Tommaso Merciai <tomm.merciai@gmail.com> [Sakari Ailus: Assign ret before using it in probe and squash Tommaso's other fixes.] Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> [hverkuil: alvium-csi2.h: SPDX must use /* */ instead of //]
2023-12-13media: i2c: ak7375: Add support for ak7345Vincent Knecht1-4/+22
Add support for ak7345 VCM, which has 9 bits position values, longer power-up delay, and no known standby register setting. Might be compatible as-is with ak7348. Tested on msm8916-alcatel-idol347 phone. Signed-off-by: Vincent Knecht <vincent.knecht@mailoo.org> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13media: i2c: ak7375: Prepare for supporting another chipVincent Knecht1-44/+66
In view of adding support for at least one other chip, change the driver to move chip-specific properties and values in a common structure. No functional changes. Signed-off-by: Vincent Knecht <vincent.knecht@mailoo.org> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13media: i2c: imx290: Properly encode registers as little-endianAlexander Stein1-21/+21
The conversion to CCI also converted the multi-byte register access to big-endian. Correct the register definition by using the correct little-endian ones. Fixes: af73323b9770 ("media: imx290: Convert to new CCI register access helpers") Cc: stable@vger.kernel.org Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> [Sakari Ailus: Fixed the Fixes: tag.] Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13media: v4l2-cci: Add support for little-endian encoded registersAlexander Stein1-8/+36
Some sensors, e.g. Sony IMX290, are using little-endian registers. Add support for those by encoding the endianness into Bit 20 of the register address. Fixes: af73323b9770 ("media: imx290: Convert to new CCI register access helpers") Cc: stable@vger.kernel.org Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> [Sakari Ailus: Fixed commit message.] Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13media: atmel-isi: Fix crash due to missing subdev in stateLaurent Pinchart1-0/+1
As a result of converting to the stream-aware state functions, commit bc0e8d91feec ("media: v4l: subdev: Switch to stream-aware state functions") caused the sd pointer of the state passed to the v4l2_subdev_state_get_crop() function to be dereferenced. It however missed that the atmel-isi driver creates the v4l2_subdev_state instance on the stack (which it shouldn't do, but that's a separate problem), without initializing the sd field. This results in a null pointer dereference. Fix it by initializing the sd field. Fixes: bc0e8d91feec ("media: v4l: subdev: Switch to stream-aware state functions") 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>
2023-12-13media: ddbridge: fix an error code problem in ddb_probeSu Hui1-1/+1
Error code is assigned to 'stat', return 'stat' rather than '-1'. Signed-off-by: Su Hui <suhui@nfschina.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13media: dvb-frontends: m88ds3103: Fix a memory leak in an error handling path ↵Christophe JAILLET1-2/+5
of m88ds3103_probe() If an error occurs after a successful i2c_mux_add_adapter(), then i2c_mux_del_adapters() should be called to free some resources, as already done in the remove function. Fixes: e6089feca460 ("media: m88ds3103: Add support for ds3103b demod") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13media: dvbdev: drop refcount on error path in dvb_device_open()Dan Carpenter1-0/+2
If call to file->f_op->open() fails, then call dvb_device_put(dvbdev). Fixes: 0fc044b2b5e2 ("media: dvbdev: adopts refcnt to avoid UAF") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13media: platform: exynos4-is: return callee's error code rather than -ENXIOSu Hui1-1/+1
Clang static analyzer complains that value stored to 'ret' is never read. Return the callee's error code to fix this. Signed-off-by: Su Hui <suhui@nfschina.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13media: i2c: Introduce a driver for the Techwell TW9900 decoderMehdi Djait3-0/+797
The Techwell video decoder supports PAL, NTSC standards and has a parallel BT.656 output interface. This commit adds support for this device, with basic support for NTSC and PAL, along with brightness and contrast controls. The TW9900 is capable of automatic standard detection. This driver is implemented with support for PAL and NTSC autodetection. Reviewed-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com> Signed-off-by: Mehdi Djait <mehdi.djait@bootlin.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13media: amphion: remove mutext lock in condition of wait_eventMing Qian3-20/+12
mutext_lock should not be called in condition of wait_event, otherwise, when CONFIG_DEBUG_ATOMIC_SLEEP is enabled, we may meet the following warning: do not call blocking ops when !TASK_RUNNING; state=2 WARNING: CPU: 5 PID: 741 at kernel/sched/core.c:9859 __might_sleep+0x80/0xa4 Hardware name: Freescale i.MX8QM MEK (DT) pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : __might_sleep+0x80/0xa4 lr : __might_sleep+0x80/0xa4 sp : ffffffc0123738a0 x29: ffffffc0123738a0 x28: ffffffc009194c48 x27: ffffffc00bbc1050 x26: ffffff8814b282f0 x25: ffffff8814b280d0 x24: ffffff8814b28080 x23: 0000000000000001 x22: 0000000000000032 x21: ffffffc00bbc1000 x20: 000000000000011b x19: ffffffc009324670 x18: 00000000fffffffd x17: 30303c5b20746120 x16: 74657320323d6574 x15: 617473203b474e49 x14: 00058b5b8b9aa1f1 x13: ffffffc00903cda0 x12: 00000000d744fcc9 x11: 000000000000001c x10: 00000000000009a0 x9 : ffffffc0090201f4 x8 : ffffff8828245000 x7 : 0000000000000001 x6 : 0000000000000001 x5 : 00000000410fd080 x4 : 0000000000000002 x3 : ffffff8815aab4c8 x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffffff8828244600 Call trace: __might_sleep+0x80/0xa4 mutex_lock+0x2c/0x80 sync_session_response+0x110/0x310 vpu_session_send_cmd+0x18c/0x244 vpu_session_start+0x38/0x70 vdec_start_session+0x1b4/0x3e0 vpu_vb2_start_streaming+0xa0/0x1c4 vb2_start_streaming+0x74/0x160 vb2_core_qbuf+0x488/0x650 vb2_qbuf+0x9c/0x100 v4l2_m2m_qbuf+0x7c/0x224 v4l2_m2m_ioctl_qbuf+0x20/0x2c v4l_qbuf+0x50/0x6c __video_do_ioctl+0x174/0x3f0 video_usercopy+0x210/0x7cc video_ioctl2+0x20/0x30 v4l2_ioctl+0x48/0x6c we need to refine check_is_responsed() to remove the mutext_lock, each cmd has a monotonically increasing id, and cmds are executed sequentially, so we can check the id of the last reponsed cmd, then determine whether a command has been responded or not. Signed-off-by: Ming Qian <ming.qian@nxp.com> CC: Xiaolei Wang <xiaolei.wang@windriver.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13media: chips-media: wave5: Requires GENERIC_ALLOCATORRandy Dunlap1-0/+1
This driver uses the API that is provided by GENERIC_ALLOCATOR API, so select it to prevent build errors: riscv32-linux-ld: drivers/media/platform/chips-media/wave5/wave5-vpu.o: in function `.L37': wave5-vpu.c:(.text+0x468): undefined reference to `of_gen_pool_get' riscv32-linux-ld: drivers/media/platform/chips-media/wave5/wave5-vdi.o: in function `.L116': wave5-vdi.c:(.text+0xaac): undefined reference to `gen_pool_dma_alloc' riscv32-linux-ld: drivers/media/platform/chips-media/wave5/wave5-vdi.o: in function `wave5_vdi_free_sram': wave5-vdi.c:(.text+0xb60): undefined reference to `gen_pool_free_owner' Fixes: 9707a6254a8a ("media: chips-media: wave5: Add the v4l2 layer") Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Cc: Nas Chung <nas.chung@chipsnmedia.com> Cc: Jackson Lee <jackson.lee@chipsnmedia.com> Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl> Cc: Mauro Carvalho Chehab <mchehab@kernel.org> Cc: linux-media@vger.kernel.org Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13media: chips-media: wave5: Fix panic on decoding DECODED_IDX_FLAG_SKIPMattijs Korpershoek1-1/+1
The display frame region information received from the vpu also contains the frame display index: info->index_frame_display. This index, being a s32, can be negative when a skip option is passed. In that case, its value is DECODED_IDX_FLAG_SKIP (-2). When disp_idx == -2, the following exception occurs: [ 1530.782246][ T1900] Hardware name: Texas Instruments AM62P5 SK (DT) [ 1530.788501][ T1900] pstate: a0400005 (NzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 1530.796144][ T1900] pc : wave5_vpu_dec_get_output_info+0x300/0x308 [wave5] [ 1530.803060][ T1900] lr : wave5_vpu_dec_get_output_info+0x80/0x308 [wave5] [ 1530.809873][ T1900] sp : ffffffc00b85bc00 [ 1530.813872][ T1900] x29: ffffffc00b85bc00 x28: 0000000000000000 x27: 0000000000000001 [ 1530.821695][ T1900] x26: 00000000fffffffd x25: 00000000ffffffff x24: ffffff8812820000 [ 1530.829516][ T1900] x23: ffffff88199f7840 x22: ffffff8873f5e000 x21: ffffffc00b85bc58 [ 1530.837336][ T1900] x20: 0000000000000000 x19: ffffff88199f7920 x18: ffffffc00a899030 [ 1530.845156][ T1900] x17: 00000000529c6ef0 x16: 00000000529c6ef0 x15: 0000000000198487 [ 1530.852975][ T1900] x14: ffffffc009f2b650 x13: 0000000000058016 x12: 0000000005000000 [ 1530.860795][ T1900] x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000000 [ 1530.868615][ T1900] x8 : 0000000000000000 x7 : 0000000000000000 x6 : 0000000000004086 [ 1530.876434][ T1900] x5 : 0000000000000001 x4 : ffffffc001454b94 x3 : ffffffc001454d94 [ 1530.884256][ T1900] x2 : ffffffc00b8201d0 x1 : 0000000000000020 x0 : 0000000000000000 [ 1530.892087][ T1900] Call trace: [ 1530.895225][ T1900] wave5_vpu_dec_get_output_info+0x300/0x308 [wave5] [ 1530.901788][ T1900] wave5_vpu_dec_finish_decode+0x6c/0x3dc [wave5] [ 1530.908081][ T1900] wave5_vpu_irq_thread+0x140/0x168 [wave5] [ 1530.913856][ T1900] irq_thread_fn+0x44/0xa4 [ 1530.918154][ T1900] irq_thread+0x15c/0x288 [ 1530.922330][ T1900] kthread+0x104/0x1d4 [ 1530.926247][ T1900] ret_from_fork+0x10/0x20 [ 1530.930520][ T1900] Code: 2a1f03ea 2a1f03eb 35ffef2c 17ffff74 (d42aa240) [ 1530.937296][ T1900] ---[ end trace 0000000000000000 ]--- [ 1530.942596][ T1900] Kernel panic - not syncing: BRK handler: Fatal exception [ 1530.949629][ T1900] SMP: stopping secondary CPUs [ 1530.954244][ T1900] Kernel Offset: disabled [ 1530.958415][ T1900] CPU features: 0x00,00000000,00800184,0000421b [ 1530.964496][ T1900] Memory Limit: none Move the disp_info assignment after testing that the index is positive to avoid the exception. Fixes: 45d1a2b93277 ("media: chips-media: wave5: Add vpuapi layer") Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13media: chips-media: wave5: Fix spelling mistake "bufferur" -> "buffer"Colin Ian King1-1/+1
There is a spelling mistake in a dev_dbg message. Fix it. Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13media: chips-media: wave5: Remove duplicate checkDan Carpenter1-3/+0
We already verified that "ret" is zero a few lines earlier. Delete this duplicate check. Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-12media: venus: core: Set up secure memory ranges for SC7280Luca Weiss1-0/+4
Not all SC7280 devices ship with ChromeOS firmware. Other devices need PAS for image authentication. That requires the predefined virtual address ranges to be passed via scm calls. Define them to enable Venus on non-CrOS SC7280 devices. Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Reviewed-by: Vikash Garodia <quic_vgarodia@quicinc.com> Signed-off-by: Luca Weiss <luca.weiss@fairphone.com> Signed-off-by: Stanimir Varbanov <stanimir.k.varbanov@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-12Backmerge tag 'v6.7-rc5' into drm-nextDave Airlie7-44/+30
Linux 6.7-rc5 Alex requested this for some amdkfd work relying on the symbols exports. Signed-off-by: Dave Airlie <airlied@redhat.com>
2023-12-09media: rkisp1: resizer: Stop manual allocation of v4l2_subdev_stateLaurent Pinchart1-14/+24
Supported media bus codes on the resizer sink pad are identical to the ISP source pad. The .enum_mbus_code() handler thus delegates the enumeration to the ISP's operation. This is problematic for two reasons: - Format enumeration on the ISP source pad is dependent on the format configured on the ISP sink pad for the same subdev state (TRY or ACTIVE), while format enumeration on the resizer sink pad should return all formats supported by the resizer subdev, regardless of the ISP configuration. - Delegating the operation involves creating a fake v4l2_subdev_state on the stack to pass to the ISP .enum_mbus_code() handler. This gets in the way of evolution of both the ISP enumeration handler and, more generally, the V4L2 subdev state infrastructure. Fix those two issues by implementing format enumeration manually for the resizer. Link: https://lore.kernel.org/r/20231126020948.2700-1-laurent.pinchart@ideasonboard.com Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2023-12-09media: rkisp1: debug: Count completed frame interruptsPaul Elder3-0/+5
Add a counter to debugfs to count the number of frame-end interrupts. Link: https://lore.kernel.org/r/20231201140433.2126011-4-paul.elder@ideasonboard.com Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Alexander Stein <alexander.stein@ew.tq-group.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2023-12-09media: rkisp1: debug: Add register dump for ISPaul Elder1-0/+4
Add register dump for the ISP image stabilizer module to debugfs. This helps debugging issues related to digital zoom. Link: https://lore.kernel.org/r/20231201140433.2126011-3-paul.elder@ideasonboard.com Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2023-12-09media: rkisp1: regs: Consolidate MI interrupt wrap fieldsPaul Elder1-6/+3
Consolidate the wraparound fields in the memory interface interrupt status registers, so that it can be more succinctly expressed by taking the stream ID (main or self) as a parameter. Link: https://lore.kernel.org/r/20231201140433.2126011-2-paul.elder@ideasonboard.com Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2023-12-09media: rkisp1: Fix IRQ disable race issueTomi Valkeinen2-4/+30
In rkisp1_isp_stop() and rkisp1_csi_disable() the driver masks the interrupts and then apparently assumes that the interrupt handler won't be running, and proceeds in the stop procedure. This is not the case, as the interrupt handler can already be running, which would lead to the ISP being disabled while the interrupt handler handling a captured frame. This brings up two issues: 1) the ISP could be powered off while the interrupt handler is still running and accessing registers, leading to board lockup, and 2) the interrupt handler code and the code that disables the streaming might do things that conflict. It is not clear to me if 2) causes a real issue, but 1) can be seen with a suitable delay (or printk in my case) in the interrupt handler, leading to board lockup. Link: https://lore.kernel.org/r/20231207-rkisp-irq-fix-v3-4-358a2c871a3c@ideasonboard.com Tested-by: Adam Ford <aford173@gmail.com> #imx8mp-beacon Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2023-12-09media: rkisp1: Store IRQ linesTomi Valkeinen2-5/+23
Store the IRQ lines used by the driver for easy access. These are needed in future patches which fix IRQ race issues. Link: https://lore.kernel.org/r/20231207-rkisp-irq-fix-v3-3-358a2c871a3c@ideasonboard.com Tested-by: Adam Ford <aford173@gmail.com> #imx8mp-beacon Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2023-12-09media: rkisp1: Fix IRQ handler return valuesTomi Valkeinen1-4/+12
The IRQ handler rkisp1_isr() calls sub-handlers, all of which returns an irqreturn_t value, but rkisp1_isr() ignores those values and always returns IRQ_HANDLED. Fix this by collecting the return values, and returning IRQ_HANDLED or IRQ_NONE as appropriate. Link: https://lore.kernel.org/r/20231207-rkisp-irq-fix-v3-2-358a2c871a3c@ideasonboard.com Tested-by: Adam Ford <aford173@gmail.com> #imx8mp-beacon Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2023-12-09media: rkisp1: Drop IRQF_SHAREDTomi Valkeinen1-1/+1
In all known platforms the ISP has dedicated IRQ lines, but for some reason the driver uses IRQF_SHARED. Supporting IRQF_SHARED properly requires handling interrupts even when our device is disabled, and the driver does not handle this. To avoid adding such code, and to be sure the driver won't accidentally be used in a platform with shared interrupts, let's drop the IRQF_SHARED flag. Link: https://lore.kernel.org/r/20231207-rkisp-irq-fix-v3-1-358a2c871a3c@ideasonboard.com Tested-by: Adam Ford <aford173@gmail.com> #imx8mp-beacon Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>