Re: [PATCH 1/3] phy: Add driver for Exynos DP PHY

2013-06-28 Thread Kishon Vijay Abraham I

Hi,

On Friday 28 June 2013 11:24 AM, Jingoo Han wrote:

On Friday, June 28, 2013 2:31 PM, Kishon Vijay Abraham I wrote:


Hi,

On Friday 28 June 2013 10:52 AM, Jingoo Han wrote:

Add a PHY provider driver for the Samsung Exynos SoC DP PHY.

Signed-off-by: Jingoo Han jg1@samsung.com
---
   .../phy/samsung,exynos5250-dp-video-phy.txt|7 ++
   drivers/phy/Kconfig|8 ++
   drivers/phy/Makefile   |3 +-
   drivers/phy/phy-exynos-dp-video.c  |  130 

   4 files changed, 147 insertions(+), 1 deletion(-)
   create mode 100644 
Documentation/devicetree/bindings/phy/samsung,exynos5250-dp-video-phy.txt
   create mode 100644 drivers/phy/phy-exynos-dp-video.c

diff --git 
a/Documentation/devicetree/bindings/phy/samsung,exynos5250-dp-video-phy.txt
b/Documentation/devicetree/bindings/phy/samsung,exynos5250-dp-video-phy.txt
new file mode 100644
index 000..8b6fa79
--- /dev/null
+++ b/Documentation/devicetree/bindings/phy/samsung,exynos5250-dp-video-phy.txt
@@ -0,0 +1,7 @@
+Samsung EXYNOS SoC series DP PHY
+-
+
+Required properties:
+- compatible : should be samsung,exynos5250-dp-video-phy;
+- reg : offset and length of the DP PHY register set;
+- #phy-cells : from the generic phy bindings, must be 1;
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index 5f85909..6d10e3b 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -11,3 +11,11 @@ menuconfig GENERIC_PHY
  devices present in the kernel. This layer will have the generic
  API by which phy drivers can create PHY using the phy framework and
  phy users can obtain reference to the PHY.
+
+if GENERIC_PHY
+
+config PHY_EXYNOS_DP_VIDEO
+   tristate EXYNOS SoC series DP PHY driver
+   help
+ Support for DP PHY found on Samsung EXYNOS SoCs.
+endif
diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
index 9e9560f..d8d861c 100644
--- a/drivers/phy/Makefile
+++ b/drivers/phy/Makefile
@@ -2,4 +2,5 @@
   # Makefile for the phy drivers.
   #

-obj-$(CONFIG_GENERIC_PHY)  += phy-core.o
+obj-$(CONFIG_GENERIC_PHY)  += phy-core.o
+obj-$(CONFIG_PHY_EXYNOS_DP_VIDEO)  += phy-exynos-dp-video.o
diff --git a/drivers/phy/phy-exynos-dp-video.c 
b/drivers/phy/phy-exynos-dp-video.c
new file mode 100644
index 000..376b3bc2
--- /dev/null
+++ b/drivers/phy/phy-exynos-dp-video.c
@@ -0,0 +1,130 @@
+/*
+ * Samsung EXYNOS SoC series DP PHY driver
+ *
+ * Copyright (C) 2013 Samsung Electronics Co., Ltd.
+ * Author: Jingoo Han jg1@samsung.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include linux/delay.h


this header file is not needed here.


OK, I will remove it.




+#include linux/io.h
+#include linux/kernel.h
+#include linux/module.h
+#include linux/of.h
+#include linux/of_address.h
+#include linux/phy/phy.h
+#include linux/platform_device.h
+#include linux/spinlock.h
+
+/* DPTX_PHY_CONTROL register */
+#define EXYNOS_DPTX_PHY_ENABLE (1  0)
+
+struct exynos_dp_video_phy {
+   spinlock_t slock;
+   struct phy *phys;
+   void __iomem *regs;
+};
+
+static int __set_phy_state(struct exynos_dp_video_phy *state, unsigned int on)
+{
+   void __iomem *addr;
+   unsigned long flags;
+   u32 reg;
+
+   addr = state-regs;
+
+   spin_lock_irqsave(state-slock, flags);
+   reg = readl(addr);
+   if (on)
+   reg |= EXYNOS_DPTX_PHY_ENABLE;
+   else
+   reg = ~EXYNOS_DPTX_PHY_ENABLE;
+   writel(reg, addr);
+   spin_unlock_irqrestore(state-slock, flags);
+   return 0;
+}
+
+static int exynos_dp_video_phy_power_on(struct phy *phy)
+{
+   struct exynos_dp_video_phy *state = phy_get_drvdata(phy);
+
+   return __set_phy_state(state, 1);
+}
+
+static int exynos_dp_video_phy_power_off(struct phy *phy)
+{
+   struct exynos_dp_video_phy *state = phy_get_drvdata(phy);
+
+   return __set_phy_state(state, 0);
+}
+
+static struct phy *exynos_dp_video_phy_xlate(struct device *dev,
+   struct of_phandle_args *args)
+{
+   struct exynos_dp_video_phy *state = dev_get_drvdata(dev);
+
+   return state-phys;


you can instead use of_phy_simple_xlate for such simple cases.


OK, I will use of_phy_simple_xlate().


+}
+
+static struct phy_ops exynos_dp_video_phy_ops = {
+   .power_on   = exynos_dp_video_phy_power_on,
+   .power_off  = exynos_dp_video_phy_power_off,
+   .owner  = THIS_MODULE,
+};
+
+static int exynos_dp_video_phy_probe(struct platform_device *pdev)
+{
+   struct exynos_dp_video_phy *state;
+   struct device *dev = pdev-dev;
+   struct resource *res;
+   struct phy_provider *phy_provider;
+
+   state = 

Re: [PATCH 3/3] video: exynos_dp: Use the generic PHY driver

2013-06-28 Thread Jingoo Han
On Friday, June 28, 2013 2:58 PM, Kishon Vijay Abraham I wrote:
 
 Hi,
 
 On Friday 28 June 2013 10:54 AM, Jingoo Han wrote:
  Use the generic PHY API instead of the platform callback to control
  the DP PHY. The 'phy_label' field is added to the platform data
  structure to allow PHY lookup on non-dt platforms.
 
  Signed-off-by: Jingoo Han jg1@samsung.com
  ---
.../devicetree/bindings/video/exynos_dp.txt|   17 ---
drivers/video/exynos/exynos_dp_core.c  |  118 
  ++--
drivers/video/exynos/exynos_dp_core.h  |2 +
include/video/exynos_dp.h  |6 +-
4 files changed, 15 insertions(+), 128 deletions(-)
 
  diff --git a/Documentation/devicetree/bindings/video/exynos_dp.txt
 b/Documentation/devicetree/bindings/video/exynos_dp.txt
  index 84f10c1..a8320e3 100644
  --- a/Documentation/devicetree/bindings/video/exynos_dp.txt
  +++ b/Documentation/devicetree/bindings/video/exynos_dp.txt
  @@ -1,17 +1,6 @@
The Exynos display port interface should be configured based on
the type of panel connected to it.
 
  -We use two nodes:
  -   -dp-controller node
  -   -dptx-phy node(defined inside dp-controller node)
  -
  -For the DP-PHY initialization, we use the dptx-phy node.
  -Required properties for dptx-phy:
  -   -reg:
  -   Base address of DP PHY register.
  -   -samsung,enable-mask:
  -   The bit-mask used to enable/disable DP PHY.
  -
For the Panel initialization, we read data from dp-controller node.
Required properties for dp-controller:
  -compatible:
  @@ -67,12 +56,6 @@ SOC specific portion:
  interrupt-parent = combiner;
  clocks = clock 342;
  clock-names = dp;
  -
  -   dptx-phy {
  -   reg = 0x10040720;
  -   samsung,enable-mask = 1;
  -   };
  -
  };
 
Board Specific portion:
  diff --git a/drivers/video/exynos/exynos_dp_core.c 
  b/drivers/video/exynos/exynos_dp_core.c
  index 12bbede..bac515b 100644
  --- a/drivers/video/exynos/exynos_dp_core.c
  +++ b/drivers/video/exynos/exynos_dp_core.c
  @@ -19,6 +19,7 @@
#include linux/interrupt.h
#include linux/delay.h
#include linux/of.h
  +#include linux/phy/phy.h
 
#include video/exynos_dp.h
 
  @@ -960,84 +961,15 @@ static struct exynos_dp_platdata 
  *exynos_dp_dt_parse_pdata(struct device *dev)
  return ERR_PTR(-EINVAL);
  }
 
  -   return pd;
  -}
  -
  -static int exynos_dp_dt_parse_phydata(struct exynos_dp_device *dp)
  -{
  -   struct device_node *dp_phy_node = of_node_get(dp-dev-of_node);
  -   u32 phy_base;
  -   int ret = 0;
  -
  -   dp_phy_node = of_find_node_by_name(dp_phy_node, dptx-phy);
  -   if (!dp_phy_node) {
  -   dev_err(dp-dev, could not find dptx-phy node\n);
  -   return -ENODEV;
  -   }
  -
  -   if (of_property_read_u32(dp_phy_node, reg, phy_base)) {
  -   dev_err(dp-dev, failed to get reg for dptx-phy\n);
  -   ret = -EINVAL;
  -   goto err;
  -   }
  -
  -   if (of_property_read_u32(dp_phy_node, samsung,enable-mask,
  -   dp-enable_mask)) {
  -   dev_err(dp-dev, failed to get enable-mask for dptx-phy\n);
  -   ret = -EINVAL;
  -   goto err;
  -   }
  -
  -   dp-phy_addr = ioremap(phy_base, SZ_4);
  -   if (!dp-phy_addr) {
  -   dev_err(dp-dev, failed to ioremap dp-phy\n);
  -   ret = -ENOMEM;
  -   goto err;
  -   }
  -
  -err:
  -   of_node_put(dp_phy_node);
  -
  -   return ret;
  -}
  -
  -static void exynos_dp_phy_init(struct exynos_dp_device *dp)
  -{
  -   u32 reg;
  -
  -   reg = __raw_readl(dp-phy_addr);
  -   reg |= dp-enable_mask;
  -   __raw_writel(reg, dp-phy_addr);
  -}
  -
  -static void exynos_dp_phy_exit(struct exynos_dp_device *dp)
  -{
  -   u32 reg;
  +   pd-phy_label = dp;
 
 In the case of non-dt boot, this phy_label should have ideally come from
 platform code.

No, this is NOT the case of non-dt.

'pd-phy_label = dp;' is included in exynos_dp_dt_parse_pdata(),
not exynos_dp_phy_exit().
Also, exynos_dp_dt_parse_pdata() is called in the case of dt.

But, diff is a little bit confusing. :(


Best regards,
Jingoo Han

 
 Thanks
 Kishon

--
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 2/3] ARM: dts: Add DP PHY node to exynos5250.dtsi

2013-06-28 Thread Hui Wang

On 06/28/2013 01:58 PM, Jingoo Han wrote:

On Friday, June 28, 2013 2:42 PM, Kishon Vijay Abraham I wrote:

Hi,

On Friday 28 June 2013 10:53 AM, Jingoo Han wrote:

Add PHY provider node for the DP PHY.

Signed-off-by: Jingoo Han jg1@samsung.com
---
   arch/arm/boot/dts/exynos5250.dtsi |   13 -
   1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
b/arch/arm/boot/dts/exynos5250.dtsi
index 41cd625..d1d6e14 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -614,6 +614,12 @@
interrupts = 0 94 0;
};

+   dp_phy: video-phy@10040720 {
+   compatible = samsung,exynos5250-dp-video-phy;
+   reg = 0x10040720 4;
+   #phy-cells = 1;

phy-cells can be '0' here since this phy_provider implements only one PHY.

Oh, thank you.
I will fix it.
Don't forget to fix the corresponding description in the 
samsung,exynos5250-dp-video-phy.txt as well. :-)

Best regards,
Jingoo Han


Thanks
Kishon

--
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




--
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 2/3] ARM: dts: Add DP PHY node to exynos5250.dtsi

2013-06-28 Thread Jingoo Han
On Friday, June 28, 2013 3:07 PM, Hui Wang wrote:
 On 06/28/2013 01:58 PM, Jingoo Han wrote:
  On Friday, June 28, 2013 2:42 PM, Kishon Vijay Abraham I wrote:
  Hi,
 
  On Friday 28 June 2013 10:53 AM, Jingoo Han wrote:
  Add PHY provider node for the DP PHY.
 
  Signed-off-by: Jingoo Han jg1@samsung.com
  ---
 arch/arm/boot/dts/exynos5250.dtsi |   13 -
 1 file changed, 8 insertions(+), 5 deletions(-)
 
  diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
  b/arch/arm/boot/dts/exynos5250.dtsi
  index 41cd625..d1d6e14 100644
  --- a/arch/arm/boot/dts/exynos5250.dtsi
  +++ b/arch/arm/boot/dts/exynos5250.dtsi
  @@ -614,6 +614,12 @@
interrupts = 0 94 0;
};
 
  + dp_phy: video-phy@10040720 {
  + compatible = samsung,exynos5250-dp-video-phy;
  + reg = 0x10040720 4;
  + #phy-cells = 1;
  phy-cells can be '0' here since this phy_provider implements only one PHY.
  Oh, thank you.
  I will fix it.
 Don't forget to fix the corresponding description in the
 samsung,exynos5250-dp-video-phy.txt as well. :-)

Hi 

OK, I already fixed it. :)
Thank you for reminding me.

Best regards,
Jignoo Han

  Best regards,
  Jingoo Han
 
  Thanks
  Kishon
  --
  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
 
 

--
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 v3 3/5] video: exynos_mipi_dsim: Use the generic PHY driver

2013-06-28 Thread Donghwa Lee

On 06/28/2013 00:02, Sylwester Nawrocki wrote:

Use the generic PHY API instead of the platform callback to control
the MIPI DSIM DPHY. The 'phy_label' field is added to the platform
data structure to allow PHY lookup on non-dt platforms.

Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Acked-by: Felipe Balbi ba...@ti.com
---
  drivers/video/exynos/exynos_mipi_dsi.c |   18 +-
  include/video/exynos_mipi_dsim.h   |6 --
  2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/video/exynos/exynos_mipi_dsi.c 
b/drivers/video/exynos/exynos_mipi_dsi.c
index 32e5406..1f96004 100644
--- a/drivers/video/exynos/exynos_mipi_dsi.c
+++ b/drivers/video/exynos/exynos_mipi_dsi.c
@@ -156,8 +156,7 @@ static int exynos_mipi_dsi_blank_mode(struct 
mipi_dsim_device *dsim, int power)
exynos_mipi_regulator_enable(dsim);
  
  		/* enable MIPI-DSI PHY. */

-   if (dsim-pd-phy_enable)
-   dsim-pd-phy_enable(pdev, true);
+   phy_power_on(dsim-phy);
  
  		clk_enable(dsim-clock);
  
@@ -373,6 +372,10 @@ static int exynos_mipi_dsi_probe(struct platform_device *pdev)

return ret;
}
  
+	dsim-phy = devm_phy_get(pdev-dev, dsim_pd-phy_label);

+   if (IS_ERR(dsim-phy))
+   return PTR_ERR(dsim-phy);
+
dsim-clock = devm_clk_get(pdev-dev, dsim0);
if (IS_ERR(dsim-clock)) {
dev_err(pdev-dev, failed to get dsim clock source\n);
@@ -439,8 +442,7 @@ static int exynos_mipi_dsi_probe(struct platform_device 
*pdev)
exynos_mipi_regulator_enable(dsim);
  
  	/* enable MIPI-DSI PHY. */

-   if (dsim-pd-phy_enable)
-   dsim-pd-phy_enable(pdev, true);
+   phy_power_on(dsim-phy);
  
  	exynos_mipi_update_cfg(dsim);
  
@@ -504,9 +506,8 @@ static int exynos_mipi_dsi_suspend(struct device *dev)

if (client_drv  client_drv-suspend)
client_drv-suspend(client_dev);
  
-	/* enable MIPI-DSI PHY. */

-   if (dsim-pd-phy_enable)
-   dsim-pd-phy_enable(pdev, false);
+   /* disable MIPI-DSI PHY. */
+   phy_power_off(dsim-phy);
  
  	clk_disable(dsim-clock);
  
@@ -536,8 +537,7 @@ static int exynos_mipi_dsi_resume(struct device *dev)

exynos_mipi_regulator_enable(dsim);
  
  	/* enable MIPI-DSI PHY. */

-   if (dsim-pd-phy_enable)
-   dsim-pd-phy_enable(pdev, true);
+   phy_power_on(dsim-phy);
  
  	clk_enable(dsim-clock);
  
diff --git a/include/video/exynos_mipi_dsim.h b/include/video/exynos_mipi_dsim.h

index 89dc88a..fd69beb 100644
--- a/include/video/exynos_mipi_dsim.h
+++ b/include/video/exynos_mipi_dsim.h
@@ -216,6 +216,7 @@ struct mipi_dsim_config {
   *automatically.
   * @e_clk_src: select byte clock source.
   * @pd: pointer to MIPI-DSI driver platform data.
+ * @phy: pointer to the generic PHY
   */
  struct mipi_dsim_device {
struct device   *dev;
@@ -236,6 +237,7 @@ struct mipi_dsim_device {
boolsuspended;
  
  	struct mipi_dsim_platform_data	*pd;

+   struct phy  *phy;
  };
  
  /*

@@ -248,7 +250,7 @@ struct mipi_dsim_device {
   * @enabled: indicate whether mipi controller got enabled or not.
   * @lcd_panel_info: pointer for lcd panel specific structure.
   *this structure specifies width, height, timing and polarity and so on.
- * @phy_enable: pointer to a callback controlling D-PHY enable/reset
+ * @phy_label: the generic PHY label
   */
  struct mipi_dsim_platform_data {
charlcd_panel_name[PANEL_NAME_SIZE];
@@ -257,7 +259,7 @@ struct mipi_dsim_platform_data {
unsigned intenabled;
void*lcd_panel_info;
  
-	int (*phy_enable)(struct platform_device *pdev, bool on);

+   const char  *phy_label;
  };
  
  /*

I confirmed that this patch operates well. It looks good to me.

Acked-by: Donghwa Lee dh09@samsung.com

Thank you,
Donghwa Lee

--
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 V2 0/3] Generic PHY driver for the Exynos SoC DP PHY

2013-06-28 Thread Jingoo Han
This patch series adds a simple driver for the Samsung Exynos SoC
series DP transmitter PHY, using the generic PHY framework [1].
Previously the DP PHY used a platform callback or internal DT node
to control the PHY power enable bit.
The platform callback and internal DT node can be dropped and this
driver does not need any calls back to the platform code.

These patches was tested on Exynos5250.

This PATCH v2 follows:
 * PATCH v1, sent on June, 28th 2013

Changes between v1 and v2:
  * Replaced exynos_dp_video_phy_xlate() with of_phy_simple_xlate(),
as Kishon Vijay Abraham I guided.
  * Set the value of phy-cells as 0, because the phy_provider implements
only one PHY.
  * Removed unnecessary header include.
  * Added '#ifdef CONFIG_OF' and of_match_ptr macro.

This series depends on the generic PHY framework [1]. These patches
refer to Sylwester Nawrocki's patches about Exynos MIPI [2].

[1] https://lkml.org/lkml/2013/6/26/259
[2] http://www.spinics.net/lists/linux-samsung-soc/msg20034.html

Jingoo Han (3):
  phy: Add driver for Exynos DP PHY
  ARM: dts: Add DP PHY node to exynos5250.dtsi
  video: exynos_dp: Use the generic PHY driver

 .../phy/samsung,exynos5250-dp-video-phy.txt|7 ++
 .../devicetree/bindings/video/exynos_dp.txt|   17 ---
 arch/arm/boot/dts/exynos5250.dtsi  |   13 -
 drivers/phy/Kconfig|8 ++
 drivers/phy/Makefile   |3 +-
 drivers/phy/phy-exynos-dp-video.c  |  122 
 drivers/video/exynos/exynos_dp_core.c  |  118 ++--
 drivers/video/exynos/exynos_dp_core.h  |2 +
 include/video/exynos_dp.h  |6 +-
 9 files changed, 162 insertions(+), 134 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/phy/samsung,exynos5250-dp-video-phy.txt
 create mode 100644 drivers/phy/phy-exynos-dp-video.c

--
1.7.10.4

--
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 V2 1/3] phy: Add driver for Exynos DP PHY

2013-06-28 Thread Jingoo Han
Add a PHY provider driver for the Samsung Exynos SoC DP PHY.

Signed-off-by: Jingoo Han jg1@samsung.com
---
 .../phy/samsung,exynos5250-dp-video-phy.txt|7 ++
 drivers/phy/Kconfig|8 ++
 drivers/phy/Makefile   |3 +-
 drivers/phy/phy-exynos-dp-video.c  |  122 
 4 files changed, 139 insertions(+), 1 deletion(-)
 create mode 100644 
Documentation/devicetree/bindings/phy/samsung,exynos5250-dp-video-phy.txt
 create mode 100644 drivers/phy/phy-exynos-dp-video.c

diff --git 
a/Documentation/devicetree/bindings/phy/samsung,exynos5250-dp-video-phy.txt
b/Documentation/devicetree/bindings/phy/samsung,exynos5250-dp-video-phy.txt
new file mode 100644
index 000..d1771ef
--- /dev/null
+++ b/Documentation/devicetree/bindings/phy/samsung,exynos5250-dp-video-phy.txt
@@ -0,0 +1,7 @@
+Samsung EXYNOS SoC series DP PHY
+-
+
+Required properties:
+- compatible : should be samsung,exynos5250-dp-video-phy;
+- reg : offset and length of the DP PHY register set;
+- #phy-cells : from the generic phy bindings, must be 0;
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index 5f85909..6d10e3b 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -11,3 +11,11 @@ menuconfig GENERIC_PHY
  devices present in the kernel. This layer will have the generic
  API by which phy drivers can create PHY using the phy framework and
  phy users can obtain reference to the PHY.
+
+if GENERIC_PHY
+
+config PHY_EXYNOS_DP_VIDEO
+   tristate EXYNOS SoC series DP PHY driver
+   help
+ Support for DP PHY found on Samsung EXYNOS SoCs.
+endif
diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
index 9e9560f..d8d861c 100644
--- a/drivers/phy/Makefile
+++ b/drivers/phy/Makefile
@@ -2,4 +2,5 @@
 # Makefile for the phy drivers.
 #
 
-obj-$(CONFIG_GENERIC_PHY)  += phy-core.o
+obj-$(CONFIG_GENERIC_PHY)  += phy-core.o
+obj-$(CONFIG_PHY_EXYNOS_DP_VIDEO)  += phy-exynos-dp-video.o
diff --git a/drivers/phy/phy-exynos-dp-video.c 
b/drivers/phy/phy-exynos-dp-video.c
new file mode 100644
index 000..9a3d6f1
--- /dev/null
+++ b/drivers/phy/phy-exynos-dp-video.c
@@ -0,0 +1,122 @@
+/*
+ * Samsung EXYNOS SoC series DP PHY driver
+ *
+ * Copyright (C) 2013 Samsung Electronics Co., Ltd.
+ * Author: Jingoo Han jg1@samsung.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include linux/io.h
+#include linux/kernel.h
+#include linux/module.h
+#include linux/of.h
+#include linux/of_address.h
+#include linux/phy/phy.h
+#include linux/platform_device.h
+#include linux/spinlock.h
+
+/* DPTX_PHY_CONTROL register */
+#define EXYNOS_DPTX_PHY_ENABLE (1  0)
+
+struct exynos_dp_video_phy {
+   spinlock_t slock;
+   struct phy *phys;
+   void __iomem *regs;
+};
+
+static int __set_phy_state(struct exynos_dp_video_phy *state, unsigned int on)
+{
+   void __iomem *addr;
+   unsigned long flags;
+   u32 reg;
+
+   addr = state-regs;
+
+   spin_lock_irqsave(state-slock, flags);
+   reg = readl(addr);
+   if (on)
+   reg |= EXYNOS_DPTX_PHY_ENABLE;
+   else
+   reg = ~EXYNOS_DPTX_PHY_ENABLE;
+   writel(reg, addr);
+   spin_unlock_irqrestore(state-slock, flags);
+   return 0;
+}
+
+static int exynos_dp_video_phy_power_on(struct phy *phy)
+{
+   struct exynos_dp_video_phy *state = phy_get_drvdata(phy);
+
+   return __set_phy_state(state, 1);
+}
+
+static int exynos_dp_video_phy_power_off(struct phy *phy)
+{
+   struct exynos_dp_video_phy *state = phy_get_drvdata(phy);
+
+   return __set_phy_state(state, 0);
+}
+
+static struct phy_ops exynos_dp_video_phy_ops = {
+   .power_on   = exynos_dp_video_phy_power_on,
+   .power_off  = exynos_dp_video_phy_power_off,
+   .owner  = THIS_MODULE,
+};
+
+static int exynos_dp_video_phy_probe(struct platform_device *pdev)
+{
+   struct exynos_dp_video_phy *state;
+   struct device *dev = pdev-dev;
+   struct resource *res;
+   struct phy_provider *phy_provider;
+
+   state = devm_kzalloc(dev, sizeof(*state), GFP_KERNEL);
+   if (!state)
+   return -ENOMEM;
+
+   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+
+   state-regs = devm_ioremap_resource(dev, res);
+   if (IS_ERR(state-regs))
+   return PTR_ERR(state-regs);
+
+   dev_set_drvdata(dev, state);
+
+   phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
+   if (IS_ERR(phy_provider))
+   return PTR_ERR(phy_provider);
+
+   state-phys = devm_phy_create(dev, 0, exynos_dp_video_phy_ops, dp);
+   if (IS_ERR(state-phys)) {
+   dev_err(dev, failed to 

[PATCH V2 2/3] ARM: dts: Add DP PHY node to exynos5250.dtsi

2013-06-28 Thread Jingoo Han
Add PHY provider node for the DP PHY.

Signed-off-by: Jingoo Han jg1@samsung.com
---
 arch/arm/boot/dts/exynos5250.dtsi |   13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
b/arch/arm/boot/dts/exynos5250.dtsi
index 41cd625..f7bac75 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -614,6 +614,12 @@
interrupts = 0 94 0;
};
 
+   dp_phy: video-phy@10040720 {
+   compatible = samsung,exynos5250-dp-video-phy;
+   reg = 0x10040720 4;
+   #phy-cells = 0;
+   };
+
dp-controller {
compatible = samsung,exynos5-dp;
reg = 0x145b 0x1000;
@@ -623,11 +629,8 @@
clock-names = dp;
#address-cells = 1;
#size-cells = 0;
-
-   dptx-phy {
-   reg = 0x10040720;
-   samsung,enable-mask = 1;
-   };
+   phys = dp_phy 0;
+   phy-names = dp;
};
 
fimd {
-- 
1.7.10.4


--
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 V2 3/3] video: exynos_dp: Use the generic PHY driver

2013-06-28 Thread Jingoo Han
Use the generic PHY API instead of the platform callback to control
the DP PHY. The 'phy_label' field is added to the platform data
structure to allow PHY lookup on non-dt platforms.

Signed-off-by: Jingoo Han jg1@samsung.com
---
 .../devicetree/bindings/video/exynos_dp.txt|   17 ---
 drivers/video/exynos/exynos_dp_core.c  |  118 ++--
 drivers/video/exynos/exynos_dp_core.h  |2 +
 include/video/exynos_dp.h  |6 +-
 4 files changed, 15 insertions(+), 128 deletions(-)

diff --git a/Documentation/devicetree/bindings/video/exynos_dp.txt 
b/Documentation/devicetree/bindings/video/exynos_dp.txt
index 84f10c1..a8320e3 100644
--- a/Documentation/devicetree/bindings/video/exynos_dp.txt
+++ b/Documentation/devicetree/bindings/video/exynos_dp.txt
@@ -1,17 +1,6 @@
 The Exynos display port interface should be configured based on
 the type of panel connected to it.
 
-We use two nodes:
-   -dp-controller node
-   -dptx-phy node(defined inside dp-controller node)
-
-For the DP-PHY initialization, we use the dptx-phy node.
-Required properties for dptx-phy:
-   -reg:
-   Base address of DP PHY register.
-   -samsung,enable-mask:
-   The bit-mask used to enable/disable DP PHY.
-
 For the Panel initialization, we read data from dp-controller node.
 Required properties for dp-controller:
-compatible:
@@ -67,12 +56,6 @@ SOC specific portion:
interrupt-parent = combiner;
clocks = clock 342;
clock-names = dp;
-
-   dptx-phy {
-   reg = 0x10040720;
-   samsung,enable-mask = 1;
-   };
-
};
 
 Board Specific portion:
diff --git a/drivers/video/exynos/exynos_dp_core.c 
b/drivers/video/exynos/exynos_dp_core.c
index 12bbede..bac515b 100644
--- a/drivers/video/exynos/exynos_dp_core.c
+++ b/drivers/video/exynos/exynos_dp_core.c
@@ -19,6 +19,7 @@
 #include linux/interrupt.h
 #include linux/delay.h
 #include linux/of.h
+#include linux/phy/phy.h
 
 #include video/exynos_dp.h
 
@@ -960,84 +961,15 @@ static struct exynos_dp_platdata 
*exynos_dp_dt_parse_pdata(struct device *dev)
return ERR_PTR(-EINVAL);
}
 
-   return pd;
-}
-
-static int exynos_dp_dt_parse_phydata(struct exynos_dp_device *dp)
-{
-   struct device_node *dp_phy_node = of_node_get(dp-dev-of_node);
-   u32 phy_base;
-   int ret = 0;
-
-   dp_phy_node = of_find_node_by_name(dp_phy_node, dptx-phy);
-   if (!dp_phy_node) {
-   dev_err(dp-dev, could not find dptx-phy node\n);
-   return -ENODEV;
-   }
-
-   if (of_property_read_u32(dp_phy_node, reg, phy_base)) {
-   dev_err(dp-dev, failed to get reg for dptx-phy\n);
-   ret = -EINVAL;
-   goto err;
-   }
-
-   if (of_property_read_u32(dp_phy_node, samsung,enable-mask,
-   dp-enable_mask)) {
-   dev_err(dp-dev, failed to get enable-mask for dptx-phy\n);
-   ret = -EINVAL;
-   goto err;
-   }
-
-   dp-phy_addr = ioremap(phy_base, SZ_4);
-   if (!dp-phy_addr) {
-   dev_err(dp-dev, failed to ioremap dp-phy\n);
-   ret = -ENOMEM;
-   goto err;
-   }
-
-err:
-   of_node_put(dp_phy_node);
-
-   return ret;
-}
-
-static void exynos_dp_phy_init(struct exynos_dp_device *dp)
-{
-   u32 reg;
-
-   reg = __raw_readl(dp-phy_addr);
-   reg |= dp-enable_mask;
-   __raw_writel(reg, dp-phy_addr);
-}
-
-static void exynos_dp_phy_exit(struct exynos_dp_device *dp)
-{
-   u32 reg;
+   pd-phy_label = dp;
 
-   reg = __raw_readl(dp-phy_addr);
-   reg = ~(dp-enable_mask);
-   __raw_writel(reg, dp-phy_addr);
+   return pd;
 }
 #else
 static struct exynos_dp_platdata *exynos_dp_dt_parse_pdata(struct device *dev)
 {
return NULL;
 }
-
-static int exynos_dp_dt_parse_phydata(struct exynos_dp_device *dp)
-{
-   return -EINVAL;
-}
-
-static void exynos_dp_phy_init(struct exynos_dp_device *dp)
-{
-   return;
-}
-
-static void exynos_dp_phy_exit(struct exynos_dp_device *dp)
-{
-   return;
-}
 #endif /* CONFIG_OF */
 
 static int exynos_dp_probe(struct platform_device *pdev)
@@ -1061,10 +993,6 @@ static int exynos_dp_probe(struct platform_device *pdev)
pdata = exynos_dp_dt_parse_pdata(pdev-dev);
if (IS_ERR(pdata))
return PTR_ERR(pdata);
-
-   ret = exynos_dp_dt_parse_phydata(dp);
-   if (ret)
-   return ret;
} else {
pdata = pdev-dev.platform_data;
if (!pdata) {
@@ -1073,6 +1001,10 @@ static int exynos_dp_probe(struct platform_device *pdev)
}
}
 
+   dp-phy = devm_phy_get(pdev-dev, pdata-phy_label);
+   if (IS_ERR(dp-phy))
+   return 

Re: [PATCH RFC v3] s5k5baf: add camera sensor driver

2013-06-28 Thread Andrzej Hajda
Hi Sylwester,


Thanks for the thorough review.


On 06/27/2013 05:57 PM, Sylwester Nawrocki wrote:
 Hi Andrzej,

 On 06/05/2013 01:44 PM, Andrzej Hajda wrote:
 Driver for Samsung S5K5BAF UXGA 1/5 2M CMOS Image Sensor
 with embedded SoC ISP.
 The driver exposes the sensor as two V4L2 subdevices:
 - S5K5BAF-CIS - pure CMOS Image Sensor, fixed 1600x1200 format,
   no controls.
 - S5K5BAF-ISP - Image Signal Processor, formats up to 1600x1200,
   pre/post ISP cropping, downscaling via selection API, controls.

 Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
 Signed-off-by: Andrzej Hajda a.ha...@samsung.com
 Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
 ---
 v3:
 - narrowed state-error usage to i2c and power errors,
 Hmm, there still seems to be quite a few functions that use state-error
 and IMHO it would be better if those just return the result directly.
 How about changing at least these:

 static void s5k5baf_check_fw_revision(struct s5k5baf *state)
 static void s5k5baf_hw_set_video_bus(struct s5k5baf *state)
 static void s5k5baf_power_on(struct s5k5baf *state)
 static void s5k5baf_power_off(struct s5k5baf *state)
 static void s5k5baf_hw_set_crop_rects(struct s5k5baf *state)

 to return result directly ?
I see no good reason in complicating those functions and their callers,
beside positive review :) OK I see some reasons, but it still does not
convince me.

Maybe I should present the idea of state-error 'pattern' in separate RFC
to attract broader audience and eventually get public acceptance or
eternal damnation :)

Anyway I will convert those functions to the 'classic' form in next
patch version,
but my heart is bleeding :)

 Personally I would also convert functins used in s5k5baf_s_ctrl()
 handler:
   s5k5baf_hw_set_awb()
   s5k5baf_hw_set_colorfx()
   s5k5baf_hw_set_auto_exposure()
   s5k5baf_hw_set_mirror()
   s5k5baf_hw_set_anti_flicker()
   s5k5baf_hw_set_test_pattern()

 And have state-err cleared at beginning of s5k5baf_s_ctrl().
 But I'll probably not complain if those are left as they are. :)

 - private gain controls replaced by red/blue balance user controls,
 - added checks to devicetree gpio node parsing

 v2:
 - lower-cased driver name,
 - removed underscore from regulator names,
 - removed platform data code,
 - v4l controls grouped in anonymous structs,
 - added s5k5baf_clear_error function,
 - private controls definitions moved to uapi header file,
 - added v4l2-controls.h reservation for private controls,
 - corrected subdev registered/unregistered code,
 - .log_status sudbev op set to v4l2 helper,
 - moved entity link creation to probe routines,
 - added cleanup on error to probe function.
 ---
  .../devicetree/bindings/media/samsung-s5k5baf.txt  |   53 +
  MAINTAINERS|7 +
  drivers/media/i2c/Kconfig  |7 +
  drivers/media/i2c/Makefile |1 +
  drivers/media/i2c/s5k5baf.c| 1979 
 
  5 files changed, 2047 insertions(+)
  create mode 100644 
 Documentation/devicetree/bindings/media/samsung-s5k5baf.txt
  create mode 100644 drivers/media/i2c/s5k5baf.c

 diff --git a/Documentation/devicetree/bindings/media/samsung-s5k5baf.txt 
 b/Documentation/devicetree/bindings/media/samsung-s5k5baf.txt
 new file mode 100644
 index 000..0e46743
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/media/samsung-s5k5baf.txt
 @@ -0,0 +1,53 @@
 +Samsung S5K5BAF UXGA 1/5 2M CMOS Image Sensor with embedded SoC ISP
 +-
 +
 +Required properties:
 +
 +- compatible  : samsung,s5k5baf;
 +- reg : i2c slave address of the sensor;
 i2c should be capitalized.
OK

 [...]
 +/* Auto-algorithms enable mask */
 +#define REG_DBG_AUTOALG_EN  0x03f8
 +#define  AALG_ALL_ENBIT(0)
 +#define  AALG_AE_EN BIT(1)
 +#define  AALG_DIVLEI_EN BIT(2)
 +#define  AALG_WB_EN BIT(3)
 +#define  AALG_USE_WB_FOR_ISPBIT(4)
 +#define  AALG_FLICKER_ENBIT(5)
 +#define  AALG_FIT_ENBIT(6)
 +#define  AALG_WRHW_EN   BIT(7)
 Perhaps some comment on what the below definitions refer to ?
OK

 +#define REG_PTR_CCM_HORIZON 0x06d0
 +#define REG_PTR_CCM_INCANDESCENT0x06d4
 +#define REG_PTR_CCM_WARM_WHITE  0x06d8
 +#define REG_PTR_CCM_COOL_WHITE  0x06dc
 +#define REG_PTR_CCM_DL500x06e0
 +#define REG_PTR_CCM_DL650x06e4
 +#define REG_PTR_CCM_OUTDOOR 0x06ec
 +
 +#define REG_ARR_CCM(n)  (0x2800 + 36 * (n))
 +
 [...]
 +struct s5k5baf_ctrls {
 +struct v4l2_ctrl_handler handler;
 +struct { /* Auto / manual white balance cluster */
 +struct v4l2_ctrl *awb;
 +struct v4l2_ctrl *gain_red;
 +struct v4l2_ctrl 

Re: [PATCH v3 1/5] phy: Add driver for Exynos MIPI CSIS/DSIM DPHYs

2013-06-28 Thread Hui Wang

On 06/26/2013 11:02 PM, Sylwester Nawrocki wrote:

Add a PHY provider driver for the Samsung S5P/Exynos SoC MIPI CSI-2
receiver and MIPI DSI transmitter DPHYs.

Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
Changes since v2:
  - adapted to the generic PHY API v9: use phy_set/get_drvdata(),
  - fixed of_xlate callback to return ERR_PTR() instead of NULL,
  - namespace cleanup, put GPL v2 as MODULE_LICENSE, removed pr_debug,
  - removed phy id check in __set_phy_state().
---

[...]

+
+   if (IS_EXYNOS_MIPI_DSIM_PHY_ID(id))
+   reset = EXYNOS_MIPI_PHY_MRESETN;
+   else
+   reset = EXYNOS_MIPI_PHY_SRESETN;
+
+   spin_lock_irqsave(state-slock, flags);
Sorry for one stupid question here, why do you use spin_lock_irqsave() 
rather than spin_lock(),

I don't see the irq handler will use this spinlock anywhere in this c file.


Regards,
Hui.

+   reg = readl(addr);
+   if (on)
+   reg |= reset;
+   else
+   reg = ~reset;
+   writel(reg, addr);
+
+   /* Clear ENABLE bit only if MRESETN, SRESETN bits are not set. */
+   if (on)
+   reg |= EXYNOS_MIPI_PHY_ENABLE;
+   else if (!(reg  EXYNOS_MIPI_PHY_RESET_MASK))
+   reg = ~EXYNOS_MIPI_PHY_ENABLE;
+
+   writel(reg, addr);
+   spin_unlock_irqrestore(state-slock, flags);
+   return 0;
+}



--
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


BTTV card

2013-06-28 Thread P.J. Marsh
The card type is GeoVision GV800 which is made up of 1 master and 3 slave 
controllers, using BT878 capture chips.


02:00.0 Multimedia video controller: Brooktree Corporation Bt878 Video 
Capture (rev 11)
02:00.1 Multimedia controller: Brooktree Corporation Bt878 Audio Capture 
(rev 11)
02:04.0 Multimedia video controller: Brooktree Corporation Bt878 Video 
Capture (rev 11)
02:04.1 Multimedia controller: Brooktree Corporation Bt878 Audio Capture 
(rev 11)
02:08.0 Multimedia video controller: Brooktree Corporation Bt878 Video 
Capture (rev 11)
02:08.1 Multimedia controller: Brooktree Corporation Bt878 Audio Capture 
(rev 11)
02:0c.0 Multimedia video controller: Brooktree Corporation Bt878 Video 
Capture (rev 11)
02:0c.1 Multimedia controller: Brooktree Corporation Bt878 Audio Capture 
(rev 11)



[8.353747] bttv: Bt8xx card found (0).
[8.362307] bttv :02:00.0: PCI INT A - GSI 17 (level, low) - IRQ 
17
[8.375254] bttv0: Bt878 (rev 17) at :02:00.0, irq: 17, latency: 
32, mmio: 0xfddff000

[8.399279] bttv0: subsystem: 800a:763c (UNKNOWN)
[8.405904] please mail id, board name and the correct card= insmod 
option to linux-media@vger.kernel.org
[8.405915] bttv0: using: Geovision GV-800(S) (master) [card=157,insmod 
option]

[8.421118] bttv0: gpio: en=, out= in=00ff28ff [init]
[8.422718] bttv0: tuner absent
[8.430398] bttv0: registered device video0
[8.438438] bttv0: PLL: 28636363 = 35468950 .
[8.443718] bttv0: registered device vbi0
[8.455725] bttv0: PLL: 28636363 = 35468950 ..
[8.457127] bttv0: PLL: 28636363 = 35468950 . ok
[8.475673]  ok
[8.500467]  ok
[8.522681] bttv: Bt8xx card found (1).
[8.528970] bttv :02:04.0: PCI INT A - GSI 17 (level, low) - IRQ 
17

[8.536409] ACPI: PCI Interrupt Link [ALKC] enabled at IRQ 22
[8.542033] bttv1: Bt878 (rev 17) at :02:04.0, irq: 17, latency: 
32, mmio: 0xfddfd000
[8.553156] VIA 82xx Audio :00:11.5: PCI INT C - Link[ALKC] - GSI 
22 (level, low) - IRQ 22

[8.564883] bttv1: subsystem: 800b:763c (UNKNOWN)
[8.570814] please mail id, board name and the correct card= insmod 
option to linux-media@vger.kernel.org
[8.570823] bttv1: using: Geovision GV-800(S) (slave) [card=158,insmod 
option]

[8.583834] VIA 82xx Audio :00:11.5: setting latency timer to 64
[8.584063] bttv1: gpio: en=, out= in=00ff7fff [init]
[8.585057] bttv1: tuner absent
[8.592312] bttv1: registered device video1
[8.599443] bttv1: PLL: 28636363 = 35468950 .
[8.601057] bttv1: registered device vbi1
[8.612344] bttv1: PLL: 28636363 = 35468950 ..
[8.613757] bttv1: PLL: 28636363 = 35468950 . ok
[8.630062]  ok
[8.644061]  ok
[8.658120] bttv: Bt8xx card found (2).
[8.663159] bttv :02:08.0: PCI INT A - GSI 17 (level, low) - IRQ 
17
[8.668256] bttv2: Bt878 (rev 17) at :02:08.0, irq: 17, latency: 
32, mmio: 0xfddfb000

[8.678373] bttv2: subsystem: 800c:763c (UNKNOWN)
[8.683571] please mail id, board name and the correct card= insmod 
option to linux-media@vger.kernel.org
[8.683581] bttv2: using: Geovision GV-800(S) (slave) [card=158,insmod 
option]

[8.695119] bttv2: gpio: en=, out= in=00ffbdff [init]
[8.696122] bttv2: tuner absent
[8.702843] bttv2: registered device video2
[8.709604] bttv2: PLL: 28636363 = 35468950 .
[8.711207] bttv2: registered device vbi2
[8.722183] bttv2: PLL: 28636363 = 35468950 ..
[8.723598] bttv2: PLL: 28636363 = 35468950 . ok
[8.740067]  ok
[8.754277]  ok
[8.768148] bttv: Bt8xx card found (3).
[8.773117] bttv :02:0c.0: PCI INT A - GSI 17 (level, low) - IRQ 
17
[8.778113] bttv3: Bt878 (rev 17) at :02:0c.0, irq: 17, latency: 
32, mmio: 0xfddf9000

[8.787938] bttv3: subsystem: 800d:763c (UNKNOWN)
[8.792821] please mail id, board name and the correct card= insmod 
option to linux-media@vger.kernel.org
[8.792830] bttv3: using: Geovision GV-800(S) (slave) [card=158,insmod 
option]

[8.803420] bttv3: gpio: en=, out= in=00ff [init]
[8.803698] bttv3: tuner absent
[8.809046] bttv3: registered device video3
[8.814242] bttv3: registered device vbi3
[8.819155] bttv3: PLL: 28636363 = 35468950 .. ok

regards,

Paul.

Contributor to: www.uhf-satcom.com - http://twitter.com/UHF_Satcom

UHF Satcom Yahoo Group: http://groups.yahoo.com/group/UHF-Satcom/

IRC - pjm @ #hearsat on irc.starchat.net

Correspondents should note that all communications to this address
are automatically logged, monitored and/or recorded for lawful
or other purposes.

Telephone: 0044 (0)845 193 0050 Skype: M0EYT_Paul

--
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  

[PATCH] usbtv: fix dependency

2013-06-28 Thread Hans Verkuil
This fixes a dependency problem as found by Randy Dunlap:

https://lkml.org/lkml/2013/6/27/501

Mauro, is there any reason for any V4L2 driver to depend on VIDEO_DEV instead of
just VIDEO_V4L2?

Some drivers depend on VIDEO_DEV, some on VIDEO_V4L2, some on both. It's all
pretty chaotic.

Regards,

Hans

diff --git a/drivers/media/usb/usbtv/Kconfig b/drivers/media/usb/usbtv/Kconfig
index 8864436..7c5b860 100644
--- a/drivers/media/usb/usbtv/Kconfig
+++ b/drivers/media/usb/usbtv/Kconfig
@@ -1,6 +1,6 @@
 config VIDEO_USBTV
 tristate USBTV007 video capture support
-depends on VIDEO_DEV
+depends on VIDEO_V4L2
 select VIDEOBUF2_VMALLOC
 
 ---help---
--
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 3/3] video: exynos_dp: Use the generic PHY driver

2013-06-28 Thread Kishon Vijay Abraham I

Hi,

On Friday 28 June 2013 11:34 AM, Jingoo Han wrote:

On Friday, June 28, 2013 2:58 PM, Kishon Vijay Abraham I wrote:


Hi,

On Friday 28 June 2013 10:54 AM, Jingoo Han wrote:

Use the generic PHY API instead of the platform callback to control
the DP PHY. The 'phy_label' field is added to the platform data
structure to allow PHY lookup on non-dt platforms.

Signed-off-by: Jingoo Han jg1@samsung.com
---
   .../devicetree/bindings/video/exynos_dp.txt|   17 ---
   drivers/video/exynos/exynos_dp_core.c  |  118 
++--
   drivers/video/exynos/exynos_dp_core.h  |2 +
   include/video/exynos_dp.h  |6 +-
   4 files changed, 15 insertions(+), 128 deletions(-)

diff --git a/Documentation/devicetree/bindings/video/exynos_dp.txt

b/Documentation/devicetree/bindings/video/exynos_dp.txt

index 84f10c1..a8320e3 100644
--- a/Documentation/devicetree/bindings/video/exynos_dp.txt
+++ b/Documentation/devicetree/bindings/video/exynos_dp.txt
@@ -1,17 +1,6 @@
   The Exynos display port interface should be configured based on
   the type of panel connected to it.

-We use two nodes:
-   -dp-controller node
-   -dptx-phy node(defined inside dp-controller node)
-
-For the DP-PHY initialization, we use the dptx-phy node.
-Required properties for dptx-phy:
-   -reg:
-   Base address of DP PHY register.
-   -samsung,enable-mask:
-   The bit-mask used to enable/disable DP PHY.
-
   For the Panel initialization, we read data from dp-controller node.
   Required properties for dp-controller:
-compatible:
@@ -67,12 +56,6 @@ SOC specific portion:
interrupt-parent = combiner;
clocks = clock 342;
clock-names = dp;
-
-   dptx-phy {
-   reg = 0x10040720;
-   samsung,enable-mask = 1;
-   };
-
};

   Board Specific portion:
diff --git a/drivers/video/exynos/exynos_dp_core.c 
b/drivers/video/exynos/exynos_dp_core.c
index 12bbede..bac515b 100644
--- a/drivers/video/exynos/exynos_dp_core.c
+++ b/drivers/video/exynos/exynos_dp_core.c
@@ -19,6 +19,7 @@
   #include linux/interrupt.h
   #include linux/delay.h
   #include linux/of.h
+#include linux/phy/phy.h

   #include video/exynos_dp.h

@@ -960,84 +961,15 @@ static struct exynos_dp_platdata 
*exynos_dp_dt_parse_pdata(struct device *dev)
return ERR_PTR(-EINVAL);
}

-   return pd;
-}
-
-static int exynos_dp_dt_parse_phydata(struct exynos_dp_device *dp)
-{
-   struct device_node *dp_phy_node = of_node_get(dp-dev-of_node);
-   u32 phy_base;
-   int ret = 0;
-
-   dp_phy_node = of_find_node_by_name(dp_phy_node, dptx-phy);
-   if (!dp_phy_node) {
-   dev_err(dp-dev, could not find dptx-phy node\n);
-   return -ENODEV;
-   }
-
-   if (of_property_read_u32(dp_phy_node, reg, phy_base)) {
-   dev_err(dp-dev, failed to get reg for dptx-phy\n);
-   ret = -EINVAL;
-   goto err;
-   }
-
-   if (of_property_read_u32(dp_phy_node, samsung,enable-mask,
-   dp-enable_mask)) {
-   dev_err(dp-dev, failed to get enable-mask for dptx-phy\n);
-   ret = -EINVAL;
-   goto err;
-   }
-
-   dp-phy_addr = ioremap(phy_base, SZ_4);
-   if (!dp-phy_addr) {
-   dev_err(dp-dev, failed to ioremap dp-phy\n);
-   ret = -ENOMEM;
-   goto err;
-   }
-
-err:
-   of_node_put(dp_phy_node);
-
-   return ret;
-}
-
-static void exynos_dp_phy_init(struct exynos_dp_device *dp)
-{
-   u32 reg;
-
-   reg = __raw_readl(dp-phy_addr);
-   reg |= dp-enable_mask;
-   __raw_writel(reg, dp-phy_addr);
-}
-
-static void exynos_dp_phy_exit(struct exynos_dp_device *dp)
-{
-   u32 reg;
+   pd-phy_label = dp;


In the case of non-dt boot, this phy_label should have ideally come from
platform code.


No, this is NOT the case of non-dt.

'pd-phy_label = dp;' is included in exynos_dp_dt_parse_pdata(),
not exynos_dp_phy_exit().
Also, exynos_dp_dt_parse_pdata() is called in the case of dt.


ah.. right. Do you support non-dt boot. I dont see any modifications in
the platform code?

Thanks
Kishon
--
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 1/3] phy: Add driver for Exynos DP PHY

2013-06-28 Thread Kishon Vijay Abraham I

Hi,

On Friday 28 June 2013 10:52 AM, Jingoo Han wrote:

Add a PHY provider driver for the Samsung Exynos SoC DP PHY.

Signed-off-by: Jingoo Han jg1@samsung.com
---
  .../phy/samsung,exynos5250-dp-video-phy.txt|7 ++
  drivers/phy/Kconfig|8 ++
  drivers/phy/Makefile   |3 +-
  drivers/phy/phy-exynos-dp-video.c  |  130 
  4 files changed, 147 insertions(+), 1 deletion(-)
  create mode 100644 
Documentation/devicetree/bindings/phy/samsung,exynos5250-dp-video-phy.txt
  create mode 100644 drivers/phy/phy-exynos-dp-video.c

diff --git 
a/Documentation/devicetree/bindings/phy/samsung,exynos5250-dp-video-phy.txt
b/Documentation/devicetree/bindings/phy/samsung,exynos5250-dp-video-phy.txt
new file mode 100644
index 000..8b6fa79
--- /dev/null
+++ b/Documentation/devicetree/bindings/phy/samsung,exynos5250-dp-video-phy.txt


How about creating a single Documentation file for all samsung video phys? 
Sylwester?


Thanks
Kishon
--
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 V2 1/3] phy: Add driver for Exynos DP PHY

2013-06-28 Thread Felipe Balbi
On Fri, Jun 28, 2013 at 04:15:32PM +0900, Jingoo Han wrote:
 Add a PHY provider driver for the Samsung Exynos SoC DP PHY.
 
 Signed-off-by: Jingoo Han jg1@samsung.com

Now that you fixed Kishon's concerns, this looks pretty good:

Acked-by: Felipe Balbi ba...@ti.com

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH V2 2/3] ARM: dts: Add DP PHY node to exynos5250.dtsi

2013-06-28 Thread Felipe Balbi
On Fri, Jun 28, 2013 at 04:16:44PM +0900, Jingoo Han wrote:
 Add PHY provider node for the DP PHY.
 
 Signed-off-by: Jingoo Han jg1@samsung.com
 ---
  arch/arm/boot/dts/exynos5250.dtsi |   13 -
  1 file changed, 8 insertions(+), 5 deletions(-)
 
 diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
 b/arch/arm/boot/dts/exynos5250.dtsi
 index 41cd625..f7bac75 100644
 --- a/arch/arm/boot/dts/exynos5250.dtsi
 +++ b/arch/arm/boot/dts/exynos5250.dtsi
 @@ -614,6 +614,12 @@
   interrupts = 0 94 0;
   };
  
 + dp_phy: video-phy@10040720 {
 + compatible = samsung,exynos5250-dp-video-phy;
 + reg = 0x10040720 4;
 + #phy-cells = 0;
 + };
 +
   dp-controller {
   compatible = samsung,exynos5-dp;
   reg = 0x145b 0x1000;
 @@ -623,11 +629,8 @@
   clock-names = dp;
   #address-cells = 1;
   #size-cells = 0;
 -
 - dptx-phy {
 - reg = 0x10040720;
 - samsung,enable-mask = 1;
 - };
 + phys = dp_phy 0;

phy-cells being 0, means that this would become:

phys = dp_phy;

 + phy-names = dp;

for the label, I would use something more descriptive such as
'display-port'.

other than that:

Acked-by: Felipe Balbi ba...@ti.com

-- 
balbi


signature.asc
Description: Digital signature


[PATCH] DocBook: upgrade media_api DocBook version to 4.2

2013-06-28 Thread Andrzej Hajda
Fixes the last three errors of media_api DocBook validatation:
# make DOCBOOKS=media_api.xml XMLTOFLAGS='-m 
Documentation/DocBook/stylesheet.xsl' htmldocs
(...)
media_api.xml:414: element imagedata: validity error : Value SVG for 
attribute format of imagedata is not among the enumerated set
media_api.xml:432: element imagedata: validity error : Value SVG for 
attribute format of imagedata is not among the enumerated set
media_api.xml:452: element imagedata: validity error : Value SVG for 
attribute format of imagedata is not among the enumerated set
(...)

Signed-off-by: Andrzej Hajda a.ha...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
Hi,

The patch upgrades DocBook to version supporting SVG attribute.
Version 4.2 is already used by uio-howto.tmpl so I suppose it should be safe.
After this patch it will be possible to build media_api DocBook with validation
turned on.

Regards
Andrzej
---
 Documentation/DocBook/media_api.tmpl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/DocBook/media_api.tmpl 
b/Documentation/DocBook/media_api.tmpl
index 6a8b715..9c92bb8 100644
--- a/Documentation/DocBook/media_api.tmpl
+++ b/Documentation/DocBook/media_api.tmpl
@@ -1,6 +1,6 @@
 ?xml version=1.0?
-!DOCTYPE book PUBLIC -//OASIS//DTD DocBook XML V4.1.2//EN
-   http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd; [
+!DOCTYPE book PUBLIC -//OASIS//DTD DocBook XML V4.2//EN
+   http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd; [
 !ENTITY % media-entities SYSTEM ./media-entities.tmpl %media-entities;
 !ENTITY media-indices SYSTEM ./media-indices.tmpl
 
-- 
1.8.1.2

--
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 V2 3/3] video: exynos_dp: Use the generic PHY driver

2013-06-28 Thread Felipe Balbi
On Fri, Jun 28, 2013 at 04:18:23PM +0900, Jingoo Han wrote:
 Use the generic PHY API instead of the platform callback to control
 the DP PHY. The 'phy_label' field is added to the platform data
 structure to allow PHY lookup on non-dt platforms.
 
 Signed-off-by: Jingoo Han jg1@samsung.com
 ---
  .../devicetree/bindings/video/exynos_dp.txt|   17 ---
  drivers/video/exynos/exynos_dp_core.c  |  118 
 ++--
  drivers/video/exynos/exynos_dp_core.h  |2 +
  include/video/exynos_dp.h  |6 +-
  4 files changed, 15 insertions(+), 128 deletions(-)
 
 diff --git a/Documentation/devicetree/bindings/video/exynos_dp.txt 
 b/Documentation/devicetree/bindings/video/exynos_dp.txt
 index 84f10c1..a8320e3 100644
 --- a/Documentation/devicetree/bindings/video/exynos_dp.txt
 +++ b/Documentation/devicetree/bindings/video/exynos_dp.txt
 @@ -1,17 +1,6 @@
  The Exynos display port interface should be configured based on
  the type of panel connected to it.
  
 -We use two nodes:
 - -dp-controller node
 - -dptx-phy node(defined inside dp-controller node)
 -
 -For the DP-PHY initialization, we use the dptx-phy node.
 -Required properties for dptx-phy:
 - -reg:
 - Base address of DP PHY register.
 - -samsung,enable-mask:
 - The bit-mask used to enable/disable DP PHY.
 -
  For the Panel initialization, we read data from dp-controller node.
  Required properties for dp-controller:
   -compatible:
 @@ -67,12 +56,6 @@ SOC specific portion:
   interrupt-parent = combiner;
   clocks = clock 342;
   clock-names = dp;
 -
 - dptx-phy {
 - reg = 0x10040720;
 - samsung,enable-mask = 1;
 - };
 -
   };
  
  Board Specific portion:
 diff --git a/drivers/video/exynos/exynos_dp_core.c 
 b/drivers/video/exynos/exynos_dp_core.c
 index 12bbede..bac515b 100644
 --- a/drivers/video/exynos/exynos_dp_core.c
 +++ b/drivers/video/exynos/exynos_dp_core.c
 @@ -19,6 +19,7 @@
  #include linux/interrupt.h
  #include linux/delay.h
  #include linux/of.h
 +#include linux/phy/phy.h
  
  #include video/exynos_dp.h
  
 @@ -960,84 +961,15 @@ static struct exynos_dp_platdata 
 *exynos_dp_dt_parse_pdata(struct device *dev)
   return ERR_PTR(-EINVAL);
   }
  
 - return pd;
 -}
 -
 -static int exynos_dp_dt_parse_phydata(struct exynos_dp_device *dp)
 -{
 - struct device_node *dp_phy_node = of_node_get(dp-dev-of_node);
 - u32 phy_base;
 - int ret = 0;
 -
 - dp_phy_node = of_find_node_by_name(dp_phy_node, dptx-phy);
 - if (!dp_phy_node) {
 - dev_err(dp-dev, could not find dptx-phy node\n);
 - return -ENODEV;
 - }
 -
 - if (of_property_read_u32(dp_phy_node, reg, phy_base)) {
 - dev_err(dp-dev, failed to get reg for dptx-phy\n);
 - ret = -EINVAL;
 - goto err;
 - }
 -
 - if (of_property_read_u32(dp_phy_node, samsung,enable-mask,
 - dp-enable_mask)) {
 - dev_err(dp-dev, failed to get enable-mask for dptx-phy\n);
 - ret = -EINVAL;
 - goto err;
 - }
 -
 - dp-phy_addr = ioremap(phy_base, SZ_4);
 - if (!dp-phy_addr) {
 - dev_err(dp-dev, failed to ioremap dp-phy\n);
 - ret = -ENOMEM;
 - goto err;
 - }
 -
 -err:
 - of_node_put(dp_phy_node);
 -
 - return ret;
 -}
 -
 -static void exynos_dp_phy_init(struct exynos_dp_device *dp)
 -{
 - u32 reg;
 -
 - reg = __raw_readl(dp-phy_addr);
 - reg |= dp-enable_mask;
 - __raw_writel(reg, dp-phy_addr);
 -}
 -
 -static void exynos_dp_phy_exit(struct exynos_dp_device *dp)
 -{
 - u32 reg;
 + pd-phy_label = dp;

only the label, which I would use 'display-port'. Other than that:

Acked-by: Felipe Balbi ba...@ti.com

-- 
balbi


signature.asc
Description: Digital signature


[PATCH] v4l2: added missing mutex.h include to v4l2-ctrls.h

2013-06-28 Thread Andrzej Hajda
This patch fixes following error:

include/media/v4l2-ctrls.h:193:15: error: field ‘_lock’ has incomplete type
include/media/v4l2-ctrls.h: In function ‘v4l2_ctrl_lock’:
include/media/v4l2-ctrls.h:570:2: error: implicit declaration of
function ‘mutex_lock’ [-Werror=implicit-function-declaration]
include/media/v4l2-ctrls.h: In function ‘v4l2_ctrl_unlock’:
include/media/v4l2-ctrls.h:579:2: error: implicit declaration of
function ‘mutex_unlock’ [-Werror=implicit-function-declaration]

Signed-off-by: Andrzej Hajda a.ha...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 include/media/v4l2-ctrls.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
index 7343a27..47ada23 100644
--- a/include/media/v4l2-ctrls.h
+++ b/include/media/v4l2-ctrls.h
@@ -22,6 +22,7 @@
 #define _V4L2_CTRLS_H
 
 #include linux/list.h
+#include linux/mutex.h
 #include linux/videodev2.h
 
 /* forward references */
-- 
1.8.1.2

--
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 1/3] phy: Add driver for Exynos DP PHY

2013-06-28 Thread Sylwester Nawrocki
Hi,

On 06/28/2013 11:31 AM, Kishon Vijay Abraham I wrote:
 diff --git 
 a/Documentation/devicetree/bindings/phy/samsung,exynos5250-dp-video-phy.txt
 b/Documentation/devicetree/bindings/phy/samsung,exynos5250-dp-video-phy.txt
 new file mode 100644
 index 000..8b6fa79
 --- /dev/null
 +++ 
 b/Documentation/devicetree/bindings/phy/samsung,exynos5250-dp-video-phy.txt
 
 How about creating a single Documentation file for all samsung video phys? 
 Sylwester?

Yes, makes sense. There are quite a few various PHYs on the Exynos SoC.
Let me resend my series with the binding description file name changed
to samsung-phy.txt. I need to add couple fixes to that series anyway.

Regards,
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 v3 1/5] phy: Add driver for Exynos MIPI CSIS/DSIM DPHYs

2013-06-28 Thread Sylwester Nawrocki
On 06/28/2013 10:17 AM, Hui Wang wrote:
 On 06/26/2013 11:02 PM, Sylwester Nawrocki wrote:
 Add a PHY provider driver for the Samsung S5P/Exynos SoC MIPI CSI-2
 receiver and MIPI DSI transmitter DPHYs.

 Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
 Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
 ---
 Changes since v2:
   - adapted to the generic PHY API v9: use phy_set/get_drvdata(),
   - fixed of_xlate callback to return ERR_PTR() instead of NULL,
   - namespace cleanup, put GPL v2 as MODULE_LICENSE, removed pr_debug,
   - removed phy id check in __set_phy_state().
 ---
 [...]
 +
 +if (IS_EXYNOS_MIPI_DSIM_PHY_ID(id))
 +reset = EXYNOS_MIPI_PHY_MRESETN;
 +else
 +reset = EXYNOS_MIPI_PHY_SRESETN;
 +
 +spin_lock_irqsave(state-slock, flags);

 Sorry for one stupid question here, why do you use spin_lock_irqsave() 
 rather than spin_lock(),
 I don't see the irq handler will use this spinlock anywhere in this c file.

Yes, there is no chance the PHY users could call the phy ops from within
an interrupt context. Especially now when there is a per phy object 
mutex used in the PHY operation helpers. So I'll replace it with plain 
spin_lock/unlock. Thank you for the review.

Regards,
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] usbtv: fix dependency

2013-06-28 Thread Mauro Carvalho Chehab
Em Fri, 28 Jun 2013 10:24:15 +0200
Hans Verkuil hverk...@xs4all.nl escreveu:

 This fixes a dependency problem as found by Randy Dunlap:
 
 https://lkml.org/lkml/2013/6/27/501
 
 Mauro, is there any reason for any V4L2 driver to depend on VIDEO_DEV instead 
 of
 just VIDEO_V4L2?
 
 Some drivers depend on VIDEO_DEV, some on VIDEO_V4L2, some on both. It's all
 pretty chaotic.

It should be noticed that, despite its name, this config is actually a
joint dependency of VIDEO_DEV and I2C that will compile drivers as module
if either I2C or VIDEO_DEV is a module:

config VIDEO_V4L2
tristate
depends on (I2C || I2C=n)  VIDEO_DEV
default (I2C || I2C=n)  VIDEO_DEV

So, a V4L2 device that doesn't have any I2C device doesn't need to depend
on VIDEO_V4L2. That includes, for example, reversed-engineered webcam
drivers where the sensor code is inside the driver and a few capture-only
device drivers.

It should be noticed, however, that, on several places, the need of adding
a depends on VIDEO_V4L2 is not needed, as, on some places, the syntax
is:

if VIDEO_V4L2

config driver foo
...

endif

Btw, it could make sense to rename it to something clearer, like
VIDEO_DEV_AND_I2C and define it as:

config VIDEO_DEV_AND_I2C
tristate
depends on I2C  VIDEO_DEV
default y

Or, even better, to just get rid of it and explicitly add I2C on all
places where it is used.


Regards,
Mauro

 
 Regards,
 
   Hans
 
 diff --git a/drivers/media/usb/usbtv/Kconfig b/drivers/media/usb/usbtv/Kconfig
 index 8864436..7c5b860 100644
 --- a/drivers/media/usb/usbtv/Kconfig
 +++ b/drivers/media/usb/usbtv/Kconfig
 @@ -1,6 +1,6 @@
  config VIDEO_USBTV
  tristate USBTV007 video capture support
 -depends on VIDEO_DEV
 +depends on VIDEO_V4L2
  select VIDEOBUF2_VMALLOC
  
  ---help---


-- 

Cheers,
Mauro
--
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] usbtv: fix dependency

2013-06-28 Thread Hans Verkuil
On Fri June 28 2013 13:00:43 Mauro Carvalho Chehab wrote:
 Em Fri, 28 Jun 2013 10:24:15 +0200
 Hans Verkuil hverk...@xs4all.nl escreveu:
 
  This fixes a dependency problem as found by Randy Dunlap:
  
  https://lkml.org/lkml/2013/6/27/501
  
  Mauro, is there any reason for any V4L2 driver to depend on VIDEO_DEV 
  instead of
  just VIDEO_V4L2?
  
  Some drivers depend on VIDEO_DEV, some on VIDEO_V4L2, some on both. It's all
  pretty chaotic.
 
 It should be noticed that, despite its name, this config is actually a
 joint dependency of VIDEO_DEV and I2C that will compile drivers as module
 if either I2C or VIDEO_DEV is a module:
 
   config VIDEO_V4L2
   tristate
   depends on (I2C || I2C=n)  VIDEO_DEV
   default (I2C || I2C=n)  VIDEO_DEV
 
 So, a V4L2 device that doesn't have any I2C device doesn't need to depend
 on VIDEO_V4L2. That includes, for example, reversed-engineered webcam
 drivers where the sensor code is inside the driver and a few capture-only
 device drivers.

Yes, it does have to depend on it. That's exactly why usbtv is failing: like
any other v4l2 driver usbtv needs the videodev.ko module. That is dependent
on VIDEO_V4L2. What is happening here is that the dependency of usbtv on
VIDEO_DEV allows it to be built as part of the kernel, but VIDEO_V4L2 is built
as a module due to its I2C dependency with the result that usbtv can't link to
the videodev functions.

The way things are today I do not believe any v4l2 driver should depend on
VIDEO_DEV, instead they should all depend on VIDEO_V4L2. That would make a
lot more sense.

Hans

 
 It should be noticed, however, that, on several places, the need of adding
 a depends on VIDEO_V4L2 is not needed, as, on some places, the syntax
 is:
 
   if VIDEO_V4L2
 
   config driver foo
   ...
 
   endif
 
 Btw, it could make sense to rename it to something clearer, like
 VIDEO_DEV_AND_I2C and define it as:
 
   config VIDEO_DEV_AND_I2C
   tristate
   depends on I2C  VIDEO_DEV
   default y
 
 Or, even better, to just get rid of it and explicitly add I2C on all
 places where it is used.
 
 
 Regards,
 Mauro
 
  
  Regards,
  
  Hans
  
  diff --git a/drivers/media/usb/usbtv/Kconfig 
  b/drivers/media/usb/usbtv/Kconfig
  index 8864436..7c5b860 100644
  --- a/drivers/media/usb/usbtv/Kconfig
  +++ b/drivers/media/usb/usbtv/Kconfig
  @@ -1,6 +1,6 @@
   config VIDEO_USBTV
   tristate USBTV007 video capture support
  -depends on VIDEO_DEV
  +depends on VIDEO_V4L2
   select VIDEOBUF2_VMALLOC
   
   ---help---
 
 
 
--
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 V2 3/3] video: exynos_dp: Use the generic PHY driver

2013-06-28 Thread Sylwester Nawrocki
Hi,

On 06/28/2013 12:27 PM, Jean-Christophe PLAGNIOL-VILLARD wrote:
 On 12:35 Fri 28 Jun , Felipe Balbi wrote:
  On Fri, Jun 28, 2013 at 04:18:23PM +0900, Jingoo Han wrote:
   Use the generic PHY API instead of the platform callback to control
   the DP PHY. The 'phy_label' field is added to the platform data
   structure to allow PHY lookup on non-dt platforms.
   
   Signed-off-by: Jingoo Han jg1@samsung.com
   ---
[...]
   diff --git a/Documentation/devicetree/bindings/video/exynos_dp.txt 
   b/Documentation/devicetree/bindings/video/exynos_dp.txt
   index 84f10c1..a8320e3 100644
   --- a/Documentation/devicetree/bindings/video/exynos_dp.txt
   +++ b/Documentation/devicetree/bindings/video/exynos_dp.txt
   @@ -1,17 +1,6 @@
The Exynos display port interface should be configured based on
the type of panel connected to it.

   -We use two nodes:
   -   -dp-controller node
   -   -dptx-phy node(defined inside dp-controller node)
   -
   -For the DP-PHY initialization, we use the dptx-phy node.
   -Required properties for dptx-phy:
   -   -reg:
   -   Base address of DP PHY register.
   -   -samsung,enable-mask:
   -   The bit-mask used to enable/disable DP PHY.
   -
For the Panel initialization, we read data from dp-controller node.
Required properties for dp-controller:
   -compatible:
   @@ -67,12 +56,6 @@ SOC specific portion:
   interrupt-parent = combiner;
   clocks = clock 342;
   clock-names = dp;
   -
   -   dptx-phy {
   -   reg = 0x10040720;
   -   samsung,enable-mask = 1;
   -   };

 I've an issue here you break dt compatibilty

Indeed. Ideally the PHYs should be detachable from the controllers.
I'd assume such a change could be acceptable, given that the driver
still supports the original binding.

--
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


[RFC PATCH 0/5] Matrix and Motion Detection support

2013-06-28 Thread Hans Verkuil
This patch series adds support for matrices and motion detection and
converts the solo6x10 driver to use these new APIs.

See the RFCv2 for details on the motion detection API:

http://www.mail-archive.com/linux-media@vger.kernel.org/msg62085.html

And this RFC for details on the matrix API (which superseeds the v4l2_md_blocks
in the RFC above):

http://permalink.gmane.org/gmane.linux.drivers.video-input-infrastructure/65195

I have tested this with the solo card, both global motion detection and
regional motion detection, and it works well.

There is no documentation for the new APIs yet (other than the RFCs). I would
like to know what others think of this proposal before I start work on the
DocBook documentation.

My tentative goal is to get this in for 3.12. Once this is in place the solo
and go7007 drivers can be moved out of staging into the mainline since this is
the only thing holding them back.

Regards,

Hans

--
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


[RFC PATCH 4/5] v4l2: add a motion detection event.

2013-06-28 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 include/uapi/linux/videodev2.h | 17 +
 1 file changed, 17 insertions(+)

diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 5cbe815..f926209 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -1721,6 +1721,7 @@ struct v4l2_streamparm {
 #define V4L2_EVENT_EOS 2
 #define V4L2_EVENT_CTRL3
 #define V4L2_EVENT_FRAME_SYNC  4
+#define V4L2_EVENT_MOTION_DET  5
 #define V4L2_EVENT_PRIVATE_START   0x0800
 
 /* Payload for V4L2_EVENT_VSYNC */
@@ -1752,12 +1753,28 @@ struct v4l2_event_frame_sync {
__u32 frame_sequence;
 };
 
+#define V4L2_EVENT_MD_FL_HAVE_FRAME_SEQ(1  0)
+
+/**
+ * struct v4l2_event_motion_det - motion detection event
+ * @flags: if V4L2_EVENT_MD_FL_HAVE_FRAME_SEQ is set, then the
+ * frame_sequence field is valid.
+ * @frame_sequence:the frame sequence number associated with this event.
+ * @region_mask:   which regions detected motion.
+ */
+struct v4l2_event_motion_det {
+   __u32 flags;
+   __u32 frame_sequence;
+   __u32 region_mask;
+};
+
 struct v4l2_event {
__u32   type;
union {
struct v4l2_event_vsync vsync;
struct v4l2_event_ctrl  ctrl;
struct v4l2_event_frame_syncframe_sync;
+   struct v4l2_event_motion_detmotion_det;
__u8data[64];
} u;
__u32   pending;
-- 
1.8.3.1

--
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


[RFC PATCH 5/5] solo6x10: implement motion detection events and controls.

2013-06-28 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c | 117 +
 drivers/staging/media/solo6x10/solo6x10.h  |   9 +-
 2 files changed, 74 insertions(+), 52 deletions(-)

diff --git a/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c 
b/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c
index 2058f4d..6e8025c 100644
--- a/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c
+++ b/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c
@@ -270,6 +270,8 @@ static int solo_enc_on(struct solo_enc_dev *solo_enc)
if (solo_enc-bw_weight  solo_dev-enc_bw_remain)
return -EBUSY;
solo_enc-sequence = 0;
+   solo_enc-motion_last_state = false;
+   solo_enc-frames_since_last_motion = 0;
solo_dev-enc_bw_remain -= solo_enc-bw_weight;
 
if (solo_enc-type == SOLO_ENC_TYPE_EXT)
@@ -510,15 +512,6 @@ static int solo_enc_fillbuf(struct solo_enc_dev *solo_enc,
struct vop_header *vh = enc_buf-vh;
int ret;
 
-   /* Check for motion flags */
-   vb-v4l2_buf.flags = ~(V4L2_BUF_FLAG_MOTION_ON |
-   V4L2_BUF_FLAG_MOTION_DETECTED);
-   if (solo_is_motion_on(solo_enc)) {
-   vb-v4l2_buf.flags |= V4L2_BUF_FLAG_MOTION_ON;
-   if (enc_buf-motion)
-   vb-v4l2_buf.flags |= V4L2_BUF_FLAG_MOTION_DETECTED;
-   }
-
switch (solo_enc-fmt) {
case V4L2_PIX_FMT_MPEG4:
case V4L2_PIX_FMT_H264:
@@ -530,9 +523,49 @@ static int solo_enc_fillbuf(struct solo_enc_dev *solo_enc,
}
 
if (!ret) {
+   bool send_event = false;
+
vb-v4l2_buf.sequence = solo_enc-sequence++;
vb-v4l2_buf.timestamp.tv_sec = vh-sec;
vb-v4l2_buf.timestamp.tv_usec = vh-usec;
+
+   /* Check for motion flags */
+   if (solo_is_motion_on(solo_enc)) {
+   /* It takes a few frames for the hardware to detect
+* motion. Once it does it clears the motion detection
+* register and it takes again a few frames before
+* motion is seen. This means in practice that when the
+* motion field is 1, it will go back to 0 for the next
+* frame. This leads to motion detection event being
+* sent all the time, which is not what we want.
+* Instead wait a few frames before deciding that the
+* motion has halted. After some experimentation it
+* turns out that waiting for 5 frames works well.
+*/
+   if (enc_buf-motion == 0 
+   solo_enc-motion_last_state 
+   solo_enc-frames_since_last_motion++  5)
+   send_event = true;
+   else if (enc_buf-motion) {
+   solo_enc-frames_since_last_motion = 0;
+   send_event = !solo_enc-motion_last_state;
+   }
+   }
+
+   if (send_event) {
+   struct v4l2_event ev = {
+   .type = V4L2_EVENT_MOTION_DET,
+   .u.motion_det = {
+   .flags = 
V4L2_EVENT_MD_FL_HAVE_FRAME_SEQ,
+   .frame_sequence = vb-v4l2_buf.sequence,
+   .region_mask = enc_buf-motion ? 1 : 0,
+   },
+   };
+
+   solo_enc-motion_last_state = enc_buf-motion;
+   solo_enc-frames_since_last_motion = 0;
+   v4l2_event_queue(solo_enc-vfd, ev);
+   }
}
 
vb2_buffer_done(vb, ret ? VB2_BUF_STATE_ERROR : VB2_BUF_STATE_DONE);
@@ -1145,14 +1178,15 @@ static int solo_s_ctrl(struct v4l2_ctrl *ctrl)
case V4L2_CID_MPEG_VIDEO_GOP_SIZE:
solo_enc-gop = ctrl-val;
return 0;
-   case V4L2_CID_MOTION_THRESHOLD:
-   solo_enc-motion_thresh = ctrl-val;
+   case V4L2_CID_DETECT_MOTION_THRESHOLD:
+   solo_enc-motion_thresh = ctrl-val  8;
if (!solo_enc-motion_global || !solo_enc-motion_enabled)
return 0;
-   return solo_set_motion_threshold(solo_dev, solo_enc-ch, 
ctrl-val);
-   case V4L2_CID_MOTION_MODE:
-   solo_enc-motion_global = ctrl-val == 1;
-   solo_enc-motion_enabled = ctrl-val  0;
+   return solo_set_motion_threshold(solo_dev, solo_enc-ch,
+   solo_enc-motion_thresh);
+   case V4L2_CID_DETECT_MOTION_MODE:
+   solo_enc-motion_global = ctrl-val == 

[RFC PATCH 2/5] v4l2-compat-ioctl32: add g/s_matrix support.

2013-06-28 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 55 +++
 1 file changed, 55 insertions(+)

diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c 
b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
index 8f7a6a4..64155b1 100644
--- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
+++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
@@ -777,6 +777,44 @@ static int put_v4l2_subdev_edid32(struct v4l2_subdev_edid 
*kp, struct v4l2_subde
return 0;
 }
 
+struct v4l2_matrix32 {
+   __u32 type;
+   union {
+   __u32 reserved[4];
+   } ref;
+   struct v4l2_rect rect;
+   compat_caddr_t matrix;
+   __u32 reserved[12];
+} __attribute__ ((packed));
+
+static int get_v4l2_matrix32(struct v4l2_matrix *kp, struct v4l2_matrix32 
__user *up)
+{
+   u32 tmp;
+
+   if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_matrix32)) ||
+   get_user(kp-type, up-type) ||
+   copy_from_user(kp-ref, up-ref, sizeof(up-ref)) ||
+   copy_from_user(kp-rect, up-rect, sizeof(up-rect)) ||
+   get_user(tmp, up-matrix) ||
+   copy_from_user(kp-reserved, up-reserved, 
sizeof(kp-reserved)))
+   return -EFAULT;
+   kp-matrix = compat_ptr(tmp);
+   return 0;
+}
+
+static int put_v4l2_matrix32(struct v4l2_matrix *kp, struct v4l2_matrix32 
__user *up)
+{
+   u32 tmp = (u32)((unsigned long)kp-matrix);
+
+   if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_matrix32)) ||
+   put_user(kp-type, up-type) ||
+   copy_to_user(kp-ref, up-ref, sizeof(kp-ref)) ||
+   copy_to_user(kp-rect, up-rect, sizeof(kp-rect)) ||
+   put_user(tmp, up-matrix) ||
+   copy_to_user(kp-reserved, up-reserved, sizeof(kp-reserved)))
+   return -EFAULT;
+   return 0;
+}
 
 #define VIDIOC_G_FMT32 _IOWR('V',  4, struct v4l2_format32)
 #define VIDIOC_S_FMT32 _IOWR('V',  5, struct v4l2_format32)
@@ -796,6 +834,8 @@ static int put_v4l2_subdev_edid32(struct v4l2_subdev_edid 
*kp, struct v4l2_subde
 #defineVIDIOC_DQEVENT32_IOR ('V', 89, struct v4l2_event32)
 #define VIDIOC_CREATE_BUFS32   _IOWR('V', 92, struct v4l2_create_buffers32)
 #define VIDIOC_PREPARE_BUF32   _IOWR('V', 93, struct v4l2_buffer32)
+#define VIDIOC_G_MATRIX32  _IOWR('V', 104, struct v4l2_matrix32)
+#define VIDIOC_S_MATRIX32  _IOWR('V', 105, struct v4l2_matrix32)
 
 #define VIDIOC_OVERLAY32   _IOW ('V', 14, s32)
 #define VIDIOC_STREAMON32  _IOW ('V', 18, s32)
@@ -817,6 +857,7 @@ static long do_video_ioctl(struct file *file, unsigned int 
cmd, unsigned long ar
struct v4l2_event v2ev;
struct v4l2_create_buffers v2crt;
struct v4l2_subdev_edid v2edid;
+   struct v4l2_matrix v2matrix;
unsigned long vx;
int vi;
} karg;
@@ -851,6 +892,8 @@ static long do_video_ioctl(struct file *file, unsigned int 
cmd, unsigned long ar
case VIDIOC_PREPARE_BUF32: cmd = VIDIOC_PREPARE_BUF; break;
case VIDIOC_SUBDEV_G_EDID32: cmd = VIDIOC_SUBDEV_G_EDID; break;
case VIDIOC_SUBDEV_S_EDID32: cmd = VIDIOC_SUBDEV_S_EDID; break;
+   case VIDIOC_G_MATRIX32: cmd = VIDIOC_G_MATRIX; break;
+   case VIDIOC_S_MATRIX32: cmd = VIDIOC_S_MATRIX; break;
}
 
switch (cmd) {
@@ -922,6 +965,12 @@ static long do_video_ioctl(struct file *file, unsigned int 
cmd, unsigned long ar
case VIDIOC_DQEVENT:
compatible_arg = 0;
break;
+
+   case VIDIOC_G_MATRIX:
+   case VIDIOC_S_MATRIX:
+   err = get_v4l2_matrix32(karg.v2matrix, up);
+   compatible_arg = 0;
+   break;
}
if (err)
return err;
@@ -994,6 +1043,11 @@ static long do_video_ioctl(struct file *file, unsigned 
int cmd, unsigned long ar
case VIDIOC_ENUMINPUT:
err = put_v4l2_input32(karg.v2i, up);
break;
+
+   case VIDIOC_G_MATRIX:
+   case VIDIOC_S_MATRIX:
+   err = put_v4l2_matrix32(karg.v2matrix, up);
+   break;
}
return err;
 }
@@ -1089,6 +1143,7 @@ long v4l2_compat_ioctl32(struct file *file, unsigned int 
cmd, unsigned long arg)
case VIDIOC_ENUM_FREQ_BANDS:
case VIDIOC_SUBDEV_G_EDID32:
case VIDIOC_SUBDEV_S_EDID32:
+   case VIDIOC_QUERY_MATRIX:
ret = do_video_ioctl(file, cmd, arg);
break;
 
-- 
1.8.3.1

--
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


[RFC PATCH 3/5] solo: implement the new matrix ioctls instead of the custom ones.

2013-06-28 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c | 102 ++---
 drivers/staging/media/solo6x10/solo6x10.h  |  10 +-
 2 files changed, 89 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c 
b/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c
index a4c5896..2058f4d 100644
--- a/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c
+++ b/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c
@@ -1033,29 +1033,98 @@ static int solo_s_parm(struct file *file, void *priv,
return solo_g_parm(file, priv, sp);
 }
 
-static long solo_enc_default(struct file *file, void *fh,
-   bool valid_prio, unsigned int cmd, void *arg)
+static int solo_query_matrix(struct file *file, void *fh,
+   struct v4l2_query_matrix *qm)
+{
+   qm-columns = 45;
+   qm-rows = 36;
+   switch (qm-type) {
+   case V4L2_MATRIX_TYPE_MD_REGION:
+   qm-elem_size = 1;
+   break;
+   case V4L2_MATRIX_TYPE_MD_THRESHOLD:
+   qm-elem_max.val = 65535;
+   qm-elem_size = 2;
+   break;
+   default:
+   return -EINVAL;
+   }
+   return 0;
+}
+
+static int solo_g_matrix(struct file *file, void *fh,
+   struct v4l2_matrix *m)
+{
+   struct solo_enc_dev *solo_enc = video_drvdata(file);
+   int w = m-rect.width;
+   int h = m-rect.height;
+   u16 *mt;
+   int y;
+
+   if (m-rect.top  0 || m-rect.top + h  35 || h  0 || w  0 ||
+   m-rect.left  0 || m-rect.left + w = SOLO_MOTION_SZ)
+   return -EINVAL;
+   if (h == 0 || w == 0)
+   return 0;
+
+   switch (m-type) {
+   case V4L2_MATRIX_TYPE_MD_REGION:
+   return clear_user(m-matrix, w * h);
+   case V4L2_MATRIX_TYPE_MD_THRESHOLD:
+   mt = 
solo_enc-motion_thresholds.thresholds[m-rect.top][m-rect.left];
+   for (y = 0; y  h; y++, mt += SOLO_MOTION_SZ)
+   if (copy_to_user(m-matrix + y * w * 2, mt, w * 2))
+   return -EFAULT;
+   break;
+   default:
+   return -EINVAL;
+   }
+   return 0;
+}
+
+static int solo_s_matrix(struct file *file, void *fh,
+   struct v4l2_matrix *m)
 {
struct solo_enc_dev *solo_enc = video_drvdata(file);
struct solo_dev *solo_dev = solo_enc-solo_dev;
-   struct solo_motion_thresholds *thresholds = arg;
+   int w = m-rect.width;
+   int h = m-rect.height;
+   u16 *mt;
+   int y;
 
-   switch (cmd) {
-   case SOLO_IOC_G_MOTION_THRESHOLDS:
-   *thresholds = solo_enc-motion_thresholds;
+   if (m-rect.top  0 || m-rect.top + h  35 || h  0 || w  0 ||
+   m-rect.left  0 || m-rect.left + w = SOLO_MOTION_SZ)
+   return -EINVAL;
+   if (h == 0 || w == 0)
return 0;
 
-   case SOLO_IOC_S_MOTION_THRESHOLDS:
-   if (!valid_prio)
-   return -EBUSY;
-   solo_enc-motion_thresholds = *thresholds;
-   if (solo_enc-motion_enabled  !solo_enc-motion_global)
-   return solo_set_motion_block(solo_dev, solo_enc-ch,
-   solo_enc-motion_thresholds);
+   switch (m-type) {
+   case V4L2_MATRIX_TYPE_MD_REGION:
+   /* Check that the region matrix is all zeroes */
+   for (y = 0; y  h; y++) {
+   u8 region[SOLO_MOTION_SZ];
+   static const u8 zeroes[SOLO_MOTION_SZ];
+
+   if (copy_from_user(region, m-matrix + y * w, w))
+   return -EFAULT;
+   if (memcmp(region, zeroes, w))
+   return -EINVAL;
+   }
return 0;
+   case V4L2_MATRIX_TYPE_MD_THRESHOLD:
+   mt = 
solo_enc-motion_thresholds.thresholds[m-rect.top][m-rect.left];
+   for (y = 0; y  h; y++, mt += SOLO_MOTION_SZ)
+   if (copy_from_user(mt, m-matrix + y * w * 2, w * 2))
+   return -EFAULT;
+   break;
default:
-   return -ENOTTY;
+   return -EINVAL;
}
+
+   if (solo_enc-motion_enabled  !solo_enc-motion_global)
+   return solo_set_motion_block(solo_dev, solo_enc-ch,
+   solo_enc-motion_thresholds);
+   return 0;
 }
 
 static int solo_s_ctrl(struct v4l2_ctrl *ctrl)
@@ -1141,11 +1210,14 @@ static const struct v4l2_ioctl_ops solo_enc_ioctl_ops = 
{
/* Video capture parameters */
.vidioc_s_parm  = solo_s_parm,
.vidioc_g_parm  = solo_g_parm,
+   /* Motion Detection matrices */
+   

[RFC PATCH 1/5] v4l2: add matrix support.

2013-06-28 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

This patch adds core support for matrices: querying, getting and setting.

Two initial matrix types are defined for motion detection (defining regions
and thresholds).

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/v4l2-core/v4l2-dev.c   |  3 ++
 drivers/media/v4l2-core/v4l2-ioctl.c | 23 -
 include/media/v4l2-ioctl.h   |  8 +
 include/uapi/linux/videodev2.h   | 64 
 4 files changed, 97 insertions(+), 1 deletion(-)

diff --git a/drivers/media/v4l2-core/v4l2-dev.c 
b/drivers/media/v4l2-core/v4l2-dev.c
index c8859d6..5e58df6 100644
--- a/drivers/media/v4l2-core/v4l2-dev.c
+++ b/drivers/media/v4l2-core/v4l2-dev.c
@@ -598,6 +598,9 @@ static void determine_valid_ioctls(struct video_device 
*vdev)
SET_VALID_IOCTL(ops, VIDIOC_UNSUBSCRIBE_EVENT, 
vidioc_unsubscribe_event);
if (ops-vidioc_enum_freq_bands || ops-vidioc_g_tuner || 
ops-vidioc_g_modulator)
set_bit(_IOC_NR(VIDIOC_ENUM_FREQ_BANDS), valid_ioctls);
+   SET_VALID_IOCTL(ops, VIDIOC_QUERY_MATRIX, vidioc_query_matrix);
+   SET_VALID_IOCTL(ops, VIDIOC_G_MATRIX, vidioc_g_matrix);
+   SET_VALID_IOCTL(ops, VIDIOC_S_MATRIX, vidioc_s_matrix);
 
if (is_vid) {
/* video specific ioctls */
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c 
b/drivers/media/v4l2-core/v4l2-ioctl.c
index 68e6b5e..47debfc 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -549,7 +549,7 @@ static void v4l_print_cropcap(const void *arg, bool 
write_only)
const struct v4l2_cropcap *p = arg;
 
pr_cont(type=%s, bounds wxh=%dx%d, x,y=%d,%d, 
-   defrect wxh=%dx%d, x,y=%d,%d\n, 
+   defrect wxh=%dx%d, x,y=%d,%d, 
pixelaspect %d/%d\n,
prt_names(p-type, v4l2_type_names),
p-bounds.width, p-bounds.height,
@@ -831,6 +831,24 @@ static void v4l_print_freq_band(const void *arg, bool 
write_only)
p-rangehigh, p-modulation);
 }
 
+static void v4l_print_query_matrix(const void *arg, bool write_only)
+{
+   const struct v4l2_query_matrix *p = arg;
+
+   pr_cont(type=0x%x, columns=%u, rows=%u, elem_min=%lld, elem_max=%lld, 
elem_size=%u\n,
+   p-type, p-columns, p-rows,
+   p-elem_min.val, p-elem_max.val, p-elem_size);
+}
+
+static void v4l_print_matrix(const void *arg, bool write_only)
+{
+   const struct v4l2_matrix *p = arg;
+
+   pr_cont(type=0x%x, wxh=%dx%d, x,y=%d,%d, matrix=%p\n,
+   p-type, p-rect.width, p-rect.height,
+   p-rect.top, p-rect.left, p-matrix);
+}
+
 static void v4l_print_u32(const void *arg, bool write_only)
 {
pr_cont(value=%u\n, *(const u32 *)arg);
@@ -2055,6 +2073,9 @@ static struct v4l2_ioctl_info v4l2_ioctls[] = {
IOCTL_INFO_STD(VIDIOC_DV_TIMINGS_CAP, vidioc_dv_timings_cap, 
v4l_print_dv_timings_cap, INFO_FL_CLEAR(v4l2_dv_timings_cap, type)),
IOCTL_INFO_FNC(VIDIOC_ENUM_FREQ_BANDS, v4l_enum_freq_bands, 
v4l_print_freq_band, 0),
IOCTL_INFO_FNC(VIDIOC_DBG_G_CHIP_INFO, v4l_dbg_g_chip_info, 
v4l_print_dbg_chip_info, INFO_FL_CLEAR(v4l2_dbg_chip_info, match)),
+   IOCTL_INFO_STD(VIDIOC_QUERY_MATRIX, vidioc_query_matrix, 
v4l_print_query_matrix, INFO_FL_CLEAR(v4l2_query_matrix, ref)),
+   IOCTL_INFO_STD(VIDIOC_G_MATRIX, vidioc_g_matrix, v4l_print_matrix, 
INFO_FL_CLEAR(v4l2_matrix, matrix)),
+   IOCTL_INFO_STD(VIDIOC_S_MATRIX, vidioc_s_matrix, v4l_print_matrix, 
INFO_FL_PRIO | INFO_FL_CLEAR(v4l2_matrix, matrix)),
 };
 #define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls)
 
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
index e0b74a4..7e4538e 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -271,6 +271,14 @@ struct v4l2_ioctl_ops {
int (*vidioc_unsubscribe_event)(struct v4l2_fh *fh,
const struct v4l2_event_subscription 
*sub);
 
+   /* Matrix ioctls */
+   int (*vidioc_query_matrix) (struct file *file, void *fh,
+   struct v4l2_query_matrix *qmatrix);
+   int (*vidioc_g_matrix) (struct file *file, void *fh,
+   struct v4l2_matrix *matrix);
+   int (*vidioc_s_matrix) (struct file *file, void *fh,
+   struct v4l2_matrix *matrix);
+
/* For other private ioctls */
long (*vidioc_default) (struct file *file, void *fh,
bool valid_prio, unsigned int cmd, void 
*arg);
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 95ef455..5cbe815 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -1838,6 +1838,64 @@ struct v4l2_create_buffers {
__u32   reserved[8];
 };
 
+/* 

Re: [PATCH] usbtv: fix dependency

2013-06-28 Thread Mauro Carvalho Chehab
Em Fri, 28 Jun 2013 13:18:44 +0200
Hans Verkuil hverk...@xs4all.nl escreveu:

 On Fri June 28 2013 13:00:43 Mauro Carvalho Chehab wrote:
  Em Fri, 28 Jun 2013 10:24:15 +0200
  Hans Verkuil hverk...@xs4all.nl escreveu:
  
   This fixes a dependency problem as found by Randy Dunlap:
   
   https://lkml.org/lkml/2013/6/27/501
   
   Mauro, is there any reason for any V4L2 driver to depend on VIDEO_DEV 
   instead of
   just VIDEO_V4L2?
   
   Some drivers depend on VIDEO_DEV, some on VIDEO_V4L2, some on both. It's 
   all
   pretty chaotic.
  
  It should be noticed that, despite its name, this config is actually a
  joint dependency of VIDEO_DEV and I2C that will compile drivers as module
  if either I2C or VIDEO_DEV is a module:
  
  config VIDEO_V4L2
  tristate
  depends on (I2C || I2C=n)  VIDEO_DEV
  default (I2C || I2C=n)  VIDEO_DEV
  
  So, a V4L2 device that doesn't have any I2C device doesn't need to depend
  on VIDEO_V4L2. That includes, for example, reversed-engineered webcam
  drivers where the sensor code is inside the driver and a few capture-only
  device drivers.
 
 Yes, it does have to depend on it. That's exactly why usbtv is failing: like
 any other v4l2 driver usbtv needs the videodev.ko module. That is dependent
 on VIDEO_V4L2. What is happening here is that the dependency of usbtv on
 VIDEO_DEV allows it to be built as part of the kernel, but VIDEO_V4L2 is built
 as a module due to its I2C dependency with the result that usbtv can't link to
 the videodev functions.
 
 The way things are today I do not believe any v4l2 driver should depend on
 VIDEO_DEV, instead they should all depend on VIDEO_V4L2. That would make a
 lot more sense.

Hmm...

$ git grep -l i2c drivers/media/v4l2-core/
drivers/media/v4l2-core/tuner-core.c(not part of videodev.ko module)
drivers/media/v4l2-core/v4l2-async.c
drivers/media/v4l2-core/v4l2-common.c
drivers/media/v4l2-core/v4l2-ctrls.c(actually, there's just a 
comment there)
drivers/media/v4l2-core/v4l2-device.c

$ git grep  CONFIG_I2C drivers/media/v4l2-core/
drivers/media/v4l2-core/v4l2-common.c:#if IS_ENABLED(CONFIG_I2C)
drivers/media/v4l2-core/v4l2-common.c:#endif /* defined(CONFIG_I2C) */
drivers/media/v4l2-core/v4l2-device.c:#if IS_ENABLED(CONFIG_I2C)

yes, there are some parts of videodev that are dependent on I2C.

That's basically why all V4L2 drivers should depend on VIDEO_V4L2.

That's said, before the addition of v4l2-async, it was safe to compile
the core without I2C, as the parts of the code that are I2C specific are
protected by a:
#if defined(CONFIG_I2C)

With its addition, I suspect that we'll still have Kbuild issues, if I2C
is disabled and a driver that doesn't depends on I2C is compiled.

So, 2 patches seem to be needed:

1) a patch that replaces all driver dependencies from CONFIG_DEV to
   CONFIG_V4L2;

2) a patch that fixes the issues with v4l2-async.

With regards to the last one, I can see 3 ways to fix it:
1) don't add v4l2-async at videodev.ko if I2C is not selected;
2) protect the I2C specific parts of v4l2-async with
#if defined(CONFIG_I2C)
3) put v4l2-async on a separate module.

(or some combination of the above)

As only very few drivers use v4l2-async, as this is more focused to
fix troubles with OT, I think that the better would be to do (3) and
to add an specific Kconfig entry for it.

Regards,
Mauro.
--
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] usbtv: fix dependency

2013-06-28 Thread Hans Verkuil
On Fri June 28 2013 14:42:46 Mauro Carvalho Chehab wrote:
 Em Fri, 28 Jun 2013 13:18:44 +0200
 Hans Verkuil hverk...@xs4all.nl escreveu:
 
  On Fri June 28 2013 13:00:43 Mauro Carvalho Chehab wrote:
   Em Fri, 28 Jun 2013 10:24:15 +0200
   Hans Verkuil hverk...@xs4all.nl escreveu:
   
This fixes a dependency problem as found by Randy Dunlap:

https://lkml.org/lkml/2013/6/27/501

Mauro, is there any reason for any V4L2 driver to depend on VIDEO_DEV 
instead of
just VIDEO_V4L2?

Some drivers depend on VIDEO_DEV, some on VIDEO_V4L2, some on both. 
It's all
pretty chaotic.
   
   It should be noticed that, despite its name, this config is actually a
   joint dependency of VIDEO_DEV and I2C that will compile drivers as module
   if either I2C or VIDEO_DEV is a module:
   
 config VIDEO_V4L2
 tristate
 depends on (I2C || I2C=n)  VIDEO_DEV
 default (I2C || I2C=n)  VIDEO_DEV
   
   So, a V4L2 device that doesn't have any I2C device doesn't need to depend
   on VIDEO_V4L2. That includes, for example, reversed-engineered webcam
   drivers where the sensor code is inside the driver and a few capture-only
   device drivers.
  
  Yes, it does have to depend on it. That's exactly why usbtv is failing: like
  any other v4l2 driver usbtv needs the videodev.ko module. That is dependent
  on VIDEO_V4L2. What is happening here is that the dependency of usbtv on
  VIDEO_DEV allows it to be built as part of the kernel, but VIDEO_V4L2 is 
  built
  as a module due to its I2C dependency with the result that usbtv can't link 
  to
  the videodev functions.
  
  The way things are today I do not believe any v4l2 driver should depend on
  VIDEO_DEV, instead they should all depend on VIDEO_V4L2. That would make a
  lot more sense.
 
 Hmm...
 
 $ git grep -l i2c drivers/media/v4l2-core/
 drivers/media/v4l2-core/tuner-core.c  (not part of videodev.ko module)
 drivers/media/v4l2-core/v4l2-async.c
 drivers/media/v4l2-core/v4l2-common.c
 drivers/media/v4l2-core/v4l2-ctrls.c  (actually, there's just a 
 comment there)
 drivers/media/v4l2-core/v4l2-device.c
 
 $ git grep  CONFIG_I2C drivers/media/v4l2-core/
 drivers/media/v4l2-core/v4l2-common.c:#if IS_ENABLED(CONFIG_I2C)
 drivers/media/v4l2-core/v4l2-common.c:#endif /* defined(CONFIG_I2C) */
 drivers/media/v4l2-core/v4l2-device.c:#if IS_ENABLED(CONFIG_I2C)
 
 yes, there are some parts of videodev that are dependent on I2C.
 
 That's basically why all V4L2 drivers should depend on VIDEO_V4L2.
 
 That's said, before the addition of v4l2-async, it was safe to compile
 the core without I2C, as the parts of the code that are I2C specific are
 protected by a:
   #if defined(CONFIG_I2C)
 
 With its addition, I suspect that we'll still have Kbuild issues, if I2C
 is disabled and a driver that doesn't depends on I2C is compiled.
 
 So, 2 patches seem to be needed:
 
 1) a patch that replaces all driver dependencies from CONFIG_DEV to
CONFIG_V4L2;
 
 2) a patch that fixes the issues with v4l2-async.
 
 With regards to the last one, I can see 3 ways to fix it:
   1) don't add v4l2-async at videodev.ko if I2C is not selected;
   2) protect the I2C specific parts of v4l2-async with
   #if defined(CONFIG_I2C)
   3) put v4l2-async on a separate module.
 
 (or some combination of the above)
 
 As only very few drivers use v4l2-async, as this is more focused to
 fix troubles with OT, I think that the better would be to do (3) and
 to add an specific Kconfig entry for it.

No, #2 is the right choice here. That's necessary anyway since it is a valid
use-case that I2C is disabled and you use it for platform devices only.

Guennadi, can you look at this? The only thing that is probably needed is
that match_i2c returns false if CONFIG_I2C is undefined.

I prefer to keep this part of videodev, at least for now: I think there will
be a fairly quick uptake of this API internally, certainly for subdevs. Note
BTW that even x86 kernels come with CONFIG_OF enabled these days.

Regards,

Hans
--
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 v3 6/8] [media] V4L: Add support for integer menu controls with standard menu items

2013-06-28 Thread Hans Verkuil
On Tue June 25 2013 12:57:13 Arun Kumar K wrote:
 From: Sylwester Nawrocki s.nawro...@samsung.com
 
 The patch modifies the helper function v4l2_ctrl_new_std_menu
 to accept integer menu controls with standard menu items.
 
 Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
 Signed-off-by: Arun Kumar K arun...@samsung.com

After fixing the very minor correction below you have my ack:

Acked-by: Hans Verkuil hans.verk...@cisco.com

Regards,

Hans

 ---
  Documentation/video4linux/v4l2-controls.txt |   21 ++--
  drivers/media/v4l2-core/v4l2-ctrls.c|   28 
 ---
  2 files changed, 36 insertions(+), 13 deletions(-)
 
 diff --git a/Documentation/video4linux/v4l2-controls.txt 
 b/Documentation/video4linux/v4l2-controls.txt
 index 676f873..e06e768 100644
 --- a/Documentation/video4linux/v4l2-controls.txt
 +++ b/Documentation/video4linux/v4l2-controls.txt
 @@ -124,26 +124,27 @@ You add non-menu controls by calling v4l2_ctrl_new_std:
   const struct v4l2_ctrl_ops *ops,
   u32 id, s32 min, s32 max, u32 step, s32 def);
  
 -Menu controls are added by calling v4l2_ctrl_new_std_menu:
 +Menu and integer menu controls are added by calling v4l2_ctrl_new_std_menu:
  
   struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *hdl,
   const struct v4l2_ctrl_ops *ops,
   u32 id, s32 max, s32 skip_mask, s32 def);
  
 -Or alternatively for integer menu controls, by calling 
 v4l2_ctrl_new_int_menu:
 +Menu controls with a driver specific menu are added by calling
 +v4l2_ctrl_new_std_menu_items:
 +
 +   struct v4l2_ctrl *v4l2_ctrl_new_std_menu_items(
 +   struct v4l2_ctrl_handler *hdl,
 +   const struct v4l2_ctrl_ops *ops, u32 id, s32 max,
 +   s32 skip_mask, s32 def, const char * const *qmenu);
 +
 +Integer menu controls with driver specific menu can be added by calling

s/with driver/with a driver/

 +v4l2_ctrl_new_int_menu:
  
   struct v4l2_ctrl *v4l2_ctrl_new_int_menu(struct v4l2_ctrl_handler *hdl,
   const struct v4l2_ctrl_ops *ops,
   u32 id, s32 max, s32 def, const s64 *qmenu_int);
  
 -Standard menu controls with a driver specific menu are added by calling
 -v4l2_ctrl_new_std_menu_items:
 -
 - struct v4l2_ctrl *v4l2_ctrl_new_std_menu_items(
 - struct v4l2_ctrl_handler *hdl,
 - const struct v4l2_ctrl_ops *ops, u32 id, s32 max,
 - s32 skip_mask, s32 def, const char * const *qmenu);
 -
  These functions are typically called right after the v4l2_ctrl_handler_init:
  
   static const s64 exp_bias_qmenu[] = {
 diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
 b/drivers/media/v4l2-core/v4l2-ctrls.c
 index fccd08b..e03a2e8 100644
 --- a/drivers/media/v4l2-core/v4l2-ctrls.c
 +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
 @@ -552,6 +552,20 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
  }
  EXPORT_SYMBOL(v4l2_ctrl_get_menu);
  
 +/*
 + * Returns NULL or an s64 type array containing the menu for given
 + * control ID. The total number of the menu items is returned in @len.
 + */
 +const s64 const *v4l2_ctrl_get_int_menu(u32 id, u32 *len)
 +{
 + switch (id) {
 + default:
 + *len = 0;
 + return NULL;
 + };
 +}
 +EXPORT_SYMBOL(v4l2_ctrl_get_int_menu);
 +
  /* Return the control name. */
  const char *v4l2_ctrl_get_name(u32 id)
  {
 @@ -1712,20 +1726,28 @@ struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct 
 v4l2_ctrl_handler *hdl,
   const struct v4l2_ctrl_ops *ops,
   u32 id, s32 max, s32 mask, s32 def)
  {
 - const char * const *qmenu = v4l2_ctrl_get_menu(id);
 + const char * const *qmenu = NULL;
 + const s64 *qmenu_int = NULL;
   const char *name;
   enum v4l2_ctrl_type type;
 + unsigned int qmenu_int_len;
   s32 min;
   s32 step;
   u32 flags;
  
   v4l2_ctrl_fill(id, name, type, min, max, step, def, flags);
 - if (type != V4L2_CTRL_TYPE_MENU) {
 +
 + if (type == V4L2_CTRL_TYPE_MENU)
 + qmenu = v4l2_ctrl_get_menu(id);
 + else if (type == V4L2_CTRL_TYPE_INTEGER_MENU)
 + qmenu_int = v4l2_ctrl_get_int_menu(id, qmenu_int_len);
 +
 + if ((!qmenu  !qmenu_int) || (qmenu_int  max  qmenu_int_len)) {
   handler_set_err(hdl, -EINVAL);
   return NULL;
   }
   return v4l2_ctrl_new(hdl, ops, id, name, type,
 -  0, max, mask, def, flags, qmenu, NULL, NULL);
 +  0, max, mask, def, flags, qmenu, qmenu_int, NULL);
  }
  EXPORT_SYMBOL(v4l2_ctrl_new_std_menu);
  
 
--
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] usbtv: fix dependency

2013-06-28 Thread Guennadi Liakhovetski
Hi Hans, Mauro

On Fri, 28 Jun 2013, Hans Verkuil wrote:

 On Fri June 28 2013 14:42:46 Mauro Carvalho Chehab wrote:
  Em Fri, 28 Jun 2013 13:18:44 +0200
  Hans Verkuil hverk...@xs4all.nl escreveu:
  
   On Fri June 28 2013 13:00:43 Mauro Carvalho Chehab wrote:
Em Fri, 28 Jun 2013 10:24:15 +0200
Hans Verkuil hverk...@xs4all.nl escreveu:

 This fixes a dependency problem as found by Randy Dunlap:
 
 https://lkml.org/lkml/2013/6/27/501
 
 Mauro, is there any reason for any V4L2 driver to depend on VIDEO_DEV 
 instead of
 just VIDEO_V4L2?
 
 Some drivers depend on VIDEO_DEV, some on VIDEO_V4L2, some on both. 
 It's all
 pretty chaotic.

It should be noticed that, despite its name, this config is actually a
joint dependency of VIDEO_DEV and I2C that will compile drivers as 
module
if either I2C or VIDEO_DEV is a module:

config VIDEO_V4L2
tristate
depends on (I2C || I2C=n)  VIDEO_DEV
default (I2C || I2C=n)  VIDEO_DEV

So, a V4L2 device that doesn't have any I2C device doesn't need to 
depend
on VIDEO_V4L2. That includes, for example, reversed-engineered webcam
drivers where the sensor code is inside the driver and a few 
capture-only
device drivers.
   
   Yes, it does have to depend on it. That's exactly why usbtv is failing: 
   like
   any other v4l2 driver usbtv needs the videodev.ko module. That is 
   dependent
   on VIDEO_V4L2. What is happening here is that the dependency of usbtv on
   VIDEO_DEV allows it to be built as part of the kernel, but VIDEO_V4L2 is 
   built
   as a module due to its I2C dependency with the result that usbtv can't 
   link to
   the videodev functions.
   
   The way things are today I do not believe any v4l2 driver should depend on
   VIDEO_DEV, instead they should all depend on VIDEO_V4L2. That would make a
   lot more sense.
  
  Hmm...
  
  $ git grep -l i2c drivers/media/v4l2-core/
  drivers/media/v4l2-core/tuner-core.c(not part of 
  videodev.ko module)
  drivers/media/v4l2-core/v4l2-async.c
  drivers/media/v4l2-core/v4l2-common.c
  drivers/media/v4l2-core/v4l2-ctrls.c(actually, there's just 
  a comment there)
  drivers/media/v4l2-core/v4l2-device.c
  
  $ git grep  CONFIG_I2C drivers/media/v4l2-core/
  drivers/media/v4l2-core/v4l2-common.c:#if IS_ENABLED(CONFIG_I2C)
  drivers/media/v4l2-core/v4l2-common.c:#endif /* defined(CONFIG_I2C) */
  drivers/media/v4l2-core/v4l2-device.c:#if IS_ENABLED(CONFIG_I2C)
  
  yes, there are some parts of videodev that are dependent on I2C.
  
  That's basically why all V4L2 drivers should depend on VIDEO_V4L2.
  
  That's said, before the addition of v4l2-async, it was safe to compile
  the core without I2C, as the parts of the code that are I2C specific are
  protected by a:
  #if defined(CONFIG_I2C)
  
  With its addition, I suspect that we'll still have Kbuild issues, if I2C
  is disabled and a driver that doesn't depends on I2C is compiled.
  
  So, 2 patches seem to be needed:
  
  1) a patch that replaces all driver dependencies from CONFIG_DEV to
 CONFIG_V4L2;
  
  2) a patch that fixes the issues with v4l2-async.
  
  With regards to the last one, I can see 3 ways to fix it:
  1) don't add v4l2-async at videodev.ko if I2C is not selected;
  2) protect the I2C specific parts of v4l2-async with
  #if defined(CONFIG_I2C)
  3) put v4l2-async on a separate module.
  
  (or some combination of the above)
  
  As only very few drivers use v4l2-async, as this is more focused to
  fix troubles with OT, I think that the better would be to do (3) and
  to add an specific Kconfig entry for it.
 
 No, #2 is the right choice here. That's necessary anyway since it is a valid
 use-case that I2C is disabled and you use it for platform devices only.
 
 Guennadi, can you look at this? The only thing that is probably needed is
 that match_i2c returns false if CONFIG_I2C is undefined.
 
 I prefer to keep this part of videodev, at least for now: I think there will
 be a fairly quick uptake of this API internally, certainly for subdevs. Note
 BTW that even x86 kernels come with CONFIG_OF enabled these days.

This patch

http://git.linuxtv.org/gliakhovetski/v4l-dvb.git/commitdiff/a92d0222c693db29a5d00eaedcdebf748789c38e

has been pushed 3 days ago:

https://patchwork.linuxtv.org/patch/19090/

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
--
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 v4 0/5] Generic PHY driver for the Exynos SoC MIPI CSI-2/DSI DPHYs

2013-06-28 Thread Sylwester Nawrocki
This patch series adds a simple driver for the Samsung S5P/Exynos SoC
series MIPI CSI-2 receiver (MIPI CSIS) and MIPI DSI transmitter (MIPI
DSIM) DPHYs, using the generic PHY framework [1]. Previously the MIPI
CSIS and MIPI DSIM used a platform callback to control the PHY power
enable and reset bits. The platform callback can now be dropped and
those drivers don't need any calls back to the platform code, which
makes migration to the device tree complete for MIPI CSIS.

Changes since v3 (only patch 1/5):
 - replaced spin_(un)lock_irq_{save,restore} with spin_{lock,unlock}.
 - DT binding file renamed to samsung-phy.txt, so it can be used for
   other PHYs as well,
 - removed linux/delay.h inclusion,
 - added missing spin_lock_init().

Changes since v2:
 - adapted to the generic PHY API v9: use phy_set/get_drvdata(),
 - fixed of_xlate callback to return ERR_PTR() instead of NULL,
 - namespace cleanup, put GPL v2 as MODULE_LICENSE, removed pr_debug,
 - removed phy id check in __set_phy_state().

Patches 2...3/5 are unchanged, description of patch 5/5 has been
updated.

Changes since v1:
 - enabled build as module and with CONFIG_OF disabled,
 - added phy_id enum,
 - of_address_to_resource() replaced with platform_get_resource(),
 - adapted to changes in the PHY API v7, v8 - added phy labels,
 - added MODULE_DEVICE_TABLE() entry,
 - the driver file renamed to phy-exynos-mipi-video.c,
 - changed DT compatible string to samsung,s5pv210-mipi-video-phy,
 - corrected the compatible property's description.
 - patch 3/5 video: exynos_dsi: Use generic PHY driver replaced
   with a patch modifying the MIPI DSIM driver which is currently
   in mainline.

This series depends on the generic PHY framework [1]. It can be browsed at:
 http://git.linuxtv.org/snawrocki/samsung.git/exynos-mipi-phy
This branch is based on the 'for-next' branch from:
 git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung.git
and the patch series:
 http://www.spinics.net/lists/arm-kernel/msg254667.html

[1] https://lkml.org/lkml/2013/6/26/259

Sylwester Nawrocki (5):
  ARM: dts: Add MIPI PHY node to exynos4.dtsi
  phy: Add driver for Exynos MIPI CSIS/DSIM DPHYs
  video: exynos_mipi_dsim: Use the generic PHY driver
  [media] exynos4-is: Use the generic MIPI CSIS PHY driver
  ARM: Samsung: Remove the MIPI PHY setup code

 .../devicetree/bindings/phy/samsung-phy.txt|   14 ++
 arch/arm/boot/dts/exynos4.dtsi |   10 ++
 arch/arm/mach-exynos/include/mach/regs-pmu.h   |5 -
 arch/arm/mach-s5pv210/include/mach/regs-clock.h|4 -
 arch/arm/plat-samsung/Kconfig  |5 -
 arch/arm/plat-samsung/Makefile |1 -
 arch/arm/plat-samsung/setup-mipiphy.c  |   60 ---
 drivers/media/platform/exynos4-is/mipi-csis.c  |   16 +-
 drivers/phy/Kconfig|9 ++
 drivers/phy/Makefile   |3 +-
 drivers/phy/phy-exynos-mipi-video.c|  169 
 drivers/video/exynos/exynos_mipi_dsi.c |   19 +--
 include/linux/platform_data/mipi-csis.h|   11 +-
 include/video/exynos_mipi_dsim.h   |6 +-
 14 files changed, 233 insertions(+), 99 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/phy/samsung-phy.txt
 delete mode 100644 arch/arm/plat-samsung/setup-mipiphy.c
 create mode 100644 drivers/phy/phy-exynos-mipi-video.c

--
1.7.9.5

--
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 v4 1/5] ARM: dts: Add MIPI PHY node to exynos4.dtsi

2013-06-28 Thread Sylwester Nawrocki
Add PHY provider node for the MIPI CSIS and MIPI DSIM PHYs.

Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Acked-by: Felipe Balbi ba...@ti.com
---
 arch/arm/boot/dts/exynos4.dtsi |   10 ++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm/boot/dts/exynos4.dtsi b/arch/arm/boot/dts/exynos4.dtsi
index 4d61120..1750511 100644
--- a/arch/arm/boot/dts/exynos4.dtsi
+++ b/arch/arm/boot/dts/exynos4.dtsi
@@ -49,6 +49,12 @@
reg = 0x1000 0x100;
};
 
+   mipi_phy: video-phy@10020710 {
+   compatible = samsung,s5pv210-mipi-video-phy;
+   reg = 0x10020710 8;
+   #phy-cells = 1;
+   };
+
pd_mfc: mfc-power-domain@10023C40 {
compatible = samsung,exynos4210-pd;
reg = 0x10023C40 0x20;
@@ -147,6 +153,8 @@
interrupts = 0 78 0;
bus-width = 4;
samsung,power-domain = pd_cam;
+   phys = mipi_phy 0;
+   phy-names = csis;
status = disabled;
};
 
@@ -156,6 +164,8 @@
interrupts = 0 80 0;
bus-width = 2;
samsung,power-domain = pd_cam;
+   phys = mipi_phy 2;
+   phy-names = csis;
status = disabled;
};
};
-- 
1.7.9.5

--
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 v4 2/5] phy: Add driver for Exynos MIPI CSIS/DSIM DPHYs

2013-06-28 Thread Sylwester Nawrocki
Add a PHY provider driver for the Samsung S5P/Exynos SoC MIPI CSI-2
receiver and MIPI DSI transmitter DPHYs.

Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Acked-by: Felipe Balbi ba...@ti.com
---
Changes since v3:
 - replaced spin_(un)lock_irq_{save,restore} with spin_{lock,unlock}.
 - DT binding file renamed to samsung-phy.txt, so it can be used for
   other PHYs as well,
 - removed linux/delay.h inclusion,
 - added missing spin_lock_init().
---
 .../devicetree/bindings/phy/samsung-phy.txt|   14 ++
 drivers/phy/Kconfig|9 ++
 drivers/phy/Makefile   |3 +-
 drivers/phy/phy-exynos-mipi-video.c|  169 
 4 files changed, 194 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/phy/samsung-phy.txt
 create mode 100644 drivers/phy/phy-exynos-mipi-video.c

diff --git a/Documentation/devicetree/bindings/phy/samsung-phy.txt 
b/Documentation/devicetree/bindings/phy/samsung-phy.txt
new file mode 100644
index 000..5ff208c
--- /dev/null
+++ b/Documentation/devicetree/bindings/phy/samsung-phy.txt
@@ -0,0 +1,14 @@
+Samsung S5P/EXYNOS SoC series MIPI CSIS/DSIM DPHY
+-
+
+Required properties:
+- compatible : should be samsung,s5pv210-mipi-video-phy;
+- reg : offset and length of the MIPI DPHY register set;
+- #phy-cells : from the generic phy bindings, must be 1;
+
+For samsung,s5pv210-mipi-video-phy compatible PHYs the second cell in
+the PHY specifier identifies the PHY and its meaning is as follows:
+  0 - MIPI CSIS 0,
+  1 - MIPI DSIM 0,
+  2 - MIPI CSIS 1,
+  3 - MIPI DSIM 1.
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index 5f85909..6f446d0 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -11,3 +11,12 @@ menuconfig GENERIC_PHY
  devices present in the kernel. This layer will have the generic
  API by which phy drivers can create PHY using the phy framework and
  phy users can obtain reference to the PHY.
+
+if GENERIC_PHY
+
+config PHY_EXYNOS_MIPI_VIDEO
+   tristate S5P/EXYNOS SoC series MIPI CSI-2/DSI PHY driver
+   help
+ Support for MIPI CSI-2 and MIPI DSI DPHY found on Samsung
+ S5P and EXYNOS SoCs.
+endif
diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
index 9e9560f..71d8841 100644
--- a/drivers/phy/Makefile
+++ b/drivers/phy/Makefile
@@ -2,4 +2,5 @@
 # Makefile for the phy drivers.
 #
 
-obj-$(CONFIG_GENERIC_PHY)  += phy-core.o
+obj-$(CONFIG_GENERIC_PHY)  += phy-core.o
+obj-$(CONFIG_PHY_EXYNOS_MIPI_VIDEO)+= phy-exynos-mipi-video.o
diff --git a/drivers/phy/phy-exynos-mipi-video.c 
b/drivers/phy/phy-exynos-mipi-video.c
new file mode 100644
index 000..7e7fcd7
--- /dev/null
+++ b/drivers/phy/phy-exynos-mipi-video.c
@@ -0,0 +1,169 @@
+/*
+ * Samsung S5P/EXYNOS SoC series MIPI CSIS/DSIM DPHY driver
+ *
+ * Copyright (C) 2013 Samsung Electronics Co., Ltd.
+ * Author: Sylwester Nawrocki s.nawro...@samsung.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include linux/io.h
+#include linux/kernel.h
+#include linux/module.h
+#include linux/of.h
+#include linux/of_address.h
+#include linux/phy/phy.h
+#include linux/platform_device.h
+#include linux/spinlock.h
+
+/* MIPI_PHYn_CONTROL register offset: n = 0..1 */
+#define EXYNOS_MIPI_PHY_CONTROL(n) ((n) * 4)
+#define EXYNOS_MIPI_PHY_ENABLE (1  0)
+#define EXYNOS_MIPI_PHY_SRESETN(1  1)
+#define EXYNOS_MIPI_PHY_MRESETN(1  2)
+#define EXYNOS_MIPI_PHY_RESET_MASK (3  1)
+
+enum exynos_mipi_phy_id {
+   EXYNOS_MIPI_PHY_ID_CSIS0,
+   EXYNOS_MIPI_PHY_ID_DSIM0,
+   EXYNOS_MIPI_PHY_ID_CSIS1,
+   EXYNOS_MIPI_PHY_ID_DSIM1,
+   EXYNOS_MIPI_PHYS_NUM
+};
+
+#define IS_EXYNOS_MIPI_DSIM_PHY_ID(id) \
+   ((id) == EXYNOS_MIPI_PHY_ID_DSIM0 || (id) == EXYNOS_MIPI_PHY_ID_DSIM0)
+
+struct exynos_mipi_video_phy {
+   spinlock_t slock;
+   struct phy *phys[EXYNOS_MIPI_PHYS_NUM];
+   void __iomem *regs;
+};
+
+static int __set_phy_state(struct exynos_mipi_video_phy *state,
+   enum exynos_mipi_phy_id id, unsigned int on)
+{
+   void __iomem *addr;
+   u32 reg, reset;
+
+   addr = state-regs + EXYNOS_MIPI_PHY_CONTROL(id / 2);
+
+   if (IS_EXYNOS_MIPI_DSIM_PHY_ID(id))
+   reset = EXYNOS_MIPI_PHY_MRESETN;
+   else
+   reset = EXYNOS_MIPI_PHY_SRESETN;
+
+   spin_lock(state-slock);
+   reg = readl(addr);
+   if (on)
+   reg |= reset;
+   else
+   reg = ~reset;
+   writel(reg, addr);
+
+   /* Clear ENABLE bit only if MRESETN, SRESETN bits are not set. */
+   if (on)
+   reg |= 

[PATCH v4 3/5] video: exynos_mipi_dsim: Use the generic PHY driver

2013-06-28 Thread Sylwester Nawrocki
Use the generic PHY API instead of the platform callback to control
the MIPI DSIM DPHY. The 'phy_label' field is added to the platform
data structure to allow PHY lookup on non-dt platforms.

Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Acked-by: Felipe Balbi ba...@ti.com
Acked-by: Donghwa Lee dh09@samsung.com
---
 drivers/video/exynos/exynos_mipi_dsi.c |   19 ++-
 include/video/exynos_mipi_dsim.h   |6 --
 2 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/drivers/video/exynos/exynos_mipi_dsi.c 
b/drivers/video/exynos/exynos_mipi_dsi.c
index 32e5406..248e444 100644
--- a/drivers/video/exynos/exynos_mipi_dsi.c
+++ b/drivers/video/exynos/exynos_mipi_dsi.c
@@ -30,6 +30,7 @@
 #include linux/interrupt.h
 #include linux/kthread.h
 #include linux/notifier.h
+#include linux/phy/phy.h
 #include linux/regulator/consumer.h
 #include linux/pm_runtime.h
 #include linux/err.h
@@ -156,8 +157,7 @@ static int exynos_mipi_dsi_blank_mode(struct 
mipi_dsim_device *dsim, int power)
exynos_mipi_regulator_enable(dsim);
 
/* enable MIPI-DSI PHY. */
-   if (dsim-pd-phy_enable)
-   dsim-pd-phy_enable(pdev, true);
+   phy_power_on(dsim-phy);
 
clk_enable(dsim-clock);
 
@@ -373,6 +373,10 @@ static int exynos_mipi_dsi_probe(struct platform_device 
*pdev)
return ret;
}
 
+   dsim-phy = devm_phy_get(pdev-dev, dsim_pd-phy_label);
+   if (IS_ERR(dsim-phy))
+   return PTR_ERR(dsim-phy);
+
dsim-clock = devm_clk_get(pdev-dev, dsim0);
if (IS_ERR(dsim-clock)) {
dev_err(pdev-dev, failed to get dsim clock source\n);
@@ -439,8 +443,7 @@ static int exynos_mipi_dsi_probe(struct platform_device 
*pdev)
exynos_mipi_regulator_enable(dsim);
 
/* enable MIPI-DSI PHY. */
-   if (dsim-pd-phy_enable)
-   dsim-pd-phy_enable(pdev, true);
+   phy_power_on(dsim-phy);
 
exynos_mipi_update_cfg(dsim);
 
@@ -504,9 +507,8 @@ static int exynos_mipi_dsi_suspend(struct device *dev)
if (client_drv  client_drv-suspend)
client_drv-suspend(client_dev);
 
-   /* enable MIPI-DSI PHY. */
-   if (dsim-pd-phy_enable)
-   dsim-pd-phy_enable(pdev, false);
+   /* disable MIPI-DSI PHY. */
+   phy_power_off(dsim-phy);
 
clk_disable(dsim-clock);
 
@@ -536,8 +538,7 @@ static int exynos_mipi_dsi_resume(struct device *dev)
exynos_mipi_regulator_enable(dsim);
 
/* enable MIPI-DSI PHY. */
-   if (dsim-pd-phy_enable)
-   dsim-pd-phy_enable(pdev, true);
+   phy_power_on(dsim-phy);
 
clk_enable(dsim-clock);
 
diff --git a/include/video/exynos_mipi_dsim.h b/include/video/exynos_mipi_dsim.h
index 89dc88a..fd69beb 100644
--- a/include/video/exynos_mipi_dsim.h
+++ b/include/video/exynos_mipi_dsim.h
@@ -216,6 +216,7 @@ struct mipi_dsim_config {
  * automatically.
  * @e_clk_src: select byte clock source.
  * @pd: pointer to MIPI-DSI driver platform data.
+ * @phy: pointer to the generic PHY
  */
 struct mipi_dsim_device {
struct device   *dev;
@@ -236,6 +237,7 @@ struct mipi_dsim_device {
boolsuspended;
 
struct mipi_dsim_platform_data  *pd;
+   struct phy  *phy;
 };
 
 /*
@@ -248,7 +250,7 @@ struct mipi_dsim_device {
  * @enabled: indicate whether mipi controller got enabled or not.
  * @lcd_panel_info: pointer for lcd panel specific structure.
  * this structure specifies width, height, timing and polarity and so on.
- * @phy_enable: pointer to a callback controlling D-PHY enable/reset
+ * @phy_label: the generic PHY label
  */
 struct mipi_dsim_platform_data {
charlcd_panel_name[PANEL_NAME_SIZE];
@@ -257,7 +259,7 @@ struct mipi_dsim_platform_data {
unsigned intenabled;
void*lcd_panel_info;
 
-   int (*phy_enable)(struct platform_device *pdev, bool on);
+   const char  *phy_label;
 };
 
 /*
-- 
1.7.9.5

--
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 v4 4/5] [media] exynos4-is: Use the generic MIPI CSIS PHY driver

2013-06-28 Thread Sylwester Nawrocki
Use the generic PHY API instead of the platform callback to control
the MIPI CSIS DPHY. The 'phy_label' field is added to the platform
data structure to allow PHY lookup on non-dt platforms

Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Acked-by: Felipe Balbi ba...@ti.com
Acked-by: Mauro Carvalho Chehab mche...@redhat.com
---
 drivers/media/platform/exynos4-is/mipi-csis.c |   16 +---
 include/linux/platform_data/mipi-csis.h   |   11 ++-
 2 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/drivers/media/platform/exynos4-is/mipi-csis.c 
b/drivers/media/platform/exynos4-is/mipi-csis.c
index a2eda9d..8436254 100644
--- a/drivers/media/platform/exynos4-is/mipi-csis.c
+++ b/drivers/media/platform/exynos4-is/mipi-csis.c
@@ -20,6 +20,7 @@
 #include linux/memory.h
 #include linux/module.h
 #include linux/of.h
+#include linux/phy/phy.h
 #include linux/platform_data/mipi-csis.h
 #include linux/platform_device.h
 #include linux/pm_runtime.h
@@ -167,6 +168,7 @@ struct csis_pktbuf {
  * @sd: v4l2_subdev associated with CSIS device instance
  * @index: the hardware instance index
  * @pdev: CSIS platform device
+ * @phy: pointer to the CSIS generic PHY
  * @regs: mmaped I/O registers memory
  * @supplies: CSIS regulator supplies
  * @clock: CSIS clocks
@@ -189,6 +191,8 @@ struct csis_state {
struct v4l2_subdev sd;
u8 index;
struct platform_device *pdev;
+   struct phy *phy;
+   const char *phy_label;
void __iomem *regs;
struct regulator_bulk_data supplies[CSIS_NUM_SUPPLIES];
struct clk *clock[NUM_CSIS_CLOCKS];
@@ -726,6 +730,7 @@ static int s5pcsis_get_platform_data(struct platform_device 
*pdev,
state-index = max(0, pdev-id);
state-max_num_lanes = state-index ? CSIS1_MAX_LANES :
  CSIS0_MAX_LANES;
+   state-phy_label = pdata-phy_label;
return 0;
 }
 
@@ -763,8 +768,9 @@ static int s5pcsis_parse_dt(struct platform_device *pdev,
samsung,csis-wclk);
 
state-num_lanes = endpoint.bus.mipi_csi2.num_data_lanes;
-
of_node_put(node);
+
+   state-phy_label = csis;
return 0;
 }
 #else
@@ -800,6 +806,10 @@ static int s5pcsis_probe(struct platform_device *pdev)
return -EINVAL;
}
 
+   state-phy = devm_phy_get(dev, state-phy_label);
+   if (IS_ERR(state-phy))
+   return PTR_ERR(state-phy);
+
mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
state-regs = devm_ioremap_resource(dev, mem_res);
if (IS_ERR(state-regs))
@@ -893,7 +903,7 @@ static int s5pcsis_pm_suspend(struct device *dev, bool 
runtime)
mutex_lock(state-lock);
if (state-flags  ST_POWERED) {
s5pcsis_stop_stream(state);
-   ret = s5p_csis_phy_enable(state-index, false);
+   ret = phy_power_off(state-phy);
if (ret)
goto unlock;
ret = regulator_bulk_disable(CSIS_NUM_SUPPLIES,
@@ -929,7 +939,7 @@ static int s5pcsis_pm_resume(struct device *dev, bool 
runtime)
state-supplies);
if (ret)
goto unlock;
-   ret = s5p_csis_phy_enable(state-index, true);
+   ret = phy_power_on(state-phy);
if (!ret) {
state-flags |= ST_POWERED;
} else {
diff --git a/include/linux/platform_data/mipi-csis.h 
b/include/linux/platform_data/mipi-csis.h
index bf34e17..9214317 100644
--- a/include/linux/platform_data/mipi-csis.h
+++ b/include/linux/platform_data/mipi-csis.h
@@ -17,21 +17,14 @@
  * @wclk_source: CSI wrapper clock selection: 0 - bus clock, 1 - ext. SCLK_CAM
  * @lanes:   number of data lanes used
  * @hs_settle:   HS-RX settle time
+ * @phy_label:  the generic PHY label
  */
 struct s5p_platform_mipi_csis {
unsigned long clk_rate;
u8 wclk_source;
u8 lanes;
u8 hs_settle;
+   const char *phy_label;
 };
 
-/**
- * s5p_csis_phy_enable - global MIPI-CSI receiver D-PHY control
- * @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(int id, bool on);
-
 #endif /* __PLAT_SAMSUNG_MIPI_CSIS_H_ */
-- 
1.7.9.5

--
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 v4 5/5] ARM: Samsung: Remove the MIPI PHY setup code

2013-06-28 Thread Sylwester Nawrocki
Generic PHY drivers are used to handle the MIPI CSIS and MIPI DSIM
DPHYs so we can remove now unused code at arch/arm/plat-samsung.
In case there is any board file for S5PV210 platforms using MIPI
CSIS/DSIM (not any upstream currently) it should use the generic
PHY API to bind the PHYs to respective PHY consumer drivers and
a platform device for the PHY provider should be defined.

Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Acked-by: Felipe Balbi ba...@ti.com
Acked-by: Kukjin Kim kgene@samsung.com
---
 arch/arm/mach-exynos/include/mach/regs-pmu.h|5 --
 arch/arm/mach-s5pv210/include/mach/regs-clock.h |4 --
 arch/arm/plat-samsung/Kconfig   |5 --
 arch/arm/plat-samsung/Makefile  |1 -
 arch/arm/plat-samsung/setup-mipiphy.c   |   60 ---
 5 files changed, 75 deletions(-)
 delete mode 100644 arch/arm/plat-samsung/setup-mipiphy.c

diff --git a/arch/arm/mach-exynos/include/mach/regs-pmu.h 
b/arch/arm/mach-exynos/include/mach/regs-pmu.h
index 57344b7..2cdb63e 100644
--- a/arch/arm/mach-exynos/include/mach/regs-pmu.h
+++ b/arch/arm/mach-exynos/include/mach/regs-pmu.h
@@ -44,11 +44,6 @@
 #define S5P_DAC_PHY_CONTROLS5P_PMUREG(0x070C)
 #define S5P_DAC_PHY_ENABLE (1  0)
 
-#define S5P_MIPI_DPHY_CONTROL(n)   S5P_PMUREG(0x0710 + (n) * 4)
-#define S5P_MIPI_DPHY_ENABLE   (1  0)
-#define S5P_MIPI_DPHY_SRESETN  (1  1)
-#define S5P_MIPI_DPHY_MRESETN  (1  2)
-
 #define S5P_INFORM0S5P_PMUREG(0x0800)
 #define S5P_INFORM1S5P_PMUREG(0x0804)
 #define S5P_INFORM2S5P_PMUREG(0x0808)
diff --git a/arch/arm/mach-s5pv210/include/mach/regs-clock.h 
b/arch/arm/mach-s5pv210/include/mach/regs-clock.h
index 032de66..e345584 100644
--- a/arch/arm/mach-s5pv210/include/mach/regs-clock.h
+++ b/arch/arm/mach-s5pv210/include/mach/regs-clock.h
@@ -147,10 +147,6 @@
 #define S5P_HDMI_PHY_CONTROL   S5P_CLKREG(0xE804)
 #define S5P_USB_PHY_CONTROLS5P_CLKREG(0xE80C)
 #define S5P_DAC_PHY_CONTROLS5P_CLKREG(0xE810)
-#define S5P_MIPI_DPHY_CONTROL(x) S5P_CLKREG(0xE814)
-#define S5P_MIPI_DPHY_ENABLE   (1  0)
-#define S5P_MIPI_DPHY_SRESETN  (1  1)
-#define S5P_MIPI_DPHY_MRESETN  (1  2)
 
 #define S5P_INFORM0S5P_CLKREG(0xF000)
 #define S5P_INFORM1S5P_CLKREG(0xF004)
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index b21d9d5..60f6337 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -388,11 +388,6 @@ config S3C24XX_PWM
  Support for exporting the PWM timer blocks via the pwm device
  system
 
-config S5P_SETUP_MIPIPHY
-   bool
-   help
- Compile in common setup code for MIPI-CSIS and MIPI-DSIM devices
-
 config S3C_SETUP_CAMIF
bool
help
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
index 5d7f839..0db786e 100644
--- a/arch/arm/plat-samsung/Makefile
+++ b/arch/arm/plat-samsung/Makefile
@@ -38,7 +38,6 @@ obj-$(CONFIG_S5P_DEV_UART)+= s5p-dev-uart.o
 obj-$(CONFIG_SAMSUNG_DEV_BACKLIGHT)+= dev-backlight.o
 
 obj-$(CONFIG_S3C_SETUP_CAMIF)  += setup-camif.o
-obj-$(CONFIG_S5P_SETUP_MIPIPHY)+= setup-mipiphy.o
 
 # DMA support
 
diff --git a/arch/arm/plat-samsung/setup-mipiphy.c 
b/arch/arm/plat-samsung/setup-mipiphy.c
deleted file mode 100644
index 66df315..000
--- a/arch/arm/plat-samsung/setup-mipiphy.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2011 Samsung Electronics Co., Ltd.
- *
- * S5P - Helper functions for MIPI-CSIS and MIPI-DSIM D-PHY control
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include linux/export.h
-#include linux/kernel.h
-#include linux/platform_device.h
-#include linux/io.h
-#include linux/spinlock.h
-#include mach/regs-clock.h
-
-static int __s5p_mipi_phy_control(int id, bool on, u32 reset)
-{
-   static DEFINE_SPINLOCK(lock);
-   void __iomem *addr;
-   unsigned long flags;
-   u32 cfg;
-
-   id = max(0, id);
-   if (id  1)
-   return -EINVAL;
-
-   addr = S5P_MIPI_DPHY_CONTROL(id);
-
-   spin_lock_irqsave(lock, flags);
-
-   cfg = __raw_readl(addr);
-   cfg = on ? (cfg | reset) : (cfg  ~reset);
-   __raw_writel(cfg, addr);
-
-   if (on) {
-   cfg |= S5P_MIPI_DPHY_ENABLE;
-   } else if (!(cfg  (S5P_MIPI_DPHY_SRESETN |
-   S5P_MIPI_DPHY_MRESETN)  ~reset)) {
-   cfg = ~S5P_MIPI_DPHY_ENABLE;
-   }
-
-   __raw_writel(cfg, addr);
-   spin_unlock_irqrestore(lock, flags);
-
-   return 0;
-}
-
-int s5p_csis_phy_enable(int id, bool on)
-{
-   

Re: [PATCH] usbtv: fix dependency

2013-06-28 Thread Mauro Carvalho Chehab
Em Fri, 28 Jun 2013 15:24:20 +0200 (CEST)
Guennadi Liakhovetski g.liakhovet...@gmx.de escreveu:

 Hi Hans, Mauro
 
 On Fri, 28 Jun 2013, Hans Verkuil wrote:
 
  On Fri June 28 2013 14:42:46 Mauro Carvalho Chehab wrote:
   Em Fri, 28 Jun 2013 13:18:44 +0200
   Hans Verkuil hverk...@xs4all.nl escreveu:
   
On Fri June 28 2013 13:00:43 Mauro Carvalho Chehab wrote:
 Em Fri, 28 Jun 2013 10:24:15 +0200
 Hans Verkuil hverk...@xs4all.nl escreveu:
 
  This fixes a dependency problem as found by Randy Dunlap:
  
  https://lkml.org/lkml/2013/6/27/501
  
  Mauro, is there any reason for any V4L2 driver to depend on 
  VIDEO_DEV instead of
  just VIDEO_V4L2?
  
  Some drivers depend on VIDEO_DEV, some on VIDEO_V4L2, some on both. 
  It's all
  pretty chaotic.
 
 It should be noticed that, despite its name, this config is actually a
 joint dependency of VIDEO_DEV and I2C that will compile drivers as 
 module
 if either I2C or VIDEO_DEV is a module:
 
   config VIDEO_V4L2
   tristate
   depends on (I2C || I2C=n)  VIDEO_DEV
   default (I2C || I2C=n)  VIDEO_DEV
 
 So, a V4L2 device that doesn't have any I2C device doesn't need to 
 depend
 on VIDEO_V4L2. That includes, for example, reversed-engineered webcam
 drivers where the sensor code is inside the driver and a few 
 capture-only
 device drivers.

Yes, it does have to depend on it. That's exactly why usbtv is failing: 
like
any other v4l2 driver usbtv needs the videodev.ko module. That is 
dependent
on VIDEO_V4L2. What is happening here is that the dependency of usbtv on
VIDEO_DEV allows it to be built as part of the kernel, but VIDEO_V4L2 
is built
as a module due to its I2C dependency with the result that usbtv can't 
link to
the videodev functions.

The way things are today I do not believe any v4l2 driver should depend 
on
VIDEO_DEV, instead they should all depend on VIDEO_V4L2. That would 
make a
lot more sense.
   
   Hmm...
   
   $ git grep -l i2c drivers/media/v4l2-core/
   drivers/media/v4l2-core/tuner-core.c  (not part of 
   videodev.ko module)
   drivers/media/v4l2-core/v4l2-async.c
   drivers/media/v4l2-core/v4l2-common.c
   drivers/media/v4l2-core/v4l2-ctrls.c  (actually, there's just 
   a comment there)
   drivers/media/v4l2-core/v4l2-device.c
   
   $ git grep  CONFIG_I2C drivers/media/v4l2-core/
   drivers/media/v4l2-core/v4l2-common.c:#if IS_ENABLED(CONFIG_I2C)
   drivers/media/v4l2-core/v4l2-common.c:#endif /* defined(CONFIG_I2C) */
   drivers/media/v4l2-core/v4l2-device.c:#if IS_ENABLED(CONFIG_I2C)
   
   yes, there are some parts of videodev that are dependent on I2C.
   
   That's basically why all V4L2 drivers should depend on VIDEO_V4L2.
   
   That's said, before the addition of v4l2-async, it was safe to compile
   the core without I2C, as the parts of the code that are I2C specific are
   protected by a:
 #if defined(CONFIG_I2C)
   
   With its addition, I suspect that we'll still have Kbuild issues, if I2C
   is disabled and a driver that doesn't depends on I2C is compiled.
   
   So, 2 patches seem to be needed:
   
   1) a patch that replaces all driver dependencies from CONFIG_DEV to
  CONFIG_V4L2;
   
   2) a patch that fixes the issues with v4l2-async.
   
   With regards to the last one, I can see 3 ways to fix it:
 1) don't add v4l2-async at videodev.ko if I2C is not selected;
 2) protect the I2C specific parts of v4l2-async with
 #if defined(CONFIG_I2C)
 3) put v4l2-async on a separate module.
   
   (or some combination of the above)
   
   As only very few drivers use v4l2-async, as this is more focused to
   fix troubles with OT, I think that the better would be to do (3) and
   to add an specific Kconfig entry for it.
  
  No, #2 is the right choice here. That's necessary anyway since it is a valid
  use-case that I2C is disabled and you use it for platform devices only.

True, if are there any case where a platform kernel would be compiled without
I2C. I can't figure out any of such cases where such a weird config would
make sense.

  
  Guennadi, can you look at this? The only thing that is probably needed is
  that match_i2c returns false if CONFIG_I2C is undefined.
  
  I prefer to keep this part of videodev, at least for now: I think there will
  be a fairly quick uptake of this API internally, certainly for subdevs. Note
  BTW that even x86 kernels come with CONFIG_OF enabled these days.

Fedora 18 (and even Fedora 19 beta) Kernels don't enable it for x86. It
is enabled there only for arm:
config-armv7-generic:CONFIG_OF=y
config-armv7-generic:CONFIG_OF_DEVICE=y

I don't doubt that this would be enabled on x86 there some day, but
this is not the current status, and I fail to see why one would enable
it on x86, except if 

Re: [PATCH V2 3/3] video: exynos_dp: Use the generic PHY driver

2013-06-28 Thread Jean-Christophe PLAGNIOL-VILLARD
On 12:35 Fri 28 Jun , Felipe Balbi wrote:
 On Fri, Jun 28, 2013 at 04:18:23PM +0900, Jingoo Han wrote:
  Use the generic PHY API instead of the platform callback to control
  the DP PHY. The 'phy_label' field is added to the platform data
  structure to allow PHY lookup on non-dt platforms.
  
  Signed-off-by: Jingoo Han jg1@samsung.com
  ---
   .../devicetree/bindings/video/exynos_dp.txt|   17 ---
   drivers/video/exynos/exynos_dp_core.c  |  118 
  ++--
   drivers/video/exynos/exynos_dp_core.h  |2 +
   include/video/exynos_dp.h  |6 +-
   4 files changed, 15 insertions(+), 128 deletions(-)
  
  diff --git a/Documentation/devicetree/bindings/video/exynos_dp.txt 
  b/Documentation/devicetree/bindings/video/exynos_dp.txt
  index 84f10c1..a8320e3 100644
  --- a/Documentation/devicetree/bindings/video/exynos_dp.txt
  +++ b/Documentation/devicetree/bindings/video/exynos_dp.txt
  @@ -1,17 +1,6 @@
   The Exynos display port interface should be configured based on
   the type of panel connected to it.
   
  -We use two nodes:
  -   -dp-controller node
  -   -dptx-phy node(defined inside dp-controller node)
  -
  -For the DP-PHY initialization, we use the dptx-phy node.
  -Required properties for dptx-phy:
  -   -reg:
  -   Base address of DP PHY register.
  -   -samsung,enable-mask:
  -   The bit-mask used to enable/disable DP PHY.
  -
   For the Panel initialization, we read data from dp-controller node.
   Required properties for dp-controller:
  -compatible:
  @@ -67,12 +56,6 @@ SOC specific portion:
  interrupt-parent = combiner;
  clocks = clock 342;
  clock-names = dp;
  -
  -   dptx-phy {
  -   reg = 0x10040720;
  -   samsung,enable-mask = 1;
  -   };
I've an issue here you break dt compatibilty

Best Regards,
J.
--
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] usbtv: fix dependency

2013-06-28 Thread Hans Verkuil
On Fri June 28 2013 15:55:15 Mauro Carvalho Chehab wrote:
 Em Fri, 28 Jun 2013 15:24:20 +0200 (CEST)
 Guennadi Liakhovetski g.liakhovet...@gmx.de escreveu:
 
  Hi Hans, Mauro
  
  On Fri, 28 Jun 2013, Hans Verkuil wrote:
  
   On Fri June 28 2013 14:42:46 Mauro Carvalho Chehab wrote:
Em Fri, 28 Jun 2013 13:18:44 +0200
Hans Verkuil hverk...@xs4all.nl escreveu:

 On Fri June 28 2013 13:00:43 Mauro Carvalho Chehab wrote:
  Em Fri, 28 Jun 2013 10:24:15 +0200
  Hans Verkuil hverk...@xs4all.nl escreveu:
  
   This fixes a dependency problem as found by Randy Dunlap:
   
   https://lkml.org/lkml/2013/6/27/501
   
   Mauro, is there any reason for any V4L2 driver to depend on 
   VIDEO_DEV instead of
   just VIDEO_V4L2?
   
   Some drivers depend on VIDEO_DEV, some on VIDEO_V4L2, some on 
   both. It's all
   pretty chaotic.
  
  It should be noticed that, despite its name, this config is 
  actually a
  joint dependency of VIDEO_DEV and I2C that will compile drivers as 
  module
  if either I2C or VIDEO_DEV is a module:
  
  config VIDEO_V4L2
  tristate
  depends on (I2C || I2C=n)  VIDEO_DEV
  default (I2C || I2C=n)  VIDEO_DEV
  
  So, a V4L2 device that doesn't have any I2C device doesn't need to 
  depend
  on VIDEO_V4L2. That includes, for example, reversed-engineered 
  webcam
  drivers where the sensor code is inside the driver and a few 
  capture-only
  device drivers.
 
 Yes, it does have to depend on it. That's exactly why usbtv is 
 failing: like
 any other v4l2 driver usbtv needs the videodev.ko module. That is 
 dependent
 on VIDEO_V4L2. What is happening here is that the dependency of usbtv 
 on
 VIDEO_DEV allows it to be built as part of the kernel, but VIDEO_V4L2 
 is built
 as a module due to its I2C dependency with the result that usbtv 
 can't link to
 the videodev functions.
 
 The way things are today I do not believe any v4l2 driver should 
 depend on
 VIDEO_DEV, instead they should all depend on VIDEO_V4L2. That would 
 make a
 lot more sense.

Hmm...

$ git grep -l i2c drivers/media/v4l2-core/
drivers/media/v4l2-core/tuner-core.c(not part of 
videodev.ko module)
drivers/media/v4l2-core/v4l2-async.c
drivers/media/v4l2-core/v4l2-common.c
drivers/media/v4l2-core/v4l2-ctrls.c(actually, there's just 
a comment there)
drivers/media/v4l2-core/v4l2-device.c

$ git grep  CONFIG_I2C drivers/media/v4l2-core/
drivers/media/v4l2-core/v4l2-common.c:#if IS_ENABLED(CONFIG_I2C)
drivers/media/v4l2-core/v4l2-common.c:#endif /* defined(CONFIG_I2C) */
drivers/media/v4l2-core/v4l2-device.c:#if IS_ENABLED(CONFIG_I2C)

yes, there are some parts of videodev that are dependent on I2C.

That's basically why all V4L2 drivers should depend on VIDEO_V4L2.

That's said, before the addition of v4l2-async, it was safe to compile
the core without I2C, as the parts of the code that are I2C specific are
protected by a:
#if defined(CONFIG_I2C)

With its addition, I suspect that we'll still have Kbuild issues, if I2C
is disabled and a driver that doesn't depends on I2C is compiled.

So, 2 patches seem to be needed:

1) a patch that replaces all driver dependencies from CONFIG_DEV to
   CONFIG_V4L2;

2) a patch that fixes the issues with v4l2-async.

With regards to the last one, I can see 3 ways to fix it:
1) don't add v4l2-async at videodev.ko if I2C is not selected;
2) protect the I2C specific parts of v4l2-async with
#if defined(CONFIG_I2C)
3) put v4l2-async on a separate module.

(or some combination of the above)

As only very few drivers use v4l2-async, as this is more focused to
fix troubles with OT, I think that the better would be to do (3) and
to add an specific Kconfig entry for it.
   
   No, #2 is the right choice here. That's necessary anyway since it is a 
   valid
   use-case that I2C is disabled and you use it for platform devices only.
 
 True, if are there any case where a platform kernel would be compiled without
 I2C. I can't figure out any of such cases where such a weird config would
 make sense.
 
   
   Guennadi, can you look at this? The only thing that is probably needed is
   that match_i2c returns false if CONFIG_I2C is undefined.
   
   I prefer to keep this part of videodev, at least for now: I think there 
   will
   be a fairly quick uptake of this API internally, certainly for subdevs. 
   Note
   BTW that even x86 kernels come with CONFIG_OF enabled these days.
 
 Fedora 18 (and even Fedora 19 beta) Kernels don't enable it for x86. It
 is enabled there only for arm:
   

[GIT PULL] mem2mem driver changes

2013-06-28 Thread Kamil Debski
The following changes since commit 53f501a96b81cedb8449153fd2afd533eeac3172:

  Merge branch 'v4l_for_linus' into patchwork (2013-06-25 15:30:23 +0200)

are available in the git repository at:


  git://git.linuxtv.org/kdebski/media.git master

for you to fetch changes up to f4603fe949a1e4ec61f4900bffb4e1d2f11c27ac:

  coda: add CODA7541 decoding support (2013-06-28 16:18:14 +0200)


Alexander Shiyan (1):
  media: coda: Fix DT driver data pointer for i.MX27

John Sheu (1):
  s5p-mfc: Fix input/output format reporting

Philipp Zabel (9):
  mem2mem: add support for hardware buffered queue
  coda: use vb2_set_plane_payload instead of setting
v4l2_planes[0].bytesused directly
  coda: dynamic IRAM setup for encoder
  coda: do not allocate maximum number of framebuffers for encoder
  coda: update CODA7541 to firmware 1.4.50
  coda: add bitstream ringbuffer handling for decoder
  coda: dynamic IRAM setup for decoder
  coda: split encoder specific parts out of device_run and irq_handler
  coda: add CODA7541 decoding support

 drivers/media/platform/coda.c| 1471
++
 drivers/media/platform/coda.h|  107 +-
 drivers/media/platform/s5p-mfc/s5p_mfc_dec.c |   79 +-
 drivers/media/platform/s5p-mfc/s5p_mfc_enc.c |   46 +-
 drivers/media/v4l2-core/v4l2-mem2mem.c   |   10 +-
 include/media/v4l2-mem2mem.h |   13 +
 6 files changed, 1459 insertions(+), 267 deletions(-)


--
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 v3 7/8] [media] V4L: Add VP8 encoder controls

2013-06-28 Thread Hans Verkuil
Hi Arun,

As promised, here is my review.

I have been thinking a bit more about whether or not a VPX control class
should be added, and in my opinion it shouldn't. These controls should be
part of the MPEG control class, as the VPX encoder shares a lot of general
encoding parameters, just like h264 and mpeg4.

It is unfortunate that all the defines contain the MPEG name, and I take
the blame for that since I came up with these defines originally.

That said, there are some things that can be done to make it less confusing:

- Clearly state in v4l2-controls.h and v4l2-ctrls.c that the MPEG controls
  are really Codec Controls, so not MPEG specific, and that the 'MPEG' part of
  the define is historical.

- Currently the V4L2_CID_MPEG_CLASS name in v4l2-ctrls.c is MPEG Encoder 
Controls.
  This should be changed to Codec Controls, since the controls in this class 
are
  neither MPEG specific, nor are they encoder specific as there are also 
controls
  related to the decoder.

- Update the DocBook section for the MPEG controls accordingly: change 'MPEG' in
  the text to 'Codec' and add a note explaining why all the defines are prefixed
  with V4L2_CID_MPEG/V4L2_MPEG instead of _CODEC.

I did toy with the idea of adding aliases in v4l2-controls.h replacing MPEG with
CODEC, but that really is too messy. I think if you can take care of the three
points mentioned above we should be OK.

This also means that in this patch the V4L2_CID_VPX_ prefix changes to
V4L2_CID_MPEG_VIDEO_VPX_ as that is consistent with the current naming 
convention
in v4l2-controls.h: V4L2_CID_MPEG_VIDEO_H264_ASO, 
V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL.

Enums use V4L2_MPEG_VIDEO_VPX_ prefix.

Yes, I know, this will make the names quite a bit longer, but it is important 
for
consistency. Codecs are likely to have lots of controls since there are lots of
knobs you can tweak. So using a systematic naming scheme will prevent it from
descending into chaos...

On Tue June 25 2013 12:57:14 Arun Kumar K wrote:
 This patch adds new V4L controls for VP8 encoding.
 
 Signed-off-by: Kiran AVND avnd.ki...@samsung.com
 Signed-off-by: Arun Kumar K arun...@samsung.com
 ---
  Documentation/DocBook/media/v4l/controls.xml |  150 
 ++
  drivers/media/v4l2-core/v4l2-ctrls.c |   33 ++
  include/uapi/linux/v4l2-controls.h   |   29 -
  3 files changed, 210 insertions(+), 2 deletions(-)
 
 diff --git a/Documentation/DocBook/media/v4l/controls.xml 
 b/Documentation/DocBook/media/v4l/controls.xml
 index 8d7a779..736c991 100644
 --- a/Documentation/DocBook/media/v4l/controls.xml
 +++ b/Documentation/DocBook/media/v4l/controls.xml
 @@ -3009,6 +3009,156 @@ in by the application. 0 = do not insert, 1 = insert 
 packets./entry
 /tgroup
   /table
/section
 +
 +section
 +  titleVPX Control Reference/title
 +
 +  paraThe VPX controls include controls for encoding parameters
 +  of VPx video codec./para
 +
 +  table pgwide=1 frame=none id=vpx-control-id
 +  titleVPX Control IDs/title
 +
 +  tgroup cols=4
 +colspec colname=c1 colwidth=1* /
 +colspec colname=c2 colwidth=6* /
 +colspec colname=c3 colwidth=2* /
 +colspec colname=c4 colwidth=6* /
 +spanspec namest=c1 nameend=c2 spanname=id /
 +spanspec namest=c2 nameend=c4 spanname=descr /
 +thead
 +  row
 +entry spanname=id align=leftID/entry
 +entry align=leftType/entry
 +  /rowrow rowsep=1entry spanname=descr 
 align=leftDescription/entry
 +  /row
 +/thead
 +tbody valign=top
 +  rowentry/entry/row
 +
 +   rowentry/entry/row
 +   row id=v4l2-vpx-num-partitions
 + entry 
 spanname=idconstantV4L2_CID_VPX_NUM_PARTITIONS/constant/entry
 + entryenum v4l2_vp8_num_partitions/entry
 +   /row
 +   rowentry spanname=descrThe number of token partitions to 
 use in VP8 encoder.
 +Possible values are:/entry
 +   /row
 +   row
 + entrytbl spanname=descr cols=2
 +   tbody valign=top
 + row
 +   entryconstantV4L2_VPX_1_PARTITION/constant/entry
 +   entry1 coefficient partition/entry
 + /row
 + row
 +   entryconstantV4L2_VPX_2_PARTITIONS/constant/entry
 +   entry2 partitions/entry

Add 'coefficient' for the other cases as well in the description. At least, I 
think
this should be '2 coefficient partitions'.

 + /row
 + row
 +   entryconstantV4L2_VPX_4_PARTITIONS/constant/entry
 +   entry4 partitions/entry
 + /row
 + row
 +   entryconstantV4L2_VPX_8_PARTITIONS/constant/entry
 +   entry8 partitions/entry
 + /row
 +  /tbody
 + /entrytbl
 +   /row
 +
 

[GIT PULL FOR v3.11] Fixes for 3.11

2013-06-28 Thread Hans Verkuil
The following changes since commit ee17608d6aa04a86e253a9130d6c6d00892f132b:

  [media] imx074: support asynchronous probing (2013-06-21 16:36:15 -0300)

are available in the git repository at:

  git://linuxtv.org/hverkuil/media_tree.git for-v3.11

for you to fetch changes up to a2bdc80ec11aa569b56dea85550858743a79b999:

  media: i2c: tvp514x: remove manual setting of subdev name (2013-06-28 
16:28:33 +0200)


Emil Goode (1):
  saa7134: Fix sparse warnings by adding __user annotation

Hans Verkuil (7):
  ml86v7667: fix compiler warning
  bfin_capture: fix compiler warning
  omap_vout: fix compiler warning
  v4l2-controls.h: fix copy-and-paste error in comment
  saa7164: fix compiler warning
  wl128x: add missing struct v4l2_device.
  mem2mem: set missing v4l2_dev pointer

Lad, Prabhakar (2):
  media: i2c: tvp7002: remove manual setting of subdev name
  media: i2c: tvp514x: remove manual setting of subdev name

Lars-Peter Clausen (1):
  tvp514x: Fix init seqeunce

 drivers/media/i2c/ml86v7667.c  |  2 +-
 drivers/media/i2c/tvp514x.c| 11 +--
 drivers/media/i2c/tvp7002.c|  1 -
 drivers/media/pci/saa7134/saa7134-video.c  |  2 +-
 drivers/media/pci/saa7164/saa7164-core.c   |  3 ++-
 drivers/media/platform/blackfin/bfin_capture.c |  4 +++-
 drivers/media/platform/m2m-deinterlace.c   |  1 +
 drivers/media/platform/mem2mem_testdev.c   |  3 ++-
 drivers/media/platform/mx2_emmaprp.c   |  1 +
 drivers/media/platform/omap/omap_vout.c|  3 +--
 drivers/media/radio/wl128x/fmdrv.h |  2 ++
 drivers/media/radio/wl128x/fmdrv_v4l2.c|  8 
 include/uapi/linux/v4l2-controls.h |  4 ++--
 13 files changed, 29 insertions(+), 16 deletions(-)
--
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: lgdt3304

2013-06-28 Thread Steven Toth
On Thu, Jun 27, 2013 at 11:00 PM, Carl-Fredrik Sundstrom
c...@blueflowamericas.com wrote:

 I am able to detect two lgdt3304 one on each i2c bus now. As you suspected I
 had to set GPIO pin 17 for them to come alive.

 Now to my next question, how do I attach two front ends I have two lgdt3304
 and two TDA18271HD/C2
 Is there a good driver I can look at where they do that ?

The SAA7164 driver (amongst others) demonstrates how to expose
multiple tuners on a single card via multiple adapters,
/dev/dvb/adapterX.

The cx88 driver demonstrates how to expose multiple tuners/demods via
a single transport bus, via a single dvb adapter.
/dev/dvb/adapter0/frontendX

- Steve

-- 
Steven Toth - Kernel Labs
http://www.kernellabs.com
--
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] usbtv: fix dependency

2013-06-28 Thread Mauro Carvalho Chehab
Em Fri, 28 Jun 2013 16:15:29 +0200
Hans Verkuil hverk...@xs4all.nl escreveu:

I prefer to keep this part of videodev, at least for now: I think there 
will
be a fairly quick uptake of this API internally, certainly for subdevs. 
Note
BTW that even x86 kernels come with CONFIG_OF enabled these days.
  
  Fedora 18 (and even Fedora 19 beta) Kernels don't enable it for x86. It
  is enabled there only for arm:
  config-armv7-generic:CONFIG_OF=y
  config-armv7-generic:CONFIG_OF_DEVICE=y
  
  I don't doubt that this would be enabled on x86 there some day, but
  this is not the current status, and I fail to see why one would enable
  it on x86, except if some specific distro have some specific issues
  at their boot loaders that would be easier to solve if OF is enabled
  on all of their kernels.
 
 Debian sid turns it on,

Weird. 

 I think it is for some intel-based embedded systems.

Ok, then, it could make sense, if they want to use the same Kernel for both
embedded and non-embedded systems.

  From my side, I don't see much sense of overbloating the videodev core
  with platform-specific code.
 
 About half of this source is necessary anyway for subdevs that need to
 be async-aware. Note that v4l2-async is by itself unrelated to CONFIG_OF.
 It can be used by any driver that wants to asynchronously load i2c drivers.

Making a V4L2 driver to initialize synchronously is already too complex,
and it takes some time until the code there becomes stable. I don't think
a typical driver should be using the async API, as this will just add
unneeded complexity to an already-complex-enough task.

So, yes, in thesis, this API could be used by non-OF driver, but
in practice, what's the gain of doing it? 

Very few hardware have more than one I2C buses, so, the access to the 
subdevs will be serialized anyway.

For a serialized I2C bus, the async API doesn't bring any benefit, and
may actually hurt the drivers, as the driver/hardware may have hard-to-track
bugs if initialized on certain specific infrequent init sequence.

The tm6000 chips, for example, have this issue: there are some parts 
there that, if you change the order where the registers are written, the
hardware crashes - it is believed to be a bug at its internal 8051
firmware.

Even the few hardware that have more than one I2C buses, where a parallel
init could make the hardware to initialize faster, it may have troubles
with parallel initialization, due to I2C gateways, I2C clock registers,
firmwares, etc. Allowing async init there could be a real nightmare,
any may require it to be serialized, anyway.

So, I see no benefit on having this code to be mandatory for a non-OF
hardware. In contrary, it would just increase the code size and make
debugging harder for nothing.

Cheers,
Mauro
--
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 v7] V4L2: soc_camera: Renesas R-Car VIN driver

2013-06-28 Thread Sergei Shtylyov

Hello.

On 06/28/2013 03:58 AM, Vladimir Barinov wrote:


From: Vladimir Barinov vladimir.bari...@cogentembedded.com



Add Renesas R-Car VIN (Video In) V4L2 driver.



Based on the patch by Phil Edworthy phil.edwor...@renesas.com.



Signed-off-by: Vladimir Barinov vladimir.bari...@cogentembedded.com
[Sergei: removed deprecated IRQF_DISABLED flag, reordered/renamed
'enum chip_id'
values, reordered rcar_vin_id_table[] entries,  removed senseless
parens from
to_buf_list() macro, used ALIGN() macro in rcar_vin_setup(), added {}
to the
*if* statement  and used 'bool' values instead of 0/1 where
necessary, removed
unused macros, done some reformatting and clarified some comments.]
Signed-off-by: Sergei Shtylyov sergei.shtyl...@cogentembedded.com



Reviewing this iteration of the patch is still on my todo, in the
meantime you might verify whether it works on top of the for-3.11-3
branch of my



http://git.linuxtv.org/gliakhovetski/v4l-dvb.git



git-tree, or next after it's been pulled by Mauro and pushed
upstream. With that branch you shouldn't need any additional patches
andy more.



Actually we need to apply/merge more patches here that enables VIN
support on separate platform (like pinctrl/clock/setup/) :)



Despite of above the rcar_vin driver works fine on Marzen board in
v4l-dvb.git after adding soc_camera_host_ops clock_start/clock_stop.


   Guennadi, does that mean that we should rebase the driver to the 
branch that you've named now?



Regards,
Vladimir


WBR, Sergei

--
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] usbtv: fix dependency

2013-06-28 Thread Mauro Carvalho Chehab
Em Fri, 28 Jun 2013 10:55:15 -0300
Mauro Carvalho Chehab mche...@redhat.com escreveu:

  This patch
  
  http://git.linuxtv.org/gliakhovetski/v4l-dvb.git/commitdiff/a92d0222c693db29a5d00eaedcdebf748789c38e
  
  has been pushed 3 days ago:
  
  https://patchwork.linuxtv.org/patch/19090/
 
 As, according with:
   https://lwn.net/Articles/556034/rss
 
 -rc7 is likely the last one before 3.10, that means that the media merge
 window for 3.11 is closed already (as we close it one week before, in order
 to give more time for reviewing the patches better at -next).
 
 So, please split the fix patches from it on a separate pull request.

Hmm... just took a look at the actual pull request... from the description,
it seems to contain just fixes/documentation, so, I'll be handling it
in a few.

Regards,
Mauro
-- 

Cheers,
Mauro
--
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


cron job: media_tree daily build: WARNINGS

2013-06-28 Thread Hans Verkuil
This message is generated daily by a cron job that builds media_tree for
the kernels and architectures in the list below.

Results of the daily build of media_tree:

date:   Fri Jun 28 19:00:18 CEST 2013
git branch: test
git hash:   188af63c0af2d7ef395bc94e3efa173f34dae03d
gcc version:i686-linux-gcc (GCC) 4.8.1
sparse version: v0.4.5-rc1
host hardware:  x86_64
host os:3.9-7.slh.1-amd64

linux-git-arm-at91: WARNINGS
linux-git-arm-davinci: WARNINGS
linux-git-arm-exynos: OK
linux-git-arm-mx: WARNINGS
linux-git-arm-omap: WARNINGS
linux-git-arm-omap1: WARNINGS
linux-git-arm-pxa: WARNINGS
linux-git-blackfin: WARNINGS
linux-git-i686: OK
linux-git-m32r: OK
linux-git-mips: OK
linux-git-powerpc64: WARNINGS
linux-git-sh: WARNINGS
linux-git-x86_64: OK
linux-2.6.31.14-i686: WARNINGS
linux-2.6.32.27-i686: WARNINGS
linux-2.6.33.7-i686: WARNINGS
linux-2.6.34.7-i686: WARNINGS
linux-2.6.35.9-i686: WARNINGS
linux-2.6.36.4-i686: WARNINGS
linux-2.6.37.6-i686: WARNINGS
linux-2.6.38.8-i686: WARNINGS
linux-2.6.39.4-i686: WARNINGS
linux-3.0.60-i686: WARNINGS
linux-3.10-rc1-i686: OK
linux-3.1.10-i686: WARNINGS
linux-3.2.37-i686: WARNINGS
linux-3.3.8-i686: WARNINGS
linux-3.4.27-i686: WARNINGS
linux-3.5.7-i686: WARNINGS
linux-3.6.11-i686: WARNINGS
linux-3.7.4-i686: WARNINGS
linux-3.8-i686: WARNINGS
linux-3.9.2-i686: WARNINGS
linux-2.6.31.14-x86_64: WARNINGS
linux-2.6.32.27-x86_64: WARNINGS
linux-2.6.33.7-x86_64: WARNINGS
linux-2.6.34.7-x86_64: WARNINGS
linux-2.6.35.9-x86_64: WARNINGS
linux-2.6.36.4-x86_64: WARNINGS
linux-2.6.37.6-x86_64: WARNINGS
linux-2.6.38.8-x86_64: WARNINGS
linux-2.6.39.4-x86_64: WARNINGS
linux-3.0.60-x86_64: WARNINGS
linux-3.10-rc1-x86_64: OK
linux-3.1.10-x86_64: WARNINGS
linux-3.2.37-x86_64: WARNINGS
linux-3.3.8-x86_64: WARNINGS
linux-3.4.27-x86_64: WARNINGS
linux-3.5.7-x86_64: WARNINGS
linux-3.6.11-x86_64: WARNINGS
linux-3.7.4-x86_64: WARNINGS
linux-3.8-x86_64: WARNINGS
linux-3.9.2-x86_64: WARNINGS
apps: WARNINGS
spec-git: OK
sparse version: v0.4.5-rc1
sparse: ERRORS

Detailed results are available here:

http://www.xs4all.nl/~hverkuil/logs/Friday.log

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Friday.tar.bz2

The Media Infrastructure API from this daily build is here:

http://www.xs4all.nl/~hverkuil/spec/media.html
--
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 v7] V4L2: soc_camera: Renesas R-Car VIN driver

2013-06-28 Thread Vladimir Barinov

Hi Guennadi,

Vladimir Barinov wrote:

Hi Guennadi,

Guennadi Liakhovetski wrote:

Hi Sergei

On Sat, 22 Jun 2013, Sergei Shtylyov wrote:

 

From: Vladimir Barinov vladimir.bari...@cogentembedded.com

Add Renesas R-Car VIN (Video In) V4L2 driver.

Based on the patch by Phil Edworthy phil.edwor...@renesas.com.

Signed-off-by: Vladimir Barinov vladimir.bari...@cogentembedded.com
[Sergei: removed deprecated IRQF_DISABLED flag, reordered/renamed 
'enum chip_id'
values, reordered rcar_vin_id_table[] entries,  removed senseless 
parens from
to_buf_list() macro, used ALIGN() macro in rcar_vin_setup(), added 
{} to the
*if* statement  and used 'bool' values instead of 0/1 where 
necessary, removed

unused macros, done some reformatting and clarified some comments.]
Signed-off-by: Sergei Shtylyov sergei.shtyl...@cogentembedded.com



Reviewing this iteration of the patch is still on my todo, in the 
meantime you might verify whether it works on top of the for-3.11-3 
branch of my


http://git.linuxtv.org/gliakhovetski/v4l-dvb.git

git-tree, or next after it's been pulled by Mauro and pushed 
upstream. With that branch you shouldn't need any additional patches 
andy more.
  
Actually we need to apply/merge more patches here that enables VIN 
support on separate platform (like pinctrl/clock/setup/) :)


Despite of above the rcar_vin driver works fine on Marzen board in 
v4l-dvb.git after adding soc_camera_host_ops clock_start/clock_stop.

A little clarification here.

I have been adding empty clock_start/clock_stop callbacks to rcar_vin 
driver since for my setup rcar_vin + adv7180  the icd-clk is NULL.


Regards,
Vladimir

--
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