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]
Message-ID: <20140610151912.GA3429@piout.net>
Date:	Tue, 10 Jun 2014 17:19:13 +0200
From:	Alexandre Belloni <alexandre.belloni@...e-electrons.com>
To:	Robert Hodaszi <robert.hodaszi@...i.com>
Cc:	jic23@...nel.org, linux-iio@...r.kernel.org,
	linux-kernel@...r.kernel.org, gregkh@...uxfoundation.org,
	marex@...x.de, jbe@...gutronix.de, hector.palacios@...i.com,
	fabio.estevam@...escale.com, lars@...afoo.de
Subject: Re: [PATCH 1/2] iio: mxs-lradc: fix divider

On 10/06/2014 at 15:41:34 +0200, Robert Hodaszi wrote :
> All channels' single measurement are happening on CH 0. So enabling / disabling
> the divider once is not enough, because it has impact on all channels.
> 
> Set only a flag, then check this on each measurement, and enable / disable the
> divider as required.
> 
> Signed-off-by: Robert Hodaszi <robert.hodaszi@...i.com>

It makes perfect sense.

Acked-by: Alexandre Belloni <alexandre.belloni@...e-electrons.com>

> ---
>  drivers/staging/iio/adc/mxs-lradc.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
> index dae8d1a..52d7517 100644
> --- a/drivers/staging/iio/adc/mxs-lradc.c
> +++ b/drivers/staging/iio/adc/mxs-lradc.c
> @@ -846,6 +846,14 @@ static int mxs_lradc_read_single(struct iio_dev *iio_dev, int chan, int *val)
>  			LRADC_CTRL1);
>  	mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0);
>  
> +	/* Enable / disable the divider per requirement */
> +	if (test_bit(chan, &lradc->is_divided))
> +		mxs_lradc_reg_set(lradc, 1 << LRADC_CTRL2_DIVIDE_BY_TWO_OFFSET,
> +			LRADC_CTRL2);
> +	else
> +		mxs_lradc_reg_clear(lradc,
> +			1 << LRADC_CTRL2_DIVIDE_BY_TWO_OFFSET, LRADC_CTRL2);
> +
>  	/* Clean the slot's previous content, then set new one. */
>  	mxs_lradc_reg_clear(lradc, LRADC_CTRL4_LRADCSELECT_MASK(0),
>  			LRADC_CTRL4);
> @@ -961,15 +969,11 @@ static int mxs_lradc_write_raw(struct iio_dev *iio_dev,
>  		if (val == scale_avail[MXS_LRADC_DIV_DISABLED].integer &&
>  		    val2 == scale_avail[MXS_LRADC_DIV_DISABLED].nano) {
>  			/* divider by two disabled */
> -			writel(1 << LRADC_CTRL2_DIVIDE_BY_TWO_OFFSET,
> -			       lradc->base + LRADC_CTRL2 + STMP_OFFSET_REG_CLR);
>  			clear_bit(chan->channel, &lradc->is_divided);
>  			ret = 0;
>  		} else if (val == scale_avail[MXS_LRADC_DIV_ENABLED].integer &&
>  			   val2 == scale_avail[MXS_LRADC_DIV_ENABLED].nano) {
>  			/* divider by two enabled */
> -			writel(1 << LRADC_CTRL2_DIVIDE_BY_TWO_OFFSET,
> -			       lradc->base + LRADC_CTRL2 + STMP_OFFSET_REG_SET);
>  			set_bit(chan->channel, &lradc->is_divided);
>  			ret = 0;
>  		}

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ