Lines Matching +full:- +full:31000
1 // SPDX-License-Identifier: GPL-2.0-only
43 /* als range 31000, ps, als disabled */
59 /* available scales: corresponding to [500, 4000, 7000, 31000] lux */
133 ret = regmap_update_bits(data->map, PA12203001_REG_CFG0, in pa12203001_als_enable()
138 data->als_enabled = !!enable; in pa12203001_als_enable()
147 ret = regmap_update_bits(data->map, PA12203001_REG_CFG0, in pa12203001_px_enable()
152 data->px_enabled = !!enable; in pa12203001_px_enable()
164 mutex_lock(&data->lock); in pa12203001_set_power_state()
165 if (data->px_enabled) { in pa12203001_set_power_state()
171 data->als_needs_enable = true; in pa12203001_set_power_state()
173 mutex_unlock(&data->lock); in pa12203001_set_power_state()
177 mutex_lock(&data->lock); in pa12203001_set_power_state()
178 if (data->als_enabled) { in pa12203001_set_power_state()
183 data->px_needs_enable = true; in pa12203001_set_power_state()
185 mutex_unlock(&data->lock); in pa12203001_set_power_state()
189 ret = pm_runtime_resume_and_get(&data->client->dev); in pa12203001_set_power_state()
192 pm_runtime_mark_last_busy(&data->client->dev); in pa12203001_set_power_state()
193 ret = pm_runtime_put_autosuspend(&data->client->dev); in pa12203001_set_power_state()
199 mutex_unlock(&data->lock); in pa12203001_set_power_state()
218 switch (chan->type) { in pa12203001_read_raw()
228 ret = regmap_bulk_read(data->map, PA12203001_REG_ADL, in pa12203001_read_raw()
243 ret = regmap_read(data->map, PA12203001_REG_PDH, in pa12203001_read_raw()
254 return -EINVAL; in pa12203001_read_raw()
258 ret = regmap_read(data->map, PA12203001_REG_CFG0, ®_byte); in pa12203001_read_raw()
266 return -EINVAL; in pa12203001_read_raw()
284 ret = regmap_read(data->map, PA12203001_REG_CFG0, ®_byte); in pa12203001_write_raw()
286 return -EINVAL; in pa12203001_write_raw()
290 return regmap_update_bits(data->map, in pa12203001_write_raw()
301 return -EINVAL; in pa12203001_write_raw()
316 ret = regmap_write(data->map, regvals[i].reg, regvals[i].val); in pa12203001_init()
329 mutex_lock(&data->lock); in pa12203001_power_chip()
337 mutex_unlock(&data->lock); in pa12203001_power_chip()
347 indio_dev = devm_iio_device_alloc(&client->dev, in pa12203001_probe()
350 return -ENOMEM; in pa12203001_probe()
354 data->client = client; in pa12203001_probe()
356 data->map = devm_regmap_init_i2c(client, &pa12203001_regmap_config); in pa12203001_probe()
357 if (IS_ERR(data->map)) in pa12203001_probe()
358 return PTR_ERR(data->map); in pa12203001_probe()
360 mutex_init(&data->lock); in pa12203001_probe()
362 indio_dev->info = &pa12203001_info; in pa12203001_probe()
363 indio_dev->name = PA12203001_DRIVER_NAME; in pa12203001_probe()
364 indio_dev->channels = pa12203001_channels; in pa12203001_probe()
365 indio_dev->num_channels = ARRAY_SIZE(pa12203001_channels); in pa12203001_probe()
366 indio_dev->modes = INDIO_DIRECT_MODE; in pa12203001_probe()
376 ret = pm_runtime_set_active(&client->dev); in pa12203001_probe()
380 pm_runtime_enable(&client->dev); in pa12203001_probe()
381 pm_runtime_set_autosuspend_delay(&client->dev, in pa12203001_probe()
383 pm_runtime_use_autosuspend(&client->dev); in pa12203001_probe()
403 pm_runtime_disable(&client->dev); in pa12203001_remove()
404 pm_runtime_set_suspended(&client->dev); in pa12203001_remove()
408 dev_warn(&client->dev, "Failed to power down (%pe)\n", in pa12203001_remove()
437 mutex_lock(&data->lock); in pa12203001_runtime_resume()
438 if (data->als_needs_enable) { in pa12203001_runtime_resume()
440 data->als_needs_enable = false; in pa12203001_runtime_resume()
442 if (data->px_needs_enable) { in pa12203001_runtime_resume()
444 data->px_needs_enable = false; in pa12203001_runtime_resume()
446 mutex_unlock(&data->lock); in pa12203001_runtime_resume()