Re: [PATCH v11] drm/bridge: add it6505 driver

2022-02-01 Thread Robert Foss
On Fri, 14 Jan 2022 at 10:29, allen  wrote:
>
> This adds support for the iTE IT6505.
> This device can convert DPI signal to DP output.
>
> From: Allen Chen 
> Tested-by: Hsin-yi Wang 
> Signed-off-by: Hermes Wu 
> Signed-off-by: Allen Chen 
> ---
> v10 -> v11 : remove drm_bridge_new_crtc_state
> ---
>  drivers/gpu/drm/bridge/Kconfig  |8 +
>  drivers/gpu/drm/bridge/Makefile |1 +
>  drivers/gpu/drm/bridge/ite-it6505.c | 3352 +++
>  3 files changed, 3361 insertions(+)
>  create mode 100644 drivers/gpu/drm/bridge/ite-it6505.c
>
> diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
> index 61db5a66b4934..f667fdd87a2cb 100644
> --- a/drivers/gpu/drm/bridge/Kconfig
> +++ b/drivers/gpu/drm/bridge/Kconfig
> @@ -74,6 +74,14 @@ config DRM_DISPLAY_CONNECTOR
>   on ARM-based platforms. Saying Y here when this driver is not needed
>   will not cause any issue.
>
> +config DRM_ITE_IT6505
> +tristate "ITE IT6505 DisplayPort bridge"
> +depends on OF
> +select DRM_KMS_HELPER
> +select EXTCON
> +help
> +  ITE IT6505 DisplayPort bridge chip driver.
> +
>  config DRM_LONTIUM_LT8912B
> tristate "Lontium LT8912B DSI/HDMI bridge"
> depends on OF
> diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
> index f2c73683cfcb7..425844c304953 100644
> --- a/drivers/gpu/drm/bridge/Makefile
> +++ b/drivers/gpu/drm/bridge/Makefile
> @@ -4,6 +4,7 @@ obj-$(CONFIG_DRM_CHIPONE_ICN6211) += chipone-icn6211.o
>  obj-$(CONFIG_DRM_CHRONTEL_CH7033) += chrontel-ch7033.o
>  obj-$(CONFIG_DRM_CROS_EC_ANX7688) += cros-ec-anx7688.o
>  obj-$(CONFIG_DRM_DISPLAY_CONNECTOR) += display-connector.o
> +obj-$(CONFIG_DRM_ITE_IT6505) += ite-it6505.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
> diff --git a/drivers/gpu/drm/bridge/ite-it6505.c 
> b/drivers/gpu/drm/bridge/ite-it6505.c
> new file mode 100644
> index 0..f47cf134e7900
> --- /dev/null
> +++ b/drivers/gpu/drm/bridge/ite-it6505.c
> @@ -0,0 +1,3352 @@
> +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +/*
> + * Copyright (c) 2020, The Linux Foundation. All rights reserved.
> + */
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 

This include has changed location, I manually fixed this in this in the patch.

> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +
> +#define REG_IC_VER 0x04
> +
> +#define REG_RESET_CTRL 0x05
> +#define VIDEO_RESET BIT(0)
> +#define AUDIO_RESET BIT(1)
> +#define ALL_LOGIC_RESET BIT(2)
> +#define AUX_RESET BIT(3)
> +#define HDCP_RESET BIT(4)
> +
> +#define INT_STATUS_01 0x06
> +#define INT_MASK_01 0x09
> +#define INT_HPD_CHANGE 0
> +#define INT_RECEIVE_HPD_IRQ 1
> +#define INT_SCDT_CHANGE 2
> +#define INT_HDCP_FAIL 3
> +#define INT_HDCP_DONE 4
> +#define BIT_OFFSET(x) (((x) - INT_STATUS_01) * BITS_PER_BYTE)
> +#define BIT_INT_HPD INT_HPD_CHANGE
> +#define BIT_INT_HPD_IRQ INT_RECEIVE_HPD_IRQ
> +#define BIT_INT_SCDT INT_SCDT_CHANGE
> +#define BIT_INT_HDCP_FAIL INT_HDCP_FAIL
> +#define BIT_INT_HDCP_DONE INT_HDCP_DONE
> +
> +#define INT_STATUS_02 0x07
> +#define INT_MASK_02 0x0A
> +#define INT_AUX_CMD_FAIL 0
> +#define INT_HDCP_KSV_CHECK 1
> +#define INT_AUDIO_FIFO_ERROR 2
> +#define BIT_INT_AUX_CMD_FAIL (BIT_OFFSET(0x07) + INT_AUX_CMD_FAIL)
> +#define BIT_INT_HDCP_KSV_CHECK (BIT_OFFSET(0x07) + INT_HDCP_KSV_CHECK)
> +#define BIT_INT_AUDIO_FIFO_ERROR (BIT_OFFSET(0x07) + INT_AUDIO_FIFO_ERROR)
> +
> +#define INT_STATUS_03 0x08
> +#define INT_MASK_03 0x0B
> +#define INT_LINK_TRAIN_FAIL 4
> +#define INT_VID_FIFO_ERROR 5
> +#define INT_IO_LATCH_FIFO_OVERFLOW 7
> +#define BIT_INT_LINK_TRAIN_FAIL (BIT_OFFSET(0x08) + INT_LINK_TRAIN_FAIL)
> +#define BIT_INT_VID_FIFO_ERROR (BIT_OFFSET(0x08) + INT_VID_FIFO_ERROR)
> +#define BIT_INT_IO_FIFO_OVERFLOW (BIT_OFFSET(0x08) + 
> INT_IO_LATCH_FIFO_OVERFLOW)
> +
> +#define REG_SYSTEM_STS 0x0D
> +#define INT_STS BIT(0)
> +#define HPD_STS BIT(1)
> +#define VIDEO_STB BIT(2)
> +
> +#define REG_LINK_TRAIN_STS 0x0E
> +#define LINK_STATE_CR BIT(2)
> +#define LINK_STATE_EQ BIT(3)
> +#define LINK_STATE_NORP BIT(4)
> +
> +#define REG_BANK_SEL 0x0F
> +#define REG_CLK_CTRL0 0x10
> +#define M_PCLK_DELAY 0x03
> +
> +#define REG_AUX_OPT 0x11
> +#define AUX_AUTO_RST BIT(0)
> +#define AUX_FIX_FREQ BIT(3)
> +
> +#define REG_DATA_CTRL0 0x12
> +#define VIDEO_LATCH_EDGE BIT(4)
> +#define ENABLE_PCLK_COUNTER BIT(7)
> +
> +#define REG_PCLK_COUNTER_VALUE 0x13
> +
> +#define REG_501_FIFO_CTRL 0x15
> +#define RST_501_FIFO BIT(1)
> +
> +#define REG_TRAIN_CTRL0 0x16
> +#define FORCE_LBR BIT(0)
> +#de

Re: [PATCH v11] drm/bridge: add it6505 driver

2022-02-01 Thread AngeloGioacchino Del Regno

Il 31/01/22 19:36, Robert Foss ha scritto:

On Mon, 31 Jan 2022 at 17:55, Hsin-Yi Wang  wrote:


On Tue, Feb 1, 2022 at 12:37 AM Robert Foss  wrote:


On Thu, 20 Jan 2022 at 16:25, AngeloGioacchino Del Regno
 wrote:


Il 14/01/22 10:14, allen ha scritto:

This adds support for the iTE IT6505.
This device can convert DPI signal to DP output.

From: Allen Chen 
Tested-by: Hsin-yi Wang 
Signed-off-by: Hermes Wu 
Signed-off-by: Allen Chen 
---
v10 -> v11 : remove drm_bridge_new_crtc_state
---
   drivers/gpu/drm/bridge/Kconfig  |8 +
   drivers/gpu/drm/bridge/Makefile |1 +
   drivers/gpu/drm/bridge/ite-it6505.c | 3352 +++
   3 files changed, 3361 insertions(+)
   create mode 100644 drivers/gpu/drm/bridge/ite-it6505.c



...snip...


+static const struct of_device_id it6505_of_match[] = {
+ { .compatible = "ite,it6505" },
+ { }
+};


If you want to have a DT compatible and DT properties, you have to also add
dt-bindings (yaml) for this driver, otherwise, any SoC/device DT will fail
the dt binding check So, please, add that.


Let me second this. A dt-binding is needed for this driver to be
complete, it functions as both documentation and a way to test the DTS
that use this device, so it is really important.


The binding seems to be accepted before the driver:
https://elixir.bootlin.com/linux/v5.16.4/source/Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml


I completely missed that. In that case we're only missing the
reviewed-by tag from someone.



You have mine... the intention was to give a Reviewed-by, not a Acked-by - I'm
sorry for that, I was sending more than one email and the wrong tag slipped
through.

So, please change my Acked-by tag to

Reviewed-by: AngeloGioacchino Del Regno 






For the driver by itself, though:

Acked-by: AngeloGioacchino Del Regno 


+
+static struct i2c_driver it6505_i2c_driver = {
+ .driver = {
+ .name = "it6505",
+ .of_match_table = it6505_of_match,
+ .pm = &it6505_bridge_pm_ops,
+ },
+ .probe = it6505_i2c_probe,
+ .remove = it6505_i2c_remove,
+ .shutdown = it6505_shutdown,
+ .id_table = it6505_id,
+};
+
+module_i2c_driver(it6505_i2c_driver);
+
+MODULE_AUTHOR("Allen Chen ");
+MODULE_DESCRIPTION("IT6505 DisplayPort Transmitter driver");
+MODULE_LICENSE("GPL v2");








Re: [PATCH v11] drm/bridge: add it6505 driver

2022-01-31 Thread Robert Foss
On Mon, 31 Jan 2022 at 17:55, Hsin-Yi Wang  wrote:
>
> On Tue, Feb 1, 2022 at 12:37 AM Robert Foss  wrote:
> >
> > On Thu, 20 Jan 2022 at 16:25, AngeloGioacchino Del Regno
> >  wrote:
> > >
> > > Il 14/01/22 10:14, allen ha scritto:
> > > > This adds support for the iTE IT6505.
> > > > This device can convert DPI signal to DP output.
> > > >
> > > > From: Allen Chen 
> > > > Tested-by: Hsin-yi Wang 
> > > > Signed-off-by: Hermes Wu 
> > > > Signed-off-by: Allen Chen 
> > > > ---
> > > > v10 -> v11 : remove drm_bridge_new_crtc_state
> > > > ---
> > > >   drivers/gpu/drm/bridge/Kconfig  |8 +
> > > >   drivers/gpu/drm/bridge/Makefile |1 +
> > > >   drivers/gpu/drm/bridge/ite-it6505.c | 3352 +++
> > > >   3 files changed, 3361 insertions(+)
> > > >   create mode 100644 drivers/gpu/drm/bridge/ite-it6505.c
> > > >
> > >
> > > ...snip...
> > >
> > > > +static const struct of_device_id it6505_of_match[] = {
> > > > + { .compatible = "ite,it6505" },
> > > > + { }
> > > > +};
> > >
> > > If you want to have a DT compatible and DT properties, you have to also 
> > > add
> > > dt-bindings (yaml) for this driver, otherwise, any SoC/device DT will fail
> > > the dt binding check So, please, add that.
> >
> > Let me second this. A dt-binding is needed for this driver to be
> > complete, it functions as both documentation and a way to test the DTS
> > that use this device, so it is really important.
> >
> The binding seems to be accepted before the driver:
> https://elixir.bootlin.com/linux/v5.16.4/source/Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml

I completely missed that. In that case we're only missing the
reviewed-by tag from someone.

>
> > >
> > > For the driver by itself, though:
> > >
> > > Acked-by: AngeloGioacchino Del Regno 
> > > 
> > >
> > > > +
> > > > +static struct i2c_driver it6505_i2c_driver = {
> > > > + .driver = {
> > > > + .name = "it6505",
> > > > + .of_match_table = it6505_of_match,
> > > > + .pm = &it6505_bridge_pm_ops,
> > > > + },
> > > > + .probe = it6505_i2c_probe,
> > > > + .remove = it6505_i2c_remove,
> > > > + .shutdown = it6505_shutdown,
> > > > + .id_table = it6505_id,
> > > > +};
> > > > +
> > > > +module_i2c_driver(it6505_i2c_driver);
> > > > +
> > > > +MODULE_AUTHOR("Allen Chen ");
> > > > +MODULE_DESCRIPTION("IT6505 DisplayPort Transmitter driver");
> > > > +MODULE_LICENSE("GPL v2");
> > > >
> > >


Re: [PATCH v11] drm/bridge: add it6505 driver

2022-01-31 Thread Hsin-Yi Wang
On Tue, Feb 1, 2022 at 12:37 AM Robert Foss  wrote:
>
> On Thu, 20 Jan 2022 at 16:25, AngeloGioacchino Del Regno
>  wrote:
> >
> > Il 14/01/22 10:14, allen ha scritto:
> > > This adds support for the iTE IT6505.
> > > This device can convert DPI signal to DP output.
> > >
> > > From: Allen Chen 
> > > Tested-by: Hsin-yi Wang 
> > > Signed-off-by: Hermes Wu 
> > > Signed-off-by: Allen Chen 
> > > ---
> > > v10 -> v11 : remove drm_bridge_new_crtc_state
> > > ---
> > >   drivers/gpu/drm/bridge/Kconfig  |8 +
> > >   drivers/gpu/drm/bridge/Makefile |1 +
> > >   drivers/gpu/drm/bridge/ite-it6505.c | 3352 +++
> > >   3 files changed, 3361 insertions(+)
> > >   create mode 100644 drivers/gpu/drm/bridge/ite-it6505.c
> > >
> >
> > ...snip...
> >
> > > +static const struct of_device_id it6505_of_match[] = {
> > > + { .compatible = "ite,it6505" },
> > > + { }
> > > +};
> >
> > If you want to have a DT compatible and DT properties, you have to also add
> > dt-bindings (yaml) for this driver, otherwise, any SoC/device DT will fail
> > the dt binding check So, please, add that.
>
> Let me second this. A dt-binding is needed for this driver to be
> complete, it functions as both documentation and a way to test the DTS
> that use this device, so it is really important.
>
The binding seems to be accepted before the driver:
https://elixir.bootlin.com/linux/v5.16.4/source/Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml

> >
> > For the driver by itself, though:
> >
> > Acked-by: AngeloGioacchino Del Regno 
> > 
> >
> > > +
> > > +static struct i2c_driver it6505_i2c_driver = {
> > > + .driver = {
> > > + .name = "it6505",
> > > + .of_match_table = it6505_of_match,
> > > + .pm = &it6505_bridge_pm_ops,
> > > + },
> > > + .probe = it6505_i2c_probe,
> > > + .remove = it6505_i2c_remove,
> > > + .shutdown = it6505_shutdown,
> > > + .id_table = it6505_id,
> > > +};
> > > +
> > > +module_i2c_driver(it6505_i2c_driver);
> > > +
> > > +MODULE_AUTHOR("Allen Chen ");
> > > +MODULE_DESCRIPTION("IT6505 DisplayPort Transmitter driver");
> > > +MODULE_LICENSE("GPL v2");
> > >
> >


Re: [PATCH v11] drm/bridge: add it6505 driver

2022-01-31 Thread Robert Foss
On Thu, 20 Jan 2022 at 16:25, AngeloGioacchino Del Regno
 wrote:
>
> Il 14/01/22 10:14, allen ha scritto:
> > This adds support for the iTE IT6505.
> > This device can convert DPI signal to DP output.
> >
> > From: Allen Chen 
> > Tested-by: Hsin-yi Wang 
> > Signed-off-by: Hermes Wu 
> > Signed-off-by: Allen Chen 
> > ---
> > v10 -> v11 : remove drm_bridge_new_crtc_state
> > ---
> >   drivers/gpu/drm/bridge/Kconfig  |8 +
> >   drivers/gpu/drm/bridge/Makefile |1 +
> >   drivers/gpu/drm/bridge/ite-it6505.c | 3352 +++
> >   3 files changed, 3361 insertions(+)
> >   create mode 100644 drivers/gpu/drm/bridge/ite-it6505.c
> >
>
> ...snip...
>
> > +static const struct of_device_id it6505_of_match[] = {
> > + { .compatible = "ite,it6505" },
> > + { }
> > +};
>
> If you want to have a DT compatible and DT properties, you have to also add
> dt-bindings (yaml) for this driver, otherwise, any SoC/device DT will fail
> the dt binding check So, please, add that.

Let me second this. A dt-binding is needed for this driver to be
complete, it functions as both documentation and a way to test the DTS
that use this device, so it is really important.

>
> For the driver by itself, though:
>
> Acked-by: AngeloGioacchino Del Regno 
>
> > +
> > +static struct i2c_driver it6505_i2c_driver = {
> > + .driver = {
> > + .name = "it6505",
> > + .of_match_table = it6505_of_match,
> > + .pm = &it6505_bridge_pm_ops,
> > + },
> > + .probe = it6505_i2c_probe,
> > + .remove = it6505_i2c_remove,
> > + .shutdown = it6505_shutdown,
> > + .id_table = it6505_id,
> > +};
> > +
> > +module_i2c_driver(it6505_i2c_driver);
> > +
> > +MODULE_AUTHOR("Allen Chen ");
> > +MODULE_DESCRIPTION("IT6505 DisplayPort Transmitter driver");
> > +MODULE_LICENSE("GPL v2");
> >
>


Re: [PATCH v11] drm/bridge: add it6505 driver

2022-01-20 Thread AngeloGioacchino Del Regno

Il 14/01/22 10:14, allen ha scritto:

This adds support for the iTE IT6505.
This device can convert DPI signal to DP output.

From: Allen Chen 
Tested-by: Hsin-yi Wang 
Signed-off-by: Hermes Wu 
Signed-off-by: Allen Chen 
---
v10 -> v11 : remove drm_bridge_new_crtc_state
---
  drivers/gpu/drm/bridge/Kconfig  |8 +
  drivers/gpu/drm/bridge/Makefile |1 +
  drivers/gpu/drm/bridge/ite-it6505.c | 3352 +++
  3 files changed, 3361 insertions(+)
  create mode 100644 drivers/gpu/drm/bridge/ite-it6505.c



...snip...


+static const struct of_device_id it6505_of_match[] = {
+   { .compatible = "ite,it6505" },
+   { }
+};


If you want to have a DT compatible and DT properties, you have to also add
dt-bindings (yaml) for this driver, otherwise, any SoC/device DT will fail
the dt binding check So, please, add that.

For the driver by itself, though:

Acked-by: AngeloGioacchino Del Regno 


+
+static struct i2c_driver it6505_i2c_driver = {
+   .driver = {
+   .name = "it6505",
+   .of_match_table = it6505_of_match,
+   .pm = &it6505_bridge_pm_ops,
+   },
+   .probe = it6505_i2c_probe,
+   .remove = it6505_i2c_remove,
+   .shutdown = it6505_shutdown,
+   .id_table = it6505_id,
+};
+
+module_i2c_driver(it6505_i2c_driver);
+
+MODULE_AUTHOR("Allen Chen ");
+MODULE_DESCRIPTION("IT6505 DisplayPort Transmitter driver");
+MODULE_LICENSE("GPL v2");