Lines Matching +full:aux +full:- +full:reg
1 /* ST Microelectronics ISM330DHCX 6-axis IMU sensor driver
5 * SPDX-License-Identifier: Apache-2.0
75 struct ism330dhcx_data *data = dev->data; in ism330dhcx_lis2mdl_init()
78 data->magn_gain = LIS2MDL_SENSITIVITY; in ism330dhcx_lis2mdl_init()
84 k_sleep(K_MSEC(10)); /* turn-on time in ms */ in ism330dhcx_lis2mdl_init()
108 return -ENOTSUP; in ism330dhcx_lis2mdl_odr_set()
124 return ism330dhcx_lis2mdl_odr_set(dev, i2c_addr, val->val1); in ism330dhcx_lis2mdl_conf()
127 return -ENOTSUP; in ism330dhcx_lis2mdl_conf()
150 struct ism330dhcx_data *data = dev->data; in ism330dhcx_hts221_read_conv_data()
152 struct hts221_data *ht = &data->hts221; in ism330dhcx_hts221_read_conv_data()
155 unsigned char len = MIN(7, sizeof(buf) - i); in ism330dhcx_hts221_read_conv_data()
161 return -EIO; in ism330dhcx_hts221_read_conv_data()
165 ht->y0 = buf[0] / 2; in ism330dhcx_hts221_read_conv_data()
166 ht->y1 = buf[1] / 2; in ism330dhcx_hts221_read_conv_data()
167 ht->x0 = buf[6] | (buf[7] << 8); in ism330dhcx_hts221_read_conv_data()
168 ht->x1 = buf[10] | (buf[11] << 8); in ism330dhcx_hts221_read_conv_data()
198 return -ENOTSUP; in ism330dhcx_hts221_odr_set()
214 return ism330dhcx_hts221_odr_set(dev, i2c_addr, val->val1); in ism330dhcx_hts221_conf()
217 return -ENOTSUP; in ism330dhcx_hts221_conf()
245 k_sleep(K_MSEC(1)); /* turn-on time in ms */ in ism330dhcx_lps22hb_init()
277 k_sleep(K_MSEC(100)); /* turn-on time in ms */ in ism330dhcx_lps22hh_init()
303 return -ENOTSUP; in ism330dhcx_lps22hh_odr_set()
319 return ism330dhcx_lps22hh_odr_set(dev, i2c_addr, val->val1); in ism330dhcx_lps22hh_conf()
322 return -ENOTSUP; in ism330dhcx_lps22hh_conf()
401 struct ism330dhcx_data *data = dev->data; in ism330dhcx_shub_wait_completed()
406 ism330dhcx_sh_status_get(data->ctx, &status); in ism330dhcx_shub_wait_completed()
412 struct ism330dhcx_data *data = dev->data; in ism330dhcx_shub_embedded_en()
415 (void) ism330dhcx_mem_bank_set(data->ctx, ISM330DHCX_SENSOR_HUB_BANK); in ism330dhcx_shub_embedded_en()
417 (void) ism330dhcx_mem_bank_set(data->ctx, ISM330DHCX_USER_BANK); in ism330dhcx_shub_embedded_en()
426 struct ism330dhcx_data *data = dev->data; in ism330dhcx_shub_read_embedded_regs()
430 if (ism330dhcx_read_reg(data->ctx, reg_addr, value, len) < 0) { in ism330dhcx_shub_read_embedded_regs()
431 LOG_DBG("shub: failed to read external reg: %02x", reg_addr); in ism330dhcx_shub_read_embedded_regs()
433 return -EIO; in ism330dhcx_shub_read_embedded_regs()
444 struct ism330dhcx_data *data = dev->data; in ism330dhcx_shub_write_embedded_regs()
448 if (ism330dhcx_write_reg(data->ctx, reg_addr, value, len) < 0) { in ism330dhcx_shub_write_embedded_regs()
449 LOG_DBG("shub: failed to write external reg: %02x", reg_addr); in ism330dhcx_shub_write_embedded_regs()
451 return -EIO; in ism330dhcx_shub_write_embedded_regs()
461 struct ism330dhcx_data *data = dev->data; in ism330dhcx_shub_enable()
464 if (!data->accel_freq) { in ism330dhcx_shub_enable()
467 if (ism330dhcx_xl_data_rate_set(data->ctx, odr) < 0) { in ism330dhcx_shub_enable()
475 if (ism330dhcx_sh_master_set(data->ctx, enable) < 0) { in ism330dhcx_shub_enable()
491 LOG_DBG("shub: error reading embedded reg"); in ism330dhcx_shub_check_slv0_nack()
492 return -EIO; in ism330dhcx_shub_check_slv0_nack()
497 return -EIO; in ism330dhcx_shub_check_slv0_nack()
509 struct ism330dhcx_data *data = dev->data; in ism330dhcx_shub_read_slave_reg()
517 LOG_DBG("shub: error writing embedded reg"); in ism330dhcx_shub_read_slave_reg()
518 return -EIO; in ism330dhcx_shub_read_slave_reg()
527 return -EIO; in ism330dhcx_shub_read_slave_reg()
532 if (ism330dhcx_read_reg(data->ctx, ISM330DHCX_SHUB_DATA_OUT, in ism330dhcx_shub_read_slave_reg()
536 return -EIO; in ism330dhcx_shub_read_slave_reg()
559 LOG_DBG("shub: error writing embedded reg"); in ism330dhcx_shub_write_slave_reg()
560 return -EIO; in ism330dhcx_shub_write_slave_reg()
566 LOG_DBG("shub: error writing embedded reg"); in ism330dhcx_shub_write_slave_reg()
567 return -EIO; in ism330dhcx_shub_write_slave_reg()
576 return -EIO; in ism330dhcx_shub_write_slave_reg()
589 LOG_DBG("shub: error writing embedded reg"); in ism330dhcx_shub_write_slave_reg()
590 return -EIO; in ism330dhcx_shub_write_slave_reg()
599 * - SLAVE 0: used for configuring all slave devices
600 * - SLAVE 1: used as data read channel for external slave device #1
601 * - SLAVE 2: used as data read channel for external slave device #2
602 * - SLAVE 3: used for generic reads while data channel is enabled
606 struct ism330dhcx_data *data = dev->data; in ism330dhcx_shub_set_data_channel()
615 slv_cfg[i] = (sp->ext_i2c_addr << 1) | ISM330DHCX_SHUB_SLVX_READ; in ism330dhcx_shub_set_data_channel()
616 slv_cfg[i + 1] = sp->out_data_addr; in ism330dhcx_shub_set_data_channel()
617 slv_cfg[i + 2] = sp->out_data_len; in ism330dhcx_shub_set_data_channel()
622 LOG_DBG("shub: error writing embedded reg"); in ism330dhcx_shub_set_data_channel()
623 return -EIO; in ism330dhcx_shub_set_data_channel()
627 ism330dhcx_aux_sens_on_t aux = ISM330DHCX_SLV_0_1_2; in ism330dhcx_shub_set_data_channel() local
629 if (ism330dhcx_sh_slave_connected_set(data->ctx, aux) < 0) { in ism330dhcx_shub_set_data_channel()
630 LOG_DBG("shub: error setting aux sensors"); in ism330dhcx_shub_set_data_channel()
631 return -EIO; in ism330dhcx_shub_set_data_channel()
636 if (ism330dhcx_sh_write_mode_set(data->ctx, wo) < 0) { in ism330dhcx_shub_set_data_channel()
638 return -EIO; in ism330dhcx_shub_set_data_channel()
657 if (sp->type == type) { in ism330dhcx_shub_get_idx()
662 return -ENOTSUP; in ism330dhcx_shub_get_idx()
668 struct ism330dhcx_data *data = dev->data; in ism330dhcx_shub_fetch_external_devs()
677 if (ism330dhcx_read_reg(data->ctx, sp->sh_out_reg, in ism330dhcx_shub_fetch_external_devs()
678 data->ext_data[n], sp->out_data_len) < 0) { in ism330dhcx_shub_fetch_external_devs()
681 return -EIO; in ism330dhcx_shub_fetch_external_devs()
700 if (sp->type == chan) { in ism330dhcx_shub_config()
707 return -ENOTSUP; in ism330dhcx_shub_config()
710 if (sp == NULL || sp->dev_conf == NULL) { in ism330dhcx_shub_config()
712 return -ENOTSUP; in ism330dhcx_shub_config()
715 return sp->dev_conf(dev, sp->ext_i2c_addr, chan, attr, val); in ism330dhcx_shub_config()
737 for (i = 0U; i < ARRAY_SIZE(sp->i2c_addr); i++) { in ism330dhcx_shub_init()
738 if (ism330dhcx_shub_read_slave_reg(dev, sp->i2c_addr[i], sp->wai_addr, in ism330dhcx_shub_init()
742 if (chip_id == sp->wai_val) { in ism330dhcx_shub_init()
747 if (i >= ARRAY_SIZE(sp->i2c_addr)) { in ism330dhcx_shub_init()
752 sp->ext_i2c_addr = sp->i2c_addr[i]; in ism330dhcx_shub_init()
759 return -EINVAL; in ism330dhcx_shub_init()
765 sp->sh_out_reg = ISM330DHCX_SHUB_DATA_OUT + regn; in ism330dhcx_shub_init()
766 regn += sp->out_data_len; in ism330dhcx_shub_init()
767 sp->dev_init(dev, sp->ext_i2c_addr); in ism330dhcx_shub_init()