* [PATCH v3 0/2] add support for Aosong AM2320 @ 2026-08-14 17:50 Nicolás Antinori 2026-08-14 17:50 ` [PATCH v3 1/2] dt-bindings: trivial-devices: add Aosong AM2315 and AM2320 chips Nicolás Antinori 2026-08-14 17:50 ` [PATCH v3 2/2] iio: humidity: am2315: add support for am2320 Nicolás Antinori 0 siblings, 2 replies; 6+ messages in thread From: Nicolás Antinori @ 2026-08-14 17:50 UTC (permalink / raw) To: Jonathan Cameron Cc: Nicolás Antinori, Andy Shevchenko, Brigham Campbell, Conor Dooley, David Lechner, Jori Koolstra, Krzysztof Kozlowski, Marcelo Schmitt, Nuno Sá, Rob Herring, Shuah Khan, devicetree, linux-iio, linux-kernel, linux-kernel-mentees The AM2320 is fully compatible with the AM2315 sensor in terms of I2C communication protocol and measurement conversions. This patch series adds am2320 to the i2c_device_id table, creates of_device_id table and adds both am2315 and am2320 to trivial-devices.yml dt bindings. v3: - Added "aosong,am2315" and "aosong,am2320" to trivial-devices.yml. - Added of_device_id table. - Replaced using a constant for driver's name with chip_info struct. - Separated code changes and dt-bindings changes in two commits. v2: Link [2] - Generalized KConfig description text. v1: Link [1] [1] https://lore.kernel.org/all/20260805183733.1000550-1-nico.antinori.7@gmail.com/T/#u [2] https://lore.kernel.org/all/20260810183337.451812-1-nico.antinori.7@gmail.com/T/#u Nicolás Antinori (2): dt-bindings: trivial-devices: add Aosong AM2315 and AM2320 chips iio: humidity: am2315: add support for am2320 .../devicetree/bindings/trivial-devices.yaml | 2 ++ drivers/iio/humidity/Kconfig | 8 +++-- drivers/iio/humidity/am2315.c | 34 ++++++++++++++++--- 3 files changed, 36 insertions(+), 8 deletions(-) -- 2.47.3 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3 1/2] dt-bindings: trivial-devices: add Aosong AM2315 and AM2320 chips 2026-08-14 17:50 [PATCH v3 0/2] add support for Aosong AM2320 Nicolás Antinori @ 2026-08-14 17:50 ` Nicolás Antinori 2026-08-17 7:02 ` Krzysztof Kozlowski 2026-08-14 17:50 ` [PATCH v3 2/2] iio: humidity: am2315: add support for am2320 Nicolás Antinori 1 sibling, 1 reply; 6+ messages in thread From: Nicolás Antinori @ 2026-08-14 17:50 UTC (permalink / raw) To: Jonathan Cameron Cc: Nicolás Antinori, Andy Shevchenko, Brigham Campbell, Conor Dooley, David Lechner, Jori Koolstra, Krzysztof Kozlowski, Marcelo Schmitt, Nuno Sá, Rob Herring, Shuah Khan, devicetree, linux-iio, linux-kernel, linux-kernel-mentees Aosong AM2315 and AM2320 are temperature and humidity sensors that do not require configuration. Signed-off-by: Nicolás Antinori <nico.antinori.7@gmail.com> --- Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/trivial-devices.yaml b/Documentation/devicetree/bindings/trivial-devices.yaml index 435c4baab436..92b757579eef 100644 --- a/Documentation/devicetree/bindings/trivial-devices.yaml +++ b/Documentation/devicetree/bindings/trivial-devices.yaml @@ -62,6 +62,8 @@ properties: # Aosong temperature & humidity sensors with I2C interface - aosong,aht10 - aosong,aht20 + - aosong,am2315 + - aosong,am2320 - aosong,dht20 # Arduino microcontroller interface over SPI on UnoQ board - arduino,unoq-mcu -- 2.47.3 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v3 1/2] dt-bindings: trivial-devices: add Aosong AM2315 and AM2320 chips 2026-08-14 17:50 ` [PATCH v3 1/2] dt-bindings: trivial-devices: add Aosong AM2315 and AM2320 chips Nicolás Antinori @ 2026-08-17 7:02 ` Krzysztof Kozlowski 0 siblings, 0 replies; 6+ messages in thread From: Krzysztof Kozlowski @ 2026-08-17 7:02 UTC (permalink / raw) To: Nicolás Antinori Cc: Jonathan Cameron, Andy Shevchenko, Brigham Campbell, Conor Dooley, David Lechner, Jori Koolstra, Krzysztof Kozlowski, Marcelo Schmitt, Nuno Sá, Rob Herring, Shuah Khan, devicetree, linux-iio, linux-kernel, linux-kernel-mentees On Fri, Aug 14, 2026 at 02:50:19PM -0300, Nicolás Antinori wrote: > Aosong AM2315 and AM2320 are temperature and humidity sensors that do > not require configuration. > > Signed-off-by: Nicolás Antinori <nico.antinori.7@gmail.com> > --- > Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++ > 1 file changed, 2 insertions(+) Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Best regards, Krzysztof ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3 2/2] iio: humidity: am2315: add support for am2320 2026-08-14 17:50 [PATCH v3 0/2] add support for Aosong AM2320 Nicolás Antinori 2026-08-14 17:50 ` [PATCH v3 1/2] dt-bindings: trivial-devices: add Aosong AM2315 and AM2320 chips Nicolás Antinori @ 2026-08-14 17:50 ` Nicolás Antinori 2026-08-17 7:49 ` Andy Shevchenko 2026-08-18 1:07 ` Marcelo Schmitt 1 sibling, 2 replies; 6+ messages in thread From: Nicolás Antinori @ 2026-08-14 17:50 UTC (permalink / raw) To: Jonathan Cameron Cc: Nicolás Antinori, Andy Shevchenko, Brigham Campbell, Conor Dooley, David Lechner, Jori Koolstra, Krzysztof Kozlowski, Marcelo Schmitt, Nuno Sá, Rob Herring, Shuah Khan, devicetree, linux-iio, linux-kernel, linux-kernel-mentees The AM2320 is fully compatible with the AM2315 sensor in terms of I2C communication protocol and measurement conversions. Add the "am2320" entry to the i2c_device_id table and create of_device_id table. Signed-off-by: Nicolás Antinori <nico.antinori.7@gmail.com> --- drivers/iio/humidity/Kconfig | 8 +++++--- drivers/iio/humidity/am2315.c | 34 +++++++++++++++++++++++++++++----- 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/drivers/iio/humidity/Kconfig b/drivers/iio/humidity/Kconfig index 54f11f000b6f..13e267943f67 100644 --- a/drivers/iio/humidity/Kconfig +++ b/drivers/iio/humidity/Kconfig @@ -5,13 +5,15 @@ menu "Humidity sensors" config AM2315 - tristate "Aosong AM2315 relative humidity and temperature sensor" + tristate "Aosong AM2315 and similar relative humidity and temperature sensor" depends on I2C select IIO_BUFFER select IIO_TRIGGERED_BUFFER help - If you say yes here you get support for the Aosong AM2315 - relative humidity and ambient temperature sensor. + If you say yes here you get support for the Aosong relative + humidity and ambient temperature sensors: + - AM2315 + - AM2320 This driver can also be built as a module. If so, the module will be called am2315. diff --git a/drivers/iio/humidity/am2315.c b/drivers/iio/humidity/am2315.c index f29baa251f9f..37491416076c 100644 --- a/drivers/iio/humidity/am2315.c +++ b/drivers/iio/humidity/am2315.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Aosong AM2315 relative humidity and temperature + * Aosong AM2315 and similar relative humidity and temperature * * Copyright (c) 2016, Intel Corporation. * @@ -27,7 +27,17 @@ #define AM2315_TEMP_OFFSET 4 #define AM2315_ALL_CHANNEL_MASK GENMASK(1, 0) -#define AM2315_DRIVER_NAME "am2315" +struct am2315_chip_info { + const char *name; +}; + +static const struct am2315_chip_info am2315_chip_info = { + .name = "am2315", +}; + +static const struct am2315_chip_info am2320_chip_info = { + .name = "am2320", +}; struct am2315_data { struct i2c_client *client; @@ -220,9 +230,14 @@ static const struct iio_info am2315_info = { static int am2315_probe(struct i2c_client *client) { int ret; + const struct am2315_chip_info *chip_info; struct iio_dev *indio_dev; struct am2315_data *data; + chip_info = i2c_get_match_data(client); + if (!chip_info) + return -EINVAL; + indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data)); if (!indio_dev) return -ENOMEM; @@ -233,7 +248,7 @@ static int am2315_probe(struct i2c_client *client) mutex_init(&data->lock); indio_dev->info = &am2315_info; - indio_dev->name = AM2315_DRIVER_NAME; + indio_dev->name = chip_info->name; indio_dev->modes = INDIO_DIRECT_MODE; indio_dev->channels = am2315_channels; indio_dev->num_channels = ARRAY_SIZE(am2315_channels); @@ -249,8 +264,16 @@ static int am2315_probe(struct i2c_client *client) return devm_iio_device_register(&client->dev, indio_dev); } +static const struct of_device_id am2315_of_match[] = { + { .compatible = "aosong,am2315", .data = &am2315_chip_info }, + { .compatible = "aosong,am2320", .data = &am2320_chip_info }, + {} +}; +MODULE_DEVICE_TABLE(of, am2315_of_match); + static const struct i2c_device_id am2315_i2c_id[] = { - { .name = "am2315" }, + { .name = "am2315", .driver_data = (kernel_ulong_t)&am2315_chip_info }, + { .name = "am2320", .driver_data = (kernel_ulong_t)&am2320_chip_info }, { } }; MODULE_DEVICE_TABLE(i2c, am2315_i2c_id); @@ -258,6 +281,7 @@ MODULE_DEVICE_TABLE(i2c, am2315_i2c_id); static struct i2c_driver am2315_driver = { .driver = { .name = "am2315", + .of_match_table = am2315_of_match, }, .probe = am2315_probe, .id_table = am2315_i2c_id, @@ -266,5 +290,5 @@ static struct i2c_driver am2315_driver = { module_i2c_driver(am2315_driver); MODULE_AUTHOR("Tiberiu Breana <tiberiu.a.breana@intel.com>"); -MODULE_DESCRIPTION("Aosong AM2315 relative humidity and temperature"); +MODULE_DESCRIPTION("Aosong AM2315 and similar relative humidity and temperature"); MODULE_LICENSE("GPL v2"); -- 2.47.3 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v3 2/2] iio: humidity: am2315: add support for am2320 2026-08-14 17:50 ` [PATCH v3 2/2] iio: humidity: am2315: add support for am2320 Nicolás Antinori @ 2026-08-17 7:49 ` Andy Shevchenko 2026-08-18 1:07 ` Marcelo Schmitt 1 sibling, 0 replies; 6+ messages in thread From: Andy Shevchenko @ 2026-08-17 7:49 UTC (permalink / raw) To: Nicolás Antinori Cc: Jonathan Cameron, Andy Shevchenko, Brigham Campbell, Conor Dooley, David Lechner, Jori Koolstra, Krzysztof Kozlowski, Marcelo Schmitt, Nuno Sá, Rob Herring, Shuah Khan, devicetree, linux-iio, linux-kernel, linux-kernel-mentees On Fri, Aug 14, 2026 at 02:50:20PM -0300, Nicolás Antinori wrote: > The AM2320 is fully compatible with the AM2315 sensor in terms of I2C > communication protocol and measurement conversions. > > Add the "am2320" entry to the i2c_device_id table and create > of_device_id table. ... > + chip_info = i2c_get_match_data(client); > + if (!chip_info) > + return -EINVAL; -ENODATA ... > +static const struct of_device_id am2315_of_match[] = { > + { .compatible = "aosong,am2315", .data = &am2315_chip_info }, > + { .compatible = "aosong,am2320", .data = &am2320_chip_info }, > + {} Same style as elsewhere, id est { } > +}; With the above being addressed, Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> -- With Best Regards, Andy Shevchenko ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 2/2] iio: humidity: am2315: add support for am2320 2026-08-14 17:50 ` [PATCH v3 2/2] iio: humidity: am2315: add support for am2320 Nicolás Antinori 2026-08-17 7:49 ` Andy Shevchenko @ 2026-08-18 1:07 ` Marcelo Schmitt 1 sibling, 0 replies; 6+ messages in thread From: Marcelo Schmitt @ 2026-08-18 1:07 UTC (permalink / raw) To: Nicolás Antinori Cc: Jonathan Cameron, Andy Shevchenko, Brigham Campbell, Conor Dooley, David Lechner, Jori Koolstra, Krzysztof Kozlowski, Nuno Sá, Rob Herring, Shuah Khan, devicetree, linux-iio, linux-kernel, linux-kernel-mentees On 08/14, Nicolás Antinori wrote: > The AM2320 is fully compatible with the AM2315 sensor in terms of I2C > communication protocol and measurement conversions. > > Add the "am2320" entry to the i2c_device_id table and create > of_device_id table. > > Signed-off-by: Nicolás Antinori <nico.antinori.7@gmail.com> > --- Some optional suggestions for the commit message: The AM2320 design is fully compatible with AM2315 in terms of I2C communication protocol and measurement conversions. Add the "am2320" entry to the i2c_device_id table and register a of_device_id table to match against devices declared in device tree. I see nothing else to improve besides what Andy already mentioned. With those sorted out, Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-08-18 1:06 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-08-14 17:50 [PATCH v3 0/2] add support for Aosong AM2320 Nicolás Antinori 2026-08-14 17:50 ` [PATCH v3 1/2] dt-bindings: trivial-devices: add Aosong AM2315 and AM2320 chips Nicolás Antinori 2026-08-17 7:02 ` Krzysztof Kozlowski 2026-08-14 17:50 ` [PATCH v3 2/2] iio: humidity: am2315: add support for am2320 Nicolás Antinori 2026-08-17 7:49 ` Andy Shevchenko 2026-08-18 1:07 ` Marcelo Schmitt
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox