media: i2c: Add driver for THine THP7312 ISP
Subsystems (4)
Laurent Pinchart
maintainerv3 cover media: i2c: Add driver for THine THP7312 ISP
Hello,
This patch series adds a new driver for the THine THP7312 ISP. It has been tested on an OLogic Pumpkin i350, which has a Mediatek MT8365 SoC, with the THine THSCG101 camera module.
Technically the driver itself (and its bindings) have no dependencies, but to run/test this on the Pumpkin i350 with the mainline kernel, a number of patches are needed to support the board and the MT8365 SoC. Some of those patches are on their way to mainline, and some, like the Pumpkin i350 board device tree, will require more work. For convenience and reference, the needed patches are available in [1].
[1] https://git.kernel.org/pub/scm/linux/kernel/git/pinchartl/linux.git/log/?h=mtk/v6.6/pumpkin/camera
Example overlays for DT integration of the THP7312 are available in that branch, in arch/arm64/boot/dts/mediatek/mt8365-pumpkin-csi0-thp7312-imx258.dtso and arch/arm64/boot/dts/mediatek/mt8365-pumpkin-csi1-thp7312-imx258.dtso.
Compared to v2, all comments received for the DT bindings in v1 have now been properly taken into account (as far as I can tell). The driver has also been improved slightly. Please see individual patches for detailed changelogs.
I also managed to get the mainline kernel running properly on the Pumpkin board, so this series has been properly tested on v6.6-rc5.
Below is the mandatory v4l2-compliance report. Careful readers may notice that my v4l2-utils version is three commits behind upstream, but that makes no practical difference as those commits are not related to v4l2-compliance.
root@buildroot ~ # v4l2-compliance -u /dev/v4l-subdev2 v4l2-compliance 1.25.0-5097, 64 bits, 64-bit time_t v4l2-compliance SHA: b79e00a74fde 2023-09-13 07:19:23
Compliance test for device /dev/v4l-subdev2:
Driver Info:
Driver version : 6.6.0
Capabilities : 0x00000000
Required ioctls:
test VIDIOC_SUDBEV_QUERYCAP: OK
test invalid ioctls: OK
Allow for multiple opens:
test second /dev/v4l-subdev2 open: OK
test VIDIOC_SUBDEV_QUERYCAP: OK
test for unlimited opens: OK
Debug ioctls:
test VIDIOC_LOG_STATUS: OK
Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK (Not Supported) test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 0 Audio Inputs: 0 Tuners: 0
Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0
Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported)
Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK test VIDIOC_QUERYCTRL: OK
test VIDIOC_G/S_CTRL: OK
test VIDIOC_G/S/TRY_EXT_CTRLS: OK test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 17 Private Controls: 4
Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK (Not Supported) test VIDIOC_G/S_PARM: OK (Not Supported)
test VIDIOC_G_FBUF: OK (Not Supported)
test VIDIOC_G_FMT: OK (Not Supported)
test VIDIOC_TRY_FMT: OK (Not Supported)
test VIDIOC_S_FMT: OK (Not Supported)
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
test Cropping: OK (Not Supported)
test Composing: OK (Not Supported)
test Scaling: OK (Not Supported)
Codec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) test VIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)
Buffer ioctls:
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK (Not Supported) test VIDIOC_EXPBUF: OK (Not Supported)
test Requests: OK (Not Supported)
Total for device /dev/v4l-subdev2: 43, Succeeded: 43, Failed: 0, Warnings: 0
Laurent Pinchart (1):
media: uapi: Add controls for the THP7312 ISP
Paul Elder (2):
dt-bindings: media: Add bindings for THine THP7312 ISP
media: i2c: Add driver for THine THP7312
.../bindings/media/i2c/thine,thp7312.yaml | 226 ++ .../userspace-api/media/drivers/index.rst | 1 + .../userspace-api/media/drivers/thp7312.rst | 32 + MAINTAINERS | 10 + drivers/media/i2c/Kconfig | 16 + drivers/media/i2c/Makefile | 1 + drivers/media/i2c/thp7312.c | 2330 +++++++++++++++++ include/uapi/linux/thp7312.h | 19 + include/uapi/linux/v4l2-controls.h | 6 + 9 files changed, 2641 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/i2c/thine,thp7312.yaml create mode 100644 Documentation/userspace-api/media/drivers/thp7312.rst create mode 100644 drivers/media/i2c/thp7312.c create mode 100644 include/uapi/linux/thp7312.h
base-commit: a1766a4fd83befa0b34d932d532e7ebb7fab1fa7
Signature · 3 lines
Regards, Laurent Pinchart
Laurent Pinchart
maintainerPATCH v3 1/3 dt-bindings: media: Add bindings for THine THP7312 ISP
From: Paul Elder <[email protected]>
The THP7312 is an external ISP from THine. Add DT bindings for it.
---
Changes since v2:
- Drop description of reg property
- Improve thine,boot-mode property documentation
- Making thine,boot-mode property optional
- Don't use underscores in supplies names
--- .../bindings/media/i2c/thine,thp7312.yaml | 226 ++++++++++++++++++ MAINTAINERS | 7 + 2 files changed, 233 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/i2c/thine,thp7312.yaml
Documentation/devicetree/bindings/media/i2c/thine,thp7312.yaml new file +226 -0
@@ -0,0 +1,226 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright (c) 2023 Ideas on Board +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/media/i2c/thine,thp7312.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: THine THP7312 + +maintainers: + - Paul Elder <paul.elder@@ideasonboard.com> + +description: + The THP7312 is a standalone ISP controlled over i2c, and is capable of + various image processing and correction functions, including 3A control. It + can be connected to CMOS image sensors from various vendors, supporting both + MIPI CSI-2 and parallel interfaces. It can also output on either MIPI CSI-2 + or parallel. The hardware is capable of transmitting and receiving MIPI + interlaved data strams with data types or multiple virtual channel + identifiers. + +allOf: + - $ref: ../video-interface-devices.yaml# + +properties: + compatible: + const: thine,thp7312 + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + description: CLKI clock input + + thine,boot-mode: + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 0 + maximum: 1 + default: 1 + description: + Boot mode of the THP7312, reflecting the value of the BOOT[0] pin strap. + 0 is for the SPI/2-wire slave boot, 1 is for the SPI master boot (from + external flash ROM). + + reset-gpios: + maxItems: 1 + description: + Reference to the GPIO connected to the RESET_N pin, if any. + Must be released (set high) after all supplies are applied. + + vddcore-supply: + description: + 1.2V supply for core, PLL, MIPI rx and MIPI tx. + + vhtermrx-supply: + description: + Supply for input (RX). 1.8V for MIPI, or 1.8/2.8/3.3V for parallel. + + vddtx-supply: + description: + Supply for output (TX). 1.8V for MIPI, or 1.8/2.8/3.3V for parallel. + + vddhost-supply: + description: + Supply for host interface. 1.8V, 2.8V, or 3.3V. + + vddcmos-supply: + description: + Supply for sensor interface. 1.8V, 2.8V, or 3.3V. + + vddgpio-0-supply: + description: + Supply for GPIO_0. 1.8V, 2.8V, or 3.3V. + + vddgpio-1-supply: + description: + Supply for GPIO_1. 1.8V, 2.8V, or 3.3V. + + orientation: true + rotation: true + + port: + $ref: /schemas/graph.yaml#/$defs/port-base + additionalProperties: false + + properties: + endpoint: + $ref: /schemas/media/video-interfaces.yaml# + unevaluatedProperties: false + + properties: + data-lanes: + description: + This property is for lane reordering between the THP7312 and the + SoC. The sensor supports either two-lane, or four-lane operation. + If this property is omitted four-lane operation is assumed. For + two-lane operation the property must be set to <1 2>. + minItems: 2 + maxItems: 4 + items: + maximum: 4 + + sensors: + type: object + description: List of connected sensors + + properties: + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + + patternProperties: + "^sensor@[01]": + type: object + description: + Sensors connected to the first and second input, with one node per + sensor. + + properties: + thine,model: + $ref: /schemas/types.yaml#/definitions/string + description: + Model of the connected sensors. Must be a valid compatible string. + + reg: + maxItems: 1 + description: THP7312 input port number + + data-lanes: + $ref: /schemas/media/video-interfaces.yaml#/properties/data-lanes + items: + maxItems: 4 + description: + This property is for lane reordering between the THP7312 and the imaging + sensor that it is connected to. + + patternProperties: + ".*-supply": + description: Power supplies for the sensor + + required: + - reg + - data-lanes + + additionalProperties: false + + required: + - "#address-cells" + - "#size-cells" + + additionalProperties: false + +required: + - compatible + - reg + - reset-gpios + - clocks + - vddcore-supply + - vhtermrx-supply + - vddtx-supply + - vddhost-supply + - vddcmos-supply + - vddgpio-0-supply + - vddgpio-1-supply + - sensors + - port + +additionalProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + + i2c { + #address-cells = <1>; + #size-cells = <0>; + + camera@61 { + compatible = "thine,thp7312"; + reg = <0x61>; + + pinctrl-names = "default"; + pinctrl-0 = <&cam1_pins_default>; + + reset-gpios = <&pio 119 GPIO_ACTIVE_LOW>; + clocks = <&camera61_clk>; + + vddcore-supply = <&vsys_v4p2>; + vhtermrx-supply = <&vsys_v4p2>; + vddtx-supply = <&vsys_v4p2>; + vddhost-supply = <&vsys_v4p2>; + vddcmos-supply = <&vsys_v4p2>; + vddgpio-0-supply = <&vsys_v4p2>; + vddgpio-1-supply = <&vsys_v4p2>; + + orientation = <0>; + rotation = <0>; + + sensors { + #address-cells = <1>; + #size-cells = <0>; + + sensor@0 { + thine,model = "sony,imx258"; + reg = <0>; + + data-lanes = <4 1 3 2>; + + dovdd-supply = <&vsys_v4p2>; + avdd-supply = <&vsys_v4p2>; + dvdd-supply = <&vsys_v4p2>; + }; + }; + + port { + thp7312_2_endpoint: endpoint { + remote-endpoint = <&mipi_thp7312_2>; + data-lanes = <4 2 1 3>; + }; + }; + }; + }; +...
MAINTAINERS +7 -0
@@ -21447,6 +21447,13 @@ S: Maintained F: Documentation/ABI/testing/sysfs-class-firmware-attributes F: drivers/platform/x86/think-lmi.? +THP7312 ISP DRIVER +M: Paul Elder <[email protected]> +L: [email protected] +S: Maintained +T: git git://linuxtv.org/media_tree.git +F: Documentation/devicetree/bindings/media/i2c/thine,thp7312.yaml + THUNDERBOLT DMA TRAFFIC TEST DRIVER M: Isaac Hazan <[email protected]> L: [email protected]
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v3 1/3] dt-bindings: media: Add bindings for THine THP7312 ISP
On 12/10/2023 21:37, Laurent Pinchart wrote:
Thanks for the changes
Quoted 15 lines
Documentation/devicetree/bindings/media/i2c/thine,thp7312.yaml new file +15
-0+ + port: + $ref: /schemas/graph.yaml#/$defs/port-base + additionalProperties: false + + properties: + endpoint: + $ref: /schemas/media/video-interfaces.yaml# + unevaluatedProperties: false + + properties: + data-lanes: + description: + This property is for lane reordering between the THP7312 and the + SoC. The sensor supports either two-lane, or four-lane operation.
Documentation/devicetree/bindings/media/i2c/thine,thp7312.yaml line 106
Quoted 10 lines
Documentation/devicetree/bindings/media/i2c/thine,thp7312.yaml new file +10
-0+ If this property is omitted four-lane operation is assumed. For + two-lane operation the property must be set to <1 2>. + minItems: 2 + maxItems: 4 + items: + maximum: 4 + + sensors: + type: object + description: List of connected sensors
I don't understand why do you list sensors here. From the binding description I understood these are external sensors, which usually sit on I2C bus.
Quoted 10 lines
Documentation/devicetree/bindings/media/i2c/thine,thp7312.yaml new file +10
-0+ + properties: + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + + patternProperties: + "^sensor@[01]":
Documentation/devicetree/bindings/media/i2c/thine,thp7312.yaml line 126
Quoted 10 lines
Documentation/devicetree/bindings/media/i2c/thine,thp7312.yaml new file +10
-0+ type: object + description: + Sensors connected to the first and second input, with one node per + sensor. + + properties: + thine,model: + $ref: /schemas/types.yaml#/definitions/string + description: + Model of the connected sensors. Must be a valid compatible string.
Then why this isn't compatible?
Quoted 89 lines
Documentation/devicetree/bindings/media/i2c/thine,thp7312.yaml new file +89
-0+ + reg: + maxItems: 1 + description: THP7312 input port number + + data-lanes: + $ref: /schemas/media/video-interfaces.yaml#/properties/data-lanes + items: + maxItems: 4 + description: + This property is for lane reordering between the THP7312 and the imaging + sensor that it is connected to. + + patternProperties: + ".*-supply": + description: Power supplies for the sensor + + required: + - reg + - data-lanes + + additionalProperties: false + + required: + - "#address-cells" + - "#size-cells" + + additionalProperties: false + +required: + - compatible + - reg + - reset-gpios + - clocks + - vddcore-supply + - vhtermrx-supply + - vddtx-supply + - vddhost-supply + - vddcmos-supply + - vddgpio-0-supply + - vddgpio-1-supply + - sensors + - port + +additionalProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + + i2c { + #address-cells = <1>; + #size-cells = <0>; + + camera@61 { + compatible = "thine,thp7312"; + reg = <0x61>; + + pinctrl-names = "default"; + pinctrl-0 = <&cam1_pins_default>; + + reset-gpios = <&pio 119 GPIO_ACTIVE_LOW>; + clocks = <&camera61_clk>; + + vddcore-supply = <&vsys_v4p2>; + vhtermrx-supply = <&vsys_v4p2>; + vddtx-supply = <&vsys_v4p2>; + vddhost-supply = <&vsys_v4p2>; + vddcmos-supply = <&vsys_v4p2>; + vddgpio-0-supply = <&vsys_v4p2>; + vddgpio-1-supply = <&vsys_v4p2>; + + orientation = <0>; + rotation = <0>; + + sensors { + #address-cells = <1>; + #size-cells = <0>; + + sensor@0 { + thine,model = "sony,imx258"; + reg = <0>; + + data-lanes = <4 1 3 2>; + + dovdd-supply = <&vsys_v4p2>; + avdd-supply = <&vsys_v4p2>; + dvdd-supply = <&vsys_v4p2>; + };
Documentation/devicetree/bindings/media/i2c/thine,thp7312.yaml line 225
Quoted 10 lines
Documentation/devicetree/bindings/media/i2c/thine,thp7312.yaml new file +10
-0+ }; + + port { + thp7312_2_endpoint: endpoint { + remote-endpoint = <&mipi_thp7312_2>; + data-lanes = <4 2 1 3>; + }; + }; + }; + };
Best regards,
Krzysztof
Laurent Pinchart
maintainerRe: [PATCH v3 1/3] dt-bindings: media: Add bindings for THine THP7312 ISP
Hi Krzysztof,
Quoted 3 lines · Krzysztof Kozlowski
On 12/10/2023 21:37, Laurent Pinchart wrote:
Thanks for the changes
You're welcome. Sorry again for missing some of your review comments on v1.
Quoted 21 lines
Quoted 21 lines
Documentation/devicetree/bindings/media/i2c/thine,thp7312.yaml new file +21
-0+ + port: + $ref: /schemas/graph.yaml#/$defs/port-base + additionalProperties: false + + properties: + endpoint: + $ref: /schemas/media/video-interfaces.yaml# + unevaluatedProperties: false + + properties: + data-lanes: + description: + This property is for lane reordering between the THP7312 and the + SoC. The sensor supports either two-lane, or four-lane operation. + If this property is omitted four-lane operation is assumed. For + two-lane operation the property must be set to <1 2>. + minItems: 2 + maxItems: 4 + items: + maximum: 4
Quoted 8 lines
Documentation/devicetree/bindings/media/i2c/thine,thp7312.yaml line 106
Quoted 4 lines
Documentation/devicetree/bindings/media/i2c/thine,thp7312.yaml new file +4
-0+ + sensors: + type: object + description: List of connected sensorsI don't understand why do you list sensors here. From the binding description I understood these are external sensors, which usually sit on I2C bus.
Good question :-)
The sensors connected to the THP7312 input are controlled over I2C by the THP7312 itself. The host operating system doesn't have access to that I2C bus. The sensors are listed here because their power supplies need to be controlled by the host operating system.
Quoted 14 lines
Quoted 14 lines
Documentation/devicetree/bindings/media/i2c/thine,thp7312.yaml new file +14
-0+ + properties: + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + + patternProperties: + "^sensor@[01]": + type: object + description: + Sensors connected to the first and second input, with one node per + sensor.
Quoted 8 lines
Documentation/devicetree/bindings/media/i2c/thine,thp7312.yaml line 126
Quoted 6 lines
Documentation/devicetree/bindings/media/i2c/thine,thp7312.yaml new file +6
-0+ + properties: + thine,model: + $ref: /schemas/types.yaml#/definitions/string + description: + Model of the connected sensors. Must be a valid compatible string.Then why this isn't compatible?
We picked a vendor-specific property to avoid implying that the sensor nodes will result in devices being created by the host operating system. I don't mind using "compatible" instead, but as far as I understand, a compatible string implies that corresponding device DT bindings should exist, and that won't be the case here necessarily.
Quoted 99 lines
Quoted 99 lines
Documentation/devicetree/bindings/media/i2c/thine,thp7312.yaml new file +99
-0+ + reg: + maxItems: 1 + description: THP7312 input port number + + data-lanes: + $ref: /schemas/media/video-interfaces.yaml#/properties/data-lanes + items: + maxItems: 4 + description: + This property is for lane reordering between the THP7312 and the imaging + sensor that it is connected to. + + patternProperties: + ".*-supply": + description: Power supplies for the sensor + + required: + - reg + - data-lanes + + additionalProperties: false + + required: + - "#address-cells" + - "#size-cells" + + additionalProperties: false + +required: + - compatible + - reg + - reset-gpios + - clocks + - vddcore-supply + - vhtermrx-supply + - vddtx-supply + - vddhost-supply + - vddcmos-supply + - vddgpio-0-supply + - vddgpio-1-supply + - sensors + - port + +additionalProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + + i2c { + #address-cells = <1>; + #size-cells = <0>; + + camera@61 { + compatible = "thine,thp7312"; + reg = <0x61>; + + pinctrl-names = "default"; + pinctrl-0 = <&cam1_pins_default>; + + reset-gpios = <&pio 119 GPIO_ACTIVE_LOW>; + clocks = <&camera61_clk>; + + vddcore-supply = <&vsys_v4p2>; + vhtermrx-supply = <&vsys_v4p2>; + vddtx-supply = <&vsys_v4p2>; + vddhost-supply = <&vsys_v4p2>; + vddcmos-supply = <&vsys_v4p2>; + vddgpio-0-supply = <&vsys_v4p2>; + vddgpio-1-supply = <&vsys_v4p2>; + + orientation = <0>; + rotation = <0>; + + sensors { + #address-cells = <1>; + #size-cells = <0>; + + sensor@0 { + thine,model = "sony,imx258"; + reg = <0>; + + data-lanes = <4 1 3 2>; + + dovdd-supply = <&vsys_v4p2>; + avdd-supply = <&vsys_v4p2>; + dvdd-supply = <&vsys_v4p2>; + }; + }; + + port { + thp7312_2_endpoint: endpoint { + remote-endpoint = <&mipi_thp7312_2>; + data-lanes = <4 2 1 3>; + }; + }; + }; + };
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v3 1/3] dt-bindings: media: Add bindings for THine THP7312 ISP
Quoted 20 lines · Laurent Pinchart
Quoted 16 lines
Quoted 5 lines
Documentation/devicetree/bindings/media/i2c/thine,thp7312.yaml new file +5
-0+ properties: + data-lanes: + description: + This property is for lane reordering between the THP7312 and the + SoC. The sensor supports either two-lane, or four-lane operation.Documentation/devicetree/bindings/media/i2c/thine,thp7312.yaml line 106
Quoted 10 lines
Documentation/devicetree/bindings/media/i2c/thine,thp7312.yaml new file +10
-0+ If this property is omitted four-lane operation is assumed. For + two-lane operation the property must be set to <1 2>. + minItems: 2 + maxItems: 4 + items: + maximum: 4 + + sensors: + type: object + description: List of connected sensorsQuoted 3 lines
I don't understand why do you list sensors here. From the binding description I understood these are external sensors, which usually sit on I2C bus.
Quoted 6 lines
Good question :-)
The sensors connected to the THP7312 input are controlled over I2C by the THP7312 itself. The host operating system doesn't have access to that I2C bus. The sensors are listed here because their power supplies need to be controlled by the host operating system.
OK
Quoted 24 lines
Quoted 15 lines
Quoted 15 lines
Documentation/devicetree/bindings/media/i2c/thine,thp7312.yaml new file +14
-0+ + properties: + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + + patternProperties: + "^sensor@[01]": + type: object + description: + Sensors connected to the first and second input, with one node per + sensor.Quoted 8 lines
Documentation/devicetree/bindings/media/i2c/thine,thp7312.yaml line 126
Quoted 6 lines
Documentation/devicetree/bindings/media/i2c/thine,thp7312.yaml new file +6
-0+ + properties: + thine,model: + $ref: /schemas/types.yaml#/definitions/string + description: + Model of the connected sensors. Must be a valid compatible string.Then why this isn't compatible?
Quoted 5 lines
We picked a vendor-specific property to avoid implying that the sensor nodes will result in devices being created by the host operating system. I don't mind using "compatible" instead, but as far as I understand, a compatible string implies that corresponding device DT bindings should exist, and that won't be the case here necessarily.
OK, looks sensible to me.
Best regards,
Krzysztof
Laurent Pinchart
maintainerPATCH v3 2/3 media: uapi: Add controls for the THP7312 ISP
In reply to Laurent PinchartThe THP7312 is an external ISP from THine. As such, it implements a large number of parameters to control all aspects of the image processing. Many of those controls are already standard in V4L2, but some are fairly device-specific.
Reserve a range of 32 controls for the device. The driver will implement 4 device-specific controls to start with, define and document them. 28 additional device-specific controls should be enough for future development.
--- .../userspace-api/media/drivers/index.rst | 1 + .../userspace-api/media/drivers/thp7312.rst | 32 +++++++++++++++++++ MAINTAINERS | 2 ++ include/uapi/linux/thp7312.h | 19 +++++++++++ include/uapi/linux/v4l2-controls.h | 6 ++++ 5 files changed, 60 insertions(+) create mode 100644 Documentation/userspace-api/media/drivers/thp7312.rst create mode 100644 include/uapi/linux/thp7312.h
Documentation/userspace-api/media/drivers/index.rst +1 -0
@@ -41,4 +41,5 @@ For more details see the file COPYING in the source distribution of Linux. npcm-video omap3isp-uapi st-vgxy61 + thp7312 uvcvideo
Documentation/userspace-api/media/drivers/thp7312.rst new file +32 -0
@@ -0,0 +1,32 @@ +.. SPDX-License-Identifier: GPL-2.0-only + +THine THP7312 ISP driver +======================== + +The THP7312 driver implements the following driver-specific controls: + +``V4L2_CID_THP7312_LOW_LIGHT_COMPENSATION`` + Enable/Disable auto-adjustment, based on lighting conditions, of the frame + rate when auto-exposure is enabled. + +``V4L2_CID_THP7312_AUTO_FOCUS_METHOD`` + Set method of auto-focus. Only takes effect when auto-focus is enabled. + + .. flat-table:: + :header-rows: 0 + :stub-columns: 0 + :widths: 1 4 + + * - ``0`` + - Contrast-based auto focus + * - ``1`` + - PDAF + * - ``2`` + - Hybrid of contrast-based and PDAF + +``V4L2_CID_THP7312_NOISE_REDUCTION_AUTO`` + Enable/Disable auto noise reduction. + +``V4L2_CID_THP7312_NOISE_REDUCTION_ABSOLUTE`` + Set the noise reduction strength, where 0 is the weakest and 10 is the + strongest.
MAINTAINERS +2 -0
@@ -21453,6 +21453,8 @@ L: [email protected] S: Maintained T: git git://linuxtv.org/media_tree.git F: Documentation/devicetree/bindings/media/i2c/thine,thp7312.yaml +F: Documentation/userspace-api/media/drivers/thp7312.rst +F: include/uapi/linux/thp7312.h THUNDERBOLT DMA TRAFFIC TEST DRIVER M: Isaac Hazan <[email protected]>
include/uapi/linux/thp7312.h new file +19 -0
@@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ +/* +* THine THP7312 user space header file. +* +* Copyright (C) 2021 THine Electronics, Inc. +* Copyright (C) 2023 Ideas on Board Oy +*/ + +#ifndef __UAPI_THP7312_H_ +#define __UAPI_THP7312_H_ + +#include <linux/v4l2-controls.h> + +#define V4L2_CID_THP7312_LOW_LIGHT_COMPENSATION (V4L2_CID_USER_THP7312_BASE + 0x01) +#define V4L2_CID_THP7312_AUTO_FOCUS_METHOD (V4L2_CID_USER_THP7312_BASE + 0x02) +#define V4L2_CID_THP7312_NOISE_REDUCTION_AUTO (V4L2_CID_USER_THP7312_BASE + 0x03) +#define V4L2_CID_THP7312_NOISE_REDUCTION_ABSOLUTE (V4L2_CID_USER_THP7312_BASE + 0x04) + +#endif /* __UAPI_THP7312_H_ */
include/uapi/linux/v4l2-controls.h +6 -0
@@ -209,6 +209,12 @@ enum v4l2_colorfx {*/ #define V4L2_CID_USER_NPCM_BASE (V4L2_CID_USER_BASE + 0x11b0) +/* +* The base for THine THP7312 driver controls. +* We reserve 32 controls for this driver. +*/ +#define V4L2_CID_USER_THP7312_BASE (V4L2_CID_USER_BASE + 0x11c0) +/* MPEG-class control IDs */ /* The MPEG controls are applicable to all codec controls * and the 'MPEG' part of the define is historical */
Signature · 3 lines
Regards, Laurent Pinchart
Laurent Pinchart
maintainerPATCH v3 3/3 media: i2c: Add driver for THine THP7312
In reply to Laurent PinchartFrom: Paul Elder <[email protected]>
The THP7312 is an external camera ISP from THine. Add a V4L2 subdev driver for it.
---
Changes since v2:
- Make boot-mode property optional
- Fix dev_err_probe() usage in DT parsing
- Additional dev_err_probe() usage
- Use %u instead of %d for unsigned values
- Don't split lines unnecessarily
- Fix error handling in firmware upload initialization
- Use CCI helpers in firmware update code
- Fix runtime PM usage count
--- MAINTAINERS | 1 + drivers/media/i2c/Kconfig | 16 + drivers/media/i2c/Makefile | 1 + drivers/media/i2c/thp7312.c | 2330 +++++++++++++++++++++++++++++++++++ 4 files changed, 2348 insertions(+) create mode 100644 drivers/media/i2c/thp7312.c
MAINTAINERS +1 -0
@@ -21454,6 +21454,7 @@ S: Maintained T: git git://linuxtv.org/media_tree.git F: Documentation/devicetree/bindings/media/i2c/thine,thp7312.yaml F: Documentation/userspace-api/media/drivers/thp7312.rst +F: drivers/media/i2c/thp7312.c F: include/uapi/linux/thp7312.h THUNDERBOLT DMA TRAFFIC TEST DRIVER
drivers/media/i2c/Kconfig +16 -0
@@ -628,6 +628,22 @@ source "drivers/media/i2c/et8ek8/Kconfig" endif +menu "Camera ISPs" + visible if MEDIA_CAMERA_SUPPORT + +config VIDEO_THP7312 + tristate "THine THP7312 support" + depends on I2C + select MEDIA_CONTROLLER + select V4L2_CCI_I2C + select V4L2_FWNODE + select VIDEO_V4L2_SUBDEV_API + help + This is a Video4Linux2 sensor-level driver for the THine + THP7312 ISP. + +endmenu + menu "Lens drivers" visible if MEDIA_CAMERA_SUPPORT
drivers/media/i2c/Makefile +1 -0
@@ -128,6 +128,7 @@ obj-$(CONFIG_VIDEO_TDA7432) += tda7432.o obj-$(CONFIG_VIDEO_TDA9840) += tda9840.o obj-$(CONFIG_VIDEO_TEA6415C) += tea6415c.o obj-$(CONFIG_VIDEO_TEA6420) += tea6420.o +obj-$(CONFIG_VIDEO_THP7312) += thp7312.o obj-$(CONFIG_VIDEO_THS7303) += ths7303.o obj-$(CONFIG_VIDEO_THS8200) += ths8200.o obj-$(CONFIG_VIDEO_TLV320AIC23B) += tlv320aic23b.o
drivers/media/i2c/thp7312.c new file +2330 -0
2,330 lines not on this page · raw message
Signature · 3 lines
Regards, Laurent Pinchart