iio: adc: mcp3422: Add the compatibles from the binding
Subsystems (2)
PATCH 1/1 iio: adc: mcp3422: Add the compatibles from the binding
The MCP342x binding, first iio/adc/mcp3422.txt and now trivial-devices.yaml, documents the compatibles "microchip,mcp3421" to "microchip,mcp3428", but the OF match table only has the undocumented "mcp3422". A device described as the binding says still binds, because the I2C core falls back to the I2C ID table, but its module is not loaded automatically: since commit af503716ac14 ("i2c: core: report OF style module alias for devices registered via OF"), the uevent of such a device carries only the OF modalias, and none of the module aliases match it.
Add the documented compatibles. Keep "mcp3422" so that device trees using it keep loading the module.
Tested on a Raspberry Pi 4 B board with an MCP3422 described as "microchip,mcp3422". Without this patch (on v6.12), the device's uevent carries MODALIAS=of:Nmcp3422T(null)Cmicrochip,mcp3422, modprobe finds no module for it and the module is not loaded; loading it by hand probes the device. With this patch, the module is loaded at boot and the ADC reads.
---
I added Cc: stable because module autoloading for the documented compatibles has been broken since v4.17.
Please drop it if you don't think it qualifies.
Regarding the old compatible, I was not sure if it should be kept or removed, I kept it to keep compatibility with old dtb, as it can be removed easily any time in future.
An AI assistant (Claude) helped write the commit message, following the commit-message, find-fixes and stable-tag skills from Sasha Levin's agents branch (git://git.kernel.org/pub/scm/linux/kernel/git/sashal/linux.git
agents, d8d07dd58c62).
--- drivers/iio/adc/mcp3422.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/iio/adc/mcp3422.c +8 -0
@@ -395,6 +395,14 @@ static const struct i2c_device_id mcp3422_id[] = {MODULE_DEVICE_TABLE (i2c, mcp3422_id);static const struct of_device_id mcp3422_of_match[] = { + { .compatible ="microchip,mcp3421" }, + { .compatible ="microchip,mcp3422" }, + { .compatible ="microchip,mcp3423" }, + { .compatible ="microchip,mcp3424" }, + { .compatible ="microchip,mcp3425" }, + { .compatible ="microchip,mcp3426" }, + { .compatible ="microchip,mcp3427" }, + { .compatible ="microchip,mcp3428" }, { .compatible ="mcp3422" }, { } };
---
base-commit: 3dd8c790a7b7027abdd568e36db5e82ffaea7c77
change-id: 20261128-mcp3422-compatibles-06044d1b5bac
Best regards,
Signature · 1 line
Kryštof Černý <[email protected]>
Kryštof Černý via B4 Relay <[email protected]> writes:
Hello Kryštof,
Quoted 22 lines
From: Kryštof Černý <[email protected]>
The MCP342x binding, first
iio/adc/mcp3422.txtand nowtrivial-devices.yaml, documents the compatibles "microchip,mcp3421" to "microchip,mcp3428", but the OF match table only has the undocumented "mcp3422". A device described as the binding says still binds, because the I2C core falls back to the I2C ID table, but its module is not loaded automatically: since commitaf503716ac14("i2c: core: report OF style module alias for devices registered via OF"), the uevent of such a device carries only the OF modalias, and none of the module aliases match it.Add the documented compatibles. Keep "mcp3422" so that device trees using it keep loading the module.
Tested on a Raspberry Pi 4 B board with an MCP3422 described as "microchip,mcp3422". Without this patch (on v6.12), the device's uevent carries MODALIAS=of:Nmcp3422T(null)Cmicrochip,mcp3422, modprobe finds no module for it and the module is not loaded; loading it by hand probes the device. With this patch, the module is loaded at boot and the ADC reads.
Quoted 3 lines
Fixes af503716ac14 ("i2c: core: report OF style module alias for devices registered via OF")---
Looks good to me.
Signature · 5 lines
Best regards, Javier Martinez Canillas Core Platforms Red Hat
Quoted 20 lines · On Wed, Dec 02, 2026 at 10:24:29AM +0100, Kryštof Černý via B4 Relay wrote:
The MCP342x binding, first
iio/adc/mcp3422.txtand nowtrivial-devices.yaml, documents the compatibles "microchip,mcp3421" to "microchip,mcp3428", but the OF match table only has the undocumented "mcp3422". A device described as the binding says still binds, because the I2C core falls back to the I2C ID table, but its module is not loaded automatically: since commitaf503716ac14("i2c: core: report OF style module alias for devices registered via OF"), the uevent of such a device carries only the OF modalias, and none of the module aliases match it.Add the documented compatibles. Keep "mcp3422" so that device trees using it keep loading the module.
Tested on a Raspberry Pi 4 B board with an MCP3422 described as "microchip,mcp3422". Without this patch (on v6.12), the device's uevent carries MODALIAS=of:Nmcp3422T(null)Cmicrochip,mcp3422, modprobe finds no module for it and the module is not loaded; loading it by hand probes the device. With this patch, the module is loaded at boot and the ADC reads.
Quoted 2 lines
Fixes af503716ac14 ("i2c: core: report OF style module alias for devices registered via OF")
We may not accept patches without SoB.
Quoted 9 lines
---
I added Cc: stable because module autoloading for the documented compatibles has been broken since v4.17.
Please drop it if you don't think it qualifies.Regarding the old compatible, I was not sure if it should be kept or removed, I kept it to keep compatibility with old dtb, as it can be removed easily any time in future.
Quoted 6 lines
An AI assistant (Claude) helped write the commit message, following the commit-message, find-fixes and stable-tag skills from Sasha Levin's agents branch (
git://git.kernel.org/pub/scm/linux/kernel/git/sashal/linux.git
agents,d8d07dd58c62).Signed-off-by Kryštof Černý <[email protected]>
Yeah, yeah, you missed the correct location. Try again.
Quoted 1 line
---
Signature · 2 lines
With Best Regards, Andy Shevchenko