Re: [PATCH RFC 01/12] s5p-csis: Add device tree support

2012-12-11 Thread Grant Likely
On Mon, 10 Dec 2012 20:45:55 +0100, Sylwester Nawrocki s.nawro...@samsung.com 
wrote:
 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.
 
 Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
 Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
 ---
  .../bindings/media/soc/samsung-mipi-csis.txt   |   82 +++
  drivers/media/platform/s5p-fimc/mipi-csis.c|  155 
 +++-
  drivers/media/platform/s5p-fimc/mipi-csis.h|1 +
  3 files changed, 202 insertions(+), 36 deletions(-)
  create mode 100644 
 Documentation/devicetree/bindings/media/soc/samsung-mipi-csis.txt
 
 diff --git 
 a/Documentation/devicetree/bindings/media/soc/samsung-mipi-csis.txt 
 b/Documentation/devicetree/bindings/media/soc/samsung-mipi-csis.txt
 new file mode 100644
 index 000..f57cbdc
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/media/soc/samsung-mipi-csis.txt
 @@ -0,0 +1,82 @@
 +Samsung S5P/EXYNOS SoC MIPI-CSI2 receiver (MIPI CSIS)
 +-
 +
 +Required properties:
 +
 +- compatible   : samsung,s5pv210-csis for S5PV210 SoCs,
 + samsung,exynos4210-csis for Exynos4210 and later SoCs;
 +- reg  : physical base address and size of the device memory 
 mapped
 + registers;
 +- interrupts  : should contain MIPI CSIS interrupt; the format of the
 + interrupt specifier depends on the interrupt controller;
 +- max-data-lanes  : maximum number of data lanes supported (SoC specific);
 +- vddio-supply: MIPI CSIS I/O and PLL voltage supply (e.g. 1.8V);
 +- vddcore-supply  : MIPI CSIS Core voltage supply (e.g. 1.1V).
 +
 +Optional properties:
 +
 +- clock-frequency : The IP's main (system bus) clock frequency in Hz, default
 + value when this property is not specified is 166 MHz;
 +- samsung,csis,wclk : CSI-2 wrapper clock selection. If this property is 
 present
 + external clock from CMU will be used, if not bus clock will
 + be selected.
 +
 +The device node should contain one 'port' child node with one child 
 'endpoint'
 +node, as outlined in the common media bindings specification. See
 +Documentation/devicetree/bindings/media/v4l2.txt for details. The following 
 are
 +properties specific to those nodes. (TODO: update the file path)
 +
 +port node
 +-
 +
 +- reg  : (required) must be 2 for camera C input (CSIS0) or 
 3 for
 + camera D input (CSIS1);

'reg' has a very specific definition. If you're going to use a reg
property here, then the parent nodes need to have
#address-cells=1;#size-cells=0; properties to define the address
specifier format.

However since you're identifying port numbers that aren't really
addresses I would suggest simply changing this property to something
like 'port-num'.

Otherwise the binding looks good.

g.

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH RFC 01/12] s5p-csis: Add device tree support

2012-12-11 Thread Sylwester Nawrocki
Hello Grant,

On 12/11/2012 09:36 AM, Grant Likely wrote:
 On Mon, 10 Dec 2012 20:45:55 +0100, Sylwester Nawrocki 
 s.nawro...@samsung.com wrote:
 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.

 Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
 Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
 ---
  .../bindings/media/soc/samsung-mipi-csis.txt   |   82 +++
  drivers/media/platform/s5p-fimc/mipi-csis.c|  155 
 +++-
  drivers/media/platform/s5p-fimc/mipi-csis.h|1 +
  3 files changed, 202 insertions(+), 36 deletions(-)
  create mode 100644 
 Documentation/devicetree/bindings/media/soc/samsung-mipi-csis.txt

 diff --git 
 a/Documentation/devicetree/bindings/media/soc/samsung-mipi-csis.txt 
 b/Documentation/devicetree/bindings/media/soc/samsung-mipi-csis.txt
 new file mode 100644
 index 000..f57cbdc
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/media/soc/samsung-mipi-csis.txt
 @@ -0,0 +1,82 @@
 +Samsung S5P/EXYNOS SoC MIPI-CSI2 receiver (MIPI CSIS)
 +-
 +
 +Required properties:
 +
 +- compatible  : samsung,s5pv210-csis for S5PV210 SoCs,
 +samsung,exynos4210-csis for Exynos4210 and later SoCs;
 +- reg : physical base address and size of the device memory 
 mapped
 +registers;
 +- interrupts  : should contain MIPI CSIS interrupt; the format of the
 +interrupt specifier depends on the interrupt controller;
 +- max-data-lanes  : maximum number of data lanes supported (SoC specific);
 +- vddio-supply: MIPI CSIS I/O and PLL voltage supply (e.g. 1.8V);
 +- vddcore-supply  : MIPI CSIS Core voltage supply (e.g. 1.1V).
 +
 +Optional properties:
 +
 +- clock-frequency : The IP's main (system bus) clock frequency in Hz, 
 default
 +value when this property is not specified is 166 MHz;
 +- samsung,csis,wclk : CSI-2 wrapper clock selection. If this property is 
 present
 +external clock from CMU will be used, if not bus clock will
 +be selected.
 +
 +The device node should contain one 'port' child node with one child 
 'endpoint'
 +node, as outlined in the common media bindings specification. See
 +Documentation/devicetree/bindings/media/v4l2.txt for details. The following 
 are
 +properties specific to those nodes. (TODO: update the file path)
 +
 +port node
 +-
 +
 +- reg : (required) must be 2 for camera C input (CSIS0) or 
 3 for
 +camera D input (CSIS1);
 
 'reg' has a very specific definition. If you're going to use a reg
 property here, then the parent nodes need to have
 #address-cells=1;#size-cells=0; properties to define the address
 specifier format.
 
 However since you're identifying port numbers that aren't really
 addresses I would suggest simply changing this property to something
 like 'port-num'.
 
 Otherwise the binding looks good.

Thank you for the review. Indeed I should have said about #address-cells,
#size-cells here. I thought using 'reg' was agreed during previous discussions
on the mailing lists (e.g. [1]), so I just carried on with 'reg'.
I should just have addressed the comments from Stephen and Rob, instead of
just resending same version of the documentation. I'll try to take care of
it in the next post. i.e. rename 'link' node to 'endpoint' and 'remote'
phandle to 'remote-endpoint'.

I'm not really sure what advantage 'reg' gives over a new property.
Would it still be OK to have port nodes names followed by indexes with
port-num instead of reg, e.g.

foo {
port@0 {
port-num = 0;
};

port@1 {
port-num = 1;
};
};
?


[1] http://www.spinics.net/lists/linux-sh/msg13383.html

--

Thanks,
Sylwester

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH RFC 01/12] s5p-csis: Add device tree support

2012-12-11 Thread Grant Likely
On Tue, 11 Dec 2012 12:24:23 +0100, Sylwester Nawrocki s.nawro...@samsung.com 
wrote:
 Hello Grant,
 
 On 12/11/2012 09:36 AM, Grant Likely wrote:
  On Mon, 10 Dec 2012 20:45:55 +0100, Sylwester Nawrocki 
  s.nawro...@samsung.com wrote:
  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.
 
  Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
  Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
  ---
   .../bindings/media/soc/samsung-mipi-csis.txt   |   82 +++
   drivers/media/platform/s5p-fimc/mipi-csis.c|  155 
  +++-
   drivers/media/platform/s5p-fimc/mipi-csis.h|1 +
   3 files changed, 202 insertions(+), 36 deletions(-)
   create mode 100644 
  Documentation/devicetree/bindings/media/soc/samsung-mipi-csis.txt
 
  diff --git 
  a/Documentation/devicetree/bindings/media/soc/samsung-mipi-csis.txt 
  b/Documentation/devicetree/bindings/media/soc/samsung-mipi-csis.txt
  new file mode 100644
  index 000..f57cbdc
  --- /dev/null
  +++ b/Documentation/devicetree/bindings/media/soc/samsung-mipi-csis.txt
  @@ -0,0 +1,82 @@
  +Samsung S5P/EXYNOS SoC MIPI-CSI2 receiver (MIPI CSIS)
  +-
  +
  +Required properties:
  +
  +- compatible: samsung,s5pv210-csis for S5PV210 SoCs,
  +  samsung,exynos4210-csis for Exynos4210 and later SoCs;
  +- reg   : physical base address and size of the device memory 
  mapped
  +  registers;
  +- interrupts  : should contain MIPI CSIS interrupt; the format of the
  +  interrupt specifier depends on the interrupt controller;
  +- max-data-lanes  : maximum number of data lanes supported (SoC specific);
  +- vddio-supply: MIPI CSIS I/O and PLL voltage supply (e.g. 1.8V);
  +- vddcore-supply  : MIPI CSIS Core voltage supply (e.g. 1.1V).
  +
  +Optional properties:
  +
  +- clock-frequency : The IP's main (system bus) clock frequency in Hz, 
  default
  +  value when this property is not specified is 166 MHz;
  +- samsung,csis,wclk : CSI-2 wrapper clock selection. If this property is 
  present
  +  external clock from CMU will be used, if not bus clock will
  +  be selected.
  +
  +The device node should contain one 'port' child node with one child 
  'endpoint'
  +node, as outlined in the common media bindings specification. See
  +Documentation/devicetree/bindings/media/v4l2.txt for details. The 
  following are
  +properties specific to those nodes. (TODO: update the file path)
  +
  +port node
  +-
  +
  +- reg   : (required) must be 2 for camera C input (CSIS0) or 
  3 for
  +  camera D input (CSIS1);
  
  'reg' has a very specific definition. If you're going to use a reg
  property here, then the parent nodes need to have
  #address-cells=1;#size-cells=0; properties to define the address
  specifier format.
  
  However since you're identifying port numbers that aren't really
  addresses I would suggest simply changing this property to something
  like 'port-num'.
  
  Otherwise the binding looks good.
 
 Thank you for the review. Indeed I should have said about #address-cells,
 #size-cells here. I thought using 'reg' was agreed during previous discussions
 on the mailing lists (e.g. [1]), so I just carried on with 'reg'.
 I should just have addressed the comments from Stephen and Rob, instead of
 just resending same version of the documentation. I'll try to take care of
 it in the next post. i.e. rename 'link' node to 'endpoint' and 'remote'
 phandle to 'remote-endpoint'.

Could be. I can't remember what has been discussed from one day to the
next.  :-)  If you've got #address/#size-cells in the binding, then reg is
fine. If that's what you've already got, then just leave it. As long as
the conventions are intact.

g.
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RFC 01/12] s5p-csis: Add device tree support

2012-12-10 Thread 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.

Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 .../bindings/media/soc/samsung-mipi-csis.txt   |   82 +++
 drivers/media/platform/s5p-fimc/mipi-csis.c|  155 +++-
 drivers/media/platform/s5p-fimc/mipi-csis.h|1 +
 3 files changed, 202 insertions(+), 36 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/media/soc/samsung-mipi-csis.txt

diff --git a/Documentation/devicetree/bindings/media/soc/samsung-mipi-csis.txt 
b/Documentation/devicetree/bindings/media/soc/samsung-mipi-csis.txt
new file mode 100644
index 000..f57cbdc
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/soc/samsung-mipi-csis.txt
@@ -0,0 +1,82 @@
+Samsung S5P/EXYNOS SoC MIPI-CSI2 receiver (MIPI CSIS)
+-
+
+Required properties:
+
+- compatible : samsung,s5pv210-csis for S5PV210 SoCs,
+   samsung,exynos4210-csis for Exynos4210 and later SoCs;
+- reg: physical base address and size of the device memory mapped
+   registers;
+- interrupts  : should contain MIPI CSIS interrupt; the format of the
+   interrupt specifier depends on the interrupt controller;
+- max-data-lanes  : maximum number of data lanes supported (SoC specific);
+- vddio-supply: MIPI CSIS I/O and PLL voltage supply (e.g. 1.8V);
+- vddcore-supply  : MIPI CSIS Core voltage supply (e.g. 1.1V).
+
+Optional properties:
+
+- clock-frequency : The IP's main (system bus) clock frequency in Hz, default
+   value when this property is not specified is 166 MHz;
+- samsung,csis,wclk : CSI-2 wrapper clock selection. If this property is 
present
+   external clock from CMU will be used, if not bus clock will
+   be selected.
+
+The device node should contain one 'port' child node with one child 'endpoint'
+node, as outlined in the common media bindings specification. See
+Documentation/devicetree/bindings/media/v4l2.txt for details. The following are
+properties specific to those nodes. (TODO: update the file path)
+
+port node
+-
+
+- reg: (required) must be 2 for camera C input (CSIS0) or 3 for
+   camera D input (CSIS1);
+
+endpoint node
+-
+
+- data-lanes : (required) an array specifying active physical MIPI-CSI2
+   data input lanes and their mapping to logical lanes; the
+   array's content is unused, only its length is meaningful;
+
+- samsung,csis-hs-settle : (optional) differential receiver (HS-RX) settle 
time;
+
+- samsung,camclk-out: (optional) specifies clock output for remote sensor,
+  0 - CAM_A_CLKOUT, 1 - CAM_B_CLKOUT;
+
+Example:
+
+   reg0: regulator@0 {
+   };
+
+   reg1: regulator@1 {
+   };
+
+/* SoC properties */
+
+   aliases {
+   csis0 = csis_0;
+   };
+
+   csis_0: csis@1188 {
+   compatible = samsung,exynos4210-csis;
+   reg = 0x1188 0x1000;
+   interrupts = 0 78 0;
+   max-data-lanes = 4;
+   };
+
+/* Board properties */
+
+   csis_0: csis@1188 {
+   clock-frequency = 16600;
+   vddio-supply = reg0;
+   vddcore-supply = reg1;
+   port {
+   reg = 2; /* 2 - CSIS0, 3 - CSIS1 */
+   csis0_ep: endpoint {
+   remote-endpoint = ...;
+   data-lanes = 1, 2;
+   samsung,csis-hs-settle = 12;
+   };
+   };
+   };
diff --git a/drivers/media/platform/s5p-fimc/mipi-csis.c 
b/drivers/media/platform/s5p-fimc/mipi-csis.c
index 8a06f14..5049aaf 100644
--- a/drivers/media/platform/s5p-fimc/mipi-csis.c
+++ b/drivers/media/platform/s5p-fimc/mipi-csis.c
@@ -19,12 +19,14 @@
 #include linux/kernel.h
 #include linux/memory.h
 #include linux/module.h
+#include linux/of.h
 #include linux/platform_device.h
 #include linux/pm_runtime.h
 #include linux/regulator/consumer.h
 #include linux/slab.h
 #include linux/spinlock.h
 #include linux/videodev2.h
+#include media/v4l2-of.h
 #include media/v4l2-subdev.h
 #include linux/platform_data/mipi-csis.h
 #include mipi-csis.h
@@ -113,6 +115,7 @@ static char *csi_clock_name[] = {
[CSIS_CLK_GATE] = csis,
 };
 #define NUM_CSIS_CLOCKSARRAY_SIZE(csi_clock_name)
+#define DEFAULT_SCLK_CSIS_FREQ 16600UL
 
 static const char * const csis_supply_name[] = {
vddcore,  /* CSIS Core (1.0V, 1.1V or 1.2V) suppply */
@@ -167,6 +170,11 @@ struct