Lines Matching refs:client
100 struct i2c_client *client; member
107 struct i2c_client *client; member
120 static int adp8860_read(struct i2c_client *client, int reg, uint8_t *val) in adp8860_read() argument
124 ret = i2c_smbus_read_byte_data(client, reg); in adp8860_read()
126 dev_err(&client->dev, "failed reading at 0x%02x\n", reg); in adp8860_read()
134 static int adp8860_write(struct i2c_client *client, u8 reg, u8 val) in adp8860_write() argument
136 return i2c_smbus_write_byte_data(client, reg, val); in adp8860_write()
139 static int adp8860_set_bits(struct i2c_client *client, int reg, uint8_t bit_mask) in adp8860_set_bits() argument
141 struct adp8860_bl *data = i2c_get_clientdata(client); in adp8860_set_bits()
147 ret = adp8860_read(client, reg, ®_val); in adp8860_set_bits()
151 ret = adp8860_write(client, reg, reg_val); in adp8860_set_bits()
158 static int adp8860_clr_bits(struct i2c_client *client, int reg, uint8_t bit_mask) in adp8860_clr_bits() argument
160 struct adp8860_bl *data = i2c_get_clientdata(client); in adp8860_clr_bits()
166 ret = adp8860_read(client, reg, ®_val); in adp8860_clr_bits()
170 ret = adp8860_write(client, reg, reg_val); in adp8860_clr_bits()
185 adp8860_write(led->client, ADP8860_ISC1 - led->id + 1, in adp8860_led_work()
201 struct i2c_client *client = led->client; in adp8860_led_setup() local
204 ret = adp8860_write(client, ADP8860_ISC1 - led->id + 1, 0); in adp8860_led_setup()
205 ret |= adp8860_set_bits(client, ADP8860_ISCC, 1 << (led->id - 1)); in adp8860_led_setup()
208 ret |= adp8860_set_bits(client, ADP8860_ISCT1, in adp8860_led_setup()
211 ret |= adp8860_set_bits(client, ADP8860_ISCT2, in adp8860_led_setup()
217 static int adp8860_led_probe(struct i2c_client *client) in adp8860_led_probe() argument
220 dev_get_platdata(&client->dev); in adp8860_led_probe()
221 struct adp8860_bl *data = i2c_get_clientdata(client); in adp8860_led_probe()
226 led = devm_kzalloc(&client->dev, sizeof(*led) * pdata->num_leds, in adp8860_led_probe()
231 ret = adp8860_write(client, ADP8860_ISCFR, pdata->led_fade_law); in adp8860_led_probe()
232 ret = adp8860_write(client, ADP8860_ISCT1, in adp8860_led_probe()
234 ret |= adp8860_write(client, ADP8860_ISCF, in adp8860_led_probe()
238 dev_err(&client->dev, "failed to write\n"); in adp8860_led_probe()
249 dev_err(&client->dev, "Invalid LED ID %d\n", in adp8860_led_probe()
256 dev_err(&client->dev, "LED %d used by Backlight\n", in adp8860_led_probe()
267 led_dat->client = client; in adp8860_led_probe()
271 ret = led_classdev_register(&client->dev, &led_dat->cdev); in adp8860_led_probe()
273 dev_err(&client->dev, "failed to register LED %d\n", in adp8860_led_probe()
280 dev_err(&client->dev, "failed to write\n"); in adp8860_led_probe()
299 static int adp8860_led_remove(struct i2c_client *client) in adp8860_led_remove() argument
302 dev_get_platdata(&client->dev); in adp8860_led_remove()
303 struct adp8860_bl *data = i2c_get_clientdata(client); in adp8860_led_remove()
314 static int adp8860_led_probe(struct i2c_client *client) in adp8860_led_probe() argument
319 static int adp8860_led_remove(struct i2c_client *client) in adp8860_led_remove() argument
328 struct i2c_client *client = data->client; in adp8860_bl_set() local
334 ret |= adp8860_clr_bits(client, ADP8860_MDCR, in adp8860_bl_set()
336 ret |= adp8860_write(client, ADP8860_BLMX1, brightness); in adp8860_bl_set()
342 ret |= adp8860_write(client, ADP8860_BLMX1, in adp8860_bl_set()
344 ret |= adp8860_set_bits(client, ADP8860_MDCR, in adp8860_bl_set()
348 ret |= adp8860_write(client, ADP8860_BLMX1, brightness); in adp8860_bl_set()
351 ret |= adp8860_set_bits(client, in adp8860_bl_set()
354 ret |= adp8860_clr_bits(client, in adp8860_bl_set()
391 struct i2c_client *client = data->client; in adp8860_bl_setup() local
395 ret |= adp8860_write(client, ADP8860_BLSEN, ~pdata->bl_led_assign); in adp8860_bl_setup()
396 ret |= adp8860_write(client, ADP8860_BLMX1, pdata->l1_daylight_max); in adp8860_bl_setup()
397 ret |= adp8860_write(client, ADP8860_BLDM1, pdata->l1_daylight_dim); in adp8860_bl_setup()
401 ret |= adp8860_write(client, ADP8860_BLMX2, in adp8860_bl_setup()
403 ret |= adp8860_write(client, ADP8860_BLDM2, in adp8860_bl_setup()
405 ret |= adp8860_write(client, ADP8860_BLMX3, in adp8860_bl_setup()
407 ret |= adp8860_write(client, ADP8860_BLDM3, in adp8860_bl_setup()
410 ret |= adp8860_write(client, ADP8860_L2_TRP, pdata->l2_trip); in adp8860_bl_setup()
411 ret |= adp8860_write(client, ADP8860_L2_HYS, pdata->l2_hyst); in adp8860_bl_setup()
412 ret |= adp8860_write(client, ADP8860_L3_TRP, pdata->l3_trip); in adp8860_bl_setup()
413 ret |= adp8860_write(client, ADP8860_L3_HYS, pdata->l3_hyst); in adp8860_bl_setup()
414 ret |= adp8860_write(client, ADP8860_CCFG, L2_EN | L3_EN | in adp8860_bl_setup()
418 ret |= adp8860_write(client, ADP8860_CFGR, in adp8860_bl_setup()
421 ret |= adp8860_write(client, ADP8860_BLFR, FADE_VAL(pdata->bl_fade_in, in adp8860_bl_setup()
424 ret |= adp8860_set_bits(client, ADP8860_MDCR, BLEN | DIM_EN | NSTBY | in adp8860_bl_setup()
437 error = adp8860_read(data->client, reg, ®_val); in adp8860_show()
458 adp8860_write(data->client, reg, val); in adp8860_store()
568 error = adp8860_read(data->client, ADP8860_PH1LEVL, ®_val); in adp8860_bl_ambient_light_level_show()
570 error |= adp8860_read(data->client, ADP8860_PH1LEVH, ®_val); in adp8860_bl_ambient_light_level_show()
592 error = adp8860_read(data->client, ADP8860_CFGR, ®_val); in adp8860_bl_ambient_light_zone_show()
617 adp8860_set_bits(data->client, ADP8860_MDCR, CMP_AUTOEN); in adp8860_bl_ambient_light_zone_store()
620 adp8860_clr_bits(data->client, ADP8860_MDCR, CMP_AUTOEN); in adp8860_bl_ambient_light_zone_store()
624 adp8860_read(data->client, ADP8860_CFGR, ®_val); in adp8860_bl_ambient_light_zone_store()
627 adp8860_write(data->client, ADP8860_CFGR, reg_val); in adp8860_bl_ambient_light_zone_store()
656 static int adp8860_probe(struct i2c_client *client, in adp8860_probe() argument
662 dev_get_platdata(&client->dev); in adp8860_probe()
667 if (!i2c_check_functionality(client->adapter, in adp8860_probe()
669 dev_err(&client->dev, "SMBUS Byte Data not Supported\n"); in adp8860_probe()
674 dev_err(&client->dev, "no platform data?\n"); in adp8860_probe()
678 data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); in adp8860_probe()
682 ret = adp8860_read(client, ADP8860_MFDVID, ®_val); in adp8860_probe()
696 dev_err(&client->dev, "failed to probe\n"); in adp8860_probe()
703 data->client = client; in adp8860_probe()
707 i2c_set_clientdata(client, data); in adp8860_probe()
715 bl = devm_backlight_device_register(&client->dev, in adp8860_probe()
716 dev_driver_string(&client->dev), in adp8860_probe()
717 &client->dev, data, &adp8860_bl_ops, &props); in adp8860_probe()
719 dev_err(&client->dev, "failed to register backlight\n"); in adp8860_probe()
732 dev_err(&client->dev, "failed to register sysfs\n"); in adp8860_probe()
744 dev_info(&client->dev, "%s Rev.%d Backlight\n", in adp8860_probe()
745 client->name, data->revid); in adp8860_probe()
748 adp8860_led_probe(client); in adp8860_probe()
760 static int adp8860_remove(struct i2c_client *client) in adp8860_remove() argument
762 struct adp8860_bl *data = i2c_get_clientdata(client); in adp8860_remove()
764 adp8860_clr_bits(client, ADP8860_MDCR, NSTBY); in adp8860_remove()
767 adp8860_led_remove(client); in adp8860_remove()
779 struct i2c_client *client = to_i2c_client(dev); in adp8860_i2c_suspend() local
781 adp8860_clr_bits(client, ADP8860_MDCR, NSTBY); in adp8860_i2c_suspend()
788 struct i2c_client *client = to_i2c_client(dev); in adp8860_i2c_resume() local
790 adp8860_set_bits(client, ADP8860_MDCR, NSTBY | BLEN); in adp8860_i2c_resume()