Lines Matching +full:data +full:- +full:ready
5 * SPDX-License-Identifier: Apache-2.0
29 struct max14916_data *data = dev->data; in max14916_pars_spi_diag() local
33 LOG_ERR("[DIAG] MAX14916 in SPI diag - error detected"); in max14916_pars_spi_diag()
35 data->glob.interrupt.reg_bits.SHT_VDD_FLT = MAX149X6_GET_BIT(rx_diag_buff[0], 5); in max14916_pars_spi_diag()
36 data->glob.interrupt.reg_bits.OW_ON_FLT = MAX149X6_GET_BIT(rx_diag_buff[0], 4); in max14916_pars_spi_diag()
37 data->glob.interrupt.reg_bits.OW_OFF_FLT = MAX149X6_GET_BIT(rx_diag_buff[0], 3); in max14916_pars_spi_diag()
38 data->glob.interrupt.reg_bits.CURR_LIM = MAX149X6_GET_BIT(rx_diag_buff[0], 2); in max14916_pars_spi_diag()
39 data->glob.interrupt.reg_bits.OVER_LD_FLT = MAX149X6_GET_BIT(rx_diag_buff[0], 1); in max14916_pars_spi_diag()
42 LOG_ERR("[DIAG] MAX14916 in SPI diag - GLOBAL FAULT detected"); in max14916_pars_spi_diag()
45 ret = -EIO; in max14916_pars_spi_diag()
47 PRINT_ERR(data->glob.interrupt.reg_bits.SHT_VDD_FLT); in max14916_pars_spi_diag()
48 PRINT_ERR(data->glob.interrupt.reg_bits.OW_ON_FLT); in max14916_pars_spi_diag()
49 PRINT_ERR(data->glob.interrupt.reg_bits.OW_OFF_FLT); in max14916_pars_spi_diag()
50 PRINT_ERR(data->glob.interrupt.reg_bits.CURR_LIM); in max14916_pars_spi_diag()
51 PRINT_ERR(data->glob.interrupt.reg_bits.OVER_LD_FLT); in max14916_pars_spi_diag()
55 /* +-----------------------------------------------------------------------+ in max14916_pars_spi_diag()
57 * +--------+--------+--------+--------+--------+--------+--------+--------+ in max14916_pars_spi_diag()
59 * +--------+--------+--------+--------+--------+--------+--------+--------+ in max14916_pars_spi_diag()
61 * +--------+--------+--------+--------+--------+--------+--------+--------+ in max14916_pars_spi_diag()
83 const struct max14916_config *config = dev->config; in max14916_reg_trans_spi_diag()
86 if (!gpio_pin_get_dt(&config->fault_gpio)) { in max14916_reg_trans_spi_diag()
93 ret = -EIO; in max14916_reg_trans_spi_diag()
105 const struct max14916_config *config = dev->config; in gpio_max14916_diag_chan_get()
106 struct max14916_data *data = dev->data; in gpio_max14916_diag_chan_get() local
109 if (!gpio_pin_get_dt(&config->fault_gpio)) { in gpio_max14916_diag_chan_get()
111 ret = -EIO; in gpio_max14916_diag_chan_get()
114 data->glob.interrupt.reg_raw = in gpio_max14916_diag_chan_get()
117 if (data->glob.interrupt.reg_raw) { in gpio_max14916_diag_chan_get()
118 if (data->glob.interrupt.reg_bits.OVER_LD_FLT) { in gpio_max14916_diag_chan_get()
119 data->chan.ovr_ld = max149x6_reg_transceive(dev, MAX14916_OVR_LD_REG, 0, in gpio_max14916_diag_chan_get()
122 if (data->glob.interrupt.reg_bits.CURR_LIM) { in gpio_max14916_diag_chan_get()
123 data->chan.curr_lim = max149x6_reg_transceive(dev, MAX14916_CURR_LIM_REG, 0, in gpio_max14916_diag_chan_get()
126 if (data->glob.interrupt.reg_bits.OW_OFF_FLT) { in gpio_max14916_diag_chan_get()
127 data->chan.ow_off = max149x6_reg_transceive(dev, MAX14916_OW_OFF_FLT_REG, 0, in gpio_max14916_diag_chan_get()
130 if (data->glob.interrupt.reg_bits.OW_ON_FLT) { in gpio_max14916_diag_chan_get()
131 data->chan.ow_on = max149x6_reg_transceive(dev, MAX14916_OW_ON_FLT_REG, 0, in gpio_max14916_diag_chan_get()
134 if (data->glob.interrupt.reg_bits.SHT_VDD_FLT) { in gpio_max14916_diag_chan_get()
135 data->chan.sht_vdd = max149x6_reg_transceive(dev, MAX14916_SHT_VDD_FLT_REG, in gpio_max14916_diag_chan_get()
139 if (data->glob.interrupt.reg_bits.SUPPLY_ERR) { in gpio_max14916_diag_chan_get()
140 data->glob.glob_err.reg_raw = max149x6_reg_transceive( in gpio_max14916_diag_chan_get()
142 PRINT_ERR(data->glob.glob_err.reg_bits.VINT_UV); in gpio_max14916_diag_chan_get()
143 PRINT_ERR(data->glob.glob_err.reg_bits.VA_UVLO); in gpio_max14916_diag_chan_get()
144 PRINT_ERR(data->glob.glob_err.reg_bits.VDD_BAD); in gpio_max14916_diag_chan_get()
145 PRINT_ERR(data->glob.glob_err.reg_bits.VDD_WARN); in gpio_max14916_diag_chan_get()
146 PRINT_ERR(data->glob.glob_err.reg_bits.VDD_UVLO); in gpio_max14916_diag_chan_get()
147 PRINT_ERR(data->glob.glob_err.reg_bits.THRMSHUTD); in gpio_max14916_diag_chan_get()
148 PRINT_ERR(data->glob.glob_err.reg_bits.SYNC_ERR); in gpio_max14916_diag_chan_get()
149 PRINT_ERR(data->glob.glob_err.reg_bits.WDOG_ERR); in gpio_max14916_diag_chan_get()
152 if (data->glob.interrupt.reg_bits.COM_ERR) { in gpio_max14916_diag_chan_get()
155 ret = -EIO; in gpio_max14916_diag_chan_get()
188 return -ENOTSUP; in gpio_max14916_config()
192 return -ENOTSUP; in gpio_max14916_config()
196 return -ENOTSUP; in gpio_max14916_config()
200 return -ENOTSUP; in gpio_max14916_config()
209 return -ENOTSUP; in gpio_max14916_config()
272 const struct max14916_config *config = dev->config; in gpio_max14916_config_diag()
273 struct max14916_data *data = dev->data; in gpio_max14916_config_diag() local
275 MAX14916_REG_WRITE(dev, MAX14916_CONFIG1_REG, config->config1.reg_raw); in gpio_max14916_config_diag()
276 MAX14916_REG_WRITE(dev, MAX14916_CONFIG2_REG, config->config2.reg_raw); in gpio_max14916_config_diag()
277 MAX14916_REG_WRITE(dev, MAX14916_OW_OFF_EN_REG, data->chan_en.ow_on_en); in gpio_max14916_config_diag()
278 MAX14916_REG_WRITE(dev, MAX14916_OW_OFF_EN_REG, data->chan_en.ow_off_en); in gpio_max14916_config_diag()
279 MAX14916_REG_WRITE(dev, MAX14916_SHT_VDD_EN_REG, data->chan_en.sht_vdd_en); in gpio_max14916_config_diag()
285 const struct max14916_config *config = dev->config; in gpio_max14916_init()
288 LOG_DBG(" --- GPIO MAX14916 init IN ---"); in gpio_max14916_init()
290 if (!spi_is_ready_dt(&config->spi)) { in gpio_max14916_init()
291 LOG_ERR("SPI bus is not ready\n"); in gpio_max14916_init()
292 return -ENODEV; in gpio_max14916_init()
295 /* setup READY gpio - normal low */ in gpio_max14916_init()
296 if (!gpio_is_ready_dt(&config->ready_gpio)) { in gpio_max14916_init()
297 LOG_ERR("READY GPIO device not ready"); in gpio_max14916_init()
298 return -ENODEV; in gpio_max14916_init()
301 err = gpio_pin_configure_dt(&config->ready_gpio, GPIO_INPUT); in gpio_max14916_init()
307 /* setup FLT gpio - normal high */ in gpio_max14916_init()
308 if (!gpio_is_ready_dt(&config->fault_gpio)) { in gpio_max14916_init()
309 LOG_ERR("FLT GPIO device not ready"); in gpio_max14916_init()
310 return -ENODEV; in gpio_max14916_init()
313 err = gpio_pin_configure_dt(&config->fault_gpio, GPIO_INPUT); in gpio_max14916_init()
319 /* setup LATCH gpio - normal high */ in gpio_max14916_init()
320 if (!gpio_is_ready_dt(&config->sync_gpio)) { in gpio_max14916_init()
321 LOG_ERR("SYNC GPIO device not ready"); in gpio_max14916_init()
322 return -ENODEV; in gpio_max14916_init()
325 err = gpio_pin_configure_dt(&config->sync_gpio, GPIO_OUTPUT_INACTIVE); in gpio_max14916_init()
331 /* setup LATCH gpio - normal high */ in gpio_max14916_init()
332 if (!gpio_is_ready_dt(&config->en_gpio)) { in gpio_max14916_init()
333 LOG_ERR("SYNC GPIO device not ready"); in gpio_max14916_init()
334 return -ENODEV; in gpio_max14916_init()
337 err = gpio_pin_configure_dt(&config->en_gpio, GPIO_OUTPUT_INACTIVE); in gpio_max14916_init()
343 gpio_pin_set_dt(&config->en_gpio, 1); in gpio_max14916_init()
344 gpio_pin_set_dt(&config->sync_gpio, 1); in gpio_max14916_init()
346 LOG_ERR("[GPIO] FALUT - %d\n", gpio_pin_get_dt(&config->fault_gpio)); in gpio_max14916_init()
347 LOG_ERR("[GPIO] READY - %d\n", gpio_pin_get_dt(&config->ready_gpio)); in gpio_max14916_init()
348 LOG_ERR("[GPIO] SYNC - %d\n", gpio_pin_get_dt(&config->sync_gpio)); in gpio_max14916_init()
349 LOG_ERR("[GPIO] EN - %d\n", gpio_pin_get_dt(&config->en_gpio)); in gpio_max14916_init()
357 LOG_DBG(" --- GPIO MAX14916 init OUT ---"); in gpio_max14916_init()