[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<CY4PR03MB33991FC450F33126532B80C19BCFA@CY4PR03MB3399.namprd03.prod.outlook.com>
Date: Tue, 11 Nov 2025 14:06:02 +0000
From: "Miclaus, Antoniu" <Antoniu.Miclaus@...log.com>
To: Jonathan Cameron <jic23@...nel.org>
CC: "robh@...nel.org" <robh@...nel.org>,
"conor+dt@...nel.org"
<conor+dt@...nel.org>,
"linux-iio@...r.kernel.org"
<linux-iio@...r.kernel.org>,
"linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>,
"devicetree@...r.kernel.org"
<devicetree@...r.kernel.org>
Subject: RE: [PATCH v2 2/3] iio: amplifiers: adl8113: add driver support
> -----Original Message-----
> From: Jonathan Cameron <jic23@...nel.org>
> Sent: Sunday, November 9, 2025 7:22 PM
> To: Miclaus, Antoniu <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
>
> [External]
>
> 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.
Isn't this supposed to be a dB value since I am returning IIO_VAL_INT_PLUS_MICRO_DB? Linear gain of 1 = 0dB.
>
> > + 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