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: <5599292F.6000205@kernel.org>
Date:	Sun, 05 Jul 2015 13:55:11 +0100
From:	Jonathan Cameron <jic23@...nel.org>
To:	Teodora Baluta <teodora.baluta@...el.com>
CC:	knaack.h@....de, lars@...afoo.de, pmeerw@...erw.net,
	daniel.baluta@...el.com, dan.carpenter@...cle.com,
	linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] iio: magnetometer: mmc35240: fix available sampling
 frequencies

On 29/06/15 13:44, Teodora Baluta wrote:
> Fix the sampling frequencies according to the datasheet (page 8). The
> datasheet specifies the following available frequencies for continuous
> mode: 1.5 Hz, 13 Hz, 25 Hz, and 50 Hz.
> 
> Also fix comments about the ODR to comply with datasheet.
> 
> Signed-off-by: Teodora Baluta <teodora.baluta@...el.com>
Applied to the fixes-for-4.2 branch of iio.git
Thanks,
> ---
>  drivers/iio/magnetometer/mmc35240.c | 35 +++++++++++++++++++++--------------
>  1 file changed, 21 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/iio/magnetometer/mmc35240.c b/drivers/iio/magnetometer/mmc35240.c
> index e89b059..36a4b53 100644
> --- a/drivers/iio/magnetometer/mmc35240.c
> +++ b/drivers/iio/magnetometer/mmc35240.c
> @@ -84,10 +84,10 @@
>  #define MMC35240_OTP_START_ADDR		0x1B
>  
>  enum mmc35240_resolution {
> -	MMC35240_16_BITS_SLOW = 0, /* 100 Hz */
> -	MMC35240_16_BITS_FAST,     /* 200 Hz */
> -	MMC35240_14_BITS,          /* 333 Hz */
> -	MMC35240_12_BITS,          /* 666 Hz */
> +	MMC35240_16_BITS_SLOW = 0, /* 7.92 ms */
> +	MMC35240_16_BITS_FAST,     /* 4.08 ms */
> +	MMC35240_14_BITS,          /* 2.16 ms */
> +	MMC35240_12_BITS,          /* 1.20 ms */
>  };
>  
>  enum mmc35240_axis {
> @@ -100,22 +100,22 @@ static const struct {
>  	int sens[3]; /* sensitivity per X, Y, Z axis */
>  	int nfo; /* null field output */
>  } mmc35240_props_table[] = {
> -	/* 16 bits, 100Hz ODR */
> +	/* 16 bits, 125Hz ODR */
>  	{
>  		{1024, 1024, 1024},
>  		32768,
>  	},
> -	/* 16 bits, 200Hz ODR */
> +	/* 16 bits, 250Hz ODR */
>  	{
>  		{1024, 1024, 770},
>  		32768,
>  	},
> -	/* 14 bits, 333Hz ODR */
> +	/* 14 bits, 450Hz ODR */
>  	{
>  		{256, 256, 193},
>  		8192,
>  	},
> -	/* 12 bits, 666Hz ODR */
> +	/* 12 bits, 800Hz ODR */
>  	{
>  		{64, 64, 48},
>  		2048,
> @@ -133,9 +133,15 @@ struct mmc35240_data {
>  	int axis_scale[3];
>  };
>  
> -static const int mmc35240_samp_freq[] = {100, 200, 333, 666};
> +static const struct {
> +	int val;
> +	int val2;
> +} mmc35240_samp_freq[] = { {1, 500000},
> +			   {13, 0},
> +			   {25, 0},
> +			   {50, 0} };
>  
> -static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("100 200 333 666");
> +static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("1.5 13 25 50");
>  
>  #define MMC35240_CHANNEL(_axis) { \
>  	.type = IIO_MAGN, \
> @@ -168,7 +174,8 @@ static int mmc35240_get_samp_freq_index(struct mmc35240_data *data,
>  	int i;
>  
>  	for (i = 0; i < ARRAY_SIZE(mmc35240_samp_freq); i++)
> -		if (mmc35240_samp_freq[i] == val)
> +		if (mmc35240_samp_freq[i].val == val &&
> +		    mmc35240_samp_freq[i].val2 == val2)
>  			return i;
>  	return -EINVAL;
>  }
> @@ -378,9 +385,9 @@ static int mmc35240_read_raw(struct iio_dev *indio_dev,
>  		if (i < 0 || i >= ARRAY_SIZE(mmc35240_samp_freq))
>  			return -EINVAL;
>  
> -		*val = mmc35240_samp_freq[i];
> -		*val2 = 0;
> -		return IIO_VAL_INT;
> +		*val = mmc35240_samp_freq[i].val;
> +		*val2 = mmc35240_samp_freq[i].val2;
> +		return IIO_VAL_INT_PLUS_MICRO;
>  	default:
>  		return -EINVAL;
>  	}
> 

--
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