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: <20240914155902.38ec637b@jic23-huawei>
Date: Sat, 14 Sep 2024 15:59:02 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Javier Carrasco <javier.carrasco.cruz@...il.com>
Cc: Lars-Peter Clausen <lars@...afoo.de>, Rob Herring <robh@...nel.org>,
 Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley
 <conor+dt@...nel.org>, Rishi Gupta <gupt21@...il.com>,
 linux-iio@...r.kernel.org, devicetree@...r.kernel.org,
 linux-kernel@...r.kernel.org, Jonathan Cameron
 <Jonathan.Cameron@...wei.com>
Subject: Re: [PATCH 6/7] iio: light: veml6030: add set up delay after any
 power on sequence

On Fri, 13 Sep 2024 15:19:01 +0200
Javier Carrasco <javier.carrasco.cruz@...il.com> wrote:

> The veml6030 requires a delay of 4 ms after activating the sensor. That
> is done correctly during the hw initialization, but it's missing after
> resuming.
> 
> Move the delay to the power on function to make sure that it is always
> observerd.
> 
> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@...il.com>
> ---
>  drivers/iio/light/veml6030.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/iio/light/veml6030.c b/drivers/iio/light/veml6030.c
> index d5add040d0b3..2945cc1db599 100644
> --- a/drivers/iio/light/veml6030.c
> +++ b/drivers/iio/light/veml6030.c
> @@ -143,8 +143,17 @@ static const struct attribute_group veml6030_event_attr_group = {
>  
>  static int veml6030_als_pwr_on(struct veml6030_data *data)
>  {
> -	return regmap_clear_bits(data->regmap, VEML6030_REG_ALS_CONF,
> +	int ret;
> +
> +	ret =  regmap_clear_bits(data->regmap, VEML6030_REG_ALS_CONF,
>  				 VEML6030_ALS_SD);
> +	if (ret)
> +		return ret;
> +
> +	/* Wait 4 ms to let processor & oscillator start correctly */
> +	usleep_range(4000, 4002);
There is no useful point in such a narrow range. Given you are moving
it let's tidy that up as well.

Just use fsleep() which will use a much wider range but is good enough.

Jonathan

> +
> +	return 0;
>  }
>  
>  static int veml6030_als_shut_down(struct veml6030_data *data)
> @@ -766,9 +775,6 @@ static int veml6030_hw_init(struct iio_dev *indio_dev)
>  		return ret;
>  	}
>  
> -	/* Wait 4 ms to let processor & oscillator start correctly */
> -	usleep_range(4000, 4002);
> -
>  	/* Clear stale interrupt status bits if any during start */
>  	ret = regmap_read(data->regmap, VEML6030_REG_ALS_INT, &val);
>  	if (ret < 0) {
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ