public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Nuno Sá" <noname.nuno@gmail.com>
To: Angelo Dureghello <adureghello@baylibre.com>,
	Lars-Peter Clausen	 <lars@metafoo.de>,
	Michael Hennerich <Michael.Hennerich@analog.com>,
	 Jonathan Cameron	 <jic23@kernel.org>,
	Mihail Chindris <mihail.chindris@analog.com>,
	Nuno Sa	 <nuno.sa@analog.com>,
	David Lechner <dlechner@baylibre.com>,
	Olivier Moysan	 <olivier.moysan@foss.st.com>
Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	linux-iio@vger.kernel.org, 	linux-kernel@vger.kernel.org,
	Antoniu Miclaus <antoniu.miclaus@analog.com>
Subject: Re: [PATCH 4/8] iio: backend: add API for interface configuration
Date: Tue, 17 Dec 2024 11:13:59 +0100	[thread overview]
Message-ID: <b5a773858a71e6929667fc73b9384908ca3ff313.camel@gmail.com> (raw)
In-Reply-To: <20241216-wip-bl-ad3552r-axi-v0-iio-testing-carlos-v1-4-856ff71fc930@baylibre.com>

On Mon, 2024-12-16 at 21:36 +0100, Angelo Dureghello wrote:
> From: Antoniu Miclaus <antoniu.miclaus@analog.com>
> 
> Add backend support for setting and getting the interface type
> in use.
> 
> Link:
> https://lore.kernel.org/linux-iio/20241129153546.63584-1-antoniu.miclaus@analog.com/T/#m6d86939078d780512824f1540145aade38b0990b
> Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
> Co-developed-by: Angelo Dureghello <adureghello@baylibre.com>
> Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
> ---
> This patch has been picked up from the Antoniu patchset
> still not accepted, and extended with the interface setter,
> fixing also namespace names to be between quotation marks.
> ---
>  drivers/iio/industrialio-backend.c | 42
> ++++++++++++++++++++++++++++++++++++++
>  include/linux/iio/backend.h        | 19 +++++++++++++++++
>  2 files changed, 61 insertions(+)
> 
> diff --git a/drivers/iio/industrialio-backend.c b/drivers/iio/industrialio-
> backend.c
> index 363281272035..6edc3e685f6a 100644
> --- a/drivers/iio/industrialio-backend.c
> +++ b/drivers/iio/industrialio-backend.c
> @@ -636,6 +636,48 @@ ssize_t iio_backend_ext_info_set(struct iio_dev
> *indio_dev, uintptr_t private,
>  }
>  EXPORT_SYMBOL_NS_GPL(iio_backend_ext_info_set, "IIO_BACKEND");
>  
> +/**
> + * iio_backend_interface_type_get - get the interface type used.
> + * @back: Backend device
> + * @type: Interface type
> + *
> + * RETURNS:
> + * 0 on success, negative error number on failure.
> + */
> +int iio_backend_interface_type_get(struct iio_backend *back,
> +				   enum iio_backend_interface_type *type)
> +{
> +	int ret;
> +
> +	ret = iio_backend_op_call(back, interface_type_get, type);
> +	if (ret)
> +		return ret;
> +
> +	if (*type >= IIO_BACKEND_INTERFACE_MAX)
> +		return -EINVAL;
> +
> +	return 0;
> +}
> +EXPORT_SYMBOL_NS_GPL(iio_backend_interface_type_get, "IIO_BACKEND");
> +
> +/**
> + * iio_backend_interface_type_set - set the interface type used.
> + * @back: Backend device
> + * @type: Interface type
> + *
> + * RETURNS:
> + * 0 on success, negative error number on failure.
> + */
> +int iio_backend_interface_type_set(struct iio_backend *back,
> +				   enum iio_backend_interface_type type)
> +{
> +	if (type >= IIO_BACKEND_INTERFACE_MAX)
> +		return -EINVAL;
> +
> +	return  iio_backend_op_call(back, interface_type_set, type);
> +}
> +EXPORT_SYMBOL_NS_GPL(iio_backend_interface_type_set, "IIO_BACKEND");
> +
>  /**
>   * iio_backend_extend_chan_spec - Extend an IIO channel
>   * @back: Backend device
> diff --git a/include/linux/iio/backend.h b/include/linux/iio/backend.h
> index 10be00f3b120..2b7221099d8c 100644
> --- a/include/linux/iio/backend.h
> +++ b/include/linux/iio/backend.h
> @@ -70,6 +70,15 @@ enum iio_backend_sample_trigger {
>  	IIO_BACKEND_SAMPLE_TRIGGER_MAX
>  };
>  
> +enum iio_backend_interface_type {
> +	IIO_BACKEND_INTERFACE_SERIAL_LVDS,
> +	IIO_BACKEND_INTERFACE_SERIAL_CMOS,

The above are apparently not used in the next patch so I would not add them now.
> +	IIO_BACKEND_INTERFACE_SERIAL_SPI,
> +	IIO_BACKEND_INTERFACE_SERIAL_DSPI,
> +	IIO_BACKEND_INTERFACE_SERIAL_QSPI,

I'll throw my 2 cents but it would be nice to have more feedback on this. I'm
not completely sure about the xSPI stuff in here. We treated the QSPI as a bus
both for control and data in which we also add child devices. And we've been
adding specific bus operations/configurations through the 'struct
ad3552r_hs_platform_data' interface. So, I'm wondering if this should also not
be set through that interface?

LVDS/CMOS still looks slightly different to me...

- Nuno Sá



  reply	other threads:[~2024-12-17 10:09 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-16 20:36 [PATCH 0/8] iio: ad3552r-hs: add support for ad3541/42r Angelo Dureghello
2024-12-16 20:36 ` [PATCH 1/8] iio: dac: ad3552r-common: fix ad3541/2r ranges Angelo Dureghello
2024-12-19 16:44   ` Jonathan Cameron
2024-12-16 20:36 ` [PATCH 2/8] iio: dac: ad3552r-hs: clear reset status flag Angelo Dureghello
2024-12-19 16:45   ` Jonathan Cameron
2024-12-16 20:36 ` [PATCH 3/8] iio: dac: adi-axi-dac: modify stream enable Angelo Dureghello
2024-12-16 20:36 ` [PATCH 4/8] iio: backend: add API for interface configuration Angelo Dureghello
2024-12-17 10:13   ` Nuno Sá [this message]
2024-12-19 16:42     ` Jonathan Cameron
2024-12-19 16:51       ` Jonathan Cameron
2024-12-19 17:01         ` David Lechner
2024-12-20 12:03           ` Angelo Dureghello
2024-12-16 20:36 ` [PATCH 5/8] iio: dac: adi-axi-dac: add bus mode setup Angelo Dureghello
2024-12-16 20:36 ` [PATCH 6/8] iio: dac: ad3552r-hs: exit for error on wrong chip id Angelo Dureghello
2024-12-19 16:54   ` Jonathan Cameron
2024-12-20  9:55     ` Conor Dooley
2024-12-20 14:25     ` Angelo Dureghello
2024-12-16 20:36 ` [PATCH 7/8] iio: dac: ad3552r-hs: add ad3541/2r support Angelo Dureghello
2024-12-19 17:08   ` Jonathan Cameron
2024-12-16 20:36 ` [PATCH 8/8] iio: dac: ad3552r-hs: update function name (non functional) Angelo Dureghello

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=b5a773858a71e6929667fc73b9384908ca3ff313.camel@gmail.com \
    --to=noname.nuno@gmail.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=adureghello@baylibre.com \
    --cc=antoniu.miclaus@analog.com \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mihail.chindris@analog.com \
    --cc=nuno.sa@analog.com \
    --cc=olivier.moysan@foss.st.com \
    /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