mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-15 15:15:47 +00:00
iio: imu: st_lsm6dsx: check if master_enable is located in primary page
Check if the master enable 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@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
ee978bb86d
commit
007f2ebbac
3 changed files with 14 additions and 5 deletions
|
@ -184,7 +184,11 @@ struct st_lsm6dsx_hw_ts_settings {
|
||||||
*/
|
*/
|
||||||
struct st_lsm6dsx_shub_settings {
|
struct st_lsm6dsx_shub_settings {
|
||||||
struct st_lsm6dsx_reg page_mux;
|
struct st_lsm6dsx_reg page_mux;
|
||||||
struct st_lsm6dsx_reg master_en;
|
struct {
|
||||||
|
bool sec_page;
|
||||||
|
u8 addr;
|
||||||
|
u8 mask;
|
||||||
|
} master_en;
|
||||||
struct st_lsm6dsx_reg pullup_en;
|
struct st_lsm6dsx_reg pullup_en;
|
||||||
struct st_lsm6dsx_reg aux_sens;
|
struct st_lsm6dsx_reg aux_sens;
|
||||||
struct st_lsm6dsx_reg wr_once;
|
struct st_lsm6dsx_reg wr_once;
|
||||||
|
|
|
@ -868,6 +868,7 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = {
|
||||||
.mask = BIT(6),
|
.mask = BIT(6),
|
||||||
},
|
},
|
||||||
.master_en = {
|
.master_en = {
|
||||||
|
.sec_page = true,
|
||||||
.addr = 0x14,
|
.addr = 0x14,
|
||||||
.mask = BIT(2),
|
.mask = BIT(2),
|
||||||
},
|
},
|
||||||
|
@ -1243,6 +1244,7 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = {
|
||||||
.mask = BIT(6),
|
.mask = BIT(6),
|
||||||
},
|
},
|
||||||
.master_en = {
|
.master_en = {
|
||||||
|
.sec_page = true,
|
||||||
.addr = 0x14,
|
.addr = 0x14,
|
||||||
.mask = BIT(2),
|
.mask = BIT(2),
|
||||||
},
|
},
|
||||||
|
|
|
@ -185,15 +185,18 @@ static int st_lsm6dsx_shub_master_enable(struct st_lsm6dsx_sensor *sensor,
|
||||||
mutex_lock(&hw->page_lock);
|
mutex_lock(&hw->page_lock);
|
||||||
|
|
||||||
hub_settings = &hw->settings->shub_settings;
|
hub_settings = &hw->settings->shub_settings;
|
||||||
err = st_lsm6dsx_set_page(hw, true);
|
if (hub_settings->master_en.sec_page) {
|
||||||
if (err < 0)
|
err = st_lsm6dsx_set_page(hw, true);
|
||||||
goto out;
|
if (err < 0)
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
data = ST_LSM6DSX_SHIFT_VAL(enable, hub_settings->master_en.mask);
|
data = ST_LSM6DSX_SHIFT_VAL(enable, hub_settings->master_en.mask);
|
||||||
err = regmap_update_bits(hw->regmap, hub_settings->master_en.addr,
|
err = regmap_update_bits(hw->regmap, hub_settings->master_en.addr,
|
||||||
hub_settings->master_en.mask, data);
|
hub_settings->master_en.mask, data);
|
||||||
|
|
||||||
st_lsm6dsx_set_page(hw, false);
|
if (hub_settings->master_en.sec_page)
|
||||||
|
st_lsm6dsx_set_page(hw, false);
|
||||||
out:
|
out:
|
||||||
mutex_unlock(&hw->page_lock);
|
mutex_unlock(&hw->page_lock);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue