25 #include <linux/module.h>
27 #include <linux/slab.h>
28 #include <linux/i2c.h>
46 return sprintf(buf,
"%d000\n", 1 << (2 * (val & 3)));
55 unsigned long int lux;
58 pm_runtime_get_sync(dev);
64 pm_runtime_put_sync(dev);
73 pm_runtime_put_sync(dev);
79 pm_runtime_put_sync(dev);
82 lux = ((((1 << (2 * (val & 3))))*1000) * ret_val) / 65536;
83 return sprintf(buf,
"%ld\n", lux);
95 if (val < 1 || val > 64000)
101 else if (val <= 4000)
103 else if (val <= 16000)
138 als_sensing_range_show, als_sensing_range_store);
141 static struct attribute *mid_att_als[] = {
142 &dev_attr_lux0_sensor_range.attr,
143 &dev_attr_lux0_input.attr,
152 static int als_set_default_config(
struct i2c_client *client)
158 dev_err(&client->
dev,
"default write failed.");
164 static int isl29020_probe(
struct i2c_client *client,
169 res = als_set_default_config(client);
175 dev_err(&client->
dev,
"isl29020: device create file failed\n");
179 als_set_power_state(client, 0);
184 static int isl29020_remove(
struct i2c_client *client)
199 static int isl29020_runtime_suspend(
struct device *dev)
202 als_set_power_state(client, 0);
206 static int isl29020_runtime_resume(
struct device *dev)
209 als_set_power_state(client, 1);
213 static const struct dev_pm_ops isl29020_pm_ops = {
215 .runtime_resume = isl29020_runtime_resume,
218 #define ISL29020_PM_OPS (&isl29020_pm_ops)
220 #define ISL29020_PM_OPS NULL
228 .probe = isl29020_probe,
229 .remove = isl29020_remove,
230 .id_table = isl29020_id,