[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240522150141.1776196-5-adureghello@baylibre.org>
Date: Wed, 22 May 2024 17:01:39 +0200
From: Angelo Dureghello <adureghello@...libre.com>
To: jic23@...nel.org,
robh@...nel.org,
krzk+dt@...nel.org,
conor+dt@...nel.org
Cc: nuno.sa@...log.com,
lars@...afoo.de,
Michael.Hennerich@...log.com,
linux-iio@...r.kernel.org,
devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org,
Angelo Dureghello <adureghello@...libre.com>
Subject: [PATCH v2 4/6] iio: dac: ad3552r: add support for ad3541r and ad3551r
From: Angelo Dureghello <adureghello@...libre.com>
Add support for single-output DAC variants.
Signed-off-by: Angelo Dureghello <adureghello@...libre.com>
---
Changes for v2:
- adding new models using model data structure.
---
drivers/iio/dac/ad3552r.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/drivers/iio/dac/ad3552r.c b/drivers/iio/dac/ad3552r.c
index 6a40c7eece1f..b4630fb89334 100644
--- a/drivers/iio/dac/ad3552r.c
+++ b/drivers/iio/dac/ad3552r.c
@@ -140,7 +140,9 @@ enum ad3552r_ch_vref_select {
};
enum ad3542r_id {
+ AD3541R_ID = 0x400b,
AD3542R_ID = 0x4009,
+ AD3551R_ID = 0x400a,
AD3552R_ID = 0x4008,
};
@@ -1105,6 +1107,15 @@ static int ad3552r_probe(struct spi_device *spi)
return devm_iio_device_register(&spi->dev, indio_dev);
}
+static const struct ad3552r_model_data ad3541r_model_data = {
+ .model_name = "ad3541r",
+ .chip_id = AD3541R_ID,
+ .num_hw_channels = 1,
+ .ranges_table = ad3542r_ch_ranges,
+ .num_ranges = ARRAY_SIZE(ad3542r_ch_ranges),
+ .requires_output_range = true,
+};
+
static const struct ad3552r_model_data ad3542r_model_data = {
.model_name = "ad3542r",
.chip_id = AD3542R_ID,
@@ -1114,6 +1125,15 @@ static const struct ad3552r_model_data ad3542r_model_data = {
.requires_output_range = true,
};
+static const struct ad3552r_model_data ad3551r_model_data = {
+ .model_name = "ad3551r",
+ .chip_id = AD3551R_ID,
+ .num_hw_channels = 1,
+ .ranges_table = ad3552r_ch_ranges,
+ .num_ranges = ARRAY_SIZE(ad3552r_ch_ranges),
+ .requires_output_range = false,
+};
+
static const struct ad3552r_model_data ad3552r_model_data = {
.model_name = "ad3552r",
.chip_id = AD3552R_ID,
@@ -1124,10 +1144,18 @@ static const struct ad3552r_model_data ad3552r_model_data = {
};
static const struct spi_device_id ad3552r_id[] = {
+ {
+ .name = "ad3541r",
+ .driver_data = (kernel_ulong_t)&ad3541r_model_data
+ },
{
.name = "ad3542r",
.driver_data = (kernel_ulong_t)&ad3542r_model_data
},
+ {
+ .name = "ad3551r",
+ .driver_data = (kernel_ulong_t)&ad3551r_model_data
+ },
{
.name = "ad3552r",
.driver_data = (kernel_ulong_t)&ad3552r_model_data
@@ -1137,7 +1165,9 @@ static const struct spi_device_id ad3552r_id[] = {
MODULE_DEVICE_TABLE(spi, ad3552r_id);
static const struct of_device_id ad3552r_of_match[] = {
+ { .compatible = "adi,ad3541r", .data = &ad3541r_model_data },
{ .compatible = "adi,ad3542r", .data = &ad3542r_model_data },
+ { .compatible = "adi,ad3551r", .data = &ad3551r_model_data },
{ .compatible = "adi,ad3552r", .data = &ad3552r_model_data },
{ }
};
--
2.45.0.rc1
Powered by blists - more mailing lists