Skip to contentSkip to conversation

Linux CCS driver

PATCH RESEND Superseded Sakari Ailus 2 participants 15 messages Sep 30, 2020 – Oct 7, 2020

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Linux CCS driver

Hi folks,

I'm just resending the DT binding patches while cc'ing the devicetree list. The entire set is here:

<URL:https://lore.kernel.org/linux-media/[email protected]/T/#t>

The entire set converts the existing SMIA driver into a MIPI CCS driver while maintaining compatibility with existing SMIA compliant devices. MIPI CCS is the current standard, hence the rename.

Sakari Ailus (100):
smiapp: Add CCS register definitions and limits
smiapp: Use CCS register flags
smiapp: Calculate CCS limit offsets and limit buffer size
smiapp: Remove macros for defining registers, merge definitions
smiapp: Add macros for accessing CCS registers
smiapp: Use MIPI CCS version and manufacturer ID information
smiapp: Read CCS limit values
smiapp: Switch to CCS limits
smiapp: Obtain frame descriptor from CCS limits
smiapp: Use CCS limits in reading data format descriptors
smiapp: Use CCS limits in reading binning capabilities
smiapp: Use CCS registers
smiapp: Remove quirk function for writing a single 8-bit register
smiapp: Rename register access functions
smiapp: Internal rename to CCS
smiapp: Differentiate CCS sensors from SMIA in subdev naming
smiapp: Rename as "ccs"
ccs: Remove profile concept
ccs: Give all subdevs a function
dt-bindings: Add vendor prefix for MIPI Alliance
dt-bindings: nokia,smia: Fix link-frequencies documentation
dt-bindings: nokia,smia: Make vana-supply optional
dt-bindings: nokia,smia: Convert to YAML
dt-bindings: nokia,smia: Use better active polarity for reset
dt-bindings: Amend SMIA bindings with MIPI CCS support
dt-bindings: Add bus-type for C-PHY support
ccs: Request for "reset" GPIO
ccs: Add "mipi,ccs" compatible string
ccs: Remove the I²C ID table
ccs: Remove remaining support for platform data
ccs: Make hwcfg part of the device specific struct
ccs: Add CCS static data parser library
ccs: Combine revision number major and minor into one
ccs: Read CCS static data from firmware binaries
ccs: Stop reading arrays after the first zero
ccs: The functions to get compose or crop rectangle never return NULL
ccs: Replace somewhat harsh internal checks based on BUG with WARN_ON
ccs: Refactor register reading a little
ccs: Make real to integer number conversion optional
ccs: Move limit value real to integer conversion from read to access
time
ccs: Read ireal numbers correctly
smiapp-pll: Rename as ccs-pll
ccs: Change my e-mail address
ccs: Add support for manufacturer regs from sensor and module files
ccs: Use static data read-only registers
ccs: Clean up runtime PM usage
ccs: Wrap long lines, unwrap short ones
ccs: Add device compatible identifiers for telling SMIA and CCS apart
ccs: Use longer pre-I²C sleep for CCS compliant devices
ccs-pll: Don't use div_u64 to divide a 32-bit number
ccs-pll: Split limits and PLL configuration into front and back parts
ccs-pll: Use correct VT divisor for calculating VT SYS divisor
ccs-pll: End search if there are no better values available
ccs-pll: Remove parallel bus support
ccs-pll: Differentiate between CSI-2 D-PHY and C-PHY
ccs-pll: Move the flags field down, away from 8-bit fields
ccs-pll: Document the structs in the header as well as the function
ccs-pll: Use the BIT macro
ccs-pll: Begin calculation from OP system clock frequency
ccs-pll: Fix condition for pre-PLL divider lower bound
ccs-pll: Avoid overflow in pre-PLL divisor lower bound search
ccs-pll: Fix comment on check against maximum PLL multiplier
ccs-pll: Fix check for PLL multiplier upper bound
ccs-pll: Use explicit 32-bit unsigned type
ccs-pll: Add support for lane speed model
ccs: Add support for lane speed model
ccs-pll: Add support for decoupled OP domain calculation
ccs-pll: Add support for extended input PLL clock divider
ccs-pll: Support two cycles per pixel on OP domain
ccs-pll: Add support flexible OP PLL pixel clock divider
ccs-pll: Add sanity checks
ccs-pll: Add C-PHY support
ccs-pll: Split off VT subtree calculation
ccs-pll: Check for derating and overrating, support non-derating
sensors
ccs-pll: Better separate OP and VT sub-tree calculation
ccs-pll: Print relevant information on PLL tree
ccs-pll: Rework bounds checks
ccs-pll: Make VT divisors 16-bit
ccs-pll: Fix VT post-PLL divisor calculation
ccs-pll: Separate VT divisor limit calculation from the rest
ccs-pll: Add trivial dual PLL support
ccs: Dual PLL support
ccs-pll: Add support for DDR OP system and pixel clocks
ccs: Add support for DDR OP SYS and OP PIX clocks
ccs: Print written register values
ccs-pll: Print pixel rates
ccs: Add support for obtaining C-PHY configuration from firmware
ccs: Add digital gain support
ccs: Add support for old-style SMIA digital gain
ccs: Remove analogue gain field
ccs: Only add analogue gain control if the device supports it
v4l: Add user control base for CCS controls
v4l: uapi: Add controls for analogue gain constants
ccs: Add support for analogue gain coefficient controls
v4l: uapi: Add controls for CCS alternative analogue gain
ccs: Add support for alternate analogue global gain
ccs: Add debug prints for MSR registers
v4l: uapi: Add CCS controls for correction configuration and
capabilities
ccs: Add shading correction and luminance correction level controls
smiapp: Add CCS ACPI device ID

 .../bindings/media/i2c/mipi,ccs.yaml          |  164 +
 .../bindings/media/i2c/nokia,smia.txt         |   66 -
 .../devicetree/bindings/vendor-prefixes.yaml  |    2 +
 MAINTAINERS                                   |   20 +-
 drivers/media/i2c/Kconfig                     |    4 +-
 drivers/media/i2c/Makefile                    |    4 +-
 drivers/media/i2c/ccs-pll.c                   |  885 ++++
 drivers/media/i2c/ccs-pll.h                   |  211 +
 drivers/media/i2c/ccs/Kconfig                 |   11 +
 drivers/media/i2c/ccs/Makefile                |    6 +
 drivers/media/i2c/ccs/ccs-core.c              | 3665 +++++++++++++++++
 drivers/media/i2c/ccs/ccs-data-defs.h         |  215 +
 drivers/media/i2c/ccs/ccs-data.c              |  949 +++++
 drivers/media/i2c/ccs/ccs-data.h              |  116 +
 drivers/media/i2c/ccs/ccs-limits.c            |  239 ++
 drivers/media/i2c/ccs/ccs-limits.h            |  258 ++
 drivers/media/i2c/ccs/ccs-os.h                |   15 +
 .../smiapp-quirk.c => ccs/ccs-quirk.c}        |  105 +-
 .../smiapp-quirk.h => ccs/ccs-quirk.h}        |   54 +-
 drivers/media/i2c/ccs/ccs-reg-access.c        |  417 ++
 drivers/media/i2c/ccs/ccs-reg-access.h        |   42 +
 drivers/media/i2c/ccs/ccs-regs.h              |  953 +++++
 .../media/i2c/{smiapp/smiapp.h => ccs/ccs.h}  |  183 +-
 drivers/media/i2c/ccs/smiapp-reg-defs.h       |  582 +++
 drivers/media/i2c/smiapp-pll.c                |  482 ---
 drivers/media/i2c/smiapp-pll.h                |   99 -
 drivers/media/i2c/smiapp/Kconfig              |   10 -
 drivers/media/i2c/smiapp/Makefile             |    6 -
 drivers/media/i2c/smiapp/smiapp-core.c        | 3173 --------------
 drivers/media/i2c/smiapp/smiapp-limits.c      |  118 -
 drivers/media/i2c/smiapp/smiapp-limits.h      |  114 -
 drivers/media/i2c/smiapp/smiapp-reg-defs.h    |  489 ---
 drivers/media/i2c/smiapp/smiapp-reg.h         |  116 -
 drivers/media/i2c/smiapp/smiapp-regs.c        |  261 --
 drivers/media/i2c/smiapp/smiapp-regs.h        |   36 -
 include/uapi/linux/ccs.h                      |   21 +
 include/uapi/linux/v4l2-controls.h            |    6 +
 37 files changed, 8939 insertions(+), 5158 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/mipi,ccs.yaml
 delete mode 100644 Documentation/devicetree/bindings/media/i2c/nokia,smia.txt
 create mode 100644 drivers/media/i2c/ccs-pll.c
 create mode 100644 drivers/media/i2c/ccs-pll.h
 create mode 100644 drivers/media/i2c/ccs/Kconfig
 create mode 100644 drivers/media/i2c/ccs/Makefile
 create mode 100644 drivers/media/i2c/ccs/ccs-core.c
 create mode 100644 drivers/media/i2c/ccs/ccs-data-defs.h
 create mode 100644 drivers/media/i2c/ccs/ccs-data.c
 create mode 100644 drivers/media/i2c/ccs/ccs-data.h
 create mode 100644 drivers/media/i2c/ccs/ccs-limits.c
 create mode 100644 drivers/media/i2c/ccs/ccs-limits.h
 create mode 100644 drivers/media/i2c/ccs/ccs-os.h
 rename drivers/media/i2c/{smiapp/smiapp-quirk.c => ccs/ccs-quirk.c} (63%)
 rename drivers/media/i2c/{smiapp/smiapp-quirk.h => ccs/ccs-quirk.h} (53%)
 create mode 100644 drivers/media/i2c/ccs/ccs-reg-access.c
 create mode 100644 drivers/media/i2c/ccs/ccs-reg-access.h
 create mode 100644 drivers/media/i2c/ccs/ccs-regs.h
 rename drivers/media/i2c/{smiapp/smiapp.h => ccs/ccs.h} (53%)
 create mode 100644 drivers/media/i2c/ccs/smiapp-reg-defs.h
 delete mode 100644 drivers/media/i2c/smiapp-pll.c
 delete mode 100644 drivers/media/i2c/smiapp-pll.h
 delete mode 100644 drivers/media/i2c/smiapp/Kconfig
 delete mode 100644 drivers/media/i2c/smiapp/Makefile
 delete mode 100644 drivers/media/i2c/smiapp/smiapp-core.c
 delete mode 100644 drivers/media/i2c/smiapp/smiapp-limits.c
 delete mode 100644 drivers/media/i2c/smiapp/smiapp-limits.h
 delete mode 100644 drivers/media/i2c/smiapp/smiapp-reg-defs.h
 delete mode 100644 drivers/media/i2c/smiapp/smiapp-reg.h
 delete mode 100644 drivers/media/i2c/smiapp/smiapp-regs.c
 delete mode 100644 drivers/media/i2c/smiapp/smiapp-regs.h
 create mode 100644 include/uapi/linux/ccs.h
Signature · 1 line
2.27.0
#1 lore raw

PATCH RESEND 20/100 dt-bindings: Add vendor prefix for MIPI Alliance

Add a vendor prefix for MIPI Alliance, Inc.

---
 Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
index 63996ab03521..f16b53909e6e 100644
@@ -663,6 +663,8 @@ patternProperties:
     description: Miniand Tech
   "^minix,.*":
     description: MINIX Technology Ltd.
+  "^mipi,.*":
+    description: MIPI Alliance, Inc.
   "^miramems,.*":
     description: MiraMEMS Sensing Technology Co., Ltd.
   "^mitsubishi,.*":
Signature · 1 line
2.27.0
maintainer
#2 lore raw

Re: [RESEND PATCH 020/100] dt-bindings: Add vendor prefix for MIPI Alliance

Quoted 6 lines · Sakari Ailus

Add a vendor prefix for MIPI Alliance, Inc.

---
 Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
 1 file changed, 2 insertions(+)

I guess based on the irc discussion, this is withdrawn.

Quoted 17 lines
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
index 63996ab03521..f16b53909e6e 100644
@@ -663,6 +663,8 @@ patternProperties:
     description: Miniand Tech
   "^minix,.*":
     description: MINIX Technology Ltd.
+  "^mipi,.*":
+    description: MIPI Alliance, Inc.
   "^miramems,.*":
     description: MiraMEMS Sensing Technology Co., Ltd.
   "^mitsubishi,.*":
Signature · 1 line
2.27.0
#3 lore raw

Re: [RESEND PATCH 020/100] dt-bindings: Add vendor prefix for MIPI Alliance

Quoted 9 lines · Rob Herring
Quoted 6 lines · Sakari Ailus

Add a vendor prefix for MIPI Alliance, Inc.

---
 Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
 1 file changed, 2 insertions(+)

I guess based on the irc discussion, this is withdrawn.

Correct. I'll send v2 with compatible ids without vendor prefix plus other fixes soonish. Please thus ignore this version.

Signature · 1 line
Sakari Ailus
#4 lore raw

PATCH RESEND 21/100 dt-bindings: nokia,smia: Fix link-frequencies documentation

In reply to Sakari Ailus

The link-frequencies property belongs to the endpoint, not to the node representing the device.

---
 .../devicetree/bindings/media/i2c/nokia,smia.txt          | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/media/i2c/nokia,smia.txt +5 -3
index 10ece8108081..6c45c79ef91f 100644
@@ -20,8 +20,6 @@ Mandatory properties
   dependent).
 - clocks: External clock to the sensor
 - clock-frequency: Frequency of the external clock to the sensor
-- link-frequencies: List of allowed data link frequencies. An array of
-  64-bit elements.
 
 
 Optional properties
@@ -39,6 +37,8 @@ Endpoint node mandatory properties
 ----------------------------------
 
 - data-lanes: <1..n>
+- link-frequencies: List of allowed data link frequencies. An array of
+  64-bit elements.
 
 
 Example
@@ -55,11 +55,13 @@ Example
 		clocks = <&omap3_isp 0>;
 		clock-frequency = <9600000>;
 		nokia,nvm-size = <512>; /* 8 * 64 */
-		link-frequencies = /bits/ 64 <199200000 210000000 499200000>;
 		port {
 			smiapp_ep: endpoint {
 				data-lanes = <1 2>;
 				remote-endpoint = <&csi2a_ep>;
+				link-frequencies =
+					/bits/ 64 <199200000 210000000
+						   499200000>;
 			};
 		};
 	};
Signature · 1 line
2.27.0
maintainer Acked-by on v1 21/100
#5 lore raw

Re: [RESEND PATCH 021/100] dt-bindings: nokia,smia: Fix link-frequencies documentation

Quoted 8 lines · Sakari Ailus

The link-frequencies property belongs to the endpoint, not to the node representing the device.

---
 .../devicetree/bindings/media/i2c/nokia,smia.txt          | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
#6 lore raw

PATCH RESEND 22/100 dt-bindings: nokia,smia: Make vana-supply optional

In reply to Sakari Ailus

vana-supply is optional in the spec, therefore make it optional in bindings, too.

---
 Documentation/devicetree/bindings/media/i2c/nokia,smia.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/media/i2c/nokia,smia.txt +2 -2
index 6c45c79ef91f..5ea4f799877b 100644
@@ -16,8 +16,6 @@ Mandatory properties
 
 - compatible: "nokia,smia"
 - reg: I2C address (0x10, or an alternative address)
-- vana-supply: Analogue voltage supply (VANA), typically 2,8 volts (sensor
-  dependent).
 - clocks: External clock to the sensor
 - clock-frequency: Frequency of the external clock to the sensor
 
@@ -31,6 +29,8 @@ Optional properties
 - rotation: Integer property; valid values are 0 (sensor mounted upright)
 	    and 180 (sensor mounted upside down). See
 	    ../video-interfaces.txt .
+- vana-supply: Analogue voltage supply (VANA), typically 2,8 volts (sensor
+  dependent).
 
 
 Endpoint node mandatory properties
Signature · 1 line
2.27.0
maintainer Acked-by on v1 22/100
#7 lore raw

Re: [RESEND PATCH 022/100] dt-bindings: nokia,smia: Make vana-supply optional

Quoted 8 lines · Sakari Ailus

vana-supply is optional in the spec, therefore make it optional in bindings, too.

---
 Documentation/devicetree/bindings/media/i2c/nokia,smia.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
#8 lore raw

PATCH RESEND 23/100 dt-bindings: nokia,smia: Convert to YAML

In reply to Sakari Ailus

Convert nokia,smia DT bindings to YAML.

Also add explicit license to bindings.

---
 .../bindings/media/i2c/nokia,smia.txt         |  68 --------
 .../bindings/media/i2c/nokia,smia.yaml        | 147 ++++++++++++++++++
 2 files changed, 147 insertions(+), 68 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/media/i2c/nokia,smia.txt
 create mode 100644 Documentation/devicetree/bindings/media/i2c/nokia,smia.yaml
Documentation/devicetree/bindings/media/i2c/nokia,smia.txt deleted +0 -68
deleted file mode 100644
index 5ea4f799877b..000000000000
@@ -1,68 +0,0 @@
-SMIA/SMIA++ sensor
-
-SMIA (Standard Mobile Imaging Architecture) is an image sensor standard
-defined jointly by Nokia and ST. SMIA++, defined by Nokia, is an extension
-of that. These definitions are valid for both types of sensors.
-
-More detailed documentation can be found in
-Documentation/devicetree/bindings/media/video-interfaces.txt .
-
-The device node should contain a "port" node which may contain one or more
-endpoint nodes, in accordance with video interface bindings defined in
-Documentation/devicetree/bindings/media/video-interfaces.txt .
-
-Mandatory properties
---------------------
-
-- compatible: "nokia,smia"
-- reg: I2C address (0x10, or an alternative address)
-- clocks: External clock to the sensor
-- clock-frequency: Frequency of the external clock to the sensor
-
-
-Optional properties
--------------------
-
-- reset-gpios: XSHUTDOWN GPIO
-- flash-leds: See ../video-interfaces.txt
-- lens-focus: See ../video-interfaces.txt
-- rotation: Integer property; valid values are 0 (sensor mounted upright)
-	    and 180 (sensor mounted upside down). See
-	    ../video-interfaces.txt .
-- vana-supply: Analogue voltage supply (VANA), typically 2,8 volts (sensor
-  dependent).
-
-
-Endpoint node mandatory properties
-----------------------------------
-
-- data-lanes: <1..n>
-- link-frequencies: List of allowed data link frequencies. An array of
-  64-bit elements.
-
-
-Example
--------
-
-&i2c2 {
-	clock-frequency = <400000>;
-
-	camera-sensor@10 {
-		compatible = "nokia,smia";
-		reg = <0x10>;
-		reset-gpios = <&gpio3 20 0>;
-		vana-supply = <&vaux3>;
-		clocks = <&omap3_isp 0>;
-		clock-frequency = <9600000>;
-		nokia,nvm-size = <512>; /* 8 * 64 */
-		port {
-			smiapp_ep: endpoint {
-				data-lanes = <1 2>;
-				remote-endpoint = <&csi2a_ep>;
-				link-frequencies =
-					/bits/ 64 <199200000 210000000
-						   499200000>;
-			};
-		};
-	};
-};
Documentation/devicetree/bindings/media/i2c/nokia,smia.yaml new file +147 -0

147 lines not on this page · raw message

Signature · 1 line
2.27.0
maintainer
#9 lore raw

Re: [RESEND PATCH 023/100] dt-bindings: nokia,smia: Convert to YAML

Quoted 135 lines · Sakari Ailus

Convert nokia,smia DT bindings to YAML.

Also add explicit license to bindings.

---
 .../bindings/media/i2c/nokia,smia.txt         |  68 --------
 .../bindings/media/i2c/nokia,smia.yaml        | 147 ++++++++++++++++++
 2 files changed, 147 insertions(+), 68 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/media/i2c/nokia,smia.txt
 create mode 100644 Documentation/devicetree/bindings/media/i2c/nokia,smia.yaml
Documentation/devicetree/bindings/media/i2c/nokia,smia.txt deleted +0 -68
deleted file mode 100644
index 5ea4f799877b..000000000000
@@ -1,68 +0,0 @@
-SMIA/SMIA++ sensor
-
-SMIA (Standard Mobile Imaging Architecture) is an image sensor standard
-defined jointly by Nokia and ST. SMIA++, defined by Nokia, is an extension
-of that. These definitions are valid for both types of sensors.
-
-More detailed documentation can be found in
-Documentation/devicetree/bindings/media/video-interfaces.txt .
-
-The device node should contain a "port" node which may contain one or more
-endpoint nodes, in accordance with video interface bindings defined in
-Documentation/devicetree/bindings/media/video-interfaces.txt .
-
-Mandatory properties
---------------------
-
-- compatible: "nokia,smia"
-- reg: I2C address (0x10, or an alternative address)
-- clocks: External clock to the sensor
-- clock-frequency: Frequency of the external clock to the sensor
-
-
-Optional properties
--------------------
-
-- reset-gpios: XSHUTDOWN GPIO
-- flash-leds: See ../video-interfaces.txt
-- lens-focus: See ../video-interfaces.txt
-- rotation: Integer property; valid values are 0 (sensor mounted upright)
-	    and 180 (sensor mounted upside down). See
-	    ../video-interfaces.txt .
-- vana-supply: Analogue voltage supply (VANA), typically 2,8 volts (sensor
-  dependent).
-
-
-Endpoint node mandatory properties
-----------------------------------
-
-- data-lanes: <1..n>
-- link-frequencies: List of allowed data link frequencies. An array of
-  64-bit elements.
-
-
-Example
--------
-
-&i2c2 {
-	clock-frequency = <400000>;
-
-	camera-sensor@10 {
-		compatible = "nokia,smia";
-		reg = <0x10>;
-		reset-gpios = <&gpio3 20 0>;
-		vana-supply = <&vaux3>;
-		clocks = <&omap3_isp 0>;
-		clock-frequency = <9600000>;
-		nokia,nvm-size = <512>; /* 8 * 64 */
-		port {
-			smiapp_ep: endpoint {
-				data-lanes = <1 2>;
-				remote-endpoint = <&csi2a_ep>;
-				link-frequencies =
-					/bits/ 64 <199200000 210000000
-						   499200000>;
-			};
-		};
-	};
-};
Documentation/devicetree/bindings/media/i2c/nokia,smia.yaml new file +43 -0
new file mode 100644
index 000000000000..3d6f68b0e559
@@ -0,0 +1,147 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright (C) 2014--2020 Intel Corporation
+
+$id: http://devicetree.org/schemas/media/i2c/nokia,smia.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: SMIA/SMIA++ sensor
+
+maintainers:
+  - Sakari Ailus <[email protected]>
+
+description:
+
+  SMIA (Standard Mobile Imaging Architecture) is an image sensor standard
+  defined jointly by Nokia and ST. SMIA++, defined by Nokia, is an extension of
+  that. These definitions are valid for both types of sensors.
+
+  More detailed documentation can be found in
+  Documentation/devicetree/bindings/media/video-interfaces.txt .
+
+properties:
+  compatible:
+    const: nokia,smia
+
+  reg:
+    maxItems: 1
+
+  vana-supply:
+    description: Analogue voltage supply (VANA), typically 2,8 volts (sensor
+      dependent).
+    maxItems: 1
+
+  clocks:
+    description: External clock to the sensor.
+    maxItems: 1
+
+  clock-frequency:
+    description: Frequency of the external clock to the sensor.
+
+  reset-gpios:
+    description: Reset GPIO. Also commonly called XSHUTDOWN in hardware
+      documentation.
+    maxItems: 1

Documentation/devicetree/bindings/media/i2c/nokia,smia.yaml line 53

Quoted 10 lines
Documentation/devicetree/bindings/media/i2c/nokia,smia.yaml new file +10 -0
+
+  flash-leds:
+    description: Flash LED phandles. See ../video-interfaces.txt for details.
+
+  lens-focus:
+    description: Lens focus controller phandles. See ../video-interfaces.txt
+      for details.
+
+  rotation:
+    description: Rotation; either 0 or 180 degrees.

enum: [ 0, 180 ]

Documentation/devicetree/bindings/media/i2c/nokia,smia.yaml line 64

Quoted 11 lines
Documentation/devicetree/bindings/media/i2c/nokia,smia.yaml new file +11 -0
+
+  port:
+    type: object
+    properties:
+      endpoint:
+        type: object
+        properties:
+          link-frequencies:
+            $ref: /schemas/types.yaml#/definitions/uint64-array
+            description: List of allowed data link frequencies. An array of
+              64-bit elements.

Just 'link-frequencies: true' unless you have some additional constraints.

Quoted 36 lines
Documentation/devicetree/bindings/media/i2c/nokia,smia.yaml new file +36 -0
+          data-lanes:
+            oneOf:
+              - items:
+                - const: 1
+              - items:
+                - const: 1
+                - const: 2
+              - items:
+                - const: 1
+                - const: 2
+                - const: 3
+              - items:
+                - const: 1
+                - const: 2
+                - const: 3
+                - const: 4
+              - items:
+                - const: 1
+                - const: 2
+                - const: 3
+                - const: 4
+                - const: 5
+              - items:
+                - const: 1
+                - const: 2
+                - const: 3
+                - const: 4
+                - const: 5
+                - const: 6
+              - items:
+                - const: 1
+                - const: 2
+                - const: 3
+                - const: 4
+                - const: 5
+                - const: 6

Documentation/devicetree/bindings/media/i2c/nokia,smia.yaml line 110

Quoted 10 lines
Documentation/devicetree/bindings/media/i2c/nokia,smia.yaml new file +10 -0
+                - const: 7
+              - items:
+                - const: 1
+                - const: 2
+                - const: 3
+                - const: 4
+                - const: 5
+                - const: 6
+                - const: 7
+                - const: 8

This all can be just the last 'items' plus:

minItems: 1
maxItems: 8

Documentation/devicetree/bindings/media/i2c/nokia,smia.yaml line 119

Quoted 9 lines
Documentation/devicetree/bindings/media/i2c/nokia,smia.yaml new file +9 -0
+        required:
+          - link-frequencies
+          - data-lanes
+
+required:
+  - compatible
+  - reg
+  - clock-frequency
+  - clocks

additionalProperties: false

Quoted 7 lines
Documentation/devicetree/bindings/media/i2c/nokia,smia.yaml new file +7 -0
+
+examples:
+  - |
+    i2c2 {
+        #address-cells = <1>;
+        #size-cells = <0>;
+

Documentation/devicetree/bindings/media/i2c/nokia,smia.yaml line 136

Quoted 10 lines
Documentation/devicetree/bindings/media/i2c/nokia,smia.yaml new file +10 -0
+        clock-frequency = <400000>;
+
+        camera-sensor@10 {
+            compatible = "nokia,smia";
+            reg = <0x10>;
+            reset-gpios = <&gpio3 20 0>;
+            vana-supply = <&vaux3>;
+            clocks = <&omap3_isp 0>;
+            clock-frequency = <9600000>;
+            nokia,nvm-size = <512>; /* 8 * 64 */

Not documented.

Quoted 14 lines
Documentation/devicetree/bindings/media/i2c/nokia,smia.yaml new file +11 -0
+            port {
+                smiapp_ep: endpoint {
+                    data-lanes = <1 2>;
+                    remote-endpoint = <&csi2a_ep>;
+                    link-frequencies = /bits/ 64 <199200000 210000000
+                                                  499200000>;
+                };
+            };
+        };
+    };
+...
Signature · 1 line
2.27.0
#10 lore raw

Re: [RESEND PATCH 023/100] dt-bindings: nokia,smia: Convert to YAML

Hi Rob,

Thank you for the review.

Quoted 140 lines · Rob Herring
Quoted 139 lines · Sakari Ailus

Convert nokia,smia DT bindings to YAML.

Also add explicit license to bindings.

---
 .../bindings/media/i2c/nokia,smia.txt         |  68 --------
 .../bindings/media/i2c/nokia,smia.yaml        | 147 ++++++++++++++++++
 2 files changed, 147 insertions(+), 68 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/media/i2c/nokia,smia.txt
 create mode 100644 Documentation/devicetree/bindings/media/i2c/nokia,smia.yaml
Documentation/devicetree/bindings/media/i2c/nokia,smia.txt deleted +0 -68
deleted file mode 100644
index 5ea4f799877b..000000000000
@@ -1,68 +0,0 @@
-SMIA/SMIA++ sensor
-
-SMIA (Standard Mobile Imaging Architecture) is an image sensor standard
-defined jointly by Nokia and ST. SMIA++, defined by Nokia, is an extension
-of that. These definitions are valid for both types of sensors.
-
-More detailed documentation can be found in
-Documentation/devicetree/bindings/media/video-interfaces.txt .
-
-The device node should contain a "port" node which may contain one or more
-endpoint nodes, in accordance with video interface bindings defined in
-Documentation/devicetree/bindings/media/video-interfaces.txt .
-
-Mandatory properties
---------------------
-
-- compatible: "nokia,smia"
-- reg: I2C address (0x10, or an alternative address)
-- clocks: External clock to the sensor
-- clock-frequency: Frequency of the external clock to the sensor
-
-
-Optional properties
--------------------
-
-- reset-gpios: XSHUTDOWN GPIO
-- flash-leds: See ../video-interfaces.txt
-- lens-focus: See ../video-interfaces.txt
-- rotation: Integer property; valid values are 0 (sensor mounted upright)
-	    and 180 (sensor mounted upside down). See
-	    ../video-interfaces.txt .
-- vana-supply: Analogue voltage supply (VANA), typically 2,8 volts (sensor
-  dependent).
-
-
-Endpoint node mandatory properties
-----------------------------------
-
-- data-lanes: <1..n>
-- link-frequencies: List of allowed data link frequencies. An array of
-  64-bit elements.
-
-
-Example
--------
-
-&i2c2 {
-	clock-frequency = <400000>;
-
-	camera-sensor@10 {
-		compatible = "nokia,smia";
-		reg = <0x10>;
-		reset-gpios = <&gpio3 20 0>;
-		vana-supply = <&vaux3>;
-		clocks = <&omap3_isp 0>;
-		clock-frequency = <9600000>;
-		nokia,nvm-size = <512>; /* 8 * 64 */
-		port {
-			smiapp_ep: endpoint {
-				data-lanes = <1 2>;
-				remote-endpoint = <&csi2a_ep>;
-				link-frequencies =
-					/bits/ 64 <199200000 210000000
-						   499200000>;
-			};
-		};
-	};
-};
Documentation/devicetree/bindings/media/i2c/nokia,smia.yaml new file +47 -0
new file mode 100644
index 000000000000..3d6f68b0e559
@@ -0,0 +1,147 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright (C) 2014--2020 Intel Corporation
+
+$id: http://devicetree.org/schemas/media/i2c/nokia,smia.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: SMIA/SMIA++ sensor
+
+maintainers:
+  - Sakari Ailus <[email protected]>
+
+description:
+
+  SMIA (Standard Mobile Imaging Architecture) is an image sensor standard
+  defined jointly by Nokia and ST. SMIA++, defined by Nokia, is an extension of
+  that. These definitions are valid for both types of sensors.
+
+  More detailed documentation can be found in
+  Documentation/devicetree/bindings/media/video-interfaces.txt .
+
+properties:
+  compatible:
+    const: nokia,smia
+
+  reg:
+    maxItems: 1
+
+  vana-supply:
+    description: Analogue voltage supply (VANA), typically 2,8 volts (sensor
+      dependent).
+    maxItems: 1
+
+  clocks:
+    description: External clock to the sensor.
+    maxItems: 1
+
+  clock-frequency:
+    description: Frequency of the external clock to the sensor.
+
+  reset-gpios:
+    description: Reset GPIO. Also commonly called XSHUTDOWN in hardware
+      documentation.
+    maxItems: 1
+
+  flash-leds:
+    description: Flash LED phandles. See ../video-interfaces.txt for details.
+
Quoted 8 lines

Documentation/devicetree/bindings/media/i2c/nokia,smia.yaml line 53

Quoted 6 lines
Documentation/devicetree/bindings/media/i2c/nokia,smia.yaml new file +6 -0
+  lens-focus:
+    description: Lens focus controller phandles. See ../video-interfaces.txt
+      for details.
+
+  rotation:
+    description: Rotation; either 0 or 180 degrees.

enum: [ 0, 180 ]

Yes.

Quoted 13 lines

Documentation/devicetree/bindings/media/i2c/nokia,smia.yaml line 64

Quoted 12 lines
Documentation/devicetree/bindings/media/i2c/nokia,smia.yaml new file +11 -0
+
+  port:
+    type: object
+    properties:
+      endpoint:
+        type: object
+        properties:
+          link-frequencies:
+            $ref: /schemas/types.yaml#/definitions/uint64-array
+            description: List of allowed data link frequencies. An array of
+              64-bit elements.
Quoted 2 lines

Just 'link-frequencies: true' unless you have some additional constraints.

We don't have video-interfaces.yaml yet, so $ref is needed. But I think mentioning it's a 64-bit element is redundant in the description so I remove it.

Quoted 48 lines
Quoted 37 lines
Documentation/devicetree/bindings/media/i2c/nokia,smia.yaml new file +36 -0
+          data-lanes:
+            oneOf:
+              - items:
+                - const: 1
+              - items:
+                - const: 1
+                - const: 2
+              - items:
+                - const: 1
+                - const: 2
+                - const: 3
+              - items:
+                - const: 1
+                - const: 2
+                - const: 3
+                - const: 4
+              - items:
+                - const: 1
+                - const: 2
+                - const: 3
+                - const: 4
+                - const: 5
+              - items:
+                - const: 1
+                - const: 2
+                - const: 3
+                - const: 4
+                - const: 5
+                - const: 6
+              - items:
+                - const: 1
+                - const: 2
+                - const: 3
+                - const: 4
+                - const: 5
+                - const: 6

Documentation/devicetree/bindings/media/i2c/nokia,smia.yaml line 110

Quoted 10 lines
Documentation/devicetree/bindings/media/i2c/nokia,smia.yaml new file +10 -0
+                - const: 7
+              - items:
+                - const: 1
+                - const: 2
+                - const: 3
+                - const: 4
+                - const: 5
+                - const: 6
+                - const: 7
+                - const: 8
Quoted 4 lines

This all can be just the last 'items' plus:

minItems: 1
maxItems: 8

I'll use that in v2.

Quoted 13 lines

Documentation/devicetree/bindings/media/i2c/nokia,smia.yaml line 119

Quoted 11 lines
Documentation/devicetree/bindings/media/i2c/nokia,smia.yaml new file +9 -0
+        required:
+          - link-frequencies
+          - data-lanes
+
+required:
+  - compatible
+  - reg
+  - clock-frequency
+  - clocks

additionalProperties: false

Yes.

Quoted 12 lines
Quoted 12 lines
Documentation/devicetree/bindings/media/i2c/nokia,smia.yaml new file +11 -0
+
+examples:
+  - |
+    i2c2 {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        clock-frequency = <400000>;
+
+        camera-sensor@10 {
+            compatible = "nokia,smia";
Quoted 8 lines

Documentation/devicetree/bindings/media/i2c/nokia,smia.yaml line 136

Quoted 6 lines
Documentation/devicetree/bindings/media/i2c/nokia,smia.yaml new file +6 -0
+            reg = <0x10>;
+            reset-gpios = <&gpio3 20 0>;
+            vana-supply = <&vaux3>;
+            clocks = <&omap3_isp 0>;
+            clock-frequency = <9600000>;
+            nokia,nvm-size = <512>; /* 8 * 64 */

Not documented.

I'll remove it before this patch in v2.

Quoted 12 lines
Quoted 12 lines
Documentation/devicetree/bindings/media/i2c/nokia,smia.yaml new file +11 -0
+            port {
+                smiapp_ep: endpoint {
+                    data-lanes = <1 2>;
+                    remote-endpoint = <&csi2a_ep>;
+                    link-frequencies = /bits/ 64 <199200000 210000000
+                                                  499200000>;
+                };
+            };
+        };
+    };
+...
Signature · 3 lines
Kind regards,

Sakari Ailus
#11 lore raw

PATCH RESEND 24/100 dt-bindings: nokia,smia: Use better active polarity for reset

In reply to Sakari Ailus

Generally reset signal is active low on camera sensors. The example had it high. Make it low, and use GPIO_ACTIVE_LOW in gpio.h for that.

---
 Documentation/devicetree/bindings/media/i2c/nokia,smia.yaml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/media/i2c/nokia,smia.yaml +3 -1
index 3d6f68b0e559..d7de07e99008 100644
@@ -120,6 +120,8 @@ required:
 
 examples:
   - |
+    #include <dt-bindings/gpio/gpio.h>
+
     i2c2 {
         #address-cells = <1>;
         #size-cells = <0>;
@@ -129,7 +131,7 @@ examples:
         camera-sensor@10 {
             compatible = "nokia,smia";
             reg = <0x10>;
-            reset-gpios = <&gpio3 20 0>;
+            reset-gpios = <&gpio3 20 GPIO_ACTIVE_LOW>;
             vana-supply = <&vaux3>;
             clocks = <&omap3_isp 0>;
             clock-frequency = <9600000>;
Signature · 1 line
2.27.0
maintainer Acked-by on v1 24/100
#12 lore raw

Re: [RESEND PATCH 024/100] dt-bindings: nokia,smia: Use better active polarity for reset

Quoted 8 lines · Sakari Ailus

Generally reset signal is active low on camera sensors. The example had it high. Make it low, and use GPIO_ACTIVE_LOW in gpio.h for that.

---
 Documentation/devicetree/bindings/media/i2c/nokia,smia.yaml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
#13 lore raw

PATCH RESEND 25/100 dt-bindings: nokia,smia: Amend SMIA bindings with MIPI CCS support

In reply to Sakari Ailus

Amend the existing SMIA bindings by adding MIPI CCS support. Besides the compatible string, two new regulator supplies are added. Rename the old bindings accordingly as CCS is the current standard.

---
 .../i2c/{nokia,smia.yaml => mipi,ccs.yaml}     | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
 rename Documentation/devicetree/bindings/media/i2c/{nokia,smia.yaml => mipi,ccs.yaml} (89%)
Documentation/devicetree/bindings/media/i2c/mipi,ccs.yaml renamed from Documentation/devicetree/bindings/media/i2c/nokia,smia.yaml +12 -6
similarity index 89%
rename from Documentation/devicetree/bindings/media/i2c/nokia,smia.yaml
rename to Documentation/devicetree/bindings/media/i2c/mipi,ccs.yaml
index d7de07e99008..6ac01ec8610c 100644
@@ -1,26 +1,32 @@
 # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
 # Copyright (C) 2014--2020 Intel Corporation
 
-$id: http://devicetree.org/schemas/media/i2c/nokia,smia.yaml#
+$id: http://devicetree.org/schemas/media/i2c/mipi,ccs.yaml#
 $schema: http://devicetree.org/meta-schemas/core.yaml#
 
-title: SMIA/SMIA++ sensor
+title: MIPI CCS, SMIA++ and SMIA compliant camera sensors
 
 maintainers:
   - Sakari Ailus <[email protected]>
 
 description:
 
+  CCS (Camera Command Set) is a raw Bayer camera sensor standard defined by the
+  MIPI Alliance; see
+  <URL:https://www.mipi.org/specifications/camera-command-set>.
+
   SMIA (Standard Mobile Imaging Architecture) is an image sensor standard
   defined jointly by Nokia and ST. SMIA++, defined by Nokia, is an extension of
-  that. These definitions are valid for both types of sensors.
+  that.
 
   More detailed documentation can be found in
   Documentation/devicetree/bindings/media/video-interfaces.txt .
 
 properties:
   compatible:
-    const: nokia,smia
+    oneOf:
+      - const: mipi,ccs
+      - const: nokia,smia
 
   reg:
     maxItems: 1
@@ -129,7 +135,7 @@ examples:
         clock-frequency = <400000>;
 
         camera-sensor@10 {
-            compatible = "nokia,smia";
+            compatible = "mipi,ccs";
             reg = <0x10>;
             reset-gpios = <&gpio3 20 GPIO_ACTIVE_LOW>;
             vana-supply = <&vaux3>;
@@ -137,7 +143,7 @@ examples:
             clock-frequency = <9600000>;
             nokia,nvm-size = <512>; /* 8 * 64 */
             port {
-                smiapp_ep: endpoint {
+                ccs_ep: endpoint {
                     data-lanes = <1 2>;
                     remote-endpoint = <&csi2a_ep>;
                     link-frequencies = /bits/ 64 <199200000 210000000
Signature · 1 line
2.27.0
#14 lore raw

PATCH RESEND 26/100 dt-bindings: ccs: Add bus-type for C-PHY support

In reply to Sakari Ailus

The bus-type property is required for C-PHY support. Add it, including values for CCP2 and CSI-2 D-PHY.

---
 .../devicetree/bindings/media/i2c/mipi,ccs.yaml          | 9 +++++++++
 1 file changed, 9 insertions(+)
Documentation/devicetree/bindings/media/i2c/mipi,ccs.yaml +8 -0
index 6ac01ec8610c..b7908f6e48b9 100644
@@ -114,6 +114,13 @@ properties:
                 - const: 6
                 - const: 7
                 - const: 8
+          bus-type:
+            description: The type of the data bus.
+            oneOf:
+              - const: 1 # CSI-2 C-PHY
+              - const: 3 # CCP2
+              - const: 4 # CSI-2 D-PHY
+
         required:
           - link-frequencies
           - data-lanes
@@ -148,6 +156,7 @@ examples:
                     remote-endpoint = <&csi2a_ep>;
                     link-frequencies = /bits/ 64 <199200000 210000000
                                                   499200000>;
+                    bus-type = <4>;
                 };
             };
         };
Signature · 1 line
2.27.0