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

2021-02-23 Thread Robert Foss
On Tue, 23 Feb 2021 at 11:51, Adrien Grassein  wrote:
>
> 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
> > > > > > +++ 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];
> > > 

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
> > > > > +++ 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;
> > 

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 
> > > > +
> > > > +#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},
> > > > +   

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

2021-02-19 Thread Robert Foss
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 
> > > +
> > > +#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},
> > > +   

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)
> > +{
> > +   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},
> > +   

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

2021-02-19 Thread Robert Foss
Hey Adrien,


Thanks for the quick update.

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)
> +{
> +   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 

[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 seq[] = {
+   {0x4e, 0xff},
+