Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Antoniu Miclaus <antoniu.miclaus@analog.com>
Cc: <robh@kernel.org>, <conor+dt@kernel.org>,
	<linux-iio@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<devicetree@vger.kernel.org>
Subject: Re: [PATCH v2 2/3] iio: amplifiers: adl8113: add driver support
Date: Sun, 9 Nov 2025 17:22:13 +0000	[thread overview]
Message-ID: <20251109172213.69d35297@jic23-huawei> (raw)
In-Reply-To: <20251108174357.3748-3-antoniu.miclaus@analog.com>

On Sat, 8 Nov 2025 17:43:53 +0000
Antoniu Miclaus <antoniu.miclaus@analog.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@analog.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;
> +	}
> +}


  reply	other threads:[~2025-11-09 17:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-08 17:43 [PATCH v2 0/3] iio: amplifiers: add support for ADL8113 Low Noise Amplifier Antoniu Miclaus
2025-11-08 17:43 ` [PATCH v2 1/3] dt-bindings: iio: amplifiers: add adl8113 Antoniu Miclaus
2025-11-08 18:25   ` Rob Herring (Arm)
2025-11-08 17:43 ` [PATCH v2 2/3] iio: amplifiers: adl8113: add driver support Antoniu Miclaus
2025-11-09 17:22   ` Jonathan Cameron [this message]
2025-11-11 14:06     ` Miclaus, Antoniu
2025-11-15 18:12       ` Jonathan Cameron
2025-11-08 17:43 ` [PATCH v2 3/3] Documentation: ABI: adl8113: add documentation Antoniu Miclaus
2025-11-09 17:18   ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251109172213.69d35297@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=antoniu.miclaus@analog.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox