2021-02-14 17:57:45

by Jagan Teki

[permalink] [raw]
Subject: [PATCH v3 1/2] dt-bindings: display: bridge: Add bindings for Chipone ICN6211

ICN6211 is MIPI-DSI to RGB Convertor bridge from Chipone.

It has a flexible configuration of MIPI DSI signal input and
produce RGB565, RGB666, RGB888 output format.

Add dt-bingings for it.

Signed-off-by: Jagan Teki <[email protected]>
---
Changes for v3:
- updated to new dt-bindings style

.../display/bridge/chipone,icn6211.yaml | 90 +++++++++++++++++++
1 file changed, 90 insertions(+)
create mode 100644 Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml

diff --git a/Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml b/Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml
new file mode 100644
index 000000000000..13764f13fe46
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml
@@ -0,0 +1,90 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/bridge/chipone,icn6211.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Chipone ICN6211 MIPI-DSI to RGB Converter bridge
+
+maintainers:
+ - Jagan Teki <[email protected]>
+
+description: |
+ ICN6211 is MIPI-DSI to RGB Convertor bridge from chipone.
+
+ It has a flexible configuration of MIPI DSI signal input and
+ produce RGB565, RGB666, RGB888 output format.
+
+properties:
+ compatible:
+ enum:
+ - chipone,icn6211
+
+ reg:
+ maxItems: 1
+ description: virtual channel number of a DSI peripheral
+
+ reset-gpios:
+ description: GPIO connected for the reset pin
+
+ ports:
+ $ref: /schemas/graph.yaml#/properties/ports
+
+ properties:
+ port@0:
+ $ref: /schemas/graph.yaml#/properties/port
+ description:
+ Video port for MIPI DSI input
+
+ port@1:
+ $ref: /schemas/graph.yaml#/properties/port
+ description:
+ Video port for MIPI DPI output (panel or connector).
+
+ required:
+ - port@0
+ - port@1
+
+required:
+ - compatible
+ - reg
+ - reset-gpios
+ - ports
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/gpio/gpio.h>
+
+ dsi {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ bridge@0 {
+ compatible = "chipone,icn6211";
+ reg = <0>;
+ reset-gpios = <&r_pio 0 5 GPIO_ACTIVE_HIGH>; /* LCD-RST: PL5 */
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ bridge_in: port@0 {
+ reg = <0>;
+
+ bridge_out_dsi: endpoint {
+ remote-endpoint = <&dsi_out_bridge>;
+ };
+ };
+
+ bridge_out: port@1 {
+ reg = <1>;
+
+ bridge_out_panel: endpoint {
+ remote-endpoint = <&panel_out_bridge>;
+ };
+ };
+ };
+ };
+ };
--
2.25.1


2021-02-14 17:57:49

by Jagan Teki

[permalink] [raw]
Subject: [PATCH v3 2/2] drm: bridge: Add Chipone ICN6211 MIPI-DSI to RGB bridge

ICN6211 is MIPI-DSI to RGB Convertor bridge from Chipone.

It has a flexible configuration of MIPI DSI signal input and
produce RGB565, RGB666, RGB888 output format.

Add bridge driver for it.

Signed-off-by: Jagan Teki <[email protected]>
---
Changes for v3:
- updated the driver to inline with new drm bridge style

MAINTAINERS | 6 +
drivers/gpu/drm/bridge/Kconfig | 11 ++
drivers/gpu/drm/bridge/Makefile | 1 +
drivers/gpu/drm/bridge/chipone-icn6211.c | 222 +++++++++++++++++++++++
4 files changed, 240 insertions(+)
create mode 100644 drivers/gpu/drm/bridge/chipone-icn6211.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 9d241b832aae..4f1084aae50d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5529,6 +5529,12 @@ S: Maintained
F: Documentation/devicetree/bindings/display/panel/boe,himax8279d.yaml
F: drivers/gpu/drm/panel/panel-boe-himax8279d.c

+DRM DRIVER FOR CHIPONE ICN6211 MIPI-DSI to RGB CONVERTOR BRIDGE
+M: Jagan Teki <[email protected]>
+S: Maintained
+F: drivers/gpu/drm/bridge/chipone-icn6211.c
+F: Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml
+
DRM DRIVER FOR FARADAY TVE200 TV ENCODER
M: Linus Walleij <[email protected]>
S: Maintained
diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index e4110d6ca7b3..49d1565b7f25 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -27,6 +27,17 @@ config DRM_CDNS_DSI
Support Cadence DPI to DSI bridge. This is an internal
bridge and is meant to be directly embedded in a SoC.

+config DRM_CHIPONE_ICN6211
+ tristate "Chipone ICN6211 MIPI-DSI/RGB Convertor bridge"
+ depends on OF
+ select DRM_MIPI_DSI
+ select DRM_PANEL_BRIDGE
+ help
+ ICN6211 is MIPI-DSI/RGB Convertor bridge from chipone.
+
+ It has a flexible configuration of MIPI DSI signal input
+ and produce RGB565, RGB666, RGB888 output format.
+
config DRM_CHRONTEL_CH7033
tristate "Chrontel CH7033 Video Encoder"
depends on OF
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index 86e7acc76f8d..3eb84b638988 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -1,5 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
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_LT9611) += lontium-lt9611.o
diff --git a/drivers/gpu/drm/bridge/chipone-icn6211.c b/drivers/gpu/drm/bridge/chipone-icn6211.c
new file mode 100644
index 000000000000..3f478f21a4a5
--- /dev/null
+++ b/drivers/gpu/drm/bridge/chipone-icn6211.c
@@ -0,0 +1,222 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2020 Amarula Solutions(India)
+ * Author: Jagan Teki <[email protected]>
+ */
+
+#include <drm/drm_of.h>
+#include <drm/drm_print.h>
+#include <drm/drm_mipi_dsi.h>
+
+#include <linux/delay.h>
+#include <linux/gpio/consumer.h>
+#include <linux/module.h>
+#include <linux/of_device.h>
+
+#include <video/mipi_display.h>
+
+struct chipone {
+ struct device *dev;
+ struct drm_bridge bridge;
+ struct drm_bridge *panel_bridge;
+ struct gpio_desc *reset_gpio;
+};
+
+static inline struct chipone *bridge_to_chipone(struct drm_bridge *bridge)
+{
+ return container_of(bridge, struct chipone, bridge);
+}
+
+static struct drm_display_mode *bridge_to_mode(struct drm_bridge *bridge)
+{
+ return &bridge->encoder->crtc->state->adjusted_mode;
+}
+
+static void chipone_post_disable(struct drm_bridge *bridge)
+{
+ struct chipone *icn = bridge_to_chipone(bridge);
+
+ gpiod_set_value(icn->reset_gpio, 0);
+
+ msleep(50);
+}
+
+static inline int chipone_dsi_write(struct chipone *icn, const void *seq,
+ size_t len)
+{
+ struct mipi_dsi_device *dsi = to_mipi_dsi_device(icn->dev);
+
+ return mipi_dsi_generic_write(dsi, seq, len);
+}
+
+#define CHIPONE_DSI(icn, seq...) \
+ { \
+ const u8 d[] = { seq }; \
+ chipone_dsi_write(icn, d, ARRAY_SIZE(d)); \
+ }
+
+static void chipone_enable(struct drm_bridge *bridge)
+{
+ struct chipone *icn = bridge_to_chipone(bridge);
+ struct drm_display_mode *mode = bridge_to_mode(bridge);
+
+ CHIPONE_DSI(icn, 0x7A, 0xC1);
+
+ /* lower 8 bits of hdisplay */
+ CHIPONE_DSI(icn, 0x20, mode->hdisplay & 0xff);
+
+ /* lower 8 bits of vdisplay */
+ CHIPONE_DSI(icn, 0x21, mode->vdisplay & 0xff);
+
+ /**
+ * lsb nibble: 2nd nibble of hdisplay
+ * msb nibble: 2nd nibble of vdisplay
+ */
+ CHIPONE_DSI(icn, 0x22, (((mode->hdisplay >> 8) & 0xf) |
+ (((mode->vdisplay >> 8) & 0xf) << 4)));
+
+ /* HFP */
+ CHIPONE_DSI(icn, 0x23, mode->hsync_start - mode->hdisplay);
+
+ /* HSYNC */
+ CHIPONE_DSI(icn, 0x24, mode->hsync_end - mode->hsync_start);
+
+ /* HBP */
+ CHIPONE_DSI(icn, 0x25, mode->htotal - mode->hsync_end);
+
+ CHIPONE_DSI(icn, 0x26, 0x00);
+
+ /* VFP */
+ CHIPONE_DSI(icn, 0x27, mode->vsync_start - mode->vdisplay);
+
+ /* VSYNC */
+ CHIPONE_DSI(icn, 0x28, mode->vsync_end - mode->vsync_start);
+
+ /* VBP */
+ CHIPONE_DSI(icn, 0x29, mode->vtotal - mode->vsync_end);
+
+ /* dsi specific sequence */
+ CHIPONE_DSI(icn, MIPI_DCS_SET_TEAR_OFF, 0x80);
+ CHIPONE_DSI(icn, MIPI_DCS_SET_ADDRESS_MODE, 0x28);
+ CHIPONE_DSI(icn, 0xB5, 0xA0);
+ CHIPONE_DSI(icn, 0x5C, 0xFF);
+ CHIPONE_DSI(icn, MIPI_DCS_SET_COLUMN_ADDRESS, 0x01);
+ CHIPONE_DSI(icn, MIPI_DCS_GET_POWER_SAVE, 0x92);
+ CHIPONE_DSI(icn, 0x6B, 0x71);
+ CHIPONE_DSI(icn, 0x69, 0x2B);
+ CHIPONE_DSI(icn, MIPI_DCS_ENTER_SLEEP_MODE, 0x40);
+ CHIPONE_DSI(icn, MIPI_DCS_EXIT_SLEEP_MODE, 0x98);
+
+ /* icn6211 specific sequence */
+ CHIPONE_DSI(icn, 0xB6, 0x20);
+ CHIPONE_DSI(icn, 0x51, 0x20);
+ CHIPONE_DSI(icn, 0x09, 0x10);
+
+ msleep(120);
+}
+
+static void chipone_pre_enable(struct drm_bridge *bridge)
+{
+ struct chipone *icn = bridge_to_chipone(bridge);
+
+ gpiod_set_value(icn->reset_gpio, 1);
+ msleep(20);
+
+ gpiod_set_value(icn->reset_gpio, 0);
+ msleep(20);
+
+ gpiod_set_value(icn->reset_gpio, 1);
+ msleep(50);
+}
+
+static int chipone_attach(struct drm_bridge *bridge, enum drm_bridge_attach_flags flags)
+{
+ struct chipone *icn = bridge_to_chipone(bridge);
+
+ return drm_bridge_attach(bridge->encoder, icn->panel_bridge, bridge, flags);
+}
+
+static const struct drm_bridge_funcs chipone_bridge_funcs = {
+ .post_disable = chipone_post_disable,
+ .enable = chipone_enable,
+ .pre_enable = chipone_pre_enable,
+ .attach = chipone_attach,
+};
+
+static int chipone_probe(struct mipi_dsi_device *dsi)
+{
+ struct device *dev = &dsi->dev;
+ struct drm_panel *panel;
+ struct chipone *icn;
+ int ret;
+
+ icn = devm_kzalloc(dev, sizeof(struct chipone), GFP_KERNEL);
+ if (!icn)
+ return -ENOMEM;
+
+ mipi_dsi_set_drvdata(dsi, icn);
+ icn->dev = dev;
+
+ dsi->mode_flags = MIPI_DSI_MODE_VIDEO_SYNC_PULSE;
+ dsi->format = MIPI_DSI_FMT_RGB888;
+ dsi->lanes = 4;
+
+ icn->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);
+ if (IS_ERR(icn->reset_gpio)) {
+ DRM_DEV_ERROR(dev, "failed to get reset GPIO\n");
+ return PTR_ERR(icn->reset_gpio);
+ }
+
+ ret = drm_of_find_panel_or_bridge(dev->of_node, 1, 0, &panel, NULL);
+ if (ret)
+ return ret;
+
+ icn->panel_bridge = devm_drm_panel_bridge_add(dev, panel);
+ if (IS_ERR(icn->panel_bridge))
+ return PTR_ERR(icn->panel_bridge);
+
+ icn->bridge.funcs = &chipone_bridge_funcs;
+ icn->bridge.type = DRM_MODE_CONNECTOR_DPI;
+ icn->bridge.of_node = dev->of_node;
+
+ drm_bridge_add(&icn->bridge);
+
+ ret = mipi_dsi_attach(dsi);
+ if (ret < 0) {
+ drm_bridge_remove(&icn->bridge);
+ dev_err(dev, "failed to attach dsi\n");
+ }
+
+ return ret;
+}
+
+static int chipone_remove(struct mipi_dsi_device *dsi)
+{
+ struct chipone *icn = mipi_dsi_get_drvdata(dsi);
+
+ mipi_dsi_detach(dsi);
+ drm_bridge_remove(&icn->bridge);
+
+ return 0;
+}
+
+static const struct of_device_id chipone_of_match[] = {
+ { .compatible = "chipone,icn6211", },
+ { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, chipone_of_match);
+
+static struct mipi_dsi_driver chipone_driver = {
+ .probe = chipone_probe,
+ .remove = chipone_remove,
+ .driver = {
+ .name = "chipone-icn6211",
+ .owner = THIS_MODULE,
+ .of_match_table = chipone_of_match,
+ },
+};
+module_mipi_dsi_driver(chipone_driver);
+
+MODULE_AUTHOR("Jagan Teki <[email protected]>");
+MODULE_DESCRIPTION("Chipone ICN6211 MIPI-DSI to RGB Convertor Bridge");
+MODULE_LICENSE("GPL");
--
2.25.1

2021-02-15 12:01:03

by Robert Foss

[permalink] [raw]
Subject: Re: [PATCH v3 1/2] dt-bindings: display: bridge: Add bindings for Chipone ICN6211

Hey Jagan,

Thanks for submitting this.

checkpatch.pl threw some typ-o warnings, and I listed them below. I
think either spelling is correct, but 'spelling.txt' does list this as
a typ-o explicitly, so I would suggest conforming to that just to
silence the checkpatch warning.

This patch also passes 'dt_binding_check' and 'dtbs_check', but I
think I'd like to defer to Rob Herring for an actual r-b.

On Sun, 14 Feb 2021 at 18:55, Jagan Teki <[email protected]> wrote:
>
> ICN6211 is MIPI-DSI to RGB Convertor bridge from Chipone.
>
> It has a flexible configuration of MIPI DSI signal input and
> produce RGB565, RGB666, RGB888 output format.
>
> Add dt-bingings for it.
>
> Signed-off-by: Jagan Teki <[email protected]>
> ---
> Changes for v3:
> - updated to new dt-bindings style
>
> .../display/bridge/chipone,icn6211.yaml | 90 +++++++++++++++++++
> 1 file changed, 90 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml
>
> diff --git a/Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml b/Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml
> new file mode 100644
> index 000000000000..13764f13fe46
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml
> @@ -0,0 +1,90 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/display/bridge/chipone,icn6211.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Chipone ICN6211 MIPI-DSI to RGB Converter bridge

$ scripts/checkpatch.pl --git HEAD~0
WARNING: 'Convertor' may be misspelled - perhaps 'Converter'?
#7:
ICN6211 is MIPI-DSI to RGB Convertor bridge from Chipone.
^^^^^^^^^

> +
> +maintainers:
> + - Jagan Teki <[email protected]>
> +
> +description: |
> + ICN6211 is MIPI-DSI to RGB Convertor bridge from chipone.

WARNING: 'Convertor' may be misspelled - perhaps 'Converter'?
#38: FILE: Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml:13:
+ ICN6211 is MIPI-DSI to RGB Convertor bridge from chipone.
^^^^^^^^^


> +
> + It has a flexible configuration of MIPI DSI signal input and
> + produce RGB565, RGB666, RGB888 output format.
> +
> +properties:
> + compatible:
> + enum:
> + - chipone,icn6211
> +
> + reg:
> + maxItems: 1
> + description: virtual channel number of a DSI peripheral
> +
> + reset-gpios:
> + description: GPIO connected for the reset pin
> +
> + ports:
> + $ref: /schemas/graph.yaml#/properties/ports
> +
> + properties:
> + port@0:
> + $ref: /schemas/graph.yaml#/properties/port
> + description:
> + Video port for MIPI DSI input
> +
> + port@1:
> + $ref: /schemas/graph.yaml#/properties/port
> + description:
> + Video port for MIPI DPI output (panel or connector).
> +
> + required:
> + - port@0
> + - port@1
> +
> +required:
> + - compatible
> + - reg
> + - reset-gpios
> + - ports
> +
> +additionalProperties: false
> +
> +examples:
> + - |
> + #include <dt-bindings/gpio/gpio.h>
> +
> + dsi {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + bridge@0 {
> + compatible = "chipone,icn6211";
> + reg = <0>;
> + reset-gpios = <&r_pio 0 5 GPIO_ACTIVE_HIGH>; /* LCD-RST: PL5 */
> +
> + ports {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + bridge_in: port@0 {
> + reg = <0>;
> +
> + bridge_out_dsi: endpoint {
> + remote-endpoint = <&dsi_out_bridge>;
> + };
> + };
> +
> + bridge_out: port@1 {
> + reg = <1>;
> +
> + bridge_out_panel: endpoint {
> + remote-endpoint = <&panel_out_bridge>;
> + };
> + };
> + };
> + };
> + };
> --
> 2.25.1
>

2021-02-15 12:12:14

by Jagan Teki

[permalink] [raw]
Subject: Re: [PATCH v3 1/2] dt-bindings: display: bridge: Add bindings for Chipone ICN6211

On Mon, Feb 15, 2021 at 5:28 PM Robert Foss <[email protected]> wrote:
>
> Hey Jagan,
>
> Thanks for submitting this.
>
> checkpatch.pl threw some typ-o warnings, and I listed them below. I
> think either spelling is correct, but 'spelling.txt' does list this as
> a typ-o explicitly, so I would suggest conforming to that just to
> silence the checkpatch warning.
>
> This patch also passes 'dt_binding_check' and 'dtbs_check', but I
> think I'd like to defer to Rob Herring for an actual r-b.
>
> On Sun, 14 Feb 2021 at 18:55, Jagan Teki <[email protected]> wrote:
> >
> > ICN6211 is MIPI-DSI to RGB Convertor bridge from Chipone.
> >
> > It has a flexible configuration of MIPI DSI signal input and
> > produce RGB565, RGB666, RGB888 output format.
> >
> > Add dt-bingings for it.
> >
> > Signed-off-by: Jagan Teki <[email protected]>
> > ---
> > Changes for v3:
> > - updated to new dt-bindings style
> >
> > .../display/bridge/chipone,icn6211.yaml | 90 +++++++++++++++++++
> > 1 file changed, 90 insertions(+)
> > create mode 100644 Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml
> >
> > diff --git a/Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml b/Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml
> > new file mode 100644
> > index 000000000000..13764f13fe46
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml
> > @@ -0,0 +1,90 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/display/bridge/chipone,icn6211.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Chipone ICN6211 MIPI-DSI to RGB Converter bridge
>
> $ scripts/checkpatch.pl --git HEAD~0
> WARNING: 'Convertor' may be misspelled - perhaps 'Converter'?

Thanks for pointing it.

I was aware of it before sending it and need to understand whether we
need to use vendor naming conversion or not. Chipone call these
devices are Convertor [1], So I have used the vendor notation for
better understanding.

Any comments are this would be welcome?

[1] http://en.chiponeic.com/content/details45_123.html

Jagan.

2021-02-15 12:20:07

by Robert Foss

[permalink] [raw]
Subject: Re: [PATCH v3 2/2] drm: bridge: Add Chipone ICN6211 MIPI-DSI to RGB bridge

Hey Jagan,

Thanks for submitting this driver, it looks really nice, but
checkpatch.pl has some minor issues with it. Again I'd suggest
deferring to the convertor->converter spelling change even though both
seem to be perfectly valid English.

With the below fixed, feel free to add my r-b.
Reviewed-by: Robert Foss <[email protected]>

On Sun, 14 Feb 2021 at 18:55, Jagan Teki <[email protected]> wrote:
>
> ICN6211 is MIPI-DSI to RGB Convertor bridge from Chipone.

WARNING: 'Convertor' may be misspelled - perhaps 'Converter'?
#6:
ICN6211 is MIPI-DSI to RGB Convertor bridge from Chipone.
^^^^^^^^^


>
> It has a flexible configuration of MIPI DSI signal input and
> produce RGB565, RGB666, RGB888 output format.
>
> Add bridge driver for it.

Currently this driver only supports MIPI_DSI_FMT_RGB888, maybe this
should be noted in the commit msg.

>
> Signed-off-by: Jagan Teki <[email protected]>
> ---
> Changes for v3:
> - updated the driver to inline with new drm bridge style
>
> MAINTAINERS | 6 +
> drivers/gpu/drm/bridge/Kconfig | 11 ++
> drivers/gpu/drm/bridge/Makefile | 1 +
> drivers/gpu/drm/bridge/chipone-icn6211.c | 222 +++++++++++++++++++++++
> 4 files changed, 240 insertions(+)
> create mode 100644 drivers/gpu/drm/bridge/chipone-icn6211.c
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 9d241b832aae..4f1084aae50d 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -5529,6 +5529,12 @@ S: Maintained
> F: Documentation/devicetree/bindings/display/panel/boe,himax8279d.yaml
> F: drivers/gpu/drm/panel/panel-boe-himax8279d.c
>
> +DRM DRIVER FOR CHIPONE ICN6211 MIPI-DSI to RGB CONVERTOR BRIDGE

WARNING: 'CONVERTOR' may be misspelled - perhaps 'CONVERTER'?
#30: FILE: MAINTAINERS:5533:
+DRM DRIVER FOR CHIPONE ICN6211 MIPI-DSI to RGB CONVERTOR BRIDGE
^^^^^^^^^


> +M: Jagan Teki <[email protected]>
> +S: Maintained
> +F: drivers/gpu/drm/bridge/chipone-icn6211.c
> +F: Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml

WARNING: Misordered MAINTAINERS entry - list file patterns in alphabetic order
#34: FILE: MAINTAINERS:5537:
+F: drivers/gpu/drm/bridge/chipone-icn6211.c
+F: Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml


> +
> DRM DRIVER FOR FARADAY TVE200 TV ENCODER
> M: Linus Walleij <[email protected]>
> S: Maintained
> diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
> index e4110d6ca7b3..49d1565b7f25 100644
> --- a/drivers/gpu/drm/bridge/Kconfig
> +++ b/drivers/gpu/drm/bridge/Kconfig
> @@ -27,6 +27,17 @@ config DRM_CDNS_DSI
> Support Cadence DPI to DSI bridge. This is an internal
> bridge and is meant to be directly embedded in a SoC.
>
> +config DRM_CHIPONE_ICN6211
> + tristate "Chipone ICN6211 MIPI-DSI/RGB Convertor bridge"

WARNING: 'Convertor' may be misspelled - perhaps 'Converter'?
#48: FILE: drivers/gpu/drm/bridge/Kconfig:31:
+ tristate "Chipone ICN6211 MIPI-DSI/RGB Convertor bridge"
^^^^^^^^^


> + depends on OF
> + select DRM_MIPI_DSI
> + select DRM_PANEL_BRIDGE
> + help
> + ICN6211 is MIPI-DSI/RGB Convertor bridge from chipone.

WARNING: 'Convertor' may be misspelled - perhaps 'Converter'?
#53: FILE: drivers/gpu/drm/bridge/Kconfig:36:
+ ICN6211 is MIPI-DSI/RGB Convertor bridge from chipone.
^^^^^^^^^

> +
> + It has a flexible configuration of MIPI DSI signal input
> + and produce RGB565, RGB666, RGB888 output format.
> +

WARNING: please write a paragraph that describes the config symbol fully
#47: FILE: drivers/gpu/drm/bridge/Kconfig:30:
+config DRM_CHIPONE_ICN6211


> config DRM_CHRONTEL_CH7033
> tristate "Chrontel CH7033 Video Encoder"
> depends on OF
> diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
> index 86e7acc76f8d..3eb84b638988 100644
> --- a/drivers/gpu/drm/bridge/Makefile
> +++ b/drivers/gpu/drm/bridge/Makefile
> @@ -1,5 +1,6 @@
> # SPDX-License-Identifier: GPL-2.0
> 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_LT9611) += lontium-lt9611.o
> diff --git a/drivers/gpu/drm/bridge/chipone-icn6211.c b/drivers/gpu/drm/bridge/chipone-icn6211.c
> new file mode 100644
> index 000000000000..3f478f21a4a5
> --- /dev/null
> +++ b/drivers/gpu/drm/bridge/chipone-icn6211.c
> @@ -0,0 +1,222 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright (C) 2020 Amarula Solutions(India)

2020-2021?

> + * Author: Jagan Teki <[email protected]>
> + */
> +
> +#include <drm/drm_of.h>
> +#include <drm/drm_print.h>
> +#include <drm/drm_mipi_dsi.h>
> +
> +#include <linux/delay.h>
> +#include <linux/gpio/consumer.h>
> +#include <linux/module.h>
> +#include <linux/of_device.h>
> +
> +#include <video/mipi_display.h>
> +
> +struct chipone {
> + struct device *dev;
> + struct drm_bridge bridge;
> + struct drm_bridge *panel_bridge;
> + struct gpio_desc *reset_gpio;
> +};
> +
> +static inline struct chipone *bridge_to_chipone(struct drm_bridge *bridge)
> +{
> + return container_of(bridge, struct chipone, bridge);
> +}
> +
> +static struct drm_display_mode *bridge_to_mode(struct drm_bridge *bridge)
> +{
> + return &bridge->encoder->crtc->state->adjusted_mode;
> +}
> +
> +static void chipone_post_disable(struct drm_bridge *bridge)
> +{
> + struct chipone *icn = bridge_to_chipone(bridge);
> +
> + gpiod_set_value(icn->reset_gpio, 0);
> +
> + msleep(50);
> +}
> +
> +static inline int chipone_dsi_write(struct chipone *icn, const void *seq,
> + size_t len)
> +{
> + struct mipi_dsi_device *dsi = to_mipi_dsi_device(icn->dev);
> +
> + return mipi_dsi_generic_write(dsi, seq, len);
> +}
> +
> +#define CHIPONE_DSI(icn, seq...) \
> + { \
> + const u8 d[] = { seq }; \
> + chipone_dsi_write(icn, d, ARRAY_SIZE(d)); \
> + }
> +
> +static void chipone_enable(struct drm_bridge *bridge)
> +{
> + struct chipone *icn = bridge_to_chipone(bridge);
> + struct drm_display_mode *mode = bridge_to_mode(bridge);
> +
> + CHIPONE_DSI(icn, 0x7A, 0xC1);
> +
> + /* lower 8 bits of hdisplay */
> + CHIPONE_DSI(icn, 0x20, mode->hdisplay & 0xff);
> +
> + /* lower 8 bits of vdisplay */
> + CHIPONE_DSI(icn, 0x21, mode->vdisplay & 0xff);
> +
> + /**
> + * lsb nibble: 2nd nibble of hdisplay
> + * msb nibble: 2nd nibble of vdisplay
> + */
> + CHIPONE_DSI(icn, 0x22, (((mode->hdisplay >> 8) & 0xf) |
> + (((mode->vdisplay >> 8) & 0xf) << 4)));
> +
> + /* HFP */
> + CHIPONE_DSI(icn, 0x23, mode->hsync_start - mode->hdisplay);
> +
> + /* HSYNC */
> + CHIPONE_DSI(icn, 0x24, mode->hsync_end - mode->hsync_start);
> +
> + /* HBP */
> + CHIPONE_DSI(icn, 0x25, mode->htotal - mode->hsync_end);
> +
> + CHIPONE_DSI(icn, 0x26, 0x00);
> +
> + /* VFP */
> + CHIPONE_DSI(icn, 0x27, mode->vsync_start - mode->vdisplay);
> +
> + /* VSYNC */
> + CHIPONE_DSI(icn, 0x28, mode->vsync_end - mode->vsync_start);
> +
> + /* VBP */
> + CHIPONE_DSI(icn, 0x29, mode->vtotal - mode->vsync_end);
> +
> + /* dsi specific sequence */
> + CHIPONE_DSI(icn, MIPI_DCS_SET_TEAR_OFF, 0x80);
> + CHIPONE_DSI(icn, MIPI_DCS_SET_ADDRESS_MODE, 0x28);
> + CHIPONE_DSI(icn, 0xB5, 0xA0);
> + CHIPONE_DSI(icn, 0x5C, 0xFF);
> + CHIPONE_DSI(icn, MIPI_DCS_SET_COLUMN_ADDRESS, 0x01);
> + CHIPONE_DSI(icn, MIPI_DCS_GET_POWER_SAVE, 0x92);
> + CHIPONE_DSI(icn, 0x6B, 0x71);
> + CHIPONE_DSI(icn, 0x69, 0x2B);
> + CHIPONE_DSI(icn, MIPI_DCS_ENTER_SLEEP_MODE, 0x40);
> + CHIPONE_DSI(icn, MIPI_DCS_EXIT_SLEEP_MODE, 0x98);
> +
> + /* icn6211 specific sequence */
> + CHIPONE_DSI(icn, 0xB6, 0x20);
> + CHIPONE_DSI(icn, 0x51, 0x20);
> + CHIPONE_DSI(icn, 0x09, 0x10);
> +
> + msleep(120);
> +}
> +
> +static void chipone_pre_enable(struct drm_bridge *bridge)
> +{
> + struct chipone *icn = bridge_to_chipone(bridge);
> +
> + gpiod_set_value(icn->reset_gpio, 1);
> + msleep(20);
> +
> + gpiod_set_value(icn->reset_gpio, 0);
> + msleep(20);
> +
> + gpiod_set_value(icn->reset_gpio, 1);
> + msleep(50);
> +}
> +
> +static int chipone_attach(struct drm_bridge *bridge, enum drm_bridge_attach_flags flags)
> +{
> + struct chipone *icn = bridge_to_chipone(bridge);
> +
> + return drm_bridge_attach(bridge->encoder, icn->panel_bridge, bridge, flags);
> +}
> +
> +static const struct drm_bridge_funcs chipone_bridge_funcs = {
> + .post_disable = chipone_post_disable,
> + .enable = chipone_enable,
> + .pre_enable = chipone_pre_enable,
> + .attach = chipone_attach,
> +};
> +
> +static int chipone_probe(struct mipi_dsi_device *dsi)
> +{
> + struct device *dev = &dsi->dev;
> + struct drm_panel *panel;
> + struct chipone *icn;
> + int ret;
> +
> + icn = devm_kzalloc(dev, sizeof(struct chipone), GFP_KERNEL);
> + if (!icn)
> + return -ENOMEM;
> +
> + mipi_dsi_set_drvdata(dsi, icn);
> + icn->dev = dev;
> +
> + dsi->mode_flags = MIPI_DSI_MODE_VIDEO_SYNC_PULSE;
> + dsi->format = MIPI_DSI_FMT_RGB888;
> + dsi->lanes = 4;
> +
> + icn->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);
> + if (IS_ERR(icn->reset_gpio)) {
> + DRM_DEV_ERROR(dev, "failed to get reset GPIO\n");
> + return PTR_ERR(icn->reset_gpio);
> + }
> +
> + ret = drm_of_find_panel_or_bridge(dev->of_node, 1, 0, &panel, NULL);
> + if (ret)
> + return ret;
> +
> + icn->panel_bridge = devm_drm_panel_bridge_add(dev, panel);
> + if (IS_ERR(icn->panel_bridge))
> + return PTR_ERR(icn->panel_bridge);
> +
> + icn->bridge.funcs = &chipone_bridge_funcs;
> + icn->bridge.type = DRM_MODE_CONNECTOR_DPI;
> + icn->bridge.of_node = dev->of_node;
> +
> + drm_bridge_add(&icn->bridge);
> +
> + ret = mipi_dsi_attach(dsi);
> + if (ret < 0) {
> + drm_bridge_remove(&icn->bridge);
> + dev_err(dev, "failed to attach dsi\n");
> + }
> +
> + return ret;
> +}
> +
> +static int chipone_remove(struct mipi_dsi_device *dsi)
> +{
> + struct chipone *icn = mipi_dsi_get_drvdata(dsi);
> +
> + mipi_dsi_detach(dsi);
> + drm_bridge_remove(&icn->bridge);
> +
> + return 0;
> +}
> +
> +static const struct of_device_id chipone_of_match[] = {
> + { .compatible = "chipone,icn6211", },
> + { /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(of, chipone_of_match);
> +
> +static struct mipi_dsi_driver chipone_driver = {
> + .probe = chipone_probe,
> + .remove = chipone_remove,
> + .driver = {
> + .name = "chipone-icn6211",
> + .owner = THIS_MODULE,
> + .of_match_table = chipone_of_match,
> + },
> +};
> +module_mipi_dsi_driver(chipone_driver);
> +
> +MODULE_AUTHOR("Jagan Teki <[email protected]>");
> +MODULE_DESCRIPTION("Chipone ICN6211 MIPI-DSI to RGB Convertor Bridge");

WARNING: 'Convertor' may be misspelled - perhaps 'Converter'?
#298: FILE: drivers/gpu/drm/bridge/chipone-icn6211.c:221:
+MODULE_DESCRIPTION("Chipone ICN6211 MIPI-DSI to RGB Convertor Bridge");
^^^^^^^^^


> +MODULE_LICENSE("GPL");
> --
> 2.25.1
>

2021-02-15 12:23:04

by Laurent Pinchart

[permalink] [raw]
Subject: Re: [PATCH v3 1/2] dt-bindings: display: bridge: Add bindings for Chipone ICN6211

Hi Jagan,

Thank you for the patch.

On Sun, Feb 14, 2021 at 11:22:10PM +0530, Jagan Teki wrote:
> ICN6211 is MIPI-DSI to RGB Convertor bridge from Chipone.
>
> It has a flexible configuration of MIPI DSI signal input and
> produce RGB565, RGB666, RGB888 output format.
>
> Add dt-bingings for it.
>
> Signed-off-by: Jagan Teki <[email protected]>
> ---
> Changes for v3:
> - updated to new dt-bindings style
>
> .../display/bridge/chipone,icn6211.yaml | 90 +++++++++++++++++++
> 1 file changed, 90 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml
>
> diff --git a/Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml b/Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml
> new file mode 100644
> index 000000000000..13764f13fe46
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml
> @@ -0,0 +1,90 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/display/bridge/chipone,icn6211.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Chipone ICN6211 MIPI-DSI to RGB Converter bridge
> +
> +maintainers:
> + - Jagan Teki <[email protected]>
> +
> +description: |
> + ICN6211 is MIPI-DSI to RGB Convertor bridge from chipone.
> +
> + It has a flexible configuration of MIPI DSI signal input and
> + produce RGB565, RGB666, RGB888 output format.

How does one select between the output formats ? Should the output
connection option be described in the device tree ?

> +
> +properties:
> + compatible:
> + enum:
> + - chipone,icn6211
> +
> + reg:
> + maxItems: 1
> + description: virtual channel number of a DSI peripheral
> +
> + reset-gpios:
> + description: GPIO connected for the reset pin
> +
> + ports:
> + $ref: /schemas/graph.yaml#/properties/ports
> +
> + properties:
> + port@0:
> + $ref: /schemas/graph.yaml#/properties/port
> + description:
> + Video port for MIPI DSI input
> +
> + port@1:
> + $ref: /schemas/graph.yaml#/properties/port
> + description:
> + Video port for MIPI DPI output (panel or connector).
> +
> + required:
> + - port@0
> + - port@1
> +
> +required:
> + - compatible
> + - reg
> + - reset-gpios
> + - ports

How about regulators ?

> +
> +additionalProperties: false
> +
> +examples:
> + - |
> + #include <dt-bindings/gpio/gpio.h>
> +
> + dsi {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + bridge@0 {
> + compatible = "chipone,icn6211";
> + reg = <0>;
> + reset-gpios = <&r_pio 0 5 GPIO_ACTIVE_HIGH>; /* LCD-RST: PL5 */
> +
> + ports {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + bridge_in: port@0 {

You can drop this label.

> + reg = <0>;
> +
> + bridge_out_dsi: endpoint {

This label should be bridge_in_dsi.

> + remote-endpoint = <&dsi_out_bridge>;
> + };
> + };
> +
> + bridge_out: port@1 {

You can drop this label too.

> + reg = <1>;
> +
> + bridge_out_panel: endpoint {
> + remote-endpoint = <&panel_out_bridge>;
> + };
> + };
> + };
> + };
> + };

--
Regards,

Laurent Pinchart

2021-02-24 13:18:34

by Jagan Teki

[permalink] [raw]
Subject: Re: [PATCH v3 1/2] dt-bindings: display: bridge: Add bindings for Chipone ICN6211

Hi Laurent,

On Mon, Feb 15, 2021 at 5:48 PM Laurent Pinchart
<[email protected]> wrote:
>
> Hi Jagan,
>
> Thank you for the patch.
>
> On Sun, Feb 14, 2021 at 11:22:10PM +0530, Jagan Teki wrote:
> > ICN6211 is MIPI-DSI to RGB Convertor bridge from Chipone.
> >
> > It has a flexible configuration of MIPI DSI signal input and
> > produce RGB565, RGB666, RGB888 output format.
> >
> > Add dt-bingings for it.
> >
> > Signed-off-by: Jagan Teki <[email protected]>
> > ---
> > Changes for v3:
> > - updated to new dt-bindings style
> >
> > .../display/bridge/chipone,icn6211.yaml | 90 +++++++++++++++++++
> > 1 file changed, 90 insertions(+)
> > create mode 100644 Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml
> >
> > diff --git a/Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml b/Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml
> > new file mode 100644
> > index 000000000000..13764f13fe46
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml
> > @@ -0,0 +1,90 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/display/bridge/chipone,icn6211.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Chipone ICN6211 MIPI-DSI to RGB Converter bridge
> > +
> > +maintainers:
> > + - Jagan Teki <[email protected]>
> > +
> > +description: |
> > + ICN6211 is MIPI-DSI to RGB Convertor bridge from chipone.
> > +
> > + It has a flexible configuration of MIPI DSI signal input and
> > + produce RGB565, RGB666, RGB888 output format.
>
> How does one select between the output formats ? Should the output
> connection option be described in the device tree ?

I think that is a good option to select output formats via dts. what
if it makes it a generic property like data-lanes? since it is common
across many other bridges.

>
> > +
> > +properties:
> > + compatible:
> > + enum:
> > + - chipone,icn6211
> > +
> > + reg:
> > + maxItems: 1
> > + description: virtual channel number of a DSI peripheral
> > +
> > + reset-gpios:
> > + description: GPIO connected for the reset pin
> > +
> > + ports:
> > + $ref: /schemas/graph.yaml#/properties/ports
> > +
> > + properties:
> > + port@0:
> > + $ref: /schemas/graph.yaml#/properties/port
> > + description:
> > + Video port for MIPI DSI input
> > +
> > + port@1:
> > + $ref: /schemas/graph.yaml#/properties/port
> > + description:
> > + Video port for MIPI DPI output (panel or connector).
> > +
> > + required:
> > + - port@0
> > + - port@1
> > +
> > +required:
> > + - compatible
> > + - reg
> > + - reset-gpios
> > + - ports
>
> How about regulators ?

Will add it in the next version.

Jagan.

2021-02-24 14:28:44

by Laurent Pinchart

[permalink] [raw]
Subject: Re: [PATCH v3 1/2] dt-bindings: display: bridge: Add bindings for Chipone ICN6211

Hi Jagan,

On Wed, Feb 24, 2021 at 06:07:43PM +0530, Jagan Teki wrote:
> On Mon, Feb 15, 2021 at 5:48 PM Laurent Pinchart wrote:
> > On Sun, Feb 14, 2021 at 11:22:10PM +0530, Jagan Teki wrote:
> > > ICN6211 is MIPI-DSI to RGB Convertor bridge from Chipone.
> > >
> > > It has a flexible configuration of MIPI DSI signal input and
> > > produce RGB565, RGB666, RGB888 output format.
> > >
> > > Add dt-bingings for it.
> > >
> > > Signed-off-by: Jagan Teki <[email protected]>
> > > ---
> > > Changes for v3:
> > > - updated to new dt-bindings style
> > >
> > > .../display/bridge/chipone,icn6211.yaml | 90 +++++++++++++++++++
> > > 1 file changed, 90 insertions(+)
> > > create mode 100644 Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml
> > >
> > > diff --git a/Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml b/Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml
> > > new file mode 100644
> > > index 000000000000..13764f13fe46
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml
> > > @@ -0,0 +1,90 @@
> > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > > +%YAML 1.2
> > > +---
> > > +$id: http://devicetree.org/schemas/display/bridge/chipone,icn6211.yaml#
> > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > +
> > > +title: Chipone ICN6211 MIPI-DSI to RGB Converter bridge
> > > +
> > > +maintainers:
> > > + - Jagan Teki <[email protected]>
> > > +
> > > +description: |
> > > + ICN6211 is MIPI-DSI to RGB Convertor bridge from chipone.
> > > +
> > > + It has a flexible configuration of MIPI DSI signal input and
> > > + produce RGB565, RGB666, RGB888 output format.
> >
> > How does one select between the output formats ? Should the output
> > connection option be described in the device tree ?
>
> I think that is a good option to select output formats via dts. what
> if it makes it a generic property like data-lanes? since it is common
> across many other bridges.

Describing the output connection in the device tree sounds like a good
idea indeed. The bus-width property could be used for this, maybe along
the lines of
https://lore.kernel.org/dri-devel/[email protected]/.

If, for a given wiring of the output, different formats could be used,
then we would need to select them at runtime.

> > > +
> > > +properties:
> > > + compatible:
> > > + enum:
> > > + - chipone,icn6211
> > > +
> > > + reg:
> > > + maxItems: 1
> > > + description: virtual channel number of a DSI peripheral
> > > +
> > > + reset-gpios:
> > > + description: GPIO connected for the reset pin
> > > +
> > > + ports:
> > > + $ref: /schemas/graph.yaml#/properties/ports
> > > +
> > > + properties:
> > > + port@0:
> > > + $ref: /schemas/graph.yaml#/properties/port
> > > + description:
> > > + Video port for MIPI DSI input
> > > +
> > > + port@1:
> > > + $ref: /schemas/graph.yaml#/properties/port
> > > + description:
> > > + Video port for MIPI DPI output (panel or connector).
> > > +
> > > + required:
> > > + - port@0
> > > + - port@1
> > > +
> > > +required:
> > > + - compatible
> > > + - reg
> > > + - reset-gpios
> > > + - ports
> >
> > How about regulators ?
>
> Will add it in the next version.

--
Regards,

Laurent Pinchart

2021-02-25 00:57:21

by Jagan Teki

[permalink] [raw]
Subject: Re: [PATCH v3 1/2] dt-bindings: display: bridge: Add bindings for Chipone ICN6211

Hi Laurent,

On Wed, Feb 24, 2021 at 6:44 PM Laurent Pinchart
<[email protected]> wrote:
>
> Hi Jagan,
>
> On Wed, Feb 24, 2021 at 06:07:43PM +0530, Jagan Teki wrote:
> > On Mon, Feb 15, 2021 at 5:48 PM Laurent Pinchart wrote:
> > > On Sun, Feb 14, 2021 at 11:22:10PM +0530, Jagan Teki wrote:
> > > > ICN6211 is MIPI-DSI to RGB Convertor bridge from Chipone.
> > > >
> > > > It has a flexible configuration of MIPI DSI signal input and
> > > > produce RGB565, RGB666, RGB888 output format.
> > > >
> > > > Add dt-bingings for it.
> > > >
> > > > Signed-off-by: Jagan Teki <[email protected]>
> > > > ---
> > > > Changes for v3:
> > > > - updated to new dt-bindings style
> > > >
> > > > .../display/bridge/chipone,icn6211.yaml | 90 +++++++++++++++++++
> > > > 1 file changed, 90 insertions(+)
> > > > create mode 100644 Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml
> > > >
> > > > diff --git a/Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml b/Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml
> > > > new file mode 100644
> > > > index 000000000000..13764f13fe46
> > > > --- /dev/null
> > > > +++ b/Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml
> > > > @@ -0,0 +1,90 @@
> > > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > > > +%YAML 1.2
> > > > +---
> > > > +$id: http://devicetree.org/schemas/display/bridge/chipone,icn6211.yaml#
> > > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > > +
> > > > +title: Chipone ICN6211 MIPI-DSI to RGB Converter bridge
> > > > +
> > > > +maintainers:
> > > > + - Jagan Teki <[email protected]>
> > > > +
> > > > +description: |
> > > > + ICN6211 is MIPI-DSI to RGB Convertor bridge from chipone.
> > > > +
> > > > + It has a flexible configuration of MIPI DSI signal input and
> > > > + produce RGB565, RGB666, RGB888 output format.
> > >
> > > How does one select between the output formats ? Should the output
> > > connection option be described in the device tree ?
> >
> > I think that is a good option to select output formats via dts. what
> > if it makes it a generic property like data-lanes? since it is common
> > across many other bridges.
>
> Describing the output connection in the device tree sounds like a good
> idea indeed. The bus-width property could be used for this, maybe along
> the lines of
> https://lore.kernel.org/dri-devel/[email protected]/.

I think this bridge is doing, what we discussed? am I correct?
Documentation/devicetree/bindings/display/bridge/ti,tfp410.yaml

>
> If, for a given wiring of the output, different formats could be used,
> then we would need to select them at runtime.

That means the opposite of what mipi_dsi_pixel_format_to_bpp is doing
right? like given bpp we need to select format.

Jagan.

2021-03-04 11:08:55

by Jagan Teki

[permalink] [raw]
Subject: Re: [PATCH v3 1/2] dt-bindings: display: bridge: Add bindings for Chipone ICN6211

On Wed, Feb 24, 2021 at 6:44 PM Laurent Pinchart
<[email protected]> wrote:
>
> Hi Jagan,
>
> On Wed, Feb 24, 2021 at 06:07:43PM +0530, Jagan Teki wrote:
> > On Mon, Feb 15, 2021 at 5:48 PM Laurent Pinchart wrote:
> > > On Sun, Feb 14, 2021 at 11:22:10PM +0530, Jagan Teki wrote:
> > > > ICN6211 is MIPI-DSI to RGB Convertor bridge from Chipone.
> > > >
> > > > It has a flexible configuration of MIPI DSI signal input and
> > > > produce RGB565, RGB666, RGB888 output format.
> > > >
> > > > Add dt-bingings for it.
> > > >
> > > > Signed-off-by: Jagan Teki <[email protected]>
> > > > ---
> > > > Changes for v3:
> > > > - updated to new dt-bindings style
> > > >
> > > > .../display/bridge/chipone,icn6211.yaml | 90 +++++++++++++++++++
> > > > 1 file changed, 90 insertions(+)
> > > > create mode 100644 Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml
> > > >
> > > > diff --git a/Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml b/Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml
> > > > new file mode 100644
> > > > index 000000000000..13764f13fe46
> > > > --- /dev/null
> > > > +++ b/Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml
> > > > @@ -0,0 +1,90 @@
> > > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > > > +%YAML 1.2
> > > > +---
> > > > +$id: http://devicetree.org/schemas/display/bridge/chipone,icn6211.yaml#
> > > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > > +
> > > > +title: Chipone ICN6211 MIPI-DSI to RGB Converter bridge
> > > > +
> > > > +maintainers:
> > > > + - Jagan Teki <[email protected]>
> > > > +
> > > > +description: |
> > > > + ICN6211 is MIPI-DSI to RGB Convertor bridge from chipone.
> > > > +
> > > > + It has a flexible configuration of MIPI DSI signal input and
> > > > + produce RGB565, RGB666, RGB888 output format.
> > >
> > > How does one select between the output formats ? Should the output
> > > connection option be described in the device tree ?
> >
> > I think that is a good option to select output formats via dts. what
> > if it makes it a generic property like data-lanes? since it is common
> > across many other bridges.
>
> Describing the output connection in the device tree sounds like a good
> idea indeed. The bus-width property could be used for this, maybe along
> the lines of
> https://lore.kernel.org/dri-devel/[email protected]/.

I have seen an issue by passing bus-width where the same bus-with 24
can use by RGB888 and RGB666 according to
mipi_dsi_pixel_format_to_bpp. Having a default RGB888 format now and
update it when it supports properly, can be a good Idea I thought of.
Let me know if you have any comments?

Jagan.

2021-03-04 13:26:39

by Laurent Pinchart

[permalink] [raw]
Subject: Re: [PATCH v3 1/2] dt-bindings: display: bridge: Add bindings for Chipone ICN6211

Hi Jagan,

On Wed, Mar 03, 2021 at 08:08:35PM +0530, Jagan Teki wrote:
> On Wed, Feb 24, 2021 at 6:44 PM Laurent Pinchart wrote:
> > On Wed, Feb 24, 2021 at 06:07:43PM +0530, Jagan Teki wrote:
> > > On Mon, Feb 15, 2021 at 5:48 PM Laurent Pinchart wrote:
> > > > On Sun, Feb 14, 2021 at 11:22:10PM +0530, Jagan Teki wrote:
> > > > > ICN6211 is MIPI-DSI to RGB Convertor bridge from Chipone.
> > > > >
> > > > > It has a flexible configuration of MIPI DSI signal input and
> > > > > produce RGB565, RGB666, RGB888 output format.
> > > > >
> > > > > Add dt-bingings for it.
> > > > >
> > > > > Signed-off-by: Jagan Teki <[email protected]>
> > > > > ---
> > > > > Changes for v3:
> > > > > - updated to new dt-bindings style
> > > > >
> > > > > .../display/bridge/chipone,icn6211.yaml | 90 +++++++++++++++++++
> > > > > 1 file changed, 90 insertions(+)
> > > > > create mode 100644 Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml
> > > > >
> > > > > diff --git a/Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml b/Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml
> > > > > new file mode 100644
> > > > > index 000000000000..13764f13fe46
> > > > > --- /dev/null
> > > > > +++ b/Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml
> > > > > @@ -0,0 +1,90 @@
> > > > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > > > > +%YAML 1.2
> > > > > +---
> > > > > +$id: http://devicetree.org/schemas/display/bridge/chipone,icn6211.yaml#
> > > > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > > > +
> > > > > +title: Chipone ICN6211 MIPI-DSI to RGB Converter bridge
> > > > > +
> > > > > +maintainers:
> > > > > + - Jagan Teki <[email protected]>
> > > > > +
> > > > > +description: |
> > > > > + ICN6211 is MIPI-DSI to RGB Convertor bridge from chipone.
> > > > > +
> > > > > + It has a flexible configuration of MIPI DSI signal input and
> > > > > + produce RGB565, RGB666, RGB888 output format.
> > > >
> > > > How does one select between the output formats ? Should the output
> > > > connection option be described in the device tree ?
> > >
> > > I think that is a good option to select output formats via dts. what
> > > if it makes it a generic property like data-lanes? since it is common
> > > across many other bridges.
> >
> > Describing the output connection in the device tree sounds like a good
> > idea indeed. The bus-width property could be used for this, maybe along
> > the lines of
> > https://lore.kernel.org/dri-devel/[email protected]/.
>
> I have seen an issue by passing bus-width where the same bus-with 24
> can use by RGB888 and RGB666 according to
> mipi_dsi_pixel_format_to_bpp. Having a default RGB888 format now and
> update it when it supports properly, can be a good Idea I thought of.
> Let me know if you have any comments?

I'm fine with hardcoding a default for now. If a given bus wiring (which
is described in DT by bus-width) can transport different formats, that's
something that should be configured dynamically, either by querying what
format a sink (such as a panel) requires, or if both the source and the
sink can support different formats, possibly by involving userspace in
the selection.

--
Regards,

Laurent Pinchart

2021-03-05 00:08:15

by Jagan Teki

[permalink] [raw]
Subject: Re: [PATCH v3 1/2] dt-bindings: display: bridge: Add bindings for Chipone ICN6211

Hi Laurent,

On Thu, Mar 4, 2021 at 4:29 AM Laurent Pinchart
<[email protected]> wrote:
>
> Hi Jagan,
>
> On Wed, Mar 03, 2021 at 08:08:35PM +0530, Jagan Teki wrote:
> > On Wed, Feb 24, 2021 at 6:44 PM Laurent Pinchart wrote:
> > > On Wed, Feb 24, 2021 at 06:07:43PM +0530, Jagan Teki wrote:
> > > > On Mon, Feb 15, 2021 at 5:48 PM Laurent Pinchart wrote:
> > > > > On Sun, Feb 14, 2021 at 11:22:10PM +0530, Jagan Teki wrote:
> > > > > > ICN6211 is MIPI-DSI to RGB Convertor bridge from Chipone.
> > > > > >
> > > > > > It has a flexible configuration of MIPI DSI signal input and
> > > > > > produce RGB565, RGB666, RGB888 output format.
> > > > > >
> > > > > > Add dt-bingings for it.
> > > > > >
> > > > > > Signed-off-by: Jagan Teki <[email protected]>
> > > > > > ---
> > > > > > Changes for v3:
> > > > > > - updated to new dt-bindings style
> > > > > >
> > > > > > .../display/bridge/chipone,icn6211.yaml | 90 +++++++++++++++++++
> > > > > > 1 file changed, 90 insertions(+)
> > > > > > create mode 100644 Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml
> > > > > >
> > > > > > diff --git a/Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml b/Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml
> > > > > > new file mode 100644
> > > > > > index 000000000000..13764f13fe46
> > > > > > --- /dev/null
> > > > > > +++ b/Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml
> > > > > > @@ -0,0 +1,90 @@
> > > > > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > > > > > +%YAML 1.2
> > > > > > +---
> > > > > > +$id: http://devicetree.org/schemas/display/bridge/chipone,icn6211.yaml#
> > > > > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > > > > +
> > > > > > +title: Chipone ICN6211 MIPI-DSI to RGB Converter bridge
> > > > > > +
> > > > > > +maintainers:
> > > > > > + - Jagan Teki <[email protected]>
> > > > > > +
> > > > > > +description: |
> > > > > > + ICN6211 is MIPI-DSI to RGB Convertor bridge from chipone.
> > > > > > +
> > > > > > + It has a flexible configuration of MIPI DSI signal input and
> > > > > > + produce RGB565, RGB666, RGB888 output format.
> > > > >
> > > > > How does one select between the output formats ? Should the output
> > > > > connection option be described in the device tree ?
> > > >
> > > > I think that is a good option to select output formats via dts. what
> > > > if it makes it a generic property like data-lanes? since it is common
> > > > across many other bridges.
> > >
> > > Describing the output connection in the device tree sounds like a good
> > > idea indeed. The bus-width property could be used for this, maybe along
> > > the lines of
> > > https://lore.kernel.org/dri-devel/[email protected]/.
> >
> > I have seen an issue by passing bus-width where the same bus-with 24
> > can use by RGB888 and RGB666 according to
> > mipi_dsi_pixel_format_to_bpp. Having a default RGB888 format now and
> > update it when it supports properly, can be a good Idea I thought of.
> > Let me know if you have any comments?
>
> I'm fine with hardcoding a default for now. If a given bus wiring (which
> is described in DT by bus-width) can transport different formats, that's
> something that should be configured dynamically, either by querying what
> format a sink (such as a panel) requires, or if both the source and the
> sink can support different formats, possibly by involving userspace in
> the selection.

Not sure how we can get userspace involvement in DRM here, but if
source and sink can have different formats then having precedence to
the source would be a good option as it handles low-level
configuration for formats.

Look like it is worth trying-feature. Maybe we can come up with some
RFC and have a discussion.

Jagan.

2021-03-05 21:41:48

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH v3 1/2] dt-bindings: display: bridge: Add bindings for Chipone ICN6211

On Mon, Feb 15, 2021 at 05:38:16PM +0530, Jagan Teki wrote:
> On Mon, Feb 15, 2021 at 5:28 PM Robert Foss <[email protected]> wrote:
> >
> > Hey Jagan,
> >
> > Thanks for submitting this.
> >
> > checkpatch.pl threw some typ-o warnings, and I listed them below. I
> > think either spelling is correct, but 'spelling.txt' does list this as
> > a typ-o explicitly, so I would suggest conforming to that just to
> > silence the checkpatch warning.
> >
> > This patch also passes 'dt_binding_check' and 'dtbs_check', but I
> > think I'd like to defer to Rob Herring for an actual r-b.
> >
> > On Sun, 14 Feb 2021 at 18:55, Jagan Teki <[email protected]> wrote:
> > >
> > > ICN6211 is MIPI-DSI to RGB Convertor bridge from Chipone.
> > >
> > > It has a flexible configuration of MIPI DSI signal input and
> > > produce RGB565, RGB666, RGB888 output format.
> > >
> > > Add dt-bingings for it.
> > >
> > > Signed-off-by: Jagan Teki <[email protected]>
> > > ---
> > > Changes for v3:
> > > - updated to new dt-bindings style
> > >
> > > .../display/bridge/chipone,icn6211.yaml | 90 +++++++++++++++++++
> > > 1 file changed, 90 insertions(+)
> > > create mode 100644 Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml
> > >
> > > diff --git a/Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml b/Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml
> > > new file mode 100644
> > > index 000000000000..13764f13fe46
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml
> > > @@ -0,0 +1,90 @@
> > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > > +%YAML 1.2
> > > +---
> > > +$id: http://devicetree.org/schemas/display/bridge/chipone,icn6211.yaml#
> > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > +
> > > +title: Chipone ICN6211 MIPI-DSI to RGB Converter bridge
> >
> > $ scripts/checkpatch.pl --git HEAD~0
> > WARNING: 'Convertor' may be misspelled - perhaps 'Converter'?
>
> Thanks for pointing it.
>
> I was aware of it before sending it and need to understand whether we
> need to use vendor naming conversion or not. Chipone call these
> devices are Convertor [1], So I have used the vendor notation for
> better understanding.
>
> Any comments are this would be welcome?

Fix their spelling. If you need to propagate spelling/grammar errors,
there's a defined way to do so.

Rob

>
> [1] http://en.chiponeic.com/content/details45_123.html
>
> Jagan.

2021-03-05 21:42:38

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH v3 1/2] dt-bindings: display: bridge: Add bindings for Chipone ICN6211

On Sun, 14 Feb 2021 23:22:10 +0530, Jagan Teki wrote:
> ICN6211 is MIPI-DSI to RGB Convertor bridge from Chipone.
>
> It has a flexible configuration of MIPI DSI signal input and
> produce RGB565, RGB666, RGB888 output format.
>
> Add dt-bingings for it.
>
> Signed-off-by: Jagan Teki <[email protected]>
> ---
> Changes for v3:
> - updated to new dt-bindings style
>
> .../display/bridge/chipone,icn6211.yaml | 90 +++++++++++++++++++
> 1 file changed, 90 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/display/bridge/chipone,icn6211.yaml
>

Reviewed-by: Rob Herring <[email protected]>