All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Oleksij Rempel <o.rempel@pengutronix.de>
Cc: Jonathan Cameron <jic23@kernel.org>, <devicetree@vger.kernel.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	<linux-iio@vger.kernel.org>,
	Robin van der Gracht <robin@protonic.nl>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	<linux-kernel@vger.kernel.org>,
	Andy Shevchenko <andy.shevchenko@gmail.com>,
	Rob Herring <robh+dt@kernel.org>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	David Jander <david@protonic.nl>
Subject: Re: [PATCH v3 3/3] iio: adc: add ADC driver for the TI TSC2046 controller
Date: Mon, 22 Mar 2021 14:27:22 +0000	[thread overview]
Message-ID: <20210322142722.000053a6@Huawei.com> (raw)
In-Reply-To: <20210322115635.GA14791@pengutronix.de>


> >   
> > > +	/*
> > > +	 * Lock to protect the layout and the spi transfer buffer.
> > > +	 * tsc2046_adc_group_layout can be changed within update_scan_mode(),
> > > +	 * in this case the l[] and tx/rx buffer will be out of sync to each
> > > +	 * other.
> > > +	 */
> > > +	struct mutex slock;
> > > +	struct tsc2046_adc_group_layout l[TI_TSC2046_MAX_CHAN];
> > > +	struct tsc2046_adc_atom *rx;
> > > +	struct tsc2046_adc_atom *tx;
> > > +
> > > +	struct tsc2046_adc_atom *rx_one;
> > > +	struct tsc2046_adc_atom *tx_one;
> > > +
> > > +	unsigned int count;
> > > +	unsigned int groups;
> > > +	u32 effective_speed_hz;
> > > +	u32 scan_interval_us;
> > > +	u32 time_per_scan_us;
> > > +	u32 time_per_bit_ns;
> > > +
> > > +	struct tsc2046_adc_ch_cfg ch_cfg[TI_TSC2046_MAX_CHAN];
> > > +};
> > > +
> > > +#define TI_TSC2046_V_CHAN(index, bits, name)			\
> > > +{								\
> > > +	.type = IIO_VOLTAGE,					\
> > > +	.indexed = 1,						\
> > > +	.channel = index,					\
> > > +	.datasheet_name = "#name",				\
> > > +	.scan_index = index,					\
> > > +	.scan_type = {						\
> > > +		.sign = 'u',					\
> > > +		.realbits = bits,				\
> > > +		.storagebits = 16,				\
> > > +		.endianness = IIO_CPU,				\
> > > +	},							\
> > > +}  
> > 
> > I'd not noticed this before but you are exposing nothing to the
> > normal IIO interfaces.
> > 
> > That means for usecases like iio-hwmon there is no access
> > to polled readings, or information like channel scaling.
> > 
> > I suppose that could be added later, but perhaps you want to call this
> > out by mentioning it in the patch description.  
> 
> If it is ok for you, then I'll add some words about it in to the patch
> description.
Sure

> 
> > > +
> > > +#define DECLARE_TI_TSC2046_8_CHANNELS(name, bits) \
> > > +const struct iio_chan_spec name ## _channels[] = { \
> > > +	TI_TSC2046_V_CHAN(0, bits, TEMP0), \
> > > +	TI_TSC2046_V_CHAN(1, bits, Y), \
> > > +	TI_TSC2046_V_CHAN(2, bits, VBAT), \
> > > +	TI_TSC2046_V_CHAN(3, bits, Z1), \
> > > +	TI_TSC2046_V_CHAN(4, bits, Z2), \
> > > +	TI_TSC2046_V_CHAN(5, bits, X), \
> > > +	TI_TSC2046_V_CHAN(6, bits, AUX), \
> > > +	TI_TSC2046_V_CHAN(7, bits, TEMP1), \
> > > +	IIO_CHAN_SOFT_TIMESTAMP(8), \
> > > +}
> > > +
> > > +static DECLARE_TI_TSC2046_8_CHANNELS(tsc2046_adc, 12);
> > > +
> > > +static const struct tsc2046_adc_dcfg tsc2046_adc_dcfg_tsc2046e = {
> > > +	.channels = tsc2046_adc_channels,
> > > +	.num_channels = ARRAY_SIZE(tsc2046_adc_channels),
> > > +};
> > > +  
> > 
> > Hmm.  Flexibility that isn't yet used.  Normally I'm pretty resistant
> > to this going in, unless I'm reassured that there is support for additional
> > devices already in the pipeline.  Is that true here?  Otherwise
> > this is basically unneeded complexity.  
> 
> In the long term this driver should replace
> drivers/input/touchscreen/ads7846.c
> 
> This driver supports ti,ads7843, ti,ads7845, ti,ads7846.. at least with
> following number of supported channels:
> ti,ads7843 - 4 channels: x, y, aux0, aux1
> ti,ads7845 - 3 channels: x, y, aux0
> ti,ads7846 - 8 channels...
> 
> Currently I don't have this HW for testing and there a subtle
> differences that have to be taken care of and tested.
> 

Note that I'm only going to merge this driver with an explicit statement
from Dmitry as input maintainer that he is fine with this approach.

Jonathan

  reply	other threads:[~2021-03-22 14:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-19 14:45 [PATCH v3 0/3] mainline ti tsc2046 adc driver Oleksij Rempel
2021-03-19 14:45 ` [PATCH v3 1/3] dt-bindings:iio:adc: add generic settling-time-us and oversampling-ratio channel properties Oleksij Rempel
2021-03-19 14:45 ` [PATCH v3 2/3] dt-bindings:iio:adc: add documentation for TI TSC2046 controller Oleksij Rempel
2021-03-19 14:45 ` [PATCH v3 3/3] iio: adc: add ADC driver for the " Oleksij Rempel
2021-03-19 16:35   ` kernel test robot
2021-03-19 16:35     ` kernel test robot
2021-03-19 17:42   ` Andy Shevchenko
2021-03-22 10:30     ` Oleksij Rempel
2021-03-22 13:41       ` Andy Shevchenko
2021-03-22 14:08         ` Oleksij Rempel
2021-03-20 15:46   ` Jonathan Cameron
2021-03-22 11:56     ` Oleksij Rempel
2021-03-22 14:27       ` Jonathan Cameron [this message]
2021-03-29  7:38         ` Oleksij Rempel
2021-03-29 10:23           ` 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=20210322142722.000053a6@Huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=david@protonic.nl \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=jic23@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=pmeerw@pmeerw.net \
    --cc=robh+dt@kernel.org \
    --cc=robin@protonic.nl \
    /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 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.