Re: [PATCH v2 2/2] iio: chemical: acd10: Add driver for ACD10 CO2 sensor

From: Uwe Kleine-König

Date: Thu Dec 03 2026 - 03:56:53 EST


Hello,

On Wed, Dec 02, 2026 at 12:25:22PM +0000, Akhilesh Patil wrote:
> Add driver for Aosong ASAIR ACD10 carbon dioxide sensor.
> Use serdev interface to communicate with sensor over UART.
> Implement read co2, get software revision, get instrument number
> commands.
>
> Tested on TI am62x sk board on UART5 with 1200 baud rate.
>
> Signed-off-by: Akhilesh Patil <akhilesh.patil@xxxxxxxxx>
> ---
> MAINTAINERS | 7 +
> drivers/iio/chemical/Kconfig | 10 +
> drivers/iio/chemical/Makefile | 3 +
> drivers/iio/chemical/acd10.c | 389 ++++++++++++++++++++++++++++++++++
> 4 files changed, 409 insertions(+)
> create mode 100644 drivers/iio/chemical/acd10.c
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index e8f06145fb54..a5d70cd11dda 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -3743,6 +3743,13 @@ S: Supported
> W: http://www.akm.com/
> F: drivers/iio/magnetometer/ak8974.c
>
> +AOSONG ACD10 CARBON DIOXIDE SENSOR DRIVER
> +M: Akhilesh Patil <akhilesh.patil@xxxxxxxxx>
> +L: linux-iio@xxxxxxxxxxxxxxx
> +S: Maintained
> +F: Documentation/devicetree/bindings/iio/chemical/aosong,acd10.yaml
> +F: drivers/iio/chemical/acd10.c
> +
> AOSONG AGS02MA TVOC SENSOR DRIVER
> M: Anshul Dalal <anshulusr@xxxxxxxxx>
> L: linux-iio@xxxxxxxxxxxxxxx
> diff --git a/drivers/iio/chemical/Kconfig b/drivers/iio/chemical/Kconfig
> index b22afa1f6d59..2bbf49135997 100644
> --- a/drivers/iio/chemical/Kconfig
> +++ b/drivers/iio/chemical/Kconfig
> @@ -5,6 +5,16 @@
>
> menu "Chemical Sensors"
>
> +config ACD10
> + tristate "Aosong ACD10 CO2 gas sensor"
> + depends on SERIAL_DEV_BUS
> + help
> + Say Y here to build Aosong ASAIR ACD10 CO2 (carbon dioxide)
> + sensor driver.
> +
> + To compile this ACD10 driver as a loadable kernel module,
> + choose M here: the module will be called acd10
> +
> config AOSONG_AGS02MA
> tristate "Aosong AGS02MA TVOC sensor driver"
> depends on I2C
> diff --git a/drivers/iio/chemical/Makefile b/drivers/iio/chemical/Makefile
> index 2287a00a6b75..2187f596728c 100644
> --- a/drivers/iio/chemical/Makefile
> +++ b/drivers/iio/chemical/Makefile
> @@ -3,7 +3,10 @@
> # Makefile for IIO chemical sensors
> #
>
> +CONTEXT_ANALYSIS_acd10.o := y
> +
> # When adding new entries keep the list in alphabetical order
> +obj-$(CONFIG_ACD10) += acd10.o
> obj-$(CONFIG_AOSONG_AGS02MA) += ags02ma.o
> obj-$(CONFIG_ATLAS_PH_SENSOR) += atlas-sensor.o
> obj-$(CONFIG_ATLAS_EZO_SENSOR) += atlas-ezo-sensor.o
> diff --git a/drivers/iio/chemical/acd10.c b/drivers/iio/chemical/acd10.c
> new file mode 100644
> index 000000000000..a77dde636ea7
> --- /dev/null
> +++ b/drivers/iio/chemical/acd10.c
> @@ -0,0 +1,389 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * ACD10 CO2 gas sensor driver
> + *
> + * Copyright (c) 2026 Akhilesh Patil <akhilesh.patil@xxxxxxxxx>
> + *
> + * Datasheet:
> + * https://www.es.co.th/Schemetic/PDF/ACD10.PDF
> + *
> + * TODO additional features:
> + * 1) single-point calibration feature.
> + * 2) Sensor preheat wait feature.
> + */
> +
> +#include <linux/array_size.h>
> +#include <linux/bits.h>
> +#include <linux/cleanup.h>
> +#include <linux/completion.h>
> +#include <linux/dev_printk.h>
> +#include <linux/errno.h>
> +#include <linux/iio/iio.h>
> +#include <linux/iio/sysfs.h>
> +#include <linux/iio/types.h>
> +#include <linux/jiffies.h>
> +#include <linux/mod_devicetable.h>

In his review of v1
(https://lore.kernel.org/linux-iio/20261122192823.6a3430e6@jic23-hlaptop/)
Jonathan wrote about <linux/mod_devicetable.h>:

Not needed any more unless something is wrong in the serdev
header. These are now assumed to always come from the bus header.

With "These" refering to *_device_id
I confirm that <linux/serdev.h> indeed provides of_device_id (which is
the only one used in your driver). As I'm working on removing that
header, please drop it.

> +static const struct of_device_id acd10_of_match_table[] = {
> + { .compatible = "aosong,acd10", },
> + { }
> +};
> +MODULE_DEVICE_TABLE(of, acd10_of_match_table);

Please also drop the , just before the closing }.

Best regards
Uwe

Attachment: signature.asc
Description: PGP signature