Lines Matching +full:autosuspend +full:- +full:delay

1 // SPDX-License-Identifier: GPL-2.0-only
14 #include <linux/delay.h>
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()
148 struct i2c_adapter *adapter = client->adapter; in bh1780_probe()
152 return -EIO; in bh1780_probe()
154 indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*bh1780)); in bh1780_probe()
156 return -ENOMEM; in bh1780_probe()
159 bh1780->client = client; in bh1780_probe()
167 pm_runtime_get_noresume(&client->dev); in bh1780_probe()
168 pm_runtime_set_active(&client->dev); in bh1780_probe()
169 pm_runtime_enable(&client->dev); in bh1780_probe()
174 dev_info(&client->dev, in bh1780_probe()
180 * measurement after power-on, do not shut it down unnecessarily. in bh1780_probe()
181 * Set autosuspend to a five seconds. in bh1780_probe()
183 pm_runtime_set_autosuspend_delay(&client->dev, 5000); in bh1780_probe()
184 pm_runtime_use_autosuspend(&client->dev); in bh1780_probe()
185 pm_runtime_put(&client->dev); in bh1780_probe()
187 indio_dev->info = &bh1780_info; in bh1780_probe()
188 indio_dev->name = "bh1780"; in bh1780_probe()
189 indio_dev->channels = bh1780_channels; in bh1780_probe()
190 indio_dev->num_channels = ARRAY_SIZE(bh1780_channels); in bh1780_probe()
191 indio_dev->modes = INDIO_DIRECT_MODE; in bh1780_probe()
199 pm_runtime_put_noidle(&client->dev); in bh1780_probe()
200 pm_runtime_disable(&client->dev); in bh1780_probe()
211 pm_runtime_get_sync(&client->dev); in bh1780_remove()
212 pm_runtime_put_noidle(&client->dev); in bh1780_remove()
213 pm_runtime_disable(&client->dev); in bh1780_remove()
216 dev_err(&client->dev, "failed to power off (%pe)\n", in bh1780_remove()