Lines Matching +full:autosuspend +full:- +full:delay +full:- +full:ms
1 // SPDX-License-Identifier: GPL-2.0-only
14 #include <linux/delay.h>
34 /* power on settling time in ms */
36 /* max time before value available in ms */
45 int ret = i2c_smbus_write_byte_data(bh1780->client, in bh1780_write()
49 dev_err(&bh1780->client->dev, in bh1780_write()
58 int ret = i2c_smbus_read_byte_data(bh1780->client, in bh1780_read()
61 dev_err(&bh1780->client->dev, in bh1780_read()
70 int ret = i2c_smbus_read_word_data(bh1780->client, in bh1780_read_word()
73 dev_err(&bh1780->client->dev, in bh1780_read_word()
108 switch (chan->type) { in bh1780_read_raw()
110 pm_runtime_get_sync(&bh1780->client->dev); in bh1780_read_raw()
114 pm_runtime_mark_last_busy(&bh1780->client->dev); in bh1780_read_raw()
115 pm_runtime_put_autosuspend(&bh1780->client->dev); in bh1780_read_raw()
120 return -EINVAL; in bh1780_read_raw()
127 return -EINVAL; in bh1780_read_raw()
149 struct i2c_adapter *adapter = client->adapter; in bh1780_probe()
153 return -EIO; in bh1780_probe()
155 indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*bh1780)); in bh1780_probe()
157 return -ENOMEM; in bh1780_probe()
160 bh1780->client = client; in bh1780_probe()
168 pm_runtime_get_noresume(&client->dev); in bh1780_probe()
169 pm_runtime_set_active(&client->dev); in bh1780_probe()
170 pm_runtime_enable(&client->dev); in bh1780_probe()
175 dev_info(&client->dev, in bh1780_probe()
180 * As the device takes 250 ms to even come up with a fresh in bh1780_probe()
181 * measurement after power-on, do not shut it down unnecessarily. in bh1780_probe()
182 * Set autosuspend to a five seconds. in bh1780_probe()
184 pm_runtime_set_autosuspend_delay(&client->dev, 5000); in bh1780_probe()
185 pm_runtime_use_autosuspend(&client->dev); in bh1780_probe()
186 pm_runtime_put(&client->dev); in bh1780_probe()
188 indio_dev->info = &bh1780_info; in bh1780_probe()
189 indio_dev->name = "bh1780"; in bh1780_probe()
190 indio_dev->channels = bh1780_channels; in bh1780_probe()
191 indio_dev->num_channels = ARRAY_SIZE(bh1780_channels); in bh1780_probe()
192 indio_dev->modes = INDIO_DIRECT_MODE; in bh1780_probe()
200 pm_runtime_put_noidle(&client->dev); in bh1780_probe()
201 pm_runtime_disable(&client->dev); in bh1780_probe()
212 pm_runtime_get_sync(&client->dev); in bh1780_remove()
213 pm_runtime_put_noidle(&client->dev); in bh1780_remove()
214 pm_runtime_disable(&client->dev); in bh1780_remove()
217 dev_err(&client->dev, "failed to power off (%pe)\n", in bh1780_remove()