Re: [PATCH v3 2/4] media: adv7180: add adv7180cp, adv7180st compatible strings

2017-07-03 Thread Ulrich Hecht
On Fri, Jun 30, 2017 at 11:19 AM, Geert Uytterhoeven
<ge...@linux-m68k.org> wrote:
> Hi Ulrich,
>
> On Fri, May 19, 2017 at 3:07 PM, Ulrich Hecht
> <ulrich.hecht+rene...@gmail.com> wrote:
>> Used to differentiate between models with 3 and 6 inputs.
>>
>> Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
>> ---
>>  drivers/media/i2c/adv7180.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c
>> index bdbbf8c..78de7dd 100644
>> --- a/drivers/media/i2c/adv7180.c
>> +++ b/drivers/media/i2c/adv7180.c
>> @@ -1452,6 +1452,8 @@ static SIMPLE_DEV_PM_OPS(adv7180_pm_ops, 
>> adv7180_suspend, adv7180_resume);
>>  #ifdef CONFIG_OF
>>  static const struct of_device_id adv7180_of_id[] = {
>> { .compatible = "adi,adv7180", },
>> +   { .compatible = "adi,adv7180cp", },
>> +   { .compatible = "adi,adv7180st", },
>> { .compatible = "adi,adv7182", },
>> { .compatible = "adi,adv7280", },
>> { .compatible = "adi,adv7280-m", },
>
> Adding compatible entries here is not sufficient, and causes a crash on
> r8a7793/gose with renesas-drivers-2017-06-27-v4.12-rc7:
>
> adv7180 2-0020: chip found @ 0x20 (e653.i2c)
> Unable to handle kernel NULL pointer dereference at virtual address 
> 0014
> pgd = c0003000
> [0014] *pgd=8040004003, *pmd=
> Internal error: Oops: 207 [#1] SMP ARM
> Modules linked in:
> CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.12.0-rc7-rcar2-initrd #37
> Hardware name: Generic R-Car Gen2 (Flattened Device Tree)
> task: df427040 task.stack: df436000
> PC is at adv7180_probe+0x84/0x3cc
>
> In the absence of an entry in adv7180_id[], the passed i2c_device_id
> pointer is NULL, and thus dereferencing it crashes the system.

Thank you for testing this. I have sent a fix (" media: adv7180: add
missing adv7180cp, adv7180st i2c device IDs"), could you please check
if it unbreaks things for you?

CU
Uli


[PATCH] media: adv7180: add missing adv7180cp, adv7180st i2c device IDs

2017-07-03 Thread Ulrich Hecht
Fixes a crash on Renesas R8A7793 Gose board that uses these "compatible"
entries.

Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 drivers/media/i2c/adv7180.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c
index 78de7dd..3df28f2 100644
--- a/drivers/media/i2c/adv7180.c
+++ b/drivers/media/i2c/adv7180.c
@@ -1402,6 +1402,8 @@ static int adv7180_remove(struct i2c_client *client)
 
 static const struct i2c_device_id adv7180_id[] = {
{ "adv7180", (kernel_ulong_t)_info },
+   { "adv7180cp", (kernel_ulong_t)_info },
+   { "adv7180st", (kernel_ulong_t)_info },
{ "adv7182", (kernel_ulong_t)_info },
{ "adv7280", (kernel_ulong_t)_info },
{ "adv7280-m", (kernel_ulong_t)_m_info },
-- 
2.7.4



[PATCH v3 3/4] media: adv7180: Add adv7180cp, adv7180st bindings

2017-05-19 Thread Ulrich Hecht
To differentiate between two classes of chip packages that have
different numbers of input ports.

Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 Documentation/devicetree/bindings/media/i2c/adv7180.txt | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/Documentation/devicetree/bindings/media/i2c/adv7180.txt 
b/Documentation/devicetree/bindings/media/i2c/adv7180.txt
index 4da486f..552b6a8 100644
--- a/Documentation/devicetree/bindings/media/i2c/adv7180.txt
+++ b/Documentation/devicetree/bindings/media/i2c/adv7180.txt
@@ -6,6 +6,8 @@ digital interfaces like MIPI CSI-2 or parallel video.
 Required Properties :
 - compatible : value must be one of
"adi,adv7180"
+   "adi,adv7180cp"
+   "adi,adv7180st"
"adi,adv7182"
"adi,adv7280"
"adi,adv7280-m"
@@ -15,6 +17,19 @@ Required Properties :
"adi,adv7282"
"adi,adv7282-m"
 
+Device nodes of "adi,adv7180cp" and "adi,adv7180st" must contain one
+'port' child node per device input and output port, in accordance with the
+video interface bindings defined in
+Documentation/devicetree/bindings/media/video-interfaces.txt. The port
+nodes are numbered as follows.
+
+  Port adv7180cp   adv7180st
+---
+  Input0-2 0-5
+  Output   3   6
+
+The digital output port node must contain at least one endpoint.
+
 Optional Properties :
 - powerdown-gpios: reference to the GPIO connected to the powerdown pin,
   if any.
-- 
2.7.4



[PATCH v3 1/4] ARM: dts: gose: add HDMI input

2017-05-19 Thread Ulrich Hecht
Identical to the setup on Koelsch.

Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinch...@ideasonboard.com>
---
 arch/arm/boot/dts/r8a7793-gose.dts | 68 --
 1 file changed, 66 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7793-gose.dts 
b/arch/arm/boot/dts/r8a7793-gose.dts
index 95e51b7..30f0835 100644
--- a/arch/arm/boot/dts/r8a7793-gose.dts
+++ b/arch/arm/boot/dts/r8a7793-gose.dts
@@ -253,12 +253,23 @@
};
};
 
+   hdmi-in {
+   compatible = "hdmi-connector";
+   type = "a";
+
+   port {
+   hdmi_con_in: endpoint {
+   remote-endpoint = <_in>;
+   };
+   };
+   };
+
hdmi-out {
compatible = "hdmi-connector";
type = "a";
 
port {
-   hdmi_con: endpoint {
+   hdmi_con_out: endpoint {
remote-endpoint = <_out>;
};
};
@@ -395,6 +406,11 @@
groups = "audio_clk_a";
function = "audio_clk";
};
+
+   vin0_pins: vin0 {
+   groups = "vin0_data24", "vin0_sync", "vin0_clkenb", "vin0_clk";
+   function = "vin0";
+   };
 };
 
  {
@@ -552,7 +568,34 @@
port@1 {
reg = <1>;
adv7511_out: endpoint {
-   remote-endpoint = <_con>;
+   remote-endpoint = <_con_out>;
+   };
+   };
+   };
+   };
+
+   hdmi-in@4c {
+   compatible = "adi,adv7612";
+   reg = <0x4c>;
+   interrupt-parent = <>;
+   interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
+   default-input = <0>;
+
+   port {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port@0 {
+   reg = <0>;
+   adv7612_in: endpoint {
+   remote-endpoint = <_con_in>;
+   };
+   };
+
+   port@2 {
+   reg = <2>;
+   adv7612_out: endpoint {
+   remote-endpoint = <>;
};
};
};
@@ -606,3 +649,24 @@
  {
shared-pin;
 };
+
+/* HDMI video input */
+ {
+   status = "okay";
+   pinctrl-0 = <_pins>;
+   pinctrl-names = "default";
+
+   port {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   vin0ep2: endpoint {
+   remote-endpoint = <_out>;
+   bus-width = <24>;
+   hsync-active = <0>;
+   vsync-active = <0>;
+   pclk-sample = <1>;
+   data-active = <1>;
+   };
+   };
+};
-- 
2.7.4



[PATCH v3 4/4] ARM: dts: gose: add composite video input

2017-05-19 Thread Ulrich Hecht
Adds VIN, decoder and connector.

Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 arch/arm/boot/dts/r8a7793-gose.dts | 59 ++
 1 file changed, 59 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7793-gose.dts 
b/arch/arm/boot/dts/r8a7793-gose.dts
index 30f0835..76e3aca 100644
--- a/arch/arm/boot/dts/r8a7793-gose.dts
+++ b/arch/arm/boot/dts/r8a7793-gose.dts
@@ -275,6 +275,16 @@
};
};
 
+   composite-in {
+   compatible = "composite-video-connector";
+
+   port {
+   composite_con_in: endpoint {
+   remote-endpoint = <_in>;
+   };
+   };
+   };
+
x2_clk: x2-clock {
compatible = "fixed-clock";
#clock-cells = <0>;
@@ -411,6 +421,11 @@
groups = "vin0_data24", "vin0_sync", "vin0_clkenb", "vin0_clk";
function = "vin0";
};
+
+   vin1_pins: vin1 {
+   groups = "vin1_data8", "vin1_clk";
+   function = "vin1";
+   };
 };
 
  {
@@ -542,6 +557,32 @@
reg = <0x12>;
};
 
+   composite-in@20 {
+   compatible = "adi,adv7180cp";
+   reg = <0x20>;
+   remote = <>;
+
+   port {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port@0 {
+   reg = <0>;
+   adv7180_in: endpoint {
+   remote-endpoint = <_con_in>;
+   };
+   };
+
+   port@3 {
+   reg = <3>;
+   adv7180_out: endpoint {
+   bus-width = <8>;
+   remote-endpoint = <>;
+   };
+   };
+   };
+   };
+
hdmi@39 {
compatible = "adi,adv7511w";
reg = <0x39>;
@@ -670,3 +711,21 @@
};
};
 };
+
+/* composite video input */
+ {
+   pinctrl-0 = <_pins>;
+   pinctrl-names = "default";
+
+   status = "okay";
+
+   port {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   vin1ep: endpoint {
+   remote-endpoint = <_out>;
+   bus-width = <8>;
+   };
+   };
+};
-- 
2.7.4



[PATCH v3 2/4] media: adv7180: add adv7180cp, adv7180st compatible strings

2017-05-19 Thread Ulrich Hecht
Used to differentiate between models with 3 and 6 inputs.

Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 drivers/media/i2c/adv7180.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c
index bdbbf8c..78de7dd 100644
--- a/drivers/media/i2c/adv7180.c
+++ b/drivers/media/i2c/adv7180.c
@@ -1452,6 +1452,8 @@ static SIMPLE_DEV_PM_OPS(adv7180_pm_ops, adv7180_suspend, 
adv7180_resume);
 #ifdef CONFIG_OF
 static const struct of_device_id adv7180_of_id[] = {
{ .compatible = "adi,adv7180", },
+   { .compatible = "adi,adv7180cp", },
+   { .compatible = "adi,adv7180st", },
{ .compatible = "adi,adv7182", },
{ .compatible = "adi,adv7280", },
{ .compatible = "adi,adv7280-m", },
-- 
2.7.4



[PATCH v3 0/4] r8a7793 Gose video input support

2017-05-19 Thread Ulrich Hecht
Hi!

This is a by-the-datasheet implementation of analog and digital video input
on the Gose board.

This revision adds new bindings that distinguish between ADV7180 variants
with three and six input ports. There are numerous variants of this chip,
but since all that have "CP" in their names have three inputs, and all that
have "ST" have six, I have limited myself to two new compatible strings,
"adv7180cp" and "adv7180st".

The digital input patch has received minor tweaks of the port names for
consistency, and the Gose analog input patch has been modified to use the
new bindings, and a composite video connector has been added.

CU
Uli


Changes since v2:
- hdmi: port hdmi_con renamed to hdmi_con_out
- adv7180: added new compatibility strings and bindings
- composite: added connector, use new bindings

Changes since v1:
- r8a7793.dtsi: added VIN2
- modeled HDMI decoder input/output and connector
- added "renesas,rcar-gen2-vin" compat strings
- removed unnecessary "remote" node and aliases
- set ADV7612 interrupt to GP4_2


Ulrich Hecht (4):
  ARM: dts: gose: add HDMI input
  media: adv7180: add adv7180cp, adv7180st compatible strings
  media: adv7180: Add adv7180cp, adv7180st bindings
  ARM: dts: gose: add composite video input

 .../devicetree/bindings/media/i2c/adv7180.txt  |  15 +++
 arch/arm/boot/dts/r8a7793-gose.dts | 127 -
 drivers/media/i2c/adv7180.c|   2 +
 3 files changed, 142 insertions(+), 2 deletions(-)

-- 
2.7.4



[PATCH v1.5 2/6] v4l: rcar-fcp: Add an API to retrieve the FCP device

2016-12-09 Thread Ulrich Hecht
From: Laurent Pinchart 

The new rcar_fcp_get_device() function retrieves the struct device
related to the FCP device. This is useful to handle DMA mapping through
the right device.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/rcar-fcp.c | 6 ++
 include/media/rcar-fcp.h  | 5 +
 2 files changed, 11 insertions(+)

diff --git a/drivers/media/platform/rcar-fcp.c 
b/drivers/media/platform/rcar-fcp.c
index e9f609e..2988031 100644
--- a/drivers/media/platform/rcar-fcp.c
+++ b/drivers/media/platform/rcar-fcp.c
@@ -78,6 +78,12 @@ void rcar_fcp_put(struct rcar_fcp_device *fcp)
 }
 EXPORT_SYMBOL_GPL(rcar_fcp_put);
 
+struct device *rcar_fcp_get_device(struct rcar_fcp_device *fcp)
+{
+   return fcp->dev;
+}
+EXPORT_SYMBOL_GPL(rcar_fcp_get_device);
+
 /**
  * rcar_fcp_enable - Enable an FCP
  * @fcp: The FCP instance
diff --git a/include/media/rcar-fcp.h b/include/media/rcar-fcp.h
index 8723f05..b60a7b1 100644
--- a/include/media/rcar-fcp.h
+++ b/include/media/rcar-fcp.h
@@ -19,6 +19,7 @@ struct rcar_fcp_device;
 #if IS_ENABLED(CONFIG_VIDEO_RENESAS_FCP)
 struct rcar_fcp_device *rcar_fcp_get(const struct device_node *np);
 void rcar_fcp_put(struct rcar_fcp_device *fcp);
+struct device *rcar_fcp_get_device(struct rcar_fcp_device *fcp);
 int rcar_fcp_enable(struct rcar_fcp_device *fcp);
 void rcar_fcp_disable(struct rcar_fcp_device *fcp);
 #else
@@ -27,6 +28,10 @@ static inline struct rcar_fcp_device *rcar_fcp_get(const 
struct device_node *np)
return ERR_PTR(-ENOENT);
 }
 static inline void rcar_fcp_put(struct rcar_fcp_device *fcp) { }
+static inline struct device *rcar_fcp_get_device(struct rcar_fcp_device *fcp)
+{
+   return NULL;
+}
 static inline int rcar_fcp_enable(struct rcar_fcp_device *fcp)
 {
return 0;
-- 
2.7.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 v1.5 0/6] R-Car DU: Fix IOMMU operation when connected to VSP

2016-12-09 Thread Ulrich Hecht
Hi!

This is a slightly updated version of Laurent's series that adds the fix
suggested by Magnus Damm and connects the FCP devices on M3-W to their
IPMMU. It also drops the patches that have already been picked up in the
media tree.

With this series and an assortment of patches from the renesas-drivers tree (
iommu/ipmmu-vmsa: Remove platform data handling
iommu/ipmmu-vmsa: Rework interrupt code and use bitmap for context
iommu/ipmmu-vmsa: Break out utlb parsing code
iommu/ipmmu-vmsa: Break out domain allocation code
iommu/ipmmu-vmsa: Add new IOMMU_DOMAIN_DMA ops
iommu/ipmmu-vmsa: ARM and ARM64 archdata access
iommu/ipmmu-vmsa: Drop LPAE Kconfig dependency
iommu/ipmmu-vmsa: Introduce features, break out alias
iommu/ipmmu-vmsa: Add optional root device feature
iommu/ipmmu-vmsa: Enable multi context support
iommu/ipmmu-vmsa: Reuse iommu groups
iommu/ipmmu-vmsa: Make use of IOMMU_OF_DECLARE()
iommu/ipmmu-vmsa: Teach xlate() to skip disabled iommus
iommu/ipmmu-vmsa: IPMMU device is 64-bit bus master
iommu/ipmmu-vmsa: Write IMCTR twice
iommu/ipmmu-vmsa: Make IMBUSCTR setup optional
iommu/ipmmu-vmsa: Allow two bit SL0
iommu/ipmmu-vmsa: Hook up r8a7795 DT matching code
iommu/ipmmu-vmsa: Add r8a7796 DT binding
iommu/ipmmu-vmsa: Increase maximum micro-TLBS to 48
iommu/ipmmu-vmsa: Hook up r8a7796 DT matching code
arm64: dts: r8a7795: Add IPMMU device nodes
arm64: dts: r8a7795: Hook up SYS-DMAC to IPMMU
arm64: dts: r8a7795: Point FCP devices to IPMMU
arm64: dts: r8a7795: Connect Ethernet AVB to IPMMU
arm64: dts: r8a7796: Add IPMMU device nodes
clk: renesas: r8a7796: Add FCP clocks
clk: renesas: r8a7796: Add VSP clocks
clk: renesas: r8a7796: Add DU and LVDS clocks
drm: rcar-du: Add R8A7796 device support
arm64: dts: renesas: r8a7795: Remove FCP SoC-specific compatible strings
arm64: dts: renesas: r8a7796: Add FCPF and FCPV instances
arm64: dts: renesas: r8a7796: Add VSP instances
arm64: dts: renesas: r8a7796: Add DU device to DT
arm64: dts: renesas: r8a7796-salvator-x: Enable DU
), I can enable IPMMU on both the H3 and M3-W Salvator-X boards with no ill
effects on the results of the vsp-tests suite.

CU
Uli


Laurent Pinchart (4):
  v4l: rcar-fcp: Don't get/put module reference
  v4l: rcar-fcp: Add an API to retrieve the FCP device
  v4l: vsp1: Add API to map and unmap DRM buffers through the VSP
  drm: rcar-du: Map memory through the VSP device

Ulrich Hecht (2):
  v4l: vsp1: Provide display list and VB2 queue with FCP device
  arm64: dts: r8a7796: Connect FCP devices to IPMMU

 arch/arm64/boot/dts/renesas/r8a7796.dtsi |  3 ++
 drivers/gpu/drm/rcar-du/rcar_du_vsp.c| 74 +---
 drivers/gpu/drm/rcar-du/rcar_du_vsp.h|  2 +
 drivers/media/platform/rcar-fcp.c| 17 
 drivers/media/platform/vsp1/vsp1_dl.c| 12 --
 drivers/media/platform/vsp1/vsp1_drm.c   | 24 +++
 drivers/media/platform/vsp1/vsp1_video.c |  6 ++-
 include/media/rcar-fcp.h |  5 +++
 include/media/vsp1.h |  3 ++
 9 files changed, 127 insertions(+), 19 deletions(-)

-- 
2.7.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 v1.5 6/6] arm64: dts: r8a7796: Connect FCP devices to IPMMU

2016-12-09 Thread Ulrich Hecht
Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 arch/arm64/boot/dts/renesas/r8a7796.dtsi | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7796.dtsi 
b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
index 52e81bb..f5496d4 100644
--- a/arch/arm64/boot/dts/renesas/r8a7796.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
@@ -440,6 +440,7 @@
reg = <0 0xfea27000 0 0x200>;
clocks = < CPG_MOD 603>;
power-domains = < R8A7796_PD_ALWAYS_ON>;
+   iommus = <_vi 8>;
};
 
vspd1: vsp@fea28000 {
@@ -457,6 +458,7 @@
reg = <0 0xfea2f000 0 0x200>;
clocks = < CPG_MOD 602>;
power-domains = < R8A7796_PD_ALWAYS_ON>;
+   iommus = <_vi 9>;
};
 
vspd2: vsp@fea3 {
@@ -474,6 +476,7 @@
reg = <0 0xfea37000 0 0x200>;
clocks = < CPG_MOD 601>;
power-domains = < R8A7796_PD_ALWAYS_ON>;
+   iommus = <_vi 10>;
};
 
du: display@feb0 {
-- 
2.7.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 v1.5 1/6] v4l: rcar-fcp: Don't get/put module reference

2016-12-09 Thread Ulrich Hecht
From: Laurent Pinchart 

Direct callers of the FCP API hold a reference to the FCP module due to
module linkage, there's no need to take another one manually. Take a
reference to the device instead to ensure that it won't disappear behind
the caller's back.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/rcar-fcp.c | 11 ++-
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/media/platform/rcar-fcp.c 
b/drivers/media/platform/rcar-fcp.c
index 7146fc5..e9f609e 100644
--- a/drivers/media/platform/rcar-fcp.c
+++ b/drivers/media/platform/rcar-fcp.c
@@ -53,14 +53,7 @@ struct rcar_fcp_device *rcar_fcp_get(const struct 
device_node *np)
if (fcp->dev->of_node != np)
continue;
 
-   /*
-* Make sure the module won't be unloaded behind our back. This
-* is a poor man's safety net, the module should really not be
-* unloaded while FCP users can be active.
-*/
-   if (!try_module_get(fcp->dev->driver->owner))
-   fcp = NULL;
-
+   get_device(fcp->dev);
goto done;
}
 
@@ -81,7 +74,7 @@ EXPORT_SYMBOL_GPL(rcar_fcp_get);
 void rcar_fcp_put(struct rcar_fcp_device *fcp)
 {
if (fcp)
-   module_put(fcp->dev->driver->owner);
+   put_device(fcp->dev);
 }
 EXPORT_SYMBOL_GPL(rcar_fcp_put);
 
-- 
2.7.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 v1.5 3/6] v4l: vsp1: Add API to map and unmap DRM buffers through the VSP

2016-12-09 Thread Ulrich Hecht
From: Laurent Pinchart 

The display buffers must be mapped for DMA through the device that
performs memory access. Expose an API to map and unmap memory through
the VSP device to be used by the DU.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/vsp1/vsp1_drm.c | 24 
 include/media/vsp1.h   |  3 +++
 2 files changed, 27 insertions(+)

diff --git a/drivers/media/platform/vsp1/vsp1_drm.c 
b/drivers/media/platform/vsp1/vsp1_drm.c
index cd209dc..bb35603 100644
--- a/drivers/media/platform/vsp1/vsp1_drm.c
+++ b/drivers/media/platform/vsp1/vsp1_drm.c
@@ -12,9 +12,11 @@
  */
 
 #include 
+#include 
 #include 
 
 #include 
+#include 
 #include 
 #include 
 
@@ -519,6 +521,28 @@ void vsp1_du_atomic_flush(struct device *dev)
 }
 EXPORT_SYMBOL_GPL(vsp1_du_atomic_flush);
 
+int vsp1_du_map_sg(struct device *dev, struct sg_table *sgt)
+{
+   struct vsp1_device *vsp1 = dev_get_drvdata(dev);
+   struct device *map_dev;
+
+   map_dev = vsp1->fcp ? rcar_fcp_get_device(vsp1->fcp) : dev;
+
+   return dma_map_sg(map_dev, sgt->sgl, sgt->nents, DMA_TO_DEVICE);
+}
+EXPORT_SYMBOL_GPL(vsp1_du_map_sg);
+
+void vsp1_du_unmap_sg(struct device *dev, struct sg_table *sgt)
+{
+   struct vsp1_device *vsp1 = dev_get_drvdata(dev);
+   struct device *map_dev;
+
+   map_dev = vsp1->fcp ? rcar_fcp_get_device(vsp1->fcp) : dev;
+
+   dma_unmap_sg(map_dev, sgt->sgl, sgt->nents, DMA_TO_DEVICE);
+}
+EXPORT_SYMBOL_GPL(vsp1_du_unmap_sg);
+
 /* 
-
  * Initialization
  */
diff --git a/include/media/vsp1.h b/include/media/vsp1.h
index 458b400..8d3d07a 100644
--- a/include/media/vsp1.h
+++ b/include/media/vsp1.h
@@ -13,6 +13,7 @@
 #ifndef __MEDIA_VSP1_H__
 #define __MEDIA_VSP1_H__
 
+#include 
 #include 
 #include 
 
@@ -37,5 +38,7 @@ void vsp1_du_atomic_begin(struct device *dev);
 int vsp1_du_atomic_update(struct device *dev, unsigned int rpf,
  const struct vsp1_du_atomic_config *cfg);
 void vsp1_du_atomic_flush(struct device *dev);
+int vsp1_du_map_sg(struct device *dev, struct sg_table *sgt);
+void vsp1_du_unmap_sg(struct device *dev, struct sg_table *sgt);
 
 #endif /* __MEDIA_VSP1_H__ */
-- 
2.7.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 v1.5 5/6] v4l: vsp1: Provide display list and VB2 queue with FCP device

2016-12-09 Thread Ulrich Hecht
Prevents IPMMU trap during boot on r8a7795/6 Salvator-X boards:
ipmmu-vmsa febd.mmu: Unhandled faut: status 0x0101 iova 0x7f09a000

Code by Magnus Damm.

Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 drivers/media/platform/vsp1/vsp1_dl.c| 12 +---
 drivers/media/platform/vsp1/vsp1_video.c |  6 +-
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_dl.c 
b/drivers/media/platform/vsp1/vsp1_dl.c
index ad545af..f610c88 100644
--- a/drivers/media/platform/vsp1/vsp1_dl.c
+++ b/drivers/media/platform/vsp1/vsp1_dl.c
@@ -17,6 +17,8 @@
 #include 
 #include 
 
+#include 
+
 #include "vsp1.h"
 #include "vsp1_dl.h"
 
@@ -133,12 +135,13 @@ static int vsp1_dl_body_init(struct vsp1_device *vsp1,
 size_t extra_size)
 {
size_t size = num_entries * sizeof(*dlb->entries) + extra_size;
+   struct device *fcp = rcar_fcp_get_device(vsp1->fcp);
 
dlb->vsp1 = vsp1;
dlb->size = size;
 
-   dlb->entries = dma_alloc_wc(vsp1->dev, dlb->size, >dma,
-   GFP_KERNEL);
+   dlb->entries = dma_alloc_wc(fcp ? fcp : vsp1->dev,
+   dlb->size, >dma, GFP_KERNEL);
if (!dlb->entries)
return -ENOMEM;
 
@@ -150,7 +153,10 @@ static int vsp1_dl_body_init(struct vsp1_device *vsp1,
  */
 static void vsp1_dl_body_cleanup(struct vsp1_dl_body *dlb)
 {
-   dma_free_wc(dlb->vsp1->dev, dlb->size, dlb->entries, dlb->dma);
+   struct device *fcp = rcar_fcp_get_device(dlb->vsp1->fcp);
+
+   dma_free_wc(fcp ? fcp : dlb->vsp1->dev,
+   dlb->size, dlb->entries, dlb->dma);
 }
 
 /**
diff --git a/drivers/media/platform/vsp1/vsp1_video.c 
b/drivers/media/platform/vsp1/vsp1_video.c
index 41e8b09..8f8e57e 100644
--- a/drivers/media/platform/vsp1/vsp1_video.c
+++ b/drivers/media/platform/vsp1/vsp1_video.c
@@ -27,6 +27,8 @@
 #include 
 #include 
 
+#include 
+
 #include "vsp1.h"
 #include "vsp1_bru.h"
 #include "vsp1_dl.h"
@@ -1094,6 +1096,7 @@ struct vsp1_video *vsp1_video_create(struct vsp1_device 
*vsp1,
 {
struct vsp1_video *video;
const char *direction;
+   struct device *fcp;
int ret;
 
video = devm_kzalloc(vsp1->dev, sizeof(*video), GFP_KERNEL);
@@ -1151,7 +1154,8 @@ struct vsp1_video *vsp1_video_create(struct vsp1_device 
*vsp1,
video->queue.ops = _video_queue_qops;
video->queue.mem_ops = _dma_contig_memops;
video->queue.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
-   video->queue.dev = video->vsp1->dev;
+   fcp = rcar_fcp_get_device(vsp1->fcp);
+   video->queue.dev = fcp ? fcp : video->vsp1->dev;
ret = vb2_queue_init(>queue);
if (ret < 0) {
dev_err(video->vsp1->dev, "failed to initialize vb2 queue\n");
-- 
2.7.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 v1.5 4/6] drm: rcar-du: Map memory through the VSP device

2016-12-09 Thread Ulrich Hecht
From: Laurent Pinchart 

For planes handled by a VSP instance, map the framebuffer memory through
the VSP to ensure proper IOMMU handling.

Signed-off-by: Laurent Pinchart 
---
 drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 74 ---
 drivers/gpu/drm/rcar-du/rcar_du_vsp.h |  2 +
 2 files changed, 70 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c 
b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
index 83ebd16..851c2e7 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
@@ -19,7 +19,9 @@
 #include 
 #include 
 
+#include 
 #include 
+#include 
 #include 
 
 #include 
@@ -166,12 +168,9 @@ static void rcar_du_vsp_plane_setup(struct 
rcar_du_vsp_plane *plane)
cfg.dst.width = state->state.crtc_w;
cfg.dst.height = state->state.crtc_h;
 
-   for (i = 0; i < state->format->planes; ++i) {
-   struct drm_gem_cma_object *gem;
-
-   gem = drm_fb_cma_get_gem_obj(fb, i);
-   cfg.mem[i] = gem->paddr + fb->offsets[i];
-   }
+   for (i = 0; i < state->format->planes; ++i)
+   cfg.mem[i] = sg_dma_address(state->sg_tables[i].sgl)
+  + fb->offsets[i];
 
for (i = 0; i < ARRAY_SIZE(formats_kms); ++i) {
if (formats_kms[i] == state->format->fourcc) {
@@ -183,6 +182,67 @@ static void rcar_du_vsp_plane_setup(struct 
rcar_du_vsp_plane *plane)
vsp1_du_atomic_update(plane->vsp->vsp, plane->index, );
 }
 
+static int rcar_du_vsp_plane_prepare_fb(struct drm_plane *plane,
+   struct drm_plane_state *state)
+{
+   struct rcar_du_vsp_plane_state *rstate = to_rcar_vsp_plane_state(state);
+   struct rcar_du_vsp *vsp = to_rcar_vsp_plane(plane)->vsp;
+   struct rcar_du_device *rcdu = vsp->dev;
+   unsigned int i;
+   int ret;
+
+   if (!state->fb)
+   return 0;
+
+   for (i = 0; i < rstate->format->planes; ++i) {
+   struct drm_gem_cma_object *gem =
+   drm_fb_cma_get_gem_obj(state->fb, i);
+   struct sg_table *sgt = >sg_tables[i];
+
+   ret = dma_get_sgtable(rcdu->dev, sgt, gem->vaddr, gem->paddr,
+ gem->base.size);
+   if (ret)
+   goto fail;
+
+   ret = vsp1_du_map_sg(vsp->vsp, sgt);
+   if (!ret) {
+   sg_free_table(sgt);
+   ret = -ENOMEM;
+   goto fail;
+   }
+   }
+
+   return 0;
+
+fail:
+   for (i--; i >= 0; i--) {
+   struct sg_table *sgt = >sg_tables[i];
+
+   vsp1_du_unmap_sg(vsp->vsp, sgt);
+   sg_free_table(sgt);
+   }
+
+   return ret;
+}
+
+static void rcar_du_vsp_plane_cleanup_fb(struct drm_plane *plane,
+struct drm_plane_state *state)
+{
+   struct rcar_du_vsp_plane_state *rstate = to_rcar_vsp_plane_state(state);
+   struct rcar_du_vsp *vsp = to_rcar_vsp_plane(plane)->vsp;
+   unsigned int i;
+
+   if (!state->fb)
+   return;
+
+   for (i = 0; i < rstate->format->planes; ++i) {
+   struct sg_table *sgt = >sg_tables[i];
+
+   vsp1_du_unmap_sg(vsp->vsp, sgt);
+   sg_free_table(sgt);
+   }
+}
+
 static int rcar_du_vsp_plane_atomic_check(struct drm_plane *plane,
  struct drm_plane_state *state)
 {
@@ -223,6 +283,8 @@ static void rcar_du_vsp_plane_atomic_update(struct 
drm_plane *plane,
 }
 
 static const struct drm_plane_helper_funcs rcar_du_vsp_plane_helper_funcs = {
+   .prepare_fb = rcar_du_vsp_plane_prepare_fb,
+   .cleanup_fb = rcar_du_vsp_plane_cleanup_fb,
.atomic_check = rcar_du_vsp_plane_atomic_check,
.atomic_update = rcar_du_vsp_plane_atomic_update,
 };
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.h 
b/drivers/gpu/drm/rcar-du/rcar_du_vsp.h
index 510dcc9..bbb4161 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.h
+++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.h
@@ -43,6 +43,7 @@ static inline struct rcar_du_vsp_plane 
*to_rcar_vsp_plane(struct drm_plane *p)
  * struct rcar_du_vsp_plane_state - Driver-specific plane state
  * @state: base DRM plane state
  * @format: information about the pixel format used by the plane
+ * @sg_tables: scatter-gather tables for the frame buffer memory
  * @alpha: value of the plane alpha property
  * @zpos: value of the plane zpos property
  */
@@ -50,6 +51,7 @@ struct rcar_du_vsp_plane_state {
struct drm_plane_state state;
 
const struct rcar_du_format_info *format;
+   struct sg_table sg_tables[3];
 
unsigned int alpha;
unsigned int zpos;
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the 

[PATCH v2 0/3] r8a7793 Gose video input support

2016-10-18 Thread Ulrich Hecht
Hi!

This is a by-the-datasheet implementation of analog and digital video input
on the Gose board.

I have tried to address all concerns raised by reviewers, with the exception
of the composite input patch, which has been left as is for now.

CU
Uli


Changes since v1:
- r8a7793.dtsi: added VIN2
- modeled HDMI decoder input/output and connector
- added "renesas,rcar-gen2-vin" compat strings
- removed unnecessary "remote" node and aliases
- set ADV7612 interrupt to GP4_2


Ulrich Hecht (3):
  ARM: dts: r8a7793: Enable VIN0-VIN2
  ARM: dts: gose: add HDMI input
  ARM: dts: gose: add composite video input

 arch/arm/boot/dts/r8a7793-gose.dts | 100 +
 arch/arm/boot/dts/r8a7793.dtsi |  27 ++
 2 files changed, 127 insertions(+)

-- 
2.7.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 2/3] ARM: dts: gose: add HDMI input

2016-10-18 Thread Ulrich Hecht
Identical to the setup on Lager.

Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 arch/arm/boot/dts/r8a7793-gose.dts | 64 ++
 1 file changed, 64 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7793-gose.dts 
b/arch/arm/boot/dts/r8a7793-gose.dts
index dc311eb..a47ea4b 100644
--- a/arch/arm/boot/dts/r8a7793-gose.dts
+++ b/arch/arm/boot/dts/r8a7793-gose.dts
@@ -253,6 +253,17 @@
};
};
 
+   hdmi-in {
+   compatible = "hdmi-connector";
+   type = "a";
+
+   port {
+   hdmi_con_in: endpoint {
+   remote-endpoint = <_in>;
+   };
+   };
+   };
+
hdmi-out {
compatible = "hdmi-connector";
type = "a";
@@ -374,6 +385,11 @@
groups = "audio_clk_a";
function = "audio_clk";
};
+
+   vin0_pins: vin0 {
+   groups = "vin0_data24", "vin0_sync", "vin0_clkenb", "vin0_clk";
+   function = "vin0";
+   };
 };
 
  {
@@ -531,6 +547,33 @@
};
};
 
+   hdmi-in@4c {
+   compatible = "adi,adv7612";
+   reg = <0x4c>;
+   interrupt-parent = <>;
+   interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
+   default-input = <0>;
+
+   port {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port@0 {
+   reg = <0>;
+   adv7612_in: endpoint {
+   remote-endpoint = <_con_in>;
+   };
+   };
+
+   port@2 {
+   reg = <2>;
+   adv7612_out: endpoint {
+   remote-endpoint = <>;
+   };
+   };
+   };
+   };
+
eeprom@50 {
compatible = "renesas,r1ex24002", "atmel,24c02";
reg = <0x50>;
@@ -558,3 +601,24 @@
  {
shared-pin;
 };
+
+/* HDMI video input */
+ {
+   status = "okay";
+   pinctrl-0 = <_pins>;
+   pinctrl-names = "default";
+
+   port {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   vin0ep2: endpoint {
+   remote-endpoint = <_out>;
+   bus-width = <24>;
+   hsync-active = <0>;
+   vsync-active = <0>;
+   pclk-sample = <1>;
+   data-active = <1>;
+   };
+   };
+};
-- 
2.7.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] ARM: dts: r8a7793: Enable VIN0-VIN2

2016-10-18 Thread Ulrich Hecht
Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 arch/arm/boot/dts/r8a7793.dtsi | 27 +++
 1 file changed, 27 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7793.dtsi b/arch/arm/boot/dts/r8a7793.dtsi
index a7d11b9..629d3d6 100644
--- a/arch/arm/boot/dts/r8a7793.dtsi
+++ b/arch/arm/boot/dts/r8a7793.dtsi
@@ -852,6 +852,33 @@
status = "disabled";
};
 
+   vin0: video@e6ef {
+   compatible = "renesas,vin-r8a7793", "renesas,rcar-gen2-vin";
+   reg = <0 0xe6ef 0 0x1000>;
+   interrupts = ;
+   clocks = <_clks R8A7793_CLK_VIN0>;
+   power-domains = < R8A7793_PD_ALWAYS_ON>;
+   status = "disabled";
+   };
+
+   vin1: video@e6ef1000 {
+   compatible = "renesas,vin-r8a7793", "renesas,rcar-gen2-vin";
+   reg = <0 0xe6ef1000 0 0x1000>;
+   interrupts = ;
+   clocks = <_clks R8A7793_CLK_VIN1>;
+   power-domains = < R8A7793_PD_ALWAYS_ON>;
+   status = "disabled";
+   };
+
+   vin2: video@e6ef2000 {
+   compatible = "renesas,vin-r8a7793", "renesas,rcar-gen2-vin";
+   reg = <0 0xe6ef2000 0 0x1000>;
+   interrupts = ;
+   clocks = <_clks R8A7793_CLK_VIN2>;
+   power-domains = < R8A7793_PD_ALWAYS_ON>;
+   status = "disabled";
+   };
+
qspi: spi@e6b1 {
compatible = "renesas,qspi-r8a7793", "renesas,qspi";
reg = <0 0xe6b1 0 0x2c>;
-- 
2.7.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] ARM: dts: gose: add composite video input

2016-10-18 Thread Ulrich Hecht
Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 arch/arm/boot/dts/r8a7793-gose.dts | 36 
 1 file changed, 36 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7793-gose.dts 
b/arch/arm/boot/dts/r8a7793-gose.dts
index a47ea4b..2606021 100644
--- a/arch/arm/boot/dts/r8a7793-gose.dts
+++ b/arch/arm/boot/dts/r8a7793-gose.dts
@@ -390,6 +390,11 @@
groups = "vin0_data24", "vin0_sync", "vin0_clkenb", "vin0_clk";
function = "vin0";
};
+
+   vin1_pins: vin1 {
+   groups = "vin1_data8", "vin1_clk";
+   function = "vin1";
+   };
 };
 
  {
@@ -515,6 +520,19 @@
reg = <0x12>;
};
 
+   composite-in@20 {
+   compatible = "adi,adv7180";
+   reg = <0x20>;
+   remote = <>;
+
+   port {
+   adv7180: endpoint {
+   bus-width = <8>;
+   remote-endpoint = <>;
+   };
+   };
+   };
+
hdmi@39 {
compatible = "adi,adv7511w";
reg = <0x39>;
@@ -622,3 +640,21 @@
};
};
 };
+
+/* composite video input */
+ {
+   pinctrl-0 = <_pins>;
+   pinctrl-names = "default";
+
+   status = "okay";
+
+   port {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   vin1ep: endpoint {
+   remote-endpoint = <>;
+   bus-width = <8>;
+   };
+   };
+};
-- 
2.7.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 0/2] Renesas Lager/Koelsch HDMI input

2016-10-18 Thread Ulrich Hecht
Hi!

This series enables HDMI input on the Lager and Koelsch boards.
It sits on renesas-next-20161017-v4.9-rc1.

I have tried to address all concerns raised by reviewers (correctly, I hope),
see below for details.

CU
Uli


Changes since v1:
- modeled decoder inputs/outputs and connectors
- removed unnecessary "remote" nodes
- r8a7790-lager.dts: "ok" -> "okay"
- r8a7791-koelsch.dts: set ADV7612 interrupt to GP4_2


Hans Verkuil (1):
  ARM: dts: koelsch: add HDMI input

William Towle (1):
  ARM: dts: lager: Add entries for VIN HDMI input support

 arch/arm/boot/dts/r8a7790-lager.dts   | 66 --
 arch/arm/boot/dts/r8a7791-koelsch.dts | 68 +--
 2 files changed, 130 insertions(+), 4 deletions(-)

-- 
2.7.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/2] ARM: dts: lager: Add entries for VIN HDMI input support

2016-10-18 Thread Ulrich Hecht
From: William Towle <william.to...@codethink.co.uk>

Add DT entries for vin0, vin0_pins, and adv7612.

Sets the 'default-input' property for ADV7612, enabling image and video
capture without the need to have userspace specifying routing.

Signed-off-by: William Towle <william.to...@codethink.co.uk>
Signed-off-by: Rob Taylor <rob.tay...@codethink.co.uk>
[uli: added interrupt, renamed endpoint, merged default-input]
Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 arch/arm/boot/dts/r8a7790-lager.dts | 66 +++--
 1 file changed, 64 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7790-lager.dts 
b/arch/arm/boot/dts/r8a7790-lager.dts
index 52b56fc..4342682 100644
--- a/arch/arm/boot/dts/r8a7790-lager.dts
+++ b/arch/arm/boot/dts/r8a7790-lager.dts
@@ -231,12 +231,23 @@
};
};
 
+   hdmi-in {
+   compatible = "hdmi-connector";
+   type = "a";
+
+   port {
+   hdmi_con_in: endpoint {
+   remote-endpoint = <_in>;
+   };
+   };
+   };
+
hdmi-out {
compatible = "hdmi-connector";
type = "a";
 
port {
-   hdmi_con: endpoint {
+   hdmi_con_out: endpoint {
remote-endpoint = <_out>;
};
};
@@ -427,6 +438,11 @@
function = "usb2";
};
 
+   vin0_pins: vin0 {
+   groups = "vin0_data24", "vin0_sync", "vin0_clkenb", "vin0_clk";
+   function = "vin0";
+   };
+
vin1_pins: vin1 {
groups = "vin1_data8", "vin1_clk";
function = "vin1";
@@ -646,7 +662,34 @@
port@1 {
reg = <1>;
adv7511_out: endpoint {
-   remote-endpoint = <_con>;
+   remote-endpoint = <_con_out>;
+   };
+   };
+   };
+   };
+
+   hdmi-in@4c {
+   compatible = "adi,adv7612";
+   reg = <0x4c>;
+   interrupt-parent = <>;
+   interrupts = <20 IRQ_TYPE_LEVEL_LOW>;
+   default-input = <0>;
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port@0 {
+   reg = <0>;
+   adv7612_in: endpoint {
+   remote-endpoint = <_con_in>;
+   };
+   };
+
+   port@2 {
+   reg = <2>;
+   adv7612_out: endpoint {
+   remote-endpoint = <>;
};
};
};
@@ -722,6 +765,25 @@
status = "okay";
 };
 
+/* HDMI video input */
+ {
+   pinctrl-0 = <_pins>;
+   pinctrl-names = "default";
+
+   status = "okay";
+
+   port {
+   vin0ep2: endpoint {
+   remote-endpoint = <_out>;
+   bus-width = <24>;
+   hsync-active = <0>;
+   vsync-active = <0>;
+   pclk-sample = <1>;
+   data-active = <1>;
+   };
+   };
+};
+
 /* composite video input */
  {
pinctrl-0 = <_pins>;
-- 
2.7.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 2/2] ARM: dts: koelsch: add HDMI input

2016-10-18 Thread Ulrich Hecht
From: Hans Verkuil <hverk...@xs4all.nl>

Add support in the dts for the HDMI input. Based on the Lager dts
patch from Ultich Hecht.

Signed-off-by: Hans Verkuil <hans.verk...@cisco.com>
[uli: removed "renesas," prefixes from pfc nodes]
Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 arch/arm/boot/dts/r8a7791-koelsch.dts | 68 +--
 1 file changed, 66 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7791-koelsch.dts 
b/arch/arm/boot/dts/r8a7791-koelsch.dts
index f17bfa0..c457b43 100644
--- a/arch/arm/boot/dts/r8a7791-koelsch.dts
+++ b/arch/arm/boot/dts/r8a7791-koelsch.dts
@@ -265,12 +265,23 @@
};
};
 
+   hdmi-in {
+   compatible = "hdmi-connector";
+   type = "a";
+
+   port {
+   hdmi_con_in: endpoint {
+   remote-endpoint = <_in>;
+   };
+   };
+   };
+
hdmi-out {
compatible = "hdmi-connector";
type = "a";
 
port {
-   hdmi_con: endpoint {
+   hdmi_con_out: endpoint {
remote-endpoint = <_out>;
};
};
@@ -414,6 +425,11 @@
function = "usb1";
};
 
+   vin0_pins: vin0 {
+   groups = "vin0_data24", "vin0_sync", "vin0_clkenb", "vin0_clk";
+   function = "vin0";
+   };
+
vin1_pins: vin1 {
groups = "vin1_data8", "vin1_clk";
function = "vin1";
@@ -617,7 +633,34 @@
port@1 {
reg = <1>;
adv7511_out: endpoint {
-   remote-endpoint = <_con>;
+   remote-endpoint = <_con_out>;
+   };
+   };
+   };
+   };
+
+   hdmi-in@4c {
+   compatible = "adi,adv7612";
+   reg = <0x4c>;
+   interrupt-parent = <>;
+   interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
+   default-input = <0>;
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port@0 {
+   reg = <0>;
+   adv7612_in: endpoint {
+   remote-endpoint = <_con_in>;
+   };
+   };
+
+   port@2 {
+   reg = <2>;
+   adv7612_out: endpoint {
+   remote-endpoint = <>;
};
};
};
@@ -699,6 +742,27 @@
cpu0-supply = <_dvfs>;
 };
 
+/* HDMI video input */
+ {
+   status = "okay";
+   pinctrl-0 = <_pins>;
+   pinctrl-names = "default";
+
+   port {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   vin0ep2: endpoint {
+   remote-endpoint = <_out>;
+   bus-width = <24>;
+   hsync-active = <0>;
+   vsync-active = <0>;
+   pclk-sample = <1>;
+   data-active = <1>;
+   };
+   };
+};
+
 /* composite video input */
  {
status = "okay";
-- 
2.7.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 2/2] media: adv7604: automatic "default-input" selection

2016-09-22 Thread Ulrich Hecht
Documentation states that the "default-input" property should reside
directly in the node of the device.  This adjusts the parsing to make the
implementation consistent with the documentation.

Based on patch by William Towle <william.to...@codethink.co.uk>.

Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
Signed-off-by: Hans Verkuil <hans.verk...@cisco.com>
---
 drivers/media/i2c/adv7604.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 4003831..fa7046e 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -3074,13 +3074,13 @@ static int adv76xx_parse_dt(struct adv76xx_state *state)
return ret;
}
 
-   if (!of_property_read_u32(endpoint, "default-input", ))
+   of_node_put(endpoint);
+
+   if (!of_property_read_u32(np, "default-input", ))
state->pdata.default_input = v;
else
state->pdata.default_input = -1;
 
-   of_node_put(endpoint);
-
flags = bus_cfg.bus.parallel.flags;
 
if (flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH)
-- 
2.7.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 0/2] media: adv7604: fix default-input property inconsistencies

2016-09-22 Thread Ulrich Hecht
Hi!

This is a fix for the inconsistency in the adv7604 bindings regarding the
default-input property, clarifying that it should be a property of the
device, not the endpoint, and a patch to implement it.

This revision implements Laurent's suggestions:

- The default input should not be set if the default-input property is missing.
- The old code for parsing the property in the endpoint node can be removed.
- The rationale for the change should go in the commit message.

CU
Uli


Ulrich Hecht (2):
  media: adv7604: fix bindings inconsistency for default-input
  media: adv7604: automatic "default-input" selection

 Documentation/devicetree/bindings/media/i2c/adv7604.txt | 3 +--
 drivers/media/i2c/adv7604.c | 6 +++---
 2 files changed, 4 insertions(+), 5 deletions(-)

-- 
2.7.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/2] media: adv7604: fix bindings inconsistency for default-input

2016-09-22 Thread Ulrich Hecht
The text states that default-input is an endpoint property, but in the
example it is a device property.

The default input is a property of the chip, not of a particular port, so
the example makes more sense.

Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinch...@ideasonboard.com>
---
 Documentation/devicetree/bindings/media/i2c/adv7604.txt | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt 
b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
index 8337f75..9cbd92e 100644
--- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
+++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
@@ -34,6 +34,7 @@ The digital output port node must contain at least one 
endpoint.
 Optional Properties:
 
   - reset-gpios: Reference to the GPIO connected to the device's reset pin.
+  - default-input: Select which input is selected after reset.
 
 Optional Endpoint Properties:
 
@@ -47,8 +48,6 @@ Optional Endpoint Properties:
   If none of hsync-active, vsync-active and pclk-sample is specified the
   endpoint will use embedded BT.656 synchronization.
 
-  - default-input: Select which input is selected after reset.
-
 Example:
 
hdmi_receiver@4c {
-- 
2.7.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


Re: [PATCH 2/2] media: adv7604: automatic "default-input" selection

2016-09-22 Thread Ulrich Hecht
On Fri, Sep 16, 2016 at 11:57 AM, Laurent Pinchart
<laurent.pinch...@ideasonboard.com> wrote:
> Hi Ulrich,
>
> Thank you for the patch.

Thanks for your review.

>
> On Friday 16 Sep 2016 11:39:42 Ulrich Hecht wrote:
>> Fall back to input 0 if "default-input" property is not present.
>>
>> Documentation states that the "default-input" property should reside
>> directly in the node for adv7612.
>
> Not just fo adv7612.
>
>> Hence, also adjust the parsing to make the implementation consistent with
>> this.
>>
>> Based on patch by William Towle <william.to...@codethink.co.uk>.
>>
>> Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
>> Signed-off-by: Hans Verkuil <hans.verk...@cisco.com>
>> ---
>>  drivers/media/i2c/adv7604.c | 5 -
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
>> index 4003831..055c9df 100644
>> --- a/drivers/media/i2c/adv7604.c
>> +++ b/drivers/media/i2c/adv7604.c
>> @@ -3077,10 +3077,13 @@ static int adv76xx_parse_dt(struct adv76xx_state
>> *state)
>>   if (!of_property_read_u32(endpoint, "default-input", ))
>
> Should this be removed if the property has to be in the device node and not in
> the endpoint ?

Probably, considering it's not used anywhere yet.

>
>>   state->pdata.default_input = v;
>>   else
>> - state->pdata.default_input = -1;
>> + state->pdata.default_input = 0;
>
> What was the use case for setting it to -1 ? Is it safe to change that ?

Not sure. Might as well leave it at -1, we define the default in the DT anyway.

CU
Uli
--
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 3/3] ARM: dts: gose: add composite video input

2016-09-16 Thread Ulrich Hecht
Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 arch/arm/boot/dts/r8a7793-gose.dts | 36 
 1 file changed, 36 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7793-gose.dts 
b/arch/arm/boot/dts/r8a7793-gose.dts
index e22d63c..981f0fe 100644
--- a/arch/arm/boot/dts/r8a7793-gose.dts
+++ b/arch/arm/boot/dts/r8a7793-gose.dts
@@ -379,6 +379,11 @@
groups = "vin0_data24", "vin0_sync", "vin0_clkenb", "vin0_clk";
function = "vin0";
};
+
+   vin1_pins: vin1 {
+   groups = "vin1_data8", "vin1_clk";
+   function = "vin1";
+   };
 };
 
  {
@@ -504,6 +509,19 @@
reg = <0x12>;
};
 
+   composite-in@20 {
+   compatible = "adi,adv7180";
+   reg = <0x20>;
+   remote = <>;
+
+   port {
+   adv7180: endpoint {
+   bus-width = <8>;
+   remote-endpoint = <>;
+   };
+   };
+   };
+
hdmi@39 {
compatible = "adi,adv7511w";
reg = <0x39>;
@@ -599,3 +617,21 @@
};
};
 };
+
+/* composite video input */
+ {
+   pinctrl-0 = <_pins>;
+   pinctrl-names = "default";
+
+   status = "okay";
+
+   port {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   vin1ep: endpoint {
+   remote-endpoint = <>;
+   bus-width = <8>;
+   };
+   };
+};
-- 
2.9.3

--
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 2/3] ARM: dts: gose: add HDMI input

2016-09-16 Thread Ulrich Hecht
Identical to the setup on Lager.

Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 arch/arm/boot/dts/r8a7793-gose.dts | 41 ++
 1 file changed, 41 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7793-gose.dts 
b/arch/arm/boot/dts/r8a7793-gose.dts
index 90af186..e22d63c 100644
--- a/arch/arm/boot/dts/r8a7793-gose.dts
+++ b/arch/arm/boot/dts/r8a7793-gose.dts
@@ -374,6 +374,11 @@
groups = "audio_clk_a";
function = "audio_clk";
};
+
+   vin0_pins: vin0 {
+   groups = "vin0_data24", "vin0_sync", "vin0_clkenb", "vin0_clk";
+   function = "vin0";
+   };
 };
 
  {
@@ -531,6 +536,21 @@
};
};
 
+   hdmi-in@4c {
+   compatible = "adi,adv7612";
+   reg = <0x4c>;
+   interrupt-parent = <>;
+   interrupts = <20 IRQ_TYPE_LEVEL_LOW>;
+   remote = <>;
+   default-input = <0>;
+
+   port {
+   adv7612: endpoint {
+   remote-endpoint = <>;
+   };
+   };
+   };
+
eeprom@50 {
compatible = "renesas,r1ex24002", "atmel,24c02";
reg = <0x50>;
@@ -558,3 +578,24 @@
  {
shared-pin;
 };
+
+/* HDMI video input */
+ {
+   status = "okay";
+   pinctrl-0 = <_pins>;
+   pinctrl-names = "default";
+
+   port {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   vin0ep: endpoint {
+   remote-endpoint = <>;
+   bus-width = <24>;
+   hsync-active = <0>;
+   vsync-active = <0>;
+   pclk-sample = <1>;
+   data-active = <1>;
+   };
+   };
+};
-- 
2.9.3

--
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 0/2] Renesas Lager/Koelsch HDMI input

2016-09-16 Thread Ulrich Hecht
Hi!

This series enables HDMI input on the Lager and Koelsch boards.
It sits on renesas-devel-20160913-v4.8-rc6 and also applies to the media
tree.

Testing this on a Lager board with v4l2-compliance on top of Hans's R-Car
branch (https://git.linuxtv.org/hverkuil/media_tree.git/log/?h=rcar) with
"media: adv7604: automatic "default-input" selection" applied, it gets a
perfect score (172/172 pass).

CU
Uli


Hans Verkuil (1):
  ARM: dts: koelsch: add HDMI input

William Towle (1):
  ARM: dts: lager: Add entries for VIN HDMI input support

 arch/arm/boot/dts/r8a7790-lager.dts   | 39 +
 arch/arm/boot/dts/r8a7791-koelsch.dts | 41 +++
 2 files changed, 80 insertions(+)

-- 
2.9.3

--
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 1/3] ARM: dts: r8a7793: Enable VIN0, VIN1

2016-09-16 Thread Ulrich Hecht
Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 arch/arm/boot/dts/r8a7793.dtsi | 20 
 1 file changed, 20 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7793.dtsi b/arch/arm/boot/dts/r8a7793.dtsi
index 8d02aac..0898668 100644
--- a/arch/arm/boot/dts/r8a7793.dtsi
+++ b/arch/arm/boot/dts/r8a7793.dtsi
@@ -30,6 +30,8 @@
i2c7 = 
i2c8 = 
spi0 = 
+   vin0 = 
+   vin1 = 
};
 
cpus {
@@ -852,6 +854,24 @@
status = "disabled";
};
 
+   vin0: video@e6ef {
+   compatible = "renesas,vin-r8a7793";
+   reg = <0 0xe6ef 0 0x1000>;
+   interrupts = ;
+   clocks = <_clks R8A7793_CLK_VIN0>;
+   power-domains = < R8A7793_PD_ALWAYS_ON>;
+   status = "disabled";
+   };
+
+   vin1: video@e6ef1000 {
+   compatible = "renesas,vin-r8a7793";
+   reg = <0 0xe6ef1000 0 0x1000>;
+   interrupts = ;
+   clocks = <_clks R8A7793_CLK_VIN1>;
+   power-domains = < R8A7793_PD_ALWAYS_ON>;
+   status = "disabled";
+   };
+
qspi: spi@e6b1 {
compatible = "renesas,qspi-r8a7793", "renesas,qspi";
reg = <0 0xe6b1 0 0x2c>;
-- 
2.9.3

--
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 0/3] r8a7793 Gose video input support

2016-09-16 Thread Ulrich Hecht
Hi!

This is a by-the-datasheet implementation of analog and digital video input
on the Gose board.

I don't have that hardware, so if somebody could test this, I would
appreciate it.  To get the digital part to work, use Hans's R-Car branch
(https://git.linuxtv.org/hverkuil/media_tree.git/log/?h=rcar) plus the
"media: adv7604: automatic "default-input" selection" patch.

CU
Uli


Ulrich Hecht (3):
  ARM: dts: r8a7793: Enable VIN0, VIN1
  ARM: dts: gose: add HDMI input
  ARM: dts: gose: add composite video input

 arch/arm/boot/dts/r8a7793-gose.dts | 77 ++
 arch/arm/boot/dts/r8a7793.dtsi | 20 ++
 2 files changed, 97 insertions(+)

-- 
2.9.3

--
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 1/2] ARM: dts: lager: Add entries for VIN HDMI input support

2016-09-16 Thread Ulrich Hecht
From: William Towle <william.to...@codethink.co.uk>

Add DT entries for vin0, vin0_pins, and adv7612.

Sets the 'default-input' property for ADV7612, enabling image and video
capture without the need to have userspace specifying routing.

Signed-off-by: William Towle <william.to...@codethink.co.uk>
Signed-off-by: Rob Taylor <rob.tay...@codethink.co.uk>
[uli: added interrupt, renamed endpoint, merged default-input]
Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 arch/arm/boot/dts/r8a7790-lager.dts | 39 +
 1 file changed, 39 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7790-lager.dts 
b/arch/arm/boot/dts/r8a7790-lager.dts
index 52b56fc..fc9d129 100644
--- a/arch/arm/boot/dts/r8a7790-lager.dts
+++ b/arch/arm/boot/dts/r8a7790-lager.dts
@@ -427,6 +427,11 @@
function = "usb2";
};
 
+   vin0_pins: vin0 {
+   groups = "vin0_data24", "vin0_sync", "vin0_clkenb", "vin0_clk";
+   function = "vin0";
+   };
+
vin1_pins: vin1 {
groups = "vin1_data8", "vin1_clk";
function = "vin1";
@@ -651,6 +656,21 @@
};
};
};
+
+   hdmi-in@4c {
+   compatible = "adi,adv7612";
+   reg = <0x4c>;
+   interrupt-parent = <>;
+   interrupts = <20 IRQ_TYPE_LEVEL_LOW>;
+   remote = <>;
+   default-input = <0>;
+
+   port {
+   adv7612: endpoint {
+   remote-endpoint = <>;
+   };
+   };
+   };
 };
 
  {
@@ -722,6 +742,25 @@
status = "okay";
 };
 
+/* HDMI video input */
+ {
+   pinctrl-0 = <_pins>;
+   pinctrl-names = "default";
+
+   status = "ok";
+
+   port {
+   vin0ep0: endpoint {
+   remote-endpoint = <>;
+   bus-width = <24>;
+   hsync-active = <0>;
+   vsync-active = <0>;
+   pclk-sample = <1>;
+   data-active = <1>;
+   };
+   };
+};
+
 /* composite video input */
  {
pinctrl-0 = <_pins>;
-- 
2.9.3

--
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 2/2] ARM: dts: koelsch: add HDMI input

2016-09-16 Thread Ulrich Hecht
From: Hans Verkuil <hverk...@xs4all.nl>

Add support in the dts for the HDMI input. Based on the Lager dts
patch from Ulrich Hecht.

Signed-off-by: Hans Verkuil <hans.verk...@cisco.com>
[uli: removed "renesas," prefixes from pfc nodes]
Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 arch/arm/boot/dts/r8a7791-koelsch.dts | 41 +++
 1 file changed, 41 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7791-koelsch.dts 
b/arch/arm/boot/dts/r8a7791-koelsch.dts
index f8a7d09..45b8b5f 100644
--- a/arch/arm/boot/dts/r8a7791-koelsch.dts
+++ b/arch/arm/boot/dts/r8a7791-koelsch.dts
@@ -393,6 +393,11 @@
function = "usb1";
};
 
+   vin0_pins: vin0 {
+   groups = "vin0_data24", "vin0_sync", "vin0_clkenb", "vin0_clk";
+   function = "vin0";
+   };
+
vin1_pins: vin1 {
groups = "vin1_data8", "vin1_clk";
function = "vin1";
@@ -596,6 +601,21 @@
};
};
 
+   hdmi-in@4c {
+   compatible = "adi,adv7612";
+   reg = <0x4c>;
+   interrupt-parent = <>;
+   interrupts = <20 IRQ_TYPE_LEVEL_LOW>;
+   remote = <>;
+   default-input = <0>;
+
+   port {
+   adv7612: endpoint {
+   remote-endpoint = <>;
+   };
+   };
+   };
+
eeprom@50 {
compatible = "renesas,24c02";
reg = <0x50>;
@@ -672,6 +692,27 @@
cpu0-supply = <_dvfs>;
 };
 
+/* HDMI video input */
+ {
+   status = "okay";
+   pinctrl-0 = <_pins>;
+   pinctrl-names = "default";
+
+   port {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   vin0ep: endpoint {
+   remote-endpoint = <>;
+   bus-width = <24>;
+   hsync-active = <0>;
+   vsync-active = <0>;
+   pclk-sample = <1>;
+   data-active = <1>;
+   };
+   };
+};
+
 /* composite video input */
  {
status = "okay";
-- 
2.9.3

--
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 2/2] media: adv7604: automatic "default-input" selection

2016-09-16 Thread Ulrich Hecht
Fall back to input 0 if "default-input" property is not present.

Documentation states that the "default-input" property should reside
directly in the node for adv7612.  Hence, also adjust the parsing to make
the implementation consistent with this.

Based on patch by William Towle <william.to...@codethink.co.uk>.

Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
Signed-off-by: Hans Verkuil <hans.verk...@cisco.com>
---
 drivers/media/i2c/adv7604.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 4003831..055c9df 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -3077,10 +3077,13 @@ static int adv76xx_parse_dt(struct adv76xx_state *state)
if (!of_property_read_u32(endpoint, "default-input", ))
state->pdata.default_input = v;
else
-   state->pdata.default_input = -1;
+   state->pdata.default_input = 0;
 
of_node_put(endpoint);
 
+   if (!of_property_read_u32(np, "default-input", ))
+   state->pdata.default_input = v;
+
flags = bus_cfg.bus.parallel.flags;
 
if (flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH)
-- 
2.9.3

--
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 1/2] media: adv7604: fix bindings inconsistency for default-input

2016-09-16 Thread Ulrich Hecht
The text states that default-input is an endpoint property, but in the
example it is a device property.  The example makes more sense.

Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 Documentation/devicetree/bindings/media/i2c/adv7604.txt | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt 
b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
index 8337f75..9cbd92e 100644
--- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
+++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
@@ -34,6 +34,7 @@ The digital output port node must contain at least one 
endpoint.
 Optional Properties:
 
   - reset-gpios: Reference to the GPIO connected to the device's reset pin.
+  - default-input: Select which input is selected after reset.
 
 Optional Endpoint Properties:
 
@@ -47,8 +48,6 @@ Optional Endpoint Properties:
   If none of hsync-active, vsync-active and pclk-sample is specified the
   endpoint will use embedded BT.656 synchronization.
 
-  - default-input: Select which input is selected after reset.
-
 Example:
 
hdmi_receiver@4c {
-- 
2.9.3

--
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 0/2] media: adv7604: fix default-input property inconsistencies

2016-09-16 Thread Ulrich Hecht
Hi!

This is a fix for the inconsistency in the adv7604 bindings regarding the
default-input property, clarifying that it should be a property of the
device, not the endpoint, and a patch to implement it.

CU
Uli


Ulrich Hecht (2):
  media: adv7604: fix bindings inconsistency for default-input
  media: adv7604: automatic "default-input" selection

 Documentation/devicetree/bindings/media/i2c/adv7604.txt | 3 +--
 drivers/media/i2c/adv7604.c | 5 -
 2 files changed, 5 insertions(+), 3 deletions(-)

-- 
2.9.3

--
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 v9 1/2] rcar-vin: implement EDID control ioctls

2016-09-15 Thread Ulrich Hecht
Adds G_EDID and S_EDID.

Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
Acked-by: Niklas Söderlund <niklas.soderlund+rene...@ragnatech.se>
---
 drivers/media/platform/rcar-vin/rcar-v4l2.c | 48 +
 drivers/media/platform/rcar-vin/rcar-vin.h  |  2 ++
 2 files changed, 50 insertions(+)

diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c 
b/drivers/media/platform/rcar-vin/rcar-v4l2.c
index 61e9b59..f35005c 100644
--- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
+++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
@@ -613,6 +613,44 @@ static int rvin_dv_timings_cap(struct file *file, void 
*priv_fh,
return ret;
 }
 
+static int rvin_g_edid(struct file *file, void *fh, struct v4l2_edid *edid)
+{
+   struct rvin_dev *vin = video_drvdata(file);
+   struct v4l2_subdev *sd = vin_to_source(vin);
+   int input, ret;
+
+   if (edid->pad)
+   return -EINVAL;
+
+   input = edid->pad;
+   edid->pad = vin->sink_pad_idx;
+
+   ret = v4l2_subdev_call(sd, pad, get_edid, edid);
+
+   edid->pad = input;
+
+   return ret;
+}
+
+static int rvin_s_edid(struct file *file, void *fh, struct v4l2_edid *edid)
+{
+   struct rvin_dev *vin = video_drvdata(file);
+   struct v4l2_subdev *sd = vin_to_source(vin);
+   int input, ret;
+
+   if (edid->pad)
+   return -EINVAL;
+
+   input = edid->pad;
+   edid->pad = vin->sink_pad_idx;
+
+   ret = v4l2_subdev_call(sd, pad, set_edid, edid);
+
+   edid->pad = input;
+
+   return ret;
+}
+
 static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
.vidioc_querycap= rvin_querycap,
.vidioc_try_fmt_vid_cap = rvin_try_fmt_vid_cap,
@@ -635,6 +673,9 @@ static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
.vidioc_s_dv_timings= rvin_s_dv_timings,
.vidioc_query_dv_timings= rvin_query_dv_timings,
 
+   .vidioc_g_edid  = rvin_g_edid,
+   .vidioc_s_edid  = rvin_s_edid,
+
.vidioc_querystd= rvin_querystd,
.vidioc_g_std   = rvin_g_std,
.vidioc_s_std   = rvin_s_std,
@@ -883,6 +924,13 @@ int rvin_v4l2_probe(struct rvin_dev *vin)
 
vin->src_pad_idx = pad_idx;
 
+   vin->sink_pad_idx = 0;
+   for (pad_idx = 0; pad_idx < sd->entity.num_pads; pad_idx++)
+   if (sd->entity.pads[pad_idx].flags == MEDIA_PAD_FL_SINK) {
+   vin->sink_pad_idx = pad_idx;
+   break;
+   }
+
vin->format.pixelformat = RVIN_DEFAULT_FORMAT;
rvin_reset_format(vin);
 
diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h 
b/drivers/media/platform/rcar-vin/rcar-vin.h
index 793184d..727e215 100644
--- a/drivers/media/platform/rcar-vin/rcar-vin.h
+++ b/drivers/media/platform/rcar-vin/rcar-vin.h
@@ -92,6 +92,7 @@ struct rvin_graph_entity {
  * @vdev:  V4L2 video device associated with VIN
  * @v4l2_dev:  V4L2 device
  * @src_pad_idx:   source pad index for media controller drivers
+ * @sink_pad_idx:  sink pad index for media controller drivers
  * @ctrl_handler:  V4L2 control handler
  * @notifier:  V4L2 asynchronous subdevs notifier
  * @digital:   entity in the DT for local digital subdevice
@@ -121,6 +122,7 @@ struct rvin_dev {
struct video_device vdev;
struct v4l2_device v4l2_dev;
int src_pad_idx;
+   int sink_pad_idx;
struct v4l2_ctrl_handler ctrl_handler;
struct v4l2_async_notifier notifier;
struct rvin_graph_entity digital;
-- 
2.9.3

--
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 v9 2/2] media: rcar-vin: use sink pad index for DV timings

2016-09-15 Thread Ulrich Hecht
Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 drivers/media/platform/rcar-vin/rcar-v4l2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c 
b/drivers/media/platform/rcar-vin/rcar-v4l2.c
index f35005c..2bbe6d4 100644
--- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
+++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
@@ -550,7 +550,7 @@ static int rvin_enum_dv_timings(struct file *file, void 
*priv_fh,
int pad, ret;
 
pad = timings->pad;
-   timings->pad = vin->src_pad_idx;
+   timings->pad = vin->sink_pad_idx;
 
ret = v4l2_subdev_call(sd, pad, enum_dv_timings, timings);
 
@@ -604,7 +604,7 @@ static int rvin_dv_timings_cap(struct file *file, void 
*priv_fh,
int pad, ret;
 
pad = cap->pad;
-   cap->pad = vin->src_pad_idx;
+   cap->pad = vin->sink_pad_idx;
 
ret = v4l2_subdev_call(sd, pad, dv_timings_cap, cap);
 
-- 
2.9.3

--
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 v9 0/2] rcar-vin EDID control ioctls

2016-09-15 Thread Ulrich Hecht
Hi!

This revision sits on top of Hans's rcar branch and adds pad sanity checks
for g_edid and s_edid, the sink pad fix for the DV timings suggested by
Niklas, and documents sink_pad_idx. Good night!

CU
Uli


Changes since v8:
- dumped merged default-input patch
- added pad sanity check
- added DV timings sink pad fix
- documented sink_pad_idx
- added Acked-By

Changes since v7:
- do not fail if there is no sink pad

Changes since v6:
- work without subdev abstraction layer
- split off DT parts, to be handled separately

Changes since v5:
- implement vin/subdev pad translation
- move i2c devices

Changes since v4:
- drop merged patches
- adv7604: always fall back to input 0 if nothing else is specified
- rcar-vin: implement G_EDID, S_EDID in place of hard-coded EDID blob

Changes since v3:
- rvin_enum_dv_timings(): use vin->src_pad_idx
- rvin_dv_timings_cap(): likewise
- rvin_s_dv_timings(): update vin->format
- add Koelsch support

Changes since v2:
- rebased on top of rcar-vin driver v4
- removed "adv7604: fix SPA register location for ADV7612" (picked up)
- changed prefix of dts patch to "ARM: dts: lager: "


Ulrich Hecht (2):
  rcar-vin: implement EDID control ioctls
  media: rcar-vin: use sink pad index for DV timings

 drivers/media/platform/rcar-vin/rcar-v4l2.c | 52 +++--
 drivers/media/platform/rcar-vin/rcar-vin.h  |  2 ++
 2 files changed, 52 insertions(+), 2 deletions(-)

-- 
2.9.3

--
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 v8 0/2] rcar-vin EDID control ioctls

2016-09-15 Thread Ulrich Hecht
On Thu, Sep 15, 2016 at 3:25 PM, Hans Verkuil <hansv...@cisco.com> wrote:
> On 09/15/2016 03:24 PM, Ulrich Hecht wrote:
>>
>> Hi!
>>
>> This is a spinoff of "Lager/Koelsch board HDMI input support" that
>> excludes
>> the DT portions, and that works without the unmerged subdevice abstraction
>> layer.
>
>
> Are you going to post another patch series for the DT portions?

Yes, but not today.

CU
Uli
--
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 v8 2/2] rcar-vin: implement EDID control ioctls

2016-09-15 Thread Ulrich Hecht
Adds G_EDID and S_EDID.

Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 drivers/media/platform/rcar-vin/rcar-v4l2.c | 42 +
 drivers/media/platform/rcar-vin/rcar-vin.h  |  1 +
 2 files changed, 43 insertions(+)

diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c 
b/drivers/media/platform/rcar-vin/rcar-v4l2.c
index 62ca7e3..f679182 100644
--- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
+++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
@@ -557,6 +557,38 @@ static int rvin_dv_timings_cap(struct file *file, void 
*priv_fh,
return ret;
 }
 
+static int rvin_g_edid(struct file *file, void *fh, struct v4l2_edid *edid)
+{
+   struct rvin_dev *vin = video_drvdata(file);
+   struct v4l2_subdev *sd = vin_to_source(vin);
+   int input, ret;
+
+   input = edid->pad;
+   edid->pad = vin->sink_pad_idx;
+
+   ret = v4l2_subdev_call(sd, pad, get_edid, edid);
+
+   edid->pad = input;
+
+   return ret;
+}
+
+static int rvin_s_edid(struct file *file, void *fh, struct v4l2_edid *edid)
+{
+   struct rvin_dev *vin = video_drvdata(file);
+   struct v4l2_subdev *sd = vin_to_source(vin);
+   int input, ret;
+
+   input = edid->pad;
+   edid->pad = vin->sink_pad_idx;
+
+   ret = v4l2_subdev_call(sd, pad, set_edid, edid);
+
+   edid->pad = input;
+
+   return ret;
+}
+
 static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
.vidioc_querycap= rvin_querycap,
.vidioc_try_fmt_vid_cap = rvin_try_fmt_vid_cap,
@@ -579,6 +611,9 @@ static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
.vidioc_s_dv_timings= rvin_s_dv_timings,
.vidioc_query_dv_timings= rvin_query_dv_timings,
 
+   .vidioc_g_edid  = rvin_g_edid,
+   .vidioc_s_edid  = rvin_s_edid,
+
.vidioc_querystd= rvin_querystd,
.vidioc_g_std   = rvin_g_std,
.vidioc_s_std   = rvin_s_std,
@@ -832,6 +867,13 @@ int rvin_v4l2_probe(struct rvin_dev *vin)
vin->src_pad_idx = pad_idx;
fmt.pad = vin->src_pad_idx;
 
+   vin->sink_pad_idx = 0;
+   for (pad_idx = 0; pad_idx < sd->entity.num_pads; pad_idx++)
+   if (sd->entity.pads[pad_idx].flags == MEDIA_PAD_FL_SINK) {
+   vin->sink_pad_idx = pad_idx;
+   break;
+   }
+
/* Try to improve our guess of a reasonable window format */
ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, );
if (ret) {
diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h 
b/drivers/media/platform/rcar-vin/rcar-vin.h
index 793184d..af815cc 100644
--- a/drivers/media/platform/rcar-vin/rcar-vin.h
+++ b/drivers/media/platform/rcar-vin/rcar-vin.h
@@ -121,6 +121,7 @@ struct rvin_dev {
struct video_device vdev;
struct v4l2_device v4l2_dev;
int src_pad_idx;
+   int sink_pad_idx;
struct v4l2_ctrl_handler ctrl_handler;
struct v4l2_async_notifier notifier;
struct rvin_graph_entity digital;
-- 
2.9.3

--
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 v8 1/2] media: adv7604: automatic "default-input" selection

2016-09-15 Thread Ulrich Hecht
Fall back to input 0 if "default-input" property is not present.

Additionally, documentation in commit bf9c82278c34 ("[media]
media: adv7604: ability to read default input port from DT") states
that the "default-input" property should reside directly in the node
for adv7612. Hence, also adjust the parsing to make the implementation
consistent with this.

Based on patch by William Towle <william.to...@codethink.co.uk>.

Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 drivers/media/i2c/adv7604.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 4003831..055c9df 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -3077,10 +3077,13 @@ static int adv76xx_parse_dt(struct adv76xx_state *state)
if (!of_property_read_u32(endpoint, "default-input", ))
state->pdata.default_input = v;
else
-   state->pdata.default_input = -1;
+   state->pdata.default_input = 0;
 
of_node_put(endpoint);
 
+   if (!of_property_read_u32(np, "default-input", ))
+   state->pdata.default_input = v;
+
flags = bus_cfg.bus.parallel.flags;
 
if (flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH)
-- 
2.9.3

--
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 v8 0/2] rcar-vin EDID control ioctls

2016-09-15 Thread Ulrich Hecht
Hi!

This is a spinoff of "Lager/Koelsch board HDMI input support" that excludes
the DT portions, and that works without the unmerged subdevice abstraction
layer.

This revision improves over v7 from earlier today in that it does not break
analog input devices...

CU
Uli


Changes since v7:
- do not fail if there is no sink pad

Changes since v6:
- work without subdev abstraction layer
- split off DT parts, to be handled separately

Changes since v5:
- implement vin/subdev pad translation
- move i2c devices

Changes since v4:
- drop merged patches
- adv7604: always fall back to input 0 if nothing else is specified
- rcar-vin: implement G_EDID, S_EDID in place of hard-coded EDID blob

Changes since v3:
- rvin_enum_dv_timings(): use vin->src_pad_idx
- rvin_dv_timings_cap(): likewise
- rvin_s_dv_timings(): update vin->format
- add Koelsch support

Changes since v2:
- rebased on top of rcar-vin driver v4
- removed "adv7604: fix SPA register location for ADV7612" (picked up)
- changed prefix of dts patch to "ARM: dts: lager: "


Ulrich Hecht (2):
  media: adv7604: automatic "default-input" selection
  rcar-vin: implement EDID control ioctls

 drivers/media/i2c/adv7604.c |  5 +++-
 drivers/media/platform/rcar-vin/rcar-v4l2.c | 42 +
 drivers/media/platform/rcar-vin/rcar-vin.h  |  1 +
 3 files changed, 47 insertions(+), 1 deletion(-)

-- 
2.9.3

--
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 v7 0/2] rcar-vin EDID control ioctls

2016-09-15 Thread Ulrich Hecht
Hi!

This is a spinoff of "Lager/Koelsch board HDMI input support" that excludes
the DT portions, and that works without the unmerged subdevice abstraction
layer.

CU
Uli


Changes since v6:
- work without subdev abstraction layer
- split off DT parts, to be handled separately

Changes since v5:
- implement vin/subdev pad translation
- move i2c devices

Changes since v4:
- drop merged patches
- adv7604: always fall back to input 0 if nothing else is specified
- rcar-vin: implement G_EDID, S_EDID in place of hard-coded EDID blob

Changes since v3:
- rvin_enum_dv_timings(): use vin->src_pad_idx
- rvin_dv_timings_cap(): likewise
- rvin_s_dv_timings(): update vin->format
- add Koelsch support

Changes since v2:
- rebased on top of rcar-vin driver v4
- removed "adv7604: fix SPA register location for ADV7612" (picked up)
- changed prefix of dts patch to "ARM: dts: lager: "


Ulrich Hecht (2):
  media: adv7604: automatic "default-input" selection
  rcar-vin: implement EDID control ioctls

 drivers/media/i2c/adv7604.c |  5 +++-
 drivers/media/platform/rcar-vin/rcar-v4l2.c | 44 +
 drivers/media/platform/rcar-vin/rcar-vin.h  |  1 +
 3 files changed, 49 insertions(+), 1 deletion(-)

-- 
2.9.3

--
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 v7 1/2] media: adv7604: automatic "default-input" selection

2016-09-15 Thread Ulrich Hecht
Fall back to input 0 if "default-input" property is not present.

Additionally, documentation in commit bf9c82278c34 ("[media]
media: adv7604: ability to read default input port from DT") states
that the "default-input" property should reside directly in the node
for adv7612. Hence, also adjust the parsing to make the implementation
consistent with this.

Based on patch by William Towle <william.to...@codethink.co.uk>.

Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 drivers/media/i2c/adv7604.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 4003831..055c9df 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -3077,10 +3077,13 @@ static int adv76xx_parse_dt(struct adv76xx_state *state)
if (!of_property_read_u32(endpoint, "default-input", ))
state->pdata.default_input = v;
else
-   state->pdata.default_input = -1;
+   state->pdata.default_input = 0;
 
of_node_put(endpoint);
 
+   if (!of_property_read_u32(np, "default-input", ))
+   state->pdata.default_input = v;
+
flags = bus_cfg.bus.parallel.flags;
 
if (flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH)
-- 
2.9.3

--
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 v6 4/4] rcar-vin: implement EDID control ioctls

2016-08-15 Thread Ulrich Hecht
On Mon, Aug 15, 2016 at 10:48 AM, Hans Verkuil <hverk...@xs4all.nl> wrote:
> On 08/15/2016 10:37 AM, Ulrich Hecht wrote:
>> On Sat, Aug 13, 2016 at 3:30 PM, Hans Verkuil <hverk...@xs4all.nl> wrote:
>>> On 07/22/2016 11:09 AM, Ulrich Hecht wrote:
>>>> Adds G_EDID and S_EDID.
>>>>
>>>> Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
>>>> ---
>>>>  drivers/media/platform/rcar-vin/rcar-v4l2.c | 33 
>>>> +
>>>>  1 file changed, 33 insertions(+)
>>>>
>>>> diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c 
>>>> b/drivers/media/platform/rcar-vin/rcar-v4l2.c
>>>> index 396eabc..57e040c 100644
>>>> --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
>>>> +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
>>>> @@ -661,6 +661,36 @@ static int rvin_dv_timings_cap(struct file *file, 
>>>> void *priv_fh,
>>>>   return ret;
>>>>  }
>>>>
>>>> +static int rvin_g_edid(struct file *file, void *fh, struct v4l2_edid 
>>>> *edid)
>>>> +{
>>>> + struct rvin_dev *vin = video_drvdata(file);
>>>> + int input, ret;
>>>> +
>>>> + input = edid->pad;
>>>> + edid->pad = vin->inputs[input].sink_idx;
>>>
>>> There is no vin->inputs array. Are there some other patches that need to be 
>>> merged
>>> first?
>>
>> It depends on "[PATCHv2 12/16] [media] rcar-vin: allow subdevices to
>> be bound late" from "[PATCHv2 00/16] rcar-vin: Enable Gen3 support".
>> Does that series have a chance of getting merged any time soon?
>
> I hope to review it today or Friday.
>
> Can you repost anyway: the dts patches don't apply cleanly anymore, and
> I prefer that you fix that. I want to avoid making a mistake when I fix them 
> up.

The patches are current, but they depend on changes in the
renesas-drivers tree not upstream yet.
Should we perhaps split this series into code and DT?

CU
Uli
--
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 v6 4/4] rcar-vin: implement EDID control ioctls

2016-08-15 Thread Ulrich Hecht
On Sat, Aug 13, 2016 at 3:30 PM, Hans Verkuil <hverk...@xs4all.nl> wrote:
> On 07/22/2016 11:09 AM, Ulrich Hecht wrote:
>> Adds G_EDID and S_EDID.
>>
>> Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
>> ---
>>  drivers/media/platform/rcar-vin/rcar-v4l2.c | 33 
>> +
>>  1 file changed, 33 insertions(+)
>>
>> diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c 
>> b/drivers/media/platform/rcar-vin/rcar-v4l2.c
>> index 396eabc..57e040c 100644
>> --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
>> +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
>> @@ -661,6 +661,36 @@ static int rvin_dv_timings_cap(struct file *file, void 
>> *priv_fh,
>>   return ret;
>>  }
>>
>> +static int rvin_g_edid(struct file *file, void *fh, struct v4l2_edid *edid)
>> +{
>> + struct rvin_dev *vin = video_drvdata(file);
>> + int input, ret;
>> +
>> + input = edid->pad;
>> + edid->pad = vin->inputs[input].sink_idx;
>
> There is no vin->inputs array. Are there some other patches that need to be 
> merged
> first?

It depends on "[PATCHv2 12/16] [media] rcar-vin: allow subdevices to
be bound late" from "[PATCHv2 00/16] rcar-vin: Enable Gen3 support".
Does that series have a chance of getting merged any time soon?

CU
Uli
--
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 v6 3/4] ARM: dts: koelsch: add HDMI input

2016-07-22 Thread Ulrich Hecht
From: Hans Verkuil <hverk...@xs4all.nl>

Add support in the dts for the HDMI input. Based on the Lager dts
patch from Ulrich Hecht.

Signed-off-by: Hans Verkuil <hans.verk...@cisco.com>
[uli: removed "renesas," prefixes from pfc nodes]
Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 arch/arm/boot/dts/r8a7791-koelsch.dts | 41 +++
 1 file changed, 41 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7791-koelsch.dts 
b/arch/arm/boot/dts/r8a7791-koelsch.dts
index 980f41b..28ec3a8 100644
--- a/arch/arm/boot/dts/r8a7791-koelsch.dts
+++ b/arch/arm/boot/dts/r8a7791-koelsch.dts
@@ -400,6 +400,21 @@
};
};
 
+   hdmi-in@4c {
+   compatible = "adi,adv7612";
+   reg = <0x4c>;
+   interrupt-parent = <>;
+   interrupts = <20 IRQ_TYPE_LEVEL_LOW>;
+   remote = <>;
+   default-input = <0>;
+
+   port {
+   adv7612: endpoint {
+   remote-endpoint = <>;
+   };
+   };
+   };
+
eeprom@50 {
compatible = "renesas,24c02";
reg = <0x50>;
@@ -534,6 +549,11 @@
function = "usb1";
};
 
+   vin0_pins: vin0 {
+   groups = "vin0_data24", "vin0_sync", "vin0_clkenb", "vin0_clk";
+   function = "vin0";
+   };
+
vin1_pins: vin1 {
groups = "vin1_data8", "vin1_clk";
function = "vin1";
@@ -765,6 +785,27 @@
cpu0-supply = <_dvfs>;
 };
 
+/* HDMI video input */
+ {
+   status = "okay";
+   pinctrl-0 = <_pins>;
+   pinctrl-names = "default";
+
+   port {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   vin0ep: endpoint {
+   remote-endpoint = <>;
+   bus-width = <24>;
+   hsync-active = <0>;
+   vsync-active = <0>;
+   pclk-sample = <1>;
+   data-active = <1>;
+   };
+   };
+};
+
 /* composite video input */
  {
status = "okay";
-- 
2.7.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 v6 2/4] ARM: dts: lager: Add entries for VIN HDMI input support

2016-07-22 Thread Ulrich Hecht
From: William Towle <william.to...@codethink.co.uk>

Add DT entries for vin0, vin0_pins, and adv7612.

Sets the 'default-input' property for ADV7612, enabling image and video
capture without the need to have userspace specifying routing.

Signed-off-by: William Towle <william.to...@codethink.co.uk>
Signed-off-by: Rob Taylor <rob.tay...@codethink.co.uk>
[uli: added interrupt, renamed endpoint, merged default-input]
Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 arch/arm/boot/dts/r8a7790-lager.dts | 39 +
 1 file changed, 39 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7790-lager.dts 
b/arch/arm/boot/dts/r8a7790-lager.dts
index ffc2f4e..16e86d0 100644
--- a/arch/arm/boot/dts/r8a7790-lager.dts
+++ b/arch/arm/boot/dts/r8a7790-lager.dts
@@ -374,6 +374,21 @@
};
};
};
+
+   hdmi-in@4c {
+   compatible = "adi,adv7612";
+   reg = <0x4c>;
+   interrupt-parent = <>;
+   interrupts = <20 IRQ_TYPE_LEVEL_LOW>;
+   remote = <>;
+   default-input = <0>;
+
+   port {
+   adv7612: endpoint {
+   remote-endpoint = <>;
+   };
+   };
+   };
};
 
/*
@@ -587,6 +602,11 @@
function = "usb2";
};
 
+   vin0_pins: vin0 {
+   groups = "vin0_data24", "vin0_sync", "vin0_clkenb", "vin0_clk";
+   function = "vin0";
+   };
+
vin1_pins: vin1 {
groups = "vin1_data8", "vin1_clk";
function = "vin1";
@@ -818,6 +838,25 @@
status = "okay";
 };
 
+/* HDMI video input */
+ {
+   pinctrl-0 = <_pins>;
+   pinctrl-names = "default";
+
+   status = "ok";
+
+   port {
+   vin0ep0: endpoint {
+   remote-endpoint = <>;
+   bus-width = <24>;
+   hsync-active = <0>;
+   vsync-active = <0>;
+   pclk-sample = <1>;
+   data-active = <1>;
+   };
+   };
+};
+
 /* composite video input */
  {
pinctrl-0 = <_pins>;
-- 
2.7.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 v6 4/4] rcar-vin: implement EDID control ioctls

2016-07-22 Thread Ulrich Hecht
Adds G_EDID and S_EDID.

Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 drivers/media/platform/rcar-vin/rcar-v4l2.c | 33 +
 1 file changed, 33 insertions(+)

diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c 
b/drivers/media/platform/rcar-vin/rcar-v4l2.c
index 396eabc..57e040c 100644
--- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
+++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
@@ -661,6 +661,36 @@ static int rvin_dv_timings_cap(struct file *file, void 
*priv_fh,
return ret;
 }
 
+static int rvin_g_edid(struct file *file, void *fh, struct v4l2_edid *edid)
+{
+   struct rvin_dev *vin = video_drvdata(file);
+   int input, ret;
+
+   input = edid->pad;
+   edid->pad = vin->inputs[input].sink_idx;
+
+   ret = rvin_subdev_call(vin, pad, get_edid, edid);
+
+   edid->pad = input;
+
+   return ret;
+}
+
+static int rvin_s_edid(struct file *file, void *fh, struct v4l2_edid *edid)
+{
+   struct rvin_dev *vin = video_drvdata(file);
+   int input, ret;
+
+   input = edid->pad;
+   edid->pad = vin->inputs[input].sink_idx;
+
+   ret = rvin_subdev_call(vin, pad, set_edid, edid);
+
+   edid->pad = input;
+
+   return ret;
+}
+
 static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
.vidioc_querycap= rvin_querycap,
.vidioc_try_fmt_vid_cap = rvin_try_fmt_vid_cap,
@@ -683,6 +713,9 @@ static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
.vidioc_s_dv_timings= rvin_s_dv_timings,
.vidioc_query_dv_timings= rvin_query_dv_timings,
 
+   .vidioc_g_edid  = rvin_g_edid,
+   .vidioc_s_edid  = rvin_s_edid,
+
.vidioc_querystd= rvin_querystd,
.vidioc_g_std   = rvin_g_std,
.vidioc_s_std   = rvin_s_std,
-- 
2.7.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 v6 0/4] Lager/Koelsch board HDMI input support

2016-07-22 Thread Ulrich Hecht
Hi!

This revision implements the pad translation between rcar-vin and subdevices
as suggested by Niklas.  It also moves around the i2c devices, following the
introduction of i2c multiplexing in the Gen2 device trees.

Based on renesas-drivers-2016-07-19-v4.7-rc7.

CU
Uli


Changes since v5:
- implement vin/subdev pad translation
- move i2c devices

Changes since v4:
- drop merged patches
- adv7604: always fall back to input 0 if nothing else is specified
- rcar-vin: implement G_EDID, S_EDID in place of hard-coded EDID blob

Changes since v3:
- rvin_enum_dv_timings(): use vin->src_pad_idx
- rvin_dv_timings_cap(): likewise
- rvin_s_dv_timings(): update vin->format
- add Koelsch support

Changes since v2:
- rebased on top of rcar-vin driver v4
- removed "adv7604: fix SPA register location for ADV7612" (picked up)
- changed prefix of dts patch to "ARM: dts: lager: "


Hans Verkuil (1):
  ARM: dts: koelsch: add HDMI input

Ulrich Hecht (2):
  media: adv7604: automatic "default-input" selection
  rcar-vin: implement EDID control ioctls

William Towle (1):
  ARM: dts: lager: Add entries for VIN HDMI input support

 arch/arm/boot/dts/r8a7790-lager.dts | 39 +++
 arch/arm/boot/dts/r8a7791-koelsch.dts   | 41 +
 drivers/media/i2c/adv7604.c |  5 +++-
 drivers/media/platform/rcar-vin/rcar-v4l2.c | 33 +++
 4 files changed, 117 insertions(+), 1 deletion(-)

-- 
2.7.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 v6 1/4] media: adv7604: automatic "default-input" selection

2016-07-22 Thread Ulrich Hecht
Fall back to input 0 if "default-input" property is not present.

Additionally, documentation in commit bf9c82278c34 ("[media]
media: adv7604: ability to read default input port from DT") states
that the "default-input" property should reside directly in the node
for adv7612. Hence, also adjust the parsing to make the implementation
consistent with this.

Based on patch by William Towle <william.to...@codethink.co.uk>.

Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 drivers/media/i2c/adv7604.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 4003831..055c9df 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -3077,10 +3077,13 @@ static int adv76xx_parse_dt(struct adv76xx_state *state)
if (!of_property_read_u32(endpoint, "default-input", ))
state->pdata.default_input = v;
else
-   state->pdata.default_input = -1;
+   state->pdata.default_input = 0;
 
of_node_put(endpoint);
 
+   if (!of_property_read_u32(np, "default-input", ))
+   state->pdata.default_input = v;
+
flags = bus_cfg.bus.parallel.flags;
 
if (flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH)
-- 
2.7.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 v5 0/4] Lager/Koelsch board HDMI input support

2016-07-06 Thread Ulrich Hecht
Hi!

Sorry for the delay.  This revision drops all patches that have since been
picked up.  It amends the default input selection to fall back to input 0 if
nothing else is specified, and it replaces the hard-coded EDID blob with an
implementation of G_EDID and S_EDID in rcar-vin.

CU
Uli


Changes since v4:
- drop merged patches
- adv7604: always fall back to input 0 if nothing else is specified
- rcar-vin: implement G_EDID, S_EDID in place of hard-coded EDID blob

Changes since v3:
- rvin_enum_dv_timings(): use vin->src_pad_idx
- rvin_dv_timings_cap(): likewise
- rvin_s_dv_timings(): update vin->format
- add Koelsch support

Changes since v2:
- rebased on top of rcar-vin driver v4
- removed "adv7604: fix SPA register location for ADV7612" (picked up)
- changed prefix of dts patch to "ARM: dts: lager: "


Hans Verkuil (1):
  ARM: dts: koelsch: add HDMI input

Ulrich Hecht (2):
  media: adv7604: automatic "default-input" selection
  rcar-vin: implement EDID control ioctls

William Towle (1):
  ARM: dts: lager: Add entries for VIN HDMI input support

 arch/arm/boot/dts/r8a7790-lager.dts | 41 -
 arch/arm/boot/dts/r8a7791-koelsch.dts   | 41 +
 drivers/media/i2c/adv7604.c |  5 +++-
 drivers/media/platform/rcar-vin/rcar-v4l2.c | 17 
 4 files changed, 102 insertions(+), 2 deletions(-)

-- 
2.7.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 v5 1/4] media: adv7604: automatic "default-input" selection

2016-07-06 Thread Ulrich Hecht
Fall back to input 0 if "default-input" property is not present.

Additionally, documentation in commit bf9c82278c34 ("[media]
media: adv7604: ability to read default input port from DT") states
that the "default-input" property should reside directly in the node
for adv7612. Hence, also adjust the parsing to make the implementation
consistent with this.

Based on patch by William Towle <william.to...@codethink.co.uk>.

Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 drivers/media/i2c/adv7604.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 3f1ab49..2e8f036 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -2830,10 +2830,13 @@ static int adv76xx_parse_dt(struct adv76xx_state *state)
if (!of_property_read_u32(endpoint, "default-input", ))
state->pdata.default_input = v;
else
-   state->pdata.default_input = -1;
+   state->pdata.default_input = 0;
 
of_node_put(endpoint);
 
+   if (!of_property_read_u32(np, "default-input", ))
+   state->pdata.default_input = v;
+
flags = bus_cfg.bus.parallel.flags;
 
if (flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH)
-- 
2.7.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 v5 2/4] ARM: dts: lager: Add entries for VIN HDMI input support

2016-07-06 Thread Ulrich Hecht
From: William Towle <william.to...@codethink.co.uk>

Add DT entries for vin0, vin0_pins, and adv7612.

Sets the 'default-input' property for ADV7612, enabling image and video
capture without the need to have userspace specifying routing.

Signed-off-by: William Towle <william.to...@codethink.co.uk>
Signed-off-by: Rob Taylor <rob.tay...@codethink.co.uk>
[uli: added interrupt, renamed endpoint, merged default-input]
Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 arch/arm/boot/dts/r8a7790-lager.dts | 41 -
 1 file changed, 40 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/r8a7790-lager.dts 
b/arch/arm/boot/dts/r8a7790-lager.dts
index 5e43763..263c7b9 100644
--- a/arch/arm/boot/dts/r8a7790-lager.dts
+++ b/arch/arm/boot/dts/r8a7790-lager.dts
@@ -427,7 +427,12 @@
function = "usb2";
};
 
-   vin1_pins: vin1 {
+   vin0_pins: vin0 {
+   groups = "vin0_data24", "vin0_sync", "vin0_clkenb", "vin0_clk";
+   function = "vin0";
+   };
+
+   vin1_pins: vin {
groups = "vin1_data8", "vin1_clk";
function = "vin1";
};
@@ -608,6 +613,21 @@
reg = <0x12>;
};
 
+   hdmi-in@4c {
+   compatible = "adi,adv7612";
+   reg = <0x4c>;
+   interrupt-parent = <>;
+   interrupts = <20 IRQ_TYPE_LEVEL_LOW>;
+   remote = <>;
+   default-input = <0>;
+
+   port {
+   adv7612: endpoint {
+   remote-endpoint = <>;
+   };
+   };
+   };
+
composite-in@20 {
compatible = "adi,adv7180";
reg = <0x20>;
@@ -723,6 +743,25 @@
status = "okay";
 };
 
+/* HDMI video input */
+ {
+   pinctrl-0 = <_pins>;
+   pinctrl-names = "default";
+
+   status = "ok";
+
+   port {
+   vin0ep0: endpoint {
+   remote-endpoint = <>;
+   bus-width = <24>;
+   hsync-active = <0>;
+   vsync-active = <0>;
+   pclk-sample = <1>;
+   data-active = <1>;
+   };
+   };
+};
+
 /* composite video input */
  {
pinctrl-0 = <_pins>;
-- 
2.7.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 v5 4/4] rcar-vin: implement EDID control ioctls

2016-07-06 Thread Ulrich Hecht
Adds G_EDID and S_EDID.

Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 drivers/media/platform/rcar-vin/rcar-v4l2.c | 17 +
 1 file changed, 17 insertions(+)

diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c 
b/drivers/media/platform/rcar-vin/rcar-v4l2.c
index 396eabc..bd8f14c 100644
--- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
+++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
@@ -661,6 +661,20 @@ static int rvin_dv_timings_cap(struct file *file, void 
*priv_fh,
return ret;
 }
 
+static int rvin_g_edid(struct file *file, void *fh, struct v4l2_edid *edid)
+{
+   struct rvin_dev *vin = video_drvdata(file);
+
+   return rvin_subdev_call(vin, pad, get_edid, edid);
+}
+
+static int rvin_s_edid(struct file *file, void *fh, struct v4l2_edid *edid)
+{
+   struct rvin_dev *vin = video_drvdata(file);
+
+   return rvin_subdev_call(vin, pad, set_edid, edid);
+}
+
 static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
.vidioc_querycap= rvin_querycap,
.vidioc_try_fmt_vid_cap = rvin_try_fmt_vid_cap,
@@ -683,6 +697,9 @@ static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
.vidioc_s_dv_timings= rvin_s_dv_timings,
.vidioc_query_dv_timings= rvin_query_dv_timings,
 
+   .vidioc_g_edid  = rvin_g_edid,
+   .vidioc_s_edid  = rvin_s_edid,
+
.vidioc_querystd= rvin_querystd,
.vidioc_g_std   = rvin_g_std,
.vidioc_s_std   = rvin_s_std,
-- 
2.7.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 v5 3/4] ARM: dts: koelsch: add HDMI input

2016-07-06 Thread Ulrich Hecht
From: Hans Verkuil <hverk...@xs4all.nl>

Add support in the dts for the HDMI input. Based on the Lager dts
patch from Ultich Hecht.

Signed-off-by: Hans Verkuil <hans.verk...@cisco.com>
[uli: removed "renesas," prefixes from pfc nodes]
Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 arch/arm/boot/dts/r8a7791-koelsch.dts | 41 +++
 1 file changed, 41 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7791-koelsch.dts 
b/arch/arm/boot/dts/r8a7791-koelsch.dts
index f8a7d09..097322a 100644
--- a/arch/arm/boot/dts/r8a7791-koelsch.dts
+++ b/arch/arm/boot/dts/r8a7791-koelsch.dts
@@ -393,6 +393,11 @@
function = "usb1";
};
 
+   vin0_pins: vin0 {
+   groups = "vin0_data24", "vin0_sync", "vin0_clkenb", "vin0_clk";
+   function = "vin0";
+   };
+
vin1_pins: vin1 {
groups = "vin1_data8", "vin1_clk";
function = "vin1";
@@ -551,6 +556,21 @@
reg = <0x12>;
};
 
+   hdmi-in@4c {
+   compatible = "adi,adv7612";
+   reg = <0x4c>;
+   interrupt-parent = <>;
+   interrupts = <20 IRQ_TYPE_LEVEL_LOW>;
+   remote = <>;
+   default-input = <0>;
+
+   port {
+   adv7612: endpoint {
+   remote-endpoint = <>;
+   };
+   };
+   };
+
composite-in@20 {
compatible = "adi,adv7180";
reg = <0x20>;
@@ -672,6 +692,27 @@
cpu0-supply = <_dvfs>;
 };
 
+/* HDMI video input */
+ {
+   status = "okay";
+   pinctrl-0 = <_pins>;
+   pinctrl-names = "default";
+
+   port {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   vin0ep: endpoint {
+   remote-endpoint = <>;
+   bus-width = <24>;
+   hsync-active = <0>;
+   vsync-active = <0>;
+   pclk-sample = <1>;
+   data-active = <1>;
+   };
+   };
+};
+
 /* composite video input */
  {
status = "okay";
-- 
2.7.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 v4 5/8] media: rcar-vin: add DV timings support

2016-05-11 Thread Ulrich Hecht
Adds ioctls DV_TIMINGS_CAP, ENUM_DV_TIMINGS, G_DV_TIMINGS, S_DV_TIMINGS,
and QUERY_DV_TIMINGS.

Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 drivers/media/platform/rcar-vin/rcar-v4l2.c | 82 +
 1 file changed, 82 insertions(+)

diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c 
b/drivers/media/platform/rcar-vin/rcar-v4l2.c
index 3788f8a..10a5c10 100644
--- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
+++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
@@ -400,6 +400,10 @@ static int rvin_enum_input(struct file *file, void *priv,
 
i->type = V4L2_INPUT_TYPE_CAMERA;
i->std = vin->vdev.tvnorms;
+
+   if (v4l2_subdev_has_op(sd, pad, dv_timings_cap))
+   i->capabilities = V4L2_IN_CAP_DV_TIMINGS;
+
strlcpy(i->name, "Camera", sizeof(i->name));
 
return 0;
@@ -478,6 +482,78 @@ static int rvin_subscribe_event(struct v4l2_fh *fh,
return v4l2_ctrl_subscribe_event(fh, sub);
 }
 
+static int rvin_enum_dv_timings(struct file *file, void *priv_fh,
+   struct v4l2_enum_dv_timings *timings)
+{
+   struct rvin_dev *vin = video_drvdata(file);
+   struct v4l2_subdev *sd = vin_to_source(vin);
+   int pad, ret;
+
+   pad = timings->pad;
+   timings->pad = vin->src_pad_idx;
+
+   ret = v4l2_subdev_call(sd, pad, enum_dv_timings, timings);
+
+   timings->pad = pad;
+
+   return ret;
+}
+
+static int rvin_s_dv_timings(struct file *file, void *priv_fh,
+   struct v4l2_dv_timings *timings)
+{
+   struct rvin_dev *vin = video_drvdata(file);
+   struct v4l2_subdev *sd = vin_to_source(vin);
+   int err;
+
+   err = v4l2_subdev_call(sd,
+   video, s_dv_timings, timings);
+   if (!err) {
+   vin->source.width = timings->bt.width;
+   vin->source.height = timings->bt.height;
+   vin->format.width = timings->bt.width;
+   vin->format.height = timings->bt.height;
+   }
+   return err;
+}
+
+static int rvin_g_dv_timings(struct file *file, void *priv_fh,
+   struct v4l2_dv_timings *timings)
+{
+   struct rvin_dev *vin = video_drvdata(file);
+   struct v4l2_subdev *sd = vin_to_source(vin);
+
+   return v4l2_subdev_call(sd,
+   video, g_dv_timings, timings);
+}
+
+static int rvin_query_dv_timings(struct file *file, void *priv_fh,
+   struct v4l2_dv_timings *timings)
+{
+   struct rvin_dev *vin = video_drvdata(file);
+   struct v4l2_subdev *sd = vin_to_source(vin);
+
+   return v4l2_subdev_call(sd,
+   video, query_dv_timings, timings);
+}
+
+static int rvin_dv_timings_cap(struct file *file, void *priv_fh,
+   struct v4l2_dv_timings_cap *cap)
+{
+   struct rvin_dev *vin = video_drvdata(file);
+   struct v4l2_subdev *sd = vin_to_source(vin);
+   int pad, ret;
+
+   pad = cap->pad;
+   cap->pad = vin->src_pad_idx;
+
+   ret = v4l2_subdev_call(sd, pad, dv_timings_cap, cap);
+
+   cap->pad = pad;
+
+   return ret;
+}
+
 static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
.vidioc_querycap= rvin_querycap,
.vidioc_try_fmt_vid_cap = rvin_try_fmt_vid_cap,
@@ -494,6 +570,12 @@ static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
.vidioc_g_input = rvin_g_input,
.vidioc_s_input = rvin_s_input,
 
+   .vidioc_dv_timings_cap  = rvin_dv_timings_cap,
+   .vidioc_enum_dv_timings = rvin_enum_dv_timings,
+   .vidioc_g_dv_timings= rvin_g_dv_timings,
+   .vidioc_s_dv_timings= rvin_s_dv_timings,
+   .vidioc_query_dv_timings= rvin_query_dv_timings,
+
.vidioc_querystd= rvin_querystd,
.vidioc_g_std   = rvin_g_std,
.vidioc_s_std   = rvin_s_std,
-- 
2.7.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 v4 1/8] v4l: subdev: Add pad config allocator and init

2016-05-11 Thread Ulrich Hecht
From: Laurent Pinchart 

Add a new subdev operation to initialize a subdev pad config array, and
a helper function to allocate and initialize the array. This can be used
by bridge drivers to implement try format based on subdev pad
operations.

Signed-off-by: Laurent Pinchart 
Acked-by: Vaibhav Hiremath 
Acked-by: Hans Verkuil 
---
 drivers/media/v4l2-core/v4l2-subdev.c | 19 ++-
 include/media/v4l2-subdev.h   | 10 ++
 2 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/drivers/media/v4l2-core/v4l2-subdev.c 
b/drivers/media/v4l2-core/v4l2-subdev.c
index d630838..f32ac0d 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -35,7 +35,7 @@
 static int subdev_fh_init(struct v4l2_subdev_fh *fh, struct v4l2_subdev *sd)
 {
 #if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
-   fh->pad = kzalloc(sizeof(*fh->pad) * sd->entity.num_pads, GFP_KERNEL);
+   fh->pad = v4l2_subdev_alloc_pad_config(sd);
if (fh->pad == NULL)
return -ENOMEM;
 #endif
@@ -569,6 +569,23 @@ int v4l2_subdev_link_validate(struct media_link *link)
sink, link, _fmt, _fmt);
 }
 EXPORT_SYMBOL_GPL(v4l2_subdev_link_validate);
+
+struct v4l2_subdev_pad_config *v4l2_subdev_alloc_pad_config(struct v4l2_subdev 
*sd)
+{
+   struct v4l2_subdev_pad_config *cfg;
+
+   if (!sd->entity.num_pads)
+   return NULL;
+
+   cfg = kcalloc(sd->entity.num_pads, sizeof(*cfg), GFP_KERNEL);
+   if (!cfg)
+   return NULL;
+
+   v4l2_subdev_call(sd, pad, init_cfg, cfg);
+
+   return cfg;
+}
+EXPORT_SYMBOL_GPL(v4l2_subdev_alloc_pad_config);
 #endif /* CONFIG_MEDIA_CONTROLLER */
 
 void v4l2_subdev_init(struct v4l2_subdev *sd, const struct v4l2_subdev_ops 
*ops)
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 11e2dfe..6c47cdd 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -607,6 +607,8 @@ struct v4l2_subdev_pad_config {
  *  may be adjusted by the subdev driver to device 
capabilities.
  */
 struct v4l2_subdev_pad_ops {
+   void (*init_cfg)(struct v4l2_subdev *sd,
+struct v4l2_subdev_pad_config *cfg);
int (*enum_mbus_code)(struct v4l2_subdev *sd,
  struct v4l2_subdev_pad_config *cfg,
  struct v4l2_subdev_mbus_code_enum *code);
@@ -801,7 +803,15 @@ int v4l2_subdev_link_validate_default(struct v4l2_subdev 
*sd,
  struct v4l2_subdev_format *source_fmt,
  struct v4l2_subdev_format *sink_fmt);
 int v4l2_subdev_link_validate(struct media_link *link);
+
+struct v4l2_subdev_pad_config *v4l2_subdev_alloc_pad_config(struct v4l2_subdev 
*sd);
+
+static inline void v4l2_subdev_free_pad_config(struct v4l2_subdev_pad_config 
*cfg)
+{
+   kfree(cfg);
+}
 #endif /* CONFIG_MEDIA_CONTROLLER */
+
 void v4l2_subdev_init(struct v4l2_subdev *sd,
  const struct v4l2_subdev_ops *ops);
 
-- 
2.7.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 v4 7/8] ARM: dts: lager: Add entries for VIN HDMI input support

2016-05-11 Thread Ulrich Hecht
From: William Towle <william.to...@codethink.co.uk>

Add DT entries for vin0, vin0_pins, and adv7612.

Sets the 'default-input' property for ADV7612, enabling image and video
capture without the need to have userspace specifying routing.

Signed-off-by: William Towle <william.to...@codethink.co.uk>
Signed-off-by: Rob Taylor <rob.tay...@codethink.co.uk>
[uli: added interrupt, renamed endpoint, merged default-input]
Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 arch/arm/boot/dts/r8a7790-lager.dts | 39 +
 1 file changed, 39 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7790-lager.dts 
b/arch/arm/boot/dts/r8a7790-lager.dts
index 749ba02..7e53f5c 100644
--- a/arch/arm/boot/dts/r8a7790-lager.dts
+++ b/arch/arm/boot/dts/r8a7790-lager.dts
@@ -427,6 +427,11 @@
function = "usb2";
};
 
+   vin0_pins: vin0 {
+   groups = "vin0_data24", "vin0_sync", "vin0_clkenb", "vin0_clk";
+   function = "vin0";
+   };
+
vin1_pins: vin {
groups = "vin1_data8", "vin1_clk";
function = "vin1";
@@ -607,6 +612,21 @@
reg = <0x12>;
};
 
+   hdmi-in@4c {
+   compatible = "adi,adv7612";
+   reg = <0x4c>;
+   interrupt-parent = <>;
+   interrupts = <20 IRQ_TYPE_LEVEL_LOW>;
+   remote = <>;
+   default-input = <0>;
+
+   port {
+   adv7612: endpoint {
+   remote-endpoint = <>;
+   };
+   };
+   };
+
composite-in@20 {
compatible = "adi,adv7180";
reg = <0x20>;
@@ -722,6 +742,25 @@
status = "okay";
 };
 
+/* HDMI video input */
+ {
+   pinctrl-0 = <_pins>;
+   pinctrl-names = "default";
+
+   status = "ok";
+
+   port {
+   vin0ep0: endpoint {
+   remote-endpoint = <>;
+   bus-width = <24>;
+   hsync-active = <0>;
+   vsync-active = <0>;
+   pclk-sample = <1>;
+   data-active = <1>;
+   };
+   };
+};
+
 /* composite video input */
  {
pinctrl-0 = <_pins>;
-- 
2.7.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 v4 8/8] r8a7791-koelsch.dts: add HDMI input

2016-05-11 Thread Ulrich Hecht
From: Hans Verkuil <hverk...@xs4all.nl>

Add support in the dts for the HDMI input. Based on the Lager dts
patch from Ultich Hecht.

Signed-off-by: Hans Verkuil <hans.verk...@cisco.com>
[uli: removed "renesas," prefixes from pfc nodes]
Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 arch/arm/boot/dts/r8a7791-koelsch.dts | 41 +++
 1 file changed, 41 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7791-koelsch.dts 
b/arch/arm/boot/dts/r8a7791-koelsch.dts
index da59c28..a96e3fa 100644
--- a/arch/arm/boot/dts/r8a7791-koelsch.dts
+++ b/arch/arm/boot/dts/r8a7791-koelsch.dts
@@ -393,6 +393,11 @@
function = "usb1";
};
 
+   vin0_pins: vin0 {
+   groups = "vin0_data24", "vin0_sync", "vin0_clkenb", "vin0_clk";
+   function = "vin0";
+   };
+
vin1_pins: vin1 {
groups = "vin1_data8", "vin1_clk";
function = "vin1";
@@ -551,6 +556,21 @@
reg = <0x12>;
};
 
+   hdmi-in@4c {
+   compatible = "adi,adv7612";
+   reg = <0x4c>;
+   interrupt-parent = <>;
+   interrupts = <20 IRQ_TYPE_LEVEL_LOW>;
+   remote = <>;
+   default-input = <0>;
+
+   port {
+   adv7612: endpoint {
+   remote-endpoint = <>;
+   };
+   };
+   };
+
composite-in@20 {
compatible = "adi,adv7180";
reg = <0x20>;
@@ -672,6 +692,27 @@
cpu0-supply = <_dvfs>;
 };
 
+/* HDMI video input */
+ {
+   status = "okay";
+   pinctrl-0 = <_pins>;
+   pinctrl-names = "default";
+
+   port {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   vin0ep: endpoint {
+   remote-endpoint = <>;
+   bus-width = <24>;
+   hsync-active = <0>;
+   vsync-active = <0>;
+   pclk-sample = <1>;
+   data-active = <1>;
+   };
+   };
+};
+
 /* composite video input */
  {
status = "okay";
-- 
2.7.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 v4 3/8] media: rcar_vin: Use correct pad number in try_fmt

2016-05-11 Thread Ulrich Hecht
Fix rcar_vin_try_fmt's use of an inappropriate pad number when calling
the subdev set_fmt function - for the ADV7612, IDs should be non-zero.

Signed-off-by: William Towle <william.to...@codethink.co.uk>
Reviewed-by: Rob Taylor <rob.tay...@codethink.co.uk>
Acked-by: Hans Verkuil <hans.verk...@cisco.com>
[uli: adapted to rcar-vin rewrite]
Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 drivers/media/platform/rcar-vin/rcar-v4l2.c | 14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c 
b/drivers/media/platform/rcar-vin/rcar-v4l2.c
index 0bc4487..42dbd35 100644
--- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
+++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
@@ -98,7 +98,7 @@ static int __rvin_try_format_source(struct rvin_dev *vin,
struct rvin_source_fmt *source)
 {
struct v4l2_subdev *sd;
-   struct v4l2_subdev_pad_config pad_cfg;
+   struct v4l2_subdev_pad_config *pad_cfg;
struct v4l2_subdev_format format = {
.which = which,
};
@@ -108,10 +108,16 @@ static int __rvin_try_format_source(struct rvin_dev *vin,
 
v4l2_fill_mbus_format(, pix, vin->source.code);
 
+   pad_cfg = v4l2_subdev_alloc_pad_config(sd);
+   if (pad_cfg == NULL)
+   return -ENOMEM;
+
+   format.pad = vin->src_pad_idx;
+
ret = v4l2_device_call_until_err(sd->v4l2_dev, 0, pad, set_fmt,
-_cfg, );
+pad_cfg, );
if (ret < 0)
-   return ret;
+   goto cleanup;
 
v4l2_fill_pix_format(pix, );
 
@@ -121,6 +127,8 @@ static int __rvin_try_format_source(struct rvin_dev *vin,
vin_dbg(vin, "Source resolution: %ux%u\n", source->width,
source->height);
 
+cleanup:
+   v4l2_subdev_free_pad_config(pad_cfg);
return 0;
 }
 
-- 
2.7.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 v4 2/8] media: adv7604: automatic "default-input" selection

2016-05-11 Thread Ulrich Hecht
From: William Towle <william.to...@codethink.co.uk>

Add logic such that the "default-input" property becomes unnecessary
for chips that only have one suitable input (ADV7611 by design, and
ADV7612 due to commit 7111cddd518f ("[media] media: adv7604: reduce
support to first (digital) input").

Additionally, Ian's documentation in commit bf9c82278c34 ("[media]
media: adv7604: ability to read default input port from DT") states
that the "default-input" property should reside directly in the node
for adv7612. Hence, also adjust the parsing to make the implementation
consistent with this.

Signed-off-by: William Towle <william.to...@codethink.co.uk>
Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 drivers/media/i2c/adv7604.c | 18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 41a1bfc..d722c16 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -2788,7 +2788,7 @@ static int adv76xx_parse_dt(struct adv76xx_state *state)
struct device_node *np;
unsigned int flags;
int ret;
-   u32 v;
+   u32 v = -1;
 
np = state->i2c_clients[ADV76XX_PAGE_IO]->dev.of_node;
 
@@ -2810,6 +2810,22 @@ static int adv76xx_parse_dt(struct adv76xx_state *state)
 
of_node_put(endpoint);
 
+   if (of_property_read_u32(np, "default-input", )) {
+   /* not specified ... can we choose automatically? */
+   switch (state->info->type) {
+   case ADV7611:
+   v = 0;
+   break;
+   case ADV7612:
+   if (state->info->max_port == ADV76XX_PAD_HDMI_PORT_A)
+   v = 0;
+   /* else is unhobbled, leave unspecified */
+   default:
+   break;
+   }
+   }
+   state->pdata.default_input = v;
+
flags = bus_cfg.bus.parallel.flags;
 
if (flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH)
-- 
2.7.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 v4 4/8] media: rcar-vin: pad-aware driver initialisation

2016-05-11 Thread Ulrich Hecht
Add detection of source pad number for drivers aware of the media controller
API, so that rcar-vin can create device nodes to support modern drivers such
as adv7604.c (for HDMI on Lager) and the converted adv7180.c (for composite)
underneath.

Building rcar_vin gains a dependency on CONFIG_MEDIA_CONTROLLER, in
line with requirements for building the drivers associated with it.

Signed-off-by: William Towle <william.to...@codethink.co.uk>
Signed-off-by: Rob Taylor <rob.tay...@codethink.co.uk>
[uli: adapted to rcar-vin rewrite]
Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 drivers/media/platform/rcar-vin/rcar-v4l2.c | 16 
 drivers/media/platform/rcar-vin/rcar-vin.h  |  2 ++
 2 files changed, 18 insertions(+)

diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c 
b/drivers/media/platform/rcar-vin/rcar-v4l2.c
index 42dbd35..3788f8a 100644
--- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
+++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
@@ -691,6 +691,9 @@ int rvin_v4l2_probe(struct rvin_dev *vin)
struct v4l2_mbus_framefmt *mf = 
struct video_device *vdev = >vdev;
struct v4l2_subdev *sd = vin_to_source(vin);
+#if defined(CONFIG_MEDIA_CONTROLLER)
+   int pad_idx;
+#endif
int ret;
 
v4l2_set_subdev_hostdata(sd, vin);
@@ -737,6 +740,19 @@ int rvin_v4l2_probe(struct rvin_dev *vin)
vdev->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING |
V4L2_CAP_READWRITE;
 
+   vin->src_pad_idx = 0;
+#if defined(CONFIG_MEDIA_CONTROLLER)
+   for (pad_idx = 0; pad_idx < sd->entity.num_pads; pad_idx++)
+   if (sd->entity.pads[pad_idx].flags
+   == MEDIA_PAD_FL_SOURCE)
+   break;
+   if (pad_idx >= sd->entity.num_pads)
+   return -EINVAL;
+
+   vin->src_pad_idx = pad_idx;
+#endif
+   fmt.pad = vin->src_pad_idx;
+
/* Try to improve our guess of a reasonable window format */
ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, );
if (ret) {
diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h 
b/drivers/media/platform/rcar-vin/rcar-vin.h
index 544a3b3..a6dd6db 100644
--- a/drivers/media/platform/rcar-vin/rcar-vin.h
+++ b/drivers/media/platform/rcar-vin/rcar-vin.h
@@ -87,6 +87,7 @@ struct rvin_graph_entity {
  *
  * @vdev:  V4L2 video device associated with VIN
  * @v4l2_dev:  V4L2 device
+ * @src_pad_idx:   source pad index for media controller drivers
  * @ctrl_handler:  V4L2 control handler
  * @notifier:  V4L2 asynchronous subdevs notifier
  * @entity:entity in the DT for subdevice
@@ -117,6 +118,7 @@ struct rvin_dev {
 
struct video_device vdev;
struct v4l2_device v4l2_dev;
+   int src_pad_idx;
struct v4l2_ctrl_handler ctrl_handler;
struct v4l2_async_notifier notifier;
struct rvin_graph_entity entity;
-- 
2.7.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 v4 6/8] media: rcar-vin: initialize EDID data

2016-05-11 Thread Ulrich Hecht
Initializes the decoder subdevice with a fixed EDID blob.

Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 drivers/media/platform/rcar-vin/rcar-v4l2.c | 46 +
 1 file changed, 46 insertions(+)

diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c 
b/drivers/media/platform/rcar-vin/rcar-v4l2.c
index 10a5c10..5bb3c3b 100644
--- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
+++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
@@ -765,6 +765,41 @@ static void rvin_notify(struct v4l2_subdev *sd,
}
 }
 
+static u8 edid[256] = {
+   0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00,
+   0x48, 0xAE, 0x9C, 0x27, 0x00, 0x00, 0x00, 0x00,
+   0x19, 0x12, 0x01, 0x03, 0x80, 0x00, 0x00, 0x78,
+   0x0E, 0x00, 0xB2, 0xA0, 0x57, 0x49, 0x9B, 0x26,
+   0x10, 0x48, 0x4F, 0x2F, 0xCF, 0x00, 0x31, 0x59,
+   0x45, 0x59, 0x61, 0x59, 0x81, 0x99, 0x01, 0x01,
+   0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x3A,
+   0x80, 0x18, 0x71, 0x38, 0x2D, 0x40, 0x58, 0x2C,
+   0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E,
+   0x00, 0x00, 0x00, 0xFD, 0x00, 0x31, 0x55, 0x18,
+   0x5E, 0x11, 0x00, 0x0A, 0x20, 0x20, 0x20, 0x20,
+   0x20, 0x20, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x43,
+   0x20, 0x39, 0x30, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A,
+   0x0A, 0x0A, 0x0A, 0x0A, 0x00, 0x00, 0x00, 0x10,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x68,
+   0x02, 0x03, 0x1a, 0xc0, 0x48, 0xa2, 0x10, 0x04,
+   0x02, 0x01, 0x21, 0x14, 0x13, 0x23, 0x09, 0x07,
+   0x07, 0x65, 0x03, 0x0c, 0x00, 0x10, 0x00, 0xe2,
+   0x00, 0x2a, 0x01, 0x1d, 0x00, 0x80, 0x51, 0xd0,
+   0x1c, 0x20, 0x40, 0x80, 0x35, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x1e, 0x8c, 0x0a, 0xd0, 0x8a,
+   0x20, 0xe0, 0x2d, 0x10, 0x10, 0x3e, 0x96, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd7
+};
+
 int rvin_v4l2_probe(struct rvin_dev *vin)
 {
struct v4l2_subdev_format fmt = {
@@ -870,5 +905,16 @@ int rvin_v4l2_probe(struct rvin_dev *vin)
v4l2_info(>v4l2_dev, "Device registered as %s\n",
  video_device_node_name(>vdev));
 
+   {
+   struct v4l2_subdev_edid rvin_edid = {
+   .pad = 0,
+   .start_block = 0,
+   .blocks = 2,
+   .edid = edid,
+   };
+   v4l2_subdev_call(sd, pad, set_edid,
+   _edid);
+   }
+
return ret;
 }
-- 
2.7.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 v4 0/8] Lager/Koelsch board HDMI input support

2016-05-11 Thread Ulrich Hecht
Hi!

This series implements Lager/Koelsch HDMI input support on top of version 6
of Niklas's rcar-vin rewrite ("[PATCHv6] [media] rcar-vin: add Renesas R-Car
VIN driver").

This revision addresses the issues found in Hans Verkuil's review of the series
(except for the EDID intialization, which I have left in), and adds his Koelsch
support patch.

CU
Uli


Changes since v3:
- rvin_enum_dv_timings(): use vin->src_pad_idx
- rvin_dv_timings_cap(): likewise
- rvin_s_dv_timings(): update vin->format
- add Koelsch support

Changes since v2:
- rebased on top of rcar-vin driver v4
- removed "adv7604: fix SPA register location for ADV7612" (picked up)
- changed prefix of dts patch to "ARM: dts: lager: "


Hans Verkuil (1):
  r8a7791-koelsch.dts: add HDMI input

Laurent Pinchart (1):
  v4l: subdev: Add pad config allocator and init

Ulrich Hecht (4):
  media: rcar_vin: Use correct pad number in try_fmt
  media: rcar-vin: pad-aware driver initialisation
  media: rcar-vin: add DV timings support
  media: rcar-vin: initialize EDID data

William Towle (2):
  media: adv7604: automatic "default-input" selection
  ARM: dts: lager: Add entries for VIN HDMI input support

 arch/arm/boot/dts/r8a7790-lager.dts |  39 +++
 arch/arm/boot/dts/r8a7791-koelsch.dts   |  41 
 drivers/media/i2c/adv7604.c |  18 +++-
 drivers/media/platform/rcar-vin/rcar-v4l2.c | 158 +++-
 drivers/media/platform/rcar-vin/rcar-vin.h  |   2 +
 drivers/media/v4l2-core/v4l2-subdev.c   |  19 +++-
 include/media/v4l2-subdev.h |  10 ++
 7 files changed, 282 insertions(+), 5 deletions(-)

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


Re: [PATCH v3 6/7] media: rcar-vin: initialize EDID data

2016-04-20 Thread Ulrich Hecht
On Mon, Apr 18, 2016 at 12:13 PM, Hans Verkuil  wrote:
> Where does this EDID come from? I'm just wondering if it has been
> adjusted for the capabilities of the adv.

It's from the cobalt driver, with only the vendor ID changed.

CU
Uli
--
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 5/7] media: rcar-vin: add DV timings support

2016-04-20 Thread Ulrich Hecht
On Mon, Apr 18, 2016 at 12:04 PM, Hans Verkuil  wrote:
> Hi Ulrich,
>
> This isn't right: this just overwrites the adv7180 input with an HDMI input.
>
> I assume the intention is to have support for both adv7180 and HDMI input and
> to use VIDIOC_S_INPUT to select between the two.

I'm not quite sure what you mean.  The inputs are always hardwired to
one specific decoder, no switching possible.

CU
Uli
--
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] r8a7791-koelsch.dts: add HDMI input

2016-04-20 Thread Ulrich Hecht
On Mon, Apr 18, 2016 at 11:38 AM, Hans Verkuil  wrote:
> Add support in the dts for the HDMI input. Based on the Lager dts
> patch from Ultich Hecht.
>
> Signed-off-by: Hans Verkuil 
> ---
> Ulrich, can you add this patch to your r-car HDMI patch series?

Can do.

CU
Uli
--
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 v3 4/7] media: rcar-vin: pad-aware driver initialisation

2016-04-14 Thread Ulrich Hecht
Add detection of source pad number for drivers aware of the media controller
API, so that rcar-vin can create device nodes to support modern drivers such
as adv7604.c (for HDMI on Lager) and the converted adv7180.c (for composite)
underneath.

Building rcar_vin gains a dependency on CONFIG_MEDIA_CONTROLLER, in
line with requirements for building the drivers associated with it.

Signed-off-by: William Towle <william.to...@codethink.co.uk>
Signed-off-by: Rob Taylor <rob.tay...@codethink.co.uk>
[uli: adapted to rcar-vin rewrite]
Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 drivers/media/platform/rcar-vin/rcar-v4l2.c | 16 
 drivers/media/platform/rcar-vin/rcar-vin.h  |  2 ++
 2 files changed, 18 insertions(+)

diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c 
b/drivers/media/platform/rcar-vin/rcar-v4l2.c
index 43aec3c..d8d5f3a 100644
--- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
+++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
@@ -659,6 +659,9 @@ int rvin_v4l2_probe(struct rvin_dev *vin)
struct v4l2_mbus_framefmt *mf = 
struct video_device *vdev = >vdev;
struct v4l2_subdev *sd = vin_to_sd(vin);
+#if defined(CONFIG_MEDIA_CONTROLLER)
+   int pad_idx;
+#endif
int ret;
 
v4l2_set_subdev_hostdata(sd, vin);
@@ -701,6 +704,19 @@ int rvin_v4l2_probe(struct rvin_dev *vin)
vdev->lock = >lock;
vdev->ctrl_handler = >ctrl_handler;
 
+   vin->src_pad_idx = 0;
+#if defined(CONFIG_MEDIA_CONTROLLER)
+   for (pad_idx = 0; pad_idx < sd->entity.num_pads; pad_idx++)
+   if (sd->entity.pads[pad_idx].flags
+   == MEDIA_PAD_FL_SOURCE)
+   break;
+   if (pad_idx >= sd->entity.num_pads)
+   return -EINVAL;
+
+   vin->src_pad_idx = pad_idx;
+#endif
+   fmt.pad = vin->src_pad_idx;
+
/* Try to improve our guess of a reasonable window format */
ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, );
if (ret) {
diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h 
b/drivers/media/platform/rcar-vin/rcar-vin.h
index 01c5086..959f5da 100644
--- a/drivers/media/platform/rcar-vin/rcar-vin.h
+++ b/drivers/media/platform/rcar-vin/rcar-vin.h
@@ -87,6 +87,7 @@ struct rvin_graph_entity {
  *
  * @vdev:  V4L2 video device associated with VIN
  * @v4l2_dev:  V4L2 device
+ * @src_pad_idx:   source pad index for media controller drivers
  * @ctrl_handler:  V4L2 control handler
  * @notifier:  V4L2 asynchronous subdevs notifier
  * @entity:entity in the DT for subdevice
@@ -118,6 +119,7 @@ struct rvin_dev {
 
struct video_device vdev;
struct v4l2_device v4l2_dev;
+   int src_pad_idx;
struct v4l2_ctrl_handler ctrl_handler;
struct v4l2_async_notifier notifier;
struct rvin_graph_entity entity;
-- 
2.7.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 v3 5/7] media: rcar-vin: add DV timings support

2016-04-14 Thread Ulrich Hecht
Adds ioctls DV_TIMINGS_CAP, ENUM_DV_TIMINGS, G_DV_TIMINGS, S_DV_TIMINGS,
and QUERY_DV_TIMINGS.

Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 drivers/media/platform/rcar-vin/rcar-v4l2.c | 69 +
 1 file changed, 69 insertions(+)

diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c 
b/drivers/media/platform/rcar-vin/rcar-v4l2.c
index d8d5f3a..ba2ed4e 100644
--- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
+++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
@@ -413,12 +413,17 @@ static int rvin_enum_input(struct file *file, void *priv,
   struct v4l2_input *i)
 {
struct rvin_dev *vin = video_drvdata(file);
+   struct v4l2_subdev *sd = vin_to_sd(vin);
 
if (i->index != 0)
return -EINVAL;
 
i->type = V4L2_INPUT_TYPE_CAMERA;
i->std = vin->vdev.tvnorms;
+
+   if (v4l2_subdev_has_op(sd, pad, dv_timings_cap))
+   i->capabilities = V4L2_IN_CAP_DV_TIMINGS;
+
strlcpy(i->name, "Camera", sizeof(i->name));
 
return 0;
@@ -461,6 +466,64 @@ static int rvin_g_std(struct file *file, void *priv, 
v4l2_std_id *a)
return v4l2_subdev_call(sd, video, g_std, a);
 }
 
+static int rvin_enum_dv_timings(struct file *file, void *priv_fh,
+   struct v4l2_enum_dv_timings *timings)
+{
+   struct rvin_dev *vin = video_drvdata(file);
+   struct v4l2_subdev *sd = vin_to_sd(vin);
+
+   timings->pad = 0;
+   return v4l2_subdev_call(sd,
+   pad, enum_dv_timings, timings);
+}
+
+static int rvin_s_dv_timings(struct file *file, void *priv_fh,
+   struct v4l2_dv_timings *timings)
+{
+   struct rvin_dev *vin = video_drvdata(file);
+   struct v4l2_subdev *sd = vin_to_sd(vin);
+   int err;
+
+   err = v4l2_subdev_call(sd,
+   video, s_dv_timings, timings);
+   if (!err) {
+   vin->sensor.width = timings->bt.width;
+   vin->sensor.height = timings->bt.height;
+   }
+   return err;
+}
+
+static int rvin_g_dv_timings(struct file *file, void *priv_fh,
+   struct v4l2_dv_timings *timings)
+{
+   struct rvin_dev *vin = video_drvdata(file);
+   struct v4l2_subdev *sd = vin_to_sd(vin);
+
+   return v4l2_subdev_call(sd,
+   video, g_dv_timings, timings);
+}
+
+static int rvin_query_dv_timings(struct file *file, void *priv_fh,
+   struct v4l2_dv_timings *timings)
+{
+   struct rvin_dev *vin = video_drvdata(file);
+   struct v4l2_subdev *sd = vin_to_sd(vin);
+
+   return v4l2_subdev_call(sd,
+   video, query_dv_timings, timings);
+}
+
+static int rvin_dv_timings_cap(struct file *file, void *priv_fh,
+   struct v4l2_dv_timings_cap *cap)
+{
+   struct rvin_dev *vin = video_drvdata(file);
+   struct v4l2_subdev *sd = vin_to_sd(vin);
+
+   cap->pad = 0;
+   return v4l2_subdev_call(sd,
+   pad, dv_timings_cap, cap);
+}
+
 static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
.vidioc_querycap= rvin_querycap,
.vidioc_try_fmt_vid_cap = rvin_try_fmt_vid_cap,
@@ -477,6 +540,12 @@ static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
.vidioc_g_input = rvin_g_input,
.vidioc_s_input = rvin_s_input,
 
+   .vidioc_dv_timings_cap  = rvin_dv_timings_cap,
+   .vidioc_enum_dv_timings = rvin_enum_dv_timings,
+   .vidioc_g_dv_timings= rvin_g_dv_timings,
+   .vidioc_s_dv_timings= rvin_s_dv_timings,
+   .vidioc_query_dv_timings= rvin_query_dv_timings,
+
.vidioc_querystd= rvin_querystd,
.vidioc_g_std   = rvin_g_std,
.vidioc_s_std   = rvin_s_std,
-- 
2.7.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 v3 3/7] media: rcar_vin: Use correct pad number in try_fmt

2016-04-14 Thread Ulrich Hecht
Fix rcar_vin_try_fmt's use of an inappropriate pad number when calling
the subdev set_fmt function - for the ADV7612, IDs should be non-zero.

Signed-off-by: William Towle <william.to...@codethink.co.uk>
Reviewed-by: Rob Taylor <rob.tay...@codethink.co.uk>
Acked-by: Hans Verkuil <hans.verk...@cisco.com>
[uli: adapted to rcar-vin rewrite]
Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 drivers/media/platform/rcar-vin/rcar-v4l2.c | 14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c 
b/drivers/media/platform/rcar-vin/rcar-v4l2.c
index a752171..43aec3c 100644
--- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
+++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
@@ -97,7 +97,7 @@ static int __rvin_try_format_sensor(struct rvin_dev *vin,
struct rvin_sensor *sensor)
 {
struct v4l2_subdev *sd;
-   struct v4l2_subdev_pad_config pad_cfg;
+   struct v4l2_subdev_pad_config *pad_cfg;
struct v4l2_subdev_format format = {
.which = which,
};
@@ -105,12 +105,18 @@ static int __rvin_try_format_sensor(struct rvin_dev *vin,
 
sd = vin_to_sd(vin);
 
+   pad_cfg = v4l2_subdev_alloc_pad_config(sd);
+   if (pad_cfg == NULL)
+   return -ENOMEM;
+
v4l2_fill_mbus_format(, pix, vin->sensor.code);
 
+   format.pad = vin->src_pad_idx;
+
ret = v4l2_device_call_until_err(sd->v4l2_dev, 0, pad, set_fmt,
-_cfg, );
+pad_cfg, );
if (ret < 0)
-   return ret;
+   goto cleanup;
 
v4l2_fill_pix_format(pix, );
 
@@ -119,6 +125,8 @@ static int __rvin_try_format_sensor(struct rvin_dev *vin,
 
vin_dbg(vin, "Sensor format: %ux%u\n", sensor->width, sensor->height);
 
+cleanup:
+   v4l2_subdev_free_pad_config(pad_cfg);
return 0;
 }
 
-- 
2.7.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 v3 7/7] ARM: dts: lager: Add entries for VIN HDMI input support

2016-04-14 Thread Ulrich Hecht
From: William Towle <william.to...@codethink.co.uk>

Add DT entries for vin0, vin0_pins, and adv7612.

Sets the 'default-input' property for ADV7612, enabling image and video
capture without the need to have userspace specifying routing.

Signed-off-by: William Towle <william.to...@codethink.co.uk>
Signed-off-by: Rob Taylor <rob.tay...@codethink.co.uk>
[uli: added interrupt, renamed endpoint, merged default-input]
Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 arch/arm/boot/dts/r8a7790-lager.dts | 41 -
 1 file changed, 40 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/r8a7790-lager.dts 
b/arch/arm/boot/dts/r8a7790-lager.dts
index aa6ca92..eed0974 100644
--- a/arch/arm/boot/dts/r8a7790-lager.dts
+++ b/arch/arm/boot/dts/r8a7790-lager.dts
@@ -414,7 +414,12 @@
renesas,function = "usb2";
};
 
-   vin1_pins: vin {
+   vin0_pins: vin0 {
+   renesas,groups = "vin0_data24", "vin0_sync", "vin0_clkenb", 
"vin0_clk";
+   renesas,function = "vin0";
+   };
+
+   vin1_pins: vin1 {
renesas,groups = "vin1_data8", "vin1_clk";
renesas,function = "vin1";
};
@@ -590,6 +595,21 @@
reg = <0x12>;
};
 
+   hdmi-in@4c {
+   compatible = "adi,adv7612";
+   reg = <0x4c>;
+   interrupt-parent = <>;
+   interrupts = <20 IRQ_TYPE_LEVEL_LOW>;
+   remote = <>;
+   default-input = <0>;
+
+   port {
+   adv7612: endpoint {
+   remote-endpoint = <>;
+   };
+   };
+   };
+
composite-in@20 {
compatible = "adi,adv7180";
reg = <0x20>;
@@ -705,6 +725,25 @@
status = "okay";
 };
 
+/* HDMI video input */
+ {
+   pinctrl-0 = <_pins>;
+   pinctrl-names = "default";
+
+   status = "ok";
+
+   port {
+   vin0ep0: endpoint {
+   remote-endpoint = <>;
+   bus-width = <24>;
+   hsync-active = <0>;
+   vsync-active = <0>;
+   pclk-sample = <1>;
+   data-active = <1>;
+   };
+   };
+};
+
 /* composite video input */
  {
pinctrl-0 = <_pins>;
-- 
2.7.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 v3 6/7] media: rcar-vin: initialize EDID data

2016-04-14 Thread Ulrich Hecht
Initializes the decoder subdevice with a fixed EDID blob.

Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 drivers/media/platform/rcar-vin/rcar-v4l2.c | 46 +
 1 file changed, 46 insertions(+)

diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c 
b/drivers/media/platform/rcar-vin/rcar-v4l2.c
index ba2ed4e..5b32105 100644
--- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
+++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
@@ -720,6 +720,41 @@ void rvin_v4l2_remove(struct rvin_dev *vin)
video_unregister_device(>vdev);
 }
 
+static u8 edid[256] = {
+   0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00,
+   0x48, 0xAE, 0x9C, 0x27, 0x00, 0x00, 0x00, 0x00,
+   0x19, 0x12, 0x01, 0x03, 0x80, 0x00, 0x00, 0x78,
+   0x0E, 0x00, 0xB2, 0xA0, 0x57, 0x49, 0x9B, 0x26,
+   0x10, 0x48, 0x4F, 0x2F, 0xCF, 0x00, 0x31, 0x59,
+   0x45, 0x59, 0x61, 0x59, 0x81, 0x99, 0x01, 0x01,
+   0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x3A,
+   0x80, 0x18, 0x71, 0x38, 0x2D, 0x40, 0x58, 0x2C,
+   0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E,
+   0x00, 0x00, 0x00, 0xFD, 0x00, 0x31, 0x55, 0x18,
+   0x5E, 0x11, 0x00, 0x0A, 0x20, 0x20, 0x20, 0x20,
+   0x20, 0x20, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x43,
+   0x20, 0x39, 0x30, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A,
+   0x0A, 0x0A, 0x0A, 0x0A, 0x00, 0x00, 0x00, 0x10,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x68,
+   0x02, 0x03, 0x1a, 0xc0, 0x48, 0xa2, 0x10, 0x04,
+   0x02, 0x01, 0x21, 0x14, 0x13, 0x23, 0x09, 0x07,
+   0x07, 0x65, 0x03, 0x0c, 0x00, 0x10, 0x00, 0xe2,
+   0x00, 0x2a, 0x01, 0x1d, 0x00, 0x80, 0x51, 0xd0,
+   0x1c, 0x20, 0x40, 0x80, 0x35, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x1e, 0x8c, 0x0a, 0xd0, 0x8a,
+   0x20, 0xe0, 0x2d, 0x10, 0x10, 0x3e, 0x96, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd7
+};
+
 int rvin_v4l2_probe(struct rvin_dev *vin)
 {
struct v4l2_subdev_format fmt = {
@@ -821,5 +856,16 @@ int rvin_v4l2_probe(struct rvin_dev *vin)
v4l2_info(>v4l2_dev, "Device registered as %s\n",
  video_device_node_name(>vdev));
 
+   {
+   struct v4l2_subdev_edid rvin_edid = {
+   .pad = 0,
+   .start_block = 0,
+   .blocks = 2,
+   .edid = edid,
+   };
+   v4l2_subdev_call(sd, pad, set_edid,
+   _edid);
+   }
+
return ret;
 }
-- 
2.7.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 v3 2/7] media: adv7604: automatic "default-input" selection

2016-04-14 Thread Ulrich Hecht
From: William Towle <william.to...@codethink.co.uk>

Add logic such that the "default-input" property becomes unnecessary
for chips that only have one suitable input (ADV7611 by design, and
ADV7612 due to commit 7111cddd518f ("[media] media: adv7604: reduce
support to first (digital) input").

Additionally, Ian's documentation in commit bf9c82278c34 ("[media]
media: adv7604: ability to read default input port from DT") states
that the "default-input" property should reside directly in the node
for adv7612. Hence, also adjust the parsing to make the implementation
consistent with this.

Signed-off-by: William Towle <william.to...@codethink.co.uk>
Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 drivers/media/i2c/adv7604.c | 18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 41a1bfc..d722c16 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -2788,7 +2788,7 @@ static int adv76xx_parse_dt(struct adv76xx_state *state)
struct device_node *np;
unsigned int flags;
int ret;
-   u32 v;
+   u32 v = -1;
 
np = state->i2c_clients[ADV76XX_PAGE_IO]->dev.of_node;
 
@@ -2810,6 +2810,22 @@ static int adv76xx_parse_dt(struct adv76xx_state *state)
 
of_node_put(endpoint);
 
+   if (of_property_read_u32(np, "default-input", )) {
+   /* not specified ... can we choose automatically? */
+   switch (state->info->type) {
+   case ADV7611:
+   v = 0;
+   break;
+   case ADV7612:
+   if (state->info->max_port == ADV76XX_PAD_HDMI_PORT_A)
+   v = 0;
+   /* else is unhobbled, leave unspecified */
+   default:
+   break;
+   }
+   }
+   state->pdata.default_input = v;
+
flags = bus_cfg.bus.parallel.flags;
 
if (flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH)
-- 
2.7.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 v3 1/7] v4l: subdev: Add pad config allocator and init

2016-04-14 Thread Ulrich Hecht
From: Laurent Pinchart 

Add a new subdev operation to initialize a subdev pad config array, and
a helper function to allocate and initialize the array. This can be used
by bridge drivers to implement try format based on subdev pad
operations.

Signed-off-by: Laurent Pinchart 
Acked-by: Vaibhav Hiremath 
Acked-by: Hans Verkuil 
---
 drivers/media/v4l2-core/v4l2-subdev.c | 19 ++-
 include/media/v4l2-subdev.h   | 10 ++
 2 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/drivers/media/v4l2-core/v4l2-subdev.c 
b/drivers/media/v4l2-core/v4l2-subdev.c
index d630838..f32ac0d 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -35,7 +35,7 @@
 static int subdev_fh_init(struct v4l2_subdev_fh *fh, struct v4l2_subdev *sd)
 {
 #if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
-   fh->pad = kzalloc(sizeof(*fh->pad) * sd->entity.num_pads, GFP_KERNEL);
+   fh->pad = v4l2_subdev_alloc_pad_config(sd);
if (fh->pad == NULL)
return -ENOMEM;
 #endif
@@ -569,6 +569,23 @@ int v4l2_subdev_link_validate(struct media_link *link)
sink, link, _fmt, _fmt);
 }
 EXPORT_SYMBOL_GPL(v4l2_subdev_link_validate);
+
+struct v4l2_subdev_pad_config *v4l2_subdev_alloc_pad_config(struct v4l2_subdev 
*sd)
+{
+   struct v4l2_subdev_pad_config *cfg;
+
+   if (!sd->entity.num_pads)
+   return NULL;
+
+   cfg = kcalloc(sd->entity.num_pads, sizeof(*cfg), GFP_KERNEL);
+   if (!cfg)
+   return NULL;
+
+   v4l2_subdev_call(sd, pad, init_cfg, cfg);
+
+   return cfg;
+}
+EXPORT_SYMBOL_GPL(v4l2_subdev_alloc_pad_config);
 #endif /* CONFIG_MEDIA_CONTROLLER */
 
 void v4l2_subdev_init(struct v4l2_subdev *sd, const struct v4l2_subdev_ops 
*ops)
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 11e2dfe..6c47cdd 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -607,6 +607,8 @@ struct v4l2_subdev_pad_config {
  *  may be adjusted by the subdev driver to device 
capabilities.
  */
 struct v4l2_subdev_pad_ops {
+   void (*init_cfg)(struct v4l2_subdev *sd,
+struct v4l2_subdev_pad_config *cfg);
int (*enum_mbus_code)(struct v4l2_subdev *sd,
  struct v4l2_subdev_pad_config *cfg,
  struct v4l2_subdev_mbus_code_enum *code);
@@ -801,7 +803,15 @@ int v4l2_subdev_link_validate_default(struct v4l2_subdev 
*sd,
  struct v4l2_subdev_format *source_fmt,
  struct v4l2_subdev_format *sink_fmt);
 int v4l2_subdev_link_validate(struct media_link *link);
+
+struct v4l2_subdev_pad_config *v4l2_subdev_alloc_pad_config(struct v4l2_subdev 
*sd);
+
+static inline void v4l2_subdev_free_pad_config(struct v4l2_subdev_pad_config 
*cfg)
+{
+   kfree(cfg);
+}
 #endif /* CONFIG_MEDIA_CONTROLLER */
+
 void v4l2_subdev_init(struct v4l2_subdev *sd,
  const struct v4l2_subdev_ops *ops);
 
-- 
2.7.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 v3 0/7] Lager board HDMI input support

2016-04-14 Thread Ulrich Hecht
Hi!

This series implements Lager HDMI input support on top of version 4 of
Niklas's rcar-vin rewrite ("[PATCHv4] [media] rcar-vin: add Renesas R-Car
VIN driver").

Apart from rebasing, this revision removes one patch that has since been
picked up, squashes the DT changes into one patch and adjusts its subject
line slightly.

CU
Uli


Changes since v2:
- rebased on top of rcar-vin driver v4
- removed "adv7604: fix SPA register location for ADV7612" (picked up)
- changed prefix of dts patch to "ARM: dts: lager: "


Laurent Pinchart (1):
  v4l: subdev: Add pad config allocator and init

Ulrich Hecht (4):
  media: rcar_vin: Use correct pad number in try_fmt
  media: rcar-vin: pad-aware driver initialisation
  media: rcar-vin: add DV timings support
  media: rcar-vin: initialize EDID data

William Towle (2):
  media: adv7604: automatic "default-input" selection
  ARM: dts: lager: Add entries for VIN HDMI input support

 arch/arm/boot/dts/r8a7790-lager.dts |  41 +++-
 drivers/media/i2c/adv7604.c |  18 +++-
 drivers/media/platform/rcar-vin/rcar-v4l2.c | 145 +++-
 drivers/media/platform/rcar-vin/rcar-vin.h  |   2 +
 drivers/media/v4l2-core/v4l2-subdev.c   |  19 +++-
 include/media/v4l2-subdev.h |  10 ++
 6 files changed, 229 insertions(+), 6 deletions(-)

-- 
2.7.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 8/9] ARM: shmobile: lager dts: Add entries for VIN HDMI input support

2016-03-02 Thread Ulrich Hecht
From: William Towle <william.to...@codethink.co.uk>

Add DT entries for vin0, vin0_pins, and adv7612.

Signed-off-by: William Towle <william.to...@codethink.co.uk>
Signed-off-by: Rob Taylor <rob.tay...@codethink.co.uk>
[uli: added interrupt, renamed endpoint]
Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 arch/arm/boot/dts/r8a7790-lager.dts | 40 -
 1 file changed, 39 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/r8a7790-lager.dts 
b/arch/arm/boot/dts/r8a7790-lager.dts
index aa6ca92..a5f727c 100644
--- a/arch/arm/boot/dts/r8a7790-lager.dts
+++ b/arch/arm/boot/dts/r8a7790-lager.dts
@@ -414,7 +414,12 @@
renesas,function = "usb2";
};
 
-   vin1_pins: vin {
+   vin0_pins: vin0 {
+   renesas,groups = "vin0_data24", "vin0_sync", "vin0_clkenb", 
"vin0_clk";
+   renesas,function = "vin0";
+   };
+
+   vin1_pins: vin1 {
renesas,groups = "vin1_data8", "vin1_clk";
renesas,function = "vin1";
};
@@ -590,6 +595,20 @@
reg = <0x12>;
};
 
+   hdmi-in@4c {
+   compatible = "adi,adv7612";
+   reg = <0x4c>;
+   interrupt-parent = <>;
+   interrupts = <20 IRQ_TYPE_LEVEL_LOW>;
+   remote = <>;
+
+   port {
+   adv7612: endpoint {
+   remote-endpoint = <>;
+   };
+   };
+   };
+
composite-in@20 {
compatible = "adi,adv7180";
reg = <0x20>;
@@ -705,6 +724,25 @@
status = "okay";
 };
 
+/* HDMI video input */
+ {
+   pinctrl-0 = <_pins>;
+   pinctrl-names = "default";
+
+   status = "ok";
+
+   port {
+   vin0ep0: endpoint {
+   remote-endpoint = <>;
+   bus-width = <24>;
+   hsync-active = <0>;
+   vsync-active = <0>;
+   pclk-sample = <1>;
+   data-active = <1>;
+   };
+   };
+};
+
 /* composite video input */
  {
pinctrl-0 = <_pins>;
-- 
2.6.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 9/9] ARM: shmobile: lager dts: specify default-input for ADV7612

2016-03-02 Thread Ulrich Hecht
From: Ian Molton <ian.mol...@codethink.co.uk>

Set the 'default-input' property for ADV7612, enabling image and video
capture without the need to have userspace specifying routing.

(This version places the property in the adv7612 node, in line with
Ian's documentation)

Signed-off-by: Ian Molton <ian.mol...@codethink.co.uk>
Signed-off-by: William Towle <william.to...@codethink.co.uk>
Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 arch/arm/boot/dts/r8a7790-lager.dts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/r8a7790-lager.dts 
b/arch/arm/boot/dts/r8a7790-lager.dts
index a5f727c..eed0974 100644
--- a/arch/arm/boot/dts/r8a7790-lager.dts
+++ b/arch/arm/boot/dts/r8a7790-lager.dts
@@ -601,6 +601,7 @@
interrupt-parent = <>;
interrupts = <20 IRQ_TYPE_LEVEL_LOW>;
remote = <>;
+   default-input = <0>;
 
port {
adv7612: endpoint {
-- 
2.6.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 7/9] media: rcar-vin: initialize EDID data

2016-03-02 Thread Ulrich Hecht
Initializes the decoder subdevice with a fixed EDID blob.

Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 drivers/media/platform/rcar-vin/rcar-dma.c | 46 ++
 1 file changed, 46 insertions(+)

diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c 
b/drivers/media/platform/rcar-vin/rcar-dma.c
index 4596eda..f5d93bc 100644
--- a/drivers/media/platform/rcar-vin/rcar-dma.c
+++ b/drivers/media/platform/rcar-vin/rcar-dma.c
@@ -1070,6 +1070,41 @@ error:
return ret;
 }
 
+static u8 edid[256] = {
+   0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00,
+   0x48, 0xAE, 0x9C, 0x27, 0x00, 0x00, 0x00, 0x00,
+   0x19, 0x12, 0x01, 0x03, 0x80, 0x00, 0x00, 0x78,
+   0x0E, 0x00, 0xB2, 0xA0, 0x57, 0x49, 0x9B, 0x26,
+   0x10, 0x48, 0x4F, 0x2F, 0xCF, 0x00, 0x31, 0x59,
+   0x45, 0x59, 0x61, 0x59, 0x81, 0x99, 0x01, 0x01,
+   0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x3A,
+   0x80, 0x18, 0x71, 0x38, 0x2D, 0x40, 0x58, 0x2C,
+   0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E,
+   0x00, 0x00, 0x00, 0xFD, 0x00, 0x31, 0x55, 0x18,
+   0x5E, 0x11, 0x00, 0x0A, 0x20, 0x20, 0x20, 0x20,
+   0x20, 0x20, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x43,
+   0x20, 0x39, 0x30, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A,
+   0x0A, 0x0A, 0x0A, 0x0A, 0x00, 0x00, 0x00, 0x10,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x68,
+   0x02, 0x03, 0x1a, 0xc0, 0x48, 0xa2, 0x10, 0x04,
+   0x02, 0x01, 0x21, 0x14, 0x13, 0x23, 0x09, 0x07,
+   0x07, 0x65, 0x03, 0x0c, 0x00, 0x10, 0x00, 0xe2,
+   0x00, 0x2a, 0x01, 0x1d, 0x00, 0x80, 0x51, 0xd0,
+   0x1c, 0x20, 0x40, 0x80, 0x35, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x1e, 0x8c, 0x0a, 0xd0, 0x8a,
+   0x20, 0xe0, 0x2d, 0x10, 0x10, 0x3e, 0x96, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd7
+};
+
 int rvin_dma_on(struct rvin_dev *vin)
 {
struct v4l2_subdev *sd;
@@ -1159,6 +1194,17 @@ int rvin_dma_on(struct rvin_dev *vin)
v4l2_info(>v4l2_dev, "Device registered as /dev/video%d\n",
  vin->vdev.num);
 
+   {
+   struct v4l2_subdev_edid rvin_edid = {
+   .pad = 0,
+   .start_block = 0,
+   .blocks = 2,
+   .edid = edid,
+   };
+   v4l2_subdev_call(sd, pad, set_edid,
+   _edid);
+   }
+
 remove_device:
rvin_remove_device(vin);
 
-- 
2.6.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 2/9] media: adv7604: automatic "default-input" selection

2016-03-02 Thread Ulrich Hecht
From: William Towle <william.to...@codethink.co.uk>

Add logic such that the "default-input" property becomes unnecessary
for chips that only have one suitable input (ADV7611 by design, and
ADV7612 due to commit 7111cddd "[media] media: adv7604: reduce support
to first (digital) input").

Additionally, Ian's documentation in commit bf9c8227 ("[media] media:
adv7604: ability to read default input port from DT") states that the
"default-input" property should reside directly in the node for
adv7612. Hence, also adjust the parsing to make the implementation
consistent with this.

Signed-off-by: William Towle <william.to...@codethink.co.uk>
Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 drivers/media/i2c/adv7604.c | 24 +---
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index f8dd750..2097c48 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -2799,7 +2799,7 @@ static int adv76xx_parse_dt(struct adv76xx_state *state)
struct device_node *endpoint;
struct device_node *np;
unsigned int flags;
-   u32 v;
+   u32 v = -1;
 
np = state->i2c_clients[ADV76XX_PAGE_IO]->dev.of_node;
 
@@ -2809,14 +2809,24 @@ static int adv76xx_parse_dt(struct adv76xx_state *state)
return -EINVAL;
 
v4l2_of_parse_endpoint(endpoint, _cfg);
-
-   if (!of_property_read_u32(endpoint, "default-input", ))
-   state->pdata.default_input = v;
-   else
-   state->pdata.default_input = -1;
-
of_node_put(endpoint);
 
+   if (of_property_read_u32(np, "default-input", )) {
+   /* not specified ... can we choose automatically? */
+   switch (state->info->type) {
+   case ADV7611:
+   v = 0;
+   break;
+   case ADV7612:
+   if (state->info->max_port == ADV76XX_PAD_HDMI_PORT_A)
+   v = 0;
+   /* else is unhobbled, leave unspecified */
+   default:
+   break;
+   }
+   }
+   state->pdata.default_input = v;
+
flags = bus_cfg.bus.parallel.flags;
 
if (flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH)
-- 
2.6.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 5/9] media: rcar-vin: pad-aware driver initialisation

2016-03-02 Thread Ulrich Hecht
Add detection of source pad number for drivers aware of the media controller
API, so that rcar-vin can create device nodes to support modern drivers such
as adv7604.c (for HDMI on Lager) and the converted adv7180.c (for composite)
underneath.

Building rcar_vin gains a dependency on CONFIG_MEDIA_CONTROLLER, in
line with requirements for building the drivers associated with it.

Signed-off-by: William Towle <william.to...@codethink.co.uk>
Signed-off-by: Rob Taylor <rob.tay...@codethink.co.uk>
[uli: adapted to rcar-vin rewrite]
Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 drivers/media/platform/rcar-vin/rcar-dma.c | 16 
 drivers/media/platform/rcar-vin/rcar-vin.h |  1 +
 2 files changed, 17 insertions(+)

diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c 
b/drivers/media/platform/rcar-vin/rcar-dma.c
index 15a67f7..3d957dc 100644
--- a/drivers/media/platform/rcar-vin/rcar-dma.c
+++ b/drivers/media/platform/rcar-vin/rcar-dma.c
@@ -1008,6 +1008,9 @@ int rvin_dma_on(struct rvin_dev *vin)
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
struct v4l2_mbus_framefmt *mf = 
+#if defined(CONFIG_MEDIA_CONTROLLER)
+   int pad_idx;
+#endif
int ret;
 
sd = vin_to_sd(vin);
@@ -1040,6 +1043,19 @@ int rvin_dma_on(struct rvin_dev *vin)
return ret;
}
 
+   vin->src_pad_idx = 0;
+#if defined(CONFIG_MEDIA_CONTROLLER)
+   for (pad_idx = 0; pad_idx < sd->entity.num_pads; pad_idx++)
+   if (sd->entity.pads[pad_idx].flags
+   == MEDIA_PAD_FL_SOURCE)
+   break;
+   if (pad_idx >= sd->entity.num_pads)
+   goto remove_device;
+
+   vin->src_pad_idx = pad_idx;
+#endif
+   fmt.pad = vin->src_pad_idx;
+
vin->format.field = V4L2_FIELD_ANY;
 
/* Try to improve our guess of a reasonable window format */
diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h 
b/drivers/media/platform/rcar-vin/rcar-vin.h
index f07cd7c..c6f6e44 100644
--- a/drivers/media/platform/rcar-vin/rcar-vin.h
+++ b/drivers/media/platform/rcar-vin/rcar-vin.h
@@ -121,6 +121,7 @@ struct rvin_dev {
 
struct video_device vdev;
struct v4l2_device v4l2_dev;
+   int src_pad_idx;/* For media-controller drivers */
struct v4l2_ctrl_handler ctrl_handler;
struct v4l2_async_notifier notifier;
struct rvin_graph_entity entity;
-- 
2.6.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 6/9] media: rcar-vin: add DV timings support

2016-03-02 Thread Ulrich Hecht
Adds ioctls DV_TIMINGS_CAP, ENUM_DV_TIMINGS, G_DV_TIMINGS, S_DV_TIMINGS,
and QUERY_DV_TIMINGS.

Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 drivers/media/platform/rcar-vin/rcar-dma.c | 69 ++
 1 file changed, 69 insertions(+)

diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c 
b/drivers/media/platform/rcar-vin/rcar-dma.c
index 3d957dc..4596eda 100644
--- a/drivers/media/platform/rcar-vin/rcar-dma.c
+++ b/drivers/media/platform/rcar-vin/rcar-dma.c
@@ -644,12 +644,17 @@ static int rvin_enum_input(struct file *file, void *priv,
   struct v4l2_input *i)
 {
struct rvin_dev *vin = video_drvdata(file);
+   struct v4l2_subdev *sd = vin_to_sd(vin);
 
if (i->index != 0)
return -EINVAL;
 
i->type = V4L2_INPUT_TYPE_CAMERA;
i->std = vin->vdev.tvnorms;
+
+   if (v4l2_subdev_has_op(sd, pad, dv_timings_cap))
+   i->capabilities = V4L2_IN_CAP_DV_TIMINGS;
+
strlcpy(i->name, "Camera", sizeof(i->name));
 
return 0;
@@ -692,6 +697,64 @@ static int rvin_g_std(struct file *file, void *priv, 
v4l2_std_id *a)
return v4l2_subdev_call(sd, video, g_std, a);
 }
 
+static int rvin_enum_dv_timings(struct file *file, void *priv_fh,
+   struct v4l2_enum_dv_timings *timings)
+{
+   struct rvin_dev *vin = video_drvdata(file);
+   struct v4l2_subdev *sd = vin_to_sd(vin);
+
+   timings->pad = 0;
+   return v4l2_subdev_call(sd,
+   pad, enum_dv_timings, timings);
+}
+
+static int rvin_s_dv_timings(struct file *file, void *priv_fh,
+   struct v4l2_dv_timings *timings)
+{
+   struct rvin_dev *vin = video_drvdata(file);
+   struct v4l2_subdev *sd = vin_to_sd(vin);
+   int err;
+
+   err = v4l2_subdev_call(sd,
+   video, s_dv_timings, timings);
+   if (!err) {
+   vin->sensor.width = timings->bt.width;
+   vin->sensor.height = timings->bt.height;
+   }
+   return err;
+}
+
+static int rvin_g_dv_timings(struct file *file, void *priv_fh,
+   struct v4l2_dv_timings *timings)
+{
+   struct rvin_dev *vin = video_drvdata(file);
+   struct v4l2_subdev *sd = vin_to_sd(vin);
+
+   return v4l2_subdev_call(sd,
+   video, g_dv_timings, timings);
+}
+
+static int rvin_query_dv_timings(struct file *file, void *priv_fh,
+   struct v4l2_dv_timings *timings)
+{
+   struct rvin_dev *vin = video_drvdata(file);
+   struct v4l2_subdev *sd = vin_to_sd(vin);
+
+   return v4l2_subdev_call(sd,
+   video, query_dv_timings, timings);
+}
+
+static int rvin_dv_timings_cap(struct file *file, void *priv_fh,
+   struct v4l2_dv_timings_cap *cap)
+{
+   struct rvin_dev *vin = video_drvdata(file);
+   struct v4l2_subdev *sd = vin_to_sd(vin);
+
+   cap->pad = 0;
+   return v4l2_subdev_call(sd,
+   pad, dv_timings_cap, cap);
+}
+
 static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
.vidioc_querycap= rvin_querycap,
.vidioc_try_fmt_vid_cap = rvin_try_fmt_vid_cap,
@@ -706,6 +769,12 @@ static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
.vidioc_g_input = rvin_g_input,
.vidioc_s_input = rvin_s_input,
 
+   .vidioc_dv_timings_cap  = rvin_dv_timings_cap,
+   .vidioc_enum_dv_timings = rvin_enum_dv_timings,
+   .vidioc_g_dv_timings= rvin_g_dv_timings,
+   .vidioc_s_dv_timings= rvin_s_dv_timings,
+   .vidioc_query_dv_timings= rvin_query_dv_timings,
+
.vidioc_querystd= rvin_querystd,
.vidioc_g_std   = rvin_g_std,
.vidioc_s_std   = rvin_s_std,
-- 
2.6.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/9] adv7604: fix SPA register location for ADV7612

2016-03-02 Thread Ulrich Hecht
SPA location LSB register is at 0x70.

Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 drivers/media/i2c/adv7604.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 2097c48..1680c0e 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -2110,7 +2110,8 @@ static int adv76xx_set_edid(struct v4l2_subdev *sd, 
struct v4l2_edid *edid)
rep_write(sd, 0x76, spa_loc & 0xff);
rep_write_clr_set(sd, 0x77, 0x40, (spa_loc & 0x100) >> 2);
} else {
-   /* FIXME: Where is the SPA location LSB register ? */
+   /* ADV7612 Software Manual Rev. A, p. 15 */
+   rep_write(sd, 0x70, spa_loc & 0xff);
rep_write_clr_set(sd, 0x71, 0x01, (spa_loc & 0x100) >> 8);
}
 
-- 
2.6.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 4/9] media: rcar_vin: Use correct pad number in try_fmt

2016-03-02 Thread Ulrich Hecht
Fix rcar_vin_try_fmt's use of an inappropriate pad number when calling
the subdev set_fmt function - for the ADV7612, IDs should be non-zero.

Signed-off-by: William Towle <william.to...@codethink.co.uk>
Reviewed-by: Rob Taylor <rob.tay...@codethink.co.uk>
Acked-by: Hans Verkuil <hans.verk...@cisco.com>
[uli: adapted to rcar-vin rewrite]
Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 drivers/media/platform/rcar-vin/rcar-dma.c | 14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c 
b/drivers/media/platform/rcar-vin/rcar-dma.c
index c267309..15a67f7 100644
--- a/drivers/media/platform/rcar-vin/rcar-dma.c
+++ b/drivers/media/platform/rcar-vin/rcar-dma.c
@@ -329,7 +329,7 @@ static int __rvin_dma_try_format_sensor(struct rvin_dev 
*vin,
struct rvin_sensor *sensor)
 {
struct v4l2_subdev *sd;
-   struct v4l2_subdev_pad_config pad_cfg;
+   struct v4l2_subdev_pad_config *pad_cfg;
struct v4l2_subdev_format format = {
.which = which,
};
@@ -337,12 +337,18 @@ static int __rvin_dma_try_format_sensor(struct rvin_dev 
*vin,
 
sd = vin_to_sd(vin);
 
+   pad_cfg = v4l2_subdev_alloc_pad_config(sd);
+   if (pad_cfg == NULL)
+   return -ENOMEM;
+
v4l2_fill_mbus_format(, pix, vin->sensor.code);
 
+   format.pad = vin->src_pad_idx;
+
ret = v4l2_device_call_until_err(sd->v4l2_dev, 0, pad, set_fmt,
-_cfg, );
+pad_cfg, );
if (ret < 0)
-   return ret;
+   goto cleanup;
 
v4l2_fill_pix_format(pix, );
 
@@ -351,6 +357,8 @@ static int __rvin_dma_try_format_sensor(struct rvin_dev 
*vin,
 
vin_dbg(vin, "Sensor format: %ux%u\n", sensor->width, sensor->height);
 
+cleanup:
+   v4l2_subdev_free_pad_config(pad_cfg);
return 0;
 }
 
-- 
2.6.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/9] v4l: subdev: Add pad config allocator and init

2016-03-02 Thread Ulrich Hecht
From: Laurent Pinchart 

Add a new subdev operation to initialize a subdev pad config array, and
a helper function to allocate and initialize the array. This can be used
by bridge drivers to implement try format based on subdev pad
operations.

Signed-off-by: Laurent Pinchart 
Acked-by: Vaibhav Hiremath 
Acked-by: Hans Verkuil 
---
 drivers/media/v4l2-core/v4l2-subdev.c | 19 ++-
 include/media/v4l2-subdev.h   | 10 ++
 2 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/drivers/media/v4l2-core/v4l2-subdev.c 
b/drivers/media/v4l2-core/v4l2-subdev.c
index d630838..f32ac0d 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -35,7 +35,7 @@
 static int subdev_fh_init(struct v4l2_subdev_fh *fh, struct v4l2_subdev *sd)
 {
 #if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
-   fh->pad = kzalloc(sizeof(*fh->pad) * sd->entity.num_pads, GFP_KERNEL);
+   fh->pad = v4l2_subdev_alloc_pad_config(sd);
if (fh->pad == NULL)
return -ENOMEM;
 #endif
@@ -569,6 +569,23 @@ int v4l2_subdev_link_validate(struct media_link *link)
sink, link, _fmt, _fmt);
 }
 EXPORT_SYMBOL_GPL(v4l2_subdev_link_validate);
+
+struct v4l2_subdev_pad_config *v4l2_subdev_alloc_pad_config(struct v4l2_subdev 
*sd)
+{
+   struct v4l2_subdev_pad_config *cfg;
+
+   if (!sd->entity.num_pads)
+   return NULL;
+
+   cfg = kcalloc(sd->entity.num_pads, sizeof(*cfg), GFP_KERNEL);
+   if (!cfg)
+   return NULL;
+
+   v4l2_subdev_call(sd, pad, init_cfg, cfg);
+
+   return cfg;
+}
+EXPORT_SYMBOL_GPL(v4l2_subdev_alloc_pad_config);
 #endif /* CONFIG_MEDIA_CONTROLLER */
 
 void v4l2_subdev_init(struct v4l2_subdev *sd, const struct v4l2_subdev_ops 
*ops)
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index b273cf9..e1e25fa 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -604,6 +604,8 @@ struct v4l2_subdev_pad_config {
  *  may be adjusted by the subdev driver to device 
capabilities.
  */
 struct v4l2_subdev_pad_ops {
+   void (*init_cfg)(struct v4l2_subdev *sd,
+struct v4l2_subdev_pad_config *cfg);
int (*enum_mbus_code)(struct v4l2_subdev *sd,
  struct v4l2_subdev_pad_config *cfg,
  struct v4l2_subdev_mbus_code_enum *code);
@@ -798,7 +800,15 @@ int v4l2_subdev_link_validate_default(struct v4l2_subdev 
*sd,
  struct v4l2_subdev_format *source_fmt,
  struct v4l2_subdev_format *sink_fmt);
 int v4l2_subdev_link_validate(struct media_link *link);
+
+struct v4l2_subdev_pad_config *v4l2_subdev_alloc_pad_config(struct v4l2_subdev 
*sd);
+
+static inline void v4l2_subdev_free_pad_config(struct v4l2_subdev_pad_config 
*cfg)
+{
+   kfree(cfg);
+}
 #endif /* CONFIG_MEDIA_CONTROLLER */
+
 void v4l2_subdev_init(struct v4l2_subdev *sd,
  const struct v4l2_subdev_ops *ops);
 
-- 
2.6.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 0/9] Lager board HDMI input support

2016-03-02 Thread Ulrich Hecht
Hi!

This series implements Lager HDMI input support on top of version 2 of
Niklas's herculean rewrite of the rcar-vin driver ("[PATCHv2] [media]
rcar-vin: add Renesas R-Car VIN driver").

A couple of the included patches are pushed or have been picked up elsewhere
already and are included here for ease of testing.

The EDID initialization blob has been lifted wholesale from the cobalt
driver, with only the vendor ID adjusted to "REN".

(Note for testing: To get up-to-date DV timings, you have to use a client
that does QUERY_DV_TIMINGS/S_DV_TIMINGS.  Few do.)

CU
Uli


Ian Molton (1):
  ARM: shmobile: lager dts: specify default-input for ADV7612

Laurent Pinchart (1):
  v4l: subdev: Add pad config allocator and init

Ulrich Hecht (5):
  adv7604: fix SPA register location for ADV7612
  media: rcar_vin: Use correct pad number in try_fmt
  media: rcar-vin: pad-aware driver initialisation
  media: rcar-vin: add DV timings support
  media: rcar-vin: initialize EDID data

William Towle (2):
  media: adv7604: automatic "default-input" selection
  ARM: shmobile: lager dts: Add entries for VIN HDMI input support

 arch/arm/boot/dts/r8a7790-lager.dts|  41 +++-
 drivers/media/i2c/adv7604.c|  27 --
 drivers/media/platform/rcar-vin/rcar-dma.c | 145 -
 drivers/media/platform/rcar-vin/rcar-vin.h |   1 +
 drivers/media/v4l2-core/v4l2-subdev.c  |  19 +++-
 include/media/v4l2-subdev.h|  10 ++
 6 files changed, 230 insertions(+), 13 deletions(-)

-- 
2.6.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 0/2] adv7604: .get_selection support

2015-12-22 Thread Ulrich Hecht
Hi!

The rcar_vin driver relies on this method.  The second patch makes sure that
they return up-to-date data if the input signal has changed since
initialization.

This revision implements .get_selection instead of .g_crop/.cropcap and
includes the suggested style changes.

It has been tested with the rcar_vin driver together with Hans Verkuil's
"v4l2: remove g/s_crop and cropcap from video ops" patch:

https://git.linuxtv.org/hverkuil/media_tree.git/commit/?h=rmcrop=9ff32166c29d1323db090d638da27ea652d1d4d8

CU
Uli


Ulrich Hecht (2):
  media: adv7604: implement get_selection
  media: adv7604: update timings on change of input signal

 drivers/media/i2c/adv7604.c | 30 ++
 1 file changed, 30 insertions(+)

-- 
2.6.3

--
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] adv7604: add direct interrupt handling

2015-12-22 Thread Ulrich Hecht
When probed from device tree, the i2c client driver can handle the
interrupt on its own.

Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinch...@ideasonboard.com>
---
This revision implements the suggested style changes and drops the
IRQF_TRIGGER_LOW flag, which is handled in the device tree.

CU
Uli


 drivers/media/i2c/adv7604.c | 24 ++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 5bd81bd..be5980c 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1971,6 +1972,16 @@ static int adv76xx_isr(struct v4l2_subdev *sd, u32 
status, bool *handled)
return 0;
 }
 
+static irqreturn_t adv76xx_irq_handler(int irq, void *devid)
+{
+   struct adv76xx_state *state = devid;
+   bool handled;
+
+   adv76xx_isr(>sd, 0, );
+
+   return handled ? IRQ_HANDLED : IRQ_NONE;
+}
+
 static int adv76xx_get_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid)
 {
struct adv76xx_state *state = to_state(sd);
@@ -2844,8 +2855,7 @@ static int adv76xx_parse_dt(struct adv76xx_state *state)
state->pdata.op_656_range = 1;
}
 
-   /* Disable the interrupt for now as no DT-based board uses it. */
-   state->pdata.int1_config = ADV76XX_INT1_CONFIG_DISABLED;
+   state->pdata.int1_config = ADV76XX_INT1_CONFIG_ACTIVE_LOW;
 
/* Use the default I2C addresses. */
state->pdata.i2c_addresses[ADV7604_PAGE_AVLINK] = 0x42;
@@ -3235,6 +3245,16 @@ static int adv76xx_probe(struct i2c_client *client,
v4l2_info(sd, "%s found @ 0x%x (%s)\n", client->name,
client->addr << 1, client->adapter->name);
 
+   if (client->irq) {
+   err = devm_request_threaded_irq(>dev,
+   client->irq,
+   NULL, adv76xx_irq_handler,
+   IRQF_ONESHOT,
+   dev_name(>dev), state);
+   if (err)
+   goto err_entity;
+   }
+
err = v4l2_async_register_subdev(sd);
if (err)
goto err_entity;
-- 
2.6.3

--
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/2] media: adv7604: implement get_selection

2015-12-22 Thread Ulrich Hecht
The rcar_vin driver relies on this.

Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 drivers/media/i2c/adv7604.c | 21 +
 1 file changed, 21 insertions(+)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index be5980c..8ad5c28 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -1885,6 +1885,26 @@ static int adv76xx_get_format(struct v4l2_subdev *sd,
return 0;
 }
 
+static int adv76xx_get_selection(struct v4l2_subdev *sd,
+struct v4l2_subdev_pad_config *cfg,
+struct v4l2_subdev_selection *sel)
+{
+   struct adv76xx_state *state = to_state(sd);
+
+   if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE)
+   return -EINVAL;
+   /* Only CROP, CROP_DEFAULT and CROP_BOUNDS are supported */
+   if (sel->target > V4L2_SEL_TGT_CROP_BOUNDS)
+   return -EINVAL;
+
+   sel->r.left = 0;
+   sel->r.top  = 0;
+   sel->r.width= state->timings.bt.width;
+   sel->r.height   = state->timings.bt.height;
+
+   return 0;
+}
+
 static int adv76xx_set_format(struct v4l2_subdev *sd,
  struct v4l2_subdev_pad_config *cfg,
  struct v4l2_subdev_format *format)
@@ -2415,6 +2435,7 @@ static const struct v4l2_subdev_video_ops 
adv76xx_video_ops = {
 
 static const struct v4l2_subdev_pad_ops adv76xx_pad_ops = {
.enum_mbus_code = adv76xx_enum_mbus_code,
+   .get_selection = adv76xx_get_selection,
.get_fmt = adv76xx_get_format,
.set_fmt = adv76xx_set_format,
.get_edid = adv76xx_get_edid,
-- 
2.6.3

--
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 2/2] media: adv7604: update timings on change of input signal

2015-12-22 Thread Ulrich Hecht
Without this, .get_selection will always return the boot-time state.

Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 drivers/media/i2c/adv7604.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 8ad5c28..dcd659b 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -1945,6 +1945,7 @@ static int adv76xx_isr(struct v4l2_subdev *sd, u32 
status, bool *handled)
u8 fmt_change_digital;
u8 fmt_change;
u8 tx_5v;
+   int ret;
 
if (irq_reg_0x43)
io_write(sd, 0x44, irq_reg_0x43);
@@ -1968,6 +1969,14 @@ static int adv76xx_isr(struct v4l2_subdev *sd, u32 
status, bool *handled)
 
v4l2_subdev_notify_event(sd, _ev_fmt);
 
+   /* update timings */
+   ret = adv76xx_query_dv_timings(sd, >timings);
+   if (ret == -ENOLINK) {
+   /* no signal, fall back to default timings */
+   state->timings = (struct v4l2_dv_timings)
+   V4L2_DV_BT_CEA_640X480P59_94;
+   }
+
if (handled)
*handled = true;
}
-- 
2.6.3

--
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 0/3] adv7604: .g_crop and .cropcap support

2015-12-14 Thread Ulrich Hecht
On Mon, Dec 14, 2015 at 2:02 PM, Hans Verkuil <hverk...@xs4all.nl> wrote:
> On 12/14/2015 01:55 PM, Ulrich Hecht wrote:
>> On Mon, Dec 14, 2015 at 11:33 AM, Hans Verkuil <hverk...@xs4all.nl> wrote:
>>> OK, my http://git.linuxtv.org/hverkuil/media_tree.git/log/?h=rmcrop branch 
>>> now has a
>>> rebased patch to remove g/s_crop. Only compile-tested. It's just the one 
>>> patch that you
>>> need.
>>
>> Thank you, that works perfectly with rcar_vin and adv7604; I'll send a
>> revised series.
>
> Just making sure: you have actually tested cropping with my patch?

OK, I'll revise my statement: The "get" part works perfectly. :)

>
> It would also be interesting to see if you can run v4l2-compliance for rcar. 
> See what it says.

Driver Info:
   Driver name   : e6ef.video
   Card type : R_Car_VIN
   Bus info  : platform:rcar_vin0
   Driver version: 4.4.0
   Capabilities  : 0x8421
   Video Capture
   Streaming
   Extended Pix Format
   Device Capabilities
   Device Caps   : 0x0421
   Video Capture
   Streaming
   Extended Pix Format

Compliance test for device /dev/video0 (not using libv4l2):

Required ioctls:
   test VIDIOC_QUERYCAP: OK

Allow for multiple opens:
   test second video open: OK
   test VIDIOC_QUERYCAP: OK
   fail: v4l2-compliance.cpp(585): prio != match
   test VIDIOC_G/S_PRIORITY: FAIL

Debug ioctls:
   test VIDIOC_DBG_G/S_REGISTER: OK
   test VIDIOC_LOG_STATUS: OK (Not Supported)

Input ioctls:
   test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported)
   test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
   test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
   test VIDIOC_ENUMAUDIO: OK (Not Supported)
   test VIDIOC_G/S/ENUMINPUT: OK
   test VIDIOC_G/S_AUDIO: OK (Not Supported)
   Inputs: 1 Audio Inputs: 0 Tuners: 0

Output ioctls:
   test VIDIOC_G/S_MODULATOR: OK (Not Supported)
   test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
   test VIDIOC_ENUMAUDOUT: OK (Not Supported)
   test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
   test VIDIOC_G/S_AUDOUT: OK (Not Supported)
   Outputs: 0 Audio Outputs: 0 Modulators: 0

Input/Output configuration ioctls:
   test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported)
   test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
   test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)
   test VIDIOC_G/S_EDID: OK (Not Supported)

Test input 0:

   Control ioctls:
   test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK
   test VIDIOC_QUERYCTRL: OK
   test VIDIOC_G/S_CTRL: OK
   test VIDIOC_G/S/TRY_EXT_CTRLS: OK
   fail: v4l2-test-controls.cpp(782): subscribe event for
control 'User Co
ntrols' failed
   test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: FAIL
   test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
   Standard Controls: 5 Private Controls: 0

   Format ioctls:
   fail: v4l2-test-formats.cpp(268): duplicate format 34424752
   test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: FAIL
   test VIDIOC_G/S_PARM: OK (Not Supported)
   test VIDIOC_G_FBUF: OK (Not Supported)
   test VIDIOC_G_FMT: OK
   test VIDIOC_TRY_FMT: OK
   warn: v4l2-test-formats.cpp(827): Could not set fmt2
   test VIDIOC_S_FMT: OK
   test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
   test Cropping: OK
   test Composing: OK
   test Scaling: OK (Not Supported)

   Codec ioctls:
   test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
   test VIDIOC_G_ENC_INDEX: OK (Not Supported)
   test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)

   Buffer ioctls:
   test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
   test VIDIOC_EXPBUF: OK

Test input 0:


Total: 42, Succeeded: 39, Failed: 3, Warnings: 1

CU
Uli
--
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 0/3] adv7604: .g_crop and .cropcap support

2015-12-14 Thread Ulrich Hecht
On Mon, Dec 14, 2015 at 11:33 AM, Hans Verkuil  wrote:
> OK, my http://git.linuxtv.org/hverkuil/media_tree.git/log/?h=rmcrop branch 
> now has a
> rebased patch to remove g/s_crop. Only compile-tested. It's just the one 
> patch that you
> need.

Thank you, that works perfectly with rcar_vin and adv7604; I'll send a
revised series.

CU
Uli
--
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 1/3] media: adv7604: implement g_crop

2015-12-11 Thread Ulrich Hecht
The rcar_vin driver relies on this.

Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 drivers/media/i2c/adv7604.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 129009f..d30e7cc 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -1885,6 +1885,17 @@ static int adv76xx_get_format(struct v4l2_subdev *sd,
return 0;
 }
 
+static int adv76xx_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
+{
+   struct adv76xx_state *state = to_state(sd);
+
+   a->c.height = state->timings.bt.height;
+   a->c.width  = state->timings.bt.width;
+   a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+
+   return 0;
+}
+
 static int adv76xx_set_format(struct v4l2_subdev *sd,
  struct v4l2_subdev_pad_config *cfg,
  struct v4l2_subdev_format *format)
@@ -2407,6 +2418,7 @@ static const struct v4l2_subdev_core_ops adv76xx_core_ops 
= {
 
 static const struct v4l2_subdev_video_ops adv76xx_video_ops = {
.s_routing = adv76xx_s_routing,
+   .g_crop = adv76xx_g_crop,
.g_input_status = adv76xx_g_input_status,
.s_dv_timings = adv76xx_s_dv_timings,
.g_dv_timings = adv76xx_g_dv_timings,
-- 
2.6.3

--
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] adv7604: add direct interrupt handling

2015-12-11 Thread Ulrich Hecht
When probed from device tree, the i2c client driver can handle the
interrupt on its own.

Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 drivers/media/i2c/adv7604.c | 24 ++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index c2df7e8..129009f 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1971,6 +1972,16 @@ static int adv76xx_isr(struct v4l2_subdev *sd, u32 
status, bool *handled)
return 0;
 }
 
+static irqreturn_t adv76xx_irq_handler(int irq, void *devid)
+{
+   struct adv76xx_state *state = devid;
+   bool handled;
+
+   adv76xx_isr(>sd, 0, );
+
+   return handled ? IRQ_HANDLED : IRQ_NONE;
+}
+
 static int adv76xx_get_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid)
 {
struct adv76xx_state *state = to_state(sd);
@@ -2833,8 +2844,7 @@ static int adv76xx_parse_dt(struct adv76xx_state *state)
state->pdata.op_656_range = 1;
}
 
-   /* Disable the interrupt for now as no DT-based board uses it. */
-   state->pdata.int1_config = ADV76XX_INT1_CONFIG_DISABLED;
+   state->pdata.int1_config = ADV76XX_INT1_CONFIG_ACTIVE_LOW;
 
/* Use the default I2C addresses. */
state->pdata.i2c_addresses[ADV7604_PAGE_AVLINK] = 0x42;
@@ -3224,6 +3234,16 @@ static int adv76xx_probe(struct i2c_client *client,
v4l2_info(sd, "%s found @ 0x%x (%s)\n", client->name,
client->addr << 1, client->adapter->name);
 
+   if (client->irq) {
+   err = devm_request_threaded_irq(>dev,
+   client->irq,
+   NULL, adv76xx_irq_handler,
+   IRQF_TRIGGER_LOW|IRQF_ONESHOT,
+   dev_name(>dev), state);
+   if (err)
+   goto err_entity;
+   }
+
err = v4l2_async_register_subdev(sd);
if (err)
goto err_entity;
-- 
2.6.3

--
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 0/3] adv7604: .g_crop and .cropcap support

2015-12-11 Thread Ulrich Hecht
Hi!

The rcar_vin driver relies on these methods.  The third patch makes sure
that they return up-to-date data if the input signal has changed since
initialization.

CU
Uli


Ulrich Hecht (3):
  media: adv7604: implement g_crop
  media: adv7604: implement cropcap
  media: adv7604: update timings on change of input signal

 drivers/media/i2c/adv7604.c | 38 ++
 1 file changed, 38 insertions(+)

-- 
2.6.3

--
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 2/3] media: adv7604: implement cropcap

2015-12-11 Thread Ulrich Hecht
Used by the rcar_vin driver.

Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 drivers/media/i2c/adv7604.c | 17 +
 1 file changed, 17 insertions(+)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index d30e7cc..1bfa9f3 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -1896,6 +1896,22 @@ static int adv76xx_g_crop(struct v4l2_subdev *sd, struct 
v4l2_crop *a)
return 0;
 }
 
+static int adv76xx_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a)
+{
+   struct adv76xx_state *state = to_state(sd);
+
+   a->bounds.left   = 0;
+   a->bounds.top= 0;
+   a->bounds.width  = state->timings.bt.width;
+   a->bounds.height = state->timings.bt.height;
+   a->defrect   = a->bounds;
+   a->type  = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+   a->pixelaspect.numerator   = 1;
+   a->pixelaspect.denominator = 1;
+
+   return 0;
+}
+
 static int adv76xx_set_format(struct v4l2_subdev *sd,
  struct v4l2_subdev_pad_config *cfg,
  struct v4l2_subdev_format *format)
@@ -2419,6 +2435,7 @@ static const struct v4l2_subdev_core_ops adv76xx_core_ops 
= {
 static const struct v4l2_subdev_video_ops adv76xx_video_ops = {
.s_routing = adv76xx_s_routing,
.g_crop = adv76xx_g_crop,
+   .cropcap = adv76xx_cropcap,
.g_input_status = adv76xx_g_input_status,
.s_dv_timings = adv76xx_s_dv_timings,
.g_dv_timings = adv76xx_g_dv_timings,
-- 
2.6.3

--
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 3/3] media: adv7604: update timings on change of input signal

2015-12-11 Thread Ulrich Hecht
Without this, g_crop will always return the boot-time state.

Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 drivers/media/i2c/adv7604.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 1bfa9f3..d7d0bb7 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -1975,6 +1975,15 @@ static int adv76xx_isr(struct v4l2_subdev *sd, u32 
status, bool *handled)
 
v4l2_subdev_notify_event(sd, _ev_fmt);
 
+   /* update timings */
+   if (adv76xx_query_dv_timings(sd, >timings)
+   == -ENOLINK) {
+   /* no signal, fall back to default timings */
+   const struct v4l2_dv_timings cea640x480 =
+   V4L2_DV_BT_CEA_640X480P59_94;
+   state->timings = cea640x480;
+   }
+
if (handled)
*handled = true;
}
-- 
2.6.3

--
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] media: adv7180: increase delay after reset to 5ms

2015-11-10 Thread Ulrich Hecht
Initialization of the ADV7180 chip fails on the Renesas R8A7790-based
Lager board about 50% of the time.  This patch resolves the issue by
increasing the minimum delay after reset from 2 ms to 5 ms, following the
recommendation in the ADV7180 datasheet:

"Executing a software reset takes approximately 2 ms. However, it is
recommended to wait 5 ms before any further I2C writes are performed."

Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 drivers/media/i2c/adv7180.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c
index f82c8aa..3c3c4bf 100644
--- a/drivers/media/i2c/adv7180.c
+++ b/drivers/media/i2c/adv7180.c
@@ -1112,7 +1112,7 @@ static int init_device(struct adv7180_state *state)
mutex_lock(>mutex);
 
adv7180_write(state, ADV7180_REG_PWR_MAN, ADV7180_PWR_MAN_RES);
-   usleep_range(2000, 1);
+   usleep_range(5000, 1);
 
ret = state->chip_info->init(state);
if (ret)
-- 
2.6.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


Re: [PATCH/RFT 0/7] HDMI capture on Lager

2015-10-27 Thread Ulrich Hecht
On Mon, Oct 19, 2015 at 4:54 PM, Hans Verkuil <hansv...@cisco.com> wrote:
> On 10/19/2015 04:07 PM, Ulrich Hecht wrote:
>> This series is supposed to serve as a basis for testing the HDMI input on
>> the Lager board.  It is based on the series by William Towle, dropping the
>> patches that have since been merged, and adding the interrupt to the
>> adv7612
>> DT description.
>>
>> The base of this series, Laurent's "pad config allocator" patch, had been
>> deferred pending a retooling of the media controller framework.  I could
>> not, however, find significant activity in that area (read: the patch
>> still
>> applies)...
> Please cross-post this to the linux-media mailinglist, otherwise it will
> likely be lost.
>
> BTW a lot of work is being done in the media controller framework, but
> nothing has been merged yet. It looks likely to be merged for kernel 4.5.

Could you point me to that work?  I have checked out the master and
media-controller branches of the media tree, but the patch series
still applies (and works) there, so I'm wondering if I'm looking in
the wrong places.  Thank you.

CU
Uli
--
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 6/6] media: soc_camera: rcar_vin: Add r8a7794 device support

2014-07-25 Thread Ulrich Hecht
From: Koji Matsuoka koji.matsuoka...@renesas.com

Signed-off-by: Koji Matsuoka koji.matsuoka...@renesas.com
Cc: linux-media@vger.kernel.org

---
 drivers/media/platform/soc_camera/rcar_vin.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/platform/soc_camera/rcar_vin.c 
b/drivers/media/platform/soc_camera/rcar_vin.c
index e594230..86d98cd 100644
--- a/drivers/media/platform/soc_camera/rcar_vin.c
+++ b/drivers/media/platform/soc_camera/rcar_vin.c
@@ -1391,6 +1391,7 @@ static struct soc_camera_host_ops rcar_vin_host_ops = {
 };
 
 static struct platform_device_id rcar_vin_id_table[] = {
+   { r8a7794-vin,  RCAR_GEN2 },
{ r8a7791-vin,  RCAR_GEN2 },
{ r8a7790-vin,  RCAR_GEN2 },
{ r8a7779-vin,  RCAR_H1 },
-- 
1.8.4.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


  1   2   >