Skip to contentSkip to conversation

Device tree support for Exynos SoC camera subsystem

PATCH Superseded Sylwester Nawrocki 3 participants 30 messages Feb 1, 2013 – Feb 14, 2013

Subsystems (3)

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v4 cover Device tree support for Exynos SoC camera subsystem

This is an updated patch series adding initial support for the Exynos4 SoC series camera subsystem. It is based on the video interfaces common device tree bindings and depends on patch series [1]. The full source tree can be browsed at [2].

I've dropped the RFC tag from this series and I'm going to continue with adding support for asynchronous sensor subdevs registration and the FIMC-IS on top of it. Unless there are further changes in the bindings.

Still, any comments are welcome.
The changes are listed in each patch, if any.

This series likely won't make it to v3.9. It would be nice, but there seems not to be much interest in getting [1] in the mainline and the reviews are relatively slow.

Any Ack/nack from the device tree maintainers are welcome, so I could finally have this patch set merged and carry on with other, even more interesting things. :)

Thanks,
Sylwester

[1] http://www.spinics.net/lists/linux-media/msg59471.html
[2] http://git.linuxtv.org/snawrocki/samsung.git/exynos_fimc

Sylwester Nawrocki (10):
s5p-csis: Add device tree support
s5p-fimc: Add device tree support for FIMC devices
s5p-fimc: Add device tree support for FIMC-LITE devices
s5p-fimc: Add device tree support for the main media device driver
s5p-fimc: Add device tree based sensors registration
s5p-fimc: Use pinctrl API for camera ports configuration
ARM: dts: Add camera to node exynos4.dtsi
ARM: dts: Add ISP power domain node for Exynos4x12
ARM: dts: Add FIMC and MIPI CSIS device nodes for Exynos4x12
ARM: dts: Correct camera pinctrl nodes for Exynos4x12 SoCs

 .../devicetree/bindings/media/soc/samsung-fimc.txt |  183 +++++++++++
 .../bindings/media/soc/samsung-mipi-csis.txt       |   82 +++++
 arch/arm/boot/dts/exynos4.dtsi                     |   64 ++++
 arch/arm/boot/dts/exynos4x12-pinctrl.dtsi          |   26 +-
 arch/arm/boot/dts/exynos4x12.dtsi                  |   52 ++++
 drivers/media/platform/s5p-fimc/fimc-capture.c     |    2 +-
 drivers/media/platform/s5p-fimc/fimc-core.c        |   94 ++++--
 drivers/media/platform/s5p-fimc/fimc-lite.c        |   65 ++--
 drivers/media/platform/s5p-fimc/fimc-mdevice.c     |  319 ++++++++++++++++++--
 drivers/media/platform/s5p-fimc/fimc-mdevice.h     |    4 +
 drivers/media/platform/s5p-fimc/mipi-csis.c        |  154 +++++++---
 drivers/media/platform/s5p-fimc/mipi-csis.h        |    1 +
 include/media/s5p_fimc.h                           |   17 ++
 13 files changed, 936 insertions(+), 127 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/media/soc/samsung-fimc.txt
 create mode 100644 Documentation/devicetree/bindings/media/soc/samsung-mipi-csis.txt

--
1.7.9.5

#1 lore raw

PATCH v4 1/10 s5p-csis: Add device tree support

s5p-csis is platform device driver for MIPI-CSI frontend to the FIMC device. This patch support for binding the driver to the MIPI-CSIS devices instantiated from device tree and for parsing all SoC and board specific properties.

---

Changes since v3:
- dropped 'bus-width' property, hard coded the number of supported data lanes per device also in dt case, it can be derived from the compatible property if required;
- "samsung,s5pv210-csis" renamed to "samsung,exynos3110-csis", updated the bindings description.

---
 .../bindings/media/soc/samsung-mipi-csis.txt       |   82 +++++++++++
 drivers/media/platform/s5p-fimc/mipi-csis.c        |  154 +++++++++++++++-----
 drivers/media/platform/s5p-fimc/mipi-csis.h        |    1 +
 3 files changed, 202 insertions(+), 35 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/media/soc/samsung-mipi-csis.txt
Documentation/devicetree/bindings/media/soc/samsung-mipi-csis.txt new file +82 -0
new file mode 100644
index 0000000..c142272
@@ -0,0 +1,82 @@
+Samsung S5P/EXYNOS SoC MIPI-CSI2 receiver (MIPI CSIS)
+-----------------------------------------------------
+
+Required properties:
+
+- compatible	  : "samsung,exynos3110-csis" for Exynos3110 (S5PC110, S5PV210)
+		     SoCs;
+		    "samsung,exynos4210-csis" for Exynos4210 (S5PC210, S5PV310)
+		    and later SoCs;
+- reg		  : physical base address and size of the device memory mapped
+		    registers;
+- interrupts      : should contain MIPI CSIS interrupt; the format of the
+		    interrupt specifier depends on the interrupt controller;
+- vddio-supply    : MIPI CSIS I/O and PLL voltage supply (e.g. 1.8V);
+- vddcore-supply  : MIPI CSIS Core voltage supply (e.g. 1.1V).
+
+Optional properties:
+
+- clock-frequency : The IP's main (system bus) clock frequency in Hz, default
+		    value when this property is not specified is 166 MHz;
+- samsung,csis-wclk : CSI-2 wrapper clock selection. If this property is present
+		    external clock from CMU will be used, if not bus clock will
+		    be selected.
+
+The device node should contain one 'port' child node with one child 'endpoint'
+node, as outlined in the common media bindings specification. See
+Documentation/devicetree/bindings/media/video-interfaces.txt for details.
+The following are properties specific to these nodes.
+
+port node
+---------
+
+- reg		  : (required) must be 3 for camera C input (CSIS0) or 4 for
+		    camera D input (CSIS1);
+
+endpoint node
+-------------
+
+- data-lanes	  : (required) an array specifying active physical MIPI-CSI2
+		    data input lanes and their mapping to logical lanes; the
+		    array's content is unused, only its length is meaningful;
+
+- samsung,csis-hs-settle : (optional) differential receiver (HS-RX) settle time;
+
+
+Example:
+
+	reg0: regulator at 0 {
+	};
+
+	reg1: regulator at 1 {
+	};
+
+/* SoC properties */
+
+	aliases {
+		csis0 = &csis_0;
+	};
+
+	csis_0: csis at 11880000 {
+		compatible = "samsung,exynos4210-csis";
+		reg = <0x11880000 0x1000>;
+		interrupts = <0 78 0>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+	};
+
+/* Board properties */
+
+	csis_0: csis at 11880000 {
+		clock-frequency = <166000000>;
+		vddio-supply = <&reg0>;
+		vddcore-supply = <&reg1>;
+		port {
+			reg = <3>; /* 3 - CSIS0, 4 - CSIS1 */
+			csis0_ep: endpoint {
+				remote-endpoint = <...>;
+				data-lanes = <1>, <2>;
+				samsung,csis-hs-settle = <12>;
+			};
+		};
+	};
drivers/media/platform/s5p-fimc/mipi-csis.c +119 -35

289 lines not on this page · raw message

drivers/media/platform/s5p-fimc/mipi-csis.h +1 -0
index 2709286..28c11c4 100644
@@ -11,6 +11,7 @@
 #define S5P_MIPI_CSIS_H_
 
 #define CSIS_DRIVER_NAME	"s5p-mipi-csis"
+#define CSIS_SUBDEV_NAME	CSIS_DRIVER_NAME
 #define CSIS_MAX_ENTITIES	2
 #define CSIS0_MAX_LANES		4
 #define CSIS1_MAX_LANES		2
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH v4 1/10 s5p-csis: Add device tree support

Documentation/devicetree/bindings/media/soc/samsung-mipi-csis.txt line 20

Quoted 11 lines · Sylwester Nawrocki

s5p-csis is platform device driver for MIPI-CSI frontend to the FIMC device. This patch support for binding the driver to the MIPI-CSIS devices instantiated from device tree and for parsing all SoC and board specific properties.

Documentation/devicetree/bindings/media/soc/samsung-mipi-csis.txt +4 -0
 
+Optional properties:
+
+- clock-frequency : The IP's main (system bus) clock frequency in Hz, default
+		    value when this property is not specified is 166 MHz;

Shouldn't this be a "clocks" property, so that the driver can call clk_get(), clk_prepare_enable(), clk_get_rate(), etc. on it?

Other than that this binding seems fine to me at a quick glance.

#3 lore raw

PATCH v4 1/10 s5p-csis: Add device tree support

Quoted 9 lines · Stephen Warren

Review

Quoted 6 lines · Sylwester Nawrocki

s5p-csis is platform device driver for MIPI-CSI frontend to the FIMC device. This patch support for binding the driver to the MIPI-CSIS devices instantiated from device tree and for parsing all SoC and board specific properties.

(quoted diff) +0 -0

b/Documentation/devicetree/bindings/media/soc/samsung-mipi-csis.txt

Quoted 7 lines

Documentation/devicetree/bindings/media/soc/samsung-mipi-csis.txt line 20

Quoted 4 lines
Documentation/devicetree/bindings/media/soc/samsung-mipi-csis.txt new file +4 -0
+Optional properties:
+
+- clock-frequency : The IP's main (system bus) clock frequency in Hz, default
+		    value when this property is not specified is 166 MHz;

Shouldn't this be a "clocks" property, so that the driver can call clk_get(), clk_prepare_enable(), clk_get_rate(), etc. on it?

Hi Stephen,

Thanks for your review!

I also use "clocks" and "clock-names" property, but didn't specify it here, because the Exynos SoCs clocks driver is not in the mainline yet.

There are two clocks the driver needs to be aware of. One of them needs to have a specific parent clock set and the frequency set properly, so when it is put into a data pipeline with other IPs there is no overflows of their input/output FIFOs.

devfreq may change those frequencies if enabled, however its another topic. I wanted to ensure the device has initially correct local clock frequency set, with which it can operate.

--

Thanks,
Sylwester

#4 lore raw

PATCH v4 1/10 s5p-csis: Add device tree support

Quoted 20 lines · Sylwester Nawrocki
Quoted 10 lines · Stephen Warren
Quoted 7 lines · Sylwester Nawrocki

s5p-csis is platform device driver for MIPI-CSI frontend to the FIMC device. This patch support for binding the driver to the MIPI-CSIS devices instantiated from device tree and for parsing all SoC and board specific properties.

diff --git a/Documentation/devicetree/bindings/media/soc/samsung-mipi-csis.txt

b/Documentation/devicetree/bindings/media/soc/samsung-mipi-csis.txt

Quoted 8 lines
Quoted 5 lines
Documentation/devicetree/bindings/media/soc/samsung-mipi-csis.txt new file +3 -0
+Optional properties:
+
+- clock-frequency : The IP's main (system bus) clock frequency in

Hz, default
+ value when this property is not specified is 166 MHz;

Shouldn't this be a "clocks" property, so that the driver can call clk_get(), clk_prepare_enable(), clk_get_rate(), etc. on it?

Quoted 6 lines

Hi Stephen,

Thanks for your review!

I also use "clocks" and "clock-names" property, but didn't specify it here, because the Exynos SoCs clocks driver is not in the mainline yet.

I'm a bit sympathetic to this, since I've been trying to push Tegra towards the common clock framework and describing clock connectivity in DT, before adding new drivers that need clocks, specifically to avoid this kind of situation.

The problem here is that if this gets merged now, then the clock driver comes along later, you'll have to change this binding definition to account for it, and DT bindings aren't supposed to be changed...

Do you have any clock driver at all upstream yet? Or, could you add a dummy clock driver to satisfy the driver's clkl_get() needs? If you do, you can always set up some AUXDATA so that clk_get() works for your driver right now, and then remove that once the complete clock driver is in place with full device tree support. That's how we've ended up handling this for Tegra drivers.

Anyway, this is all mainly food-for-thought rather than an objection to the patch; I'd leave that to Grant/Rob if applicable.

#5 lore raw

PATCH v4 1/10 s5p-csis: Add device tree support

Quoted 28 lines · Stephen Warren
Quoted 20 lines · Sylwester Nawrocki
Quoted 10 lines · Stephen Warren
Quoted 7 lines · Sylwester Nawrocki

s5p-csis is platform device driver for MIPI-CSI frontend to the FIMC device. This patch support for binding the driver to the MIPI-CSIS devices instantiated from device tree and for parsing all SoC and board specific properties.

diff --git a/Documentation/devicetree/bindings/media/soc/samsung-mipi-csis.txt

b/Documentation/devicetree/bindings/media/soc/samsung-mipi-csis.txt

Quoted 8 lines
Quoted 5 lines
Documentation/devicetree/bindings/media/soc/samsung-mipi-csis.txt new file +3 -0
+Optional properties:
+
+- clock-frequency : The IP's main (system bus) clock frequency in

Hz, default
+ value when this property is not specified is 166 MHz;

Shouldn't this be a "clocks" property, so that the driver can call clk_get(), clk_prepare_enable(), clk_get_rate(), etc. on it?

Quoted 6 lines

Hi Stephen,

Thanks for your review!

I also use "clocks" and "clock-names" property, but didn't specify it here, because the Exynos SoCs clocks driver is not in the mainline yet.

Quoted 8 lines

I'm a bit sympathetic to this, since I've been trying to push Tegra towards the common clock framework and describing clock connectivity in DT, before adding new drivers that need clocks, specifically to avoid this kind of situation.

The problem here is that if this gets merged now, then the clock driver comes along later, you'll have to change this binding definition to account for it, and DT bindings aren't supposed to be changed...

Yes, I wasn't quite sure if this is a really serious problem or not. There is already quite a few drivers for the Exynos SoC IPs that have DT support and their bindings will need to be changed when the new clocks driver gets upstreamed...

Quoted 6 lines

Do you have any clock driver at all upstream yet? Or, could you add a dummy clock driver to satisfy the driver's clkl_get() needs? If you do, you can always set up some AUXDATA so that clk_get() works for your driver right now, and then remove that once the complete clock driver is in place with full device tree support. That's how we've ended up handling this for Tegra drivers.

Yes, there is the clocks support upstream, only not using the common clock API. And I used indeed AUXDATA in v3 of these patches.

The Exynos common clock API based driver was supposed to be merged in v3.9, but it seems it won't happen. These patches also won't make it to 3.9. Then hopefully both appear in 3.10 together.

I will add the clock properties to relevant nodes, assuming the new clocks driver is available.

Quoted 2 lines

Anyway, this is all mainly food-for-thought rather than an objection to the patch; I'd leave that to Grant/Rob if applicable.

:-) OK, thanks for the suggestions.

#6 lore raw

PATCH v4 2/10 s5p-fimc: Add device tree support for FIMC devices

In reply to Sylwester Nawrocki

This patch adds support for FIMC devices instantiated from devicetree for S5PV210 and Exynos4 SoCs. The FIMC IP features include colorspace conversion and scaling (mem-to-mem) and parallel/MIPI CSI2 bus video capture interface.

Multiple SoC revisions specific parameters are defined statically in the driver and are used for both dt and non-dt. The driver's static data is selected based on the compatible property. Previously the platform device name was used to match driver data and a specific SoC/IP version.

Aliases are used to determine an index of the IP which is essential for linking FIMC IP with other entities, like MIPI-CSIS (the MIPI CSI-2 bus frontend) or FIMC-LITE and FIMC-IS ISP.

---

Changes since v3:
- added optional clock-frequency property to specify local bus (FIMCn_LCLK) clock frequency

---
 .../devicetree/bindings/media/soc/samsung-fimc.txt |   72 +++++++++++++++
 drivers/media/platform/s5p-fimc/fimc-capture.c     |    2 +-
 drivers/media/platform/s5p-fimc/fimc-core.c        |   93 +++++++++++++-------
 3 files changed, 135 insertions(+), 32 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/media/soc/samsung-fimc.txt
Documentation/devicetree/bindings/media/soc/samsung-fimc.txt new file +72 -0
new file mode 100644
index 0000000..916b2c3
@@ -0,0 +1,72 @@
+Samsung S5P/EXYNOS SoC Camera Subsystem (FIMC)
+----------------------------------------------
+
+The Exynos Camera subsystem comprises of multiple sub-devices that are
+represented by separate platform devices. Some of the IPs come in different
+variants across the SoC revisions (FIMC) and some remain mostly unchanged
+(MIPI CSIS, FIMC-LITE).
+
+All those sub-subdevices are defined as parent nodes of the common device
+node, which also includes common properties of the whole subsystem not really
+specific to any single sub-device, like common camera port pins or external
+clocks for image sensors attached to the SoC.
+
+Common 'camera' node
+--------------------
+
+Required properties:
+
+- compatible	   : must be "samsung,fimc", "simple-bus"
+
+The 'camera' node must include at least one 'fimc' child node.
+
+
+'fimc' device nodes
+-------------------
+
+Required properties:
+
+- compatible : "samsung,s5pv210-fimc" for S5PV210,
+	       "samsung,exynos4210-fimc" for Exynos4210,
+	       "samsung,exynos4212-fimc" for Exynos4212/4412 SoCs;
+- reg	     : physical base address and size of the device memory mapped
+	       registers;
+- interrupts : FIMC interrupt to the CPU should be described here;
+
+For every fimc node a numbered alias should be present in the aliases node.
+Aliases are of the form fimc<n>, where <n> is an integer (0...N) specifying
+the IP's instance index.
+
+Optional properties
+
+ - clock-frequency - maximum FIMC local clock (LCLK) frequency
+
+Example:
+
+	aliases {
+		csis0 = &csis_0;
+		fimc0 = &fimc_0;
+	};
+
+	camera {
+		compatible = "samsung,fimc", "simple-bus";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		status = "okay";
+
+		fimc_0: fimc at 11800000 {
+			compatible = "samsung,exynos4210-fimc";
+			reg = <0x11800000 0x1000>;
+			interrupts = <0 85 0>;
+			status = "okay";
+		};
+
+		csis_0: csis at 11880000 {
+			compatible = "samsung,exynos4210-csis";
+			reg = <0x11880000 0x1000>;
+			interrupts = <0 78 0>;
+			max-data-lanes = <4>;
+		};
+	};
+
+[1] Documentation/devicetree/bindings/media/soc/samsung-mipi-csis.txt
drivers/media/platform/s5p-fimc/fimc-capture.c +1 -1
index f822b8e..bc84301 100644
@@ -1883,7 +1883,7 @@ int fimc_initialize_capture_subdev(struct fimc_dev *fimc)
 
 	v4l2_subdev_init(sd, &fimc_subdev_ops);
 	sd->flags = V4L2_SUBDEV_FL_HAS_DEVNODE;
-	snprintf(sd->name, sizeof(sd->name), "FIMC.%d", fimc->pdev->id);
+	snprintf(sd->name, sizeof(sd->name), "FIMC.%d", fimc->id);
 
 	fimc->vid_cap.sd_pads[FIMC_SD_PAD_SINK].flags = MEDIA_PAD_FL_SINK;
 	fimc->vid_cap.sd_pads[FIMC_SD_PAD_SOURCE].flags = MEDIA_PAD_FL_SOURCE;
drivers/media/platform/s5p-fimc/fimc-core.c +62 -31

176 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#7 lore raw

PATCH v4 2/10 s5p-fimc: Add device tree support for FIMC devices

Quoted 16 lines · Sylwester Nawrocki

This patch adds support for FIMC devices instantiated from devicetree for S5PV210 and Exynos4 SoCs. The FIMC IP features include colorspace conversion and scaling (mem-to-mem) and parallel/MIPI CSI2 bus video capture interface.

Multiple SoC revisions specific parameters are defined statically in the driver and are used for both dt and non-dt. The driver's static data is selected based on the compatible property. Previously the platform device name was used to match driver data and a specific SoC/IP version.

Aliases are used to determine an index of the IP which is essential for linking FIMC IP with other entities, like MIPI-CSIS (the MIPI CSI-2 bus frontend) or FIMC-LITE and FIMC-IS ISP.

Documentation/devicetree/bindings/media/soc/samsung-fimc.txt line 5

Quoted 6 lines
Documentation/devicetree/bindings/media/soc/samsung-fimc.txt +5 -0
 
+Samsung S5P/EXYNOS SoC Camera Subsystem (FIMC)
+----------------------------------------------
+
+The Exynos Camera subsystem comprises of multiple sub-devices that are
+represented by separate platform devices. Some of the IPs come in different

"platform devices" is a rather Linux-centric term, and DT bindings should be OS-agnostic. Perhaps use "device tree nodes" here?

Documentation/devicetree/bindings/media/soc/samsung-fimc.txt line 9

Quoted 4 lines
Documentation/devicetree/bindings/media/soc/samsung-fimc.txt +4 -0
+variants across the SoC revisions (FIMC) and some remain mostly unchanged
+(MIPI CSIS, FIMC-LITE).
+
+All those sub-subdevices are defined as parent nodes of the common device

s/parent nodes/child node/ I think?

Documentation/devicetree/bindings/media/soc/samsung-fimc.txt line 38

Quoted 3 lines
Documentation/devicetree/bindings/media/soc/samsung-fimc.txt +3 -0
+For every fimc node a numbered alias should be present in the aliases node.
+Aliases are of the form fimc<n>, where <n> is an integer (0...N) specifying
+the IP's instance index.

Why? Isn't it up to the DT author whether they care if each fimc node is assigned a specific identification v.s. whether identification is assigned automatically?

Documentation/devicetree/bindings/media/soc/samsung-fimc.txt line 42

Quoted 3 lines
Documentation/devicetree/bindings/media/soc/samsung-fimc.txt +3 -0
+Optional properties
+
+ - clock-frequency - maximum FIMC local clock (LCLK) frequency

Again, I'd expect a clocks property here instead.

#8 lore raw

PATCH v4 2/10 s5p-fimc: Add device tree support for FIMC devices

Quoted 10 lines · Stephen Warren

Documentation/devicetree/bindings/media/soc/samsung-fimc.txt line 5

Quoted 7 lines
Documentation/devicetree/bindings/media/soc/samsung-fimc.txt +5 -0
 
+Samsung S5P/EXYNOS SoC Camera Subsystem (FIMC)
+----------------------------------------------
+
+The Exynos Camera subsystem comprises of multiple sub-devices that are
+represented by separate platform devices. Some of the IPs come in different

"platform devices" is a rather Linux-centric term, and DT bindings should be OS-agnostic. Perhaps use "device tree nodes" here?

Indeed, thank you for the suggestion, I'll change it.

Quoted 6 lines

Documentation/devicetree/bindings/media/soc/samsung-fimc.txt line 9

Quoted 4 lines
Documentation/devicetree/bindings/media/soc/samsung-fimc.txt +4 -0
+variants across the SoC revisions (FIMC) and some remain mostly unchanged
+(MIPI CSIS, FIMC-LITE).
+
+All those sub-subdevices are defined as parent nodes of the common device

s/parent nodes/child node/ I think?

Yeah, 'parent nodes' doesn't really make sense. Thanks for catching it.

Quoted 7 lines

Documentation/devicetree/bindings/media/soc/samsung-fimc.txt line 38

Quoted 3 lines
Documentation/devicetree/bindings/media/soc/samsung-fimc.txt +3 -0
+For every fimc node a numbered alias should be present in the aliases node.
+Aliases are of the form fimc<n>, where<n>  is an integer (0...N) specifying
+the IP's instance index.

Why? Isn't it up to the DT author whether they care if each fimc node is assigned a specific identification v.s. whether identification is assigned automatically?

There are at least three different kinds of IPs that come in multiple instances in an SoC. To activate data links between them each instance needs to be clearly identified. There are also differences between instances of same device. Hence it's important these aliases don't have random values.

Some more details about the SoC can be found at [1]. The aliases are also already used in the Exynos5 GScaler bindings [2] in a similar way.

Quoted 5 lines

Documentation/devicetree/bindings/media/soc/samsung-fimc.txt line 42

Quoted 3 lines
Documentation/devicetree/bindings/media/soc/samsung-fimc.txt +3 -0
+Optional properties
+
+ - clock-frequency - maximum FIMC local clock (LCLK) frequency

Again, I'd expect a clocks property here instead.

Please see my comment to patch 01/10. Analogously, I needed this clock frequency to ensure reliable video data pipeline operation.

[1] http://tinyurl.com/anw9udm
[2] http://www.spinics.net/lists/arm-kernel/msg200036.html

#9 lore raw

PATCH v4 2/10 s5p-fimc: Add device tree support for FIMC devices

Quoted 7 lines · Sylwester Nawrocki
Quoted 6 lines · Stephen Warren
Quoted 6 lines

diff --git a/Documentation/devicetree/bindings/media/soc/samsung-fimc.txt b/Documentation/devicetree/bindings/media/soc/samsung-fimc.txt

+Samsung S5P/EXYNOS SoC Camera Subsystem (FIMC)
+----------------------------------------------

...

Quoted 10 lines
Quoted 9 lines
Quoted 5 lines

+For every fimc node a numbered alias should be present in the aliases node.
+Aliases are of the form fimc<n>, where<n> is an integer (0...N) specifying
+the IP's instance index.

Why? Isn't it up to the DT author whether they care if each fimc node is assigned a specific identification v.s. whether identification is assigned automatically?

Quoted 8 lines

There are at least three different kinds of IPs that come in multiple instances in an SoC. To activate data links between them each instance needs to be clearly identified. There are also differences between instances of same device. Hence it's important these aliases don't have random values.

Some more details about the SoC can be found at [1]. The aliases are also already used in the Exynos5 GScaler bindings [2] in a similar way.

Hmmm. I'd expect explicit DT properties to represent the instance-specific "configuration", or even different compatible values. Relying on the alias ID seems rather indirect; what if in e.g. Exynos6/... the mapping from instance/alias ID to feature set changes. With explicit DT properties, that'd just be a .dts change, whereas by requiring alias IDs now, you'd need a driver change to support this.

#10 lore raw

PATCH v4 2/10 s5p-fimc: Add device tree support for FIMC devices

Quoted 28 lines · Stephen Warren
Quoted 7 lines · Sylwester Nawrocki
Quoted 6 lines · Stephen Warren
Quoted 6 lines

diff --git a/Documentation/devicetree/bindings/media/soc/samsung-fimc.txt b/Documentation/devicetree/bindings/media/soc/samsung-fimc.txt

+Samsung S5P/EXYNOS SoC Camera Subsystem (FIMC)
+----------------------------------------------

...

Quoted 10 lines
Quoted 9 lines
Quoted 5 lines

+For every fimc node a numbered alias should be present in the aliases node.
+Aliases are of the form fimc<n>, where<n> is an integer (0...N)
specifying
+the IP's instance index.

Why? Isn't it up to the DT author whether they care if each fimc node is assigned a specific identification v.s. whether identification is assigned automatically?

Quoted 8 lines

There are at least three different kinds of IPs that come in multiple instances in an SoC. To activate data links between them each instance needs to be clearly identified. There are also differences between instances of same device. Hence it's important these aliases don't have random values.

Some more details about the SoC can be found at [1]. The aliases are also already used in the Exynos5 GScaler bindings [2] in a similar way.

Quoted 6 lines

Hmmm. I'd expect explicit DT properties to represent the instance-specific "configuration", or even different compatible values. Relying on the alias ID seems rather indirect; what if in e.g. Exynos6/... the mapping from instance/alias ID to feature set changes. With explicit DT properties, that'd just be a .dts change, whereas by requiring alias IDs now, you'd need a driver change to support this.

In the initial version of this patch series I used cell-index property, but then Grant pointed out in some other mail thread it should be avoided. Hence I used the node aliases.

Different compatible values might not work, when for example there are 3 IPs out of 4 of one type and the fourth one of another type. It wouldn't even by really different types, just quirks/little differences between them, e.g. no data path routed to one of other IPs.

Then to connect e.g. MIPI-CSIS.0 to FIMC.2 at run time an index of the MIPI-CSIS needs to be written to the FIMC.2 data input control register. Even though MIPI-CSIS.N are same in terms of hardware structure they still need to be distinguished as separate instances.

#11 lore raw

PATCH v4 2/10 s5p-fimc: Add device tree support for FIMC devices

Quoted 37 lines · Sylwester Nawrocki
Quoted 29 lines · Stephen Warren
Quoted 7 lines · Sylwester Nawrocki
Quoted 6 lines · Stephen Warren
Quoted 6 lines

diff --git a/Documentation/devicetree/bindings/media/soc/samsung-fimc.txt b/Documentation/devicetree/bindings/media/soc/samsung-fimc.txt

+Samsung S5P/EXYNOS SoC Camera Subsystem (FIMC)
+----------------------------------------------

...

Quoted 11 lines
Quoted 10 lines
Quoted 5 lines

+For every fimc node a numbered alias should be present in the aliases node.
+Aliases are of the form fimc<n>, where<n> is an integer (0...N)
specifying
+the IP's instance index.

Why? Isn't it up to the DT author whether they care if each fimc node is
assigned a specific identification v.s. whether identification is assigned automatically?

Quoted 8 lines

There are at least three different kinds of IPs that come in multiple instances in an SoC. To activate data links between them each instance needs to be clearly identified. There are also differences between instances of same device. Hence it's important these aliases don't have random values.

Some more details about the SoC can be found at [1]. The aliases are also already used in the Exynos5 GScaler bindings [2] in a similar way.

Quoted 6 lines

Hmmm. I'd expect explicit DT properties to represent the instance-specific "configuration", or even different compatible values. Relying on the alias ID seems rather indirect; what if in e.g. Exynos6/... the mapping from instance/alias ID to feature set changes. With explicit DT properties, that'd just be a .dts change, whereas by requiring alias IDs now, you'd need a driver change to support this.

Quoted 3 lines

In the initial version of this patch series I used cell-index property, but then Grant pointed out in some other mail thread it should be avoided. Hence I used the node aliases.

To me, using cell-index is semantically equivalent to using the alias ID.

Quoted 4 lines

Different compatible values might not work, when for example there are 3 IPs out of 4 of one type and the fourth one of another type. It wouldn't even by really different types, just quirks/little differences between them, e.g. no data path routed to one of other IPs.

I was thinking of using feature-/quirk-oriented properties. For example, if there's a port on 3 of the 4 devices to connect to some other IP block, simply include a boolean property to indicate whether that port is present. It would be in 3 of the nodes but not the 4th.

Quoted 4 lines

Then to connect e.g. MIPI-CSIS.0 to FIMC.2 at run time an index of the MIPI-CSIS needs to be written to the FIMC.2 data input control register. Even though MIPI-CSIS.N are same in terms of hardware structure they still need to be distinguished as separate instances.

Oh, so you're using the alias ID as the value to write into the FIMC.2 register for that. I'm not 100% familiar with aliases, but they seem like a more user-oriented naming thing to me, whereas values for hooking up intra-SoC routing are an unrelated namespace semantically, even if the values happen to line up right now. Perhaps rather than a Boolean property I mentioned above, use a custom property to indicate the ID that the FIMC.2 object knows the MIPI-CSIS.0 object as? While this seems similar to using cell-index, my *guess* is that Grant's objection to using cell-index was more based on re-using cell-index for something other than its intended purpose than pushing you to use an alias ID rather than a property.

After all, what happens in some later SoC where you have two different types of module that feed into the common module, such that type A sources have IDs 0..3 in the common module, and type B sources have IDs 4..7 in the common module - you wouldn't want to require alias ISs 4..7 for the type B DT nodes.

#12 lore raw

PATCH v4 2/10 s5p-fimc: Add device tree support for FIMC devices

Quoted 38 lines · Stephen Warren
Quoted 37 lines · Sylwester Nawrocki
Quoted 35 lines · Stephen Warren
Quoted 7 lines · Sylwester Nawrocki
Quoted 6 lines · Stephen Warren
Quoted 6 lines

diff --git a/Documentation/devicetree/bindings/media/soc/samsung-fimc.txt b/Documentation/devicetree/bindings/media/soc/samsung-fimc.txt

+Samsung S5P/EXYNOS SoC Camera Subsystem (FIMC)
+----------------------------------------------

...

Quoted 11 lines
Quoted 10 lines
Quoted 5 lines

+For every fimc node a numbered alias should be present in the aliases node.
+Aliases are of the form fimc<n>, where<n> is an integer (0...N)
specifying
+the IP's instance index.

Why? Isn't it up to the DT author whether they care if each fimc node is
assigned a specific identification v.s. whether identification is assigned automatically?

Quoted 8 lines

There are at least three different kinds of IPs that come in multiple instances in an SoC. To activate data links between them each instance needs to be clearly identified. There are also differences between instances of same device. Hence it's important these aliases don't have random values.

Some more details about the SoC can be found at [1]. The aliases are also already used in the Exynos5 GScaler bindings [2] in a similar way.

Hmmm. I'd expect explicit DT properties to represent the instance-specific "configuration", or even different compatible values. Relying on the alias ID seems rather indirect; what if in e.g. Exynos6/... the mapping from instance/alias ID to feature set changes. With explicit DT properties, that'd just be a .dts change, whereas by requiring alias IDs now, you'd need a driver change to support this.

Quoted 5 lines
Quoted 3 lines

In the initial version of this patch series I used cell-index property, but then Grant pointed out in some other mail thread it should be avoided. Hence I used the node aliases.

To me, using cell-index is semantically equivalent to using the alias ID.

I can't see significant difference either. I just switched to what seemed to be used for similar purpose.

Quoted 9 lines
Quoted 4 lines

Different compatible values might not work, when for example there are 3 IPs out of 4 of one type and the fourth one of another type. It wouldn't even by really different types, just quirks/little differences between them, e.g. no data path routed to one of other IPs.

I was thinking of using feature-/quirk-oriented properties. For example, if there's a port on 3 of the 4 devices to connect to some other IP block, simply include a boolean property to indicate whether that port is present. It would be in 3 of the nodes but not the 4th.

Yes, I could add several properties corresponding to all members of this
[3] data structure. But still it is needed to clearly identify the IP block in a set of the hardware instances.

Quoted 5 lines
Quoted 4 lines

Then to connect e.g. MIPI-CSIS.0 to FIMC.2 at run time an index of the MIPI-CSIS needs to be written to the FIMC.2 data input control register. Even though MIPI-CSIS.N are same in terms of hardware structure they still need to be distinguished as separate instances.

Quoted 7 lines

Oh, so you're using the alias ID as the value to write into the FIMC.2 register for that. I'm not 100% familiar with aliases, but they seem like a more user-oriented naming thing to me, whereas values for hooking up intra-SoC routing are an unrelated namespace semantically, even if the values happen to line up right now. Perhaps rather than a Boolean property I mentioned above, use a custom property to indicate the ID that the FIMC.2 object knows the MIPI-CSIS.0 object as? While this seems

That could be 'reg' property in the MIPI-CSIS.0 'port' subnode that links it to the image sensor node ([4], line 165). Because MIPI-CSIS IP blocks are immutably connected to the SoC camera physical MIPI CSI-2 interfaces, and the physical camera ports have fixed assignment to the MIPI-CSIS devices.. This way we could drop alias ID for the MIPI-CSIS nodes. And their instance index that is required for the top level driver which exposes topology and the routing capabilities to user space could be restored from the reg property value by subtracting a fixed offset.

Similarly an instance index of FIMC-LITE could be derived from the value of reg property in a port node that links it to FIMC-IS ISP. I have been omitting these port/endpoint nodes because it seemed unnecessary to model explicitly those data paths. However it feels a bit overkill to add them just for the sake of identifying the IP block instance

Still I can't really see a possibility to drop indexes for the FIMC nodes.

Quoted 4 lines

similar to using cell-index, my *guess* is that Grant's objection to using cell-index was more based on re-using cell-index for something other than its intended purpose than pushing you to use an alias ID rather than a property.

The comments to a patch for some other driver I was referring to can be found at [1]. My first patch series appeared significantly later [2]. I confused things a bit, sorry about that.

I can see aliases used in bindings of multiple devices: uart, spi, sound interfaces, gpio, ... And all bindings seem to impose some rules on how their aliases are created.

Quoted 5 lines

After all, what happens in some later SoC where you have two different types of module that feed into the common module, such that type A sources have IDs 0..3 in the common module, and type B sources have IDs 4..7 in the common module - you wouldn't want to require alias ISs 4..7 for the type B DT nodes.

There is no need to write alias ID directly into registers, and actually it doesn't really happen. But we need to know that, for example camera A is connected to physical MIPI CSI-2 channel 0 and to capture video with DMA engine of FIMC.2 we need to set FIMC.2 input register to link it to MIPI-CSIS 0.

The system registers, where a sort of camera/display glue logic is configured also refer to FIMC devices explicitly by ID. So the driver as a client of the system registers block/glue logic interface needs to pass an information which FIMC H/W instance it wants to be e.g. attached/detached to/from some data pipeline.

I still need to design some API for the camera system registers (glue logic) block. This would be shared by the V4L2 and the DRM FIMC driver. I thought about a couple of function calls specific to Exynos platform that would be called directly by related drivers.

[1]
https://lists.ozlabs.org/pipermail/devicetree-discuss/2012-January/012128.html
[2] http://www.spinics.net/lists/linux-media/msg48341.html
[3]
http://lxr.linux.no/#linux+v3.7.6/drivers/media/platform/s5p-fimc/fimc-core.h#L365
[4] http://tinyurl.com/arczzuo

#13 lore raw

PATCH v4 2/10 s5p-fimc: Add device tree support for FIMC devices

Quoted 6 lines · Sylwester Nawrocki
Quoted 6 lines

After all, what happens in some later SoC where you have two different types of module that feed into the common module, such that type A sources have IDs 0..3 in the common module, and type B sources have IDs 4..7 in the common module - you wouldn't want to require alias ISs 4..7 for the type B DT nodes.

I forgot to add, any ID remapping could happen in the common module, if it requires it. Type A and type B sources could have indexes 0...3 and the common module could derive its configuration from the source ID *and* the source type. The idea behind aliases was to identify each instance, rather than providing an exact configuration data that the common module could use.

#14 lore raw

PATCH v4 2/10 s5p-fimc: Add device tree support for FIMC devices

In reply to Sylwester Nawrocki
Quoted 17 lines · Sylwester Nawrocki
Quoted 16 lines · Stephen Warren
Quoted 15 lines · Sylwester Nawrocki
Quoted 14 lines · Stephen Warren
Quoted 7 lines · Sylwester Nawrocki
Quoted 6 lines · Stephen Warren
Quoted 6 lines

diff --git a/Documentation/devicetree/bindings/media/soc/samsung-fimc.txt b/Documentation/devicetree/bindings/media/soc/samsung-fimc.txt

+Samsung S5P/EXYNOS SoC Camera Subsystem (FIMC)
+----------------------------------------------

...

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

+For every fimc node a numbered alias should be present in the aliases node.
+Aliases are of the form fimc<n>, where<n> is an integer (0...N)
specifying
+the IP's instance index.

...

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

Different compatible values might not work, when for example there are 3 IPs out of 4 of one type and the fourth one of another type. It wouldn't even by really different types, just quirks/little differences between them, e.g. no data path routed to one of other IPs.

Quoted 8 lines
Quoted 4 lines

I was thinking of using feature-/quirk-oriented properties. For example, if there's a port on 3 of the 4 devices to connect to some other IP block, simply include a boolean property to indicate whether that port is present. It would be in 3 of the nodes but not the 4th.

Yes, I could add several properties corresponding to all members of this
[3] data structure. But still it is needed to clearly identify the IP block in a set of the hardware instances.

Why? What decisions will be made based on the identify of the IP block instance that wouldn't be covered by DT properties that describe which features/bugs/... the IP block instance has?

Quoted 14 lines
Quoted 6 lines
Quoted 5 lines

Then to connect e.g. MIPI-CSIS.0 to FIMC.2 at run time an index of the MIPI-CSIS needs to be written to the FIMC.2 data input control register. Even though MIPI-CSIS.N are same in terms of hardware structure they still
need to be distinguished as separate instances.

Quoted 7 lines

Oh, so you're using the alias ID as the value to write into the FIMC.2 register for that. I'm not 100% familiar with aliases, but they seem like a more user-oriented naming thing to me, whereas values for hooking up intra-SoC routing are an unrelated namespace semantically, even if the values happen to line up right now. Perhaps rather than a Boolean property I mentioned above, use a custom property to indicate the ID that the FIMC.2 object knows the MIPI-CSIS.0 object as? While this seems

Quoted 9 lines

That could be 'reg' property in the MIPI-CSIS.0 'port' subnode that links it to the image sensor node ([4], line 165). Because MIPI-CSIS IP blocks are immutably connected to the SoC camera physical MIPI CSI-2 interfaces, and the physical camera ports have fixed assignment to the MIPI-CSIS devices.. This way we could drop alias ID for the MIPI-CSIS nodes. And their instance index that is required for the top level driver which exposes topology and the routing capabilities to user space could be restored from the reg property value by subtracting a fixed offset.

I suppose that would work. It feels a little indirect, and I think means that the driver needs to go find some child node defining its end of some link, then find the node representing the other end of the link, then read properties out of that other node to find the value. That seems a little unusual, but I guess it would work. I'm not sure of the long-term implications of doing that kind of thing. You'd want to run the idea past some DT maintainers/experts.

...

Quoted 3 lines

I can see aliases used in bindings of multiple devices: uart, spi, sound interfaces, gpio, ... And all bindings seem to impose some rules on how their aliases are created.

Do you have specific examples? I really don't think the bindings should be dictating the alias values.

Quoted 11 lines
Quoted 5 lines

After all, what happens in some later SoC where you have two different types of module that feed into the common module, such that type A sources have IDs 0..3 in the common module, and type B sources have IDs 4..7 in the common module - you wouldn't want to require alias ISs 4..7 for the type B DT nodes.

There is no need to write alias ID directly into registers, and actually it doesn't really happen. But we need to know that, for example camera A is connected to physical MIPI CSI-2 channel 0 and to capture video with DMA engine of FIMC.2 we need to set FIMC.2 input register to link it to MIPI-CSIS 0.

OK, so the IDs are selecting which register to write, or which mux settings to access. That's pretty much semantically the same thing.

#15 lore raw

PATCH v4 2/10 s5p-fimc: Add device tree support for FIMC devices

Quoted 29 lines · Stephen Warren
Quoted 17 lines · Sylwester Nawrocki
Quoted 16 lines · Stephen Warren
Quoted 15 lines · Sylwester Nawrocki
Quoted 14 lines · Stephen Warren
Quoted 7 lines · Sylwester Nawrocki
Quoted 6 lines · Stephen Warren
Quoted 6 lines

diff --git a/Documentation/devicetree/bindings/media/soc/samsung-fimc.txt b/Documentation/devicetree/bindings/media/soc/samsung-fimc.txt

+Samsung S5P/EXYNOS SoC Camera Subsystem (FIMC)
+----------------------------------------------

...

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

+For every fimc node a numbered alias should be present in the aliases node.
+Aliases are of the form fimc<n>, where<n> is an integer (0...N)
specifying
+the IP's instance index.

...

Quoted 10 lines
Quoted 9 lines
Quoted 4 lines

Different compatible values might not work, when for example there are 3 IPs out of 4 of one type and the fourth one of another type. It wouldn't even by really different types, just quirks/little differences between them, e.g. no data path routed to one of other IPs.

I was thinking of using feature-/quirk-oriented properties. For example, if there's a port on 3 of the 4 devices to connect to some other IP block, simply include a boolean property to indicate whether that port is present. It would be in 3 of the nodes but not the 4th.

Quoted 7 lines
Quoted 3 lines

Yes, I could add several properties corresponding to all members of this
[3] data structure. But still it is needed to clearly identify the IP block in a set of the hardware instances.

Why? What decisions will be made based on the identify of the IP block instance that wouldn't be covered by DT properties that describe which features/bugs/... the IP block instance has?

The whole subsystem topology is exposed to user space through the Media Controller API. Although the user space libraries/applications using this driver are not much concerned how the hardware is represented internally in the kernel, some properties of the media entities seen in user space are derived from the hardware details, e.g. the media entity names contain index of a corresponding IP block. Please see [1] for an example of a topology exposed by the driver.

Since different H/W instances have different capabilities, user space libraries/plugins can be coded to e.g. use one instance for video playback post-processing and another for camera capture. The capabilities could be also discovered with the V4L2 API to some level of detail. But still assigning random entity names to the IP blocks has a potential of breaking user space or causing some malfunctions.

Perhaps I should just use a custom properties like "samsung,fimc-id" ? I tried to represent some intra-soc data routing details with our common video interfaces bindings and it really looked like a lot of unnecessary nodes, with 11 camera sub-device nodes required to cover a front a rear facing camera. Some details can be just coded in the driver, especially that newer SoCs will get a new driver anyway, since there are huge differences between the media subsystem architecture across subsequent SoC revisions.

[1] http://www.spinics.net/lists/linux-media/attachments/psPhA96YX70U.ps

Quoted 24 lines
Quoted 14 lines
Quoted 6 lines
Quoted 5 lines

Then to connect e.g. MIPI-CSIS.0 to FIMC.2 at run time an index of the MIPI-CSIS needs to be written to the FIMC.2 data input control register. Even though MIPI-CSIS.N are same in terms of hardware structure they still
need to be distinguished as separate instances.

Quoted 7 lines

Oh, so you're using the alias ID as the value to write into the FIMC.2 register for that. I'm not 100% familiar with aliases, but they seem like a more user-oriented naming thing to me, whereas values for hooking up intra-SoC routing are an unrelated namespace semantically, even if the values happen to line up right now. Perhaps rather than a Boolean property I mentioned above, use a custom property to indicate the ID that the FIMC.2 object knows the MIPI-CSIS.0 object as? While this seems

Quoted 9 lines

That could be 'reg' property in the MIPI-CSIS.0 'port' subnode that links it to the image sensor node ([4], line 165). Because MIPI-CSIS IP blocks are immutably connected to the SoC camera physical MIPI CSI-2 interfaces, and the physical camera ports have fixed assignment to the MIPI-CSIS devices.. This way we could drop alias ID for the MIPI-CSIS nodes. And their instance index that is required for the top level driver which exposes topology and the routing capabilities to user space could be restored from the reg property value by subtracting a fixed offset.

Quoted 7 lines

I suppose that would work. It feels a little indirect, and I think means that the driver needs to go find some child node defining its end of some link, then find the node representing the other end of the link, then read properties out of that other node to find the value. That seems a little unusual, but I guess it would work. I'm not sure of the long-term implications of doing that kind of thing. You'd want to run the idea past some DT maintainers/experts.

It's a bit simpler than that. We would need only to look for the reg property in a local port subnode. MIPI-CSIS correspond to physical MIPI CSI-2 bus interface of an SoC, hence it has to have specific reg values that identify each camera input interface.

csis { /* MIPI CSI-2 Slave */

     ...
     port {
         reg = <1>;  /* e.g. MIPI-CSIS.1 */
         csis_ep: endpoint {
             remote-endpoint = <&img_sensor_ep>;
         }	
     };
};
i2c-controller {
     ...
     image-sensor {  /* MIPI CSI-2 Master */
         ...
         port {
             img_sensor_ep: endpoint {
                 remote-endpoint = <&csis_ep>;
             }	
         };
     };
};

Naturally the image-sensor node represents a device external to an SoC.

Quoted 7 lines

...

Quoted 3 lines

I can see aliases used in bindings of multiple devices: uart, spi, sound interfaces, gpio, ... And all bindings seem to impose some rules on how their aliases are created.

Do you have specific examples? I really don't think the bindings should be dictating the alias values.

I just grepped through the existing bindings documentation:

gpio/gpio-mxs.txt:Note: Each GPIO port should have an alias correctly numbered in "aliases"
gpio/gpio-mxs.txt-node.

serial/fsl-imx-uart.txt:Note: Each uart controller should have an alias correctly numbered
serial/fsl-imx-uart.txt:in "aliases" node.

mmc/synopsis-dw-mshc.txt:- All the MSHC controller nodes should be represented in the aliases node using mmc/synopsis-dw-mshc.txt: the following format 'mshc{n}' where n is a unique number for the alias.

sound/mxs-saif.txt:Note: Each SAIF controller should have an alias correctly numbered
sound/mxs-saif.txt:in "aliases" node.

spi/spi-samsung.txt:- All the SPI controller nodes should be represented in the aliases node using
spi/spi-samsung.txt: the following format 'spi{n}' where n is a unique number for the alias.

tty/serial/fsl-mxs-auart.txt:Note: Each auart port should have an alias correctly numbered in "aliases" tty/serial/fsl-mxs-auart.txt-node.

powerpc/fsl/mpic-msgr.txt: An alias should be created for every
message register block. They are not
powerpc/fsl/mpic-msgr.txt- required, though. However, a particular
implementation of this binding
powerpc/fsl/mpic-msgr.txt: may require aliases to be present.
Aliases are of the form
powerpc/fsl/mpic-msgr.txt- 'mpic-msgr-block<n>', where <n> is an
integer specifying the block's number.
powerpc/fsl/mpic-msgr.txt- Numbers shall start at 0.

I think "correctly numbered" in the above statements means there are some specific rules on how the aliases are created, however those seem not clearly communicated.

And there is a new patch series that allows I2C bus controller enumeration by means of the aliases:

http://www.spinics.net/lists/arm-kernel/msg224162.html

Quoted 14 lines
Quoted 11 lines
Quoted 5 lines

After all, what happens in some later SoC where you have two different types of module that feed into the common module, such that type A sources have IDs 0..3 in the common module, and type B sources have IDs 4..7 in the common module - you wouldn't want to require alias ISs 4..7 for the type B DT nodes.

There is no need to write alias ID directly into registers, and actually it doesn't really happen. But we need to know that, for example camera A is connected to physical MIPI CSI-2 channel 0 and to capture video with DMA engine of FIMC.2 we need to set FIMC.2 input register to link it to MIPI-CSIS 0.

OK, so the IDs are selecting which register to write, or which mux settings to access. That's pretty much semantically the same thing.

#16 lore raw

PATCH v4 2/10 s5p-fimc: Add device tree support for FIMC devices

Quoted 37 lines · Sylwester Nawrocki
Quoted 36 lines · Stephen Warren
Quoted 18 lines · Sylwester Nawrocki
Quoted 17 lines · Stephen Warren
Quoted 16 lines · Sylwester Nawrocki
Quoted 15 lines · Stephen Warren
Quoted 7 lines · Sylwester Nawrocki
Quoted 6 lines · Stephen Warren
Quoted 6 lines

diff --git a/Documentation/devicetree/bindings/media/soc/samsung-fimc.txt b/Documentation/devicetree/bindings/media/soc/samsung-fimc.txt

+Samsung S5P/EXYNOS SoC Camera Subsystem (FIMC)
+----------------------------------------------

...

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

+For every fimc node a numbered alias should be present in the aliases node.
+Aliases are of the form fimc<n>, where<n> is an integer
(0...N)
specifying
+the IP's instance index.

...

Quoted 15 lines
Quoted 11 lines
Quoted 5 lines

Different compatible values might not work, when for example there are 3 IPs out of 4 of one type and the fourth one of another type. It wouldn't even by really different types, just quirks/little differences between them, e.g. no data path routed to one of other IPs.

I was thinking of using feature-/quirk-oriented properties. For example,
if there's a port on 3 of the 4 devices to connect to some other IP block, simply include a boolean property to indicate whether that port is present. It would be in 3 of the nodes but not the 4th.

Yes, I could add several properties corresponding to all members of this
[3] data structure. But still it is needed to clearly identify the IP block in a set of the hardware instances.

Quoted 6 lines
Quoted 3 lines

Why? What decisions will be made based on the identify of the IP block instance that wouldn't be covered by DT properties that describe which features/bugs/... the IP block instance has?

The whole subsystem topology is exposed to user space through the Media Controller API.

OK, stable user-visible names are a reasonable use for device tree. I still don't think you should use those user-visible IDs for making any other kind of decision though.

Quoted 35 lines
Quoted 27 lines
Quoted 17 lines
Quoted 7 lines
Quoted 6 lines

Then to connect e.g. MIPI-CSIS.0 to FIMC.2 at run time an index of the MIPI-CSIS needs to be written to the FIMC.2 data input control register.
Even though MIPI-CSIS.N are same in terms of hardware structure they still
need to be distinguished as separate instances.

Quoted 9 lines

Oh, so you're using the alias ID as the value to write into the FIMC.2 register for that. I'm not 100% familiar with aliases, but they seem like a more user-oriented naming thing to me, whereas values for hooking
up intra-SoC routing are an unrelated namespace semantically, even if the values happen to line up right now. Perhaps rather than a Boolean property I mentioned above, use a custom property to indicate the ID that the FIMC.2 object knows the MIPI-CSIS.0 object as? While this seems

Quoted 9 lines

That could be 'reg' property in the MIPI-CSIS.0 'port' subnode that links it to the image sensor node ([4], line 165). Because MIPI-CSIS IP blocks are immutably connected to the SoC camera physical MIPI CSI-2 interfaces, and the physical camera ports have fixed assignment to the MIPI-CSIS devices.. This way we could drop alias ID for the MIPI-CSIS nodes. And their instance index that is required for the top level driver which exposes topology and the routing capabilities to user space could be restored from the reg property value by subtracting a fixed offset.

Quoted 7 lines

I suppose that would work. It feels a little indirect, and I think means that the driver needs to go find some child node defining its end of some link, then find the node representing the other end of the link, then read properties out of that other node to find the value. That seems a little unusual, but I guess it would work. I'm not sure of the long-term implications of doing that kind of thing. You'd want to run the idea past some DT maintainers/experts.

Quoted 4 lines

It's a bit simpler than that. We would need only to look for the reg property in a local port subnode. MIPI-CSIS correspond to physical MIPI CSI-2 bus interface of an SoC, hence it has to have specific reg values that identify each camera input interface.

Oh I see. I guess if a device is using its own node to determine its own identify, that's reasonable.

I thought you were talking about a situation like:

FIMC <--> XXX

where FIMC wanted to determine what ID XXX knew that particular FIMC as.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

I can see aliases used in bindings of multiple devices: uart, spi, sound interfaces, gpio, ... And all bindings seem to impose some rules on how their aliases are created.

Do you have specific examples? I really don't think the bindings should be dictating the alias values.

I just grepped through the existing bindings documentation:

...

Quoted 3 lines

I think "correctly numbered" in the above statements means there are some specific rules on how the aliases are created, however those seem not clearly communicated.

A binding specifying that an alias must (or even should) exist for each node seems odd to me. In the absence of an explicit rule for how to determine the alias IDs to use, I think the rule would simply be that the aliases must be unique?

Quoted 4 lines

And there is a new patch series that allows I2C bus controller enumeration by means of the aliases:

http://www.spinics.net/lists/arm-kernel/msg224162.html

That's not enumerating controllers by alias (they're still enumerated by scanning the DT nodes for buses in the normal way). The change simply assigns the bus ID of each controller from an alias; exactly what aliases are for.

#17 lore raw

PATCH v4 2/10 s5p-fimc: Add device tree support for FIMC devices

Quoted 1 line · Stephen Warren

On 02/12/2013 03:39 PM, Sylwester Nawrocki wrote:

[...]

Quoted 6 lines
Quoted 2 lines

The whole subsystem topology is exposed to user space through the Media Controller API.

OK, stable user-visible names are a reasonable use for device tree. I still don't think you should use those user-visible IDs for making any other kind of decision though.

OK, I will update the bindings so all variant details are placed in the device tree. Then the routing information would mostly be coming from the device specific dt properties/the common media bindings and the state of links between the media entities, set by the user.

Quoted 7 lines
Quoted 4 lines

It's a bit simpler than that. We would need only to look for the reg property in a local port subnode. MIPI-CSIS correspond to physical MIPI CSI-2 bus interface of an SoC, hence it has to have specific reg values that identify each camera input interface.

Oh I see. I guess if a device is using its own node to determine its own identify, that's reasonable.

OK, I'm going to post an updated patch series in a week or two.

Quoted 5 lines

I thought you were talking about a situation like:

FIMC <--> XXX

where FIMC wanted to determine what ID XXX knew that particular FIMC as.

Ah, no. Sorry for the poor explanation. FIMC are on a sort if interconnect bus and they can be attached to a single data source, even in parallel, and the data source entity don't even need to be fully aware of it.

Quoted 9 lines
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

I can see aliases used in bindings of multiple devices: uart, spi, sound interfaces, gpio, ... And all bindings seem to impose some rules on how their aliases are created.

Do you have specific examples? I really don't think the bindings should be dictating the alias values.

I just grepped through the existing bindings documentation:

...

Quoted 8 lines
Quoted 3 lines

I think "correctly numbered" in the above statements means there are some specific rules on how the aliases are created, however those seem not clearly communicated.

A binding specifying that an alias must (or even should) exist for each node seems odd to me. In the absence of an explicit rule for how to determine the alias IDs to use, I think the rule would simply be that the aliases must be unique?

I guess so. Inspecting of_alias_get_id() call sites tells us that most drivers
just fail when alias is not present and only rarely it is not treated as an error condition.

Quoted 9 lines
Quoted 4 lines

And there is a new patch series that allows I2C bus controller enumeration by means of the aliases:

http://www.spinics.net/lists/arm-kernel/msg224162.html

That's not enumerating controllers by alias (they're still enumerated by scanning the DT nodes for buses in the normal way). The change simply assigns the bus ID of each controller from an alias; exactly what aliases are for.

OK, that clarifies a bit my understanding of the aliases.

Thanks,
Sylwester

#18 lore raw

PATCH v4 3/10 s5p-fimc: Add device tree support for FIMC-LITE devices

In reply to Sylwester Nawrocki

This patch add support for binding the driver to FIMC-LITE devices instantiated from the device tree.

---
 .../devicetree/bindings/media/soc/samsung-fimc.txt |   15 +++++
 drivers/media/platform/s5p-fimc/fimc-lite.c        |   65 ++++++++++++++------
 2 files changed, 61 insertions(+), 19 deletions(-)
Documentation/devicetree/bindings/media/soc/samsung-fimc.txt +15 -0
index 916b2c3..2b932f2 100644
@@ -41,6 +41,21 @@ Optional properties
 
  - clock-frequency - maximum FIMC local clock (LCLK) frequency
 
+'fimc-lite' device nodes
+-----------------------
+
+Required properties:
+
+- compatible : should be "samsung,exynos4212-fimc" for Exynos4212 and
+	       Exynos4412 SoCs;
+- reg	     : physical base address and size of the device memory mapped
+	       registers;
+- interrupts : should contain FIMC-LITE interrupt;
+
+For every fimc-lite node a numbered alias should be present in the aliases
+node. Aliases are in form of fimc-lite<n>, where <n> is an integer (0...N)
+specifying the IP's instance index.
+
 Example:
 
 	aliases {
drivers/media/platform/s5p-fimc/fimc-lite.c +46 -19

141 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#19 lore raw

PATCH v4 4/10 s5p-fimc: Add device tree support for the main media device driver

In reply to Sylwester Nawrocki

This patch adds changes required for the main camera media device driver to be initialized on systems instantiated from the device tree.

The platform devices corresponding to child nodes of the 'camera' node are looked up and and registered as sub-devices to the common media device. The main driver's probing is deferred if any of the sub-device drivers is not yet initialized and ready.

An OF matching table is added for the main driver associated with the 'camera' node.

---
 drivers/media/platform/s5p-fimc/fimc-core.c    |    1 -
 drivers/media/platform/s5p-fimc/fimc-mdevice.c |   77 +++++++++++++++++++++---
 drivers/media/platform/s5p-fimc/fimc-mdevice.h |    4 ++
 include/media/s5p_fimc.h                       |    1 +
 4 files changed, 75 insertions(+), 8 deletions(-)
drivers/media/platform/s5p-fimc/fimc-core.c +0 -1
index 07ca0e0..ba743a5 100644
@@ -1276,7 +1276,6 @@ static const struct platform_device_id fimc_driver_ids[] = {
 	},
 	{ },
 };
-MODULE_DEVICE_TABLE(platform, fimc_driver_ids);
 
 static const struct of_device_id fimc_of_match[] = {
 	{
drivers/media/platform/s5p-fimc/fimc-mdevice.c +70 -7

115 lines not on this page · raw message

drivers/media/platform/s5p-fimc/fimc-mdevice.h +4 -0
index 06b0d82..f3e0251 100644
@@ -21,6 +21,10 @@
 #include "fimc-lite.h"
 #include "mipi-csis.h"
 
+#define FIMC_OF_NODE_NAME	"fimc"
+#define FIMC_LITE_OF_NODE_NAME	"fimc-lite"
+#define CSIS_OF_NODE_NAME	"csis"
+
 /* Group IDs of sensor, MIPI-CSIS, FIMC-LITE and the writeback subdevs. */
 #define GRP_ID_SENSOR		(1 << 8)
 #define GRP_ID_FIMC_IS_SENSOR	(1 << 9)
include/media/s5p_fimc.h +1 -0
index 28f3590..17fd2fa 100644
@@ -81,6 +81,7 @@ enum fimc_subdev_index {
 	IDX_SENSOR,
 	IDX_CSIS,
 	IDX_FLITE,
+	IDX_IS_ISP,
 	IDX_FIMC,
 	IDX_MAX,
 };
Signature · 1 line
1.7.9.5
#20 lore raw

PATCH v4 5/10 s5p-fimc: Add device tree based sensors registration

In reply to Sylwester Nawrocki

The sensor (I2C and/or SPI client) devices are instantiated by their corresponding control bus drivers. Since the I2C client's master clock is often provided by a video bus receiver (host interface) or other than I2C/SPI controller device, the drivers of those client devices are not accessing hardware in their driver's probe() callback. Instead, after enabling clock, the host driver calls back into a sub-device when it wants to activate them. This pattern is used by some in-tree drivers and this patch also uses it for DT case. This patch is intended as a first step for adding device tree support to the S5P/Exynos SoC camera drivers. The second one is adding support for asynchronous sub-devices registration and clock control from sub-device driver level. The bindings shall not change when asynchronous probing support is added.

---
 .../devicetree/bindings/media/soc/samsung-fimc.txt |   89 ++++++++
 drivers/media/platform/s5p-fimc/fimc-mdevice.c     |  231 +++++++++++++++++---
 include/media/s5p_fimc.h                           |   16 ++
 3 files changed, 311 insertions(+), 25 deletions(-)
Documentation/devicetree/bindings/media/soc/samsung-fimc.txt +89 -0
index 2b932f2..6b81ad1 100644
@@ -56,6 +56,29 @@ For every fimc-lite node a numbered alias should be present in the aliases
 node. Aliases are in form of fimc-lite<n>, where <n> is an integer (0...N)
 specifying the IP's instance index.
 
+
+'parallel-ports' node
+---------------------
+
+This node should contain child 'port' nodes specifying active parallel video
+input ports. It includes camera A and camera B inputs. 'reg' property in the
+port nodes specifies data input - 0, 1 indicates input A, B respectively.
+
+Optional properties
+
+- samsung,camclk-out	 : specifies clock output for remote sensor,
+			   0 - CAM_A_CLKOUT, 1 - CAM_B_CLKOUT;
+
+Image sensor nodes
+------------------
+
+The sensor device nodes should be added as their control bus controller
+(e.g. I2C0) child nodes and linked to a port node in the csis or parallel-ports
+node, using common the common video interfaces bindings, i.e. port/endpoint
+node pairs. The implementation of this binding requires clock-frequency
+property to be present in the sensor device nodes.
+
+
 Example:
 
 	aliases {
@@ -63,12 +86,68 @@ Example:
 		fimc0 = &fimc_0;
 	};
 
+	/* Parallel bus IF sensor */
+	i2c_0: i2c at 13860000 {
+		s5k6aa: sensor at 3c {
+			compatible = "samsung,s5k6aafx";
+			reg = <0x3c>;
+			vddio-supply = <...>;
+
+			clock-frequency = <24000000>;
+			clocks = <...>;
+			clock-names = "mclk";
+
+			port {
+				s5k6aa_ep: endpoint {
+					remote-endpoint = <&fimc0_ep>;
+					bus-width = <8>;
+					hsync-active = <0>;
+					hsync-active = <1>;
+					pclk-sample = <1>;
+				};
+			};
+		};
+	};
+
+	/* MIPI CSI-2 bus IF sensor */
+	s5c73m3: sensor at 0x1a {
+		compatible = "samsung,s5c73m3";
+		reg = <0x1a>;
+		vddio-supply = <...>;
+
+		clock-frequency = <24000000>;
+		clocks = <...>;
+		clock-names = "mclk";
+
+		port {
+			s5c73m3_1: endpoint {
+				data-lanes = <1>, <2>, <3>, <4>;
+				remote-endpoint = <&csis0_ep>;
+			};
+		};
+	};
+
 	camera {
 		compatible = "samsung,fimc", "simple-bus";
 		#address-cells = <1>;
 		#size-cells = <1>;
 		status = "okay";
 
+		/* parallel camera ports */
+		parallel-ports {
+			/* camera A input */
+			port at 0 {
+				reg = <1>;
+				fimc0_ep: endpoint {
+					remote-endpoint = <&s5k6aa_ep>;
+					bus-width = <8>;
+					hsync-active = <0>;
+					hsync-active = <1>;
+					pclk-sample = <1>;
+				};
+			};
+		};
+
 		fimc_0: fimc at 11800000 {
 			compatible = "samsung,exynos4210-fimc";
 			reg = <0x11800000 0x1000>;
@@ -81,6 +160,16 @@ Example:
 			reg = <0x11880000 0x1000>;
 			interrupts = <0 78 0>;
 			max-data-lanes = <4>;
+			/* camera C input */
+			port {
+				reg = <3>;
+				csis0_ep: endpoint {
+					remote-endpoint = <&s5c73m3_ep>;
+					data-lanes = <1>, <2>, <3>, <4>;
+					samsung,csis-hs-settle = <12>;
+					samsung,camclk-out = <0>;
+				};
+			};
 		};
 	};
 
drivers/media/platform/s5p-fimc/fimc-mdevice.c +206 -25

311 lines not on this page · raw message

include/media/s5p_fimc.h +16 -0
index 17fd2fa..e2434bb 100644
@@ -15,6 +15,19 @@
 #include <media/media-entity.h>
 
 /*
+ * Enumeration of data inputs to the camera subsystem.
+ */
+enum fimc_input {
+	FIMC_INPUT_PARALLEL_0	= 1,
+	FIMC_INPUT_PARALLEL_1,
+	FIMC_INPUT_MIPI_CSI2_0	= 3,
+	FIMC_INPUT_MIPI_CSI2_1,
+	FIMC_INPUT_WRITEBACK_A	= 5,
+	FIMC_INPUT_WRITEBACK_B,
+	FIMC_INPUT_WRITEBACK_ISP = 5,
+};
+
+/*
  * Enumeration of the FIMC data bus types.
  */
 enum fimc_bus_type {
@@ -32,6 +45,9 @@ enum fimc_bus_type {
 	FIMC_BUS_TYPE_ISP_WRITEBACK = FIMC_BUS_TYPE_LCD_WRITEBACK_B,
 };
 
+#define fimc_input_is_parallel(x) ((x) == 1 || (x) == 2)
+#define fimc_input_is_mipi_csi(x) ((x) == 3 || (x) == 4)
+
 struct i2c_board_info;
 
 /**
Signature · 1 line
1.7.9.5
#21 lore raw

PATCH v4 5/10 s5p-fimc: Add device tree based sensors registration

Quoted 15 lines · Sylwester Nawrocki

The sensor (I2C and/or SPI client) devices are instantiated by their corresponding control bus drivers. Since the I2C client's master clock is often provided by a video bus receiver (host interface) or other than I2C/SPI controller device, the drivers of those client devices are not accessing hardware in their driver's probe() callback. Instead, after enabling clock, the host driver calls back into a sub-device when it wants to activate them. This pattern is used by some in-tree drivers and this patch also uses it for DT case. This patch is intended as a first step for adding device tree support to the S5P/Exynos SoC camera drivers. The second one is adding support for asynchronous sub-devices registration and clock control from sub-device driver level. The bindings shall not change when asynchronous probing support is added.

Documentation/devicetree/bindings/media/soc/samsung-fimc.txt For every fimc-lite node a numbered alias should be present in the aliases · line 75

Quoted 2 lines
Documentation/devicetree/bindings/media/soc/samsung-fimc.txt +1 -0
 
+The sensor device nodes should be added as their control bus controller

I think "as" should be "to"?

Quoted 4 lines
Documentation/devicetree/bindings/media/soc/samsung-fimc.txt +4 -0
+(e.g. I2C0) child nodes and linked to a port node in the csis or parallel-ports
+node, using common the common video interfaces bindings, i.e. port/endpoint
+node pairs. The implementation of this binding requires clock-frequency
+property to be present in the sensor device nodes.
#22 lore raw

PATCH v4 5/10 s5p-fimc: Add device tree based sensors registration

Quoted 15 lines · Stephen Warren
Quoted 13 lines · Sylwester Nawrocki

The sensor (I2C and/or SPI client) devices are instantiated by their corresponding control bus drivers. Since the I2C client's master clock is often provided by a video bus receiver (host interface) or other than I2C/SPI controller device, the drivers of those client devices are not accessing hardware in their driver's probe() callback. Instead, after enabling clock, the host driver calls back into a sub-device when it wants to activate them. This pattern is used by some in-tree drivers and this patch also uses it for DT case. This patch is intended as a first step for adding device tree support to the S5P/Exynos SoC camera drivers. The second one is adding support for asynchronous sub-devices registration and clock control from sub-device driver level. The bindings shall not change when asynchronous probing support is added.

Quoted 5 lines

Documentation/devicetree/bindings/media/soc/samsung-fimc.txt For every fimc-lite node a numbered alias should be present in the aliases · line 75

Quoted 3 lines
Documentation/devicetree/bindings/media/soc/samsung-fimc.txt +1 -0
 
+The sensor device nodes should be added as their control bus controller

I think "as" should be "to"?

Yes, something is wrong here. Hopefully this is more correct:

The sensor device nodes should be added to their control bus controller (e.g. I2C0) nodes and linked to a port node in the csis or parallel-ports

Quoted 2 lines

Documentation/devicetree/bindings/media/soc/samsung-fimc.txt For every fimc-lite node a numbered alias should be present in the aliases · line 77

Quoted 2 lines
Documentation/devicetree/bindings/media/soc/samsung-fimc.txt +2 -0
+(e.g. I2C0) child nodes and linked to a port node in the csis or parallel-ports
+node, using common the common video interfaces bindings, i.e. port/endpoint
                ^^^^^^^^

And this needs correction too.

Quoted 2 lines
Quoted 2 lines
Documentation/devicetree/bindings/media/soc/samsung-fimc.txt +2 -0
+node pairs. The implementation of this binding requires clock-frequency
+property to be present in the sensor device nodes.
#23 lore raw

PATCH v4 6/10 s5p-fimc: Use pinctrl API for camera ports configuration

In reply to Sylwester Nawrocki

Before the camera ports can be used the pinmux needs to be configured properly. This patch adds a function to set the camera ports pinctrl to a default state within the media driver's probe().
The camera port(s) are then configured for the video bus operation.

Changes since v3:
- removed the "inactive" pinctrl state, it will be added later if required

---
 .../devicetree/bindings/media/soc/samsung-fimc.txt |    7 +++++++
 drivers/media/platform/s5p-fimc/fimc-mdevice.c     |    9 +++++++++
 2 files changed, 16 insertions(+)
Documentation/devicetree/bindings/media/soc/samsung-fimc.txt +7 -0
index 6b81ad1..3788305 100644
@@ -18,6 +18,10 @@ Required properties:
 
 - compatible	   : must be "samsung,fimc", "simple-bus"
 
+- pinctrl-names    : pinctrl names for camera port pinmux control, at least
+		     "default" needs to be specified.
+- pinctrl-0...N	   : pinctrl properties corresponding to pinctrl-names
+
 The 'camera' node must include at least one 'fimc' child node.
 
 
@@ -133,6 +137,9 @@ Example:
 		#size-cells = <1>;
 		status = "okay";
 
+		pinctrl-names = "default";
+		pinctrl-0 = <&cam_port_a_clk_active>;
+
 		/* parallel camera ports */
 		parallel-ports {
 			/* camera A input */
drivers/media/platform/s5p-fimc/fimc-mdevice.c +9 -0
index 2bb501f..6c2c9e3 100644
@@ -21,6 +21,7 @@
 #include <linux/of_platform.h>
 #include <linux/of_device.h>
 #include <linux/of_i2c.h>
+#include <linux/pinctrl/consumer.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
 #include <linux/types.h>
@@ -1197,6 +1198,14 @@ static int fimc_md_probe(struct platform_device *pdev)
 	/* Protect the media graph while we're registering entities */
 	mutex_lock(&fmd->media_dev.graph_mutex);
 
+	if (dev->of_node) {
+		struct pinctrl *pctl = devm_pinctrl_get_select_default(dev);
+		if (IS_ERR(pctl)) {
+			ret = PTR_ERR(pctl);
+			goto err_unlock;
+		}
+	}
+
 	if (fmd->pdev->dev.of_node)
 		ret = fimc_md_register_of_platform_entities(fmd, dev->of_node);
 	else
Signature · 1 line
1.7.9.5
#24 lore raw

PATCH v4 6/10 s5p-fimc: Use pinctrl API for camera ports configuration

Documentation/devicetree/bindings/media/soc/samsung-fimc.txt Required properties: · line 24

Quoted 11 lines · Sylwester Nawrocki

Before the camera ports can be used the pinmux needs to be configured properly. This patch adds a function to set the camera ports pinctrl to a default state within the media driver's probe().
The camera port(s) are then configured for the video bus operation.

Documentation/devicetree/bindings/media/soc/samsung-fimc.txt +4 -0
 
+- pinctrl-names    : pinctrl names for camera port pinmux control, at least
+		     "default" needs to be specified.
+- pinctrl-0...N	   : pinctrl properties corresponding to pinctrl-names
+

A reference to the binding document describing the pin control bindings would be appropriate here. Given that reference, I'm not sure if spelling out the property names makes sense since it feels a little like duplication; an alternative might be simply:

The pinctrl bindings defined in ../../../pinctrl/pinctrl-bindings.txt must be used to define a pinctrl state named "default".

However, this isn't a big deal; it's fine either way.

#25 lore raw

PATCH v4 6/10 s5p-fimc: Use pinctrl API for camera ports configuration

Quoted 18 lines · Stephen Warren

Documentation/devicetree/bindings/media/soc/samsung-fimc.txt Required properties: · line 24

Quoted 11 lines · Sylwester Nawrocki

Before the camera ports can be used the pinmux needs to be configured properly. This patch adds a function to set the camera ports pinctrl to a default state within the media driver's probe().
The camera port(s) are then configured for the video bus operation.

Documentation/devicetree/bindings/media/soc/samsung-fimc.txt +4 -0
 
+- pinctrl-names    : pinctrl names for camera port pinmux control, at least
+		     "default" needs to be specified.
+- pinctrl-0...N	   : pinctrl properties corresponding to pinctrl-names
+

A reference to the binding document describing the pin control bindings would be appropriate here. Given that reference, I'm not sure if spelling out the property names makes sense since it feels a little like duplication; an alternative might be simply:

Quoted 2 lines

The pinctrl bindings defined in ../../../pinctrl/pinctrl-bindings.txt must be used to define a pinctrl state named "default".

OK, I will add a reference to the pinctrl bindings instead.

Quoted 1 line

However, this isn't a big deal; it's fine either way.

--

Thanks.
Sylwester

#26 lore raw

PATCH v4 7/10 ARM: dts: Add camera to node exynos4.dtsi

In reply to Sylwester Nawrocki

This patch adds common FIMC device nodes for all Exynos4 SoCs.

---
 arch/arm/boot/dts/exynos4.dtsi |   64 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)
arch/arm/boot/dts/exynos4.dtsi +64 -0
index e1347fc..75c388b 100644
@@ -36,6 +36,12 @@
 		i2c5 = &i2c_5;
 		i2c6 = &i2c_6;
 		i2c7 = &i2c_7;
+		csis0 = &csis_0;
+		csis1 = &csis_1;
+		fimc0 = &fimc_0;
+		fimc1 = &fimc_1;
+		fimc2 = &fimc_2;
+		fimc3 = &fimc_3;
 	};
 
 	pd_mfc: mfc-power-domain at 10023C40 {
@@ -82,6 +88,64 @@
 		reg = <0x10440000 0x1000>;
 	};
 
+	camera {
+		compatible = "samsung,fimc", "simple-bus";
+		status = "disabled";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges;
+
+		fimc_0: fimc at 11800000 {
+			compatible = "samsung,exynos4210-fimc";
+			reg = <0x11800000 0x1000>;
+			interrupts = <0 84 0>;
+			samsung,power-domain = <&pd_cam>;
+			status = "disabled";
+		};
+
+		fimc_1: fimc at 11810000 {
+			compatible = "samsung,exynos4210-fimc";
+			reg = <0x11810000 0x1000>;
+			interrupts = <0 85 0>;
+			samsung,power-domain = <&pd_cam>;
+			status = "disabled";
+		};
+
+		fimc_2: fimc at 11820000 {
+			compatible = "samsung,exynos4210-fimc";
+			reg = <0x11820000 0x1000>;
+			interrupts = <0 86 0>;
+			samsung,power-domain = <&pd_cam>;
+			status = "disabled";
+		};
+
+		fimc_3: fimc at 11830000 {
+			compatible = "samsung,exynos4210-fimc";
+			reg = <0x11830000 0x1000>;
+			interrupts = <0 87 0>;
+			samsung,power-domain = <&pd_cam>;
+			status = "disabled";
+		};
+
+		csis_0: csis at 11880000 {
+			compatible = "samsung,exynos4210-csis";
+			reg = <0x11880000 0x4000>;
+			interrupts = <0 78 0>;
+			bus-width = <4>;
+			samsung,power-domain = <&pd_cam>;
+			status = "disabled";
+		};
+
+		csis_1: csis at 11890000 {
+			compatible = "samsung,exynos4210-csis";
+			reg = <0x11890000 0x4000>;
+			interrupts = <0 80 0>;
+			bus-width = <2>;
+			samsung,power-domain = <&pd_cam>;
+			status = "disabled";
+		};
+	};
+
 	watchdog at 10060000 {
 		compatible = "samsung,s3c2410-wdt";
 		reg = <0x10060000 0x100>;
Signature · 1 line
1.7.9.5
#27 lore raw

PATCH v4 8/10 ARM: dts: Add ISP power domain node for Exynos4x12

In reply to Sylwester Nawrocki

The ISP power domain is a common power domain for fimc-lite and fimc-is (ISP) devices.

---
 arch/arm/boot/dts/exynos4x12.dtsi |    5 +++++
 1 file changed, 5 insertions(+)
arch/arm/boot/dts/exynos4x12.dtsi +5 -0
index 179a62e..9c809b72 100644
@@ -28,6 +28,11 @@
 		pinctrl3 = &pinctrl_3;
 	};
 
+	pd_isp: isp-power-domain at 10023CA0 {
+		compatible = "samsung,exynos4210-pd";
+		reg = <0x10023CA0 0x20>;
+	};
+
 	combiner:interrupt-controller at 10440000 {
 		interrupts = <0 0 0>, <0 1 0>, <0 2 0>, <0 3 0>,
 			     <0 4 0>, <0 5 0>, <0 6 0>, <0 7 0>,
Signature · 1 line
1.7.9.5
#28 lore raw

PATCH v4 9/10 ARM: dts: Add FIMC and MIPI CSIS device nodes for Exynos4x12

In reply to Sylwester Nawrocki

Add common camera node and fimc nodes specific to Exynos4212 and Exynos4412 SoCs. fimc-is is a node for the Exynos4x12 FIMC-IS subsystem and fimc-lite nodes are created as its child nodes, among others due to FIMC-LITE device dependencies on FIMC-IS related clocks.

---
 arch/arm/boot/dts/exynos4x12.dtsi |   47 +++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)
arch/arm/boot/dts/exynos4x12.dtsi +47 -0
index 9c809b72..59b2b8e 100644
@@ -26,6 +26,8 @@
 		pinctrl1 = &pinctrl_1;
 		pinctrl2 = &pinctrl_2;
 		pinctrl3 = &pinctrl_3;
+		fimc-lite0 = &fimc_lite_0;
+		fimc-lite1 = &fimc_lite_1;
 	};
 
 	pd_isp: isp-power-domain at 10023CA0 {
@@ -71,4 +73,49 @@
 		reg = <0x106E0000 0x1000>;
 		interrupts = <0 72 0>;
 	};
+
+	camera {
+		fimc_0: fimc at 11800000 {
+			compatible = "samsung,exynos4212-fimc";
+		};
+
+		fimc_1: fimc at 11810000 {
+			compatible = "samsung,exynos4212-fimc";
+		};
+
+		fimc_2: fimc at 11820000 {
+			compatible = "samsung,exynos4212-fimc";
+		};
+
+		fimc_3: fimc at 11830000 {
+			compatible = "samsung,exynos4212-fimc";
+		};
+
+		fimc_is: fimc-is at 12000000 {
+			compatible = "samsung,exynos4212-fimc-is", "simple-bus";
+			reg = <0x12000000 0x260000>;
+			interrupts = <0 90 0>, <0 95 0>;
+			samsung,power-domain = <&pd_isp>;
+			status = "disabled";
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges;
+
+			fimc_lite_0: fimc-lite at 12390000 {
+				compatible = "samsung,exynos4212-fimc-lite";
+				reg = <0x12390000 0x1000>;
+				interrupts = <0 105 0>;
+				samsung,power-domain = <&pd_isp>;
+				status = "disabled";
+			};
+
+			fimc_lite_1: fimc-lite at 123A0000 {
+				compatible = "samsung,exynos4212-fimc-lite";
+				reg = <0x123A0000 0x1000>;
+				interrupts = <0 106 0>;
+				samsung,power-domain = <&pd_isp>;
+				status = "disabled";
+			};
+		};
+	};
 };
Signature · 1 line
1.7.9.5
#29 lore raw

PATCH v4 10/10 ARM: dts: Correct camera pinctrl nodes for Exynos4x12 SoCs

In reply to Sylwester Nawrocki

Add separate nodes for the CAMCLK pin and turn off pull-up on camera ports A, B. The video bus pins and the clock output (CAMCLK) pin need separate nodes since full camera port is not used in some configurations, e.g. for MIPI CSI-2 bus on CAMCLK is required and data/clock signal use separate dedicated pins.

Changes since v3:
- corrected camera port B part and removed entries for "inactive" state

---
 arch/arm/boot/dts/exynos4x12-pinctrl.dtsi |   26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)
arch/arm/boot/dts/exynos4x12-pinctrl.dtsi +19 -7
index 8e6115a..4c3a2c3 100644
@@ -401,15 +401,21 @@
 			samsung,pin-drv = <0>;
 		};
 
-		cam_port_a: cam-port-a {
+		cam_port_a_io: cam-port-a-io {
 			samsung,pins = "gpj0-0", "gpj0-1", "gpj0-2", "gpj0-3",
 					"gpj0-4", "gpj0-5", "gpj0-6", "gpj0-7",
-					"gpj1-0", "gpj1-1", "gpj1-2", "gpj1-3",
-					"gpj1-4";
+					"gpj1-0", "gpj1-1", "gpj1-2", "gpj1-4";
 			samsung,pin-function = <2>;
-			samsung,pin-pud = <3>;
+			samsung,pin-pud = <0>;
 			samsung,pin-drv = <0>;
 		};
+
+		cam_port_a_clk_active: cam-port-a-clk-active {
+			samsung,pins = "gpj1-3";
+			samsung,pin-function = <2>;
+			samsung,pin-pud = <0>;
+			samsung,pin-drv = <3>;
+		};
 	};
 
 	pinctrl at 11000000 {
@@ -834,16 +840,22 @@
 			samsung,pin-drv = <0>;
 		};
 
-		cam_port_b: cam-port-b {
+		cam_port_b_io: cam-port-b-io {
 			samsung,pins = "gpm0-0", "gpm0-1", "gpm0-2", "gpm0-3",
 					"gpm0-4", "gpm0-5", "gpm0-6", "gpm0-7",
-					"gpm1-0", "gpm1-1", "gpm2-0", "gpm2-1",
-					"gpm2-2";
+					"gpm1-0", "gpm1-1", "gpm2-0", "gpm2-1";
 			samsung,pin-function = <3>;
 			samsung,pin-pud = <3>;
 			samsung,pin-drv = <0>;
 		};
 
+		cam_port_b_clk_active: cam-port-b-clk-active {
+			samsung,pins = "gpm2-2";
+			samsung,pin-function = <3>;
+			samsung,pin-pud = <0>;
+			samsung,pin-drv = <3>;
+		};
+
 		eint0: ext-int0 {
 			samsung,pins = "gpx0-0";
 			samsung,pin-function = <0xf>;
Signature · 1 line
1.7.9.5