lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 2 Jul 2023 17:21:16 +0800
From:   Jonathan Cameron <Jonathan.Cameron@...wei.com>
To:     George Stark <gnstark@...rdevices.ru>
CC:     <jic23@...nel.org>, <lars@...afoo.de>, <neil.armstrong@...aro.org>,
        <khilman@...libre.com>, <jbrunet@...libre.com>,
        <martin.blumenstingl@...glemail.com>,
        <andriy.shevchenko@...ux.intel.com>, <nuno.sa@...log.com>,
        <linux-iio@...r.kernel.org>,
        <linux-arm-kernel@...ts.infradead.org>,
        <linux-kernel@...r.kernel.org>,
        <linux-amlogic@...ts.infradead.org>, <kernel@...rdevices.ru>
Subject: Re: [PATCH v3 5/5] meson saradc: support reading from channel 7 mux
 inputs

On Wed, 28 Jun 2023 01:37:18 +0300
George Stark <gnstark@...rdevices.ru> wrote:

> Add iio channel for every channel 7 mux input.
> Meson saradc channel 7 is connected to a mux that can switch channel
> input to well-known sources like Vdd, GND and several Vdd dividers.
> 
> Signed-off-by: George Stark <GNStark@...rdevices.ru>
> ---
>  drivers/iio/adc/meson_saradc.c | 83 ++++++++++++++++++++++++++++++++--
>  1 file changed, 79 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c
> index 4a9dacedb6c3..c99a55944ece 100644
> --- a/drivers/iio/adc/meson_saradc.c
> +++ b/drivers/iio/adc/meson_saradc.c
> @@ -163,6 +163,7 @@
>  #define MESON_SAR_ADC_MAX_FIFO_SIZE				32
>  #define MESON_SAR_ADC_TIMEOUT					100 /* ms */
>  #define MESON_SAR_ADC_VOLTAGE_AND_TEMP_CHANNEL			6
> +#define MESON_SAR_ADC_VOLTAGE_AND_MUX_CHANNEL			7
>  #define MESON_SAR_ADC_TEMP_OFFSET				27
>  
>  /* temperature sensor calibration information in eFuse */
> @@ -202,6 +203,19 @@
>  	.datasheet_name = "TEMP_SENSOR",				\
>  }
>  
> +#define MESON_SAR_ADC_MUX(_chan, _sel) {				\
> +	.type = IIO_VOLTAGE,						\
> +	.channel = _chan,						\
> +	.indexed = 1,							\
> +	.address = MESON_SAR_ADC_VOLTAGE_AND_MUX_CHANNEL,		\
> +	.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |			\
> +				BIT(IIO_CHAN_INFO_AVERAGE_RAW),		\
> +	.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),		\
> +	.info_mask_shared_by_all = BIT(IIO_CHAN_INFO_CALIBBIAS) |	\
> +				BIT(IIO_CHAN_INFO_CALIBSCALE),		\
> +	.datasheet_name = "SAR_ADC_MUX_"#_sel,				\
> +}
> +
>  enum meson_sar_adc_avg_mode {
>  	NO_AVERAGING = 0x0,
>  	MEAN_AVERAGING = 0x1,
> @@ -235,6 +249,27 @@ enum meson_sar_adc_channel_index {
>  	NUM_CHAN_7,
>  	NUM_CHAN_TEMP,
>  	NUM_CHAN_SOFT_TIMESTAMP,

Silly question... Why does this device have timestamp channels?
It has no buffer support so they don't 'do anything'.
If it had then putting other channels after that might have broken
things if not done very carefully (hence I went looking)

> +	NUM_MUX_0_VSS,
> +	NUM_MUX_1_VDD_DIV4,
> +	NUM_MUX_2_VDD_DIV2,
> +	NUM_MUX_3_VDD_MUL3_DIV4,
> +	NUM_MUX_4_VDD,
> +};
...

>  static const struct iio_chan_spec meson_sar_adc_iio_channels[] = {
> @@ -247,6 +282,11 @@ static const struct iio_chan_spec meson_sar_adc_iio_channels[] = {
>  	MESON_SAR_ADC_CHAN(NUM_CHAN_6),
>  	MESON_SAR_ADC_CHAN(NUM_CHAN_7),
>  	IIO_CHAN_SOFT_TIMESTAMP(NUM_CHAN_SOFT_TIMESTAMP),
> +	MESON_SAR_ADC_MUX(NUM_MUX_0_VSS, 0),
> +	MESON_SAR_ADC_MUX(NUM_MUX_1_VDD_DIV4, 1),
> +	MESON_SAR_ADC_MUX(NUM_MUX_2_VDD_DIV2, 2),
> +	MESON_SAR_ADC_MUX(NUM_MUX_3_VDD_MUL3_DIV4, 3),
> +	MESON_SAR_ADC_MUX(NUM_MUX_4_VDD, 4),
>  };

Jonathan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ