aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-12-13media: i2c: Add support for alvium cameraTommaso Merciai5-0/+3042
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 <[email protected]> [Sakari Ailus: Assign ret before using it in probe and squash Tommaso's other fixes.] Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> [hverkuil: alvium-csi2.h: SPDX must use /* */ instead of //]
2023-12-13media: dt-bindings: alvium: add document YAML bindingTommaso Merciai1-0/+81
Add documentation of device tree in YAML schema for the ALVIUM Camera from Allied Vision Inc. References: - https://www.alliedvision.com/en/products/embedded-vision-solutions Signed-off-by: Tommaso Merciai <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Reviewed-by: Conor Dooley <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-12-13dt-bindings: vendor-prefixes: Add prefix alliedvisionTommaso Merciai1-0/+2
Add a vendor prefix entry for Allied Vision Technologies GmbH (https://www.alliedvision.com) Signed-off-by: Tommaso Merciai <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Acked-by: Conor Dooley <[email protected]> Acked-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
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 <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-12-13media: dt-bindings: ak7375: Add ak7345 supportVincent Knecht1-1/+3
Document AK7345 bindings. Compared to AK7375, it has only 9 bits position values (instead of 12), 20 ms power-up delay (instead of 10), and no known standby register setting. Acked-by: Conor Dooley <[email protected]> Signed-off-by: Vincent Knecht <[email protected]> [Sakari Ailus: Rewrap commit message.] Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
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 <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
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: [email protected] Signed-off-by: Alexander Stein <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> [Sakari Ailus: Fixed the Fixes: tag.] Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-12-13media: v4l2-cci: Add support for little-endian encoded registersAlexander Stein2-8/+41
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: [email protected] Signed-off-by: Alexander Stein <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> [Sakari Ailus: Fixed commit message.] Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
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 <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
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 <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
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 <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
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 <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
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 <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-12-13MAINTAINERS: Add missing bindings for max96712Niklas Söderlund1-0/+1
Add the binding documentation to the entry in the MAINTAINERS file. Signed-off-by: Niklas Söderlund <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-12-13media: i2c: Introduce a driver for the Techwell TW9900 decoderMehdi Djait4-0/+803
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 <[email protected]> Signed-off-by: Mehdi Djait <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-12-13media: dt-bindings: media: i2c: Add bindings for TW9900Mehdi Djait1-0/+137
The Techwell TW9900 is a video decoder supporting multiple input standards such as PAL and NTSC and has a parallel BT.656 output interface. It's designed to be low-power, posesses some features such as a programmable comb-filter, and automatic input standard detection Reviewed-by: Paul Kocialkowski <[email protected]> Reviewed-by: Rob Herring <[email protected]> Signed-off-by: Mehdi Djait <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-12-13dt-bindings: vendor-prefixes: Add techwell vendor prefixMehdi Djait1-0/+2
Add prefix for Techwell, Inc. Acked-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Mehdi Djait <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
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 <[email protected]> CC: Xiaolei Wang <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
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 <[email protected]> Cc: Nas Chung <[email protected]> Cc: Jackson Lee <[email protected]> Cc: Hans Verkuil <[email protected]> Cc: Mauro Carvalho Chehab <[email protected]> Cc: [email protected] Signed-off-by: Sebastian Fricke <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
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 <[email protected]> Reviewed-by: Nicolas Dufresne <[email protected]> Signed-off-by: Sebastian Fricke <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
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 <[email protected]> Signed-off-by: Sebastian Fricke <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-12-13media: MAINTAINERS: Correct file entry in WAVE5 VPU CODEC DRIVERLukas Bulwahn1-1/+1
Commit 26dde1beb359 ("media: chips-media: wave5: Add wave5 driver to maintainers file") adds the MAINTAINERS section WAVE5 VPU CODEC DRIVER referring to the 'cnm,wave5.yaml' media devicetree binding, but the file actually added in the commit de4b9f7e371a ("dt-bindings: media: wave5: add yaml devicetree bindings") is named 'cnm,wave521c.yaml'. Correct the file entry in WAVE5 VPU CODEC DRIVER. Fixes: 26dde1beb359 ("media: chips-media: wave5: Add wave5 driver to maintainers file") Signed-off-by: Lukas Bulwahn <[email protected]> Signed-off-by: Sebastian Fricke <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
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 <[email protected]> Reviewed-by: Nicolas Dufresne <[email protected]> Signed-off-by: Sebastian Fricke <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
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 <[email protected]> Reviewed-by: Bryan O'Donoghue <[email protected]> Reviewed-by: Vikash Garodia <[email protected]> Signed-off-by: Luca Weiss <[email protected]> Signed-off-by: Stanimir Varbanov <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
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/[email protected] Reviewed-by: Paul Elder <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Signed-off-by: Laurent Pinchart <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
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/[email protected] Signed-off-by: Paul Elder <[email protected]> Reviewed-by: Alexander Stein <[email protected]> Reviewed-by: Kieran Bingham <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Signed-off-by: Laurent Pinchart <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
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/[email protected] Signed-off-by: Paul Elder <[email protected]> Tested-by: Alexander Stein <[email protected]> Reviewed-by: Kieran Bingham <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Signed-off-by: Laurent Pinchart <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
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/[email protected] Signed-off-by: Paul Elder <[email protected]> Reviewed-by: Kieran Bingham <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Signed-off-by: Laurent Pinchart <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
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/[email protected] Tested-by: Adam Ford <[email protected]> #imx8mp-beacon Signed-off-by: Tomi Valkeinen <[email protected]> Signed-off-by: Laurent Pinchart <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
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/[email protected] Tested-by: Adam Ford <[email protected]> #imx8mp-beacon Signed-off-by: Tomi Valkeinen <[email protected]> Signed-off-by: Laurent Pinchart <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
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/[email protected] Tested-by: Adam Ford <[email protected]> #imx8mp-beacon Signed-off-by: Tomi Valkeinen <[email protected]> Signed-off-by: Laurent Pinchart <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
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/[email protected] Tested-by: Adam Ford <[email protected]> #imx8mp-beacon Signed-off-by: Tomi Valkeinen <[email protected]> Signed-off-by: Laurent Pinchart <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-12-09media: rkisp1: Fix memory leaks in rkisp1_isp_unregister()Tomi Valkeinen1-0/+1
Add missing call to v4l2_subdev_cleanup() to fix memory leak. Link: https://lore.kernel.org/r/[email protected] Fixes: 2cce0a369dbd ("media: rkisp1: isp: Use V4L2 subdev active state") Reviewed-by: Tommaso Merciai <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]> Signed-off-by: Laurent Pinchart <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-12-09media: rkisp1: Fix media device memory leakTomi Valkeinen1-1/+5
Add missing calls to media_device_cleanup() to fix memory leak. Link: https://lore.kernel.org/r/[email protected] Fixes: d65dd85281fb ("media: staging: rkisp1: add Rockchip ISP1 base driver") Reviewed-by: Tommaso Merciai <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]> Signed-off-by: Laurent Pinchart <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-12-09media: dt-bindings: media: rkisp1: Fix the port description for the parallel ↵Mehdi Djait1-5/+6
interface The bus-type belongs to the endpoint's properties and should therefore be moved. Link: https://lore.kernel.org/r/[email protected] Fixes: 6a0eaa25bf36 ("media: dt-bindings: media: rkisp1: Add port for parallel interface") Signed-off-by: Mehdi Djait <[email protected]> Acked-by: Conor Dooley <[email protected]> Signed-off-by: Laurent Pinchart <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-12-09media: nxp: imx8-isi-debug: Add missing 36-Bit DMA registers to debugfs outputAlexander Stein1-3/+24
The extended address registers are missing in the debug output register list. These are only available on 36-Bit DMA platforms. Due to the prolonged name, the output width has to be adjusted as well. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexander Stein <[email protected]> Tested-by: Alexander Stein <[email protected]> Signed-off-by: Laurent Pinchart <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-12-09media: imx-mipi-csis: Drop extra clock enable at probe()Tomi Valkeinen1-11/+2
The driver always enables the clocks at probe() and disables them only at remove(). It is not clear why the driver does this, as it supports runtime PM, and enables and disables the clocks in the runtime resume and suspend callbacks. Also, in the case runtime PM is not available, the driver calls the resume and suspend callbacks manually from probe() and remove(). Drop the unnecessary clock enable, thus enabling the clocks only when actually needed. Link: https://lore.kernel.org/r/[email protected] Fixes: 7807063b862b ("media: staging/imx7: add MIPI CSI-2 receiver subdev for i.MX7") Signed-off-by: Tomi Valkeinen <[email protected]> Signed-off-by: Laurent Pinchart <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-12-09media: imx-mipi-csis: Fix clock handling in remove()Tomi Valkeinen1-1/+3
The driver always calls mipi_csis_runtime_suspend() and mipi_csis_clk_disable() in remove(). This causes multiple WARNs from the kernel, as the clocks get disabled too many times. Fix the remove() to call mipi_csis_runtime_suspend() and mipi_csis_clk_disable() in a way that reverses what is done in probe(). Link: https://lore.kernel.org/r/[email protected] Fixes: 7807063b862b ("media: staging/imx7: add MIPI CSI-2 receiver subdev for i.MX7") Signed-off-by: Tomi Valkeinen <[email protected]> Signed-off-by: Laurent Pinchart <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-12-09media: imx: imx7-media-csi: Include headers explicitlyLaurent Pinchart1-6/+21
Include all the headers that the driver needs explicitly instead of relying on indirect inclusion. While at it, drop a few unneeded headers. Signed-off-by: Laurent Pinchart <[email protected]> Acked-by: Alexander Stein <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-12-09media: uvcvideo: Fix power line control for SunplusIT cameraRicardo Ribalda1-0/+9
The device does not implement the power line frequency control correctly. It is a UVC 1.5 device, but implements the control as a UVC 1.1 device. Add the corresponding control mapping override. Bus 003 Device 002: ID 2b7e:b752 SunplusIT Inc HD Camera Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.01 bDeviceClass 239 Miscellaneous Device bDeviceSubClass 2 bDeviceProtocol 1 Interface Association bMaxPacketSize0 64 idVendor 0x2b7e idProduct 0xb752 bcdDevice 0.04 iManufacturer 1 SunplusIT Inc iProduct 2 HD Camera iSerial 3 01.00.00 bNumConfigurations 1 Cc: Yunke Cao <[email protected]> Signed-off-by: Ricardo Ribalda <[email protected]> Signed-off-by: Laurent Pinchart <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-12-09media: uvcvideo: Pick first best alternate setting insteed of lastLaurent Pinchart1-1/+1
When selecting an alternate setting, the driver loops over all available alternate settings to find the one with the lowest bandwidth high enough for the selected format and resolution. While all alternate settings should have different packet sizes, some buggy devices report multiple alternate settings with the same size. The driver happens to pick the last one in this case. In theory this should work fine, but in real life we have device bugs. The Ali Corp. Newmine Camera (0402:8841) exposes four alternate settings with the same packet size. The first three seem to work fine, while selecting the last one results in lots of transmission errors. Switch to using the first best alternate setting when multiple are present. This should be safe (last famous words), as sniffing USB traffic with the faulty device shows that Windows 10 picks the first alternate setting, and devices are typically tested on Windows. Closes: https://lore.kernel.org/linux-media/[email protected]/ Reported-by: Karel Janda <[email protected]> Suggested-by: Karel Janda <[email protected]> Signed-off-by: Laurent Pinchart <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-12-09media: uvcvideo: Fix power line control for a Chicony cameraRicardo Ribalda1-0/+9
The device does not implement the control properly. Fixes v4l2-compliance error: info: checking control 'Power Line Frequency' (0x00980918) fail: v4l2-test-controls.cpp(552): could not set valid menu item 3 Signed-off-by: Ricardo Ribalda <[email protected]> Signed-off-by: Laurent Pinchart <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-12-09media: videobuf2: request more buffers for vb2_readHans Verkuil1-2/+7
The vb2 read support requests 1 buffer, leaving it to the driver to increase this number to something that works. Unfortunately, drivers do not deal with this reliably, and in fact this caused problems for the bttv driver and reading from /dev/vbiX, causing every other VBI frame to be all 0. Instead, request as the number of buffers whatever is the maximum of 2 and q->min_buffers_needed+1. In order to start streaming you need at least q->min_buffers_needed queued buffers, so add 1 buffer for processing. And if that field is 0, then choose 2 (again, one buffer is being filled while the other one is being processed). This certainly makes more sense than requesting just 1 buffer, and the VBI bttv support is now working again. It turns out that the old videobuf1 behavior of bttv was to allocate 8 (video) and 4 (vbi) buffers when used with read(). After the vb2 conversion that changed to 2 for both. With this patch it is 3, which is really all you need. Signed-off-by: Hans Verkuil <[email protected]> Fixes: b7ec3212a73a ("media: bttv: convert to vb2") Tested-by: Dr. David Alan Gilbert <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-12-09media: bttv: add back vbi hackHans Verkuil1-0/+21
The old (now removed) videobuf framework had an optional vbi hack where the sequence number of the frame counter was copied in the last 4 bytes of the buffer. This hack was active only for the read() interface (so not for streaming I/O), and it was enabled by bttv. This allowed applications that used read() for the VBI data to match it with the corresponding video frame. When bttv was converted to vb2 this hack was forgotten, but some old applications rely on this. So add this back, but this time in the bttv driver rather than in the vb2 framework. Signed-off-by: Hans Verkuil <[email protected]> Fixes: b7ec3212a73a ("media: bttv: convert to vb2") Tested-by: Dr. David Alan Gilbert <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-12-09media: bttv: start_streaming should return a proper error codeHans Verkuil2-9/+5
The start_streaming callback returned 0 or 1 instead of a proper error code. Fix that. Signed-off-by: Hans Verkuil <[email protected]> Fixes: b7ec3212a73a ("media: bttv: convert to vb2") Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-12-08media: ov9640: Don't set format in sub-device stateSakari Ailus1-2/+0
For the purpose of setting old non-pad based sub-device try format as a basis for VIDIOC_TRY_FMT implementation, there is no need to set the format in the sub-device state. Drop the assignment to the state, which would result in a NULL pointer dereference. Fixes: fd17e3a9a788 ("media: i2c: Use accessors for pad config 'try_*' fields") Signed-off-by: Sakari Ailus <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-12-08media: tw9910: Don't set format in sub-device stateSakari Ailus1-2/+0
For the purpose of setting old non-pad based sub-device try format as a basis for VIDIOC_TRY_FMT implementation, there is no need to set the format in the sub-device state. Drop the assignment to the state, which would result in a NULL pointer dereference. Fixes: fd17e3a9a788 ("media: i2c: Use accessors for pad config 'try_*' fields") Signed-off-by: Sakari Ailus <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-12-08media: rj54n1cb0c: Don't set format in sub-device stateSakari Ailus1-3/+1
For the purpose of setting old non-pad based sub-device try format as a basis for VIDIOC_TRY_FMT implementation, there is no need to set the format in the sub-device state. Drop the assignment to the state, which would result in a NULL pointer dereference. Fixes: fd17e3a9a788 ("media: i2c: Use accessors for pad config 'try_*' fields") Signed-off-by: Sakari Ailus <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-12-08media: mt9t112: Don't set format in sub-device stateSakari Ailus1-1/+0
For the purpose of setting old non-pad based sub-device try format as a basis for VIDIOC_TRY_FMT implementation, there is no need to set the format in the sub-device state. Drop the assignment to the state, which would result in a NULL pointer dereference. Fixes: fd17e3a9a788 ("media: i2c: Use accessors for pad config 'try_*' fields") Signed-off-by: Sakari Ailus <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-12-08media: adv7183: Don't set format in sub-device stateSakari Ailus1-2/+0
For the purpose of setting old non-pad based sub-device try format as a basis for VIDIOC_TRY_FMT implementation, there is no need to set the format in the sub-device state. Drop the assignment to the state, which would result in a NULL pointer dereference. Fixes: fd17e3a9a788 ("media: i2c: Use accessors for pad config 'try_*' fields") Signed-off-by: Sakari Ailus <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>