All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] iio: amplifiers: hmc425a: Add Support HMC540S 4-bit Attenuator
@ 2023-08-16 11:09 Ana-Maria Cusco
  2023-08-16 11:09 ` [PATCH 2/2] dt-bindings: iio: hmc425a: add entry for HMC540S Ana-Maria Cusco
  2023-08-28 14:35 ` [PATCH 1/2] iio: amplifiers: hmc425a: Add Support HMC540S 4-bit Attenuator Jonathan Cameron
  0 siblings, 2 replies; 8+ messages in thread
From: Ana-Maria Cusco @ 2023-08-16 11:09 UTC (permalink / raw)
  To: ana-maria.cusco
  Cc: Michael Hennerich, Lars-Peter Clausen, Michael Hennerich,
	Jonathan Cameron, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	linux-iio, devicetree, linux-kernel

From: Michael Hennerich <michael.hennerich@analog.com>

This adds support for the Analog Devices HMC540s 1 dB LSB
Silicon MMIC 4-Bit Digital Positive Control Attenuator, 0.1 - 8 GHz

Signed-off-by: Ana-Maria Cusco <ana-maria.cusco@analog.com>
---
 drivers/iio/amplifiers/hmc425a.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/iio/amplifiers/hmc425a.c b/drivers/iio/amplifiers/hmc425a.c
index 108f0f1685ef..e87d35d50a95 100644
--- a/drivers/iio/amplifiers/hmc425a.c
+++ b/drivers/iio/amplifiers/hmc425a.c
@@ -21,6 +21,7 @@
 
 enum hmc425a_type {
 	ID_HMC425A,
+	ID_HMC540S,
 };
 
 struct hmc425a_chip_info {
@@ -70,6 +71,9 @@ static int hmc425a_read_raw(struct iio_dev *indio_dev,
 		case ID_HMC425A:
 			gain = ~code * -500;
 			break;
+		case ID_HMC540S:
+			gain = ~code * -1000;
+			break;
 		}
 
 		*val = gain / 1000;
@@ -106,6 +110,9 @@ static int hmc425a_write_raw(struct iio_dev *indio_dev,
 	case ID_HMC425A:
 		code = ~((abs(gain) / 500) & 0x3F);
 		break;
+	case ID_HMC540S:
+		code = ~((abs(gain) / 1000) & 0xF);
+		break;
 	}
 
 	mutex_lock(&st->lock);
@@ -157,6 +164,7 @@ static const struct iio_chan_spec hmc425a_channels[] = {
 /* Match table for of_platform binding */
 static const struct of_device_id hmc425a_of_match[] = {
 	{ .compatible = "adi,hmc425a", .data = (void *)ID_HMC425A },
+	{ .compatible = "adi,hmc540s", .data = (void *)ID_HMC540S },
 	{},
 };
 MODULE_DEVICE_TABLE(of, hmc425a_of_match);
@@ -171,6 +179,15 @@ static struct hmc425a_chip_info hmc425a_chip_info_tbl[] = {
 		.gain_max = 0,
 		.default_gain = -0x40, /* set default gain -31.5db*/
 	},
+	[ID_HMC540S] = {
+		.name = "hmc540s",
+		.channels = hmc425a_channels,
+		.num_channels = ARRAY_SIZE(hmc425a_channels),
+		.num_gpios = 4,
+		.gain_min = -15000,
+		.gain_max = 0,
+		.default_gain = -0x10, /* set default gain -15.0db*/
+	},
 };
 
 static int hmc425a_probe(struct platform_device *pdev)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-09-12 11:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-16 11:09 [PATCH 1/2] iio: amplifiers: hmc425a: Add Support HMC540S 4-bit Attenuator Ana-Maria Cusco
2023-08-16 11:09 ` [PATCH 2/2] dt-bindings: iio: hmc425a: add entry for HMC540S Ana-Maria Cusco
2023-08-16 14:36   ` Conor Dooley
2023-09-12  6:36     ` Hennerich, Michael
2023-09-12  6:56       ` Krzysztof Kozlowski
2023-09-12  9:16         ` Jonathan Cameron
2023-09-12 11:28           ` Hennerich, Michael
2023-08-28 14:35 ` [PATCH 1/2] iio: amplifiers: hmc425a: Add Support HMC540S 4-bit Attenuator Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.