[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251109172213.69d35297@jic23-huawei>
Date: Sun, 9 Nov 2025 17:22:13 +0000
From: Jonathan Cameron <jic23@...nel.org>
To: Antoniu Miclaus <antoniu.miclaus@...log.com>
Cc: <robh@...nel.org>, <conor+dt@...nel.org>, <linux-iio@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <devicetree@...r.kernel.org>
Subject: Re: [PATCH v2 2/3] iio: amplifiers: adl8113: add driver support
On Sat, 8 Nov 2025 17:43:53 +0000
Antoniu Miclaus <antoniu.miclaus@...log.com> wrote:
> Add support for adl8113 10MHz to 12GHz Low Noise Amplifier with
> 10MHz to 14GHz bypass switches.
>
> Signed-off-by: Antoniu Miclaus <antoniu.miclaus@...log.com>
Hi Antoniu
I think we need to come up with an innovative solution for the "mode".
I'm not sure what it is yet though so very much looking for some discussion.
thanks,
Jonathan
> diff --git a/drivers/iio/amplifiers/adl8113.c b/drivers/iio/amplifiers/adl8113.c
> new file mode 100644
> index 000000000000..8c234f0a1b6a
> --- /dev/null
> +++ b/drivers/iio/amplifiers/adl8113.c
> @@ -0,0 +1,213 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * ADL8113 Low Noise Amplifier with integrated bypass switches
> + *
> + * Copyright 2025 Analog Devices Inc.
> + */
> +
> +#include <linux/array_size.h>
> +#include <linux/device.h>
> +#include <linux/err.h>
> +#include <linux/gpio/consumer.h>
> +#include <linux/iio/iio.h>
> +#include <linux/iio/sysfs.h>
Not sure if this file is being used. It is rare to see it needed in a modern drive.
> +#include <linux/mod_devicetable.h>
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
> +#include <linux/property.h>
> +#include <linux/regulator/consumer.h>
> +#include <linux/slab.h>
> +#include <linux/sysfs.h>
> +
> +static int adl8113_read_raw(struct iio_dev *indio_dev,
> + struct iio_chan_spec const *chan,
> + int *val, int *val2, long mask)
> +{
> + struct adl8113_state *st = iio_priv(indio_dev);
> + int ret;
> +
> + switch (mask) {
> + case IIO_CHAN_INFO_HARDWAREGAIN:
> + switch (st->current_mode) {
> + case ADL8113_INTERNAL_AMPLIFIER:
> + *val = 14;
> + *val2 = 0;
> + ret = IIO_VAL_INT_PLUS_MICRO_DB;
return ...
> + break;
> + case ADL8113_INTERNAL_BYPASS:
> + *val = 0;
> + *val2 = 0;
gain of bypass = 1.0 rather than 0.0 which is open circuit gain.
> + ret = IIO_VAL_INT_PLUS_MICRO_DB;
return IIO_VAL_INT...
> + break;
> + case ADL8113_EXTERNAL_BYPASS_A:
> + case ADL8113_EXTERNAL_BYPASS_B:
> + default:
> + ret = -EINVAL;
return -EINVAL;
Early returns save a line of code here and I general think make
for much more readable code.
> + }
> + return ret;
> + default:
> + return -EINVAL;
> + }
> +}
Powered by blists - more mailing lists