[linux-sunxi] Re: [PATCH v6 1/6] drm: sun4i: dsi: Drop DRM bind race with bridge attach

2022-01-17 Thread Jagan Teki
On Mon, Dec 13, 2021 at 10:32 PM Maxime Ripard  wrote:
>
> On Fri, Dec 10, 2021 at 04:47:06PM +0530, Jagan Teki wrote:
> > Existing host driver will keep looking for DRM pointer in
> > sun6i_dsi_attach and defers even if the particular DSI device
> > is found for the first time. Meanwhile it triggers the bind
> > callback and gets the DRM pointer and then continues the
> > sun6i_dsi_attach.
> >
> > This makes a deadlock situation if sun6i_dsi_attach is trying
> > to find the bridge.
>
> I'm not sure what you mean by deadlock here, there's no lock involved?

deadlock parse here for general understanding, where bind is trying to
attach bridge but drm pointer is not available that point and drm
pointer will available only when bind done. This is what I'm calling
as deadlock here.

Anyway, now I'm able to support both panel and bridge to support
hotplug so no need to drop the hotplug support.

Please let me know, if you have any questions so-that I can send next
version series.

Thanks,
Jagan.

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CAMty3ZAetcXpcokJ418VGHzbi4ivJg4Rt0OVgh7WaZ6GAJQY1Q%40mail.gmail.com.


[linux-sunxi] Re: [PATCH v6 3/6] drm: sun4i: dsi: Add bridge support

2022-01-17 Thread Jagan Teki
On Mon, Dec 13, 2021 at 10:48 PM Maxime Ripard  wrote:
>
> On Fri, Dec 10, 2021 at 04:47:08PM +0530, Jagan Teki wrote:
> > Some display panels would come up with a non-DSI output, those
> > can have an option to connect the DSI host by means of interface
> > bridge converter.
> >
> > This DSI to non-DSI interface bridge converter would require
> > DSI Host to handle drm bridge functionalities in order to
> > communicate interface bridge.
> >
> > This patch adds support for bridge functionalities in Allwinner
> > DSI controller.
> >
> > Supporting down-stream bridge makes few changes in the driver.
> >
> > - It drops drm_connector and related operations as drm_bridge_attach
> >   creates connector during attachment.
> >
> > - It drop panel pointer and iterate the bridge, so-that it can operate
> >   the normal bridge and panel_bridge in constitutive callbacks.
> >
> > - It uses devm_drm_of_get_bridge for panel or bridge lookup. It uses
> >   port 0 and endpoint 0 to support I2C-based bridges eventhough the
> >   usual Allwinner DSI OF graph doesn't require this for panel and
> >   non-I2C based downstream bridges.
> >
> > Signed-off-by: Jagan Teki 
> > ---
> > Changes for v6:
> > - support donwstream bridge
> > - drop bridge conversion
> > - devm_drm_of_get_bridge() require child lookup
> > https://patchwork.kernel.org/project/dri-devel/cover/20211207054747.461029-1-ja...@amarulasolutions.com/
> > Changes for v5:
> > - add atomic APIs
> > - find host and device variant DSI devices.
> > Changes for v4, v3:
> > - none
> >
> >  drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 83 ++
> >  drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h |  9 +--
> >  2 files changed, 33 insertions(+), 59 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c 
> > b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> > index 9cf91dcac3f2..f1d612bf1a0b 100644
> > --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> > +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> > @@ -21,6 +21,7 @@
> >
> >  #include 
> >  #include 
> > +#include 
> >  #include 
> >  #include 
> >  #include 
> > @@ -720,6 +721,7 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder 
> > *encoder)
> >   struct mipi_dsi_device *device = dsi->device;
> >   union phy_configure_opts opts = { };
> >   struct phy_configure_opts_mipi_dphy *cfg = _dphy;
> > + struct drm_bridge *iter;
> >   u16 delay;
> >   int err;
> >
> > @@ -769,8 +771,10 @@ static void sun6i_dsi_encoder_enable(struct 
> > drm_encoder *encoder)
> >   phy_configure(dsi->dphy, );
> >   phy_power_on(dsi->dphy);
> >
> > - if (dsi->panel)
> > - drm_panel_prepare(dsi->panel);
> > + list_for_each_entry(iter, >bridge_chain, chain_node) {
> > + if (iter->funcs->pre_enable)
> > + iter->funcs->pre_enable(iter);
> > + }
>
> Like we discussed in the previous version already, this is unnecessary,
> just like the poking at bridge_chain in the encoder.

Unlike previous patch, this patch not doing bridge conversion it is
supporting downstream bridge. Yes, it is possible to use bridge helper
for invoking downstream bridge enable when bridge functions added.

Thanks,
Jagan.

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CAMty3ZBXUart1GZod2v%3DbMv2xYxuDjkyEw-WZ8bMDsCLU1gVWA%40mail.gmail.com.


[linux-sunxi] [DO NOT MERGE] [PATCH v6 6/6] ARM: dts: sun8i: bananapi-m2m: Enable DLPC3433 Bridge (I2C)

2021-12-10 Thread Jagan Teki
R16 board has DLCP3433 DSI bridge for connecting TI DMD Projectors.

Enable support for it.

Note: This is for testing purpose, DLPC3433 not available in BPI-M2M.

Signed-off-by: Jagan Teki 
---
 .../boot/dts/sun8i-r16-bananapi-m2m-i2c.dts   | 69 +++
 1 file changed, 69 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-r16-bananapi-m2m-i2c.dts 
b/arch/arm/boot/dts/sun8i-r16-bananapi-m2m-i2c.dts
index 7713cdaf6211..a96fbfd743f7 100644
--- a/arch/arm/boot/dts/sun8i-r16-bananapi-m2m-i2c.dts
+++ b/arch/arm/boot/dts/sun8i-r16-bananapi-m2m-i2c.dts
@@ -86,6 +86,16 @@ vol-down {
};
};
 
+   panel {
+   compatible = "panel-simple";
+
+   port {
+   panel_out_bridge: endpoint {
+   remote-endpoint = <_out_panel>;
+   };
+   };
+   };
+
reg_vcc5v0: vcc5v0 {
compatible = "regulator-fixed";
regulator-name = "vcc5v0";
@@ -125,6 +135,32 @@  {
status = "okay";
 };
 
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   vcc-dsi-supply = <_dcdc1>;  /* VCC-DSI */
+   status = "okay";
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port@0 {
+   reg = <0>;
+
+   dsi_out_bridge: endpoint {
+   remote-endpoint = <_out_dsi>;
+   };
+   };
+   };
+};
+
  {
status = "okay";
 };
@@ -132,6 +168,35 @@  {
  {
clock-frequency = <10>;
status = "okay";
+
+   bridge@1d {
+   compatible = "ti,dlpc3433";
+   reg = <0x1d>;
+   enable-gpios = < 4 15 GPIO_ACTIVE_HIGH>;
+   vcc_intf-supply = <_dldo1>;
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   bridge_in: port@0 {
+   reg = <0>;
+
+   bridge_out_dsi: endpoint {
+   remote-endpoint = <_out_bridge>;
+   data-lanes = <0 1 2 3>;
+   };
+   };
+
+   bridge_out: port@1 {
+   reg = <1>;
+
+   bridge_out_panel: endpoint {
+   remote-endpoint = <_out_bridge>;
+   };
+   };
+   };
+   };
 };
 
  {
@@ -289,6 +354,10 @@  {
"Right DAC", "AIF1 Slot 0 Right";
 };
 
+ {
+   status = "okay";
+};
+
  {
pinctrl-names = "default";
pinctrl-0 = <_pb_pins>;
-- 
2.25.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20211210111711.2072660-7-jagan%40amarulasolutions.com.


[linux-sunxi] [DO NOT MERGE] [PATCH v6 5/6] ARM: dts: sun8i: bananapi-m2m: Enable ICN6211 DSI Bridge

2021-12-10 Thread Jagan Teki
Bananapi S070WV20-CT16 is a pure RGB output panel with ICN6211
DSI/RGB convertor bridge.

Enable bridge along with associated panel.

Signed-off-by: Jagan Teki 
---
 arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts | 64 
 1 file changed, 64 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts 
b/arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts
index bf5b5e2f6168..501666dfb5ee 100644
--- a/arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts
+++ b/arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts
@@ -44,6 +44,7 @@
 #include "sun8i-a33.dtsi"
 
 #include 
+#include 
 
 / {
model = "BananaPi M2 Magic";
@@ -55,12 +56,21 @@ aliases {
i2c2 = 
serial0 = 
serial1 = 
+   mmc0 = 
};
 
chosen {
stdout-path = "serial0:115200n8";
};
 
+   backlight: backlight {
+   compatible = "pwm-backlight";
+   pwms = < 0 5 PWM_POLARITY_INVERTED>;
+   brightness-levels = <1 2 4 8 16 32 64 128 255>;
+   default-brightness-level = <8>;
+   enable-gpios = <_pio 0 4 GPIO_ACTIVE_HIGH>; /* LCD-BL-EN: PL4 
*/
+   };
+
leds {
compatible = "gpio-leds";
 
@@ -81,6 +91,18 @@ led-2 {
};
};
 
+   panel {
+   compatible = "bananapi,s070wv20-ct16";
+   enable-gpios = < 1 7 GPIO_ACTIVE_HIGH>; /* LCD-PWR-EN: PB7 
*/
+   backlight = <>;
+
+   port {
+   panel_out_bridge: endpoint {
+   remote-endpoint = <_out_panel>;
+   };
+   };
+   };
+
reg_vcc5v0: vcc5v0 {
compatible = "regulator-fixed";
regulator-name = "vcc5v0";
@@ -122,6 +144,38 @@  {
status = "okay";
 };
 
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   vcc-dsi-supply = <_dcdc1>;  /* VCC-DSI */
+   status = "okay";
+
+   bridge@0 {
+   compatible = "chipone,icn6211";
+   reg = <0>;
+   enable-gpios = <_pio 0 5 GPIO_ACTIVE_HIGH>; /* LCD-RST: PL5 */
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   bridge_out: port@1 {
+   reg = <1>;
+
+   bridge_out_panel: endpoint {
+   remote-endpoint = <_out_bridge>;
+   };
+   };
+   };
+   };
+};
+
  {
status = "okay";
 };
@@ -157,6 +211,12 @@  {
status = "okay";
 };
 
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pin>;
+   status = "okay";
+};
+
 _rsb {
status = "okay";
 
@@ -269,6 +329,10 @@  {
status = "okay";
 };
 
+ {
+   status = "okay";
+};
+
  {
pinctrl-names = "default";
pinctrl-0 = <_pb_pins>;
-- 
2.25.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20211210111711.2072660-6-jagan%40amarulasolutions.com.


[linux-sunxi] [DO NOT MERGE] [PATCH v6 4/6] ARM: dts: sun8i: bananapi-m2m: Enable iS070WV20-CT16 DSI Panel

2021-12-10 Thread Jagan Teki
Bananapi S070WV20-CT16 is a pure RGB output panel with ICN6211
DSI/RGB convertor bridge.

Enable support for it.

Signed-off-by: Jagan Teki 
---
 .../boot/dts/sun8i-r16-bananapi-m2m-panel.dts | 41 +++
 1 file changed, 41 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-r16-bananapi-m2m-panel.dts 
b/arch/arm/boot/dts/sun8i-r16-bananapi-m2m-panel.dts
index bf5b5e2f6168..04392358b492 100644
--- a/arch/arm/boot/dts/sun8i-r16-bananapi-m2m-panel.dts
+++ b/arch/arm/boot/dts/sun8i-r16-bananapi-m2m-panel.dts
@@ -44,6 +44,7 @@
 #include "sun8i-a33.dtsi"
 
 #include 
+#include 
 
 / {
model = "BananaPi M2 Magic";
@@ -55,12 +56,21 @@ aliases {
i2c2 = 
serial0 = 
serial1 = 
+   mmc0 = 
};
 
chosen {
stdout-path = "serial0:115200n8";
};
 
+   backlight: backlight {
+   compatible = "pwm-backlight";
+   pwms = < 0 5 PWM_POLARITY_INVERTED>;
+   brightness-levels = <1 2 4 8 16 32 64 128 255>;
+   default-brightness-level = <8>;
+   enable-gpios = <_pio 0 4 GPIO_ACTIVE_HIGH>; /* LCD-BL-EN: PL4 
*/
+   };
+
leds {
compatible = "gpio-leds";
 
@@ -122,6 +132,27 @@  {
status = "okay";
 };
 
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   vcc-dsi-supply = <_dcdc1>;  /* VCC-DSI */
+   status = "okay";
+
+   panel@0 {
+   compatible = "bananapi,s070wv20-ct16-icn6211";
+   reg = <0>;
+   reset-gpios = <_pio 0 5 GPIO_ACTIVE_HIGH>; /* LCD-RST: PL5 */
+   enable-gpios = < 1 7 GPIO_ACTIVE_HIGH>; /* LCD-PWR-EN: PB7 
*/
+   backlight = <>;
+   };
+};
+
  {
status = "okay";
 };
@@ -157,6 +188,12 @@  {
status = "okay";
 };
 
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pin>;
+   status = "okay";
+};
+
 _rsb {
status = "okay";
 
@@ -269,6 +306,10 @@  {
status = "okay";
 };
 
+ {
+   status = "okay";
+};
+
  {
pinctrl-names = "default";
pinctrl-0 = <_pb_pins>;
-- 
2.25.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20211210111711.2072660-5-jagan%40amarulasolutions.com.


[linux-sunxi] [PATCH v6 3/6] drm: sun4i: dsi: Add bridge support

2021-12-10 Thread Jagan Teki
Some display panels would come up with a non-DSI output, those
can have an option to connect the DSI host by means of interface
bridge converter.

This DSI to non-DSI interface bridge converter would require
DSI Host to handle drm bridge functionalities in order to
communicate interface bridge.

This patch adds support for bridge functionalities in Allwinner
DSI controller.

Supporting down-stream bridge makes few changes in the driver.

- It drops drm_connector and related operations as drm_bridge_attach
  creates connector during attachment.

- It drop panel pointer and iterate the bridge, so-that it can operate
  the normal bridge and panel_bridge in constitutive callbacks.

- It uses devm_drm_of_get_bridge for panel or bridge lookup. It uses
  port 0 and endpoint 0 to support I2C-based bridges eventhough the
  usual Allwinner DSI OF graph doesn't require this for panel and
  non-I2C based downstream bridges.

Signed-off-by: Jagan Teki 
---
Changes for v6:
- support donwstream bridge
- drop bridge conversion
- devm_drm_of_get_bridge() require child lookup
https://patchwork.kernel.org/project/dri-devel/cover/20211207054747.461029-1-ja...@amarulasolutions.com/
Changes for v5:
- add atomic APIs
- find host and device variant DSI devices.
Changes for v4, v3:
- none

 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 83 ++
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h |  9 +--
 2 files changed, 33 insertions(+), 59 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c 
b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
index 9cf91dcac3f2..f1d612bf1a0b 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
@@ -21,6 +21,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -720,6 +721,7 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder 
*encoder)
struct mipi_dsi_device *device = dsi->device;
union phy_configure_opts opts = { };
struct phy_configure_opts_mipi_dphy *cfg = _dphy;
+   struct drm_bridge *iter;
u16 delay;
int err;
 
@@ -769,8 +771,10 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder 
*encoder)
phy_configure(dsi->dphy, );
phy_power_on(dsi->dphy);
 
-   if (dsi->panel)
-   drm_panel_prepare(dsi->panel);
+   list_for_each_entry(iter, >bridge_chain, chain_node) {
+   if (iter->funcs->pre_enable)
+   iter->funcs->pre_enable(iter);
+   }
 
/*
 * FIXME: This should be moved after the switch to HS mode.
@@ -784,8 +788,10 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder 
*encoder)
 * ordering on the panels I've tested it with, so I guess this
 * will do for now, until that IP is better understood.
 */
-   if (dsi->panel)
-   drm_panel_enable(dsi->panel);
+   list_for_each_entry(iter, >bridge_chain, chain_node) {
+   if (iter->funcs->enable)
+   iter->funcs->enable(iter);
+   }
 
sun6i_dsi_start(dsi, DSI_START_HSC);
 
@@ -797,12 +803,16 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder 
*encoder)
 static void sun6i_dsi_encoder_disable(struct drm_encoder *encoder)
 {
struct sun6i_dsi *dsi = encoder_to_sun6i_dsi(encoder);
+   struct drm_bridge *iter;
 
DRM_DEBUG_DRIVER("Disabling DSI output\n");
 
-   if (dsi->panel) {
-   drm_panel_disable(dsi->panel);
-   drm_panel_unprepare(dsi->panel);
+   list_for_each_entry(iter, >bridge_chain, chain_node) {
+   if (iter->funcs->disable)
+   iter->funcs->disable(iter);
+
+   if (iter->funcs->post_disable)
+   iter->funcs->post_disable(iter);
}
 
phy_power_off(dsi->dphy);
@@ -813,35 +823,6 @@ static void sun6i_dsi_encoder_disable(struct drm_encoder 
*encoder)
regulator_disable(dsi->regulator);
 }
 
-static int sun6i_dsi_get_modes(struct drm_connector *connector)
-{
-   struct sun6i_dsi *dsi = connector_to_sun6i_dsi(connector);
-
-   return drm_panel_get_modes(dsi->panel, connector);
-}
-
-static const struct drm_connector_helper_funcs 
sun6i_dsi_connector_helper_funcs = {
-   .get_modes  = sun6i_dsi_get_modes,
-};
-
-static enum drm_connector_status
-sun6i_dsi_connector_detect(struct drm_connector *connector, bool force)
-{
-   struct sun6i_dsi *dsi = connector_to_sun6i_dsi(connector);
-
-   return dsi->panel ? connector_status_connected :
-   connector_status_disconnected;
-}
-
-static const struct drm_connector_funcs sun6i_dsi_connector_funcs = {
-   .detect = sun6i_dsi_connector_detect,
-   .fill_modes = drm_helper_probe_single_connector_modes,
-   .destroy= drm_connector_

[linux-sunxi] [PATCH v6 2/6] drm: sun4i: dsi: Add component only once DSI device attached

2021-12-10 Thread Jagan Teki
Having component_add for running all drm bind callbacks returns
error or unbound due to chain of DSI devices connected across
bridge topology on a display pipeline.

In a typical bridge oriented display pipeline where the host is
connected to the bridge converter and that indeed connected to
a panel.

DRM => SUN6I DSI Host => Chipone ICN6211 => BananaPi Panel

The bridge converter is looking for a panel to probe first and
then attach the host. The host attach is looking for a bridge
converter to probe and preserve bridge pointer, at this movement
the host is trying to bind the all callbacks and one of the bind
callback in the DSI host is trying to find the bridge using the
bridge pointer in sun6i_dsi_attach call.

chipone_probe().start
drm_of_find_panel_or_bridge
mipi_dsi_attach
 sun6i_dsi_attach
 drm_of_find_panel_or_bridge
chipone_probe().done

sun6i_dsi_probe().start
mipi_dsi_host_register
component_add
sun6i_dsi_probe().done

However, the movement when panel defers the probe, will make the
bridge converter defer the host attach call which eventually found
a NULL bridge pointer during DSI component bind callback.

So, in order to prevent this scenario of binding invalid bridge,
wait for DSI devices on the pipeline to probe first and start the
binding process by moving component_add in host probe to attach call.

chipone_probe().start
drm_of_find_panel_or_bridge
mipi_dsi_attach
 sun6i_dsi_attach
 drm_of_find_panel_or_bridge
  component_add
chipone_probe().done

sun6i_dsi_probe().start
mipi_dsi_host_register
sun6i_dsi_probe().done

Signed-off-by: Jagan Teki 
---
Changes for v6:
- none
Changes for v5:
- new patch

 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 120 +
 1 file changed, 61 insertions(+), 59 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c 
b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
index 4bdcce8f1d84..9cf91dcac3f2 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
@@ -959,11 +959,63 @@ static int sun6i_dsi_dcs_read(struct sun6i_dsi *dsi,
return 1;
 }
 
+static int sun6i_dsi_bind(struct device *dev, struct device *master,
+void *data)
+{
+   struct drm_device *drm = data;
+   struct sun6i_dsi *dsi = dev_get_drvdata(dev);
+   int ret;
+
+   drm_encoder_helper_add(>encoder,
+  _dsi_enc_helper_funcs);
+   ret = drm_simple_encoder_init(drm, >encoder,
+ DRM_MODE_ENCODER_DSI);
+   if (ret) {
+   dev_err(dsi->dev, "Couldn't initialise the DSI encoder\n");
+   return ret;
+   }
+   dsi->encoder.possible_crtcs = BIT(0);
+
+   drm_connector_helper_add(>connector,
+_dsi_connector_helper_funcs);
+   ret = drm_connector_init(drm, >connector,
+_dsi_connector_funcs,
+DRM_MODE_CONNECTOR_DSI);
+   if (ret) {
+   dev_err(dsi->dev,
+   "Couldn't initialise the DSI connector\n");
+   goto err_cleanup_connector;
+   }
+
+   drm_connector_attach_encoder(>connector, >encoder);
+
+   return 0;
+
+err_cleanup_connector:
+   drm_encoder_cleanup(>encoder);
+   return ret;
+}
+
+static void sun6i_dsi_unbind(struct device *dev, struct device *master,
+   void *data)
+{
+   struct sun6i_dsi *dsi = dev_get_drvdata(dev);
+
+   drm_encoder_cleanup(>encoder);
+}
+
+static const struct component_ops sun6i_dsi_ops = {
+   .bind   = sun6i_dsi_bind,
+   .unbind = sun6i_dsi_unbind,
+};
+
 static int sun6i_dsi_attach(struct mipi_dsi_host *host,
struct mipi_dsi_device *device)
 {
struct sun6i_dsi *dsi = host_to_sun6i_dsi(host);
struct drm_panel *panel = of_drm_find_panel(device->dev.of_node);
+   struct device *dev = dsi->dev;
+   int ret;
 
if (IS_ERR(panel))
return PTR_ERR(panel);
@@ -973,6 +1025,13 @@ static int sun6i_dsi_attach(struct mipi_dsi_host *host,
 
dev_info(host->dev, "Attached device %s\n", device->name);
 
+   ret = component_add(dev, _dsi_ops);
+   if (ret) {
+   dev_err(dev, "Couldn't register our component\n");
+   mipi_dsi_host_unregister(>host);
+   return ret;
+   }
+
return 0;
 }
 
@@ -984,6 +1043,8 @@ static int sun6i_dsi_detach(struct mipi_dsi_host *host,
dsi->panel = NULL;
dsi->device = NULL;
 
+   component_del(dsi->dev, _dsi_ops);
+
return 0;
 }
 
@@ -1041,56 +1102,6 @@ static const struct regmap_config 
sun6i_dsi_regmap_config = {
.name   = "mipi-dsi&qu

[linux-sunxi] [PATCH v6 1/6] drm: sun4i: dsi: Drop DRM bind race with bridge attach

2021-12-10 Thread Jagan Teki
Existing host driver will keep looking for DRM pointer in
sun6i_dsi_attach and defers even if the particular DSI device
is found for the first time. Meanwhile it triggers the bind
callback and gets the DRM pointer and then continues the
sun6i_dsi_attach.

This makes a deadlock situation if sun6i_dsi_attach is trying
to find the bridge.

If interface bridge is trying to call host attach, then host
sun6i_dsi_attach is trying to find bridge and defers the
interface bridge even if it found the bridge as bind callback
does not complete at the movement. So, this sun6i_dsi_attach
defers interface bridge and triggers the bind callback and
tries to attach the bridge with a bridge pointer which is not
available at the moment.

Eventually these callbacks are triggered recursively, as
sun6i_dsi_attach defers interface bridge and bind callback
defers sun6i_dsi_attach due to invalid bridge ponter.

This patch prevents this situation by probing all DSI devices
on the pipeline first and then triggers the bind callback by
dropping exing DRM binding logic.

Signed-off-by: Jagan Teki 
---
Changes for v6:
- none
Changes for v5:
- new patch

 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 10 +-
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h |  1 -
 2 files changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c 
b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
index 527c7b2474da..4bdcce8f1d84 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
@@ -967,14 +967,10 @@ static int sun6i_dsi_attach(struct mipi_dsi_host *host,
 
if (IS_ERR(panel))
return PTR_ERR(panel);
-   if (!dsi->drm || !dsi->drm->registered)
-   return -EPROBE_DEFER;
 
dsi->panel = panel;
dsi->device = device;
 
-   drm_kms_helper_hotplug_event(dsi->drm);
-
dev_info(host->dev, "Attached device %s\n", device->name);
 
return 0;
@@ -988,8 +984,6 @@ static int sun6i_dsi_detach(struct mipi_dsi_host *host,
dsi->panel = NULL;
dsi->device = NULL;
 
-   drm_kms_helper_hotplug_event(dsi->drm);
-
return 0;
 }
 
@@ -1077,8 +1071,6 @@ static int sun6i_dsi_bind(struct device *dev, struct 
device *master,
 
drm_connector_attach_encoder(>connector, >encoder);
 
-   dsi->drm = drm;
-
return 0;
 
 err_cleanup_connector:
@@ -1091,7 +1083,7 @@ static void sun6i_dsi_unbind(struct device *dev, struct 
device *master,
 {
struct sun6i_dsi *dsi = dev_get_drvdata(dev);
 
-   dsi->drm = NULL;
+   drm_encoder_cleanup(>encoder);
 }
 
 static const struct component_ops sun6i_dsi_ops = {
diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h 
b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h
index c863900ae3b4..61e88ea6044d 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h
@@ -29,7 +29,6 @@ struct sun6i_dsi {
 
struct device   *dev;
struct mipi_dsi_device  *device;
-   struct drm_device   *drm;
struct drm_panel*panel;
 };
 
-- 
2.25.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20211210111711.2072660-2-jagan%40amarulasolutions.com.


[linux-sunxi] [PATCH v6 0/6] drm: sun4i: dsi: Bridge support

2021-12-10 Thread Jagan Teki
This series add bridge support for Allwinner DSI controller.

In addition to previous version, this series add bridge support
only not doing any bridge conversion at the moment.

Previous version changes [1].

Patch 1: Drop the DRM bind race while attaching bridges

Patch 2: Move component_add into sun6i_dsi_attach

Patch 3: Add Bridge driver

Patch 4: Add mode_set API

Patch 5: Enable DSI Panel

Patch 6: Enable DSI Bridge

Patch 7: Enable DSI Bridge (I2C)

[1] 
https://patchwork.kernel.org/project/dri-devel/cover/20211122065223.88059-1-ja...@amarulasolutions.com/

Any inputs?
Jagan.

Jagan Teki (6):
  drm: sun4i: dsi: Drop DRM bind race with bridge attach
  drm: sun4i: dsi: Add component only once DSI device attached
  drm: sun4i: dsi: Add bridge support
  [DO NOT MERGE] ARM: dts: sun8i: bananapi-m2m: Enable iS070WV20-CT16 DSI Panel
  [DO NOT MERGE] ARM: dts: sun8i: bananapi-m2m: Enable ICN6211 DSI Bridge
  [DO NOT MERGE] ARM: dts: sun8i: bananapi-m2m: Enable DLPC3433 Bridge (I2C)

 .../boot/dts/sun8i-r16-bananapi-m2m-i2c.dts   |  69 +++
 .../boot/dts/sun8i-r16-bananapi-m2m-panel.dts |  41 
 arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts  |  64 ++
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c| 187 --
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h|  10 +-
 5 files changed, 256 insertions(+), 115 deletions(-)

-- 
2.25.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20211210111711.2072660-1-jagan%40amarulasolutions.com.


[linux-sunxi] Re: [PATCH v2 4/6] net: sun8i-emac: add v3s variant

2021-12-06 Thread Jagan Teki
On Sun, May 23, 2021 at 4:52 AM Andreas Rehn  wrote:
>
> Add variant V3S_EMAC.
> Handle pinmux compile time error by skipping goio setup, because
> V3s uses internal phy and don't expose pins.
>
> Signed-off-by: Andreas Rehn 
> ---
> Changes in v2:
> - skip pinmux and add proper description
> - Add V3S variant add it to compatible list
> - Skip (R)GMII flags and handle sun8i_handle_internal_phy
>
>  drivers/net/sun8i_emac.c | 15 ---
>  1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/sun8i_emac.c b/drivers/net/sun8i_emac.c
> index 5a1b38bf80..ab9f61994c 100644
> --- a/drivers/net/sun8i_emac.c
> +++ b/drivers/net/sun8i_emac.c
> @@ -145,6 +145,7 @@ enum emac_variant {
> A64_EMAC,
> R40_GMAC,
> H6_EMAC,
> +   V3S_EMAC,
>  };
>
>  struct emac_dma_desc {
> @@ -303,7 +304,7 @@ static void sun8i_adjust_link(struct emac_eth_dev *priv,
>  static u32 sun8i_emac_set_syscon_ephy(struct emac_eth_dev *priv, u32 reg)
>  {
> if (priv->use_internal_phy) {
> -   /* H3 based SoC's that has an Internal 100MBit PHY
> +   /* H3 and V3s based SoC's that has an Internal 100MBit PHY
>  * needs to be configured and powered up before use
> */
> reg &= ~H3_EPHY_DEFAULT_MASK;
> @@ -354,7 +355,8 @@ static int sun8i_emac_set_syscon(struct sun8i_eth_pdata 
> *pdata,
> case PHY_INTERFACE_MODE_RGMII_ID:
> case PHY_INTERFACE_MODE_RGMII_RXID:
> case PHY_INTERFACE_MODE_RGMII_TXID:
> -   reg |= SC_EPIT | SC_ETCS_INT_GMII;
> +   if (priv->variant != V3S_EMAC)
> +   reg |= SC_EPIT | SC_ETCS_INT_GMII;
> break;
> case PHY_INTERFACE_MODE_RMII:
> if (priv->variant == H3_EMAC ||
> @@ -566,6 +568,10 @@ static int parse_phy_pins(struct udevice *dev)
> iomux = SUN8I_IOMUX;
> else if (IS_ENABLED(CONFIG_MACH_SUN50I))
> iomux = SUN8I_IOMUX;
> +   else if (IS_ENABLED(CONFIG_MACH_SUN8I_V3S))
> +   // V3s does not expose any MAC pins,
> +   // but case is required to handle BUILD_BUG_ON_MSG.

Wrong multi-line comment. please fix it?

Jagan.

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CAMty3ZBb9tfUBkvSrdP5jpmUev__xnL5zJ5Ce3TJr1ri4dbgQQ%40mail.gmail.com.


[linux-sunxi] Re: [PATCH v2 5/6] dts: sunxi: v3s: enable emac

2021-12-06 Thread Jagan Teki
On Sat, May 22, 2021 at 1:36 AM Andreas Rehn  wrote:
>
> Enable emac for licheepi-zero-dock as it provides a ethernet port
>
> Signed-off-by: Andreas Rehn 
> ---
>  arch/arm/dts/sun8i-v3s-licheepi-zero-dock.dts | 9 +
>  1 file changed, 9 insertions(+)
>
> diff --git a/arch/arm/dts/sun8i-v3s-licheepi-zero-dock.dts 
> b/arch/arm/dts/sun8i-v3s-licheepi-zero-dock.dts
> index db5cd0b857..4d564028f2 100644
> --- a/arch/arm/dts/sun8i-v3s-licheepi-zero-dock.dts
> +++ b/arch/arm/dts/sun8i-v3s-licheepi-zero-dock.dts
> @@ -49,6 +49,10 @@
> compatible = "licheepi,licheepi-zero-dock", "licheepi,licheepi-zero",
>  "allwinner,sun8i-v3s";
>
> +   aliases {
> +   ethernet0 = 
> +   };
> +
> leds {
> /* The LEDs use PG0~2 pins, which conflict with MMC1 */
> status = "disabled";
> @@ -94,3 +98,8 @@
> voltage = <80>;
> };
>  };
> +
> + {
> +   allwinner,leds-active-low;
> +   status = "okay";
> +};

We (atleast on sunXi) cannot support intermediate dst changes, better
sync any specific tag or commit from upstream linux.

Jagan.

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CAMty3ZD_5kyjKERA2oxUHuewXReDVS4%2BtFWhfLHHmOCSCDeyJg%40mail.gmail.com.


[linux-sunxi] Re: [PATCH v5 3/7] drm: sun4i: dsi: Convert to bridge driver

2021-11-29 Thread Jagan Teki
On Fri, Nov 26, 2021 at 9:34 PM Maxime Ripard  wrote:
>
> On Thu, Nov 25, 2021 at 09:44:14PM +0530, Jagan Teki wrote:
> > On Thu, Nov 25, 2021 at 9:40 PM Maxime Ripard  wrote:
> > >
> > > On Thu, Nov 25, 2021 at 07:55:41PM +0530, Jagan Teki wrote:
> > > > Hi,
> > > >
> > > > On Thu, Nov 25, 2021 at 7:45 PM Maxime Ripard  wrote:
> > > > >
> > > > > On Wed, Nov 24, 2021 at 12:02:47AM +0530, Jagan Teki wrote:
> > > > > > > > > > > + dsi->panel = of_drm_find_panel(remote);
> > > > > > > > > > > + if (IS_ERR(dsi->panel)) {
> > > > > > > > > > > + dsi->panel = NULL;
> > > > > > > > > > > +
> > > > > > > > > > > + dsi->next_bridge = 
> > > > > > > > > > > of_drm_find_bridge(remote);
> > > > > > > > > > > + if (IS_ERR(dsi->next_bridge)) {
> > > > > > > > > > > + dev_err(dsi->dev, "failed to find 
> > > > > > > > > > > bridge\n");
> > > > > > > > > > > + return PTR_ERR(dsi->next_bridge);
> > > > > > > > > > > + }
> > > > > > > > > > > + } else {
> > > > > > > > > > > + dsi->next_bridge = NULL;
> > > > > > > > > > > + }
> > > > > > > > > > > +
> > > > > > > > > > > + of_node_put(remote);
> > > > > > > > > >
> > > > > > > > > > Using devm_drm_of_get_bridge would greatly simplify the 
> > > > > > > > > > driver
> > > > > > > > >
> > > > > > > > > I'm aware of this and this would break the existing sunxi dsi 
> > > > > > > > > binding,
> > > > > > > > > we are not using ports based pipeline in dsi node. Of-course 
> > > > > > > > > you have
> > > > > > > > > pointed the same before, please check below
> > > > > > > > > https://patchwork.kernel.org/project/dri-devel/patch/20210322140152.101709-2-ja...@amarulasolutions.com/
> > > > > > > >
> > > > > > > > Then drm_of_find_panel_or_bridge needs to be adjusted to handle 
> > > > > > > > the DSI
> > > > > > > > bindings and look for a panel or bridge not only through the OF 
> > > > > > > > graph,
> > > > > > > > but also on the child nodes
> > > > > > >
> > > > > > > Okay. I need to check this.
> > > > > >
> > > > > > devm_drm_of_get_bridge is not working with legacy binding like the 
> > > > > > one
> > > > > > used in sun6i dsi
> > > > >
> > > > > There's nothing legacy about it.
> > > >
> > > > What I'm mean legacy here with current binding used in sun6i-dsi like 
> > > > this.
> > > >
> > > >  {
> > > >   vcc-dsi-supply = <_dcdc1>; /* VCC-DSI */
> > > >   status = "okay";
> > > >
> > > >  panel@0 {
> > > >compatible = "bananapi,s070wv20-ct16-icn6211";
> > > >reg = <0>;
> > > >reset-gpios = <_pio 0 5 GPIO_ACTIVE_HIGH>; /*
> > > > LCD-RST: PL5 */
> > > >   enable-gpios = < 1 7 GPIO_ACTIVE_HIGH>; /*
> > > > LCD-PWR-EN: PB7 */
> > > >   backlight = <>;
> > > > };
> > > > };
> > >
> > > Yes, I know, it's the generic DSI binding. It's still not legacy.
> > >
> > > > devm_drm_of_get_bridge cannot find the device with above binding and
> > > > able to find the device with below binding.
> > > >
> > > >  {
> > > >vcc-dsi-supply = <_dcdc1>; /* VCC-DSI */
> > > >status = "okay";
> > > >
> > > >   ports {
> > > > #address-cells = <1>;
> > > > #size-cells = <0>;

[linux-sunxi] Re: [PATCH v5 3/7] drm: sun4i: dsi: Convert to bridge driver

2021-11-25 Thread Jagan Teki
On Mon, Nov 22, 2021 at 8:34 PM Maxime Ripard  wrote:
>
> On Mon, Nov 22, 2021 at 07:49:26PM +0530, Jagan Teki wrote:
> > On Mon, Nov 22, 2021 at 7:35 PM Maxime Ripard  wrote:
> > > On Mon, Nov 22, 2021 at 07:18:13PM +0530, Jagan Teki wrote:
> > > > On Mon, Nov 22, 2021 at 3:37 PM Maxime Ripard  wrote:
> > > > >
> > > > > On Mon, Nov 22, 2021 at 12:22:19PM +0530, Jagan Teki wrote:
> > > > > > Some display panels would come up with a non-DSI output, those
> > > > > > can have an option to connect the DSI host by means of interface
> > > > > > bridge converter.
> > > > > >
> > > > > > This DSI to non-DSI interface bridge converter would requires
> > > > > > DSI Host to handle drm bridge functionalities in order to DSI
> > > > > > Host to Interface bridge.
> > > > >
> > > > > In order to do this you would need to use the DRM bridge API...
> > > >
> > > > Sorry, which bridge API do you mean?
> > >
> > > Any variant of of_drm_find_bridge, and drm_bridge_attach. Just like
> > > we're doing in sun4i_rgb.c
> >
> > Yes, we have drm_bridge_attach in bind and bridge_function.attach
> > calls in this patch and of_drm_find_bridge in sun6i_mipi_dsi_attach.
> > Not sure which API's I've missed.
>
> None, that's my point, you don't need anything else in order to do what
> you wanted to achieve.

Correct, the order is some how confused in this patch. I will fix it
in next version.

>
> > >
> > > > > > This patch convert the existing to a drm bridge driver with a
> > > > > > built-in encoder support for compatibility with existing
> > > > > > component drivers.
> > > > >
> > > > > ... but changing the encoder driver to a bridge is completely
> > > > > unnecessary to do so. Why did you need to make that change?
> > > >
> > > > Idea of this series is to convert the driver to bridge and use the
> > > > latest bridge function from the v1 series.
> > >
> > > Ok, but it's not at all what you mention in your commit log? You don't
> > > need any of that in order to support a bridge downstream.
> >
> > I've mentioned "Converting to bridge driver" and thought it has
> > meaning of converting encoder related function to bridge functions as
> > well. Not think about specific description to describe on commit
> > message. Will update this.
>
> But you provided no reason to do so. The only one you did mention was
> that you wanted to support downstream bridges, but you don't need to
> convert the DSI driver to a bridge in order to do that.

Okay. Look like I've combined both downstream bridge support and
converting bridge together. This what it totally confused, I will fix
it.

>
> > > > > > Signed-off-by: Jagan Teki 
> > > > > >
> > > > > > ---
> > > > > > Changes for v5:
> > > > > > - add atomic APIs
> > > > > > - find host and device variant DSI devices.
> > > > > > Changes for v4, v3:
> > > > > > - none
> > > > > >
> > > > > >  drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 112 
> > > > > > -
> > > > > >  drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h |   7 ++
> > > > > >  2 files changed, 96 insertions(+), 23 deletions(-)
> > > > > >
> > > > > > diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c 
> > > > > > b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> > > > > > index 43d9c9e5198d..a6a272b55f77 100644
> > > > > > --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> > > > > > +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> > > > > > @@ -21,6 +21,7 @@
> > > > > >
> > > > > >  #include 
> > > > > >  #include 
> > > > > > +#include 
> > > > > >  #include 
> > > > > >  #include 
> > > > > >  #include 
> > > > > > @@ -713,10 +714,11 @@ static int sun6i_dsi_start(struct sun6i_dsi 
> > > > > > *dsi,
> > > > > >   return 0;
> > > > > >  }
> > > > > >
> > > > > > -static void sun6i_dsi_encoder_enable(struct drm_encoder *encoder)
> > > > > > +static void sun6i_dsi_bridge_atomic_enable(struct drm_bridge 
&

[linux-sunxi] Re: [PATCH v5 3/7] drm: sun4i: dsi: Convert to bridge driver

2021-11-25 Thread Jagan Teki
On Thu, Nov 25, 2021 at 9:40 PM Maxime Ripard  wrote:
>
> On Thu, Nov 25, 2021 at 07:55:41PM +0530, Jagan Teki wrote:
> > Hi,
> >
> > On Thu, Nov 25, 2021 at 7:45 PM Maxime Ripard  wrote:
> > >
> > > On Wed, Nov 24, 2021 at 12:02:47AM +0530, Jagan Teki wrote:
> > > > > > > > > + dsi->panel = of_drm_find_panel(remote);
> > > > > > > > > + if (IS_ERR(dsi->panel)) {
> > > > > > > > > + dsi->panel = NULL;
> > > > > > > > > +
> > > > > > > > > + dsi->next_bridge = of_drm_find_bridge(remote);
> > > > > > > > > + if (IS_ERR(dsi->next_bridge)) {
> > > > > > > > > + dev_err(dsi->dev, "failed to find 
> > > > > > > > > bridge\n");
> > > > > > > > > + return PTR_ERR(dsi->next_bridge);
> > > > > > > > > + }
> > > > > > > > > + } else {
> > > > > > > > > + dsi->next_bridge = NULL;
> > > > > > > > > + }
> > > > > > > > > +
> > > > > > > > > + of_node_put(remote);
> > > > > > > >
> > > > > > > > Using devm_drm_of_get_bridge would greatly simplify the driver
> > > > > > >
> > > > > > > I'm aware of this and this would break the existing sunxi dsi 
> > > > > > > binding,
> > > > > > > we are not using ports based pipeline in dsi node. Of-course you 
> > > > > > > have
> > > > > > > pointed the same before, please check below
> > > > > > > https://patchwork.kernel.org/project/dri-devel/patch/20210322140152.101709-2-ja...@amarulasolutions.com/
> > > > > >
> > > > > > Then drm_of_find_panel_or_bridge needs to be adjusted to handle the 
> > > > > > DSI
> > > > > > bindings and look for a panel or bridge not only through the OF 
> > > > > > graph,
> > > > > > but also on the child nodes
> > > > >
> > > > > Okay. I need to check this.
> > > >
> > > > devm_drm_of_get_bridge is not working with legacy binding like the one
> > > > used in sun6i dsi
> > >
> > > There's nothing legacy about it.
> >
> > What I'm mean legacy here with current binding used in sun6i-dsi like this.
> >
> >  {
> >   vcc-dsi-supply = <_dcdc1>; /* VCC-DSI */
> >   status = "okay";
> >
> >  panel@0 {
> >compatible = "bananapi,s070wv20-ct16-icn6211";
> >reg = <0>;
> >reset-gpios = <_pio 0 5 GPIO_ACTIVE_HIGH>; /*
> > LCD-RST: PL5 */
> >   enable-gpios = < 1 7 GPIO_ACTIVE_HIGH>; /*
> > LCD-PWR-EN: PB7 */
> >   backlight = <>;
> > };
> > };
>
> Yes, I know, it's the generic DSI binding. It's still not legacy.
>
> > devm_drm_of_get_bridge cannot find the device with above binding and
> > able to find the device with below binding.
> >
> >  {
> >vcc-dsi-supply = <_dcdc1>; /* VCC-DSI */
> >status = "okay";
> >
> >   ports {
> > #address-cells = <1>;
> > #size-cells = <0>;
> >
> >dsi_out: port@0 {
> >reg = <0>;
> >
> >   dsi_out_bridge: endpoint {
> > remote-endpoint = <_out_dsi>;
> >   };
> >};
> >   };
> >
> >   panel@0 {
> >  compatible = "bananapi,s070wv20-ct16-icn6211";
> >  reg = <0>;
> >  reset-gpios = <_pio 0 5 GPIO_ACTIVE_HIGH>; /* LCD-RST: PL5 */
> >  enable-gpios = < 1 7 GPIO_ACTIVE_HIGH>; /* LCD-PWR-EN: PB7 
> > */
> >  backlight = <>;
> >
> >   port {
> > bridge_out_dsi: endpoint {
> > remote-endpoint = <_out_bridge>;
> > };
> > };
> >};
> > };
>
> Yes, I know, and that's beca

[linux-sunxi] Re: [PATCH v5 3/7] drm: sun4i: dsi: Convert to bridge driver

2021-11-25 Thread Jagan Teki
Hi,

On Thu, Nov 25, 2021 at 7:45 PM Maxime Ripard  wrote:
>
> On Wed, Nov 24, 2021 at 12:02:47AM +0530, Jagan Teki wrote:
> > > > > > > + dsi->panel = of_drm_find_panel(remote);
> > > > > > > + if (IS_ERR(dsi->panel)) {
> > > > > > > + dsi->panel = NULL;
> > > > > > > +
> > > > > > > + dsi->next_bridge = of_drm_find_bridge(remote);
> > > > > > > + if (IS_ERR(dsi->next_bridge)) {
> > > > > > > + dev_err(dsi->dev, "failed to find 
> > > > > > > bridge\n");
> > > > > > > + return PTR_ERR(dsi->next_bridge);
> > > > > > > + }
> > > > > > > + } else {
> > > > > > > + dsi->next_bridge = NULL;
> > > > > > > + }
> > > > > > > +
> > > > > > > + of_node_put(remote);
> > > > > >
> > > > > > Using devm_drm_of_get_bridge would greatly simplify the driver
> > > > >
> > > > > I'm aware of this and this would break the existing sunxi dsi binding,
> > > > > we are not using ports based pipeline in dsi node. Of-course you have
> > > > > pointed the same before, please check below
> > > > > https://patchwork.kernel.org/project/dri-devel/patch/20210322140152.101709-2-ja...@amarulasolutions.com/
> > > >
> > > > Then drm_of_find_panel_or_bridge needs to be adjusted to handle the DSI
> > > > bindings and look for a panel or bridge not only through the OF graph,
> > > > but also on the child nodes
> > >
> > > Okay. I need to check this.
> >
> > devm_drm_of_get_bridge is not working with legacy binding like the one
> > used in sun6i dsi
>
> There's nothing legacy about it.

What I'm mean legacy here with current binding used in sun6i-dsi like this.

 {
  vcc-dsi-supply = <_dcdc1>; /* VCC-DSI */
  status = "okay";

 panel@0 {
   compatible = "bananapi,s070wv20-ct16-icn6211";
   reg = <0>;
   reset-gpios = <_pio 0 5 GPIO_ACTIVE_HIGH>; /*
LCD-RST: PL5 */
  enable-gpios = < 1 7 GPIO_ACTIVE_HIGH>; /*
LCD-PWR-EN: PB7 */
  backlight = <>;
};
};

devm_drm_of_get_bridge cannot find the device with above binding and
able to find the device with below binding.

 {
   vcc-dsi-supply = <_dcdc1>; /* VCC-DSI */
   status = "okay";

  ports {
#address-cells = <1>;
#size-cells = <0>;

   dsi_out: port@0 {
   reg = <0>;

  dsi_out_bridge: endpoint {
remote-endpoint = <_out_dsi>;
  };
   };
  };

  panel@0 {
 compatible = "bananapi,s070wv20-ct16-icn6211";
 reg = <0>;
 reset-gpios = <_pio 0 5 GPIO_ACTIVE_HIGH>; /* LCD-RST: PL5 */
 enable-gpios = < 1 7 GPIO_ACTIVE_HIGH>; /* LCD-PWR-EN: PB7 */
 backlight = <>;

  port {
bridge_out_dsi: endpoint {
remote-endpoint = <_out_bridge>;
};
};
   };
};

>
> > https://patchwork.kernel.org/project/dri-devel/patch/20211122065223.88059-6-ja...@amarulasolutions.com/
> >
> > dsi->next_bridge = devm_drm_of_get_bridge(dsi->dev, dsi->dev->of_node, 0, 
> > 0);
> > if (IS_ERR(dsi->next_bridge))
> >return PTR_ERR(dsi->next_bridge);
> >
> > It is only working if we have ports on the pipeline, something like this
> > https://patchwork.kernel.org/project/dri-devel/patch/20210214194102.126146-8-ja...@amarulasolutions.com/
> >
> > Please have a look and let me know if I miss anything?
>
> Yes, you're missing the answer you quoted earlier:

Yes, I'm trying to resolve the comment one after another. Will get back.

Thanks,
Jagan.

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CAMty3ZC0KOUxr2rComOCfC70wGS_aSXzjFGS4f%3DpEB6MQHRGFw%40mail.gmail.com.


[linux-sunxi] Re: [PATCH v5 3/7] drm: sun4i: dsi: Convert to bridge driver

2021-11-23 Thread Jagan Teki
Hi Maxime,

On Mon, Nov 22, 2021 at 7:49 PM Jagan Teki  wrote:
>
> Hi Maxime,
>
> On Mon, Nov 22, 2021 at 7:35 PM Maxime Ripard  wrote:
> >
> > On Mon, Nov 22, 2021 at 07:18:13PM +0530, Jagan Teki wrote:
> > > Hi Maxime,
> > >
> > > On Mon, Nov 22, 2021 at 3:37 PM Maxime Ripard  wrote:
> > > >
> > > > On Mon, Nov 22, 2021 at 12:22:19PM +0530, Jagan Teki wrote:
> > > > > Some display panels would come up with a non-DSI output, those
> > > > > can have an option to connect the DSI host by means of interface
> > > > > bridge converter.
> > > > >
> > > > > This DSI to non-DSI interface bridge converter would requires
> > > > > DSI Host to handle drm bridge functionalities in order to DSI
> > > > > Host to Interface bridge.
> > > >
> > > > In order to do this you would need to use the DRM bridge API...
> > >
> > > Sorry, which bridge API do you mean?
> >
> > Any variant of of_drm_find_bridge, and drm_bridge_attach. Just like
> > we're doing in sun4i_rgb.c
>
> Yes, we have drm_bridge_attach in bind and bridge_function.attach
> calls in this patch and of_drm_find_bridge in sun6i_mipi_dsi_attach.
> Not sure which API's I've missed.
>
> >
> > > > > This patch convert the existing to a drm bridge driver with a
> > > > > built-in encoder support for compatibility with existing
> > > > > component drivers.
> > > >
> > > > ... but changing the encoder driver to a bridge is completely
> > > > unnecessary to do so. Why did you need to make that change?
> > >
> > > Idea of this series is to convert the driver to bridge and use the
> > > latest bridge function from the v1 series.
> >
> > Ok, but it's not at all what you mention in your commit log? You don't
> > need any of that in order to support a bridge downstream.
>
> I've mentioned "Converting to bridge driver" and thought it has
> meaning of converting encoder related function to bridge functions as
> well. Not think about specific description to describe on commit
> message. Will update this.
>
> >
> > > >
> > > > > Signed-off-by: Jagan Teki 
> > > > >
> > > > > ---
> > > > > Changes for v5:
> > > > > - add atomic APIs
> > > > > - find host and device variant DSI devices.
> > > > > Changes for v4, v3:
> > > > > - none
> > > > >
> > > > >  drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 112 
> > > > > -
> > > > >  drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h |   7 ++
> > > > >  2 files changed, 96 insertions(+), 23 deletions(-)
> > > > >
> > > > > diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c 
> > > > > b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> > > > > index 43d9c9e5198d..a6a272b55f77 100644
> > > > > --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> > > > > +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> > > > > @@ -21,6 +21,7 @@
> > > > >
> > > > >  #include 
> > > > >  #include 
> > > > > +#include 
> > > > >  #include 
> > > > >  #include 
> > > > >  #include 
> > > > > @@ -713,10 +714,11 @@ static int sun6i_dsi_start(struct sun6i_dsi 
> > > > > *dsi,
> > > > >   return 0;
> > > > >  }
> > > > >
> > > > > -static void sun6i_dsi_encoder_enable(struct drm_encoder *encoder)
> > > > > +static void sun6i_dsi_bridge_atomic_enable(struct drm_bridge *bridge,
> > > > > +struct drm_bridge_state 
> > > > > *old_bridge_state)
> > > > >  {
> > > > > - struct drm_display_mode *mode = 
> > > > > >crtc->state->adjusted_mode;
> > > > > - struct sun6i_dsi *dsi = encoder_to_sun6i_dsi(encoder);
> > > > > + struct sun6i_dsi *dsi = bridge_to_sun6i_dsi(bridge);
> > > > > + struct drm_display_mode *mode = 
> > > > > >encoder->crtc->state->adjusted_mode;
> > > > >   struct mipi_dsi_device *device = dsi->device;
> > > > >   union phy_configure_opts opts = { };
> > > > >   struct phy_configure_opts_mipi_dphy *cfg = _dphy;
> > > > > @@ -772,6 +774,9 @@ static voi

[linux-sunxi] Re: [PATCH v5 4/7] drm: sun4i: dsi: Add mode_set function

2021-11-22 Thread Jagan Teki
On Mon, Nov 22, 2021 at 8:36 PM Maxime Ripard  wrote:
>
> On Mon, Nov 22, 2021 at 08:01:47PM +0530, Jagan Teki wrote:
> > On Mon, Nov 22, 2021 at 7:39 PM Maxime Ripard  wrote:
> > >
> > > On Mon, Nov 22, 2021 at 07:21:57PM +0530, Jagan Teki wrote:
> > > > > It's perfectly valid to dereference the pointer in atomic_enable, and
> > > > > that patch would consume memory for no particular reason.
> > > >
> > > > Again, I'm not pointing any mistake in dereference and certainly not
> > > > understand about what memory consumption issue here.
> > >
> > > You add a struct drm_display_mode field to struct sun6i_dsi. It
> > > increases the size of struct sun6i_dsi of sizeof(struct
> > > drm_display_mode).
> > >
> > > > I'm doing it here since I'm doing it via mode_set in other drivers. No
> > > > problem for me either way.
> > >
> > > But *why* are you doing so?
> > >
> > > There might be a valid reason in other drivers, but there's none here
> > > (that you mentioned at least).
> >
> > The reason is to use existing bridge function instead of dereference
> > ie what I've mentioned. I don't have any other reasons.
>
> This discussion is going in circles. Unless you have a reason other than
> "because we can", NAK for the reasons already stated above.

Agreed your point.

Thanks,
Jagan.

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CAMty3ZAm1%2BUyFXGpO0vuJyGbE-P58EErA%2BBgWYXWzu2b9vVr7A%40mail.gmail.com.


[linux-sunxi] Re: [PATCH v5 4/7] drm: sun4i: dsi: Add mode_set function

2021-11-22 Thread Jagan Teki
On Mon, Nov 22, 2021 at 7:39 PM Maxime Ripard  wrote:
>
> On Mon, Nov 22, 2021 at 07:21:57PM +0530, Jagan Teki wrote:
> > > It's perfectly valid to dereference the pointer in atomic_enable, and
> > > that patch would consume memory for no particular reason.
> >
> > Again, I'm not pointing any mistake in dereference and certainly not
> > understand about what memory consumption issue here.
>
> You add a struct drm_display_mode field to struct sun6i_dsi. It
> increases the size of struct sun6i_dsi of sizeof(struct
> drm_display_mode).
>
> > I'm doing it here since I'm doing it via mode_set in other drivers. No
> > problem for me either way.
>
> But *why* are you doing so?
>
> There might be a valid reason in other drivers, but there's none here
> (that you mentioned at least).

The reason is to use existing bridge function instead of dereference
ie what I've mentioned. I don't have any other reasons.

Jagan.

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CAMty3ZBOYRJ5ScrYEKoA9e1hP9%3DyuKuASvXyorB_kLsp26Fe3A%40mail.gmail.com.


[linux-sunxi] Re: [PATCH v5 3/7] drm: sun4i: dsi: Convert to bridge driver

2021-11-22 Thread Jagan Teki
Hi Maxime,

On Mon, Nov 22, 2021 at 7:35 PM Maxime Ripard  wrote:
>
> On Mon, Nov 22, 2021 at 07:18:13PM +0530, Jagan Teki wrote:
> > Hi Maxime,
> >
> > On Mon, Nov 22, 2021 at 3:37 PM Maxime Ripard  wrote:
> > >
> > > On Mon, Nov 22, 2021 at 12:22:19PM +0530, Jagan Teki wrote:
> > > > Some display panels would come up with a non-DSI output, those
> > > > can have an option to connect the DSI host by means of interface
> > > > bridge converter.
> > > >
> > > > This DSI to non-DSI interface bridge converter would requires
> > > > DSI Host to handle drm bridge functionalities in order to DSI
> > > > Host to Interface bridge.
> > >
> > > In order to do this you would need to use the DRM bridge API...
> >
> > Sorry, which bridge API do you mean?
>
> Any variant of of_drm_find_bridge, and drm_bridge_attach. Just like
> we're doing in sun4i_rgb.c

Yes, we have drm_bridge_attach in bind and bridge_function.attach
calls in this patch and of_drm_find_bridge in sun6i_mipi_dsi_attach.
Not sure which API's I've missed.

>
> > > > This patch convert the existing to a drm bridge driver with a
> > > > built-in encoder support for compatibility with existing
> > > > component drivers.
> > >
> > > ... but changing the encoder driver to a bridge is completely
> > > unnecessary to do so. Why did you need to make that change?
> >
> > Idea of this series is to convert the driver to bridge and use the
> > latest bridge function from the v1 series.
>
> Ok, but it's not at all what you mention in your commit log? You don't
> need any of that in order to support a bridge downstream.

I've mentioned "Converting to bridge driver" and thought it has
meaning of converting encoder related function to bridge functions as
well. Not think about specific description to describe on commit
message. Will update this.

>
> > >
> > > > Signed-off-by: Jagan Teki 
> > > >
> > > > ---
> > > > Changes for v5:
> > > > - add atomic APIs
> > > > - find host and device variant DSI devices.
> > > > Changes for v4, v3:
> > > > - none
> > > >
> > > >  drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 112 -
> > > >  drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h |   7 ++
> > > >  2 files changed, 96 insertions(+), 23 deletions(-)
> > > >
> > > > diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c 
> > > > b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> > > > index 43d9c9e5198d..a6a272b55f77 100644
> > > > --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> > > > +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> > > > @@ -21,6 +21,7 @@
> > > >
> > > >  #include 
> > > >  #include 
> > > > +#include 
> > > >  #include 
> > > >  #include 
> > > >  #include 
> > > > @@ -713,10 +714,11 @@ static int sun6i_dsi_start(struct sun6i_dsi *dsi,
> > > >   return 0;
> > > >  }
> > > >
> > > > -static void sun6i_dsi_encoder_enable(struct drm_encoder *encoder)
> > > > +static void sun6i_dsi_bridge_atomic_enable(struct drm_bridge *bridge,
> > > > +struct drm_bridge_state 
> > > > *old_bridge_state)
> > > >  {
> > > > - struct drm_display_mode *mode = 
> > > > >crtc->state->adjusted_mode;
> > > > - struct sun6i_dsi *dsi = encoder_to_sun6i_dsi(encoder);
> > > > + struct sun6i_dsi *dsi = bridge_to_sun6i_dsi(bridge);
> > > > + struct drm_display_mode *mode = 
> > > > >encoder->crtc->state->adjusted_mode;
> > > >   struct mipi_dsi_device *device = dsi->device;
> > > >   union phy_configure_opts opts = { };
> > > >   struct phy_configure_opts_mipi_dphy *cfg = _dphy;
> > > > @@ -772,6 +774,9 @@ static void sun6i_dsi_encoder_enable(struct 
> > > > drm_encoder *encoder)
> > > >   if (dsi->panel)
> > > >   drm_panel_prepare(dsi->panel);
> > > >
> > > > + if (dsi->next_bridge)
> > > > + 
> > > > dsi->next_bridge->funcs->atomic_pre_enable(dsi->next_bridge, 
> > > > old_bridge_state);
> > > > +
> > >
> > > Please use the proper helpers.
> >
> > If we use bridge_functions we need to take atomic functi

[linux-sunxi] Re: [PATCH v5 4/7] drm: sun4i: dsi: Add mode_set function

2021-11-22 Thread Jagan Teki
Hi Maxime,

On Mon, Nov 22, 2021 at 6:58 PM Maxime Ripard  wrote:
>
> On Mon, Nov 22, 2021 at 06:35:58PM +0530, Jagan Teki wrote:
> > On Mon, Nov 22, 2021 at 3:38 PM Maxime Ripard  wrote:
> > >
> > > On Mon, Nov 22, 2021 at 12:22:20PM +0530, Jagan Teki wrote:
> > > > Get the display mode settings via mode_set bridge function
> > > > instead of explicitly de-reference.
> > >
> > > What's wrong with dereferencing the mode?
> >
> > Nothing wrong with dereferencing, however we have built-in API to that job.
>
> That's not an API though?

May be we can call it bridge or encoding function, I usually call
these ops are API's.

>
> It's perfectly valid to dereference the pointer in atomic_enable, and
> that patch would consume memory for no particular reason.

Again, I'm not pointing any mistake in dereference and certainly not
understand about what memory consumption issue here. I'm doing it here
since I'm doing it via mode_set in other drivers. No problem for me
either way.

Thanks,
Jagan.

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CAMty3ZAzwKtABZqJhVDmgOVpnZFg66z6Bc_pn3Fm9%3D658RPG1g%40mail.gmail.com.


[linux-sunxi] Re: [PATCH v5 3/7] drm: sun4i: dsi: Convert to bridge driver

2021-11-22 Thread Jagan Teki
Hi Maxime,

On Mon, Nov 22, 2021 at 3:37 PM Maxime Ripard  wrote:
>
> On Mon, Nov 22, 2021 at 12:22:19PM +0530, Jagan Teki wrote:
> > Some display panels would come up with a non-DSI output, those
> > can have an option to connect the DSI host by means of interface
> > bridge converter.
> >
> > This DSI to non-DSI interface bridge converter would requires
> > DSI Host to handle drm bridge functionalities in order to DSI
> > Host to Interface bridge.
>
> In order to do this you would need to use the DRM bridge API...

Sorry, which bridge API do you mean?

>
> > This patch convert the existing to a drm bridge driver with a
> > built-in encoder support for compatibility with existing
> > component drivers.
>
> ... but changing the encoder driver to a bridge is completely
> unnecessary to do so. Why did you need to make that change?

Idea of this series is to convert the driver to bridge and use the
latest bridge function from the v1 series.

>
> > Signed-off-by: Jagan Teki 
> >
> > ---
> > Changes for v5:
> > - add atomic APIs
> > - find host and device variant DSI devices.
> > Changes for v4, v3:
> > - none
> >
> >  drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 112 -
> >  drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h |   7 ++
> >  2 files changed, 96 insertions(+), 23 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c 
> > b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> > index 43d9c9e5198d..a6a272b55f77 100644
> > --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> > +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> > @@ -21,6 +21,7 @@
> >
> >  #include 
> >  #include 
> > +#include 
> >  #include 
> >  #include 
> >  #include 
> > @@ -713,10 +714,11 @@ static int sun6i_dsi_start(struct sun6i_dsi *dsi,
> >   return 0;
> >  }
> >
> > -static void sun6i_dsi_encoder_enable(struct drm_encoder *encoder)
> > +static void sun6i_dsi_bridge_atomic_enable(struct drm_bridge *bridge,
> > +struct drm_bridge_state 
> > *old_bridge_state)
> >  {
> > - struct drm_display_mode *mode = >crtc->state->adjusted_mode;
> > - struct sun6i_dsi *dsi = encoder_to_sun6i_dsi(encoder);
> > + struct sun6i_dsi *dsi = bridge_to_sun6i_dsi(bridge);
> > + struct drm_display_mode *mode = 
> > >encoder->crtc->state->adjusted_mode;
> >   struct mipi_dsi_device *device = dsi->device;
> >   union phy_configure_opts opts = { };
> >   struct phy_configure_opts_mipi_dphy *cfg = _dphy;
> > @@ -772,6 +774,9 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder 
> > *encoder)
> >   if (dsi->panel)
> >   drm_panel_prepare(dsi->panel);
> >
> > + if (dsi->next_bridge)
> > + dsi->next_bridge->funcs->atomic_pre_enable(dsi->next_bridge, 
> > old_bridge_state);
> > +
>
> Please use the proper helpers.

If we use bridge_functions we need to take atomic functions as
precedence as the next bridge functions might convert atomic calls.

>
> >   /*
> >* FIXME: This should be moved after the switch to HS mode.
> >*
> > @@ -787,6 +792,9 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder 
> > *encoder)
> >   if (dsi->panel)
> >   drm_panel_enable(dsi->panel);
> >
> > + if (dsi->next_bridge)
> > + dsi->next_bridge->funcs->atomic_enable(dsi->next_bridge, 
> > old_bridge_state);
> > +
>
> Ditto
>
> >   sun6i_dsi_start(dsi, DSI_START_HSC);
> >
> >   udelay(1000);
> > @@ -794,15 +802,19 @@ static void sun6i_dsi_encoder_enable(struct 
> > drm_encoder *encoder)
> >   sun6i_dsi_start(dsi, DSI_START_HSD);
> >  }
> >
> > -static void sun6i_dsi_encoder_disable(struct drm_encoder *encoder)
> > +static void sun6i_dsi_bridge_atomic_disable(struct drm_bridge *bridge,
> > + struct drm_bridge_state 
> > *old_bridge_state)
> >  {
> > - struct sun6i_dsi *dsi = encoder_to_sun6i_dsi(encoder);
> > + struct sun6i_dsi *dsi = bridge_to_sun6i_dsi(bridge);
> >
> >   DRM_DEBUG_DRIVER("Disabling DSI output\n");
> >
> >   if (dsi->panel) {
> >   drm_panel_disable(dsi->panel);
> >   drm_panel_unprepare(dsi->panel);
> > + } else if (dsi->next_bridge) {
> > + dsi->next_bridge->funcs-

[linux-sunxi] Re: [PATCH v5 3/7] drm: sun4i: dsi: Convert to bridge driver

2021-11-22 Thread Jagan Teki
Hi Neil,

On Mon, Nov 22, 2021 at 6:22 PM Neil Armstrong  wrote:
>
> On 22/11/2021 07:52, Jagan Teki wrote:
> > Some display panels would come up with a non-DSI output, those
> > can have an option to connect the DSI host by means of interface
> > bridge converter.
> >
> > This DSI to non-DSI interface bridge converter would requires
> > DSI Host to handle drm bridge functionalities in order to DSI
> > Host to Interface bridge.
> >
> > This patch convert the existing to a drm bridge driver with a
> > built-in encoder support for compatibility with existing
> > component drivers.
> >
> > Signed-off-by: Jagan Teki 
> > ---
> > Changes for v5:
> > - add atomic APIs
> > - find host and device variant DSI devices.
> > Changes for v4, v3:
> > - none
> >
> >  drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 112 -
> >  drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h |   7 ++
> >  2 files changed, 96 insertions(+), 23 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c 
> > b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> > index 43d9c9e5198d..a6a272b55f77 100644
> > --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> > +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> > @@ -21,6 +21,7 @@
> >
> >  #include 
> >  #include 
> > +#include 
> >  #include 
> >  #include 
> >  #include 
> > @@ -713,10 +714,11 @@ static int sun6i_dsi_start(struct sun6i_dsi *dsi,
> >   return 0;
> >  }
> >
> > -static void sun6i_dsi_encoder_enable(struct drm_encoder *encoder)
> > +static void sun6i_dsi_bridge_atomic_enable(struct drm_bridge *bridge,
> > +struct drm_bridge_state 
> > *old_bridge_state)
> >  {
> > - struct drm_display_mode *mode = >crtc->state->adjusted_mode;
> > - struct sun6i_dsi *dsi = encoder_to_sun6i_dsi(encoder);
> > + struct sun6i_dsi *dsi = bridge_to_sun6i_dsi(bridge);
> > + struct drm_display_mode *mode = 
> > >encoder->crtc->state->adjusted_mode;
> >   struct mipi_dsi_device *device = dsi->device;
> >   union phy_configure_opts opts = { };
> >   struct phy_configure_opts_mipi_dphy *cfg = _dphy;
> > @@ -772,6 +774,9 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder 
> > *encoder)
> >   if (dsi->panel)
> >   drm_panel_prepare(dsi->panel);
> >
> > + if (dsi->next_bridge)
> > + dsi->next_bridge->funcs->atomic_pre_enable(dsi->next_bridge, 
> > old_bridge_state);
> > +
> >   /*
> >* FIXME: This should be moved after the switch to HS mode.
> >*
> > @@ -787,6 +792,9 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder 
> > *encoder)
> >   if (dsi->panel)
> >   drm_panel_enable(dsi->panel);
> >
> > + if (dsi->next_bridge)
> > + dsi->next_bridge->funcs->atomic_enable(dsi->next_bridge, 
> > old_bridge_state);
> > +
>
>
> No need to call the next bridge atomic pre_enable/enable/disable/post_disable 
> since they will
> be called automatically on the bridge chain.

Correct, but the existing bridge chain (stack) is not compatible with
sun6i DSI start sequence. We cannot send any DCS once we start HS
mode.
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c#n775

This specific problem can be fixed only if we change the bridge chain
from stack to queue. Please check this series
https://patchwork.kernel.org/project/dri-devel/patch/20210214194102.126146-6-ja...@amarulasolutions.com/

Jagan.

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CAMty3ZDATTKoJq7aLOe5i%3DRPo2UHzqnLs8j8sT-EBNdpC7%3D3DQ%40mail.gmail.com.


[linux-sunxi] Re: [PATCH v5 4/7] drm: sun4i: dsi: Add mode_set function

2021-11-22 Thread Jagan Teki
On Mon, Nov 22, 2021 at 3:38 PM Maxime Ripard  wrote:
>
> On Mon, Nov 22, 2021 at 12:22:20PM +0530, Jagan Teki wrote:
> > Get the display mode settings via mode_set bridge function
> > instead of explicitly de-reference.
>
> What's wrong with dereferencing the mode?

Nothing wrong with dereferencing, however we have built-in API to that job.

Jagan.

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CAMty3ZDDQR-OkjqEfb1ZYZG%2BoLN2ZOv-2GLxs3AdeDHqUD8fjQ%40mail.gmail.com.


[linux-sunxi] [DO NOT MERGE] [PATCH v5 7/7] ARM: dts: sun8i: Enable DLPC3433 Bridge (I2C)

2021-11-21 Thread Jagan Teki
Signed-off-by: Jagan Teki 
---
 arch/arm/boot/dts/sun8i-r16-renew-vista-e.dts | 79 +--
 1 file changed, 73 insertions(+), 6 deletions(-)

diff --git a/arch/arm/boot/dts/sun8i-r16-renew-vista-e.dts 
b/arch/arm/boot/dts/sun8i-r16-renew-vista-e.dts
index d28b7b35a3c5..c3ee6a879ddb 100644
@@ -108,6 +102,17 @@ sel-lvds-mux {
};
};
 
+   panel {
+   compatible = "ti,dlpa3000a-720p";
+   /* backlight not required */
+
+   port {
+   panel_out_bridge: endpoint {
+   remote-endpoint = <_out_panel>;
+   };
+   };
+   };
+
reg_vcc5v0: vcc5v0 {
compatible = "regulator-fixed";
regulator-name = "vcc5v0";
@@ -147,6 +152,32 @@  {
status = "okay";
 };
 
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   vcc-dsi-supply = <_dcdc1>;  /* VCC-DSI */
+   status = "okay";
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port@0 {
+   reg = <0>;
+
+   dsi_out_bridge: endpoint {
+   remote-endpoint = <_out_dsi>;
+   };
+   };
+   };
+};
+
  {
status = "okay";
 };
@@ -154,6 +185,38 @@  {
  {
clock-frequency = <10>;
status = "okay";
+
+   bridge@1d {
+   compatible = "ti,dlpc3433";
+   reg = <0x1d>;
+   enable-gpios = < 4 15 GPIO_ACTIVE_HIGH>;
+   vcc-supply = <_dldo1>;
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   bridge_in: port@0 {
+   reg = <0>;
+
+   bridge_out_dsi: endpoint {
+   remote-endpoint = <_out_bridge>;
+   data-lanes = <0 1 2 3>;
+   };
+   };
+
+   bridge_out: port@1 {
+   reg = <1>;
+
+   bridge_out_panel: endpoint {
+   remote-endpoint = <_out_bridge>;
+   };
+   };
+   };
+   };
 };
 
  {
@@ -321,6 +384,10 @@  {
"Right DAC", "AIF1 Slot 0 Right";
 };
 
+ {
+   status = "okay";
+};
+
  {
pinctrl-names = "default";
pinctrl-0 = <_pb_pins>;
-- 
2.25.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20211122065223.88059-8-jagan%40amarulasolutions.com.


[linux-sunxi] [DO NOT MERGE] [PATCH v5 6/7] ARM: dts: sun8i: bananapi-m2m: Enable ICN6211 DSI Bridge

2021-11-21 Thread Jagan Teki
Bananapi S070WV20-CT16 is a pure RGB output panel with ICN6211
DSI/RGB convertor bridge.

Enable bridge along with associated panel.

Signed-off-by: Jagan Teki 
---
 arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts | 63 
 1 file changed, 63 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts 
b/arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts
index bf5b5e2f6168..da6c1f2a0c74 100644
--- a/arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts
+++ b/arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts
@@ -44,6 +44,7 @@
 #include "sun8i-a33.dtsi"
 
 #include 
+#include 
 
 / {
model = "BananaPi M2 Magic";
@@ -61,6 +62,14 @@ chosen {
stdout-path = "serial0:115200n8";
};
 
+   backlight: backlight {
+   compatible = "pwm-backlight";
+   pwms = < 0 5 PWM_POLARITY_INVERTED>;
+   brightness-levels = <1 2 4 8 16 32 64 128 255>;
+   default-brightness-level = <8>;
+   enable-gpios = <_pio 0 4 GPIO_ACTIVE_HIGH>; /* LCD-BL-EN: PL4 
*/
+   };
+
leds {
compatible = "gpio-leds";
 
@@ -81,6 +90,18 @@ led-2 {
};
};
 
+   panel {
+   compatible = "bananapi,s070wv20-ct16";
+   enable-gpios = < 1 7 GPIO_ACTIVE_HIGH>; /* LCD-PWR-EN: PB7 
*/
+   backlight = <>;
+
+   port {
+   panel_out_bridge: endpoint {
+   remote-endpoint = <_out_panel>;
+   };
+   };
+   };
+
reg_vcc5v0: vcc5v0 {
compatible = "regulator-fixed";
regulator-name = "vcc5v0";
@@ -122,6 +143,38 @@  {
status = "okay";
 };
 
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   vcc-dsi-supply = <_dcdc1>;  /* VCC-DSI */
+   status = "okay";
+
+   bridge@0 {
+   compatible = "chipone,icn6211";
+   reg = <0>;
+   enable-gpios = <_pio 0 5 GPIO_ACTIVE_HIGH>; /* LCD-RST: PL5 */
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   bridge_out: port@1 {
+   reg = <1>;
+
+   bridge_out_panel: endpoint {
+   remote-endpoint = <_out_bridge>;
+   };
+   };
+   };
+   };
+};
+
  {
status = "okay";
 };
@@ -157,6 +210,12 @@  {
status = "okay";
 };
 
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pin>;
+   status = "okay";
+};
+
 _rsb {
status = "okay";
 
@@ -269,6 +328,10 @@  {
status = "okay";
 };
 
+ {
+   status = "okay";
+};
+
  {
pinctrl-names = "default";
pinctrl-0 = <_pb_pins>;
-- 
2.25.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20211122065223.88059-7-jagan%40amarulasolutions.com.


[linux-sunxi] [DO NOT MERGE] [PATCH v5 5/7] ARM: dts: sun8i: bananapi-m2m: Enable S070WV20-CT16 Panel

2021-11-21 Thread Jagan Teki
This patch add support for Bananapi S070WV20-CT16 panel to
BPI-M2M board.

This specific DSI Bananapi S070WV20-CT16 panel driver is not
available in upstream, added for testing purpose.

Signed-off-by: Jagan Teki 
---
 arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts | 40 
 1 file changed, 40 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts 
b/arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts
index bf5b5e2f6168..b215c32996a3 100644
--- a/arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts
+++ b/arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts
@@ -44,6 +44,7 @@
 #include "sun8i-a33.dtsi"
 
 #include 
+#include 
 
 / {
model = "BananaPi M2 Magic";
@@ -61,6 +62,14 @@ chosen {
stdout-path = "serial0:115200n8";
};
 
+   backlight: backlight {
+   compatible = "pwm-backlight";
+   pwms = < 0 5 PWM_POLARITY_INVERTED>;
+   brightness-levels = <1 2 4 8 16 32 64 128 255>;
+   default-brightness-level = <8>;
+   enable-gpios = <_pio 0 4 GPIO_ACTIVE_HIGH>; /* LCD-BL-EN: PL4 
*/
+   };
+
leds {
compatible = "gpio-leds";
 
@@ -122,6 +131,27 @@  {
status = "okay";
 };
 
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   vcc-dsi-supply = <_dcdc1>;  /* VCC-DSI */
+   status = "okay";
+
+   panel@0 {
+   compatible = "bananapi,s070wv20-ct16-icn6211";
+   reg = <0>;
+   reset-gpios = <_pio 0 5 GPIO_ACTIVE_HIGH>; /* LCD-RST: PL5 */
+   enable-gpios = < 1 7 GPIO_ACTIVE_HIGH>; /* LCD-PWR-EN: PB7 
*/
+   backlight = <>;
+   };
+};
+
  {
status = "okay";
 };
@@ -157,6 +187,12 @@  {
status = "okay";
 };
 
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pin>;
+   status = "okay";
+};
+
 _rsb {
status = "okay";
 
@@ -269,6 +305,10 @@  {
status = "okay";
 };
 
+ {
+   status = "okay";
+};
+
  {
pinctrl-names = "default";
pinctrl-0 = <_pb_pins>;
-- 
2.25.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20211122065223.88059-6-jagan%40amarulasolutions.com.


[linux-sunxi] [PATCH v5 4/7] drm: sun4i: dsi: Add mode_set function

2021-11-21 Thread Jagan Teki
Get the display mode settings via mode_set bridge function
instead of explicitly de-reference.

Signed-off-by: Jagan Teki 
---
Changes for v5:
- new patch

 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 12 +++-
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h |  1 +
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c 
b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
index a6a272b55f77..731af31e2bde 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
@@ -718,7 +718,7 @@ static void sun6i_dsi_bridge_atomic_enable(struct 
drm_bridge *bridge,
   struct drm_bridge_state 
*old_bridge_state)
 {
struct sun6i_dsi *dsi = bridge_to_sun6i_dsi(bridge);
-   struct drm_display_mode *mode = 
>encoder->crtc->state->adjusted_mode;
+   struct drm_display_mode *mode = >mode;
struct mipi_dsi_device *device = dsi->device;
union phy_configure_opts opts = { };
struct phy_configure_opts_mipi_dphy *cfg = _dphy;
@@ -854,6 +854,15 @@ static const struct drm_connector_funcs 
sun6i_dsi_connector_funcs = {
.atomic_destroy_state   = drm_atomic_helper_connector_destroy_state,
 };
 
+static void sun6i_dsi_bridge_mode_set(struct drm_bridge *bridge,
+ const struct drm_display_mode *mode,
+ const struct drm_display_mode 
*adjusted_mode)
+{
+   struct sun6i_dsi *dsi = bridge_to_sun6i_dsi(bridge);
+
+   drm_mode_copy(>mode, adjusted_mode);
+}
+
 static int sun6i_dsi_bridge_attach(struct drm_bridge *bridge,
   enum drm_bridge_attach_flags flags)
 {
@@ -872,6 +881,7 @@ static const struct drm_bridge_funcs sun6i_dsi_bridge_funcs 
= {
.atomic_reset   = drm_atomic_helper_bridge_reset,
.atomic_enable  = sun6i_dsi_bridge_atomic_enable,
.atomic_disable = sun6i_dsi_bridge_atomic_disable,
+   .mode_set   = sun6i_dsi_bridge_mode_set,
.attach = sun6i_dsi_bridge_attach,
 };
 
diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h 
b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h
index d269304691c9..acdd586a4157 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h
@@ -20,6 +20,7 @@ struct sun6i_dsi {
struct drm_connectorconnector;
struct drm_encoder  encoder;
struct mipi_dsi_hosthost;
+   struct drm_display_mode mode;
 
struct clk  *bus_clk;
struct clk  *mod_clk;
-- 
2.25.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20211122065223.88059-5-jagan%40amarulasolutions.com.


[linux-sunxi] [PATCH v5 3/7] drm: sun4i: dsi: Convert to bridge driver

2021-11-21 Thread Jagan Teki
Some display panels would come up with a non-DSI output, those
can have an option to connect the DSI host by means of interface
bridge converter.

This DSI to non-DSI interface bridge converter would requires
DSI Host to handle drm bridge functionalities in order to DSI
Host to Interface bridge.

This patch convert the existing to a drm bridge driver with a
built-in encoder support for compatibility with existing
component drivers.

Signed-off-by: Jagan Teki 
---
Changes for v5:
- add atomic APIs
- find host and device variant DSI devices.
Changes for v4, v3:
- none

 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 112 -
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h |   7 ++
 2 files changed, 96 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c 
b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
index 43d9c9e5198d..a6a272b55f77 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
@@ -21,6 +21,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -713,10 +714,11 @@ static int sun6i_dsi_start(struct sun6i_dsi *dsi,
return 0;
 }
 
-static void sun6i_dsi_encoder_enable(struct drm_encoder *encoder)
+static void sun6i_dsi_bridge_atomic_enable(struct drm_bridge *bridge,
+  struct drm_bridge_state 
*old_bridge_state)
 {
-   struct drm_display_mode *mode = >crtc->state->adjusted_mode;
-   struct sun6i_dsi *dsi = encoder_to_sun6i_dsi(encoder);
+   struct sun6i_dsi *dsi = bridge_to_sun6i_dsi(bridge);
+   struct drm_display_mode *mode = 
>encoder->crtc->state->adjusted_mode;
struct mipi_dsi_device *device = dsi->device;
union phy_configure_opts opts = { };
struct phy_configure_opts_mipi_dphy *cfg = _dphy;
@@ -772,6 +774,9 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder 
*encoder)
if (dsi->panel)
drm_panel_prepare(dsi->panel);
 
+   if (dsi->next_bridge)
+   dsi->next_bridge->funcs->atomic_pre_enable(dsi->next_bridge, 
old_bridge_state);
+
/*
 * FIXME: This should be moved after the switch to HS mode.
 *
@@ -787,6 +792,9 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder 
*encoder)
if (dsi->panel)
drm_panel_enable(dsi->panel);
 
+   if (dsi->next_bridge)
+   dsi->next_bridge->funcs->atomic_enable(dsi->next_bridge, 
old_bridge_state);
+
sun6i_dsi_start(dsi, DSI_START_HSC);
 
udelay(1000);
@@ -794,15 +802,19 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder 
*encoder)
sun6i_dsi_start(dsi, DSI_START_HSD);
 }
 
-static void sun6i_dsi_encoder_disable(struct drm_encoder *encoder)
+static void sun6i_dsi_bridge_atomic_disable(struct drm_bridge *bridge,
+   struct drm_bridge_state 
*old_bridge_state)
 {
-   struct sun6i_dsi *dsi = encoder_to_sun6i_dsi(encoder);
+   struct sun6i_dsi *dsi = bridge_to_sun6i_dsi(bridge);
 
DRM_DEBUG_DRIVER("Disabling DSI output\n");
 
if (dsi->panel) {
drm_panel_disable(dsi->panel);
drm_panel_unprepare(dsi->panel);
+   } else if (dsi->next_bridge) {
+   dsi->next_bridge->funcs->atomic_disable(dsi->next_bridge, 
old_bridge_state);
+   dsi->next_bridge->funcs->atomic_post_disable(dsi->next_bridge, 
old_bridge_state);
}
 
phy_power_off(dsi->dphy);
@@ -842,9 +854,25 @@ static const struct drm_connector_funcs 
sun6i_dsi_connector_funcs = {
.atomic_destroy_state   = drm_atomic_helper_connector_destroy_state,
 };
 
-static const struct drm_encoder_helper_funcs sun6i_dsi_enc_helper_funcs = {
-   .disable= sun6i_dsi_encoder_disable,
-   .enable = sun6i_dsi_encoder_enable,
+static int sun6i_dsi_bridge_attach(struct drm_bridge *bridge,
+  enum drm_bridge_attach_flags flags)
+{
+   struct sun6i_dsi *dsi = bridge_to_sun6i_dsi(bridge);
+
+   if (dsi->next_bridge)
+   return drm_bridge_attach(bridge->encoder, dsi->next_bridge,
+NULL, 0);
+
+   return 0;
+}
+
+static const struct drm_bridge_funcs sun6i_dsi_bridge_funcs = {
+   .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
+   .atomic_destroy_state   = drm_atomic_helper_bridge_destroy_state,
+   .atomic_reset   = drm_atomic_helper_bridge_reset,
+   .atomic_enable  = sun6i_dsi_bridge_atomic_enable,
+   .atomic_disable = sun6i_dsi_bridge_atomic_disable,
+   .attach = sun6i_dsi_bridge_attach,
 };
 
 static u32 sun6i_dsi_dcs_build_pkt_hdr(struct sun6i_dsi *dsi,
@@ -966,8 +994,6 @@ static int sun6i_dsi_bind(struct device *dev, struct devic

[linux-sunxi] [PATCH v5 2/7] drm: sun4i: dsi: Add component only once DSI device attached

2021-11-21 Thread Jagan Teki
Having component_add for running all drm bind callbacks returns
error or unbound due to chain of DSI devices connected across
bridge topology on a display pipeline.

In a typical bridge oriented display pipeline where the host is
connected to the bridge converter and that indeed connected to
a panel.

DRM => SUN6I DSI Host => Chipone ICN6211 => BananaPi Panel

The bridge converter is looking for a panel to probe first and
then attach the host. The host attach is looking for a bridge
converter to probe and preserve bridge pointer, at this movement
the host is trying to bind the all callbacks and one of the bind
callback in the DSI host is trying to find the bridge using the
bridge pointer in sun6i_dsi_attach call.

chipone_probe().start
drm_of_find_panel_or_bridge
mipi_dsi_attach
 sun6i_dsi_attach
 drm_of_find_panel_or_bridge
chipone_probe().done

sun6i_dsi_probe().start
mipi_dsi_host_register
component_add
sun6i_dsi_probe().done

However, the movement when panel defers the probe, will make the
bridge converter defer the host attach call which eventually found
a NULL bridge pointer during DSI component bind callback.

So, in order to prevent this scenario of binding invalid bridge,
wait for DSI devices on the pipeline to probe first and start the
binding process by moving component_add in host probe to attach call.

chipone_probe().start
drm_of_find_panel_or_bridge
mipi_dsi_attach
 sun6i_dsi_attach
 drm_of_find_panel_or_bridge
  component_add
chipone_probe().done

sun6i_dsi_probe().start
mipi_dsi_host_register
sun6i_dsi_probe().done

Signed-off-by: Jagan Teki 
---
Changes for v5:
- new patch

 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 119 +
 1 file changed, 60 insertions(+), 59 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c 
b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
index 4bdcce8f1d84..43d9c9e5198d 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
@@ -959,11 +959,62 @@ static int sun6i_dsi_dcs_read(struct sun6i_dsi *dsi,
return 1;
 }
 
+static int sun6i_dsi_bind(struct device *dev, struct device *master,
+void *data)
+{
+   struct drm_device *drm = data;
+   struct sun6i_dsi *dsi = dev_get_drvdata(dev);
+   int ret;
+
+   drm_encoder_helper_add(>encoder,
+  _dsi_enc_helper_funcs);
+   ret = drm_simple_encoder_init(drm, >encoder,
+ DRM_MODE_ENCODER_DSI);
+   if (ret) {
+   dev_err(dsi->dev, "Couldn't initialise the DSI encoder\n");
+   return ret;
+   }
+   dsi->encoder.possible_crtcs = BIT(0);
+
+   drm_connector_helper_add(>connector,
+_dsi_connector_helper_funcs);
+   ret = drm_connector_init(drm, >connector,
+_dsi_connector_funcs,
+DRM_MODE_CONNECTOR_DSI);
+   if (ret) {
+   dev_err(dsi->dev,
+   "Couldn't initialise the DSI connector\n");
+   goto err_cleanup_connector;
+   }
+
+   drm_connector_attach_encoder(>connector, >encoder);
+
+   return 0;
+
+err_cleanup_connector:
+   drm_encoder_cleanup(>encoder);
+   return ret;
+}
+
+static void sun6i_dsi_unbind(struct device *dev, struct device *master,
+   void *data)
+{
+   struct sun6i_dsi *dsi = dev_get_drvdata(dev);
+
+   drm_encoder_cleanup(>encoder);
+}
+
+static const struct component_ops sun6i_dsi_ops = {
+   .bind   = sun6i_dsi_bind,
+   .unbind = sun6i_dsi_unbind,
+};
+
 static int sun6i_dsi_attach(struct mipi_dsi_host *host,
struct mipi_dsi_device *device)
 {
struct sun6i_dsi *dsi = host_to_sun6i_dsi(host);
struct drm_panel *panel = of_drm_find_panel(device->dev.of_node);
+   int ret;
 
if (IS_ERR(panel))
return PTR_ERR(panel);
@@ -973,6 +1024,13 @@ static int sun6i_dsi_attach(struct mipi_dsi_host *host,
 
dev_info(host->dev, "Attached device %s\n", device->name);
 
+   ret = component_add(dsi->dev, _dsi_ops);
+   if (ret) {
+   dev_err(dsi->dev, "Couldn't register our component\n");
+   mipi_dsi_host_unregister(>host);
+   return ret;
+   }
+
return 0;
 }
 
@@ -984,6 +1042,8 @@ static int sun6i_dsi_detach(struct mipi_dsi_host *host,
dsi->panel = NULL;
dsi->device = NULL;
 
+   component_del(dsi->dev, _dsi_ops);
+
return 0;
 }
 
@@ -1041,56 +1101,6 @@ static const struct regmap_config 
sun6i_dsi_regmap_config = {
.name   = "mipi-dsi",
 };
 
-static int sun6i_dsi_bind(struct device *de

[linux-sunxi] [PATCH v5 1/7] drm: sun4i: dsi: Drop DRM bind race with bridge attach

2021-11-21 Thread Jagan Teki
Existing host driver will keep looking for DRM pointer in
sun6i_dsi_attach and defers even if the particular DSI device
is found for the first time. Meanwhile it triggers the bind
callback and gets the DRM pointer and then continues the
sun6i_dsi_attach.

This makes a deadlock situation if sun6i_dsi_attach is trying
to find the bridge.

If interface bridge is trying to call host attach, then host
sun6i_dsi_attach is trying to find bridge and defers the
interface bridge even if it found the bridge as bind callback
does not complete at the movement. So, this sun6i_dsi_attach
defers interface bridge and triggers the bind callback and
tries to attach the bridge with a bridge pointer which is not
available at the moment.

Eventually these callbacks are triggered recursively, as
sun6i_dsi_attach defers interface bridge and bind callback
defers sun6i_dsi_attach due to invalid bridge ponter.

This patch prevents this situation by probing all DSI devices
on the pipeline first and then triggers the bind callback by
dropping exing DRM binding logic.

Signed-off-by: Jagan Teki 
---
Changes for v5:
- new patch

 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 10 +-
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h |  1 -
 2 files changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c 
b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
index 527c7b2474da..4bdcce8f1d84 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
@@ -967,14 +967,10 @@ static int sun6i_dsi_attach(struct mipi_dsi_host *host,
 
if (IS_ERR(panel))
return PTR_ERR(panel);
-   if (!dsi->drm || !dsi->drm->registered)
-   return -EPROBE_DEFER;
 
dsi->panel = panel;
dsi->device = device;
 
-   drm_kms_helper_hotplug_event(dsi->drm);
-
dev_info(host->dev, "Attached device %s\n", device->name);
 
return 0;
@@ -988,8 +984,6 @@ static int sun6i_dsi_detach(struct mipi_dsi_host *host,
dsi->panel = NULL;
dsi->device = NULL;
 
-   drm_kms_helper_hotplug_event(dsi->drm);
-
return 0;
 }
 
@@ -1077,8 +1071,6 @@ static int sun6i_dsi_bind(struct device *dev, struct 
device *master,
 
drm_connector_attach_encoder(>connector, >encoder);
 
-   dsi->drm = drm;
-
return 0;
 
 err_cleanup_connector:
@@ -1091,7 +1083,7 @@ static void sun6i_dsi_unbind(struct device *dev, struct 
device *master,
 {
struct sun6i_dsi *dsi = dev_get_drvdata(dev);
 
-   dsi->drm = NULL;
+   drm_encoder_cleanup(>encoder);
 }
 
 static const struct component_ops sun6i_dsi_ops = {
diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h 
b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h
index c863900ae3b4..61e88ea6044d 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h
@@ -29,7 +29,6 @@ struct sun6i_dsi {
 
struct device   *dev;
struct mipi_dsi_device  *device;
-   struct drm_device   *drm;
struct drm_panel*panel;
 };
 
-- 
2.25.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20211122065223.88059-2-jagan%40amarulasolutions.com.


[linux-sunxi] [PATCH v5 0/7] drm: sun4i: dsi: Convert drm bridge

2021-11-21 Thread Jagan Teki
This series convert Allwinner DSI controller to full functional 
drm bridge driver for supporting all variants of DSI devices.

Here, are the previous version changes[1].

Patch 1: Drop the DRM bind race while attaching bridges

Patch 2: Move component_add into sun6i_dsi_attach

Patch 3: Convert the encoder to bridge driver

Patch 4: Add mode_set API

Patch 5: Enable DSI Panel

Patch 6: Enable DSI Bridge

Patch 7: Enable DSI Bridge (I2C)

[1] https://www.spinics.net/lists/arm-kernel/msg883560.html

Any inputs?
Jagan.

Jagan Teki (7):
  drm: sun4i: dsi: Drop DRM bind race with bridge attach
  drm: sun4i: dsi: Add component only once DSI device attached
  drm: sun4i: dsi: Convert to bridge driver
  drm: sun4i: dsi: Add mode_set function
  [DO NOT MERGE] ARM: dts: sun8i: bananapi-m2m: Enable S070WV20-CT16 Panel
  [DO NOT MERGE] ARM: dts: sun8i: bananapi-m2m: Enable ICN6211 DSI Bridge
  [DO NOT MERGE] ARM: dts: sun8i: Enable DLPC3433 Bridge (I2C)

 arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts |  63 ++
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c   | 225 ---
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h   |   9 +-
 3 files changed, 218 insertions(+), 79 deletions(-)

-- 
2.25.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20211122065223.88059-1-jagan%40amarulasolutions.com.


[linux-sunxi] Re: [PATCH] usb: musb-new: Extend Allwinner quirk to newer SoCs

2021-04-27 Thread Jagan Teki
On Tue, Apr 27, 2021 at 1:41 PM Andre Przywara  wrote:
>
> On Tue, 27 Apr 2021 02:37:20 +0200
> Marek Vasut  wrote:
>
> Hi,
>
> > On 4/27/21 2:03 AM, Andre Przywara wrote:
> > > As the comment in musb_regs.h describes, Allwinner saves the
> > > MUSB_CONFIGDATA register, which always return 0 on those SoCs.
> > >
> > > This is also true for the H6 and H616, so extend the quirk to those
> > > controllers as well.
> > >
> > > This fixes USB peripheral mode on H6 and H616 boards.
> > >
> > > Signed-off-by: Andre Przywara 
> > > ---
> > >   drivers/usb/musb-new/musb_regs.h | 3 ++-
> > >   1 file changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/usb/musb-new/musb_regs.h 
> > > b/drivers/usb/musb-new/musb_regs.h
> > > index c4d7203b851..bee1b715a95 100644
> > > --- a/drivers/usb/musb-new/musb_regs.h
> > > +++ b/drivers/usb/musb-new/musb_regs.h
> > > @@ -432,7 +432,8 @@ static inline u8 musb_read_ulpi_buscontrol(void 
> > > __iomem *mbase)
> > >   static inline u8 musb_read_configdata(void __iomem *mbase)
> > >   {
> > >   #if defined CONFIG_MACH_SUN8I_A33 || defined CONFIG_MACH_SUN8I_A83T || \
> > > -   defined CONFIG_MACH_SUNXI_H3_H5 || defined CONFIG_MACH_SUN50I
> > > +   defined CONFIG_MACH_SUNXI_H3_H5 || defined CONFIG_MACH_SUN50I || \
> > > +   defined CONFIG_SUN50I_GEN_H6
> >
> > Isn't there some better solution then ever-growing list of macros to
> > check, like e.g. a single CONFIG_MACH_SUNXI ?
>
> I was wondering the same, but I think this does not apply to the older
> SoCs (we use ARCH_SUNXI in the two functions above and below, so I
> guess the differentiation here is deliberate). I will test this later.
>
> So we could probably use the quirk also for the older, working(?) SoCs,
> but I am not sure we should do that. CONFIG_SUN50I_GEN_H6 is already a
> symbol covering multiple SoCs, so ideally we won't need to add many
> more.
> I can have a look if we have other checks like that in the code, then
> maybe define a collective symbol for newer SoCs?

The better approach is to support config_read via musb_platform_ops.
If so, we can identify the offsets to endpoint registers using SoC
musb reg space and return the relevant 16-bit config value.

Jagan.

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CAMty3ZB0twvNAu40D-2Sn5Z_6WYYNBB8c%3Dt-kmHfV-djM%3DWcKw%40mail.gmail.com.


[linux-sunxi] Re: [PATCH] sunxi: board: Add H616 MMC2 pins

2021-04-26 Thread Jagan Teki
On Mon, Apr 26, 2021 at 5:45 PM Andre Przywara  wrote:
>
> We hardcode the pinctrl setting for the MMC controllers in boards.c,
> since we need them also in the SPL, where there is no DT yet.
>
> Add the respective setting for the H616 SoC, to enable eMMC on boards
> with this SoC as well.
> Also to make diagnosing this problem easier, print a warning if a board
> tries to setup MMC2 pins without a respective SoC setting being defined.
>
> Signed-off-by: Andre Przywara 
> ---

Reviewed-by: Jagan Teki 

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CAMty3ZC8nEDZjsmigoSDCzqpJFwrQR30xHXnm9aUve2jROQ32A%40mail.gmail.com.


[linux-sunxi] Re: [PATCH] sunxi: Bring back SD card as MMC device 0

2021-04-26 Thread Jagan Teki
On Mon, Apr 26, 2021 at 4:57 PM Andre Przywara  wrote:
>
> On Sun, 25 Apr 2021 18:03:05 +0530
> Jagan Teki  wrote:
>
> Hi Jagan,
>
> thanks for your input!
>
> > On Sun, Apr 25, 2021 at 3:30 PM Andre Przywara  
> > wrote:
> > >
> > > On Fri, 16 Apr 2021 12:08:09 +0100
> > > Andre Przywara  wrote:
> > >
> > > Hi,
> > >
> > > > Commit 2243d19e5618 ("mmc: mmc-uclass: Use dev_seq() to read aliases
> > > > node's index") now actually enforces U-Boot's device enumeration policy,
> > > > where explicitly named devices come first, then any other non-named
> > > > devices follow, without filling gaps.
> > > >
> > > > For quite a while we have had an "mmc1 = " alias in our
> > > > sunxi-u-boot.dtsi, which now leads to the problem that the SD card
> > > > (which was always mmc device 0) now gets to be number 2.
> > > > I guess this breaks quite some boot scripts, and is confusing at least.
> > > >
> > > > Just add an explicit mmc0 alias in the very same file to fix this and
> > > > restore the old behaviour.
> > >
> > > Can someone please say if this is the right solution?
> > > I think the SD card has always been mmc device 0 in U-Boot, so I think
> > > it's worth keeping that. Just not sure if this is the right way of
> > > fixing that?
> >
> > Playing with aliases always gets confused and might get a different
> > behavior, IMHO.
>
> I am not so sure about that, since aliases force a fixed numbering, so
> it should be less confusing. We have the same problem in the kernel
> now, and Samuel sent some patches to have aliases in the mainline DTs
> as well [1].

Okay.

>
> > Detect the dev number by U-Boot itself and look at
> > traverse bootenv by all possible dev numbers in sunxi-common.h, but
>
> OK, I will have a look at how the automatic distro boot behaves with
> this change. My concern was more the interactive user, who is used to
> have the SD card at device 0 (I certainly am).
>
> > this has one slide effect that we mark mmc2 as devnum 1 for the sake
> > of fastboot so if we mark fastboot number for specific board properly
> > (by static or runtime) then explicit aliases wouldn't required.
>
> Ah, good point, thanks for the heads up. I guess this is the actual
> reason for the alias in our -u-boot.dtsi? Maybe we find a different way
> to let fastboot find the eMMC? Then we can drop the extra mmc1 alias,
> get our numbering back, and can cope with the incoming aliases from the
> mainline DTs as well?

Agreed.

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CAMty3ZAtOcbDZQc50OykhATDTTuNLaQFEg8ja5XQJvk5FO1eqQ%40mail.gmail.com.


[linux-sunxi] Re: [PATCH] sunxi: Bring back SD card as MMC device 0

2021-04-25 Thread Jagan Teki
On Sun, Apr 25, 2021 at 3:30 PM Andre Przywara  wrote:
>
> On Fri, 16 Apr 2021 12:08:09 +0100
> Andre Przywara  wrote:
>
> Hi,
>
> > Commit 2243d19e5618 ("mmc: mmc-uclass: Use dev_seq() to read aliases
> > node's index") now actually enforces U-Boot's device enumeration policy,
> > where explicitly named devices come first, then any other non-named
> > devices follow, without filling gaps.
> >
> > For quite a while we have had an "mmc1 = " alias in our
> > sunxi-u-boot.dtsi, which now leads to the problem that the SD card
> > (which was always mmc device 0) now gets to be number 2.
> > I guess this breaks quite some boot scripts, and is confusing at least.
> >
> > Just add an explicit mmc0 alias in the very same file to fix this and
> > restore the old behaviour.
>
> Can someone please say if this is the right solution?
> I think the SD card has always been mmc device 0 in U-Boot, so I think
> it's worth keeping that. Just not sure if this is the right way of
> fixing that?

Playing with aliases always gets confused and might get a different
behavior, IMHO. Detect the dev number by U-Boot itself and look at
traverse bootenv by all possible dev numbers in sunxi-common.h, but
this has one slide effect that we mark mmc2 as devnum 1 for the sake
of fastboot so if we mark fastboot number for specific board properly
(by static or runtime) then explicit aliases wouldn't required.

Jagan.

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CAMty3ZBfRNxHzRnvo%2BVSdUR3das0TdOFUTuKoWveJKJAN%2Bn7iw%40mail.gmail.com.


[linux-sunxi] Re: [PATCH 2/2] sunxi: dts: H616: Drop reserved-memory node

2021-03-30 Thread Jagan Teki
On Tue, Mar 30, 2021 at 7:21 PM Samuel Holland  wrote:
>
> On 3/30/21 8:28 AM, Jagan Teki wrote:
> > On Tue, Mar 30, 2021 at 6:31 PM Andre Przywara  
> > wrote:
> >>
> >> Trusted Firmware now adds the /reserved-memory subnode to the DT at
> >> runtime[1], putting in the right values.
> >>
> >> Drop our hard-coded version, as this might clash with the actual values
> >> (which have also changed), and rely on TF-A to add the node.
> >>
> >> [1] https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/7770
> >>
> >> Signed-off-by: Andre Przywara 
>
> Reviewed-by: Samuel Holland 
>
> >> ---
> >>  arch/arm/dts/sun50i-h616.dtsi | 12 
> >>  1 file changed, 12 deletions(-)
> >>
> >> diff --git a/arch/arm/dts/sun50i-h616.dtsi b/arch/arm/dts/sun50i-h616.dtsi
> >> index 953e8fac20f..dd4d2f3 100644
> >> --- a/arch/arm/dts/sun50i-h616.dtsi
> >> +++ b/arch/arm/dts/sun50i-h616.dtsi
> >> @@ -51,18 +51,6 @@
> >> };
> >> };
> >>
> >> -   reserved-memory {
> >> -   #address-cells = <2>;
> >> -   #size-cells = <2>;
> >> -   ranges;
> >> -
> >> -   /* 512KiB reserved for ARM Trusted Firmware (BL31) */
> >> -   secmon_reserved: secmon@4000 {
> >> -   reg = <0x0 0x4000 0x0 0x8>;
> >> -   no-map;
> >> -   };
> >> -   };
> >> -
> >
> > As said always. it's better to not touch Linux dts files. If the same
> > fix same available in Linux add SHA1 on the commit message otherwise
> > keep /delete-node on -u-boot.dtsi. This how we are maintaining sofar
> > at least on sunxi.
>
> This file has not yet been added to the Linux tree, so that rule does not 
> apply
> in this case.

Reviewed-by: Jagan Teki 

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CAMty3ZDLJHgaj0CHbo6rpb3%2B1-Qz%2Bz1fPiBzkBub9ZDC4mdoJw%40mail.gmail.com.


[linux-sunxi] Re: [PATCH 2/2] sunxi: dts: H616: Drop reserved-memory node

2021-03-30 Thread Jagan Teki
On Tue, Mar 30, 2021 at 6:31 PM Andre Przywara  wrote:
>
> Trusted Firmware now adds the /reserved-memory subnode to the DT at
> runtime[1], putting in the right values.
>
> Drop our hard-coded version, as this might clash with the actual values
> (which have also changed), and rely on TF-A to add the node.
>
> [1] https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/7770
>
> Signed-off-by: Andre Przywara 
> ---
>  arch/arm/dts/sun50i-h616.dtsi | 12 
>  1 file changed, 12 deletions(-)
>
> diff --git a/arch/arm/dts/sun50i-h616.dtsi b/arch/arm/dts/sun50i-h616.dtsi
> index 953e8fac20f..dd4d2f3 100644
> --- a/arch/arm/dts/sun50i-h616.dtsi
> +++ b/arch/arm/dts/sun50i-h616.dtsi
> @@ -51,18 +51,6 @@
> };
> };
>
> -   reserved-memory {
> -   #address-cells = <2>;
> -   #size-cells = <2>;
> -   ranges;
> -
> -   /* 512KiB reserved for ARM Trusted Firmware (BL31) */
> -   secmon_reserved: secmon@4000 {
> -   reg = <0x0 0x4000 0x0 0x8>;
> -   no-map;
> -   };
> -   };
> -

As said always. it's better to not touch Linux dts files. If the same
fix same available in Linux add SHA1 on the commit message otherwise
keep /delete-node on -u-boot.dtsi. This how we are maintaining sofar
at least on sunxi.

Jagan.

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CAMty3ZDpETzmE%3D1CRo2d3yT4FN0nSi7p%2Bpvf8cLjBSwfu7Kpkg%40mail.gmail.com.


[linux-sunxi] Re: [PATCH v4 1/4] drm: sun4i: dsi: Use drm_of_find_panel_or_bridge

2021-03-24 Thread Jagan Teki
Hi Laurent,

On Wed, Mar 24, 2021 at 3:09 PM Laurent Pinchart
 wrote:
>
> Hi Jagan,
>
> On Wed, Mar 24, 2021 at 02:44:57PM +0530, Jagan Teki wrote:
> > On Wed, Mar 24, 2021 at 8:18 AM Samuel Holland wrote:
> > > On 3/23/21 5:53 PM, Laurent Pinchart wrote:
> > > > On Mon, Mar 22, 2021 at 07:31:49PM +0530, Jagan Teki wrote:
> > > >> Replace of_drm_find_panel with drm_of_find_panel_or_bridge
> > > >> for finding panel, this indeed help to find the bridge if
> > > >> bridge support added.
> > > >>
> > > >> Added NULL in bridge argument, same will replace with bridge
> > > >> parameter once bridge supported.
> > > >>
> > > >> Signed-off-by: Jagan Teki 
> > > >
> > > > Looks good, there should be no functional change.
> > >
> > > Actually this breaks all existing users of this driver, see below.
> > >
> > > > Reviewed-by: Laurent Pinchart 
> > > >
> > > >> ---
> > > >> Changes for v4, v3:
> > > >> - none
> > > >>
> > > >>  drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 11 ---
> > > >>  1 file changed, 8 insertions(+), 3 deletions(-)
> > > >>
> > > >> diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c 
> > > >> b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> > > >> index 4f5efcace68e..2e9e7b2d4145 100644
> > > >> --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> > > >> +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> > > >> @@ -21,6 +21,7 @@
> > > >>
> > > >>  #include 
> > > >>  #include 
> > > >> +#include 
> > > >>  #include 
> > > >>  #include 
> > > >>  #include 
> > > >> @@ -963,10 +964,14 @@ static int sun6i_dsi_attach(struct mipi_dsi_host 
> > > >> *host,
> > > >>  struct mipi_dsi_device *device)
> > > >>  {
> > > >>  struct sun6i_dsi *dsi = host_to_sun6i_dsi(host);
> > > >> -struct drm_panel *panel = of_drm_find_panel(device->dev.of_node);
> > >
> > > This is using the OF node of the DSI device, which is a direct child of
> > > the DSI host's OF node. There is no OF graph involved.
> > >
> > > >> +struct drm_panel *panel;
> > > >> +int ret;
> > > >> +
> > > >> +ret = drm_of_find_panel_or_bridge(dsi->dev->of_node, 0, 0,
> > > >> +  , NULL);
> > >
> > > However, this function expects to find the panel using OF graph. This
> > > does not work with existing device trees (PinePhone, PineTab) which do
> > > not use OF graph to connect the panel. And it cannot work, because the
> > > DSI host's binding specifies a single port: the input port from the
> > > display engine.
> >
> > Thanks for noticing this. I did understand your point and yes, I did
> > mention the updated pipeline in previous versions and forgot to add it
> > to this series.
> >
> > Here is the updated pipeline to make it work:
> >
> > https://patchwork.kernel.org/project/dri-devel/patch/20190524104252.20236-1-ja...@amarulasolutions.com/
> >
> > Let me know your comments on this, so I will add a patch for the
> > above-affected DTS files.
>
> DT is an ABI, we need to ensure backward compatibility. Changes in
> kernel drivers can't break devices that have an old DT.

Thanks for your point.

So, we need to choose APIs that would compatible with the old DT and
new DT changes. Am I correct?

Jagan.

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CAMty3ZBGnz_a4_HO_TZ-zPNJwHMcVJyrBi3kZX2%3Da6G47Ze-yw%40mail.gmail.com.


[linux-sunxi] Re: [PATCH v4 1/4] drm: sun4i: dsi: Use drm_of_find_panel_or_bridge

2021-03-24 Thread Jagan Teki
On Wed, Mar 24, 2021 at 8:18 AM Samuel Holland  wrote:
>
> On 3/23/21 5:53 PM, Laurent Pinchart wrote:
> > Hi Jagan,
> >
> > Thank you for the patch.
> >
> > On Mon, Mar 22, 2021 at 07:31:49PM +0530, Jagan Teki wrote:
> >> Replace of_drm_find_panel with drm_of_find_panel_or_bridge
> >> for finding panel, this indeed help to find the bridge if
> >> bridge support added.
> >>
> >> Added NULL in bridge argument, same will replace with bridge
> >> parameter once bridge supported.
> >>
> >> Signed-off-by: Jagan Teki 
> >
> > Looks good, there should be no functional change.
>
> Actually this breaks all existing users of this driver, see below.
>
> > Reviewed-by: Laurent Pinchart 
> >
> >> ---
> >> Changes for v4, v3:
> >> - none
> >>
> >>  drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 11 ---
> >>  1 file changed, 8 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c 
> >> b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> >> index 4f5efcace68e..2e9e7b2d4145 100644
> >> --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> >> +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> >> @@ -21,6 +21,7 @@
> >>
> >>  #include 
> >>  #include 
> >> +#include 
> >>  #include 
> >>  #include 
> >>  #include 
> >> @@ -963,10 +964,14 @@ static int sun6i_dsi_attach(struct mipi_dsi_host 
> >> *host,
> >>  struct mipi_dsi_device *device)
> >>  {
> >>  struct sun6i_dsi *dsi = host_to_sun6i_dsi(host);
> >> -struct drm_panel *panel = of_drm_find_panel(device->dev.of_node);
>
> This is using the OF node of the DSI device, which is a direct child of
> the DSI host's OF node. There is no OF graph involved.
>
> >> +struct drm_panel *panel;
> >> +int ret;
> >> +
> >> +ret = drm_of_find_panel_or_bridge(dsi->dev->of_node, 0, 0,
> >> +  , NULL);
>
> However, this function expects to find the panel using OF graph. This
> does not work with existing device trees (PinePhone, PineTab) which do
> not use OF graph to connect the panel. And it cannot work, because the
> DSI host's binding specifies a single port: the input port from the
> display engine.

Thanks for noticing this. I did understand your point and yes, I did
mention the updated pipeline in previous versions and forgot to add it
to this series.

Here is the updated pipeline to make it work:

https://patchwork.kernel.org/project/dri-devel/patch/20190524104252.20236-1-ja...@amarulasolutions.com/

Let me know your comments on this, so I will add a patch for the
above-affected DTS files.

Jagan.

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CAMty3ZDOVeMeYTsuF8n4EQTG6eEbj6e33TuTPrFiMWG4RhRdSw%40mail.gmail.com.


[linux-sunxi] [PATCH v4 1/4] drm: sun4i: dsi: Use drm_of_find_panel_or_bridge

2021-03-22 Thread Jagan Teki
Replace of_drm_find_panel with drm_of_find_panel_or_bridge
for finding panel, this indeed help to find the bridge if
bridge support added.

Added NULL in bridge argument, same will replace with bridge
parameter once bridge supported.

Signed-off-by: Jagan Teki 
---
Changes for v4, v3:
- none

 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c 
b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
index 4f5efcace68e..2e9e7b2d4145 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
@@ -21,6 +21,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -963,10 +964,14 @@ static int sun6i_dsi_attach(struct mipi_dsi_host *host,
struct mipi_dsi_device *device)
 {
struct sun6i_dsi *dsi = host_to_sun6i_dsi(host);
-   struct drm_panel *panel = of_drm_find_panel(device->dev.of_node);
+   struct drm_panel *panel;
+   int ret;
+
+   ret = drm_of_find_panel_or_bridge(dsi->dev->of_node, 0, 0,
+ , NULL);
+   if (ret)
+   return ret;
 
-   if (IS_ERR(panel))
-   return PTR_ERR(panel);
if (!dsi->drm || !dsi->drm->registered)
return -EPROBE_DEFER;
 
-- 
2.25.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20210322140152.101709-2-jagan%40amarulasolutions.com.


[linux-sunxi] [DO NOT MERGE] [PATCH v4 4/4] ARM: dts: sun8i: bananapi-m2m: Enable S070WV20-CT16 panel

2021-03-22 Thread Jagan Teki
This patch add support for Bananapi S070WV20-CT16 panel to
BPI-M2M board.

Bananapi S070WV20-CT16 is a pure RGB output panel with ICN6211 DSI/RGB
converter bridge, so enable bridge along with associated panel.

DSI panel connected via board DSI port with,
- DCDC1 as VCC-DSI supply
- PL5 gpio for bridge enable gpio pin
- PB7 gpio for lcd enable gpio pin
- PL4 gpio for backlight enable pin

Signed-off-by: Jagan Teki 
---
Changes for v4:
- replace reset with enable-gpios
Changes for v3:
- none 

 arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts | 85 
 1 file changed, 85 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts 
b/arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts
index 293016d081cd..6f33e1ae8ffc 100644
--- a/arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts
+++ b/arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts
@@ -44,6 +44,7 @@
 #include "sun8i-a33.dtsi"
 
 #include 
+#include 
 
 / {
model = "BananaPi M2 Magic";
@@ -55,12 +56,21 @@ aliases {
i2c2 = 
serial0 = 
serial1 = 
+   mmc0 = 
};
 
chosen {
stdout-path = "serial0:115200n8";
};
 
+   backlight: backlight {
+   compatible = "pwm-backlight";
+   pwms = < 0 5 PWM_POLARITY_INVERTED>;
+   brightness-levels = <1 2 4 8 16 32 64 128 255>;
+   default-brightness-level = <8>;
+   enable-gpios = <_pio 0 4 GPIO_ACTIVE_HIGH>; /* LCD-BL-EN: PL4 
*/
+   };
+
leds {
compatible = "gpio-leds";
 
@@ -81,6 +91,18 @@ led-2 {
};
};
 
+   panel {
+   compatible = "bananapi,s070wv20-ct16";
+   enable-gpios = < 1 7 GPIO_ACTIVE_HIGH>; /* LCD-PWR-EN: PB7 
*/
+   backlight = <>;
+
+   port {
+   panel_out_bridge: endpoint {
+   remote-endpoint = <_out_panel>;
+   };
+   };
+   };
+
reg_vcc5v0: vcc5v0 {
compatible = "regulator-fixed";
regulator-name = "vcc5v0";
@@ -122,6 +144,59 @@  {
status = "okay";
 };
 
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   vcc-dsi-supply = <_dcdc1>;  /* VCC-DSI */
+   status = "okay";
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   dsi_out: port@0 {
+   reg = <0>;
+
+   dsi_out_bridge: endpoint {
+   remote-endpoint = <_out_dsi>;
+   };
+   };
+   };
+
+   bridge@0 {
+   compatible = "chipone,icn6211";
+   reg = <0>;
+   enable-gpios = <_pio 0 5 GPIO_ACTIVE_HIGH>; /* LCD-RST: PL5 */
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   bridge_in: port@0 {
+   reg = <0>;
+
+   bridge_out_dsi: endpoint {
+   remote-endpoint = <_out_bridge>;
+   };
+   };
+
+   bridge_out: port@1 {
+   reg = <1>;
+
+   bridge_out_panel: endpoint {
+   remote-endpoint = <_out_bridge>;
+   };
+   };
+   };
+   };
+};
+
  {
status = "okay";
 };
@@ -157,6 +232,12 @@  {
status = "okay";
 };
 
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pin>;
+   status = "okay";
+};
+
 _rsb {
status = "okay";
 
@@ -269,6 +350,10 @@  {
status = "okay";
 };
 
+ {
+   status = "okay";
+};
+
  {
pinctrl-names = "default";
pinctrl-0 = <_pb_pins>;
-- 
2.25.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20210322140152.101709-5-jagan%40amarulasolutions.com.


[linux-sunxi] [PATCH v4 3/4] drm: sun4i: dsi: Convert to bridge driver

2021-03-22 Thread Jagan Teki
DRM bridge drivers have build-in handling of treating all display
pipeline components as bridges.

So, convert the existing to a drm bridge driver with a built-in
encoder support for compatibility with existing component drivers.

Signed-off-by: Jagan Teki 
---
Changes for v4:
- none
Changes for v3:
- new patch

 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 75 --
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h |  6 +++
 2 files changed, 54 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c 
b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
index 39321299dc27..6f3c5330a468 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
@@ -714,10 +714,10 @@ static int sun6i_dsi_start(struct sun6i_dsi *dsi,
return 0;
 }
 
-static void sun6i_dsi_encoder_enable(struct drm_encoder *encoder)
+static void sun6i_dsi_bridge_enable(struct drm_bridge *bridge)
 {
-   struct drm_display_mode *mode = >crtc->state->adjusted_mode;
-   struct sun6i_dsi *dsi = encoder_to_sun6i_dsi(encoder);
+   struct drm_display_mode *mode = 
>encoder->crtc->state->adjusted_mode;
+   struct sun6i_dsi *dsi = bridge_to_sun6i_dsi(bridge);
struct mipi_dsi_device *device = dsi->device;
union phy_configure_opts opts = { };
struct phy_configure_opts_mipi_dphy *cfg = _dphy;
@@ -801,9 +801,9 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder 
*encoder)
sun6i_dsi_start(dsi, DSI_START_HSD);
 }
 
-static void sun6i_dsi_encoder_disable(struct drm_encoder *encoder)
+static void sun6i_dsi_bridge_disable(struct drm_bridge *bridge)
 {
-   struct sun6i_dsi *dsi = encoder_to_sun6i_dsi(encoder);
+   struct sun6i_dsi *dsi = bridge_to_sun6i_dsi(bridge);
 
DRM_DEBUG_DRIVER("Disabling DSI output\n");
 
@@ -852,9 +852,40 @@ static const struct drm_connector_funcs 
sun6i_dsi_connector_funcs = {
.atomic_destroy_state   = drm_atomic_helper_connector_destroy_state,
 };
 
-static const struct drm_encoder_helper_funcs sun6i_dsi_enc_helper_funcs = {
-   .disable= sun6i_dsi_encoder_disable,
-   .enable = sun6i_dsi_encoder_enable,
+static int sun6i_dsi_bridge_attach(struct drm_bridge *bridge,
+  enum drm_bridge_attach_flags flags)
+{
+   struct sun6i_dsi *dsi = bridge_to_sun6i_dsi(bridge);
+   int ret;
+
+   if (dsi->panel_bridge)
+   return drm_bridge_attach(bridge->encoder, dsi->panel_bridge, 
NULL, 0);
+
+   if (dsi->panel) {
+   drm_connector_helper_add(>connector,
+_dsi_connector_helper_funcs);
+   ret = drm_connector_init(bridge->dev, >connector,
+_dsi_connector_funcs,
+DRM_MODE_CONNECTOR_DSI);
+   if (ret) {
+   dev_err(dsi->dev, "Couldn't initialise the DSI 
connector\n");
+   goto err_cleanup_connector;
+   }
+
+   drm_connector_attach_encoder(>connector, >encoder);
+   }
+
+   return 0;
+
+err_cleanup_connector:
+   drm_encoder_cleanup(>encoder);
+   return ret;
+}
+
+static const struct drm_bridge_funcs sun6i_dsi_bridge_funcs = {
+   .enable = sun6i_dsi_bridge_enable,
+   .disable= sun6i_dsi_bridge_disable,
+   .attach = sun6i_dsi_bridge_attach,
 };
 
 static u32 sun6i_dsi_dcs_build_pkt_hdr(struct sun6i_dsi *dsi,
@@ -1063,8 +1094,6 @@ static int sun6i_dsi_bind(struct device *dev, struct 
device *master,
struct sun6i_dsi *dsi = dev_get_drvdata(dev);
int ret;
 
-   drm_encoder_helper_add(>encoder,
-  _dsi_enc_helper_funcs);
ret = drm_simple_encoder_init(drm, >encoder,
  DRM_MODE_ENCODER_DSI);
if (ret) {
@@ -1073,27 +1102,12 @@ static int sun6i_dsi_bind(struct device *dev, struct 
device *master,
}
dsi->encoder.possible_crtcs = BIT(0);
 
-   drm_connector_helper_add(>connector,
-_dsi_connector_helper_funcs);
-   ret = drm_connector_init(drm, >connector,
-_dsi_connector_funcs,
-DRM_MODE_CONNECTOR_DSI);
+   ret = drm_bridge_attach(>encoder, >bridge, NULL, 0);
if (ret) {
-   dev_err(dsi->dev,
-   "Couldn't initialise the DSI connector\n");
+   dev_err(dsi->dev, "Couldn't attach drm bridge\n");
goto err_cleanup_connector;
}
 
-   drm_connector_attach_encoder(>connector, >encoder);
-
-   if (dsi->panel_bridge) {
-   ret = drm_bridge_attach(>encoder, dsi->panel_bridge, NULL, 
0);
-

[linux-sunxi] [PATCH v4 2/4] drm: sun4i: dsi: Add bridge support

2021-03-22 Thread Jagan Teki
Some display panels would come up with a non-DSI output which
can have an option to connect DSI interface by means of bridge
converter.

This DSI to non-DSI bridge converter would require a bridge
driver that would communicate the DSI controller for bridge
functionalities.

So, add support for bridge functionalities in Allwinner DSI
controller.

Cc: Samuel Holland 
Signed-off-by: Jagan Teki 
---
Note: 
Samuel Holland, The existing kms hotplug dropped in order to 
attach the bridge properly. 

However, I did try several ways to support hotplug with the 
bridge but it's resulting in a deadlock where bind never attach 
bridge until bridge pointer found and bridge pointer cannot 
found until bind finishes. Any inputs on this would be appreciated.

Changes for v4:
- none
Changes for v3:
- updated with new API's 

 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 34 +-
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h |  2 +-
 2 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c 
b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
index 2e9e7b2d4145..39321299dc27 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
@@ -773,6 +773,9 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder 
*encoder)
if (dsi->panel)
drm_panel_prepare(dsi->panel);
 
+   if (dsi->panel_bridge)
+   dsi->panel_bridge->funcs->pre_enable(dsi->panel_bridge);
+
/*
 * FIXME: This should be moved after the switch to HS mode.
 *
@@ -788,6 +791,9 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder 
*encoder)
if (dsi->panel)
drm_panel_enable(dsi->panel);
 
+   if (dsi->panel_bridge)
+   dsi->panel_bridge->funcs->enable(dsi->panel_bridge);
+
sun6i_dsi_start(dsi, DSI_START_HSC);
 
udelay(1000);
@@ -804,6 +810,9 @@ static void sun6i_dsi_encoder_disable(struct drm_encoder 
*encoder)
if (dsi->panel) {
drm_panel_disable(dsi->panel);
drm_panel_unprepare(dsi->panel);
+   } else if (dsi->panel_bridge) {
+   dsi->panel_bridge->funcs->disable(dsi->panel_bridge);
+   dsi->panel_bridge->funcs->post_disable(dsi->panel_bridge);
}
 
phy_power_off(dsi->dphy);
@@ -964,23 +973,17 @@ static int sun6i_dsi_attach(struct mipi_dsi_host *host,
struct mipi_dsi_device *device)
 {
struct sun6i_dsi *dsi = host_to_sun6i_dsi(host);
-   struct drm_panel *panel;
int ret;
 
ret = drm_of_find_panel_or_bridge(dsi->dev->of_node, 0, 0,
- , NULL);
+ >panel, >panel_bridge);
if (ret)
return ret;
 
-   if (!dsi->drm || !dsi->drm->registered)
-   return -EPROBE_DEFER;
-
-   dsi->panel = panel;
dsi->device = device;
 
-   drm_kms_helper_hotplug_event(dsi->drm);
-
-   dev_info(host->dev, "Attached device %s\n", device->name);
+   dev_info(host->dev, "Attached %s %s\n",
+device->name, dsi->panel ? "panel" : "bridge");
 
return 0;
 }
@@ -991,9 +994,10 @@ static int sun6i_dsi_detach(struct mipi_dsi_host *host,
struct sun6i_dsi *dsi = host_to_sun6i_dsi(host);
 
dsi->panel = NULL;
+   dsi->panel_bridge = NULL;
dsi->device = NULL;
 
-   drm_kms_helper_hotplug_event(dsi->drm);
+   drm_of_panel_bridge_remove(dsi->dev->of_node, 0, 0);
 
return 0;
 }
@@ -1082,7 +1086,13 @@ static int sun6i_dsi_bind(struct device *dev, struct 
device *master,
 
drm_connector_attach_encoder(>connector, >encoder);
 
-   dsi->drm = drm;
+   if (dsi->panel_bridge) {
+   ret = drm_bridge_attach(>encoder, dsi->panel_bridge, NULL, 
0);
+   if (ret) {
+   dev_err(dsi->dev, "Couldn't attach drm bridge\n");
+   goto err_cleanup_connector;
+   }
+   }
 
return 0;
 
@@ -1096,7 +1106,7 @@ static void sun6i_dsi_unbind(struct device *dev, struct 
device *master,
 {
struct sun6i_dsi *dsi = dev_get_drvdata(dev);
 
-   dsi->drm = NULL;
+   drm_encoder_cleanup(>encoder);
 }
 
 static const struct component_ops sun6i_dsi_ops = {
diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h 
b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h
index c863900ae3b4..370ecb356a63 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h
@@ -29,8 +29,8 @@ struct sun6i_dsi {
 
struct device   *dev;
struct mipi_dsi_device  *device;
-   struct drm_device   *drm;
struct drm_panel*

[linux-sunxi] [PATCH v4 0/4] drm: sun4i: dsi: Convert drm bridge

2021-03-22 Thread Jagan Teki
This series convert Allwinner DSI controller to full functional 
drm bridge driver for supporting slave panel, bridges.

Here, are the previous version changes[1].

Patch 1: use drm_of_find_panel_or_bridge API

Patch 2: Adding DRM Bridge support

Patch 3: Convert to bridge driver, that indeed drop
 encoder API's and support bridge API's

Patch 4: Overlay patch for bridge enablement in BPI-M2M

Note: Only nit on this series is kms hotplug, added Samuel Holland
for reviews and comments as he is authorized the code before.

[1] https://lkml.org/lkml/2021/2/14/173

Any inputs on this would be appreciated!
Jagan.

Jagan Teki (4):
  drm: sun4i: dsi: Use drm_of_find_panel_or_bridge
  drm: sun4i: dsi: Add bridge support
  drm: sun4i: dsi: Convert to bridge driver
  [DO NOT MERGE] ARM: dts: sun8i: bananapi-m2m: Enable S070WV20-CT16 panel

 arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts |  85 
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c   | 100 +--
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h   |   8 +-
 3 files changed, 160 insertions(+), 33 deletions(-)

-- 
2.25.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20210322140152.101709-1-jagan%40amarulasolutions.com.


[linux-sunxi] Re: [PATCH v2 16/19] video: sunxi: de2: switch clock setup to DM model

2021-03-08 Thread Jagan Teki
On Sun, Mar 7, 2021 at 1:25 AM Jernej Skrabec  wrote:
>
> Now that proper DM clock and reset driver exists for Display Engine 2
> and 3, remove all clock and reset related code and use appropriate
> framework instead.
>
> Signed-off-by: Jernej Skrabec 
> ---

Reviewed-by: Jagan Teki 

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CAMty3ZD_1q4HpNqQ5DhWgQqmC6qH0tHc9w7kOu7P%2ByrA9UnMyA%40mail.gmail.com.


[linux-sunxi] Re: [PATCH v2 14/19] clk: sunxi: Add DE2 and HDMI clocks to H3 and A64

2021-03-08 Thread Jagan Teki
On Sun, Mar 7, 2021 at 1:25 AM Jernej Skrabec  wrote:
>
> These clocks and resets are needed for video drivers.
>
> Cc: Lukasz Majewski 
> Signed-off-by: Jernej Skrabec 
> ---

Reviewed-by: Jagan Teki 

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CAMty3ZBjgb%2BjOZzPCkhfBc_ekiur6MvuALAvM0-iDYjN%3D51w1w%40mail.gmail.com.


[linux-sunxi] Re: [PATCH v2 15/19] clk: sunxi: add DE2 clock driver

2021-03-07 Thread Jagan Teki
On Sun, Mar 7, 2021 at 1:25 AM Jernej Skrabec  wrote:
>
> Video driver currently manages clocks and resets by directly writing to
> registers. This is already a bit messy because each SoC has some
> specifics. It's much better to implement proper clock and reset driver
> which takes information from device tree file.
>
> Note that this driver is not perfect yet. It still sets PLL and parent
> by hand. Sunxi clock framework still doesn't know how to set parents or
> rates. However, this is already big step in right direction.
>
> Cc: Lukasz Majewski 
> Signed-off-by: Jernej Skrabec 
> ---

Reviewed-by: Jagan Teki 

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CAMty3ZB1y_Sa-6hu3m1uvAe6oAXDNmnQ43xg8_DeARLFDderiQ%40mail.gmail.com.


[linux-sunxi] Re: [PATCH v2 18/19] video: sunxi: Add DW HDMI PHY driver

2021-03-07 Thread Jagan Teki
On Sun, Mar 7, 2021 at 1:25 AM Jernej Skrabec  wrote:
>
> This commit adds standalone driver for DW HDMI PHY. It deprecates code
> which is included in sunxi dw-hdmi platform driver.
>
> Signed-off-by: Jernej Skrabec 
> ---
>  arch/arm/mach-sunxi/Kconfig |   1 +
>  drivers/video/sunxi/Makefile|   2 +-
>  drivers/video/sunxi/sunxi_dw_hdmi_phy.c | 423 
>  drivers/video/sunxi/sunxi_dw_hdmi_phy.h |  24 ++

Would be good if this PHY management code handles via drivers/phy.
Hope this would possible?

Jagan.

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CAMty3ZCWE8Q3m3Zu98-i_HzZSwbGqAO6ATojSjgiAyoBqQgyBw%40mail.gmail.com.


[linux-sunxi] Re: [PATCH] sunxi: Add arm64 FEL support

2020-12-07 Thread Jagan Teki
On Thu, Nov 19, 2020 at 4:24 PM Andre Przywara  wrote:
>
> So far we did not support the BootROM based FEL USB debug mode on the
> 64-bit builds for Allwinner SoCs: The BootROM is using AArch32, but the
> SPL runs in AArch64.
> Returning back to AArch32 was not working as expected, since the RMR
> reset into 32-bit mode always starts execution in the BootROM, but not
> in the FEL routine.
>
> After some debug and research and with help via IRC, the CPU hotplug
> mechanism emerged as a solution: If a certain R_CPUCFG register contains
> some magic, the BootROM will immediately branch to an address stored in
> some other register. This works well for our purposes.
>
> Enable the FEL feature by providing early AArch32 code to first save the
> FEL state, *before* initially entering AArch64.
> If we eventually determine that we should return to FEL, we reset back
> into AArch32, and use the CPU hotplug mechanism to run some small
> AArch32 code snippet that restores the initially saved FEL state.
>
> That allows the normal AArch64 SPL build to be loaded via the sunxi-fel
> tool, with it returning into FEL mode, so that other payloads can be
> transferred via FEL as well.
>
> Tested on A64, H5 and H6.
>
> Signed-off-by: Andre Przywara 
> ---

Acked-by: Jagan Teki 

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CAMty3ZCntuSMZkBRkY4QAAvFUbftHYGhF9mTLPoqemwpeKWXSA%40mail.gmail.com.


[linux-sunxi] Re: [PATCH v2 2/2] sunxi: Use mkimage for SPL boot image generation

2020-11-15 Thread Jagan Teki
On Wed, Nov 11, 2020 at 6:23 PM Andre Przywara  wrote:
>
> Switch the SPL boot image generation from using mksunxiboot to the new
> sunxi_egon format of mkimage.
>
> Verified to create identical results for all 152 Allwinner boards.
>
> Signed-off-by: Andre Przywara 
> Reviewed-by: Simon Glass 

Reviewed-by: Jagan Teki 

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CAMty3ZDGgWwbLuVL_h0ov9B-1caFopkzRH9FuWe%2Bn6UUW1gLfA%40mail.gmail.com.


[linux-sunxi] Re: [PATCH 0/6] Allwinner V3/S3 support + PineCube support

2020-10-28 Thread Jagan Teki
On Mon, Oct 26, 2020 at 7:46 PM Icenowy Zheng  wrote:
>
> This patchset tries to add support for Allwinner V3/S3 and Pine64
> PineCube to U-Boot.
>
> First 3 patches adds support for Allwinner V3/S3 to U-Boot by expanding
> the code of V3s and add compatible strings to individual drivers.
>
> Then a patch allows V3 series chips to utilize the AXP20x driver in
> U-Boot.
>
> Finally the device tree is synchorized from Linux v5.10-rc1 (which
> contains the PineCube DT) and PineCube defconfig is added.
>
> Icenowy Zheng (6):
>   sunxi: add V3/S3 support
>   sunxi: gpio: introduce compatible string for V3 GPIO
>   clk: sunxi: add compatible string for V3
>   sunxi: allow to use AXP20[39] attached to I2C0 on V3 series
>   sunxi: dts: sync Allwinner V3s-related DTs from Linux 5.10-rc1

Applied to u-boot-sunxi/master.

>   sunxi: add PineCube board

Jagan.

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CAMty3ZD4aHwar35AsoUiVn1-jG%3DKZn8cpayEC7aDa6o%2B4YrAbg%40mail.gmail.com.


[linux-sunxi] Re: [PATCH 6/6] sunxi: add PineCube board

2020-10-28 Thread Jagan Teki
On Mon, Oct 26, 2020 at 7:51 PM Icenowy Zheng  wrote:
>
> PineCube is an IP camera development kit released by Pine64.
>
> It comes with the following compoents:
>
> - A mainboard with Sochip S3 SoC, a 16MByte SPI Flash, AXP209 PMIC,
> a power-only microUSB connector, a USB Type-A connector, a 10/100Mbps
> Ethernet port and FPC connectors for camera and daughter board.
> - An OV5640-based camera module which is connected to the parallel CSI
> bus of the mainboard.
> - A daughterboard with several buttons, a SD slot, some IR LEDs, a
> microphone and a speaker connector.
>
> As the device tree is synchronized in a previous commit, just add
> MAINTAINER item and a defconfig.
>
> Signed-off-by: Icenowy Zheng 
> ---
>  board/sunxi/MAINTAINERS|  5 +
>  configs/pinecube_defconfig | 17 +
>  2 files changed, 22 insertions(+)
>  create mode 100644 configs/pinecube_defconfig
>
> diff --git a/board/sunxi/MAINTAINERS b/board/sunxi/MAINTAINERS
> index 1180b86db3..5c53b2c878 100644
> --- a/board/sunxi/MAINTAINERS
> +++ b/board/sunxi/MAINTAINERS
> @@ -440,6 +440,11 @@ M: Vasily Khoruzhick 
>  S: Maintained
>  F: configs/pinebook_defconfig
>
> +PINECUBE BOARD:
> +M: Icenowy Zheng 
> +S: Maintained
> +F: configs/pinecube_defconfig
> +
>  PINE64 BOARDS
>  M: Andre Przywara 
>  S: Maintained
> diff --git a/configs/pinecube_defconfig b/configs/pinecube_defconfig
> new file mode 100644
> index 00..107562ee49
> --- /dev/null
> +++ b/configs/pinecube_defconfig
> @@ -0,0 +1,17 @@
> +CONFIG_ARM=y
> +CONFIG_ARCH_SUNXI=y
> +CONFIG_SPL=y
> +CONFIG_MACH_SUN8I_V3S=y
> +CONFIG_SUNXI_DRAM_DDR3_1333=y
> +CONFIG_DRAM_CLK=504
> +CONFIG_DRAM_ODT_EN=y
> +CONFIG_I2C0_ENABLE=y
> +CONFIG_DEFAULT_DEVICE_TREE="sun8i-s3-pinecube"
> +CONFIG_SPL_I2C_SUPPORT=y
> +# CONFIG_NETDEVICES is not set
> +CONFIG_AXP209_POWER=y
> +CONFIG_AXP_DCDC2_VOLT=1250
> +CONFIG_AXP_DCDC3_VOLT=3300
> +CONFIG_AXP_ALDO3_VOLT_SLOPE_08=y
> +CONFIG_AXP_ALDO3_INRUSH_QUIRK=y

All these AXP enablements start from AXP209_POWER to the respective dc
and load values are selected from drivers/power/Kconfig itself. Please
check it.

Jagan.

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CAMty3ZDCOdOMNc4-S6z94UE397xV-Bu-z71BTKP-Uww1wrKznA%40mail.gmail.com.


[linux-sunxi] Re: [PATCH v2 3/3] video: sunxi_display: Convert to DM_VIDEO

2020-06-18 Thread Jagan Teki
On Thu, Jun 18, 2020 at 12:54 PM Maxime Ripard  wrote:
>
> On Thu, Jun 18, 2020 at 01:54:37AM +0530, Jagan Teki wrote:
> > DM_VIDEO migration deadline is already expired, but around
> > 80 Allwinner boards are still using video in a legacy way.
> >
> > = WARNING ==
> > This board does not use CONFIG_DM_VIDEO Please update
> > the board to use CONFIG_DM_VIDEO before the v2019.07 release.
> > Failure to update by the deadline may result in board removal.
> > See doc/driver-model/migration.rst for more info.
> > 
> >
> > So let's live these boards on the tree before the video maintainer
> > removes it by converting in to DM_VIDEO.
> >
> > Tested in Bananapi M1+ Plus 1920x1200 HDMI out.
> >
> > Signed-off-by: Jagan Teki 
> > ---
> > Changes for v2:
> > - add BMP support
> >
> >  arch/arm/mach-sunxi/Kconfig |   4 +-
> >  drivers/video/sunxi/sunxi_display.c | 264 
> >  include/configs/sunxi-common.h  |  17 --
> >  scripts/config_whitelist.txt|   1 -
> >  4 files changed, 157 insertions(+), 129 deletions(-)
> >
> > diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
> > index be0822bfb7..7d2fb55ff0 100644
> > --- a/arch/arm/mach-sunxi/Kconfig
> > +++ b/arch/arm/mach-sunxi/Kconfig
> > @@ -758,8 +758,10 @@ config VIDEO_SUNXI
> >   depends on !MACH_SUN9I
> >   depends on !MACH_SUN50I
> >   depends on !MACH_SUN50I_H6
> > - select VIDEO
> > + select DM_VIDEO
> > + select DISPLAY
> >   imply VIDEO_DT_SIMPLEFB
> > + imply CMD_BMP
> >   default y
> >   ---help---
> >   Say Y here to add support for using a cfb console on the HDMI, LCD
> > diff --git a/drivers/video/sunxi/sunxi_display.c 
> > b/drivers/video/sunxi/sunxi_display.c
> > index f52aba4d21..fb51b0c5ba 100644
> > --- a/drivers/video/sunxi/sunxi_display.c
> > +++ b/drivers/video/sunxi/sunxi_display.c
> > @@ -7,6 +7,8 @@
> >   */
> >
> >  #include 
> > +#include 
> > +#include 
> >  #include 
> >  #include 
> >  #include 
> > @@ -28,7 +30,9 @@
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> >  #include 
> > +#include 
> >  #include "../videomodes.h"
> >  #include "../anx9804.h"
> >  #include "../hitachi_tx18d42vm_lcd.h"
> > @@ -45,6 +49,13 @@
> >
> >  DECLARE_GLOBAL_DATA_PTR;
> >
> > +enum {
> > + /* Maximum LCD size we support */
> > + LCD_MAX_WIDTH   = 3840,
> > + LCD_MAX_HEIGHT  = 2160,
> > + LCD_MAX_LOG2_BPP= VIDEO_BPP32,
> > +};
>
> Why is that an enum? Those three values don't have any relationship with
> each other.

Not sure I understand your question. These are maximum resolution
followed by maximum bpp supporting. based on these the fbbuffer
allocation happens, please see sunxi_de_bind on this patch.

>
> >  enum sunxi_monitor {
> >   sunxi_monitor_none,
> >   sunxi_monitor_dvi,
> > @@ -59,12 +70,11 @@ enum sunxi_monitor {
> >  #define SUNXI_MONITOR_LAST sunxi_monitor_composite_pal_nc
> >
> >  struct sunxi_display {
> > - GraphicDevice graphic_device;
> >   enum sunxi_monitor monitor;
> >   unsigned int depth;
> >   unsigned int fb_addr;
> >   unsigned int fb_size;
> > -} sunxi_display;
> > +};
>
> This looks unrelated?
>
> >  const struct ctfb_res_modes composite_video_modes[2] = {
> >   /*  x y  hz  pixclk ps/kHz   le   ri  up  lo   hs vs  s  vmode */
> > @@ -214,7 +224,8 @@ static int sunxi_hdmi_edid_get_block(int block, u8 *buf)
> >   return r;
> >  }
> >
> > -static int sunxi_hdmi_edid_get_mode(struct ctfb_res_modes *mode,
> > +static int sunxi_hdmi_edid_get_mode(struct sunxi_display *sunxi_display,
> > + struct ctfb_res_modes *mode,
> >   bool verbose_mode)
> >  {
> >   struct edid1_info edid1;
> > @@ -291,14 +302,14 @@ static int sunxi_hdmi_edid_get_mode(struct 
> > ctfb_res_modes *mode,
> >   }
> >
> >   /* Check for basic audio support, if found enable hdmi output */
> > - sunxi_display.monitor = sunxi_monitor_dvi;
> > + sunxi_display->monitor = sunxi_monitor_dvi;
> >   for (i = 0; i < ext_blocks; i++) {
> >   if (cea681[i].extension_

[linux-sunxi] [PATCH v2 2/3] sunxi: Enable splash screen support

2020-06-17 Thread Jagan Teki
Enable splash screen support for sunxi platforms.

The splash screen image, sunxi.bmp would load left corner
on screen in 0,0 splash position. This is default legacy
logo position on sunxi platform and also it would be common
practice to have at 0,0 since the default sunx.bmp is nominal
size.

Signed-off-by: Jagan Teki 
---
Changes for v2:
- new patch

 include/configs/sunxi-common.h | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index 5b0bec0561..308d7a42aa 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -270,6 +270,15 @@ extern int soft_i2c_gpio_scl;
 
 #endif /* CONFIG_VIDEO_SUNXI */
 
+#if CONFIG_IS_ENABLED(CMD_BMP)
+# define CONFIG_VIDEO_BMP_RLE8
+# define CONFIG_SPLASH_SCREEN
+# define CONFIG_SPLASH_SCREEN_ALIGN
+# define CONFIG_BMP_16BPP
+# define CONFIG_VIDEO_LOGO
+# define CONFIG_VIDEO_BMP_LOGO
+#endif
+
 /* Ethernet support */
 
 #ifdef CONFIG_USB_EHCI_HCD
@@ -475,6 +484,8 @@ extern int soft_i2c_gpio_scl;
 #endif
 
 #define CONSOLE_ENV_SETTINGS \
+   "splashpos=0,0\0" \
+   "splashimage=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \
CONSOLE_STDIN_SETTINGS \
CONSOLE_STDOUT_SETTINGS
 
-- 
2.25.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20200617202437.301108-3-jagan%40amarulasolutions.com.


[linux-sunxi] [PATCH v2 3/3] video: sunxi_display: Convert to DM_VIDEO

2020-06-17 Thread Jagan Teki
DM_VIDEO migration deadline is already expired, but around
80 Allwinner boards are still using video in a legacy way.

= WARNING ==
This board does not use CONFIG_DM_VIDEO Please update
the board to use CONFIG_DM_VIDEO before the v2019.07 release.
Failure to update by the deadline may result in board removal.
See doc/driver-model/migration.rst for more info.


So let's live these boards on the tree before the video maintainer
removes it by converting in to DM_VIDEO.

Tested in Bananapi M1+ Plus 1920x1200 HDMI out.

Signed-off-by: Jagan Teki 
---
Changes for v2:
- add BMP support

 arch/arm/mach-sunxi/Kconfig |   4 +-
 drivers/video/sunxi/sunxi_display.c | 264 
 include/configs/sunxi-common.h  |  17 --
 scripts/config_whitelist.txt|   1 -
 4 files changed, 157 insertions(+), 129 deletions(-)

diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
index be0822bfb7..7d2fb55ff0 100644
--- a/arch/arm/mach-sunxi/Kconfig
+++ b/arch/arm/mach-sunxi/Kconfig
@@ -758,8 +758,10 @@ config VIDEO_SUNXI
depends on !MACH_SUN9I
depends on !MACH_SUN50I
depends on !MACH_SUN50I_H6
-   select VIDEO
+   select DM_VIDEO
+   select DISPLAY
imply VIDEO_DT_SIMPLEFB
+   imply CMD_BMP
default y
---help---
Say Y here to add support for using a cfb console on the HDMI, LCD
diff --git a/drivers/video/sunxi/sunxi_display.c 
b/drivers/video/sunxi/sunxi_display.c
index f52aba4d21..fb51b0c5ba 100644
--- a/drivers/video/sunxi/sunxi_display.c
+++ b/drivers/video/sunxi/sunxi_display.c
@@ -7,6 +7,8 @@
  */
 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -28,7 +30,9 @@
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
 #include "../videomodes.h"
 #include "../anx9804.h"
 #include "../hitachi_tx18d42vm_lcd.h"
@@ -45,6 +49,13 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+enum {
+   /* Maximum LCD size we support */
+   LCD_MAX_WIDTH   = 3840,
+   LCD_MAX_HEIGHT  = 2160,
+   LCD_MAX_LOG2_BPP= VIDEO_BPP32,
+};
+
 enum sunxi_monitor {
sunxi_monitor_none,
sunxi_monitor_dvi,
@@ -59,12 +70,11 @@ enum sunxi_monitor {
 #define SUNXI_MONITOR_LAST sunxi_monitor_composite_pal_nc
 
 struct sunxi_display {
-   GraphicDevice graphic_device;
enum sunxi_monitor monitor;
unsigned int depth;
unsigned int fb_addr;
unsigned int fb_size;
-} sunxi_display;
+};
 
 const struct ctfb_res_modes composite_video_modes[2] = {
/*  x y  hz  pixclk ps/kHz   le   ri  up  lo   hs vs  s  vmode */
@@ -214,7 +224,8 @@ static int sunxi_hdmi_edid_get_block(int block, u8 *buf)
return r;
 }
 
-static int sunxi_hdmi_edid_get_mode(struct ctfb_res_modes *mode,
+static int sunxi_hdmi_edid_get_mode(struct sunxi_display *sunxi_display,
+   struct ctfb_res_modes *mode,
bool verbose_mode)
 {
struct edid1_info edid1;
@@ -291,14 +302,14 @@ static int sunxi_hdmi_edid_get_mode(struct ctfb_res_modes 
*mode,
}
 
/* Check for basic audio support, if found enable hdmi output */
-   sunxi_display.monitor = sunxi_monitor_dvi;
+   sunxi_display->monitor = sunxi_monitor_dvi;
for (i = 0; i < ext_blocks; i++) {
if (cea681[i].extension_tag != EDID_CEA861_EXTENSION_TAG ||
cea681[i].revision < 2)
continue;
 
if (EDID_CEA861_SUPPORTS_BASIC_AUDIO(cea681[i]))
-   sunxi_display.monitor = sunxi_monitor_hdmi;
+   sunxi_display->monitor = sunxi_monitor_hdmi;
}
 
return 0;
@@ -414,9 +425,9 @@ static void sunxi_frontend_mode_set(const struct 
ctfb_res_modes *mode,
 static void sunxi_frontend_enable(void) {}
 #endif
 
-static bool sunxi_is_composite(void)
+static bool sunxi_is_composite(enum sunxi_monitor monitor)
 {
-   switch (sunxi_display.monitor) {
+   switch (monitor) {
case sunxi_monitor_none:
case sunxi_monitor_dvi:
case sunxi_monitor_hdmi:
@@ -473,7 +484,8 @@ static const u32 sunxi_rgb2yuv_coef[12] = {
 };
 
 static void sunxi_composer_mode_set(const struct ctfb_res_modes *mode,
-   unsigned int address)
+   unsigned int address,
+   enum sunxi_monitor monitor)
 {
struct sunxi_de_be_reg * const de_be =
(struct sunxi_de_be_reg *)SUNXI_DE_BE0_BASE;
@@ -502,7 +514,7 @@ static void sunxi_composer_mode_set(const struct 
ctfb_res_modes *mode,
 #endif
 SUNXI_DE_BE_MODE_INTERLACE_ENABLE);
 
-   if (sunxi_is_composite()) {
+   if (sunxi_is_composite(monitor)) {
w

[linux-sunxi] [PATCH v2 1/3] logos: Add sunxi logo

2020-06-17 Thread Jagan Teki
Add sunxi logo which would be used for splash screen support.

The original images were the crapped version from linux-sunxi.org
and generated using below step

$ convert sunxi.jpg -type Palette -colors 224 -depth 8 \
-compress none -verbose BMP3:tools/logos/sunxi.bmp

Signed-off-by: Jagan Teki 
---
Changes for v2:
- new patch

 tools/logos/sunxi.bmp | Bin 0 -> 11018 bytes
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 tools/logos/sunxi.bmp

diff --git a/tools/logos/sunxi.bmp b/tools/logos/sunxi.bmp
new file mode 100644
index 
..87dfea0c4fe2c7cf805e042cb20e54c1481b02c6
GIT binary patch
literal 11018
zcmeHNduUV55+5JO$5G?a_=q7y6Jiau#u}U3P-{&>jiIrmgxW$vsv(3EN(d!2h9D6m
zkppr?5fnu94-rH}K@da~K}12sKg6pb3W|sbqWHk~>(1<+lP@Y?8^3b@xR9wiXLfdW
z=C`x6vzwr=TU-i^{xuQ6j@-ZTvkpJwU<#A}r-8lrV;t*X{J3%BVEp*;Fk!+3m^g7F
z2!a5UCQX9LlPANJDN|tT)TuCS+B6VF5vEU{4l`!VfSEIAf+R^WYt}57J$p9j^?H~y
zXAaDrI~V57n+Nmf$)c1e3`GX0sU8}{tk
z1AF)Gg?;<>!T$aG;lP0daPZ(kICSU`96o#)jvP4xM~@zbO7>xdK19$JjUSA^^041G1PB2kod+$Re4-e9;t
zYyewgxU7^1Z73pTgNzWAfDUv?e8;PQ1E{j}=d8|Xvl?}kafY@~B<5%6FiD+RrC1)e
zfWD(h-hC3&({<#qQD{M2h@~vkj}$f1Pt(RRyiHG?BhVjDB;|NKVB^~Z%)RI*CZZB5
zSo+HZ0q1QRATHm+T$*TQ${`bK#F0xoY6PNs7EKKfce}gYY2#C4c=VoBNnzfUVx*OK
znEOhKl2qf=f;@V~d5cYh#74~ovX$X#Bm^-OW}9opLVAL(B{V>BRdUhxO4jSUn25wk
z`F2tSV+dCx%@aoI;$3Xs0a~R}2$gJ6#8Qmt$#NeGaj|M841v_0=T`AqOjub^Kpz;c
z2#JZaW!L))I8z=M=O7On^JVHKrIbSi7M8Sw>GYti+*?N_K6vs0kK%AutD
zLw!TkS?(f}dLP2h8kqH4TN*brT)J#0rmBJ+cCrIV$GV2n`^GAukjC?YIgvhA%A
z2>!~*LOs~bygFqZTMVEfdjh#^8^VL_(q*+{t?=S2+!YaCZ3
zLuEz83@8Le2PI|P2tgbm)4pS5WK+RitX-e1bO=PW?9tRleiIh6FUAWg6$h|WCL|;^
z_?9SQ8N#vxIvICQNY8S-8w&{5q>Mw=;@O7dhUf?)o2Cf123W<$*2qNqEGCk}KcMY`
zkRD|=vXV5ZmlsnX`pnWrL`00mUN`looVf3B&@jG<1W?1GD0rtqv$$wEW=b*M7$@Iq64&-1DMP0$P}~#r&~D%Vuq+Lh56QYNJ9|aN>Q75?vW|Es>w4t7~qF}zMFO|hoW=UxPulWKys1&)8bZ`I_kY0?D
zElMNl^dM?U%1OBwbI020_j+rrb(9%yj7ur*Fq%vjKOHkAw*Cz`qY}T(qj8C_r0`%7
zY_t{?r_iMolpe(5PGmDfeVSLPp}EOs!Swo5Y9IhgKG7e?Z=y(a2f?Jhi!IO%AU
zWT*_AY3B^PNla074}?Q4sAY3Bm<+heBpU-s0ZJ03T%@%{;^o4UMPP$!xe+9+X*rpy
zo8;{c`uXlBzmmzI$Fc)DQJ_^uZVYH}D#jkQ*ddT|+RsC4No0pJR6Ut(vDxi*IdJ}1
zJ}d?;S{28?`~O{1W3(*6be@){n9D@*{>Vsb?dWjRX-K45t~9F_L+ewuu*o|a!-xOT
zQ?Li3@}S)BZ>F+=RB_7rignhhJxEFWRB`H9P3w=}f~3R$&!7`oJ<*KeTVt!aDg?iD
zYfbI_$1tkgFdM3*;%$VkUo`8@dIahbs7Ih4fqDe$5vWJt|1Sdn1vprt
AKL7v#

literal 0
HcmV?d1

-- 
2.25.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20200617202437.301108-2-jagan%40amarulasolutions.com.


[linux-sunxi] [PATCH v2 0/3] video: sunxi: Convert DM_VIDEO

2020-06-17 Thread Jagan Teki
These series supports DM_VIDEO conversation for missing 
sunxi platforms. Separate splash screen support is required 
since the video log support in legacy drivers are not 
supporting with driver mode video.

Dependencies:
http://patchwork.ozlabs.org/project/uboot/list/?series=182476
http://patchwork.ozlabs.org/project/uboot/list/?series=182477
http://patchwork.ozlabs.org/project/uboot/list/?series=182478

Changes for v2:
- new splash screen support patches

Any inputs?
Jagan.

Jagan Teki (3):
  logos: Add sunxi logo
  sunxi: Enable splash screen support
  video: sunxi_display: Convert to DM_VIDEO

 arch/arm/mach-sunxi/Kconfig |   4 +-
 drivers/video/sunxi/sunxi_display.c | 264 
 include/configs/sunxi-common.h  |  26 ++-
 scripts/config_whitelist.txt|   1 -
 tools/logos/sunxi.bmp   | Bin 0 -> 11018 bytes
 5 files changed, 167 insertions(+), 128 deletions(-)
 create mode 100644 tools/logos/sunxi.bmp

-- 
2.25.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20200617202437.301108-1-jagan%40amarulasolutions.com.


[linux-sunxi] [PATCH] video: sunxi_display: Convert to DM_VIDEO

2020-06-16 Thread Jagan Teki
DM_VIDEO migration deadline is already expired, but around
80 Allwinner boards are still using video in a legacy way.

= WARNING ==
This board does not use CONFIG_DM_VIDEO Please update
the board to use CONFIG_DM_VIDEO before the v2019.07 release.
Failure to update by the deadline may result in board removal.
See doc/driver-model/migration.rst for more info.


So let's live these boards on the tree before the video maintainer
removes it by converting in to DM_VIDEO.

Tested in Bananapi M1+ Plus 1920x1200 HDMI out.

Cc: Maxime Ripard 
Signed-off-by: Jagan Teki 
---
Note: Existing video log would break since the similar
configuration of cfb_console will not build for DM_VIDEO.
Will try to send the splashscreen, in next version or the
next patches.

 arch/arm/mach-sunxi/Kconfig |   3 +-
 drivers/video/sunxi/sunxi_display.c | 264 
 include/configs/sunxi-common.h  |   7 -
 scripts/config_whitelist.txt|   1 -
 4 files changed, 156 insertions(+), 119 deletions(-)

diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
index be0822bfb7..4fd31f7d61 100644
--- a/arch/arm/mach-sunxi/Kconfig
+++ b/arch/arm/mach-sunxi/Kconfig
@@ -758,7 +758,8 @@ config VIDEO_SUNXI
depends on !MACH_SUN9I
depends on !MACH_SUN50I
depends on !MACH_SUN50I_H6
-   select VIDEO
+   select DM_VIDEO
+   select DISPLAY
imply VIDEO_DT_SIMPLEFB
default y
---help---
diff --git a/drivers/video/sunxi/sunxi_display.c 
b/drivers/video/sunxi/sunxi_display.c
index f52aba4d21..fb51b0c5ba 100644
--- a/drivers/video/sunxi/sunxi_display.c
+++ b/drivers/video/sunxi/sunxi_display.c
@@ -7,6 +7,8 @@
  */
 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -28,7 +30,9 @@
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
 #include "../videomodes.h"
 #include "../anx9804.h"
 #include "../hitachi_tx18d42vm_lcd.h"
@@ -45,6 +49,13 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+enum {
+   /* Maximum LCD size we support */
+   LCD_MAX_WIDTH   = 3840,
+   LCD_MAX_HEIGHT  = 2160,
+   LCD_MAX_LOG2_BPP= VIDEO_BPP32,
+};
+
 enum sunxi_monitor {
sunxi_monitor_none,
sunxi_monitor_dvi,
@@ -59,12 +70,11 @@ enum sunxi_monitor {
 #define SUNXI_MONITOR_LAST sunxi_monitor_composite_pal_nc
 
 struct sunxi_display {
-   GraphicDevice graphic_device;
enum sunxi_monitor monitor;
unsigned int depth;
unsigned int fb_addr;
unsigned int fb_size;
-} sunxi_display;
+};
 
 const struct ctfb_res_modes composite_video_modes[2] = {
/*  x y  hz  pixclk ps/kHz   le   ri  up  lo   hs vs  s  vmode */
@@ -214,7 +224,8 @@ static int sunxi_hdmi_edid_get_block(int block, u8 *buf)
return r;
 }
 
-static int sunxi_hdmi_edid_get_mode(struct ctfb_res_modes *mode,
+static int sunxi_hdmi_edid_get_mode(struct sunxi_display *sunxi_display,
+   struct ctfb_res_modes *mode,
bool verbose_mode)
 {
struct edid1_info edid1;
@@ -291,14 +302,14 @@ static int sunxi_hdmi_edid_get_mode(struct ctfb_res_modes 
*mode,
}
 
/* Check for basic audio support, if found enable hdmi output */
-   sunxi_display.monitor = sunxi_monitor_dvi;
+   sunxi_display->monitor = sunxi_monitor_dvi;
for (i = 0; i < ext_blocks; i++) {
if (cea681[i].extension_tag != EDID_CEA861_EXTENSION_TAG ||
cea681[i].revision < 2)
continue;
 
if (EDID_CEA861_SUPPORTS_BASIC_AUDIO(cea681[i]))
-   sunxi_display.monitor = sunxi_monitor_hdmi;
+   sunxi_display->monitor = sunxi_monitor_hdmi;
}
 
return 0;
@@ -414,9 +425,9 @@ static void sunxi_frontend_mode_set(const struct 
ctfb_res_modes *mode,
 static void sunxi_frontend_enable(void) {}
 #endif
 
-static bool sunxi_is_composite(void)
+static bool sunxi_is_composite(enum sunxi_monitor monitor)
 {
-   switch (sunxi_display.monitor) {
+   switch (monitor) {
case sunxi_monitor_none:
case sunxi_monitor_dvi:
case sunxi_monitor_hdmi:
@@ -473,7 +484,8 @@ static const u32 sunxi_rgb2yuv_coef[12] = {
 };
 
 static void sunxi_composer_mode_set(const struct ctfb_res_modes *mode,
-   unsigned int address)
+   unsigned int address,
+   enum sunxi_monitor monitor)
 {
struct sunxi_de_be_reg * const de_be =
(struct sunxi_de_be_reg *)SUNXI_DE_BE0_BASE;
@@ -502,7 +514,7 @@ static void sunxi_composer_mode_set(const struct 
ctfb_res_modes *mode,
 #endif
 SUNXI_DE_BE_MODE_INTERLACE_ENABLE);
 
-   if (sunxi_is_composite()

[linux-sunxi] Re: [PATCH] phy: sun4i-usb: Align H6 initialization logic with the kernel

2020-06-01 Thread Jagan Teki
On Wed, May 13, 2020 at 2:22 AM Roman Stratiienko
 wrote:
>
> H6 SOC needs additional initialization of PHY registers. Corresponding
> changes can be found in the kernel patch [1].
>
> Without this changes there is no enumeration of 'musb' gadget.
>
> [1] - 
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ae409cc7c3cdb9ac4a1dba3eae70efec3d6b6c79
>
> Fixes: 35fa673e0e5f ("sunxi: phy: Add USB PHY support for Allwinner H6")
> Signed-off-by: Roman Stratiienko 
> ---

Applied to u-boot-sunxi/master

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CAMty3ZBasHXYcHqwJGgDaBsnki7PS8FcvA%2BOr5_N2ZcmS9AF7w%40mail.gmail.com.


[linux-sunxi] Re: [PATCH v2 0/5] sunxi: SPL SPI booting: Enable R40 and H6 SoCs

2020-03-18 Thread Jagan Teki
On Tue, Jan 28, 2020 at 6:17 AM Andre Przywara  wrote:
>
> This series enables the SPI booting feature for Allwinner R40 and H6
> SoCs. To achieve this, we enable our spl_spi_sunxi.c driver to deal
> with those two SoCs. The R40 is pretty straightforward, as it just needs
> its base address adjusted. This is prepared in patch 1/5 and finalised
> in patch 3/5.
> For the H6, on top of yet another different base address, the new clocks
> and slightly different pinmux setup need to be cared for.
> Patch 2/5 and 4/5 take care of that.
> Patch 5/5 enables this feature for the Pine H64 board, which comes with
> soldered SPI flash.
>
> This has been tested on the Pine H64 board and a Bananapi M2 Berry
> (with SPI flash connected to the SPI0-PortC header pins).
> For the existing SPI boot platforms this does not change the code size,
> as the toolchain is clever enough to optimise this properly.
>
> There is a similar series to enable SPI support for the sunxi-fel tool,
> which was used to test this:
> https://github.com/linux-sunxi/sunxi-tools/pull/129
>
> Cheers,
> Andre.
>
> Changelog v1 .. v2:
> - Drop already merged patch 1/6
> - rename is_new_gen_spi() to is_sun6i_gen_spi()

Applied to u-boot-sunxi/master

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CAMty3ZDs610QQC_qqnY5u2egOmCSw5FXRKPFwuTOzRwRuRuOZw%40mail.gmail.com.


[linux-sunxi] Re: [PATCH 3/6] sunxi: SPL SPI: Introduce is_new_gen_spi()

2020-01-27 Thread Jagan Teki
On Mon, Jan 27, 2020 at 6:59 AM André Przywara  wrote:
>
> On 21/01/2020 08:20, Jagan Teki wrote:
>
> Hi Jagan,
>
> first: many thanks for merging those other patches of mine, much
> appreciated!
>
> > On Mon, Jan 6, 2020 at 6:59 AM Andre Przywara  
> > wrote:
> >>
> >> So far we were using the CONFIG_SUNXI_GEN_SUN6I symbol to select between
> >> the two SPI controller generations used on Allwinner SoCs. This is a
> >> convenience symbol to roughly differentiate between "older" and "newer"
> >> generation of SoCs.
> >>
> >> The H6 SoCs is the newest SoC so far, but is sufficiently different to
> >> not define this symbol. However it is using a SPI controller compatible
> >> to the "new gen" SoCs.
> >>
> >> To prepare for H6 support, we replace the check for this single symbol
> >> with an explicit function, which can later be extended.
> >> For now we just return CONFIG_SUNXI_GEN_SUN6I in there, so this does not
> >> create a functional change.
> >>
> >> Signed-off-by: Andre Przywara 
> >> ---
> >>  arch/arm/mach-sunxi/spl_spi_sunxi.c | 22 ++
> >>  1 file changed, 14 insertions(+), 8 deletions(-)
> >>
> >> diff --git a/arch/arm/mach-sunxi/spl_spi_sunxi.c 
> >> b/arch/arm/mach-sunxi/spl_spi_sunxi.c
> >> index 5b4598a25b..b19f1bf4af 100644
> >> --- a/arch/arm/mach-sunxi/spl_spi_sunxi.c
> >> +++ b/arch/arm/mach-sunxi/spl_spi_sunxi.c
> >> @@ -100,9 +100,14 @@ static void spi0_pinmux_setup(unsigned int 
> >> pin_function)
> >> sunxi_gpio_set_cfgpin(SUNXI_GPC(3), pin_function);
> >>  }
> >>
> >> +static bool is_new_gen_spi(void)
> >> +{
> >> +   return IS_ENABLED(CONFIG_SUNXI_GEN_SUN6I);
> >> +}
> >
> > Doesn't it confusing? new gen is H6, but it returns 6I?
>
> Well, naming ...
> For the purpose of U-Boot there are two generations of SPI controller
> *register interfaces*, the "old" one used in the older SoCs like the
> A20, and the "newer" one used in everything halfway recent. The H6 uses
> the same "new" generation, just at a different address. Yes, it adds
> quad-SPI, but this is not relevant for this driver.
> I have seen this old/new terminology at different places, so just went
> with it.
> I could rename it to is_spi_sun6i_gen() or something if that makes you
> happy...

Please do, would be great if you can send the new changes as soon as
possible so-that I can send PR for the rc1.

Jagan.

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CAMty3ZAdchUNb9qX-XagucRMRM_oEGKuorJ5xL62ocrtxyu%2Bnw%40mail.gmail.com.


[linux-sunxi] Re: [PATCH 0/2] sunxi: Support automated booting from 128KB

2020-01-26 Thread Jagan Teki
On Fri, Jan 10, 2020 at 7:17 AM Andre Przywara  wrote:
>
> The Allwinner Boot ROM on all later SoCs can load the initial SPL code
> from offset 128KB or from offset 8KB of an SD card or eMMC.
> We support this in the SPL for a while now, but so far needed to manually
> adjust the U-Boot image MMC load sector during compile time.
>
> Since the Boot ROM writes a different boot source ID into the SRAM when
> loaded from the higher offset, we can check this value and dynamically
> adjust the raw MMC load sector for the U-Boot proper image.
>
> This allows to generate *one* image file, which can be written to either
> offset 8KB or to offset 128KB. The latter has the advantange of not
> overlapping with a standard GPT partition table.
>
> Tested on Bananapi M2 Berry (R40), Orangepi Zero (H2+), Orangepi PC 2 (H5),
> Pine64-LTS (A64), Bananapi-M64 (A64, both SD card and eMMC) and
> Pine H64 (H6), on all boards writing the same image to both 8K and 128K.
>
> Cheers,
> Andre.
>
> Andre Przywara (2):
>   sunxi: SPL: Factor out sunxi_get_boot_source()
>   sunxi: Automate loading from 128KB MMC offset

Applied to u-boot-sunxi/master

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CAMty3ZDcoOMdn%3D%2BQyfuRw_HdU7sJYBuK0SR7BQuss8eAhcTi-g%40mail.gmail.com.


[linux-sunxi] Re: [PATCH 0/4] sunxi: R40: Enable USB and Ethernet

2020-01-24 Thread Jagan Teki
On Thu, Jan 2, 2020 at 5:15 AM Andre Przywara  wrote:
>
> This series enables the USB ports on boards with the Allwinner R40 SoC,
> also updates the Bananapi M2 Berry board support.
> Patch 1/4 updates the M2 Berry .dts file, so that we get the USB and
> Ethernet nodes that we need to enable Ethernet in patch 2/4.
> Patch 3/4 adds support for the USB PHY in the R40 SoC, so that the final
> patch can enable USB for the two R40 boards that U-Boot supports.
>
> Tested on the Bananapi M2 Berry. I don't have the M2 Ultra, but USB
> should work there with this series too. Ethernet was already enabled.
>
> Cheers,
> Andre.
>
> Andre Przywara (4):
>   sunxi: dts: R40: Update Bananapi M2 Berry .dts
>   sunxi: defconfig: Bananapi M2 Berry: enable Ethernet
>   phy: sun4i-usb: Add Allwinner R40 support
>   sunxi: defconfig: R40 boards: enable USB
>
>  arch/arm/dts/sun8i-v40-bananapi-m2-berry.dts | 135 
> ---
>  arch/arm/mach-sunxi/Kconfig  |   1 +
>  configs/Bananapi_M2_Ultra_defconfig  |   4 +
>  configs/bananapi_m2_berry_defconfig  |   6 ++
>  drivers/phy/allwinner/phy-sun4i-usb.c|  12 +++
>  5 files changed, 143 insertions(+), 15 deletions(-)

Applied all to u-boot-sunxi/master

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CAMty3ZCgqRjM1BH0Ew1B7b3spisdN4%3Dn0_paWtucg1s%2B1u6PRw%40mail.gmail.com.


[linux-sunxi] Re: [PATCH 1/6] sunxi: move CONFIG_SYS_SPI_U_BOOT_OFFS out of defconfig

2020-01-24 Thread Jagan Teki
On Mon, Jan 6, 2020 at 6:59 AM Andre Przywara  wrote:
>
> For Allwinner SoCs the CONFIG_SYS_SPI_U_BOOT_OFFS value is not really a
> board choice: The boot ROM only loads the SPL from offset 0 of the SPI
> NOR flash, and loads at most 32KB. This is a similar situation as on MMC,
> so consequently we create our "joint" image (SPL + U-Boot proper) with
> that 32KB offset during the build.
>
> So define the value of this symbol to be 32KB by default for every
> Allwinner SoC. This removes the definition of this symbol from the
> _defconfig files, and avoids every board to define this over and over
> again.
>
> Signed-off-by: Andre Przywara 
> ---

Applied to u-boot-sunxi/master

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CAMty3ZCkhKWq_Tm_-TB5ths%2BHge0u2DJ0yonU2Au8uDP47X2%3Dg%40mail.gmail.com.


[linux-sunxi] Re: [PATCH 1/4] sunxi: dts: R40: Update Bananapi M2 Berry .dts

2020-01-21 Thread Jagan Teki
On Thu, Jan 2, 2020 at 5:15 AM Andre Przywara  wrote:
>
> Update the .dts file from the kernel, which carries much more nodes,
> some of them we need to enable USB and Ethernet support for the board.
>
> Signed-off-by: Andre Przywara 
> ---

Would be better to have all R40 files to sync at the same time?

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CAMty3ZCJDj9sMDde6_3ninEr8KyT8zFr_UV9oW_geosHkJ2Obg%40mail.gmail.com.


[linux-sunxi] Re: [PATCH 3/6] sunxi: SPL SPI: Introduce is_new_gen_spi()

2020-01-21 Thread Jagan Teki
On Mon, Jan 6, 2020 at 6:59 AM Andre Przywara  wrote:
>
> So far we were using the CONFIG_SUNXI_GEN_SUN6I symbol to select between
> the two SPI controller generations used on Allwinner SoCs. This is a
> convenience symbol to roughly differentiate between "older" and "newer"
> generation of SoCs.
>
> The H6 SoCs is the newest SoC so far, but is sufficiently different to
> not define this symbol. However it is using a SPI controller compatible
> to the "new gen" SoCs.
>
> To prepare for H6 support, we replace the check for this single symbol
> with an explicit function, which can later be extended.
> For now we just return CONFIG_SUNXI_GEN_SUN6I in there, so this does not
> create a functional change.
>
> Signed-off-by: Andre Przywara 
> ---
>  arch/arm/mach-sunxi/spl_spi_sunxi.c | 22 ++
>  1 file changed, 14 insertions(+), 8 deletions(-)
>
> diff --git a/arch/arm/mach-sunxi/spl_spi_sunxi.c 
> b/arch/arm/mach-sunxi/spl_spi_sunxi.c
> index 5b4598a25b..b19f1bf4af 100644
> --- a/arch/arm/mach-sunxi/spl_spi_sunxi.c
> +++ b/arch/arm/mach-sunxi/spl_spi_sunxi.c
> @@ -100,9 +100,14 @@ static void spi0_pinmux_setup(unsigned int pin_function)
> sunxi_gpio_set_cfgpin(SUNXI_GPC(3), pin_function);
>  }
>
> +static bool is_new_gen_spi(void)
> +{
> +   return IS_ENABLED(CONFIG_SUNXI_GEN_SUN6I);
> +}

Doesn't it confusing? new gen is H6, but it returns 6I?

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CAMty3ZAfZrA9-SV16hU7_eEBG83do2SHiJVd7UdA9ROfrH2wOA%40mail.gmail.com.


[linux-sunxi] Re: [PATCH v3 2/9] drm/sun4i: tcon: Add TCON LCD support for R40

2020-01-02 Thread Jagan Teki
On Thu, Jan 2, 2020 at 9:17 PM Maxime Ripard  wrote:
>
> On Thu, Jan 02, 2020 at 09:10:31PM +0530, Jagan Teki wrote:
> > On Thu, Jan 2, 2020 at 4:24 PM Maxime Ripard  wrote:
> > >
> > > On Tue, Dec 31, 2019 at 06:35:21PM +0530, Jagan Teki wrote:
> > > > TCON LCD0, LCD1 in allwinner R40, are used for managing
> > > > LCD interfaces like RGB, LVDS and DSI.
> > > >
> > > > Like TCON TV0, TV1 these LCD0, LCD1 are also managed via
> > > > tcon top.
> > > >
> > > > Add support for it, in tcon driver.
> > > >
> > > > Signed-off-by: Jagan Teki 
> > > > ---
> > > > Changes for v3:
> > > > - none
> > > >
> > > >  drivers/gpu/drm/sun4i/sun4i_tcon.c | 8 
> > > >  1 file changed, 8 insertions(+)
> > > >
> > > > diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c 
> > > > b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> > > > index fad72799b8df..69611d38c844 100644
> > > > --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
> > > > +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> > > > @@ -1470,6 +1470,13 @@ static const struct sun4i_tcon_quirks 
> > > > sun8i_a83t_tv_quirks = {
> > > >   .has_channel_1  = true,
> > > >  };
> > > >
> > > > +static const struct sun4i_tcon_quirks sun8i_r40_lcd_quirks = {
> > > > + .supports_lvds  = true,
> > > > + .has_channel_0  = true,
> > > > + /* TODO Need to support TCON output muxing via GPIO pins */
> > > > + .set_mux= sun8i_r40_tcon_tv_set_mux,
> > >
> > > What is this muking about? And why is it a TODO?
> >
> > Muxing similar like how TCON TOP handle TV0, TV1 I have reused the
> > same so-that it would configure de port selection via
> > sun8i_tcon_top_de_config
> >
> > TCON output muxing have gpio with GPIOD and GPIOH bits, which select
> > which of LCD or TV TCON outputs to the LCD function pins. I have
> > marked these has TODO for further support as mentioned by Chen-Yu in
> > v1[1].
>
> It should be in the commit log.

Make sense.

>
> What's the plan to support that when needed? And that means that the
> LCD and TV outputs are mutually exclusive? We should at the very least
> check that both aren't enabled at the same time.

Yes, LCD or TV within the outselect seems to be mutually exclusive.
Like LCD0 or TV0 can output to GPIOD incase of TV0_OUTSEL and LCD1 or
TV1 can output to GPIOH incase of TV1_OUTSEL. I think checking them
before configuring TCON_TOP_PORT_SEL_REG would make sense, let me know
if you have any suggestions?

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CAMty3ZB_6GyK%3DhhJU-8yAQiom1Uq25ojFbKaGrK1fmW8SnDV_A%40mail.gmail.com.


[linux-sunxi] Re: [PATCH v3 6/9] dt-bindings: sun6i-dsi: Add R40 DPHY compatible (w/ A31 fallback)

2020-01-02 Thread Jagan Teki
On Thu, Jan 2, 2020 at 4:33 PM Maxime Ripard  wrote:
>
> On Tue, Dec 31, 2019 at 06:35:25PM +0530, Jagan Teki wrote:
> > The MIPI DSI PHY controller on Allwinner R40 is similar
> > on the one on A31.
> >
> > Add R40 compatible and append A31 compatible as fallback.
> >
> > Signed-off-by: Jagan Teki 
> > ---
> > Changes for v3:
> > - update the binding in new yaml format
> >
> >  .../devicetree/bindings/phy/allwinner,sun6i-a31-mipi-dphy.yaml   | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git 
> > a/Documentation/devicetree/bindings/phy/allwinner,sun6i-a31-mipi-dphy.yaml 
> > b/Documentation/devicetree/bindings/phy/allwinner,sun6i-a31-mipi-dphy.yaml
> > index 8841938050b2..0c283fe79402 100644
> > --- 
> > a/Documentation/devicetree/bindings/phy/allwinner,sun6i-a31-mipi-dphy.yaml
> > +++ 
> > b/Documentation/devicetree/bindings/phy/allwinner,sun6i-a31-mipi-dphy.yaml
> > @@ -18,6 +18,7 @@ properties:
> >  oneOf:
> >- const: allwinner,sun6i-a31-mipi-dphy
> >- items:
> > +  - const: allwinner,sun8i-r40-mipi-dphy
> >- const: allwinner,sun50i-a64-mipi-dphy
> >- const: allwinner,sun6i-a31-mipi-dphy
>
> This isn't doing what you say it does.
>
> Here you're stating that there's two valid values, one that is a
> single element allwinner,sun6i-a31-mipi-dphy, and another which is a
> list of three elements allwinner,sun8i-r40-mipi-dphy,
> allwinner,sun50i-a64-mipi-dphy and allwinner,sun6i-a31-mipi-dphy, in
> that order.

I got it Maxime, thanks for pointing this.

>
> Did you run make dtbs_check and dt_bindings_check?

I sure I didn't, thanks for the clue.

Will do this on another patch as well.

Jagan.

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CAMty3ZAwaqE31%3DrCiub3bRZBOa68ck5Ld%3DA7kVsQjssps9TCxg%40mail.gmail.com.


[linux-sunxi] Re: [PATCH v3 2/9] drm/sun4i: tcon: Add TCON LCD support for R40

2020-01-02 Thread Jagan Teki
On Thu, Jan 2, 2020 at 4:24 PM Maxime Ripard  wrote:
>
> On Tue, Dec 31, 2019 at 06:35:21PM +0530, Jagan Teki wrote:
> > TCON LCD0, LCD1 in allwinner R40, are used for managing
> > LCD interfaces like RGB, LVDS and DSI.
> >
> > Like TCON TV0, TV1 these LCD0, LCD1 are also managed via
> > tcon top.
> >
> > Add support for it, in tcon driver.
> >
> > Signed-off-by: Jagan Teki 
> > ---
> > Changes for v3:
> > - none
> >
> >  drivers/gpu/drm/sun4i/sun4i_tcon.c | 8 
> >  1 file changed, 8 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c 
> > b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> > index fad72799b8df..69611d38c844 100644
> > --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
> > +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> > @@ -1470,6 +1470,13 @@ static const struct sun4i_tcon_quirks 
> > sun8i_a83t_tv_quirks = {
> >   .has_channel_1  = true,
> >  };
> >
> > +static const struct sun4i_tcon_quirks sun8i_r40_lcd_quirks = {
> > + .supports_lvds  = true,
> > + .has_channel_0  = true,
> > + /* TODO Need to support TCON output muxing via GPIO pins */
> > + .set_mux= sun8i_r40_tcon_tv_set_mux,
>
> What is this muking about? And why is it a TODO?

Muxing similar like how TCON TOP handle TV0, TV1 I have reused the
same so-that it would configure de port selection via
sun8i_tcon_top_de_config

TCON output muxing have gpio with GPIOD and GPIOH bits, which select
which of LCD or TV TCON outputs to the LCD function pins. I have
marked these has TODO for further support as mentioned by Chen-Yu in
v1[1].

[1] https://patchwork.freedesktop.org/patch/310210/?series=62062=1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CAMty3ZA0e8eJZWvAh0x%3DKGAZVL3apdao3COvR6j3-ckv0cdvcg%40mail.gmail.com.


[linux-sunxi] [PATCH v3 6/9] dt-bindings: sun6i-dsi: Add R40 DPHY compatible (w/ A31 fallback)

2019-12-31 Thread Jagan Teki
The MIPI DSI PHY controller on Allwinner R40 is similar
on the one on A31.

Add R40 compatible and append A31 compatible as fallback.

Signed-off-by: Jagan Teki 
---
Changes for v3:
- update the binding in new yaml format

 .../devicetree/bindings/phy/allwinner,sun6i-a31-mipi-dphy.yaml   | 1 +
 1 file changed, 1 insertion(+)

diff --git 
a/Documentation/devicetree/bindings/phy/allwinner,sun6i-a31-mipi-dphy.yaml 
b/Documentation/devicetree/bindings/phy/allwinner,sun6i-a31-mipi-dphy.yaml
index 8841938050b2..0c283fe79402 100644
--- a/Documentation/devicetree/bindings/phy/allwinner,sun6i-a31-mipi-dphy.yaml
+++ b/Documentation/devicetree/bindings/phy/allwinner,sun6i-a31-mipi-dphy.yaml
@@ -18,6 +18,7 @@ properties:
 oneOf:
   - const: allwinner,sun6i-a31-mipi-dphy
   - items:
+  - const: allwinner,sun8i-r40-mipi-dphy
   - const: allwinner,sun50i-a64-mipi-dphy
   - const: allwinner,sun6i-a31-mipi-dphy
 
-- 
2.18.0.321.gffc6fa0e3

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20191231130528.20669-7-jagan%40amarulasolutions.com.


[linux-sunxi] [PATCH v3 8/9] ARM: dts: sun8i: r40: Add MIPI DSI pipeline

2019-12-31 Thread Jagan Teki
Add MIPI DSI pipeline for Allwinner R40.

Unlike conventional Display pipeline in allwinner, R40 have
TCON TCOP which would interact various block like muxes,
tcon lcd, tcon_tv for better pipeline fitting.

For MIPI DSI pipeline, we have to configure the tcon_lcd0
block which would interact with tcon_top for upper pipeline
connections and dsi block for lower pipeline connections.

So, this patch created that pipeline by adding new nodes
for tcon_lcd0, dsi, dphy and connet them to make proper
pipeline fitting.

Signed-off-by: Jagan Teki 
---
Changes for v3:
- drop clock-names in dsi node

 arch/arm/boot/dts/sun8i-r40.dtsi | 72 
 1 file changed, 72 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-r40.dtsi b/arch/arm/boot/dts/sun8i-r40.dtsi
index 3faa35d43afa..4c61e93d9a0b 100644
--- a/arch/arm/boot/dts/sun8i-r40.dtsi
+++ b/arch/arm/boot/dts/sun8i-r40.dtsi
@@ -628,6 +628,7 @@
 
tcon_top_mixer0_out_tcon_lcd0: 
endpoint@0 {
reg = <0>;
+   remote-endpoint = 
<_lcd0_in_tcon_top_mixer0>;
};
 
tcon_top_mixer0_out_tcon_lcd1: 
endpoint@1 {
@@ -706,6 +707,45 @@
};
};
 
+   tcon_lcd0: lcd-controller@1c71000 {
+   compatible = "allwinner,sun8i-r40-tcon-lcd";
+   reg = <0x01c71000 0x1000>;
+   interrupts = ;
+   clocks = < CLK_BUS_TCON_LCD0>, < CLK_TCON_LCD0>;
+   clock-names = "ahb", "tcon-ch0";
+   clock-output-names = "tcon-pixel-clock";
+   resets = < RST_BUS_TCON_LCD0>, < RST_BUS_LVDS>;
+   reset-names = "lcd", "lvds";
+   status = "disabled";
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   tcon_lcd0_in: port@0 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   reg = <0>;
+
+   tcon_lcd0_in_tcon_top_mixer0: 
endpoint@0 {
+   reg = <0>;
+   remote-endpoint = 
<_top_mixer0_out_tcon_lcd0>;
+   };
+   };
+
+   tcon_lcd0_out: port@1 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   reg = <1>;
+
+   tcon_lcd0_out_dsi_out: endpoint@1 {
+   reg = <1>;
+   remote-endpoint = 
<_in_tcon_lcd0_out>;
+   };
+   };
+   };
+   };
+
tcon_tv0: lcd-controller@1c73000 {
compatible = "allwinner,sun8i-r40-tcon-tv";
reg = <0x01c73000 0x1000>;
@@ -803,6 +843,38 @@
interrupts = ;
};
 
+   dsi: dsi@1ca {
+   compatible = "allwinner,sun8i-r40-mipi-dsi",
+"allwinner,sun50i-a64-mipi-dsi";
+   reg = <0x01ca 0x1000>;
+   interrupts = ;
+   clocks = < CLK_BUS_MIPI_DSI>;
+   resets = < RST_BUS_MIPI_DSI>;
+   phys = <>;
+   phy-names = "dphy";
+   status = "disabled";
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port {
+   dsi_in_tcon_lcd0_out: endpoint {
+   remote-endpoint = 
<_lcd0_out_dsi_out>;
+   };
+   };
+   };
+
+   dphy: d-phy@1ca1000 {
+   compatible = "allwinner,sun8i-r40-mipi-dphy",
+"allwinner,sun6i-a31-mipi-dphy";
+   reg = <0x01ca1000 0x1000>;
+   clocks = < CLK_BUS_MIPI_DSI>,
+<_top CLK_TCON_TOP_DSI&g

[linux-sunxi] [PATCH v3 3/9] ARM: dts: sun8i: r40: Use tcon top clock index macros

2019-12-31 Thread Jagan Teki
tcon_tv0, tcon_tv1 nodes have a clock names of tcon-ch0,
tcon-ch1 which are referring tcon_top clocks via index
numbers like 0, 1 with CLK_TCON_TV0 and CLK_TCON_TV1
respectively.

Use the macro in place of index numbers, for more code
readability.

Signed-off-by: Jagan Teki 
Reviewed-by: Chen-Yu Tsai 
---
Changes for v3:
- none

 arch/arm/boot/dts/sun8i-r40.dtsi | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/sun8i-r40.dtsi b/arch/arm/boot/dts/sun8i-r40.dtsi
index c9c2688db66d..3faa35d43afa 100644
--- a/arch/arm/boot/dts/sun8i-r40.dtsi
+++ b/arch/arm/boot/dts/sun8i-r40.dtsi
@@ -44,6 +44,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -709,7 +710,7 @@
compatible = "allwinner,sun8i-r40-tcon-tv";
reg = <0x01c73000 0x1000>;
interrupts = ;
-   clocks = < CLK_BUS_TCON_TV0>, <_top 0>;
+   clocks = < CLK_BUS_TCON_TV0>, <_top 
CLK_TCON_TOP_TV0>;
clock-names = "ahb", "tcon-ch1";
resets = < RST_BUS_TCON_TV0>;
reset-names = "lcd";
@@ -752,7 +753,7 @@
compatible = "allwinner,sun8i-r40-tcon-tv";
reg = <0x01c74000 0x1000>;
interrupts = ;
-   clocks = < CLK_BUS_TCON_TV1>, <_top 1>;
+   clocks = < CLK_BUS_TCON_TV1>, <_top 
CLK_TCON_TOP_TV1>;
clock-names = "ahb", "tcon-ch1";
resets = < RST_BUS_TCON_TV1>;
reset-names = "lcd";
-- 
2.18.0.321.gffc6fa0e3

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20191231130528.20669-4-jagan%40amarulasolutions.com.


[linux-sunxi] [PATCH v3 4/9] drm/sun4i: tcon_top: Use clock name index macros

2019-12-31 Thread Jagan Teki
TCON TOP mux blocks in R40 are registering clock using
tcon top clock index numbers.

Right now the code is using, real numbers start with 0, but
we have proper macros that defined these name index numbers.

Use the existing macros, instead of real numbers for more
code readability.

Signed-off-by: Jagan Teki 
---
Changes for v3:
- none

 drivers/gpu/drm/sun4i/sun8i_tcon_top.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun8i_tcon_top.c 
b/drivers/gpu/drm/sun4i/sun8i_tcon_top.c
index 75d8e60c149d..e0b3c5330b9a 100644
--- a/drivers/gpu/drm/sun4i/sun8i_tcon_top.c
+++ b/drivers/gpu/drm/sun4i/sun8i_tcon_top.c
@@ -194,19 +194,22 @@ static int sun8i_tcon_top_bind(struct device *dev, struct 
device *master,
clk_data->hws[CLK_TCON_TOP_TV0] =
sun8i_tcon_top_register_gate(dev, "tcon-tv0", regs,
 _top->reg_lock,
-TCON_TOP_TCON_TV0_GATE, 0);
+TCON_TOP_TCON_TV0_GATE,
+CLK_TCON_TOP_TV0);
 
if (quirks->has_tcon_tv1)
clk_data->hws[CLK_TCON_TOP_TV1] =
sun8i_tcon_top_register_gate(dev, "tcon-tv1", regs,
 _top->reg_lock,
-TCON_TOP_TCON_TV1_GATE, 1);
+TCON_TOP_TCON_TV1_GATE,
+CLK_TCON_TOP_TV1);
 
if (quirks->has_dsi)
clk_data->hws[CLK_TCON_TOP_DSI] =
sun8i_tcon_top_register_gate(dev, "dsi", regs,
 _top->reg_lock,
-TCON_TOP_TCON_DSI_GATE, 2);
+TCON_TOP_TCON_DSI_GATE,
+CLK_TCON_TOP_DSI);
 
for (i = 0; i < CLK_NUM; i++)
if (IS_ERR(clk_data->hws[i])) {
-- 
2.18.0.321.gffc6fa0e3

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20191231130528.20669-5-jagan%40amarulasolutions.com.


[linux-sunxi] [PATCH v3 5/9] drm/sun4i: tcon_top: Register reset, clock gates in probe

2019-12-31 Thread Jagan Teki
TCON TOP is processing clock gates and reset control for
TV0, TV1 and DSI channels during bind and release the same
during unbind component ops.

The usual DSI initialization would setup all controller
clocks along with DPHY clocking during probe.

Since the actual clock gates (along with DSI clock gate)
are initialized during ton top bind, the DPHY is failed to
get the DSI clock during that time.

To solve, this circular dependency move the reset control,
clock gate registration from bind to probe and release the
same from unbind to remove.

This eventually give a chance DPHY to initialize the DSI
clock gate.

Signed-off-by: Jagan Teki 
---
Changes for v3:
- fixed comments from Chen-Yu
- move reset control methods into probe

 drivers/gpu/drm/sun4i/sun8i_tcon_top.c | 41 +-
 1 file changed, 21 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun8i_tcon_top.c 
b/drivers/gpu/drm/sun4i/sun8i_tcon_top.c
index e0b3c5330b9a..732ac19b4371 100644
--- a/drivers/gpu/drm/sun4i/sun8i_tcon_top.c
+++ b/drivers/gpu/drm/sun4i/sun8i_tcon_top.c
@@ -124,7 +124,22 @@ static struct clk_hw *sun8i_tcon_top_register_gate(struct 
device *dev,
 static int sun8i_tcon_top_bind(struct device *dev, struct device *master,
   void *data)
 {
-   struct platform_device *pdev = to_platform_device(dev);
+   return 0;
+}
+
+static void sun8i_tcon_top_unbind(struct device *dev, struct device *master,
+ void *data)
+{
+}
+
+static const struct component_ops sun8i_tcon_top_ops = {
+   .bind   = sun8i_tcon_top_bind,
+   .unbind = sun8i_tcon_top_unbind,
+};
+
+static int sun8i_tcon_top_probe(struct platform_device *pdev)
+{
+   struct device *dev = >dev;
struct clk_hw_onecell_data *clk_data;
struct sun8i_tcon_top *tcon_top;
const struct sun8i_tcon_top_quirks *quirks;
@@ -132,7 +147,7 @@ static int sun8i_tcon_top_bind(struct device *dev, struct 
device *master,
void __iomem *regs;
int ret, i;
 
-   quirks = of_device_get_match_data(>dev);
+   quirks = of_device_get_match_data(dev);
 
tcon_top = devm_kzalloc(dev, sizeof(*tcon_top), GFP_KERNEL);
if (!tcon_top)
@@ -226,22 +241,21 @@ static int sun8i_tcon_top_bind(struct device *dev, struct 
device *master,
 
dev_set_drvdata(dev, tcon_top);
 
-   return 0;
+   return component_add(dev, _tcon_top_ops);
 
 err_unregister_gates:
for (i = 0; i < CLK_NUM; i++)
if (!IS_ERR_OR_NULL(clk_data->hws[i]))
clk_hw_unregister_gate(clk_data->hws[i]);
-   clk_disable_unprepare(tcon_top->bus);
 err_assert_reset:
reset_control_assert(tcon_top->rst);
 
return ret;
 }
 
-static void sun8i_tcon_top_unbind(struct device *dev, struct device *master,
- void *data)
+static int sun8i_tcon_top_remove(struct platform_device *pdev)
 {
+   struct device *dev = >dev;
struct sun8i_tcon_top *tcon_top = dev_get_drvdata(dev);
struct clk_hw_onecell_data *clk_data = tcon_top->clk_data;
int i;
@@ -253,21 +267,8 @@ static void sun8i_tcon_top_unbind(struct device *dev, 
struct device *master,
 
clk_disable_unprepare(tcon_top->bus);
reset_control_assert(tcon_top->rst);
-}
-
-static const struct component_ops sun8i_tcon_top_ops = {
-   .bind   = sun8i_tcon_top_bind,
-   .unbind = sun8i_tcon_top_unbind,
-};
-
-static int sun8i_tcon_top_probe(struct platform_device *pdev)
-{
-   return component_add(>dev, _tcon_top_ops);
-}
 
-static int sun8i_tcon_top_remove(struct platform_device *pdev)
-{
-   component_del(>dev, _tcon_top_ops);
+   component_del(dev, _tcon_top_ops);
 
return 0;
 }
-- 
2.18.0.321.gffc6fa0e3

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20191231130528.20669-6-jagan%40amarulasolutions.com.


[linux-sunxi] [DO NOT MERGE] [PATCH v3 9/9] ARM: dts: sun8i-r40: bananapi-m2-ultra: Enable Bananapi S070WV20-CT16

2019-12-31 Thread Jagan Teki
This patch add support for Bananapi S070WV20-CT16 DSI panel to
BPI-M2U board.

DSI panel connected via board DSI port with,
- DCDC1 as VCC-DSI supply
- PH18 gpio for lcd enable pin
- PD17 gpio for lcd reset pin
- PD16 gpio for backlight enable pin

Signed-off-by: Jagan Teki 
---
Changes for v3:
- none

 .../boot/dts/sun8i-r40-bananapi-m2-ultra.dts  | 37 +++
 1 file changed, 37 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts 
b/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
index 42d62d1ba1dc..99f84e6f15ce 100644
--- a/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
+++ b/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
@@ -45,6 +45,7 @@
 #include "sun8i-r40.dtsi"
 
 #include 
+#include 
 
 / {
model = "Banana Pi BPI-M2-Ultra";
@@ -55,6 +56,14 @@
serial0 = 
};
 
+   backlight: backlight {
+   compatible = "pwm-backlight";
+   pwms = < 0 5 PWM_POLARITY_INVERTED>;
+   brightness-levels = <1 2 4 8 16 32 64 128 255>;
+   default-brightness-level = <2>;
+   enable-gpios = < 7 16 GPIO_ACTIVE_HIGH>; /* LCD-BL-EN: PH16 
*/
+   };
+
chosen {
stdout-path = "serial0:115200n8";
};
@@ -117,6 +126,24 @@
status = "okay";
 };
 
+ {
+   status = "okay";
+};
+
+ {
+   vcc-dsi-supply = <_dcdc1>;  /* VCC-DSI */
+   status = "okay";
+
+   panel@0 {
+   compatible = "bananapi,s070wv20-ct16-icn6211";
+   reg = <0>;
+   enable-gpio = < 7 18 GPIO_ACTIVE_HIGH>; /* LCD-PWR-EN: PH18 
*/
+   reset-gpios = < 7 17 GPIO_ACTIVE_HIGH>; /* LCD-RST: PH17 */
+   vdd-supply = <_dcdc1>;
+   backlight = <>;
+   };
+};
+
  {
status = "okay";
 };
@@ -209,6 +236,12 @@
vcc-pg-supply = <_dldo1>;
 };
 
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pin>;
+   status = "okay";
+};
+
 _aldo2 {
regulator-min-microvolt = <250>;
regulator-max-microvolt = <250>;
@@ -295,6 +328,10 @@
regulator-name = "vdd1v2-sata";
 };
 
+_lcd0 {
+   status = "okay";
+};
+
 _tv0 {
status = "okay";
 };
-- 
2.18.0.321.gffc6fa0e3

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20191231130528.20669-10-jagan%40amarulasolutions.com.


[linux-sunxi] [PATCH v3 7/9] dt-bindings: sun6i-dsi: Document R40 MIPI-DSI controller (w/ A64 fallback)

2019-12-31 Thread Jagan Teki
The MIPI DSI controller on Allwinner R40 is similar on
the one on A64 like doesn't associate any DSI_SCLK gating.

So, add R40 compatible and append A64 compatible as fallback.

Signed-off-by: Jagan Teki 
---
Changes for v3:
- update the binding in new yaml format

 .../bindings/display/allwinner,sun6i-a31-mipi-dsi.yaml| 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git 
a/Documentation/devicetree/bindings/display/allwinner,sun6i-a31-mipi-dsi.yaml 
b/Documentation/devicetree/bindings/display/allwinner,sun6i-a31-mipi-dsi.yaml
index d41ecb5e7f7c..138ffb6ae403 100644
--- 
a/Documentation/devicetree/bindings/display/allwinner,sun6i-a31-mipi-dsi.yaml
+++ 
b/Documentation/devicetree/bindings/display/allwinner,sun6i-a31-mipi-dsi.yaml
@@ -15,9 +15,11 @@ properties:
   "#size-cells": true
 
   compatible:
-enum:
-  - allwinner,sun6i-a31-mipi-dsi
-  - allwinner,sun50i-a64-mipi-dsi
+oneOf:
+  - const: allwinner,sun6i-a31-mipi-dsi
+  - const: allwinner,sun50i-a64-mipi-dsi
+  - items:
+  - const: allwinner,sun8i-r40-mipi-dsi
 
   reg:
 maxItems: 1
-- 
2.18.0.321.gffc6fa0e3

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20191231130528.20669-8-jagan%40amarulasolutions.com.


[linux-sunxi] [PATCH v3 0/9] drm/sun4i: Allwinner R40 MIPI-DSI support

2019-12-31 Thread Jagan Teki
This is v3 version for supporting MIPI-DSI on Allwinner R40 from
initial version[1].

The controller look similar like, Allwinner A64 but with associated
R40 TCON TOP for DSI pipeline.

Changes for v3:
- collect Rob, Chen-Yu r-b, a-b tags
- move tcon top reset control methods into probe
- rebase on drm-misc
Changes for v2:
- drop tcon top lcd clock patch
- add TODO text while adding tcon lcd support
- add patch for registering tcon top clock gates in probe
- change tcon-ch0 in tcon_lcd0 to CLK_TCON_LCD0
- change mod clock in dphy to tcon_top with index 3 

[1] https://patchwork.freedesktop.org/series/62062/

Any inputs?
Jagan.

Jagan Teki (9):
  dt-bindings: display: Add TCON LCD compatible for R40
  drm/sun4i: tcon: Add TCON LCD support for R40
  ARM: dts: sun8i: r40: Use tcon top clock index macros
  drm/sun4i: tcon_top: Use clock name index macros
  drm/sun4i: tcon_top: Register reset, clock gates in probe
  dt-bindings: sun6i-dsi: Add R40 DPHY compatible (w/ A31 fallback)
  dt-bindings: sun6i-dsi: Document R40 MIPI-DSI controller (w/ A64
fallback)
  ARM: dts: sun8i: r40: Add MIPI DSI pipeline
  [DO NOT MERGE] ARM: dts: sun8i-r40: bananapi-m2-ultra: Enable Bananapi 
S070WV20-CT16

 .../display/allwinner,sun6i-a31-mipi-dsi.yaml |  8 +-
 .../bindings/display/sunxi/sun4i-drm.txt  |  1 +
 .../phy/allwinner,sun6i-a31-mipi-dphy.yaml|  1 +
 .../boot/dts/sun8i-r40-bananapi-m2-ultra.dts  | 37 +
 arch/arm/boot/dts/sun8i-r40.dtsi  | 77 ++-
 drivers/gpu/drm/sun4i/sun4i_tcon.c|  8 ++
 drivers/gpu/drm/sun4i/sun8i_tcon_top.c| 50 ++--
 7 files changed, 154 insertions(+), 28 deletions(-)

-- 
2.18.0.321.gffc6fa0e3

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20191231130528.20669-1-jagan%40amarulasolutions.com.


[linux-sunxi] [PATCH v3 2/9] drm/sun4i: tcon: Add TCON LCD support for R40

2019-12-31 Thread Jagan Teki
TCON LCD0, LCD1 in allwinner R40, are used for managing
LCD interfaces like RGB, LVDS and DSI.

Like TCON TV0, TV1 these LCD0, LCD1 are also managed via
tcon top.

Add support for it, in tcon driver.

Signed-off-by: Jagan Teki 
---
Changes for v3:
- none

 drivers/gpu/drm/sun4i/sun4i_tcon.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c 
b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index fad72799b8df..69611d38c844 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -1470,6 +1470,13 @@ static const struct sun4i_tcon_quirks 
sun8i_a83t_tv_quirks = {
.has_channel_1  = true,
 };
 
+static const struct sun4i_tcon_quirks sun8i_r40_lcd_quirks = {
+   .supports_lvds  = true,
+   .has_channel_0  = true,
+   /* TODO Need to support TCON output muxing via GPIO pins */
+   .set_mux= sun8i_r40_tcon_tv_set_mux,
+};
+
 static const struct sun4i_tcon_quirks sun8i_r40_tv_quirks = {
.has_channel_1  = true,
.set_mux= sun8i_r40_tcon_tv_set_mux,
@@ -1500,6 +1507,7 @@ const struct of_device_id sun4i_tcon_of_table[] = {
{ .compatible = "allwinner,sun8i-a33-tcon", .data = _a33_quirks },
{ .compatible = "allwinner,sun8i-a83t-tcon-lcd", .data = 
_a83t_lcd_quirks },
{ .compatible = "allwinner,sun8i-a83t-tcon-tv", .data = 
_a83t_tv_quirks },
+   { .compatible = "allwinner,sun8i-r40-tcon-lcd", .data = 
_r40_lcd_quirks },
{ .compatible = "allwinner,sun8i-r40-tcon-tv", .data = 
_r40_tv_quirks },
{ .compatible = "allwinner,sun8i-v3s-tcon", .data = _v3s_quirks },
{ .compatible = "allwinner,sun9i-a80-tcon-lcd", .data = 
_a80_tcon_lcd_quirks },
-- 
2.18.0.321.gffc6fa0e3

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20191231130528.20669-3-jagan%40amarulasolutions.com.


[linux-sunxi] [PATCH v3 1/9] dt-bindings: display: Add TCON LCD compatible for R40

2019-12-31 Thread Jagan Teki
Like TCON TV0, TV1 allwinner R40 has TCON LCD0, LCD1 which
are managed via TCON TOP.

Add tcon lcd compatible R40, the same compatible can handle
TCON LCD0, LCD1.

Signed-off-by: Jagan Teki 
Acked-by: Chen-Yu Tsai 
Reviewed-by: Rob Herring 
---
Changes for v3:
- none

 Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt 
b/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
index 31ab72cba3d4..9e9c7f934202 100644
--- a/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
+++ b/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
@@ -160,6 +160,7 @@ Required properties:
* allwinner,sun8i-a33-tcon
* allwinner,sun8i-a83t-tcon-lcd
* allwinner,sun8i-a83t-tcon-tv
+   * allwinner,sun8i-r40-tcon-lcd
* allwinner,sun8i-r40-tcon-tv
* allwinner,sun8i-v3s-tcon
* allwinner,sun9i-a80-tcon-lcd
-- 
2.18.0.321.gffc6fa0e3

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20191231130528.20669-2-jagan%40amarulasolutions.com.


[linux-sunxi] Re: [PATCH v14 0/7] drm/sun4i: Allwinner A64 MIPI-DSI support

2019-12-27 Thread Jagan Teki
On Thu, Dec 26, 2019 at 3:08 PM Maxime Ripard  wrote:
>
> On Sun, Dec 22, 2019 at 06:52:22PM +0530, Jagan Teki wrote:
> > This is v14 version for Allwinner A64 MIPI-DSI support
> > and here is the previous version set[1]
>
> I applied the patches 1 to 6, and fixed checkpatch warnings in the
> patch 5. Make sure to run it before sending patches.

Looks like I missed this time, sorry but usually I would do. Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CAMty3ZA9VBj6OxaLYE21Qt01nnTYGhsS8c2JHc5esDMeWe0qYw%40mail.gmail.com.


[linux-sunxi] [DO NOT MERGE] [PATCH v14 7/7] arm64: dts: allwinner: bananapi-m64: Enable Bananapi S070WV20-CT16 DSI panel

2019-12-22 Thread Jagan Teki
This patch add support for Bananapi S070WV20-CT16 DSI panel to
BPI-M64 board.

DSI panel connected via board DSI port with,
- DLDO1 as VCC-DSI supply
- DCDC1 as VDD supply
- PD7 gpio for lcd enable pin
- PD6 gpio for lcd reset pin
- PD5 gpio for backlight enable pin

Signed-off-by: Jagan Teki 
---
 .../dts/allwinner/sun50i-a64-bananapi-m64.dts | 31 +++
 1 file changed, 31 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts 
b/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts
index 208373efee49..6beaecdd802a 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts
@@ -45,6 +45,7 @@
 #include "sun50i-a64.dtsi"
 
 #include 
+#include 
 
 / {
model = "BananaPi-M64";
@@ -56,6 +57,14 @@
serial1 = 
};
 
+   backlight: backlight {
+   compatible = "pwm-backlight";
+   pwms = <_pwm 0 5 PWM_POLARITY_INVERTED>;
+   brightness-levels = <1 2 4 8 16 32 64 128 255>;
+   default-brightness-level = <2>;
+   enable-gpios = < 3 5 GPIO_ACTIVE_HIGH>; /* LCD-BL-EN: PD5 */
+   };
+
chosen {
stdout-path = "serial0:115200n8";
};
@@ -116,6 +125,24 @@
status = "okay";
 };
 
+ {
+   status = "okay";
+};
+
+ {
+   vcc-dsi-supply = <_dldo1>;  /* VCC3V3-DSI */
+   status = "okay";
+
+   panel@0 {
+   compatible = "bananapi,s070wv20-ct16-icn6211";
+   reg = <0>;
+   enable-gpios = < 3 7 GPIO_ACTIVE_HIGH>; /* LCD-PWR-EN: PD7 
*/
+   reset-gpios = < 3 6 GPIO_ACTIVE_HIGH>; /* LCD-RST: PD6 */
+   vdd-supply = <_dcdc1>;
+   backlight = <>;
+   };
+};
+
  {
status = "okay";
 };
@@ -206,6 +233,10 @@
status = "okay";
 };
 
+_pwm {
+   status = "okay";
+};
+
 _rsb {
status = "okay";
 
-- 
2.18.0.321.gffc6fa0e3

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20191222132229.30276-8-jagan%40amarulasolutions.com.


[linux-sunxi] [PATCH v14 5/7] drm/sun4i: dsi: Add Allwinner A64 MIPI DSI support

2019-12-22 Thread Jagan Teki
The MIPI DSI controller in Allwinner A64 is similar to A33.

But unlike A33, A64 doesn't have DSI_SCLK gating so add compatible
for Allwinner A64 with uninitialized has_mod_clk driver.

Signed-off-by: Jagan Teki 
Tested-by: Merlijn Wajer 
---
Changes for v14:
- none

 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c 
b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
index 2577b237d06a..4a024951aa11 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
@@ -1256,6 +1256,7 @@ static const struct dev_pm_ops sun6i_dsi_pm_ops = {
 
 static const struct of_device_id sun6i_dsi_of_table[] = {
{ .compatible = "allwinner,sun6i-a31-mipi-dsi" },
+   { .compatible = "allwinner,sun50i-a64-mipi-dsi" },
{ }
 };
 MODULE_DEVICE_TABLE(of, sun6i_dsi_of_table);
-- 
2.18.0.321.gffc6fa0e3

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20191222132229.30276-6-jagan%40amarulasolutions.com.


[linux-sunxi] [PATCH v14 2/7] dt-bindings: sun6i-dsi: Add A64 DPHY compatible (w/ A31 fallback)

2019-12-22 Thread Jagan Teki
The MIPI DSI PHY controller on Allwinner A64 is similar
on the one on A31.

Add A64 compatible and append A31 compatible as fallback.

Reviewed-by: Rob Herring 
Signed-off-by: Jagan Teki 
---
Changes for v14:
- none

 .../bindings/phy/allwinner,sun6i-a31-mipi-dphy.yaml | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git 
a/Documentation/devicetree/bindings/phy/allwinner,sun6i-a31-mipi-dphy.yaml 
b/Documentation/devicetree/bindings/phy/allwinner,sun6i-a31-mipi-dphy.yaml
index fa46670de299..8841938050b2 100644
--- a/Documentation/devicetree/bindings/phy/allwinner,sun6i-a31-mipi-dphy.yaml
+++ b/Documentation/devicetree/bindings/phy/allwinner,sun6i-a31-mipi-dphy.yaml
@@ -15,7 +15,11 @@ properties:
 const: 0
 
   compatible:
-const: allwinner,sun6i-a31-mipi-dphy
+oneOf:
+  - const: allwinner,sun6i-a31-mipi-dphy
+  - items:
+  - const: allwinner,sun50i-a64-mipi-dphy
+  - const: allwinner,sun6i-a31-mipi-dphy
 
   reg:
 maxItems: 1
-- 
2.18.0.321.gffc6fa0e3

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20191222132229.30276-3-jagan%40amarulasolutions.com.


[linux-sunxi] [PATCH v14 6/7] arm64: dts: allwinner: a64: Add MIPI DSI pipeline

2019-12-22 Thread Jagan Teki
Add MIPI DSI pipeline for Allwinner A64.

- dsi node, with A64 compatible since it doesn't support
  DSI_SCLK gating unlike A33
- dphy node, with A64 compatible with A33 fallback since
  DPHY on A64 and A33 is similar
- finally, attach the dsi_in to tcon0 for complete MIPI DSI

Signed-off-by: Jagan Teki 
Tested-by: Merlijn Wajer 
---
Changes for v14:
- none

 arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 37 +++
 1 file changed, 37 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi 
b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
index 27e48234f1c2..1db8378f59a4 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
@@ -382,6 +382,12 @@
#address-cells = <1>;
#size-cells = <0>;
reg = <1>;
+
+   tcon0_out_dsi: endpoint@1 {
+   reg = <1>;
+   remote-endpoint = 
<_in_tcon0>;
+   allwinner,tcon-channel = <1>;
+   };
};
};
};
@@ -1014,6 +1020,37 @@
status = "disabled";
};
 
+   dsi: dsi@1ca {
+   compatible = "allwinner,sun50i-a64-mipi-dsi";
+   reg = <0x01ca 0x1000>;
+   interrupts = ;
+   clocks = < CLK_BUS_MIPI_DSI>;
+   resets = < RST_BUS_MIPI_DSI>;
+   phys = <>;
+   phy-names = "dphy";
+   status = "disabled";
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port {
+   dsi_in_tcon0: endpoint {
+   remote-endpoint = <_out_dsi>;
+   };
+   };
+   };
+
+   dphy: d-phy@1ca1000 {
+   compatible = "allwinner,sun50i-a64-mipi-dphy",
+"allwinner,sun6i-a31-mipi-dphy";
+   reg = <0x01ca1000 0x1000>;
+   clocks = < CLK_BUS_MIPI_DSI>,
+< CLK_DSI_DPHY>;
+   clock-names = "bus", "mod";
+   resets = < RST_BUS_MIPI_DSI>;
+   status = "disabled";
+   #phy-cells = <0>;
+   };
+
hdmi: hdmi@1ee {
compatible = "allwinner,sun50i-a64-dw-hdmi",
 "allwinner,sun8i-a83t-dw-hdmi";
-- 
2.18.0.321.gffc6fa0e3

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20191222132229.30276-7-jagan%40amarulasolutions.com.


[linux-sunxi] [PATCH v14 3/7] drm/sun4i: dsi: Get the mod clock for A31

2019-12-22 Thread Jagan Teki
As per the user manual, look like mod clock is not mandatory
for all Allwinner MIPI DSI controllers, it is connected to
CLK_DSI_SCLK for A31 and not available in A64.

So, add compatible check for A31 and get mod clock accordingly.

Tested-by: Merlijn Wajer 
Signed-off-by: Jagan Teki 
---
Changes for v14:
- none

 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c 
b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
index c958ca9bae63..68b88a3dc4c5 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
@@ -1120,10 +1120,13 @@ static int sun6i_dsi_probe(struct platform_device *pdev)
return PTR_ERR(dsi->reset);
}
 
-   dsi->mod_clk = devm_clk_get(dev, "mod");
-   if (IS_ERR(dsi->mod_clk)) {
-   dev_err(dev, "Couldn't get the DSI mod clock\n");
-   return PTR_ERR(dsi->mod_clk);
+   if (of_device_is_compatible(dev->of_node,
+   "allwinner,sun6i-a31-mipi-dsi")) {
+   dsi->mod_clk = devm_clk_get(dev, "mod");
+   if (IS_ERR(dsi->mod_clk)) {
+   dev_err(dev, "Couldn't get the DSI mod clock\n");
+   return PTR_ERR(dsi->mod_clk);
+   }
}
 
/*
-- 
2.18.0.321.gffc6fa0e3

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20191222132229.30276-4-jagan%40amarulasolutions.com.


[linux-sunxi] [PATCH v14 4/7] drm/sun4i: dsi: Handle bus clock via regmap_mmio_attach_clk

2019-12-22 Thread Jagan Teki
regmap has special API to enable the controller bus clock while
initializing register space, and current driver is using
devm_regmap_init_mmio_clk which require to specify bus
clk_id argument as "bus"

But, the usage of clocks are varies between different Allwinner
DSI controllers. Clocking in A33 would need bus and mod clocks
where as A64 would need only bus clock.

Since A64 support only single bus clock, it is optional to
specify the clock-names on the controller device tree node.
So using NULL on clk_id would get the attached clock.

To support clk_id as "bus" and "NULL" during clock enablement
between controllers, this patch add generic code to handle
the bus clock using regmap_mmio_attach_clk with associated
regmap APIs.

Signed-off-by: Jagan Teki 
---
Changes for v14:
- drop regmap_exit, clk_put

 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 37 --
 1 file changed, 29 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c 
b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
index 68b88a3dc4c5..2577b237d06a 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
@@ -1081,6 +1081,7 @@ static const struct component_ops sun6i_dsi_ops = {
 static int sun6i_dsi_probe(struct platform_device *pdev)
 {
struct device *dev = >dev;
+   const char *bus_clk_name = NULL;
struct sun6i_dsi *dsi;
struct resource *res;
void __iomem *base;
@@ -1094,6 +1095,10 @@ static int sun6i_dsi_probe(struct platform_device *pdev)
dsi->host.ops = _dsi_host_ops;
dsi->host.dev = dev;
 
+   if (of_device_is_compatible(dev->of_node,
+   "allwinner,sun6i-a31-mipi-dsi"))
+   bus_clk_name = "bus";
+
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
base = devm_ioremap_resource(dev, res);
if (IS_ERR(base)) {
@@ -1107,25 +1112,35 @@ static int sun6i_dsi_probe(struct platform_device *pdev)
return PTR_ERR(dsi->regulator);
}
 
-   dsi->regs = devm_regmap_init_mmio_clk(dev, "bus", base,
- _dsi_regmap_config);
-   if (IS_ERR(dsi->regs)) {
-   dev_err(dev, "Couldn't create the DSI encoder regmap\n");
-   return PTR_ERR(dsi->regs);
-   }
-
dsi->reset = devm_reset_control_get_shared(dev, NULL);
if (IS_ERR(dsi->reset)) {
dev_err(dev, "Couldn't get our reset line\n");
return PTR_ERR(dsi->reset);
}
 
+   dsi->regs = devm_regmap_init_mmio(dev, base, _dsi_regmap_config);
+   if (IS_ERR(dsi->regs)) {
+   dev_err(dev, "Couldn't init regmap\n");
+   return PTR_ERR(dsi->regs);
+   }
+
+   dsi->bus_clk = devm_clk_get(dev, bus_clk_name);
+   if (IS_ERR(dsi->bus_clk)) {
+   dev_err(dev, "Couldn't get the DSI bus clock\n");
+   return PTR_ERR(dsi->bus_clk);
+   } else {
+   ret = regmap_mmio_attach_clk(dsi->regs, dsi->bus_clk);
+   if (ret)
+   return ret;
+   }
+
if (of_device_is_compatible(dev->of_node,
"allwinner,sun6i-a31-mipi-dsi")) {
dsi->mod_clk = devm_clk_get(dev, "mod");
if (IS_ERR(dsi->mod_clk)) {
dev_err(dev, "Couldn't get the DSI mod clock\n");
-   return PTR_ERR(dsi->mod_clk);
+   ret = PTR_ERR(dsi->mod_clk);
+   goto err_attach_clk;
}
}
 
@@ -1164,6 +1179,9 @@ static int sun6i_dsi_probe(struct platform_device *pdev)
pm_runtime_disable(dev);
 err_unprotect_clk:
clk_rate_exclusive_put(dsi->mod_clk);
+err_attach_clk:
+   if (!IS_ERR(dsi->bus_clk))
+   regmap_mmio_detach_clk(dsi->regs);
return ret;
 }
 
@@ -1177,6 +1195,9 @@ static int sun6i_dsi_remove(struct platform_device *pdev)
pm_runtime_disable(dev);
clk_rate_exclusive_put(dsi->mod_clk);
 
+   if (!IS_ERR(dsi->bus_clk))
+   regmap_mmio_detach_clk(dsi->regs);
+
return 0;
 }
 
-- 
2.18.0.321.gffc6fa0e3

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20191222132229.30276-5-jagan%40amarulasolutions.com.


[linux-sunxi] [PATCH v14 0/7] drm/sun4i: Allwinner A64 MIPI-DSI support

2019-12-22 Thread Jagan Teki
This is v14 version for Allwinner A64 MIPI-DSI support
and here is the previous version set[1]

Changes for v14:
- drop explicit regmap_exit, clk_put
Changes for v13:
- update dt-bindings for A64
- drop has_mod_clk variant
- use regmap bus clock properly
Changes for v12:
- use enum insted of oneOf+const
- handle bus clock using regmap attach clk
- tested on A64, A33 boards.
Changes for v11:
- fix dt-bindings for dphy
- fix dt-bindings for dsi controller
- add bus clock handling code
- tested on A64, A33 boards.
Changes for v10:
- updated dt-bindings as per .yaml format
- rebased on drm-misc/for-linux-next
Changes for v9:
- moved dsi fixes in separate series on top of A33
- rebase on linux-next
Changes for v8:
- rebased on drm-misc change along with linux-next
- reworked video start delay patch
- tested on 4 different dsi panels
- reworked commit messages
Changes for v7:
- moved vcc-dsi binding to required filed.
- drop quotes on fallback dphy bindings.
- drop min_rate clock pll-mipi patches.
- introduce dclk divider computation as like A64 BSP.
- add A64 DSI quark patches.
- fixed A64 DSI pipeline.
- add proper commit messages.
- collect Merlijn Wajer Tested-by credits.
Changes for v6:
- dropped unneeded changes, patches
- fixed all burst mode patches as per previous version comments
- rebase on master
- update proper commit message
- dropped unneeded comments
- order the patches that make review easy
Changes for v5:
- collect Rob, Acked-by
- droped "Fix VBP size calculation" patch
- updated vblk timing calculation.
- droped techstar, bananapi dsi panel drivers which may require
  bridge or other setup. it's under discussion.
Changes for v4:
- droppoed untested CCU_FEATURE_FIXED_POSTDIV check code in
  nkm min, max rate patches
- create two patches for "Add Allwinner A64 MIPI DSI support"
  one for has_mod_clk quirk and other one for A64 support
- use existing driver code construct for hblk computation
- dropped "Increase hfp packet overhead" patch [2], though BSP added
  this but we have no issues as of now.
  (no issues on panel side w/o this change)
- create separate function for vblk computation 
- enable vcc-dsi regulator in dsi_runtime_resume
- collect Rob, Acked-by
- update MAINTAINERS file for panel drivers
- cleanup commit messages
- fixed checkpatch warnings/errors

[1] https://patchwork.freedesktop.org/series/71131/

Any inputs?
Jagan.

Jagan Teki (7):
  dt-bindings: sun6i-dsi: Document A64 MIPI-DSI controller
  dt-bindings: sun6i-dsi: Add A64 DPHY compatible (w/ A31 fallback)
  drm/sun4i: dsi: Get the mod clock for A31
  drm/sun4i: dsi: Handle bus clock via regmap_mmio_attach_clk
  drm/sun4i: dsi: Add Allwinner A64 MIPI DSI support
  arm64: dts: allwinner: a64: Add MIPI DSI pipeline
  [DO NOT MERGE] arm64: dts: allwinner: bananapi-m64: Enable Bananapi 
S070WV20-CT16 DSI
panel

 .../display/allwinner,sun6i-a31-mipi-dsi.yaml | 33 -
 .../phy/allwinner,sun6i-a31-mipi-dphy.yaml|  6 ++-
 .../dts/allwinner/sun50i-a64-bananapi-m64.dts | 31 
 arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 37 +++
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c| 47 ++-
 5 files changed, 140 insertions(+), 14 deletions(-)

-- 
2.18.0.321.gffc6fa0e3

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20191222132229.30276-1-jagan%40amarulasolutions.com.


[linux-sunxi] [PATCH v14 1/7] dt-bindings: sun6i-dsi: Document A64 MIPI-DSI controller

2019-12-22 Thread Jagan Teki
The MIPI DSI controller in Allwinner A64 is similar to A33.

But unlike A33, A64 doesn't have DSI_SCLK gating so it is valid
to have separate compatible for A64 on the same driver.

DSI_SCLK uses mod clock-names on dt-bindings, so the same
is not required for A64.

On that note
- A64 require minimum of 1 clock like the bus clock
- A33 require minimum of 2 clocks like both bus, mod clocks

So, update dt-bindings so-that it can document both A33,
A64 bindings requirements.

Reviewed-by: Rob Herring 
Signed-off-by: Jagan Teki 
---
Changes for v14:
- none

 .../display/allwinner,sun6i-a31-mipi-dsi.yaml | 33 +--
 1 file changed, 31 insertions(+), 2 deletions(-)

diff --git 
a/Documentation/devicetree/bindings/display/allwinner,sun6i-a31-mipi-dsi.yaml 
b/Documentation/devicetree/bindings/display/allwinner,sun6i-a31-mipi-dsi.yaml
index dafc0980c4fa..d41ecb5e7f7c 100644
--- 
a/Documentation/devicetree/bindings/display/allwinner,sun6i-a31-mipi-dsi.yaml
+++ 
b/Documentation/devicetree/bindings/display/allwinner,sun6i-a31-mipi-dsi.yaml
@@ -15,7 +15,9 @@ properties:
   "#size-cells": true
 
   compatible:
-const: allwinner,sun6i-a31-mipi-dsi
+enum:
+  - allwinner,sun6i-a31-mipi-dsi
+  - allwinner,sun50i-a64-mipi-dsi
 
   reg:
 maxItems: 1
@@ -24,6 +26,8 @@ properties:
 maxItems: 1
 
   clocks:
+minItems: 1
+maxItems: 2
 items:
   - description: Bus Clock
   - description: Module Clock
@@ -63,13 +67,38 @@ required:
   - reg
   - interrupts
   - clocks
-  - clock-names
   - phys
   - phy-names
   - resets
   - vcc-dsi-supply
   - port
 
+allOf:
+  - if:
+  properties:
+ compatible:
+   contains:
+ const: allwinner,sun6i-a31-mipi-dsi
+
+then:
+properties:
+  clocks:
+minItems: 2
+
+required:
+  - clock-names
+
+  - if:
+  properties:
+ compatible:
+   contains:
+ const: allwinner,sun50i-a64-mipi-dsi
+
+then:
+properties:
+  clocks:
+minItems: 1
+
 additionalProperties: false
 
 examples:
-- 
2.18.0.321.gffc6fa0e3

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20191222132229.30276-2-jagan%40amarulasolutions.com.


[linux-sunxi] Re: [PATCH v13 4/7] drm/sun4i: dsi: Handle bus clock via regmap_mmio_attach_clk

2019-12-21 Thread Jagan Teki
On Thu, Dec 19, 2019 at 3:35 AM Maxime Ripard  wrote:
>
> On Thu, Dec 19, 2019 at 12:40:14AM +0530, Jagan Teki wrote:
> > regmap has special API to enable the controller bus clock while
> > initializing register space, and current driver is using
> > devm_regmap_init_mmio_clk which require to specify bus
> > clk_id argument as "bus"
> >
> > But, the usage of clocks are varies between different Allwinner
> > DSI controllers. Clocking in A33 would need bus and mod clocks
> > where as A64 would need only bus clock.
> >
> > Since A64 support only single bus clock, it is optional to
> > specify the clock-names on the controller device tree node.
> > So using NULL on clk_id would get the attached clock.
> >
> > To support clk_id as "bus" and "NULL" during clock enablement
> > between controllers, this patch add generic code to handle
> > the bus clock using regmap_mmio_attach_clk with associated
> > regmap APIs.
> >
> > Signed-off-by: Jagan Teki 
> > ---
> > Changes for v13:
> > - update the changes since has_mod_clk is dropped in previous patch
> >
> >  drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 45 +-
> >  1 file changed, 37 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c 
> > b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> > index 68b88a3dc4c5..de8955fbeb00 100644
> > --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> > +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> > @@ -1081,6 +1081,7 @@ static const struct component_ops sun6i_dsi_ops = {
> >  static int sun6i_dsi_probe(struct platform_device *pdev)
> >  {
> >   struct device *dev = >dev;
> > + const char *bus_clk_name = NULL;
> >   struct sun6i_dsi *dsi;
> >   struct resource *res;
> >   void __iomem *base;
> > @@ -1094,6 +1095,10 @@ static int sun6i_dsi_probe(struct platform_device 
> > *pdev)
> >   dsi->host.ops = _dsi_host_ops;
> >   dsi->host.dev = dev;
> >
> > + if (of_device_is_compatible(dev->of_node,
> > + "allwinner,sun6i-a31-mipi-dsi"))
> > + bus_clk_name = "bus";
> > +
> >   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> >   base = devm_ioremap_resource(dev, res);
> >   if (IS_ERR(base)) {
> > @@ -1107,25 +1112,36 @@ static int sun6i_dsi_probe(struct platform_device 
> > *pdev)
> >   return PTR_ERR(dsi->regulator);
> >   }
> >
> > - dsi->regs = devm_regmap_init_mmio_clk(dev, "bus", base,
> > -   _dsi_regmap_config);
> > - if (IS_ERR(dsi->regs)) {
> > - dev_err(dev, "Couldn't create the DSI encoder regmap\n");
> > - return PTR_ERR(dsi->regs);
> > - }
> > -
> >   dsi->reset = devm_reset_control_get_shared(dev, NULL);
> >   if (IS_ERR(dsi->reset)) {
> >   dev_err(dev, "Couldn't get our reset line\n");
> >   return PTR_ERR(dsi->reset);
> >   }
> >
> > + dsi->regs = devm_regmap_init_mmio(dev, base, 
> > _dsi_regmap_config);
> > + if (IS_ERR(dsi->regs)) {
> > + dev_err(dev, "Couldn't init regmap\n");
> > + return PTR_ERR(dsi->regs);
> > + }
> > +
> > + dsi->bus_clk = devm_clk_get(dev, bus_clk_name);
> > + if (IS_ERR(dsi->bus_clk)) {
> > + dev_err(dev, "Couldn't get the DSI bus clock\n");
> > + ret = PTR_ERR(dsi->bus_clk);
> > + goto err_regmap;
> > + } else {
> > + ret = regmap_mmio_attach_clk(dsi->regs, dsi->bus_clk);
> > + if (ret)
> > + goto err_bus_clk;
> > + }
> > +
> >   if (of_device_is_compatible(dev->of_node,
> >   "allwinner,sun6i-a31-mipi-dsi")) {
> >   dsi->mod_clk = devm_clk_get(dev, "mod");
> >   if (IS_ERR(dsi->mod_clk)) {
> >   dev_err(dev, "Couldn't get the DSI mod clock\n");
> > - return PTR_ERR(dsi->mod_clk);
> > + ret = PTR_ERR(dsi->mod_clk);
> > + goto err_attach_clk;
> >   }
> >   }
> >
> > @@ -1164,6 +1180,14 @@ static int sun6i_dsi_probe(struct platform_device 
> > *pdev)

[linux-sunxi] [DO NOT MERGE] [PATCH v13 7/7] arm64: dts: allwinner: bananapi-m64: Enable Bananapi S070WV20-CT16 DSI panel

2019-12-18 Thread Jagan Teki
This patch add support for Bananapi S070WV20-CT16 DSI panel to
BPI-M64 board.

DSI panel connected via board DSI port with,
- DLDO1 as VCC-DSI supply
- DCDC1 as VDD supply
- PD7 gpio for lcd enable pin
- PD6 gpio for lcd reset pin
- PD5 gpio for backlight enable pin

Signed-off-by: Jagan Teki 
---
 .../dts/allwinner/sun50i-a64-bananapi-m64.dts | 31 +++
 1 file changed, 31 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts 
b/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts
index 208373efee49..6beaecdd802a 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts
@@ -45,6 +45,7 @@
 #include "sun50i-a64.dtsi"
 
 #include 
+#include 
 
 / {
model = "BananaPi-M64";
@@ -56,6 +57,14 @@
serial1 = 
};
 
+   backlight: backlight {
+   compatible = "pwm-backlight";
+   pwms = <_pwm 0 5 PWM_POLARITY_INVERTED>;
+   brightness-levels = <1 2 4 8 16 32 64 128 255>;
+   default-brightness-level = <2>;
+   enable-gpios = < 3 5 GPIO_ACTIVE_HIGH>; /* LCD-BL-EN: PD5 */
+   };
+
chosen {
stdout-path = "serial0:115200n8";
};
@@ -116,6 +125,24 @@
status = "okay";
 };
 
+ {
+   status = "okay";
+};
+
+ {
+   vcc-dsi-supply = <_dldo1>;  /* VCC3V3-DSI */
+   status = "okay";
+
+   panel@0 {
+   compatible = "bananapi,s070wv20-ct16-icn6211";
+   reg = <0>;
+   enable-gpios = < 3 7 GPIO_ACTIVE_HIGH>; /* LCD-PWR-EN: PD7 
*/
+   reset-gpios = < 3 6 GPIO_ACTIVE_HIGH>; /* LCD-RST: PD6 */
+   vdd-supply = <_dcdc1>;
+   backlight = <>;
+   };
+};
+
  {
status = "okay";
 };
@@ -206,6 +233,10 @@
status = "okay";
 };
 
+_pwm {
+   status = "okay";
+};
+
 _rsb {
status = "okay";
 
-- 
2.18.0.321.gffc6fa0e3

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20191218191017.2895-8-jagan%40amarulasolutions.com.


[linux-sunxi] [PATCH v13 1/7] dt-bindings: sun6i-dsi: Document A64 MIPI-DSI controller

2019-12-18 Thread Jagan Teki
The MIPI DSI controller in Allwinner A64 is similar to A33.

But unlike A33, A64 doesn't have DSI_SCLK gating so it is valid
to have separate compatible for A64 on the same driver.

DSI_SCLK uses mod clock-names on dt-bindings, so the same
is not required for A64.

On that note
- A64 require minimum of 1 clock like the bus clock
- A33 require minimum of 2 clocks like both bus, mod clocks

So, update dt-bindings so-that it can document both A33,
A64 bindings requirements.

Reviewed-by: Rob Herring 
Signed-off-by: Jagan Teki 
---
Changes for v13:
- Add if statement for A64 with single clock

 .../display/allwinner,sun6i-a31-mipi-dsi.yaml | 33 +--
 1 file changed, 31 insertions(+), 2 deletions(-)

diff --git 
a/Documentation/devicetree/bindings/display/allwinner,sun6i-a31-mipi-dsi.yaml 
b/Documentation/devicetree/bindings/display/allwinner,sun6i-a31-mipi-dsi.yaml
index dafc0980c4fa..d41ecb5e7f7c 100644
--- 
a/Documentation/devicetree/bindings/display/allwinner,sun6i-a31-mipi-dsi.yaml
+++ 
b/Documentation/devicetree/bindings/display/allwinner,sun6i-a31-mipi-dsi.yaml
@@ -15,7 +15,9 @@ properties:
   "#size-cells": true
 
   compatible:
-const: allwinner,sun6i-a31-mipi-dsi
+enum:
+  - allwinner,sun6i-a31-mipi-dsi
+  - allwinner,sun50i-a64-mipi-dsi
 
   reg:
 maxItems: 1
@@ -24,6 +26,8 @@ properties:
 maxItems: 1
 
   clocks:
+minItems: 1
+maxItems: 2
 items:
   - description: Bus Clock
   - description: Module Clock
@@ -63,13 +67,38 @@ required:
   - reg
   - interrupts
   - clocks
-  - clock-names
   - phys
   - phy-names
   - resets
   - vcc-dsi-supply
   - port
 
+allOf:
+  - if:
+  properties:
+ compatible:
+   contains:
+ const: allwinner,sun6i-a31-mipi-dsi
+
+then:
+properties:
+  clocks:
+minItems: 2
+
+required:
+  - clock-names
+
+  - if:
+  properties:
+ compatible:
+   contains:
+ const: allwinner,sun50i-a64-mipi-dsi
+
+then:
+properties:
+  clocks:
+minItems: 1
+
 additionalProperties: false
 
 examples:
-- 
2.18.0.321.gffc6fa0e3

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20191218191017.2895-2-jagan%40amarulasolutions.com.


[linux-sunxi] [PATCH v13 4/7] drm/sun4i: dsi: Handle bus clock via regmap_mmio_attach_clk

2019-12-18 Thread Jagan Teki
regmap has special API to enable the controller bus clock while
initializing register space, and current driver is using
devm_regmap_init_mmio_clk which require to specify bus
clk_id argument as "bus"

But, the usage of clocks are varies between different Allwinner
DSI controllers. Clocking in A33 would need bus and mod clocks
where as A64 would need only bus clock.

Since A64 support only single bus clock, it is optional to
specify the clock-names on the controller device tree node.
So using NULL on clk_id would get the attached clock.

To support clk_id as "bus" and "NULL" during clock enablement
between controllers, this patch add generic code to handle
the bus clock using regmap_mmio_attach_clk with associated
regmap APIs.

Signed-off-by: Jagan Teki 
---
Changes for v13:
- update the changes since has_mod_clk is dropped in previous patch

 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 45 +-
 1 file changed, 37 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c 
b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
index 68b88a3dc4c5..de8955fbeb00 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
@@ -1081,6 +1081,7 @@ static const struct component_ops sun6i_dsi_ops = {
 static int sun6i_dsi_probe(struct platform_device *pdev)
 {
struct device *dev = >dev;
+   const char *bus_clk_name = NULL;
struct sun6i_dsi *dsi;
struct resource *res;
void __iomem *base;
@@ -1094,6 +1095,10 @@ static int sun6i_dsi_probe(struct platform_device *pdev)
dsi->host.ops = _dsi_host_ops;
dsi->host.dev = dev;
 
+   if (of_device_is_compatible(dev->of_node,
+   "allwinner,sun6i-a31-mipi-dsi"))
+   bus_clk_name = "bus";
+
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
base = devm_ioremap_resource(dev, res);
if (IS_ERR(base)) {
@@ -1107,25 +1112,36 @@ static int sun6i_dsi_probe(struct platform_device *pdev)
return PTR_ERR(dsi->regulator);
}
 
-   dsi->regs = devm_regmap_init_mmio_clk(dev, "bus", base,
- _dsi_regmap_config);
-   if (IS_ERR(dsi->regs)) {
-   dev_err(dev, "Couldn't create the DSI encoder regmap\n");
-   return PTR_ERR(dsi->regs);
-   }
-
dsi->reset = devm_reset_control_get_shared(dev, NULL);
if (IS_ERR(dsi->reset)) {
dev_err(dev, "Couldn't get our reset line\n");
return PTR_ERR(dsi->reset);
}
 
+   dsi->regs = devm_regmap_init_mmio(dev, base, _dsi_regmap_config);
+   if (IS_ERR(dsi->regs)) {
+   dev_err(dev, "Couldn't init regmap\n");
+   return PTR_ERR(dsi->regs);
+   }
+
+   dsi->bus_clk = devm_clk_get(dev, bus_clk_name);
+   if (IS_ERR(dsi->bus_clk)) {
+   dev_err(dev, "Couldn't get the DSI bus clock\n");
+   ret = PTR_ERR(dsi->bus_clk);
+   goto err_regmap;
+   } else {
+   ret = regmap_mmio_attach_clk(dsi->regs, dsi->bus_clk);
+   if (ret)
+   goto err_bus_clk;
+   }
+
if (of_device_is_compatible(dev->of_node,
"allwinner,sun6i-a31-mipi-dsi")) {
dsi->mod_clk = devm_clk_get(dev, "mod");
if (IS_ERR(dsi->mod_clk)) {
dev_err(dev, "Couldn't get the DSI mod clock\n");
-   return PTR_ERR(dsi->mod_clk);
+   ret = PTR_ERR(dsi->mod_clk);
+   goto err_attach_clk;
}
}
 
@@ -1164,6 +1180,14 @@ static int sun6i_dsi_probe(struct platform_device *pdev)
pm_runtime_disable(dev);
 err_unprotect_clk:
clk_rate_exclusive_put(dsi->mod_clk);
+err_attach_clk:
+   if (!IS_ERR(dsi->bus_clk))
+   regmap_mmio_detach_clk(dsi->regs);
+err_bus_clk:
+   if (!IS_ERR(dsi->bus_clk))
+   clk_put(dsi->bus_clk);
+err_regmap:
+   regmap_exit(dsi->regs);
return ret;
 }
 
@@ -1177,6 +1201,11 @@ static int sun6i_dsi_remove(struct platform_device *pdev)
pm_runtime_disable(dev);
clk_rate_exclusive_put(dsi->mod_clk);
 
+   if (!IS_ERR(dsi->bus_clk))
+   regmap_mmio_detach_clk(dsi->regs);
+
+   regmap_exit(dsi->regs);
+
return 0;
 }
 
-- 
2.18.0.321.gffc6fa0e3

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20191218191017.2895-5-jagan%40amarulasolutions.com.


[linux-sunxi] [PATCH v13 6/7] arm64: dts: allwinner: a64: Add MIPI DSI pipeline

2019-12-18 Thread Jagan Teki
Add MIPI DSI pipeline for Allwinner A64.

- dsi node, with A64 compatible since it doesn't support
  DSI_SCLK gating unlike A33
- dphy node, with A64 compatible with A33 fallback since
  DPHY on A64 and A33 is similar
- finally, attach the dsi_in to tcon0 for complete MIPI DSI

Signed-off-by: Jagan Teki 
Tested-by: Merlijn Wajer 
---
Changes for v13:
- none 

 arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 37 +++
 1 file changed, 37 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi 
b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
index 27e48234f1c2..1db8378f59a4 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
@@ -382,6 +382,12 @@
#address-cells = <1>;
#size-cells = <0>;
reg = <1>;
+
+   tcon0_out_dsi: endpoint@1 {
+   reg = <1>;
+   remote-endpoint = 
<_in_tcon0>;
+   allwinner,tcon-channel = <1>;
+   };
};
};
};
@@ -1014,6 +1020,37 @@
status = "disabled";
};
 
+   dsi: dsi@1ca {
+   compatible = "allwinner,sun50i-a64-mipi-dsi";
+   reg = <0x01ca 0x1000>;
+   interrupts = ;
+   clocks = < CLK_BUS_MIPI_DSI>;
+   resets = < RST_BUS_MIPI_DSI>;
+   phys = <>;
+   phy-names = "dphy";
+   status = "disabled";
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port {
+   dsi_in_tcon0: endpoint {
+   remote-endpoint = <_out_dsi>;
+   };
+   };
+   };
+
+   dphy: d-phy@1ca1000 {
+   compatible = "allwinner,sun50i-a64-mipi-dphy",
+"allwinner,sun6i-a31-mipi-dphy";
+   reg = <0x01ca1000 0x1000>;
+   clocks = < CLK_BUS_MIPI_DSI>,
+< CLK_DSI_DPHY>;
+   clock-names = "bus", "mod";
+   resets = < RST_BUS_MIPI_DSI>;
+   status = "disabled";
+   #phy-cells = <0>;
+   };
+
hdmi: hdmi@1ee {
compatible = "allwinner,sun50i-a64-dw-hdmi",
 "allwinner,sun8i-a83t-dw-hdmi";
-- 
2.18.0.321.gffc6fa0e3

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20191218191017.2895-7-jagan%40amarulasolutions.com.


[linux-sunxi] [PATCH v13 2/7] dt-bindings: sun6i-dsi: Add A64 DPHY compatible (w/ A31 fallback)

2019-12-18 Thread Jagan Teki
The MIPI DSI PHY controller on Allwinner A64 is similar
on the one on A31.

Add A64 compatible and append A31 compatible as fallback.

Reviewed-by: Rob Herring 
Signed-off-by: Jagan Teki 
---
Changes for v13:
- collect Rob review tag

 .../bindings/phy/allwinner,sun6i-a31-mipi-dphy.yaml | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git 
a/Documentation/devicetree/bindings/phy/allwinner,sun6i-a31-mipi-dphy.yaml 
b/Documentation/devicetree/bindings/phy/allwinner,sun6i-a31-mipi-dphy.yaml
index fa46670de299..8841938050b2 100644
--- a/Documentation/devicetree/bindings/phy/allwinner,sun6i-a31-mipi-dphy.yaml
+++ b/Documentation/devicetree/bindings/phy/allwinner,sun6i-a31-mipi-dphy.yaml
@@ -15,7 +15,11 @@ properties:
 const: 0
 
   compatible:
-const: allwinner,sun6i-a31-mipi-dphy
+oneOf:
+  - const: allwinner,sun6i-a31-mipi-dphy
+  - items:
+  - const: allwinner,sun50i-a64-mipi-dphy
+  - const: allwinner,sun6i-a31-mipi-dphy
 
   reg:
 maxItems: 1
-- 
2.18.0.321.gffc6fa0e3

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20191218191017.2895-3-jagan%40amarulasolutions.com.


[linux-sunxi] [PATCH v13 5/7] drm/sun4i: dsi: Add Allwinner A64 MIPI DSI support

2019-12-18 Thread Jagan Teki
The MIPI DSI controller in Allwinner A64 is similar to A33.

But unlike A33, A64 doesn't have DSI_SCLK gating so add compatible
for Allwinner A64 with uninitialized has_mod_clk driver.

Signed-off-by: Jagan Teki 
Tested-by: Merlijn Wajer 
---
Changes for v13:
- update the changes since has_mod_clk is dropped in previous patch

 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c 
b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
index de8955fbeb00..8669d5f0e744 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
@@ -1264,6 +1264,7 @@ static const struct dev_pm_ops sun6i_dsi_pm_ops = {
 
 static const struct of_device_id sun6i_dsi_of_table[] = {
{ .compatible = "allwinner,sun6i-a31-mipi-dsi" },
+   { .compatible = "allwinner,sun50i-a64-mipi-dsi" },
{ }
 };
 MODULE_DEVICE_TABLE(of, sun6i_dsi_of_table);
-- 
2.18.0.321.gffc6fa0e3

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20191218191017.2895-6-jagan%40amarulasolutions.com.


[linux-sunxi] [PATCH v13 0/7] drm/sun4i: Allwinner A64 MIPI-DSI support

2019-12-18 Thread Jagan Teki
This is v13 version for Allwinner A64 MIPI-DSI support
and here is the previous version set[1]

Changes for v13:
- update dt-bindings for A64
- drop has_mod_clk variant
- use regmap bus clock properly
Changes for v12:
- use enum insted of oneOf+const
- handle bus clock using regmap attach clk
- tested on A64, A33 boards.
Changes for v11:
- fix dt-bindings for dphy
- fix dt-bindings for dsi controller
- add bus clock handling code
- tested on A64, A33 boards.
Changes for v10:
- updated dt-bindings as per .yaml format
- rebased on drm-misc/for-linux-next
Changes for v9:
- moved dsi fixes in separate series on top of A33
- rebase on linux-next
Changes for v8:
- rebased on drm-misc change along with linux-next
- reworked video start delay patch
- tested on 4 different dsi panels
- reworked commit messages
Changes for v7:
- moved vcc-dsi binding to required filed.
- drop quotes on fallback dphy bindings.
- drop min_rate clock pll-mipi patches.
- introduce dclk divider computation as like A64 BSP.
- add A64 DSI quark patches.
- fixed A64 DSI pipeline.
- add proper commit messages.
- collect Merlijn Wajer Tested-by credits.
Changes for v6:
- dropped unneeded changes, patches
- fixed all burst mode patches as per previous version comments
- rebase on master
- update proper commit message
- dropped unneeded comments
- order the patches that make review easy
Changes for v5:
- collect Rob, Acked-by
- droped "Fix VBP size calculation" patch
- updated vblk timing calculation.
- droped techstar, bananapi dsi panel drivers which may require
  bridge or other setup. it's under discussion.
Changes for v4:
- droppoed untested CCU_FEATURE_FIXED_POSTDIV check code in
  nkm min, max rate patches
- create two patches for "Add Allwinner A64 MIPI DSI support"
  one for has_mod_clk quirk and other one for A64 support
- use existing driver code construct for hblk computation
- dropped "Increase hfp packet overhead" patch [2], though BSP added
  this but we have no issues as of now.
  (no issues on panel side w/o this change)
- create separate function for vblk computation 
- enable vcc-dsi regulator in dsi_runtime_resume
- collect Rob, Acked-by
- update MAINTAINERS file for panel drivers
- cleanup commit messages
- fixed checkpatch warnings/errors

[1] https://patchwork.freedesktop.org/series/70361/

Any inputs?
Jagan.

Jagan Teki (7):
  dt-bindings: sun6i-dsi: Document A64 MIPI-DSI controller
  dt-bindings: sun6i-dsi: Add A64 DPHY compatible (w/ A31 fallback)
  drm/sun4i: dsi: Get the mod clock for A31
  drm/sun4i: dsi: Handle bus clock via regmap_mmio_attach_clk
  drm/sun4i: dsi: Add Allwinner A64 MIPI DSI support
  arm64: dts: allwinner: a64: Add MIPI DSI pipeline
  [DO NOT MERGE] arm64: dts: allwinner: bananapi-m64: Enable Bananapi 
S070WV20-CT16 DSI
panel

 .../display/allwinner,sun6i-a31-mipi-dsi.yaml | 33 ++-
 .../phy/allwinner,sun6i-a31-mipi-dphy.yaml|  6 +-
 .../dts/allwinner/sun50i-a64-bananapi-m64.dts | 31 +++
 arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 37 +
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c| 55 +++
 5 files changed, 148 insertions(+), 14 deletions(-)

-- 
2.18.0.321.gffc6fa0e3

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20191218191017.2895-1-jagan%40amarulasolutions.com.


[linux-sunxi] [PATCH v13 3/7] drm/sun4i: dsi: Get the mod clock for A31

2019-12-18 Thread Jagan Teki
As per the user manual, look like mod clock is not mandatory
for all Allwinner MIPI DSI controllers, it is connected to
CLK_DSI_SCLK for A31 and not available in A64.

So, add compatible check for A31 and get mod clock accordingly.

Tested-by: Merlijn Wajer 
Signed-off-by: Jagan Teki 
---
Changes for v13:
- Drop has_mod_clk quirk as commented by Chen-Yu

 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c 
b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
index c958ca9bae63..68b88a3dc4c5 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
@@ -1120,10 +1120,13 @@ static int sun6i_dsi_probe(struct platform_device *pdev)
return PTR_ERR(dsi->reset);
}
 
-   dsi->mod_clk = devm_clk_get(dev, "mod");
-   if (IS_ERR(dsi->mod_clk)) {
-   dev_err(dev, "Couldn't get the DSI mod clock\n");
-   return PTR_ERR(dsi->mod_clk);
+   if (of_device_is_compatible(dev->of_node,
+   "allwinner,sun6i-a31-mipi-dsi")) {
+   dsi->mod_clk = devm_clk_get(dev, "mod");
+   if (IS_ERR(dsi->mod_clk)) {
+   dev_err(dev, "Couldn't get the DSI mod clock\n");
+   return PTR_ERR(dsi->mod_clk);
+   }
}
 
/*
-- 
2.18.0.321.gffc6fa0e3

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20191218191017.2895-4-jagan%40amarulasolutions.com.


[linux-sunxi] Re: [PATCH v12 1/7] dt-bindings: sun6i-dsi: Document A64 MIPI-DSI controller

2019-12-17 Thread Jagan Teki
On Tue, Dec 17, 2019 at 12:04 AM Maxime Ripard  wrote:
>
> On Mon, Dec 16, 2019 at 10:29:08PM +0530, Jagan Teki wrote:
> > On Mon, Dec 16, 2019 at 4:50 PM Maxime Ripard  wrote:
> > >
> > > On Mon, Dec 16, 2019 at 04:37:20PM +0530, Jagan Teki wrote:
> > > > On Wed, Dec 4, 2019 at 7:06 PM Maxime Ripard  wrote:
> > > > >
> > > > > On Tue, Dec 03, 2019 at 07:18:10PM +0530, Jagan Teki wrote:
> > > > > > The MIPI DSI controller in Allwinner A64 is similar to A33.
> > > > > >
> > > > > > But unlike A33, A64 doesn't have DSI_SCLK gating so it is valid
> > > > > > to have separate compatible for A64 on the same driver.
> > > > > >
> > > > > > DSI_SCLK uses mod clock-names on dt-bindings, so the same
> > > > > > is not required for A64.
> > > > > >
> > > > > > On that note
> > > > > > - A64 require minimum of 1 clock like the bus clock
> > > > > > - A33 require minimum of 2 clocks like both bus, mod clocks
> > > > > >
> > > > > > So, update dt-bindings so-that it can document both A33,
> > > > > > A64 bindings requirements.
> > > > > >
> > > > > > Reviewed-by: Rob Herring 
> > > > > > Signed-off-by: Jagan Teki 
> > > > > > ---
> > > > > > Changes for v12:
> > > > > > - Use 'enum' instead of oneOf+const
> > > > > >
> > > > > >  .../display/allwinner,sun6i-a31-mipi-dsi.yaml | 20 
> > > > > > +--
> > > > > >  1 file changed, 18 insertions(+), 2 deletions(-)
> > > > > >
> > > > > > diff --git 
> > > > > > a/Documentation/devicetree/bindings/display/allwinner,sun6i-a31-mipi-dsi.yaml
> > > > > >  
> > > > > > b/Documentation/devicetree/bindings/display/allwinner,sun6i-a31-mipi-dsi.yaml
> > > > > > index dafc0980c4fa..b91446475f35 100644
> > > > > > --- 
> > > > > > a/Documentation/devicetree/bindings/display/allwinner,sun6i-a31-mipi-dsi.yaml
> > > > > > +++ 
> > > > > > b/Documentation/devicetree/bindings/display/allwinner,sun6i-a31-mipi-dsi.yaml
> > > > > > @@ -15,7 +15,9 @@ properties:
> > > > > >"#size-cells": true
> > > > > >
> > > > > >compatible:
> > > > > > -const: allwinner,sun6i-a31-mipi-dsi
> > > > > > +enum:
> > > > > > +  - allwinner,sun6i-a31-mipi-dsi
> > > > > > +  - allwinner,sun50i-a64-mipi-dsi
> > > > > >
> > > > > >reg:
> > > > > >  maxItems: 1
> > > > > > @@ -24,6 +26,8 @@ properties:
> > > > > >  maxItems: 1
> > > > > >
> > > > > >clocks:
> > > > > > +minItems: 1
> > > > > > +maxItems: 2
> > > > > >  items:
> > > > > >- description: Bus Clock
> > > > > >- description: Module Clock
> > > > > > @@ -63,13 +67,25 @@ required:
> > > > > >- reg
> > > > > >- interrupts
> > > > > >- clocks
> > > > > > -  - clock-names
> > > > > >- phys
> > > > > >- phy-names
> > > > > >- resets
> > > > > >- vcc-dsi-supply
> > > > > >- port
> > > > > >
> > > > > > +allOf:
> > > > > > +  - if:
> > > > > > +  properties:
> > > > > > + compatible:
> > > > > > +   contains:
> > > > > > + const: allwinner,sun6i-a31-mipi-dsi
> > > > > > +  then:
> > > > > > +properties:
> > > > > > +  clocks:
> > > > > > +minItems: 2
> > > > > > +required:
> > > > > > +  - clock-names
> > > > > > +
> > > > >
> > > > > Your else condition should check that the number of clocks items is 1
> > > > > on the A64
> > > >
> > > > But the minItems mentioned as 1 in clocks, which is unchanged number
> > > > by default. doesn'

[linux-sunxi] Re: [PATCH v12 1/7] dt-bindings: sun6i-dsi: Document A64 MIPI-DSI controller

2019-12-16 Thread Jagan Teki
On Mon, Dec 16, 2019 at 4:50 PM Maxime Ripard  wrote:
>
> On Mon, Dec 16, 2019 at 04:37:20PM +0530, Jagan Teki wrote:
> > On Wed, Dec 4, 2019 at 7:06 PM Maxime Ripard  wrote:
> > >
> > > On Tue, Dec 03, 2019 at 07:18:10PM +0530, Jagan Teki wrote:
> > > > The MIPI DSI controller in Allwinner A64 is similar to A33.
> > > >
> > > > But unlike A33, A64 doesn't have DSI_SCLK gating so it is valid
> > > > to have separate compatible for A64 on the same driver.
> > > >
> > > > DSI_SCLK uses mod clock-names on dt-bindings, so the same
> > > > is not required for A64.
> > > >
> > > > On that note
> > > > - A64 require minimum of 1 clock like the bus clock
> > > > - A33 require minimum of 2 clocks like both bus, mod clocks
> > > >
> > > > So, update dt-bindings so-that it can document both A33,
> > > > A64 bindings requirements.
> > > >
> > > > Reviewed-by: Rob Herring 
> > > > Signed-off-by: Jagan Teki 
> > > > ---
> > > > Changes for v12:
> > > > - Use 'enum' instead of oneOf+const
> > > >
> > > >  .../display/allwinner,sun6i-a31-mipi-dsi.yaml | 20 +--
> > > >  1 file changed, 18 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git 
> > > > a/Documentation/devicetree/bindings/display/allwinner,sun6i-a31-mipi-dsi.yaml
> > > >  
> > > > b/Documentation/devicetree/bindings/display/allwinner,sun6i-a31-mipi-dsi.yaml
> > > > index dafc0980c4fa..b91446475f35 100644
> > > > --- 
> > > > a/Documentation/devicetree/bindings/display/allwinner,sun6i-a31-mipi-dsi.yaml
> > > > +++ 
> > > > b/Documentation/devicetree/bindings/display/allwinner,sun6i-a31-mipi-dsi.yaml
> > > > @@ -15,7 +15,9 @@ properties:
> > > >"#size-cells": true
> > > >
> > > >compatible:
> > > > -const: allwinner,sun6i-a31-mipi-dsi
> > > > +enum:
> > > > +  - allwinner,sun6i-a31-mipi-dsi
> > > > +  - allwinner,sun50i-a64-mipi-dsi
> > > >
> > > >reg:
> > > >  maxItems: 1
> > > > @@ -24,6 +26,8 @@ properties:
> > > >  maxItems: 1
> > > >
> > > >clocks:
> > > > +minItems: 1
> > > > +maxItems: 2
> > > >  items:
> > > >- description: Bus Clock
> > > >- description: Module Clock
> > > > @@ -63,13 +67,25 @@ required:
> > > >- reg
> > > >- interrupts
> > > >- clocks
> > > > -  - clock-names
> > > >- phys
> > > >- phy-names
> > > >- resets
> > > >- vcc-dsi-supply
> > > >- port
> > > >
> > > > +allOf:
> > > > +  - if:
> > > > +  properties:
> > > > + compatible:
> > > > +   contains:
> > > > + const: allwinner,sun6i-a31-mipi-dsi
> > > > +  then:
> > > > +properties:
> > > > +  clocks:
> > > > +minItems: 2
> > > > +required:
> > > > +  - clock-names
> > > > +
> > >
> > > Your else condition should check that the number of clocks items is 1
> > > on the A64
> >
> > But the minItems mentioned as 1 in clocks, which is unchanged number
> > by default. doesn't it sufficient?
>
> In the main schema, it's said that the clocks property can have one or
> two elements (to cover the A31 case that has one, and the A64 case
> that has 2).
>
> This is fine.
>
> Later on, you enforce that the A64 has two elements, and this is fine
> too.

Actually A31 case has 2 and A64 case has 1.

>
> However, you never check that on the A31 you only have one clock, and
> you could very well have two and no one would notice.

I did check A31 case for 2 but not in A64. this is what you mean? so
adding A64 check like below would fine?

allOf:
  - if:
  properties:
 compatible:
   contains:
 const: allwinner,sun6i-a31-mipi-dsi
  then:
properties:
  clocks:
minItems: 2
required:
  - clock-names
  - if:
  properties:
 compatible:
   contains:
 const: allwinner,sun50i-a64-mipi-dsi
  then:
properties:
  clocks:
minItems: 1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CAMty3ZBU-XaxR_vM5L2yVbhR5ftfbtDn3jP00qCxBF%2BowVyqDQ%40mail.gmail.com.


[linux-sunxi] Re: [PATCH v12 1/7] dt-bindings: sun6i-dsi: Document A64 MIPI-DSI controller

2019-12-16 Thread Jagan Teki
On Wed, Dec 4, 2019 at 7:06 PM Maxime Ripard  wrote:
>
> On Tue, Dec 03, 2019 at 07:18:10PM +0530, Jagan Teki wrote:
> > The MIPI DSI controller in Allwinner A64 is similar to A33.
> >
> > But unlike A33, A64 doesn't have DSI_SCLK gating so it is valid
> > to have separate compatible for A64 on the same driver.
> >
> > DSI_SCLK uses mod clock-names on dt-bindings, so the same
> > is not required for A64.
> >
> > On that note
> > - A64 require minimum of 1 clock like the bus clock
> > - A33 require minimum of 2 clocks like both bus, mod clocks
> >
> > So, update dt-bindings so-that it can document both A33,
> > A64 bindings requirements.
> >
> > Reviewed-by: Rob Herring 
> > Signed-off-by: Jagan Teki 
> > ---
> > Changes for v12:
> > - Use 'enum' instead of oneOf+const
> >
> >  .../display/allwinner,sun6i-a31-mipi-dsi.yaml | 20 +--
> >  1 file changed, 18 insertions(+), 2 deletions(-)
> >
> > diff --git 
> > a/Documentation/devicetree/bindings/display/allwinner,sun6i-a31-mipi-dsi.yaml
> >  
> > b/Documentation/devicetree/bindings/display/allwinner,sun6i-a31-mipi-dsi.yaml
> > index dafc0980c4fa..b91446475f35 100644
> > --- 
> > a/Documentation/devicetree/bindings/display/allwinner,sun6i-a31-mipi-dsi.yaml
> > +++ 
> > b/Documentation/devicetree/bindings/display/allwinner,sun6i-a31-mipi-dsi.yaml
> > @@ -15,7 +15,9 @@ properties:
> >"#size-cells": true
> >
> >compatible:
> > -const: allwinner,sun6i-a31-mipi-dsi
> > +enum:
> > +  - allwinner,sun6i-a31-mipi-dsi
> > +  - allwinner,sun50i-a64-mipi-dsi
> >
> >reg:
> >  maxItems: 1
> > @@ -24,6 +26,8 @@ properties:
> >  maxItems: 1
> >
> >clocks:
> > +minItems: 1
> > +maxItems: 2
> >  items:
> >- description: Bus Clock
> >- description: Module Clock
> > @@ -63,13 +67,25 @@ required:
> >- reg
> >- interrupts
> >- clocks
> > -  - clock-names
> >- phys
> >- phy-names
> >- resets
> >- vcc-dsi-supply
> >- port
> >
> > +allOf:
> > +  - if:
> > +  properties:
> > + compatible:
> > +   contains:
> > + const: allwinner,sun6i-a31-mipi-dsi
> > +  then:
> > +properties:
> > +  clocks:
> > +minItems: 2
> > +required:
> > +  - clock-names
> > +
>
> Your else condition should check that the number of clocks items is 1
> on the A64

But the minItems mentioned as 1 in clocks, which is unchanged number
by default. doesn't it sufficient?

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CAMty3ZDU57Hj3ZSBC6sSMFWN9-HQadA03hmXUNUVS1W0UQQ3DA%40mail.gmail.com.


  1   2   3   4   5   6   7   8   9   10   >