Re: [PATCH 3/6] iio: imu: st_lsm6dsx: check if pull_up is located in primary page

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 14 Dec 2019 17:52:56 +0100
Lorenzo Bianconi <lorenzo@xxxxxxxxxx> wrote:

> Check if the pull up register is located in the primary or in the
> secondary memory page. This is a preliminary patch to support i2c master
> controller on lsm6dsm devices
> 
> Signed-off-by: Lorenzo Bianconi <lorenzo@xxxxxxxxxx>
There was a bit of fuzz on this one given Andy's series merged
in the meantime.  Looks like it went on cleanly but please check.

This has happened in this order because I got a bit swamped so
it was easier to start at newest and go back in time (many
older versions are already superceded). Sorry about that!

Thanks,

Jonathan

> ---
>  drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h      |  6 +++++-
>  drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 13 +++++++++----
>  2 files changed, 14 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
> index 0f8f3fbde67a..b4bd02df2900 100644
> --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
> +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
> @@ -189,7 +189,11 @@ struct st_lsm6dsx_shub_settings {
>  		u8 addr;
>  		u8 mask;
>  	} master_en;
> -	struct st_lsm6dsx_reg pullup_en;
> +	struct {
> +		bool sec_page;
> +		u8 addr;
> +		u8 mask;
> +	} pullup_en;
>  	struct st_lsm6dsx_reg aux_sens;
>  	struct st_lsm6dsx_reg wr_once;
>  	u8 num_ext_dev;
> diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> index fe1aaaf68a9b..6adfc53ef8d0 100644
> --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> @@ -872,6 +872,7 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = {
>  				.mask = BIT(2),
>  			},
>  			.pullup_en = {
> +				.sec_page = true,
>  				.addr = 0x14,
>  				.mask = BIT(3),
>  			},
> @@ -1248,6 +1249,7 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = {
>  				.mask = BIT(2),
>  			},
>  			.pullup_en = {
> +				.sec_page = true,
>  				.addr = 0x14,
>  				.mask = BIT(3),
>  			},
> @@ -1863,16 +1865,19 @@ static int st_lsm6dsx_init_shub(struct st_lsm6dsx_hw *hw)
>  	pdata = (struct st_sensors_platform_data *)hw->dev->platform_data;
>  	if ((np && of_property_read_bool(np, "st,pullups")) ||
>  	    (pdata && pdata->pullups)) {
> -		err = st_lsm6dsx_set_page(hw, true);
> -		if (err < 0)
> -			return err;
> +		if (hub_settings->pullup_en.sec_page) {
> +			err = st_lsm6dsx_set_page(hw, true);
> +			if (err < 0)
> +				return err;
> +		}
>  
>  		data = ST_LSM6DSX_SHIFT_VAL(1, hub_settings->pullup_en.mask);
>  		err = regmap_update_bits(hw->regmap,
>  					 hub_settings->pullup_en.addr,
>  					 hub_settings->pullup_en.mask, data);
>  
> -		st_lsm6dsx_set_page(hw, false);
> +		if (hub_settings->pullup_en.sec_page)
> +			st_lsm6dsx_set_page(hw, false);
>  
>  		if (err < 0)
>  			return err;




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux