Re: [PATCH v1] drm/bridge: lt8912b: Add hot plug detection

2022-11-29 Thread Adrien Grassein
Le mar. 29 nov. 2022 à 12:15, Robert Foss  a écrit :
>
> On Mon, 28 Nov 2022 at 12:23, Francesco Dolcini  wrote:
> >
> > From: Stefan Eichenberger 
> >
> > Enable hot plug detection when it is available on the HDMI port.
> > Without this connecting to a different monitor with incompatible timing
> > before the 10 seconds poll period will lead to a broken display output.
> >
> > Fixes: 30e2ae943c26 ("drm/bridge: Introduce LT8912B DSI to HDMI bridge")
> > Signed-off-by: Stefan Eichenberger 
> > Signed-off-by: Francesco Dolcini 
> > ---
> >  drivers/gpu/drm/bridge/lontium-lt8912b.c | 21 +++--
> >  1 file changed, 19 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c 
> > b/drivers/gpu/drm/bridge/lontium-lt8912b.c
> > index a98efef0ba0e..5f0c9cd2a970 100644
> > --- a/drivers/gpu/drm/bridge/lontium-lt8912b.c
> > +++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c
> > @@ -517,14 +517,27 @@ static int lt8912_attach_dsi(struct lt8912 *lt)
> > return 0;
> >  }
> >
> > +static void lt8912_bridge_hpd_cb(void *data, enum drm_connector_status 
> > status)
> > +{
> > +   struct lt8912 *lt = data;
> > +
> > +   if (lt->bridge.dev)
> > +   drm_helper_hpd_irq_event(lt->bridge.dev);
> > +}
> > +
> >  static int lt8912_bridge_connector_init(struct drm_bridge *bridge)
> >  {
> > int ret;
> > struct lt8912 *lt = bridge_to_lt8912(bridge);
> > struct drm_connector *connector = >connector;
> >
> > -   connector->polled = DRM_CONNECTOR_POLL_CONNECT |
> > -   DRM_CONNECTOR_POLL_DISCONNECT;
> > +   if (lt->hdmi_port->ops & DRM_BRIDGE_OP_HPD) {
> > +   drm_bridge_hpd_enable(lt->hdmi_port, lt8912_bridge_hpd_cb, 
> > lt);
> > +   connector->polled = DRM_CONNECTOR_POLL_HPD;
> > +   } else {
> > +   connector->polled = DRM_CONNECTOR_POLL_CONNECT |
> > +   DRM_CONNECTOR_POLL_DISCONNECT;
> > +   }
> >
> > ret = drm_connector_init(bridge->dev, connector,
> >  _connector_funcs,
> > @@ -578,6 +591,10 @@ static void lt8912_bridge_detach(struct drm_bridge 
> > *bridge)
> >
> > if (lt->is_attached) {
> >     lt8912_hard_power_off(lt);
> > +
> > +   if (lt->hdmi_port->ops & DRM_BRIDGE_OP_HPD)
> > +   drm_bridge_hpd_disable(lt->hdmi_port);
> > +
> > drm_connector_unregister(>connector);
> > drm_connector_cleanup(>connector);
> > }
> > --
> > 2.25.1
> >
>
>
> Reviewed-by: Robert Foss 
Reviewed-by: Adrien Grassein 
>
> Snoozing this patch, will apply it in a few days if no issues are found.


Re: [PATCH 4/4] drm/bridge: lt8912b: clarify lvds output status

2022-09-22 Thread Adrien Grassein
Le jeu. 22 sept. 2022 à 14:43, Philippe Schenker  a écrit :
>
> From: Francesco Dolcini 
>
> Add comments on the lt8912_write_lvds_config() config to document the
> current settings and to make it clear that this is a hardcoded
> configuration not relevant for the HDMI output (could be removed without
> affecting the HDMI port).
>
> No changes on the actual register writes.
>
> Signed-off-by: Francesco Dolcini 
> Signed-off-by: Philippe Schenker 
Acked-by: Adrien Grassein 
> ---
>
>  drivers/gpu/drm/bridge/lontium-lt8912b.c | 26 
>  1 file changed, 17 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c 
> b/drivers/gpu/drm/bridge/lontium-lt8912b.c
> index 5968f4af190b..3e870d45f881 100644
> --- a/drivers/gpu/drm/bridge/lontium-lt8912b.c
> +++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c
> @@ -165,24 +165,32 @@ static int lt8912_write_rxlogicres_config(struct lt8912 
> *lt)
> return ret;
>  };
>
> +/* enable LVDS output with some hardcoded configuration, not required for 
> the HDMI output */
>  static int lt8912_write_lvds_config(struct lt8912 *lt)
>  {
> const struct reg_sequence seq[] = {
> +   // lvds power up
> {0x44, 0x30},
> {0x51, 0x05},
> -   {0x50, 0x24},
> -   {0x51, 0x2d},
> -   {0x52, 0x04},
> -   {0x69, 0x0e},
> +
> +   // core pll bypass
> +   {0x50, 0x24}, // cp=50uA
> +   {0x51, 0x2d}, // Pix_clk as reference, second order passive 
> LPF PLL
> +   {0x52, 0x04}, // loopdiv=0, use second-order PLL
> +   {0x69, 0x0e}, // CP_PRESET_DIV_RATIO
> {0x69, 0x8e},
> {0x6a, 0x00},
> -   {0x6c, 0xb8},
> +   {0x6c, 0xb8}, // RGD_CP_SOFT_K_EN,RGD_CP_SOFT_K[13:8]
> {0x6b, 0x51},
> -   {0x04, 0xfb},
> +
> +   {0x04, 0xfb}, // core pll reset
> {0x04, 0xff},
> -   {0x7f, 0x00},
> -   {0xa8, 0x13},
> -   {0x02, 0xf7},
> +
> +   // scaler bypass
> +   {0x7f, 0x00}, // disable scaler
> +   {0xa8, 0x13}, // 0x13: JEIDA, 0x33: VESA
> +
> +   {0x02, 0xf7}, // lvds pll reset
> {0x02, 0xff},
> {0x03, 0xcf},
> {0x03, 0xff},
> --
> 2.37.3
>


Re: [PATCH 3/4] drm/bridge: lt8912b: fix corrupted image output

2022-09-22 Thread Adrien Grassein
Le jeu. 22 sept. 2022 à 14:43, Philippe Schenker  a écrit :
>
> From: Francesco Dolcini 
>
> Correct I2C address for the register list in lt8912_write_lvds_config(),
> these registers are on the first I2C address (0x48), the current
> function is just writing garbage to the wrong registers and this creates
> multiple issues (artifacts and output completely corrupted) on some HDMI
> displays.
>
> Correct I2C address comes from Lontium documentation and it is the one
> used on other out-of-tree LT8912B drivers [1].
>
> [1] 
> https://github.com/boundarydevices/linux/blob/boundary-imx_5.10.x_2.0.0/drivers/video/lt8912.c#L296
>
> Fixes: 30e2ae943c26 ("drm/bridge: Introduce LT8912B DSI to HDMI bridge")
> Signed-off-by: Francesco Dolcini 
> Signed-off-by: Philippe Schenker 
Acked-by: Adrien Grassein 
> ---
>
>  drivers/gpu/drm/bridge/lontium-lt8912b.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c 
> b/drivers/gpu/drm/bridge/lontium-lt8912b.c
> index 6a4bb7422176..5968f4af190b 100644
> --- a/drivers/gpu/drm/bridge/lontium-lt8912b.c
> +++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c
> @@ -188,7 +188,7 @@ static int lt8912_write_lvds_config(struct lt8912 *lt)
> {0x03, 0xff},
> };
>
> -   return regmap_multi_reg_write(lt->regmap[I2C_CEC_DSI], seq, 
> ARRAY_SIZE(seq));
> +   return regmap_multi_reg_write(lt->regmap[I2C_MAIN], seq, 
> ARRAY_SIZE(seq));
>  };
>
>  static inline struct lt8912 *bridge_to_lt8912(struct drm_bridge *b)
> --
> 2.37.3
>


Re: [PATCH 2/4] drm/bridge: lt8912b: set hdmi or dvi mode

2022-09-22 Thread Adrien Grassein
Le jeu. 22 sept. 2022 à 14:43, Philippe Schenker  a écrit :
>
> From: Philippe Schenker 
>
> The Lontium LT8912 does have a setting for DVI or HDMI. This patch reads
> from EDID what the display needs and sets it accordingly.
>
> Fixes: 30e2ae943c26 ("drm/bridge: Introduce LT8912B DSI to HDMI bridge")
> Signed-off-by: Philippe Schenker 
Acked-by: Adrien Grassein 
> ---
>
>  drivers/gpu/drm/bridge/lontium-lt8912b.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c 
> b/drivers/gpu/drm/bridge/lontium-lt8912b.c
> index 0fd3472e767c..6a4bb7422176 100644
> --- a/drivers/gpu/drm/bridge/lontium-lt8912b.c
> +++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c
> @@ -323,6 +323,8 @@ static int lt8912_video_setup(struct lt8912 *lt)
>   vsync_activehigh ? BIT(0) : 0);
> ret |= regmap_update_bits(lt->regmap[I2C_MAIN], 0xab, BIT(1),
>   hsync_activehigh ? BIT(1) : 0);
> +   ret |= regmap_update_bits(lt->regmap[I2C_MAIN], 0xb2, BIT(0),
> + lt->connector.display_info.is_hdmi ? BIT(0) 
> : 0);
>
> return ret;
>  }
> --
> 2.37.3
>


Re: [PATCH 1/4] drm/bridge: lt8912b: add vsync hsync

2022-09-22 Thread Adrien Grassein
Le jeu. 22 sept. 2022 à 14:43, Philippe Schenker  a écrit :
>
> From: Philippe Schenker 
>
> Currently the bridge driver does not take care whether or not the display
> needs positive/negative vertical/horizontal syncs. Pass these two flags
> to the bridge from the EDID that was read out from the display.
>
> Fixes: 30e2ae943c26 ("drm/bridge: Introduce LT8912B DSI to HDMI bridge")
> Signed-off-by: Philippe Schenker 
Acked-by: Adrien Grassein 
>
> ---
>
>  drivers/gpu/drm/bridge/lontium-lt8912b.c | 9 -
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c 
> b/drivers/gpu/drm/bridge/lontium-lt8912b.c
> index 28bad30dc4e5..0fd3472e767c 100644
> --- a/drivers/gpu/drm/bridge/lontium-lt8912b.c
> +++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c
> @@ -268,7 +268,7 @@ static int lt8912_video_setup(struct lt8912 *lt)
> u32 hactive, h_total, hpw, hfp, hbp;
> u32 vactive, v_total, vpw, vfp, vbp;
> u8 settle = 0x08;
> -   int ret;
> +   int ret, hsync_activehigh, vsync_activehigh;
>
> if (!lt)
> return -EINVAL;
> @@ -278,12 +278,14 @@ static int lt8912_video_setup(struct lt8912 *lt)
> hpw = lt->mode.hsync_len;
> hbp = lt->mode.hback_porch;
> h_total = hactive + hfp + hpw + hbp;
> +   hsync_activehigh = lt->mode.flags & DISPLAY_FLAGS_HSYNC_HIGH;
>
> vactive = lt->mode.vactive;
> vfp = lt->mode.vfront_porch;
> vpw = lt->mode.vsync_len;
> vbp = lt->mode.vback_porch;
> v_total = vactive + vfp + vpw + vbp;
> +   vsync_activehigh = lt->mode.flags & DISPLAY_FLAGS_VSYNC_HIGH;
>
> if (vactive <= 600)
> settle = 0x04;
> @@ -317,6 +319,11 @@ static int lt8912_video_setup(struct lt8912 *lt)
> ret |= regmap_write(lt->regmap[I2C_CEC_DSI], 0x3e, hfp & 0xff);
> ret |= regmap_write(lt->regmap[I2C_CEC_DSI], 0x3f, hfp >> 8);
>
> +   ret |= regmap_update_bits(lt->regmap[I2C_MAIN], 0xab, BIT(0),
> + vsync_activehigh ? BIT(0) : 0);
> +   ret |= regmap_update_bits(lt->regmap[I2C_MAIN], 0xab, BIT(1),
> + hsync_activehigh ? BIT(1) : 0);
> +
> return ret;
>  }
>
> --
> 2.37.3
>


Re: [PATCH] drm/bridge: lt8912b: Drop unused includes

2021-05-29 Thread Adrien Grassein
Reviewed-by: Adren Grassein 

Le sam. 29 mai 2021 à 02:30, Linus Walleij  a écrit :
>
> The Lontium bridge is including legacy header files for GPIO
> but not using them. Delete the includes.
>
> Cc: Adrien Grassein 
> Cc: Robert Foss 
> Signed-off-by: Linus Walleij 
> ---
>  drivers/gpu/drm/bridge/lontium-lt8912b.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c 
> b/drivers/gpu/drm/bridge/lontium-lt8912b.c
> index 443f1b47e031..4ff091ecd8b4 100644
> --- a/drivers/gpu/drm/bridge/lontium-lt8912b.c
> +++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c
> @@ -7,8 +7,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
> -#include 
>  #include 
>
>  #include 
> --
> 2.31.1
>


Re: ERROR: modpost: "drm_display_mode_to_videomode" [drivers/gpu/drm/bridge/lontium-lt8912b.ko] undefined!

2021-05-04 Thread Adrien Grassein
Fixed proposed at:
https://lore.kernel.org/dri-devel/20210504220207.4004511-1-adrien.grass...@gmail.com/T/#u

Thanks,

Le mar. 4 mai 2021 à 21:19, Adrien Grassein
 a écrit :
>
> Ok thanks,
>
> I will investigate this.
>
> Le mar. 4 mai 2021 à 21:04, Michal Suchánek  a écrit :
> >
> > Hello,
> >
> > I have only one from ppc64, the other architectures don't have the
> > problem or fail earlier.
> >
> > Thanks
> >
> > Michal
> >
> > On Tue, May 04, 2021 at 08:45:01PM +0200, Adrien Grassein wrote:
> > > Hello,
> > >
> > > I think this is self-evident but could you please send the config to 
> > > confirm?
> > >
> > > Thanks,
> > >
> > > Le mar. 4 mai 2021 à 20:30, Michal Suchánek  a écrit :
> > > >
> > > > Hello,
> > > >
> > > > I get errors about missing symbol in the lontium-lt8912b module.
> > > >
> > > > Is the problem self-evident or do you need the config as well?
> > > >
> > > > I don't need the driver for anything, it was just auto-enabled because
> > > > it's new and the change has not been reviewed.
> > > >
> > > > Thanks
> > > >
> > > > Michal
> > > > >
> > > > > Last output:
> > > > >   WRAParch/powerpc/boot/zImage.maple
> > > > >   WRAParch/powerpc/boot/zImage.pseries
> > > > > make[2]: *** Deleting file 'modules-only.symvers'
> > > > >   MODPOST modules-only.symvers
> > > > > ERROR: modpost: "drm_display_mode_to_videomode" 
> > > > > [drivers/gpu/drm/bridge/lontium-lt8912b.ko] undefined!
> > > > > make[2]: *** [../scripts/Makefile.modpost:150: modules-only.symvers] 
> > > > > Error 1
> > > > > make[1]: *** 
> > > > > [/home/abuild/rpmbuild/BUILD/kernel-vanilla-5.12.0.13670.g5e321ded302d/linux-5.12-13670-g5e321ded302d/Makefile:1770:
> > > > >  modules] Error 2
> > > > > make: *** [../Makefile:215: __sub-make] Error 2
> > > > > error: Bad exit status from /var/tmp/rpm-tmp.q1oSIp (%build)
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm/bridge: fix LONTIUM_LT8912B dependencies

2021-05-04 Thread Adrien Grassein
LONTIUM_LT8912B uses "drm_display_mode_to_videomode" from
DRM framework that needs VIDEOMODE_HELPERS to be enabled.

Fixes: 30e2ae943c26 ("drm/bridge: Introduce LT8912B DSI to HDMI bridge")
Reported-by: Michal Suchánek 
Signed-off-by: Adrien Grassein 
---
 drivers/gpu/drm/bridge/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 400193e38d29..70bcceaae9bf 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -68,6 +68,7 @@ config DRM_LONTIUM_LT8912B
select DRM_KMS_HELPER
select DRM_MIPI_DSI
select REGMAP_I2C
+   select VIDEOMODE_HELPERS
help
  Driver for Lontium LT8912B DSI to HDMI bridge
  chip driver.
-- 
2.25.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: ERROR: modpost: "drm_display_mode_to_videomode" [drivers/gpu/drm/bridge/lontium-lt8912b.ko] undefined!

2021-05-04 Thread Adrien Grassein
Ok thanks,

I will investigate this.

Le mar. 4 mai 2021 à 21:04, Michal Suchánek  a écrit :
>
> Hello,
>
> I have only one from ppc64, the other architectures don't have the
> problem or fail earlier.
>
> Thanks
>
> Michal
>
> On Tue, May 04, 2021 at 08:45:01PM +0200, Adrien Grassein wrote:
> > Hello,
> >
> > I think this is self-evident but could you please send the config to 
> > confirm?
> >
> > Thanks,
> >
> > Le mar. 4 mai 2021 à 20:30, Michal Suchánek  a écrit :
> > >
> > > Hello,
> > >
> > > I get errors about missing symbol in the lontium-lt8912b module.
> > >
> > > Is the problem self-evident or do you need the config as well?
> > >
> > > I don't need the driver for anything, it was just auto-enabled because
> > > it's new and the change has not been reviewed.
> > >
> > > Thanks
> > >
> > > Michal
> > > >
> > > > Last output:
> > > >   WRAParch/powerpc/boot/zImage.maple
> > > >   WRAParch/powerpc/boot/zImage.pseries
> > > > make[2]: *** Deleting file 'modules-only.symvers'
> > > >   MODPOST modules-only.symvers
> > > > ERROR: modpost: "drm_display_mode_to_videomode" 
> > > > [drivers/gpu/drm/bridge/lontium-lt8912b.ko] undefined!
> > > > make[2]: *** [../scripts/Makefile.modpost:150: modules-only.symvers] 
> > > > Error 1
> > > > make[1]: *** 
> > > > [/home/abuild/rpmbuild/BUILD/kernel-vanilla-5.12.0.13670.g5e321ded302d/linux-5.12-13670-g5e321ded302d/Makefile:1770:
> > > >  modules] Error 2
> > > > make: *** [../Makefile:215: __sub-make] Error 2
> > > > error: Bad exit status from /var/tmp/rpm-tmp.q1oSIp (%build)
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: ERROR: modpost: "drm_display_mode_to_videomode" [drivers/gpu/drm/bridge/lontium-lt8912b.ko] undefined!

2021-05-04 Thread Adrien Grassein
Hello,

I think this is self-evident but could you please send the config to confirm?

Thanks,

Le mar. 4 mai 2021 à 20:30, Michal Suchánek  a écrit :
>
> Hello,
>
> I get errors about missing symbol in the lontium-lt8912b module.
>
> Is the problem self-evident or do you need the config as well?
>
> I don't need the driver for anything, it was just auto-enabled because
> it's new and the change has not been reviewed.
>
> Thanks
>
> Michal
> >
> > Last output:
> >   WRAParch/powerpc/boot/zImage.maple
> >   WRAParch/powerpc/boot/zImage.pseries
> > make[2]: *** Deleting file 'modules-only.symvers'
> >   MODPOST modules-only.symvers
> > ERROR: modpost: "drm_display_mode_to_videomode" 
> > [drivers/gpu/drm/bridge/lontium-lt8912b.ko] undefined!
> > make[2]: *** [../scripts/Makefile.modpost:150: modules-only.symvers] Error 1
> > make[1]: *** 
> > [/home/abuild/rpmbuild/BUILD/kernel-vanilla-5.12.0.13670.g5e321ded302d/linux-5.12-13670-g5e321ded302d/Makefile:1770:
> >  modules] Error 2
> > make: *** [../Makefile:215: __sub-make] Error 2
> > error: Bad exit status from /var/tmp/rpm-tmp.q1oSIp (%build)
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v5 1/1] drm/bridge: lt8912b: fix incorrect handling of of_* return values

2021-04-16 Thread Adrien Grassein
Hi Robert,

Could you please have a look at this patch?
It has been reviewed by the bug reporter and another person.

I don't receive any "merged" message.

Thanks a lot,
Adrien

Le mer. 31 mars 2021 à 16:42, Dan Carpenter  a écrit :
>
> On Wed, Mar 31, 2021 at 03:33:13PM +0200, Adrien Grassein wrote:
> > A static analysis shows several issues in the driver code at
> > probing time.
> >
> > DT parsing errors were bad handled and could lead to bugs:
> >   - Bad error detection;
> >   - Bad release of ressources
> >
> > Reported-by: Dan Carpenter 
> > Suggested-by: Dan Carpenter  
> > Signed-off-by: Adrien Grassein 
> > Reviewed-by: Andrzej Hajda 
>
> Great!  Thanks!
>
> Reviewed-by: Dan Carpenter 
>
> regards,
> dan carpenter
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH -next] drm: bridge: fix LONTIUM use of mipi_dsi_() functions

2021-04-15 Thread Adrien Grassein
Reviewed-by: Adren Grassein 

Le jeu. 15 avr. 2021 à 20:36, Randy Dunlap  a écrit :
>
> The Lontium DRM bridge drivers use mipi_dsi_() function interfaces so
> they need to select DRM_MIPI_DSI to prevent build errors.
>
> ERROR: modpost: "mipi_dsi_attach" 
> [drivers/gpu/drm/bridge/lontium-lt9611uxc.ko] undefined!
> ERROR: modpost: "mipi_dsi_device_register_full" 
> [drivers/gpu/drm/bridge/lontium-lt9611uxc.ko] undefined!
> ERROR: modpost: "of_find_mipi_dsi_host_by_node" 
> [drivers/gpu/drm/bridge/lontium-lt9611uxc.ko] undefined!
> ERROR: modpost: "mipi_dsi_device_unregister" 
> [drivers/gpu/drm/bridge/lontium-lt9611uxc.ko] undefined!
> ERROR: modpost: "mipi_dsi_detach" 
> [drivers/gpu/drm/bridge/lontium-lt9611uxc.ko] undefined!
> ERROR: modpost: "mipi_dsi_attach" [drivers/gpu/drm/bridge/lontium-lt9611.ko] 
> undefined!
> ERROR: modpost: "mipi_dsi_device_register_full" 
> [drivers/gpu/drm/bridge/lontium-lt9611.ko] undefined!
> ERROR: modpost: "of_find_mipi_dsi_host_by_node" 
> [drivers/gpu/drm/bridge/lontium-lt9611.ko] undefined!
> ERROR: modpost: "mipi_dsi_device_unregister" 
> [drivers/gpu/drm/bridge/lontium-lt9611.ko] undefined!
> ERROR: modpost: "mipi_dsi_detach" [drivers/gpu/drm/bridge/lontium-lt9611.ko] 
> undefined!
> WARNING: modpost: suppressed 5 unresolved symbol warnings because there were 
> too many)
>
> Fixes: 23278bf54afe ("drm/bridge: Introduce LT9611 DSI to HDMI bridge")
> Fixes: 0cbbd5b1a012 ("drm: bridge: add support for lontium LT9611UXC bridge")
> Fixes: 30e2ae943c26 ("drm/bridge: Introduce LT8912B DSI to HDMI bridge")
> Signed-off-by: Randy Dunlap 
> Reported-by: kernel test robot 
> Cc: Dmitry Baryshkov 
> Cc: Sam Ravnborg 
> Cc: Vinod Koul 
> Cc: Bjorn Andersson 
> Cc: Srinivas Kandagatla 
> Cc: Adrien Grassein 
> Cc: Andrzej Hajda 
> Cc: Neil Armstrong 
> Cc: Robert Foss 
> Cc: dri-devel@lists.freedesktop.org
> Cc: sta...@vger.kernel.org
> ---
>  drivers/gpu/drm/bridge/Kconfig |3 +++
>  1 file changed, 3 insertions(+)
>
> --- linux-next-20210414.orig/drivers/gpu/drm/bridge/Kconfig
> +++ linux-next-20210414/drivers/gpu/drm/bridge/Kconfig
> @@ -66,6 +66,7 @@ config DRM_LONTIUM_LT8912B
> depends on OF
> select DRM_PANEL_BRIDGE
> select DRM_KMS_HELPER
> +   select DRM_MIPI_DSI
> select REGMAP_I2C
> help
>   Driver for Lontium LT8912B DSI to HDMI bridge
> @@ -81,6 +82,7 @@ config DRM_LONTIUM_LT9611
> depends on OF
> select DRM_PANEL_BRIDGE
> select DRM_KMS_HELPER
> +   select DRM_MIPI_DSI
> select REGMAP_I2C
> help
>   Driver for Lontium LT9611 DSI to HDMI bridge
> @@ -94,6 +96,7 @@ config DRM_LONTIUM_LT9611UXC
> depends on OF
> select DRM_PANEL_BRIDGE
> select DRM_KMS_HELPER
> +   select DRM_MIPI_DSI
> select REGMAP_I2C
> help
>   Driver for Lontium LT9611UXC DSI to HDMI bridge
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v5 1/1] drm/bridge: lt8912b: fix incorrect handling of of_* return values

2021-03-31 Thread Adrien Grassein
A static analysis shows several issues in the driver code at
probing time.

DT parsing errors were bad handled and could lead to bugs:
  - Bad error detection;
  - Bad release of ressources

Reported-by: Dan Carpenter 
Suggested-by: Dan Carpenter  
Signed-off-by: Adrien Grassein 
Reviewed-by: Andrzej Hajda 
---
 drivers/gpu/drm/bridge/lontium-lt8912b.c | 32 +---
 1 file changed, 17 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c 
b/drivers/gpu/drm/bridge/lontium-lt8912b.c
index 61491615bad0..55d8aa22c882 100644
--- a/drivers/gpu/drm/bridge/lontium-lt8912b.c
+++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c
@@ -621,7 +621,8 @@ static int lt8912_parse_dt(struct lt8912 *lt)
 {
struct gpio_desc *gp_reset;
struct device *dev = lt->dev;
-   int ret = 0;
+   int ret;
+   int data_lanes;
struct device_node *port_node;
struct device_node *endpoint;
 
@@ -635,19 +636,21 @@ static int lt8912_parse_dt(struct lt8912 *lt)
lt->gp_reset = gp_reset;
 
endpoint = of_graph_get_endpoint_by_regs(dev->of_node, 0, -1);
-   if (IS_ERR(endpoint)) {
-   ret = PTR_ERR(endpoint);
-   goto end;
-   }
+   if (!endpoint)
+   return -ENODEV;
 
-   lt->data_lanes = of_property_count_u32_elems(endpoint, "data-lanes");
+   data_lanes = of_property_count_u32_elems(endpoint, "data-lanes");
of_node_put(endpoint);
+   if (data_lanes < 0) {
+   dev_err(lt->dev, "%s: Bad data-lanes property\n", __func__);
+   return data_lanes;
+   }
+   lt->data_lanes = data_lanes;
 
lt->host_node = of_graph_get_remote_node(dev->of_node, 0, -1);
if (!lt->host_node) {
dev_err(lt->dev, "%s: Failed to get remote port\n", __func__);
-   ret = -ENODEV;
-   goto end;
+   return -ENODEV;
}
 
port_node = of_graph_get_remote_node(dev->of_node, 1, -1);
@@ -658,24 +661,23 @@ static int lt8912_parse_dt(struct lt8912 *lt)
}
 
lt->hdmi_port = of_drm_find_bridge(port_node);
-   if (IS_ERR(lt->hdmi_port)) {
+   if (!lt->hdmi_port) {
dev_err(lt->dev, "%s: Failed to get hdmi port\n", __func__);
-   ret = PTR_ERR(lt->hdmi_port);
-   of_node_put(lt->host_node);
-   goto end;
+   ret = -ENODEV;
+   goto err_free_host_node;
}
 
if (!of_device_is_compatible(port_node, "hdmi-connector")) {
dev_err(lt->dev, "%s: Failed to get hdmi port\n", __func__);
ret = -EINVAL;
+   goto err_free_host_node;
}
 
of_node_put(port_node);
-
-end:
-   return ret;
+   return 0;
 
 err_free_host_node:
+   of_node_put(port_node);
of_node_put(lt->host_node);
return ret;
 }
-- 
2.25.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v5 0/1] Fixes 30e2ae943c26 "drm/bridge: Introduce LT8912B DSI to HDMI"

2021-03-31 Thread Adrien Grassein
Hi,

This patch fixes issues found by a static checker:
  - Bad handling of handling of of_* return values.

Thanks,

Adrien Grassein (1):
  drm/bridge: lt8912b: fix incorrect handling of of_* return values

 drivers/gpu/drm/bridge/lontium-lt8912b.c | 32 +---
 1 file changed, 17 insertions(+), 15 deletions(-)

-- 
2.25.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v4 1/1] drm/bridge: lt8912b: Fix issues found during static analysis

2021-03-31 Thread Adrien Grassein
Some issues where found during static analysis of this driver.

Reported-by: Dan Carpenter 
Suggested-by: Dan Carpenter  
Signed-off-by: Adrien Grassein 
---
 drivers/gpu/drm/bridge/lontium-lt8912b.c | 27 +++-
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c 
b/drivers/gpu/drm/bridge/lontium-lt8912b.c
index 61491615bad0..4c8d79142262 100644
--- a/drivers/gpu/drm/bridge/lontium-lt8912b.c
+++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c
@@ -621,7 +621,8 @@ static int lt8912_parse_dt(struct lt8912 *lt)
 {
struct gpio_desc *gp_reset;
struct device *dev = lt->dev;
-   int ret = 0;
+   int ret;
+   int data_lanes;
struct device_node *port_node;
struct device_node *endpoint;
 
@@ -635,13 +636,16 @@ static int lt8912_parse_dt(struct lt8912 *lt)
lt->gp_reset = gp_reset;
 
endpoint = of_graph_get_endpoint_by_regs(dev->of_node, 0, -1);
-   if (IS_ERR(endpoint)) {
-   ret = PTR_ERR(endpoint);
-   goto end;
-   }
+   if (!endpoint)
+   return -ENODEV;
 
-   lt->data_lanes = of_property_count_u32_elems(endpoint, "data-lanes");
+   data_lanes = of_property_count_u32_elems(endpoint, "data-lanes");
of_node_put(endpoint);
+   if (data_lanes < 0) {
+   dev_err(lt->dev, "%s: Bad data-lanes property\n", __func__);
+   return data_lanes;
+   }
+   lt->data_lanes = data_lanes;
 
lt->host_node = of_graph_get_remote_node(dev->of_node, 0, -1);
if (!lt->host_node) {
@@ -658,19 +662,22 @@ static int lt8912_parse_dt(struct lt8912 *lt)
}
 
lt->hdmi_port = of_drm_find_bridge(port_node);
-   if (IS_ERR(lt->hdmi_port)) {
+   if (!lt->hdmi_port) {
dev_err(lt->dev, "%s: Failed to get hdmi port\n", __func__);
-   ret = PTR_ERR(lt->hdmi_port);
-   of_node_put(lt->host_node);
-   goto end;
+   ret = -ENODEV;
+   of_node_put(port_node);
+   goto err_free_host_node;
}
 
if (!of_device_is_compatible(port_node, "hdmi-connector")) {
dev_err(lt->dev, "%s: Failed to get hdmi port\n", __func__);
+   of_node_put(port_node);
ret = -EINVAL;
+   goto err_free_host_node;
}
 
of_node_put(port_node);
+   return 0;
 
 end:
return ret;
-- 
2.25.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v4 0/1] Fixes 30e2ae943c26 "drm/bridge: Introduce LT8912B DSI to HDMI"

2021-03-31 Thread Adrien Grassein
Hi,

This patch fixes issues found by a static checker.

Thanks,

Adrien Grassein (1):
  drm/bridge: lt8912b: Fix issues found during static analysis

 drivers/gpu/drm/bridge/lontium-lt8912b.c | 27 +++-
 1 file changed, 17 insertions(+), 10 deletions(-)

-- 
2.25.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v3 1/1] drm/bridge: lt8912b: Fix issues found during static analysis

2021-03-31 Thread Adrien Grassein
Le mer. 31 mars 2021 à 13:36, Dan Carpenter  a écrit :
>
> On Wed, Mar 31, 2021 at 01:21:37PM +0200, Adrien Grassein wrote:
> > - lt->data_lanes = of_property_count_u32_elems(endpoint, "data-lanes");
> > + data_lanes = of_property_count_u32_elems(endpoint, "data-lanes");
> >   of_node_put(endpoint);
> > + if (data_lanes < 0) {
> > + dev_err(lt->dev, "%s: Bad data-lanes property\n", __func__);
> > + return lt->data_lanes;
>
> This needs to be "return data_lanes;"
>
> > + }
> > + lt->data_lanes = data_lanes;
>
> I really believe that v4 will be the perfect version though...  :)
>
Ahah, maybe, let's see ^^.

> regards,
> dan carpenter
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 1/1] drm/bridge: lt8912b: Fix issues found during static analysis

2021-03-31 Thread Adrien Grassein
Some issues where found during static analysis of this driver.

Reported-by: Dan Carpenter 
Suggested-by: Dan Carpenter  
Signed-off-by: Adrien Grassein 
---
 drivers/gpu/drm/bridge/lontium-lt8912b.c | 27 +++-
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c 
b/drivers/gpu/drm/bridge/lontium-lt8912b.c
index 61491615bad0..dcaceab818ee 100644
--- a/drivers/gpu/drm/bridge/lontium-lt8912b.c
+++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c
@@ -621,7 +621,8 @@ static int lt8912_parse_dt(struct lt8912 *lt)
 {
struct gpio_desc *gp_reset;
struct device *dev = lt->dev;
-   int ret = 0;
+   int ret;
+   int data_lanes;
struct device_node *port_node;
struct device_node *endpoint;
 
@@ -635,13 +636,16 @@ static int lt8912_parse_dt(struct lt8912 *lt)
lt->gp_reset = gp_reset;
 
endpoint = of_graph_get_endpoint_by_regs(dev->of_node, 0, -1);
-   if (IS_ERR(endpoint)) {
-   ret = PTR_ERR(endpoint);
-   goto end;
-   }
+   if (!endpoint)
+   return -ENODEV;
 
-   lt->data_lanes = of_property_count_u32_elems(endpoint, "data-lanes");
+   data_lanes = of_property_count_u32_elems(endpoint, "data-lanes");
of_node_put(endpoint);
+   if (data_lanes < 0) {
+   dev_err(lt->dev, "%s: Bad data-lanes property\n", __func__);
+   return lt->data_lanes;
+   }
+   lt->data_lanes = data_lanes;
 
lt->host_node = of_graph_get_remote_node(dev->of_node, 0, -1);
if (!lt->host_node) {
@@ -658,19 +662,22 @@ static int lt8912_parse_dt(struct lt8912 *lt)
}
 
lt->hdmi_port = of_drm_find_bridge(port_node);
-   if (IS_ERR(lt->hdmi_port)) {
+   if (!lt->hdmi_port) {
dev_err(lt->dev, "%s: Failed to get hdmi port\n", __func__);
-   ret = PTR_ERR(lt->hdmi_port);
-   of_node_put(lt->host_node);
-   goto end;
+   ret = -ENODEV;
+   of_node_put(port_node);
+   goto err_free_host_node;
}
 
if (!of_device_is_compatible(port_node, "hdmi-connector")) {
dev_err(lt->dev, "%s: Failed to get hdmi port\n", __func__);
+   of_node_put(port_node);
ret = -EINVAL;
+   goto err_free_host_node;
}
 
of_node_put(port_node);
+   return 0;
 
 end:
return ret;
-- 
2.25.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 0/1] Fixes 30e2ae943c26 "drm/bridge: Introduce LT8912B DSI to HDMI"

2021-03-31 Thread Adrien Grassein
Hi,

This patch fixes issues found by a static checker.

Thanks,

Adrien Grassein (1):
  drm/bridge: lt8912b: Fix issues found during static analysis

 drivers/gpu/drm/bridge/lontium-lt8912b.c | 27 +++-
 1 file changed, 17 insertions(+), 10 deletions(-)

-- 
2.25.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 1/1] drm/bridge: lt8912b: Fix issues found during static analysis

2021-03-31 Thread Adrien Grassein
Some issues where found during static analysis of this driver.

Reported-by: Dan Carpenter 
Suggested-by: Dan Carpenter  
Signed-off-by: Adrien Grassein 
---
 drivers/gpu/drm/bridge/lontium-lt8912b.c | 24 +++-
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c 
b/drivers/gpu/drm/bridge/lontium-lt8912b.c
index 61491615bad0..dc903f793dbc 100644
--- a/drivers/gpu/drm/bridge/lontium-lt8912b.c
+++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c
@@ -622,6 +622,7 @@ static int lt8912_parse_dt(struct lt8912 *lt)
struct gpio_desc *gp_reset;
struct device *dev = lt->dev;
int ret = 0;
+   int data_lanes;
struct device_node *port_node;
struct device_node *endpoint;
 
@@ -635,13 +636,16 @@ static int lt8912_parse_dt(struct lt8912 *lt)
lt->gp_reset = gp_reset;
 
endpoint = of_graph_get_endpoint_by_regs(dev->of_node, 0, -1);
-   if (IS_ERR(endpoint)) {
-   ret = PTR_ERR(endpoint);
-   goto end;
-   }
+   if (!endpoint)
+   return -ENODEV;
 
-   lt->data_lanes = of_property_count_u32_elems(endpoint, "data-lanes");
+   data_lanes = of_property_count_u32_elems(endpoint, "data-lanes");
of_node_put(endpoint);
+   if (data_lanes < 0) {
+   dev_err(lt->dev, "%s: Bad data-lanes property\n", __func__);
+   return lt->data_lanes;
+   }
+   lt->data_lanes = data_lanes;
 
lt->host_node = of_graph_get_remote_node(dev->of_node, 0, -1);
if (!lt->host_node) {
@@ -658,16 +662,18 @@ static int lt8912_parse_dt(struct lt8912 *lt)
}
 
lt->hdmi_port = of_drm_find_bridge(port_node);
-   if (IS_ERR(lt->hdmi_port)) {
+   if (!lt->hdmi_port) {
dev_err(lt->dev, "%s: Failed to get hdmi port\n", __func__);
-   ret = PTR_ERR(lt->hdmi_port);
-   of_node_put(lt->host_node);
-   goto end;
+   ret = -ENODEV;
+   of_node_put(port_node);
+   goto err_free_host_node;
}
 
if (!of_device_is_compatible(port_node, "hdmi-connector")) {
dev_err(lt->dev, "%s: Failed to get hdmi port\n", __func__);
+   of_node_put(port_node);
ret = -EINVAL;
+   goto err_free_host_node;
}
 
of_node_put(port_node);
-- 
2.25.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 0/1] Fixes 30e2ae943c26 "drm/bridge: Introduce LT8912B DSI to HDMI"

2021-03-31 Thread Adrien Grassein
Hi,

This patch fixes issues found by a static checker.

Thanks,

Adrien Grassein (1):
  drm/bridge: lt8912b: Fix issues found during static analysis

 drivers/gpu/drm/bridge/lontium-lt8912b.c | 24 +++-
 1 file changed, 15 insertions(+), 9 deletions(-)

-- 
2.25.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v1 1/1] drm/bridge: lt8912b: Fix issues found during static analysis

2021-03-31 Thread Adrien Grassein
Le mer. 31 mars 2021 à 12:29, Dan Carpenter  a écrit :
>
> On Wed, Mar 31, 2021 at 11:38:22AM +0200, Adrien Grassein wrote:
> > Some issues where found during static analysis of this driver.
> >
> > Reported-by: Dan Carpenter 
> > Suggested-by: Dan Carpenter  
> > Signed-off-by: Adrien Grassein 
> > ---
> >  drivers/gpu/drm/bridge/lontium-lt8912b.c | 20 
> >  1 file changed, 12 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c 
> > b/drivers/gpu/drm/bridge/lontium-lt8912b.c
> > index 61491615bad0..9a5a19655362 100644
> > --- a/drivers/gpu/drm/bridge/lontium-lt8912b.c
> > +++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c
> > @@ -635,13 +635,15 @@ static int lt8912_parse_dt(struct lt8912 *lt)
> >   lt->gp_reset = gp_reset;
> >
> >   endpoint = of_graph_get_endpoint_by_regs(dev->of_node, 0, -1);
> > - if (IS_ERR(endpoint)) {
> > - ret = PTR_ERR(endpoint);
> > - goto end;
> > - }
> > + if (!endpoint)
> > + return -ENODEV;
> >
> >   lt->data_lanes = of_property_count_u32_elems(endpoint, "data-lanes");
> >   of_node_put(endpoint);
> > + if (lt->data_lanes < 0) {
>
> Ah flip.  Unfortunately, ->data_lanes is a u8 so it can't be negative.
>
oups ^^.

> > + dev_err(lt->dev, "%s: Bad data-lanes property\n", __func__);
> > + return lt->data_lanes;
> > + }
>
> regards,
> dan carpenter
>
Thanks,
Adrien
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v1 1/1] drm/bridge: lt8912b: Fix issues found during static analysis

2021-03-31 Thread Adrien Grassein
Some issues where found during static analysis of this driver.

Reported-by: Dan Carpenter 
Suggested-by: Dan Carpenter  
Signed-off-by: Adrien Grassein 
---
 drivers/gpu/drm/bridge/lontium-lt8912b.c | 20 
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c 
b/drivers/gpu/drm/bridge/lontium-lt8912b.c
index 61491615bad0..9a5a19655362 100644
--- a/drivers/gpu/drm/bridge/lontium-lt8912b.c
+++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c
@@ -635,13 +635,15 @@ static int lt8912_parse_dt(struct lt8912 *lt)
lt->gp_reset = gp_reset;
 
endpoint = of_graph_get_endpoint_by_regs(dev->of_node, 0, -1);
-   if (IS_ERR(endpoint)) {
-   ret = PTR_ERR(endpoint);
-   goto end;
-   }
+   if (!endpoint)
+   return -ENODEV;
 
lt->data_lanes = of_property_count_u32_elems(endpoint, "data-lanes");
of_node_put(endpoint);
+   if (lt->data_lanes < 0) {
+   dev_err(lt->dev, "%s: Bad data-lanes property\n", __func__);
+   return lt->data_lanes;
+   }
 
lt->host_node = of_graph_get_remote_node(dev->of_node, 0, -1);
if (!lt->host_node) {
@@ -658,16 +660,18 @@ static int lt8912_parse_dt(struct lt8912 *lt)
}
 
lt->hdmi_port = of_drm_find_bridge(port_node);
-   if (IS_ERR(lt->hdmi_port)) {
+   if (!lt->hdmi_port) {
dev_err(lt->dev, "%s: Failed to get hdmi port\n", __func__);
-   ret = PTR_ERR(lt->hdmi_port);
-   of_node_put(lt->host_node);
-   goto end;
+   ret = -ENODEV;
+   of_node_put(port_node);
+   goto err_free_host_node;
}
 
if (!of_device_is_compatible(port_node, "hdmi-connector")) {
dev_err(lt->dev, "%s: Failed to get hdmi port\n", __func__);
+   of_node_put(port_node);
ret = -EINVAL;
+   goto err_free_host_node;
}
 
of_node_put(port_node);
-- 
2.25.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v1 0/1] Fixes 30e2ae943c26 "drm/bridge: Introduce LT8912B DSI to HDMI

2021-03-31 Thread Adrien Grassein
Hi,

This patch fixes issues found by a static checker.

Thanks,

Adrien Grassein (1):
  drm/bridge: lt8912b: Fix issues found during static analysis

 drivers/gpu/drm/bridge/lontium-lt8912b.c | 20 
 1 file changed, 12 insertions(+), 8 deletions(-)

-- 
2.25.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [bug report] drm/bridge: Introduce LT8912B DSI to HDMI bridge

2021-03-31 Thread Adrien Grassein
Le mer. 31 mars 2021 à 11:27, Dan Carpenter  a écrit :
>
> On Wed, Mar 31, 2021 at 11:17:20AM +0200, Adrien Grassein wrote:
> > Hello,
> >
> > thanks for your review.
> >
> > I will publish a patch soon.
> >
> > What tag should I add to my commit to mention that you find bugs
> > (Suggested-by for example)?
>
> If there is a bug fix then please could you use Reported-by?
>
I will do that + Suggested-by.
> regards,
> dan carpenter
>

Thanks again for your time and your review.

Adrien
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [bug report] drm/bridge: Introduce LT8912B DSI to HDMI bridge

2021-03-31 Thread Adrien Grassein
Hello,

thanks for your review.

I will publish a patch soon.

What tag should I add to my commit to mention that you find bugs
(Suggested-by for example)?

Thanks;

Le mer. 31 mars 2021 à 10:14, Dan Carpenter  a écrit :
>
> On Wed, Mar 31, 2021 at 11:12:38AM +0300, Dan Carpenter wrote:
> >644  of_node_put(endpoint);
> >645
> >646  lt->host_node = of_graph_get_remote_node(dev->of_node, 0, 
> > -1);
> >647  if (!lt->host_node) {
> >648  dev_err(lt->dev, "%s: Failed to get remote port\n", 
> > __func__);
> >649  ret = -ENODEV;
> >650  goto end;
> >651  }
> >652
> >653  port_node = of_graph_get_remote_node(dev->of_node, 1, -1);
> >654  if (!port_node) {
> >655  dev_err(lt->dev, "%s: Failed to get connector 
> > port\n", __func__);
> >656  ret = -ENODEV;
> >657  goto err_free_host_node;
> >658  }
> >659
> >660  lt->hdmi_port = of_drm_find_bridge(port_node);
> >661  if (IS_ERR(lt->hdmi_port)) {
>
> This isn't an error pointer either.  of_drm_find_bridge() returns NULL.
>
> regards,
> dan carpenter
>
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v9 2/2] drm/bridge: Introduce LT8912B DSI to HDMI bridge

2021-03-26 Thread Adrien Grassein
Lontium LT8912B is a DSI to HDMI bridge.

Signed-off-by: Adrien Grassein 
Reported-by: kernel test robot 
Reviewed-by: Robert Foss 
---
 MAINTAINERS  |   1 +
 drivers/gpu/drm/bridge/Kconfig   |  14 +
 drivers/gpu/drm/bridge/Makefile  |   1 +
 drivers/gpu/drm/bridge/lontium-lt8912b.c | 765 +++
 4 files changed, 781 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/lontium-lt8912b.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 0dd60d51c001..a4e03d19f579 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10552,6 +10552,7 @@ LONTIUM LT8912B MIPI TO HDMI BRIDGE
 M: Adrien Grassein 
 S: Maintained
 F: Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml
+F: drivers/gpu/drm/bridge/lontium-lt8912b.c
 
 LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI)
 M: Sathya Prakash 
diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 330ee70ed746..dba62f92d051 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -61,6 +61,20 @@ config DRM_DISPLAY_CONNECTOR
  on ARM-based platforms. Saying Y here when this driver is not needed
  will not cause any issue.
 
+config DRM_LONTIUM_LT8912B
+   tristate "Lontium LT8912B DSI/HDMI bridge"
+   depends on OF
+   select DRM_PANEL_BRIDGE
+   select DRM_KMS_HELPER
+   select REGMAP_I2C
+   help
+ Driver for Lontium LT8912B DSI to HDMI bridge
+ chip driver.
+ Please say Y if you have such hardware.
+
+ Say M here if you want to support this hardware as a module.
+ The module will be named "lontium-lt8912b".
+
 config DRM_LONTIUM_LT9611
tristate "Lontium LT9611 DSI/HDMI bridge"
select SND_SOC_HDMI_CODEC if SND_SOC
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index 3eb84b638988..5c61b50c1663 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -3,6 +3,7 @@ obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
 obj-$(CONFIG_DRM_CHIPONE_ICN6211) += chipone-icn6211.o
 obj-$(CONFIG_DRM_CHRONTEL_CH7033) += chrontel-ch7033.o
 obj-$(CONFIG_DRM_DISPLAY_CONNECTOR) += display-connector.o
+obj-$(CONFIG_DRM_LONTIUM_LT8912B) += lontium-lt8912b.o
 obj-$(CONFIG_DRM_LONTIUM_LT9611) += lontium-lt9611.o
 obj-$(CONFIG_DRM_LONTIUM_LT9611UXC) += lontium-lt9611uxc.o
 obj-$(CONFIG_DRM_LVDS_CODEC) += lvds-codec.o
diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c 
b/drivers/gpu/drm/bridge/lontium-lt8912b.c
new file mode 100644
index ..61491615bad0
--- /dev/null
+++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c
@@ -0,0 +1,765 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#define I2C_MAIN 0
+#define I2C_ADDR_MAIN 0x48
+
+#define I2C_CEC_DSI 1
+#define I2C_ADDR_CEC_DSI 0x49
+
+#define I2C_MAX_IDX 2
+
+struct lt8912 {
+   struct device *dev;
+   struct drm_bridge bridge;
+   struct drm_connector connector;
+
+   struct i2c_client *i2c_client[I2C_MAX_IDX];
+   struct regmap *regmap[I2C_MAX_IDX];
+
+   struct device_node *host_node;
+   struct drm_bridge *hdmi_port;
+
+   struct mipi_dsi_device *dsi;
+
+   struct gpio_desc *gp_reset;
+
+   struct videomode mode;
+
+   u8 data_lanes;
+   bool is_power_on;
+   bool is_attached;
+};
+
+static int lt8912_write_init_config(struct lt8912 *lt)
+{
+   const struct reg_sequence seq[] = {
+   /* Digital clock en*/
+   {0x08, 0xff},
+   {0x09, 0xff},
+   {0x0a, 0xff},
+   {0x0b, 0x7c},
+   {0x0c, 0xff},
+   {0x42, 0x04},
+
+   /*Tx Analog*/
+   {0x31, 0xb1},
+   {0x32, 0xb1},
+   {0x33, 0x0e},
+   {0x37, 0x00},
+   {0x38, 0x22},
+   {0x60, 0x82},
+
+   /*Cbus Analog*/
+   {0x39, 0x45},
+   {0x3a, 0x00},
+   {0x3b, 0x00},
+
+   /*HDMI Pll Analog*/
+   {0x44, 0x31},
+   {0x55, 0x44},
+   {0x57, 0x01},
+   {0x5a, 0x02},
+
+   /*MIPI Analog*/
+   {0x3e, 0xd6},
+   {0x3f, 0xd4},
+   {0x41, 0x3c},
+   {0xB2, 0x00},
+   };
+
+   return regmap_multi_reg_write(lt->regmap[I2C_MAIN], seq, 
ARRAY_SIZE(seq));
+}
+
+static int lt8912_write_mipi_basic_config(struct lt8912 *lt)
+{
+   const struct reg_sequence seq[] = {
+   {0x12, 0x04},
+   {0x14, 0x00},
+   {0x15, 0x00},
+   {0x1a, 0x03},
+   {0x1b, 0x03},
+   };
+
+   return regmap_multi_reg_write(lt->regmap[I2C_CEC_DSI], seq, 

[PATCH v9 0/2] Add support of Lontium lt8912 MIPI to HDMI bridge

2021-03-26 Thread Adrien Grassein
Hi,
this patch set adds the support of the Lontium lt8912 MIPI to HDMI
bridge in the kernel.

It's only support the video part, not the audio part yet
since I don't have the datasheet of this component.
I get the current i2c configuration from Digi and
Boundary drivers.
Developed using the DB_DSIHD board from BoundaryDevices.

Update in v2
  - Use standard data-lanes instead of a custom prop;
  - Use hdmi-connector node.

Update in v3
  - Fix indentation;
  - Implement missing bridge functions;
  - Add some comments.

Update in v4
  - Fix bridge ops;
  - Fix i2c error detection.

Update in v5
  - Fix lt8912 name (lt8912b instead of lt8912);
  - Implement HPD via a workaround. In fact I don't have the datasheet
of this component yet so I can't say if the configuration of the
registers is correct or if I have an HW issue on my board. So, I choose
to implement a fake version of HPD using a workqueue and polling the
status regularly.

Update in v6
  - Fix a warning found by "kernel test robot"

Update in v7
  - Fix HPD logic (via an HW emulation);
  - HPD from chip is still not working.

Update in v8
  - Remove HPD logic (will be added later when HW bug qill be fixed).

Update in v9
  - Fix errors found in scripts/checkpatch.pl --strict

Thanks,

Adrien Grassein (2):
  dt-bindings: display: bridge: Add documentation for LT8912B
  drm/bridge: Introduce LT8912B DSI to HDMI bridge

 .../display/bridge/lontium,lt8912b.yaml   | 102 +++
 MAINTAINERS   |   6 +
 drivers/gpu/drm/bridge/Kconfig|  14 +
 drivers/gpu/drm/bridge/Makefile   |   1 +
 drivers/gpu/drm/bridge/lontium-lt8912b.c  | 765 ++
 5 files changed, 888 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml
 create mode 100644 drivers/gpu/drm/bridge/lontium-lt8912b.c

-- 
2.25.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v9 1/2] dt-bindings: display: bridge: Add documentation for LT8912B

2021-03-26 Thread Adrien Grassein
Lontium LT8912B is a DSI to HDMI bridge.

Signed-off-by: Adrien Grassein 
Reviewed-by: Rob Herring 
---
 .../display/bridge/lontium,lt8912b.yaml   | 102 ++
 MAINTAINERS   |   5 +
 2 files changed, 107 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml

diff --git 
a/Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml 
b/Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml
new file mode 100644
index ..735d0233a7d6
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml
@@ -0,0 +1,102 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/bridge/lontium,lt8912b.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Lontium LT8912B MIPI to HDMI Bridge
+
+maintainers:
+  - Adrien Grassein 
+
+description: |
+  The LT8912B is a bridge device which convert DSI to HDMI
+
+properties:
+  compatible:
+enum:
+  - lontium,lt8912b
+
+  reg:
+maxItems: 1
+
+  reset-gpios:
+maxItems: 1
+description: GPIO connected to active high RESET pin.
+
+  ports:
+$ref: /schemas/graph.yaml#/properties/ports
+
+properties:
+  port@0:
+$ref: /schemas/graph.yaml#/properties/port
+description:
+  Primary MIPI port for MIPI input
+
+properties:
+  endpoint:
+$ref: /schemas/media/video-interfaces.yaml#
+unevaluatedProperties: false
+
+properties:
+  data-lanes: true
+
+required:
+  - data-lanes
+
+  port@1:
+$ref: /schemas/graph.yaml#/properties/port
+description: |
+  HDMI port, should be connected to a node compatible with the
+  hdmi-connector binding.
+
+required:
+  - port@0
+  - port@1
+
+required:
+  - compatible
+  - reg
+  - reset-gpios
+  - ports
+
+additionalProperties: false
+
+examples:
+  - |
+#include 
+
+i2c4 {
+  #address-cells = <1>;
+  #size-cells = <0>;
+
+  hdmi-bridge@48 {
+compatible = "lontium,lt8912b";
+reg = <0x48>;
+reset-gpios = < 0 GPIO_ACTIVE_LOW>;
+
+ports {
+  #address-cells = <1>;
+  #size-cells = <0>;
+
+  port@0 {
+reg = <0>;
+
+hdmi_out_in: endpoint {
+  data-lanes = <0 1 2 3>;
+  remote-endpoint = <_dsi_out>;
+};
+  };
+
+  port@1 {
+  reg = <1>;
+
+  endpoint {
+  remote-endpoint = <_in>;
+  };
+  };
+};
+  };
+};
+
+...
diff --git a/MAINTAINERS b/MAINTAINERS
index 67b104202602..0dd60d51c001 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10548,6 +10548,11 @@ S: Maintained
 T: git git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git
 F: drivers/hid/hid-lg-g15.c
 
+LONTIUM LT8912B MIPI TO HDMI BRIDGE
+M: Adrien Grassein 
+S: Maintained
+F: Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml
+
 LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI)
 M: Sathya Prakash 
 M: Sreekanth Reddy 
-- 
2.25.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v8 2/2] drm/bridge: Introduce LT8912B DSI to HDMI bridge

2021-03-23 Thread Adrien Grassein
Lontium LT8912B is a DSI to HDMI bridge.

Signed-off-by: Adrien Grassein 
Reported-by: kernel test robot 
Reviewed-by: Robert Foss 
---
 MAINTAINERS  |   1 +
 drivers/gpu/drm/bridge/Kconfig   |  14 +
 drivers/gpu/drm/bridge/Makefile  |   1 +
 drivers/gpu/drm/bridge/lontium-lt8912b.c | 765 +++
 4 files changed, 781 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/lontium-lt8912b.c

diff --git a/MAINTAINERS b/MAINTAINERS
index d9a125e5d295..6af083797947 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10530,6 +10530,7 @@ LONTIUM LT8912B MIPI TO HDMI BRIDGE
 M: Adrien Grassein 
 S: Maintained
 F: Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml
+F: drivers/gpu/drm/bridge/lontium-lt8912b.c
 
 LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI)
 M: Sathya Prakash 
diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index e4110d6ca7b3..f2c5ec75d2f5 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -48,6 +48,20 @@ config DRM_DISPLAY_CONNECTOR
  on ARM-based platforms. Saying Y here when this driver is not needed
  will not cause any issue.
 
+config DRM_LONTIUM_LT8912B
+   tristate "Lontium LT8912B DSI/HDMI bridge"
+   depends on OF
+   select DRM_PANEL_BRIDGE
+   select DRM_KMS_HELPER
+   select REGMAP_I2C
+   help
+ Driver for Lontium LT8912B DSI to HDMI bridge
+ chip driver.
+ Please say Y if you have such hardware.
+
+ Say M here if you want to support this hardware as a module.
+ The module will be named "lontium-lt8912b".
+
 config DRM_LONTIUM_LT9611
tristate "Lontium LT9611 DSI/HDMI bridge"
select SND_SOC_HDMI_CODEC if SND_SOC
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index 86e7acc76f8d..756ce401aad3 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -2,6 +2,7 @@
 obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
 obj-$(CONFIG_DRM_CHRONTEL_CH7033) += chrontel-ch7033.o
 obj-$(CONFIG_DRM_DISPLAY_CONNECTOR) += display-connector.o
+obj-$(CONFIG_DRM_LONTIUM_LT8912B) += lontium-lt8912b.o
 obj-$(CONFIG_DRM_LONTIUM_LT9611) += lontium-lt9611.o
 obj-$(CONFIG_DRM_LONTIUM_LT9611UXC) += lontium-lt9611uxc.o
 obj-$(CONFIG_DRM_LVDS_CODEC) += lvds-codec.o
diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c 
b/drivers/gpu/drm/bridge/lontium-lt8912b.c
new file mode 100644
index ..fd0ec1c84368
--- /dev/null
+++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c
@@ -0,0 +1,765 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#define I2C_MAIN 0
+#define I2C_ADDR_MAIN 0x48
+
+#define I2C_CEC_DSI 1
+#define I2C_ADDR_CEC_DSI 0x49
+
+#define I2C_MAX_IDX 2
+
+struct lt8912 {
+   struct device *dev;
+   struct drm_bridge bridge;
+   struct drm_connector connector;
+
+   struct i2c_client *i2c_client[I2C_MAX_IDX];
+   struct regmap *regmap[I2C_MAX_IDX];
+
+   struct device_node *host_node;
+   struct drm_bridge *hdmi_port;
+
+   struct mipi_dsi_device *dsi;
+
+   struct gpio_desc *gp_reset;
+
+   struct videomode mode;
+
+   u8 data_lanes;
+   bool is_power_on;
+   bool is_attached;
+};
+
+static int lt8912_write_init_config(struct lt8912 *lt)
+{
+   const struct reg_sequence seq[] = {
+   /* Digital clock en*/
+   {0x08, 0xff},
+   {0x09, 0xff},
+   {0x0a, 0xff},
+   {0x0b, 0x7c},
+   {0x0c, 0xff},
+   {0x42, 0x04},
+
+   /*Tx Analog*/
+   {0x31, 0xb1},
+   {0x32, 0xb1},
+   {0x33, 0x0e},
+   {0x37, 0x00},
+   {0x38, 0x22},
+   {0x60, 0x82},
+
+   /*Cbus Analog*/
+   {0x39, 0x45},
+   {0x3a, 0x00},
+   {0x3b, 0x00},
+
+   /*HDMI Pll Analog*/
+   {0x44, 0x31},
+   {0x55, 0x44},
+   {0x57, 0x01},
+   {0x5a, 0x02},
+
+   /*MIPI Analog*/
+   {0x3e, 0xd6},
+   {0x3f, 0xd4},
+   {0x41, 0x3c},
+   {0xB2, 0x00},
+   };
+
+   return regmap_multi_reg_write(lt->regmap[I2C_MAIN], seq, 
ARRAY_SIZE(seq));
+}
+
+static int lt8912_write_mipi_basic_config(struct lt8912 *lt)
+{
+   const struct reg_sequence seq[] = {
+   {0x12, 0x04},
+   {0x14, 0x00},
+   {0x15, 0x00},
+   {0x1a, 0x03},
+   {0x1b, 0x03},
+   };
+
+   return regmap_multi_reg_write(lt->regmap[I2C_CEC_DSI], seq, 
ARRAY_SIZE(seq));
+};
+
+static int lt8912_write_dds_config

[PATCH v8 1/2] dt-bindings: display: bridge: Add documentation for LT8912B

2021-03-23 Thread Adrien Grassein
Lontium LT8912B is a DSI to HDMI bridge.

Signed-off-by: Adrien Grassein 
Reviewed-by: Rob Herring 
---
 .../display/bridge/lontium,lt8912b.yaml   | 102 ++
 MAINTAINERS   |   5 +
 2 files changed, 107 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml

diff --git 
a/Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml 
b/Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml
new file mode 100644
index ..735d0233a7d6
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml
@@ -0,0 +1,102 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/bridge/lontium,lt8912b.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Lontium LT8912B MIPI to HDMI Bridge
+
+maintainers:
+  - Adrien Grassein 
+
+description: |
+  The LT8912B is a bridge device which convert DSI to HDMI
+
+properties:
+  compatible:
+enum:
+  - lontium,lt8912b
+
+  reg:
+maxItems: 1
+
+  reset-gpios:
+maxItems: 1
+description: GPIO connected to active high RESET pin.
+
+  ports:
+$ref: /schemas/graph.yaml#/properties/ports
+
+properties:
+  port@0:
+$ref: /schemas/graph.yaml#/properties/port
+description:
+  Primary MIPI port for MIPI input
+
+properties:
+  endpoint:
+$ref: /schemas/media/video-interfaces.yaml#
+unevaluatedProperties: false
+
+properties:
+  data-lanes: true
+
+required:
+  - data-lanes
+
+  port@1:
+$ref: /schemas/graph.yaml#/properties/port
+description: |
+  HDMI port, should be connected to a node compatible with the
+  hdmi-connector binding.
+
+required:
+  - port@0
+  - port@1
+
+required:
+  - compatible
+  - reg
+  - reset-gpios
+  - ports
+
+additionalProperties: false
+
+examples:
+  - |
+#include 
+
+i2c4 {
+  #address-cells = <1>;
+  #size-cells = <0>;
+
+  hdmi-bridge@48 {
+compatible = "lontium,lt8912b";
+reg = <0x48>;
+reset-gpios = < 0 GPIO_ACTIVE_LOW>;
+
+ports {
+  #address-cells = <1>;
+  #size-cells = <0>;
+
+  port@0 {
+reg = <0>;
+
+hdmi_out_in: endpoint {
+  data-lanes = <0 1 2 3>;
+  remote-endpoint = <_dsi_out>;
+};
+  };
+
+  port@1 {
+  reg = <1>;
+
+  endpoint {
+  remote-endpoint = <_in>;
+  };
+  };
+};
+  };
+};
+
+...
diff --git a/MAINTAINERS b/MAINTAINERS
index 8c44fd8fd85d..d9a125e5d295 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10526,6 +10526,11 @@ S: Maintained
 T: git git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git
 F: drivers/hid/hid-lg-g15.c
 
+LONTIUM LT8912B MIPI TO HDMI BRIDGE
+M: Adrien Grassein 
+S: Maintained
+F: Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml
+
 LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI)
 M: Sathya Prakash 
 M: Sreekanth Reddy 
-- 
2.25.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v8 0/2] Add support of Lontium lt8912 MIPI to HDMI bridge

2021-03-23 Thread Adrien Grassein
Hi,
this patch set adds the support of the Lontium lt8912 MIPI to HDMI
bridge in the kernel.

It's only support the video part, not the audio part yet
since I don't have the datasheet of this component.
I get the current i2c configuration from Digi and
Boundary drivers.
Developed using the DB_DSIHD board from BoundaryDevices.

Update in v2
  - Use standard data-lanes instead of a custom prop;
  - Use hdmi-connector node.

Update in v3
  - Fix indentation;
  - Implement missing bridge functions;
  - Add some comments.

Update in v4
  - Fix bridge ops;
  - Fix i2c error detection.

Update in v5
  - Fix lt8912 name (lt8912b instead of lt8912);
  - Implement HPD via a workaround. In fact I don't have the datasheet
of this component yet so I can't say if the configuration of the
registers is correct or if I have an HW issue on my board. So, I choose
to implement a fake version of HPD using a workqueue and polling the
status regularly.

Update in v6
  - Fix a warning found by "kernel test robot"

Update in v7
  - Fix HPD logic (via an HW emulation);
  - HPD from chip is still not working.

Update in v8
  - Remove HPD logic (will be added later when HW bug qill be fixed).

Thanks,

Adrien Grassein (2):
  dt-bindings: display: bridge: Add documentation for LT8912B
  drm/bridge: Introduce LT8912B DSI to HDMI bridge

 .../display/bridge/lontium,lt8912b.yaml   | 102 +++
 MAINTAINERS   |   6 +
 drivers/gpu/drm/bridge/Kconfig|  14 +
 drivers/gpu/drm/bridge/Makefile   |   1 +
 drivers/gpu/drm/bridge/lontium-lt8912b.c  | 765 ++
 5 files changed, 888 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml
 create mode 100644 drivers/gpu/drm/bridge/lontium-lt8912b.c

-- 
2.25.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v7 2/2] drm/bridge: Introduce LT8912B DSI to HDMI bridge

2021-03-23 Thread Adrien Grassein
Le mar. 23 mars 2021 à 15:16, Adrien Grassein
 a écrit :
>
> Le mar. 23 mars 2021 à 15:07, Robert Foss  a écrit :
> >
> > > > > >
> > > > > > > +static enum drm_connector_status 
> > > > > > > lt8912_check_cable_status(struct lt8912 *lt)
> > > > > > > +{
> > > > > > > +   int ret;
> > > > > > > +   unsigned int reg_val;
> > > > > > > +
> > > > > > > +   ret = regmap_read(lt->regmap[I2C_MAIN], 0xC1, _val);
> > > > > > > +   if (ret)
> > > > > > > +   return connector_status_unknown;
> > > > > > > +
> > > > > > > +   if (reg_val & BIT(7))
> > > > > > > +   return connector_status_connected;
> > > > > >
> > > > > > Register 0xc0 & BIT(7) - HPD signal after debounce
> > > > > > Register 0xc0 & BIT(6) - HPD signal for TX HPD pad
> > > > >
> > > > > So, if I understand well, I need to write 0xc0 & BIT(6) with 1 to
> > > > > enable the HPD pin.
> > > >
> > > > Ah, sorry about being a bit terse.
> > > >
> > > > Both bit 6 & 7 are read only, and are probably best read after an IRQ.
> > >
> > > In my case, IRQ is not triggered at all.
> >
> > Are you saying that pin 63 never is high, or that an irq/isr routine
> > isn't getting executed?
> >
> > > When reading the value of the HPD pin, I always get 1 (and no
> > > transition occurs when plugging / unplugging a cable).
> > > The HPD IRQ is done on the HDMI connector driver [5].
> > > I think a register configuration should be done to enable the IRQ pin
> > > or maybe there is a nug in electronics.
> >
> > After looking at the documentation a bit more, I think we can ignore
> > pin63 and instead have a look at pin14. It is the HDMI TX HPD Control
> > pin. It has a 100k pull-down, so it should be active high.
>
> pin63 is always active high.
> pin14 is connected to the HDMI logic (pin 19 of the HDMI connector)
> with a 100k pull-down.
>
> >
> > I also found some different I2C addresses than what you've used, I
> > assume the device is available on both addresses.
> >
> > Chip control registers, address:0x90
> > CEC control registers, address 0x92
> >
> Strange, configuration seems to be working well with the address used
> in my driver.
>
> > > The HPD pin is linked to a 2.2k pullup resistor (maybe it's wrong)
> >
> > The datasheet isn't entirely clear about if pin14 has an internal 100k
> > pull-down, or if they recommend adding a 100k pull-down.
> >
> > But this does seem like an issue.
>
> pin14 can't be used directly. I guess it's used by the internal logic
> of the chip to generate the HPD (pin63) signal.
> >
> > >
> > > >
> > > > > >
> > > > > > > +
> > > > > > > +static int lt8912_probe(struct i2c_client *client,
> > > > > > > +const struct i2c_device_id *id)
> > > > > > > +{
> > > > > > > +   static struct lt8912 *lt;
> > > > > > > +   int ret = 0;
> > > > > > > +   struct device *dev = >dev;
> > > > > > > +
> > > > > > > +   lt = devm_kzalloc(dev, sizeof(struct lt8912), GFP_KERNEL);
> > > > > > > +   if (!lt)
> > > > > > > +   return -ENOMEM;
> > > > > > > +
> > > > > > > +   lt->dev = dev;
> > > > > > > +   lt->i2c_client[0] = client;
> > > > > > > +   lt->cable_status = connector_status_unknown;
> > > > > > > +   lt->workq = create_workqueue("lt8912_workq");
> > > > > >
> > > > > > Looking at [1] and maybe even better [2], I think this polling
> > > > > > approach is the wrong way to go. And with access to documentation, I
> > > > > > think we should be able to sort this out.
> > > > >
> > > > > I neither like the polling approach too. I did it to go on this issue.
> > > > > I will totally remove it once the HPD issue will be resolved.
> > > > > >
> > > > > > Using the irq driver approach requires the interrupt pin to be
> > > > > &

Re: [PATCH v7 2/2] drm/bridge: Introduce LT8912B DSI to HDMI bridge

2021-03-23 Thread Adrien Grassein
Le mar. 23 mars 2021 à 15:07, Robert Foss  a écrit :
>
> > > > >
> > > > > > +static enum drm_connector_status lt8912_check_cable_status(struct 
> > > > > > lt8912 *lt)
> > > > > > +{
> > > > > > +   int ret;
> > > > > > +   unsigned int reg_val;
> > > > > > +
> > > > > > +   ret = regmap_read(lt->regmap[I2C_MAIN], 0xC1, _val);
> > > > > > +   if (ret)
> > > > > > +   return connector_status_unknown;
> > > > > > +
> > > > > > +   if (reg_val & BIT(7))
> > > > > > +   return connector_status_connected;
> > > > >
> > > > > Register 0xc0 & BIT(7) - HPD signal after debounce
> > > > > Register 0xc0 & BIT(6) - HPD signal for TX HPD pad
> > > >
> > > > So, if I understand well, I need to write 0xc0 & BIT(6) with 1 to
> > > > enable the HPD pin.
> > >
> > > Ah, sorry about being a bit terse.
> > >
> > > Both bit 6 & 7 are read only, and are probably best read after an IRQ.
> >
> > In my case, IRQ is not triggered at all.
>
> Are you saying that pin 63 never is high, or that an irq/isr routine
> isn't getting executed?
>
> > When reading the value of the HPD pin, I always get 1 (and no
> > transition occurs when plugging / unplugging a cable).
> > The HPD IRQ is done on the HDMI connector driver [5].
> > I think a register configuration should be done to enable the IRQ pin
> > or maybe there is a nug in electronics.
>
> After looking at the documentation a bit more, I think we can ignore
> pin63 and instead have a look at pin14. It is the HDMI TX HPD Control
> pin. It has a 100k pull-down, so it should be active high.

pin63 is always active high.
pin14 is connected to the HDMI logic (pin 19 of the HDMI connector)
with a 100k pull-down.

>
> I also found some different I2C addresses than what you've used, I
> assume the device is available on both addresses.
>
> Chip control registers, address:0x90
> CEC control registers, address 0x92
>
Strange, configuration seems to be working well with the address used
in my driver.

> > The HPD pin is linked to a 2.2k pullup resistor (maybe it's wrong)
>
> The datasheet isn't entirely clear about if pin14 has an internal 100k
> pull-down, or if they recommend adding a 100k pull-down.
>
> But this does seem like an issue.

pin14 can't be used directly. I guess it's used by the internal logic
of the chip to generate the HPD (pin63) signal.
>
> >
> > >
> > > > >
> > > > > > +
> > > > > > +static int lt8912_probe(struct i2c_client *client,
> > > > > > +const struct i2c_device_id *id)
> > > > > > +{
> > > > > > +   static struct lt8912 *lt;
> > > > > > +   int ret = 0;
> > > > > > +   struct device *dev = >dev;
> > > > > > +
> > > > > > +   lt = devm_kzalloc(dev, sizeof(struct lt8912), GFP_KERNEL);
> > > > > > +   if (!lt)
> > > > > > +   return -ENOMEM;
> > > > > > +
> > > > > > +   lt->dev = dev;
> > > > > > +   lt->i2c_client[0] = client;
> > > > > > +   lt->cable_status = connector_status_unknown;
> > > > > > +   lt->workq = create_workqueue("lt8912_workq");
> > > > >
> > > > > Looking at [1] and maybe even better [2], I think this polling
> > > > > approach is the wrong way to go. And with access to documentation, I
> > > > > think we should be able to sort this out.
> > > >
> > > > I neither like the polling approach too. I did it to go on this issue.
> > > > I will totally remove it once the HPD issue will be resolved.
> > > > >
> > > > > Using the irq driver approach requires the interrupt pin to be
> > > > > configured. Pin 63 of the lt8912b is the IRQ output pin.
> > > > >
> > > > > In order to trigger interrupts based on it, the dt-binding would need
> > > > > to be updated[3][4] as well as whichever DTS you're using.
> > > > >
> > > >
> > > > The IRQ part is working well in my DTB. It test it by adding some
> > > > electronics to emulate the HPD pin on the GPIO expander where the HPD
> > > > pin is linked.
> > >
> > > Looking at the dt-binding patch, it does not seem to list any
> > > interrupts. So that should be added. I think the irq support from [3]
> > > & [4] can be pretty much copied.
> > >
> > > Then we can come back and replace the polling code with the IRQ driven
> > > code from [2].
> >
> > My board uses a "max7323" GPIO expander and the HPD pin is linked to it.
> > I test this GPIO expander by soldering a pull up resistor and an
> > interrupt on it and an interrupt was correctly triggered in both
> > max7323 driver and hdmi-connector;
> > So I guess that my DTB configuration is correct.
> > I made my DBT configuration available:
> >   - hdmi-connector node: [6]
> >   - lt8912b node: |7]
> >   - max7323 node: [8].
>
> Looking at [7] I think that you would want to add something like:
>
> hdmi-bridge@48 {
> interrupts-extended = < $LT8912B_PIN_14 IRQ_TYPE_EDGE_RISING>;
> }
>
> And of course add the corresponding parts from [2] and [3].
>
> >
> >
> > >
> > > >
> > > > >
> > > > > [1] 
> > > > > 

Re: [PATCH v7 2/2] drm/bridge: Introduce LT8912B DSI to HDMI bridge

2021-03-23 Thread Adrien Grassein
Le mar. 23 mars 2021 à 11:42, Robert Foss  a écrit :
>
> On Tue, 23 Mar 2021 at 11:01, Adrien Grassein  
> wrote:
> >
> > Hey Robert,
> >
> > Thanks for the update.
> >
> > Le mar. 23 mars 2021 à 10:10, Robert Foss  a écrit :
> > >
> > > Hey Adrien,
> > >
> > > Sorry about the slow reply, but I just received the documentation from
> > > the vendor. So let's dig in to the HPD issue.
> >
> > No problem :)
> > >
> > > > +static enum drm_connector_status lt8912_check_cable_status(struct 
> > > > lt8912 *lt)
> > > > +{
> > > > +   int ret;
> > > > +   unsigned int reg_val;
> > > > +
> > > > +   ret = regmap_read(lt->regmap[I2C_MAIN], 0xC1, _val);
> > > > +   if (ret)
> > > > +   return connector_status_unknown;
> > > > +
> > > > +   if (reg_val & BIT(7))
> > > > +   return connector_status_connected;
> > >
> > > Register 0xc0 & BIT(7) - HPD signal after debounce
> > > Register 0xc0 & BIT(6) - HPD signal for TX HPD pad
> >
> > So, if I understand well, I need to write 0xc0 & BIT(6) with 1 to
> > enable the HPD pin.
>
> Ah, sorry about being a bit terse.
>
> Both bit 6 & 7 are read only, and are probably best read after an IRQ.

In my case, IRQ is not triggered at all.
When reading the value of the HPD pin, I always get 1 (and no
transition occurs when plugging / unplugging a cable).
The HPD IRQ is done on the HDMI connector driver [5].
I think a register configuration should be done to enable the IRQ pin
or maybe there is a nug in electronics.
The HPD pin is linked to a 2.2k pullup resistor (maybe it's wrong)

>
> > >
> > > > +
> > > > +static int lt8912_probe(struct i2c_client *client,
> > > > +const struct i2c_device_id *id)
> > > > +{
> > > > +   static struct lt8912 *lt;
> > > > +   int ret = 0;
> > > > +   struct device *dev = >dev;
> > > > +
> > > > +   lt = devm_kzalloc(dev, sizeof(struct lt8912), GFP_KERNEL);
> > > > +   if (!lt)
> > > > +   return -ENOMEM;
> > > > +
> > > > +   lt->dev = dev;
> > > > +   lt->i2c_client[0] = client;
> > > > +   lt->cable_status = connector_status_unknown;
> > > > +   lt->workq = create_workqueue("lt8912_workq");
> > >
> > > Looking at [1] and maybe even better [2], I think this polling
> > > approach is the wrong way to go. And with access to documentation, I
> > > think we should be able to sort this out.
> >
> > I neither like the polling approach too. I did it to go on this issue.
> > I will totally remove it once the HPD issue will be resolved.
> > >
> > > Using the irq driver approach requires the interrupt pin to be
> > > configured. Pin 63 of the lt8912b is the IRQ output pin.
> > >
> > > In order to trigger interrupts based on it, the dt-binding would need
> > > to be updated[3][4] as well as whichever DTS you're using.
> > >
> >
> > The IRQ part is working well in my DTB. It test it by adding some
> > electronics to emulate the HPD pin on the GPIO expander where the HPD
> > pin is linked.
>
> Looking at the dt-binding patch, it does not seem to list any
> interrupts. So that should be added. I think the irq support from [3]
> & [4] can be pretty much copied.
>
> Then we can come back and replace the polling code with the IRQ driven
> code from [2].

My board uses a "max7323" GPIO expander and the HPD pin is linked to it.
I test this GPIO expander by soldering a pull up resistor and an
interrupt on it and an interrupt was correctly triggered in both
max7323 driver and hdmi-connector;
So I guess that my DTB configuration is correct.
I made my DBT configuration available:
  - hdmi-connector node: [6]
  - lt8912b node: |7]
  - max7323 node: [8].


>
> >
> > >
> > > [1] 
> > > https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/bridge/analogix/anx7625.c#L1751
> > >
> > > [2] 
> > > https://github.com/torvalds/linux/blob/v5.11/drivers/gpu/drm/bridge/lontium-lt9611.c#L1160
> > >
> > > [3] 
> > > https://github.com/torvalds/linux/blob/v5.11/Documentation/devicetree/bindings/display/bridge/lontium,lt9611.yaml#L27
> > >
> > > [4] 
> > > https://github.com/torvalds/linux/blob/v5.11/Documentation/devicetree/bindings/display/bridge/lontium,lt9611.yaml#L144

[5] 
https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/bridge/display-connector.c#L199
[6] 
https://github.com/grassead/linux-next/blob/master/arch/arm64/boot/dts/freescale/imx8mq-nitrogen.dts#L37
[7] 
https://github.com/grassead/linux-next/blob/master/arch/arm64/boot/dts/freescale/imx8mq-nitrogen.dts#L249
[8] 
https://github.com/grassead/linux-next/blob/master/arch/arm64/boot/dts/freescale/imx8mq-nitrogen.dts#L291


Thanks,
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v7 2/2] drm/bridge: Introduce LT8912B DSI to HDMI bridge

2021-03-23 Thread Adrien Grassein
Hey Robert,

Thanks for the update.

Le mar. 23 mars 2021 à 10:10, Robert Foss  a écrit :
>
> Hey Adrien,
>
> Sorry about the slow reply, but I just received the documentation from
> the vendor. So let's dig in to the HPD issue.

No problem :)
>
> > +static enum drm_connector_status lt8912_check_cable_status(struct lt8912 
> > *lt)
> > +{
> > +   int ret;
> > +   unsigned int reg_val;
> > +
> > +   ret = regmap_read(lt->regmap[I2C_MAIN], 0xC1, _val);
> > +   if (ret)
> > +   return connector_status_unknown;
> > +
> > +   if (reg_val & BIT(7))
> > +   return connector_status_connected;
>
> Register 0xc0 & BIT(7) - HPD signal after debounce
> Register 0xc0 & BIT(6) - HPD signal for TX HPD pad

So, if I understand well, I need to write 0xc0 & BIT(6) with 1 to
enable the HPD pin.
>
> > +
> > +static int lt8912_probe(struct i2c_client *client,
> > +const struct i2c_device_id *id)
> > +{
> > +   static struct lt8912 *lt;
> > +   int ret = 0;
> > +   struct device *dev = >dev;
> > +
> > +   lt = devm_kzalloc(dev, sizeof(struct lt8912), GFP_KERNEL);
> > +   if (!lt)
> > +   return -ENOMEM;
> > +
> > +   lt->dev = dev;
> > +   lt->i2c_client[0] = client;
> > +   lt->cable_status = connector_status_unknown;
> > +   lt->workq = create_workqueue("lt8912_workq");
>
> Looking at [1] and maybe even better [2], I think this polling
> approach is the wrong way to go. And with access to documentation, I
> think we should be able to sort this out.

I neither like the polling approach too. I did it to go on this issue.
I will totally remove it once the HPD issue will be resolved.
>
> Using the irq driver approach requires the interrupt pin to be
> configured. Pin 63 of the lt8912b is the IRQ output pin.
>
> In order to trigger interrupts based on it, the dt-binding would need
> to be updated[3][4] as well as whichever DTS you're using.
>

The IRQ part is working well in my DTB. It test it by adding some
electronics to emulate the HPD pin on the GPIO expander where the HPD
pin is linked.

>
> [1] 
> https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/bridge/analogix/anx7625.c#L1751
>
> [2] 
> https://github.com/torvalds/linux/blob/v5.11/drivers/gpu/drm/bridge/lontium-lt9611.c#L1160
>
> [3] 
> https://github.com/torvalds/linux/blob/v5.11/Documentation/devicetree/bindings/display/bridge/lontium,lt9611.yaml#L27
>
> [4] 
> https://github.com/torvalds/linux/blob/v5.11/Documentation/devicetree/bindings/display/bridge/lontium,lt9611.yaml#L144

Thanks a lot,
Adrien
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v7 2/2] drm/bridge: Introduce LT8912B DSI to HDMI bridge

2021-03-08 Thread Adrien Grassein
Lontium LT8912B is a DSI to HDMI bridge.

Signed-off-by: Adrien Grassein 
Reported-by: kernel test robot 
---
 MAINTAINERS  |   1 +
 drivers/gpu/drm/bridge/Kconfig   |  14 +
 drivers/gpu/drm/bridge/Makefile  |   1 +
 drivers/gpu/drm/bridge/lontium-lt8912b.c | 836 +++
 4 files changed, 852 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/lontium-lt8912b.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 719f633c8a28..072dea9c43ed 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10466,6 +10466,7 @@ LONTIUM LT8912B MIPI TO HDMI BRIDGE
 M: Adrien Grassein 
 S: Maintained
 F: Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml
+F: drivers/gpu/drm/bridge/lontium-lt8912b.c
 
 LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI)
 M: Sathya Prakash 
diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index e4110d6ca7b3..f2c5ec75d2f5 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -48,6 +48,20 @@ config DRM_DISPLAY_CONNECTOR
  on ARM-based platforms. Saying Y here when this driver is not needed
  will not cause any issue.
 
+config DRM_LONTIUM_LT8912B
+   tristate "Lontium LT8912B DSI/HDMI bridge"
+   depends on OF
+   select DRM_PANEL_BRIDGE
+   select DRM_KMS_HELPER
+   select REGMAP_I2C
+   help
+ Driver for Lontium LT8912B DSI to HDMI bridge
+ chip driver.
+ Please say Y if you have such hardware.
+
+ Say M here if you want to support this hardware as a module.
+ The module will be named "lontium-lt8912b".
+
 config DRM_LONTIUM_LT9611
tristate "Lontium LT9611 DSI/HDMI bridge"
select SND_SOC_HDMI_CODEC if SND_SOC
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index 86e7acc76f8d..756ce401aad3 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -2,6 +2,7 @@
 obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
 obj-$(CONFIG_DRM_CHRONTEL_CH7033) += chrontel-ch7033.o
 obj-$(CONFIG_DRM_DISPLAY_CONNECTOR) += display-connector.o
+obj-$(CONFIG_DRM_LONTIUM_LT8912B) += lontium-lt8912b.o
 obj-$(CONFIG_DRM_LONTIUM_LT9611) += lontium-lt9611.o
 obj-$(CONFIG_DRM_LONTIUM_LT9611UXC) += lontium-lt9611uxc.o
 obj-$(CONFIG_DRM_LVDS_CODEC) += lvds-codec.o
diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c 
b/drivers/gpu/drm/bridge/lontium-lt8912b.c
new file mode 100644
index ..82501fe2e408
--- /dev/null
+++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c
@@ -0,0 +1,836 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#define I2C_MAIN 0
+#define I2C_ADDR_MAIN 0x48
+
+#define I2C_CEC_DSI 1
+#define I2C_ADDR_CEC_DSI 0x49
+
+#define I2C_MAX_IDX 2
+
+#define HPD_WORK_DELAY_MS 1000
+
+struct lt8912 {
+   struct device *dev;
+   struct drm_bridge bridge;
+   struct drm_connector connector;
+
+   struct i2c_client *i2c_client[I2C_MAX_IDX];
+   struct regmap *regmap[I2C_MAX_IDX];
+
+   struct device_node *host_node;
+   struct drm_bridge *hdmi_port;
+
+   struct mipi_dsi_device *dsi;
+
+   struct gpio_desc *gp_reset;
+
+   struct videomode mode;
+
+   u8 data_lanes;
+   bool is_power_on;
+   bool is_attached;
+
+   enum drm_connector_status cable_status;
+   struct workqueue_struct *workq;
+   struct delayed_work lt8912_check_hpd_work_id;
+};
+
+static int lt8912_write_init_config(struct lt8912 *lt)
+{
+   const struct reg_sequence seq[] = {
+   /* Digital clock en*/
+   {0x08, 0xff},
+   {0x09, 0xff},
+   {0x0a, 0xff},
+   {0x0b, 0x7c},
+   {0x0c, 0xff},
+   {0x42, 0x04},
+
+   /*Tx Analog*/
+   {0x31, 0xb1},
+   {0x32, 0xb1},
+   {0x33, 0x0e},
+   {0x37, 0x00},
+   {0x38, 0x22},
+   {0x60, 0x82},
+
+   /*Cbus Analog*/
+   {0x39, 0x45},
+   {0x3a, 0x00},
+   {0x3b, 0x00},
+
+   /*HDMI Pll Analog*/
+   {0x44, 0x31},
+   {0x55, 0x44},
+   {0x57, 0x01},
+   {0x5a, 0x02},
+
+   /*MIPI Analog*/
+   {0x3e, 0xd6},
+   {0x3f, 0xd4},
+   {0x41, 0x3c},
+   {0xB2, 0x00},
+   };
+
+   return regmap_multi_reg_write(lt->regmap[I2C_MAIN], seq, 
ARRAY_SIZE(seq));
+}
+
+static int lt8912_write_mipi_basic_config(struct lt8912 *lt)
+{
+   const struct reg_sequence seq[] = {
+   {0x12, 0x04},
+   {0x14, 0x00},
+   {0x15, 0x00},
+   {0x1a, 0x03},
+   {0x1b, 0

[PATCH v7 1/2] dt-bindings: display: bridge: Add documentation for LT8912B

2021-03-08 Thread Adrien Grassein
Lontium LT8912B is a DSI to HDMI bridge.

Signed-off-by: Adrien Grassein 
Reviewed-by: Rob Herring 
---
 .../display/bridge/lontium,lt8912b.yaml   | 102 ++
 MAINTAINERS   |   5 +
 2 files changed, 107 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml

diff --git 
a/Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml 
b/Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml
new file mode 100644
index ..735d0233a7d6
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml
@@ -0,0 +1,102 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/bridge/lontium,lt8912b.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Lontium LT8912B MIPI to HDMI Bridge
+
+maintainers:
+  - Adrien Grassein 
+
+description: |
+  The LT8912B is a bridge device which convert DSI to HDMI
+
+properties:
+  compatible:
+enum:
+  - lontium,lt8912b
+
+  reg:
+maxItems: 1
+
+  reset-gpios:
+maxItems: 1
+description: GPIO connected to active high RESET pin.
+
+  ports:
+$ref: /schemas/graph.yaml#/properties/ports
+
+properties:
+  port@0:
+$ref: /schemas/graph.yaml#/properties/port
+description:
+  Primary MIPI port for MIPI input
+
+properties:
+  endpoint:
+$ref: /schemas/media/video-interfaces.yaml#
+unevaluatedProperties: false
+
+properties:
+  data-lanes: true
+
+required:
+  - data-lanes
+
+  port@1:
+$ref: /schemas/graph.yaml#/properties/port
+description: |
+  HDMI port, should be connected to a node compatible with the
+  hdmi-connector binding.
+
+required:
+  - port@0
+  - port@1
+
+required:
+  - compatible
+  - reg
+  - reset-gpios
+  - ports
+
+additionalProperties: false
+
+examples:
+  - |
+#include 
+
+i2c4 {
+  #address-cells = <1>;
+  #size-cells = <0>;
+
+  hdmi-bridge@48 {
+compatible = "lontium,lt8912b";
+reg = <0x48>;
+reset-gpios = < 0 GPIO_ACTIVE_LOW>;
+
+ports {
+  #address-cells = <1>;
+  #size-cells = <0>;
+
+  port@0 {
+reg = <0>;
+
+hdmi_out_in: endpoint {
+  data-lanes = <0 1 2 3>;
+  remote-endpoint = <_dsi_out>;
+};
+  };
+
+  port@1 {
+  reg = <1>;
+
+  endpoint {
+  remote-endpoint = <_in>;
+  };
+  };
+};
+  };
+};
+
+...
diff --git a/MAINTAINERS b/MAINTAINERS
index 9095d182deaf..719f633c8a28 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10462,6 +10462,11 @@ S: Maintained
 T: git git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git
 F: drivers/hid/hid-lg-g15.c
 
+LONTIUM LT8912B MIPI TO HDMI BRIDGE
+M: Adrien Grassein 
+S: Maintained
+F: Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml
+
 LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI)
 M: Sathya Prakash 
 M: Sreekanth Reddy 
-- 
2.25.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v7 0/2] Add support of Lontium lt8912 MIPI to HDMI bridge

2021-03-08 Thread Adrien Grassein
Hi,
this patch set adds the support of the Lontium lt8912 MIPI to HDMI
bridge in the kernel.

It's only support the video part, not the audio part yet
since I don't have the datasheet of this component.
I get the current i2c configuration from Digi and
Boundary drivers.
Developed using the DB_DSIHD board from BoundaryDevices.

Update in v2
  - Use standard data-lanes instead of a custom prop;
  - Use hdmi-connector node.

Update in v3
  - Fix indentation;
  - Implement missing bridge functions;
  - Add some comments.

Update in v4
  - Fix bridge ops;
  - Fix i2c error detection.

Update in v5
  - Fix lt8912 name (lt8912b instead of lt8912);
  - Implement HPD via a workaround. In fact I don't have the datasheet
of this component yet so I can't say if the configuration of the
registers is correct or if I have an HW issue on my board. So, I choose
to implement a fake version of HPD using a workqueue and polling the
status regularly.

Update in v6
  - Fix a warning found by "kernel test robot"

Update in v7
  - Fix HPD logic (via an HW emulation);
  - HPD from chip is still not working.

Thanks,

Adrien Grassein (2):
  dt-bindings: display: bridge: Add documentation for LT8912B
  drm/bridge: Introduce LT8912B DSI to HDMI bridge

 .../display/bridge/lontium,lt8912b.yaml   | 102 +++
 MAINTAINERS   |   6 +
 drivers/gpu/drm/bridge/Kconfig|  14 +
 drivers/gpu/drm/bridge/Makefile   |   1 +
 drivers/gpu/drm/bridge/lontium-lt8912b.c  | 836 ++
 5 files changed, 959 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml
 create mode 100644 drivers/gpu/drm/bridge/lontium-lt8912b.c

-- 
2.25.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v6 2/2] drm/bridge: Introduce LT8912B DSI to HDMI bridge

2021-02-27 Thread Adrien Grassein
Lontium LT8912B is a DSI to HDMI bridge.

Signed-off-by: Adrien Grassein 
Reported-by: kernel test robot 
---
 MAINTAINERS  |   1 +
 drivers/gpu/drm/bridge/Kconfig   |  14 +
 drivers/gpu/drm/bridge/Makefile  |   1 +
 drivers/gpu/drm/bridge/lontium-lt8912b.c | 818 +++
 4 files changed, 834 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/lontium-lt8912b.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 6366b8eac3f6..e075a74f57dd 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10464,6 +10464,7 @@ LONTIUM LT8912B MIPI TO HDMI BRIDGE
 M: Adrien Grassein 
 S: Maintained
 F: Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml
+F: drivers/gpu/drm/bridge/lontium-lt8912b.c
 
 LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI)
 M: Sathya Prakash 
diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index e4110d6ca7b3..f2c5ec75d2f5 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -48,6 +48,20 @@ config DRM_DISPLAY_CONNECTOR
  on ARM-based platforms. Saying Y here when this driver is not needed
  will not cause any issue.
 
+config DRM_LONTIUM_LT8912B
+   tristate "Lontium LT8912B DSI/HDMI bridge"
+   depends on OF
+   select DRM_PANEL_BRIDGE
+   select DRM_KMS_HELPER
+   select REGMAP_I2C
+   help
+ Driver for Lontium LT8912B DSI to HDMI bridge
+ chip driver.
+ Please say Y if you have such hardware.
+
+ Say M here if you want to support this hardware as a module.
+ The module will be named "lontium-lt8912b".
+
 config DRM_LONTIUM_LT9611
tristate "Lontium LT9611 DSI/HDMI bridge"
select SND_SOC_HDMI_CODEC if SND_SOC
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index 86e7acc76f8d..756ce401aad3 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -2,6 +2,7 @@
 obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
 obj-$(CONFIG_DRM_CHRONTEL_CH7033) += chrontel-ch7033.o
 obj-$(CONFIG_DRM_DISPLAY_CONNECTOR) += display-connector.o
+obj-$(CONFIG_DRM_LONTIUM_LT8912B) += lontium-lt8912b.o
 obj-$(CONFIG_DRM_LONTIUM_LT9611) += lontium-lt9611.o
 obj-$(CONFIG_DRM_LONTIUM_LT9611UXC) += lontium-lt9611uxc.o
 obj-$(CONFIG_DRM_LVDS_CODEC) += lvds-codec.o
diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c 
b/drivers/gpu/drm/bridge/lontium-lt8912b.c
new file mode 100644
index ..3d55f5dec197
--- /dev/null
+++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c
@@ -0,0 +1,818 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#define I2C_MAIN 0
+#define I2C_ADDR_MAIN 0x48
+
+#define I2C_CEC_DSI 1
+#define I2C_ADDR_CEC_DSI 0x49
+
+#define I2C_MAX_IDX 2
+
+#define HPD_WORK_DELAY_MS 1000
+
+struct lt8912 {
+   struct device *dev;
+   struct drm_bridge bridge;
+   struct drm_connector connector;
+
+   struct i2c_client *i2c_client[I2C_MAX_IDX];
+   struct regmap *regmap[I2C_MAX_IDX];
+
+   struct device_node *host_node;
+   struct drm_bridge *hdmi_port;
+
+   struct mipi_dsi_device *dsi;
+
+   struct gpio_desc *gp_reset;
+
+   struct videomode mode;
+
+   u8 data_lanes;
+   bool is_power_on;
+   bool is_attached;
+
+   enum drm_connector_status cable_status;
+   struct workqueue_struct *workq;
+   struct delayed_work lt8912_check_hpd_work_id;
+};
+
+static int lt8912_write_init_config(struct lt8912 *lt)
+{
+   const struct reg_sequence seq[] = {
+   /* Digital clock en*/
+   {0x08, 0xff},
+   {0x09, 0xff},
+   {0x0a, 0xff},
+   {0x0b, 0x7c},
+   {0x0c, 0xff},
+   {0x42, 0x04},
+
+   /*Tx Analog*/
+   {0x31, 0xb1},
+   {0x32, 0xb1},
+   {0x33, 0x0e},
+   {0x37, 0x00},
+   {0x38, 0x22},
+   {0x60, 0x82},
+
+   /*Cbus Analog*/
+   {0x39, 0x45},
+   {0x3a, 0x00},
+   {0x3b, 0x00},
+
+   /*HDMI Pll Analog*/
+   {0x44, 0x31},
+   {0x55, 0x44},
+   {0x57, 0x01},
+   {0x5a, 0x02},
+
+   /*MIPI Analog*/
+   {0x3e, 0xd6},
+   {0x3f, 0xd4},
+   {0x41, 0x3c},
+   {0xB2, 0x00},
+   };
+
+   return regmap_multi_reg_write(lt->regmap[I2C_MAIN], seq, 
ARRAY_SIZE(seq));
+}
+
+static int lt8912_write_mipi_basic_config(struct lt8912 *lt)
+{
+   const struct reg_sequence seq[] = {
+   {0x12, 0x04},
+   {0x14, 0x00},
+   {0x15, 0x00},
+   {0x1a, 0x03},
+   {0x1b, 0

[PATCH v6 1/2] dt-bindings: display: bridge: Add documentation for LT8912B

2021-02-27 Thread Adrien Grassein
Lontium LT8912B is a DSI to HDMI bridge.

Signed-off-by: Adrien Grassein 
Reviewed-by: Rob Herring 
---
 .../display/bridge/lontium,lt8912b.yaml   | 102 ++
 MAINTAINERS   |   5 +
 2 files changed, 107 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml

diff --git 
a/Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml 
b/Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml
new file mode 100644
index ..735d0233a7d6
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml
@@ -0,0 +1,102 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/bridge/lontium,lt8912b.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Lontium LT8912B MIPI to HDMI Bridge
+
+maintainers:
+  - Adrien Grassein 
+
+description: |
+  The LT8912B is a bridge device which convert DSI to HDMI
+
+properties:
+  compatible:
+enum:
+  - lontium,lt8912b
+
+  reg:
+maxItems: 1
+
+  reset-gpios:
+maxItems: 1
+description: GPIO connected to active high RESET pin.
+
+  ports:
+$ref: /schemas/graph.yaml#/properties/ports
+
+properties:
+  port@0:
+$ref: /schemas/graph.yaml#/properties/port
+description:
+  Primary MIPI port for MIPI input
+
+properties:
+  endpoint:
+$ref: /schemas/media/video-interfaces.yaml#
+unevaluatedProperties: false
+
+properties:
+  data-lanes: true
+
+required:
+  - data-lanes
+
+  port@1:
+$ref: /schemas/graph.yaml#/properties/port
+description: |
+  HDMI port, should be connected to a node compatible with the
+  hdmi-connector binding.
+
+required:
+  - port@0
+  - port@1
+
+required:
+  - compatible
+  - reg
+  - reset-gpios
+  - ports
+
+additionalProperties: false
+
+examples:
+  - |
+#include 
+
+i2c4 {
+  #address-cells = <1>;
+  #size-cells = <0>;
+
+  hdmi-bridge@48 {
+compatible = "lontium,lt8912b";
+reg = <0x48>;
+reset-gpios = < 0 GPIO_ACTIVE_LOW>;
+
+ports {
+  #address-cells = <1>;
+  #size-cells = <0>;
+
+  port@0 {
+reg = <0>;
+
+hdmi_out_in: endpoint {
+  data-lanes = <0 1 2 3>;
+  remote-endpoint = <_dsi_out>;
+};
+  };
+
+  port@1 {
+  reg = <1>;
+
+  endpoint {
+  remote-endpoint = <_in>;
+  };
+  };
+};
+  };
+};
+
+...
diff --git a/MAINTAINERS b/MAINTAINERS
index 16ada1a4b751..6366b8eac3f6 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10460,6 +10460,11 @@ S: Maintained
 T: git git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git
 F: drivers/hid/hid-lg-g15.c
 
+LONTIUM LT8912B MIPI TO HDMI BRIDGE
+M: Adrien Grassein 
+S: Maintained
+F: Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml
+
 LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI)
 M: Sathya Prakash 
 M: Sreekanth Reddy 
-- 
2.25.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v6 0/2] Add support of Lontium lt8912 MIPI to HDMI bridge

2021-02-27 Thread Adrien Grassein
Hi,
this patch set adds the support of the Lontium lt8912 MIPI to HDMI
bridge in the kernel.

It's only support the video part, not the audio part yet
since I don't have the datasheet of this component.
I get the current i2c configuration from Digi and
Boundary drivers.
Developed using the DB_DSIHD board from BoundaryDevices.

Update in v2
  - Use standard data-lanes instead of a custom prop;
  - Use hdmi-connector node.

Update in v3
  - Fix indentation;
  - Implement missing bridge functions;
  - Add some comments.

Update in v4
  - Fix bridge ops;
  - Fix i2c error detection.

Update in v5
  - Fix lt8912 name (lt8912b instead of lt8912);
  - Implement HPD via a workaround. In fact I don't have the datasheet
of this component yet so I can't say if the configuration of the
registers is correct or if I have an HW issue on my board. So, I choose
to implement a fake version of HPD using a workqueue and polling the
status regularly.

Update in v6
  - Fix a warning found by "kernel test robot"

Thanks,

Adrien Grassein (2):
  dt-bindings: display: bridge: Add documentation for LT8912B
  drm/bridge: Introduce LT8912B DSI to HDMI bridge

 .../display/bridge/lontium,lt8912b.yaml   | 102 +++
 MAINTAINERS   |   6 +
 drivers/gpu/drm/bridge/Kconfig|  14 +
 drivers/gpu/drm/bridge/Makefile   |   1 +
 drivers/gpu/drm/bridge/lontium-lt8912b.c  | 818 ++
 5 files changed, 941 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml
 create mode 100644 drivers/gpu/drm/bridge/lontium-lt8912b.c

-- 
2.25.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v5 2/2] drm/bridge: Introduce LT8912B DSI to HDMI bridge

2021-02-27 Thread Adrien Grassein
Lontium LT8912B is a DSI to HDMI bridge.

Signed-off-by: Adrien Grassein 
---
 MAINTAINERS  |   1 +
 drivers/gpu/drm/bridge/Kconfig   |  14 +
 drivers/gpu/drm/bridge/Makefile  |   1 +
 drivers/gpu/drm/bridge/lontium-lt8912b.c | 817 +++
 4 files changed, 833 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/lontium-lt8912b.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 6366b8eac3f6..e075a74f57dd 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10464,6 +10464,7 @@ LONTIUM LT8912B MIPI TO HDMI BRIDGE
 M: Adrien Grassein 
 S: Maintained
 F: Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml
+F: drivers/gpu/drm/bridge/lontium-lt8912b.c
 
 LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI)
 M: Sathya Prakash 
diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index e4110d6ca7b3..f2c5ec75d2f5 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -48,6 +48,20 @@ config DRM_DISPLAY_CONNECTOR
  on ARM-based platforms. Saying Y here when this driver is not needed
  will not cause any issue.
 
+config DRM_LONTIUM_LT8912B
+   tristate "Lontium LT8912B DSI/HDMI bridge"
+   depends on OF
+   select DRM_PANEL_BRIDGE
+   select DRM_KMS_HELPER
+   select REGMAP_I2C
+   help
+ Driver for Lontium LT8912B DSI to HDMI bridge
+ chip driver.
+ Please say Y if you have such hardware.
+
+ Say M here if you want to support this hardware as a module.
+ The module will be named "lontium-lt8912b".
+
 config DRM_LONTIUM_LT9611
tristate "Lontium LT9611 DSI/HDMI bridge"
select SND_SOC_HDMI_CODEC if SND_SOC
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index 86e7acc76f8d..756ce401aad3 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -2,6 +2,7 @@
 obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
 obj-$(CONFIG_DRM_CHRONTEL_CH7033) += chrontel-ch7033.o
 obj-$(CONFIG_DRM_DISPLAY_CONNECTOR) += display-connector.o
+obj-$(CONFIG_DRM_LONTIUM_LT8912B) += lontium-lt8912b.o
 obj-$(CONFIG_DRM_LONTIUM_LT9611) += lontium-lt9611.o
 obj-$(CONFIG_DRM_LONTIUM_LT9611UXC) += lontium-lt9611uxc.o
 obj-$(CONFIG_DRM_LVDS_CODEC) += lvds-codec.o
diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c 
b/drivers/gpu/drm/bridge/lontium-lt8912b.c
new file mode 100644
index ..f3ed8d8b7a64
--- /dev/null
+++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c
@@ -0,0 +1,817 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#define I2C_MAIN 0
+#define I2C_ADDR_MAIN 0x48
+
+#define I2C_CEC_DSI 1
+#define I2C_ADDR_CEC_DSI 0x49
+
+#define I2C_MAX_IDX 2
+
+#define HPD_WORK_DELAY_MS 1000
+
+struct lt8912 {
+   struct device *dev;
+   struct drm_bridge bridge;
+   struct drm_connector connector;
+
+   struct i2c_client *i2c_client[I2C_MAX_IDX];
+   struct regmap *regmap[I2C_MAX_IDX];
+
+   struct device_node *host_node;
+   struct drm_bridge *hdmi_port;
+
+   struct mipi_dsi_device *dsi;
+
+   struct gpio_desc *gp_reset;
+
+   struct videomode mode;
+
+   u8 data_lanes;
+   bool is_power_on;
+   bool is_attached;
+
+   enum drm_connector_status cable_status;
+   struct workqueue_struct *workq;
+   struct delayed_work lt8912_check_hpd_work_id;
+};
+
+static int lt8912_write_init_config(struct lt8912 *lt)
+{
+   const struct reg_sequence seq[] = {
+   /* Digital clock en*/
+   {0x08, 0xff},
+   {0x09, 0xff},
+   {0x0a, 0xff},
+   {0x0b, 0x7c},
+   {0x0c, 0xff},
+   {0x42, 0x04},
+
+   /*Tx Analog*/
+   {0x31, 0xb1},
+   {0x32, 0xb1},
+   {0x33, 0x0e},
+   {0x37, 0x00},
+   {0x38, 0x22},
+   {0x60, 0x82},
+
+   /*Cbus Analog*/
+   {0x39, 0x45},
+   {0x3a, 0x00},
+   {0x3b, 0x00},
+
+   /*HDMI Pll Analog*/
+   {0x44, 0x31},
+   {0x55, 0x44},
+   {0x57, 0x01},
+   {0x5a, 0x02},
+
+   /*MIPI Analog*/
+   {0x3e, 0xd6},
+   {0x3f, 0xd4},
+   {0x41, 0x3c},
+   {0xB2, 0x00},
+   };
+
+   return regmap_multi_reg_write(lt->regmap[I2C_MAIN], seq, 
ARRAY_SIZE(seq));
+}
+
+static int lt8912_write_mipi_basic_config(struct lt8912 *lt)
+{
+   const struct reg_sequence seq[] = {
+   {0x12, 0x04},
+   {0x14, 0x00},
+   {0x15, 0x00},
+   {0x1a, 0x03},
+   {0x1b, 0x03},
+   };
+
+   return 

[PATCH v5 1/2] dt-bindings: display: bridge: Add documentation for LT8912B

2021-02-27 Thread Adrien Grassein
Lontium LT8912B is a DSI to HDMI bridge.

Signed-off-by: Adrien Grassein 
Reviewed-by: Rob Herring 
---
 .../display/bridge/lontium,lt8912b.yaml   | 102 ++
 MAINTAINERS   |   5 +
 2 files changed, 107 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml

diff --git 
a/Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml 
b/Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml
new file mode 100644
index ..735d0233a7d6
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml
@@ -0,0 +1,102 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/bridge/lontium,lt8912b.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Lontium LT8912B MIPI to HDMI Bridge
+
+maintainers:
+  - Adrien Grassein 
+
+description: |
+  The LT8912B is a bridge device which convert DSI to HDMI
+
+properties:
+  compatible:
+enum:
+  - lontium,lt8912b
+
+  reg:
+maxItems: 1
+
+  reset-gpios:
+maxItems: 1
+description: GPIO connected to active high RESET pin.
+
+  ports:
+$ref: /schemas/graph.yaml#/properties/ports
+
+properties:
+  port@0:
+$ref: /schemas/graph.yaml#/properties/port
+description:
+  Primary MIPI port for MIPI input
+
+properties:
+  endpoint:
+$ref: /schemas/media/video-interfaces.yaml#
+unevaluatedProperties: false
+
+properties:
+  data-lanes: true
+
+required:
+  - data-lanes
+
+  port@1:
+$ref: /schemas/graph.yaml#/properties/port
+description: |
+  HDMI port, should be connected to a node compatible with the
+  hdmi-connector binding.
+
+required:
+  - port@0
+  - port@1
+
+required:
+  - compatible
+  - reg
+  - reset-gpios
+  - ports
+
+additionalProperties: false
+
+examples:
+  - |
+#include 
+
+i2c4 {
+  #address-cells = <1>;
+  #size-cells = <0>;
+
+  hdmi-bridge@48 {
+compatible = "lontium,lt8912b";
+reg = <0x48>;
+reset-gpios = < 0 GPIO_ACTIVE_LOW>;
+
+ports {
+  #address-cells = <1>;
+  #size-cells = <0>;
+
+  port@0 {
+reg = <0>;
+
+hdmi_out_in: endpoint {
+  data-lanes = <0 1 2 3>;
+  remote-endpoint = <_dsi_out>;
+};
+  };
+
+  port@1 {
+  reg = <1>;
+
+  endpoint {
+  remote-endpoint = <_in>;
+  };
+  };
+};
+  };
+};
+
+...
diff --git a/MAINTAINERS b/MAINTAINERS
index 16ada1a4b751..6366b8eac3f6 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10460,6 +10460,11 @@ S: Maintained
 T: git git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git
 F: drivers/hid/hid-lg-g15.c
 
+LONTIUM LT8912B MIPI TO HDMI BRIDGE
+M: Adrien Grassein 
+S: Maintained
+F: Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml
+
 LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI)
 M: Sathya Prakash 
 M: Sreekanth Reddy 
-- 
2.25.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v5 0/2] Add support of Lontium lt8912 MIPI to HDMI bridge

2021-02-27 Thread Adrien Grassein
Hi,
this patch set adds the support of the Lontium lt8912 MIPI to HDMI
bridge in the kernel.

It's only support the video part, not the audio part yet
since I don't have the datasheet of this component.
I get the current i2c configuration from Digi and
Boundary drivers.
Developed using the DB_DSIHD board from BoundaryDevices.

Update in v2
  - Use standard data-lanes instead of a custom prop;
  - Use hdmi-connector node.

Update in v3
  - Fix indentation;
  - Implement missing bridge functions;
  - Add some comments.

Update in v4
  - Fix bridge ops;
  - Fix i2c error detection.

Update in v5
  - Fix lt8912 name (lt8912b instead of lt8912);
  - Implement HPD via a workaround. In fact I don't have the datasheet
of this component yet so I can't say if the configuration of the
registers is correct or if I have an HW issue on my board. So, I choose
to implement a fake version of HPD using a workqueue and polling the
status regularly.

Thanks,

Adrien Grassein (2):
  dt-bindings: display: bridge: Add documentation for LT8912B
  drm/bridge: Introduce LT8912B DSI to HDMI bridge

 .../display/bridge/lontium,lt8912b.yaml   | 102 +++
 MAINTAINERS   |   6 +
 drivers/gpu/drm/bridge/Kconfig|  14 +
 drivers/gpu/drm/bridge/Makefile   |   1 +
 drivers/gpu/drm/bridge/lontium-lt8912b.c  | 817 ++
 5 files changed, 940 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml
 create mode 100644 drivers/gpu/drm/bridge/lontium-lt8912b.c

-- 
2.25.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v4 2/2] drm/bridge: Introduce LT8912 DSI to HDMI bridge

2021-02-23 Thread Adrien Grassein
Lontium Lt8912 is a DSI to HDMI bridge.

Signed-off-by: Adrien Grassein 
---
 MAINTAINERS |   1 +
 drivers/gpu/drm/bridge/Kconfig  |  14 +
 drivers/gpu/drm/bridge/Makefile |   1 +
 drivers/gpu/drm/bridge/lontium-lt8912.c | 764 
 4 files changed, 780 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/lontium-lt8912.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 1e4d49f9dfea..fda331610c35 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10464,6 +10464,7 @@ LONTIUM LT8912 MIPI TO HDMI BRIDGE
 M: Adrien Grassein 
 S: Maintained
 F: Documentation/devicetree/bindings/display/bridge/lontium,lt8912.yaml
+F: drivers/gpu/drm/bridge/lontium-lt8912.c
 
 LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI)
 M: Sathya Prakash 
diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index e4110d6ca7b3..5b36d4b86e3c 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -48,6 +48,20 @@ config DRM_DISPLAY_CONNECTOR
  on ARM-based platforms. Saying Y here when this driver is not needed
  will not cause any issue.
 
+config DRM_LONTIUM_LT8912
+   tristate "Lontium LT8912 DSI/HDMI bridge"
+   depends on OF
+   select DRM_PANEL_BRIDGE
+   select DRM_KMS_HELPER
+   select REGMAP_I2C
+   help
+ Driver for Lontium LT8912 DSI to HDMI bridge
+ chip driver.
+ Please say Y if you have such hardware.
+
+ Say M here if you want to support this hardware as a module.
+ The module will be named "lontium-lt8912".
+
 config DRM_LONTIUM_LT9611
tristate "Lontium LT9611 DSI/HDMI bridge"
select SND_SOC_HDMI_CODEC if SND_SOC
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index 86e7acc76f8d..5a1b201cea1f 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -2,6 +2,7 @@
 obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
 obj-$(CONFIG_DRM_CHRONTEL_CH7033) += chrontel-ch7033.o
 obj-$(CONFIG_DRM_DISPLAY_CONNECTOR) += display-connector.o
+obj-$(CONFIG_DRM_LONTIUM_LT8912) += lontium-lt8912.o
 obj-$(CONFIG_DRM_LONTIUM_LT9611) += lontium-lt9611.o
 obj-$(CONFIG_DRM_LONTIUM_LT9611UXC) += lontium-lt9611uxc.o
 obj-$(CONFIG_DRM_LVDS_CODEC) += lvds-codec.o
diff --git a/drivers/gpu/drm/bridge/lontium-lt8912.c 
b/drivers/gpu/drm/bridge/lontium-lt8912.c
new file mode 100644
index ..11d94da73c37
--- /dev/null
+++ b/drivers/gpu/drm/bridge/lontium-lt8912.c
@@ -0,0 +1,764 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#define I2C_MAIN 0
+#define I2C_ADDR_MAIN 0x48
+
+#define I2C_CEC_DSI 1
+#define I2C_ADDR_CEC_DSI 0x49
+
+#define I2C_MAX_IDX 2
+
+struct lt8912 {
+   struct device *dev;
+   struct drm_bridge bridge;
+   struct drm_connector connector;
+
+   struct i2c_client *i2c_client[I2C_MAX_IDX];
+   struct regmap *regmap[I2C_MAX_IDX];
+
+   struct device_node *host_node;
+   struct drm_bridge *hdmi_port;
+
+   struct mipi_dsi_device *dsi;
+
+   struct gpio_desc *gp_reset;
+
+   struct videomode mode;
+
+   u8 data_lanes;
+   bool is_power_on;
+   bool is_attached;
+};
+
+static int lt8912_write_init_config(struct lt8912 *lt)
+{
+   const struct reg_sequence seq[] = {
+   /* Digital clock en*/
+   {0x08, 0xff},
+   {0x09, 0xff},
+   {0x0a, 0xff},
+   {0x0b, 0x7c},
+   {0x0c, 0xff},
+   {0x42, 0x04},
+
+   /*Tx Analog*/
+   {0x31, 0xb1},
+   {0x32, 0xb1},
+   {0x33, 0x0e},
+   {0x37, 0x00},
+   {0x38, 0x22},
+   {0x60, 0x82},
+
+   /*Cbus Analog*/
+   {0x39, 0x45},
+   {0x3a, 0x00},
+   {0x3b, 0x00},
+
+   /*HDMI Pll Analog*/
+   {0x44, 0x31},
+   {0x55, 0x44},
+   {0x57, 0x01},
+   {0x5a, 0x02},
+
+   /*MIPI Analog*/
+   {0x3e, 0xd6},
+   {0x3f, 0xd4},
+   {0x41, 0x3c},
+   {0xB2, 0x00},
+   };
+
+   return regmap_multi_reg_write(lt->regmap[I2C_MAIN], seq, 
ARRAY_SIZE(seq));
+}
+
+static int lt8912_write_mipi_basic_config(struct lt8912 *lt)
+{
+   const struct reg_sequence seq[] = {
+   {0x12, 0x04},
+   {0x14, 0x00},
+   {0x15, 0x00},
+   {0x1a, 0x03},
+   {0x1b, 0x03},
+   };
+
+   return regmap_multi_reg_write(lt->regmap[I2C_CEC_DSI], seq, 
ARRAY_SIZE(seq));
+};
+
+static int lt8912_write_dds_config(struct lt8912 *lt)
+{
+   const struct reg_sequence s

[PATCH v4 1/2] dt-bindings: display: bridge: Add documentation for LT8912

2021-02-23 Thread Adrien Grassein
Lontium LT8912 is a DSI to HDMI bridge.

Signed-off-by: Adrien Grassein 
Reviewed-by: Rob Herring 
---
 .../display/bridge/lontium,lt8912.yaml| 102 ++
 MAINTAINERS   |   5 +
 2 files changed, 107 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/lontium,lt8912.yaml

diff --git 
a/Documentation/devicetree/bindings/display/bridge/lontium,lt8912.yaml 
b/Documentation/devicetree/bindings/display/bridge/lontium,lt8912.yaml
new file mode 100644
index ..1e5a2ad5eb47
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/lontium,lt8912.yaml
@@ -0,0 +1,102 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/bridge/lontium,lt8912.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Lontium LT8912 MIPI to HDMI Bridge
+
+maintainers:
+  - Adrien Grassein 
+
+description: |
+  The LT8912 is a bridge device which convert DSI to HDMI
+
+properties:
+  compatible:
+enum:
+  - lontium,lt8912
+
+  reg:
+maxItems: 1
+
+  reset-gpios:
+maxItems: 1
+description: GPIO connected to active high RESET pin.
+
+  ports:
+$ref: /schemas/graph.yaml#/properties/ports
+
+properties:
+  port@0:
+$ref: /schemas/graph.yaml#/properties/port
+description:
+  Primary MIPI port for MIPI input
+
+properties:
+  endpoint:
+$ref: /schemas/media/video-interfaces.yaml#
+unevaluatedProperties: false
+
+properties:
+  data-lanes: true
+
+required:
+  - data-lanes
+
+  port@1:
+$ref: /schemas/graph.yaml#/properties/port
+description: |
+  HDMI port, should be connected to a node compatible with the
+  hdmi-connector binding.
+
+required:
+  - port@0
+  - port@1
+
+required:
+  - compatible
+  - reg
+  - reset-gpios
+  - ports
+
+additionalProperties: false
+
+examples:
+  - |
+#include 
+
+i2c4 {
+  #address-cells = <1>;
+  #size-cells = <0>;
+
+  hdmi-bridge@48 {
+compatible = "lontium,lt8912";
+reg = <0x48>;
+reset-gpios = < 0 GPIO_ACTIVE_LOW>;
+
+ports {
+  #address-cells = <1>;
+  #size-cells = <0>;
+
+  port@0 {
+reg = <0>;
+
+hdmi_out_in: endpoint {
+  data-lanes = <0 1 2 3>;
+  remote-endpoint = <_dsi_out>;
+};
+  };
+
+  port@1 {
+  reg = <1>;
+
+  endpoint {
+  remote-endpoint = <_in>;
+  };
+  };
+};
+  };
+};
+
+...
diff --git a/MAINTAINERS b/MAINTAINERS
index 16ada1a4b751..1e4d49f9dfea 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10460,6 +10460,11 @@ S: Maintained
 T: git git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git
 F: drivers/hid/hid-lg-g15.c
 
+LONTIUM LT8912 MIPI TO HDMI BRIDGE
+M: Adrien Grassein 
+S: Maintained
+F: Documentation/devicetree/bindings/display/bridge/lontium,lt8912.yaml
+
 LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI)
 M: Sathya Prakash 
 M: Sreekanth Reddy 
-- 
2.25.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v4 0/2] Add support of Lontium lt8912 MIPI to HDMI bridge

2021-02-23 Thread Adrien Grassein
Hi,
this patch set adds the support of the Lontium lt8912 MIPI to HDMI
bridge in the kernel.

It's only support the video part, not the audio part yet
since I don't have the datasheet of this component.
I get the current i2c configuration from Digi and
Boundary drivers.
Developed using the DB_DSIHD board from BoundaryDevices.

Update in v2
  - Use standard data-lanes instead of a custom prop;
  - Use hdmi-connector node.

Update in v3
  - Fix indentation;
  - Implement missing bridge functions;
  - Add some comments.

Update in v4
  - Fix bridge ops;
  - Fix i2c error detection.

Adrien Grassein (2):
  dt-bindings: display: bridge: Add documentation for LT8912
  drm/bridge: Introduce LT8912 DSI to HDMI bridge

 .../display/bridge/lontium,lt8912.yaml| 102 +++
 MAINTAINERS   |   6 +
 drivers/gpu/drm/bridge/Kconfig|  14 +
 drivers/gpu/drm/bridge/Makefile   |   1 +
 drivers/gpu/drm/bridge/lontium-lt8912.c   | 764 ++
 5 files changed, 887 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/lontium,lt8912.yaml
 create mode 100644 drivers/gpu/drm/bridge/lontium-lt8912.c

-- 
2.25.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v3 2/2] drm/bridge: Introduce LT8912 DSI to HDMI bridge

2021-02-23 Thread Adrien Grassein
Hey Robert,

Le ven. 19 févr. 2021 à 22:47, Adrien Grassein
 a écrit :
>
> Le ven. 19 févr. 2021 à 22:28, Robert Foss  a écrit :
> >
> > On Fri, 19 Feb 2021 at 16:01, Adrien Grassein  
> > wrote:
> > >
> > > Hey Robert,
> > >
> > > Le ven. 19 févr. 2021 à 14:27, Robert Foss  a 
> > > écrit :
> > > >
> > > > Hey Adrien,
> > > >
> > > >
> > > > Thanks for the quick update.
> > > No problem, I have some free time at the moment.
> > > >
> > > > On Thu, 18 Feb 2021 at 22:05, Adrien Grassein 
> > > >  wrote:
> > > > >
> > > > > Lontium Lt8912 is a DSI to HDMI bridge.
> > > > >
> > > > > Signed-off-by: Adrien Grassein 
> > > > > ---
> > > > >  MAINTAINERS |   1 +
> > > > >  drivers/gpu/drm/bridge/Kconfig  |  14 +
> > > > >  drivers/gpu/drm/bridge/Makefile |   1 +
> > > > >  drivers/gpu/drm/bridge/lontium-lt8912.c | 760 
> > > > > 
> > > > >  4 files changed, 776 insertions(+)
> > > > >  create mode 100644 drivers/gpu/drm/bridge/lontium-lt8912.c
> > > > >
> > > > > diff --git a/MAINTAINERS b/MAINTAINERS
> > > > > index 5d1ed281cd41..58f8f45a7c86 100644
> > > > > --- a/MAINTAINERS
> > > > > +++ b/MAINTAINERS
> > > > > @@ -10462,6 +10462,7 @@ LONTIUM LT8912 MIPI TO HDMI BRIDGE
> > > > >  M: Adrien Grassein 
> > > > >  S: Maintained
> > > > >  F: 
> > > > > Documentation/devicetree/bindings/display/bridge/lontium,lt8912.yaml
> > > > > +F: drivers/gpu/drm/bridge/lontium-lt8912.c
> > > > >
> > > > >  LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI)
> > > > >  M: Sathya Prakash 
> > > > > diff --git a/drivers/gpu/drm/bridge/Kconfig 
> > > > > b/drivers/gpu/drm/bridge/Kconfig
> > > > > index e4110d6ca7b3..5b36d4b86e3c 100644
> > > > > --- a/drivers/gpu/drm/bridge/Kconfig
> > > > > +++ b/drivers/gpu/drm/bridge/Kconfig
> > > > > @@ -48,6 +48,20 @@ config DRM_DISPLAY_CONNECTOR
> > > > >   on ARM-based platforms. Saying Y here when this driver is 
> > > > > not needed
> > > > >   will not cause any issue.
> > > > >
> > > > > +config DRM_LONTIUM_LT8912
> > > > > +   tristate "Lontium LT8912 DSI/HDMI bridge"
> > > > > +   depends on OF
> > > > > +   select DRM_PANEL_BRIDGE
> > > > > +   select DRM_KMS_HELPER
> > > > > +   select REGMAP_I2C
> > > > > +   help
> > > > > + Driver for Lontium LT8912 DSI to HDMI bridge
> > > > > + chip driver.
> > > > > + Please say Y if you have such hardware.
> > > > > +
> > > > > + Say M here if you want to support this hardware as a module.
> > > > > + The module will be named "lontium-lt8912".
> > > > > +
> > > > >  config DRM_LONTIUM_LT9611
> > > > > tristate "Lontium LT9611 DSI/HDMI bridge"
> > > > > select SND_SOC_HDMI_CODEC if SND_SOC
> > > > > diff --git a/drivers/gpu/drm/bridge/Makefile 
> > > > > b/drivers/gpu/drm/bridge/Makefile
> > > > > index 86e7acc76f8d..5a1b201cea1f 100644
> > > > > --- a/drivers/gpu/drm/bridge/Makefile
> > > > > +++ b/drivers/gpu/drm/bridge/Makefile
> > > > > @@ -2,6 +2,7 @@
> > > > >  obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
> > > > >  obj-$(CONFIG_DRM_CHRONTEL_CH7033) += chrontel-ch7033.o
> > > > >  obj-$(CONFIG_DRM_DISPLAY_CONNECTOR) += display-connector.o
> > > > > +obj-$(CONFIG_DRM_LONTIUM_LT8912) += lontium-lt8912.o
> > > > >  obj-$(CONFIG_DRM_LONTIUM_LT9611) += lontium-lt9611.o
> > > > >  obj-$(CONFIG_DRM_LONTIUM_LT9611UXC) += lontium-lt9611uxc.o
> > > > >  obj-$(CONFIG_DRM_LVDS_CODEC) += lvds-codec.o
> > > > > diff --git a/drivers/gpu/drm/bridge/lontium-lt8912.c 
> > > > > b/drivers/gpu/drm/bridge/lontium-lt8912.c
> > > > > new file mode 100644
> > > > > index ..8bdb584d22ce
> > > > > --- /dev/null
> > > > &g

Re: [PATCH v3 2/2] drm/bridge: Introduce LT8912 DSI to HDMI bridge

2021-02-19 Thread Adrien Grassein
Le ven. 19 févr. 2021 à 22:28, Robert Foss  a écrit :
>
> On Fri, 19 Feb 2021 at 16:01, Adrien Grassein  
> wrote:
> >
> > Hey Robert,
> >
> > Le ven. 19 févr. 2021 à 14:27, Robert Foss  a écrit 
> > :
> > >
> > > Hey Adrien,
> > >
> > >
> > > Thanks for the quick update.
> > No problem, I have some free time at the moment.
> > >
> > > On Thu, 18 Feb 2021 at 22:05, Adrien Grassein  
> > > wrote:
> > > >
> > > > Lontium Lt8912 is a DSI to HDMI bridge.
> > > >
> > > > Signed-off-by: Adrien Grassein 
> > > > ---
> > > >  MAINTAINERS |   1 +
> > > >  drivers/gpu/drm/bridge/Kconfig  |  14 +
> > > >  drivers/gpu/drm/bridge/Makefile |   1 +
> > > >  drivers/gpu/drm/bridge/lontium-lt8912.c | 760 
> > > >  4 files changed, 776 insertions(+)
> > > >  create mode 100644 drivers/gpu/drm/bridge/lontium-lt8912.c
> > > >
> > > > diff --git a/MAINTAINERS b/MAINTAINERS
> > > > index 5d1ed281cd41..58f8f45a7c86 100644
> > > > --- a/MAINTAINERS
> > > > +++ b/MAINTAINERS
> > > > @@ -10462,6 +10462,7 @@ LONTIUM LT8912 MIPI TO HDMI BRIDGE
> > > >  M: Adrien Grassein 
> > > >  S: Maintained
> > > >  F: 
> > > > Documentation/devicetree/bindings/display/bridge/lontium,lt8912.yaml
> > > > +F: drivers/gpu/drm/bridge/lontium-lt8912.c
> > > >
> > > >  LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI)
> > > >  M: Sathya Prakash 
> > > > diff --git a/drivers/gpu/drm/bridge/Kconfig 
> > > > b/drivers/gpu/drm/bridge/Kconfig
> > > > index e4110d6ca7b3..5b36d4b86e3c 100644
> > > > --- a/drivers/gpu/drm/bridge/Kconfig
> > > > +++ b/drivers/gpu/drm/bridge/Kconfig
> > > > @@ -48,6 +48,20 @@ config DRM_DISPLAY_CONNECTOR
> > > >   on ARM-based platforms. Saying Y here when this driver is not 
> > > > needed
> > > >   will not cause any issue.
> > > >
> > > > +config DRM_LONTIUM_LT8912
> > > > +   tristate "Lontium LT8912 DSI/HDMI bridge"
> > > > +   depends on OF
> > > > +   select DRM_PANEL_BRIDGE
> > > > +   select DRM_KMS_HELPER
> > > > +   select REGMAP_I2C
> > > > +   help
> > > > + Driver for Lontium LT8912 DSI to HDMI bridge
> > > > + chip driver.
> > > > + Please say Y if you have such hardware.
> > > > +
> > > > + Say M here if you want to support this hardware as a module.
> > > > + The module will be named "lontium-lt8912".
> > > > +
> > > >  config DRM_LONTIUM_LT9611
> > > > tristate "Lontium LT9611 DSI/HDMI bridge"
> > > > select SND_SOC_HDMI_CODEC if SND_SOC
> > > > diff --git a/drivers/gpu/drm/bridge/Makefile 
> > > > b/drivers/gpu/drm/bridge/Makefile
> > > > index 86e7acc76f8d..5a1b201cea1f 100644
> > > > --- a/drivers/gpu/drm/bridge/Makefile
> > > > +++ b/drivers/gpu/drm/bridge/Makefile
> > > > @@ -2,6 +2,7 @@
> > > >  obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
> > > >  obj-$(CONFIG_DRM_CHRONTEL_CH7033) += chrontel-ch7033.o
> > > >  obj-$(CONFIG_DRM_DISPLAY_CONNECTOR) += display-connector.o
> > > > +obj-$(CONFIG_DRM_LONTIUM_LT8912) += lontium-lt8912.o
> > > >  obj-$(CONFIG_DRM_LONTIUM_LT9611) += lontium-lt9611.o
> > > >  obj-$(CONFIG_DRM_LONTIUM_LT9611UXC) += lontium-lt9611uxc.o
> > > >  obj-$(CONFIG_DRM_LVDS_CODEC) += lvds-codec.o
> > > > diff --git a/drivers/gpu/drm/bridge/lontium-lt8912.c 
> > > > b/drivers/gpu/drm/bridge/lontium-lt8912.c
> > > > new file mode 100644
> > > > index ..8bdb584d22ce
> > > > --- /dev/null
> > > > +++ b/drivers/gpu/drm/bridge/lontium-lt8912.c
> > > > @@ -0,0 +1,760 @@
> > > > +// SPDX-License-Identifier: GPL-2.0
> > > > +/*
> > > > + * Copyright (c) 2018, The Linux Foundation. All rights reserved.
> > > > + */
> > > > +
> > > > +#include 
> > > > +#include 
> > > > +#include 
> > > > +#include 
> > > > +#include 
> > > > +#include 
> > > > +
> > > > +#includ

Re: [PATCH v3 2/2] drm/bridge: Introduce LT8912 DSI to HDMI bridge

2021-02-19 Thread Adrien Grassein
Hey Robert,

Le ven. 19 févr. 2021 à 14:27, Robert Foss  a écrit :
>
> Hey Adrien,
>
>
> Thanks for the quick update.
No problem, I have some free time at the moment.
>
> On Thu, 18 Feb 2021 at 22:05, Adrien Grassein  
> wrote:
> >
> > Lontium Lt8912 is a DSI to HDMI bridge.
> >
> > Signed-off-by: Adrien Grassein 
> > ---
> >  MAINTAINERS |   1 +
> >  drivers/gpu/drm/bridge/Kconfig  |  14 +
> >  drivers/gpu/drm/bridge/Makefile |   1 +
> >  drivers/gpu/drm/bridge/lontium-lt8912.c | 760 
> >  4 files changed, 776 insertions(+)
> >  create mode 100644 drivers/gpu/drm/bridge/lontium-lt8912.c
> >
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index 5d1ed281cd41..58f8f45a7c86 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -10462,6 +10462,7 @@ LONTIUM LT8912 MIPI TO HDMI BRIDGE
> >  M: Adrien Grassein 
> >  S: Maintained
> >  F: Documentation/devicetree/bindings/display/bridge/lontium,lt8912.yaml
> > +F: drivers/gpu/drm/bridge/lontium-lt8912.c
> >
> >  LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI)
> >  M: Sathya Prakash 
> > diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
> > index e4110d6ca7b3..5b36d4b86e3c 100644
> > --- a/drivers/gpu/drm/bridge/Kconfig
> > +++ b/drivers/gpu/drm/bridge/Kconfig
> > @@ -48,6 +48,20 @@ config DRM_DISPLAY_CONNECTOR
> >   on ARM-based platforms. Saying Y here when this driver is not 
> > needed
> >   will not cause any issue.
> >
> > +config DRM_LONTIUM_LT8912
> > +   tristate "Lontium LT8912 DSI/HDMI bridge"
> > +   depends on OF
> > +   select DRM_PANEL_BRIDGE
> > +   select DRM_KMS_HELPER
> > +   select REGMAP_I2C
> > +   help
> > + Driver for Lontium LT8912 DSI to HDMI bridge
> > + chip driver.
> > + Please say Y if you have such hardware.
> > +
> > + Say M here if you want to support this hardware as a module.
> > + The module will be named "lontium-lt8912".
> > +
> >  config DRM_LONTIUM_LT9611
> > tristate "Lontium LT9611 DSI/HDMI bridge"
> > select SND_SOC_HDMI_CODEC if SND_SOC
> > diff --git a/drivers/gpu/drm/bridge/Makefile 
> > b/drivers/gpu/drm/bridge/Makefile
> > index 86e7acc76f8d..5a1b201cea1f 100644
> > --- a/drivers/gpu/drm/bridge/Makefile
> > +++ b/drivers/gpu/drm/bridge/Makefile
> > @@ -2,6 +2,7 @@
> >  obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
> >  obj-$(CONFIG_DRM_CHRONTEL_CH7033) += chrontel-ch7033.o
> >  obj-$(CONFIG_DRM_DISPLAY_CONNECTOR) += display-connector.o
> > +obj-$(CONFIG_DRM_LONTIUM_LT8912) += lontium-lt8912.o
> >  obj-$(CONFIG_DRM_LONTIUM_LT9611) += lontium-lt9611.o
> >  obj-$(CONFIG_DRM_LONTIUM_LT9611UXC) += lontium-lt9611uxc.o
> >  obj-$(CONFIG_DRM_LVDS_CODEC) += lvds-codec.o
> > diff --git a/drivers/gpu/drm/bridge/lontium-lt8912.c 
> > b/drivers/gpu/drm/bridge/lontium-lt8912.c
> > new file mode 100644
> > index ..8bdb584d22ce
> > --- /dev/null
> > +++ b/drivers/gpu/drm/bridge/lontium-lt8912.c
> > @@ -0,0 +1,760 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/*
> > + * Copyright (c) 2018, The Linux Foundation. All rights reserved.
> > + */
> > +
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +#include 
> > +
> > +#define I2C_MAIN 0
> > +#define I2C_ADDR_MAIN 0x48
> > +
> > +#define I2C_CEC_DSI 1
> > +#define I2C_ADDR_CEC_DSI 0x49
> > +
> > +#define I2C_MAX_IDX 2
> > +
> > +struct lt8912 {
> > +   struct device *dev;
> > +   struct drm_bridge bridge;
> > +   struct drm_connector connector;
> > +
> > +   struct i2c_client *i2c_client[I2C_MAX_IDX];
> > +   struct regmap *regmap[I2C_MAX_IDX];
> > +
> > +   struct device_node *host_node;
> > +   struct drm_bridge *hdmi_port;
> > +
> > +   struct mipi_dsi_device *dsi;
> > +
> > +   struct gpio_desc *gp_reset;
> > +
> > +   struct videomode mode;
> > +
> > +   u8 data_lanes;
> > +   bool is_power_on;
> > +   bool is_attached;
> > +};
> > +
> > +static int lt8912_write_init_config(struct lt8912 *lt)
> > +{
> > +  

Re: [PATCH v2 2/2] drm/bridge: Introduce LT8912 DSI to HDMI bridge

2021-02-18 Thread Adrien Grassein
Hey Robert,

Thank you for your time and for your review.

Le mer. 17 févr. 2021 à 18:32, Robert Foss  a écrit :
>
> Hey Adrien,
>
> Thanks for submitting this!
>
> On Mon, 15 Feb 2021 at 00:31, Adrien Grassein  
> wrote:
> >
> > Lontium Lt8912 is a DSI to HDMI bridge.
> >
> > Signed-off-by: Adrien Grassein 
> > ---
> >  MAINTAINERS |   1 +
> >  drivers/gpu/drm/bridge/Kconfig  |  14 +
> >  drivers/gpu/drm/bridge/Makefile |   1 +
> >  drivers/gpu/drm/bridge/lontium-lt8912.c | 719 
> >  4 files changed, 735 insertions(+)
> >  create mode 100644 drivers/gpu/drm/bridge/lontium-lt8912.c
> >
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index f010b485aa7c..8b3d64b689c7 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -10444,6 +10444,7 @@ LONTIUM LT8912 MIPI TO HDMI BRIDGE
> >  M: Adrien Grassein 
> >  S: Maintained
> >  F: Documentation/devicetree/bindings/display/bridge/lontium,lt8912.yaml
> > +F: drivers/gpu/drm/bridge/lontium-lt8912.c
> >
> >  LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI)
> >  M: Sathya Prakash 
> > diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
> > index e4110d6ca7b3..5b36d4b86e3c 100644
> > --- a/drivers/gpu/drm/bridge/Kconfig
> > +++ b/drivers/gpu/drm/bridge/Kconfig
> > @@ -48,6 +48,20 @@ config DRM_DISPLAY_CONNECTOR
> >   on ARM-based platforms. Saying Y here when this driver is not 
> > needed
> >   will not cause any issue.
> >
> > +config DRM_LONTIUM_LT8912
> > +   tristate "Lontium LT8912 DSI/HDMI bridge"
> > +   depends on OF
> > +   select DRM_PANEL_BRIDGE
> > +   select DRM_KMS_HELPER
> > +   select REGMAP_I2C
> > +   help
> > + Driver for Lontium LT8912 DSI to HDMI bridge
> > + chip driver.
> > + Please say Y if you have such hardware.
> > +
> > + Say M here if you want to support this hardware as a module.
> > + The module will be named "lontium-lt8912".
> > +
> >  config DRM_LONTIUM_LT9611
> > tristate "Lontium LT9611 DSI/HDMI bridge"
> > select SND_SOC_HDMI_CODEC if SND_SOC
> > diff --git a/drivers/gpu/drm/bridge/Makefile 
> > b/drivers/gpu/drm/bridge/Makefile
> > index 86e7acc76f8d..5a1b201cea1f 100644
> > --- a/drivers/gpu/drm/bridge/Makefile
> > +++ b/drivers/gpu/drm/bridge/Makefile
> > @@ -2,6 +2,7 @@
> >  obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
> >  obj-$(CONFIG_DRM_CHRONTEL_CH7033) += chrontel-ch7033.o
> >  obj-$(CONFIG_DRM_DISPLAY_CONNECTOR) += display-connector.o
> > +obj-$(CONFIG_DRM_LONTIUM_LT8912) += lontium-lt8912.o
> >  obj-$(CONFIG_DRM_LONTIUM_LT9611) += lontium-lt9611.o
> >  obj-$(CONFIG_DRM_LONTIUM_LT9611UXC) += lontium-lt9611uxc.o
> >  obj-$(CONFIG_DRM_LVDS_CODEC) += lvds-codec.o
> > diff --git a/drivers/gpu/drm/bridge/lontium-lt8912.c 
> > b/drivers/gpu/drm/bridge/lontium-lt8912.c
> > new file mode 100644
> > index ..d713d3365c3e
> > --- /dev/null
> > +++ b/drivers/gpu/drm/bridge/lontium-lt8912.c
> > @@ -0,0 +1,719 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/*
> > + * Copyright (c) 2018, The Linux Foundation. All rights reserved.
> > + */
> > +
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +#include 
> > +
> > +#define I2C_MAIN 0
> > +#define I2C_ADDR_MAIN 0x48
> > +
> > +#define I2C_CEC_DSI 1
> > +#define I2C_ADDR_CEC_DSI 0x49
> > +
> > +#define I2C_MAX_IDX 2
> > +
> > +#define HPD_WORK_DELAY_MS 1000
> > +
> > +struct lt8912 {
> > +   struct device *dev;
> > +   struct drm_bridge bridge;
> > +   struct drm_connector connector;
> > +
> > +   struct i2c_client *i2c_client[I2C_MAX_IDX];
> > +   struct regmap *regmap[I2C_MAX_IDX];
> > +
> > +   struct device_node *host_node;
> > +   struct drm_bridge *hdmi_port;
> > +
> > +   struct mipi_dsi_device *dsi;
> > +
> > +   struct gpio_desc *gp_reset;
> > +
> > +   struct videomode mode;
> > +
> > +   u8 data_lanes;
> > +   bool is_power_on;
> > +   bool is_attached;
> > +};
> > +
> > +static int lt8912_write_init_config(struct lt8912 *lt)
>

[PATCH v3 1/2] dt-bindings: display: bridge: Add documentation for LT8912

2021-02-18 Thread Adrien Grassein
Lontium LT8912 is a DSI to HDMI bridge.

Signed-off-by: Adrien Grassein 
Reviewed-by: Rob Herring 
---
 .../display/bridge/lontium,lt8912.yaml| 102 ++
 MAINTAINERS   |   5 +
 2 files changed, 107 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/lontium,lt8912.yaml

diff --git 
a/Documentation/devicetree/bindings/display/bridge/lontium,lt8912.yaml 
b/Documentation/devicetree/bindings/display/bridge/lontium,lt8912.yaml
new file mode 100644
index ..1e5a2ad5eb47
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/lontium,lt8912.yaml
@@ -0,0 +1,102 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/bridge/lontium,lt8912.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Lontium LT8912 MIPI to HDMI Bridge
+
+maintainers:
+  - Adrien Grassein 
+
+description: |
+  The LT8912 is a bridge device which convert DSI to HDMI
+
+properties:
+  compatible:
+enum:
+  - lontium,lt8912
+
+  reg:
+maxItems: 1
+
+  reset-gpios:
+maxItems: 1
+description: GPIO connected to active high RESET pin.
+
+  ports:
+$ref: /schemas/graph.yaml#/properties/ports
+
+properties:
+  port@0:
+$ref: /schemas/graph.yaml#/properties/port
+description:
+  Primary MIPI port for MIPI input
+
+properties:
+  endpoint:
+$ref: /schemas/media/video-interfaces.yaml#
+unevaluatedProperties: false
+
+properties:
+  data-lanes: true
+
+required:
+  - data-lanes
+
+  port@1:
+$ref: /schemas/graph.yaml#/properties/port
+description: |
+  HDMI port, should be connected to a node compatible with the
+  hdmi-connector binding.
+
+required:
+  - port@0
+  - port@1
+
+required:
+  - compatible
+  - reg
+  - reset-gpios
+  - ports
+
+additionalProperties: false
+
+examples:
+  - |
+#include 
+
+i2c4 {
+  #address-cells = <1>;
+  #size-cells = <0>;
+
+  hdmi-bridge@48 {
+compatible = "lontium,lt8912";
+reg = <0x48>;
+reset-gpios = < 0 GPIO_ACTIVE_LOW>;
+
+ports {
+  #address-cells = <1>;
+  #size-cells = <0>;
+
+  port@0 {
+reg = <0>;
+
+hdmi_out_in: endpoint {
+  data-lanes = <0 1 2 3>;
+  remote-endpoint = <_dsi_out>;
+};
+  };
+
+  port@1 {
+  reg = <1>;
+
+  endpoint {
+  remote-endpoint = <_in>;
+  };
+  };
+};
+  };
+};
+
+...
diff --git a/MAINTAINERS b/MAINTAINERS
index 4ad16d3bb517..5d1ed281cd41 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10458,6 +10458,11 @@ S: Maintained
 T: git git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git
 F: drivers/hid/hid-lg-g15.c
 
+LONTIUM LT8912 MIPI TO HDMI BRIDGE
+M: Adrien Grassein 
+S: Maintained
+F: Documentation/devicetree/bindings/display/bridge/lontium,lt8912.yaml
+
 LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI)
 M: Sathya Prakash 
 M: Sreekanth Reddy 
-- 
2.25.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 2/2] drm/bridge: Introduce LT8912 DSI to HDMI bridge

2021-02-18 Thread Adrien Grassein
Lontium Lt8912 is a DSI to HDMI bridge.

Signed-off-by: Adrien Grassein 
---
 MAINTAINERS |   1 +
 drivers/gpu/drm/bridge/Kconfig  |  14 +
 drivers/gpu/drm/bridge/Makefile |   1 +
 drivers/gpu/drm/bridge/lontium-lt8912.c | 760 
 4 files changed, 776 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/lontium-lt8912.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 5d1ed281cd41..58f8f45a7c86 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10462,6 +10462,7 @@ LONTIUM LT8912 MIPI TO HDMI BRIDGE
 M: Adrien Grassein 
 S: Maintained
 F: Documentation/devicetree/bindings/display/bridge/lontium,lt8912.yaml
+F: drivers/gpu/drm/bridge/lontium-lt8912.c
 
 LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI)
 M: Sathya Prakash 
diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index e4110d6ca7b3..5b36d4b86e3c 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -48,6 +48,20 @@ config DRM_DISPLAY_CONNECTOR
  on ARM-based platforms. Saying Y here when this driver is not needed
  will not cause any issue.
 
+config DRM_LONTIUM_LT8912
+   tristate "Lontium LT8912 DSI/HDMI bridge"
+   depends on OF
+   select DRM_PANEL_BRIDGE
+   select DRM_KMS_HELPER
+   select REGMAP_I2C
+   help
+ Driver for Lontium LT8912 DSI to HDMI bridge
+ chip driver.
+ Please say Y if you have such hardware.
+
+ Say M here if you want to support this hardware as a module.
+ The module will be named "lontium-lt8912".
+
 config DRM_LONTIUM_LT9611
tristate "Lontium LT9611 DSI/HDMI bridge"
select SND_SOC_HDMI_CODEC if SND_SOC
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index 86e7acc76f8d..5a1b201cea1f 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -2,6 +2,7 @@
 obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
 obj-$(CONFIG_DRM_CHRONTEL_CH7033) += chrontel-ch7033.o
 obj-$(CONFIG_DRM_DISPLAY_CONNECTOR) += display-connector.o
+obj-$(CONFIG_DRM_LONTIUM_LT8912) += lontium-lt8912.o
 obj-$(CONFIG_DRM_LONTIUM_LT9611) += lontium-lt9611.o
 obj-$(CONFIG_DRM_LONTIUM_LT9611UXC) += lontium-lt9611uxc.o
 obj-$(CONFIG_DRM_LVDS_CODEC) += lvds-codec.o
diff --git a/drivers/gpu/drm/bridge/lontium-lt8912.c 
b/drivers/gpu/drm/bridge/lontium-lt8912.c
new file mode 100644
index ..8bdb584d22ce
--- /dev/null
+++ b/drivers/gpu/drm/bridge/lontium-lt8912.c
@@ -0,0 +1,760 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#define I2C_MAIN 0
+#define I2C_ADDR_MAIN 0x48
+
+#define I2C_CEC_DSI 1
+#define I2C_ADDR_CEC_DSI 0x49
+
+#define I2C_MAX_IDX 2
+
+struct lt8912 {
+   struct device *dev;
+   struct drm_bridge bridge;
+   struct drm_connector connector;
+
+   struct i2c_client *i2c_client[I2C_MAX_IDX];
+   struct regmap *regmap[I2C_MAX_IDX];
+
+   struct device_node *host_node;
+   struct drm_bridge *hdmi_port;
+
+   struct mipi_dsi_device *dsi;
+
+   struct gpio_desc *gp_reset;
+
+   struct videomode mode;
+
+   u8 data_lanes;
+   bool is_power_on;
+   bool is_attached;
+};
+
+static int lt8912_write_init_config(struct lt8912 *lt)
+{
+   const struct reg_sequence seq[] = {
+   /* Digital clock en*/
+   {0x08, 0xff},
+   {0x09, 0xff},
+   {0x0a, 0xff},
+   {0x0b, 0x7c},
+   {0x0c, 0xff},
+   {0x42, 0x04},
+
+   /*Tx Analog*/
+   {0x31, 0xb1},
+   {0x32, 0xb1},
+   {0x33, 0x0e},
+   {0x37, 0x00},
+   {0x38, 0x22},
+   {0x60, 0x82},
+
+   /*Cbus Analog*/
+   {0x39, 0x45},
+   {0x3a, 0x00},
+   {0x3b, 0x00},
+
+   /*HDMI Pll Analog*/
+   {0x44, 0x31},
+   {0x55, 0x44},
+   {0x57, 0x01},
+   {0x5a, 0x02},
+
+   /*MIPI Analog*/
+   {0x3e, 0xd6},
+   {0x3f, 0xd4},
+   {0x41, 0x3c},
+   {0xB2, 0x00},
+   };
+
+   return regmap_multi_reg_write(lt->regmap[I2C_MAIN], seq, 
ARRAY_SIZE(seq));
+}
+
+static int lt8912_write_mipi_basic_config(struct lt8912 *lt)
+{
+   const struct reg_sequence seq[] = {
+   {0x12, 0x04},
+   {0x14, 0x00},
+   {0x15, 0x00},
+   {0x1a, 0x03},
+   {0x1b, 0x03},
+   };
+
+   return regmap_multi_reg_write(lt->regmap[I2C_CEC_DSI], seq, 
ARRAY_SIZE(seq));
+};
+
+static int lt8912_write_dds_config(struct lt8912 *lt)
+{
+   const struct reg_sequence s

[PATCH v3 0/2] Add support of Lontium lt8912 MIPI to HDMI bridge

2021-02-18 Thread Adrien Grassein
this patch set adds the support of the Lontium lt8912 MIPI to HDMI
bridge in the kernel.

It's only support the video part, not the audio part yet
since I don't have the datasheet of this component.
I get the current i2c configuration from Digi and
Boundary drivers.
Developed using the DB_DSIHD board from BoundaryDevices.

Update in v2
  - Use standard data-lanes instead of a custom prop;
  - Use hdmi-connector node.

Update in v3
  - Fix indentation;
  - Implement missing bridge functions;
  - Add some comments.

Thanks,
Adrien Grassein

Adrien Grassein (2):
  dt-bindings: display: bridge: Add documentation for LT8912
  drm/bridge: Introduce LT8912 DSI to HDMI bridge

 .../display/bridge/lontium,lt8912.yaml| 102 +++
 MAINTAINERS   |   6 +
 drivers/gpu/drm/bridge/Kconfig|  14 +
 drivers/gpu/drm/bridge/Makefile   |   1 +
 drivers/gpu/drm/bridge/lontium-lt8912.c   | 760 ++
 5 files changed, 883 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/lontium,lt8912.yaml
 create mode 100644 drivers/gpu/drm/bridge/lontium-lt8912.c

-- 
2.25.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 0/2] Add support of Lontium lt8912 MIPI to HDMI bridge

2021-02-15 Thread Adrien Grassein
Hello,

this patch set adds the support of the Lontium lt8912 MIPI to HDMI
bridge in the kernel.

It's only support the video part, not the audio part yet
since I don't have the datasheet of this component.
I get the current i2c configuration from Digi and
Boundary drivers.
Developed using the DB_DSIHD board from BoundaryDevices.

Update in v2
  - Use standard data-lanes instead of a custom prop;
  - Use hdmi-connector node.

Thanks,
Adrien Grassein

Adrien Grassein (2):
  dt-bindings: display: bridge: Add documentation for LT8912
  drm/bridge: Introduce LT8912 DSI to HDMI bridge

 .../display/bridge/lontium,lt8912.yaml| 102 +++
 MAINTAINERS   |   6 +
 drivers/gpu/drm/bridge/Kconfig|  14 +
 drivers/gpu/drm/bridge/Makefile   |   1 +
 drivers/gpu/drm/bridge/lontium-lt8912.c   | 719 ++
 5 files changed, 842 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/lontium,lt8912.yaml
 create mode 100644 drivers/gpu/drm/bridge/lontium-lt8912.c

-- 
2.25.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 1/2] dt-bindings: display: bridge: Add documentation for LT8912

2021-02-15 Thread Adrien Grassein
Lontium LT8912 is a DSI to HDMI bridge.

Signed-off-by: Adrien Grassein 
---
 .../display/bridge/lontium,lt8912.yaml| 102 ++
 MAINTAINERS   |   5 +
 2 files changed, 107 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/lontium,lt8912.yaml

diff --git 
a/Documentation/devicetree/bindings/display/bridge/lontium,lt8912.yaml 
b/Documentation/devicetree/bindings/display/bridge/lontium,lt8912.yaml
new file mode 100644
index ..1e5a2ad5eb47
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/lontium,lt8912.yaml
@@ -0,0 +1,102 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/bridge/lontium,lt8912.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Lontium LT8912 MIPI to HDMI Bridge
+
+maintainers:
+  - Adrien Grassein 
+
+description: |
+  The LT8912 is a bridge device which convert DSI to HDMI
+
+properties:
+  compatible:
+enum:
+  - lontium,lt8912
+
+  reg:
+maxItems: 1
+
+  reset-gpios:
+maxItems: 1
+description: GPIO connected to active high RESET pin.
+
+  ports:
+$ref: /schemas/graph.yaml#/properties/ports
+
+properties:
+  port@0:
+$ref: /schemas/graph.yaml#/properties/port
+description:
+  Primary MIPI port for MIPI input
+
+properties:
+  endpoint:
+$ref: /schemas/media/video-interfaces.yaml#
+unevaluatedProperties: false
+
+properties:
+  data-lanes: true
+
+required:
+  - data-lanes
+
+  port@1:
+$ref: /schemas/graph.yaml#/properties/port
+description: |
+  HDMI port, should be connected to a node compatible with the
+  hdmi-connector binding.
+
+required:
+  - port@0
+  - port@1
+
+required:
+  - compatible
+  - reg
+  - reset-gpios
+  - ports
+
+additionalProperties: false
+
+examples:
+  - |
+#include 
+
+i2c4 {
+  #address-cells = <1>;
+  #size-cells = <0>;
+
+  hdmi-bridge@48 {
+compatible = "lontium,lt8912";
+reg = <0x48>;
+reset-gpios = < 0 GPIO_ACTIVE_LOW>;
+
+ports {
+  #address-cells = <1>;
+  #size-cells = <0>;
+
+  port@0 {
+reg = <0>;
+
+hdmi_out_in: endpoint {
+  data-lanes = <0 1 2 3>;
+  remote-endpoint = <_dsi_out>;
+};
+  };
+
+  port@1 {
+  reg = <1>;
+
+  endpoint {
+  remote-endpoint = <_in>;
+  };
+  };
+};
+  };
+};
+
+...
diff --git a/MAINTAINERS b/MAINTAINERS
index c38651ca59a5..f010b485aa7c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10440,6 +10440,11 @@ S: Maintained
 T: git git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git
 F: drivers/hid/hid-lg-g15.c
 
+LONTIUM LT8912 MIPI TO HDMI BRIDGE
+M: Adrien Grassein 
+S: Maintained
+F: Documentation/devicetree/bindings/display/bridge/lontium,lt8912.yaml
+
 LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI)
 M: Sathya Prakash 
 M: Sreekanth Reddy 
-- 
2.25.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 2/2] drm/bridge: Introduce LT8912 DSI to HDMI bridge

2021-02-15 Thread Adrien Grassein
Lontium Lt8912 is a DSI to HDMI bridge.

Signed-off-by: Adrien Grassein 
---
 MAINTAINERS |   1 +
 drivers/gpu/drm/bridge/Kconfig  |  14 +
 drivers/gpu/drm/bridge/Makefile |   1 +
 drivers/gpu/drm/bridge/lontium-lt8912.c | 719 
 4 files changed, 735 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/lontium-lt8912.c

diff --git a/MAINTAINERS b/MAINTAINERS
index f010b485aa7c..8b3d64b689c7 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10444,6 +10444,7 @@ LONTIUM LT8912 MIPI TO HDMI BRIDGE
 M: Adrien Grassein 
 S: Maintained
 F: Documentation/devicetree/bindings/display/bridge/lontium,lt8912.yaml
+F: drivers/gpu/drm/bridge/lontium-lt8912.c
 
 LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI)
 M: Sathya Prakash 
diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index e4110d6ca7b3..5b36d4b86e3c 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -48,6 +48,20 @@ config DRM_DISPLAY_CONNECTOR
  on ARM-based platforms. Saying Y here when this driver is not needed
  will not cause any issue.
 
+config DRM_LONTIUM_LT8912
+   tristate "Lontium LT8912 DSI/HDMI bridge"
+   depends on OF
+   select DRM_PANEL_BRIDGE
+   select DRM_KMS_HELPER
+   select REGMAP_I2C
+   help
+ Driver for Lontium LT8912 DSI to HDMI bridge
+ chip driver.
+ Please say Y if you have such hardware.
+
+ Say M here if you want to support this hardware as a module.
+ The module will be named "lontium-lt8912".
+
 config DRM_LONTIUM_LT9611
tristate "Lontium LT9611 DSI/HDMI bridge"
select SND_SOC_HDMI_CODEC if SND_SOC
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index 86e7acc76f8d..5a1b201cea1f 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -2,6 +2,7 @@
 obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
 obj-$(CONFIG_DRM_CHRONTEL_CH7033) += chrontel-ch7033.o
 obj-$(CONFIG_DRM_DISPLAY_CONNECTOR) += display-connector.o
+obj-$(CONFIG_DRM_LONTIUM_LT8912) += lontium-lt8912.o
 obj-$(CONFIG_DRM_LONTIUM_LT9611) += lontium-lt9611.o
 obj-$(CONFIG_DRM_LONTIUM_LT9611UXC) += lontium-lt9611uxc.o
 obj-$(CONFIG_DRM_LVDS_CODEC) += lvds-codec.o
diff --git a/drivers/gpu/drm/bridge/lontium-lt8912.c 
b/drivers/gpu/drm/bridge/lontium-lt8912.c
new file mode 100644
index ..d713d3365c3e
--- /dev/null
+++ b/drivers/gpu/drm/bridge/lontium-lt8912.c
@@ -0,0 +1,719 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#define I2C_MAIN 0
+#define I2C_ADDR_MAIN 0x48
+
+#define I2C_CEC_DSI 1
+#define I2C_ADDR_CEC_DSI 0x49
+
+#define I2C_MAX_IDX 2
+
+#define HPD_WORK_DELAY_MS 1000
+
+struct lt8912 {
+   struct device *dev;
+   struct drm_bridge bridge;
+   struct drm_connector connector;
+
+   struct i2c_client *i2c_client[I2C_MAX_IDX];
+   struct regmap *regmap[I2C_MAX_IDX];
+
+   struct device_node *host_node;
+   struct drm_bridge *hdmi_port;
+
+   struct mipi_dsi_device *dsi;
+
+   struct gpio_desc *gp_reset;
+
+   struct videomode mode;
+
+   u8 data_lanes;
+   bool is_power_on;
+   bool is_attached;
+};
+
+static int lt8912_write_init_config(struct lt8912 *lt)
+{
+   const struct reg_sequence seq[] = {
+   /* Digital clock en*/
+   {0x08, 0xff},
+   {0x09, 0xff},
+   {0x0a, 0xff},
+   {0x0b, 0x7c},
+   {0x0c, 0xff},
+   {0x42, 0x04},
+
+   /*Tx Analog*/
+   {0x31, 0xb1},
+   {0x32, 0xb1},
+   {0x33, 0x0e},
+   {0x37, 0x00},
+   {0x38, 0x22},
+   {0x60, 0x82},
+
+   /*Cbus Analog*/
+   {0x39, 0x45},
+   {0x3a, 0x00},
+   {0x3b, 0x00},
+
+   /*HDMI Pll Analog*/
+   {0x44, 0x31},
+   {0x55, 0x44},
+   {0x57, 0x01},
+   {0x5a, 0x02},
+
+   /*MIPI Analog*/
+   {0x3e, 0xd6},
+   {0x3f, 0xd4},
+   {0x41, 0x3c},
+   {0xB2, 0x00},
+   };
+
+   return regmap_multi_reg_write(lt->regmap[I2C_MAIN], seq, 
ARRAY_SIZE(seq));
+}
+
+static int lt8912_write_mipi_basic_config(struct lt8912 *lt)
+{
+   const struct reg_sequence seq[] = {
+   {0x12, 0x04},
+   {0x14, 0x00},
+   {0x15, 0x00},
+   {0x1a, 0x03},
+   {0x1b, 0x03},
+   };
+
+   return regmap_multi_reg_write(lt->regmap[I2C_CEC_DSI], seq, 
ARRAY_SIZE(seq));
+};
+
+static int lt8912_write_dds_config(struct lt8912 *lt)
+{
+

[PATCH 0/2] Add support of Lontium lt8912 MIPI to HDMI bridge

2021-01-25 Thread Adrien Grassein
Hello,

this patch set adds the support of the Lontium lt8912 MIPI to HDMI
bridge in the kernel.

It's only support the video part, not the audio part yet
since I don't have the datasheet of this component.
I get the current i2c configuration from Digi and
Boundary drivers.
Developed using the DB_DSIHD board from BoundaryDevices.

Thanks,
Adrien Grassein

Adrien Grassein (2):
  dt-bindings: display: bridge: Add documentation for LT8912
  drm/bridge: Introduce LT8912 DSI to HDMI bridge

 .../display/bridge/lontium,lt8912.yaml|  92 +++
 MAINTAINERS   |   6 +
 drivers/gpu/drm/bridge/Kconfig|  14 +
 drivers/gpu/drm/bridge/Makefile   |   1 +
 drivers/gpu/drm/bridge/lontium-lt8912.c   | 749 ++
 5 files changed, 862 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/lontium,lt8912.yaml
 create mode 100644 drivers/gpu/drm/bridge/lontium-lt8912.c

-- 
2.25.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 1/2] dt-bindings: display: bridge: Add documentation for LT8912

2021-01-25 Thread Adrien Grassein
Lontium LT8912 is a DSI to HDMI bridge.

Signed-off-by: Adrien Grassein 
---
 .../display/bridge/lontium,lt8912.yaml| 92 +++
 MAINTAINERS   |  5 +
 2 files changed, 97 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/lontium,lt8912.yaml

diff --git 
a/Documentation/devicetree/bindings/display/bridge/lontium,lt8912.yaml 
b/Documentation/devicetree/bindings/display/bridge/lontium,lt8912.yaml
new file mode 100644
index ..ed1a6ddaab2f
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/lontium,lt8912.yaml
@@ -0,0 +1,92 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/bridge/lontium,lt8912.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Lontium LT8912 MIPI to HDMI Bridge
+
+maintainers:
+  - Adrien Grassein 
+
+description: |
+  The LT8912 is a bridge device which convert DSI to HDMI
+
+properties:
+  compatible:
+enum:
+  - lontium,lt8912
+
+  reg:
+maxItems: 1
+
+  ddc-i2c-bus:
+maxItems: 1
+description: i2c bus used to read EDID of the connected display.
+
+  dsi-lanes:
+maxItems: 1
+description: dsi lanes count interconnected with lt8912.
+
+  reset-gpios:
+maxItems: 1
+description: GPIO connected to active high RESET pin.
+
+  ports:
+$ref: /schemas/graph.yaml#/properties/ports
+
+properties:
+  port@0:
+$ref: /schemas/graph.yaml#/properties/port
+description:
+  Primary MIPI port-1 for MIPI input
+
+required:
+  - port@0
+
+required:
+  - compatible
+  - ddc-i2c-bus
+  - dsi-lanes
+  - reg
+  - reset-gpios
+  - ports
+
+additionalProperties: false
+
+examples:
+  - |
+#include 
+
+i2c4 {
+  #address-cells = <1>;
+  #size-cells = <0>;
+
+  hdmi-bridge@48 {
+compatible = "lontium,lt8912";
+reg = <0x48>;
+reset-gpios = < 0 GPIO_ACTIVE_LOW>;
+dsi-lanes = <4>;
+ddc-i2c-bus = <_i2c_bus>;
+
+ports {
+  #address-cells = <1>;
+  #size-cells = <0>;
+
+  port@0 {
+reg = <0>;
+
+hdmi_out_in: endpoint {
+  remote-endpoint = <_dsi_out>;
+};
+  };
+};
+  };
+};
+
+ddc_i2c_bus: i2c5 {
+  #address-cells = <1>;
+  #size-cells = <0>;
+};
+
+...
diff --git a/MAINTAINERS b/MAINTAINERS
index 5aa18cbfb883..01e7e356bfac 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10472,6 +10472,11 @@ S: Maintained
 T: git git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git
 F: drivers/hid/hid-lg-g15.c
 
+LONTIUM LT8912 MIPI TO HDMI BRIDGE
+M: Adrien Grassein 
+S: Maintained
+F: Documentation/devicetree/bindings/display/bridge/lontium,lt8912.yaml
+
 LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI)
 M: Sathya Prakash 
 M: Sreekanth Reddy 
-- 
2.25.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 2/2] drm/bridge: Introduce LT8912 DSI to HDMI bridge

2021-01-25 Thread Adrien Grassein
Lontium Lt8912 is a DSI to HDMI bridge.

Signed-off-by: Adrien Grassein 
---
 MAINTAINERS |   1 +
 drivers/gpu/drm/bridge/Kconfig  |  14 +
 drivers/gpu/drm/bridge/Makefile |   1 +
 drivers/gpu/drm/bridge/lontium-lt8912.c | 749 
 4 files changed, 765 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/lontium-lt8912.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 01e7e356bfac..65fb19382e40 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10476,6 +10476,7 @@ LONTIUM LT8912 MIPI TO HDMI BRIDGE
 M: Adrien Grassein 
 S: Maintained
 F: Documentation/devicetree/bindings/display/bridge/lontium,lt8912.yaml
+F: drivers/gpu/drm/bridge/lontium-lt8912.c
 
 LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI)
 M: Sathya Prakash 
diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index e4110d6ca7b3..5b36d4b86e3c 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -48,6 +48,20 @@ config DRM_DISPLAY_CONNECTOR
  on ARM-based platforms. Saying Y here when this driver is not needed
  will not cause any issue.
 
+config DRM_LONTIUM_LT8912
+   tristate "Lontium LT8912 DSI/HDMI bridge"
+   depends on OF
+   select DRM_PANEL_BRIDGE
+   select DRM_KMS_HELPER
+   select REGMAP_I2C
+   help
+ Driver for Lontium LT8912 DSI to HDMI bridge
+ chip driver.
+ Please say Y if you have such hardware.
+
+ Say M here if you want to support this hardware as a module.
+ The module will be named "lontium-lt8912".
+
 config DRM_LONTIUM_LT9611
tristate "Lontium LT9611 DSI/HDMI bridge"
select SND_SOC_HDMI_CODEC if SND_SOC
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index 86e7acc76f8d..5a1b201cea1f 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -2,6 +2,7 @@
 obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
 obj-$(CONFIG_DRM_CHRONTEL_CH7033) += chrontel-ch7033.o
 obj-$(CONFIG_DRM_DISPLAY_CONNECTOR) += display-connector.o
+obj-$(CONFIG_DRM_LONTIUM_LT8912) += lontium-lt8912.o
 obj-$(CONFIG_DRM_LONTIUM_LT9611) += lontium-lt9611.o
 obj-$(CONFIG_DRM_LONTIUM_LT9611UXC) += lontium-lt9611uxc.o
 obj-$(CONFIG_DRM_LVDS_CODEC) += lvds-codec.o
diff --git a/drivers/gpu/drm/bridge/lontium-lt8912.c 
b/drivers/gpu/drm/bridge/lontium-lt8912.c
new file mode 100644
index ..dd2ac92a5730
--- /dev/null
+++ b/drivers/gpu/drm/bridge/lontium-lt8912.c
@@ -0,0 +1,749 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#define I2C_MAIN 0
+#define I2C_ADDR_MAIN 0x48
+
+#define I2C_CEC_DSI 1
+#define I2C_ADDR_CEC_DSI 0x49
+
+#define I2C_MAX_IDX 2
+
+#define HPD_WORK_DELAY_MS 1000
+
+struct lt8912 {
+   struct device *dev;
+   struct drm_bridge bridge;
+   struct drm_connector connector;
+
+   struct i2c_adapter *ddc;
+   struct i2c_client *i2c_client[I2C_MAX_IDX];
+   struct regmap *regmap[I2C_MAX_IDX];
+
+   struct device_node *host_node;
+   struct mipi_dsi_device *dsi;
+
+   struct gpio_desc *gp_reset;
+
+   struct videomode mode;
+
+   u8 dsi_lanes;
+   bool is_power_on;
+   bool is_attached;
+   bool cable_is_attached;
+
+   struct workqueue_struct *workq;
+   struct delayed_work lt8912_check_hpd_work_id;
+};
+
+static int lt8912_write_init_config(struct lt8912 *lt)
+{
+   const struct reg_sequence seq[] = {
+   /* Digital clock en*/
+   {0x08, 0xff},
+   {0x09, 0xff},
+   {0x0a, 0xff},
+   {0x0b, 0x7c},
+   {0x0c, 0xff},
+   {0x42, 0x04},
+
+   /*Tx Analog*/
+   {0x31, 0xb1},
+   {0x32, 0xb1},
+   {0x33, 0x0e},
+   {0x37, 0x00},
+   {0x38, 0x22},
+   {0x60, 0x82},
+
+   /*Cbus Analog*/
+   {0x39, 0x45},
+   {0x3a, 0x00},
+   {0x3b, 0x00},
+
+   /*HDMI Pll Analog*/
+   {0x44, 0x31},
+   {0x55, 0x44},
+   {0x57, 0x01},
+   {0x5a, 0x02},
+
+   /*MIPI Analog*/
+   {0x3e, 0xd6},
+   {0x3f, 0xd4},
+   {0x41, 0x3c},
+   {0xB2, 0x00},
+   };
+
+   return regmap_multi_reg_write(lt->regmap[I2C_MAIN], seq, 
ARRAY_SIZE(seq));
+}
+
+static int lt8912_write_mipi_basic_config(struct lt8912 *lt)
+{
+   const struct reg_sequence seq[] = {
+   {0x12, 0x04},
+   {0x14, 0x00},
+   {0x15, 0x00},
+   {0x1a, 0x03},
+   {0x1b, 0x03},
+   };
+
+   return regmap_multi_reg_write(lt->regma

[PATCH 1/2] dt-bindings: display: bridge: Add documentation for LT8912

2021-01-25 Thread Adrien Grassein
Lontium LT8912 is a DSI to HDMI bridge.

Signed-off-by: Adrien Grassein 
---
 .../display/bridge/lontium,lt8912.yaml| 92 +++
 MAINTAINERS   |  5 +
 2 files changed, 97 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/lontium,lt8912.yaml

diff --git 
a/Documentation/devicetree/bindings/display/bridge/lontium,lt8912.yaml 
b/Documentation/devicetree/bindings/display/bridge/lontium,lt8912.yaml
new file mode 100644
index ..ed1a6ddaab2f
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/lontium,lt8912.yaml
@@ -0,0 +1,92 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/bridge/lontium,lt8912.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Lontium LT8912 MIPI to HDMI Bridge
+
+maintainers:
+  - Adrien Grassein 
+
+description: |
+  The LT8912 is a bridge device which convert DSI to HDMI
+
+properties:
+  compatible:
+enum:
+  - lontium,lt8912
+
+  reg:
+maxItems: 1
+
+  ddc-i2c-bus:
+maxItems: 1
+description: i2c bus used to read EDID of the connected display.
+
+  dsi-lanes:
+maxItems: 1
+description: dsi lanes count interconnected with lt8912.
+
+  reset-gpios:
+maxItems: 1
+description: GPIO connected to active high RESET pin.
+
+  ports:
+$ref: /schemas/graph.yaml#/properties/ports
+
+properties:
+  port@0:
+$ref: /schemas/graph.yaml#/properties/port
+description:
+  Primary MIPI port-1 for MIPI input
+
+required:
+  - port@0
+
+required:
+  - compatible
+  - ddc-i2c-bus
+  - dsi-lanes
+  - reg
+  - reset-gpios
+  - ports
+
+additionalProperties: false
+
+examples:
+  - |
+#include 
+
+i2c4 {
+  #address-cells = <1>;
+  #size-cells = <0>;
+
+  hdmi-bridge@48 {
+compatible = "lontium,lt8912";
+reg = <0x48>;
+reset-gpios = < 0 GPIO_ACTIVE_LOW>;
+dsi-lanes = <4>;
+ddc-i2c-bus = <_i2c_bus>;
+
+ports {
+  #address-cells = <1>;
+  #size-cells = <0>;
+
+  port@0 {
+reg = <0>;
+
+hdmi_out_in: endpoint {
+  remote-endpoint = <_dsi_out>;
+};
+  };
+};
+  };
+};
+
+ddc_i2c_bus: i2c5 {
+  #address-cells = <1>;
+  #size-cells = <0>;
+};
+
+...
diff --git a/MAINTAINERS b/MAINTAINERS
index 5aa18cbfb883..01e7e356bfac 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10472,6 +10472,11 @@ S: Maintained
 T: git git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git
 F: drivers/hid/hid-lg-g15.c
 
+LONTIUM LT8912 MIPI TO HDMI BRIDGE
+M: Adrien Grassein 
+S: Maintained
+F: Documentation/devicetree/bindings/display/bridge/lontium,lt8912.yaml
+
 LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI)
 M: Sathya Prakash 
 M: Sreekanth Reddy 
-- 
2.25.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel