Lines Matching +full:iovdd +full:- +full:supply
1 // SPDX-License-Identifier: GPL-2.0-only
6 * Copyright (c) 2008-2009 Jonathan Cameron <jic23@kernel.org>
60 #define KXSD9_CTRL_B_ST BIT(5) /* Self-test */
65 * struct kxsd9_state - device related storage
69 * @regs: regulators for this device, VDD and IOVDD
88 #define KXSD9_ZERO_G_OFFSET -2048
94 static const char kxsd9_reg_iovdd[] = "iovdd";
108 return -EINVAL; in kxsd9_write_scale()
110 ret = regmap_update_bits(st->map, in kxsd9_write_scale()
118 st->scale = i; in kxsd9_write_scale()
141 int ret = -EINVAL; in kxsd9_write_raw()
144 pm_runtime_get_sync(st->dev); in kxsd9_write_raw()
149 return -EINVAL; in kxsd9_write_raw()
153 pm_runtime_mark_last_busy(st->dev); in kxsd9_write_raw()
154 pm_runtime_put_autosuspend(st->dev); in kxsd9_write_raw()
163 int ret = -EINVAL; in kxsd9_read_raw()
169 pm_runtime_get_sync(st->dev); in kxsd9_read_raw()
173 ret = regmap_bulk_read(st->map, chan->address, &raw_val, in kxsd9_read_raw()
184 /* This has a bias of -2048 */ in kxsd9_read_raw()
189 ret = regmap_read(st->map, in kxsd9_read_raw()
201 pm_runtime_mark_last_busy(st->dev); in kxsd9_read_raw()
202 pm_runtime_put_autosuspend(st->dev); in kxsd9_read_raw()
210 struct iio_dev *indio_dev = pf->indio_dev; in kxsd9_trigger_handler()
222 ret = regmap_bulk_read(st->map, in kxsd9_trigger_handler()
227 dev_err(st->dev, "error reading data: %d\n", ret); in kxsd9_trigger_handler()
235 iio_trigger_notify_done(indio_dev->trig); in kxsd9_trigger_handler()
244 pm_runtime_get_sync(st->dev); in kxsd9_buffer_preenable()
253 pm_runtime_mark_last_busy(st->dev); in kxsd9_buffer_postdisable()
254 pm_runtime_put_autosuspend(st->dev); in kxsd9_buffer_postdisable()
270 return &st->orientation; in kxsd9_get_mount_matrix()
328 ret = regulator_bulk_enable(ARRAY_SIZE(st->regs), st->regs); in kxsd9_power_up()
330 dev_err(st->dev, "Cannot enable regulators\n"); in kxsd9_power_up()
335 ret = regmap_write(st->map, in kxsd9_power_up()
345 ret = regmap_write(st->map, in kxsd9_power_up()
350 st->scale); in kxsd9_power_up()
355 * Power-up time depends on the LPF setting, but typ 15.9 ms, let's in kxsd9_power_up()
368 * Set into low power mode - since there may be more users of the in kxsd9_power_down()
373 ret = regmap_clear_bits(st->map, KXSD9_REG_CTRL_B, KXSD9_CTRL_B_ENABLE); in kxsd9_power_down()
378 ret = regulator_bulk_disable(ARRAY_SIZE(st->regs), st->regs); in kxsd9_power_down()
380 dev_err(st->dev, "Cannot disable regulators\n"); in kxsd9_power_down()
406 return -ENOMEM; in kxsd9_common_probe()
409 st->dev = dev; in kxsd9_common_probe()
410 st->map = map; in kxsd9_common_probe()
412 indio_dev->channels = kxsd9_channels; in kxsd9_common_probe()
413 indio_dev->num_channels = ARRAY_SIZE(kxsd9_channels); in kxsd9_common_probe()
414 indio_dev->name = name; in kxsd9_common_probe()
415 indio_dev->info = &kxsd9_info; in kxsd9_common_probe()
416 indio_dev->modes = INDIO_DIRECT_MODE; in kxsd9_common_probe()
417 indio_dev->available_scan_masks = kxsd9_scan_masks; in kxsd9_common_probe()
420 ret = iio_read_mount_matrix(dev, &st->orientation); in kxsd9_common_probe()
425 st->regs[0].supply = kxsd9_reg_vdd; in kxsd9_common_probe()
426 st->regs[1].supply = kxsd9_reg_iovdd; in kxsd9_common_probe()
428 ARRAY_SIZE(st->regs), in kxsd9_common_probe()
429 st->regs); in kxsd9_common_probe()
435 st->scale = KXSD9_CTRL_C_FS_2G; in kxsd9_common_probe()
460 * start-up time. 20ms start-up time means 2000ms autosuspend, in kxsd9_common_probe()