devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V3 0/4] drm/bridge: it66121: Add initial it66122 support
@ 2025-08-15  3:41 Nishanth Menon
  2025-08-15  3:41 ` [PATCH V3 1/4] dt-bindings: display: bridge: it66121: Add compatible string for IT66122 Nishanth Menon
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Nishanth Menon @ 2025-08-15  3:41 UTC (permalink / raw)
  To: Conor Dooley, Krzysztof Kozlowski, Rob Herring, David Airlie,
	Maxime Ripard, Laurent Pinchart, Neil Armstrong
  Cc: linux-kernel, devicetree, dri-devel, Robert Nelson, Jason Kridner,
	afd, tomi.valkeinen, devarsht, Nishanth Menon

Hi,

Add initial support for IT66122, which seems to be compatible to it66121
but probably has additional functionality.

BeagleY-AI uses this it66122 as the old part is no longer in production
as far as I understand.

Now, BeaglePlay uses it66121 at the moment, but at some point, it might
end up flipping over to the new part. Additionally, it also looks like
Revision D of BeagleBone Black switched over to it66122 as well.

Changes in V3:
Based on Tomi's and Devarsh's reviews, and searching online (and failing
to find) for a public data sheet, I have refactored the series to:
a) Detect the ID by matching vid/pid
b) Introduce it66122 basic support which seems to work based on
   empirical testing evidence on BeagleY-AI. This allows incremental
   patches in the future by someone who might have access to the data
   sheet to add additional features for the chip.
c) Irritated by checkpatch --strict warnings, added a patch to fix
   existing warnings as part of this series, but it could probably go
   in independent of everything else.
d) Stopped claiming it66122 is drop in replacement of it66121 :)

Changes in V2:
* Picked up Krystoff's binding ack
* Switched over to a vid/pid list

V1: https://lore.kernel.org/all/20250813190835.344563-1-nm@ti.com/
V2: https://lore.kernel.org/all/20250813204106.580141-1-nm@ti.com/

Nishanth Menon (4):
  dt-bindings: display: bridge: it66121: Add compatible string for
    IT66122
  drm/bridge: it66121: Drop ftrace like dev_dbg() prints
  drm/bridge: it66121: Use vid/pid to detect the type of chip
  drm/bridge: it66121: Add minimal it66122 support

 .../bindings/display/bridge/ite,it66121.yaml  |  1 +
 drivers/gpu/drm/bridge/ite-it66121.c          | 63 +++++++++----------
 2 files changed, 32 insertions(+), 32 deletions(-)

-- 
2.47.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH V3 1/4] dt-bindings: display: bridge: it66121: Add compatible string for IT66122
  2025-08-15  3:41 [PATCH V3 0/4] drm/bridge: it66121: Add initial it66122 support Nishanth Menon
@ 2025-08-15  3:41 ` Nishanth Menon
  2025-08-15  3:41 ` [PATCH V3 2/4] drm/bridge: it66121: Drop ftrace like dev_dbg() prints Nishanth Menon
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: Nishanth Menon @ 2025-08-15  3:41 UTC (permalink / raw)
  To: Conor Dooley, Krzysztof Kozlowski, Rob Herring, David Airlie,
	Maxime Ripard, Laurent Pinchart, Neil Armstrong
  Cc: linux-kernel, devicetree, dri-devel, Robert Nelson, Jason Kridner,
	afd, tomi.valkeinen, devarsht, Nishanth Menon,
	Krzysztof Kozlowski

Add a new ite,it66122 compatible string to the IT66121 binding
documentation, since the two chips are practically same except for id
register difference.

Signed-off-by: Nishanth Menon <nm@ti.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
Changes in V3:
* None.

V2: https://lore.kernel.org/all/20250813204106.580141-2-nm@ti.com/
V1: https://lore.kernel.org/all/20250813190835.344563-2-nm@ti.com/

 .../devicetree/bindings/display/bridge/ite,it66121.yaml          | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/display/bridge/ite,it66121.yaml b/Documentation/devicetree/bindings/display/bridge/ite,it66121.yaml
index a7eb2603691f..c99b67f0bb73 100644
--- a/Documentation/devicetree/bindings/display/bridge/ite,it66121.yaml
+++ b/Documentation/devicetree/bindings/display/bridge/ite,it66121.yaml
@@ -19,6 +19,7 @@ properties:
   compatible:
     enum:
       - ite,it66121
+      - ite,it66122
       - ite,it6610
 
   reg:
-- 
2.47.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH V3 2/4] drm/bridge: it66121: Drop ftrace like dev_dbg() prints
  2025-08-15  3:41 [PATCH V3 0/4] drm/bridge: it66121: Add initial it66122 support Nishanth Menon
  2025-08-15  3:41 ` [PATCH V3 1/4] dt-bindings: display: bridge: it66121: Add compatible string for IT66122 Nishanth Menon
@ 2025-08-15  3:41 ` Nishanth Menon
  2025-08-15 13:50   ` Andrew Davis
  2025-08-16 19:23   ` Dmitry Baryshkov
  2025-08-15  3:41 ` [PATCH V3 3/4] drm/bridge: it66121: Use vid/pid to detect the type of chip Nishanth Menon
  2025-08-15  3:41 ` [PATCH V3 4/4] drm/bridge: it66121: Add minimal it66122 support Nishanth Menon
  3 siblings, 2 replies; 11+ messages in thread
From: Nishanth Menon @ 2025-08-15  3:41 UTC (permalink / raw)
  To: Conor Dooley, Krzysztof Kozlowski, Rob Herring, David Airlie,
	Maxime Ripard, Laurent Pinchart, Neil Armstrong
  Cc: linux-kernel, devicetree, dri-devel, Robert Nelson, Jason Kridner,
	afd, tomi.valkeinen, devarsht, Nishanth Menon

Drop the ftrace like dev_dbg() that checkpatch --strict complains about:

WARNING: Unnecessary ftrace-like logging - prefer using ftrace
+	dev_dbg(dev, "%s\n", __func__);

WARNING: Unnecessary ftrace-like logging - prefer using ftrace
+	dev_dbg(dev, "%s\n", __func__);

WARNING: Unnecessary ftrace-like logging - prefer using ftrace
+	dev_dbg(dev, "%s\n", __func__);

Signed-off-by: Nishanth Menon <nm@ti.com>
---
Changes in V3:
* New patch

 drivers/gpu/drm/bridge/ite-it66121.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/gpu/drm/bridge/ite-it66121.c b/drivers/gpu/drm/bridge/ite-it66121.c
index aa7b1dcc5d70..9b8ed2fae2f4 100644
--- a/drivers/gpu/drm/bridge/ite-it66121.c
+++ b/drivers/gpu/drm/bridge/ite-it66121.c
@@ -1384,8 +1384,6 @@ static int it66121_audio_startup(struct device *dev, void *data)
 	int ret;
 	struct it66121_ctx *ctx = dev_get_drvdata(dev);
 
-	dev_dbg(dev, "%s\n", __func__);
-
 	mutex_lock(&ctx->lock);
 	ret = it661221_audio_output_enable(ctx, true);
 	if (ret)
@@ -1401,8 +1399,6 @@ static void it66121_audio_shutdown(struct device *dev, void *data)
 	int ret;
 	struct it66121_ctx *ctx = dev_get_drvdata(dev);
 
-	dev_dbg(dev, "%s\n", __func__);
-
 	mutex_lock(&ctx->lock);
 	ret = it661221_audio_output_enable(ctx, false);
 	if (ret)
@@ -1479,8 +1475,6 @@ static int it66121_audio_codec_init(struct it66121_ctx *ctx, struct device *dev)
 		.no_capture_mute = 1,
 	};
 
-	dev_dbg(dev, "%s\n", __func__);
-
 	if (!of_property_present(dev->of_node, "#sound-dai-cells")) {
 		dev_info(dev, "No \"#sound-dai-cells\", no audio\n");
 		return 0;
-- 
2.47.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH V3 3/4] drm/bridge: it66121: Use vid/pid to detect the type of chip
  2025-08-15  3:41 [PATCH V3 0/4] drm/bridge: it66121: Add initial it66122 support Nishanth Menon
  2025-08-15  3:41 ` [PATCH V3 1/4] dt-bindings: display: bridge: it66121: Add compatible string for IT66122 Nishanth Menon
  2025-08-15  3:41 ` [PATCH V3 2/4] drm/bridge: it66121: Drop ftrace like dev_dbg() prints Nishanth Menon
@ 2025-08-15  3:41 ` Nishanth Menon
  2025-08-15 13:52   ` Andrew Davis
  2025-08-16 19:55   ` Dmitry Baryshkov
  2025-08-15  3:41 ` [PATCH V3 4/4] drm/bridge: it66121: Add minimal it66122 support Nishanth Menon
  3 siblings, 2 replies; 11+ messages in thread
From: Nishanth Menon @ 2025-08-15  3:41 UTC (permalink / raw)
  To: Conor Dooley, Krzysztof Kozlowski, Rob Herring, David Airlie,
	Maxime Ripard, Laurent Pinchart, Neil Armstrong
  Cc: linux-kernel, devicetree, dri-devel, Robert Nelson, Jason Kridner,
	afd, tomi.valkeinen, devarsht, Nishanth Menon

The driver knows exactly which version of the chip is present since
the vid/pid is used to enforce a compatibility. Given that some
devices like IT66121 has potentially been replaced with IT66122 mid
production for many platforms, it makes no sense to use the vid/pid as
an enforcement for compatibility. Instead, let us detect the ID of the
actual chip in use by matching the corresponding vid/pid.

This also allows for some future compatibility to be checked only
against a restricted set of vid/pid.

While at this, fix up a bit of formatting errors reported by
checkpatch warning, and since the ctx info just requires the id, drop
storing the entire chip_info pointer.

Signed-off-by: Nishanth Menon <nm@ti.com>
---
Changes in V3:
* Converted the patch to lookup ID based on vid/pid match rather than
  enforcing vid/pid match per compatible.
* Squashed a formating fix for pre-existing checkpatch --strict warning

V2: https://lore.kernel.org/all/20250813204106.580141-3-nm@ti.com/

 drivers/gpu/drm/bridge/ite-it66121.c | 53 ++++++++++++++--------------
 1 file changed, 27 insertions(+), 26 deletions(-)

diff --git a/drivers/gpu/drm/bridge/ite-it66121.c b/drivers/gpu/drm/bridge/ite-it66121.c
index 9b8ed2fae2f4..5ac9631bcd9a 100644
--- a/drivers/gpu/drm/bridge/ite-it66121.c
+++ b/drivers/gpu/drm/bridge/ite-it66121.c
@@ -312,7 +312,7 @@ struct it66121_ctx {
 		u8 swl;
 		bool auto_cts;
 	} audio;
-	const struct it66121_chip_info *info;
+	enum chip_id id;
 };
 
 static const struct regmap_range_cfg it66121_regmap_banks[] = {
@@ -402,7 +402,7 @@ static int it66121_configure_afe(struct it66121_ctx *ctx,
 		if (ret)
 			return ret;
 
-		if (ctx->info->id == ID_IT66121) {
+		if (ctx->id == ID_IT66121) {
 			ret = regmap_write_bits(ctx->regmap, IT66121_AFE_IP_REG,
 						IT66121_AFE_IP_EC1, 0);
 			if (ret)
@@ -428,7 +428,7 @@ static int it66121_configure_afe(struct it66121_ctx *ctx,
 		if (ret)
 			return ret;
 
-		if (ctx->info->id == ID_IT66121) {
+		if (ctx->id == ID_IT66121) {
 			ret = regmap_write_bits(ctx->regmap, IT66121_AFE_IP_REG,
 						IT66121_AFE_IP_EC1,
 						IT66121_AFE_IP_EC1);
@@ -449,7 +449,7 @@ static int it66121_configure_afe(struct it66121_ctx *ctx,
 	if (ret)
 		return ret;
 
-	if (ctx->info->id == ID_IT6610) {
+	if (ctx->id == ID_IT6610) {
 		ret = regmap_write_bits(ctx->regmap, IT66121_AFE_XP_REG,
 					IT6610_AFE_XP_BYPASS,
 					IT6610_AFE_XP_BYPASS);
@@ -599,7 +599,7 @@ static int it66121_bridge_attach(struct drm_bridge *bridge,
 	if (ret)
 		return ret;
 
-	if (ctx->info->id == ID_IT66121) {
+	if (ctx->id == ID_IT66121) {
 		ret = regmap_write_bits(ctx->regmap, IT66121_CLK_BANK_REG,
 					IT66121_CLK_BANK_PWROFF_RCLK, 0);
 		if (ret)
@@ -748,7 +748,7 @@ static int it66121_bridge_check(struct drm_bridge *bridge,
 {
 	struct it66121_ctx *ctx = container_of(bridge, struct it66121_ctx, bridge);
 
-	if (ctx->info->id == ID_IT6610) {
+	if (ctx->id == ID_IT6610) {
 		/* The IT6610 only supports these settings */
 		bridge_state->input_bus_cfg.flags |= DRM_BUS_FLAG_DE_HIGH |
 			DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE;
@@ -802,7 +802,7 @@ void it66121_bridge_mode_set(struct drm_bridge *bridge,
 	if (regmap_write(ctx->regmap, IT66121_HDMI_MODE_REG, IT66121_HDMI_MODE_HDMI))
 		goto unlock;
 
-	if (ctx->info->id == ID_IT66121 &&
+	if (ctx->id == ID_IT66121 &&
 	    regmap_write_bits(ctx->regmap, IT66121_CLK_BANK_REG,
 			      IT66121_CLK_BANK_PWROFF_TXCLK,
 			      IT66121_CLK_BANK_PWROFF_TXCLK)) {
@@ -815,7 +815,7 @@ void it66121_bridge_mode_set(struct drm_bridge *bridge,
 	if (it66121_configure_afe(ctx, adjusted_mode))
 		goto unlock;
 
-	if (ctx->info->id == ID_IT66121 &&
+	if (ctx->id == ID_IT66121 &&
 	    regmap_write_bits(ctx->regmap, IT66121_CLK_BANK_REG,
 			      IT66121_CLK_BANK_PWROFF_TXCLK, 0)) {
 		goto unlock;
@@ -1505,6 +1505,7 @@ static int it66121_probe(struct i2c_client *client)
 	int ret;
 	struct it66121_ctx *ctx;
 	struct device *dev = &client->dev;
+	const struct it66121_chip_info *chip_info;
 
 	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
 		dev_err(dev, "I2C check functionality failed.\n");
@@ -1522,7 +1523,7 @@ static int it66121_probe(struct i2c_client *client)
 
 	ctx->dev = dev;
 	ctx->client = client;
-	ctx->info = i2c_get_match_data(client);
+	chip_info = i2c_get_match_data(client);
 
 	of_property_read_u32(ep, "bus-width", &ctx->bus_width);
 	of_node_put(ep);
@@ -1568,11 +1569,17 @@ static int it66121_probe(struct i2c_client *client)
 	revision_id = FIELD_GET(IT66121_REVISION_MASK, device_ids[1]);
 	device_ids[1] &= IT66121_DEVICE_ID1_MASK;
 
-	if ((vendor_ids[1] << 8 | vendor_ids[0]) != ctx->info->vid ||
-	    (device_ids[1] << 8 | device_ids[0]) != ctx->info->pid) {
-		return -ENODEV;
+	for (; chip_info->vid; chip_info++) {
+		if ((vendor_ids[1] << 8 | vendor_ids[0]) == chip_info->vid &&
+		    (device_ids[1] << 8 | device_ids[0]) == chip_info->pid) {
+			ctx->id = chip_info->id;
+			break;
+		}
 	}
 
+	if (!chip_info->vid)
+		return -ENODEV;
+
 	ctx->bridge.of_node = dev->of_node;
 	ctx->bridge.type = DRM_MODE_CONNECTOR_HDMIA;
 	ctx->bridge.ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID;
@@ -1606,28 +1613,22 @@ static void it66121_remove(struct i2c_client *client)
 	mutex_destroy(&ctx->lock);
 }
 
-static const struct it66121_chip_info it66121_chip_info = {
-	.id = ID_IT66121,
-	.vid = 0x4954,
-	.pid = 0x0612,
-};
-
-static const struct it66121_chip_info it6610_chip_info = {
-	.id = ID_IT6610,
-	.vid = 0xca00,
-	.pid = 0x0611,
+static const struct it66121_chip_info it66xx_chip_info[] = {
+	{.id = ID_IT66121, .vid = 0x4954, .pid = 0x0612 },
+	{.id = ID_IT6610, .vid = 0xca00, .pid = 0x0611 },
+	{ }
 };
 
 static const struct of_device_id it66121_dt_match[] = {
-	{ .compatible = "ite,it66121", &it66121_chip_info },
-	{ .compatible = "ite,it6610", &it6610_chip_info },
+	{ .compatible = "ite,it66121", &it66xx_chip_info },
+	{ .compatible = "ite,it6610", &it66xx_chip_info },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, it66121_dt_match);
 
 static const struct i2c_device_id it66121_id[] = {
-	{ "it66121", (kernel_ulong_t) &it66121_chip_info },
-	{ "it6610", (kernel_ulong_t) &it6610_chip_info },
+	{ "it66121", (kernel_ulong_t)&it66xx_chip_info },
+	{ "it6610", (kernel_ulong_t)&it66xx_chip_info },
 	{ }
 };
 MODULE_DEVICE_TABLE(i2c, it66121_id);
-- 
2.47.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH V3 4/4] drm/bridge: it66121: Add minimal it66122 support
  2025-08-15  3:41 [PATCH V3 0/4] drm/bridge: it66121: Add initial it66122 support Nishanth Menon
                   ` (2 preceding siblings ...)
  2025-08-15  3:41 ` [PATCH V3 3/4] drm/bridge: it66121: Use vid/pid to detect the type of chip Nishanth Menon
@ 2025-08-15  3:41 ` Nishanth Menon
  2025-08-15 13:54   ` Andrew Davis
  3 siblings, 1 reply; 11+ messages in thread
From: Nishanth Menon @ 2025-08-15  3:41 UTC (permalink / raw)
  To: Conor Dooley, Krzysztof Kozlowski, Rob Herring, David Airlie,
	Maxime Ripard, Laurent Pinchart, Neil Armstrong
  Cc: linux-kernel, devicetree, dri-devel, Robert Nelson, Jason Kridner,
	afd, tomi.valkeinen, devarsht, Nishanth Menon

The IT66122 is a pin compatible replacement for the IT66122. Based on
empirical testing, the new device looks to be compatible with IT66121.
However due to a lack of public data sheet at this time beyond overall
feature list[1] (which seems to add additional features vs ITT66121),
it is hard to determine that additional register operations required
to enable additional features.

So, introduce the device as a new compatible that we will detect based
on vid/pid match, with explicit id that can be used to extend the
driver capability as information becomes available later on.

[1] https://www.ite.com.tw/en/product/cate1/IT66122

Signed-off-by: Nishanth Menon <nm@ti.com>
---
Changes in V3:
* Dropped the claim that it is 1-1 replacement of IT66121.
* Based on emperical test result[2], introduce the same configuration of
  IT66121, but provide ID as suggested by Devarsh to allow for future
  expansion of functionality.

NOTE: I did consider the possibility of converting the chip_id into a
bitfield, but decided it is over-engineering, so kept the enum.

[2] https://github.com/beagleboard/linux/commits/v6.1.83-ti-rt-r40

V2: https://lore.kernel.org/all/20250813204106.580141-4-nm@ti.com/

 drivers/gpu/drm/bridge/ite-it66121.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/bridge/ite-it66121.c b/drivers/gpu/drm/bridge/ite-it66121.c
index 5ac9631bcd9a..a108d287722d 100644
--- a/drivers/gpu/drm/bridge/ite-it66121.c
+++ b/drivers/gpu/drm/bridge/ite-it66121.c
@@ -287,6 +287,7 @@
 enum chip_id {
 	ID_IT6610,
 	ID_IT66121,
+	ID_IT66122,
 };
 
 struct it66121_chip_info {
@@ -402,7 +403,7 @@ static int it66121_configure_afe(struct it66121_ctx *ctx,
 		if (ret)
 			return ret;
 
-		if (ctx->id == ID_IT66121) {
+		if (ctx->id == ID_IT66121 || ctx->id == ID_IT66122) {
 			ret = regmap_write_bits(ctx->regmap, IT66121_AFE_IP_REG,
 						IT66121_AFE_IP_EC1, 0);
 			if (ret)
@@ -428,7 +429,7 @@ static int it66121_configure_afe(struct it66121_ctx *ctx,
 		if (ret)
 			return ret;
 
-		if (ctx->id == ID_IT66121) {
+		if (ctx->id == ID_IT66121 || ctx->id == ID_IT66122) {
 			ret = regmap_write_bits(ctx->regmap, IT66121_AFE_IP_REG,
 						IT66121_AFE_IP_EC1,
 						IT66121_AFE_IP_EC1);
@@ -599,7 +600,7 @@ static int it66121_bridge_attach(struct drm_bridge *bridge,
 	if (ret)
 		return ret;
 
-	if (ctx->id == ID_IT66121) {
+	if (ctx->id == ID_IT66121 || ctx->id == ID_IT66122) {
 		ret = regmap_write_bits(ctx->regmap, IT66121_CLK_BANK_REG,
 					IT66121_CLK_BANK_PWROFF_RCLK, 0);
 		if (ret)
@@ -802,7 +803,7 @@ void it66121_bridge_mode_set(struct drm_bridge *bridge,
 	if (regmap_write(ctx->regmap, IT66121_HDMI_MODE_REG, IT66121_HDMI_MODE_HDMI))
 		goto unlock;
 
-	if (ctx->id == ID_IT66121 &&
+	if ((ctx->id == ID_IT66121 || ctx->id == ID_IT66122) &&
 	    regmap_write_bits(ctx->regmap, IT66121_CLK_BANK_REG,
 			      IT66121_CLK_BANK_PWROFF_TXCLK,
 			      IT66121_CLK_BANK_PWROFF_TXCLK)) {
@@ -815,7 +816,7 @@ void it66121_bridge_mode_set(struct drm_bridge *bridge,
 	if (it66121_configure_afe(ctx, adjusted_mode))
 		goto unlock;
 
-	if (ctx->id == ID_IT66121 &&
+	if ((ctx->id == ID_IT66121 || ctx->id == ID_IT66122) &&
 	    regmap_write_bits(ctx->regmap, IT66121_CLK_BANK_REG,
 			      IT66121_CLK_BANK_PWROFF_TXCLK, 0)) {
 		goto unlock;
@@ -1614,12 +1615,14 @@ static void it66121_remove(struct i2c_client *client)
 }
 
 static const struct it66121_chip_info it66xx_chip_info[] = {
+	{.id = ID_IT66122, .vid = 0x4954, .pid = 0x0622 },
 	{.id = ID_IT66121, .vid = 0x4954, .pid = 0x0612 },
 	{.id = ID_IT6610, .vid = 0xca00, .pid = 0x0611 },
 	{ }
 };
 
 static const struct of_device_id it66121_dt_match[] = {
+	{ .compatible = "ite,it66122", &it66xx_chip_info },
 	{ .compatible = "ite,it66121", &it66xx_chip_info },
 	{ .compatible = "ite,it6610", &it66xx_chip_info },
 	{ }
@@ -1627,6 +1630,7 @@ static const struct of_device_id it66121_dt_match[] = {
 MODULE_DEVICE_TABLE(of, it66121_dt_match);
 
 static const struct i2c_device_id it66121_id[] = {
+	{ "it66122", (kernel_ulong_t)&it66xx_chip_info },
 	{ "it66121", (kernel_ulong_t)&it66xx_chip_info },
 	{ "it6610", (kernel_ulong_t)&it66xx_chip_info },
 	{ }
-- 
2.47.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH V3 2/4] drm/bridge: it66121: Drop ftrace like dev_dbg() prints
  2025-08-15  3:41 ` [PATCH V3 2/4] drm/bridge: it66121: Drop ftrace like dev_dbg() prints Nishanth Menon
@ 2025-08-15 13:50   ` Andrew Davis
  2025-08-16 19:23   ` Dmitry Baryshkov
  1 sibling, 0 replies; 11+ messages in thread
From: Andrew Davis @ 2025-08-15 13:50 UTC (permalink / raw)
  To: Nishanth Menon, Conor Dooley, Krzysztof Kozlowski, Rob Herring,
	David Airlie, Maxime Ripard, Laurent Pinchart, Neil Armstrong
  Cc: linux-kernel, devicetree, dri-devel, Robert Nelson, Jason Kridner,
	tomi.valkeinen, devarsht

On 8/14/25 10:41 PM, Nishanth Menon wrote:
> Drop the ftrace like dev_dbg() that checkpatch --strict complains about:
> 
> WARNING: Unnecessary ftrace-like logging - prefer using ftrace
> +	dev_dbg(dev, "%s\n", __func__);
> 
> WARNING: Unnecessary ftrace-like logging - prefer using ftrace
> +	dev_dbg(dev, "%s\n", __func__);
> 
> WARNING: Unnecessary ftrace-like logging - prefer using ftrace
> +	dev_dbg(dev, "%s\n", __func__);
> 
> Signed-off-by: Nishanth Menon <nm@ti.com>
> ---

Reviewed-by: Andrew Davis <afd@ti.com>

> Changes in V3:
> * New patch
> 
>   drivers/gpu/drm/bridge/ite-it66121.c | 6 ------
>   1 file changed, 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/ite-it66121.c b/drivers/gpu/drm/bridge/ite-it66121.c
> index aa7b1dcc5d70..9b8ed2fae2f4 100644
> --- a/drivers/gpu/drm/bridge/ite-it66121.c
> +++ b/drivers/gpu/drm/bridge/ite-it66121.c
> @@ -1384,8 +1384,6 @@ static int it66121_audio_startup(struct device *dev, void *data)
>   	int ret;
>   	struct it66121_ctx *ctx = dev_get_drvdata(dev);
>   
> -	dev_dbg(dev, "%s\n", __func__);
> -
>   	mutex_lock(&ctx->lock);
>   	ret = it661221_audio_output_enable(ctx, true);
>   	if (ret)
> @@ -1401,8 +1399,6 @@ static void it66121_audio_shutdown(struct device *dev, void *data)
>   	int ret;
>   	struct it66121_ctx *ctx = dev_get_drvdata(dev);
>   
> -	dev_dbg(dev, "%s\n", __func__);
> -
>   	mutex_lock(&ctx->lock);
>   	ret = it661221_audio_output_enable(ctx, false);
>   	if (ret)
> @@ -1479,8 +1475,6 @@ static int it66121_audio_codec_init(struct it66121_ctx *ctx, struct device *dev)
>   		.no_capture_mute = 1,
>   	};
>   
> -	dev_dbg(dev, "%s\n", __func__);
> -
>   	if (!of_property_present(dev->of_node, "#sound-dai-cells")) {
>   		dev_info(dev, "No \"#sound-dai-cells\", no audio\n");
>   		return 0;


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH V3 3/4] drm/bridge: it66121: Use vid/pid to detect the type of chip
  2025-08-15  3:41 ` [PATCH V3 3/4] drm/bridge: it66121: Use vid/pid to detect the type of chip Nishanth Menon
@ 2025-08-15 13:52   ` Andrew Davis
  2025-08-15 15:22     ` Nishanth Menon
  2025-08-16 19:55   ` Dmitry Baryshkov
  1 sibling, 1 reply; 11+ messages in thread
From: Andrew Davis @ 2025-08-15 13:52 UTC (permalink / raw)
  To: Nishanth Menon, Conor Dooley, Krzysztof Kozlowski, Rob Herring,
	David Airlie, Maxime Ripard, Laurent Pinchart, Neil Armstrong
  Cc: linux-kernel, devicetree, dri-devel, Robert Nelson, Jason Kridner,
	tomi.valkeinen, devarsht

On 8/14/25 10:41 PM, Nishanth Menon wrote:
> The driver knows exactly which version of the chip is present since
> the vid/pid is used to enforce a compatibility. Given that some
> devices like IT66121 has potentially been replaced with IT66122 mid
> production for many platforms, it makes no sense to use the vid/pid as
> an enforcement for compatibility. Instead, let us detect the ID of the
> actual chip in use by matching the corresponding vid/pid.
> 
> This also allows for some future compatibility to be checked only
> against a restricted set of vid/pid.
> 
> While at this, fix up a bit of formatting errors reported by
> checkpatch warning, and since the ctx info just requires the id, drop
> storing the entire chip_info pointer.
> 
> Signed-off-by: Nishanth Menon <nm@ti.com>
> ---
> Changes in V3:
> * Converted the patch to lookup ID based on vid/pid match rather than
>    enforcing vid/pid match per compatible.
> * Squashed a formating fix for pre-existing checkpatch --strict warning
> 
> V2: https://lore.kernel.org/all/20250813204106.580141-3-nm@ti.com/
> 
>   drivers/gpu/drm/bridge/ite-it66121.c | 53 ++++++++++++++--------------
>   1 file changed, 27 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/ite-it66121.c b/drivers/gpu/drm/bridge/ite-it66121.c
> index 9b8ed2fae2f4..5ac9631bcd9a 100644
> --- a/drivers/gpu/drm/bridge/ite-it66121.c
> +++ b/drivers/gpu/drm/bridge/ite-it66121.c
> @@ -312,7 +312,7 @@ struct it66121_ctx {
>   		u8 swl;
>   		bool auto_cts;
>   	} audio;
> -	const struct it66121_chip_info *info;
> +	enum chip_id id;
>   };
>   
>   static const struct regmap_range_cfg it66121_regmap_banks[] = {
> @@ -402,7 +402,7 @@ static int it66121_configure_afe(struct it66121_ctx *ctx,
>   		if (ret)
>   			return ret;
>   
> -		if (ctx->info->id == ID_IT66121) {
> +		if (ctx->id == ID_IT66121) {
>   			ret = regmap_write_bits(ctx->regmap, IT66121_AFE_IP_REG,
>   						IT66121_AFE_IP_EC1, 0);
>   			if (ret)
> @@ -428,7 +428,7 @@ static int it66121_configure_afe(struct it66121_ctx *ctx,
>   		if (ret)
>   			return ret;
>   
> -		if (ctx->info->id == ID_IT66121) {
> +		if (ctx->id == ID_IT66121) {
>   			ret = regmap_write_bits(ctx->regmap, IT66121_AFE_IP_REG,
>   						IT66121_AFE_IP_EC1,
>   						IT66121_AFE_IP_EC1);
> @@ -449,7 +449,7 @@ static int it66121_configure_afe(struct it66121_ctx *ctx,
>   	if (ret)
>   		return ret;
>   
> -	if (ctx->info->id == ID_IT6610) {
> +	if (ctx->id == ID_IT6610) {
>   		ret = regmap_write_bits(ctx->regmap, IT66121_AFE_XP_REG,
>   					IT6610_AFE_XP_BYPASS,
>   					IT6610_AFE_XP_BYPASS);
> @@ -599,7 +599,7 @@ static int it66121_bridge_attach(struct drm_bridge *bridge,
>   	if (ret)
>   		return ret;
>   
> -	if (ctx->info->id == ID_IT66121) {
> +	if (ctx->id == ID_IT66121) {
>   		ret = regmap_write_bits(ctx->regmap, IT66121_CLK_BANK_REG,
>   					IT66121_CLK_BANK_PWROFF_RCLK, 0);
>   		if (ret)
> @@ -748,7 +748,7 @@ static int it66121_bridge_check(struct drm_bridge *bridge,
>   {
>   	struct it66121_ctx *ctx = container_of(bridge, struct it66121_ctx, bridge);
>   
> -	if (ctx->info->id == ID_IT6610) {
> +	if (ctx->id == ID_IT6610) {
>   		/* The IT6610 only supports these settings */
>   		bridge_state->input_bus_cfg.flags |= DRM_BUS_FLAG_DE_HIGH |
>   			DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE;
> @@ -802,7 +802,7 @@ void it66121_bridge_mode_set(struct drm_bridge *bridge,
>   	if (regmap_write(ctx->regmap, IT66121_HDMI_MODE_REG, IT66121_HDMI_MODE_HDMI))
>   		goto unlock;
>   
> -	if (ctx->info->id == ID_IT66121 &&
> +	if (ctx->id == ID_IT66121 &&
>   	    regmap_write_bits(ctx->regmap, IT66121_CLK_BANK_REG,
>   			      IT66121_CLK_BANK_PWROFF_TXCLK,
>   			      IT66121_CLK_BANK_PWROFF_TXCLK)) {
> @@ -815,7 +815,7 @@ void it66121_bridge_mode_set(struct drm_bridge *bridge,
>   	if (it66121_configure_afe(ctx, adjusted_mode))
>   		goto unlock;
>   
> -	if (ctx->info->id == ID_IT66121 &&
> +	if (ctx->id == ID_IT66121 &&
>   	    regmap_write_bits(ctx->regmap, IT66121_CLK_BANK_REG,
>   			      IT66121_CLK_BANK_PWROFF_TXCLK, 0)) {
>   		goto unlock;
> @@ -1505,6 +1505,7 @@ static int it66121_probe(struct i2c_client *client)
>   	int ret;
>   	struct it66121_ctx *ctx;
>   	struct device *dev = &client->dev;
> +	const struct it66121_chip_info *chip_info;
>   
>   	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
>   		dev_err(dev, "I2C check functionality failed.\n");
> @@ -1522,7 +1523,7 @@ static int it66121_probe(struct i2c_client *client)
>   
>   	ctx->dev = dev;
>   	ctx->client = client;
> -	ctx->info = i2c_get_match_data(client);
> +	chip_info = i2c_get_match_data(client);
>   
>   	of_property_read_u32(ep, "bus-width", &ctx->bus_width);
>   	of_node_put(ep);
> @@ -1568,11 +1569,17 @@ static int it66121_probe(struct i2c_client *client)
>   	revision_id = FIELD_GET(IT66121_REVISION_MASK, device_ids[1]);
>   	device_ids[1] &= IT66121_DEVICE_ID1_MASK;
>   
> -	if ((vendor_ids[1] << 8 | vendor_ids[0]) != ctx->info->vid ||
> -	    (device_ids[1] << 8 | device_ids[0]) != ctx->info->pid) {
> -		return -ENODEV;
> +	for (; chip_info->vid; chip_info++) {
> +		if ((vendor_ids[1] << 8 | vendor_ids[0]) == chip_info->vid &&
> +		    (device_ids[1] << 8 | device_ids[0]) == chip_info->pid) {
> +			ctx->id = chip_info->id;
> +			break;
> +		}
>   	}
>   
> +	if (!chip_info->vid)
> +		return -ENODEV;
> +
>   	ctx->bridge.of_node = dev->of_node;
>   	ctx->bridge.type = DRM_MODE_CONNECTOR_HDMIA;
>   	ctx->bridge.ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID;
> @@ -1606,28 +1613,22 @@ static void it66121_remove(struct i2c_client *client)
>   	mutex_destroy(&ctx->lock);
>   }
>   
> -static const struct it66121_chip_info it66121_chip_info = {
> -	.id = ID_IT66121,
> -	.vid = 0x4954,
> -	.pid = 0x0612,
> -};
> -
> -static const struct it66121_chip_info it6610_chip_info = {
> -	.id = ID_IT6610,
> -	.vid = 0xca00,
> -	.pid = 0x0611,
> +static const struct it66121_chip_info it66xx_chip_info[] = {
> +	{.id = ID_IT66121, .vid = 0x4954, .pid = 0x0612 },
> +	{.id = ID_IT6610, .vid = 0xca00, .pid = 0x0611 },
> +	{ }
>   };
>   
>   static const struct of_device_id it66121_dt_match[] = {
> -	{ .compatible = "ite,it66121", &it66121_chip_info },
> -	{ .compatible = "ite,it6610", &it6610_chip_info },
> +	{ .compatible = "ite,it66121", &it66xx_chip_info },
> +	{ .compatible = "ite,it6610", &it66xx_chip_info },

If you will pass in the same data to all devices, just don't pass
anything. Move the it66121_dt_match table up above probe, and just
use it, no need for fetching it from i2c_get_match_data().

That can also be done later too, so not a blocker here,

Reviewed-by: Andrew Davis <afd@ti.com>

>   	{ }
>   };
>   MODULE_DEVICE_TABLE(of, it66121_dt_match);
>   
>   static const struct i2c_device_id it66121_id[] = {
> -	{ "it66121", (kernel_ulong_t) &it66121_chip_info },
> -	{ "it6610", (kernel_ulong_t) &it6610_chip_info },
> +	{ "it66121", (kernel_ulong_t)&it66xx_chip_info },
> +	{ "it6610", (kernel_ulong_t)&it66xx_chip_info },
>   	{ }
>   };
>   MODULE_DEVICE_TABLE(i2c, it66121_id);


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH V3 4/4] drm/bridge: it66121: Add minimal it66122 support
  2025-08-15  3:41 ` [PATCH V3 4/4] drm/bridge: it66121: Add minimal it66122 support Nishanth Menon
@ 2025-08-15 13:54   ` Andrew Davis
  0 siblings, 0 replies; 11+ messages in thread
From: Andrew Davis @ 2025-08-15 13:54 UTC (permalink / raw)
  To: Nishanth Menon, Conor Dooley, Krzysztof Kozlowski, Rob Herring,
	David Airlie, Maxime Ripard, Laurent Pinchart, Neil Armstrong
  Cc: linux-kernel, devicetree, dri-devel, Robert Nelson, Jason Kridner,
	tomi.valkeinen, devarsht

On 8/14/25 10:41 PM, Nishanth Menon wrote:
> The IT66122 is a pin compatible replacement for the IT66122. Based on
> empirical testing, the new device looks to be compatible with IT66121.
> However due to a lack of public data sheet at this time beyond overall
> feature list[1] (which seems to add additional features vs ITT66121),
> it is hard to determine that additional register operations required
> to enable additional features.
> 
> So, introduce the device as a new compatible that we will detect based
> on vid/pid match, with explicit id that can be used to extend the
> driver capability as information becomes available later on.
> 
> [1] https://www.ite.com.tw/en/product/cate1/IT66122
> 
> Signed-off-by: Nishanth Menon <nm@ti.com>
> ---
> Changes in V3:
> * Dropped the claim that it is 1-1 replacement of IT66121.
> * Based on emperical test result[2], introduce the same configuration of
>    IT66121, but provide ID as suggested by Devarsh to allow for future
>    expansion of functionality.
> 
> NOTE: I did consider the possibility of converting the chip_id into a
> bitfield, but decided it is over-engineering, so kept the enum.
> 

But over-engineering is so much more fun :D

Reviewed-by: Andrew Davis <afd@ti.com>

> [2] https://github.com/beagleboard/linux/commits/v6.1.83-ti-rt-r40
> 
> V2: https://lore.kernel.org/all/20250813204106.580141-4-nm@ti.com/
> 
>   drivers/gpu/drm/bridge/ite-it66121.c | 14 +++++++++-----
>   1 file changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/ite-it66121.c b/drivers/gpu/drm/bridge/ite-it66121.c
> index 5ac9631bcd9a..a108d287722d 100644
> --- a/drivers/gpu/drm/bridge/ite-it66121.c
> +++ b/drivers/gpu/drm/bridge/ite-it66121.c
> @@ -287,6 +287,7 @@
>   enum chip_id {
>   	ID_IT6610,
>   	ID_IT66121,
> +	ID_IT66122,
>   };
>   
>   struct it66121_chip_info {
> @@ -402,7 +403,7 @@ static int it66121_configure_afe(struct it66121_ctx *ctx,
>   		if (ret)
>   			return ret;
>   
> -		if (ctx->id == ID_IT66121) {
> +		if (ctx->id == ID_IT66121 || ctx->id == ID_IT66122) {
>   			ret = regmap_write_bits(ctx->regmap, IT66121_AFE_IP_REG,
>   						IT66121_AFE_IP_EC1, 0);
>   			if (ret)
> @@ -428,7 +429,7 @@ static int it66121_configure_afe(struct it66121_ctx *ctx,
>   		if (ret)
>   			return ret;
>   
> -		if (ctx->id == ID_IT66121) {
> +		if (ctx->id == ID_IT66121 || ctx->id == ID_IT66122) {
>   			ret = regmap_write_bits(ctx->regmap, IT66121_AFE_IP_REG,
>   						IT66121_AFE_IP_EC1,
>   						IT66121_AFE_IP_EC1);
> @@ -599,7 +600,7 @@ static int it66121_bridge_attach(struct drm_bridge *bridge,
>   	if (ret)
>   		return ret;
>   
> -	if (ctx->id == ID_IT66121) {
> +	if (ctx->id == ID_IT66121 || ctx->id == ID_IT66122) {
>   		ret = regmap_write_bits(ctx->regmap, IT66121_CLK_BANK_REG,
>   					IT66121_CLK_BANK_PWROFF_RCLK, 0);
>   		if (ret)
> @@ -802,7 +803,7 @@ void it66121_bridge_mode_set(struct drm_bridge *bridge,
>   	if (regmap_write(ctx->regmap, IT66121_HDMI_MODE_REG, IT66121_HDMI_MODE_HDMI))
>   		goto unlock;
>   
> -	if (ctx->id == ID_IT66121 &&
> +	if ((ctx->id == ID_IT66121 || ctx->id == ID_IT66122) &&
>   	    regmap_write_bits(ctx->regmap, IT66121_CLK_BANK_REG,
>   			      IT66121_CLK_BANK_PWROFF_TXCLK,
>   			      IT66121_CLK_BANK_PWROFF_TXCLK)) {
> @@ -815,7 +816,7 @@ void it66121_bridge_mode_set(struct drm_bridge *bridge,
>   	if (it66121_configure_afe(ctx, adjusted_mode))
>   		goto unlock;
>   
> -	if (ctx->id == ID_IT66121 &&
> +	if ((ctx->id == ID_IT66121 || ctx->id == ID_IT66122) &&
>   	    regmap_write_bits(ctx->regmap, IT66121_CLK_BANK_REG,
>   			      IT66121_CLK_BANK_PWROFF_TXCLK, 0)) {
>   		goto unlock;
> @@ -1614,12 +1615,14 @@ static void it66121_remove(struct i2c_client *client)
>   }
>   
>   static const struct it66121_chip_info it66xx_chip_info[] = {
> +	{.id = ID_IT66122, .vid = 0x4954, .pid = 0x0622 },
>   	{.id = ID_IT66121, .vid = 0x4954, .pid = 0x0612 },
>   	{.id = ID_IT6610, .vid = 0xca00, .pid = 0x0611 },
>   	{ }
>   };
>   
>   static const struct of_device_id it66121_dt_match[] = {
> +	{ .compatible = "ite,it66122", &it66xx_chip_info },
>   	{ .compatible = "ite,it66121", &it66xx_chip_info },
>   	{ .compatible = "ite,it6610", &it66xx_chip_info },
>   	{ }
> @@ -1627,6 +1630,7 @@ static const struct of_device_id it66121_dt_match[] = {
>   MODULE_DEVICE_TABLE(of, it66121_dt_match);
>   
>   static const struct i2c_device_id it66121_id[] = {
> +	{ "it66122", (kernel_ulong_t)&it66xx_chip_info },
>   	{ "it66121", (kernel_ulong_t)&it66xx_chip_info },
>   	{ "it6610", (kernel_ulong_t)&it66xx_chip_info },
>   	{ }


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH V3 3/4] drm/bridge: it66121: Use vid/pid to detect the type of chip
  2025-08-15 13:52   ` Andrew Davis
@ 2025-08-15 15:22     ` Nishanth Menon
  0 siblings, 0 replies; 11+ messages in thread
From: Nishanth Menon @ 2025-08-15 15:22 UTC (permalink / raw)
  To: Andrew Davis
  Cc: Conor Dooley, Krzysztof Kozlowski, Rob Herring, David Airlie,
	Maxime Ripard, Laurent Pinchart, Neil Armstrong, linux-kernel,
	devicetree, dri-devel, Robert Nelson, Jason Kridner,
	tomi.valkeinen, devarsht

On 08:52-20250815, Andrew Davis wrote:
> > This also allows for some future compatibility to be checked only
> > against a restricted set of vid/pid.

^^ See below

> >   static const struct of_device_id it66121_dt_match[] = {
> > -	{ .compatible = "ite,it66121", &it66121_chip_info },
> > -	{ .compatible = "ite,it6610", &it6610_chip_info },
> > +	{ .compatible = "ite,it66121", &it66xx_chip_info },
> > +	{ .compatible = "ite,it6610", &it66xx_chip_info },
> 
> If you will pass in the same data to all devices, just don't pass
> anything. Move the it66121_dt_match table up above probe, and just
> use it, no need for fetching it from i2c_get_match_data().

(rationale in commit messsage)
Yeah, I was going to do that, but this vendor has a bunch of devices and
I am not able to see all possible combinations.. so was thinking that
maybe some combination device will need different checks with a limited
vid/pid list.. just lack of public documentation makes me a bit
paranoid.

I am not tied to this that hard (it was a "meh"), so if folks feel this
can be thrown out, can respin.

-- 
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D
https://ti.com/opensource

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH V3 2/4] drm/bridge: it66121: Drop ftrace like dev_dbg() prints
  2025-08-15  3:41 ` [PATCH V3 2/4] drm/bridge: it66121: Drop ftrace like dev_dbg() prints Nishanth Menon
  2025-08-15 13:50   ` Andrew Davis
@ 2025-08-16 19:23   ` Dmitry Baryshkov
  1 sibling, 0 replies; 11+ messages in thread
From: Dmitry Baryshkov @ 2025-08-16 19:23 UTC (permalink / raw)
  To: Nishanth Menon
  Cc: Conor Dooley, Krzysztof Kozlowski, Rob Herring, David Airlie,
	Maxime Ripard, Laurent Pinchart, Neil Armstrong, linux-kernel,
	devicetree, dri-devel, Robert Nelson, Jason Kridner, afd,
	tomi.valkeinen, devarsht

On Thu, Aug 14, 2025 at 10:41:03PM -0500, Nishanth Menon wrote:
> Drop the ftrace like dev_dbg() that checkpatch --strict complains about:
> 
> WARNING: Unnecessary ftrace-like logging - prefer using ftrace
> +	dev_dbg(dev, "%s\n", __func__);
> 
> WARNING: Unnecessary ftrace-like logging - prefer using ftrace
> +	dev_dbg(dev, "%s\n", __func__);
> 
> WARNING: Unnecessary ftrace-like logging - prefer using ftrace
> +	dev_dbg(dev, "%s\n", __func__);
> 
> Signed-off-by: Nishanth Menon <nm@ti.com>
> ---
> Changes in V3:
> * New patch
> 
>  drivers/gpu/drm/bridge/ite-it66121.c | 6 ------
>  1 file changed, 6 deletions(-)
> 

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>


-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH V3 3/4] drm/bridge: it66121: Use vid/pid to detect the type of chip
  2025-08-15  3:41 ` [PATCH V3 3/4] drm/bridge: it66121: Use vid/pid to detect the type of chip Nishanth Menon
  2025-08-15 13:52   ` Andrew Davis
@ 2025-08-16 19:55   ` Dmitry Baryshkov
  1 sibling, 0 replies; 11+ messages in thread
From: Dmitry Baryshkov @ 2025-08-16 19:55 UTC (permalink / raw)
  To: Nishanth Menon
  Cc: Conor Dooley, Krzysztof Kozlowski, Rob Herring, David Airlie,
	Maxime Ripard, Laurent Pinchart, Neil Armstrong, linux-kernel,
	devicetree, dri-devel, Robert Nelson, Jason Kridner, afd,
	tomi.valkeinen, devarsht

On Thu, Aug 14, 2025 at 10:41:04PM -0500, Nishanth Menon wrote:
> The driver knows exactly which version of the chip is present since
> the vid/pid is used to enforce a compatibility. Given that some
> devices like IT66121 has potentially been replaced with IT66122 mid
> production for many platforms, it makes no sense to use the vid/pid as
> an enforcement for compatibility. Instead, let us detect the ID of the
> actual chip in use by matching the corresponding vid/pid.
> 
> This also allows for some future compatibility to be checked only
> against a restricted set of vid/pid.
> 
> While at this, fix up a bit of formatting errors reported by
> checkpatch warning, and since the ctx info just requires the id, drop
> storing the entire chip_info pointer.

Separate commit, please. Don't mix unrelated changes into a single
patch. "While at it" usually means that it should be a separate patch.

> 
> Signed-off-by: Nishanth Menon <nm@ti.com>
> ---
> Changes in V3:
> * Converted the patch to lookup ID based on vid/pid match rather than
>   enforcing vid/pid match per compatible.
> * Squashed a formating fix for pre-existing checkpatch --strict warning
> 
> V2: https://lore.kernel.org/all/20250813204106.580141-3-nm@ti.com/
> 
>  drivers/gpu/drm/bridge/ite-it66121.c | 53 ++++++++++++++--------------
>  1 file changed, 27 insertions(+), 26 deletions(-)
> 
> @@ -1606,28 +1613,22 @@ static void it66121_remove(struct i2c_client *client)
>  	mutex_destroy(&ctx->lock);
>  }
>  
> -static const struct it66121_chip_info it66121_chip_info = {
> -	.id = ID_IT66121,
> -	.vid = 0x4954,
> -	.pid = 0x0612,
> -};
> -
> -static const struct it66121_chip_info it6610_chip_info = {
> -	.id = ID_IT6610,
> -	.vid = 0xca00,
> -	.pid = 0x0611,
> +static const struct it66121_chip_info it66xx_chip_info[] = {
> +	{.id = ID_IT66121, .vid = 0x4954, .pid = 0x0612 },
> +	{.id = ID_IT6610, .vid = 0xca00, .pid = 0x0611 },
> +	{ }
>  };
>  
>  static const struct of_device_id it66121_dt_match[] = {
> -	{ .compatible = "ite,it66121", &it66121_chip_info },
> -	{ .compatible = "ite,it6610", &it6610_chip_info },
> +	{ .compatible = "ite,it66121", &it66xx_chip_info },
> +	{ .compatible = "ite,it6610", &it66xx_chip_info },

Other than dropping the match data completely, please keep arrays
sorted.

>  	{ }
>  };
>  MODULE_DEVICE_TABLE(of, it66121_dt_match);
>  
>  static const struct i2c_device_id it66121_id[] = {
> -	{ "it66121", (kernel_ulong_t) &it66121_chip_info },
> -	{ "it6610", (kernel_ulong_t) &it6610_chip_info },
> +	{ "it66121", (kernel_ulong_t)&it66xx_chip_info },
> +	{ "it6610", (kernel_ulong_t)&it66xx_chip_info },
>  	{ }
>  };
>  MODULE_DEVICE_TABLE(i2c, it66121_id);
> -- 
> 2.47.0
> 

-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-08-16 19:55 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-15  3:41 [PATCH V3 0/4] drm/bridge: it66121: Add initial it66122 support Nishanth Menon
2025-08-15  3:41 ` [PATCH V3 1/4] dt-bindings: display: bridge: it66121: Add compatible string for IT66122 Nishanth Menon
2025-08-15  3:41 ` [PATCH V3 2/4] drm/bridge: it66121: Drop ftrace like dev_dbg() prints Nishanth Menon
2025-08-15 13:50   ` Andrew Davis
2025-08-16 19:23   ` Dmitry Baryshkov
2025-08-15  3:41 ` [PATCH V3 3/4] drm/bridge: it66121: Use vid/pid to detect the type of chip Nishanth Menon
2025-08-15 13:52   ` Andrew Davis
2025-08-15 15:22     ` Nishanth Menon
2025-08-16 19:55   ` Dmitry Baryshkov
2025-08-15  3:41 ` [PATCH V3 4/4] drm/bridge: it66121: Add minimal it66122 support Nishanth Menon
2025-08-15 13:54   ` Andrew Davis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).