Re: [PATCH 10/61] gpio: simplify getting .drvdata

2018-04-22 Thread Michal Simek
Hi Wolfram,

On 21.4.2018 18:23, Wolfram Sang wrote:
> Hi Michal,
> 
> Thanks for the reviews!
> 
>> There are two more occurences in this gpio-zynq driver.
>> zynq_gpio_resume, zynq_gpio_suspend. It wasn't detected because these
>> two lines are not together. But the same change can be applied for them too.
> 
> Not really. The rule would have matched if there was just "something"
> inbetween. It did not match because the "something" involves the
> variable 'pdev', so we can't remove it. And just changing towards
> 'dev_get_drvdata' and keeping 'pdev' was not worth the hazzle in my
> book. Especially since I think the code should probably get refactored.
> Calling platform_get_irq() in suspend/resume paths in order to get the
> irq_data looks a little expensive to me, but I haven't tested it.
> 

ok. Thanks. I have overlooked that.

Thanks,
Michal


[PATCH 09/10] arm64: dts: renesas: r8a7795-salvator-x: enable HDMI sound

2018-04-22 Thread Kuninori Morimoto
From: Kuninori Morimoto 

Signed-off-by: Kuninori Morimoto 
Tested-by: Nguyen Viet Dung 
---
 arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts | 46 ++
 1 file changed, 46 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts 
b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
index af46741..0efbef5 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
@@ -56,6 +56,12 @@
status = "okay";
 };
 
+&sound_card {
+   dais = <&rsnd_port0 /* ak4613 */
+   &rsnd_port1 /* HDMI0  */
+   &rsnd_port2>;   /* HDMI1  */
+};
+
 &hdmi0 {
status = "okay";
 
@@ -66,6 +72,12 @@
remote-endpoint = <&hdmi0_con>;
};
};
+   port@2 {
+   reg = <2>;
+   dw_hdmi0_snd_in: endpoint {
+   remote-endpoint = <&rsnd_endpoint1>;
+   };
+   };
};
 };
 
@@ -83,6 +95,12 @@
remote-endpoint = <&hdmi1_con>;
};
};
+   port@2 {
+   reg = <2>;
+   dw_hdmi1_snd_in: endpoint {
+   remote-endpoint = <&rsnd_endpoint2>;
+   };
+   };
};
 };
 
@@ -94,6 +112,34 @@
status = "okay";
 };
 
+&rcar_sound {
+   ports {
+   /* rsnd_port0 is on salvator-common */
+   rsnd_port1: port@1 {
+   rsnd_endpoint1: endpoint {
+   remote-endpoint = <&dw_hdmi0_snd_in>;
+
+   dai-format = "i2s";
+   bitclock-master = <&rsnd_endpoint1>;
+   frame-master = <&rsnd_endpoint1>;
+
+   playback = <&ssi2>;
+   };
+   };
+   rsnd_port2: port@2 {
+   rsnd_endpoint2: endpoint {
+   remote-endpoint = <&dw_hdmi1_snd_in>;
+
+   dai-format = "i2s";
+   bitclock-master = <&rsnd_endpoint2>;
+   frame-master = <&rsnd_endpoint2>;
+
+   playback = <&ssi3>;
+   };
+   };
+   };
+};
+
 &pfc {
usb2_pins: usb2 {
groups = "usb2";
-- 
1.9.1



[PATCH 10/10] arm64: dts: renesas: r8a7796-salvator-x: enable HDMI sound

2018-04-22 Thread Kuninori Morimoto
From: Kuninori Morimoto 

Signed-off-by: Kuninori Morimoto 
Tested-by: Nguyen Viet Dung 
---
 arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts | 28 ++
 1 file changed, 28 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts 
b/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts
index 498c9e8..90cca09 100644
--- a/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts
@@ -40,6 +40,11 @@
  "dclkin.0", "dclkin.1", "dclkin.2";
 };
 
+&sound_card {
+   dais = <&rsnd_port0 /* ak4613 */
+   &rsnd_port1>;   /* HDMI0  */
+};
+
 &hdmi0 {
status = "okay";
 
@@ -50,9 +55,32 @@
remote-endpoint = <&hdmi0_con>;
};
};
+   port@2 {
+   reg = <2>;
+   dw_hdmi0_snd_in: endpoint {
+   remote-endpoint = <&rsnd_endpoint1>;
+   };
+   };
};
 };
 
 &hdmi0_con {
remote-endpoint = <&rcar_dw_hdmi0_out>;
 };
+
+&rcar_sound {
+   ports {
+   /* rsnd_port0 is on salvator-common */
+   rsnd_port1: port@1 {
+   rsnd_endpoint1: endpoint {
+   remote-endpoint = <&dw_hdmi0_snd_in>;
+
+   dai-format = "i2s";
+   bitclock-master = <&rsnd_endpoint1>;
+   frame-master = <&rsnd_endpoint1>;
+
+   playback = <&ssi2>;
+   };
+   };
+   };
+};
-- 
1.9.1



[PATCH 08/10] arm64: dts: renesas: r8a7796-salvator-xs: enable HDMI sound

2018-04-22 Thread Kuninori Morimoto
From: Kuninori Morimoto 

Signed-off-by: Kuninori Morimoto 
Tested-by: Nguyen Viet Dung 
---
 .../arm64/boot/dts/renesas/r8a7796-salvator-xs.dts | 28 ++
 1 file changed, 28 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7796-salvator-xs.dts 
b/arch/arm64/boot/dts/renesas/r8a7796-salvator-xs.dts
index 2c37055..ddf35d4 100644
--- a/arch/arm64/boot/dts/renesas/r8a7796-salvator-xs.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7796-salvator-xs.dts
@@ -40,6 +40,11 @@
  "dclkin.0", "dclkin.1", "dclkin.2";
 };
 
+&sound_card {
+   dais = <&rsnd_port0 /* ak4613 */
+   &rsnd_port1>;   /* HDMI0  */
+};
+
 &hdmi0 {
status = "okay";
 
@@ -50,9 +55,32 @@
remote-endpoint = <&hdmi0_con>;
};
};
+   port@2 {
+   reg = <2>;
+   dw_hdmi0_snd_in: endpoint {
+   remote-endpoint = <&rsnd_endpoint1>;
+   };
+   };
};
 };
 
 &hdmi0_con {
remote-endpoint = <&rcar_dw_hdmi0_out>;
 };
+
+&rcar_sound {
+   ports {
+   /* rsnd_port0 is on salvator-common */
+   rsnd_port1: port@1 {
+   rsnd_endpoint1: endpoint {
+   remote-endpoint = <&dw_hdmi0_snd_in>;
+
+   dai-format = "i2s";
+   bitclock-master = <&rsnd_endpoint1>;
+   frame-master = <&rsnd_endpoint1>;
+
+   playback = <&ssi2>;
+   };
+   };
+   };
+};
-- 
1.9.1



[PATCH 07/10] arm64: dts: renesas: r8a7795-salvator-xs: enable HDMI sound

2018-04-22 Thread Kuninori Morimoto
From: Kuninori Morimoto 

Signed-off-by: Kuninori Morimoto 
Tested-by: Nguyen Viet Dung 
---
 .../arm64/boot/dts/renesas/r8a7795-salvator-xs.dts | 46 ++
 1 file changed, 46 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7795-salvator-xs.dts 
b/arch/arm64/boot/dts/renesas/r8a7795-salvator-xs.dts
index 8b50ceb..8367668 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795-salvator-xs.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7795-salvator-xs.dts
@@ -56,6 +56,12 @@
status = "okay";
 };
 
+&sound_card {
+   dais = <&rsnd_port0 /* ak4613 */
+   &rsnd_port1 /* HDMI0  */
+   &rsnd_port2>;   /* HDMI1  */
+};
+
 &hdmi0 {
status = "okay";
 
@@ -66,6 +72,12 @@
remote-endpoint = <&hdmi0_con>;
};
};
+   port@2 {
+   reg = <2>;
+   dw_hdmi0_snd_in: endpoint {
+   remote-endpoint = <&rsnd_endpoint1>;
+   };
+   };
};
 };
 
@@ -83,6 +95,12 @@
remote-endpoint = <&hdmi1_con>;
};
};
+   port@2 {
+   reg = <2>;
+   dw_hdmi1_snd_in: endpoint {
+   remote-endpoint = <&rsnd_endpoint2>;
+   };
+   };
};
 };
 
@@ -94,6 +112,34 @@
status = "okay";
 };
 
+&rcar_sound {
+   ports {
+   /* rsnd_port0 is on salvator-common */
+   rsnd_port1: port@1 {
+   rsnd_endpoint1: endpoint {
+   remote-endpoint = <&dw_hdmi0_snd_in>;
+
+   dai-format = "i2s";
+   bitclock-master = <&rsnd_endpoint1>;
+   frame-master = <&rsnd_endpoint1>;
+
+   playback = <&ssi2>;
+   };
+   };
+   rsnd_port2: port@2 {
+   rsnd_endpoint2: endpoint {
+   remote-endpoint = <&dw_hdmi1_snd_in>;
+
+   dai-format = "i2s";
+   bitclock-master = <&rsnd_endpoint2>;
+   frame-master = <&rsnd_endpoint2>;
+
+   playback = <&ssi3>;
+   };
+   };
+   };
+};
+
 &pfc {
usb2_pins: usb2 {
groups = "usb2";
-- 
1.9.1



[PATCH 06/10] arm64: dts: renesas: r8a7795-es1-salvator-x: enable HDMI sound

2018-04-22 Thread Kuninori Morimoto
From: Kuninori Morimoto 

Signed-off-by: Kuninori Morimoto 
Tested-by: Nguyen Viet Dung 
---
 .../boot/dts/renesas/r8a7795-es1-salvator-x.dts| 46 ++
 1 file changed, 46 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7795-es1-salvator-x.dts 
b/arch/arm64/boot/dts/renesas/r8a7795-es1-salvator-x.dts
index 7f2a3d9..3f46345 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795-es1-salvator-x.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7795-es1-salvator-x.dts
@@ -56,6 +56,12 @@
status = "okay";
 };
 
+&sound_card {
+   dais = <&rsnd_port0 /* ak4613 */
+   &rsnd_port1 /* HDMI0  */
+   &rsnd_port2>;   /* HDMI1  */
+};
+
 &hdmi0 {
status = "okay";
 
@@ -66,6 +72,12 @@
remote-endpoint = <&hdmi0_con>;
};
};
+   port@2 {
+   reg = <2>;
+   dw_hdmi0_snd_in: endpoint {
+   remote-endpoint = <&rsnd_endpoint1>;
+   };
+   };
};
 };
 
@@ -83,6 +95,12 @@
remote-endpoint = <&hdmi1_con>;
};
};
+   port@2 {
+   reg = <2>;
+   dw_hdmi1_snd_in: endpoint {
+   remote-endpoint = <&rsnd_endpoint2>;
+   };
+   };
};
 };
 
@@ -94,6 +112,34 @@
status = "okay";
 };
 
+&rcar_sound {
+   ports {
+   /* rsnd_port0 is on salvator-common */
+   rsnd_port1: port@1 {
+   rsnd_endpoint1: endpoint {
+   remote-endpoint = <&dw_hdmi0_snd_in>;
+
+   dai-format = "i2s";
+   bitclock-master = <&rsnd_endpoint1>;
+   frame-master = <&rsnd_endpoint1>;
+
+   playback = <&ssi2>;
+   };
+   };
+   rsnd_port2: port@2 {
+   rsnd_endpoint2: endpoint {
+   remote-endpoint = <&dw_hdmi1_snd_in>;
+
+   dai-format = "i2s";
+   bitclock-master = <&rsnd_endpoint2>;
+   frame-master = <&rsnd_endpoint2>;
+
+   playback = <&ssi3>;
+   };
+   };
+   };
+};
+
 &pfc {
usb2_pins: usb2 {
groups = "usb2";
-- 
1.9.1



[PATCH 05/10] arm64: dts: renesas: salvator-common: use audio-graph-card for Sound

2018-04-22 Thread Kuninori Morimoto
From: Kuninori Morimoto 

Current Sound is using simple-audio-card which can't support HDMI.
To use HDMI sound, we need to use audio-graph-card.
But, one note is that r8a7795 has 2 HDMI ports, but r8a7796 has 1.
Because of this mismatch, supporting HDMI on salvator-common is
impossible.
Thus, this patch exchange sound card to audio-graph-card and keep
supporting ak4613 as 1st sound node.
r8a7795/r8a7796 salvator-x{s} need to add HDMI sound individually.

Signed-off-by: Kuninori Morimoto 
Tested-by: Nguyen Viet Dung 
---
 arch/arm64/boot/dts/renesas/salvator-common.dtsi | 38 ++--
 1 file changed, 22 insertions(+), 16 deletions(-)

diff --git a/arch/arm64/boot/dts/renesas/salvator-common.dtsi 
b/arch/arm64/boot/dts/renesas/salvator-common.dtsi
index b5b9b83..8add664 100644
--- a/arch/arm64/boot/dts/renesas/salvator-common.dtsi
+++ b/arch/arm64/boot/dts/renesas/salvator-common.dtsi
@@ -116,20 +116,12 @@
regulator-always-on;
};
 
-   rsnd_ak4613: sound {
-   compatible = "simple-audio-card";
+   sound_card: sound {
+   compatible = "audio-graph-card";
 
-   simple-audio-card,format = "left_j";
-   simple-audio-card,bitclock-master = <&sndcpu>;
-   simple-audio-card,frame-master = <&sndcpu>;
+   label = "rcar-sound";
 
-   sndcpu: simple-audio-card,cpu {
-   sound-dai = <&rcar_sound>;
-   };
-
-   sndcodec: simple-audio-card,codec {
-   sound-dai = <&ak4613>;
-   };
+   dais = <&rsnd_port0>;
};
 
vbus0_usb2: regulator-vbus0-usb2 {
@@ -376,6 +368,12 @@
asahi-kasei,out4-single-end;
asahi-kasei,out5-single-end;
asahi-kasei,out6-single-end;
+
+   port {
+   ak4613_endpoint: endpoint {
+   remote-endpoint = <&rsnd_endpoint0>;
+   };
+   };
};
 
cs2000: clk_multiplier@4f {
@@ -686,10 +684,18 @@
 <&audio_clk_c>,
 <&cpg CPG_CORE CPG_AUDIO_CLK_I>;
 
-   rcar_sound,dai {
-   dai0 {
-   playback = <&ssi0 &src0 &dvc0>;
-   capture  = <&ssi1 &src1 &dvc1>;
+   ports {
+   rsnd_port0: port@0 {
+   rsnd_endpoint0: endpoint {
+   remote-endpoint = <&ak4613_endpoint>;
+
+   dai-format = "left_j";
+   bitclock-master = <&rsnd_endpoint0>;
+   frame-master = <&rsnd_endpoint0>;
+
+   playback = <&ssi0 &src0 &dvc0>;
+   capture  = <&ssi1 &src1 &dvc1>;
+   };
};
};
 };
-- 
1.9.1



[PATCH 02/10] arm64: defconfig: Enable CONFIG_SND_AUDIO_GRAPH_CARD

2018-04-22 Thread Kuninori Morimoto

From: Kuninori Morimoto 

CONFIG_SND_AUDIO_GRAPH_CARD is needed to use HDMI sound with video

Signed-off-by: Kuninori Morimoto 
Tested-by: Nguyen Viet Dung 
---
 arch/arm64/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index ecf6137..66b4638 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -440,6 +440,7 @@ CONFIG_SND_SOC_SAMSUNG=y
 CONFIG_SND_SOC_RCAR=m
 CONFIG_SND_SOC_AK4613=m
 CONFIG_SND_SIMPLE_CARD=y
+CONFIG_SND_AUDIO_GRAPH_CARD=y
 CONFIG_USB=y
 CONFIG_USB_OTG=y
 CONFIG_USB_XHCI_HCD=y
-- 
1.9.1



[PATCH 04/10] arm64: dts: renesas: r8a7796: add HDMI sound support

2018-04-22 Thread Kuninori Morimoto

From: Kuninori Morimoto 

Signed-off-by: Kuninori Morimoto 
Tested-by: Nguyen Viet Dung 
---
 arch/arm64/boot/dts/renesas/r8a7796.dtsi | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7796.dtsi 
b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
index 599c74d..732f1ce 100644
--- a/arch/arm64/boot/dts/renesas/r8a7796.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
@@ -2380,6 +2380,10 @@
port@1 {
reg = <1>;
};
+   port@2 {
+   /* HDMI sound */
+   reg = <2>;
+   };
};
};
 
-- 
1.9.1



[PATCH 03/10] arm64: dts: renesas: r8a7795: add HDMI sound support

2018-04-22 Thread Kuninori Morimoto

From: Kuninori Morimoto 

Signed-off-by: Kuninori Morimoto 
Tested-by: Nguyen Viet Dung 
---
 arch/arm64/boot/dts/renesas/r8a7795.dtsi | 8 
 1 file changed, 8 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7795.dtsi 
b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
index 5ae85d8..2b83c4ad 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
@@ -2736,6 +2736,10 @@
port@1 {
reg = <1>;
};
+   port@2 {
+   /* HDMI sound */
+   reg = <2>;
+   };
};
};
 
@@ -2761,6 +2765,10 @@
port@1 {
reg = <1>;
};
+   port@2 {
+   /* HDMI sound */
+   reg = <2>;
+   };
};
};
 
-- 
1.9.1



[PATCH 01/10] arm64: renesas_defconfig: Enable CONFIG_SND_AUDIO_GRAPH_CARD

2018-04-22 Thread Kuninori Morimoto
From: Kuninori Morimoto 

CONFIG_SND_AUDIO_GRAPH_CARD is needed to use HDMI sound with video

Signed-off-by: Kuninori Morimoto 
Tested-by: Nguyen Viet Dung 
---
 arch/arm64/configs/renesas_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/configs/renesas_defconfig 
b/arch/arm64/configs/renesas_defconfig
index 6f3f965..c27ab6f5 100644
--- a/arch/arm64/configs/renesas_defconfig
+++ b/arch/arm64/configs/renesas_defconfig
@@ -227,6 +227,7 @@ CONFIG_SND_SOC=y
 CONFIG_SND_SOC_RCAR=y
 CONFIG_SND_SOC_AK4613=y
 CONFIG_SND_SIMPLE_CARD=y
+CONFIG_SND_AUDIO_GRAPH_CARD=y
 CONFIG_USB=y
 CONFIG_USB_OTG=y
 CONFIG_USB_XHCI_HCD=y
-- 
1.9.1



[PATCH 00/10] arm64: renesas: enable HDMI sound on Salvator

2018-04-22 Thread Kuninori Morimoto

Hi Simon

These patches enable HDMI sound on R-Car Salvator boards on H3/M3.
Basically, HDMI sound support on "driver side" was already supported,
but I didn't posted "DT side" patches, because it needed to confirm
business relationship. Now it be cleared.

But, unfortunately, DT "full_name" behavior was exchanged from v4.15.
And driver assumeed that DT is using numerical suffixes, but this idea
was rejected. Because of these reasons, it needs below patch.
Simon, can you consider these patches on below ?

git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git :: for-4.18

9ff7386656f5b7d9524ab7bdf69d508d14800d42
("ASoC: rsnd: don't assume node full path name for HDMI probing")

1)   : only for renesas, not for upstream
2)   : for defconfig
3) - 10) : based on 9ff7386656f5b7d9524ab7bdf69d508d14800d42

Kuninori Morimoto (10):
   1) arm64: renesas_defconfig: Enable CONFIG_SND_AUDIO_GRAPH_CARD
   2) arm64: defconfig: Enable CONFIG_SND_AUDIO_GRAPH_CARD
   3) arm64: dts: renesas: r8a7795: add HDMI sound support
   4) arm64: dts: renesas: r8a7796: add HDMI sound support
   5) arm64: dts: renesas: salvator-common: use audio-graph-card for Sound
   6) arm64: dts: renesas: r8a7795-es1-salvator-x: enable HDMI sound
   7) arm64: dts: renesas: r8a7795-salvator-xs: enable HDMI sound
   8) arm64: dts: renesas: r8a7796-salvator-xs: enable HDMI sound
   9) arm64: dts: renesas: r8a7795-salvator-x: enable HDMI sound
  10) arm64: dts: renesas: r8a7796-salvator-x: enable HDMI sound

 .../boot/dts/renesas/r8a7795-es1-salvator-x.dts| 46 ++
 arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts | 46 ++
 .../arm64/boot/dts/renesas/r8a7795-salvator-xs.dts | 46 ++
 arch/arm64/boot/dts/renesas/r8a7795.dtsi   |  8 
 arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts | 28 +
 .../arm64/boot/dts/renesas/r8a7796-salvator-xs.dts | 28 +
 arch/arm64/boot/dts/renesas/r8a7796.dtsi   |  4 ++
 arch/arm64/boot/dts/renesas/salvator-common.dtsi   | 38 ++
 arch/arm64/configs/defconfig   |  1 +
 arch/arm64/configs/renesas_defconfig   |  1 +
 10 files changed, 230 insertions(+), 16 deletions(-)

-- 
1.9.1



[PATCH v2 2/8] v4l: vsp1: Share the CLU, LIF and LUT set_fmt pad operation code

2018-04-22 Thread Laurent Pinchart
The implementation of the set_fmt pad operation is identical in the
three modules. Move it to a generic helper function.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/vsp1/vsp1_clu.c| 65 +--
 drivers/media/platform/vsp1/vsp1_entity.c | 75 +++
 drivers/media/platform/vsp1/vsp1_entity.h |  6 +++
 drivers/media/platform/vsp1/vsp1_lif.c| 65 +--
 drivers/media/platform/vsp1/vsp1_lut.c| 65 +--
 5 files changed, 116 insertions(+), 160 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_clu.c 
b/drivers/media/platform/vsp1/vsp1_clu.c
index 9626b6308585..96a448e1504c 100644
--- a/drivers/media/platform/vsp1/vsp1_clu.c
+++ b/drivers/media/platform/vsp1/vsp1_clu.c
@@ -114,18 +114,18 @@ static const struct v4l2_ctrl_config clu_mode_control = {
  * V4L2 Subdevice Pad Operations
  */
 
+static const unsigned int clu_codes[] = {
+   MEDIA_BUS_FMT_ARGB_1X32,
+   MEDIA_BUS_FMT_AHSV_1X32,
+   MEDIA_BUS_FMT_AYUV8_1X32,
+};
+
 static int clu_enum_mbus_code(struct v4l2_subdev *subdev,
  struct v4l2_subdev_pad_config *cfg,
  struct v4l2_subdev_mbus_code_enum *code)
 {
-   static const unsigned int codes[] = {
-   MEDIA_BUS_FMT_ARGB_1X32,
-   MEDIA_BUS_FMT_AHSV_1X32,
-   MEDIA_BUS_FMT_AYUV8_1X32,
-   };
-
-   return vsp1_subdev_enum_mbus_code(subdev, cfg, code, codes,
- ARRAY_SIZE(codes));
+   return vsp1_subdev_enum_mbus_code(subdev, cfg, code, clu_codes,
+ ARRAY_SIZE(clu_codes));
 }
 
 static int clu_enum_frame_size(struct v4l2_subdev *subdev,
@@ -141,51 +141,10 @@ static int clu_set_format(struct v4l2_subdev *subdev,
  struct v4l2_subdev_pad_config *cfg,
  struct v4l2_subdev_format *fmt)
 {
-   struct vsp1_clu *clu = to_clu(subdev);
-   struct v4l2_subdev_pad_config *config;
-   struct v4l2_mbus_framefmt *format;
-   int ret = 0;
-
-   mutex_lock(&clu->entity.lock);
-
-   config = vsp1_entity_get_pad_config(&clu->entity, cfg, fmt->which);
-   if (!config) {
-   ret = -EINVAL;
-   goto done;
-   }
-
-   /* Default to YUV if the requested format is not supported. */
-   if (fmt->format.code != MEDIA_BUS_FMT_ARGB_1X32 &&
-   fmt->format.code != MEDIA_BUS_FMT_AHSV_1X32 &&
-   fmt->format.code != MEDIA_BUS_FMT_AYUV8_1X32)
-   fmt->format.code = MEDIA_BUS_FMT_AYUV8_1X32;
-
-   format = vsp1_entity_get_pad_format(&clu->entity, config, fmt->pad);
-
-   if (fmt->pad == CLU_PAD_SOURCE) {
-   /* The CLU output format can't be modified. */
-   fmt->format = *format;
-   goto done;
-   }
-
-   format->code = fmt->format.code;
-   format->width = clamp_t(unsigned int, fmt->format.width,
-   CLU_MIN_SIZE, CLU_MAX_SIZE);
-   format->height = clamp_t(unsigned int, fmt->format.height,
-CLU_MIN_SIZE, CLU_MAX_SIZE);
-   format->field = V4L2_FIELD_NONE;
-   format->colorspace = V4L2_COLORSPACE_SRGB;
-
-   fmt->format = *format;
-
-   /* Propagate the format to the source pad. */
-   format = vsp1_entity_get_pad_format(&clu->entity, config,
-   CLU_PAD_SOURCE);
-   *format = fmt->format;
-
-done:
-   mutex_unlock(&clu->entity.lock);
-   return ret;
+   return vsp1_subdev_set_pad_format(subdev, cfg, fmt, clu_codes,
+ ARRAY_SIZE(clu_codes),
+ CLU_MIN_SIZE, CLU_MIN_SIZE,
+ CLU_MAX_SIZE, CLU_MAX_SIZE);
 }
 
 /* 
-
diff --git a/drivers/media/platform/vsp1/vsp1_entity.c 
b/drivers/media/platform/vsp1/vsp1_entity.c
index 72354caf5746..239df047efd0 100644
--- a/drivers/media/platform/vsp1/vsp1_entity.c
+++ b/drivers/media/platform/vsp1/vsp1_entity.c
@@ -307,6 +307,81 @@ int vsp1_subdev_enum_frame_size(struct v4l2_subdev *subdev,
return ret;
 }
 
+/*
+ * vsp1_subdev_set_pad_format - Subdev pad set_fmt handler
+ * @subdev: V4L2 subdevice
+ * @cfg: V4L2 subdev pad configuration
+ * @fmt: V4L2 subdev format
+ * @codes: Array of supported media bus codes
+ * @ncodes: Number of supported media bus codes
+ * @min_width: Minimum image width
+ * @min_height: Minimum image height
+ * @max_width: Maximum image width
+ * @max_height: Maximum image height
+ *
+ * This function implements the subdev set_fmt pad operation for entities that
+ * do not support scaling or cropping. It defaults to the first supplied media
+ * bus code if the requested code isn't supported, clamps the size to

[PATCH v2 6/8] v4l: vsp1: Add support for the DISCOM entity

2018-04-22 Thread Laurent Pinchart
The DISCOM calculates a CRC on a configurable window of the frame. It
interfaces to the VSP through the UIF glue, hence the name used in the
code.

The module supports configuration of the CRC window through the crop
rectangle on the ink pad of the corresponding entity. However, unlike
the traditional V4L2 subdevice model, the crop rectangle does not
influence the format on the source pad.

Modeling the DISCOM as a sink-only entity would allow adhering to the
V4L2 subdevice model at the expense of more complex code in the driver,
as at the hardware level the UIF is handled as a sink+source entity. As
the DISCOM is only present in R-Car Gen3 VSP-D and VSP-DL instances it
is not exposed to userspace through V4L2 but controlled through the DU
driver. We can thus change this model later if needed without fear of
affecting userspace.

Signed-off-by: Laurent Pinchart 
---
Changes since v1:

- Don't return uninitialized value from uif_set_selection()
---
 drivers/media/platform/vsp1/Makefile  |   2 +-
 drivers/media/platform/vsp1/vsp1.h|   4 +
 drivers/media/platform/vsp1/vsp1_drv.c|  20 +++
 drivers/media/platform/vsp1/vsp1_entity.c |   6 +
 drivers/media/platform/vsp1/vsp1_entity.h |   1 +
 drivers/media/platform/vsp1/vsp1_regs.h   |  41 +
 drivers/media/platform/vsp1/vsp1_uif.c| 271 ++
 drivers/media/platform/vsp1/vsp1_uif.h|  32 
 8 files changed, 376 insertions(+), 1 deletion(-)
 create mode 100644 drivers/media/platform/vsp1/vsp1_uif.c
 create mode 100644 drivers/media/platform/vsp1/vsp1_uif.h

diff --git a/drivers/media/platform/vsp1/Makefile 
b/drivers/media/platform/vsp1/Makefile
index 596775f932c0..4bb4dcbef7b5 100644
--- a/drivers/media/platform/vsp1/Makefile
+++ b/drivers/media/platform/vsp1/Makefile
@@ -5,6 +5,6 @@ vsp1-y  += vsp1_rpf.o 
vsp1_rwpf.o vsp1_wpf.o
 vsp1-y += vsp1_clu.o vsp1_hsit.o vsp1_lut.o
 vsp1-y += vsp1_brx.o vsp1_sru.o vsp1_uds.o
 vsp1-y += vsp1_hgo.o vsp1_hgt.o vsp1_histo.o
-vsp1-y += vsp1_lif.o
+vsp1-y += vsp1_lif.o vsp1_uif.o
 
 obj-$(CONFIG_VIDEO_RENESAS_VSP1)   += vsp1.o
diff --git a/drivers/media/platform/vsp1/vsp1.h 
b/drivers/media/platform/vsp1/vsp1.h
index 9cf4e1c4b036..33f632331474 100644
--- a/drivers/media/platform/vsp1/vsp1.h
+++ b/drivers/media/platform/vsp1/vsp1.h
@@ -36,10 +36,12 @@ struct vsp1_lut;
 struct vsp1_rwpf;
 struct vsp1_sru;
 struct vsp1_uds;
+struct vsp1_uif;
 
 #define VSP1_MAX_LIF   2
 #define VSP1_MAX_RPF   5
 #define VSP1_MAX_UDS   3
+#define VSP1_MAX_UIF   2
 #define VSP1_MAX_WPF   4
 
 #define VSP1_HAS_LUT   (1 << 1)
@@ -60,6 +62,7 @@ struct vsp1_device_info {
unsigned int lif_count;
unsigned int rpf_count;
unsigned int uds_count;
+   unsigned int uif_count;
unsigned int wpf_count;
unsigned int num_bru_inputs;
bool uapi;
@@ -86,6 +89,7 @@ struct vsp1_device {
struct vsp1_rwpf *rpf[VSP1_MAX_RPF];
struct vsp1_sru *sru;
struct vsp1_uds *uds[VSP1_MAX_UDS];
+   struct vsp1_uif *uif[VSP1_MAX_UIF];
struct vsp1_rwpf *wpf[VSP1_MAX_WPF];
 
struct list_head entities;
diff --git a/drivers/media/platform/vsp1/vsp1_drv.c 
b/drivers/media/platform/vsp1/vsp1_drv.c
index 331a2e0af0d3..d29f9c4baebe 100644
--- a/drivers/media/platform/vsp1/vsp1_drv.c
+++ b/drivers/media/platform/vsp1/vsp1_drv.c
@@ -35,6 +35,7 @@
 #include "vsp1_rwpf.h"
 #include "vsp1_sru.h"
 #include "vsp1_uds.h"
+#include "vsp1_uif.h"
 #include "vsp1_video.h"
 
 /* 
-
@@ -409,6 +410,19 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
list_add_tail(&uds->entity.list_dev, &vsp1->entities);
}
 
+   for (i = 0; i < vsp1->info->uif_count; ++i) {
+   struct vsp1_uif *uif;
+
+   uif = vsp1_uif_create(vsp1, i);
+   if (IS_ERR(uif)) {
+   ret = PTR_ERR(uif);
+   goto done;
+   }
+
+   vsp1->uif[i] = uif;
+   list_add_tail(&uif->entity.list_dev, &vsp1->entities);
+   }
+
for (i = 0; i < vsp1->info->wpf_count; ++i) {
struct vsp1_rwpf *wpf;
 
@@ -513,6 +527,9 @@ static int vsp1_device_init(struct vsp1_device *vsp1)
for (i = 0; i < vsp1->info->uds_count; ++i)
vsp1_write(vsp1, VI6_DPR_UDS_ROUTE(i), VI6_DPR_NODE_UNUSED);
 
+   for (i = 0; i < vsp1->info->uif_count; ++i)
+   vsp1_write(vsp1, VI6_DPR_UIF_ROUTE(i), VI6_DPR_NODE_UNUSED);
+
vsp1_write(vsp1, VI6_DPR_SRU_ROUTE, VI6_DPR_NODE_UNUSED);
vsp1_write(vsp1, VI6_DPR_LUT_ROUTE, VI6_DPR_NODE_UNUSED);
vsp1_write(vsp1, VI6_DPR_CLU_ROUTE, VI6_DPR_NODE_UNUSED);

[PATCH v2 8/8] drm: rcar-du: Add support for CRC computation

2018-04-22 Thread Laurent Pinchart
Implement CRC computation configuration and reporting through the DRM
debugfs-based CRC API. The CRC source can be configured to any input
plane or the pipeline output.

Signed-off-by: Laurent Pinchart 
---
Changes since v1:

- Format the source names using plane IDs instead of plane indices
---
 drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 156 +++--
 drivers/gpu/drm/rcar-du/rcar_du_crtc.h |  19 
 drivers/gpu/drm/rcar-du/rcar_du_vsp.c  |   7 ++
 3 files changed, 176 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c 
b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
index c4420538ec85..d71d709fe3d9 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
@@ -691,6 +691,52 @@ static const struct drm_crtc_helper_funcs 
crtc_helper_funcs = {
.atomic_disable = rcar_du_crtc_atomic_disable,
 };
 
+static struct drm_crtc_state *
+rcar_du_crtc_atomic_duplicate_state(struct drm_crtc *crtc)
+{
+   struct rcar_du_crtc_state *state;
+   struct rcar_du_crtc_state *copy;
+
+   if (WARN_ON(!crtc->state))
+   return NULL;
+
+   state = to_rcar_crtc_state(crtc->state);
+   copy = kmemdup(state, sizeof(*state), GFP_KERNEL);
+   if (copy == NULL)
+   return NULL;
+
+   __drm_atomic_helper_crtc_duplicate_state(crtc, ©->state);
+
+   return ©->state;
+}
+
+static void rcar_du_crtc_atomic_destroy_state(struct drm_crtc *crtc,
+ struct drm_crtc_state *state)
+{
+   __drm_atomic_helper_crtc_destroy_state(state);
+   kfree(to_rcar_crtc_state(state));
+}
+
+static void rcar_du_crtc_reset(struct drm_crtc *crtc)
+{
+   struct rcar_du_crtc_state *state;
+
+   if (crtc->state) {
+   rcar_du_crtc_atomic_destroy_state(crtc, crtc->state);
+   crtc->state = NULL;
+   }
+
+   state = kzalloc(sizeof(*state), GFP_KERNEL);
+   if (state == NULL)
+   return;
+
+   state->crc.source = VSP1_DU_CRC_NONE;
+   state->crc.index = 0;
+
+   crtc->state = &state->state;
+   crtc->state->crtc = crtc;
+}
+
 static int rcar_du_crtc_enable_vblank(struct drm_crtc *crtc)
 {
struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc);
@@ -710,15 +756,111 @@ static void rcar_du_crtc_disable_vblank(struct drm_crtc 
*crtc)
rcrtc->vblank_enable = false;
 }
 
-static const struct drm_crtc_funcs crtc_funcs = {
-   .reset = drm_atomic_helper_crtc_reset,
+static int rcar_du_crtc_set_crc_source(struct drm_crtc *crtc,
+  const char *source_name,
+  size_t *values_cnt)
+{
+   struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc);
+   struct drm_modeset_acquire_ctx ctx;
+   struct drm_crtc_state *crtc_state;
+   struct drm_atomic_state *state;
+   enum vsp1_du_crc_source source;
+   unsigned int index = 0;
+   unsigned int i;
+   int ret;
+
+   /*
+* Parse the source name. Supported values are "plane%u" to compute the
+* CRC on an input plane (%u is the plane ID), and "auto" to compute the
+* CRC on the composer (VSP) output.
+*/
+   if (!source_name) {
+   source = VSP1_DU_CRC_NONE;
+   } else if (!strcmp(source_name, "auto")) {
+   source = VSP1_DU_CRC_OUTPUT;
+   } else if (strstarts(source_name, "plane")) {
+   source = VSP1_DU_CRC_PLANE;
+
+   ret = kstrtouint(source_name + strlen("plane"), 10, &index);
+   if (ret < 0)
+   return ret;
+
+   for (i = 0; i < rcrtc->vsp->num_planes; ++i) {
+   if (index == rcrtc->vsp->planes[i].plane.base.id) {
+   index = i;
+   break;
+   }
+   }
+
+   if (i >= rcrtc->vsp->num_planes)
+   return -EINVAL;
+   } else {
+   return -EINVAL;
+   }
+
+   *values_cnt = 1;
+
+   /* Perform an atomic commit to set the CRC source. */
+   drm_modeset_acquire_init(&ctx, 0);
+
+   state = drm_atomic_state_alloc(crtc->dev);
+   if (!state) {
+   ret = -ENOMEM;
+   goto unlock;
+   }
+
+   state->acquire_ctx = &ctx;
+
+retry:
+   crtc_state = drm_atomic_get_crtc_state(state, crtc);
+   if (!IS_ERR(crtc_state)) {
+   struct rcar_du_crtc_state *rcrtc_state;
+
+   rcrtc_state = to_rcar_crtc_state(crtc_state);
+   rcrtc_state->crc.source = source;
+   rcrtc_state->crc.index = index;
+
+   ret = drm_atomic_commit(state);
+   } else {
+   ret = PTR_ERR(crtc_state);
+   }
+
+   if (ret == -EDEADLK) {
+   drm_atomic_state_clear(state);
+   drm_modeset_backoff(&ctx);
+   goto retry;
+   }
+
+   drm_ato

[PATCH v2 5/8] v4l: vsp1: Extend the DU API to support CRC computation

2018-04-22 Thread Laurent Pinchart
Add a parameter (in the form of a structure to ease future API
extensions) to the VSP atomic flush handler to pass CRC source
configuration, and pass the CRC value to the completion callback.

Signed-off-by: Laurent Pinchart 
---
 drivers/gpu/drm/rcar-du/rcar_du_vsp.c  |  6 --
 drivers/media/platform/vsp1/vsp1_drm.c |  6 --
 drivers/media/platform/vsp1/vsp1_drm.h |  2 +-
 include/media/vsp1.h   | 29 +++--
 4 files changed, 36 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c 
b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
index 2c260c33840b..bdcec201591f 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
@@ -31,7 +31,7 @@
 #include "rcar_du_kms.h"
 #include "rcar_du_vsp.h"
 
-static void rcar_du_vsp_complete(void *private, bool completed)
+static void rcar_du_vsp_complete(void *private, bool completed, u32 crc)
 {
struct rcar_du_crtc *crtc = private;
 
@@ -102,7 +102,9 @@ void rcar_du_vsp_atomic_begin(struct rcar_du_crtc *crtc)
 
 void rcar_du_vsp_atomic_flush(struct rcar_du_crtc *crtc)
 {
-   vsp1_du_atomic_flush(crtc->vsp->vsp, crtc->vsp_pipe);
+   struct vsp1_du_atomic_pipe_config cfg = { { 0, } };
+
+   vsp1_du_atomic_flush(crtc->vsp->vsp, crtc->vsp_pipe, &cfg);
 }
 
 /* Keep the two tables in sync. */
diff --git a/drivers/media/platform/vsp1/vsp1_drm.c 
b/drivers/media/platform/vsp1/vsp1_drm.c
index 2b29a83dceb9..5fc31578f9b0 100644
--- a/drivers/media/platform/vsp1/vsp1_drm.c
+++ b/drivers/media/platform/vsp1/vsp1_drm.c
@@ -36,7 +36,7 @@ static void vsp1_du_pipeline_frame_end(struct vsp1_pipeline 
*pipe,
bool complete = completion == VSP1_DL_FRAME_END_COMPLETED;
 
if (drm_pipe->du_complete)
-   drm_pipe->du_complete(drm_pipe->du_private, complete);
+   drm_pipe->du_complete(drm_pipe->du_private, complete, 0);
 
if (completion & VSP1_DL_FRAME_END_INTERNAL) {
drm_pipe->force_brx_release = false;
@@ -739,8 +739,10 @@ EXPORT_SYMBOL_GPL(vsp1_du_atomic_update);
  * vsp1_du_atomic_flush - Commit an atomic update
  * @dev: the VSP device
  * @pipe_index: the DRM pipeline index
+ * @cfg: atomic pipe configuration
  */
-void vsp1_du_atomic_flush(struct device *dev, unsigned int pipe_index)
+void vsp1_du_atomic_flush(struct device *dev, unsigned int pipe_index,
+ const struct vsp1_du_atomic_pipe_config *cfg)
 {
struct vsp1_device *vsp1 = dev_get_drvdata(dev);
struct vsp1_drm_pipeline *drm_pipe = &vsp1->drm->pipe[pipe_index];
diff --git a/drivers/media/platform/vsp1/vsp1_drm.h 
b/drivers/media/platform/vsp1/vsp1_drm.h
index f4af1b2b12d6..e5b88b28806c 100644
--- a/drivers/media/platform/vsp1/vsp1_drm.h
+++ b/drivers/media/platform/vsp1/vsp1_drm.h
@@ -35,7 +35,7 @@ struct vsp1_drm_pipeline {
wait_queue_head_t wait_queue;
 
/* Frame synchronisation */
-   void (*du_complete)(void *, bool);
+   void (*du_complete)(void *data, bool completed, u32 crc);
void *du_private;
 };
 
diff --git a/include/media/vsp1.h b/include/media/vsp1.h
index ff7ef894465d..ac63a9928a79 100644
--- a/include/media/vsp1.h
+++ b/include/media/vsp1.h
@@ -34,7 +34,7 @@ struct vsp1_du_lif_config {
unsigned int width;
unsigned int height;
 
-   void (*callback)(void *, bool);
+   void (*callback)(void *data, bool completed, u32 crc);
void *callback_data;
 };
 
@@ -61,11 +61,36 @@ struct vsp1_du_atomic_config {
unsigned int zpos;
 };
 
+/**
+ * enum vsp1_du_crc_source - Source used for CRC calculation
+ * @VSP1_DU_CRC_NONE: CRC calculation disabled
+ * @VSP_DU_CRC_PLANE: Perform CRC calculation on an input plane
+ * @VSP_DU_CRC_OUTPUT: Perform CRC calculation on the composed output
+ */
+enum vsp1_du_crc_source {
+   VSP1_DU_CRC_NONE,
+   VSP1_DU_CRC_PLANE,
+   VSP1_DU_CRC_OUTPUT,
+};
+
+/**
+ * struct vsp1_du_atomic_pipe_config - VSP atomic pipe configuration parameters
+ * @crc.source: source for CRC calculation
+ * @crc.index: index of the CRC source plane (when crc.source is set to plane)
+ */
+struct vsp1_du_atomic_pipe_config {
+   struct  {
+   enum vsp1_du_crc_source source;
+   unsigned int index;
+   } crc;
+};
+
 void vsp1_du_atomic_begin(struct device *dev, unsigned int pipe_index);
 int vsp1_du_atomic_update(struct device *dev, unsigned int pipe_index,
  unsigned int rpf,
  const struct vsp1_du_atomic_config *cfg);
-void vsp1_du_atomic_flush(struct device *dev, unsigned int pipe_index);
+void vsp1_du_atomic_flush(struct device *dev, unsigned int pipe_index,
+ const struct vsp1_du_atomic_pipe_config *cfg);
 int vsp1_du_map_sg(struct device *dev, struct sg_table *sgt);
 void vsp1_du_unmap_sg(struct device *dev, struct sg_table *sgt);
 
-- 
Regards,

Laurent Pinchart



[PATCH v2 4/8] v4l: vsp1: Document the vsp1_du_atomic_config structure

2018-04-22 Thread Laurent Pinchart
The structure is used in the API that the VSP1 driver exposes to the DU
driver. Documenting it is thus important.

Signed-off-by: Laurent Pinchart 
---
Changes since v1:

- Fixed typo
---
 include/media/vsp1.h | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/include/media/vsp1.h b/include/media/vsp1.h
index 68a8abe4fac5..ff7ef894465d 100644
--- a/include/media/vsp1.h
+++ b/include/media/vsp1.h
@@ -41,6 +41,16 @@ struct vsp1_du_lif_config {
 int vsp1_du_setup_lif(struct device *dev, unsigned int pipe_index,
  const struct vsp1_du_lif_config *cfg);
 
+/**
+ * struct vsp1_du_atomic_config - VSP atomic configuration parameters
+ * @pixelformat: plane pixel format (V4L2 4CC)
+ * @pitch: line pitch in bytes, for all planes
+ * @mem: DMA memory address for each plane of the frame buffer
+ * @src: source rectangle in the frame buffer (integer coordinates)
+ * @dst: destination rectangle on the display (integer coordinates)
+ * @alpha: alpha value (0: fully transparent, 255: fully opaque)
+ * @zpos: Z position of the plane (from 0 to number of planes minus 1)
+ */
 struct vsp1_du_atomic_config {
u32 pixelformat;
unsigned int pitch;
-- 
Regards,

Laurent Pinchart



[PATCH v2 7/8] v4l: vsp1: Integrate DISCOM in display pipeline

2018-04-22 Thread Laurent Pinchart
The DISCOM is used to compute CRCs on display frames. Integrate it in
the display pipeline at the output of the blending unit to process
output frames.

Computing CRCs on input frames is possible by positioning the DISCOM at
a different point in the pipeline. This use case isn't supported at the
moment and could be implemented by extending the API between the VSP1
and DU drivers if needed.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/vsp1/vsp1_drm.c | 115 -
 drivers/media/platform/vsp1/vsp1_drm.h |  12 
 2 files changed, 124 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_drm.c 
b/drivers/media/platform/vsp1/vsp1_drm.c
index 5fc31578f9b0..7864b43a90e1 100644
--- a/drivers/media/platform/vsp1/vsp1_drm.c
+++ b/drivers/media/platform/vsp1/vsp1_drm.c
@@ -22,6 +22,7 @@
 #include "vsp1_lif.h"
 #include "vsp1_pipe.h"
 #include "vsp1_rwpf.h"
+#include "vsp1_uif.h"
 
 #define BRX_NAME(e)(e)->type == VSP1_ENTITY_BRU ? "BRU" : "BRS"
 
@@ -35,8 +36,13 @@ static void vsp1_du_pipeline_frame_end(struct vsp1_pipeline 
*pipe,
struct vsp1_drm_pipeline *drm_pipe = to_vsp1_drm_pipeline(pipe);
bool complete = completion == VSP1_DL_FRAME_END_COMPLETED;
 
-   if (drm_pipe->du_complete)
-   drm_pipe->du_complete(drm_pipe->du_private, complete, 0);
+   if (drm_pipe->du_complete) {
+   struct vsp1_entity *uif = drm_pipe->uif;
+   u32 crc;
+
+   crc = uif ? vsp1_uif_get_crc(to_uif(&uif->subdev)) : 0;
+   drm_pipe->du_complete(drm_pipe->du_private, complete, crc);
+   }
 
if (completion & VSP1_DL_FRAME_END_INTERNAL) {
drm_pipe->force_brx_release = false;
@@ -48,10 +54,65 @@ static void vsp1_du_pipeline_frame_end(struct vsp1_pipeline 
*pipe,
  * Pipeline Configuration
  */
 
+/*
+ * Insert the UIF in the pipeline between the prev and next entities. If no UIF
+ * is available connect the two entities directly.
+ */
+static int vsp1_du_insert_uif(struct vsp1_device *vsp1,
+ struct vsp1_pipeline *pipe,
+ struct vsp1_entity *uif,
+ struct vsp1_entity *prev, unsigned int prev_pad,
+ struct vsp1_entity *next, unsigned int next_pad)
+{
+   int ret;
+
+   if (uif) {
+   struct v4l2_subdev_format format;
+
+   prev->sink = uif;
+   prev->sink_pad = UIF_PAD_SINK;
+
+   memset(&format, 0, sizeof(format));
+   format.which = V4L2_SUBDEV_FORMAT_ACTIVE;
+   format.pad = prev_pad;
+
+   ret = v4l2_subdev_call(&prev->subdev, pad, get_fmt, NULL,
+  &format);
+   if (ret < 0)
+   return ret;
+
+   format.pad = UIF_PAD_SINK;
+
+   ret = v4l2_subdev_call(&uif->subdev, pad, set_fmt, NULL,
+  &format);
+   if (ret < 0)
+   return ret;
+
+   dev_dbg(vsp1->dev, "%s: set format %ux%u (%x) on UIF sink\n",
+   __func__, format.format.width, format.format.height,
+   format.format.code);
+
+   /*
+* The UIF doesn't mangle the format between its sink and
+* source pads, so there is no need to retrieve the format on
+* its source pad.
+*/
+
+   uif->sink = next;
+   uif->sink_pad = next_pad;
+   } else {
+   prev->sink = next;
+   prev->sink_pad = next_pad;
+   }
+
+   return 0;
+}
+
 /* Setup one RPF and the connected BRx sink pad. */
 static int vsp1_du_pipeline_setup_rpf(struct vsp1_device *vsp1,
  struct vsp1_pipeline *pipe,
  struct vsp1_rwpf *rpf,
+ struct vsp1_entity *uif,
  unsigned int brx_input)
 {
struct v4l2_subdev_selection sel;
@@ -122,6 +183,12 @@ static int vsp1_du_pipeline_setup_rpf(struct vsp1_device 
*vsp1,
if (ret < 0)
return ret;
 
+   /* Insert and configure the UIF if available. */
+   ret = vsp1_du_insert_uif(vsp1, pipe, uif, &rpf->entity, RWPF_PAD_SOURCE,
+pipe->brx, brx_input);
+   if (ret < 0)
+   return ret;
+
/* BRx sink, propagate the format from the RPF source. */
format.pad = brx_input;
 
@@ -297,7 +364,10 @@ static unsigned int rpf_zpos(struct vsp1_device *vsp1, 
struct vsp1_rwpf *rpf)
 static int vsp1_du_pipeline_setup_inputs(struct vsp1_device *vsp1,
struct vsp1_pipeline *pipe)
 {
+   struct vsp1_drm_pipeline *drm_pipe = to_vsp1_drm_pipeline(pipe);
struct vsp1_rwpf *inputs[VSP1_MAX_RPF] = { NULL, };

[PATCH v2 1/8] v4l: vsp1: Use SPDX license headers

2018-04-22 Thread Laurent Pinchart
Adopt the SPDX license identifier headers to ease license compliance
management. All files in the driver are licensed under the GPLv2+ except
for the vsp1_regs.h file which is licensed under the GPLv2. This is
likely an oversight, but fixing this requires contacting the copyright
owners and is out of scope for this patch.

While at it fix the file descriptions to match file names where copy and
paste error occurred.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/vsp1/vsp1.h| 6 +-
 drivers/media/platform/vsp1/vsp1_brx.c| 6 +-
 drivers/media/platform/vsp1/vsp1_brx.h| 6 +-
 drivers/media/platform/vsp1/vsp1_clu.c| 6 +-
 drivers/media/platform/vsp1/vsp1_clu.h| 6 +-
 drivers/media/platform/vsp1/vsp1_dl.c | 8 ++--
 drivers/media/platform/vsp1/vsp1_dl.h | 6 +-
 drivers/media/platform/vsp1/vsp1_drm.c| 8 ++--
 drivers/media/platform/vsp1/vsp1_drm.h| 6 +-
 drivers/media/platform/vsp1/vsp1_drv.c| 6 +-
 drivers/media/platform/vsp1/vsp1_entity.c | 6 +-
 drivers/media/platform/vsp1/vsp1_entity.h | 6 +-
 drivers/media/platform/vsp1/vsp1_hgo.c| 6 +-
 drivers/media/platform/vsp1/vsp1_hgo.h| 6 +-
 drivers/media/platform/vsp1/vsp1_hgt.c| 6 +-
 drivers/media/platform/vsp1/vsp1_hgt.h| 6 +-
 drivers/media/platform/vsp1/vsp1_histo.c  | 6 +-
 drivers/media/platform/vsp1/vsp1_histo.h  | 6 +-
 drivers/media/platform/vsp1/vsp1_hsit.c   | 6 +-
 drivers/media/platform/vsp1/vsp1_hsit.h   | 6 +-
 drivers/media/platform/vsp1/vsp1_lif.c| 6 +-
 drivers/media/platform/vsp1/vsp1_lif.h| 6 +-
 drivers/media/platform/vsp1/vsp1_lut.c| 6 +-
 drivers/media/platform/vsp1/vsp1_lut.h| 6 +-
 drivers/media/platform/vsp1/vsp1_pipe.c   | 6 +-
 drivers/media/platform/vsp1/vsp1_pipe.h   | 6 +-
 drivers/media/platform/vsp1/vsp1_regs.h   | 5 +
 drivers/media/platform/vsp1/vsp1_rpf.c| 6 +-
 drivers/media/platform/vsp1/vsp1_rwpf.c   | 6 +-
 drivers/media/platform/vsp1/vsp1_rwpf.h   | 6 +-
 drivers/media/platform/vsp1/vsp1_sru.c| 6 +-
 drivers/media/platform/vsp1/vsp1_sru.h| 6 +-
 drivers/media/platform/vsp1/vsp1_uds.c| 6 +-
 drivers/media/platform/vsp1/vsp1_uds.h| 6 +-
 drivers/media/platform/vsp1/vsp1_video.c  | 6 +-
 drivers/media/platform/vsp1/vsp1_video.h  | 6 +-
 drivers/media/platform/vsp1/vsp1_wpf.c| 6 +-
 37 files changed, 39 insertions(+), 186 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1.h 
b/drivers/media/platform/vsp1/vsp1.h
index 894cc725c2d4..9cf4e1c4b036 100644
--- a/drivers/media/platform/vsp1/vsp1.h
+++ b/drivers/media/platform/vsp1/vsp1.h
@@ -1,14 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
 /*
  * vsp1.h  --  R-Car VSP1 Driver
  *
  * Copyright (C) 2013-2014 Renesas Electronics Corporation
  *
  * Contact: Laurent Pinchart (laurent.pinch...@ideasonboard.com)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
  */
 #ifndef __VSP1_H__
 #define __VSP1_H__
diff --git a/drivers/media/platform/vsp1/vsp1_brx.c 
b/drivers/media/platform/vsp1/vsp1_brx.c
index b4af1d546022..3beec18fd863 100644
--- a/drivers/media/platform/vsp1/vsp1_brx.c
+++ b/drivers/media/platform/vsp1/vsp1_brx.c
@@ -1,14 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * vsp1_brx.c  --  R-Car VSP1 Blend ROP Unit (BRU and BRS)
  *
  * Copyright (C) 2013 Renesas Corporation
  *
  * Contact: Laurent Pinchart (laurent.pinch...@ideasonboard.com)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
  */
 
 #include 
diff --git a/drivers/media/platform/vsp1/vsp1_brx.h 
b/drivers/media/platform/vsp1/vsp1_brx.h
index 927aa4254c0f..6abbb8c3343c 100644
--- a/drivers/media/platform/vsp1/vsp1_brx.h
+++ b/drivers/media/platform/vsp1/vsp1_brx.h
@@ -1,14 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
 /*
  * vsp1_brx.h  --  R-Car VSP1 Blend ROP Unit (BRU and BRS)
  *
  * Copyright (C) 2013 Renesas Corporation
  *
  * Contact: Laurent Pinchart (laurent.pinch...@ideasonboard.com)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
  */
 #ifndef __VSP1_BRX_H__
 #define __VSP1_BRX_H__
diff --git a/drivers/media/platform/vsp1/vsp1_clu.c 
b/drivers/media/platform/vsp1/vsp1_clu.c
index f2fb26e5ab4e..9626b6308585 100644
--- a/drivers/media/platform/vsp1/vsp1_clu.c
+++ b/drivers/media/platform/vsp1/vsp1_clu.c
@

[PATCH v2 3/8] v4l: vsp1: Reset the crop and compose rectangles in the set_fmt helper

2018-04-22 Thread Laurent Pinchart
To make vsp1_subdev_set_pad_format() usable by entities that support
selection rectangles, we need to reset the crop and compose rectangles
when setting the format on the sink pad. Do so and replace the custom
set_fmt implementation of the histogram code by a call to
vsp1_subdev_set_pad_format().

Resetting the crop and compose rectangles for entities that don't
support crop and compose has no adverse effect as the rectangles are
ignored anyway.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/vsp1/vsp1_entity.c | 16 +
 drivers/media/platform/vsp1/vsp1_histo.c  | 59 +++
 2 files changed, 20 insertions(+), 55 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_entity.c 
b/drivers/media/platform/vsp1/vsp1_entity.c
index 239df047efd0..181a583aecad 100644
--- a/drivers/media/platform/vsp1/vsp1_entity.c
+++ b/drivers/media/platform/vsp1/vsp1_entity.c
@@ -335,6 +335,7 @@ int vsp1_subdev_set_pad_format(struct v4l2_subdev *subdev,
struct vsp1_entity *entity = to_vsp1_entity(subdev);
struct v4l2_subdev_pad_config *config;
struct v4l2_mbus_framefmt *format;
+   struct v4l2_rect *selection;
unsigned int i;
int ret = 0;
 
@@ -377,6 +378,21 @@ int vsp1_subdev_set_pad_format(struct v4l2_subdev *subdev,
format = vsp1_entity_get_pad_format(entity, config, 1);
*format = fmt->format;
 
+   /* Reset the crop and compose rectangles */
+   selection = vsp1_entity_get_pad_selection(entity, config, fmt->pad,
+ V4L2_SEL_TGT_CROP);
+   selection->left = 0;
+   selection->top = 0;
+   selection->width = format->width;
+   selection->height = format->height;
+
+   selection = vsp1_entity_get_pad_selection(entity, config, fmt->pad,
+ V4L2_SEL_TGT_COMPOSE);
+   selection->left = 0;
+   selection->top = 0;
+   selection->width = format->width;
+   selection->height = format->height;
+
 done:
mutex_unlock(&entity->lock);
return ret;
diff --git a/drivers/media/platform/vsp1/vsp1_histo.c 
b/drivers/media/platform/vsp1/vsp1_histo.c
index 029181c1fb61..5e15c8ff88d9 100644
--- a/drivers/media/platform/vsp1/vsp1_histo.c
+++ b/drivers/media/platform/vsp1/vsp1_histo.c
@@ -389,65 +389,14 @@ static int histo_set_format(struct v4l2_subdev *subdev,
struct v4l2_subdev_format *fmt)
 {
struct vsp1_histogram *histo = subdev_to_histo(subdev);
-   struct v4l2_subdev_pad_config *config;
-   struct v4l2_mbus_framefmt *format;
-   struct v4l2_rect *selection;
-   unsigned int i;
-   int ret = 0;
 
if (fmt->pad != HISTO_PAD_SINK)
return histo_get_format(subdev, cfg, fmt);
 
-   mutex_lock(&histo->entity.lock);
-
-   config = vsp1_entity_get_pad_config(&histo->entity, cfg, fmt->which);
-   if (!config) {
-   ret = -EINVAL;
-   goto done;
-   }
-
-   /*
-* Default to the first format if the requested format is not
-* supported.
-*/
-   for (i = 0; i < histo->num_formats; ++i) {
-   if (fmt->format.code == histo->formats[i])
-   break;
-   }
-   if (i == histo->num_formats)
-   fmt->format.code = histo->formats[0];
-
-   format = vsp1_entity_get_pad_format(&histo->entity, config, fmt->pad);
-
-   format->code = fmt->format.code;
-   format->width = clamp_t(unsigned int, fmt->format.width,
-   HISTO_MIN_SIZE, HISTO_MAX_SIZE);
-   format->height = clamp_t(unsigned int, fmt->format.height,
-HISTO_MIN_SIZE, HISTO_MAX_SIZE);
-   format->field = V4L2_FIELD_NONE;
-   format->colorspace = V4L2_COLORSPACE_SRGB;
-
-   fmt->format = *format;
-
-   /* Reset the crop and compose rectangles */
-   selection = vsp1_entity_get_pad_selection(&histo->entity, config,
- fmt->pad, V4L2_SEL_TGT_CROP);
-   selection->left = 0;
-   selection->top = 0;
-   selection->width = format->width;
-   selection->height = format->height;
-
-   selection = vsp1_entity_get_pad_selection(&histo->entity, config,
- fmt->pad,
- V4L2_SEL_TGT_COMPOSE);
-   selection->left = 0;
-   selection->top = 0;
-   selection->width = format->width;
-   selection->height = format->height;
-
-done:
-   mutex_unlock(&histo->entity.lock);
-   return ret;
+   return vsp1_subdev_set_pad_format(subdev, cfg, fmt,
+ histo->formats, histo->num_formats,
+ HISTO_MIN_SIZE, HISTO_MIN_SIZE,
+ HISTO_MAX_SIZE, HISTO_MAX_SIZE);
 }
 
 static const struct v4l2_subd

[PATCH v2 0/8] R-Car DU: Support CRC calculation

2018-04-22 Thread Laurent Pinchart
Hello,

This patch series adds support for CRC calculation to the rcar-du-drm driver.

CRC calculation is supported starting at the Renesas R-Car Gen3 SoCs, as
earlier versions don't have the necessary hardware. On Gen3 SoCs, the CRC is
computed by the DISCOM module part of the VSP-D and VSP-DL.

The DISCOM is interfaced to the VSP through the UIF glue and appears as a VSP
entity with a sink pad and a source pad.

The series starts with a switch to SPDX license headers in patch 1/8, prompted
by a checkpatch.pl warning for a later patch that complained about missing
SPDX license headers. It then continues with cleanup and refactoring. Patches
2/8 and 3/8 prepare for DISCOM and UIF support by extending generic code to
make it usable for the UIF. Patch 4/8 documents a structure that will receive
new fields.

Patch 5/8 then extends the API exposed by the VSP driver to the DU driver to
support CRC computation configuration and reporting. The patch unfortunately
needs to touch both the VSP and DU drivers, so the whole series will need to
be merged through a single tree.

Patch 5/8 adds support for the DISCOM and UIF in the VSP driver, patch 7/8
integrates it in the DRM pipeline, and patch 8/8 finally implements the CRC
API in the DU driver to expose CRC computation to userspace.

The hardware supports computing the CRC at any arbitrary point in the
pipeline on a configurable window of the frame. This patch series supports CRC
computation on input planes or pipeline output, but on the full frame only.
Support for CRC window configuration can be added later if needed but will
require extending the userspace API, as the DRM/KMS CRC API doesn't support
this feature.

Compared to v1, the CRC source names for plane inputs are now constructed from
plane IDs instead of plane indices. This allows userspace to match CRC sources
with planes.

Note that exposing the DISCOM and UIF though the V4L2 API isn't supported as
the module is only found in VSP-D and VSP-DL instances that are not exposed
through V4L2. It is possible to expose those instances through V4L2 with a
small modification to the driver for testing purpose. If the need arises to
test DISCOM and UIF with such an out-of-tree patch, support for CRC reporting
through a V4L2 control can be added later without affecting how CRC is exposed
through the DRM/KMS API.

The patches are based on top of the "[PATCH v2 00/15] R-Car VSP1: Dynamically
assign blend units to display pipelines" patch series, itself based on top of
the Linux media master branch and scheduled for merge in v4.18. The new base
caused heavy conflicts, requiring this series to be merged through the V4L2
tree. Once the patches receive the necessary review I will ask Dave to ack the
merge plan.

For convenience the patches are available at

git://linuxtv.org/pinchartl/media.git vsp1-discom-v2-20180423

The code has been tested through the kms-test-crc.py script part of the DU
test suite available at

git://git.ideasonboard.com/renesas/kms-tests.git discom

Laurent Pinchart (8):
  v4l: vsp1: Use SPDX license headers
  v4l: vsp1: Share the CLU, LIF and LUT set_fmt pad operation code
  v4l: vsp1: Reset the crop and compose rectangles in the set_fmt helper
  v4l: vsp1: Document the vsp1_du_atomic_config structure
  v4l: vsp1: Extend the DU API to support CRC computation
  v4l: vsp1: Add support for the DISCOM entity
  v4l: vsp1: Integrate DISCOM in display pipeline
  drm: rcar-du: Add support for CRC computation

 drivers/gpu/drm/rcar-du/rcar_du_crtc.c| 156 -
 drivers/gpu/drm/rcar-du/rcar_du_crtc.h|  19 +++
 drivers/gpu/drm/rcar-du/rcar_du_vsp.c |  13 +-
 drivers/media/platform/vsp1/Makefile  |   2 +-
 drivers/media/platform/vsp1/vsp1.h|  10 +-
 drivers/media/platform/vsp1/vsp1_brx.c|   6 +-
 drivers/media/platform/vsp1/vsp1_brx.h|   6 +-
 drivers/media/platform/vsp1/vsp1_clu.c|  71 ++--
 drivers/media/platform/vsp1/vsp1_clu.h|   6 +-
 drivers/media/platform/vsp1/vsp1_dl.c |   8 +-
 drivers/media/platform/vsp1/vsp1_dl.h |   6 +-
 drivers/media/platform/vsp1/vsp1_drm.c| 127 --
 drivers/media/platform/vsp1/vsp1_drm.h|  20 ++-
 drivers/media/platform/vsp1/vsp1_drv.c|  26 ++-
 drivers/media/platform/vsp1/vsp1_entity.c | 103 +++-
 drivers/media/platform/vsp1/vsp1_entity.h |  13 +-
 drivers/media/platform/vsp1/vsp1_hgo.c|   6 +-
 drivers/media/platform/vsp1/vsp1_hgo.h|   6 +-
 drivers/media/platform/vsp1/vsp1_hgt.c|   6 +-
 drivers/media/platform/vsp1/vsp1_hgt.h|   6 +-
 drivers/media/platform/vsp1/vsp1_histo.c  |  65 +--
 drivers/media/platform/vsp1/vsp1_histo.h  |   6 +-
 drivers/media/platform/vsp1/vsp1_hsit.c   |   6 +-
 drivers/media/platform/vsp1/vsp1_hsit.h   |   6 +-
 drivers/media/platform/vsp1/vsp1_lif.c|  71 ++--
 drivers/media/platform/vsp1/vsp1_lif.h|   6 +-
 drivers/media/platform/vsp1/vsp1_lut.c|  71 ++--
 drivers/media/platform/vsp1/vsp1_lut.h   

Re: [PATCH 6/8] drm: rcar-du: rcar-lvds: Add bridge format support

2018-04-22 Thread Peter Rosin
On 2018-04-19 11:31, Jacopo Mondi wrote:
> With the introduction of static input image format enumeration in DRM
> bridges, add support to retrieve the format in rcar-lvds LVDS encoder
> from both panel or bridge, to set the desired LVDS mode.
> 
> Do not rely on 'DRM_BUS_FLAG_DATA_LSB_TO_MSB' flag to mirror the LVDS
> format, as it is only defined for drm connectors, but use the newly
> introduced _LE version of LVDS mbus image formats.
> 
> Signed-off-by: Jacopo Mondi 
> ---
>  drivers/gpu/drm/rcar-du/rcar_lvds.c | 64 
> +
>  1 file changed, 44 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_lvds.c 
> b/drivers/gpu/drm/rcar-du/rcar_lvds.c
> index 3d2d3bb..2fa875f 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_lvds.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_lvds.c
> @@ -280,41 +280,65 @@ static bool rcar_lvds_mode_fixup(struct drm_bridge 
> *bridge,
>   return true;
>  }
>  
> -static void rcar_lvds_get_lvds_mode(struct rcar_lvds *lvds)
> +static int rcar_lvds_get_lvds_mode_from_connector(struct rcar_lvds *lvds,
> +   unsigned int *bus_fmt)
>  {
>   struct drm_display_info *info = &lvds->connector.display_info;
> - enum rcar_lvds_mode mode;
> -
> - /*
> -  * There is no API yet to retrieve LVDS mode from a bridge, only panels
> -  * are supported.
> -  */
> - if (!lvds->panel)
> - return;
>  
>   if (!info->num_bus_formats || !info->bus_formats) {
>   dev_err(lvds->dev, "no LVDS bus format reported\n");
> - return;
> + return -EINVAL;
> + }
> +
> + *bus_fmt = info->bus_formats[0];
> +
> + return 0;
> +}
> +
> +static int rcar_lvds_get_lvds_mode_from_bridge(struct rcar_lvds *lvds,
> +unsigned int *bus_fmt)
> +{
> + if (!lvds->next_bridge->num_bus_formats ||
> + !lvds->next_bridge->bus_formats) {
> + dev_err(lvds->dev, "no LVDS bus format reported\n");
> + return -EINVAL;
>   }
>  
> - switch (info->bus_formats[0]) {
> + *bus_fmt = lvds->next_bridge->bus_formats[0];

What makes the first reported format the best choice?

> +
> + return 0;
> +}
> +
> +static void rcar_lvds_get_lvds_mode(struct rcar_lvds *lvds)
> +{
> + unsigned int bus_fmt;
> + int ret;
> +
> + if (lvds->panel)
> + ret = rcar_lvds_get_lvds_mode_from_connector(lvds, &bus_fmt);
> + else
> + ret = rcar_lvds_get_lvds_mode_from_bridge(lvds, &bus_fmt);

What if no bridge reports any format, shouldn't the connector be examined
then?

> + if (ret)
> + return;
> +
> + switch (bus_fmt) {
> + case MEDIA_BUS_FMT_RGB666_1X7X3_SPWG_LE:
> + case MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA_LE:
> + lvds->mode |= RCAR_LVDS_MODE_MIRROR;
>   case MEDIA_BUS_FMT_RGB666_1X7X3_SPWG:
>   case MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA:
> - mode = RCAR_LVDS_MODE_JEIDA;
> + lvds->mode = RCAR_LVDS_MODE_JEIDA;

This is b0rken, first the mirror bit is ORed into some unknown preexisting
value, then the code falls through (without any fall through comment, btw)
and forcibly sets the mode, thus discarding the mirror bit which was
carefully ORed in.

>   break;
> +
> + case MEDIA_BUS_FMT_RGB888_1X7X4_SPWG_LE:
> + lvds->mode |= RCAR_LVDS_MODE_MIRROR;
>   case MEDIA_BUS_FMT_RGB888_1X7X4_SPWG:
> - mode = RCAR_LVDS_MODE_VESA;
> + lvds->mode = RCAR_LVDS_MODE_VESA;

Dito.

Cheers,
Peter

>   break;
>   default:
>   dev_err(lvds->dev, "unsupported LVDS bus format 0x%04x\n",
> - info->bus_formats[0]);
> - return;
> + bus_fmt);
>   }
> -
> - if (info->bus_flags & DRM_BUS_FLAG_DATA_LSB_TO_MSB)
> - mode |= RCAR_LVDS_MODE_MIRROR;
> -
> - lvds->mode = mode;
>  }
>  
>  static void rcar_lvds_mode_set(struct drm_bridge *bridge,
> 



Re: [PATCH 3/8] drm: bridge: thc63lvd1024: Add support for LVDS mode map

2018-04-22 Thread Peter Rosin
On 2018-04-19 11:31, Jacopo Mondi wrote:
> The THC63LVD1024 LVDS to RGB bridge supports two different LVDS mapping
> modes, selectable by means of an external pin.
> 
> Add support for configurable LVDS input mapping modes, using the newly
> introduced support for bridge input image formats.
> 
> Signed-off-by: Jacopo Mondi 
> ---
>  drivers/gpu/drm/bridge/thc63lvd1024.c | 41 
> +++
>  1 file changed, 41 insertions(+)
> 
> diff --git a/drivers/gpu/drm/bridge/thc63lvd1024.c 
> b/drivers/gpu/drm/bridge/thc63lvd1024.c
> index 48527f8..a3071a1 100644
> --- a/drivers/gpu/drm/bridge/thc63lvd1024.c
> +++ b/drivers/gpu/drm/bridge/thc63lvd1024.c
> @@ -10,9 +10,15 @@
>  #include 
>  
>  #include 
> +#include 
>  #include 
>  #include 
>  
> +enum thc63_lvds_mapping_mode {
> + THC63_LVDS_MAP_MODE2,
> + THC63_LVDS_MAP_MODE1,
> +};
> +
>  enum thc63_ports {
>   THC63_LVDS_IN0,
>   THC63_LVDS_IN1,
> @@ -116,6 +122,37 @@ static int thc63_parse_dt(struct thc63_dev *thc63)
>   return 0;
>  }
>  
> +static int thc63_set_bus_fmt(struct thc63_dev *thc63)
> +{
> + u32 bus_fmt;
> + u32 map;
> + int ret;
> +
> + ret = of_property_read_u32(thc63->dev->of_node, "thine,map", &map);
> + if (ret) {
> + dev_err(thc63->dev,
> + "Unable to parse property \"thine,map\": %d\n", ret);
> + return ret;
> + }
> +
> + switch (map) {
> + case THC63_LVDS_MAP_MODE1:
> + bus_fmt = MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA;
> + break;
> + case THC63_LVDS_MAP_MODE2:
> + bus_fmt = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG;

Why do you assume rgb888/1x7x4 here? It might as well be rgb666/1x7x3
or rgb101010/1x7x5, no?

Cheers,
Peter

> + break;
> + default:
> + dev_err(thc63->dev,
> + "Invalid value for property \"thine,map\": %u\n", map);
> + return -EINVAL;
> + }
> +
> + drm_bridge_set_bus_formats(&thc63->bridge, &bus_fmt, 1);
> +
> + return 0;
> +}
> +
>  static int thc63_gpio_init(struct thc63_dev *thc63)
>  {
>   thc63->oe = devm_gpiod_get_optional(thc63->dev, "oe", GPIOD_OUT_LOW);
> @@ -166,6 +203,10 @@ static int thc63_probe(struct platform_device *pdev)
>   if (ret)
>   return ret;
>  
> + ret = thc63_set_bus_fmt(thc63);
> + if (ret)
> + return ret;
> +
>   thc63->bridge.driver_private = thc63;
>   thc63->bridge.of_node = pdev->dev.of_node;
>   thc63->bridge.funcs = &thc63_bridge_func;
> 



Re: [PATCH 2/8] dt-bindings: display: bridge: thc63lvd1024: Add lvds map property

2018-04-22 Thread Peter Rosin
On 2018-04-19 11:31, Jacopo Mondi wrote:
> The THC63LVD1024 LVDS to RGB bridge supports two different input mapping
> modes, selectable by means of an external pin.
> 
> Describe the LVDS mode map through a newly defined mandatory property in
> device tree bindings.
> 
> Signed-off-by: Jacopo Mondi 
> ---
>  .../devicetree/bindings/display/bridge/thine,thc63lvd1024.txt  | 3 
> +++
>  1 file changed, 3 insertions(+)
> 
> diff --git 
> a/Documentation/devicetree/bindings/display/bridge/thine,thc63lvd1024.txt 
> b/Documentation/devicetree/bindings/display/bridge/thine,thc63lvd1024.txt
> index 37f0c04..0937595 100644
> --- a/Documentation/devicetree/bindings/display/bridge/thine,thc63lvd1024.txt
> +++ b/Documentation/devicetree/bindings/display/bridge/thine,thc63lvd1024.txt
> @@ -12,6 +12,8 @@ Required properties:
>  - compatible: Shall be "thine,thc63lvd1024"
>  - vcc-supply: Power supply for TTL output, TTL CLOCKOUT signal, LVDS input,
>PPL and digital circuitry
> +- thine,map: LVDS mapping mode selection signal, pin name "MAP". Shall be <1>
> +  for mapping mode 1, <0> for mapping mode 2

Since the MAP pin is an input pin, I would expect there to be an optional gpio
specifier like thine,map-gpios so that the driver can set it according to
the value given in thine,map in case the HW has a line from some gpio output
to the MAP pin (instead of hardwired hi/low which seem to be your thinking).

Cheers,
Peter

>  
>  Optional properties:
>  - powerdown-gpios: Power down GPIO signal, pin name "/PDWN". Active low
> @@ -36,6 +38,7 @@ Example:
>  
>   vcc-supply = <®_lvds_vcc>;
>   powerdown-gpios = <&gpio4 15 GPIO_ACTIVE_LOW>;
> + thine,map = <1>;
>  
>   ports {
>   #address-cells = <1>;
> 



Re: [PATCH 1/8] drm: bridge: Add support for static image formats

2018-04-22 Thread Peter Rosin
On 2018-04-19 11:31, Jacopo Mondi wrote:
> Add support for storing image format information in DRM bridges with
> associated helper function.
> 
> This patch replicates for bridges what 'drm_display_info_set_bus_formats()'
> is for connectors.
> 
> Signed-off-by: Jacopo Mondi 
> ---
>  drivers/gpu/drm/drm_bridge.c | 30 ++
>  include/drm/drm_bridge.h |  8 
>  2 files changed, 38 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
> index 1638bfe..e2ad098 100644
> --- a/drivers/gpu/drm/drm_bridge.c
> +++ b/drivers/gpu/drm/drm_bridge.c
> @@ -157,6 +157,36 @@ void drm_bridge_detach(struct drm_bridge *bridge)
>  }
>  
>  /**
> + * drm_bridge_set_bus_formats() - set bridge supported image formats
> + * @bridge: the bridge to set image formats in
> + * @formats: array of MEDIA_BUS_FMT\_ supported image formats
> + * @num_formats: number of elements in the @formats array
> + *
> + * Store a list of supported image formats in a bridge.
> + * See MEDIA_BUS_FMT_* definitions in include/uapi/linux/media-bus-format.h 
> for
> + * a full list of available formats.
> + */
> +int drm_bridge_set_bus_formats(struct drm_bridge *bridge, const u32 *formats,
> +unsigned int num_formats)
> +{
> + u32 *fmts;
> +
> + if (!formats || !num_formats)
> + return -EINVAL;

I see no compelling reason to forbid restoring the number of reported
input formats to zero? I can't think of a use right now of course, but it
seems a bit odd all the same.

Cheers,
Peter

> +
> + fmts = kmemdup(formats, sizeof(*formats) * num_formats, GFP_KERNEL);
> + if (!fmts)
> + return -ENOMEM;
> +
> + kfree(bridge->bus_formats);
> + bridge->bus_formats = fmts;
> + bridge->num_bus_formats = num_formats;
> +
> + return 0;
> +}
> +EXPORT_SYMBOL(drm_bridge_set_bus_formats);
> +
> +/**
>   * DOC: bridge callbacks
>   *
>   * The &drm_bridge_funcs ops are populated by the bridge driver. The DRM
> diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
> index 3270fec..6b3648c 100644
> --- a/include/drm/drm_bridge.h
> +++ b/include/drm/drm_bridge.h
> @@ -258,6 +258,9 @@ struct drm_bridge_timings {
>   * @encoder: encoder to which this bridge is connected
>   * @next: the next bridge in the encoder chain
>   * @of_node: device node pointer to the bridge
> + * @bus_formats: wire image formats. Array of @num_bus_formats 
> MEDIA_BUS_FMT\_
> + * elements
> + * @num_bus_formats: size of @bus_formats array
>   * @list: to keep track of all added bridges
>   * @timings: the timing specification for the bridge, if any (may
>   * be NULL)
> @@ -271,6 +274,9 @@ struct drm_bridge {
>  #ifdef CONFIG_OF
>   struct device_node *of_node;
>  #endif
> + const u32 *bus_formats;
> + unsigned int num_bus_formats;
> +
>   struct list_head list;
>   const struct drm_bridge_timings *timings;
>  
> @@ -296,6 +302,8 @@ void drm_bridge_mode_set(struct drm_bridge *bridge,
>   struct drm_display_mode *adjusted_mode);
>  void drm_bridge_pre_enable(struct drm_bridge *bridge);
>  void drm_bridge_enable(struct drm_bridge *bridge);
> +int drm_bridge_set_bus_formats(struct drm_bridge *bridge, const u32 *fmts,
> +unsigned int num_fmts);
>  
>  #ifdef CONFIG_DRM_PANEL_BRIDGE
>  struct drm_bridge *drm_panel_bridge_add(struct drm_panel *panel,
> 



Re: [PATCH 30/61] mtd: nand: onenand: simplify getting .drvdata

2018-04-22 Thread Boris Brezillon
On Thu, 19 Apr 2018 16:06:00 +0200
Wolfram Sang  wrote:

> We should get drvdata from struct device directly. Going via
> platform_device is an unneeded step back and forth.
> 
> Signed-off-by: Wolfram Sang 

Applied to nand/next.

Thanks,

Boris

> ---
> 
> Build tested only. buildbot is happy. Please apply individually.
> 
>  drivers/mtd/nand/onenand/samsung.c | 6 ++
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mtd/nand/onenand/samsung.c 
> b/drivers/mtd/nand/onenand/samsung.c
> index 2e9d076e445a..4cce4c0311ca 100644
> --- a/drivers/mtd/nand/onenand/samsung.c
> +++ b/drivers/mtd/nand/onenand/samsung.c
> @@ -958,8 +958,7 @@ static int s3c_onenand_remove(struct platform_device 
> *pdev)
>  
>  static int s3c_pm_ops_suspend(struct device *dev)
>  {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct mtd_info *mtd = platform_get_drvdata(pdev);
> + struct mtd_info *mtd = dev_get_drvdata(dev);
>   struct onenand_chip *this = mtd->priv;
>  
>   this->wait(mtd, FL_PM_SUSPENDED);
> @@ -968,8 +967,7 @@ static int s3c_pm_ops_suspend(struct device *dev)
>  
>  static  int s3c_pm_ops_resume(struct device *dev)
>  {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct mtd_info *mtd = platform_get_drvdata(pdev);
> + struct mtd_info *mtd = dev_get_drvdata(dev);
>   struct onenand_chip *this = mtd->priv;
>  
>   this->unlock_all(mtd);



Re: [PATCH 29/61] mtd: devices: simplify getting .drvdata

2018-04-22 Thread Boris Brezillon
On Thu, 19 Apr 2018 16:05:59 +0200
Wolfram Sang  wrote:

> We should get drvdata from struct device directly. Going via
> platform_device is an unneeded step back and forth.
> 
> Signed-off-by: Wolfram Sang 

Applied to mtd/next.

Thanks,

Boris

> ---
> 
> Build tested only. buildbot is happy. Please apply individually.
> 
>  drivers/mtd/devices/docg3.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/devices/docg3.c b/drivers/mtd/devices/docg3.c
> index c594fe5eac08..802d8f159e90 100644
> --- a/drivers/mtd/devices/docg3.c
> +++ b/drivers/mtd/devices/docg3.c
> @@ -1470,8 +1470,7 @@ static struct docg3 *sysfs_dev2docg3(struct device *dev,
>struct device_attribute *attr)
>  {
>   int floor;
> - struct platform_device *pdev = to_platform_device(dev);
> - struct mtd_info **docg3_floors = platform_get_drvdata(pdev);
> + struct mtd_info **docg3_floors = dev_get_drvdata(dev);
>  
>   floor = attr->attr.name[1] - '0';
>   if (floor < 0 || floor >= DOC_MAX_NBFLOORS)



Re: [PATCH/RFC net-next 5/5] ravb: remove tx buffer addr 4byte alilgnment restriction for R-Car Gen3

2018-04-22 Thread Sergei Shtylyov

Hello!

On 4/17/2018 11:50 AM, Simon Horman wrote:


From: Kazuya Mizuguchi 

This patch sets from two descriptor to one descriptor because R-Car Gen3
does not have the 4 bytes alignment restriction of the transmission buffer.

Signed-off-by: Kazuya Mizuguchi 
Signed-off-by: Simon Horman 

[...]

diff --git a/drivers/net/ethernet/renesas/ravb.h 
b/drivers/net/ethernet/renesas/ravb.h
index fcd04dbc7dde..3d0985305c26 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -964,7 +964,10 @@ enum RAVB_QUEUE {
 #define RX_QUEUE_OFFSET4
 #define NUM_RX_QUEUE   2
 #define NUM_TX_QUEUE   2
-#define NUM_TX_DESC2   /* TX descriptors per packet */
+
+/* TX descriptors per packet */
+#define NUM_TX_DESC_GEN2   2
+#define NUM_TX_DESC_GEN3   1


   We hanrdly need these...

 
 struct ravb_tstamp_skb {

struct list_head list;

[...]

diff --git a/drivers/net/ethernet/renesas/ravb_main.c 
b/drivers/net/ethernet/renesas/ravb_main.c
index 88056dd912ed..f137b62d5b52 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -189,12 +189,13 @@ static int ravb_tx_free(struct net_device *ndev, int q, 
bool free_txed_only)
int free_num = 0;
int entry;
u32 size;
+   int num_tx_desc = priv->num_tx_desc;


   Please keep sorting the declarations by length -- that's DaveM's pet peeve 
(and indeed looks prettier. :-)


[...]

@@ -229,6 +230,7 @@ static void ravb_ring_free(struct net_device *ndev, int q)
struct ravb_private *priv = netdev_priv(ndev);
int ring_size;
int i;
+   int num_tx_desc = priv->num_tx_desc;


   Here as well.

 
 	if (priv->rx_ring[q]) {


for (i = 0; i < priv->num_rx_ring[q]; i++) {

[...]

@@ -321,8 +324,10 @@ static void ravb_ring_format(struct net_device *ndev, int 
q)
for (i = 0, tx_desc = priv->tx_ring[q]; i < priv->num_tx_ring[q];
 i++, tx_desc++) {
tx_desc->die_dt = DT_EEMPTY;
-   tx_desc++;
-   tx_desc->die_dt = DT_EEMPTY;
+   if (num_tx_desc >= 2) {


   > 1, please.
   Strictly speaking, this only works when num_tx_desc == 2, however that's 
my fault...



+   tx_desc++;
+   tx_desc->die_dt = DT_EEMPTY;
+   }
}
tx_desc->dptr = cpu_to_le32((u32)priv->tx_desc_dma[q]);
tx_desc->die_dt = DT_LINKFIX; /* type */
@@ -345,6 +350,7 @@ static int ravb_ring_init(struct net_device *ndev, int q)
struct sk_buff *skb;
int ring_size;
int i;
+   int num_tx_desc = priv->num_tx_desc;


   Again, please keep the descarations sorted by length.

  
  	priv->rx_buf_sz = (ndev->mtu <= 1492 ? PKT_BUF_SZ : ndev->mtu) +

ETH_HLEN + VLAN_HLEN;

[...]

@@ -1533,10 +1539,11 @@ static netdev_tx_t ravb_start_xmit(struct sk_buff *skb, 
struct net_device *ndev)
void *buffer;
u32 entry;
u32 len;
+   int num_tx_desc = priv->num_tx_desc;


   Here as well...

[...]

@@ -1547,41 +1554,55 @@ static netdev_tx_t ravb_start_xmit(struct sk_buff *skb, 
struct net_device *ndev)

[...]

+   entry = priv->cur_tx[q] % (priv->num_tx_ring[q] * num_tx_desc);
+   priv->tx_skb[q][entry / num_tx_desc] = skb;
+
+   if (num_tx_desc >= 2) {


   > 1, please.

[...]

@@ -1589,9 +1610,11 @@ static netdev_tx_t ravb_start_xmit(struct sk_buff *skb, 
struct net_device *ndev)
if (q == RAVB_NC) {
ts_skb = kmalloc(sizeof(*ts_skb), GFP_ATOMIC);
if (!ts_skb) {
-   desc--;
-   dma_unmap_single(ndev->dev.parent, dma_addr, len,
-DMA_TO_DEVICE);
+   if (num_tx_desc >= 2) {


   Likewise.


+   desc--;
+   dma_unmap_single(ndev->dev.parent, dma_addr,
+len, DMA_TO_DEVICE);
+   }
goto unmap;
}
ts_skb->skb = skb;

[...]

@@ -2106,6 +2132,9 @@ static int ravb_probe(struct platform_device *pdev)
ndev->max_mtu = 2048 - (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN);
ndev->min_mtu = ETH_MIN_MTU;
  
+	priv->num_tx_desc = (chip_id == RCAR_GEN2) ?


   Parens not needed.


+   NUM_TX_DESC_GEN2 : NUM_TX_DESC_GEN3;


   Just 2 : 1;

[...]

   However... I'm not seeing this patch disabling memory allocation for 
priv->tx_align[] and reducing the memory pressure is one of 2 reasons for this 
patch, isn't it?


MBR, Sergei


[PATCH 0/4] ARM: dts: renesas: Enable FDP1 devices

2018-04-22 Thread Laurent Pinchart
Hello,

This patch series adds the FDP1 devices for all applicable Gen2 platforms
(H2, M2W, M2N and E2). There's no rocket science involved, the devices have
no I/O pin and need no resource other than a memory range, a functional clock
and an interrupt.

Laurent Pinchart (4):
  ARM: dts: renesas: r8a7790: Add FDP1 instances
  ARM: dts: renesas: r8a7791: Add FDP1 instances
  ARM: dts: renesas: r8a7793: Add FDP1 instances
  ARM: dts: renesas: r8a7794: Add FDP1 instances

 arch/arm/boot/dts/r8a7790.dtsi | 27 +++
 arch/arm/boot/dts/r8a7791.dtsi | 18 ++
 arch/arm/boot/dts/r8a7793.dtsi | 18 ++
 arch/arm/boot/dts/r8a7794.dtsi |  9 +
 4 files changed, 72 insertions(+)

-- 
Regards,

Laurent Pinchart



[PATCH 2/4] ARM: dts: renesas: r8a7791: Add FDP1 instances

2018-04-22 Thread Laurent Pinchart
The r8a7791 has two FDP1 instances.

Signed-off-by: Laurent Pinchart 
---
 arch/arm/boot/dts/r8a7791.dtsi | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
index f11dab71b03a..55b5a56da35e 100644
--- a/arch/arm/boot/dts/r8a7791.dtsi
+++ b/arch/arm/boot/dts/r8a7791.dtsi
@@ -1621,6 +1621,24 @@
resets = <&cpg 127>;
};
 
+   fdp1@fe94 {
+   compatible = "renesas,fdp1";
+   reg = <0 0xfe94 0 0x2400>;
+   interrupts = ;
+   clocks = <&cpg CPG_MOD 119>;
+   power-domains = <&sysc R8A7791_PD_ALWAYS_ON>;
+   resets = <&cpg 119>;
+   };
+
+   fdp1@fe944000 {
+   compatible = "renesas,fdp1";
+   reg = <0 0xfe944000 0 0x2400>;
+   interrupts = ;
+   clocks = <&cpg CPG_MOD 118>;
+   power-domains = <&sysc R8A7791_PD_ALWAYS_ON>;
+   resets = <&cpg 118>;
+   };
+
jpu: jpeg-codec@fe98 {
compatible = "renesas,jpu-r8a7791",
 "renesas,rcar-gen2-jpu";
-- 
Regards,

Laurent Pinchart



[PATCH 3/4] ARM: dts: renesas: r8a7793: Add FDP1 instances

2018-04-22 Thread Laurent Pinchart
The r8a7793 has two FDP1 instances.

Signed-off-by: Laurent Pinchart 
---
 arch/arm/boot/dts/r8a7793.dtsi | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7793.dtsi b/arch/arm/boot/dts/r8a7793.dtsi
index f9c5a557107d..61c58029e03e 100644
--- a/arch/arm/boot/dts/r8a7793.dtsi
+++ b/arch/arm/boot/dts/r8a7793.dtsi
@@ -1290,6 +1290,24 @@
resets = <&cpg 408>;
};
 
+   fdp1@fe94 {
+   compatible = "renesas,fdp1";
+   reg = <0 0xfe94 0 0x2400>;
+   interrupts = ;
+   clocks = <&cpg CPG_MOD 119>;
+   power-domains = <&sysc R8A7793_PD_ALWAYS_ON>;
+   resets = <&cpg 119>;
+   };
+
+   fdp1@fe944000 {
+   compatible = "renesas,fdp1";
+   reg = <0 0xfe944000 0 0x2400>;
+   interrupts = ;
+   clocks = <&cpg CPG_MOD 118>;
+   power-domains = <&sysc R8A7793_PD_ALWAYS_ON>;
+   resets = <&cpg 118>;
+   };
+
du: display@feb0 {
compatible = "renesas,du-r8a7793";
reg = <0 0xfeb0 0 0x4>,
-- 
Regards,

Laurent Pinchart



[PATCH 4/4] ARM: dts: renesas: r8a7794: Add FDP1 instances

2018-04-22 Thread Laurent Pinchart
The r8a7794 has one FDP1 instance.

Signed-off-by: Laurent Pinchart 
---
 arch/arm/boot/dts/r8a7794.dtsi | 9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7794.dtsi b/arch/arm/boot/dts/r8a7794.dtsi
index d588efa6aeaa..56f5fa6a2c0f 100644
--- a/arch/arm/boot/dts/r8a7794.dtsi
+++ b/arch/arm/boot/dts/r8a7794.dtsi
@@ -1323,6 +1323,15 @@
resets = <&cpg 128>;
};
 
+   fdp1@fe94 {
+   compatible = "renesas,fdp1";
+   reg = <0 0xfe94 0 0x2400>;
+   interrupts = ;
+   clocks = <&cpg CPG_MOD 119>;
+   power-domains = <&sysc R8A7794_PD_ALWAYS_ON>;
+   resets = <&cpg 119>;
+   };
+
du: display@feb0 {
compatible = "renesas,du-r8a7794";
reg = <0 0xfeb0 0 0x4>;
-- 
Regards,

Laurent Pinchart



[PATCH 1/4] ARM: dts: renesas: r8a7790: Add FDP1 instances

2018-04-22 Thread Laurent Pinchart
The r8a7790 has three FDP1 instances.

Signed-off-by: Laurent Pinchart 
---
 arch/arm/boot/dts/r8a7790.dtsi | 27 +++
 1 file changed, 27 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
index e4367cecad18..9c527ddfde56 100644
--- a/arch/arm/boot/dts/r8a7790.dtsi
+++ b/arch/arm/boot/dts/r8a7790.dtsi
@@ -1606,6 +1606,33 @@
resets = <&cpg 128>;
};
 
+   fdp1@fe94 {
+   compatible = "renesas,fdp1";
+   reg = <0 0xfe94 0 0x2400>;
+   interrupts = ;
+   clocks = <&cpg CPG_MOD 119>;
+   power-domains = <&sysc R8A7790_PD_ALWAYS_ON>;
+   resets = <&cpg 119>;
+   };
+
+   fdp1@fe944000 {
+   compatible = "renesas,fdp1";
+   reg = <0 0xfe944000 0 0x2400>;
+   interrupts = ;
+   clocks = <&cpg CPG_MOD 118>;
+   power-domains = <&sysc R8A7790_PD_ALWAYS_ON>;
+   resets = <&cpg 118>;
+   };
+
+   fdp1@fe948000 {
+   compatible = "renesas,fdp1";
+   reg = <0 0xfe948000 0 0x2400>;
+   interrupts = ;
+   clocks = <&cpg CPG_MOD 117>;
+   power-domains = <&sysc R8A7790_PD_ALWAYS_ON>;
+   resets = <&cpg 117>;
+   };
+
vsp@fe938000 {
compatible = "renesas,vsp1";
reg = <0 0xfe938000 0 0x8000>;
-- 
Regards,

Laurent Pinchart



[PATCH 2/3] v4l: rcar_fdp1: Enable compilation on Gen2 platforms

2018-04-22 Thread Laurent Pinchart
Commit 1d3897143815 ("[media] v4l: rcar_fdp1: add FCP dependency") fixed
a compilation breakage when the optional VIDEO_RENESAS_FCP dependency is
compiled as a module while the rcar_fdp1 driver is built in. As a side
effect it disabled compilation on Gen2 by disallowing the valid
combination ARCH_RENESAS && !VIDEO_RENESAS_FCP. Fix it by handling the
dependency the same way the vsp1 driver did in commit 199946731fa4
("[media] vsp1: clarify FCP dependency").

Fixes: 1d3897143815 ("[media] v4l: rcar_fdp1: add FCP dependency")
Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index 621d63b2001d..81c3ab95c050 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -397,7 +397,7 @@ config VIDEO_RENESAS_FDP1
tristate "Renesas Fine Display Processor"
depends on VIDEO_DEV && VIDEO_V4L2 && HAS_DMA
depends on ARCH_RENESAS || COMPILE_TEST
-   depends on (!ARCH_RENESAS && !VIDEO_RENESAS_FCP) || VIDEO_RENESAS_FCP
+   depends on (!ARM64 && !VIDEO_RENESAS_FCP) || VIDEO_RENESAS_FCP
select VIDEOBUF2_DMA_CONTIG
select V4L2_MEM2MEM_DEV
---help---
-- 
Regards,

Laurent Pinchart



[PATCH 3/3] v4l: rcar_fdp1: Fix indentation oddities

2018-04-22 Thread Laurent Pinchart
Indentation is odd in several places, especially when printing messages
to the kernel log. Fix it to match the usual coding style.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/rcar_fdp1.c | 28 ++--
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/media/platform/rcar_fdp1.c 
b/drivers/media/platform/rcar_fdp1.c
index b13dec3081e5..81e8a761b924 100644
--- a/drivers/media/platform/rcar_fdp1.c
+++ b/drivers/media/platform/rcar_fdp1.c
@@ -949,7 +949,7 @@ static void fdp1_configure_wpf(struct fdp1_ctx *ctx,
u32 rndctl;
 
pstride = q_data->format.plane_fmt[0].bytesperline
-   << FD1_WPF_PSTRIDE_Y_SHIFT;
+   << FD1_WPF_PSTRIDE_Y_SHIFT;
 
if (q_data->format.num_planes > 1)
pstride |= q_data->format.plane_fmt[1].bytesperline
@@ -1143,8 +1143,8 @@ static int fdp1_m2m_job_ready(void *priv)
int dstbufs = 1;
 
dprintk(ctx->fdp1, "+ Src: %d : Dst: %d\n",
-   v4l2_m2m_num_src_bufs_ready(ctx->fh.m2m_ctx),
-   v4l2_m2m_num_dst_bufs_ready(ctx->fh.m2m_ctx));
+   v4l2_m2m_num_src_bufs_ready(ctx->fh.m2m_ctx),
+   v4l2_m2m_num_dst_bufs_ready(ctx->fh.m2m_ctx));
 
/* One output buffer is required for each field */
if (V4L2_FIELD_HAS_BOTH(src_q_data->format.field))
@@ -1282,7 +1282,7 @@ static void fdp1_m2m_device_run(void *priv)
 
fdp1_queue_field(ctx, fbuf);
dprintk(fdp1, "Queued Buffer [%d] last_field:%d\n",
-   i, fbuf->last_field);
+   i, fbuf->last_field);
}
 
/* Queue as many jobs as our data provides for */
@@ -1341,7 +1341,7 @@ static void device_frame_end(struct fdp1_dev *fdp1,
fdp1_job_free(fdp1, job);
 
dprintk(fdp1, "curr_ctx->num_processed %d curr_ctx->translen %d\n",
-   ctx->num_processed, ctx->translen);
+   ctx->num_processed, ctx->translen);
 
if (ctx->num_processed == ctx->translen ||
ctx->aborting) {
@@ -1366,7 +1366,7 @@ static int fdp1_vidioc_querycap(struct file *file, void 
*priv,
strlcpy(cap->driver, DRIVER_NAME, sizeof(cap->driver));
strlcpy(cap->card, DRIVER_NAME, sizeof(cap->card));
snprintf(cap->bus_info, sizeof(cap->bus_info),
-   "platform:%s", DRIVER_NAME);
+"platform:%s", DRIVER_NAME);
return 0;
 }
 
@@ -1997,13 +1997,13 @@ static void fdp1_stop_streaming(struct vb2_queue *q)
/* Free smsk_data */
if (ctx->smsk_cpu) {
dma_free_coherent(ctx->fdp1->dev, ctx->smsk_size,
-   ctx->smsk_cpu, ctx->smsk_addr[0]);
+ ctx->smsk_cpu, ctx->smsk_addr[0]);
ctx->smsk_addr[0] = ctx->smsk_addr[1] = 0;
ctx->smsk_cpu = NULL;
}
 
WARN(!list_empty(&ctx->fields_queue),
-   "Buffer queue not empty");
+"Buffer queue not empty");
} else {
/* Empty Capture queues (Jobs) */
struct fdp1_job *job;
@@ -2025,10 +2025,10 @@ static void fdp1_stop_streaming(struct vb2_queue *q)
fdp1_field_complete(ctx, ctx->previous);
 
WARN(!list_empty(&ctx->fdp1->queued_job_list),
-   "Queued Job List not empty");
+"Queued Job List not empty");
 
WARN(!list_empty(&ctx->fdp1->hw_job_list),
-   "HW Job list not empty");
+"HW Job list not empty");
}
 }
 
@@ -2114,7 +2114,7 @@ static int fdp1_open(struct file *file)
 fdp1_ctrl_deint_menu);
 
ctrl = v4l2_ctrl_new_std(&ctx->hdl, &fdp1_ctrl_ops,
-   V4L2_CID_MIN_BUFFERS_FOR_CAPTURE, 1, 2, 1, 1);
+V4L2_CID_MIN_BUFFERS_FOR_CAPTURE, 1, 2, 1, 1);
if (ctrl)
ctrl->flags |= V4L2_CTRL_FLAG_VOLATILE;
 
@@ -2351,8 +2351,8 @@ static int fdp1_probe(struct platform_device *pdev)
goto release_m2m;
}
 
-   v4l2_info(&fdp1->v4l2_dev,
-   "Device registered as /dev/video%d\n", vfd->num);
+   v4l2_info(&fdp1->v4l2_dev, "Device registered as /dev/video%d\n",
+ vfd->num);
 
/* Power up the cells to read HW */
pm_runtime_enable(&pdev->dev);
@@ -2371,7 +2371,7 @@ static int fdp1_probe(struct platform_device *pdev)
break;
default:
dev_err(fdp1->dev, "FDP1 Unidentifiable (0x%08x)\n",
-   hw_version);
+   hw_version);
}
 
/* Allow the hw to sleep until an open call puts it to use */
-- 
Regards,

Laurent Pinchart



[PATCH 1/3] v4l: rcar_fdp1: Change platform dependency to ARCH_RENESAS

2018-04-22 Thread Laurent Pinchart
From: Geert Uytterhoeven 

The Renesas Fine Display Processor driver is used on Renesas R-Car SoCs
only.  Since commit 9b5ba0df4ea4f940 ("ARM: shmobile: Introduce
ARCH_RENESAS") is ARCH_RENESAS a more appropriate platform dependency
than the legacy ARCH_SHMOBILE, hence use the former.

This will allow to drop ARCH_SHMOBILE on ARM and ARM64 in the near
future.

Signed-off-by: Geert Uytterhoeven 
Acked-by: Laurent Pinchart 
Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index c7a1cf8a1b01..621d63b2001d 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -396,7 +396,7 @@ config VIDEO_SH_VEU
 config VIDEO_RENESAS_FDP1
tristate "Renesas Fine Display Processor"
depends on VIDEO_DEV && VIDEO_V4L2 && HAS_DMA
-   depends on ARCH_SHMOBILE || COMPILE_TEST
+   depends on ARCH_RENESAS || COMPILE_TEST
depends on (!ARCH_RENESAS && !VIDEO_RENESAS_FCP) || VIDEO_RENESAS_FCP
select VIDEOBUF2_DMA_CONTIG
select V4L2_MEM2MEM_DEV
-- 
Regards,

Laurent Pinchart



[PATCH 0/3] R-Car Gen2 support for FDP1

2018-04-22 Thread Laurent Pinchart
Hello,

This small patch series improves support of the FDP1 on R-Car Gen2 platforms
by enabling compilation without requiring the Gen3-only FCP dependency.

As the Kconfig change (2/3) conflicts with a patch recently posted by Geert I
have included it in the series as 1/3. Patch 3/3 fixes indentation oddities I
have run across during development.

Geert Uytterhoeven (1):
  v4l: rcar_fdp1: Change platform dependency to ARCH_RENESAS

Laurent Pinchart (2):
  v4l: rcar_fdp1: Enable compilation on Gen2 platforms
  v4l: rcar_fdp1: Fix indentation oddities

 drivers/media/platform/Kconfig |  4 ++--
 drivers/media/platform/rcar_fdp1.c | 28 ++--
 2 files changed, 16 insertions(+), 16 deletions(-)

-- 
Regards,

Laurent Pinchart



[PATCH 04/04] arm64: dts: renesas: r8a77995: Enable IPMMU devices

2018-04-22 Thread Magnus Damm
From: Magnus Damm 

Remove 'status = "disabled"' to make sure all IPMMU devices are enabled
in DT on the r8a77995 SoC.

Signed-off-by: Magnus Damm 
---

 arch/arm64/boot/dts/renesas/r8a77995.dtsi |   10 --
 1 file changed, 10 deletions(-)

--- 0001/arch/arm64/boot/dts/renesas/r8a77995.dtsi
+++ work/arch/arm64/boot/dts/renesas/r8a77995.dtsi  2018-04-22 
18:25:39.340607110 +0900
@@ -108,7 +108,6 @@
reg = <0 0xfebd 0 0x1000>;
renesas,ipmmu-main = <&ipmmu_mm 14>;
#iommu-cells = <1>;
-   status = "disabled";
};
 
ipmmu_vp0: mmu@fe99 {
@@ -116,7 +115,6 @@
reg = <0 0xfe99 0 0x1000>;
renesas,ipmmu-main = <&ipmmu_mm 16>;
#iommu-cells = <1>;
-   status = "disabled";
};
 
ipmmu_vc0: mmu@fe6b {
@@ -124,7 +122,6 @@
reg = <0 0xfe6b 0 0x1000>;
renesas,ipmmu-main = <&ipmmu_mm 12>;
#iommu-cells = <1>;
-   status = "disabled";
};
 
ipmmu_pv0: mmu@fd80 {
@@ -132,7 +129,6 @@
reg = <0 0xfd80 0 0x1000>;
renesas,ipmmu-main = <&ipmmu_mm 6>;
#iommu-cells = <1>;
-   status = "disabled";
};
 
ipmmu_hc: mmu@e657 {
@@ -140,7 +136,6 @@
reg = <0 0xe657 0 0x1000>;
renesas,ipmmu-main = <&ipmmu_mm 2>;
#iommu-cells = <1>;
-   status = "disabled";
};
 
ipmmu_rt: mmu@ffc8 {
@@ -148,7 +143,6 @@
reg = <0 0xffc8 0 0x1000>;
renesas,ipmmu-main = <&ipmmu_mm 10>;
#iommu-cells = <1>;
-   status = "disabled";
};
 
ipmmu_mp: mmu@ec67 {
@@ -156,7 +150,6 @@
reg = <0 0xec67 0 0x1000>;
renesas,ipmmu-main = <&ipmmu_mm 4>;
#iommu-cells = <1>;
-   status = "disabled";
};
 
ipmmu_ds0: mmu@e674 {
@@ -164,7 +157,6 @@
reg = <0 0xe674 0 0x1000>;
renesas,ipmmu-main = <&ipmmu_mm 0>;
#iommu-cells = <1>;
-   status = "disabled";
};
 
ipmmu_ds1: mmu@e774 {
@@ -172,7 +164,6 @@
reg = <0 0xe774 0 0x1000>;
renesas,ipmmu-main = <&ipmmu_mm 1>;
#iommu-cells = <1>;
-   status = "disabled";
};
 
ipmmu_mm: mmu@e67b {
@@ -181,7 +172,6 @@
interrupts = ,
 ;
#iommu-cells = <1>;
-   status = "disabled";
};
 
 


[PATCH 02/04] arm64: dts: renesas: r8a7796: Enable IPMMU devices

2018-04-22 Thread Magnus Damm
From: Magnus Damm 

Remove 'status = "disabled"' to make sure all IPMMU devices are enabled
in DT on the r8a7796 SoC.

Signed-off-by: Magnus Damm 
---

 arch/arm64/boot/dts/renesas/r8a7796.dtsi |5 -
 1 file changed, 5 deletions(-)

--- 0001/arch/arm64/boot/dts/renesas/r8a7796.dtsi
+++ work/arch/arm64/boot/dts/renesas/r8a7796.dtsi   2018-04-22 
18:22:15.350607110 +0900
@@ -881,7 +881,6 @@
renesas,ipmmu-main = <&ipmmu_mm 2>;
power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
#iommu-cells = <1>;
-   status = "disabled";
};
 
ipmmu_ir: mmu@ff8b {
@@ -890,7 +889,6 @@
renesas,ipmmu-main = <&ipmmu_mm 3>;
power-domains = <&sysc R8A7796_PD_A3IR>;
#iommu-cells = <1>;
-   status = "disabled";
};
 
ipmmu_mm: mmu@e67b {
@@ -924,7 +922,6 @@
renesas,ipmmu-main = <&ipmmu_mm 6>;
power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
#iommu-cells = <1>;
-   status = "disabled";
};
 
ipmmu_rt: mmu@ffc8 {
@@ -933,7 +930,6 @@
renesas,ipmmu-main = <&ipmmu_mm 7>;
power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
#iommu-cells = <1>;
-   status = "disabled";
};
 
ipmmu_vc0: mmu@fe6b {
@@ -942,7 +938,6 @@
renesas,ipmmu-main = <&ipmmu_mm 8>;
power-domains = <&sysc R8A7796_PD_A3VC>;
#iommu-cells = <1>;
-   status = "disabled";
};
 
ipmmu_vi0: mmu@febd {


[PATCH 03/04] arm64: dts: renesas: r8a77970: Enable IPMMU devices

2018-04-22 Thread Magnus Damm
From: Magnus Damm 

Remove 'status = "disabled"' to make sure all IPMMU devices are enabled
in DT on the r8a77970 SoC.

Signed-off-by: Magnus Damm 
---

 arch/arm64/boot/dts/renesas/r8a77970.dtsi |2 --
 1 file changed, 2 deletions(-)

--- 0001/arch/arm64/boot/dts/renesas/r8a77970.dtsi
+++ work/arch/arm64/boot/dts/renesas/r8a77970.dtsi  2018-04-22 
18:23:37.480607110 +0900
@@ -137,7 +137,6 @@
renesas,ipmmu-main = <&ipmmu_mm 9>;
power-domains = <&sysc R8A77970_PD_ALWAYS_ON>;
#iommu-cells = <1>;
-   status = "disabled";
};
 
ipmmu_ir: mmu@ff8b {
@@ -146,7 +145,6 @@
renesas,ipmmu-main = <&ipmmu_mm 3>;
power-domains = <&sysc R8A77970_PD_A3IR>;
#iommu-cells = <1>;
-   status = "disabled";
};
 
ipmmu_rt: mmu@ffc8 {


[PATCH 01/04] arm64: dts: renesas: r8a7795: Enable IPMMU devices

2018-04-22 Thread Magnus Damm
From: Magnus Damm 

Remove 'status = "disabled"' to make sure all IPMMU devices are enabled
in DT on the r8a7795 SoC.

Signed-off-by: Magnus Damm 
---

 arch/arm64/boot/dts/renesas/r8a7795.dtsi |   12 
 1 file changed, 12 deletions(-)

--- 0001/arch/arm64/boot/dts/renesas/r8a7795.dtsi
+++ work/arch/arm64/boot/dts/renesas/r8a7795.dtsi   2018-04-22 
18:18:49.150607110 +0900
@@ -947,7 +947,6 @@
renesas,ipmmu-main = <&ipmmu_mm 2>;
power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
#iommu-cells = <1>;
-   status = "disabled";
};
 
ipmmu_ir: mmu@ff8b {
@@ -956,7 +955,6 @@
renesas,ipmmu-main = <&ipmmu_mm 3>;
power-domains = <&sysc R8A7795_PD_A3IR>;
#iommu-cells = <1>;
-   status = "disabled";
};
 
ipmmu_mm: mmu@e67b {
@@ -974,7 +972,6 @@
renesas,ipmmu-main = <&ipmmu_mm 4>;
power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
#iommu-cells = <1>;
-   status = "disabled";
};
 
ipmmu_pv0: mmu@fd80 {
@@ -983,7 +980,6 @@
renesas,ipmmu-main = <&ipmmu_mm 6>;
power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
#iommu-cells = <1>;
-   status = "disabled";
};
 
ipmmu_pv1: mmu@fd95 {
@@ -992,7 +988,6 @@
renesas,ipmmu-main = <&ipmmu_mm 7>;
power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
#iommu-cells = <1>;
-   status = "disabled";
};
 
ipmmu_pv2: mmu@fd96 {
@@ -1001,7 +996,6 @@
renesas,ipmmu-main = <&ipmmu_mm 8>;
power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
#iommu-cells = <1>;
-   status = "disabled";
};
 
ipmmu_pv3: mmu@fd97 {
@@ -1010,7 +1004,6 @@
renesas,ipmmu-main = <&ipmmu_mm 9>;
power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
#iommu-cells = <1>;
-   status = "disabled";
};
 
ipmmu_rt: mmu@ffc8 {
@@ -1019,7 +1012,6 @@
renesas,ipmmu-main = <&ipmmu_mm 10>;
power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
#iommu-cells = <1>;
-   status = "disabled";
};
 
ipmmu_vc0: mmu@fe6b {
@@ -1028,7 +1020,6 @@
renesas,ipmmu-main = <&ipmmu_mm 12>;
power-domains = <&sysc R8A7795_PD_A3VC>;
#iommu-cells = <1>;
-   status = "disabled";
};
 
ipmmu_vc1: mmu@fe6f {
@@ -1037,7 +1028,6 @@
renesas,ipmmu-main = <&ipmmu_mm 13>;
power-domains = <&sysc R8A7795_PD_A3VC>;
#iommu-cells = <1>;
-   status = "disabled";
};
 
ipmmu_vi0: mmu@febd {
@@ -1054,7 +1044,6 @@
renesas,ipmmu-main = <&ipmmu_mm 15>;
power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
#iommu-cells = <1>;
-   status = "disabled";
};
 
ipmmu_vp0: mmu@fe99 {
@@ -1063,7 +1052,6 @@
renesas,ipmmu-main = <&ipmmu_mm 16>;
power-domains = <&sysc R8A7795_PD_A3VP>;
#iommu-cells = <1>;
-   status = "disabled";
};
 
ipmmu_vp1: mmu@fe98 {


[PATCH 00/04] arm64: dts: renesas: Enable IPMMU devices

2018-04-22 Thread Magnus Damm
arm64: dts: renesas: Enable IPMMU devices

[PATCH 01/04] arm64: dts: renesas: r8a7795: Enable IPMMU devices
[PATCH 02/04] arm64: dts: renesas: r8a7796: Enable IPMMU devices
[PATCH 03/04] arm64: dts: renesas: r8a77970: Enable IPMMU devices
[PATCH 04/04] arm64: dts: renesas: r8a77995: Enable IPMMU devices

Following the policy of using DT to describe the hardware and not software
support state, this series makes sure all IPMMU devices are enabled in DT
for SoCs such as r8a7795, r8a7796, r8a77970 and r8a77995. 

Signed-off-by: Magnus Damm 
---

 Developed on top of renesas-devel-20180420-v4.17-rc1

 arch/arm64/boot/dts/renesas/r8a7795.dtsi  |   12 
 arch/arm64/boot/dts/renesas/r8a7796.dtsi  |5 -
 arch/arm64/boot/dts/renesas/r8a77970.dtsi |2 --
 arch/arm64/boot/dts/renesas/r8a77995.dtsi |   10 --
 4 files changed, 29 deletions(-)


Re: [PATCH 07/61] dma: simplify getting .drvdata

2018-04-22 Thread Wolfram Sang
On Sun, Apr 22, 2018 at 11:47:33AM +0530, Vinod Koul wrote:
> On Thu, Apr 19, 2018 at 04:05:37PM +0200, Wolfram Sang wrote:
> > We should get drvdata from struct device directly. Going via
> > platform_device is an unneeded step back and forth.
> 
> Do you mind splitting this per driver please, that makes it easy to manage
> for me :)

No problem, done.



signature.asc
Description: PGP signature


Re: [PATCH 3/8] [media] v4l: rcar_fdp1: Change platform dependency to ARCH_RENESAS

2018-04-22 Thread Laurent Pinchart
Hi Geert,

On Saturday, 21 April 2018 11:07:11 EEST Laurent Pinchart wrote:
> On Friday, 20 April 2018 16:28:29 EEST Geert Uytterhoeven wrote:
> > The Renesas Fine Display Processor driver is used on Renesas R-Car SoCs
> > only.  Since commit 9b5ba0df4ea4f940 ("ARM: shmobile: Introduce
> > ARCH_RENESAS") is ARCH_RENESAS a more appropriate platform dependency
> > than the legacy ARCH_SHMOBILE, hence use the former.
> > 
> > This will allow to drop ARCH_SHMOBILE on ARM and ARM64 in the near
> > future.
> > 
> > Signed-off-by: Geert Uytterhoeven 
> 
> Acked-by: Laurent Pinchart 
> 
> How would you like to get this merged ?

Unless you would like to merge the whole series in one go, I'll take this in 
my tree as I have a conflicting patch I would like to submit for v4.18.

> > ---
> > 
> >  drivers/media/platform/Kconfig | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/media/platform/Kconfig
> > b/drivers/media/platform/Kconfig index f9235e8f8e962d2e..7ad4725f9d1f9627
> > 100644
> > --- a/drivers/media/platform/Kconfig
> > +++ b/drivers/media/platform/Kconfig
> > @@ -396,7 +396,7 @@ config VIDEO_SH_VEU
> >  config VIDEO_RENESAS_FDP1
> > tristate "Renesas Fine Display Processor"
> > depends on VIDEO_DEV && VIDEO_V4L2 && HAS_DMA
> > -   depends on ARCH_SHMOBILE || COMPILE_TEST
> > +   depends on ARCH_RENESAS || COMPILE_TEST
> > depends on (!ARCH_RENESAS && !VIDEO_RENESAS_FCP) || VIDEO_RENESAS_FCP
> > select VIDEOBUF2_DMA_CONTIG
> > select V4L2_MEM2MEM_DEV

-- 
Regards,

Laurent Pinchart