Lines Matching +full:i2c +full:- +full:retry +full:- +full:count

1 // SPDX-License-Identifier: GPL-2.0-only
3 * apds9802als.c - apds9802 ALS Driver
14 #include <linux/i2c.h>
51 int retry = 10; in als_wait_for_data_ready() local
56 } while (!(ret & 0x80) && retry--); in als_wait_for_data_ready()
58 if (retry < 0) { in als_wait_for_data_ready()
60 return -ETIMEDOUT; in als_wait_for_data_ready()
76 mutex_lock(&data->mutex); in als_lux0_input_data_show()
97 mutex_unlock(&data->mutex); in als_lux0_input_data_show()
103 mutex_unlock(&data->mutex); in als_lux0_input_data_show()
109 struct device_attribute *attr, const char *buf, size_t count) in als_sensing_range_store() argument
125 return -ERANGE; in als_sensing_range_store()
131 mutex_lock(&data->mutex); in als_sensing_range_store()
149 mutex_unlock(&data->mutex); in als_sensing_range_store()
151 return count; in als_sensing_range_store()
154 mutex_unlock(&data->mutex); in als_sensing_range_store()
164 mutex_lock(&data->mutex); in als_set_power_state()
174 mutex_unlock(&data->mutex); in als_set_power_state()
199 dev_err(&client->dev, "failed default switch on write\n"); in als_set_default_config()
205 dev_err(&client->dev, "failed default LUX on write\n"); in als_set_default_config()
210 als_wait_for_data_ready(&client->dev); in als_set_default_config()
223 dev_err(&client->dev, "Memory allocation failed\n"); in apds9802als_probe()
224 return -ENOMEM; in apds9802als_probe()
227 res = sysfs_create_group(&client->dev.kobj, &m_als_gr); in apds9802als_probe()
229 dev_err(&client->dev, "device create file failed\n"); in apds9802als_probe()
232 dev_info(&client->dev, "ALS chip found\n"); in apds9802als_probe()
234 mutex_init(&data->mutex); in apds9802als_probe()
236 pm_runtime_set_active(&client->dev); in apds9802als_probe()
237 pm_runtime_enable(&client->dev); in apds9802als_probe()
249 pm_runtime_get_sync(&client->dev); in apds9802als_remove()
252 sysfs_remove_group(&client->dev.kobj, &m_als_gr); in apds9802als_remove()
254 pm_runtime_disable(&client->dev); in apds9802als_remove()
255 pm_runtime_set_suspended(&client->dev); in apds9802als_remove()
256 pm_runtime_put_noidle(&client->dev); in apds9802als_remove()
294 MODULE_DEVICE_TABLE(i2c, apds9802als_id);