• Home
  • Raw
  • Download

Lines Matching +full:use +full:- +full:prox

1 // SPDX-License-Identifier: GPL-2.0+
4 * detection (prox) within the TAOS TSL2571, TSL2671, TMD2671, TSL2771, TMD2771,
8 * Copyright (c) 2017-2018 Brian Masney <masneyb@onstation.org>
39 * TAOS Register definitions - Note: depending on device, some of these register
143 /* Per-device data */
324 ret = i2c_smbus_read_byte_data(chip->client, in tsl2772_read_status()
327 dev_err(&chip->client->dev, in tsl2772_read_status()
338 ret = i2c_smbus_write_byte_data(chip->client, in tsl2772_write_control_reg()
341 dev_err(&chip->client->dev, in tsl2772_write_control_reg()
355 ret = i2c_smbus_write_byte(chip->client, in tsl2772_read_autoinc_regs()
359 dev_err(&chip->client->dev, in tsl2772_read_autoinc_regs()
365 ret = i2c_smbus_read_byte_data(chip->client, in tsl2772_read_autoinc_regs()
368 dev_err(&chip->client->dev, in tsl2772_read_autoinc_regs()
375 ret = i2c_smbus_read_byte_data(chip->client, in tsl2772_read_autoinc_regs()
378 dev_err(&chip->client->dev, in tsl2772_read_autoinc_regs()
385 ret = i2c_smbus_write_byte(chip->client, in tsl2772_read_autoinc_regs()
389 dev_err(&chip->client->dev, in tsl2772_read_autoinc_regs()
399 * tsl2772_get_lux() - Reads and calculates current lux value.
404 * by a device-specific scale factor, and divided by the integration time and
416 mutex_lock(&chip->als_mutex); in tsl2772_get_lux()
418 if (chip->tsl2772_chip_status != TSL2772_CHIP_WORKING) { in tsl2772_get_lux()
419 dev_err(&chip->client->dev, "%s: device is not enabled\n", in tsl2772_get_lux()
421 ret = -EBUSY; in tsl2772_get_lux()
430 dev_err(&chip->client->dev, in tsl2772_get_lux()
432 ret = chip->als_cur_info.lux; /* return LAST VALUE */ in tsl2772_get_lux()
440 chip->als_cur_info.als_ch0 = ret; in tsl2772_get_lux()
446 chip->als_cur_info.als_ch1 = ret; in tsl2772_get_lux()
448 if (chip->als_cur_info.als_ch0 >= chip->als_saturation) { in tsl2772_get_lux()
453 if (!chip->als_cur_info.als_ch0) { in tsl2772_get_lux()
455 ret = chip->als_cur_info.lux; in tsl2772_get_lux()
461 for (p = (struct tsl2772_lux *)chip->tsl2772_device_lux; p->ch0 != 0; in tsl2772_get_lux()
465 lux = ((chip->als_cur_info.als_ch0 * p->ch0) - in tsl2772_get_lux()
466 (chip->als_cur_info.als_ch1 * p->ch1)) / in tsl2772_get_lux()
467 chip->als_gain_time_scale; in tsl2772_get_lux()
475 lux = (lux * chip->settings.als_gain_trim) / 1000; in tsl2772_get_lux()
489 chip->als_cur_info.lux = max_lux; in tsl2772_get_lux()
493 mutex_unlock(&chip->als_mutex); in tsl2772_get_lux()
499 * tsl2772_get_prox() - Reads proximity data registers and updates
500 * chip->prox_data.
509 mutex_lock(&chip->prox_mutex); in tsl2772_get_prox()
515 switch (chip->id) { in tsl2772_get_prox()
522 ret = -EINVAL; in tsl2772_get_prox()
533 ret = -EINVAL; in tsl2772_get_prox()
542 chip->prox_data = ret; in tsl2772_get_prox()
545 mutex_unlock(&chip->prox_mutex); in tsl2772_get_prox()
552 struct device_node *of_node = chip->client->dev.of_node; in tsl2772_read_prox_led_current()
555 ret = of_property_read_u32(of_node, "led-max-microamp", &tmp); in tsl2772_read_prox_led_current()
561 chip->settings.prox_power = tsl2772_led_currents[i][1]; in tsl2772_read_prox_led_current()
566 dev_err(&chip->client->dev, "Invalid value %d for led-max-microamp\n", in tsl2772_read_prox_led_current()
569 return -EINVAL; in tsl2772_read_prox_led_current()
575 struct device_node *of_node = chip->client->dev.of_node; in tsl2772_read_prox_diodes()
579 ret = of_property_count_u32_elems(of_node, "amstaos,proximity-diodes"); in tsl2772_read_prox_diodes()
587 ret = of_property_read_u32_array(of_node, "amstaos,proximity-diodes", in tsl2772_read_prox_diodes()
590 dev_err(&chip->client->dev, in tsl2772_read_prox_diodes()
591 "Invalid value for amstaos,proximity-diodes: %d.\n", in tsl2772_read_prox_diodes()
603 dev_err(&chip->client->dev, in tsl2772_read_prox_diodes()
604 "Invalid value %d in amstaos,proximity-diodes.\n", in tsl2772_read_prox_diodes()
606 return -EINVAL; in tsl2772_read_prox_diodes()
609 chip->settings.prox_diode = prox_diode_mask; in tsl2772_read_prox_diodes()
621 * tsl2772_defaults() - Populates the device nominal operating parameters
630 if (chip->pdata && chip->pdata->platform_default_settings) in tsl2772_defaults()
631 memcpy(&chip->settings, chip->pdata->platform_default_settings, in tsl2772_defaults()
634 memcpy(&chip->settings, &tsl2772_default_settings, in tsl2772_defaults()
638 if (chip->pdata && chip->pdata->platform_lux_table[0].ch0 != 0) in tsl2772_defaults()
639 memcpy(chip->tsl2772_device_lux, in tsl2772_defaults()
640 chip->pdata->platform_lux_table, in tsl2772_defaults()
641 sizeof(chip->pdata->platform_lux_table)); in tsl2772_defaults()
643 memcpy(chip->tsl2772_device_lux, in tsl2772_defaults()
644 tsl2772_default_lux_table_group[chip->id], in tsl2772_defaults()
651 * tsl2772_als_calibrate() - Obtain single reading and calculate
661 ret = i2c_smbus_read_byte_data(chip->client, in tsl2772_als_calibrate()
664 dev_err(&chip->client->dev, in tsl2772_als_calibrate()
672 dev_err(&chip->client->dev, in tsl2772_als_calibrate()
675 return -EINVAL; in tsl2772_als_calibrate()
677 dev_err(&chip->client->dev, in tsl2772_als_calibrate()
680 return -ENODATA; in tsl2772_als_calibrate()
685 dev_err(&chip->client->dev, in tsl2772_als_calibrate()
690 return -ERANGE; in tsl2772_als_calibrate()
692 ret = (chip->settings.als_cal_target * chip->settings.als_gain_trim) / in tsl2772_als_calibrate()
695 return -ERANGE; in tsl2772_als_calibrate()
697 chip->settings.als_gain_trim = ret; in tsl2772_als_calibrate()
706 regulator_bulk_disable(ARRAY_SIZE(chip->supplies), chip->supplies); in tsl2772_disable_regulators_action()
716 chip->tsl2772_config[TSL2772_ALS_TIME] = chip->settings.als_time; in tsl2772_chip_on()
717 chip->tsl2772_config[TSL2772_PRX_TIME] = chip->settings.prox_time; in tsl2772_chip_on()
718 chip->tsl2772_config[TSL2772_WAIT_TIME] = chip->settings.wait_time; in tsl2772_chip_on()
719 chip->tsl2772_config[TSL2772_ALS_PRX_CONFIG] = in tsl2772_chip_on()
720 chip->settings.als_prox_config; in tsl2772_chip_on()
722 chip->tsl2772_config[TSL2772_ALS_MINTHRESHLO] = in tsl2772_chip_on()
723 (chip->settings.als_thresh_low) & 0xFF; in tsl2772_chip_on()
724 chip->tsl2772_config[TSL2772_ALS_MINTHRESHHI] = in tsl2772_chip_on()
725 (chip->settings.als_thresh_low >> 8) & 0xFF; in tsl2772_chip_on()
726 chip->tsl2772_config[TSL2772_ALS_MAXTHRESHLO] = in tsl2772_chip_on()
727 (chip->settings.als_thresh_high) & 0xFF; in tsl2772_chip_on()
728 chip->tsl2772_config[TSL2772_ALS_MAXTHRESHHI] = in tsl2772_chip_on()
729 (chip->settings.als_thresh_high >> 8) & 0xFF; in tsl2772_chip_on()
730 chip->tsl2772_config[TSL2772_PERSISTENCE] = in tsl2772_chip_on()
731 (chip->settings.prox_persistence & 0xFF) << 4 | in tsl2772_chip_on()
732 (chip->settings.als_persistence & 0xFF); in tsl2772_chip_on()
734 chip->tsl2772_config[TSL2772_PRX_COUNT] = in tsl2772_chip_on()
735 chip->settings.prox_pulse_count; in tsl2772_chip_on()
736 chip->tsl2772_config[TSL2772_PRX_MINTHRESHLO] = in tsl2772_chip_on()
737 (chip->settings.prox_thres_low) & 0xFF; in tsl2772_chip_on()
738 chip->tsl2772_config[TSL2772_PRX_MINTHRESHHI] = in tsl2772_chip_on()
739 (chip->settings.prox_thres_low >> 8) & 0xFF; in tsl2772_chip_on()
740 chip->tsl2772_config[TSL2772_PRX_MAXTHRESHLO] = in tsl2772_chip_on()
741 (chip->settings.prox_thres_high) & 0xFF; in tsl2772_chip_on()
742 chip->tsl2772_config[TSL2772_PRX_MAXTHRESHHI] = in tsl2772_chip_on()
743 (chip->settings.prox_thres_high >> 8) & 0xFF; in tsl2772_chip_on()
746 if (chip->tsl2772_chip_status == TSL2772_CHIP_WORKING) { in tsl2772_chip_on()
747 /* if forcing a register update - turn off, then on */ in tsl2772_chip_on()
748 dev_info(&chip->client->dev, "device is already enabled\n"); in tsl2772_chip_on()
749 return -EINVAL; in tsl2772_chip_on()
753 chip->tsl2772_config[TSL2772_GAIN] = in tsl2772_chip_on()
754 (chip->settings.als_gain & 0xFF) | in tsl2772_chip_on()
755 ((chip->settings.prox_gain & 0xFF) << 2) | in tsl2772_chip_on()
756 (chip->settings.prox_diode << 4) | in tsl2772_chip_on()
757 (chip->settings.prox_power << 6); in tsl2772_chip_on()
760 als_count = 256 - chip->settings.als_time; in tsl2772_chip_on()
761 als_time_us = als_count * tsl2772_int_time_avail[chip->id][3]; in tsl2772_chip_on()
762 chip->als_saturation = als_count * 768; /* 75% of full scale */ in tsl2772_chip_on()
763 chip->als_gain_time_scale = als_time_us * in tsl2772_chip_on()
764 tsl2772_als_gain[chip->settings.als_gain]; in tsl2772_chip_on()
767 * TSL2772 Specific power-on / adc enable sequence in tsl2772_chip_on()
775 * Use the following shadow copy for our delay before enabling ADC. in tsl2772_chip_on()
778 for (i = 0, dev_reg = chip->tsl2772_config; in tsl2772_chip_on()
782 ret = i2c_smbus_write_byte_data(chip->client, reg, in tsl2772_chip_on()
785 dev_err(&chip->client->dev, in tsl2772_chip_on()
792 /* Power-on settling time */ in tsl2772_chip_on()
797 if (chip->settings.als_interrupt_en) in tsl2772_chip_on()
799 if (chip->settings.prox_interrupt_en) in tsl2772_chip_on()
806 ret = i2c_smbus_write_byte(chip->client, in tsl2772_chip_on()
810 dev_err(&chip->client->dev, in tsl2772_chip_on()
816 chip->tsl2772_chip_status = TSL2772_CHIP_WORKING; in tsl2772_chip_on()
826 chip->tsl2772_chip_status = TSL2772_CHIP_SUSPENDED; in tsl2772_chip_off()
838 * tsl2772_invoke_change - power cycle the device to implement the user
842 * Obtain and lock both ALS and PROX resources, determine and save device state
849 int device_status = chip->tsl2772_chip_status; in tsl2772_invoke_change()
852 mutex_lock(&chip->als_mutex); in tsl2772_invoke_change()
853 mutex_lock(&chip->prox_mutex); in tsl2772_invoke_change()
864 mutex_unlock(&chip->prox_mutex); in tsl2772_invoke_change()
865 mutex_unlock(&chip->als_mutex); in tsl2772_invoke_change()
876 if (chip->settings.prox_max_samples_cal < 1 || in tsl2772_prox_cal()
877 chip->settings.prox_max_samples_cal > MAX_SAMPLES_CAL) in tsl2772_prox_cal()
878 return -EINVAL; in tsl2772_prox_cal()
880 for (i = 0; i < chip->settings.prox_max_samples_cal; i++) { in tsl2772_prox_cal()
886 prox_history[i] = chip->prox_data; in tsl2772_prox_cal()
891 for (i = 0; i < chip->settings.prox_max_samples_cal; i++) { in tsl2772_prox_cal()
895 mean = sample_sum / chip->settings.prox_max_samples_cal; in tsl2772_prox_cal()
897 chip->settings.prox_thres_high = (max << 1) - mean; in tsl2772_prox_cal()
911 if (chan->type == IIO_INTENSITY) { in tsl2772_read_avail()
921 *length = ARRAY_SIZE(tsl2772_int_time_avail[chip->id]); in tsl2772_read_avail()
922 *vals = tsl2772_int_time_avail[chip->id]; in tsl2772_read_avail()
927 return -EINVAL; in tsl2772_read_avail()
936 return scnprintf(buf, PAGE_SIZE, "%d\n", chip->settings.als_cal_target); in in_illuminance0_target_input_show()
949 return -EINVAL; in in_illuminance0_target_input_store()
951 chip->settings.als_cal_target = value; in in_illuminance0_target_input_store()
968 return -EINVAL; in in_illuminance0_calibrate_store()
990 offset += scnprintf(buf + offset, PAGE_SIZE - offset, "%u,%u,", in in_illuminance0_lux_table_show()
991 chip->tsl2772_device_lux[i].ch0, in in_illuminance0_lux_table_show()
992 chip->tsl2772_device_lux[i].ch1); in in_illuminance0_lux_table_show()
993 if (chip->tsl2772_device_lux[i].ch0 == 0) { in in_illuminance0_lux_table_show()
998 offset--; in in_illuminance0_lux_table_show()
1004 offset += scnprintf(buf + offset, PAGE_SIZE - offset, "\n"); in in_illuminance0_lux_table_show()
1014 int value[ARRAY_SIZE(chip->tsl2772_device_lux) * 2 + 1]; in in_illuminance0_lux_table_store()
1027 n > ((ARRAY_SIZE(chip->tsl2772_device_lux) - 1) * 2)) in in_illuminance0_lux_table_store()
1028 return -EINVAL; in in_illuminance0_lux_table_store()
1030 if ((value[(n - 1)] | value[n]) != 0) in in_illuminance0_lux_table_store()
1031 return -EINVAL; in in_illuminance0_lux_table_store()
1033 if (chip->tsl2772_chip_status == TSL2772_CHIP_WORKING) { in in_illuminance0_lux_table_store()
1040 memset(chip->tsl2772_device_lux, 0, sizeof(chip->tsl2772_device_lux)); in in_illuminance0_lux_table_store()
1041 memcpy(chip->tsl2772_device_lux, &value[1], (value[0] * 4)); in in_illuminance0_lux_table_store()
1059 return -EINVAL; in in_proximity0_calibrate_store()
1079 if (chan->type == IIO_INTENSITY) in tsl2772_read_interrupt_config()
1080 return chip->settings.als_interrupt_en; in tsl2772_read_interrupt_config()
1082 return chip->settings.prox_interrupt_en; in tsl2772_read_interrupt_config()
1093 if (chan->type == IIO_INTENSITY) in tsl2772_write_interrupt_config()
1094 chip->settings.als_interrupt_en = val ? true : false; in tsl2772_write_interrupt_config()
1096 chip->settings.prox_interrupt_en = val ? true : false; in tsl2772_write_interrupt_config()
1109 int ret = -EINVAL, count, persistence; in tsl2772_write_event_value()
1114 if (chan->type == IIO_INTENSITY) { in tsl2772_write_event_value()
1117 chip->settings.als_thresh_high = val; in tsl2772_write_event_value()
1121 chip->settings.als_thresh_low = val; in tsl2772_write_event_value()
1130 chip->settings.prox_thres_high = val; in tsl2772_write_event_value()
1134 chip->settings.prox_thres_low = val; in tsl2772_write_event_value()
1143 if (chan->type == IIO_INTENSITY) in tsl2772_write_event_value()
1144 time = chip->settings.als_time; in tsl2772_write_event_value()
1146 time = chip->settings.prox_time; in tsl2772_write_event_value()
1148 count = 256 - time; in tsl2772_write_event_value()
1150 (count * tsl2772_int_time_avail[chip->id][3]); in tsl2772_write_event_value()
1152 if (chan->type == IIO_INTENSITY) { in tsl2772_write_event_value()
1157 chip->settings.als_persistence = persistence; in tsl2772_write_event_value()
1159 chip->settings.prox_persistence = persistence; in tsl2772_write_event_value()
1187 if (chan->type == IIO_INTENSITY) { in tsl2772_read_event_value()
1190 *val = chip->settings.als_thresh_high; in tsl2772_read_event_value()
1193 *val = chip->settings.als_thresh_low; in tsl2772_read_event_value()
1196 return -EINVAL; in tsl2772_read_event_value()
1201 *val = chip->settings.prox_thres_high; in tsl2772_read_event_value()
1204 *val = chip->settings.prox_thres_low; in tsl2772_read_event_value()
1207 return -EINVAL; in tsl2772_read_event_value()
1212 if (chan->type == IIO_INTENSITY) { in tsl2772_read_event_value()
1213 time = chip->settings.als_time; in tsl2772_read_event_value()
1214 persistence = chip->settings.als_persistence; in tsl2772_read_event_value()
1218 persistence = (persistence - 3) * 5; in tsl2772_read_event_value()
1220 time = chip->settings.prox_time; in tsl2772_read_event_value()
1221 persistence = chip->settings.prox_persistence; in tsl2772_read_event_value()
1224 filter_delay = persistence * (256 - time) * in tsl2772_read_event_value()
1225 tsl2772_int_time_avail[chip->id][3]; in tsl2772_read_event_value()
1231 return -EINVAL; in tsl2772_read_event_value()
1245 switch (chan->type) { in tsl2772_read_raw()
1248 *val = chip->als_cur_info.lux; in tsl2772_read_raw()
1251 return -EINVAL; in tsl2772_read_raw()
1254 switch (chan->type) { in tsl2772_read_raw()
1257 if (chan->channel == 0) in tsl2772_read_raw()
1258 *val = chip->als_cur_info.als_ch0; in tsl2772_read_raw()
1260 *val = chip->als_cur_info.als_ch1; in tsl2772_read_raw()
1264 *val = chip->prox_data; in tsl2772_read_raw()
1267 return -EINVAL; in tsl2772_read_raw()
1271 if (chan->type == IIO_LIGHT) in tsl2772_read_raw()
1272 *val = tsl2772_als_gain[chip->settings.als_gain]; in tsl2772_read_raw()
1274 *val = tsl2772_prox_gain[chip->settings.prox_gain]; in tsl2772_read_raw()
1277 *val = chip->settings.als_gain_trim; in tsl2772_read_raw()
1281 *val2 = (256 - chip->settings.als_time) * in tsl2772_read_raw()
1282 tsl2772_int_time_avail[chip->id][3]; in tsl2772_read_raw()
1285 return -EINVAL; in tsl2772_read_raw()
1299 if (chan->type == IIO_INTENSITY) { in tsl2772_write_raw()
1302 chip->settings.als_gain = 0; in tsl2772_write_raw()
1305 chip->settings.als_gain = 1; in tsl2772_write_raw()
1308 chip->settings.als_gain = 2; in tsl2772_write_raw()
1311 chip->settings.als_gain = 3; in tsl2772_write_raw()
1314 return -EINVAL; in tsl2772_write_raw()
1319 chip->settings.prox_gain = 0; in tsl2772_write_raw()
1322 chip->settings.prox_gain = 1; in tsl2772_write_raw()
1325 chip->settings.prox_gain = 2; in tsl2772_write_raw()
1328 chip->settings.prox_gain = 3; in tsl2772_write_raw()
1331 return -EINVAL; in tsl2772_write_raw()
1338 return -EINVAL; in tsl2772_write_raw()
1340 chip->settings.als_gain_trim = val; in tsl2772_write_raw()
1343 if (val != 0 || val2 < tsl2772_int_time_avail[chip->id][1] || in tsl2772_write_raw()
1344 val2 > tsl2772_int_time_avail[chip->id][5]) in tsl2772_write_raw()
1345 return -EINVAL; in tsl2772_write_raw()
1347 chip->settings.als_time = 256 - in tsl2772_write_raw()
1348 (val2 / tsl2772_int_time_avail[chip->id][3]); in tsl2772_write_raw()
1351 return -EINVAL; in tsl2772_write_raw()
1365 /* Use the default register values to identify the Taos device */
1385 return -EINVAL; in tsl2772_device_id_verif()
1418 ret = i2c_smbus_write_byte(chip->client, in tsl2772_event_handler()
1422 dev_err(&chip->client->dev, in tsl2772_event_handler()
1766 indio_dev = devm_iio_device_alloc(&clientp->dev, sizeof(*chip)); in tsl2772_probe()
1768 return -ENOMEM; in tsl2772_probe()
1771 chip->client = clientp; in tsl2772_probe()
1774 chip->supplies[TSL2772_SUPPLY_VDD].supply = "vdd"; in tsl2772_probe()
1775 chip->supplies[TSL2772_SUPPLY_VDDIO].supply = "vddio"; in tsl2772_probe()
1777 ret = devm_regulator_bulk_get(&clientp->dev, in tsl2772_probe()
1778 ARRAY_SIZE(chip->supplies), in tsl2772_probe()
1779 chip->supplies); in tsl2772_probe()
1781 return dev_err_probe(&clientp->dev, ret, "Failed to get regulators\n"); in tsl2772_probe()
1783 ret = regulator_bulk_enable(ARRAY_SIZE(chip->supplies), chip->supplies); in tsl2772_probe()
1785 dev_err(&clientp->dev, "Failed to enable regulators: %d\n", in tsl2772_probe()
1790 ret = devm_add_action_or_reset(&clientp->dev, in tsl2772_probe()
1794 dev_err(&clientp->dev, "Failed to setup regulator cleanup action %d\n", in tsl2772_probe()
1801 ret = i2c_smbus_read_byte_data(chip->client, in tsl2772_probe()
1806 if (tsl2772_device_id_verif(ret, id->driver_data) <= 0) { in tsl2772_probe()
1807 dev_info(&chip->client->dev, in tsl2772_probe()
1810 return -EINVAL; in tsl2772_probe()
1815 dev_err(&clientp->dev, in tsl2772_probe()
1821 mutex_init(&chip->als_mutex); in tsl2772_probe()
1822 mutex_init(&chip->prox_mutex); in tsl2772_probe()
1824 chip->tsl2772_chip_status = TSL2772_CHIP_UNKNOWN; in tsl2772_probe()
1825 chip->pdata = dev_get_platdata(&clientp->dev); in tsl2772_probe()
1826 chip->id = id->driver_data; in tsl2772_probe()
1827 chip->chip_info = in tsl2772_probe()
1828 &tsl2772_chip_info_tbl[device_channel_config[id->driver_data]]; in tsl2772_probe()
1830 indio_dev->info = chip->chip_info->info; in tsl2772_probe()
1831 indio_dev->modes = INDIO_DIRECT_MODE; in tsl2772_probe()
1832 indio_dev->name = chip->client->name; in tsl2772_probe()
1833 indio_dev->num_channels = chip->chip_info->chan_table_elements; in tsl2772_probe()
1835 if (clientp->irq) { in tsl2772_probe()
1836 indio_dev->channels = chip->chip_info->channel_with_events; in tsl2772_probe()
1838 ret = devm_request_threaded_irq(&clientp->dev, clientp->irq, in tsl2772_probe()
1846 dev_err(&clientp->dev, in tsl2772_probe()
1851 indio_dev->channels = chip->chip_info->channel_without_events; in tsl2772_probe()
1859 ret = devm_add_action_or_reset(&clientp->dev, in tsl2772_probe()
1865 return devm_iio_device_register(&clientp->dev, indio_dev); in tsl2772_probe()
1875 regulator_bulk_disable(ARRAY_SIZE(chip->supplies), chip->supplies); in tsl2772_suspend()
1886 ret = regulator_bulk_enable(ARRAY_SIZE(chip->supplies), chip->supplies); in tsl2772_resume()