2020-02-13 14:54:45

by Enric Balletbo i Serra

[permalink] [raw]
Subject: [PATCH v2 1/2] Documentation: bindings: Add ANX7688 HDMI to DP bridge binding

From: Nicolas Boichat <[email protected]>

Add documentation for DT properties supported by anx7688 HDMI-DP
converter.

Signed-off-by: Nicolas Boichat <[email protected]>
Signed-off-by: Hsin-Yi Wang <[email protected]>
Signed-off-by: Enric Balletbo i Serra <[email protected]>
---

Changes in v2:
- Improve a bit the descriptions using the info from the datasheet.
- Convert binding to yaml.
- Use dual licensing.

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

diff --git a/Documentation/devicetree/bindings/display/bridge/anx7688.yaml b/Documentation/devicetree/bindings/display/bridge/anx7688.yaml
new file mode 100644
index 000000000000..c1b4b5191d44
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/anx7688.yaml
@@ -0,0 +1,79 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/bridge/anx7688.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Analogix ANX7688 HDMI to USB Type-C Bridge (Port Controller with MUX)
+
+maintainers:
+ - Nicolas Boichat <[email protected]>
+ - Enric Balletbo i Serra <[email protected]>
+
+description: |
+ The ANX7688 is a single-chip mobile transmitter to support 4K 60 frames per
+ second (4096x2160p60) or FHD 120 frames per second (1920x1080p120) video
+ resolution from a smartphone or tablet with full function USB-C.
+
+ This binding only describes the HDMI to DP display bridge.
+
+properties:
+ compatible:
+ const: analogix,anx7688
+
+ reg:
+ maxItems: 1
+ description: I2C address of the device
+
+ ports:
+ type: object
+
+ properties:
+ port@0:
+ type: object
+ description: |
+ Video port for HDMI input
+
+ port@1:
+ type: object
+ description: |
+ Video port for DP output
+
+ required:
+ - port@0
+
+required:
+ - compatible
+ - reg
+ - ports
+
+examples:
+ - |
+ i2c0 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ anx7688: dp-bridge@2c {
+ compatible = "analogix,anx7688";
+ reg = <0x2c>;
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port@0 {
+ reg = <0>;
+ anx7866_in: endpoint {
+ remote-endpoint = <&hdmi0_out>;
+ };
+ };
+
+ port@1 {
+ reg = <1>;
+ anx7866_out: endpoint {
+ remote-endpoint = <&panel_in>;
+ };
+ };
+ };
+ };
+ };
--
2.25.0


2020-02-13 14:54:48

by Enric Balletbo i Serra

[permalink] [raw]
Subject: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support

From: Nicolas Boichat <[email protected]>

ANX7688 is a HDMI to DP converter (as well as USB-C port controller),
that has an internal microcontroller.

The only reason a Linux kernel driver is necessary is to reject
resolutions that require more bandwidth than what is available on
the DP side. DP bandwidth and lane count are reported by the bridge
via 2 registers on I2C.

Signed-off-by: Nicolas Boichat <[email protected]>
Signed-off-by: Hsin-Yi Wang <[email protected]>
Signed-off-by: Enric Balletbo i Serra <[email protected]>
---

Changes in v2:
- Move driver to drivers/gpu/drm/bridge/analogix.
- Make the driver OF only so we can reduce the ifdefs.
- Update the Copyright to 2020.
- Use probe_new so we can get rid of the i2c_device_id table.

drivers/gpu/drm/bridge/analogix/Kconfig | 12 ++
drivers/gpu/drm/bridge/analogix/Makefile | 1 +
.../drm/bridge/analogix/analogix-anx7688.c | 188 ++++++++++++++++++
3 files changed, 201 insertions(+)
create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-anx7688.c

diff --git a/drivers/gpu/drm/bridge/analogix/Kconfig b/drivers/gpu/drm/bridge/analogix/Kconfig
index e1fa7d820373..af7c2939403c 100644
--- a/drivers/gpu/drm/bridge/analogix/Kconfig
+++ b/drivers/gpu/drm/bridge/analogix/Kconfig
@@ -11,6 +11,18 @@ config DRM_ANALOGIX_ANX6345
ANX6345 transforms the LVTTL RGB output of an
application processor to eDP or DisplayPort.

+config DRM_ANALOGIX_ANX7688
+ tristate "Analogix ANX7688 bridge"
+ depends on OF
+ select DRM_KMS_HELPER
+ select REGMAP_I2C
+ help
+ ANX7688 is an ultra-low power 4k Ultra-HD (4096x2160p60)
+ mobile HD transmitter designed for portable devices. The
+ ANX7688 converts HDMI 2.0 to DisplayPort 1.3 Ultra-HD
+ including an intelligent crosspoint switch to support
+ USB Type-C.
+
config DRM_ANALOGIX_ANX78XX
tristate "Analogix ANX78XX bridge"
select DRM_ANALOGIX_DP
diff --git a/drivers/gpu/drm/bridge/analogix/Makefile b/drivers/gpu/drm/bridge/analogix/Makefile
index 97669b374098..27cd73635c8c 100644
--- a/drivers/gpu/drm/bridge/analogix/Makefile
+++ b/drivers/gpu/drm/bridge/analogix/Makefile
@@ -1,5 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only
analogix_dp-objs := analogix_dp_core.o analogix_dp_reg.o analogix-i2c-dptx.o
obj-$(CONFIG_DRM_ANALOGIX_ANX6345) += analogix-anx6345.o
+obj-$(CONFIG_DRM_ANALOGIX_ANX7688) += analogix-anx7688.o
obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix_dp.o
diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c b/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
new file mode 100644
index 000000000000..10a7cd0f9126
--- /dev/null
+++ b/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
@@ -0,0 +1,188 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * ANX7688 HDMI->DP bridge driver
+ *
+ * Copyright 2020 Google LLC
+ */
+
+#include <linux/i2c.h>
+#include <linux/module.h>
+#include <linux/regmap.h>
+#include <drm/drm_bridge.h>
+
+/* Register addresses */
+#define VENDOR_ID_REG 0x00
+#define DEVICE_ID_REG 0x02
+
+#define FW_VERSION_REG 0x80
+
+#define DP_BANDWIDTH_REG 0x85
+#define DP_LANE_COUNT_REG 0x86
+
+#define VENDOR_ID 0x1f29
+#define DEVICE_ID 0x7688
+
+/* First supported firmware version (0.85) */
+#define MINIMUM_FW_VERSION 0x0085
+
+struct anx7688 {
+ struct drm_bridge bridge;
+ struct i2c_client *client;
+ struct regmap *regmap;
+
+ bool filter;
+};
+
+static inline struct anx7688 *bridge_to_anx7688(struct drm_bridge *bridge)
+{
+ return container_of(bridge, struct anx7688, bridge);
+}
+
+static bool anx7688_bridge_mode_fixup(struct drm_bridge *bridge,
+ const struct drm_display_mode *mode,
+ struct drm_display_mode *adjusted_mode)
+{
+ struct anx7688 *anx7688 = bridge_to_anx7688(bridge);
+ int totalbw, requiredbw;
+ u8 dpbw, lanecount;
+ u8 regs[2];
+ int ret;
+
+ if (!anx7688->filter)
+ return true;
+
+ /* Read both regs 0x85 (bandwidth) and 0x86 (lane count). */
+ ret = regmap_bulk_read(anx7688->regmap, DP_BANDWIDTH_REG, regs, 2);
+ if (ret < 0) {
+ dev_err(&anx7688->client->dev,
+ "Failed to read bandwidth/lane count\n");
+ return false;
+ }
+ dpbw = regs[0];
+ lanecount = regs[1];
+
+ /* Maximum 0x19 bandwidth (6.75 Gbps Turbo mode), 2 lanes */
+ if (dpbw > 0x19 || lanecount > 2) {
+ dev_err(&anx7688->client->dev,
+ "Invalid bandwidth/lane count (%02x/%d)\n",
+ dpbw, lanecount);
+ return false;
+ }
+
+ /* Compute available bandwidth (kHz) */
+ totalbw = dpbw * lanecount * 270000 * 8 / 10;
+
+ /* Required bandwidth (8 bpc, kHz) */
+ requiredbw = mode->clock * 8 * 3;
+
+ dev_dbg(&anx7688->client->dev,
+ "DP bandwidth: %d kHz (%02x/%d); mode requires %d Khz\n",
+ totalbw, dpbw, lanecount, requiredbw);
+
+ if (totalbw == 0) {
+ dev_warn(&anx7688->client->dev,
+ "Bandwidth/lane count are 0, not rejecting modes\n");
+ return true;
+ }
+
+ return totalbw >= requiredbw;
+}
+
+static const struct drm_bridge_funcs anx7688_bridge_funcs = {
+ .mode_fixup = anx7688_bridge_mode_fixup,
+};
+
+static const struct regmap_config anx7688_regmap_config = {
+ .reg_bits = 8,
+ .val_bits = 8,
+};
+
+static int anx7688_i2c_probe(struct i2c_client *client)
+{
+ struct device *dev = &client->dev;
+ struct anx7688 *anx7688;
+ u16 vendor, device;
+ u16 fwversion;
+ u8 buffer[4];
+ int ret;
+
+ anx7688 = devm_kzalloc(dev, sizeof(*anx7688), GFP_KERNEL);
+ if (!anx7688)
+ return -ENOMEM;
+
+ anx7688->bridge.of_node = dev->of_node;
+ anx7688->client = client;
+ i2c_set_clientdata(client, anx7688);
+
+ anx7688->regmap = devm_regmap_init_i2c(client, &anx7688_regmap_config);
+
+ /* Read both vendor and device id (4 bytes). */
+ ret = regmap_bulk_read(anx7688->regmap, VENDOR_ID_REG, buffer, 4);
+ if (ret) {
+ dev_err(dev, "Failed to read chip vendor/device id\n");
+ return ret;
+ }
+
+ vendor = (u16)buffer[1] << 8 | buffer[0];
+ device = (u16)buffer[3] << 8 | buffer[2];
+ if (vendor != VENDOR_ID || device != DEVICE_ID) {
+ dev_err(dev, "Invalid vendor/device id %04x/%04x\n",
+ vendor, device);
+ return -ENODEV;
+ }
+
+ ret = regmap_bulk_read(anx7688->regmap, FW_VERSION_REG, buffer, 2);
+ if (ret) {
+ dev_err(&client->dev, "Failed to read firmware version\n");
+ return ret;
+ }
+
+ fwversion = (u16)buffer[0] << 8 | buffer[1];
+ dev_info(dev, "ANX7688 firwmare version %02x.%02x\n",
+ buffer[0], buffer[1]);
+
+ /* FW version >= 0.85 supports bandwidth/lane count registers */
+ if (fwversion >= MINIMUM_FW_VERSION) {
+ anx7688->filter = true;
+ } else {
+ /* Warn, but not fail, for backwards compatibility. */
+ dev_warn(dev,
+ "Old ANX7688 FW version (%02x.%02x), not filtering\n",
+ buffer[0], buffer[1]);
+ }
+
+ anx7688->bridge.funcs = &anx7688_bridge_funcs;
+ drm_bridge_add(&anx7688->bridge);
+
+ return 0;
+}
+
+static int anx7688_i2c_remove(struct i2c_client *client)
+{
+ struct anx7688 *anx7688 = i2c_get_clientdata(client);
+
+ drm_bridge_remove(&anx7688->bridge);
+
+ return 0;
+}
+
+static const struct of_device_id anx7688_match_table[] = {
+ { .compatible = "analogix,anx7688", },
+ { }
+};
+MODULE_DEVICE_TABLE(of, anx7688_match_table);
+
+static struct i2c_driver anx7688_driver = {
+ .probe_new = anx7688_i2c_probe,
+ .remove = anx7688_i2c_remove,
+ .driver = {
+ .name = "anx7688",
+ .of_match_table = anx7688_match_table,
+ },
+};
+
+module_i2c_driver(anx7688_driver);
+
+MODULE_DESCRIPTION("ANX7688 HDMI->DP bridge driver");
+MODULE_AUTHOR("Nicolas Boichat <[email protected]>");
+MODULE_LICENSE("GPL");
--
2.25.0

2020-02-14 12:20:08

by Andrzej Hajda

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support

On 13.02.2020 15:54, Enric Balletbo i Serra wrote:
> From: Nicolas Boichat <[email protected]>
>
> ANX7688 is a HDMI to DP converter (as well as USB-C port controller),
> that has an internal microcontroller.
>
> The only reason a Linux kernel driver is necessary is to reject
> resolutions that require more bandwidth than what is available on
> the DP side. DP bandwidth and lane count are reported by the bridge
> via 2 registers on I2C.
>
> Signed-off-by: Nicolas Boichat <[email protected]>
> Signed-off-by: Hsin-Yi Wang <[email protected]>
> Signed-off-by: Enric Balletbo i Serra <[email protected]>
> ---
>
> Changes in v2:
> - Move driver to drivers/gpu/drm/bridge/analogix.
> - Make the driver OF only so we can reduce the ifdefs.
> - Update the Copyright to 2020.
> - Use probe_new so we can get rid of the i2c_device_id table.
>
> drivers/gpu/drm/bridge/analogix/Kconfig | 12 ++
> drivers/gpu/drm/bridge/analogix/Makefile | 1 +
> .../drm/bridge/analogix/analogix-anx7688.c | 188 ++++++++++++++++++
> 3 files changed, 201 insertions(+)
> create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
>
> diff --git a/drivers/gpu/drm/bridge/analogix/Kconfig b/drivers/gpu/drm/bridge/analogix/Kconfig
> index e1fa7d820373..af7c2939403c 100644
> --- a/drivers/gpu/drm/bridge/analogix/Kconfig
> +++ b/drivers/gpu/drm/bridge/analogix/Kconfig
> @@ -11,6 +11,18 @@ config DRM_ANALOGIX_ANX6345
> ANX6345 transforms the LVTTL RGB output of an
> application processor to eDP or DisplayPort.
>
> +config DRM_ANALOGIX_ANX7688
> + tristate "Analogix ANX7688 bridge"
> + depends on OF
> + select DRM_KMS_HELPER
> + select REGMAP_I2C
> + help
> + ANX7688 is an ultra-low power 4k Ultra-HD (4096x2160p60)
> + mobile HD transmitter designed for portable devices. The
> + ANX7688 converts HDMI 2.0 to DisplayPort 1.3 Ultra-HD
> + including an intelligent crosspoint switch to support
> + USB Type-C.
> +
> config DRM_ANALOGIX_ANX78XX
> tristate "Analogix ANX78XX bridge"
> select DRM_ANALOGIX_DP
> diff --git a/drivers/gpu/drm/bridge/analogix/Makefile b/drivers/gpu/drm/bridge/analogix/Makefile
> index 97669b374098..27cd73635c8c 100644
> --- a/drivers/gpu/drm/bridge/analogix/Makefile
> +++ b/drivers/gpu/drm/bridge/analogix/Makefile
> @@ -1,5 +1,6 @@
> # SPDX-License-Identifier: GPL-2.0-only
> analogix_dp-objs := analogix_dp_core.o analogix_dp_reg.o analogix-i2c-dptx.o
> obj-$(CONFIG_DRM_ANALOGIX_ANX6345) += analogix-anx6345.o
> +obj-$(CONFIG_DRM_ANALOGIX_ANX7688) += analogix-anx7688.o
> obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
> obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix_dp.o
> diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c b/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> new file mode 100644
> index 000000000000..10a7cd0f9126
> --- /dev/null
> +++ b/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> @@ -0,0 +1,188 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * ANX7688 HDMI->DP bridge driver
> + *
> + * Copyright 2020 Google LLC
> + */
> +
> +#include <linux/i2c.h>
> +#include <linux/module.h>
> +#include <linux/regmap.h>
> +#include <drm/drm_bridge.h>
> +
> +/* Register addresses */
> +#define VENDOR_ID_REG 0x00
> +#define DEVICE_ID_REG 0x02
> +
> +#define FW_VERSION_REG 0x80
> +
> +#define DP_BANDWIDTH_REG 0x85
> +#define DP_LANE_COUNT_REG 0x86
> +
> +#define VENDOR_ID 0x1f29
> +#define DEVICE_ID 0x7688
> +
> +/* First supported firmware version (0.85) */
> +#define MINIMUM_FW_VERSION 0x0085
> +
> +struct anx7688 {
> + struct drm_bridge bridge;
> + struct i2c_client *client;
> + struct regmap *regmap;
> +
> + bool filter;
> +};
> +
> +static inline struct anx7688 *bridge_to_anx7688(struct drm_bridge *bridge)
> +{
> + return container_of(bridge, struct anx7688, bridge);
> +}
> +
> +static bool anx7688_bridge_mode_fixup(struct drm_bridge *bridge,
> + const struct drm_display_mode *mode,
> + struct drm_display_mode *adjusted_mode)
> +{
> + struct anx7688 *anx7688 = bridge_to_anx7688(bridge);
> + int totalbw, requiredbw;
> + u8 dpbw, lanecount;
> + u8 regs[2];
> + int ret;
> +
> + if (!anx7688->filter)
> + return true;
> +
> + /* Read both regs 0x85 (bandwidth) and 0x86 (lane count). */
> + ret = regmap_bulk_read(anx7688->regmap, DP_BANDWIDTH_REG, regs, 2);
> + if (ret < 0) {
> + dev_err(&anx7688->client->dev,
> + "Failed to read bandwidth/lane count\n");
> + return false;
> + }
> + dpbw = regs[0];
> + lanecount = regs[1];


Are these values hw invariant? Or they are result of cable probe/training?

In 1st case this code should go rather to mode_valid.


> +
> + /* Maximum 0x19 bandwidth (6.75 Gbps Turbo mode), 2 lanes */
> + if (dpbw > 0x19 || lanecount > 2) {
> + dev_err(&anx7688->client->dev,
> + "Invalid bandwidth/lane count (%02x/%d)\n",
> + dpbw, lanecount);
> + return false;
> + }
> +
> + /* Compute available bandwidth (kHz) */
> + totalbw = dpbw * lanecount * 270000 * 8 / 10;
> +
> + /* Required bandwidth (8 bpc, kHz) */
> + requiredbw = mode->clock * 8 * 3;
> +
> + dev_dbg(&anx7688->client->dev,
> + "DP bandwidth: %d kHz (%02x/%d); mode requires %d Khz\n",
> + totalbw, dpbw, lanecount, requiredbw);
> +
> + if (totalbw == 0) {
> + dev_warn(&anx7688->client->dev,
> + "Bandwidth/lane count are 0, not rejecting modes\n");
> + return true;
> + }
> +
> + return totalbw >= requiredbw;
> +}
> +
> +static const struct drm_bridge_funcs anx7688_bridge_funcs = {
> + .mode_fixup = anx7688_bridge_mode_fixup,
> +};
> +
> +static const struct regmap_config anx7688_regmap_config = {
> + .reg_bits = 8,
> + .val_bits = 8,
> +};
> +
> +static int anx7688_i2c_probe(struct i2c_client *client)
> +{
> + struct device *dev = &client->dev;
> + struct anx7688 *anx7688;
> + u16 vendor, device;
> + u16 fwversion;
> + u8 buffer[4];
> + int ret;
> +
> + anx7688 = devm_kzalloc(dev, sizeof(*anx7688), GFP_KERNEL);
> + if (!anx7688)
> + return -ENOMEM;
> +
> + anx7688->bridge.of_node = dev->of_node;
> + anx7688->client = client;
> + i2c_set_clientdata(client, anx7688);
> +
> + anx7688->regmap = devm_regmap_init_i2c(client, &anx7688_regmap_config);
> +
> + /* Read both vendor and device id (4 bytes). */
> + ret = regmap_bulk_read(anx7688->regmap, VENDOR_ID_REG, buffer, 4);
> + if (ret) {
> + dev_err(dev, "Failed to read chip vendor/device id\n");
> + return ret;
> + }
> +
> + vendor = (u16)buffer[1] << 8 | buffer[0];
> + device = (u16)buffer[3] << 8 | buffer[2];


Here we have little endian, and...


> + if (vendor != VENDOR_ID || device != DEVICE_ID) {
> + dev_err(dev, "Invalid vendor/device id %04x/%04x\n",
> + vendor, device);
> + return -ENODEV;
> + }
> +
> + ret = regmap_bulk_read(anx7688->regmap, FW_VERSION_REG, buffer, 2);
> + if (ret) {
> + dev_err(&client->dev, "Failed to read firmware version\n");
> + return ret;
> + }
> +
> + fwversion = (u16)buffer[0] << 8 | buffer[1];


...here big endian.

Is it correct?


Overall driver looks OK.

Reviewed-by: Andrzej Hajda <[email protected]>

 --
Regards
Andrzej


> + dev_info(dev, "ANX7688 firwmare version %02x.%02x\n",
> + buffer[0], buffer[1]);
> +
> + /* FW version >= 0.85 supports bandwidth/lane count registers */
> + if (fwversion >= MINIMUM_FW_VERSION) {
> + anx7688->filter = true;
> + } else {
> + /* Warn, but not fail, for backwards compatibility. */
> + dev_warn(dev,
> + "Old ANX7688 FW version (%02x.%02x), not filtering\n",
> + buffer[0], buffer[1]);
> + }
> +
> + anx7688->bridge.funcs = &anx7688_bridge_funcs;
> + drm_bridge_add(&anx7688->bridge);
> +
> + return 0;
> +}
> +
> +static int anx7688_i2c_remove(struct i2c_client *client)
> +{
> + struct anx7688 *anx7688 = i2c_get_clientdata(client);
> +
> + drm_bridge_remove(&anx7688->bridge);
> +
> + return 0;
> +}
> +
> +static const struct of_device_id anx7688_match_table[] = {
> + { .compatible = "analogix,anx7688", },
> + { }
> +};
> +MODULE_DEVICE_TABLE(of, anx7688_match_table);
> +
> +static struct i2c_driver anx7688_driver = {
> + .probe_new = anx7688_i2c_probe,
> + .remove = anx7688_i2c_remove,
> + .driver = {
> + .name = "anx7688",
> + .of_match_table = anx7688_match_table,
> + },
> +};
> +
> +module_i2c_driver(anx7688_driver);
> +
> +MODULE_DESCRIPTION("ANX7688 HDMI->DP bridge driver");
> +MODULE_AUTHOR("Nicolas Boichat <[email protected]>");
> +MODULE_LICENSE("GPL");


2020-02-14 13:31:22

by Nicolas Boichat

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support

On Fri, Feb 14, 2020 at 8:18 PM Andrzej Hajda <[email protected]> wrote:
>
> On 13.02.2020 15:54, Enric Balletbo i Serra wrote:
> > From: Nicolas Boichat <[email protected]>
> >
> > ANX7688 is a HDMI to DP converter (as well as USB-C port controller),
> > that has an internal microcontroller.
> >
> > The only reason a Linux kernel driver is necessary is to reject
> > resolutions that require more bandwidth than what is available on
> > the DP side. DP bandwidth and lane count are reported by the bridge
> > via 2 registers on I2C.
> >
> > Signed-off-by: Nicolas Boichat <[email protected]>
> > Signed-off-by: Hsin-Yi Wang <[email protected]>
> > Signed-off-by: Enric Balletbo i Serra <[email protected]>
> > ---
> >
> > Changes in v2:
> > - Move driver to drivers/gpu/drm/bridge/analogix.
> > - Make the driver OF only so we can reduce the ifdefs.
> > - Update the Copyright to 2020.
> > - Use probe_new so we can get rid of the i2c_device_id table.
> >
> > drivers/gpu/drm/bridge/analogix/Kconfig | 12 ++
> > drivers/gpu/drm/bridge/analogix/Makefile | 1 +
> > .../drm/bridge/analogix/analogix-anx7688.c | 188 ++++++++++++++++++
> > 3 files changed, 201 insertions(+)
> > create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> >
> > diff --git a/drivers/gpu/drm/bridge/analogix/Kconfig b/drivers/gpu/drm/bridge/analogix/Kconfig
> > index e1fa7d820373..af7c2939403c 100644
> > --- a/drivers/gpu/drm/bridge/analogix/Kconfig
> > +++ b/drivers/gpu/drm/bridge/analogix/Kconfig
> > @@ -11,6 +11,18 @@ config DRM_ANALOGIX_ANX6345
> > ANX6345 transforms the LVTTL RGB output of an
> > application processor to eDP or DisplayPort.
> >
> > +config DRM_ANALOGIX_ANX7688
> > + tristate "Analogix ANX7688 bridge"
> > + depends on OF
> > + select DRM_KMS_HELPER
> > + select REGMAP_I2C
> > + help
> > + ANX7688 is an ultra-low power 4k Ultra-HD (4096x2160p60)
> > + mobile HD transmitter designed for portable devices. The
> > + ANX7688 converts HDMI 2.0 to DisplayPort 1.3 Ultra-HD
> > + including an intelligent crosspoint switch to support
> > + USB Type-C.
> > +
> > config DRM_ANALOGIX_ANX78XX
> > tristate "Analogix ANX78XX bridge"
> > select DRM_ANALOGIX_DP
> > diff --git a/drivers/gpu/drm/bridge/analogix/Makefile b/drivers/gpu/drm/bridge/analogix/Makefile
> > index 97669b374098..27cd73635c8c 100644
> > --- a/drivers/gpu/drm/bridge/analogix/Makefile
> > +++ b/drivers/gpu/drm/bridge/analogix/Makefile
> > @@ -1,5 +1,6 @@
> > # SPDX-License-Identifier: GPL-2.0-only
> > analogix_dp-objs := analogix_dp_core.o analogix_dp_reg.o analogix-i2c-dptx.o
> > obj-$(CONFIG_DRM_ANALOGIX_ANX6345) += analogix-anx6345.o
> > +obj-$(CONFIG_DRM_ANALOGIX_ANX7688) += analogix-anx7688.o
> > obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
> > obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix_dp.o
> > diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c b/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> > new file mode 100644
> > index 000000000000..10a7cd0f9126
> > --- /dev/null
> > +++ b/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> > @@ -0,0 +1,188 @@
> > +// SPDX-License-Identifier: GPL-2.0-only
> > +/*
> > + * ANX7688 HDMI->DP bridge driver
> > + *
> > + * Copyright 2020 Google LLC
> > + */
> > +
> > +#include <linux/i2c.h>
> > +#include <linux/module.h>
> > +#include <linux/regmap.h>
> > +#include <drm/drm_bridge.h>
> > +
> > +/* Register addresses */
> > +#define VENDOR_ID_REG 0x00
> > +#define DEVICE_ID_REG 0x02
> > +
> > +#define FW_VERSION_REG 0x80
> > +
> > +#define DP_BANDWIDTH_REG 0x85
> > +#define DP_LANE_COUNT_REG 0x86
> > +
> > +#define VENDOR_ID 0x1f29
> > +#define DEVICE_ID 0x7688
> > +
> > +/* First supported firmware version (0.85) */
> > +#define MINIMUM_FW_VERSION 0x0085
> > +
> > +struct anx7688 {
> > + struct drm_bridge bridge;
> > + struct i2c_client *client;
> > + struct regmap *regmap;
> > +
> > + bool filter;
> > +};
> > +
> > +static inline struct anx7688 *bridge_to_anx7688(struct drm_bridge *bridge)
> > +{
> > + return container_of(bridge, struct anx7688, bridge);
> > +}
> > +
> > +static bool anx7688_bridge_mode_fixup(struct drm_bridge *bridge,
> > + const struct drm_display_mode *mode,
> > + struct drm_display_mode *adjusted_mode)
> > +{
> > + struct anx7688 *anx7688 = bridge_to_anx7688(bridge);
> > + int totalbw, requiredbw;
> > + u8 dpbw, lanecount;
> > + u8 regs[2];
> > + int ret;
> > +
> > + if (!anx7688->filter)
> > + return true;
> > +
> > + /* Read both regs 0x85 (bandwidth) and 0x86 (lane count). */
> > + ret = regmap_bulk_read(anx7688->regmap, DP_BANDWIDTH_REG, regs, 2);
> > + if (ret < 0) {
> > + dev_err(&anx7688->client->dev,
> > + "Failed to read bandwidth/lane count\n");
> > + return false;
> > + }
> > + dpbw = regs[0];
> > + lanecount = regs[1];
>
>
> Are these values hw invariant? Or they are result of cable probe/training?
>
> In 1st case this code should go rather to mode_valid.

2nd case. They're the result of probing/training of the DP link:
number of lanes (1 or 2), and bandwidth (RBR, HBR, HBR2...).

> > +
> > + /* Maximum 0x19 bandwidth (6.75 Gbps Turbo mode), 2 lanes */
> > + if (dpbw > 0x19 || lanecount > 2) {
> > + dev_err(&anx7688->client->dev,
> > + "Invalid bandwidth/lane count (%02x/%d)\n",
> > + dpbw, lanecount);
> > + return false;
> > + }
> > +
> > + /* Compute available bandwidth (kHz) */
> > + totalbw = dpbw * lanecount * 270000 * 8 / 10;
> > +
> > + /* Required bandwidth (8 bpc, kHz) */
> > + requiredbw = mode->clock * 8 * 3;
> > +
> > + dev_dbg(&anx7688->client->dev,
> > + "DP bandwidth: %d kHz (%02x/%d); mode requires %d Khz\n",
> > + totalbw, dpbw, lanecount, requiredbw);
> > +
> > + if (totalbw == 0) {
> > + dev_warn(&anx7688->client->dev,
> > + "Bandwidth/lane count are 0, not rejecting modes\n");
> > + return true;
> > + }
> > +
> > + return totalbw >= requiredbw;
> > +}
> > +
> > +static const struct drm_bridge_funcs anx7688_bridge_funcs = {
> > + .mode_fixup = anx7688_bridge_mode_fixup,
> > +};
> > +
> > +static const struct regmap_config anx7688_regmap_config = {
> > + .reg_bits = 8,
> > + .val_bits = 8,
> > +};
> > +
> > +static int anx7688_i2c_probe(struct i2c_client *client)
> > +{
> > + struct device *dev = &client->dev;
> > + struct anx7688 *anx7688;
> > + u16 vendor, device;
> > + u16 fwversion;
> > + u8 buffer[4];
> > + int ret;
> > +
> > + anx7688 = devm_kzalloc(dev, sizeof(*anx7688), GFP_KERNEL);
> > + if (!anx7688)
> > + return -ENOMEM;
> > +
> > + anx7688->bridge.of_node = dev->of_node;
> > + anx7688->client = client;
> > + i2c_set_clientdata(client, anx7688);
> > +
> > + anx7688->regmap = devm_regmap_init_i2c(client, &anx7688_regmap_config);
> > +
> > + /* Read both vendor and device id (4 bytes). */
> > + ret = regmap_bulk_read(anx7688->regmap, VENDOR_ID_REG, buffer, 4);
> > + if (ret) {
> > + dev_err(dev, "Failed to read chip vendor/device id\n");
> > + return ret;
> > + }
> > +
> > + vendor = (u16)buffer[1] << 8 | buffer[0];
> > + device = (u16)buffer[3] << 8 | buffer[2];
>
>
> Here we have little endian, and...
>
>
> > + if (vendor != VENDOR_ID || device != DEVICE_ID) {
> > + dev_err(dev, "Invalid vendor/device id %04x/%04x\n",
> > + vendor, device);
> > + return -ENODEV;
> > + }
> > +
> > + ret = regmap_bulk_read(anx7688->regmap, FW_VERSION_REG, buffer, 2);
> > + if (ret) {
> > + dev_err(&client->dev, "Failed to read firmware version\n");
> > + return ret;
> > + }
> > +
> > + fwversion = (u16)buffer[0] << 8 | buffer[1];
>
>
> ...here big endian.
>
> Is it correct?
>
>
> Overall driver looks OK.
>
> Reviewed-by: Andrzej Hajda <[email protected]>
>
> --
> Regards
> Andrzej
>
>
> > + dev_info(dev, "ANX7688 firwmare version %02x.%02x\n",
> > + buffer[0], buffer[1]);
> > +
> > + /* FW version >= 0.85 supports bandwidth/lane count registers */
> > + if (fwversion >= MINIMUM_FW_VERSION) {
> > + anx7688->filter = true;
> > + } else {
> > + /* Warn, but not fail, for backwards compatibility. */
> > + dev_warn(dev,
> > + "Old ANX7688 FW version (%02x.%02x), not filtering\n",
> > + buffer[0], buffer[1]);
> > + }
> > +
> > + anx7688->bridge.funcs = &anx7688_bridge_funcs;
> > + drm_bridge_add(&anx7688->bridge);
> > +
> > + return 0;
> > +}
> > +
> > +static int anx7688_i2c_remove(struct i2c_client *client)
> > +{
> > + struct anx7688 *anx7688 = i2c_get_clientdata(client);
> > +
> > + drm_bridge_remove(&anx7688->bridge);
> > +
> > + return 0;
> > +}
> > +
> > +static const struct of_device_id anx7688_match_table[] = {
> > + { .compatible = "analogix,anx7688", },
> > + { }
> > +};
> > +MODULE_DEVICE_TABLE(of, anx7688_match_table);
> > +
> > +static struct i2c_driver anx7688_driver = {
> > + .probe_new = anx7688_i2c_probe,
> > + .remove = anx7688_i2c_remove,
> > + .driver = {
> > + .name = "anx7688",
> > + .of_match_table = anx7688_match_table,
> > + },
> > +};
> > +
> > +module_i2c_driver(anx7688_driver);
> > +
> > +MODULE_DESCRIPTION("ANX7688 HDMI->DP bridge driver");
> > +MODULE_AUTHOR("Nicolas Boichat <[email protected]>");
> > +MODULE_LICENSE("GPL");
>
>

2020-02-14 21:37:36

by Vasily Khoruzhick

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support

On Thu, Feb 13, 2020 at 6:54 AM Enric Balletbo i Serra
<[email protected]> wrote:
>
> From: Nicolas Boichat <[email protected]>
>
> ANX7688 is a HDMI to DP converter (as well as USB-C port controller),
> that has an internal microcontroller.
>
> The only reason a Linux kernel driver is necessary is to reject
> resolutions that require more bandwidth than what is available on
> the DP side. DP bandwidth and lane count are reported by the bridge
> via 2 registers on I2C.

It is true only for your particular platform where usb-c part is
managed by firmware. Pinephone has the same anx7688 but linux will
need a driver that manages usb-c in addition to DP.

I'd suggest making it MFD driver from the beginning, or at least make
proper bindings so we don't have to rework it and introduce binding
incompatibilities in future.

> Signed-off-by: Nicolas Boichat <[email protected]>
> Signed-off-by: Hsin-Yi Wang <[email protected]>
> Signed-off-by: Enric Balletbo i Serra <[email protected]>
> ---
>
> Changes in v2:
> - Move driver to drivers/gpu/drm/bridge/analogix.
> - Make the driver OF only so we can reduce the ifdefs.
> - Update the Copyright to 2020.
> - Use probe_new so we can get rid of the i2c_device_id table.
>
> drivers/gpu/drm/bridge/analogix/Kconfig | 12 ++
> drivers/gpu/drm/bridge/analogix/Makefile | 1 +
> .../drm/bridge/analogix/analogix-anx7688.c | 188 ++++++++++++++++++
> 3 files changed, 201 insertions(+)
> create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
>
> diff --git a/drivers/gpu/drm/bridge/analogix/Kconfig b/drivers/gpu/drm/bridge/analogix/Kconfig
> index e1fa7d820373..af7c2939403c 100644
> --- a/drivers/gpu/drm/bridge/analogix/Kconfig
> +++ b/drivers/gpu/drm/bridge/analogix/Kconfig
> @@ -11,6 +11,18 @@ config DRM_ANALOGIX_ANX6345
> ANX6345 transforms the LVTTL RGB output of an
> application processor to eDP or DisplayPort.
>
> +config DRM_ANALOGIX_ANX7688
> + tristate "Analogix ANX7688 bridge"
> + depends on OF
> + select DRM_KMS_HELPER
> + select REGMAP_I2C
> + help
> + ANX7688 is an ultra-low power 4k Ultra-HD (4096x2160p60)
> + mobile HD transmitter designed for portable devices. The
> + ANX7688 converts HDMI 2.0 to DisplayPort 1.3 Ultra-HD
> + including an intelligent crosspoint switch to support
> + USB Type-C.
> +
> config DRM_ANALOGIX_ANX78XX
> tristate "Analogix ANX78XX bridge"
> select DRM_ANALOGIX_DP
> diff --git a/drivers/gpu/drm/bridge/analogix/Makefile b/drivers/gpu/drm/bridge/analogix/Makefile
> index 97669b374098..27cd73635c8c 100644
> --- a/drivers/gpu/drm/bridge/analogix/Makefile
> +++ b/drivers/gpu/drm/bridge/analogix/Makefile
> @@ -1,5 +1,6 @@
> # SPDX-License-Identifier: GPL-2.0-only
> analogix_dp-objs := analogix_dp_core.o analogix_dp_reg.o analogix-i2c-dptx.o
> obj-$(CONFIG_DRM_ANALOGIX_ANX6345) += analogix-anx6345.o
> +obj-$(CONFIG_DRM_ANALOGIX_ANX7688) += analogix-anx7688.o
> obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
> obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix_dp.o
> diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c b/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> new file mode 100644
> index 000000000000..10a7cd0f9126
> --- /dev/null
> +++ b/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> @@ -0,0 +1,188 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * ANX7688 HDMI->DP bridge driver
> + *
> + * Copyright 2020 Google LLC
> + */
> +
> +#include <linux/i2c.h>
> +#include <linux/module.h>
> +#include <linux/regmap.h>
> +#include <drm/drm_bridge.h>
> +
> +/* Register addresses */
> +#define VENDOR_ID_REG 0x00
> +#define DEVICE_ID_REG 0x02
> +
> +#define FW_VERSION_REG 0x80
> +
> +#define DP_BANDWIDTH_REG 0x85
> +#define DP_LANE_COUNT_REG 0x86
> +
> +#define VENDOR_ID 0x1f29
> +#define DEVICE_ID 0x7688
> +
> +/* First supported firmware version (0.85) */
> +#define MINIMUM_FW_VERSION 0x0085
> +
> +struct anx7688 {
> + struct drm_bridge bridge;
> + struct i2c_client *client;
> + struct regmap *regmap;
> +
> + bool filter;
> +};
> +
> +static inline struct anx7688 *bridge_to_anx7688(struct drm_bridge *bridge)
> +{
> + return container_of(bridge, struct anx7688, bridge);
> +}
> +
> +static bool anx7688_bridge_mode_fixup(struct drm_bridge *bridge,
> + const struct drm_display_mode *mode,
> + struct drm_display_mode *adjusted_mode)
> +{
> + struct anx7688 *anx7688 = bridge_to_anx7688(bridge);
> + int totalbw, requiredbw;
> + u8 dpbw, lanecount;
> + u8 regs[2];
> + int ret;
> +
> + if (!anx7688->filter)
> + return true;
> +
> + /* Read both regs 0x85 (bandwidth) and 0x86 (lane count). */
> + ret = regmap_bulk_read(anx7688->regmap, DP_BANDWIDTH_REG, regs, 2);
> + if (ret < 0) {
> + dev_err(&anx7688->client->dev,
> + "Failed to read bandwidth/lane count\n");
> + return false;
> + }
> + dpbw = regs[0];
> + lanecount = regs[1];
> +
> + /* Maximum 0x19 bandwidth (6.75 Gbps Turbo mode), 2 lanes */
> + if (dpbw > 0x19 || lanecount > 2) {
> + dev_err(&anx7688->client->dev,
> + "Invalid bandwidth/lane count (%02x/%d)\n",
> + dpbw, lanecount);
> + return false;
> + }
> +
> + /* Compute available bandwidth (kHz) */
> + totalbw = dpbw * lanecount * 270000 * 8 / 10;
> +
> + /* Required bandwidth (8 bpc, kHz) */
> + requiredbw = mode->clock * 8 * 3;
> +
> + dev_dbg(&anx7688->client->dev,
> + "DP bandwidth: %d kHz (%02x/%d); mode requires %d Khz\n",
> + totalbw, dpbw, lanecount, requiredbw);
> +
> + if (totalbw == 0) {
> + dev_warn(&anx7688->client->dev,
> + "Bandwidth/lane count are 0, not rejecting modes\n");
> + return true;
> + }
> +
> + return totalbw >= requiredbw;
> +}
> +
> +static const struct drm_bridge_funcs anx7688_bridge_funcs = {
> + .mode_fixup = anx7688_bridge_mode_fixup,
> +};
> +
> +static const struct regmap_config anx7688_regmap_config = {
> + .reg_bits = 8,
> + .val_bits = 8,
> +};
> +
> +static int anx7688_i2c_probe(struct i2c_client *client)
> +{
> + struct device *dev = &client->dev;
> + struct anx7688 *anx7688;
> + u16 vendor, device;
> + u16 fwversion;
> + u8 buffer[4];
> + int ret;
> +
> + anx7688 = devm_kzalloc(dev, sizeof(*anx7688), GFP_KERNEL);
> + if (!anx7688)
> + return -ENOMEM;
> +
> + anx7688->bridge.of_node = dev->of_node;
> + anx7688->client = client;
> + i2c_set_clientdata(client, anx7688);
> +
> + anx7688->regmap = devm_regmap_init_i2c(client, &anx7688_regmap_config);
> +
> + /* Read both vendor and device id (4 bytes). */
> + ret = regmap_bulk_read(anx7688->regmap, VENDOR_ID_REG, buffer, 4);
> + if (ret) {
> + dev_err(dev, "Failed to read chip vendor/device id\n");
> + return ret;
> + }
> +
> + vendor = (u16)buffer[1] << 8 | buffer[0];
> + device = (u16)buffer[3] << 8 | buffer[2];
> + if (vendor != VENDOR_ID || device != DEVICE_ID) {
> + dev_err(dev, "Invalid vendor/device id %04x/%04x\n",
> + vendor, device);
> + return -ENODEV;
> + }
> +
> + ret = regmap_bulk_read(anx7688->regmap, FW_VERSION_REG, buffer, 2);
> + if (ret) {
> + dev_err(&client->dev, "Failed to read firmware version\n");
> + return ret;
> + }
> +
> + fwversion = (u16)buffer[0] << 8 | buffer[1];
> + dev_info(dev, "ANX7688 firwmare version %02x.%02x\n",
> + buffer[0], buffer[1]);
> +
> + /* FW version >= 0.85 supports bandwidth/lane count registers */
> + if (fwversion >= MINIMUM_FW_VERSION) {
> + anx7688->filter = true;
> + } else {
> + /* Warn, but not fail, for backwards compatibility. */
> + dev_warn(dev,
> + "Old ANX7688 FW version (%02x.%02x), not filtering\n",
> + buffer[0], buffer[1]);
> + }
> +
> + anx7688->bridge.funcs = &anx7688_bridge_funcs;
> + drm_bridge_add(&anx7688->bridge);
> +
> + return 0;
> +}
> +
> +static int anx7688_i2c_remove(struct i2c_client *client)
> +{
> + struct anx7688 *anx7688 = i2c_get_clientdata(client);
> +
> + drm_bridge_remove(&anx7688->bridge);
> +
> + return 0;
> +}
> +
> +static const struct of_device_id anx7688_match_table[] = {
> + { .compatible = "analogix,anx7688", },
> + { }
> +};
> +MODULE_DEVICE_TABLE(of, anx7688_match_table);
> +
> +static struct i2c_driver anx7688_driver = {
> + .probe_new = anx7688_i2c_probe,
> + .remove = anx7688_i2c_remove,
> + .driver = {
> + .name = "anx7688",
> + .of_match_table = anx7688_match_table,
> + },
> +};
> +
> +module_i2c_driver(anx7688_driver);
> +
> +MODULE_DESCRIPTION("ANX7688 HDMI->DP bridge driver");
> +MODULE_AUTHOR("Nicolas Boichat <[email protected]>");
> +MODULE_LICENSE("GPL");
> --
> 2.25.0
>

2020-02-14 21:55:10

by Enric Balletbo Serra

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support

Hi Vasily,

Missatge de Vasily Khoruzhick <[email protected]> del dia dv., 14 de
febr. 2020 a les 22:36:
>
> On Thu, Feb 13, 2020 at 6:54 AM Enric Balletbo i Serra
> <[email protected]> wrote:
> >
> > From: Nicolas Boichat <[email protected]>
> >
> > ANX7688 is a HDMI to DP converter (as well as USB-C port controller),
> > that has an internal microcontroller.
> >
> > The only reason a Linux kernel driver is necessary is to reject
> > resolutions that require more bandwidth than what is available on
> > the DP side. DP bandwidth and lane count are reported by the bridge
> > via 2 registers on I2C.
>
> It is true only for your particular platform where usb-c part is
> managed by firmware. Pinephone has the same anx7688 but linux will
> need a driver that manages usb-c in addition to DP.
>
> I'd suggest making it MFD driver from the beginning, or at least make
> proper bindings so we don't have to rework it and introduce binding
> incompatibilities in future.
>

Do you have example code on how the ANX7866 is used in pinephone?
There is a repo somewhere?

Thanks,
Enric

> > Signed-off-by: Nicolas Boichat <[email protected]>
> > Signed-off-by: Hsin-Yi Wang <[email protected]>
> > Signed-off-by: Enric Balletbo i Serra <[email protected]>
> > ---
> >
> > Changes in v2:
> > - Move driver to drivers/gpu/drm/bridge/analogix.
> > - Make the driver OF only so we can reduce the ifdefs.
> > - Update the Copyright to 2020.
> > - Use probe_new so we can get rid of the i2c_device_id table.
> >
> > drivers/gpu/drm/bridge/analogix/Kconfig | 12 ++
> > drivers/gpu/drm/bridge/analogix/Makefile | 1 +
> > .../drm/bridge/analogix/analogix-anx7688.c | 188 ++++++++++++++++++
> > 3 files changed, 201 insertions(+)
> > create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> >
> > diff --git a/drivers/gpu/drm/bridge/analogix/Kconfig b/drivers/gpu/drm/bridge/analogix/Kconfig
> > index e1fa7d820373..af7c2939403c 100644
> > --- a/drivers/gpu/drm/bridge/analogix/Kconfig
> > +++ b/drivers/gpu/drm/bridge/analogix/Kconfig
> > @@ -11,6 +11,18 @@ config DRM_ANALOGIX_ANX6345
> > ANX6345 transforms the LVTTL RGB output of an
> > application processor to eDP or DisplayPort.
> >
> > +config DRM_ANALOGIX_ANX7688
> > + tristate "Analogix ANX7688 bridge"
> > + depends on OF
> > + select DRM_KMS_HELPER
> > + select REGMAP_I2C
> > + help
> > + ANX7688 is an ultra-low power 4k Ultra-HD (4096x2160p60)
> > + mobile HD transmitter designed for portable devices. The
> > + ANX7688 converts HDMI 2.0 to DisplayPort 1.3 Ultra-HD
> > + including an intelligent crosspoint switch to support
> > + USB Type-C.
> > +
> > config DRM_ANALOGIX_ANX78XX
> > tristate "Analogix ANX78XX bridge"
> > select DRM_ANALOGIX_DP
> > diff --git a/drivers/gpu/drm/bridge/analogix/Makefile b/drivers/gpu/drm/bridge/analogix/Makefile
> > index 97669b374098..27cd73635c8c 100644
> > --- a/drivers/gpu/drm/bridge/analogix/Makefile
> > +++ b/drivers/gpu/drm/bridge/analogix/Makefile
> > @@ -1,5 +1,6 @@
> > # SPDX-License-Identifier: GPL-2.0-only
> > analogix_dp-objs := analogix_dp_core.o analogix_dp_reg.o analogix-i2c-dptx.o
> > obj-$(CONFIG_DRM_ANALOGIX_ANX6345) += analogix-anx6345.o
> > +obj-$(CONFIG_DRM_ANALOGIX_ANX7688) += analogix-anx7688.o
> > obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
> > obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix_dp.o
> > diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c b/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> > new file mode 100644
> > index 000000000000..10a7cd0f9126
> > --- /dev/null
> > +++ b/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> > @@ -0,0 +1,188 @@
> > +// SPDX-License-Identifier: GPL-2.0-only
> > +/*
> > + * ANX7688 HDMI->DP bridge driver
> > + *
> > + * Copyright 2020 Google LLC
> > + */
> > +
> > +#include <linux/i2c.h>
> > +#include <linux/module.h>
> > +#include <linux/regmap.h>
> > +#include <drm/drm_bridge.h>
> > +
> > +/* Register addresses */
> > +#define VENDOR_ID_REG 0x00
> > +#define DEVICE_ID_REG 0x02
> > +
> > +#define FW_VERSION_REG 0x80
> > +
> > +#define DP_BANDWIDTH_REG 0x85
> > +#define DP_LANE_COUNT_REG 0x86
> > +
> > +#define VENDOR_ID 0x1f29
> > +#define DEVICE_ID 0x7688
> > +
> > +/* First supported firmware version (0.85) */
> > +#define MINIMUM_FW_VERSION 0x0085
> > +
> > +struct anx7688 {
> > + struct drm_bridge bridge;
> > + struct i2c_client *client;
> > + struct regmap *regmap;
> > +
> > + bool filter;
> > +};
> > +
> > +static inline struct anx7688 *bridge_to_anx7688(struct drm_bridge *bridge)
> > +{
> > + return container_of(bridge, struct anx7688, bridge);
> > +}
> > +
> > +static bool anx7688_bridge_mode_fixup(struct drm_bridge *bridge,
> > + const struct drm_display_mode *mode,
> > + struct drm_display_mode *adjusted_mode)
> > +{
> > + struct anx7688 *anx7688 = bridge_to_anx7688(bridge);
> > + int totalbw, requiredbw;
> > + u8 dpbw, lanecount;
> > + u8 regs[2];
> > + int ret;
> > +
> > + if (!anx7688->filter)
> > + return true;
> > +
> > + /* Read both regs 0x85 (bandwidth) and 0x86 (lane count). */
> > + ret = regmap_bulk_read(anx7688->regmap, DP_BANDWIDTH_REG, regs, 2);
> > + if (ret < 0) {
> > + dev_err(&anx7688->client->dev,
> > + "Failed to read bandwidth/lane count\n");
> > + return false;
> > + }
> > + dpbw = regs[0];
> > + lanecount = regs[1];
> > +
> > + /* Maximum 0x19 bandwidth (6.75 Gbps Turbo mode), 2 lanes */
> > + if (dpbw > 0x19 || lanecount > 2) {
> > + dev_err(&anx7688->client->dev,
> > + "Invalid bandwidth/lane count (%02x/%d)\n",
> > + dpbw, lanecount);
> > + return false;
> > + }
> > +
> > + /* Compute available bandwidth (kHz) */
> > + totalbw = dpbw * lanecount * 270000 * 8 / 10;
> > +
> > + /* Required bandwidth (8 bpc, kHz) */
> > + requiredbw = mode->clock * 8 * 3;
> > +
> > + dev_dbg(&anx7688->client->dev,
> > + "DP bandwidth: %d kHz (%02x/%d); mode requires %d Khz\n",
> > + totalbw, dpbw, lanecount, requiredbw);
> > +
> > + if (totalbw == 0) {
> > + dev_warn(&anx7688->client->dev,
> > + "Bandwidth/lane count are 0, not rejecting modes\n");
> > + return true;
> > + }
> > +
> > + return totalbw >= requiredbw;
> > +}
> > +
> > +static const struct drm_bridge_funcs anx7688_bridge_funcs = {
> > + .mode_fixup = anx7688_bridge_mode_fixup,
> > +};
> > +
> > +static const struct regmap_config anx7688_regmap_config = {
> > + .reg_bits = 8,
> > + .val_bits = 8,
> > +};
> > +
> > +static int anx7688_i2c_probe(struct i2c_client *client)
> > +{
> > + struct device *dev = &client->dev;
> > + struct anx7688 *anx7688;
> > + u16 vendor, device;
> > + u16 fwversion;
> > + u8 buffer[4];
> > + int ret;
> > +
> > + anx7688 = devm_kzalloc(dev, sizeof(*anx7688), GFP_KERNEL);
> > + if (!anx7688)
> > + return -ENOMEM;
> > +
> > + anx7688->bridge.of_node = dev->of_node;
> > + anx7688->client = client;
> > + i2c_set_clientdata(client, anx7688);
> > +
> > + anx7688->regmap = devm_regmap_init_i2c(client, &anx7688_regmap_config);
> > +
> > + /* Read both vendor and device id (4 bytes). */
> > + ret = regmap_bulk_read(anx7688->regmap, VENDOR_ID_REG, buffer, 4);
> > + if (ret) {
> > + dev_err(dev, "Failed to read chip vendor/device id\n");
> > + return ret;
> > + }
> > +
> > + vendor = (u16)buffer[1] << 8 | buffer[0];
> > + device = (u16)buffer[3] << 8 | buffer[2];
> > + if (vendor != VENDOR_ID || device != DEVICE_ID) {
> > + dev_err(dev, "Invalid vendor/device id %04x/%04x\n",
> > + vendor, device);
> > + return -ENODEV;
> > + }
> > +
> > + ret = regmap_bulk_read(anx7688->regmap, FW_VERSION_REG, buffer, 2);
> > + if (ret) {
> > + dev_err(&client->dev, "Failed to read firmware version\n");
> > + return ret;
> > + }
> > +
> > + fwversion = (u16)buffer[0] << 8 | buffer[1];
> > + dev_info(dev, "ANX7688 firwmare version %02x.%02x\n",
> > + buffer[0], buffer[1]);
> > +
> > + /* FW version >= 0.85 supports bandwidth/lane count registers */
> > + if (fwversion >= MINIMUM_FW_VERSION) {
> > + anx7688->filter = true;
> > + } else {
> > + /* Warn, but not fail, for backwards compatibility. */
> > + dev_warn(dev,
> > + "Old ANX7688 FW version (%02x.%02x), not filtering\n",
> > + buffer[0], buffer[1]);
> > + }
> > +
> > + anx7688->bridge.funcs = &anx7688_bridge_funcs;
> > + drm_bridge_add(&anx7688->bridge);
> > +
> > + return 0;
> > +}
> > +
> > +static int anx7688_i2c_remove(struct i2c_client *client)
> > +{
> > + struct anx7688 *anx7688 = i2c_get_clientdata(client);
> > +
> > + drm_bridge_remove(&anx7688->bridge);
> > +
> > + return 0;
> > +}
> > +
> > +static const struct of_device_id anx7688_match_table[] = {
> > + { .compatible = "analogix,anx7688", },
> > + { }
> > +};
> > +MODULE_DEVICE_TABLE(of, anx7688_match_table);
> > +
> > +static struct i2c_driver anx7688_driver = {
> > + .probe_new = anx7688_i2c_probe,
> > + .remove = anx7688_i2c_remove,
> > + .driver = {
> > + .name = "anx7688",
> > + .of_match_table = anx7688_match_table,
> > + },
> > +};
> > +
> > +module_i2c_driver(anx7688_driver);
> > +
> > +MODULE_DESCRIPTION("ANX7688 HDMI->DP bridge driver");
> > +MODULE_AUTHOR("Nicolas Boichat <[email protected]>");
> > +MODULE_LICENSE("GPL");
> > --
> > 2.25.0
> >
> _______________________________________________
> dri-devel mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

2020-02-14 22:18:04

by Vasily Khoruzhick

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support

On Fri, Feb 14, 2020 at 1:53 PM Enric Balletbo Serra
<[email protected]> wrote:
>
> Hi Vasily,
>
> Missatge de Vasily Khoruzhick <[email protected]> del dia dv., 14 de
> febr. 2020 a les 22:36:
> >
> > On Thu, Feb 13, 2020 at 6:54 AM Enric Balletbo i Serra
> > <[email protected]> wrote:
> > >
> > > From: Nicolas Boichat <[email protected]>
> > >
> > > ANX7688 is a HDMI to DP converter (as well as USB-C port controller),
> > > that has an internal microcontroller.
> > >
> > > The only reason a Linux kernel driver is necessary is to reject
> > > resolutions that require more bandwidth than what is available on
> > > the DP side. DP bandwidth and lane count are reported by the bridge
> > > via 2 registers on I2C.
> >
> > It is true only for your particular platform where usb-c part is
> > managed by firmware. Pinephone has the same anx7688 but linux will
> > need a driver that manages usb-c in addition to DP.
> >
> > I'd suggest making it MFD driver from the beginning, or at least make
> > proper bindings so we don't have to rework it and introduce binding
> > incompatibilities in future.
> >
>
> Do you have example code on how the ANX7866 is used in pinephone?
> There is a repo somewhere?

I don't think it's implemented yet. I've CCed Icenowy in case if she
has anything.

> Thanks,
> Enric
>
> > > Signed-off-by: Nicolas Boichat <[email protected]>
> > > Signed-off-by: Hsin-Yi Wang <[email protected]>
> > > Signed-off-by: Enric Balletbo i Serra <[email protected]>
> > > ---
> > >
> > > Changes in v2:
> > > - Move driver to drivers/gpu/drm/bridge/analogix.
> > > - Make the driver OF only so we can reduce the ifdefs.
> > > - Update the Copyright to 2020.
> > > - Use probe_new so we can get rid of the i2c_device_id table.
> > >
> > > drivers/gpu/drm/bridge/analogix/Kconfig | 12 ++
> > > drivers/gpu/drm/bridge/analogix/Makefile | 1 +
> > > .../drm/bridge/analogix/analogix-anx7688.c | 188 ++++++++++++++++++
> > > 3 files changed, 201 insertions(+)
> > > create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> > >
> > > diff --git a/drivers/gpu/drm/bridge/analogix/Kconfig b/drivers/gpu/drm/bridge/analogix/Kconfig
> > > index e1fa7d820373..af7c2939403c 100644
> > > --- a/drivers/gpu/drm/bridge/analogix/Kconfig
> > > +++ b/drivers/gpu/drm/bridge/analogix/Kconfig
> > > @@ -11,6 +11,18 @@ config DRM_ANALOGIX_ANX6345
> > > ANX6345 transforms the LVTTL RGB output of an
> > > application processor to eDP or DisplayPort.
> > >
> > > +config DRM_ANALOGIX_ANX7688
> > > + tristate "Analogix ANX7688 bridge"
> > > + depends on OF
> > > + select DRM_KMS_HELPER
> > > + select REGMAP_I2C
> > > + help
> > > + ANX7688 is an ultra-low power 4k Ultra-HD (4096x2160p60)
> > > + mobile HD transmitter designed for portable devices. The
> > > + ANX7688 converts HDMI 2.0 to DisplayPort 1.3 Ultra-HD
> > > + including an intelligent crosspoint switch to support
> > > + USB Type-C.
> > > +
> > > config DRM_ANALOGIX_ANX78XX
> > > tristate "Analogix ANX78XX bridge"
> > > select DRM_ANALOGIX_DP
> > > diff --git a/drivers/gpu/drm/bridge/analogix/Makefile b/drivers/gpu/drm/bridge/analogix/Makefile
> > > index 97669b374098..27cd73635c8c 100644
> > > --- a/drivers/gpu/drm/bridge/analogix/Makefile
> > > +++ b/drivers/gpu/drm/bridge/analogix/Makefile
> > > @@ -1,5 +1,6 @@
> > > # SPDX-License-Identifier: GPL-2.0-only
> > > analogix_dp-objs := analogix_dp_core.o analogix_dp_reg.o analogix-i2c-dptx.o
> > > obj-$(CONFIG_DRM_ANALOGIX_ANX6345) += analogix-anx6345.o
> > > +obj-$(CONFIG_DRM_ANALOGIX_ANX7688) += analogix-anx7688.o
> > > obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
> > > obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix_dp.o
> > > diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c b/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> > > new file mode 100644
> > > index 000000000000..10a7cd0f9126
> > > --- /dev/null
> > > +++ b/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> > > @@ -0,0 +1,188 @@
> > > +// SPDX-License-Identifier: GPL-2.0-only
> > > +/*
> > > + * ANX7688 HDMI->DP bridge driver
> > > + *
> > > + * Copyright 2020 Google LLC
> > > + */
> > > +
> > > +#include <linux/i2c.h>
> > > +#include <linux/module.h>
> > > +#include <linux/regmap.h>
> > > +#include <drm/drm_bridge.h>
> > > +
> > > +/* Register addresses */
> > > +#define VENDOR_ID_REG 0x00
> > > +#define DEVICE_ID_REG 0x02
> > > +
> > > +#define FW_VERSION_REG 0x80
> > > +
> > > +#define DP_BANDWIDTH_REG 0x85
> > > +#define DP_LANE_COUNT_REG 0x86
> > > +
> > > +#define VENDOR_ID 0x1f29
> > > +#define DEVICE_ID 0x7688
> > > +
> > > +/* First supported firmware version (0.85) */
> > > +#define MINIMUM_FW_VERSION 0x0085
> > > +
> > > +struct anx7688 {
> > > + struct drm_bridge bridge;
> > > + struct i2c_client *client;
> > > + struct regmap *regmap;
> > > +
> > > + bool filter;
> > > +};
> > > +
> > > +static inline struct anx7688 *bridge_to_anx7688(struct drm_bridge *bridge)
> > > +{
> > > + return container_of(bridge, struct anx7688, bridge);
> > > +}
> > > +
> > > +static bool anx7688_bridge_mode_fixup(struct drm_bridge *bridge,
> > > + const struct drm_display_mode *mode,
> > > + struct drm_display_mode *adjusted_mode)
> > > +{
> > > + struct anx7688 *anx7688 = bridge_to_anx7688(bridge);
> > > + int totalbw, requiredbw;
> > > + u8 dpbw, lanecount;
> > > + u8 regs[2];
> > > + int ret;
> > > +
> > > + if (!anx7688->filter)
> > > + return true;
> > > +
> > > + /* Read both regs 0x85 (bandwidth) and 0x86 (lane count). */
> > > + ret = regmap_bulk_read(anx7688->regmap, DP_BANDWIDTH_REG, regs, 2);
> > > + if (ret < 0) {
> > > + dev_err(&anx7688->client->dev,
> > > + "Failed to read bandwidth/lane count\n");
> > > + return false;
> > > + }
> > > + dpbw = regs[0];
> > > + lanecount = regs[1];
> > > +
> > > + /* Maximum 0x19 bandwidth (6.75 Gbps Turbo mode), 2 lanes */
> > > + if (dpbw > 0x19 || lanecount > 2) {
> > > + dev_err(&anx7688->client->dev,
> > > + "Invalid bandwidth/lane count (%02x/%d)\n",
> > > + dpbw, lanecount);
> > > + return false;
> > > + }
> > > +
> > > + /* Compute available bandwidth (kHz) */
> > > + totalbw = dpbw * lanecount * 270000 * 8 / 10;
> > > +
> > > + /* Required bandwidth (8 bpc, kHz) */
> > > + requiredbw = mode->clock * 8 * 3;
> > > +
> > > + dev_dbg(&anx7688->client->dev,
> > > + "DP bandwidth: %d kHz (%02x/%d); mode requires %d Khz\n",
> > > + totalbw, dpbw, lanecount, requiredbw);
> > > +
> > > + if (totalbw == 0) {
> > > + dev_warn(&anx7688->client->dev,
> > > + "Bandwidth/lane count are 0, not rejecting modes\n");
> > > + return true;
> > > + }
> > > +
> > > + return totalbw >= requiredbw;
> > > +}
> > > +
> > > +static const struct drm_bridge_funcs anx7688_bridge_funcs = {
> > > + .mode_fixup = anx7688_bridge_mode_fixup,
> > > +};
> > > +
> > > +static const struct regmap_config anx7688_regmap_config = {
> > > + .reg_bits = 8,
> > > + .val_bits = 8,
> > > +};
> > > +
> > > +static int anx7688_i2c_probe(struct i2c_client *client)
> > > +{
> > > + struct device *dev = &client->dev;
> > > + struct anx7688 *anx7688;
> > > + u16 vendor, device;
> > > + u16 fwversion;
> > > + u8 buffer[4];
> > > + int ret;
> > > +
> > > + anx7688 = devm_kzalloc(dev, sizeof(*anx7688), GFP_KERNEL);
> > > + if (!anx7688)
> > > + return -ENOMEM;
> > > +
> > > + anx7688->bridge.of_node = dev->of_node;
> > > + anx7688->client = client;
> > > + i2c_set_clientdata(client, anx7688);
> > > +
> > > + anx7688->regmap = devm_regmap_init_i2c(client, &anx7688_regmap_config);
> > > +
> > > + /* Read both vendor and device id (4 bytes). */
> > > + ret = regmap_bulk_read(anx7688->regmap, VENDOR_ID_REG, buffer, 4);
> > > + if (ret) {
> > > + dev_err(dev, "Failed to read chip vendor/device id\n");
> > > + return ret;
> > > + }
> > > +
> > > + vendor = (u16)buffer[1] << 8 | buffer[0];
> > > + device = (u16)buffer[3] << 8 | buffer[2];
> > > + if (vendor != VENDOR_ID || device != DEVICE_ID) {
> > > + dev_err(dev, "Invalid vendor/device id %04x/%04x\n",
> > > + vendor, device);
> > > + return -ENODEV;
> > > + }
> > > +
> > > + ret = regmap_bulk_read(anx7688->regmap, FW_VERSION_REG, buffer, 2);
> > > + if (ret) {
> > > + dev_err(&client->dev, "Failed to read firmware version\n");
> > > + return ret;
> > > + }
> > > +
> > > + fwversion = (u16)buffer[0] << 8 | buffer[1];
> > > + dev_info(dev, "ANX7688 firwmare version %02x.%02x\n",
> > > + buffer[0], buffer[1]);
> > > +
> > > + /* FW version >= 0.85 supports bandwidth/lane count registers */
> > > + if (fwversion >= MINIMUM_FW_VERSION) {
> > > + anx7688->filter = true;
> > > + } else {
> > > + /* Warn, but not fail, for backwards compatibility. */
> > > + dev_warn(dev,
> > > + "Old ANX7688 FW version (%02x.%02x), not filtering\n",
> > > + buffer[0], buffer[1]);
> > > + }
> > > +
> > > + anx7688->bridge.funcs = &anx7688_bridge_funcs;
> > > + drm_bridge_add(&anx7688->bridge);
> > > +
> > > + return 0;
> > > +}
> > > +
> > > +static int anx7688_i2c_remove(struct i2c_client *client)
> > > +{
> > > + struct anx7688 *anx7688 = i2c_get_clientdata(client);
> > > +
> > > + drm_bridge_remove(&anx7688->bridge);
> > > +
> > > + return 0;
> > > +}
> > > +
> > > +static const struct of_device_id anx7688_match_table[] = {
> > > + { .compatible = "analogix,anx7688", },
> > > + { }
> > > +};
> > > +MODULE_DEVICE_TABLE(of, anx7688_match_table);
> > > +
> > > +static struct i2c_driver anx7688_driver = {
> > > + .probe_new = anx7688_i2c_probe,
> > > + .remove = anx7688_i2c_remove,
> > > + .driver = {
> > > + .name = "anx7688",
> > > + .of_match_table = anx7688_match_table,
> > > + },
> > > +};
> > > +
> > > +module_i2c_driver(anx7688_driver);
> > > +
> > > +MODULE_DESCRIPTION("ANX7688 HDMI->DP bridge driver");
> > > +MODULE_AUTHOR("Nicolas Boichat <[email protected]>");
> > > +MODULE_LICENSE("GPL");
> > > --
> > > 2.25.0
> > >
> > _______________________________________________
> > dri-devel mailing list
> > [email protected]
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel

2020-02-14 22:20:38

by Enric Balletbo Serra

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support

Hi Vasily,

Missatge de Vasily Khoruzhick <[email protected]> del dia dv., 14 de
febr. 2020 a les 23:17:
>
> On Fri, Feb 14, 2020 at 1:53 PM Enric Balletbo Serra
> <[email protected]> wrote:
> >
> > Hi Vasily,
> >
> > Missatge de Vasily Khoruzhick <[email protected]> del dia dv., 14 de
> > febr. 2020 a les 22:36:
> > >
> > > On Thu, Feb 13, 2020 at 6:54 AM Enric Balletbo i Serra
> > > <[email protected]> wrote:
> > > >
> > > > From: Nicolas Boichat <[email protected]>
> > > >
> > > > ANX7688 is a HDMI to DP converter (as well as USB-C port controller),
> > > > that has an internal microcontroller.
> > > >
> > > > The only reason a Linux kernel driver is necessary is to reject
> > > > resolutions that require more bandwidth than what is available on
> > > > the DP side. DP bandwidth and lane count are reported by the bridge
> > > > via 2 registers on I2C.
> > >
> > > It is true only for your particular platform where usb-c part is
> > > managed by firmware. Pinephone has the same anx7688 but linux will
> > > need a driver that manages usb-c in addition to DP.
> > >
> > > I'd suggest making it MFD driver from the beginning, or at least make
> > > proper bindings so we don't have to rework it and introduce binding
> > > incompatibilities in future.
> > >
> >
> > Do you have example code on how the ANX7866 is used in pinephone?
> > There is a repo somewhere?
>
> I don't think it's implemented yet. I've CCed Icenowy in case if she
> has anything.
>

It would be good to join the effort. Just because I am curious, there
are public schematics for the pinephone that is using that bridge?

> > Thanks,
> > Enric
> >
> > > > Signed-off-by: Nicolas Boichat <[email protected]>
> > > > Signed-off-by: Hsin-Yi Wang <[email protected]>
> > > > Signed-off-by: Enric Balletbo i Serra <[email protected]>
> > > > ---
> > > >
> > > > Changes in v2:
> > > > - Move driver to drivers/gpu/drm/bridge/analogix.
> > > > - Make the driver OF only so we can reduce the ifdefs.
> > > > - Update the Copyright to 2020.
> > > > - Use probe_new so we can get rid of the i2c_device_id table.
> > > >
> > > > drivers/gpu/drm/bridge/analogix/Kconfig | 12 ++
> > > > drivers/gpu/drm/bridge/analogix/Makefile | 1 +
> > > > .../drm/bridge/analogix/analogix-anx7688.c | 188 ++++++++++++++++++
> > > > 3 files changed, 201 insertions(+)
> > > > create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> > > >
> > > > diff --git a/drivers/gpu/drm/bridge/analogix/Kconfig b/drivers/gpu/drm/bridge/analogix/Kconfig
> > > > index e1fa7d820373..af7c2939403c 100644
> > > > --- a/drivers/gpu/drm/bridge/analogix/Kconfig
> > > > +++ b/drivers/gpu/drm/bridge/analogix/Kconfig
> > > > @@ -11,6 +11,18 @@ config DRM_ANALOGIX_ANX6345
> > > > ANX6345 transforms the LVTTL RGB output of an
> > > > application processor to eDP or DisplayPort.
> > > >
> > > > +config DRM_ANALOGIX_ANX7688
> > > > + tristate "Analogix ANX7688 bridge"
> > > > + depends on OF
> > > > + select DRM_KMS_HELPER
> > > > + select REGMAP_I2C
> > > > + help
> > > > + ANX7688 is an ultra-low power 4k Ultra-HD (4096x2160p60)
> > > > + mobile HD transmitter designed for portable devices. The
> > > > + ANX7688 converts HDMI 2.0 to DisplayPort 1.3 Ultra-HD
> > > > + including an intelligent crosspoint switch to support
> > > > + USB Type-C.
> > > > +
> > > > config DRM_ANALOGIX_ANX78XX
> > > > tristate "Analogix ANX78XX bridge"
> > > > select DRM_ANALOGIX_DP
> > > > diff --git a/drivers/gpu/drm/bridge/analogix/Makefile b/drivers/gpu/drm/bridge/analogix/Makefile
> > > > index 97669b374098..27cd73635c8c 100644
> > > > --- a/drivers/gpu/drm/bridge/analogix/Makefile
> > > > +++ b/drivers/gpu/drm/bridge/analogix/Makefile
> > > > @@ -1,5 +1,6 @@
> > > > # SPDX-License-Identifier: GPL-2.0-only
> > > > analogix_dp-objs := analogix_dp_core.o analogix_dp_reg.o analogix-i2c-dptx.o
> > > > obj-$(CONFIG_DRM_ANALOGIX_ANX6345) += analogix-anx6345.o
> > > > +obj-$(CONFIG_DRM_ANALOGIX_ANX7688) += analogix-anx7688.o
> > > > obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
> > > > obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix_dp.o
> > > > diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c b/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> > > > new file mode 100644
> > > > index 000000000000..10a7cd0f9126
> > > > --- /dev/null
> > > > +++ b/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> > > > @@ -0,0 +1,188 @@
> > > > +// SPDX-License-Identifier: GPL-2.0-only
> > > > +/*
> > > > + * ANX7688 HDMI->DP bridge driver
> > > > + *
> > > > + * Copyright 2020 Google LLC
> > > > + */
> > > > +
> > > > +#include <linux/i2c.h>
> > > > +#include <linux/module.h>
> > > > +#include <linux/regmap.h>
> > > > +#include <drm/drm_bridge.h>
> > > > +
> > > > +/* Register addresses */
> > > > +#define VENDOR_ID_REG 0x00
> > > > +#define DEVICE_ID_REG 0x02
> > > > +
> > > > +#define FW_VERSION_REG 0x80
> > > > +
> > > > +#define DP_BANDWIDTH_REG 0x85
> > > > +#define DP_LANE_COUNT_REG 0x86
> > > > +
> > > > +#define VENDOR_ID 0x1f29
> > > > +#define DEVICE_ID 0x7688
> > > > +
> > > > +/* First supported firmware version (0.85) */
> > > > +#define MINIMUM_FW_VERSION 0x0085
> > > > +
> > > > +struct anx7688 {
> > > > + struct drm_bridge bridge;
> > > > + struct i2c_client *client;
> > > > + struct regmap *regmap;
> > > > +
> > > > + bool filter;
> > > > +};
> > > > +
> > > > +static inline struct anx7688 *bridge_to_anx7688(struct drm_bridge *bridge)
> > > > +{
> > > > + return container_of(bridge, struct anx7688, bridge);
> > > > +}
> > > > +
> > > > +static bool anx7688_bridge_mode_fixup(struct drm_bridge *bridge,
> > > > + const struct drm_display_mode *mode,
> > > > + struct drm_display_mode *adjusted_mode)
> > > > +{
> > > > + struct anx7688 *anx7688 = bridge_to_anx7688(bridge);
> > > > + int totalbw, requiredbw;
> > > > + u8 dpbw, lanecount;
> > > > + u8 regs[2];
> > > > + int ret;
> > > > +
> > > > + if (!anx7688->filter)
> > > > + return true;
> > > > +
> > > > + /* Read both regs 0x85 (bandwidth) and 0x86 (lane count). */
> > > > + ret = regmap_bulk_read(anx7688->regmap, DP_BANDWIDTH_REG, regs, 2);
> > > > + if (ret < 0) {
> > > > + dev_err(&anx7688->client->dev,
> > > > + "Failed to read bandwidth/lane count\n");
> > > > + return false;
> > > > + }
> > > > + dpbw = regs[0];
> > > > + lanecount = regs[1];
> > > > +
> > > > + /* Maximum 0x19 bandwidth (6.75 Gbps Turbo mode), 2 lanes */
> > > > + if (dpbw > 0x19 || lanecount > 2) {
> > > > + dev_err(&anx7688->client->dev,
> > > > + "Invalid bandwidth/lane count (%02x/%d)\n",
> > > > + dpbw, lanecount);
> > > > + return false;
> > > > + }
> > > > +
> > > > + /* Compute available bandwidth (kHz) */
> > > > + totalbw = dpbw * lanecount * 270000 * 8 / 10;
> > > > +
> > > > + /* Required bandwidth (8 bpc, kHz) */
> > > > + requiredbw = mode->clock * 8 * 3;
> > > > +
> > > > + dev_dbg(&anx7688->client->dev,
> > > > + "DP bandwidth: %d kHz (%02x/%d); mode requires %d Khz\n",
> > > > + totalbw, dpbw, lanecount, requiredbw);
> > > > +
> > > > + if (totalbw == 0) {
> > > > + dev_warn(&anx7688->client->dev,
> > > > + "Bandwidth/lane count are 0, not rejecting modes\n");
> > > > + return true;
> > > > + }
> > > > +
> > > > + return totalbw >= requiredbw;
> > > > +}
> > > > +
> > > > +static const struct drm_bridge_funcs anx7688_bridge_funcs = {
> > > > + .mode_fixup = anx7688_bridge_mode_fixup,
> > > > +};
> > > > +
> > > > +static const struct regmap_config anx7688_regmap_config = {
> > > > + .reg_bits = 8,
> > > > + .val_bits = 8,
> > > > +};
> > > > +
> > > > +static int anx7688_i2c_probe(struct i2c_client *client)
> > > > +{
> > > > + struct device *dev = &client->dev;
> > > > + struct anx7688 *anx7688;
> > > > + u16 vendor, device;
> > > > + u16 fwversion;
> > > > + u8 buffer[4];
> > > > + int ret;
> > > > +
> > > > + anx7688 = devm_kzalloc(dev, sizeof(*anx7688), GFP_KERNEL);
> > > > + if (!anx7688)
> > > > + return -ENOMEM;
> > > > +
> > > > + anx7688->bridge.of_node = dev->of_node;
> > > > + anx7688->client = client;
> > > > + i2c_set_clientdata(client, anx7688);
> > > > +
> > > > + anx7688->regmap = devm_regmap_init_i2c(client, &anx7688_regmap_config);
> > > > +
> > > > + /* Read both vendor and device id (4 bytes). */
> > > > + ret = regmap_bulk_read(anx7688->regmap, VENDOR_ID_REG, buffer, 4);
> > > > + if (ret) {
> > > > + dev_err(dev, "Failed to read chip vendor/device id\n");
> > > > + return ret;
> > > > + }
> > > > +
> > > > + vendor = (u16)buffer[1] << 8 | buffer[0];
> > > > + device = (u16)buffer[3] << 8 | buffer[2];
> > > > + if (vendor != VENDOR_ID || device != DEVICE_ID) {
> > > > + dev_err(dev, "Invalid vendor/device id %04x/%04x\n",
> > > > + vendor, device);
> > > > + return -ENODEV;
> > > > + }
> > > > +
> > > > + ret = regmap_bulk_read(anx7688->regmap, FW_VERSION_REG, buffer, 2);
> > > > + if (ret) {
> > > > + dev_err(&client->dev, "Failed to read firmware version\n");
> > > > + return ret;
> > > > + }
> > > > +
> > > > + fwversion = (u16)buffer[0] << 8 | buffer[1];
> > > > + dev_info(dev, "ANX7688 firwmare version %02x.%02x\n",
> > > > + buffer[0], buffer[1]);
> > > > +
> > > > + /* FW version >= 0.85 supports bandwidth/lane count registers */
> > > > + if (fwversion >= MINIMUM_FW_VERSION) {
> > > > + anx7688->filter = true;
> > > > + } else {
> > > > + /* Warn, but not fail, for backwards compatibility. */
> > > > + dev_warn(dev,
> > > > + "Old ANX7688 FW version (%02x.%02x), not filtering\n",
> > > > + buffer[0], buffer[1]);
> > > > + }
> > > > +
> > > > + anx7688->bridge.funcs = &anx7688_bridge_funcs;
> > > > + drm_bridge_add(&anx7688->bridge);
> > > > +
> > > > + return 0;
> > > > +}
> > > > +
> > > > +static int anx7688_i2c_remove(struct i2c_client *client)
> > > > +{
> > > > + struct anx7688 *anx7688 = i2c_get_clientdata(client);
> > > > +
> > > > + drm_bridge_remove(&anx7688->bridge);
> > > > +
> > > > + return 0;
> > > > +}
> > > > +
> > > > +static const struct of_device_id anx7688_match_table[] = {
> > > > + { .compatible = "analogix,anx7688", },
> > > > + { }
> > > > +};
> > > > +MODULE_DEVICE_TABLE(of, anx7688_match_table);
> > > > +
> > > > +static struct i2c_driver anx7688_driver = {
> > > > + .probe_new = anx7688_i2c_probe,
> > > > + .remove = anx7688_i2c_remove,
> > > > + .driver = {
> > > > + .name = "anx7688",
> > > > + .of_match_table = anx7688_match_table,
> > > > + },
> > > > +};
> > > > +
> > > > +module_i2c_driver(anx7688_driver);
> > > > +
> > > > +MODULE_DESCRIPTION("ANX7688 HDMI->DP bridge driver");
> > > > +MODULE_AUTHOR("Nicolas Boichat <[email protected]>");
> > > > +MODULE_LICENSE("GPL");
> > > > --
> > > > 2.25.0
> > > >
> > > _______________________________________________
> > > dri-devel mailing list
> > > [email protected]
> > > https://lists.freedesktop.org/mailman/listinfo/dri-devel

2020-02-14 22:23:15

by Vasily Khoruzhick

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support

On Fri, Feb 14, 2020 at 2:20 PM Enric Balletbo Serra
<[email protected]> wrote:
>
> Hi Vasily,
>
> Missatge de Vasily Khoruzhick <[email protected]> del dia dv., 14 de
> febr. 2020 a les 23:17:
> >
> > On Fri, Feb 14, 2020 at 1:53 PM Enric Balletbo Serra
> > <[email protected]> wrote:
> > >
> > > Hi Vasily,
> > >
> > > Missatge de Vasily Khoruzhick <[email protected]> del dia dv., 14 de
> > > febr. 2020 a les 22:36:
> > > >
> > > > On Thu, Feb 13, 2020 at 6:54 AM Enric Balletbo i Serra
> > > > <[email protected]> wrote:
> > > > >
> > > > > From: Nicolas Boichat <[email protected]>
> > > > >
> > > > > ANX7688 is a HDMI to DP converter (as well as USB-C port controller),
> > > > > that has an internal microcontroller.
> > > > >
> > > > > The only reason a Linux kernel driver is necessary is to reject
> > > > > resolutions that require more bandwidth than what is available on
> > > > > the DP side. DP bandwidth and lane count are reported by the bridge
> > > > > via 2 registers on I2C.
> > > >
> > > > It is true only for your particular platform where usb-c part is
> > > > managed by firmware. Pinephone has the same anx7688 but linux will
> > > > need a driver that manages usb-c in addition to DP.
> > > >
> > > > I'd suggest making it MFD driver from the beginning, or at least make
> > > > proper bindings so we don't have to rework it and introduce binding
> > > > incompatibilities in future.
> > > >
> > >
> > > Do you have example code on how the ANX7866 is used in pinephone?
> > > There is a repo somewhere?
> >
> > I don't think it's implemented yet. I've CCed Icenowy in case if she
> > has anything.
> >
>
> It would be good to join the effort. Just because I am curious, there
> are public schematics for the pinephone that is using that bridge?

Schematics is available here:
https://wiki.pine64.org/index.php/PinePhone_v1.1_-_Braveheart#Schematic

> > > Thanks,
> > > Enric
> > >
> > > > > Signed-off-by: Nicolas Boichat <[email protected]>
> > > > > Signed-off-by: Hsin-Yi Wang <[email protected]>
> > > > > Signed-off-by: Enric Balletbo i Serra <[email protected]>
> > > > > ---
> > > > >
> > > > > Changes in v2:
> > > > > - Move driver to drivers/gpu/drm/bridge/analogix.
> > > > > - Make the driver OF only so we can reduce the ifdefs.
> > > > > - Update the Copyright to 2020.
> > > > > - Use probe_new so we can get rid of the i2c_device_id table.
> > > > >
> > > > > drivers/gpu/drm/bridge/analogix/Kconfig | 12 ++
> > > > > drivers/gpu/drm/bridge/analogix/Makefile | 1 +
> > > > > .../drm/bridge/analogix/analogix-anx7688.c | 188 ++++++++++++++++++
> > > > > 3 files changed, 201 insertions(+)
> > > > > create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> > > > >
> > > > > diff --git a/drivers/gpu/drm/bridge/analogix/Kconfig b/drivers/gpu/drm/bridge/analogix/Kconfig
> > > > > index e1fa7d820373..af7c2939403c 100644
> > > > > --- a/drivers/gpu/drm/bridge/analogix/Kconfig
> > > > > +++ b/drivers/gpu/drm/bridge/analogix/Kconfig
> > > > > @@ -11,6 +11,18 @@ config DRM_ANALOGIX_ANX6345
> > > > > ANX6345 transforms the LVTTL RGB output of an
> > > > > application processor to eDP or DisplayPort.
> > > > >
> > > > > +config DRM_ANALOGIX_ANX7688
> > > > > + tristate "Analogix ANX7688 bridge"
> > > > > + depends on OF
> > > > > + select DRM_KMS_HELPER
> > > > > + select REGMAP_I2C
> > > > > + help
> > > > > + ANX7688 is an ultra-low power 4k Ultra-HD (4096x2160p60)
> > > > > + mobile HD transmitter designed for portable devices. The
> > > > > + ANX7688 converts HDMI 2.0 to DisplayPort 1.3 Ultra-HD
> > > > > + including an intelligent crosspoint switch to support
> > > > > + USB Type-C.
> > > > > +
> > > > > config DRM_ANALOGIX_ANX78XX
> > > > > tristate "Analogix ANX78XX bridge"
> > > > > select DRM_ANALOGIX_DP
> > > > > diff --git a/drivers/gpu/drm/bridge/analogix/Makefile b/drivers/gpu/drm/bridge/analogix/Makefile
> > > > > index 97669b374098..27cd73635c8c 100644
> > > > > --- a/drivers/gpu/drm/bridge/analogix/Makefile
> > > > > +++ b/drivers/gpu/drm/bridge/analogix/Makefile
> > > > > @@ -1,5 +1,6 @@
> > > > > # SPDX-License-Identifier: GPL-2.0-only
> > > > > analogix_dp-objs := analogix_dp_core.o analogix_dp_reg.o analogix-i2c-dptx.o
> > > > > obj-$(CONFIG_DRM_ANALOGIX_ANX6345) += analogix-anx6345.o
> > > > > +obj-$(CONFIG_DRM_ANALOGIX_ANX7688) += analogix-anx7688.o
> > > > > obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
> > > > > obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix_dp.o
> > > > > diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c b/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> > > > > new file mode 100644
> > > > > index 000000000000..10a7cd0f9126
> > > > > --- /dev/null
> > > > > +++ b/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> > > > > @@ -0,0 +1,188 @@
> > > > > +// SPDX-License-Identifier: GPL-2.0-only
> > > > > +/*
> > > > > + * ANX7688 HDMI->DP bridge driver
> > > > > + *
> > > > > + * Copyright 2020 Google LLC
> > > > > + */
> > > > > +
> > > > > +#include <linux/i2c.h>
> > > > > +#include <linux/module.h>
> > > > > +#include <linux/regmap.h>
> > > > > +#include <drm/drm_bridge.h>
> > > > > +
> > > > > +/* Register addresses */
> > > > > +#define VENDOR_ID_REG 0x00
> > > > > +#define DEVICE_ID_REG 0x02
> > > > > +
> > > > > +#define FW_VERSION_REG 0x80
> > > > > +
> > > > > +#define DP_BANDWIDTH_REG 0x85
> > > > > +#define DP_LANE_COUNT_REG 0x86
> > > > > +
> > > > > +#define VENDOR_ID 0x1f29
> > > > > +#define DEVICE_ID 0x7688
> > > > > +
> > > > > +/* First supported firmware version (0.85) */
> > > > > +#define MINIMUM_FW_VERSION 0x0085
> > > > > +
> > > > > +struct anx7688 {
> > > > > + struct drm_bridge bridge;
> > > > > + struct i2c_client *client;
> > > > > + struct regmap *regmap;
> > > > > +
> > > > > + bool filter;
> > > > > +};
> > > > > +
> > > > > +static inline struct anx7688 *bridge_to_anx7688(struct drm_bridge *bridge)
> > > > > +{
> > > > > + return container_of(bridge, struct anx7688, bridge);
> > > > > +}
> > > > > +
> > > > > +static bool anx7688_bridge_mode_fixup(struct drm_bridge *bridge,
> > > > > + const struct drm_display_mode *mode,
> > > > > + struct drm_display_mode *adjusted_mode)
> > > > > +{
> > > > > + struct anx7688 *anx7688 = bridge_to_anx7688(bridge);
> > > > > + int totalbw, requiredbw;
> > > > > + u8 dpbw, lanecount;
> > > > > + u8 regs[2];
> > > > > + int ret;
> > > > > +
> > > > > + if (!anx7688->filter)
> > > > > + return true;
> > > > > +
> > > > > + /* Read both regs 0x85 (bandwidth) and 0x86 (lane count). */
> > > > > + ret = regmap_bulk_read(anx7688->regmap, DP_BANDWIDTH_REG, regs, 2);
> > > > > + if (ret < 0) {
> > > > > + dev_err(&anx7688->client->dev,
> > > > > + "Failed to read bandwidth/lane count\n");
> > > > > + return false;
> > > > > + }
> > > > > + dpbw = regs[0];
> > > > > + lanecount = regs[1];
> > > > > +
> > > > > + /* Maximum 0x19 bandwidth (6.75 Gbps Turbo mode), 2 lanes */
> > > > > + if (dpbw > 0x19 || lanecount > 2) {
> > > > > + dev_err(&anx7688->client->dev,
> > > > > + "Invalid bandwidth/lane count (%02x/%d)\n",
> > > > > + dpbw, lanecount);
> > > > > + return false;
> > > > > + }
> > > > > +
> > > > > + /* Compute available bandwidth (kHz) */
> > > > > + totalbw = dpbw * lanecount * 270000 * 8 / 10;
> > > > > +
> > > > > + /* Required bandwidth (8 bpc, kHz) */
> > > > > + requiredbw = mode->clock * 8 * 3;
> > > > > +
> > > > > + dev_dbg(&anx7688->client->dev,
> > > > > + "DP bandwidth: %d kHz (%02x/%d); mode requires %d Khz\n",
> > > > > + totalbw, dpbw, lanecount, requiredbw);
> > > > > +
> > > > > + if (totalbw == 0) {
> > > > > + dev_warn(&anx7688->client->dev,
> > > > > + "Bandwidth/lane count are 0, not rejecting modes\n");
> > > > > + return true;
> > > > > + }
> > > > > +
> > > > > + return totalbw >= requiredbw;
> > > > > +}
> > > > > +
> > > > > +static const struct drm_bridge_funcs anx7688_bridge_funcs = {
> > > > > + .mode_fixup = anx7688_bridge_mode_fixup,
> > > > > +};
> > > > > +
> > > > > +static const struct regmap_config anx7688_regmap_config = {
> > > > > + .reg_bits = 8,
> > > > > + .val_bits = 8,
> > > > > +};
> > > > > +
> > > > > +static int anx7688_i2c_probe(struct i2c_client *client)
> > > > > +{
> > > > > + struct device *dev = &client->dev;
> > > > > + struct anx7688 *anx7688;
> > > > > + u16 vendor, device;
> > > > > + u16 fwversion;
> > > > > + u8 buffer[4];
> > > > > + int ret;
> > > > > +
> > > > > + anx7688 = devm_kzalloc(dev, sizeof(*anx7688), GFP_KERNEL);
> > > > > + if (!anx7688)
> > > > > + return -ENOMEM;
> > > > > +
> > > > > + anx7688->bridge.of_node = dev->of_node;
> > > > > + anx7688->client = client;
> > > > > + i2c_set_clientdata(client, anx7688);
> > > > > +
> > > > > + anx7688->regmap = devm_regmap_init_i2c(client, &anx7688_regmap_config);
> > > > > +
> > > > > + /* Read both vendor and device id (4 bytes). */
> > > > > + ret = regmap_bulk_read(anx7688->regmap, VENDOR_ID_REG, buffer, 4);
> > > > > + if (ret) {
> > > > > + dev_err(dev, "Failed to read chip vendor/device id\n");
> > > > > + return ret;
> > > > > + }
> > > > > +
> > > > > + vendor = (u16)buffer[1] << 8 | buffer[0];
> > > > > + device = (u16)buffer[3] << 8 | buffer[2];
> > > > > + if (vendor != VENDOR_ID || device != DEVICE_ID) {
> > > > > + dev_err(dev, "Invalid vendor/device id %04x/%04x\n",
> > > > > + vendor, device);
> > > > > + return -ENODEV;
> > > > > + }
> > > > > +
> > > > > + ret = regmap_bulk_read(anx7688->regmap, FW_VERSION_REG, buffer, 2);
> > > > > + if (ret) {
> > > > > + dev_err(&client->dev, "Failed to read firmware version\n");
> > > > > + return ret;
> > > > > + }
> > > > > +
> > > > > + fwversion = (u16)buffer[0] << 8 | buffer[1];
> > > > > + dev_info(dev, "ANX7688 firwmare version %02x.%02x\n",
> > > > > + buffer[0], buffer[1]);
> > > > > +
> > > > > + /* FW version >= 0.85 supports bandwidth/lane count registers */
> > > > > + if (fwversion >= MINIMUM_FW_VERSION) {
> > > > > + anx7688->filter = true;
> > > > > + } else {
> > > > > + /* Warn, but not fail, for backwards compatibility. */
> > > > > + dev_warn(dev,
> > > > > + "Old ANX7688 FW version (%02x.%02x), not filtering\n",
> > > > > + buffer[0], buffer[1]);
> > > > > + }
> > > > > +
> > > > > + anx7688->bridge.funcs = &anx7688_bridge_funcs;
> > > > > + drm_bridge_add(&anx7688->bridge);
> > > > > +
> > > > > + return 0;
> > > > > +}
> > > > > +
> > > > > +static int anx7688_i2c_remove(struct i2c_client *client)
> > > > > +{
> > > > > + struct anx7688 *anx7688 = i2c_get_clientdata(client);
> > > > > +
> > > > > + drm_bridge_remove(&anx7688->bridge);
> > > > > +
> > > > > + return 0;
> > > > > +}
> > > > > +
> > > > > +static const struct of_device_id anx7688_match_table[] = {
> > > > > + { .compatible = "analogix,anx7688", },
> > > > > + { }
> > > > > +};
> > > > > +MODULE_DEVICE_TABLE(of, anx7688_match_table);
> > > > > +
> > > > > +static struct i2c_driver anx7688_driver = {
> > > > > + .probe_new = anx7688_i2c_probe,
> > > > > + .remove = anx7688_i2c_remove,
> > > > > + .driver = {
> > > > > + .name = "anx7688",
> > > > > + .of_match_table = anx7688_match_table,
> > > > > + },
> > > > > +};
> > > > > +
> > > > > +module_i2c_driver(anx7688_driver);
> > > > > +
> > > > > +MODULE_DESCRIPTION("ANX7688 HDMI->DP bridge driver");
> > > > > +MODULE_AUTHOR("Nicolas Boichat <[email protected]>");
> > > > > +MODULE_LICENSE("GPL");
> > > > > --
> > > > > 2.25.0
> > > > >
> > > > _______________________________________________
> > > > dri-devel mailing list
> > > > [email protected]
> > > > https://lists.freedesktop.org/mailman/listinfo/dri-devel

2020-02-15 00:37:33

by Nicolas Boichat

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support

On Fri, Feb 14, 2020 at 8:18 PM Andrzej Hajda <[email protected]> wrote:
>
> On 13.02.2020 15:54, Enric Balletbo i Serra wrote:
> > From: Nicolas Boichat <[email protected]>
> >
> > ANX7688 is a HDMI to DP converter (as well as USB-C port controller),
> > that has an internal microcontroller.
> >
> > The only reason a Linux kernel driver is necessary is to reject
> > resolutions that require more bandwidth than what is available on
> > the DP side. DP bandwidth and lane count are reported by the bridge
> > via 2 registers on I2C.
> >
> > Signed-off-by: Nicolas Boichat <[email protected]>
> > Signed-off-by: Hsin-Yi Wang <[email protected]>
> > Signed-off-by: Enric Balletbo i Serra <[email protected]>
> > ---
> >
> > Changes in v2:
> > - Move driver to drivers/gpu/drm/bridge/analogix.
> > - Make the driver OF only so we can reduce the ifdefs.
> > - Update the Copyright to 2020.
> > - Use probe_new so we can get rid of the i2c_device_id table.
> >
> > drivers/gpu/drm/bridge/analogix/Kconfig | 12 ++
> > drivers/gpu/drm/bridge/analogix/Makefile | 1 +
> > .../drm/bridge/analogix/analogix-anx7688.c | 188 ++++++++++++++++++
> > 3 files changed, 201 insertions(+)
> > create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> >
> > diff --git a/drivers/gpu/drm/bridge/analogix/Kconfig b/drivers/gpu/drm/bridge/analogix/Kconfig
> > index e1fa7d820373..af7c2939403c 100644
> > --- a/drivers/gpu/drm/bridge/analogix/Kconfig
> > +++ b/drivers/gpu/drm/bridge/analogix/Kconfig
> > @@ -11,6 +11,18 @@ config DRM_ANALOGIX_ANX6345
> > ANX6345 transforms the LVTTL RGB output of an
> > application processor to eDP or DisplayPort.
> >
> > +config DRM_ANALOGIX_ANX7688
> > + tristate "Analogix ANX7688 bridge"
> > + depends on OF
> > + select DRM_KMS_HELPER
> > + select REGMAP_I2C
> > + help
> > + ANX7688 is an ultra-low power 4k Ultra-HD (4096x2160p60)
> > + mobile HD transmitter designed for portable devices. The
> > + ANX7688 converts HDMI 2.0 to DisplayPort 1.3 Ultra-HD
> > + including an intelligent crosspoint switch to support
> > + USB Type-C.
> > +
> > config DRM_ANALOGIX_ANX78XX
> > tristate "Analogix ANX78XX bridge"
> > select DRM_ANALOGIX_DP
> > diff --git a/drivers/gpu/drm/bridge/analogix/Makefile b/drivers/gpu/drm/bridge/analogix/Makefile
> > index 97669b374098..27cd73635c8c 100644
> > --- a/drivers/gpu/drm/bridge/analogix/Makefile
> > +++ b/drivers/gpu/drm/bridge/analogix/Makefile
> > @@ -1,5 +1,6 @@
> > # SPDX-License-Identifier: GPL-2.0-only
> > analogix_dp-objs := analogix_dp_core.o analogix_dp_reg.o analogix-i2c-dptx.o
> > obj-$(CONFIG_DRM_ANALOGIX_ANX6345) += analogix-anx6345.o
> > +obj-$(CONFIG_DRM_ANALOGIX_ANX7688) += analogix-anx7688.o
> > obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
> > obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix_dp.o
> > diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c b/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> > new file mode 100644
> > index 000000000000..10a7cd0f9126
> > --- /dev/null
> > +++ b/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> > @@ -0,0 +1,188 @@
> > +// SPDX-License-Identifier: GPL-2.0-only
> > +/*
> > + * ANX7688 HDMI->DP bridge driver
> > + *
> > + * Copyright 2020 Google LLC
> > + */
> > +
> > +#include <linux/i2c.h>
> > +#include <linux/module.h>
> > +#include <linux/regmap.h>
> > +#include <drm/drm_bridge.h>
> > +
> > +/* Register addresses */
> > +#define VENDOR_ID_REG 0x00
> > +#define DEVICE_ID_REG 0x02
> > +
> > +#define FW_VERSION_REG 0x80
> > +
> > +#define DP_BANDWIDTH_REG 0x85
> > +#define DP_LANE_COUNT_REG 0x86
> > +
> > +#define VENDOR_ID 0x1f29
> > +#define DEVICE_ID 0x7688
> > +
> > +/* First supported firmware version (0.85) */
> > +#define MINIMUM_FW_VERSION 0x0085
> > +
> > +struct anx7688 {
> > + struct drm_bridge bridge;
> > + struct i2c_client *client;
> > + struct regmap *regmap;
> > +
> > + bool filter;
> > +};
> > +
> > +static inline struct anx7688 *bridge_to_anx7688(struct drm_bridge *bridge)
> > +{
> > + return container_of(bridge, struct anx7688, bridge);
> > +}
> > +
> > +static bool anx7688_bridge_mode_fixup(struct drm_bridge *bridge,
> > + const struct drm_display_mode *mode,
> > + struct drm_display_mode *adjusted_mode)
> > +{
> > + struct anx7688 *anx7688 = bridge_to_anx7688(bridge);
> > + int totalbw, requiredbw;
> > + u8 dpbw, lanecount;
> > + u8 regs[2];
> > + int ret;
> > +
> > + if (!anx7688->filter)
> > + return true;
> > +
> > + /* Read both regs 0x85 (bandwidth) and 0x86 (lane count). */
> > + ret = regmap_bulk_read(anx7688->regmap, DP_BANDWIDTH_REG, regs, 2);
> > + if (ret < 0) {
> > + dev_err(&anx7688->client->dev,
> > + "Failed to read bandwidth/lane count\n");
> > + return false;
> > + }
> > + dpbw = regs[0];
> > + lanecount = regs[1];
>
>
> Are these values hw invariant? Or they are result of cable probe/training?
>
> In 1st case this code should go rather to mode_valid.
>
>
> > +
> > + /* Maximum 0x19 bandwidth (6.75 Gbps Turbo mode), 2 lanes */
> > + if (dpbw > 0x19 || lanecount > 2) {
> > + dev_err(&anx7688->client->dev,
> > + "Invalid bandwidth/lane count (%02x/%d)\n",
> > + dpbw, lanecount);
> > + return false;
> > + }
> > +
> > + /* Compute available bandwidth (kHz) */
> > + totalbw = dpbw * lanecount * 270000 * 8 / 10;
> > +
> > + /* Required bandwidth (8 bpc, kHz) */
> > + requiredbw = mode->clock * 8 * 3;
> > +
> > + dev_dbg(&anx7688->client->dev,
> > + "DP bandwidth: %d kHz (%02x/%d); mode requires %d Khz\n",
> > + totalbw, dpbw, lanecount, requiredbw);
> > +
> > + if (totalbw == 0) {
> > + dev_warn(&anx7688->client->dev,
> > + "Bandwidth/lane count are 0, not rejecting modes\n");
> > + return true;
> > + }
> > +
> > + return totalbw >= requiredbw;
> > +}
> > +
> > +static const struct drm_bridge_funcs anx7688_bridge_funcs = {
> > + .mode_fixup = anx7688_bridge_mode_fixup,
> > +};
> > +
> > +static const struct regmap_config anx7688_regmap_config = {
> > + .reg_bits = 8,
> > + .val_bits = 8,
> > +};
> > +
> > +static int anx7688_i2c_probe(struct i2c_client *client)
> > +{
> > + struct device *dev = &client->dev;
> > + struct anx7688 *anx7688;
> > + u16 vendor, device;
> > + u16 fwversion;
> > + u8 buffer[4];
> > + int ret;
> > +
> > + anx7688 = devm_kzalloc(dev, sizeof(*anx7688), GFP_KERNEL);
> > + if (!anx7688)
> > + return -ENOMEM;
> > +
> > + anx7688->bridge.of_node = dev->of_node;
> > + anx7688->client = client;
> > + i2c_set_clientdata(client, anx7688);
> > +
> > + anx7688->regmap = devm_regmap_init_i2c(client, &anx7688_regmap_config);
> > +
> > + /* Read both vendor and device id (4 bytes). */
> > + ret = regmap_bulk_read(anx7688->regmap, VENDOR_ID_REG, buffer, 4);
> > + if (ret) {
> > + dev_err(dev, "Failed to read chip vendor/device id\n");
> > + return ret;
> > + }
> > +
> > + vendor = (u16)buffer[1] << 8 | buffer[0];
> > + device = (u16)buffer[3] << 8 | buffer[2];
>
>
> Here we have little endian, and...
>
>
> > + if (vendor != VENDOR_ID || device != DEVICE_ID) {
> > + dev_err(dev, "Invalid vendor/device id %04x/%04x\n",
> > + vendor, device);
> > + return -ENODEV;
> > + }
> > +
> > + ret = regmap_bulk_read(anx7688->regmap, FW_VERSION_REG, buffer, 2);
> > + if (ret) {
> > + dev_err(&client->dev, "Failed to read firmware version\n");
> > + return ret;
> > + }
> > +
> > + fwversion = (u16)buffer[0] << 8 | buffer[1];
>
>
> ...here big endian.
>
> Is it correct?

(since I'm looking at the datasheet, answering that one too)

This is some kind of BCD style encoding. Bits 15..8 are the minor
version, and 7..0 are the major version.

Yes it's weird, but it seems to be the way this is ,-)

>
> Overall driver looks OK.
>
> Reviewed-by: Andrzej Hajda <[email protected]>
>
> --
> Regards
> Andrzej
>
>
> > + dev_info(dev, "ANX7688 firwmare version %02x.%02x\n",
> > + buffer[0], buffer[1]);
> > +
> > + /* FW version >= 0.85 supports bandwidth/lane count registers */
> > + if (fwversion >= MINIMUM_FW_VERSION) {
> > + anx7688->filter = true;
> > + } else {
> > + /* Warn, but not fail, for backwards compatibility. */
> > + dev_warn(dev,
> > + "Old ANX7688 FW version (%02x.%02x), not filtering\n",
> > + buffer[0], buffer[1]);
> > + }
> > +
> > + anx7688->bridge.funcs = &anx7688_bridge_funcs;
> > + drm_bridge_add(&anx7688->bridge);
> > +
> > + return 0;
> > +}
> > +
> > +static int anx7688_i2c_remove(struct i2c_client *client)
> > +{
> > + struct anx7688 *anx7688 = i2c_get_clientdata(client);
> > +
> > + drm_bridge_remove(&anx7688->bridge);
> > +
> > + return 0;
> > +}
> > +
> > +static const struct of_device_id anx7688_match_table[] = {
> > + { .compatible = "analogix,anx7688", },
> > + { }
> > +};
> > +MODULE_DEVICE_TABLE(of, anx7688_match_table);
> > +
> > +static struct i2c_driver anx7688_driver = {
> > + .probe_new = anx7688_i2c_probe,
> > + .remove = anx7688_i2c_remove,
> > + .driver = {
> > + .name = "anx7688",
> > + .of_match_table = anx7688_match_table,
> > + },
> > +};
> > +
> > +module_i2c_driver(anx7688_driver);
> > +
> > +MODULE_DESCRIPTION("ANX7688 HDMI->DP bridge driver");
> > +MODULE_AUTHOR("Nicolas Boichat <[email protected]>");
> > +MODULE_LICENSE("GPL");
>
>

2020-02-15 00:58:54

by Nicolas Boichat

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support

On Sat, Feb 15, 2020 at 5:36 AM Vasily Khoruzhick <[email protected]> wrote:
>
> On Thu, Feb 13, 2020 at 6:54 AM Enric Balletbo i Serra
> <[email protected]> wrote:
> >
> > From: Nicolas Boichat <[email protected]>
> >
> > ANX7688 is a HDMI to DP converter (as well as USB-C port controller),
> > that has an internal microcontroller.
> >
> > The only reason a Linux kernel driver is necessary is to reject
> > resolutions that require more bandwidth than what is available on
> > the DP side. DP bandwidth and lane count are reported by the bridge
> > via 2 registers on I2C.
>
> It is true only for your particular platform where usb-c part is
> managed by firmware. Pinephone has the same anx7688 but linux will
> need a driver that manages usb-c in addition to DP.
>
> I'd suggest making it MFD driver from the beginning, or at least make
> proper bindings so we don't have to rework it and introduce binding
> incompatibilities in future.

If that helps for the binding, ANX7688 is indeed a MFD (TCPC, HDMI to
DP converter, USB-C mux between USB 3.0 lanes and the DP output of the
embedded converter), with 2 I2C addresses:
- 0x2c is the TCPC/mux, used by the Embedded Controller [1] on Chrome
OS, and the code in this patch (my understanding is that lane count/BW
registers in the kernel driver below may only be available to FW on
Chromebooks).
- 0x28:
- Used to update the embedded FW in the anx7688 (on Chrome OS we
do this in depthcharge [2]). This is a EEPROM-based FW (so even
without implementing this, it'll usually "just work").
- Used to workaround some TCPC issues (see [1] again).

[1] EC driver: https://chromium.googlesource.com/chromiumos/platform/ec/+/refs/heads/master/driver/tcpm/anx7688.c
[2] depthcharge driver to update ANX7688 FW:
https://chromium.googlesource.com/chromiumos/platform/depthcharge/+/master/src/drivers/ec/anx7688/anx7688.c

2020-02-19 15:34:02

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] Documentation: bindings: Add ANX7688 HDMI to DP bridge binding

On Thu, Feb 13, 2020 at 03:54:15PM +0100, Enric Balletbo i Serra wrote:
> From: Nicolas Boichat <[email protected]>

'dt-bindings: ....' for the subject please.

>
> Add documentation for DT properties supported by anx7688 HDMI-DP
> converter.
>
> Signed-off-by: Nicolas Boichat <[email protected]>
> Signed-off-by: Hsin-Yi Wang <[email protected]>
> Signed-off-by: Enric Balletbo i Serra <[email protected]>
> ---
>
> Changes in v2:
> - Improve a bit the descriptions using the info from the datasheet.
> - Convert binding to yaml.
> - Use dual licensing.
>
> .../bindings/display/bridge/anx7688.yaml | 79 +++++++++++++++++++

Use the full compatible string: analogix,anx7688.yaml

> 1 file changed, 79 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/display/bridge/anx7688.yaml
>
> diff --git a/Documentation/devicetree/bindings/display/bridge/anx7688.yaml b/Documentation/devicetree/bindings/display/bridge/anx7688.yaml
> new file mode 100644
> index 000000000000..c1b4b5191d44
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/display/bridge/anx7688.yaml
> @@ -0,0 +1,79 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/display/bridge/anx7688.yaml#

Don't forget to update this too.

> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Analogix ANX7688 HDMI to USB Type-C Bridge (Port Controller with MUX)
> +
> +maintainers:
> + - Nicolas Boichat <[email protected]>
> + - Enric Balletbo i Serra <[email protected]>
> +
> +description: |
> + The ANX7688 is a single-chip mobile transmitter to support 4K 60 frames per
> + second (4096x2160p60) or FHD 120 frames per second (1920x1080p120) video
> + resolution from a smartphone or tablet with full function USB-C.
> +
> + This binding only describes the HDMI to DP display bridge.
> +
> +properties:
> + compatible:
> + const: analogix,anx7688
> +
> + reg:
> + maxItems: 1
> + description: I2C address of the device

That's every reg, you can drop 'description'.

> +
> + ports:
> + type: object
> +
> + properties:
> + port@0:
> + type: object
> + description: |
> + Video port for HDMI input
> +
> + port@1:
> + type: object
> + description: |
> + Video port for DP output
> +
> + required:
> + - port@0

IMO, port@1 should be required too. If not a fixed panel, then it should
have a connector node.

> +
> +required:
> + - compatible
> + - reg
> + - ports
> +
> +examples:
> + - |
> + i2c0 {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + anx7688: dp-bridge@2c {
> + compatible = "analogix,anx7688";
> + reg = <0x2c>;
> +
> + ports {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + port@0 {
> + reg = <0>;
> + anx7866_in: endpoint {
> + remote-endpoint = <&hdmi0_out>;
> + };
> + };
> +
> + port@1 {
> + reg = <1>;
> + anx7866_out: endpoint {
> + remote-endpoint = <&panel_in>;
> + };
> + };
> + };
> + };
> + };
> --
> 2.25.0
>

2020-03-05 15:29:17

by Enric Balletbo i Serra

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support

Hi Vasily,

On 14/2/20 23:22, Vasily Khoruzhick wrote:
> On Fri, Feb 14, 2020 at 2:20 PM Enric Balletbo Serra
> <[email protected]> wrote:
>>
>> Hi Vasily,
>>
>> Missatge de Vasily Khoruzhick <[email protected]> del dia dv., 14 de
>> febr. 2020 a les 23:17:
>>>
>>> On Fri, Feb 14, 2020 at 1:53 PM Enric Balletbo Serra
>>> <[email protected]> wrote:
>>>>
>>>> Hi Vasily,
>>>>
>>>> Missatge de Vasily Khoruzhick <[email protected]> del dia dv., 14 de
>>>> febr. 2020 a les 22:36:
>>>>>
>>>>> On Thu, Feb 13, 2020 at 6:54 AM Enric Balletbo i Serra
>>>>> <[email protected]> wrote:
>>>>>>
>>>>>> From: Nicolas Boichat <[email protected]>
>>>>>>
>>>>>> ANX7688 is a HDMI to DP converter (as well as USB-C port controller),
>>>>>> that has an internal microcontroller.
>>>>>>
>>>>>> The only reason a Linux kernel driver is necessary is to reject
>>>>>> resolutions that require more bandwidth than what is available on
>>>>>> the DP side. DP bandwidth and lane count are reported by the bridge
>>>>>> via 2 registers on I2C.
>>>>>
>>>>> It is true only for your particular platform where usb-c part is
>>>>> managed by firmware. Pinephone has the same anx7688 but linux will
>>>>> need a driver that manages usb-c in addition to DP.
>>>>>
>>>>> I'd suggest making it MFD driver from the beginning, or at least make
>>>>> proper bindings so we don't have to rework it and introduce binding
>>>>> incompatibilities in future.
>>>>>
>>>>
>>>> Do you have example code on how the ANX7866 is used in pinephone?
>>>> There is a repo somewhere?
>>>
>>> I don't think it's implemented yet. I've CCed Icenowy in case if she
>>> has anything.
>>>
>>
>> It would be good to join the effort. Just because I am curious, there
>> are public schematics for the pinephone that is using that bridge?
>
> Schematics is available here:
> https://wiki.pine64.org/index.php/PinePhone_v1.1_-_Braveheart#Schematic
>

Would you mind to check which firmware version is running the anx7688 in
PinePhone, I think should be easy to check with i2c-tools.

Thanks in advance,
Enric

[snip]

2020-03-05 18:30:23

by Vasily Khoruzhick

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support

On Thu, Mar 5, 2020 at 7:28 AM Enric Balletbo i Serra
<[email protected]> wrote:
>
> Hi Vasily,

CC: Icenowy and Ondrej
>
> Would you mind to check which firmware version is running the anx7688 in
> PinePhone, I think should be easy to check with i2c-tools.

Icenowy, Ondrej, can you guys please check anx7688 firmware version?

> Thanks in advance,
> Enric
>
> [snip]

2020-03-05 18:37:22

by Icenowy Zheng

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support



于 2020年3月6日 GMT+08:00 上午2:29:33, Vasily Khoruzhick <[email protected]> 写到:
>On Thu, Mar 5, 2020 at 7:28 AM Enric Balletbo i Serra
><[email protected]> wrote:
>>
>> Hi Vasily,
>
>CC: Icenowy and Ondrej
>>
>> Would you mind to check which firmware version is running the anx7688
>in
>> PinePhone, I think should be easy to check with i2c-tools.
>
>Icenowy, Ondrej, can you guys please check anx7688 firmware version?

At 0x2c, 0x80 is 0x01, 0x81 is 0x25

01.25, right?

>
>> Thanks in advance,
>> Enric
>>
>> [snip]

--
使用 K-9 Mail 发送自我的Android设备。

2020-03-05 19:35:46

by Ondřej Jirman

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support

Hi,

On Thu, Mar 05, 2020 at 10:29:33AM -0800, Vasily Khoruzhick wrote:
> On Thu, Mar 5, 2020 at 7:28 AM Enric Balletbo i Serra
> <[email protected]> wrote:
> >
> > Hi Vasily,
>
> CC: Icenowy and Ondrej
> >
> > Would you mind to check which firmware version is running the anx7688 in
> > PinePhone, I think should be easy to check with i2c-tools.
>
> Icenowy, Ondrej, can you guys please check anx7688 firmware version?

i2cget 0 0x28 0x00 w
0xaaaa

i2cget 0 0x28 0x02 w
0x7688

i2cget 0 0x28 0x80 w
0x0000

regards,
o.

> > Thanks in advance,
> > Enric
> >
> > [snip]

2020-03-06 08:47:57

by Enric Balletbo i Serra

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support

Hi Ondrej,

On 5/3/20 20:35, Ondřej Jirman wrote:
> Hi,
>
> On Thu, Mar 05, 2020 at 10:29:33AM -0800, Vasily Khoruzhick wrote:
>> On Thu, Mar 5, 2020 at 7:28 AM Enric Balletbo i Serra
>> <[email protected]> wrote:
>>>
>>> Hi Vasily,
>>
>> CC: Icenowy and Ondrej
>>>
>>> Would you mind to check which firmware version is running the anx7688 in
>>> PinePhone, I think should be easy to check with i2c-tools.
>>
>> Icenowy, Ondrej, can you guys please check anx7688 firmware version?
>
> i2cget 0 0x28 0x00 w
> 0xaaaa
>
> i2cget 0 0x28 0x02 w
> 0x7688
>
> i2cget 0 0x28 0x80 w
> 0x0000
>

Can you check the value for 0x81 too?

Thanks,
Enric


> regards,
> o.
>
>>> Thanks in advance,
>>> Enric
>>>
>>> [snip]

2020-03-06 08:48:03

by Enric Balletbo i Serra

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support

Hi Icenowy,

On 5/3/20 19:35, Icenowy Zheng wrote:
>
>
> 于 2020年3月6日 GMT+08:00 上午2:29:33, Vasily Khoruzhick <[email protected]> 写到:
>> On Thu, Mar 5, 2020 at 7:28 AM Enric Balletbo i Serra
>> <[email protected]> wrote:
>>>
>>> Hi Vasily,
>>
>> CC: Icenowy and Ondrej
>>>
>>> Would you mind to check which firmware version is running the anx7688
>> in
>>> PinePhone, I think should be easy to check with i2c-tools.
>>
>> Icenowy, Ondrej, can you guys please check anx7688 firmware version?
>
> At 0x2c, 0x80 is 0x01, 0x81 is 0x25
>
> 01.25, right?
>

Yes, thanks.

>>
>>> Thanks in advance,
>>> Enric
>>>
>>> [snip]
>

2020-03-06 08:54:57

by Icenowy Zheng

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support

在 2020-03-06星期五的 09:46 +0100,Enric Balletbo i Serra写道:
> Hi Ondrej,
>
> On 5/3/20 20:35, Ondřej Jirman wrote:
> > Hi,
> >
> > On Thu, Mar 05, 2020 at 10:29:33AM -0800, Vasily Khoruzhick wrote:
> > > On Thu, Mar 5, 2020 at 7:28 AM Enric Balletbo i Serra
> > > <[email protected]> wrote:
> > > > Hi Vasily,
> > >
> > > CC: Icenowy and Ondrej
> > > > Would you mind to check which firmware version is running the
> > > > anx7688 in
> > > > PinePhone, I think should be easy to check with i2c-tools.
> > >
> > > Icenowy, Ondrej, can you guys please check anx7688 firmware
> > > version?
> >
> > i2cget 0 0x28 0x00 w
> > 0xaaaa
> >
> > i2cget 0 0x28 0x02 w
> > 0x7688
> >
> > i2cget 0 0x28 0x80 w
> > 0x0000
> >
>
> Can you check the value for 0x81 too?

root@ice-pinephone [ ~ ] # i2cdump 0 0x28
No size specified (using byte-data access)
WARNING! This program can confuse your I2C bus, cause data loss and
worse!
I will probe file /dev/i2c-0, address 0x28, mode byte
Continue? [Y/n]
0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
00: aa aa 88 76 ac 00 00 00 00 00 00 00 00 00 05 05 ???v?.........??
10: 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0...............
20: 00 00 00 00 00 00 00 00 00 00 00 24 f2 e4 ff 00 ...........$??..
30: 06 40 00 04 94 11 20 ff ff 03 00 bf ff ff 10 01 ?@.??? ..?.?..??
40: 72 a4 00 09 00 08 05 84 15 40 17 00 00 0a 00 e0 r?.?.????@?..?.?
50: 00 00 00 0a 10 00 e0 df ff ff 00 00 00 10 71 00 ...??.??.....?q.
60: 10 10 04 29 2d 21 10 01 09 13 00 03 e8 13 88 00 ???)-!????.????.
70: 00 19 18 83 16 5c 11 00 ff 00 00 0d 04 38 42 07 .????\?....??8B?
80: 00 00 00 00 00 74 1b 19 44 08 75 00 00 00 00 00 .....t??D?u.....
90: 01 02 00 00 00 00 03 00 ff 30 00 59 01 00 00 00 ??....?..0.Y?...
a0: 00 ff fe ff ff 00 00 00 00 00 00 00 00 00 00 02 ..?............?
b0: 00 00 00 00 00 00 40 00 28 00 00 00 00 44 08 00 ......@.(....D?.
c0: 00 00 00 00 80 00 10 01 0a 10 18 00 00 fd 00 00 ....?.?????..?..
d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
e0: 50 10 08 50 00 02 00 70 00 00 30 10 0b 02 1c 01 P??P.?.p..0?????
f0: 00 0b 07 00 94 11 7f 00 00 00 00 00 00 01 0e ff .??.???......??.
root@ice-pinephone [ ~ ] # i2cdump 0 0x2c
No size specified (using byte-data access)
WARNING! This program can confuse your I2C bus, cause data loss and
worse!
I will probe file /dev/i2c-0, address 0x2c, mode byte
Continue? [Y/n]
0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
00: 29 1f 88 76 00 ac 11 00 11 20 10 10 00 00 00 00 )??v.??.? ??....
10: 03 00 ff 8f ff 7f 00 00 00 00 05 00 10 0a 0c 00 ?..?.?....?.???.
20: 00 00 00 00 99 06 c0 00 00 00 00 00 00 00 02 00 ....???.......?.
30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
40: 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ?...............
50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
70: b8 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ?...............
80: 01 25 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ?%..............
90: 0f 0f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ??..............
a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................

>
> Thanks,
> Enric
>
>
> > regards,
> > o.
> >
> > > > Thanks in advance,
> > > > Enric
> > > >
> > > > [snip]

2020-03-06 12:05:25

by Ondřej Jirman

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support

On Fri, Mar 06, 2020 at 09:46:51AM +0100, Enric Balletbo i Serra wrote:
> Hi Ondrej,
>
> On 5/3/20 20:35, Ondřej Jirman wrote:
> > Hi,
> >
> > On Thu, Mar 05, 2020 at 10:29:33AM -0800, Vasily Khoruzhick wrote:
> >> On Thu, Mar 5, 2020 at 7:28 AM Enric Balletbo i Serra
> >> <[email protected]> wrote:
> >>>
> >>> Hi Vasily,
> >>
> >> CC: Icenowy and Ondrej
> >>>
> >>> Would you mind to check which firmware version is running the anx7688 in
> >>> PinePhone, I think should be easy to check with i2c-tools.
> >>
> >> Icenowy, Ondrej, can you guys please check anx7688 firmware version?
> >
> > i2cget 0 0x28 0x00 w
> > 0xaaaa
> >
> > i2cget 0 0x28 0x02 w
> > 0x7688
> >
> > i2cget 0 0x28 0x80 w
> > 0x0000
> >
>
> Can you check the value for 0x81 too?

'w' read checks both values at once, as you can see above.

regards,
o.

> Thanks,
> Enric
>
>
> > regards,
> > o.
> >
> >>> Thanks in advance,
> >>> Enric
> >>>
> >>> [snip]

2020-03-06 12:08:20

by Ondřej Jirman

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support

On Fri, Mar 06, 2020 at 04:53:46PM +0800, Icenowy Zheng wrote:
> 在 2020-03-06星期五的 09:46 +0100,Enric Balletbo i Serra写道:
> > Hi Ondrej,
> >
> > On 5/3/20 20:35, Ondřej Jirman wrote:
> > > Hi,
> > >
> > > On Thu, Mar 05, 2020 at 10:29:33AM -0800, Vasily Khoruzhick wrote:
> > > > On Thu, Mar 5, 2020 at 7:28 AM Enric Balletbo i Serra
> > > > <[email protected]> wrote:
> > > > > Hi Vasily,
> > > >
> > > > CC: Icenowy and Ondrej
> > > > > Would you mind to check which firmware version is running the
> > > > > anx7688 in
> > > > > PinePhone, I think should be easy to check with i2c-tools.
> > > >
> > > > Icenowy, Ondrej, can you guys please check anx7688 firmware
> > > > version?
> > >
> > > i2cget 0 0x28 0x00 w
> > > 0xaaaa
> > >
> > > i2cget 0 0x28 0x02 w
> > > 0x7688
> > >
> > > i2cget 0 0x28 0x80 w
> > > 0x0000
> > >
> >
> > Can you check the value for 0x81 too?
>
> root@ice-pinephone [ ~ ] # i2cdump 0 0x28
> No size specified (using byte-data access)
> WARNING! This program can confuse your I2C bus, cause data loss and
> worse!
> I will probe file /dev/i2c-0, address 0x28, mode byte
> Continue? [Y/n]
> 0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
> 00: aa aa 88 76 ac 00 00 00 00 00 00 00 00 00 05 05 ???v?.........??
> 10: 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0...............
> 20: 00 00 00 00 00 00 00 00 00 00 00 24 f2 e4 ff 00 ...........$??..
> 30: 06 40 00 04 94 11 20 ff ff 03 00 bf ff ff 10 01 ?@.??? ..?.?..??
> 40: 72 a4 00 09 00 08 05 84 15 40 17 00 00 0a 00 e0 r?.?.????@?..?.?
> 50: 00 00 00 0a 10 00 e0 df ff ff 00 00 00 10 71 00 ...??.??.....?q.
> 60: 10 10 04 29 2d 21 10 01 09 13 00 03 e8 13 88 00 ???)-!????.????.
> 70: 00 19 18 83 16 5c 11 00 ff 00 00 0d 04 38 42 07 .????\?....??8B?
> 80: 00 00 00 00 00 74 1b 19 44 08 75 00 00 00 00 00 .....t??D?u.....
> 90: 01 02 00 00 00 00 03 00 ff 30 00 59 01 00 00 00 ??....?..0.Y?...
> a0: 00 ff fe ff ff 00 00 00 00 00 00 00 00 00 00 02 ..?............?
> b0: 00 00 00 00 00 00 40 00 28 00 00 00 00 44 08 00 ......@.(....D?.
> c0: 00 00 00 00 80 00 10 01 0a 10 18 00 00 fd 00 00 ....?.?????..?..
> d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> e0: 50 10 08 50 00 02 00 70 00 00 30 10 0b 02 1c 01 P??P.?.p..0?????
> f0: 00 0b 07 00 94 11 7f 00 00 00 00 00 00 01 0e ff .??.???......??.

My values for 0x28 address match this. ^

Interesting that it returns different register values for different
device addresses.

> root@ice-pinephone [ ~ ] # i2cdump 0 0x2c
> No size specified (using byte-data access)
> WARNING! This program can confuse your I2C bus, cause data loss and
> worse!
> I will probe file /dev/i2c-0, address 0x2c, mode byte
> Continue? [Y/n]
> 0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
> 00: 29 1f 88 76 00 ac 11 00 11 20 10 10 00 00 00 00 )??v.??.? ??....
> 10: 03 00 ff 8f ff 7f 00 00 00 00 05 00 10 0a 0c 00 ?..?.?....?.???.
> 20: 00 00 00 00 99 06 c0 00 00 00 00 00 00 00 02 00 ....???.......?.
> 30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> 40: 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ?...............
> 50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> 60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> 70: b8 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ?...............
> 80: 01 25 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ?%..............
> 90: 0f 0f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ??..............
> a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
>
> >
> > Thanks,
> > Enric
> >
> >
> > > regards,
> > > o.
> > >
> > > > > Thanks in advance,
> > > > > Enric
> > > > >
> > > > > [snip]
>

2020-03-06 12:13:19

by Nicolas Boichat

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support

On Fri, Mar 6, 2020 at 8:07 PM Ondřej Jirman <[email protected]> wrote:
>
> On Fri, Mar 06, 2020 at 04:53:46PM +0800, Icenowy Zheng wrote:
> > 在 2020-03-06星期五的 09:46 +0100,Enric Balletbo i Serra写道:
> > > Hi Ondrej,
> > >
> > > On 5/3/20 20:35, Ondřej Jirman wrote:
> > > > Hi,
> > > >
> > > > On Thu, Mar 05, 2020 at 10:29:33AM -0800, Vasily Khoruzhick wrote:
> > > > > On Thu, Mar 5, 2020 at 7:28 AM Enric Balletbo i Serra
> > > > > <[email protected]> wrote:
> > > > > > Hi Vasily,
> > > > >
> > > > > CC: Icenowy and Ondrej
> > > > > > Would you mind to check which firmware version is running the
> > > > > > anx7688 in
> > > > > > PinePhone, I think should be easy to check with i2c-tools.
> > > > >
> > > > > Icenowy, Ondrej, can you guys please check anx7688 firmware
> > > > > version?
> > > >
> > > > i2cget 0 0x28 0x00 w
> > > > 0xaaaa
> > > >
> > > > i2cget 0 0x28 0x02 w
> > > > 0x7688
> > > >
> > > > i2cget 0 0x28 0x80 w
> > > > 0x0000
> > > >
> > >
> > > Can you check the value for 0x81 too?
> >
> > root@ice-pinephone [ ~ ] # i2cdump 0 0x28
> > No size specified (using byte-data access)
> > WARNING! This program can confuse your I2C bus, cause data loss and
> > worse!
> > I will probe file /dev/i2c-0, address 0x28, mode byte
> > Continue? [Y/n]
> > 0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
> > 00: aa aa 88 76 ac 00 00 00 00 00 00 00 00 00 05 05 ???v?.........??
> > 10: 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0...............
> > 20: 00 00 00 00 00 00 00 00 00 00 00 24 f2 e4 ff 00 ...........$??..
> > 30: 06 40 00 04 94 11 20 ff ff 03 00 bf ff ff 10 01 ?@.??? ..?.?..??
> > 40: 72 a4 00 09 00 08 05 84 15 40 17 00 00 0a 00 e0 r?.?.????@?..?.?
> > 50: 00 00 00 0a 10 00 e0 df ff ff 00 00 00 10 71 00 ...??.??.....?q.
> > 60: 10 10 04 29 2d 21 10 01 09 13 00 03 e8 13 88 00 ???)-!????.????.
> > 70: 00 19 18 83 16 5c 11 00 ff 00 00 0d 04 38 42 07 .????\?....??8B?
> > 80: 00 00 00 00 00 74 1b 19 44 08 75 00 00 00 00 00 .....t??D?u.....
> > 90: 01 02 00 00 00 00 03 00 ff 30 00 59 01 00 00 00 ??....?..0.Y?...
> > a0: 00 ff fe ff ff 00 00 00 00 00 00 00 00 00 00 02 ..?............?
> > b0: 00 00 00 00 00 00 40 00 28 00 00 00 00 44 08 00 ......@.(....D?.
> > c0: 00 00 00 00 80 00 10 01 0a 10 18 00 00 fd 00 00 ....?.?????..?..
> > d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> > e0: 50 10 08 50 00 02 00 70 00 00 30 10 0b 02 1c 01 P??P.?.p..0?????
> > f0: 00 0b 07 00 94 11 7f 00 00 00 00 00 00 01 0e ff .??.???......??.
>
> My values for 0x28 address match this. ^

What about the values at 0x2c?

> Interesting that it returns different register values for different
> device addresses.

Yes the registers have different meanings for the 2 addresses.

Thanks,

2020-03-06 12:19:46

by Enric Balletbo i Serra

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support



On 6/3/20 13:03, Ondřej Jirman wrote:
> On Fri, Mar 06, 2020 at 09:46:51AM +0100, Enric Balletbo i Serra wrote:
>> Hi Ondrej,
>>
>> On 5/3/20 20:35, Ondřej Jirman wrote:
>>> Hi,
>>>
>>> On Thu, Mar 05, 2020 at 10:29:33AM -0800, Vasily Khoruzhick wrote:
>>>> On Thu, Mar 5, 2020 at 7:28 AM Enric Balletbo i Serra
>>>> <[email protected]> wrote:
>>>>>
>>>>> Hi Vasily,
>>>>
>>>> CC: Icenowy and Ondrej
>>>>>
>>>>> Would you mind to check which firmware version is running the anx7688 in
>>>>> PinePhone, I think should be easy to check with i2c-tools.
>>>>
>>>> Icenowy, Ondrej, can you guys please check anx7688 firmware version?
>>>
>>> i2cget 0 0x28 0x00 w
>>> 0xaaaa
>>>
>>> i2cget 0 0x28 0x02 w
>>> 0x7688
>>>
>>> i2cget 0 0x28 0x80 w
>>> 0x0000
>>>
>>
>> Can you check the value for 0x81 too?
>
> 'w' read checks both values at once, as you can see above.
>

Oh right, sorry. The thing is that firmware version is at 0x2c, not 0x28, so
we're interested on see register 0x80 and 0x81 for 0x2c address.

Thanks,
Enric

> regards,
> o.
>
>> Thanks,
>> Enric
>>
>>
>>> regards,
>>> o.
>>>
>>>>> Thanks in advance,
>>>>> Enric
>>>>>
>>>>> [snip]

2020-03-06 12:47:30

by Ondřej Jirman

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support

On Fri, Mar 06, 2020 at 08:11:07PM +0800, Nicolas Boichat wrote:
> On Fri, Mar 6, 2020 at 8:07 PM Ondřej Jirman <[email protected]> wrote:
>
> What about the values at 0x2c?

i2cdump 0 0x28

0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
00: aa aa 88 76 ac 00 00 00 00 00 00 00 00 80 05 05 ???v?........???
10: 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0...............
20: 00 00 00 00 00 00 00 00 00 00 00 34 f2 e4 ff 00 ...........4??..
30: 04 40 00 04 94 11 20 ff ff 03 00 ff ff ff 00 01 ?@.??? ..?.....?
40: 78 a4 00 09 00 08 05 84 10 60 17 00 00 0a 00 b0 x?.?.????`?..?.?
50: 00 00 00 0a 00 00 e0 df ff ff 00 00 00 10 71 00 ...?..??.....?q.
60: 10 10 04 29 2d 21 10 01 09 03 00 03 e8 13 88 00 ???)-!????.????.
70: 00 19 18 83 06 5a 11 00 ff 00 00 0d 04 38 42 07 .????Z?....??8B?
80: 00 00 00 00 00 74 1b 19 40 08 75 00 00 00 00 00 .....t??@?u.....
90: 00 00 00 00 00 00 03 00 ff 30 00 59 01 00 00 00 ......?..0.Y?...
a0: 00 ff ff ff ff 00 00 00 00 00 00 00 00 00 00 00 ................
b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
c0: 00 00 00 00 00 00 00 00 0a 10 18 00 00 ff 00 00 ........???.....
d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
e0: 50 10 08 50 00 02 00 70 00 00 30 10 11 02 1c 01 P??P.?.p..0?????
f0: 00 11 07 00 94 11 7f 00 00 00 00 00 00 01 0e ff .??.???......??.

i2cdump 0 0x2c

0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
00: 29 1f 88 76 00 ac 11 00 11 20 10 10 00 00 00 00 )??v.??.? ??....
10: 03 00 ff 8f ff 7f 00 00 00 00 0a 00 10 11 0c 00 ?..?.?....?.???.
20: 00 00 00 00 99 06 c0 00 00 00 00 00 00 00 02 00 ....???.......?.
30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
70: b4 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ?...............
80: 01 25 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ?%..............
90: 0f 0f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ??..............
a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................


regards,
o.

>
> Thanks,