summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2023-12-13media: i2c: thp7312: Store frame interval in subdev stateLaurent Pinchart
Use the newly added storage for frame interval in the subdev state to simplify the driver. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13media: docs: uAPI: Fix documentation of 'which' field for routing ioctlsLaurent Pinchart
The routing ioctls documentation incorrectly describes the 'which' field, due to a bad copy & paste. Fix it. Fixes: ea73eda50813 ("media: Documentation: Add GS_ROUTING documentation") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13media: docs: uAPI: Expand error documentation for invalid 'which' valueLaurent Pinchart
Multiple subdev ioctls that take a 'which' field do not document the error returned when the field has an invalid value. Expand the documentation to fix this. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13media: docs: uAPI: Clarify error documentation for invalid 'which' valueLaurent Pinchart
Invalid values for the 'which' field of structures passed to multiple subdev ioctls result in an EINVAL error being returned. The documentation of the corresponding ioctls indicates this with sentences such as the following: the ``which`` field references a non-existing format This is confusing. Clarify the documentation. Suggested-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13media: v4l2-subdev: Store frame interval in subdev stateLaurent Pinchart
Subdev states store all standard pad configuration data, except for frame intervals. Fix it by adding interval fields in the v4l2_subdev_pad_config and v4l2_subdev_stream_config structures, with corresponding accessor functions and a helper function to implement the .get_frame_interval() operation. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13media: v4l2-subdev: Add which field to struct v4l2_subdev_frame_intervalLaurent Pinchart
Due to a historical mishap, the v4l2_subdev_frame_interval structure is the only part of the V4L2 subdev userspace API that doesn't contain a 'which' field. This prevents trying frame intervals using the subdev 'TRY' state mechanism. Adding a 'which' field is simple as the structure has 8 reserved fields. This would however break userspace as the field is currently set to 0, corresponding to V4L2_SUBDEV_FORMAT_TRY, while the corresponding ioctls currently operate on the 'ACTIVE' state. We thus need to add a new subdev client cap, V4L2_SUBDEV_CLIENT_CAP_INTERVAL_USES_WHICH, to indicate that userspace is aware of this new field. All drivers that implement the subdev .get_frame_interval() and .set_frame_interval() operations are updated to return -EINVAL when operating on the TRY state, preserving the current behaviour. While at it, fix a bad copy&paste in the documentation of the struct v4l2_subdev_frame_interval_enum 'which' field. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> # for imx-media Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> # for tegra-video Reviewed-by: Mauro Carvalho Chehab <mchehab@kernel.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13media: v4l2-subdev: Turn .[gs]_frame_interval into pad operationsLaurent Pinchart
The subdev .[gs]_frame_interval are video operations, but they operate on pads (and even on streams). Not only is this confusing, it causes practical issues for drivers as the operations don't receive a subdev state pointer, requiring manual state handling. To improve the situation, turn the operations into pad operations, and extend them to receive a state pointer like other pad operations. While at it, rename the operations to .[gs]et_frame_interval at the same time to match the naming scheme of other pad operations. This isn't strictly necessary, but given that all drivers using those operations need to be modified, handling the rename separately would generate more churn for very little gain (if at all). Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> # for imx-media Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> # for tegra-video Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13media: v4l: subdev: Move out subdev state lock macros outside ↵Tomi Valkeinen
CONFIG_MEDIA_CONTROLLER The subdev state locking macros and macros to get the active state are currently behind CONFIG_MEDIA_CONTROLLER. This makes sense, as there can be no subdev state without MC. However, we have code paths common to MC and non-MC cases which call subdev operations that have subdev state as a parameter. In the non-MC case the state parameter would always be NULL. Thus it makes sense to allow, e.g.: v4l2_subdev_call_state_active(sd, pad, get_fmt, fmt) which for non-MC case would call the subdev passing NULL as the state. This currently fails: https://lore.kernel.org/oe-kbuild-all/202312061101.PLrz5NnJ-lkp@intel.com/ Fix the issue by moving the related macros to be outside CONFIG_MEDIA_CONTROLLER. The v4l2_subdev_lock_state() and v4l2_subdev_unlock_state() macros will crash if given NULL as the state, but the other macros behave correctly even when there's no active state, and they will only call the lock/unlock macros if there is a state. An alternative fix would be to make another version of v4l2_subdev_call_state_try() with ifdefs, which would not use any state macros and would always pass NULL as the state. But having two version of a macro/function is always more confusing than having just one, so I went this way. So, this fixes the v4l2_subdev_call_state_active() macro. But we also have v4l2_subdev_call_state_try(). It would be possible to fix that macro by additionally creating "no-op" variants of the state alloc and free functions. However, v4l2_subdev_call_state_try() is only used by a single driver (stm32-dcmi), which selects MC, and the macro is supposed to be removed as soon as the users have been converted away from the macro. Thus I have not touched the state alloc/free functions, and I think it makes sense to keep alloc/free functions available only if there's actually something that can be allocated or freed. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Link: https://lore.kernel.org/r/20231208-v4l2-state-mc-fix-v1-1-a0c8162557c6@ideasonboard.com Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13media: s5p-mfc: DPB Count Independent of VIDIOC_REQBUFAakarsh Jain
Add allocation of DPB buffers based on MFC requirement so, codec buffers allocations has been moved after state MFCINST_HEAD_PRODUCED. It is taken care that codec buffer allocation is performed in process context from userspace IOCTL call. 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: Load firmware for each run in MFCv12.Aakarsh Jain
In MFCv12, some section of firmware gets updated at each MFC run. Hence we need to reload original firmware for each run at the start. 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: Set context for valid case before calling try_runAakarsh Jain
Context bit is set for hardware execution if there is a buffer in source and destination queue before calling try_run in the init_buffers function. Now there will be a new context created and hardware will be invoked for the buffer queued instead of waiting for another buffer to be queued from userspace to set this context bit for hw execution. 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: Add support for DMABUF for encoderAakarsh Jain
Add dmabuf support for mfc encoder 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: Add support for UHD encoding.Aakarsh Jain
MFC driver had restriction on max resolution of 1080p, updated it for UHD. Added corresponding support to set recommended profile and level for H264 in UHD scenario. 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: Add support for rate controls in MFCv12Aakarsh Jain
In MFCv12, the rc configs are changed with support for CBR loose, CBR tight and Variable Bitrate (VBR) added. 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: Add YV12 and I420 multiplanar format supportAakarsh Jain
YV12 and I420 format (3-plane) support is added. Stride information is added to all formats and planes since it is necessary for YV12/I420 which are different from width. 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: Add initial support for MFCv12Aakarsh Jain
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 Jain
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-13dt-bindings: media: s5p-mfc: Add mfcv12 variantAakarsh Jain
Add Tesla FSD MFC(MFC v12) compatible. Cc: linux-fsd@tesla.com Signed-off-by: Aakarsh Jain <aakarsh.jain@samsung.com> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13media: i2c: Add driver for OmniVision OV64A40Jacopo Mondi
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: dt-bindings: Add OmniVision OV64A40Jacopo Mondi
Add bindings for OmniVision OV64A40. 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> Acked-by: Conor Dooley <conor.dooley@microchip.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 Jain
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 Bingham
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 Bingham
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 Bingham
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 Bingham
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 Bingham
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: dt-bindings: media: imx335: Add supply bindingsKieran Bingham
Add the bindings for the supply references used on the IMX335. Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Acked-by: Conor Dooley <conor.dooley@microchip.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é Apitzsch
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é Apitzsch
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é Apitzsch
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é Apitzsch
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 Reichel
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: MAINTAINERS: Add GalaxyCore in camera sensor sectionSebastian Reichel
"gc" prefixed i2c media drivers are most likely GalaxyCore camera sensor drivers, so add it to the list. Signed-off-by: Sebastian Reichel <sre@kernel.org> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13media: dt-bindings: gc0308: add bindingSebastian Reichel
Add DT binding for GalaxyCore GC0308 camera sensor. Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by: Sebastian Reichel <sre@kernel.org> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13media: dt-bindings: ov8856: decouple lanes and link frequency from driverKrzysztof Kozlowski
The data lanes and link frequency were set to match existing Linux driver limitations, however bindings should be independent of chosen Linux driver support. Decouple these properties from the driver to match what is actually supported by the hardware. This also fixes DTS example: ov8856.example.dtb: camera@10: port:endpoint:link-frequencies:0: [360000000] is too short Fixes: 066a94e28a23 ("media: dt-bindings: media: Use graph and video-interfaces schemas") Acked-by: Conor Dooley <conor.dooley@microchip.com> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13media: Documentation: LP-11 and LP-111 are states, not modesSakari Ailus
LP-11 and LP-111 are CSI-2 bus states, not modes. Fix this. 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>
2023-12-13media: Documentation: BT.601 is not a busSakari Ailus
BT.601 is not actually a bus specification, leaving parallel bus without a specification to refer to. Fix this. 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 Ailus
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 Goede
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 Goede
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 Goede
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 Goede
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 Goede
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 Goede
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 Goede
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 Goede
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 Goede
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 Merciai
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: dt-bindings: alvium: add document YAML bindingTommaso Merciai
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 <tomm.merciai@gmail.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Conor Dooley <conor.dooley@microchip.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2023-12-13dt-bindings: vendor-prefixes: Add prefix alliedvisionTommaso Merciai
Add a vendor prefix entry for Allied Vision Technologies GmbH (https://www.alliedvision.com) Signed-off-by: Tommaso Merciai <tomm.merciai@gmail.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Conor Dooley <conor.dooley@microchip.com> Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>