Skip to contentSkip to conversation

Add device tree support for s5p-fimc SoC camera host interface driver

PATCH In review Sylwester Nawrocki 7 participants 59 messages May 25, 2012 – Aug 19, 2012 2 messages not in the archive

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover Add device tree support for s5p-fimc SoC camera host interface driver

Hi All,

This patch series adds device tree support for Samsung S5P/Exynos SoC camera devices - camera host interface (FIMC), MIPI-CSI2 receiver (a frontend to FIMC) and S5K6AA image sensor.

It also defines common "data-lanes" property for MIPI-CSI2 receivers and transmitters, as well as "video-bus-type" for image sensors, video encoders etc. and camera host interface drivers.

For an overview of the topology of devices in an SoC I have attached sample graph generated from output at /dev/media? Media Controller devnode. It's not generated from latest kernel, however it depicts well how the image sensor (S5K6AA), MIPI-CSIS and FIMC devices are connected.

In coming few weeks I'm going to be offline and Bartlomiej will continue with this RFC during that time.

The patches will be available in few hours at:
http://git.infradead.org/users/kmpark/linux-samsung/shortlog/refs/heads/camera-of

Base tree for this series is available at git repository:
git://git.infradead.org/users/kmpark/linux-samsung camera-of

Comments are welcome.

Regards,
Sylwester

#1 lore raw

PATCH 1/13 ARM: Samsung: Extend MIPI PHY callback with an index argument

For systems instantiated from device tree struct platform_device id field is always -1, add an 'id' argument to the s5p_csis_phy_enable() function so the MIPI-CSIS hardware instance index can be passed in by driver, for CONFIG_OF=y.

---
 arch/arm/plat-s5p/setup-mipiphy.c              |   20 ++++++++------------
 arch/arm/plat-samsung/include/plat/mipi_csis.h |   10 ++++++----
 2 files changed, 14 insertions(+), 16 deletions(-)
arch/arm/plat-s5p/setup-mipiphy.c +8 -12
index 683c466..146ecc3 100644
@@ -14,24 +14,19 @@
 #include <linux/spinlock.h>
 #include <mach/regs-clock.h>
 
-static int __s5p_mipi_phy_control(struct platform_device *pdev,
+static int __s5p_mipi_phy_control(struct platform_device *pdev, int id,
 				  bool on, u32 reset)
 {
 	static DEFINE_SPINLOCK(lock);
 	void __iomem *addr;
 	unsigned long flags;
-	int pid;
 	u32 cfg;
 
-	if (!pdev)
+	id = max(0, id);
+	if (id > 1)
 		return -EINVAL;
 
-	pid = (pdev->id == -1) ? 0 : pdev->id;
-
-	if (pid != 0 && pid != 1)
-		return -EINVAL;
-
-	addr = S5P_MIPI_DPHY_CONTROL(pid);
+	addr = S5P_MIPI_DPHY_CONTROL(id);
 
 	spin_lock_irqsave(&lock, flags);
 
@@ -52,12 +47,13 @@ static int __s5p_mipi_phy_control(struct platform_device *pdev,
 	return 0;
 }
 
-int s5p_csis_phy_enable(struct platform_device *pdev, bool on)
+int s5p_csis_phy_enable(struct platform_device *pdev, int id, bool on)
 {
-	return __s5p_mipi_phy_control(pdev, on, S5P_MIPI_DPHY_SRESETN);
+	return __s5p_mipi_phy_control(pdev, on, id, S5P_MIPI_DPHY_SRESETN);
 }
 
 int s5p_dsim_phy_enable(struct platform_device *pdev, bool on)
 {
-	return __s5p_mipi_phy_control(pdev, on, S5P_MIPI_DPHY_MRESETN);
+	return __s5p_mipi_phy_control(pdev, pdev->id, on,
+				      S5P_MIPI_DPHY_MRESETN);
 }
arch/arm/plat-samsung/include/plat/mipi_csis.h +6 -4
index c45b1e8..609cf1e 100644
@@ -34,10 +34,12 @@ struct s5p_platform_mipi_csis {
 
 /**
  * s5p_csis_phy_enable - global MIPI-CSI receiver D-PHY control
- * @pdev: MIPI-CSIS platform device
- * @on: true to enable D-PHY and deassert its reset
- *	false to disable D-PHY
+ * @pdev:   MIPI-CSIS platform device
+ * @id:     MIPI-CSIS harware instance index (0...1)
+ * @on:     true to enable D-PHY and deassert its reset
+ *          false to disable D-PHY
+ * @return: 0 on success, or negative error code on failure
  */
-int s5p_csis_phy_enable(struct platform_device *pdev, bool on);
+int s5p_csis_phy_enable(struct platform_device *pdev, int id, bool on);
 
 #endif /* __PLAT_SAMSUNG_MIPI_CSIS_H_ */
Signature · 1 line
1.7.10
#2 lore raw

PATCH 2/13 media: s5p-csis: Add device tree support

s5p-csis is platform device driver for MIPI-CSI frontend to the FIMC (camera host interface DMA engine and image processor). This patch adds support for instantiating the MIPI-CSIS devices from DT and parsing all SoC and board specific properties from device tree. The MIPI DPHY control callback is now called directly from within the driver, the platform code must ensure this callback does the right thing for each SoC.

The cell-index property is used to ensure proper signal routing, from physical camera port, through MIPI-CSI2 receiver to the DMA engine (FIMC?). It's also helpful in exposing the device topology in user space at /dev/media? devnode (Media Controller API).

This patch also defines a common property ("data-lanes") for MIPI-CSI receivers and transmitters.

---
 Documentation/devicetree/bindings/video/mipi.txt   |    5 +
 .../bindings/video/samsung-mipi-csis.txt           |   47 ++++++++++
 drivers/media/video/s5p-fimc/mipi-csis.c           |   97 +++++++++++++++-----
 drivers/media/video/s5p-fimc/mipi-csis.h           |    1 +
 4 files changed, 126 insertions(+), 24 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/video/mipi.txt
 create mode 100644 Documentation/devicetree/bindings/video/samsung-mipi-csis.txt
Documentation/devicetree/bindings/video/mipi.txt new file +5 -0
new file mode 100644
index 0000000..5aed285
@@ -0,0 +1,5 @@
+Common properties of MIPI-CSI1 and MIPI-CSI2 receivers and transmitters
+
+ - data-lanes : number of differential data lanes wired and actively used in
+		communication between the transmitter and the receiver, this
+		excludes the clock lane;
Documentation/devicetree/bindings/video/samsung-mipi-csis.txt new file +47 -0

47 lines not on this page · raw message

drivers/media/video/s5p-fimc/mipi-csis.c +73 -24

208 lines not on this page · raw message

drivers/media/video/s5p-fimc/mipi-csis.h +1 -0
index 2709286..8f71e84 100644
@@ -11,6 +11,7 @@
 #define S5P_MIPI_CSIS_H_
 
 #define CSIS_DRIVER_NAME	"s5p-mipi-csis"
+#define CSIS_SUBDEV_NAME	"MIPI-CSIS"
 #define CSIS_MAX_ENTITIES	2
 #define CSIS0_MAX_LANES		4
 #define CSIS1_MAX_LANES		2
Signature · 1 line
1.7.10
#3 lore raw

Re: [RFC/PATCH 02/13] media: s5p-csis: Add device tree support

Hi Sylwester

Thanks for your comments to my RFC and for pointing out to this your earlier patch series. Unfortunately, I missed in in May, let me try to provide some thoughts about this, we should really try to converge our proposals. Maybe a discussion at KS would help too.

Quoted 33 lines · Sylwester Nawrocki

s5p-csis is platform device driver for MIPI-CSI frontend to the FIMC (camera host interface DMA engine and image processor). This patch adds support for instantiating the MIPI-CSIS devices from DT and parsing all SoC and board specific properties from device tree. The MIPI DPHY control callback is now called directly from within the driver, the platform code must ensure this callback does the right thing for each SoC.

The cell-index property is used to ensure proper signal routing, from physical camera port, through MIPI-CSI2 receiver to the DMA engine (FIMC?). It's also helpful in exposing the device topology in user space at /dev/media? devnode (Media Controller API).

This patch also defines a common property ("data-lanes") for MIPI-CSI receivers and transmitters.

---
 Documentation/devicetree/bindings/video/mipi.txt   |    5 +
 .../bindings/video/samsung-mipi-csis.txt           |   47 ++++++++++
 drivers/media/video/s5p-fimc/mipi-csis.c           |   97 +++++++++++++++-----
 drivers/media/video/s5p-fimc/mipi-csis.h           |    1 +
 4 files changed, 126 insertions(+), 24 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/video/mipi.txt
 create mode 100644 Documentation/devicetree/bindings/video/samsung-mipi-csis.txt
Documentation/devicetree/bindings/video/mipi.txt new file +0 -0
new file mode 100644
index 0000000..5aed285

Documentation/devicetree/bindings/video/mipi.txt line 5

Quoted 5 lines
Documentation/devicetree/bindings/video/mipi.txt new file +5 -0
@@ -0,0 +1,5 @@
+Common properties of MIPI-CSI1 and MIPI-CSI2 receivers and transmitters
+
+ - data-lanes : number of differential data lanes wired and actively used in
+		communication between the transmitter and the receiver, this
+		excludes the clock lane;

Wouldn't it be better to use the standard "bus-width" DT property?

Quoted 10 lines
Documentation/devicetree/bindings/video/samsung-mipi-csis.txt new file +4 -0
new file mode 100644
index 0000000..7bce6f4
@@ -0,0 +1,47 @@
+Samsung S5P/EXYNOS SoC MIPI-CSI2 receiver (MIPI CSIS)
+-----------------------------------------------------
+
+Required properties:

Documentation/devicetree/bindings/video/samsung-mipi-csis.txt line 14

Quoted 10 lines
Documentation/devicetree/bindings/video/samsung-mipi-csis.txt new file +10 -0
+
+- compatible - one of :
+		"samsung,s5pv210-csis",
+		"samsung,exynos4210-csis",
+		"samsung,exynos4212-csis",
+		"samsung,exynos4412-csis";
+- 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;
+- cell-index      : the hardware instance index;

Not sure whether this is absolutely needed... Wouldn't it be sufficient to just enumerate them during probing?

Documentation/devicetree/bindings/video/samsung-mipi-csis.txt line 17

Quoted 3 lines
Documentation/devicetree/bindings/video/samsung-mipi-csis.txt new file +3 -0
+- clock-frequency : The IP's main (system bus) clock frequency in Hz, the default
+		    value when this property is not specified is 166 MHz;
+- data-lanes      : number of physical MIPI-CSI2 lanes used;

ditto - bus-width?

Quoted 20 lines
Documentation/devicetree/bindings/video/samsung-mipi-csis.txt new file +20 -0
+- samsung,csis-hs-settle : differential receiver (HS-RX) settle time;
+- 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).
+
+Example:
+
+	reg0: regulator@0 {
+	};
+
+	reg1: regulator@1 {
+	};
+
+/* SoC properties */
+
+	csis@11880000 {
+		compatible = "samsung,exynos4210-csis";
+		reg = <0x11880000 0x1000>;
+		interrupts = <0 78 0>;
+		cell-index = <0>;
+	};

Documentation/devicetree/bindings/video/samsung-mipi-csis.txt line 47

Quoted 10 lines
Documentation/devicetree/bindings/video/samsung-mipi-csis.txt new file +10 -0
+
+/* Board properties */
+
+	csis@11880000 {
+		clock-frequency = <166000000>;
+		data-lanes = <2>;
+		samsung,csis-hs-settle = <12>;
+		vddio-supply = <&reg0>;
+		vddcore-supply = <&reg1>;
+	};

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#4 lore raw

Re: [RFC/PATCH 02/13] media: s5p-csis: Add device tree support

Hi Guennadi,

Quoted 6 lines · Guennadi Liakhovetski

Hi Sylwester

Thanks for your comments to my RFC and for pointing out to this your earlier patch series. Unfortunately, I missed in in May, let me try to provide some thoughts about this, we should really try to converge our proposals. Maybe a discussion at KS would help too.

Thank you for the review. I was happy to see your RFC, as previously there seemed to be not much interest in DT among the media guys. Certainly, we need to work on a common approach to ensure interoperability of existing drivers and to avoid having people inventing different bindings for common features. I would also expect some share of device specific bindings, as diversity of media devices is significant.

I'd be great to discuss these things at KS, especially support for proper suspend/resume sequences. Also having common sessions with other subsystems folks, like ASoC, for example, might be a good idea.

I'm not sure if I'll be travelling to the KS though. :)

Quoted 29 lines · Sylwester Nawrocki
Quoted 28 lines

s5p-csis is platform device driver for MIPI-CSI frontend to the FIMC (camera host interface DMA engine and image processor). This patch adds support for instantiating the MIPI-CSIS devices from DT and parsing all SoC and board specific properties from device tree. The MIPI DPHY control callback is now called directly from within the driver, the platform code must ensure this callback does the right thing for each SoC.

The cell-index property is used to ensure proper signal routing, from physical camera port, through MIPI-CSI2 receiver to the DMA engine (FIMC?). It's also helpful in exposing the device topology in user space at /dev/media? devnode (Media Controller API).

This patch also defines a common property ("data-lanes") for MIPI-CSI receivers and transmitters.

---
  Documentation/devicetree/bindings/video/mipi.txt   |    5 +
  .../bindings/video/samsung-mipi-csis.txt           |   47 ++++++++++
  drivers/media/video/s5p-fimc/mipi-csis.c           |   97 +++++++++++++++-----
  drivers/media/video/s5p-fimc/mipi-csis.h           |    1 +
  4 files changed, 126 insertions(+), 24 deletions(-)

create mode 100644 Documentation/devicetree/bindings/video/mipi.txt create mode 100644 Documentation/devicetree/bindings/video/samsung-mipi-csis.txt

Quoted 13 lines

Documentation/devicetree/bindings/video/mipi.txt line 5

Quoted 11 lines
Documentation/devicetree/bindings/video/mipi.txt new file +5 -0
new file mode 100644
index 0000000..5aed285
@@ -0,0 +1,5 @@
+Common properties of MIPI-CSI1 and MIPI-CSI2 receivers and transmitters
+
+ - data-lanes : number of differential data lanes wired and actively used in
+		communication between the transmitter and the receiver, this
+		excludes the clock lane;

Wouldn't it be better to use the standard "bus-width" DT property?

I can't see any problems with using "bus-width". It seems sufficient and could indeed be better, without a need to invent new MIPI-CSI specific names. That was my first RFC on that and my perspective wasn't probably broad enough. :)

Quoted 15 lines
Quoted 15 lines
Documentation/devicetree/bindings/video/samsung-mipi-csis.txt new file +9 -0
new file mode 100644
index 0000000..7bce6f4
@@ -0,0 +1,47 @@
+Samsung S5P/EXYNOS SoC MIPI-CSI2 receiver (MIPI CSIS)
+-----------------------------------------------------
+
+Required properties:
+
+- compatible - one of :
+		"samsung,s5pv210-csis",
+		"samsung,exynos4210-csis",
+		"samsung,exynos4212-csis",
Quoted 8 lines

Documentation/devicetree/bindings/video/samsung-mipi-csis.txt line 14

Quoted 5 lines
Documentation/devicetree/bindings/video/samsung-mipi-csis.txt new file +5 -0
+		"samsung,exynos4412-csis";
+- 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;
+- cell-index      : the hardware instance index;

Not sure whether this is absolutely needed... Wouldn't it be sufficient to just enumerate them during probing?

As Grant pointed to me, the "cell-index" property is something that we should be avoiding. But I needed something like this in the driver,
to differentiate between the multiple IP instances. I cannot simply assign the indexes in random way to the hardware instances. Each of the MIPI-CSI Slaves has different properties (e.g. supporting max. 2 or 4 data lanes). Additionally, a particular MIPI-CSI Slave instance is hard-wired inside the SoC to the FIMC input mux (cross-bar) and physical video port. IOW, an image sensor/video port/MIPI-CSIS instance assignment is fixed. If two MIPI-CSI image sensors are connected, one of them will work only with MIPI-CSIS0, and the other only with MIPI-CSIS1.

So the driver must be able to identify it's physical device (IO region + IRQ) precisely.

That said, I found out recently that a proper entries in the "aliases" could be used instead, and I could finally abandon the "cell-index" idea. Not sure how aliases approach is better but from what I can see it is a preferred way to handle things like the above.

Please see Documentation/devicetree/bindings/sound/mxs-saif.txt and users of of_alias_get_id() for more details.

So to summarize, the indexes are needed, but the current implementation is not necessarily good, and AFAICT the aliases approach could be the way to go.

Quoted 5 lines

Documentation/devicetree/bindings/video/samsung-mipi-csis.txt line 17

Quoted 3 lines
Documentation/devicetree/bindings/video/samsung-mipi-csis.txt new file +3 -0
+- clock-frequency : The IP's main (system bus) clock frequency in Hz, the default
+		    value when this property is not specified is 166 MHz;
+- data-lanes      : number of physical MIPI-CSI2 lanes used;

ditto - bus-width?

Yes, agreed. Let's drop it in favour of "bus-width".

--

Regards,
Sylwester

#5 lore raw

Re: [RFC/PATCH 02/13] media: s5p-csis: Add device tree support

Hi Sylwester,

Quoted 66 lines · On Tuesday 17 July 2012 20:16:23 Sylwester Nawrocki wrote:
Quoted 6 lines · Guennadi Liakhovetski

Hi Sylwester

Thanks for your comments to my RFC and for pointing out to this your earlier patch series. Unfortunately, I missed in in May, let me try to provide some thoughts about this, we should really try to converge our proposals. Maybe a discussion at KS would help too.

Thank you for the review. I was happy to see your RFC, as previously there seemed to be not much interest in DT among the media guys. Certainly, we need to work on a common approach to ensure interoperability of existing drivers and to avoid having people inventing different bindings for common features. I would also expect some share of device specific bindings, as diversity of media devices is significant.

I'd be great to discuss these things at KS, especially support for proper suspend/resume sequences. Also having common sessions with other subsystems folks, like ASoC, for example, might be a good idea.

I'm not sure if I'll be travelling to the KS though. :)

Quoted 36 lines · Sylwester Nawrocki
Quoted 35 lines

s5p-csis is platform device driver for MIPI-CSI frontend to the FIMC (camera host interface DMA engine and image processor). This patch adds support for instantiating the MIPI-CSIS devices from DT and parsing all SoC and board specific properties from device tree. The MIPI DPHY control callback is now called directly from within the driver, the platform code must ensure this callback does the right thing for each SoC.

The cell-index property is used to ensure proper signal routing, from physical camera port, through MIPI-CSI2 receiver to the DMA engine (FIMC?). It's also helpful in exposing the device topology in user space at /dev/media? devnode (Media Controller API).

This patch also defines a common property ("data-lanes") for MIPI-CSI receivers and transmitters.

---

  Documentation/devicetree/bindings/video/mipi.txt   |    5 +
  .../bindings/video/samsung-mipi-csis.txt           |   47 ++++++++++
  drivers/media/video/s5p-fimc/mipi-csis.c           |   97
  +++++++++++++++----- drivers/media/video/s5p-fimc/mipi-csis.h         
   |    1 +
  4 files changed, 126 insertions(+), 24 deletions(-)

create mode 100644 Documentation/devicetree/bindings/video/mipi.txt create mode 100644 Documentation/devicetree/bindings/video/samsung-mipi-csis.txt>>

(quoted diff) +0 -0

b/Documentation/devicetree/bindings/video/mipi.txt new file mode 100644 index 0000000..5aed285

Documentation/devicetree/bindings/video/mipi.txt new file +0 -0
@@ -0,0 +1,5 @@
Quoted 8 lines

Documentation/devicetree/bindings/video/mipi.txt line 5

Quoted 6 lines
Documentation/devicetree/bindings/video/mipi.txt new file +3 -0
+Common properties of MIPI-CSI1 and MIPI-CSI2 receivers and transmitters
+
+ - data-lanes : number of differential data lanes wired and actively

used in

Documentation/devicetree/bindings/video/mipi.txt new file +2 -0
+		communication between the transmitter and the receiver, this
+		excludes the clock lane;

Wouldn't it be better to use the standard "bus-width" DT property?

Quoted 4 lines

I can't see any problems with using "bus-width". It seems sufficient and could indeed be better, without a need to invent new MIPI-CSI specific names. That was my first RFC on that and my perspective wasn't probably broad enough. :)

What about CSI receivers that can reroute the lanes internally ? We would need to specify lane indices for each lane then, maybe with something like

clock-lane = <0>;
data-lanes = <2 3 1>;

For receivers that can't reroute lanes internally, the data-lanes property would be need to specify lanes in sequence.

data-lanes = <1 2 3>;

Signature · 3 lines
Regards,

Laurent Pinchart
#6 lore raw

Re: [RFC/PATCH 02/13] media: s5p-csis: Add device tree support

Hi Laurent,

Quoted 17 lines · Laurent Pinchart
Quoted 12 lines
Quoted 11 lines

Documentation/devicetree/bindings/video/mipi.txt line 5

Quoted 9 lines
Documentation/devicetree/bindings/video/mipi.txt new file +3 -0
@@ -0,0 +1,5 @@
+Common properties of MIPI-CSI1 and MIPI-CSI2 receivers and transmitters
+
+ - data-lanes : number of differential data lanes wired and actively

used in

Documentation/devicetree/bindings/video/mipi.txt new file +2 -0
+		communication between the transmitter and the receiver, this
+		excludes the clock lane;

Wouldn't it be better to use the standard "bus-width" DT property?

Quoted 4 lines

I can't see any problems with using "bus-width". It seems sufficient and could indeed be better, without a need to invent new MIPI-CSI specific names. That was my first RFC on that and my perspective wasn't probably broad enough. :)

Quoted 5 lines

What about CSI receivers that can reroute the lanes internally ? We would need to specify lane indices for each lane then, maybe with something like

clock-lane =<0>;
data-lanes =<2 3 1>;

Sounds good to me. And the clock-lane could be made optional, as not all devices would need it.

However, as far as I can see, there is currently no generic API for handling this kind of data structure. E.g. number of cells for the "interrupts" property is specified with an additional "#interrupt-cells" property.

It would have been much easier to handle something like:

data-lanes = <2>, <3>, <1>;

i.e. an array of the lane indexes.

Quoted 4 lines

For receivers that can't reroute lanes internally, the data-lanes property would be need to specify lanes in sequence.

data-lanes =<1 2 3>;

In this case we would be only interested in the number of cells in this property, but how it could be retrieved ? With an array, it could have been calculated from property length returned by of_property_find() (divided by sizof(u32)).

--

Regards,
Sylwester

#7 lore raw

Re: [RFC/PATCH 02/13] media: s5p-csis: Add device tree support

Hi Sylwester,

Quoted 33 lines · On Thursday 26 July 2012 21:51:30 Sylwester Nawrocki wrote:
Quoted 18 lines · Laurent Pinchart
Quoted 13 lines
Quoted 4 lines
Quoted 4 lines
Documentation/devicetree/bindings/video/mipi.txt new file +1 -0
@@ -0,0 +1,5 @@
+Common properties of MIPI-CSI1 and MIPI-CSI2 receivers and
Quoted 8 lines

Documentation/devicetree/bindings/video/mipi.txt line 5

Quoted 6 lines

transmitters
+
+ - data-lanes : number of differential data lanes wired and actively used in

Documentation/devicetree/bindings/video/mipi.txt new file +2 -0
+		communication between the transmitter and the receiver, this
+		excludes the clock lane;

Wouldn't it be better to use the standard "bus-width" DT property?

Quoted 4 lines

I can't see any problems with using "bus-width". It seems sufficient and could indeed be better, without a need to invent new MIPI-CSI specific names. That was my first RFC on that and my perspective wasn't probably broad enough. :)

Quoted 6 lines

What about CSI receivers that can reroute the lanes internally ? We would need to specify lane indices for each lane then, maybe with something like

clock-lane =<0>;
data-lanes =<2 3 1>;

Sounds good to me. And the clock-lane could be made optional, as not all devices would need it.

However, as far as I can see, there is currently no generic API for handling this kind of data structure. E.g. number of cells for the "interrupts" property is specified with an additional "#interrupt-cells" property.

Quoted 5 lines

It would have been much easier to handle something like:

data-lanes = <2>, <3>, <1>;

i.e. an array of the lane indexes.

I'm fine with that.

Quoted 9 lines
Quoted 4 lines

For receivers that can't reroute lanes internally, the data-lanes property would be need to specify lanes in sequence.

data-lanes =<1 2 3>;

In this case we would be only interested in the number of cells in this property, but how it could be retrieved ? With an array, it could have been calculated from property length returned by of_property_find() (divided by sizof(u32)).

Agreed.

Signature · 3 lines
Regards,

Laurent Pinchart
#8 lore raw

Re: [RFC/PATCH 02/13] media: s5p-csis: Add device tree support

Quoted 36 lines · Laurent Pinchart

Hi Sylwester,

Quoted 33 lines · On Thursday 26 July 2012 21:51:30 Sylwester Nawrocki wrote:
Quoted 18 lines · Laurent Pinchart
Quoted 13 lines
Quoted 4 lines
Quoted 4 lines
Documentation/devicetree/bindings/video/mipi.txt new file +1 -0
@@ -0,0 +1,5 @@
+Common properties of MIPI-CSI1 and MIPI-CSI2 receivers and
Quoted 8 lines

Documentation/devicetree/bindings/video/mipi.txt line 5

Quoted 6 lines

transmitters
+
+ - data-lanes : number of differential data lanes wired and actively used in

Documentation/devicetree/bindings/video/mipi.txt new file +2 -0
+		communication between the transmitter and the receiver, this
+		excludes the clock lane;

Wouldn't it be better to use the standard "bus-width" DT property?

Quoted 4 lines

I can't see any problems with using "bus-width". It seems sufficient and could indeed be better, without a need to invent new MIPI-CSI specific names. That was my first RFC on that and my perspective wasn't probably broad enough. :)

Quoted 6 lines

What about CSI receivers that can reroute the lanes internally ? We would need to specify lane indices for each lane then, maybe with something like

clock-lane =<0>;
data-lanes =<2 3 1>;

Sounds good to me. And the clock-lane could be made optional, as not all devices would need it.

However, as far as I can see, there is currently no generic API for handling this kind of data structure. E.g. number of cells for the "interrupts" property is specified with an additional "#interrupt-cells" property.

Quoted 7 lines
Quoted 5 lines

It would have been much easier to handle something like:

data-lanes = <2>, <3>, <1>;

i.e. an array of the lane indexes.

I'm fine with that.

...on a second thought: shouldn't this be handled by pinctrl? Or is it some CSI-2 module internal lane switching, not the global SoC pin function configuration?

Thanks
Guennadi

Quoted 17 lines
Quoted 9 lines
Quoted 4 lines

For receivers that can't reroute lanes internally, the data-lanes property would be need to specify lanes in sequence.

data-lanes =<1 2 3>;

In this case we would be only interested in the number of cells in this property, but how it could be retrieved ? With an array, it could have been calculated from property length returned by of_property_find() (divided by sizof(u32)).

Agreed.

Signature · 3 lines
Regards,

Laurent Pinchart

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

A message that is not in the archive (sent off-list or not yet received): Pine.LNX.4.64.1207311257020.27888-0199iw4Nj15frtckUFj5Ag@public.gmane.org

#10 lore raw

Re: [RFC/PATCH 02/13] media: s5p-csis: Add device tree support

Hi Guennadi,

Quoted 42 lines · On Tuesday 31 July 2012 12:58:50 Guennadi Liakhovetski wrote:
Quoted 41 lines · Laurent Pinchart
Quoted 40 lines · On Thursday 26 July 2012 21:51:30 Sylwester Nawrocki wrote:
Quoted 19 lines · Laurent Pinchart
Quoted 14 lines
Quoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/video/mipi.txt new file +1 -0
@@ -0,0 +1,5 @@
+Common properties of MIPI-CSI1 and MIPI-CSI2 receivers and

transmitters

Quoted 8 lines

Documentation/devicetree/bindings/video/mipi.txt

Quoted 6 lines

+
+ - data-lanes : number of differential data lanes wired and actively
used in

Documentation/devicetree/bindings/video/mipi.txt new file +2 -0
+		communication between the transmitter and the receiver, this
+		excludes the clock lane;

Wouldn't it be better to use the standard "bus-width" DT property?

Quoted 4 lines

I can't see any problems with using "bus-width". It seems sufficient and could indeed be better, without a need to invent new MIPI-CSI specific names. That was my first RFC on that and my perspective wasn't probably broad enough. :)

Quoted 7 lines

What about CSI receivers that can reroute the lanes internally ? We would
need to specify lane indices for each lane then, maybe with something like

clock-lane =<0>;
data-lanes =<2 3 1>;

Sounds good to me. And the clock-lane could be made optional, as not all devices would need it.

However, as far as I can see, there is currently no generic API for handling this kind of data structure. E.g. number of cells for the "interrupts" property is specified with an additional "#interrupt-cells" property.

It would have been much easier to handle something like:

data-lanes = <2>, <3>, <1>;

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

i.e. an array of the lane indexes.

I'm fine with that.

...on a second thought: shouldn't this be handled by pinctrl? Or is it some CSI-2 module internal lane switching, not the global SoC pin function configuration?

On the hardware I came across, it's handled by the CSI2 receiver, not the SoC pinmux feature.

Signature · 3 lines
Regards,

Laurent Pinchart
#11 lore raw

Re: [RFC/PATCH 02/13] media: s5p-csis: Add device tree support

Quoted 22 lines · Laurent Pinchart
Quoted 22 lines
Quoted 22 lines
Quoted 21 lines
Quoted 7 lines

What about CSI receivers that can reroute the lanes internally ? We would
need to specify lane indices for each lane then, maybe with something like

clock-lane =<0>;
data-lanes =<2 3 1>;

Sounds good to me. And the clock-lane could be made optional, as not all devices would need it.

However, as far as I can see, there is currently no generic API for handling this kind of data structure. E.g. number of cells for the "interrupts" property is specified with an additional "#interrupt-cells" property.

It would have been much easier to handle something like:

data-lanes = <2>, <3>, <1>;

i.e. an array of the lane indexes.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

I'm fine with that.

...on a second thought: shouldn't this be handled by pinctrl? Or is it some CSI-2 module internal lane switching, not the global SoC pin function configuration?

On the hardware I came across, it's handled by the CSI2 receiver, not the SoC pinmux feature.

Same here. Is there any hardware known to mux those MIPI-CSI D-PHY high speed differential signals with general purpose IO pins ?

Or are there mostly dedicated pins used ?

However, if there are cases the lane configuration is done solely at CSI2 receiver level, there seems little point in involving the pinctrl API.

--

Regards,
Sylwester

#12 lore raw

Re: [RFC/PATCH 02/13] media: s5p-csis: Add device tree support

Hi Sylwester,

Quoted 28 lines · On Tuesday 31 July 2012 14:38:35 Sylwester Nawrocki wrote:
Quoted 27 lines · Laurent Pinchart
Quoted 26 lines
Quoted 15 lines
Quoted 15 lines
Quoted 6 lines

What about CSI receivers that can reroute the lanes internally ? We would need to specify lane indices for each lane then, maybe with something like

clock-lane =<0>;
data-lanes =<2 3 1>;

Sounds good to me. And the clock-lane could be made optional, as not all devices would need it.

However, as far as I can see, there is currently no generic API for handling this kind of data structure. E.g. number of cells for the "interrupts" property is specified with an additional "#interrupt-cells" property.

Quoted 7 lines
Quoted 5 lines

It would have been much easier to handle something like:

data-lanes = <2>, <3>, <1>;

i.e. an array of the lane indexes.

I'm fine with that.

...on a second thought: shouldn't this be handled by pinctrl? Or is it some CSI-2 module internal lane switching, not the global SoC pin function configuration?

Quoted 7 lines
Quoted 2 lines

On the hardware I came across, it's handled by the CSI2 receiver, not the SoC pinmux feature.

Same here. Is there any hardware known to mux those MIPI-CSI D-PHY high speed differential signals with general purpose IO pins ?

Or are there mostly dedicated pins used ?

The OMAP3 multiplexes the CSI pins with other functions.

Quoted 2 lines

However, if there are cases the lane configuration is done solely at CSI2 receiver level, there seems little point in involving the pinctrl API.

The OMAP3 handles lane routing in the CSI2 receiver.

Signature · 3 lines
Regards,

Laurent Pinchart
#13 lore raw

Re: [RFC/PATCH 02/13] media: s5p-csis: Add device tree support

In reply to Laurent Pinchart
Quoted 74 lines · Laurent Pinchart

Hi Sylwester,

Quoted 66 lines · On Tuesday 17 July 2012 20:16:23 Sylwester Nawrocki wrote:
Quoted 6 lines · Guennadi Liakhovetski

Hi Sylwester

Thanks for your comments to my RFC and for pointing out to this your earlier patch series. Unfortunately, I missed in in May, let me try to provide some thoughts about this, we should really try to converge our proposals. Maybe a discussion at KS would help too.

Thank you for the review. I was happy to see your RFC, as previously there seemed to be not much interest in DT among the media guys. Certainly, we need to work on a common approach to ensure interoperability of existing drivers and to avoid having people inventing different bindings for common features. I would also expect some share of device specific bindings, as diversity of media devices is significant.

I'd be great to discuss these things at KS, especially support for proper suspend/resume sequences. Also having common sessions with other subsystems folks, like ASoC, for example, might be a good idea.

I'm not sure if I'll be travelling to the KS though. :)

Quoted 36 lines · Sylwester Nawrocki
Quoted 35 lines

s5p-csis is platform device driver for MIPI-CSI frontend to the FIMC (camera host interface DMA engine and image processor). This patch adds support for instantiating the MIPI-CSIS devices from DT and parsing all SoC and board specific properties from device tree. The MIPI DPHY control callback is now called directly from within the driver, the platform code must ensure this callback does the right thing for each SoC.

The cell-index property is used to ensure proper signal routing, from physical camera port, through MIPI-CSI2 receiver to the DMA engine (FIMC?). It's also helpful in exposing the device topology in user space at /dev/media? devnode (Media Controller API).

This patch also defines a common property ("data-lanes") for MIPI-CSI receivers and transmitters.

---

  Documentation/devicetree/bindings/video/mipi.txt   |    5 +
  .../bindings/video/samsung-mipi-csis.txt           |   47 ++++++++++
  drivers/media/video/s5p-fimc/mipi-csis.c           |   97
  +++++++++++++++----- drivers/media/video/s5p-fimc/mipi-csis.h         
   |    1 +
  4 files changed, 126 insertions(+), 24 deletions(-)

create mode 100644 Documentation/devicetree/bindings/video/mipi.txt create mode 100644 Documentation/devicetree/bindings/video/samsung-mipi-csis.txt>>

(quoted diff) +0 -0

b/Documentation/devicetree/bindings/video/mipi.txt new file mode 100644 index 0000000..5aed285

Documentation/devicetree/bindings/video/mipi.txt new file +0 -0
@@ -0,0 +1,5 @@
Quoted 8 lines

Documentation/devicetree/bindings/video/mipi.txt line 5

Quoted 6 lines
Documentation/devicetree/bindings/video/mipi.txt new file +3 -0
+Common properties of MIPI-CSI1 and MIPI-CSI2 receivers and transmitters
+
+ - data-lanes : number of differential data lanes wired and actively

used in

Documentation/devicetree/bindings/video/mipi.txt new file +2 -0
+		communication between the transmitter and the receiver, this
+		excludes the clock lane;

Wouldn't it be better to use the standard "bus-width" DT property?

Quoted 4 lines

I can't see any problems with using "bus-width". It seems sufficient and could indeed be better, without a need to invent new MIPI-CSI specific names. That was my first RFC on that and my perspective wasn't probably broad enough. :)

Quoted 4 lines

What about CSI receivers that can reroute the lanes internally ? We would need to specify lane indices for each lane then, maybe with something like

clock-lane = <0>;

"clock-lanes" for uniformity?

Quoted 1 line

data-lanes = <2 3 1>;

Are there transmitters, that can reroute lanes too?

Thanks
Guennadi

Quoted 10 lines

For receivers that can't reroute lanes internally, the data-lanes property would be need to specify lanes in sequence.

data-lanes = <1 2 3>;

Signature · 3 lines
Regards,

Laurent Pinchart

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#14 lore raw

PATCH 3/13 ARM: Samsung: Remove unused fields from FIMC and CSIS platform data

In reply to Sylwester Nawrocki

The MIPI-CSI2 bus data alignment is now being derived from the media bus pixel code, the drivers don't use the corresponding structure fields, so remove them. Also remove the s5p_csis_phy_enable callback which is now used directly by s5p-csis driver.

---
 arch/arm/mach-exynos/mach-nuri.c               |    3 ---
 arch/arm/mach-exynos/mach-universal_c210.c     |    3 ---
 arch/arm/plat-samsung/include/plat/mipi_csis.h |   13 +++----------
 include/media/s5p_fimc.h                       |    2 --
 4 files changed, 3 insertions(+), 18 deletions(-)
arch/arm/mach-exynos/mach-nuri.c +0 -3
index c9ca54a..1cd4ded 100644
@@ -1148,9 +1148,7 @@ static struct platform_device cam_8m_12v_fixed_rdev = {
 static struct s5p_platform_mipi_csis mipi_csis_platdata = {
 	.clk_rate	= 166000000UL,
 	.lanes		= 2,
-	.alignment	= 32,
 	.hs_settle	= 12,
-	.phy_enable	= s5p_csis_phy_enable,
 };
 
 #define GPIO_CAM_MEGA_RST	EXYNOS4_GPY3(7) /* ISP_RESET */
@@ -1194,7 +1192,6 @@ static struct s5p_fimc_isp_info nuri_camera_sensors[] = {
 		.bus_type	= FIMC_MIPI_CSI2,
 		.board_info	= &m5mols_board_info,
 		.clk_frequency	= 24000000UL,
-		.csi_data_align	= 32,
 	},
 };
 
arch/arm/mach-exynos/mach-universal_c210.c +0 -3
index 7ebf79c..c2cba7a 100644
@@ -908,9 +908,7 @@ static struct platform_device cam_s_if_fixed_reg_dev = {
 static struct s5p_platform_mipi_csis mipi_csis_platdata = {
 	.clk_rate	= 166000000UL,
 	.lanes		= 2,
-	.alignment	= 32,
 	.hs_settle	= 12,
-	.phy_enable	= s5p_csis_phy_enable,
 };
 
 #define GPIO_CAM_LEVEL_EN(n)	EXYNOS4_GPE4(n + 3)
@@ -974,7 +972,6 @@ static struct s5p_fimc_isp_info universal_camera_sensors[] = {
 		.board_info	= &m5mols_board_info,
 		.i2c_bus_num	= 0,
 		.clk_frequency	= 24000000UL,
-		.csi_data_align	= 32,
 	},
 };
 
arch/arm/plat-samsung/include/plat/mipi_csis.h +3 -10
index 609cf1e..c35bf7a 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010-2011 Samsung Electronics Co., Ltd.
+ * Copyright (C) 2010 - 2012 Samsung Electronics Co., Ltd.
  *
  * S5P series MIPI CSI slave device support
  *
@@ -15,21 +15,14 @@ struct platform_device;
 
 /**
  * struct s5p_platform_mipi_csis - platform data for S5P MIPI-CSIS driver
- * @clk_rate: bus clock frequency
- * @lanes: number of data lanes used
- * @alignment: data alignment in bits
+ * @clk_rate:  bus clock frequency
+ * @lanes:     number of data lanes used
  * @hs_settle: HS-RX settle time
- * @fixed_phy_vdd: false to enable external D-PHY regulator management in the
- *		   driver or true in case this regulator has no enable function
- * @phy_enable: pointer to a callback controlling D-PHY enable/reset
  */
 struct s5p_platform_mipi_csis {
 	unsigned long clk_rate;
 	u8 lanes;
-	u8 alignment;
 	u8 hs_settle;
-	bool fixed_phy_vdd;
-	int (*phy_enable)(struct platform_device *pdev, bool on);
 };
 
 /**
include/media/s5p_fimc.h +0 -2
index 8587aaf..7be6f81 100644
@@ -28,7 +28,6 @@ struct i2c_board_info;
  * @board_info: pointer to I2C subdevice's board info
  * @clk_frequency: frequency of the clock the host interface provides to sensor
  * @bus_type: determines bus type, MIPI, ITU-R BT.601 etc.
- * @csi_data_align: MIPI-CSI interface data alignment in bits
  * @i2c_bus_num: i2c control bus id the sensor is attached to
  * @mux_id: FIMC camera interface multiplexer index (separate for MIPI and ITU)
  * @clk_id: index of the SoC peripheral clock for sensors
@@ -38,7 +37,6 @@ struct s5p_fimc_isp_info {
 	struct i2c_board_info *board_info;
 	unsigned long clk_frequency;
 	enum cam_bus_type bus_type;
-	u16 csi_data_align;
 	u16 i2c_bus_num;
 	u16 mux_id;
 	u16 flags;
Signature · 1 line
1.7.10
#15 lore raw

PATCH 4/13 devicetree: Add common video devices bindings documentation

In reply to Sylwester Nawrocki
---
 Documentation/devicetree/bindings/video/video.txt |   10 ++++++++++
 1 file changed, 10 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/video/video.txt
Documentation/devicetree/bindings/video/video.txt new file +10 -0
new file mode 100644
index 0000000..9f6a637
@@ -0,0 +1,10 @@
+Common properties of video data source devices (image sensor, video encoders, etc.)
+
+Video bus types
+---------------
+
+- video-bus-type : must be one of:
+
+    - itu-601   : parallel bus with HSYNC and VSYNC - ITU-R BT.601;
+    - itu-656   : parallel bus with embedded synchronization - ITU-R BT.656;
+    - mipi-csi2 : MIPI-CSI2 serial bus;
Signature · 1 line
1.7.10
#16 lore raw

Re: [RFC/PATCH 04/13] devicetree: Add common video devices bindings documentation

Quoted 13 lines · Sylwester Nawrocki
---
 Documentation/devicetree/bindings/video/video.txt |   10 ++++++++++
 1 file changed, 10 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/video/video.txt
Documentation/devicetree/bindings/video/video.txt new file +0 -0
new file mode 100644
index 0000000..9f6a637

Documentation/devicetree/bindings/video/video.txt line 9

Quoted 9 lines
Documentation/devicetree/bindings/video/video.txt new file +9 -0
@@ -0,0 +1,10 @@
+Common properties of video data source devices (image sensor, video encoders, etc.)
+
+Video bus types
+---------------
+
+- video-bus-type : must be one of:
+
+    - itu-601   : parallel bus with HSYNC and VSYNC - ITU-R BT.601;
+    - itu-656   : parallel bus with embedded synchronization - ITU-R BT.656;

wikipedia tells me, that bt.601 is mostly a data encoding standard, it also defines bus-types, but recent versions also include serial busses.

Documentation/devicetree/bindings/video/video.txt line 10

Quoted 1 line
Documentation/devicetree/bindings/video/video.txt new file +1 -0
+    - mipi-csi2 : MIPI-CSI2 serial bus;

In general: are these at all needed? Wouldn't it be better to specify pads on sensors and interfaces to differentiate between serial and parallel connections. As for whether HSYNC and VSYNC are used - I see 3 possibilities there:

1. real sync signals are used - the default.

2. embedded syncs shall be used, because sync signals are missing. This should (arguably) be derived from pinctrl - see this discussion:

http://lkml.indiana.edu/hypermail/linux/kernel/1205.2/index.html#03893

3. sync signals are present, but cannot be used, because one of the partners doesn't support them - .g_mbus_config() can be used to retrieve this information.

4. sync signals are available and supported by both peers, but for some reason the user prefers to use embedded sync data - is such a case feasible? Even if so, this should be run-time configurable then?

So, maybe we don't need these at all.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#17 lore raw

Re: [RFC/PATCH 04/13] devicetree: Add common video devices bindings documentation

Hi Guennadi,

Quoted 19 lines · Guennadi Liakhovetski
Quoted 17 lines · Sylwester Nawrocki
---
  Documentation/devicetree/bindings/video/video.txt |   10 ++++++++++
  1 file changed, 10 insertions(+)

create mode 100644 Documentation/devicetree/bindings/video/video.txt

Documentation/devicetree/bindings/video/video.txt new file +4 -0
new file mode 100644
index 0000000..9f6a637
@@ -0,0 +1,10 @@
+Common properties of video data source devices (image sensor, video encoders, etc.)
+
+Video bus types
+---------------
Quoted 8 lines

Documentation/devicetree/bindings/video/video.txt line 9

Quoted 5 lines
Documentation/devicetree/bindings/video/video.txt new file +5 -0
+
+- video-bus-type : must be one of:
+
+    - itu-601   : parallel bus with HSYNC and VSYNC - ITU-R BT.601;
+    - itu-656   : parallel bus with embedded synchronization - ITU-R BT.656;

wikipedia tells me, that bt.601 is mostly a data encoding standard, it also defines bus-types, but recent versions also include serial busses.

Hmm, indeed, I got slightly misled by the Samsung SoCs' User Manuals that used bt.601/bt.656 to distinguish between bus with sync signals and with embedded sync.

Quoted 5 lines

Documentation/devicetree/bindings/video/video.txt line 10

Quoted 1 line
Documentation/devicetree/bindings/video/video.txt new file +1 -0
+    - mipi-csi2 : MIPI-CSI2 serial bus;

In general: are these at all needed? Wouldn't it be better to specify pads on sensors and interfaces to differentiate between serial and parallel connections. As for whether HSYNC and VSYNC are used - I see 3

We have video buses and data receivers and transmitters attached to them. The pads concept doesn't quite fit here for me. Specifying possible links with character string tags might be a way to go, but I'd like to hear others' opinion on that. Do we have any bindings already that do something similar ?

Quoted 8 lines

possibilities there:

1. real sync signals are used - the default.

2. embedded syncs shall be used, because sync signals are missing. This should (arguably) be derived from pinctrl - see this discussion:

http://lkml.indiana.edu/hypermail/linux/kernel/1205.2/index.html#03893

Hmm, I'm not terribly familiar with pinctrl API, but wouldn't it be required to have two pin group names: (data + clock + sync) signals and (data + clock) (for embedded video synchronization) ? We would have to name these two configurations somehow anyway, wouldn't we ?

Also, as Stephen pointed out, the control flow is supposed to be from drivers to pin controller, not the other way around.

Quoted 3 lines

3. sync signals are present, but cannot be used, because one of the partners doesn't support them - .g_mbus_config() can be used to retrieve this information.

OK.

Quoted 3 lines

4. sync signals are available and supported by both peers, but for some reason the user prefers to use embedded sync data - is such a case feasible? Even if so, this should be run-time configurable then?

I've never seen such a situation. I would expect that if sync signal wires are routed, they shall be used. Otherwise only embedded synchronization would be used, to save PCB area.

Quoted 1 line

So, maybe we don't need these at all.

We need something that would let drivers distinguish which (serial/ parallel) bus is supported on a board. And what type of synchronization is used. I'm fine as long as this can be specified reliably in DT and drivers of the transmitters/receivers can configure their output/input interfaces. I'm not against dynamic configuration but static one also need to be supported.

--
Regards,
Sylwester

#18 lore raw

PATCH 5/13 media: s5p-fimc: Add device tree support for FIMC devices

In reply to Sylwester Nawrocki
---
 .../bindings/camera/soc/samsung-fimc.txt           |   66 ++++
 drivers/media/video/s5p-fimc/fimc-capture.c        |    2 +-
 drivers/media/video/s5p-fimc/fimc-core.c           |  410 +++++++++++---------
 drivers/media/video/s5p-fimc/fimc-core.h           |    2 -
 drivers/media/video/s5p-fimc/fimc-mdevice.c        |    8 +-
 5 files changed, 291 insertions(+), 197 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/camera/soc/samsung-fimc.txt
Documentation/devicetree/bindings/camera/soc/samsung-fimc.txt new file +66 -0
new file mode 100644
index 0000000..1ec48e9
@@ -0,0 +1,66 @@
+Samsung S5P/EXYNOS SoC Camera Subsystem (FIMC)
+----------------------------------------------
+
+The Exynos Camera subsystem uses a dedicated device node associated with
+top level device driver that manages common properties of the whole subsystem,
+like common camera port pins or clocks for external image sensors. This
+aggregate node references related platform sub-devices - FIMC, FIMC-LITE,
+MIPI-CSIS [1], and it also contains nodes describing image sensors wired to
+the host SoC's video port and using I2C or SPI as the control bus.
+
+
+Common 'camera' node
+--------------------
+
+Required properties:
+
+- compatible	   : must be "samsung,fimc"
+- fimc-controllers : an array of phandles to 'fimc' device nodes,
+		     size of this array must be at least 1;
+
+Optional properties:
+
+- csi-rx-controllers : an array of phandles to 'csis' device nodes,
+		       it is required for sensors with MIPI-CSI2 bus;
+
+'fimc' device node
+------------------
+
+Required properties:
+
+- compatible : should be one of:
+		"samsung,s5pv210-fimc"
+		"samsung,exynos4210-fimc";
+		"samsung,exynos4412-fimc";
+- reg	     : physical base address and size of the device memory mapped
+	       registers;
+- interrupts : FIMC interrupt to the CPU should be described here;
+- cell-index : FIMC IP instance index, the number of available instances
+	       depends on the SoC revision. For S5PV210 valid values are:
+	       0...2, for Exynos4x1x: 0...3.
+
+Example:
+
+	fimc0: fimc@11800000 {
+		compatible = "samsung,exynos4210-fimc";
+		reg = <0x11800000 0x1000>;
+		interrupts = <0 85 0>;
+		cell-index = <0>;
+	};
+
+	csis0: csis@11880000 {
+		compatible = "samsung,exynos4210-csis";
+		reg = <0x11880000 0x1000>;
+		interrupts = <0 78 0>;
+		cell-index = <0>;
+	};
+
+	camera {
+		compatible = "samsung,fimc";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		fimc-controllers = <&fimc0>;
+		csi-rx-controllers = <&csis0>;
+	};
+
+[1] Documentation/devicetree/bindings/video/samsung-mipi-csis.txt
drivers/media/video/s5p-fimc/fimc-capture.c +1 -1
index 0549451..7585b2f 100644
@@ -1684,7 +1684,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/video/s5p-fimc/fimc-core.c +220 -190

451 lines not on this page · raw message

drivers/media/video/s5p-fimc/fimc-core.h +0 -2
index 95b27ae..a1df84d 100644
@@ -414,7 +414,6 @@ struct fimc_ctx;
  * @slock:	the spinlock protecting this data structure
  * @lock:	the mutex protecting this data structure
  * @pdev:	pointer to the FIMC platform device
- * @pdata:	pointer to the device platform data
  * @variant:	the IP variant information
  * @id:		FIMC device index (0..FIMC_MAX_DEVS)
  * @clock:	clocks required for FIMC operation
@@ -431,7 +430,6 @@ struct fimc_dev {
 	spinlock_t			slock;
 	struct mutex			lock;
 	struct platform_device		*pdev;
-	struct s5p_platform_fimc	*pdata;
 	struct fimc_variant		*variant;
 	u16				id;
 	struct clk			*clock[MAX_FIMC_CLOCKS];
drivers/media/video/s5p-fimc/fimc-mdevice.c +4 -4
index 2d780e5..3ffc4f5e 100644
@@ -335,15 +335,15 @@ static int fimc_register_callback(struct device *dev, void *p)
 	struct fimc_dev *fimc = dev_get_drvdata(dev);
 	struct v4l2_subdev *sd = &fimc->vid_cap.subdev;
 	struct fimc_md *fmd = p;
-	int ret = 0;
+	int ret;
 
-	if (!fimc || !fimc->pdev)
+	if (fimc == NULL)
 		return 0;
 
-	if (fimc->pdev->id < 0 || fimc->pdev->id >= FIMC_MAX_DEVS)
+	if (fimc->id >= FIMC_MAX_DEVS)
 		return 0;
 
-	fmd->fimc[fimc->pdev->id] = fimc;
+	fmd->fimc[fimc->id] = fimc;
 	sd->grp_id = FIMC_GROUP_ID;
 
 	ret = v4l2_device_register_subdev(&fmd->v4l2_dev, sd);
Signature · 1 line
1.7.10
#19 lore raw

Re: [RFC/PATCH 05/13] media: s5p-fimc: Add device tree support for FIMC devices

Quoted 5 lines · Sylwester Nawrocki

From the documentation below I think, I understand what it does, but why

is it needed? It doesn't describe your video subsystem topology, right? How various subdevices are connected. It just lists them all in one node... A description for this patch would be very welcome IMHO and, maybe, such a node can be completely avoided?

Thanks
Guennadi

Quoted 71 lines
---
 .../bindings/camera/soc/samsung-fimc.txt           |   66 ++++
 drivers/media/video/s5p-fimc/fimc-capture.c        |    2 +-
 drivers/media/video/s5p-fimc/fimc-core.c           |  410 +++++++++++---------
 drivers/media/video/s5p-fimc/fimc-core.h           |    2 -
 drivers/media/video/s5p-fimc/fimc-mdevice.c        |    8 +-
 5 files changed, 291 insertions(+), 197 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/camera/soc/samsung-fimc.txt
Documentation/devicetree/bindings/camera/soc/samsung-fimc.txt new file +56 -0
new file mode 100644
index 0000000..1ec48e9
@@ -0,0 +1,66 @@
+Samsung S5P/EXYNOS SoC Camera Subsystem (FIMC)
+----------------------------------------------
+
+The Exynos Camera subsystem uses a dedicated device node associated with
+top level device driver that manages common properties of the whole subsystem,
+like common camera port pins or clocks for external image sensors. This
+aggregate node references related platform sub-devices - FIMC, FIMC-LITE,
+MIPI-CSIS [1], and it also contains nodes describing image sensors wired to
+the host SoC's video port and using I2C or SPI as the control bus.
+
+
+Common 'camera' node
+--------------------
+
+Required properties:
+
+- compatible	   : must be "samsung,fimc"
+- fimc-controllers : an array of phandles to 'fimc' device nodes,
+		     size of this array must be at least 1;
+
+Optional properties:
+
+- csi-rx-controllers : an array of phandles to 'csis' device nodes,
+		       it is required for sensors with MIPI-CSI2 bus;
+
+'fimc' device node
+------------------
+
+Required properties:
+
+- compatible : should be one of:
+		"samsung,s5pv210-fimc"
+		"samsung,exynos4210-fimc";
+		"samsung,exynos4412-fimc";
+- reg	     : physical base address and size of the device memory mapped
+	       registers;
+- interrupts : FIMC interrupt to the CPU should be described here;
+- cell-index : FIMC IP instance index, the number of available instances
+	       depends on the SoC revision. For S5PV210 valid values are:
+	       0...2, for Exynos4x1x: 0...3.
+
+Example:
+
+	fimc0: fimc@11800000 {
+		compatible = "samsung,exynos4210-fimc";
+		reg = <0x11800000 0x1000>;
+		interrupts = <0 85 0>;
+		cell-index = <0>;
+	};
+
+	csis0: csis@11880000 {
+		compatible = "samsung,exynos4210-csis";
+		reg = <0x11880000 0x1000>;
+		interrupts = <0 78 0>;
+		cell-index = <0>;
+	};

Documentation/devicetree/bindings/camera/soc/samsung-fimc.txt line 66

Quoted 10 lines
Documentation/devicetree/bindings/camera/soc/samsung-fimc.txt new file +10 -0
+
+	camera {
+		compatible = "samsung,fimc";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		fimc-controllers = <&fimc0>;
+		csi-rx-controllers = <&csis0>;
+	};
+
+[1] Documentation/devicetree/bindings/video/samsung-mipi-csis.txt

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#20 lore raw

Re: [RFC/PATCH 05/13] media: s5p-fimc: Add device tree support for FIMC devices

Quoted 11 lines · Guennadi Liakhovetski
Quoted 3 lines · Sylwester Nawrocki

From the documentation below I think, I understand what it does, but why
is it needed? It doesn't describe your video subsystem topology, right? How various subdevices are connected. It just lists them all in one node... A description for this patch would be very welcome IMHO and, maybe, such a node can be completely avoided?

Sorry, I'll provide better description in next iteration. It's true it doesn't describe the topology in detail, as there are multiple one-to many possible connections between sub-devices. An exact topology is coded in the driver and can be changed through MC API. The "samsung,camif-mux-id" and "video-bus-type" properties at "sensor" nodes just specify to which physical SoC camera port an image sensor is connected.

Originally the all camera devices were supposed to land under common 'camera' node. And a top level driver would be registering all platform devices. With this approach it would be possible to better control PM handling (which currently depends on an order of registering devices to the driver core). But then we discovered that we couldn't use OF_DEV_AUXDATA in such case, which was required to preserve platform device names, in order for the clock API to work. So I've moved some sub-devices out of 'camera' node and have added only a list of phandles to them in that node. This is rather a cheap workaround..

I think all camera sub-devices should be placed under common node, as there are some properties that don't belong to any sub-node: GPIO config, clocks, to name a few. Of course simpler devices might not need such a composite node. I think we can treat the sub-device interdependencies as an issue separate from a need for a common node.

If some devices need to reflect the topology better, we probably could include in some nodes (a list of) phandles to other nodes. This could ease parsing the topology at the drivers, by using existing OF infrastructure.

--

Thanks,
Sylwester

#21 lore raw

Re: [RFC/PATCH 05/13] media: s5p-fimc: Add device tree support for FIMC devices

Quoted 13 lines · Sylwester Nawrocki
Quoted 11 lines · Guennadi Liakhovetski
Quoted 3 lines · Sylwester Nawrocki

From the documentation below I think, I understand what it does, but why
is it needed? It doesn't describe your video subsystem topology, right? How various subdevices are connected. It just lists them all in one node... A description for this patch would be very welcome IMHO and, maybe, such a node can be completely avoided?

Quoted 7 lines

Sorry, I'll provide better description in next iteration. It's true it doesn't describe the topology in detail, as there are multiple one-to many possible connections between sub-devices. An exact topology is coded in the driver and can be changed through MC API. The "samsung,camif-mux-id" and "video-bus-type" properties at "sensor" nodes just specify to which physical SoC camera port an image sensor is connected.

So, don't you think my media-link child nodes are a good solution for this?

Quoted 16 lines

Originally the all camera devices were supposed to land under common 'camera' node. And a top level driver would be registering all platform devices. With this approach it would be possible to better control PM handling (which currently depends on an order of registering devices to the driver core). But then we discovered that we couldn't use OF_DEV_AUXDATA in such case, which was required to preserve platform device names, in order for the clock API to work. So I've moved some sub-devices out of 'camera' node and have added only a list of phandles to them in that node. This is rather a cheap workaround..

I think all camera sub-devices should be placed under common node, as there are some properties that don't belong to any sub-node: GPIO config, clocks, to name a few. Of course simpler devices might not need such a composite node. I think we can treat the sub-device interdependencies as an issue separate from a need for a common node.

Quoted 3 lines

If some devices need to reflect the topology better, we probably could include in some nodes (a list of) phandles to other nodes. This could ease parsing the topology at the drivers, by using existing OF infrastructure.

Ok, I think you have some good ideas in your RFC's, an interesting question now is - how to proceed. Do you think we'd be able to work out a combined RFC? Or would you prefer to make two versions and then see what others think? In either case it would be nice, I think, if you could try to separate what you see as common V4L DT bindings, then we could discuss that separately. Whereas what you think is private to your hardware, we can also look at for common ideas, or maybe even some of those properties we'll wake to make common too.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#22 lore raw

Re: [RFC/PATCH 05/13] media: s5p-fimc: Add device tree support for FIMC devices

Quoted 22 lines · Guennadi Liakhovetski
Quoted 13 lines · Sylwester Nawrocki
Quoted 11 lines · Guennadi Liakhovetski
Quoted 3 lines · Sylwester Nawrocki

From the documentation below I think, I understand what it does, but why
is it needed? It doesn't describe your video subsystem topology, right? How various subdevices are connected. It just lists them all in one node... A description for this patch would be very welcome IMHO and, maybe, such a node can be completely avoided?

Quoted 7 lines

Sorry, I'll provide better description in next iteration. It's true it doesn't describe the topology in detail, as there are multiple one-to many possible connections between sub-devices. An exact topology is coded in the driver and can be changed through MC API. The "samsung,camif-mux-id" and "video-bus-type" properties at "sensor" nodes just specify to which physical SoC camera port an image sensor is connected.

Quoted 2 lines

So, don't you think my media-link child nodes are a good solution for this?

Not quite yet ;) It would be good to see some example implementation and how it actually works.

Quoted 20 lines
Quoted 16 lines

Originally the all camera devices were supposed to land under common 'camera' node. And a top level driver would be registering all platform devices. With this approach it would be possible to better control PM handling (which currently depends on an order of registering devices to the driver core). But then we discovered that we couldn't use OF_DEV_AUXDATA in such case, which was required to preserve platform device names, in order for the clock API to work. So I've moved some sub-devices out of 'camera' node and have added only a list of phandles to them in that node. This is rather a cheap workaround..

I think all camera sub-devices should be placed under common node, as there are some properties that don't belong to any sub-node: GPIO config, clocks, to name a few. Of course simpler devices might not need such a composite node. I think we can treat the sub-device interdependencies as an issue separate from a need for a common node.

Quoted 3 lines

If some devices need to reflect the topology better, we probably could include in some nodes (a list of) phandles to other nodes. This could ease parsing the topology at the drivers, by using existing OF infrastructure.

Quoted 8 lines

Ok, I think you have some good ideas in your RFC's, an interesting question now is - how to proceed. Do you think we'd be able to work out a combined RFC? Or would you prefer to make two versions and then see what others think? In either case it would be nice, I think, if you could try to separate what you see as common V4L DT bindings, then we could discuss that separately. Whereas what you think is private to your hardware, we can also look at for common ideas, or maybe even some of those properties we'll wake to make common too.

I think we need a one combined RFC and continue discussions in one thread. Still, our proposals are quite different, but I believe we need something in between. I presume we should focus more to have common bindings for subdevs that are reused among different host/ISP devices, i.e. sensors and encoders. For simple host interfaces we can likely come up with common binding patterns, but more complex processing pipelines may require a sort of individual approach.

The suspend/resume handling is still something I don't have an idea on how the solution for might look like..
Instantiating all devices from a top level driver could help, but it is only going to work when platforms are converted to the common clock framework and have their clocks instantiated from device tree.

This week I'm out of office, and next one or two I have some pending assignments. So there might be some delay before I can dedicate some reasonable amount of time to carry on with that topic.

I unfortunately won't be attending KS this time.

I'll try to prepare some summary with topics that appear common. And also to restructure my RFC series to better separate new common features and specific H/W support.

In the meantime we could possibly continue discussions in your RFC thread.

--

Regards,
Sylwester

#23 lore raw

Re: [RFC/PATCH 05/13] media: s5p-fimc: Add device tree support for FIMC devices

Hi Sylwester,

Quoted 62 lines · On Wednesday 18 July 2012 21:53:34 Sylwester Nawrocki wrote:
Quoted 23 lines · Guennadi Liakhovetski
Quoted 14 lines · Sylwester Nawrocki
Quoted 5 lines · Guennadi Liakhovetski
Quoted 4 lines · Sylwester Nawrocki
Quoted 7 lines

From the documentation below I think, I understand what it does, but why

is it needed? It doesn't describe your video subsystem topology, right? How various subdevices are connected. It just lists them all in one node... A description for this patch would be very welcome IMHO and, maybe, such a node can be completely avoided?

Quoted 7 lines

Sorry, I'll provide better description in next iteration. It's true it doesn't describe the topology in detail, as there are multiple one-to many possible connections between sub-devices. An exact topology is coded in the driver and can be changed through MC API. The "samsung,camif-mux-id" and "video-bus-type" properties at "sensor" nodes just specify to which physical SoC camera port an image sensor is connected.

Quoted 2 lines

So, don't you think my media-link child nodes are a good solution for this?

Not quite yet ;) It would be good to see some example implementation and how it actually works.

Quoted 23 lines
Quoted 18 lines

Originally the all camera devices were supposed to land under common 'camera' node. And a top level driver would be registering all platform devices. With this approach it would be possible to better control PM handling (which currently depends on an order of registering devices to the driver core). But then we discovered that we couldn't use OF_DEV_AUXDATA in such case, which was required to preserve platform device names, in order for the clock API to work. So I've moved some sub-devices out of 'camera' node and have added only a list of phandles to them in that node. This is rather a cheap workaround..

I think all camera sub-devices should be placed under common node, as there
are some properties that don't belong to any sub-node: GPIO config, clocks,
to name a few. Of course simpler devices might not need such a composite node. I think we can treat the sub-device interdependencies as an issue separate from a need for a common node.

Quoted 4 lines

If some devices need to reflect the topology better, we probably could include in some nodes (a list of) phandles to other nodes. This could ease
parsing the topology at the drivers, by using existing OF infrastructure.

Quoted 8 lines

Ok, I think you have some good ideas in your RFC's, an interesting question now is - how to proceed. Do you think we'd be able to work out a combined RFC? Or would you prefer to make two versions and then see what others think? In either case it would be nice, I think, if you could try to separate what you see as common V4L DT bindings, then we could discuss that separately. Whereas what you think is private to your hardware, we can also look at for common ideas, or maybe even some of those properties we'll wake to make common too.

Quoted 1 line

I think we need a one combined RFC and continue discussions in one thread.

Agreed.

Quoted 13 lines

Still, our proposals are quite different, but I believe we need something in between. I presume we should focus more to have common bindings for subdevs that are reused among different host/ISP devices, i.e. sensors and encoders. For simple host interfaces we can likely come up with common binding patterns, but more complex processing pipelines may require a sort of individual approach.

The suspend/resume handling is still something I don't have an idea on how the solution for might look like..
Instantiating all devices from a top level driver could help, but it is only going to work when platforms are converted to the common clock framework and have their clocks instantiated from device tree.

Quoted 5 lines

This week I'm out of office, and next one or two I have some pending assignments. So there might be some delay before I can dedicate some reasonable amount of time to carry on with that topic.

I unfortunately won't be attending KS this time.

That's bad news :-( I still think this topic should be discussed during KS, I expect several developers to be interested. The media workshop might not be the best venue though, as we might need quite a lot of time.

Until KS let's continue the discussion by e-mail.

Quoted 5 lines

I'll try to prepare some summary with topics that appear common. And also to restructure my RFC series to better separate new common features and specific H/W support.

In the meantime we could possibly continue discussions in your RFC thread.

Signature · 3 lines
Regards,

Laurent Pinchart
#24 lore raw

Re: [RFC/PATCH 05/13] media: s5p-fimc: Add device tree support for FIMC devices

Hi Laurent,

Quoted 18 lines · Laurent Pinchart
Quoted 1 line · On Wednesday 18 July 2012 21:53:34 Sylwester Nawrocki wrote:

I think we need a one combined RFC and continue discussions in one thread.

Agreed.

Quoted 13 lines

Still, our proposals are quite different, but I believe we need something in between. I presume we should focus more to have common bindings for subdevs that are reused among different host/ISP devices, i.e. sensors and encoders. For simple host interfaces we can likely come up with common binding patterns, but more complex processing pipelines may require a sort of individual approach.

The suspend/resume handling is still something I don't have an idea on how the solution for might look like..
Instantiating all devices from a top level driver could help, but it is only going to work when platforms are converted to the common clock framework and have their clocks instantiated from device tree.

Quoted 7 lines
Quoted 5 lines

This week I'm out of office, and next one or two I have some pending assignments. So there might be some delay before I can dedicate some reasonable amount of time to carry on with that topic.

I unfortunately won't be attending KS this time.

That's bad news :-( I still think this topic should be discussed during KS, I

Yeah, shit happens.. :) I guess -ENOBUDGET this time... I didn't really plan early to attend KS, I might be coming to ELCE though. However it's a rather distant event and we'll probably get most things settled by that time.

Quoted 4 lines

expect several developers to be interested. The media workshop might not be the best venue though, as we might need quite a lot of time.

Until KS let's continue the discussion by e-mail.

OK, thank you for taking time to review the RFCs.

--

Regards,
Sylwester

#25 lore raw

PATCH 6/13 media: s5p-fimc: Add device tree support for FIMC-LITE

In reply to Sylwester Nawrocki
---
 .../bindings/camera/soc/samsung-fimc.txt           |   15 ++++
 drivers/media/video/s5p-fimc/fimc-lite.c           |   73 ++++++++++++++------
 2 files changed, 67 insertions(+), 21 deletions(-)
Documentation/devicetree/bindings/camera/soc/samsung-fimc.txt +15 -0
index 1ec48e9..b459da2 100644
@@ -39,6 +39,21 @@ Required properties:
 	       depends on the SoC revision. For S5PV210 valid values are:
 	       0...2, for Exynos4x1x: 0...3.
 
+
+'fimc-lite' device node
+-----------------------
+
+Required properties:
+
+- compatible : should be one of:
+		"samsung,exynos4212-fimc";
+		"samsung,exynos4412-fimc";
+- reg	     : physical base address and size of the device's memory mapped
+	       registers;
+- interrupts : should contain FIMC-LITE interrupt;
+- cell-index : FIMC-LITE IP instance index;
+
+
 Example:
 
 	fimc0: fimc@11800000 {
drivers/media/video/s5p-fimc/fimc-lite.c +52 -21

114 lines not on this page · raw message

Signature · 1 line
1.7.10
#26 lore raw

Re: [RFC/PATCH 06/13] media: s5p-fimc: Add device tree support for FIMC-LITE

Quoted 18 lines · Sylwester Nawrocki
---
 .../bindings/camera/soc/samsung-fimc.txt           |   15 ++++
 drivers/media/video/s5p-fimc/fimc-lite.c           |   73 ++++++++++++++------
 2 files changed, 67 insertions(+), 21 deletions(-)
Documentation/devicetree/bindings/camera/soc/samsung-fimc.txt +3 -0
index 1ec48e9..b459da2 100644
@@ -39,6 +39,21 @@ Required properties:
 	       depends on the SoC revision. For S5PV210 valid values are:
 	       0...2, for Exynos4x1x: 0...3.
 
+
+'fimc-lite' device node
+-----------------------

Documentation/devicetree/bindings/camera/soc/samsung-fimc.txt Required properties: · line 54

Quoted 10 lines
Documentation/devicetree/bindings/camera/soc/samsung-fimc.txt +10 -0
+
+Required properties:
+
+- compatible : should be one of:
+		"samsung,exynos4212-fimc";
+		"samsung,exynos4412-fimc";
+- reg	     : physical base address and size of the device's memory mapped
+	       registers;
+- interrupts : should contain FIMC-LITE interrupt;
+- cell-index : FIMC-LITE IP instance index;

Same as in an earlier patch - not sure this is needed.

Thanks
Guennadi

Documentation/devicetree/bindings/camera/soc/samsung-fimc.txt Required properties: · line 59

Quoted 5 lines
Documentation/devicetree/bindings/camera/soc/samsung-fimc.txt +2 -0
+
+
 Example:
 
 	fimc0: fimc@11800000 {

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

A message that is not in the archive (sent off-list or not yet received): Pine.LNX.4.64.1207161114130.12302-0199iw4Nj15frtckUFj5Ag@public.gmane.org

#28 lore raw

Re: [RFC/PATCH 06/13] media: s5p-fimc: Add device tree support for FIMC-LITE

Quoted 6 lines · Guennadi Liakhovetski
Quoted 6 lines
Documentation/devicetree/bindings/camera/soc/samsung-fimc.txt +0 -0
@@ -39,6 +39,21 @@ Required properties:
  	       depends on the SoC revision. For S5PV210 valid values are:
  	       0...2, for Exynos4x1x: 0...3.
 
Quoted 15 lines

Documentation/devicetree/bindings/camera/soc/samsung-fimc.txt Required properties: · line 54

Quoted 13 lines
Documentation/devicetree/bindings/camera/soc/samsung-fimc.txt +13 -0
+
+'fimc-lite' device node
+-----------------------
+
+Required properties:
+
+- compatible : should be one of:
+		"samsung,exynos4212-fimc";
+		"samsung,exynos4412-fimc";
+- reg	     : physical base address and size of the device's memory mapped
+	       registers;
+- interrupts : should contain FIMC-LITE interrupt;
+- cell-index : FIMC-LITE IP instance index;

Same as in an earlier patch - not sure this is needed.

It is needed for setting up a pipeline of multiple sub-device within a SoC. As I commented on patch 2/13 I'd like to replace this with proper entries in the "aliases" node. Some sub-devices have registers that these indexes need to be directly written to.

--

Thanks,
Sylwester

#29 lore raw

Re: [RFC/PATCH 06/13] media: s5p-fimc: Add device tree support for FIMC-LITE

Hi Sylwester

Quoted 24 lines · Sylwester Nawrocki
Quoted 6 lines · Guennadi Liakhovetski
Quoted 6 lines
Documentation/devicetree/bindings/camera/soc/samsung-fimc.txt +0 -0
@@ -39,6 +39,21 @@ Required properties:
  	       depends on the SoC revision. For S5PV210 valid values are:
  	       0...2, for Exynos4x1x: 0...3.
 
Quoted 16 lines
Quoted 11 lines
Documentation/devicetree/bindings/camera/soc/samsung-fimc.txt +10 -0
+
+'fimc-lite' device node
+-----------------------
+
+Required properties:
+
+- compatible : should be one of:
+		"samsung,exynos4212-fimc";
+		"samsung,exynos4412-fimc";
+- reg	     : physical base address and size of the device's memory

mapped

Documentation/devicetree/bindings/camera/soc/samsung-fimc.txt Required properties: · line 54

Quoted 3 lines
Documentation/devicetree/bindings/camera/soc/samsung-fimc.txt +3 -0
+	       registers;
+- interrupts : should contain FIMC-LITE interrupt;
+- cell-index : FIMC-LITE IP instance index;

Same as in an earlier patch - not sure this is needed.

Quoted 4 lines

It is needed for setting up a pipeline of multiple sub-device within a SoC. As I commented on patch 2/13 I'd like to replace this with proper entries in the "aliases" node. Some sub-devices have registers that these indexes need to be directly written to.

Aha, so, these are not purely software indices, that you just use to identify your devices, these are actual hardware values? You really have to write, e.g., "1" into a resizer register to connect it to a certain capture engine? Ok, in this case it indeed might make sense to have these values in the DT. Not sure how best to call these properties, or whether aliases is the best solution, but that's already a detail. And btw, if you do decide to keep this as a property, maybe this is one of the cases, where you'd want to mark it with your hardware type, like "fimc,cell-id" or similar?

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#30 lore raw

Re: [RFC/PATCH 06/13] media: s5p-fimc: Add device tree support for FIMC-LITE

Hi Guennadi,

Quoted 30 lines · Guennadi Liakhovetski
Quoted 24 lines · Sylwester Nawrocki
Quoted 6 lines · Guennadi Liakhovetski
Quoted 6 lines
Documentation/devicetree/bindings/camera/soc/samsung-fimc.txt +0 -0
@@ -39,6 +39,21 @@ Required properties:
   	       depends on the SoC revision. For S5PV210 valid values are:
   	       0...2, for Exynos4x1x: 0...3.
 
Quoted 16 lines
Quoted 11 lines
Documentation/devicetree/bindings/camera/soc/samsung-fimc.txt +10 -0
+
+'fimc-lite' device node
+-----------------------
+
+Required properties:
+
+- compatible : should be one of:
+		"samsung,exynos4212-fimc";
+		"samsung,exynos4412-fimc";
+- reg	     : physical base address and size of the device's memory

mapped

Documentation/devicetree/bindings/camera/soc/samsung-fimc.txt Required properties: · line 54

Quoted 3 lines
Documentation/devicetree/bindings/camera/soc/samsung-fimc.txt +3 -0
+	       registers;
+- interrupts : should contain FIMC-LITE interrupt;
+- cell-index : FIMC-LITE IP instance index;

Same as in an earlier patch - not sure this is needed.

Quoted 4 lines

It is needed for setting up a pipeline of multiple sub-device within a SoC. As I commented on patch 2/13 I'd like to replace this with proper entries in the "aliases" node. Some sub-devices have registers that these indexes need to be directly written to.

Quoted 4 lines

Aha, so, these are not purely software indices, that you just use to identify your devices, these are actual hardware values? You really have to write, e.g., "1" into a resizer register to connect it to a certain capture engine? Ok, in this case it indeed might make sense to have these

Yes, that's more or less how it works. If I select input mux id = 0, then MIPI-CSIS0 have to be used for streaming. For this FIMC-LITE device there are some commands/registers within the device that sits after FIMC-LITE in the data pipeline (not yet mainlined).

Quoted 2 lines

values in the DT. Not sure how best to call these properties, or whether aliases is the best solution, but that's already a detail. And btw, if you

Yeah, the property seems more accurate. But I don't really mind, I could just use whatever is accepted in the mainline.

Quoted 3 lines

do decide to keep this as a property, maybe this is one of the cases, where you'd want to mark it with your hardware type, like "fimc,cell-id" or similar?

I'm not sure about that. "cell-index" has well defined semantics. So there should be no reason to use device specific property. I would have then to use "samsung,fimc-cell-id", "samsung,fimc-lite-cell-id" and "samsung,csis-cell-id", as all device specific bindings need to be prefixed with a manufacturer code.

--

Thanks,
Sylwester

#31 lore raw

PATCH 7/13 media: s5p-fimc: Enable device tree based media device instantiation

In reply to Sylwester Nawrocki

Enable device tree based instantiation of the common platform device associated with the top level media device driver. Handling of the image sensor related properties, like video port pins configuration, is not included in this patch.

---
 drivers/media/video/s5p-fimc/fimc-core.h    |    2 +-
 drivers/media/video/s5p-fimc/fimc-mdevice.c |  104 +++++++++++++++++++++++++--
 2 files changed, 101 insertions(+), 5 deletions(-)
drivers/media/video/s5p-fimc/fimc-core.h +1 -1
index a1df84d..8c5c03f 100644
@@ -431,7 +431,7 @@ struct fimc_dev {
 	struct mutex			lock;
 	struct platform_device		*pdev;
 	struct fimc_variant		*variant;
-	u16				id;
+	u32				id;
 	struct clk			*clock[MAX_FIMC_CLOCKS];
 	void __iomem			*regs;
 	wait_queue_head_t		irq_queue;
drivers/media/video/s5p-fimc/fimc-mdevice.c +100 -4

144 lines not on this page · raw message

Signature · 1 line
1.7.10
#32 lore raw

PATCH 8/13 ARM: dts: Add FIMC and MIPI-CSIS devices to Exynos4210 DT source

In reply to Sylwester Nawrocki
---
 arch/arm/boot/dts/exynos4210-origen.dts   |   28 +++++++++++++++
 arch/arm/boot/dts/exynos4210-smdkv310.dts |   28 +++++++++++++++
 arch/arm/boot/dts/exynos4210.dtsi         |   54 +++++++++++++++++++++++++++++
 arch/arm/mach-exynos/mach-exynos4-dt.c    |   12 +++++++
 4 files changed, 122 insertions(+)
arch/arm/boot/dts/exynos4210-origen.dts +28 -0
index b8c4763..20915b1 100644
@@ -134,4 +134,32 @@
 	i2c@138D0000 {
 		status = "disabled";
 	};
+
+	camera {
+		status = "disabled";
+	};
+
+	fimc@11800000 {
+		status = "disabled";
+	};
+
+	fimc@11810000 {
+		status = "disabled";
+	};
+
+	fimc@11820000 {
+		status = "disabled";
+	};
+
+	fimc@11830000 {
+		status = "disabled";
+	};
+
+	csis@11880000 {
+		status = "disabled";
+	};
+
+	csis@11890000 {
+		status = "disabled";
+	};
 };
arch/arm/boot/dts/exynos4210-smdkv310.dts +28 -0
index 27afc8e..da7adb7 100644
@@ -179,4 +179,32 @@
 	i2c@138D0000 {
 		status = "disabled";
 	};
+
+	camera {
+		status = "disabled";
+	};
+
+	fimc@11800000 {
+		status = "disabled";
+	};
+
+	fimc@11810000 {
+		status = "disabled";
+	};
+
+	fimc@11820000 {
+		status = "disabled";
+	};
+
+	fimc@11830000 {
+		status = "disabled";
+	};
+
+	csis@11880000 {
+		status = "disabled";
+	};
+
+	csis@11890000 {
+		status = "disabled";
+	};
 };
arch/arm/boot/dts/exynos4210.dtsi +54 -0

60 lines not on this page · raw message

arch/arm/mach-exynos/mach-exynos4-dt.c +12 -0
index aa13ec0..6545a37 100644
@@ -70,6 +70,18 @@ static const struct of_dev_auxdata exynos4210_auxdata_lookup[] __initconst = {
 	OF_DEV_AUXDATA("samsung,s5pv210-tvmixer", S5P_PA_MIXER, "s5p-mixer", NULL),
 	OF_DEV_AUXDATA("arm,pl330", EXYNOS4_PA_PDMA0, "dma-pl330.0", NULL),
 	OF_DEV_AUXDATA("arm,pl330", EXYNOS4_PA_PDMA1, "dma-pl330.1", NULL),
+	OF_DEV_AUXDATA("samsung,exynos4210-csis", EXYNOS4_PA_MIPI_CSIS0,
+				"s5p-mipi-csis.0", NULL),
+	OF_DEV_AUXDATA("samsung,exynos4210-csis", EXYNOS4_PA_MIPI_CSIS1,
+				"s5p-mipi-csis.1", NULL),
+	OF_DEV_AUXDATA("samsung,exynos4210-fimc", EXYNOS4_PA_FIMC0,
+				"exynos4-fimc.0", NULL),
+	OF_DEV_AUXDATA("samsung,exynos4210-fimc", EXYNOS4_PA_FIMC1,
+				"exynos4-fimc.1", NULL),
+	OF_DEV_AUXDATA("samsung,exynos4210-fimc", EXYNOS4_PA_FIMC2,
+				"exynos4-fimc.2", NULL),
+	OF_DEV_AUXDATA("samsung,exynos4210-fimc", EXYNOS4_PA_FIMC3,
+				"exynos4-fimc.3", NULL),
 	{},
 };
 
Signature · 1 line
1.7.10
#33 lore raw

PATCH 9/13 media: s5k6aa: Add support for device tree based instantiation

In reply to Sylwester Nawrocki

The driver initializes all board related properties except the s_power() callback to board code. The platforms that require this callback are not supported by this driver yet for CONFIG_OF=y.

---
 .../bindings/camera/samsung-s5k6aafx.txt           |   57 +++++++++
 drivers/media/video/s5k6aa.c                       |  129 ++++++++++++++------
 2 files changed, 146 insertions(+), 40 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt
Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file +57 -0
new file mode 100644
index 0000000..6685a9c
@@ -0,0 +1,57 @@
+Samsung S5K6AAFX camera sensor
+------------------------------
+
+Required properties:
+
+- compatible : "samsung,s5k6aafx";
+- reg : base address of the device on I2C bus;
+- video-itu-601-bus : parallel bus with HSYNC and VSYNC - ITU-R BT.601;
+- vdd_core-supply : digital core voltage supply 1.5V (1.4V to 1.6V);
+- vdda-supply : analog power voltage supply 2.8V (2.6V to 3.0V);
+- vdd_reg-supply : regulator input power voltage supply 1.8V (1.7V to 1.9V)
+		   or 2.8V (2.6V to 3.0);
+- vddio-supply : I/O voltage supply 1.8V (1.65V to 1.95V)
+		 or 2.8V (2.5V to 3.1V);
+
+Optional properties:
+
+- clock-frequency : the IP's main (system bus) clock frequency in Hz, the default
+		    value when this property is not specified is 24 MHz;
+- data-lanes : number of physical lanes used (default 2 if not specified);
+- gpio-stby : specifies the S5K6AA_STBY GPIO
+- gpio-rst : specifies the S5K6AA_RST GPIO
+- samsung,s5k6aa-inv-stby : set inverted S5K6AA_STBY GPIO level;
+- samsung,s5k6aa-inv-rst : set inverted S5K6AA_RST GPIO level;
+- samsung,s5k6aa-hflip : set the default horizontal image flipping;
+- samsung,s5k6aa-vflip : set the default vertical image flipping;
+
+
+Example:
+
+	gpl2: gpio-controller@0 {
+	};
+
+	reg0: regulator@0 {
+	};
+
+	reg1: regulator@1 {
+	};
+
+	reg2: regulator@2 {
+	};
+
+	reg3: regulator@3 {
+	};
+
+	s5k6aafx@3c {
+		compatible = "samsung,s5k6aafx";
+		reg = <0x3c>;
+		clock-frequency = <24000000>;
+		gpio-rst = <&gpl2 0 2 0 3>;
+		gpio-stby = <&gpl2 1 2 0 3>;
+		video-itu-601-bus;
+		vdd_core-supply = <&reg0>;
+		vdda-supply = <&reg1>;
+		vdd_reg-supply = <&reg2>;
+		vddio-supply = <&reg3>;
+	};
drivers/media/video/s5k6aa.c +89 -40

216 lines not on this page · raw message

Signature · 1 line
1.7.10
#34 lore raw

Re: [RFC/PATCH 09/13] media: s5k6aa: Add support for device tree based instantiation

Quoted 19 lines · Sylwester Nawrocki

The driver initializes all board related properties except the s_power() callback to board code. The platforms that require this callback are not supported by this driver yet for CONFIG_OF=y.

---
 .../bindings/camera/samsung-s5k6aafx.txt           |   57 +++++++++
 drivers/media/video/s5k6aa.c                       |  129 ++++++++++++++------
 2 files changed, 146 insertions(+), 40 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt
Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file +0 -0
new file mode 100644
index 0000000..6685a9c

Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt line 7

Quoted 7 lines
Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file +7 -0
@@ -0,0 +1,57 @@
+Samsung S5K6AAFX camera sensor
+------------------------------
+
+Required properties:
+
+- compatible : "samsung,s5k6aafx";
+- reg : base address of the device on I2C bus;

You said you ended up putting your sensors outside of I2C busses, is this one of changes, that are present in your git-tree but not in this series?

Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt line 8

Quoted 1 line
Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file +1 -0
+- video-itu-601-bus : parallel bus with HSYNC and VSYNC - ITU-R BT.601;

If this is a boolean property, it cannot be required? Otherwise, as discussed in a different patch comment, this property might not be required, and if it is, I would use the same definition for both the camera interface and for sensors.

Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt line 12

Quoted 4 lines
Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file +4 -0
+- vdd_core-supply : digital core voltage supply 1.5V (1.4V to 1.6V);
+- vdda-supply : analog power voltage supply 2.8V (2.6V to 3.0V);
+- vdd_reg-supply : regulator input power voltage supply 1.8V (1.7V to 1.9V)
+		   or 2.8V (2.6V to 3.0);

I think, underscores in property names are generally frowned upon.

Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt line 20

Quoted 8 lines
Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file +8 -0
+- vddio-supply : I/O voltage supply 1.8V (1.65V to 1.95V)
+		 or 2.8V (2.5V to 3.1V);
+
+Optional properties:
+
+- clock-frequency : the IP's main (system bus) clock frequency in Hz, the default
+		    value when this property is not specified is 24 MHz;
+- data-lanes : number of physical lanes used (default 2 if not specified);

bus-width?

Quoted 4 lines
Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file +2 -0
+- gpio-stby : specifies the S5K6AA_STBY GPIO
+- gpio-rst : specifies the S5K6AA_RST GPIO

From Documentation/devicetree/bindings/gpio/gpio.txt:

<quote>
GPIO properties should be named "[<name>-]gpios".
</quote>

Quoted 2 lines
+- samsung,s5k6aa-inv-stby : set inverted S5K6AA_STBY GPIO level;
+- samsung,s5k6aa-inv-rst : set inverted S5K6AA_RST GPIO level;

Isn't this provided by GPIO flags as described in include/linux/of_gpio.h by using the OF_GPIO_ACTIVE_LOW bit?

Quoted 2 lines
+- samsung,s5k6aa-hflip : set the default horizontal image flipping;
+- samsung,s5k6aa-vflip : set the default vertical image flipping;

This is a board property, specifying how the sensor is wired and mounted on the casing, right? IIRC, libv4l has a database of these for USB cameras. So, maybe it belongs to the user-space for embedded systems too? Or at least this shouldn't be Samsung-specific?

Quoted 21 lines
Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file +21 -0
+
+
+Example:
+
+	gpl2: gpio-controller@0 {
+	};
+
+	reg0: regulator@0 {
+	};
+
+	reg1: regulator@1 {
+	};
+
+	reg2: regulator@2 {
+	};
+
+	reg3: regulator@3 {
+	};
+
+	s5k6aafx@3c {
+		compatible = "samsung,s5k6aafx";

Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt line 57

Quoted 10 lines
Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file +10 -0
+		reg = <0x3c>;
+		clock-frequency = <24000000>;
+		gpio-rst = <&gpl2 0 2 0 3>;
+		gpio-stby = <&gpl2 1 2 0 3>;
+		video-itu-601-bus;
+		vdd_core-supply = <&reg0>;
+		vdda-supply = <&reg1>;
+		vdd_reg-supply = <&reg2>;
+		vddio-supply = <&reg3>;
+	};

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#35 lore raw

Re: [RFC/PATCH 09/13] media: s5k6aa: Add support for device tree based instantiation

Hi Guennadi,

Quoted 15 lines · Guennadi Liakhovetski
Quoted 13 lines · Sylwester Nawrocki

The driver initializes all board related properties except the s_power() callback to board code. The platforms that require this callback are not supported by this driver yet for CONFIG_OF=y.

---
  .../bindings/camera/samsung-s5k6aafx.txt           |   57 +++++++++
  drivers/media/video/s5k6aa.c                       |  129 ++++++++++++++------
  2 files changed, 146 insertions(+), 40 deletions(-)

create mode 100644 Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt

Quoted 16 lines

Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt line 7

Quoted 13 lines
Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file +7 -0
new file mode 100644
index 0000000..6685a9c
@@ -0,0 +1,57 @@
+Samsung S5K6AAFX camera sensor
+------------------------------
+
+Required properties:
+
+- compatible : "samsung,s5k6aafx";
+- reg : base address of the device on I2C bus;

You said you ended up putting your sensors outside of I2C busses, is this one of changes, that are present in your git-tree but not in this series?

No, I must have been not clear enough on that. Our idea was to keep I2C slave device nodes as an I2C controller's child nodes, according to the current convention.
The 'sensor' nodes (the 'camera''s children) would only contain a phandle to a respective I2C slave node.

This implies that we cannot access I2C bus in I2C client's device probe() callback. An actual H/W access could begin only from within and after invocation of v4l2_subdev .registered callback..

Quoted 6 lines

Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt line 8

Quoted 1 line
Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file +1 -0
+- video-itu-601-bus : parallel bus with HSYNC and VSYNC - ITU-R BT.601;

If this is a boolean property, it cannot be required? Otherwise, as discussed in a different patch comment, this property might not be required, and if it is, I would use the same definition for both the camera interface and for sensors.

Yeah, that's an omission, a leftover from previous versions. It should have been 'video-bus-type', for this series.

Here is the updated binding documentation:

8<---------------------------------------------------------------------- Required properties:

- compatible : "samsung,s5k6aafx";
- reg : base address of the device on I2C bus;
- vdd_core-supply : digital core voltage supply 1.5V (1.4V to 1.6V);
- vdda-supply : analog circuits voltage supply 2.8V (2.6V to 3.0V);
- vdd_reg-supply : regulator input voltage supply 1.8V (1.7V to 1.9V)

                   or 2.8V (2.6V to 3.0);
- vddio-supply : I/O voltage supply 1.8V (1.65V to 1.95V)
                 or 2.8V (2.5V to 3.1V);
- video-bus-type : sensor video output bus type, must be one of:
                   "itu-601", "mipi-csi2";

- clock-frequency : the sensor's master clock frequency in Hz;

Optional properties:

- data-lanes : number of physical MIPI-CSI2 data lanes used

               (default is 2 when this property is not specified);

- gpios : specifies gpios connected to the sensor's reset
reset (RSTN) and standby (STBYN) pins, the order
of gpios is: <RSTN, STBYN>; If any of these gpios
is not used, its specifier shall be 0;
- samsung,s5k6aa-gpio-lvls : this property (bits [1:0]) specifies an active state of the S5K6AAFX reset and stand-by signals; the meaning of bits is: bit[1:0] = [RST, STBY], e.g. bit[1] = 0 indicates the GPIO driving the S5K6AAFX's standby pin should be set to 1 to bring the sensor out from stand-by to normal operation state.
- samsung,s5k6aa-hflip : sets the default horizontal image flipping;
- samsung,s5k6aa-vflip : sets the default vertical image flipping; 8<----------------------------------------------------------------------

Quoted 6 lines

Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt line 12

Quoted 4 lines
Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file +4 -0
+- vdd_core-supply : digital core voltage supply 1.5V (1.4V to 1.6V);
+- vdda-supply : analog power voltage supply 2.8V (2.6V to 3.0V);
+- vdd_reg-supply : regulator input power voltage supply 1.8V (1.7V to 1.9V)
+		   or 2.8V (2.6V to 3.0);

I think, underscores in property names are generally frowned upon.

Indeed, I felt something might be wrong here;) It's in this form because I just copied regulator supply names from the existing driver. And I didn't want to change them, to avoid updating them in all board files where they're used. Thanks for pointing it out, I'll fix that in next iteration.

Quoted 10 lines

Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt line 20

Quoted 8 lines
Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file +8 -0
+- vddio-supply : I/O voltage supply 1.8V (1.65V to 1.95V)
+		 or 2.8V (2.5V to 3.1V);
+
+Optional properties:
+
+- clock-frequency : the IP's main (system bus) clock frequency in Hz, the default
+		    value when this property is not specified is 24 MHz;
+- data-lanes : number of physical lanes used (default 2 if not specified);

bus-width?

OK.

Quoted 8 lines

Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt line 22

Quoted 2 lines
Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file +2 -0
+- gpio-stby : specifies the S5K6AA_STBY GPIO
+- gpio-rst : specifies the S5K6AA_RST GPIO

From Documentation/devicetree/bindings/gpio/gpio.txt:

<quote>
GPIO properties should be named "[<name>-]gpios".
</quote>

Thanks, these have been already removed in the next version, as can be seen above.

Quoted 5 lines

Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt line 24

Quoted 2 lines
Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file +2 -0
+- samsung,s5k6aa-inv-stby : set inverted S5K6AA_STBY GPIO level;
+- samsung,s5k6aa-inv-rst : set inverted S5K6AA_RST GPIO level;

Isn't this provided by GPIO flags as described in include/linux/of_gpio.h by using the OF_GPIO_ACTIVE_LOW bit?

Hmm, I wasn't aware of that. I'll see how this flag can be used.

Quoted 5 lines

Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt line 26

Quoted 2 lines
Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file +2 -0
+- samsung,s5k6aa-hflip : set the default horizontal image flipping;
+- samsung,s5k6aa-vflip : set the default vertical image flipping;

This is a board property, specifying how the sensor is wired and mounted on the casing, right? IIRC, libv4l has a database of these for USB

Yeah, that's exactly it. It could be used for compensating for an "upside down" mounting.

Quoted 1 line

cameras. So, maybe it belongs to the user-space for embedded systems too?

Using library for these things is one of the solutions, which works well for USB webcams. However, I wouldn't like enforcing that. Those properties still describe hardware IHMO, then why not add them into DT blob that is usually distributed with each board ? There wouldn't be a need to rely on any user-space database lookup, before the hardware can actually be used.

Quoted 1 line

Or at least this shouldn't be Samsung-specific?

Yes, good point. If we agree we can keep them, perhaps we could standardize those as boolean properties: horizontal-flip; and vertical-flip; ?

--

Thanks,
Sylwester

#36 lore raw

Re: [RFC/PATCH 09/13] media: s5k6aa: Add support for device tree based instantiation

Hi Sylwester,

Quoted 42 lines · On Wednesday 18 July 2012 11:18:33 Sylwester Nawrocki wrote:
Quoted 26 lines · Guennadi Liakhovetski
Quoted 25 lines · Sylwester Nawrocki

The driver initializes all board related properties except the s_power() callback to board code. The platforms that require this callback are not supported by this driver yet for CONFIG_OF=y.

---

  .../bindings/camera/samsung-s5k6aafx.txt           |   57 +++++++++
  drivers/media/video/s5k6aa.c                       |  129

++++++++++++++------ 2 files changed, 146 insertions(+), 40 deletions(-)
create mode 100644 Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt>>
diff --git a/Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt b/Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file mode 100644
index 0000000..6685a9c

Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file +2 -0
@@ -0,0 +1,57 @@
+Samsung S5K6AAFX camera sensor
+------------------------------
Quoted 8 lines

Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt line 7

Quoted 5 lines
Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file +5 -0
+
+Required properties:
+
+- compatible : "samsung,s5k6aafx";
+- reg : base address of the device on I2C bus;

You said you ended up putting your sensors outside of I2C busses, is this one of changes, that are present in your git-tree but not in this series?

No, I must have been not clear enough on that. Our idea was to keep I2C slave device nodes as an I2C controller's child nodes, according to the current convention.
The 'sensor' nodes (the 'camera''s children) would only contain a phandle to a respective I2C slave node.

Quoted 3 lines

This implies that we cannot access I2C bus in I2C client's device probe() callback. An actual H/W access could begin only from within and after invocation of v4l2_subdev .registered callback..

That's how I've envisioned the DT bindings for sensors as well, this sounds good. The real challenge will be to get hold of the subdev to register it without race conditions.

Quoted 98 lines
Quoted 6 lines

Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt line 8

Quoted 1 line
Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file +1 -0
+- video-itu-601-bus : parallel bus with HSYNC and VSYNC - ITU-R BT.601;

If this is a boolean property, it cannot be required? Otherwise, as discussed in a different patch comment, this property might not be required, and if it is, I would use the same definition for both the camera interface and for sensors.

Yeah, that's an omission, a leftover from previous versions. It should have been 'video-bus-type', for this series.

Here is the updated binding documentation:

8<---------------------------------------------------------------------- Required properties:

- compatible : "samsung,s5k6aafx";
- reg : base address of the device on I2C bus;
- vdd_core-supply : digital core voltage supply 1.5V (1.4V to 1.6V);
- vdda-supply : analog circuits voltage supply 2.8V (2.6V to 3.0V);
- vdd_reg-supply : regulator input voltage supply 1.8V (1.7V to 1.9V)

                   or 2.8V (2.6V to 3.0);
- vddio-supply : I/O voltage supply 1.8V (1.65V to 1.95V)
                 or 2.8V (2.5V to 3.1V);
- video-bus-type : sensor video output bus type, must be one of:
                   "itu-601", "mipi-csi2";

- clock-frequency : the sensor's master clock frequency in Hz;

Optional properties:

- data-lanes : number of physical MIPI-CSI2 data lanes used

               (default is 2 when this property is not specified);

- gpios : specifies gpios connected to the sensor's reset
reset (RSTN) and standby (STBYN) pins, the order
of gpios is: <RSTN, STBYN>; If any of these gpios
is not used, its specifier shall be 0;
- samsung,s5k6aa-gpio-lvls : this property (bits [1:0]) specifies an active state of the S5K6AAFX reset and stand-by
signals; the meaning of bits is: bit[1:0] = [RST, STBY], e.g. bit[1] = 0 indicates the GPIO driving the S5K6AAFX's standby pin should be set to 1 to bring the sensor out from stand-by to normal operation state.
- samsung,s5k6aa-hflip : sets the default horizontal image flipping;
- samsung,s5k6aa-vflip : sets the default vertical image flipping; 8<----------------------------------------------------------------------

Quoted 6 lines
Quoted 4 lines
Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file +3 -0
+- vdd_core-supply : digital core voltage supply 1.5V (1.4V to 1.6V);
+- vdda-supply : analog power voltage supply 2.8V (2.6V to 3.0V);
+- vdd_reg-supply : regulator input power voltage supply 1.8V (1.7V to

1.9V) + or 2.8V (2.6V to 3.0);

I think, underscores in property names are generally frowned upon.

Indeed, I felt something might be wrong here;) It's in this form because I just copied regulator supply names from the existing driver. And I didn't want to change them, to avoid updating them in all board files where they're used. Thanks for pointing it out, I'll fix that in next iteration.

Quoted 11 lines
Quoted 9 lines

+- vddio-supply : I/O voltage supply 1.8V (1.65V to 1.95V)

Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file +5 -0
+		 or 2.8V (2.5V to 3.1V);
+
+Optional properties:
+
+- clock-frequency : the IP's main (system bus) clock frequency in Hz,

the default + value when this property is not specified is 24 MHz;
+- data-lanes : number of physical lanes used (default 2 if not specified);

bus-width?

OK.

Quoted 7 lines
Quoted 3 lines
+- gpio-stby : specifies the S5K6AA_STBY GPIO
+- gpio-rst : specifies the S5K6AA_RST GPIO

From Documentation/devicetree/bindings/gpio/gpio.txt:
<quote>
GPIO properties should be named "[<name>-]gpios". </quote>

Thanks, these have been already removed in the next version, as can be seen above.

Quoted 5 lines
Quoted 2 lines
+- samsung,s5k6aa-inv-stby : set inverted S5K6AA_STBY GPIO level;
+- samsung,s5k6aa-inv-rst : set inverted S5K6AA_RST GPIO level;

Isn't this provided by GPIO flags as described in include/linux/of_gpio.h by using the OF_GPIO_ACTIVE_LOW bit?

Hmm, I wasn't aware of that. I'll see how this flag can be used.

Quoted 5 lines
Quoted 2 lines
+- samsung,s5k6aa-hflip : set the default horizontal image flipping;
+- samsung,s5k6aa-vflip : set the default vertical image flipping;

This is a board property, specifying how the sensor is wired and mounted on the casing, right? IIRC, libv4l has a database of these for USB

Yeah, that's exactly it. It could be used for compensating for an "upside down" mounting.

Quoted 7 lines
Quoted 1 line

cameras. So, maybe it belongs to the user-space for embedded systems too?

Using library for these things is one of the solutions, which works well for USB webcams. However, I wouldn't like enforcing that. Those properties still describe hardware IHMO, then why not add them into DT blob that is usually distributed with each board ? There wouldn't be a need to rely on any user-space database lookup, before the hardware can actually be used.

I agree. For USB devices on x86 we don't have many other options, but with DT we can describe the hardware properly.

Quoted 4 lines
Quoted 1 line

Or at least this shouldn't be Samsung-specific?

Yes, good point. If we agree we can keep them, perhaps we could standardize those as boolean properties: horizontal-flip; and vertical-flip; ?

Signature · 3 lines
Regards,

Laurent Pinchart
#37 lore raw

Re: [RFC/PATCH 09/13] media: s5k6aa: Add support for device tree based instantiation

Quoted 45 lines · Laurent Pinchart

Hi Sylwester,

Quoted 42 lines · On Wednesday 18 July 2012 11:18:33 Sylwester Nawrocki wrote:
Quoted 26 lines · Guennadi Liakhovetski
Quoted 25 lines · Sylwester Nawrocki

The driver initializes all board related properties except the s_power() callback to board code. The platforms that require this callback are not supported by this driver yet for CONFIG_OF=y.

---

  .../bindings/camera/samsung-s5k6aafx.txt           |   57 +++++++++
  drivers/media/video/s5k6aa.c                       |  129

++++++++++++++------ 2 files changed, 146 insertions(+), 40 deletions(-)
create mode 100644 Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt>>
diff --git a/Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt b/Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file mode 100644
index 0000000..6685a9c

Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file +2 -0
@@ -0,0 +1,57 @@
+Samsung S5K6AAFX camera sensor
+------------------------------
Quoted 8 lines

Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt line 7

Quoted 5 lines
Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file +5 -0
+
+Required properties:
+
+- compatible : "samsung,s5k6aafx";
+- reg : base address of the device on I2C bus;

You said you ended up putting your sensors outside of I2C busses, is this one of changes, that are present in your git-tree but not in this series?

No, I must have been not clear enough on that. Our idea was to keep I2C slave device nodes as an I2C controller's child nodes, according to the current convention.
The 'sensor' nodes (the 'camera''s children) would only contain a phandle to a respective I2C slave node.

Quoted 7 lines
Quoted 3 lines

This implies that we cannot access I2C bus in I2C client's device probe() callback. An actual H/W access could begin only from within and after invocation of v4l2_subdev .registered callback..

That's how I've envisioned the DT bindings for sensors as well, this sounds good. The real challenge will be to get hold of the subdev to register it without race conditions.

Hrm... That's how early pre-subdev versions of soc-camera used to work, that's where all the <device>_video_probe() functions come from. But then we switched to dynamic i2c device registration. Do we want to switch all drivers back now?... Couldn't we "temporarily" use references from subdevs to hosts until the clock API is available?

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#38 lore raw

Re: [RFC/PATCH 09/13] media: s5k6aa: Add support for device tree based instantiation

Hi Guennadi,

Quoted 56 lines · On Tuesday 31 July 2012 11:56:44 Guennadi Liakhovetski wrote:
Quoted 47 lines · Laurent Pinchart
Quoted 46 lines · On Wednesday 18 July 2012 11:18:33 Sylwester Nawrocki wrote:
Quoted 30 lines · Guennadi Liakhovetski
Quoted 29 lines · Sylwester Nawrocki

The driver initializes all board related properties except the s_power() callback to board code. The platforms that require this callback are not supported by this driver yet for CONFIG_OF=y.

---

  .../bindings/camera/samsung-s5k6aafx.txt           |   57 +++++++++
  drivers/media/video/s5k6aa.c                       |  129

++++++++++++++------ 2 files changed, 146 insertions(+), 40 deletions(-)
create mode 100644 Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt>>

diff --git a/Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt b/Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file
mode 100644
index 0000000..6685a9c

Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file +4 -0
@@ -0,0 +1,57 @@
+Samsung S5K6AAFX camera sensor
+------------------------------
+
+Required properties:
Quoted 8 lines

Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt line 7

Quoted 3 lines
Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file +3 -0
+
+- compatible : "samsung,s5k6aafx";
+- reg : base address of the device on I2C bus;

You said you ended up putting your sensors outside of I2C busses, is this
one of changes, that are present in your git-tree but not in this series?

No, I must have been not clear enough on that. Our idea was to keep I2C slave device nodes as an I2C controller's child nodes, according to the current convention.
The 'sensor' nodes (the 'camera''s children) would only contain a phandle to a respective I2C slave node.

Quoted 7 lines
Quoted 3 lines

This implies that we cannot access I2C bus in I2C client's device probe() callback. An actual H/W access could begin only from within and after invocation of v4l2_subdev .registered callback..

That's how I've envisioned the DT bindings for sensors as well, this sounds good. The real challenge will be to get hold of the subdev to register it without race conditions.

Quoted 5 lines

Hrm... That's how early pre-subdev versions of soc-camera used to work, that's where all the <device>_video_probe() functions come from. But then we switched to dynamic i2c device registration. Do we want to switch all drivers back now?... Couldn't we "temporarily" use references from subdevs to hosts until the clock API is available?

I don't think that requires a reference from subdevs to hosts in the DT. The subdev will need the host to be probed before a clock can be available so you won't be able to access the hardware in the probe() function in the generic case. You will need to wait until the registered() subdev operation is called, at which point the host can be accessed through the v4l2_device.

Signature · 3 lines
Regards,

Laurent Pinchart
#39 lore raw

Re: [RFC/PATCH 09/13] media: s5k6aa: Add support for device tree based instantiation

Quoted 65 lines · Laurent Pinchart

Hi Guennadi,

Quoted 56 lines · On Tuesday 31 July 2012 11:56:44 Guennadi Liakhovetski wrote:
Quoted 47 lines · Laurent Pinchart
Quoted 46 lines · On Wednesday 18 July 2012 11:18:33 Sylwester Nawrocki wrote:
Quoted 30 lines · Guennadi Liakhovetski
Quoted 29 lines · Sylwester Nawrocki

The driver initializes all board related properties except the s_power() callback to board code. The platforms that require this callback are not supported by this driver yet for CONFIG_OF=y.

---

  .../bindings/camera/samsung-s5k6aafx.txt           |   57 +++++++++
  drivers/media/video/s5k6aa.c                       |  129

++++++++++++++------ 2 files changed, 146 insertions(+), 40 deletions(-)
create mode 100644 Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt>>

diff --git a/Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt b/Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file
mode 100644
index 0000000..6685a9c

Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file +4 -0
@@ -0,0 +1,57 @@
+Samsung S5K6AAFX camera sensor
+------------------------------
+
+Required properties:
Quoted 8 lines

Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt line 7

Quoted 3 lines
Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file +3 -0
+
+- compatible : "samsung,s5k6aafx";
+- reg : base address of the device on I2C bus;

You said you ended up putting your sensors outside of I2C busses, is this
one of changes, that are present in your git-tree but not in this series?

No, I must have been not clear enough on that. Our idea was to keep I2C slave device nodes as an I2C controller's child nodes, according to the current convention.
The 'sensor' nodes (the 'camera''s children) would only contain a phandle to a respective I2C slave node.

Quoted 7 lines
Quoted 3 lines

This implies that we cannot access I2C bus in I2C client's device probe() callback. An actual H/W access could begin only from within and after invocation of v4l2_subdev .registered callback..

That's how I've envisioned the DT bindings for sensors as well, this sounds good. The real challenge will be to get hold of the subdev to register it without race conditions.

Quoted 5 lines

Hrm... That's how early pre-subdev versions of soc-camera used to work, that's where all the <device>_video_probe() functions come from. But then we switched to dynamic i2c device registration. Do we want to switch all drivers back now?... Couldn't we "temporarily" use references from subdevs to hosts until the clock API is available?

Quoted 5 lines

I don't think that requires a reference from subdevs to hosts in the DT. The subdev will need the host to be probed before a clock can be available so you won't be able to access the hardware in the probe() function in the generic case. You will need to wait until the registered() subdev operation is called, at which point the host can be accessed through the v4l2_device.

Sure, I understand, but that's exactly what we wanted to avoid - succeeding client's i2c .probe() without even touching the hardware.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#40 lore raw

Re: [RFC/PATCH 09/13] media: s5k6aa: Add support for device tree based instantiation

Hi Guennadi,

Quoted 74 lines · On Tuesday 31 July 2012 13:14:13 Guennadi Liakhovetski wrote:
Quoted 66 lines · Laurent Pinchart
Quoted 59 lines · On Tuesday 31 July 2012 11:56:44 Guennadi Liakhovetski wrote:
Quoted 50 lines · Laurent Pinchart
Quoted 49 lines · On Wednesday 18 July 2012 11:18:33 Sylwester Nawrocki wrote:
Quoted 33 lines · Guennadi Liakhovetski
Quoted 32 lines · Sylwester Nawrocki

The driver initializes all board related properties except the s_power() callback to board code. The platforms that require this callback are not supported by this driver yet for CONFIG_OF=y.

Signed-off-by Bartlomiej

Zolnierkiewicz<[email protected]>

---

  .../bindings/camera/samsung-s5k6aafx.txt           |   57
  +++++++++
  drivers/media/video/s5k6aa.c                       |  129

++++++++++++++------ 2 files changed, 146 insertions(+), 40 deletions(-)
create mode 100644 Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt>>

diff --git a/Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt b/Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new
file
mode 100644
index 0000000..6685a9c
--- /dev/null
+++
b/Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt

(quoted diff) +3 -0
@@ -0,0 +1,57 @@
+Samsung S5K6AAFX camera sensor
+------------------------------
+
Quoted 8 lines

Review line 7

Quoted 4 lines
(quoted diff) +4 -0
+Required properties:
+
+- compatible : "samsung,s5k6aafx";
+- reg : base address of the device on I2C bus;

You said you ended up putting your sensors outside of I2C busses, is this one of changes, that are present in your git-tree but not in this series?

No, I must have been not clear enough on that. Our idea was to keep I2C slave device nodes as an I2C controller's child nodes, according to the current convention.
The 'sensor' nodes (the 'camera''s children) would only contain a phandle to a respective I2C slave node.

Quoted 7 lines
Quoted 3 lines

This implies that we cannot access I2C bus in I2C client's device probe() callback. An actual H/W access could begin only from within and after invocation of v4l2_subdev .registered callback..

That's how I've envisioned the DT bindings for sensors as well, this sounds good. The real challenge will be to get hold of the subdev to register it without race conditions.

Quoted 5 lines

Hrm... That's how early pre-subdev versions of soc-camera used to work, that's where all the <device>_video_probe() functions come from. But then we switched to dynamic i2c device registration. Do we want to switch all drivers back now?... Couldn't we "temporarily" use references from subdevs to hosts until the clock API is available?

Quoted 6 lines

I don't think that requires a reference from subdevs to hosts in the DT. The subdev will need the host to be probed before a clock can be available so you won't be able to access the hardware in the probe() function in the generic case. You will need to wait until the registered() subdev operation is called, at which point the host can be accessed through the v4l2_device.

Quoted 2 lines

Sure, I understand, but that's exactly what we wanted to avoid - succeeding client's i2c .probe() without even touching the hardware.

But should we allow host probe() to succeed if the sensor isn't present ?

Signature · 3 lines
Regards,

Laurent Pinchart
#41 lore raw

Re: [RFC/PATCH 09/13] media: s5k6aa: Add support for device tree based instantiation

Quoted 77 lines · Laurent Pinchart

Hi Guennadi,

Quoted 74 lines · On Tuesday 31 July 2012 13:14:13 Guennadi Liakhovetski wrote:
Quoted 72 lines · Laurent Pinchart
Quoted 59 lines · On Tuesday 31 July 2012 11:56:44 Guennadi Liakhovetski wrote:
Quoted 50 lines · Laurent Pinchart
Quoted 49 lines · On Wednesday 18 July 2012 11:18:33 Sylwester Nawrocki wrote:
Quoted 33 lines · Guennadi Liakhovetski
Quoted 32 lines · Sylwester Nawrocki

The driver initializes all board related properties except the s_power() callback to board code. The platforms that require this callback are not supported by this driver yet for CONFIG_OF=y.

Signed-off-by Bartlomiej

Zolnierkiewicz<[email protected]>

---

  .../bindings/camera/samsung-s5k6aafx.txt           |   57
  +++++++++
  drivers/media/video/s5k6aa.c                       |  129

++++++++++++++------ 2 files changed, 146 insertions(+), 40 deletions(-)
create mode 100644 Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt>>

diff --git a/Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt b/Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new
file
mode 100644
index 0000000..6685a9c
--- /dev/null
+++
b/Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt

(quoted diff) +3 -0
@@ -0,0 +1,57 @@
+Samsung S5K6AAFX camera sensor
+------------------------------
+
Quoted 8 lines

Review line 7

Quoted 4 lines
(quoted diff) +4 -0
+Required properties:
+
+- compatible : "samsung,s5k6aafx";
+- reg : base address of the device on I2C bus;

You said you ended up putting your sensors outside of I2C busses, is this one of changes, that are present in your git-tree but not in this series?

No, I must have been not clear enough on that. Our idea was to keep I2C slave device nodes as an I2C controller's child nodes, according to the current convention.
The 'sensor' nodes (the 'camera''s children) would only contain a phandle to a respective I2C slave node.

Quoted 7 lines
Quoted 3 lines

This implies that we cannot access I2C bus in I2C client's device probe() callback. An actual H/W access could begin only from within and after invocation of v4l2_subdev .registered callback..

That's how I've envisioned the DT bindings for sensors as well, this sounds good. The real challenge will be to get hold of the subdev to register it without race conditions.

Quoted 5 lines

Hrm... That's how early pre-subdev versions of soc-camera used to work, that's where all the <device>_video_probe() functions come from. But then we switched to dynamic i2c device registration. Do we want to switch all drivers back now?... Couldn't we "temporarily" use references from subdevs to hosts until the clock API is available?

I don't think that requires a reference from subdevs to hosts in the DT. The subdev will need the host to be probed before a clock can be available so you won't be able to access the hardware in the probe() function in the generic case. You will need to wait until the registered() subdev operation is called, at which point the host can be accessed through the v4l2_device.

Quoted 4 lines
Quoted 2 lines

Sure, I understand, but that's exactly what we wanted to avoid - succeeding client's i2c .probe() without even touching the hardware.

But should we allow host probe() to succeed if the sensor isn't present ?

I think we should, yes. The host hardware is there and functional - whether or not all or some of the clients are failing. Theoretically clients can also be hot-plugged. Whether and how many video device nodes we create, that's a different question.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#42 lore raw

Re: [RFC/PATCH 09/13] media: s5k6aa: Add support for device tree based instantiation

Hi Guennadi,

Quoted 86 lines · On Tuesday 31 July 2012 13:29:55 Guennadi Liakhovetski wrote:
Quoted 85 lines · Laurent Pinchart
Quoted 83 lines · On Tuesday 31 July 2012 13:14:13 Guennadi Liakhovetski wrote:
Quoted 73 lines · Laurent Pinchart
Quoted 65 lines · On Tuesday 31 July 2012 11:56:44 Guennadi Liakhovetski wrote:
Quoted 55 lines · Laurent Pinchart
Quoted 54 lines · On Wednesday 18 July 2012 11:18:33 Sylwester Nawrocki wrote:
Quoted 38 lines · Guennadi Liakhovetski
Quoted 37 lines · Sylwester Nawrocki

The driver initializes all board related properties except the s_power() callback to board code. The platforms that require this callback are not supported by this driver yet for CONFIG_OF=y.

Signed-off-by Bartlomiej

Zolnierkiewicz<[email protected]>

---

  .../bindings/camera/samsung-s5k6aafx.txt           |   57
  +++++++++
  drivers/media/video/s5k6aa.c                       |  129

++++++++++++++------ 2 files changed, 146 insertions(+), 40 deletions(-)
create mode 100644 Documentation/devicetree/bindings/camera/samsung-s5k6aafx.t xt>>

diff --git a/Documentation/devicetree/bindings/camera/samsung-s5k6aafx.t xt b/Documentation/devicetree/bindings/camera/samsung-s5k6aafx.t xt
new
file
mode 100644
index 0000000..6685a9c
--- /dev/null
+++
b/Documentation/devicetree/bindings/camera/samsung-s5k6aafx.t xt

(quoted diff) +3 -0
@@ -0,0 +1,57 @@
+Samsung S5K6AAFX camera sensor
+------------------------------
+
Quoted 8 lines

Review line 7

Quoted 4 lines
(quoted diff) +4 -0
+Required properties:
+
+- compatible : "samsung,s5k6aafx";
+- reg : base address of the device on I2C bus;

You said you ended up putting your sensors outside of I2C busses, is this one of changes, that are present in your git- tree but not in this series?

No, I must have been not clear enough on that. Our idea was to keep I2C slave device nodes as an I2C controller's child nodes, according to the current convention. The 'sensor' nodes (the 'camera''s children) would only contain a phandle to a respective I2C slave node.

Quoted 8 lines
Quoted 4 lines

This implies that we cannot access I2C bus in I2C client's device probe() callback. An actual H/W access could begin only from within and after invocation of v4l2_subdev .registered callback..

That's how I've envisioned the DT bindings for sensors as well, this sounds good. The real challenge will be to get hold of the subdev to register it without race conditions.

Quoted 6 lines

Hrm... That's how early pre-subdev versions of soc-camera used to work, that's where all the <device>_video_probe() functions come from. But then we switched to dynamic i2c device registration. Do we want to switch all drivers back now?... Couldn't we "temporarily" use references from subdevs to hosts until the clock API is available?

Quoted 6 lines

I don't think that requires a reference from subdevs to hosts in the DT. The subdev will need the host to be probed before a clock can be available so you won't be able to access the hardware in the probe() function in the generic case. You will need to wait until the registered() subdev operation is called, at which point the host can be accessed through the v4l2_device.

Sure, I understand, but that's exactly what we wanted to avoid - succeeding client's i2c .probe() without even touching the hardware.

Quoted 6 lines
Quoted 1 line

But should we allow host probe() to succeed if the sensor isn't present ?

I think we should, yes. The host hardware is there and functional - whether or not all or some of the clients are failing. Theoretically clients can also be hot-plugged. Whether and how many video device nodes we create, that's a different question.

I think I can agree with you on this (although I could change my mind if this architecture turns out to result in unsolvable technical issues). That will involve a lot of work though.

Signature · 3 lines
Regards,

Laurent Pinchart
#43 lore raw

Re: [RFC/PATCH 09/13] media: s5k6aa: Add support for device tree based instantiation

Quoted 91 lines · Laurent Pinchart

Hi Guennadi,

Quoted 88 lines · On Tuesday 31 July 2012 13:29:55 Guennadi Liakhovetski wrote:
Quoted 86 lines · Laurent Pinchart
Quoted 81 lines · On Tuesday 31 July 2012 13:14:13 Guennadi Liakhovetski wrote:
Quoted 73 lines · Laurent Pinchart
Quoted 65 lines · On Tuesday 31 July 2012 11:56:44 Guennadi Liakhovetski wrote:
Quoted 55 lines · Laurent Pinchart
Quoted 54 lines · On Wednesday 18 July 2012 11:18:33 Sylwester Nawrocki wrote:
Quoted 38 lines · Guennadi Liakhovetski
Quoted 37 lines · Sylwester Nawrocki

The driver initializes all board related properties except the s_power() callback to board code. The platforms that require this callback are not supported by this driver yet for CONFIG_OF=y.

Signed-off-by Bartlomiej

Zolnierkiewicz<[email protected]>

---

  .../bindings/camera/samsung-s5k6aafx.txt           |   57
  +++++++++
  drivers/media/video/s5k6aa.c                       |  129

++++++++++++++------ 2 files changed, 146 insertions(+), 40 deletions(-)
create mode 100644 Documentation/devicetree/bindings/camera/samsung-s5k6aafx.t xt>>

diff --git a/Documentation/devicetree/bindings/camera/samsung-s5k6aafx.t xt b/Documentation/devicetree/bindings/camera/samsung-s5k6aafx.t xt
new
file
mode 100644
index 0000000..6685a9c
--- /dev/null
+++
b/Documentation/devicetree/bindings/camera/samsung-s5k6aafx.t xt

(quoted diff) +3 -0
@@ -0,0 +1,57 @@
+Samsung S5K6AAFX camera sensor
+------------------------------
+
Quoted 8 lines

Review line 7

Quoted 4 lines
(quoted diff) +4 -0
+Required properties:
+
+- compatible : "samsung,s5k6aafx";
+- reg : base address of the device on I2C bus;

You said you ended up putting your sensors outside of I2C busses, is this one of changes, that are present in your git- tree but not in this series?

No, I must have been not clear enough on that. Our idea was to keep I2C slave device nodes as an I2C controller's child nodes, according to the current convention. The 'sensor' nodes (the 'camera''s children) would only contain a phandle to a respective I2C slave node.

Quoted 8 lines
Quoted 4 lines

This implies that we cannot access I2C bus in I2C client's device probe() callback. An actual H/W access could begin only from within and after invocation of v4l2_subdev .registered callback..

That's how I've envisioned the DT bindings for sensors as well, this sounds good. The real challenge will be to get hold of the subdev to register it without race conditions.

Quoted 6 lines

Hrm... That's how early pre-subdev versions of soc-camera used to work, that's where all the <device>_video_probe() functions come from. But then we switched to dynamic i2c device registration. Do we want to switch all drivers back now?... Couldn't we "temporarily" use references from subdevs to hosts until the clock API is available?

Quoted 6 lines

I don't think that requires a reference from subdevs to hosts in the DT. The subdev will need the host to be probed before a clock can be available so you won't be able to access the hardware in the probe() function in the generic case. You will need to wait until the registered() subdev operation is called, at which point the host can be accessed through the v4l2_device.

Quoted 2 lines

Sure, I understand, but that's exactly what we wanted to avoid - succeeding client's i2c .probe() without even touching the hardware.

But should we allow host probe() to succeed if the sensor isn't present ?

Quoted 8 lines
Quoted 4 lines

I think we should, yes. The host hardware is there and functional - whether or not all or some of the clients are failing. Theoretically clients can also be hot-plugged. Whether and how many video device nodes we create, that's a different question.

I think I can agree with you on this (although I could change my mind if this architecture turns out to result in unsolvable technical issues). That will involve a lot of work though.

There's however at least one more gotcha that occurs to me with this
approach: if clients fail to probe, how do we find out about that and turn clocks back off? One improvement to turning clocks on immediately in host's probe() is to only do it in a BUS_NOTIFY_BIND_DRIVER notifier. But how do we find out, that probing failed? No notifier is called in this case. We could use a time-out, but that's ugly. I think, we could ever request a new notifier for this case. We could also require client drivers to call a V4L2 function in this case, but that's not very pretty either.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#44 lore raw

Re: [RFC/PATCH 09/13] media: s5k6aa: Add support for device tree based instantiation

Quoted 7 lines · Guennadi Liakhovetski
Quoted 7 lines
Quoted 6 lines
Quoted 1 line

But should we allow host probe() to succeed if the sensor isn't present ?

I think we should, yes. The host hardware is there and functional - whether or not all or some of the clients are failing. Theoretically clients can also be hot-plugged. Whether and how many video device nodes we create, that's a different question.

Quoted 7 lines
Quoted 3 lines

I think I can agree with you on this (although I could change my mind if this architecture turns out to result in unsolvable technical issues). That will involve a lot of work though.

There's however at least one more gotcha that occurs to me with this
approach: if clients fail to probe, how do we find out about that and turn clocks back off? One improvement to turning clocks on immediately in

Hmm, wouldn't it be the client that turns a clock on/off when needed ? I'd like to preserve this functionality, so client drivers can have full control on the power up/down sequences. While we are trying to improve the current situation...

Quoted 5 lines

host's probe() is to only do it in a BUS_NOTIFY_BIND_DRIVER notifier. But how do we find out, that probing failed? No notifier is called in this case. We could use a time-out, but that's ugly. I think, we could ever request a new notifier for this case. We could also require client drivers to call a V4L2 function in this case, but that's not very pretty either.

--

Regards,
Sylwester

#45 lore raw

Re: [RFC/PATCH 09/13] media: s5k6aa: Add support for device tree based instantiation

Quoted 12 lines · Sylwester Nawrocki
Quoted 11 lines · Guennadi Liakhovetski
Quoted 10 lines
Quoted 6 lines
Quoted 1 line

But should we allow host probe() to succeed if the sensor isn't present ?

I think we should, yes. The host hardware is there and functional - whether or not all or some of the clients are failing. Theoretically clients can also be hot-plugged. Whether and how many video device nodes we create, that's a different question.

I think I can agree with you on this (although I could change my mind if this architecture turns out to result in unsolvable technical issues). That will involve a lot of work though.

Quoted 8 lines
Quoted 3 lines

There's however at least one more gotcha that occurs to me with this
approach: if clients fail to probe, how do we find out about that and turn clocks back off? One improvement to turning clocks on immediately in

Hmm, wouldn't it be the client that turns a clock on/off when needed ? I'd like to preserve this functionality, so client drivers can have full control on the power up/down sequences. While we are trying to improve the current situation...

Eventually, when the clock API is available - yes, the client would just call clk_enable() / clk_disable(). But for now isn't it host's job to do that? Or you want to add new API for that?

Thanks
Guennadi

Quoted 5 lines
Quoted 5 lines

host's probe() is to only do it in a BUS_NOTIFY_BIND_DRIVER notifier. But how do we find out, that probing failed? No notifier is called in this case. We could use a time-out, but that's ugly. I think, we could ever request a new notifier for this case. We could also require client drivers to call a V4L2 function in this case, but that's not very pretty either.

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#46 lore raw

Re: [RFC/PATCH 09/13] media: s5k6aa: Add support for device tree based instantiation

Quoted 17 lines · Guennadi Liakhovetski
Quoted 16 lines · Sylwester Nawrocki
Quoted 14 lines · Guennadi Liakhovetski
Quoted 10 lines
Quoted 6 lines
Quoted 1 line

But should we allow host probe() to succeed if the sensor isn't present ?

I think we should, yes. The host hardware is there and functional - whether or not all or some of the clients are failing. Theoretically clients can also be hot-plugged. Whether and how many video device nodes we create, that's a different question.

I think I can agree with you on this (although I could change my mind if this architecture turns out to result in unsolvable technical issues). That will involve a lot of work though.

There's however at least one more gotcha that occurs to me with this
approach: if clients fail to probe, how do we find out about that and turn clocks back off? One improvement to turning clocks on immediately in

Quoted 8 lines
Quoted 4 lines

Hmm, wouldn't it be the client that turns a clock on/off when needed ? I'd like to preserve this functionality, so client drivers can have full control on the power up/down sequences. While we are trying to improve the current situation...

Eventually, when the clock API is available - yes, the client would just call clk_enable() / clk_disable(). But for now isn't it host's job to do that? Or you want to add new API for that?

Indeed, looking at existing drivers, the clocks' handling is now mostly done in the host drivers. Only the omap3isp appears to do the right thing, i.e. delegating control over the clock to client drivers, but it does it with platform_data callbacks.

We've already discussed adding a new API for that,
http://www.mail-archive.com/[email protected]/msg35359.html

However using common clock API and binding a clock to client device (either DT based or not) sounds like a best approach to me.

Waiting for the common clock API to be generally available maybe we could add some clock ops at the v4l2_device ? Just a humble suggestion, I'm not sure whether it is really good and needed or not.

--

Thanks,
Sylwester

#47 lore raw

Re: [RFC/PATCH 09/13] media: s5k6aa: Add support for device tree based instantiation

Hi Sylwester,

Quoted 38 lines · On Tuesday 31 July 2012 15:28:52 Sylwester Nawrocki wrote:
Quoted 20 lines · Guennadi Liakhovetski
Quoted 19 lines · Sylwester Nawrocki
Quoted 17 lines · Guennadi Liakhovetski
Quoted 9 lines
Quoted 8 lines
Quoted 2 lines

But should we allow host probe() to succeed if the sensor isn't present ?

I think we should, yes. The host hardware is there and functional - whether or not all or some of the clients are failing. Theoretically clients can also be hot-plugged. Whether and how many video device nodes
we create, that's a different question.

Quoted 3 lines

I think I can agree with you on this (although I could change my mind if this architecture turns out to result in unsolvable technical issues). That will involve a lot of work though.

There's however at least one more gotcha that occurs to me with this
approach: if clients fail to probe, how do we find out about that and turn
clocks back off? One improvement to turning clocks on immediately in

Quoted 8 lines
Quoted 4 lines

Hmm, wouldn't it be the client that turns a clock on/off when needed ? I'd like to preserve this functionality, so client drivers can have full control on the power up/down sequences. While we are trying to improve the current situation...

Eventually, when the clock API is available - yes, the client would just call clk_enable() / clk_disable(). But for now isn't it host's job to do that? Or you want to add new API for that?

Indeed, looking at existing drivers, the clocks' handling is now mostly done in the host drivers. Only the omap3isp appears to do the right thing, i.e. delegating control over the clock to client drivers, but it does it with platform_data callbacks.

We've already discussed adding a new API for that,
http://www.mail-archive.com/[email protected]/msg35359.html

Quoted 6 lines

However using common clock API and binding a clock to client device (either DT based or not) sounds like a best approach to me.

Waiting for the common clock API to be generally available maybe we could add some clock ops at the v4l2_device ? Just a humble suggestion, I'm not sure whether it is really good and needed or not.

I'm fine with that (or something similar) as an interim solution.

Signature · 3 lines
Regards,

Laurent Pinchart
#48 lore raw

Re: [RFC/PATCH 09/13] media: s5k6aa: Add support for device tree based instantiation

In reply to Sylwester Nawrocki

Hi Sylwester,

Quoted 39 lines · On Friday 25 May 2012 21:52:48 Sylwester Nawrocki wrote:

The driver initializes all board related properties except the s_power() callback to board code. The platforms that require this callback are not supported by this driver yet for CONFIG_OF=y.

---
 .../bindings/camera/samsung-s5k6aafx.txt           |   57 +++++++++
 drivers/media/video/s5k6aa.c                       |  129 ++++++++++++-----
 2 files changed, 146 insertions(+), 40 deletions(-)
 create mode 100644

Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt

(quoted diff) +0 -0

b/Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file mode 100644
index 0000000..6685a9c

Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file +18 -0
@@ -0,0 +1,57 @@
+Samsung S5K6AAFX camera sensor
+------------------------------
+
+Required properties:
+
+- compatible : "samsung,s5k6aafx";
+- reg : base address of the device on I2C bus;
+- video-itu-601-bus : parallel bus with HSYNC and VSYNC - ITU-R BT.601;
+- vdd_core-supply : digital core voltage supply 1.5V (1.4V to 1.6V);
+- vdda-supply : analog power voltage supply 2.8V (2.6V to 3.0V);
+- vdd_reg-supply : regulator input power voltage supply 1.8V (1.7V to 1.9V)
+		   or 2.8V (2.6V to 3.0);
+- vddio-supply : I/O voltage supply 1.8V (1.65V to 1.95V)
+		 or 2.8V (2.5V to 3.1V);
+
+Optional properties:
+
+- clock-frequency : the IP's main (system bus) clock frequency in Hz, the
Quoted 1 line

default

Is that the input clock frequency ? Can't it vary ? Instead of accessing the sensor clock frequency from the FIMC driver you should reference a clock in the sensor DT node. That obviously requires generic clock support, which might not be available for your platform yet (that's one of the reasons the OMAP3 ISP driver doesn't support DT yet).

Quoted 39 lines
Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file +39 -0
+		    value when this property is not specified is 24 MHz;
+- data-lanes : number of physical lanes used (default 2 if not specified);
+- gpio-stby : specifies the S5K6AA_STBY GPIO
+- gpio-rst : specifies the S5K6AA_RST GPIO
+- samsung,s5k6aa-inv-stby : set inverted S5K6AA_STBY GPIO level;
+- samsung,s5k6aa-inv-rst : set inverted S5K6AA_RST GPIO level;
+- samsung,s5k6aa-hflip : set the default horizontal image flipping;
+- samsung,s5k6aa-vflip : set the default vertical image flipping;
+
+
+Example:
+
+	gpl2: gpio-controller@0 {
+	};
+
+	reg0: regulator@0 {
+	};
+
+	reg1: regulator@1 {
+	};
+
+	reg2: regulator@2 {
+	};
+
+	reg3: regulator@3 {
+	};
+
+	s5k6aafx@3c {
+		compatible = "samsung,s5k6aafx";
+		reg = <0x3c>;
+		clock-frequency = <24000000>;
+		gpio-rst = <&gpl2 0 2 0 3>;
+		gpio-stby = <&gpl2 1 2 0 3>;
+		video-itu-601-bus;
+		vdd_core-supply = <&reg0>;
+		vdda-supply = <&reg1>;
+		vdd_reg-supply = <&reg2>;
+		vddio-supply = <&reg3>;
+	};
Signature · 3 lines
Regards,

Laurent Pinchart
#49 lore raw

Re: [RFC/PATCH 09/13] media: s5k6aa: Add support for device tree based instantiation

Hi Laurent,

Quoted 35 lines · Laurent Pinchart
Quoted 34 lines · On Friday 25 May 2012 21:52:48 Sylwester Nawrocki wrote:

The driver initializes all board related properties except the s_power() callback to board code. The platforms that require this callback are not supported by this driver yet for CONFIG_OF=y.

---
  .../bindings/camera/samsung-s5k6aafx.txt           |   57 +++++++++
  drivers/media/video/s5k6aa.c                       |  129 ++++++++++++-----
  2 files changed, 146 insertions(+), 40 deletions(-)

create mode 100644
Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt

(quoted diff) +0 -0

b/Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file mode 100644
index 0000000..6685a9c

Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file +13 -0
@@ -0,0 +1,57 @@
+Samsung S5K6AAFX camera sensor
+------------------------------
+
+Required properties:
+
+- compatible : "samsung,s5k6aafx";
+- reg : base address of the device on I2C bus;
+- video-itu-601-bus : parallel bus with HSYNC and VSYNC - ITU-R BT.601;
+- vdd_core-supply : digital core voltage supply 1.5V (1.4V to 1.6V);
+- vdda-supply : analog power voltage supply 2.8V (2.6V to 3.0V);
+- vdd_reg-supply : regulator input power voltage supply 1.8V (1.7V to 1.9V)
+		   or 2.8V (2.6V to 3.0);
+- vddio-supply : I/O voltage supply 1.8V (1.65V to 1.95V)
Quoted 8 lines
Quoted 6 lines
Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file +5 -0
+		 or 2.8V (2.5V to 3.1V);
+
+Optional properties:
+
+- clock-frequency : the IP's main (system bus) clock frequency in Hz, the

default

Is that the input clock frequency ? Can't it vary ? Instead of accessing the

Yes, the description is incorrect in this patch, it should read:

+- clock-frequency : the sensor's master clock frequency in Hz;

and be a required property. As in this patch:
https://github.com/snawrocki/linux/commit/e8a5f890dec0d7414b656bb1d1ac97d5e7abe563

It could vary (as this is a PLL input frequency), so probably a range would be a better alternative. Given that host device won't always be able to set this exact value...

Quoted 4 lines

sensor clock frequency from the FIMC driver you should reference a clock in the sensor DT node. That obviously requires generic clock support, which might not be available for your platform yet (that's one of the reasons the OMAP3 ISP driver doesn't support DT yet).

I agree it might be better, but waiting unknown number of kernel releases for the platforms to get converted to common clock API is not a good alternative either. I guess we could have some transitional solutions while other subsystems are getting adapted.

Yet we need to specify the clock frequency range per sensor, so

1. either we specify it at a sensor node and host device driver references it, or
2. it could be added to a sensor specific child node of a host device mode, and then only the host would reference it, and sensor would reference a clock in its DT node; I guess it's not a problem that in most cases the camera host device is a clock provider.

--

Regards,
Sylwester

#50 lore raw

Re: [RFC/PATCH 09/13] media: s5k6aa: Add support for device tree based instantiation

Hi Sylwester,

Quoted 52 lines · On Thursday 26 July 2012 22:39:31 Sylwester Nawrocki wrote:
Quoted 39 lines · Laurent Pinchart
Quoted 38 lines · On Friday 25 May 2012 21:52:48 Sylwester Nawrocki wrote:

The driver initializes all board related properties except the s_power() callback to board code. The platforms that require this callback are not supported by this driver yet for CONFIG_OF=y.

---

  .../bindings/camera/samsung-s5k6aafx.txt           |   57 +++++++++
  drivers/media/video/s5k6aa.c                       |  129 +++++++++----
  2 files changed, 146 insertions(+), 40 deletions(-)

create mode 100644

Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt

diff --git a/Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt b/Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file mode 100644
index 0000000..6685a9c

Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file +11 -0
@@ -0,0 +1,57 @@
+Samsung S5K6AAFX camera sensor
+------------------------------
+
+Required properties:
+
+- compatible : "samsung,s5k6aafx";
+- reg : base address of the device on I2C bus;
+- video-itu-601-bus : parallel bus with HSYNC and VSYNC - ITU-R BT.601;
+- vdd_core-supply : digital core voltage supply 1.5V (1.4V to 1.6V);
+- vdda-supply : analog power voltage supply 2.8V (2.6V to 3.0V);
+- vdd_reg-supply : regulator input power voltage supply 1.8V (1.7V to

1.9V) + or 2.8V (2.6V to 3.0);
+- vddio-supply : I/O voltage supply 1.8V (1.65V to 1.95V)

Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file +1 -0
+		 or 2.8V (2.5V to 3.1V);
Quoted 8 lines
Quoted 5 lines
Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file +4 -0
+
+Optional properties:
+
+- clock-frequency : the IP's main (system bus) clock frequency in Hz,

the default

Is that the input clock frequency ? Can't it vary ? Instead of accessing the

Yes, the description is incorrect in this patch, it should read:

+- clock-frequency : the sensor's master clock frequency in Hz;

Quoted 7 lines

and be a required property. As in this patch:
https://github.com/snawrocki/linux/commit/e8a5f890dec0d7414b656bb1d1ac97d5e7
abe563

It could vary (as this is a PLL input frequency), so probably a range would be a better alternative. Given that host device won't always be able to set this exact value...

A range sounds good, or perhaps a list of ranges. Sakari, what would you need for the SMIA++ driver ?

Quoted 9 lines
Quoted 4 lines

sensor clock frequency from the FIMC driver you should reference a clock in the sensor DT node. That obviously requires generic clock support, which might not be available for your platform yet (that's one of the reasons the OMAP3 ISP driver doesn't support DT yet).

I agree it might be better, but waiting unknown number of kernel releases for the platforms to get converted to common clock API is not a good alternative either. I guess we could have some transitional solutions while other subsystems are getting adapted.

I agree, we need an interim solution.

Quoted 8 lines

Yet we need to specify the clock frequency range per sensor, so

1. either we specify it at a sensor node and host device driver references it, or
2. it could be added to a sensor specific child node of a host device mode, and then only the host would reference it, and sensor would reference a clock in its DT node; I guess it's not a problem that in most cases the camera host device is a clock provider.

The sensor will need to configure the clock rate, so a (list of) clock frequency range(s) will be needed in the sensor node anyway. As an interim solution the host can access that property. When the platform will be ported to the common clock API no modification to the DT will be needed.

Signature · 3 lines
Regards,

Laurent Pinchart
#51 lore raw

Re: [RFC/PATCH 09/13] media: s5k6aa: Add support for device tree based instantiation

Hi Laurent and Sylwester,

My apologies for the late answer.

Quoted 59 lines · Laurent Pinchart

Hi Sylwester,

Quoted 56 lines · On Thursday 26 July 2012 22:39:31 Sylwester Nawrocki wrote:
Quoted 39 lines · Laurent Pinchart
Quoted 38 lines · On Friday 25 May 2012 21:52:48 Sylwester Nawrocki wrote:

The driver initializes all board related properties except the s_power() callback to board code. The platforms that require this callback are not supported by this driver yet for CONFIG_OF=y.

---

  .../bindings/camera/samsung-s5k6aafx.txt           |   57 +++++++++
  drivers/media/video/s5k6aa.c                       |  129 +++++++++----
  2 files changed, 146 insertions(+), 40 deletions(-)

create mode 100644

Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt

diff --git a/Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt b/Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file mode 100644
index 0000000..6685a9c

Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file +11 -0
@@ -0,0 +1,57 @@
+Samsung S5K6AAFX camera sensor
+------------------------------
+
+Required properties:
+
+- compatible : "samsung,s5k6aafx";
+- reg : base address of the device on I2C bus;
+- video-itu-601-bus : parallel bus with HSYNC and VSYNC - ITU-R BT.601;
+- vdd_core-supply : digital core voltage supply 1.5V (1.4V to 1.6V);
+- vdda-supply : analog power voltage supply 2.8V (2.6V to 3.0V);
+- vdd_reg-supply : regulator input power voltage supply 1.8V (1.7V to

1.9V) + or 2.8V (2.6V to 3.0);
+- vddio-supply : I/O voltage supply 1.8V (1.65V to 1.95V)

Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file +1 -0
+		 or 2.8V (2.5V to 3.1V);
Quoted 8 lines
Quoted 5 lines
Documentation/devicetree/bindings/camera/samsung-s5k6aafx.txt new file +4 -0
+
+Optional properties:
+
+- clock-frequency : the IP's main (system bus) clock frequency in Hz,

the default

Is that the input clock frequency ? Can't it vary ? Instead of accessing the

Yes, the description is incorrect in this patch, it should read:

+- clock-frequency : the sensor's master clock frequency in Hz;

and be a required property. As in this patch:
https://github.com/snawrocki/linux/commit/e8a5f890dec0d7414b656bb1d1ac97d5e7
abe563

Quoted 6 lines
Quoted 3 lines

It could vary (as this is a PLL input frequency), so probably a range would be a better alternative. Given that host device won't always be able to set this exact value...

A range sounds good, or perhaps a list of ranges. Sakari, what would you need for the SMIA++ driver ?

Typically the sensor's external clock is derived from another clock using a divisor. This means there's usually quite limited selection of possible clock frequencies since the sensors usually have a small range of possible frequencies such as 6 -- 27 MHz or even less.

Also it's important to choose the frequency in such a way that it doesn't interfere with other devices in the system. The frequency also must be picked so that one can achieve the desired highest data transfer rate. The sensors are also quite flexible in their internal clock tree configuration, but in the situation where the desired data rate is close to sensor limits there may be additional constraints. Still it's always possible to come up with a best value for the board while other values are inferior.

For these reasons I see little point in providing anything else than just a single value for the external clock frequency. This value is board-specific.

Quoted 11 lines
Quoted 9 lines
Quoted 4 lines

sensor clock frequency from the FIMC driver you should reference a clock in the sensor DT node. That obviously requires generic clock support, which might not be available for your platform yet (that's one of the reasons the OMAP3 ISP driver doesn't support DT yet).

I agree it might be better, but waiting unknown number of kernel releases for the platforms to get converted to common clock API is not a good alternative either. I guess we could have some transitional solutions while other subsystems are getting adapted.

I agree, we need an interim solution.

The SMIA++ driver allows the platform data to have either the clock name or a function pointer to set the clock frequency. If the clock name is there it'll be used instead. The function pointer can be removed once it's no longer needed.

Kind regards,

Signature · 2 lines
Sakari Ailus
e-mail: [email protected]	jabber/XMPP/Gmail: [email protected]
#52 lore raw

PATCH 10/13 ARM: dts: Add camera devices to exynos4210-nuri.dts

In reply to Sylwester Nawrocki
---
 arch/arm/boot/dts/exynos4210-nuri.dts |   54 +++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)
arch/arm/boot/dts/exynos4210-nuri.dts +54 -0
index 103092c..d04f596 100644
@@ -444,6 +444,21 @@
 
 		gpios = <&gpc1 3 4 3 0>,
 			<&gpc1 4 4 3 0>;
+
+		s5k6aafx: s5k6aafx@3c {
+			compatible = "samsung,s5k6aafx";
+			reg = <0x3c>;
+			clock-frequency = <24000000>;
+			gpio-rst = <&gpl2 1 2 0 3>;
+			samsung,s5k6aa-inv-rst;
+			gpio-stby = <&gpl2 0 2 0 3>;
+			samsung,s5k6aa-inv-stby;
+			video-bus-type = "itu-601";
+			vdd_core-supply = <&camv1_5_reg>;
+			vdda-supply = <&camvdda_reg>;
+			vdd_reg-supply = <&vpda_reg>;
+			vddio-supply = <&vtcam_reg>;
+		};
 	};
 
 	i2c7: i2c@138D0000 {
@@ -493,6 +508,7 @@
 			gpio-reset = <&gpf3 4 0 0 0>;
 			hdmi-en-supply = <&hdmi_reg>;
 		};
+
 	};
 
 	g2d: gpu@12800000 {
@@ -564,4 +580,42 @@
 	       reg = <0xf8183c80 0x20>;
 	};
 
+	csis0: csis@11880000 {
+		vddcore-supply = <&vusb_reg>;
+		vddio-supply = <&vmipi_reg>;
+	};
+
+	csis1: csis@11890000 {
+		status = "disabled";
+	};
+
+	camera {
+		compatible = "samsung,fimc";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges;
+
+		fimc-controllers = <&fimc0 &fimc1>;
+		csi-rx-controllers = <&csis0>;
+		samsung,camport-a-gpios = <&gpj0 0 2 0 0>,
+					  <&gpj0 1 2 0 0>,
+					  <&gpj0 2 2 0 0>,
+					  <&gpj0 3 2 0 0>,
+					  <&gpj0 4 2 0 0>,
+					  <&gpj0 5 2 0 0>,
+					  <&gpj0 6 2 0 0>,
+					  <&gpj0 7 2 0 0>,
+					  <&gpj1 0 2 0 0>,
+					  <&gpj1 1 2 0 0>,
+					  <&gpj1 2 2 0 0>,
+					  <&gpj1 3 2 0 3>,
+					  <&gpj1 4 2 0 0>;
+		sensor@0 {
+			 i2c-client = <&s5k6aafx>;
+			 samsung,camif-mux-id = <0>;
+			 samsung,fimc-clk-id = <0>;
+			 video-bus-type = "itu-601";
+		};
+	};
+
 };
Signature · 1 line
1.7.10
#53 lore raw

PATCH 11/13 media: s5p-fimc: Keep local copy of sensors platform data

In reply to Sylwester Nawrocki

Use a copy of sensor platform data structure, rather than referencing external platform data from the driver. This allows to fill the local copy with values parsed from device tree when needed.

---
 drivers/media/video/s5p-fimc/fimc-capture.c |    6 +++---
 drivers/media/video/s5p-fimc/fimc-lite.c    |    2 +-
 drivers/media/video/s5p-fimc/fimc-mdevice.c |   18 +++++++++---------
 drivers/media/video/s5p-fimc/fimc-mdevice.h |    2 +-
 4 files changed, 14 insertions(+), 14 deletions(-)
drivers/media/video/s5p-fimc/fimc-capture.c +3 -3
index 7585b2f..ec259fb 100644
@@ -50,9 +50,9 @@ static int fimc_capture_hw_init(struct fimc_dev *fimc)
 	fimc_prepare_dma_offset(ctx, &ctx->d_frame);
 	fimc_set_yuv_order(ctx);
 
-	fimc_hw_set_camera_polarity(fimc, sensor->pdata);
-	fimc_hw_set_camera_type(fimc, sensor->pdata);
-	fimc_hw_set_camera_source(fimc, sensor->pdata);
+	fimc_hw_set_camera_polarity(fimc, &sensor->pdata);
+	fimc_hw_set_camera_type(fimc, &sensor->pdata);
+	fimc_hw_set_camera_source(fimc, &sensor->pdata);
 	fimc_hw_set_camera_offset(fimc, &ctx->s_frame);
 
 	ret = fimc_set_scaler_info(ctx);
drivers/media/video/s5p-fimc/fimc-lite.c +1 -1
index a7ae149..4ee5b70 100644
@@ -165,7 +165,7 @@ static int fimc_lite_hw_init(struct fimc_lite *fimc)
 	sensor = v4l2_get_subdev_hostdata(pipeline->subdevs[IDX_SENSOR]);
 	spin_lock_irqsave(&fimc->slock, flags);
 
-	flite_hw_set_camera_bus(fimc, sensor->pdata);
+	flite_hw_set_camera_bus(fimc, &sensor->pdata);
 	flite_hw_set_source_format(fimc, &fimc->inp_frame);
 	flite_hw_set_window_offset(fimc, &fimc->inp_frame);
 	flite_hw_set_output_dma(fimc, &fimc->out_frame, true);
drivers/media/video/s5p-fimc/fimc-mdevice.c +9 -9
index 92c9887..1b3b13c 100644
@@ -244,27 +244,27 @@ static struct v4l2_subdev *fimc_md_register_sensor(struct fimc_md *fmd,
 	if (!s_info || !fmd)
 		return NULL;
 
-	adapter = i2c_get_adapter(s_info->pdata->i2c_bus_num);
+	adapter = i2c_get_adapter(s_info->pdata.i2c_bus_num);
 	if (!adapter) {
 		v4l2_warn(&fmd->v4l2_dev,
 			  "Failed to get I2C adapter %d, deferring probe\n",
-			  s_info->pdata->i2c_bus_num);
+			  s_info->pdata.i2c_bus_num);
 		return ERR_PTR(-EPROBE_DEFER);
 	}
 	sd = v4l2_i2c_new_subdev_board(&fmd->v4l2_dev, adapter,
-				       s_info->pdata->board_info, NULL);
+				       s_info->pdata.board_info, NULL);
 	if (IS_ERR_OR_NULL(sd)) {
 		i2c_put_adapter(adapter);
 		v4l2_warn(&fmd->v4l2_dev,
 			  "Failed to acquire subdev %s, deferring probe\n",
-			  s_info->pdata->board_info->type);
+			  s_info->pdata.board_info->type);
 		return ERR_PTR(-EPROBE_DEFER);
 	}
 	v4l2_set_subdev_hostdata(sd, s_info);
 	sd->grp_id = SENSOR_GROUP_ID;
 
 	v4l2_info(&fmd->v4l2_dev, "Registered sensor subdevice %s\n",
-		  s_info->pdata->board_info->type);
+		  s_info->pdata.board_info->type);
 	return sd;
 }
 
@@ -308,7 +308,7 @@ static int fimc_md_register_sensor_entities(struct fimc_md *fmd)
 	for (i = 0; i < num_clients; i++) {
 		struct v4l2_subdev *sd;
 
-		fmd->sensor[i].pdata = &pdata->isp_info[i];
+		fmd->sensor[i].pdata = pdata->isp_info[i];
 		ret = __fimc_md_set_camclk(fmd, &fmd->sensor[i], true);
 		if (ret)
 			break;
@@ -713,11 +713,11 @@ static int fimc_md_create_links(struct fimc_md *fmd)
 
 		sensor = fmd->sensor[i].subdev;
 		s_info = v4l2_get_subdev_hostdata(sensor);
-		if (!s_info || !s_info->pdata)
+		if (!s_info)
 			continue;
 
 		source = NULL;
-		pdata = s_info->pdata;
+		pdata = &s_info->pdata;
 
 		switch (pdata->bus_type) {
 		case FIMC_MIPI_CSI2:
@@ -827,7 +827,7 @@ static int __fimc_md_set_camclk(struct fimc_md *fmd,
 					 struct fimc_sensor_info *s_info,
 					 bool on)
 {
-	struct s5p_fimc_isp_info *pdata = s_info->pdata;
+	struct s5p_fimc_isp_info *pdata = &s_info->pdata;
 	struct fimc_camclk_info *camclk;
 	int ret = 0;
 
drivers/media/video/s5p-fimc/fimc-mdevice.h +1 -1
index 3b8a349..bba85bf 100644
@@ -52,7 +52,7 @@ struct fimc_camclk_info {
  * This data structure applies to image sensor and the writeback subdevs.
  */
 struct fimc_sensor_info {
-	struct s5p_fimc_isp_info *pdata;
+	struct s5p_fimc_isp_info pdata;
 	struct v4l2_subdev *subdev;
 	struct fimc_dev *host;
 	bool clk_on;
Signature · 1 line
1.7.10
#54 lore raw

PATCH 12/13 media: s5p-fimc: Add device tree based sensors registration

In reply to Sylwester Nawrocki

Add parsing of 'sensor' nodes specified as 'camera' child nodes. Each 'sensor' node should contain a phandle indicating sensor I2C client device. Sensors with SPI control bus are not yet supported.

Additionally it is required that the I2C client node (child node of I2C bus controller node) contains 'clock-frequency' and 'video-bus-type' properties. These properties allow the host controller to switch to proper video bus and set proper master clock frequency for a sensor.

---

We might need something like this as a V4L2 core function. But I wanted to have something settled first until proposing any addtions to the V4L2 core modules.

---
 .../bindings/camera/soc/samsung-fimc.txt           |   22 ++++
 drivers/media/video/s5p-fimc/fimc-mdevice.c        |  114 +++++++++++++++++++-
 2 files changed, 133 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/camera/soc/samsung-fimc.txt +22 -0
index b459da2..ffe09ac 100644
@@ -54,6 +54,28 @@ Required properties:
 - cell-index : FIMC-LITE IP instance index;
 
 
+The 'sensor' nodes
+------------------
+
+Required properties:
+
+ - i2c-client : a phandle to an image sensor I2C client device;
+
+Optional properties:
+
+- samsung,camif-mux-id : FIMC video multiplexer input index; for camera
+			 port A, B, C the indexes are 0, 1, 0 respectively.
+			 If this property is not specified a default 0
+			 value will be used by driver.
+
+- samsung,fimc-camclk-id : the SoC CAM_MCLK clock output index. These clocks
+			   are master clocks for external image processors.
+			   If this property is not specified a default 0 value
+			   will be used by driver.
+
+ "video-bus-type" and "clock-frequency" properties must be specified at the
+ node referenced by 'i2c-client' phandle.
+
 Example:
 
 	fimc0: fimc@11800000 {
drivers/media/video/s5p-fimc/fimc-mdevice.c +111 -3

141 lines not on this page · raw message

Signature · 1 line
1.7.10
#55 lore raw

Re: [RFC/PATCH 12/13] media: s5p-fimc: Add device tree based sensors registration

Quoted 33 lines · Sylwester Nawrocki

Add parsing of 'sensor' nodes specified as 'camera' child nodes. Each 'sensor' node should contain a phandle indicating sensor I2C client device. Sensors with SPI control bus are not yet supported.

Additionally it is required that the I2C client node (child node of I2C bus controller node) contains 'clock-frequency' and 'video-bus-type' properties. These properties allow the host controller to switch to proper video bus and set proper master clock frequency for a sensor.

---

We might need something like this as a V4L2 core function. But I wanted to have something settled first until proposing any addtions to the V4L2 core modules.

---
 .../bindings/camera/soc/samsung-fimc.txt           |   22 ++++
 drivers/media/video/s5p-fimc/fimc-mdevice.c        |  114 +++++++++++++++++++-
 2 files changed, 133 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/camera/soc/samsung-fimc.txt +3 -0
index b459da2..ffe09ac 100644
@@ -54,6 +54,28 @@ Required properties:
 - cell-index : FIMC-LITE IP instance index;
 
 
+The 'sensor' nodes
+------------------
+

Documentation/devicetree/bindings/camera/soc/samsung-fimc.txt Required properties: · line 69

Quoted 10 lines
Documentation/devicetree/bindings/camera/soc/samsung-fimc.txt +10 -0
+Required properties:
+
+ - i2c-client : a phandle to an image sensor I2C client device;
+
+Optional properties:
+
+- samsung,camif-mux-id : FIMC video multiplexer input index; for camera
+			 port A, B, C the indexes are 0, 1, 0 respectively.
+			 If this property is not specified a default 0
+			 value will be used by driver.

Isn't it possible to have several clients connected to different mux inputs and switch between them at run-time? Even if only one of them can be active at any time? That's why I've introduced link nodes in my RFC to specify exactly which pads are connected.

Documentation/devicetree/bindings/camera/soc/samsung-fimc.txt Required properties: · line 81

Quoted 12 lines
Documentation/devicetree/bindings/camera/soc/samsung-fimc.txt +9 -0
+
+- samsung,fimc-camclk-id : the SoC CAM_MCLK clock output index. These clocks
+			   are master clocks for external image processors.
+			   If this property is not specified a default 0 value
+			   will be used by driver.
+
+ "video-bus-type" and "clock-frequency" properties must be specified at the
+ node referenced by 'i2c-client' phandle.
+
 Example:
 
 	fimc0: fimc@11800000 {

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#56 lore raw

Re: [RFC/PATCH 12/13] media: s5p-fimc: Add device tree based sensors registration

On 07/16/2012 11:51 AM, Guennadi Liakhovetski wrote:
[...]

Quoted 18 lines
Quoted 18 lines
Documentation/devicetree/bindings/camera/soc/samsung-fimc.txt +10 -0
index b459da2..ffe09ac 100644
@@ -54,6 +54,28 @@ Required properties:
  - cell-index : FIMC-LITE IP instance index;
 
 
+The 'sensor' nodes
+------------------
+
+Required properties:
+
+ - i2c-client : a phandle to an image sensor I2C client device;
+
+Optional properties:
+
+- samsung,camif-mux-id : FIMC video multiplexer input index; for camera
Quoted 8 lines

Documentation/devicetree/bindings/camera/soc/samsung-fimc.txt Required properties: · line 69

Quoted 3 lines
Documentation/devicetree/bindings/camera/soc/samsung-fimc.txt +3 -0
+			 port A, B, C the indexes are 0, 1, 0 respectively.
+			 If this property is not specified a default 0
+			 value will be used by driver.

Isn't it possible to have several clients connected to different mux inputs and switch between them at run-time? Even if only one of them can be active at any time? That's why I've introduced link nodes in my RFC to specify exactly which pads are connected.

Yes, of course it is. For such a configuration there would be multiple 'sensor' nodes and each of them would contain a 'samsung,camif-mux-id' determining camera port the corresponding sensor/encoder is wired to.

Then switching between the sensors would be possible by setting up
a proper media link (or just through VIDIOC_S_INPUT ioctl, if that's
feasible) and then writing the mux input index and the camera port
type values to the control registers (in this specific case ports A,B (index 0, 1) are parallel and port C (index 0) is a serial port). Thus using only input index wouldn't be sufficient to do the sensors
switch over.

--

Thanks,
Sylwester

#57 lore raw

PATCH 13/13 media: s5p-fimc: Add parallel video port pin configuration

In reply to Sylwester Nawrocki

This patch adds parsing of 'samsung,fimc-camport-a-gpios' and 'samsung,fimc-camport-b-gpios' properties from 'camera' node and configuration of camera parallel port pins. It can be in future replaced with equivalent pinctrl API calls.

---
 .../bindings/camera/soc/samsung-fimc.txt           |   12 +++
 drivers/media/video/s5p-fimc/fimc-mdevice.c        |   87 ++++++++++++++++++++
 drivers/media/video/s5p-fimc/fimc-mdevice.h        |   10 +++
 3 files changed, 109 insertions(+)
Documentation/devicetree/bindings/camera/soc/samsung-fimc.txt +12 -0
index ffe09ac..efa5be5 100644
@@ -23,6 +23,18 @@ Optional properties:
 - csi-rx-controllers : an array of phandles to 'csis' device nodes,
 		       it is required for sensors with MIPI-CSI2 bus;
 
+- samsung,camport-a-gpios, samsung,camport-b-gpios : gpio specifier list for
+			   the parallel camera ports A and B respectively;
+
+  For 'video-itu-601-bus' the list length must be 13, for 'video-itu-656-bus'
+  at least 10 and for 'video-mipi-csi2-bus' the array should contain at least
+  one gpio (CLKOUT). The meaning of the gpios is as following: DATA[7:0], PCLK,
+  VSYNC, HREF, CLKOUT, FIELD. It is not required to list gpios exactly in that
+  order. All gpios listed here will be configured into camera port function.
+  In case of ITU-R BT.656 bus the VSYNC, HREF, and FIELD pins remain unused,
+  hence don't need to be specified here.
+
+
 'fimc' device node
 ------------------
 
drivers/media/video/s5p-fimc/fimc-mdevice.c +87 -0

110 lines not on this page · raw message

drivers/media/video/s5p-fimc/fimc-mdevice.h +10 -0
index bba85bf..1f7ebf8 100644
@@ -30,6 +30,10 @@
 
 #define FIMC_MAX_SENSORS	8
 #define FIMC_MAX_CAMCLKS	2
+/* Maximum number of supported parallel video ports */
+#define FIMC_MAX_PARALLEL_PORTS		2
+/* Maximum number of pins per 8-bit parallel port */
+#define FIMC_MAX_PARALLEL_PORT_PINS	13
 
 struct fimc_csis_info {
 	struct v4l2_subdev *sd;
@@ -58,8 +62,13 @@ struct fimc_sensor_info {
 	bool clk_on;
 };
 
+struct fimc_video_port {
+	int gpios[FIMC_MAX_PARALLEL_PORT_PINS];
+};
+
 /**
  * struct fimc_md - fimc media device information
+ * @parallel_ports: parallel video ports data
  * @csis: MIPI CSIS subdevs data
  * @sensor: array of registered sensor subdevs
  * @num_sensors: actual number of registered sensors
@@ -72,6 +81,7 @@ struct fimc_sensor_info {
  * @slock: spinlock protecting @sensor array
  */
 struct fimc_md {
+	struct fimc_video_port *parallel_ports;
 	struct fimc_csis_info csis[CSIS_MAX_ENTITIES];
 	struct fimc_sensor_info sensor[FIMC_MAX_SENSORS];
 	int num_sensors;
Signature · 1 line
1.7.10
#58 lore raw

PATCH 14/14 s5p-fimc: Add FIMC and MIPI-CSIS devices to CAM power domain

In reply to Sylwester Nawrocki

From: Bartlomiej Zolnierkiewicz <[email protected]>

---
 drivers/media/video/s5p-fimc/fimc-core.c |   15 +++++++++++++++
 drivers/media/video/s5p-fimc/mipi-csis.c |   15 +++++++++++++++
 2 files changed, 30 insertions(+)
drivers/media/video/s5p-fimc/fimc-core.c +15 -0
index 30c6365..15c7cc6 100644
@@ -19,6 +19,7 @@
 #include <linux/device.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
+#include <linux/pm_domain.h>
 #include <linux/list.h>
 #include <linux/io.h>
 #include <linux/of.h>
@@ -1057,6 +1058,17 @@ static int fimc_m2m_resume(struct fimc_dev *fimc)
 	return 0;
 }
 
+static void bus_add_dev_to_pd(struct device *dev)
+{
+	struct device_node *np;
+
+	np = of_parse_phandle(dev->of_node, "pd", 0);
+	if (np)
+		pm_genpd_of_add_device(np, dev);
+
+	of_node_put(np);
+}
+
 static int fimc_probe(struct platform_device *pdev)
 {
 	struct fimc_drvdata *drv_data = NULL;
@@ -1072,6 +1084,9 @@ static int fimc_probe(struct platform_device *pdev)
 
 	if (pdev->dev.of_node) {
 		u32 id = 0;
+
+		bus_add_dev_to_pd(&pdev->dev);
+
 		of_id = of_match_node(fimc_of_match, pdev->dev.of_node);
 		if (of_id)
 			drv_data = of_id->data;
drivers/media/video/s5p-fimc/mipi-csis.c +15 -0
index ffb820e..6858c92 100644
@@ -22,6 +22,7 @@
 #include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
+#include <linux/pm_domain.h>
 #include <linux/regulator/consumer.h>
 #include <linux/slab.h>
 #include <linux/spinlock.h>
@@ -529,6 +530,17 @@ static int s5pcsis_get_platform_data(struct platform_device *pdev,
 	return 0;
 }
 
+static void bus_add_dev_to_pd(struct device *dev)
+{
+	struct device_node *np;
+
+	np = of_parse_phandle(dev->of_node, "pd", 0);
+	if (np)
+		pm_genpd_of_add_device(np, dev);
+
+	of_node_put(np);
+}
+
 static int __devinit s5pcsis_probe(struct platform_device *pdev)
 {
 	struct resource *mem_res;
@@ -543,6 +555,9 @@ static int __devinit s5pcsis_probe(struct platform_device *pdev)
 	mutex_init(&state->lock);
 	state->pdev = pdev;
 
+	if (pdev->dev.of_node)
+		bus_add_dev_to_pd(&pdev->dev);
+
 	ret = s5pcsis_get_platform_data(pdev, state);
 	if (ret < 0)
 		return ret;
Signature · 1 line
1.7.10
#59 lore raw

Re: [RFC/PATCH 01/13] ARM: Samsung: Extend MIPI PHY callback with an index argument

In reply to Sylwester Nawrocki

Hi Sylwester,

Quoted 17 lines · On Friday 25 May 2012 21:52:40 Sylwester Nawrocki wrote:

For systems instantiated from device tree struct platform_device id field is always -1, add an 'id' argument to the s5p_csis_phy_enable() function so the MIPI-CSIS hardware instance index can be passed in by driver, for CONFIG_OF=y.

---
 arch/arm/plat-s5p/setup-mipiphy.c              |   20 ++++++++------------
 arch/arm/plat-samsung/include/plat/mipi_csis.h |   10 ++++++----
 2 files changed, 14 insertions(+), 16 deletions(-)
(quoted diff) +0 -0

b/arch/arm/plat-s5p/setup-mipiphy.c index 683c466..146ecc3 100644

arch/arm/plat-s5p/setup-mipiphy.c line 18

Quoted 6 lines
arch/arm/plat-s5p/setup-mipiphy.c +1 -1
@@ -14,24 +14,19 @@
 #include <linux/spinlock.h>
 #include <mach/regs-clock.h>
 
-static int __s5p_mipi_phy_control(struct platform_device *pdev,
+static int __s5p_mipi_phy_control(struct platform_device *pdev, int id,
 				  bool on, u32 reset)

What about removing the pdev argument, as it's now not needed ?

Signature · 3 lines
Regards,

Laurent Pinchart
#60 lore raw

Re: [RFC/PATCH 01/13] ARM: Samsung: Extend MIPI PHY callback with an index argument

Hi Laurent,

Quoted 23 lines · Laurent Pinchart

Hi Sylwester,

Quoted 20 lines · On Friday 25 May 2012 21:52:40 Sylwester Nawrocki wrote:

For systems instantiated from device tree struct platform_device id field is always -1, add an 'id' argument to the s5p_csis_phy_enable() function so the MIPI-CSIS hardware instance index can be passed in by driver, for CONFIG_OF=y.

---
  arch/arm/plat-s5p/setup-mipiphy.c              |   20 ++++++++------------
  arch/arm/plat-samsung/include/plat/mipi_csis.h |   10 ++++++----
  2 files changed, 14 insertions(+), 16 deletions(-)
(quoted diff) +0 -0

b/arch/arm/plat-s5p/setup-mipiphy.c index 683c466..146ecc3 100644

arch/arm/plat-s5p/setup-mipiphy.c +0 -0
@@ -14,24 +14,19 @@
  #include<linux/spinlock.h>
  #include<mach/regs-clock.h>
 
Quoted 5 lines

arch/arm/plat-s5p/setup-mipiphy.c line 18

Quoted 3 lines
arch/arm/plat-s5p/setup-mipiphy.c +1 -1
-static int __s5p_mipi_phy_control(struct platform_device *pdev,
+static int __s5p_mipi_phy_control(struct platform_device *pdev, int id,
  				  bool on, u32 reset)

What about removing the pdev argument, as it's now not needed ?

Indeed, it isn't useful any more. I'm not sure what I intended to keep it for, perhaps just some sentimental reasons.. :) Thanks for pointing out, I'll remove it in the next iteration.

--

Regards,
Sylwester