Lines Matching full:client

50 	struct i2c_client *client;  member
64 static int __isl29003_read_reg(struct i2c_client *client, in __isl29003_read_reg() argument
67 struct isl29003_data *data = i2c_get_clientdata(client); in __isl29003_read_reg()
72 static int __isl29003_write_reg(struct i2c_client *client, in __isl29003_write_reg() argument
75 struct isl29003_data *data = i2c_get_clientdata(client); in __isl29003_write_reg()
88 ret = i2c_smbus_write_byte_data(client, reg, tmp); in __isl29003_write_reg()
101 static int isl29003_get_range(struct i2c_client *client) in isl29003_get_range() argument
103 return __isl29003_read_reg(client, ISL29003_REG_CONTROL, in isl29003_get_range()
107 static int isl29003_set_range(struct i2c_client *client, int range) in isl29003_set_range() argument
109 return __isl29003_write_reg(client, ISL29003_REG_CONTROL, in isl29003_set_range()
114 static int isl29003_get_resolution(struct i2c_client *client) in isl29003_get_resolution() argument
116 return __isl29003_read_reg(client, ISL29003_REG_COMMAND, in isl29003_get_resolution()
120 static int isl29003_set_resolution(struct i2c_client *client, int res) in isl29003_set_resolution() argument
122 return __isl29003_write_reg(client, ISL29003_REG_COMMAND, in isl29003_set_resolution()
127 static int isl29003_get_mode(struct i2c_client *client) in isl29003_get_mode() argument
129 return __isl29003_read_reg(client, ISL29003_REG_COMMAND, in isl29003_get_mode()
133 static int isl29003_set_mode(struct i2c_client *client, int mode) in isl29003_set_mode() argument
135 return __isl29003_write_reg(client, ISL29003_REG_COMMAND, in isl29003_set_mode()
140 static int isl29003_set_power_state(struct i2c_client *client, int state) in isl29003_set_power_state() argument
142 return __isl29003_write_reg(client, ISL29003_REG_COMMAND, in isl29003_set_power_state()
147 static int isl29003_get_power_state(struct i2c_client *client) in isl29003_get_power_state() argument
149 struct isl29003_data *data = i2c_get_clientdata(client); in isl29003_get_power_state()
155 static int isl29003_get_adc_value(struct i2c_client *client) in isl29003_get_adc_value() argument
157 struct isl29003_data *data = i2c_get_clientdata(client); in isl29003_get_adc_value()
161 lsb = i2c_smbus_read_byte_data(client, ISL29003_REG_LSB_SENSOR); in isl29003_get_adc_value()
168 msb = i2c_smbus_read_byte_data(client, ISL29003_REG_MSB_SENSOR); in isl29003_get_adc_value()
174 range = isl29003_get_range(client); in isl29003_get_adc_value()
175 bitdepth = (4 - isl29003_get_resolution(client)) * 4; in isl29003_get_adc_value()
187 struct i2c_client *client = to_i2c_client(dev); in isl29003_show_range() local
189 return sysfs_emit(buf, "%i\n", isl29003_get_range(client)); in isl29003_show_range()
196 struct i2c_client *client = to_i2c_client(dev); in isl29003_store_range() local
207 ret = isl29003_set_range(client, val); in isl29003_store_range()
223 struct i2c_client *client = to_i2c_client(dev); in isl29003_show_resolution() local
225 return sysfs_emit(buf, "%d\n", isl29003_get_resolution(client)); in isl29003_show_resolution()
232 struct i2c_client *client = to_i2c_client(dev); in isl29003_store_resolution() local
243 ret = isl29003_set_resolution(client, val); in isl29003_store_resolution()
257 struct i2c_client *client = to_i2c_client(dev); in isl29003_show_mode() local
259 return sysfs_emit(buf, "%d\n", isl29003_get_mode(client)); in isl29003_show_mode()
265 struct i2c_client *client = to_i2c_client(dev); in isl29003_store_mode() local
276 ret = isl29003_set_mode(client, val); in isl29003_store_mode()
292 struct i2c_client *client = to_i2c_client(dev); in isl29003_show_power_state() local
294 return sysfs_emit(buf, "%d\n", isl29003_get_power_state(client)); in isl29003_show_power_state()
301 struct i2c_client *client = to_i2c_client(dev); in isl29003_store_power_state() local
312 ret = isl29003_set_power_state(client, val); in isl29003_store_power_state()
324 struct i2c_client *client = to_i2c_client(dev); in isl29003_show_lux() local
327 if (!isl29003_get_power_state(client)) in isl29003_show_lux()
330 return sysfs_emit(buf, "%d\n", isl29003_get_adc_value(client)); in isl29003_show_lux()
348 static int isl29003_init_client(struct i2c_client *client) in isl29003_init_client() argument
350 struct isl29003_data *data = i2c_get_clientdata(client); in isl29003_init_client()
356 int v = i2c_smbus_read_byte_data(client, i); in isl29003_init_client()
365 isl29003_set_range(client, 0); in isl29003_init_client()
366 isl29003_set_resolution(client, 0); in isl29003_init_client()
367 isl29003_set_mode(client, 0); in isl29003_init_client()
368 isl29003_set_power_state(client, 0); in isl29003_init_client()
377 static int isl29003_probe(struct i2c_client *client) in isl29003_probe() argument
379 struct i2c_adapter *adapter = client->adapter; in isl29003_probe()
390 data->client = client; in isl29003_probe()
391 i2c_set_clientdata(client, data); in isl29003_probe()
395 err = isl29003_init_client(client); in isl29003_probe()
400 err = sysfs_create_group(&client->dev.kobj, &isl29003_attr_group); in isl29003_probe()
404 dev_info(&client->dev, "driver version %s enabled\n", DRIVER_VERSION); in isl29003_probe()
412 static void isl29003_remove(struct i2c_client *client) in isl29003_remove() argument
414 sysfs_remove_group(&client->dev.kobj, &isl29003_attr_group); in isl29003_remove()
415 isl29003_set_power_state(client, 0); in isl29003_remove()
416 kfree(i2c_get_clientdata(client)); in isl29003_remove()
422 struct i2c_client *client = to_i2c_client(dev); in isl29003_suspend() local
423 struct isl29003_data *data = i2c_get_clientdata(client); in isl29003_suspend()
425 data->power_state_before_suspend = isl29003_get_power_state(client); in isl29003_suspend()
426 return isl29003_set_power_state(client, 0); in isl29003_suspend()
432 struct i2c_client *client = to_i2c_client(dev); in isl29003_resume() local
433 struct isl29003_data *data = i2c_get_clientdata(client); in isl29003_resume()
437 if (i2c_smbus_write_byte_data(client, i, data->reg_cache[i])) in isl29003_resume()
440 return isl29003_set_power_state(client, in isl29003_resume()