drm/bridge: it66121: Add initial it66122 support
Subsystems (5)
v6 cover drm/bridge: it66121: Add initial it66122 support
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.
Series is based on next-20250827
Bootlog: BeaglePlay: https://gist.github.com/nmenon/65afb917ee1818979d338cf25732a920
Changes in V6:
* Picked up Tomi's ack
* Rebased on next-20251029
Changes in V5:
* Switched over to ARRAY_SIZE
* Picked up Andrew's Reviewed-by
Changes in V4:
* Added patch to sort the compatibles alpha-numerically
* vid/pid lookup is done without using the match_data.
* picked reviews
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
V5: https://lore.kernel.org/all/[email protected]/
V4: https://lore.kernel.org/all/[email protected]/
V3: https://lore.kernel.org/all/[email protected]/
V2: https://lore.kernel.org/all/[email protected]/
V1: https://lore.kernel.org/all/[email protected]/
Nishanth Menon (5):
dt-bindings: display: bridge: it66121: Add compatible string for
IT66122
drm/bridge: it66121: Drop ftrace like dev_dbg() prints drm/bridge: it66121: Sort the compatibles 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 | 68 +++++++++---------- 2 files changed, 34 insertions(+), 35 deletions(-)
Signature · 1 line
2.47.0
PATCH v6 1/5 dt-bindings: display: bridge: it66121: Add compatible string for IT66122
Add a new ite,it66122 compatible string to the IT66121 binding documentation, since the two chips are practically same except for id register difference.
---
Changes since V5:
* Picked Tomi's Ack
V5: https://lore.kernel.org/all/[email protected]/
V4: https://lore.kernel.org/all/[email protected]/
V3: https://lore.kernel.org/all/[email protected]/
V2: https://lore.kernel.org/all/[email protected]/
V1: https://lore.kernel.org/all/[email protected]/
.../devicetree/bindings/display/bridge/ite,it66121.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/display/bridge/ite,it66121.yaml +1 -0
@@ -19,6 +19,7 @@ properties: compatible: enum: - ite,it66121 + - ite,it66122 - ite,it6610 reg:
Signature · 1 line
2.47.0
PATCH v6 2/5 drm/bridge: it66121: Drop ftrace like dev_dbg() prints
In reply to Nishanth MenonDrop 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__);
---
Changes since V5:
* Picked Tomi's Ack
V5: https://lore.kernel.org/all/[email protected]/
V4: https://lore.kernel.org/all/[email protected]/
V3: https://lore.kernel.org/all/[email protected]/
drivers/gpu/drm/bridge/ite-it66121.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/gpu/drm/bridge/ite-it66121.c +0 -6
@@ -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 ;
Signature · 1 line
2.47.0
PATCH v6 3/5 drm/bridge: it66121: Sort the compatibles
In reply to Nishanth MenonKeep the compatibles sorted alpha-numerically.
---
Changes since V5:
* Picked Tomi's Ack
V5: https://lore.kernel.org/all/[email protected]/
V4: https://lore.kernel.org/all/[email protected]/
drivers/gpu/drm/bridge/ite-it66121.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/bridge/ite-it66121.c +3 -3
@@ -1619,15 +1619,15 @@ static const struct it66121_chip_info it6610_chip_info = { };static const struct of_device_id it66121_dt_match[] = { - { .compatible ="ite,it66121" , &it66121_chip_info }, { .compatible ="ite,it6610" , &it6610_chip_info }, + { .compatible ="ite,it66121" , &it66121_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 }, + {"it6610" , (kernel_ulong_t)&it6610_chip_info }, + {"it66121" , (kernel_ulong_t)&it66121_chip_info }, { } };MODULE_DEVICE_TABLE (i2c, it66121_id);
Signature · 1 line
2.47.0
PATCH v6 4/5 drm/bridge: it66121: Use vid/pid to detect the type of chip
In reply to Nishanth MenonThe 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, detect the ID of the actual chip in use by matching the corresponding vid/pid and drop the compatible specific lookup table.
---
Changes since V5:
* Picked Tomi's Ack
V5: https://lore.kernel.org/all/[email protected]/
V4: https://lore.kernel.org/all/[email protected]/
V3: https://lore.kernel.org/all/[email protected]/
V2: https://lore.kernel.org/all/[email protected]/
drivers/gpu/drm/bridge/ite-it66121.c | 58 ++++++++++++++-------------- 1 file changed, 29 insertions(+), 29 deletions(-)
drivers/gpu/drm/bridge/ite-it66121.c +29 -29
@@ -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 &®map_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 &®map_write_bits (ctx->regmap,IT66121_CLK_BANK_REG ,IT66121_CLK_BANK_PWROFF_TXCLK ,0 )) { goto unlock;
@@ -1498,13 +1498,19 @@ static const char * const it66121_supplies[] = {"vcn33" ,"vcn18" ,"vrf12" }; +static const struct it66121_chip_info it66xx_chip_info[] = { + {.id =ID_IT6610 , .vid =0xca00 , .pid =0x0611 }, + {.id =ID_IT66121 , .vid =0x4954 , .pid =0x0612 }, +}; +static int it66121_probe (struct i2c_client *client) {u32 revision_id, vendor_ids[2 ] = {0 }, device_ids[2 ] = {0 };struct device_node *ep; -int ret; +int ret, i;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 +1528,6 @@ static int it66121_probe(struct i2c_client *client) ctx->dev = dev; ctx->client = client; - ctx->info =i2c_get_match_data (client);of_property_read_u32 (ep,"bus-width" , &ctx->bus_width);of_node_put (ep);
@@ -1568,11 +1573,18 @@ 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 (i =0 ; i <ARRAY_SIZE (it66xx_chip_info); i++) { + chip_info = &it66xx_chip_info[i]; +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 (i ==ARRAY_SIZE (it66xx_chip_info)) +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 +1618,16 @@ 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 of_device_id it66121_dt_match[] = { - { .compatible ="ite,it6610" , &it6610_chip_info }, - { .compatible ="ite,it66121" , &it66121_chip_info }, + { .compatible ="ite,it6610" }, + { .compatible ="ite,it66121" }, { } };MODULE_DEVICE_TABLE (of, it66121_dt_match);static const struct i2c_device_id it66121_id[] = { - {"it6610" , (kernel_ulong_t)&it6610_chip_info }, - {"it66121" , (kernel_ulong_t)&it66121_chip_info }, + { .name ="it6610" }, + { .name ="it66121" }, { } };MODULE_DEVICE_TABLE (i2c, it66121_id);
Signature · 1 line
2.47.0
PATCH v6 5/5 drm/bridge: it66121: Add minimal it66122 support
In reply to Nishanth MenonThe 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
---
Changes since V5:
* Picked Tomi's Ack
V5: https://lore.kernel.org/all/[email protected]/
V4: https://lore.kernel.org/all/[email protected]/
V3: https://lore.kernel.org/all/[email protected]/
V2: https://lore.kernel.org/all/[email protected]/
drivers/gpu/drm/bridge/ite-it66121.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/gpu/drm/bridge/ite-it66121.c +9 -5
@@ -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 ) &®map_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 ) &®map_write_bits (ctx->regmap,IT66121_CLK_BANK_REG ,IT66121_CLK_BANK_PWROFF_TXCLK ,0 )) { goto unlock;
@@ -1501,6 +1502,7 @@ static const char * const it66121_supplies[] = {static const struct it66121_chip_info it66xx_chip_info[] = { {.id =ID_IT6610 , .vid =0xca00 , .pid =0x0611 }, {.id =ID_IT66121 , .vid =0x4954 , .pid =0x0612 }, + {.id =ID_IT66122 , .vid =0x4954 , .pid =0x0622 }, };static int it66121_probe (struct i2c_client *client)
@@ -1621,6 +1623,7 @@ static void it66121_remove(struct i2c_client *client)static const struct of_device_id it66121_dt_match[] = { { .compatible ="ite,it6610" }, { .compatible ="ite,it66121" }, + { .compatible ="ite,it66122" }, { } };MODULE_DEVICE_TABLE (of, it66121_dt_match);
@@ -1628,6 +1631,7 @@ MODULE_DEVICE_TABLE(of, it66121_dt_match);static const struct i2c_device_id it66121_id[] = { { .name ="it6610" }, { .name ="it66121" }, + { .name ="it66122" }, { } };MODULE_DEVICE_TABLE (i2c, it66121_id);
Signature · 1 line
2.47.0
Hi Dmitry, Neil,
Can this be merged?
Tomi
Quoted 65 lines · 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.
Series is based on next-20250827
Bootlog: BeaglePlay: https://gist.github.com/nmenon/65afb917ee1818979d338cf25732a920
Changes in V6:
* Picked up Tomi's ack
* Rebased on next-20251029Changes in V5:
* Switched over toARRAY_SIZE
* Picked up Andrew's Reviewed-byChanges in V4:
* Added patch to sort the compatibles alpha-numerically
* vid/pid lookup is done without using thematch_data.
* picked reviewsChanges 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 listV5: https://lore.kernel.org/all/[email protected]/
V4: https://lore.kernel.org/all/[email protected]/
V3: https://lore.kernel.org/all/[email protected]/
V2: https://lore.kernel.org/all/[email protected]/
V1: https://lore.kernel.org/all/[email protected]/Nishanth Menon (5):
dt-bindings: display: bridge: it66121: Add compatible string forIT66122drm/bridge: it66121: Drop ftrace like
dev_dbg()prints drm/bridge: it66121: Sort the compatibles 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 | 68 +++++++++---------- 2 files changed, 34 insertions(+), 35 deletions(-)
Hi,
Quoted 11 lines · Nishanth Menon
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.
[...]
Thanks, Applied to https://gitlab.freedesktop.org/drm/misc/kernel.git (drm-misc-next)
[1/5] dt-bindings: display: bridge: it66121: Add compatible string for IT66122
https://gitlab.freedesktop.org/drm/misc/kernel/-/commit/e902d2c38a2797aa78c1e08fc1419490bb8c63dd [2/5] drm/bridge: it66121: Drop ftrace like dev_dbg() prints https://gitlab.freedesktop.org/drm/misc/kernel/-/commit/1ba36afa667bf14820a9862e18b5d55ee47a67e4 [3/5] drm/bridge: it66121: Sort the compatibles https://gitlab.freedesktop.org/drm/misc/kernel/-/commit/a1df28b5f4d30467b8dabe861f1da324e00313fd [4/5] drm/bridge: it66121: Use vid/pid to detect the type of chip https://gitlab.freedesktop.org/drm/misc/kernel/-/commit/a8811c0bb79c60bf2464e939c8e040b5d6f532ef [5/5] drm/bridge: it66121: Add minimal it66122 support https://gitlab.freedesktop.org/drm/misc/kernel/-/commit/715cbb21c6fe2fe5760ea05e873f12473aa5884e
Signature · 1 line
Neil