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

2021-03-08 Thread Jernej Škrabec
Dne ponedeljek, 08. marec 2021 ob 08:57:31 CET je Jagan Teki napisal(a):
> 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?

You mean move this code there? Yeah, it's possible, but then we have to move 
sunxi_dw_hdmi_phy.h to general or arch includes folder, because it implements 
additional functionality which is not covered by general PHY interface.

Best regards,
Jernej



-- 
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/6933226.Xat2Mhy8F1%40jernej-laptop.


[linux-sunxi] Re: [PATCH v2 09/19] video: sunxi: de2: switch to public uclass functions

2021-03-08 Thread Jernej Škrabec
Dne torek, 09. marec 2021 ob 01:40:32 CET je Andre Przywara napisal(a):
> On Sun, 07 Mar 2021 08:35:23 +0100
> Jernej Škrabec  wrote:
> 
> Hi,
> 
> > Dne nedelja, 07. marec 2021 ob 02:32:52 CET je Andre Przywara napisal(a):
> > > On Sat,  6 Mar 2021 20:54:27 +0100
> > > 
> > > Jernej Skrabec  wrote:
> > > > Currently DE2 driver uses functions which are defined in internal
> > > > headers. They are not meant to be used outside of uclass framework.
> > > > Switch DE2 driver to public ones. This has additional benefit that
> > > > device_probe doesn't need to be called manually.
> > > 
> > > Indeed, good solution: for the calls in _probe(), we call de2_init()
> > > right afterwards, which would explicitly call probe for the display, so
> > > this both saves this call and the usage of the internal function.
> > > For the calls in simplefb_setup: the DM framework checks if a device
> > > has already been activated, so there is no problem with double probes.
> > > 
> > > However, actually testing this on a Pine64-LTS revealed that this breaks
> > > on the A64: I only get a black screen (bisecting down to this commit).
> > > 
> > > I didn't investigate any further yet, just wanted to give a heads up.
> > 
> > Thanks! I'll check what's going on.
> 
> I think I know what's going on, see below.
> 
> > > > Signed-off-by: Jernej Skrabec 
> > > > ---
> > > > 
> > > >  drivers/video/sunxi/sunxi_de2.c | 29 ++---
> > > >  1 file changed, 10 insertions(+), 19 deletions(-)
> > > > 
> > > > diff --git a/drivers/video/sunxi/sunxi_de2.c
> > > > b/drivers/video/sunxi/sunxi_de2.c index 6b836a011944..e02d359cd259
> > > > 100644
> > > > --- a/drivers/video/sunxi/sunxi_de2.c
> > > > +++ b/drivers/video/sunxi/sunxi_de2.c
> > > > @@ -19,8 +19,6 @@
> > > > 
> > > >  #include 
> > > >  #include 
> > > >  #include 
> > > > 
> > > > -#include 
> > > > -#include 
> > > > 
> > > >  #include 
> > > >  #include "simplefb_common.h"
> > > > 
> > > > @@ -198,13 +196,6 @@ static int sunxi_de2_init(struct udevice *dev,
> > > > ulong
> > > > fbbase,>
> > > > 
> > > > disp_uc_plat->source_id = mux;
> 
> The mux value is set *after* the call to uclass_find_device_by_name()
> (or uclass_get_device_by_driver()) returned, and then we call this
> function with it, which *used* to call probe().
> Now probe is already called as part of uclass_get_device_by_driver(),
> so *before* we had a chance to determine and set the mux value/
> source_id.
> For the H3/H5 it's 0, so it conveniently works with the probably zeroed
> uc_plat structure there.

Oh, thanks for looking into this!

> 
> Not sure how to fix this, as we get a handle to the device only after
> the uclass_find/get functions returned, so don't know where to set
> source_id before that.
> 
> Shall this H3 vs. A64 check be moved into the HDMI driver and it's probe
> routine?

This info shouldn't be needed once TCON is implemented as standalone driver 
probed via compatible string. I guess workaround can be implemented in HDMI 
driver to get TCON number from DT instead, although this is a bit clumsy.

Best regards,
Jernej

> 
> Cheers,
> Andre
> 
> > > > -   ret = device_probe(disp);
> > > > -   if (ret) {
> > > > -   debug("%s: device '%s' display won't probe (ret=%d)
\n",
> > > > - __func__, dev->name, ret);
> > > > -   return ret;
> > > > -   }
> > > > -
> > > > 
> > > > ret = display_read_timing(disp, );
> > > > if (ret) {
> > > > 
> > > > debug("%s: Failed to read timings\n", __func__);
> > > > 
> > > > @@ -245,8 +236,8 @@ static int sunxi_de2_probe(struct udevice *dev)
> > > > 
> > > > if (!(gd->flags & GD_FLG_RELOC))
> > > > 
> > > > return 0;
> > > > 
> > > > -   ret = uclass_find_device_by_name(UCLASS_DISPLAY,
> > > > -"sunxi_lcd", );
> > > > +   ret = uclass_get_device_by_driver(UCLASS_DISPLAY,
> > > > +
> > 
> > DM_DRIVER_GET(sunxi_lcd), );
> > 
> > > > if (!ret) {
> > > > 
> > > > int mux;
> > > > 
> > > > @@ -262,8 +253,8 @@ static int sunxi_de2_probe(struct udevice *dev)
> > > > 
> > > > debug("%s: lcd display not found (ret=%d)\n", __func__, ret);
> > > > 
> > > > -   ret = uclass_find_device_by_name(UCLASS_DISPLAY,
> > > > -"sunxi_dw_hdmi",
> > 
> > );
> > 
> > > > +   ret = uclass_get_device_by_driver(UCLASS_DISPLAY,
> > > > +
> > 
> > DM_DRIVER_GET(sunxi_dw_hdmi), );
> > 
> > > > if (!ret) {
> > > > 
> > > > int mux;
> > > > if (IS_ENABLED(CONFIG_MACH_SUNXI_H3_H5))
> > > > 
> > > > @@ -332,8 +323,8 @@ int sunxi_simplefb_setup(void *blob)
> > > > 
> > > > mux = 1;
> > > > 
> > > > /* Skip simplefb setting if DE2 / HDMI is not present */
> > > > 
> > > > -   ret = uclass_find_device_by_name(UCLASS_VIDEO,
> > > 

[linux-sunxi] Re: [PATCH v2 09/19] video: sunxi: de2: switch to public uclass functions

2021-03-08 Thread Andre Przywara
On Sun, 07 Mar 2021 08:35:23 +0100
Jernej Škrabec  wrote:

Hi,

> Dne nedelja, 07. marec 2021 ob 02:32:52 CET je Andre Przywara napisal(a):
> > On Sat,  6 Mar 2021 20:54:27 +0100
> > 
> > Jernej Skrabec  wrote:  
> > > Currently DE2 driver uses functions which are defined in internal
> > > headers. They are not meant to be used outside of uclass framework.
> > > Switch DE2 driver to public ones. This has additional benefit that
> > > device_probe doesn't need to be called manually.  
> > 
> > Indeed, good solution: for the calls in _probe(), we call de2_init()
> > right afterwards, which would explicitly call probe for the display, so
> > this both saves this call and the usage of the internal function.
> > For the calls in simplefb_setup: the DM framework checks if a device
> > has already been activated, so there is no problem with double probes.
> > 
> > However, actually testing this on a Pine64-LTS revealed that this breaks
> > on the A64: I only get a black screen (bisecting down to this commit).
> > 
> > I didn't investigate any further yet, just wanted to give a heads up.  
> 
> Thanks! I'll check what's going on.

I think I know what's going on, see below.

> >   
> > > Signed-off-by: Jernej Skrabec 
> > > ---
> > > 
> > >  drivers/video/sunxi/sunxi_de2.c | 29 ++---
> > >  1 file changed, 10 insertions(+), 19 deletions(-)
> > > 
> > > diff --git a/drivers/video/sunxi/sunxi_de2.c
> > > b/drivers/video/sunxi/sunxi_de2.c index 6b836a011944..e02d359cd259 100644
> > > --- a/drivers/video/sunxi/sunxi_de2.c
> > > +++ b/drivers/video/sunxi/sunxi_de2.c
> > > @@ -19,8 +19,6 @@
> > > 
> > >  #include 
> > >  #include 
> > >  #include 
> > > 
> > > -#include 
> > > -#include 
> > > 
> > >  #include 
> > >  #include "simplefb_common.h"
> > > 
> > > @@ -198,13 +196,6 @@ static int sunxi_de2_init(struct udevice *dev, ulong 
> > >  
> > > fbbase,>   
> > >   disp_uc_plat->source_id = mux;

The mux value is set *after* the call to uclass_find_device_by_name()
(or uclass_get_device_by_driver()) returned, and then we call this
function with it, which *used* to call probe().
Now probe is already called as part of uclass_get_device_by_driver(),
so *before* we had a chance to determine and set the mux value/
source_id.
For the H3/H5 it's 0, so it conveniently works with the probably zeroed
uc_plat structure there.

Not sure how to fix this, as we get a handle to the device only after
the uclass_find/get functions returned, so don't know where to set
source_id before that.

Shall this H3 vs. A64 check be moved into the HDMI driver and it's probe 
routine?

Cheers,
Andre

> > > 
> > > - ret = device_probe(disp);
> > > - if (ret) {
> > > - debug("%s: device '%s' display won't probe (ret=%d)\n",
> > > -   __func__, dev->name, ret);
> > > - return ret;
> > > - }
> > > -
> > > 
> > >   ret = display_read_timing(disp, );
> > >   if (ret) {
> > >   
> > >   debug("%s: Failed to read timings\n", __func__);
> > > 
> > > @@ -245,8 +236,8 @@ static int sunxi_de2_probe(struct udevice *dev)
> > > 
> > >   if (!(gd->flags & GD_FLG_RELOC))
> > >   
> > >   return 0;
> > > 
> > > - ret = uclass_find_device_by_name(UCLASS_DISPLAY,
> > > -  "sunxi_lcd", );
> > > + ret = uclass_get_device_by_driver(UCLASS_DISPLAY,
> > > + 
> DM_DRIVER_GET(sunxi_lcd), );
> > > 
> > >   if (!ret) {
> > >   
> > >   int mux;
> > > 
> > > @@ -262,8 +253,8 @@ static int sunxi_de2_probe(struct udevice *dev)
> > > 
> > >   debug("%s: lcd display not found (ret=%d)\n", __func__, ret);
> > > 
> > > - ret = uclass_find_device_by_name(UCLASS_DISPLAY,
> > > -  "sunxi_dw_hdmi",   
> );
> > > + ret = uclass_get_device_by_driver(UCLASS_DISPLAY,
> > > + 
> DM_DRIVER_GET(sunxi_dw_hdmi), );
> > > 
> > >   if (!ret) {
> > >   
> > >   int mux;
> > >   if (IS_ENABLED(CONFIG_MACH_SUNXI_H3_H5))
> > > 
> > > @@ -332,8 +323,8 @@ int sunxi_simplefb_setup(void *blob)
> > > 
> > >   mux = 1;
> > >   
> > >   /* Skip simplefb setting if DE2 / HDMI is not present */
> > > 
> > > - ret = uclass_find_device_by_name(UCLASS_VIDEO,
> > > -  "sunxi_de2", );
> > > + ret = uclass_get_device_by_driver(UCLASS_VIDEO,
> > > + 
> DM_DRIVER_GET(sunxi_de2), );
> > > 
> > >   if (ret) {
> > >   
> > >   debug("DE2 not present\n");
> > >   return 0;
> > > 
> > > @@ -342,8 +333,8 @@ int sunxi_simplefb_setup(void *blob)
> > > 
> > >   return 0;
> > >   
> > >   }
> > > 
> > > - ret = uclass_find_device_by_name(UCLASS_DISPLAY,
> > > -  "sunxi_dw_hdmi",   
> );
> > > + ret = uclass_get_device_by_driver(UCLASS_DISPLAY,
> > > + 
> DM_DRIVER_GET(sunxi_dw_hdmi), );
> > > 
> > >   if (ret) {
> > >   
> > >   

[linux-sunxi] Re: [PATCH v2 4/4] arm64: dts: allwinner: h6: Use RSB for AXP805 PMIC connection

2021-03-08 Thread Maxime Ripard
On Sun, Jan 03, 2021 at 04:00:07AM -0600, Samuel Holland wrote:
> On boards where the only peripheral connected to PL0/PL1 is an X-Powers
> PMIC, configure the connection to use the RSB bus rather than the I2C
> bus. Compared to the I2C controller that shares the pins, the RSB
> controller allows a higher bus frequency, and it is more CPU-efficient.
> 
> Signed-off-by: Samuel Holland 

Applied, thanks

Maxime

-- 
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/20210308154522.mkbxh3dpxidxhzzs%40gilmour.


signature.asc
Description: PGP signature


[linux-sunxi] Re: [PATCH] ARM: dts: sun8i: h3: beelink-x2: Add power button

2021-03-08 Thread Maxime Ripard
Hi

On Sat, Mar 06, 2021 at 09:36:11PM +0100, Jernej Skrabec wrote:
> Beelink X2 has power button. Add node for it.
> 
> Signed-off-by: Jernej Skrabec 
> ---
>  arch/arm/boot/dts/sun8i-h3-beelink-x2.dts | 11 +++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/sun8i-h3-beelink-x2.dts 
> b/arch/arm/boot/dts/sun8i-h3-beelink-x2.dts
> index 62b5280ec093..4a2cb072ecf6 100644
> --- a/arch/arm/boot/dts/sun8i-h3-beelink-x2.dts
> +++ b/arch/arm/boot/dts/sun8i-h3-beelink-x2.dts
> @@ -111,6 +111,17 @@ spdif_out: spdif-out {
>   #sound-dai-cells = <0>;
>   compatible = "linux,spdif-dit";
>   };
> +
> + r_gpio_keys {

Underscores are not valid for node names (and will trigger a dtc warning
when running with W=1).

> + compatible = "gpio-keys";
> +
> + power {
> + label = "power";

IIRC the node name is used as a fallback when the label isn't there?

Maxime

-- 
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/20210308130506.v35gjviwknr5hat5%40gilmour.


signature.asc
Description: PGP signature


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