Lines Matching +full:1 +full:st

47 static bool inv_magn_supported(const struct inv_mpu6050_state *st)  in inv_magn_supported()  argument
49 switch (st->chip_type) { in inv_magn_supported()
60 static int inv_magn_init(struct inv_mpu6050_state *st) in inv_magn_init() argument
68 ret = inv_mpu_aux_read(st, INV_MPU_MAGN_I2C_ADDR, INV_MPU_MAGN_REG_WIA, in inv_magn_init()
76 switch (st->chip_type) { in inv_magn_init()
79 ret = inv_mpu_aux_write(st, INV_MPU_MAGN_I2C_ADDR, in inv_magn_init()
90 ret = inv_mpu_aux_write(st, INV_MPU_MAGN_I2C_ADDR, in inv_magn_init()
96 ret = inv_mpu_aux_read(st, INV_MPU_MAGN_I2C_ADDR, INV_MPU_MAGN_REG_ASAX, in inv_magn_init()
102 ret = inv_mpu_aux_write(st, INV_MPU_MAGN_I2C_ADDR, in inv_magn_init()
110 * 1 uT = 0.01 G and value is in micron (1e6) in inv_magn_init()
111 * sensitvity = x uT * 0.01 * 1e6 in inv_magn_init()
113 switch (st->chip_type) { in inv_magn_init()
130 * Hadj = H * (((ASA - 128) * 0.5 / 128) + 1) in inv_magn_init()
136 st->magn_raw_to_gauss[0] = (((int32_t)asa[0] + 128) * sensitivity) / 256; in inv_magn_init()
137 st->magn_raw_to_gauss[1] = (((int32_t)asa[1] + 128) * sensitivity) / 256; in inv_magn_init()
138 st->magn_raw_to_gauss[2] = (((int32_t)asa[2] + 128) * sensitivity) / 256; in inv_magn_init()
145 * @st: driver internal state
152 int inv_mpu_magn_probe(struct inv_mpu6050_state *st) in inv_mpu_magn_probe() argument
158 if (!inv_magn_supported(st)) in inv_mpu_magn_probe()
162 ret = inv_mpu_aux_init(st); in inv_mpu_magn_probe()
167 ret = inv_magn_init(st); in inv_mpu_magn_probe()
176 ret = regmap_write(st->map, INV_MPU6050_REG_I2C_SLV_ADDR(0), in inv_mpu_magn_probe()
181 ret = regmap_write(st->map, INV_MPU6050_REG_I2C_SLV_REG(0), in inv_mpu_magn_probe()
186 ret = regmap_write(st->map, INV_MPU6050_REG_I2C_SLV_CTRL(0), in inv_mpu_magn_probe()
195 ret = regmap_write(st->map, INV_MPU6050_REG_I2C_SLV_ADDR(1), in inv_mpu_magn_probe()
200 ret = regmap_write(st->map, INV_MPU6050_REG_I2C_SLV_REG(1), in inv_mpu_magn_probe()
207 switch (st->chip_type) { in inv_mpu_magn_probe()
215 ret = regmap_write(st->map, INV_MPU6050_REG_I2C_SLV_DO(1), val); in inv_mpu_magn_probe()
219 return regmap_write(st->map, INV_MPU6050_REG_I2C_SLV_CTRL(1), in inv_mpu_magn_probe()
220 INV_MPU6050_BIT_SLV_EN | 1); in inv_mpu_magn_probe()
225 * @st: driver internal state
234 int inv_mpu_magn_set_rate(const struct inv_mpu6050_state *st, int fifo_rate) in inv_mpu_magn_set_rate() argument
239 if (!inv_magn_supported(st)) in inv_mpu_magn_set_rate()
244 * compute fifo_rate divider d: rate = fifo_rate / (d + 1) in inv_mpu_magn_set_rate()
247 d = fifo_rate / INV_MPU_MAGN_FREQ_HZ_MAX - 1; in inv_mpu_magn_set_rate()
251 return regmap_write(st->map, INV_MPU6050_REG_I2C_SLV4_CTRL, d); in inv_mpu_magn_set_rate()
256 * @st: driver internal state
262 int inv_mpu_magn_set_orient(struct inv_mpu6050_state *st) in inv_mpu_magn_set_orient() argument
269 switch (st->chip_type) { in inv_mpu_magn_set_orient()
274 st->magn_orient.rotation[0] = st->orientation.rotation[3]; in inv_mpu_magn_set_orient()
275 st->magn_orient.rotation[1] = st->orientation.rotation[4]; in inv_mpu_magn_set_orient()
276 st->magn_orient.rotation[2] = st->orientation.rotation[5]; in inv_mpu_magn_set_orient()
278 st->magn_orient.rotation[3] = st->orientation.rotation[0]; in inv_mpu_magn_set_orient()
279 st->magn_orient.rotation[4] = st->orientation.rotation[1]; in inv_mpu_magn_set_orient()
280 st->magn_orient.rotation[5] = st->orientation.rotation[2]; in inv_mpu_magn_set_orient()
283 orient = st->orientation.rotation[6 + i]; in inv_mpu_magn_set_orient()
285 str = devm_kzalloc(regmap_get_device(st->map), in inv_mpu_magn_set_orient()
292 strcpy(str, &orient[1]); in inv_mpu_magn_set_orient()
295 strcpy(&str[1], orient); in inv_mpu_magn_set_orient()
297 st->magn_orient.rotation[6 + i] = str; in inv_mpu_magn_set_orient()
301 st->magn_orient = st->orientation; in inv_mpu_magn_set_orient()
310 * @st: driver internal state
316 int inv_mpu_magn_read(struct inv_mpu6050_state *st, int axis, int *val) in inv_mpu_magn_read() argument
324 if (!inv_magn_supported(st)) in inv_mpu_magn_read()
344 ret = regmap_read(st->map, INV_MPU6050_REG_I2C_MST_STATUS, &status); in inv_mpu_magn_read()
352 ret = regmap_bulk_read(st->map, addr, &data, sizeof(data)); in inv_mpu_magn_read()