Lines Matching refs:client
109 struct i2c_client *client; member
123 struct i2c_client *client; member
129 static int adp8870_read(struct i2c_client *client, int reg, uint8_t *val) in adp8870_read() argument
133 ret = i2c_smbus_read_byte_data(client, reg); in adp8870_read()
135 dev_err(&client->dev, "failed reading at 0x%02x\n", reg); in adp8870_read()
144 static int adp8870_write(struct i2c_client *client, u8 reg, u8 val) in adp8870_write() argument
146 int ret = i2c_smbus_write_byte_data(client, reg, val); in adp8870_write()
149 dev_err(&client->dev, "failed to write\n"); in adp8870_write()
154 static int adp8870_set_bits(struct i2c_client *client, int reg, uint8_t bit_mask) in adp8870_set_bits() argument
156 struct adp8870_bl *data = i2c_get_clientdata(client); in adp8870_set_bits()
162 ret = adp8870_read(client, reg, ®_val); in adp8870_set_bits()
166 ret = adp8870_write(client, reg, reg_val); in adp8870_set_bits()
173 static int adp8870_clr_bits(struct i2c_client *client, int reg, uint8_t bit_mask) in adp8870_clr_bits() argument
175 struct adp8870_bl *data = i2c_get_clientdata(client); in adp8870_clr_bits()
181 ret = adp8870_read(client, reg, ®_val); in adp8870_clr_bits()
185 ret = adp8870_write(client, reg, reg_val); in adp8870_clr_bits()
200 adp8870_write(led->client, ADP8870_ISC1 + led->id - 1, in adp8870_led_work()
219 struct i2c_client *client = led->client; in adp8870_led_setup() local
222 ret = adp8870_write(client, ADP8870_ISC1 + led->id - 1, 0); in adp8870_led_setup()
226 ret = adp8870_set_bits(client, ADP8870_ISCC, 1 << (led->id - 1)); in adp8870_led_setup()
231 ret = adp8870_set_bits(client, ADP8870_ISCT1, in adp8870_led_setup()
234 ret = adp8870_set_bits(client, ADP8870_ISCT2, in adp8870_led_setup()
240 static int adp8870_led_probe(struct i2c_client *client) in adp8870_led_probe() argument
243 dev_get_platdata(&client->dev); in adp8870_led_probe()
244 struct adp8870_bl *data = i2c_get_clientdata(client); in adp8870_led_probe()
249 led = devm_kzalloc(&client->dev, pdata->num_leds * sizeof(*led), in adp8870_led_probe()
254 ret = adp8870_write(client, ADP8870_ISCLAW, pdata->led_fade_law); in adp8870_led_probe()
258 ret = adp8870_write(client, ADP8870_ISCT1, in adp8870_led_probe()
263 ret = adp8870_write(client, ADP8870_ISCF, in adp8870_led_probe()
275 dev_err(&client->dev, "Invalid LED ID %d\n", in adp8870_led_probe()
282 dev_err(&client->dev, "LED %d used by Backlight\n", in adp8870_led_probe()
293 led_dat->client = client; in adp8870_led_probe()
297 ret = led_classdev_register(&client->dev, &led_dat->cdev); in adp8870_led_probe()
299 dev_err(&client->dev, "failed to register LED %d\n", in adp8870_led_probe()
306 dev_err(&client->dev, "failed to write\n"); in adp8870_led_probe()
325 static int adp8870_led_remove(struct i2c_client *client) in adp8870_led_remove() argument
328 dev_get_platdata(&client->dev); in adp8870_led_remove()
329 struct adp8870_bl *data = i2c_get_clientdata(client); in adp8870_led_remove()
340 static int adp8870_led_probe(struct i2c_client *client) in adp8870_led_probe() argument
345 static int adp8870_led_remove(struct i2c_client *client) in adp8870_led_remove() argument
354 struct i2c_client *client = data->client; in adp8870_bl_set() local
360 ret = adp8870_clr_bits(client, ADP8870_MDCR, in adp8870_bl_set()
364 ret = adp8870_write(client, ADP8870_BLMX1, brightness); in adp8870_bl_set()
372 ret = adp8870_write(client, ADP8870_BLMX1, in adp8870_bl_set()
377 ret = adp8870_set_bits(client, ADP8870_MDCR, in adp8870_bl_set()
383 ret = adp8870_write(client, ADP8870_BLMX1, brightness); in adp8870_bl_set()
389 ret = adp8870_set_bits(client, in adp8870_bl_set()
392 ret = adp8870_clr_bits(client, in adp8870_bl_set()
429 struct i2c_client *client = data->client; in adp8870_bl_setup() local
433 ret = adp8870_write(client, ADP8870_BLSEL, ~pdata->bl_led_assign); in adp8870_bl_setup()
437 ret = adp8870_write(client, ADP8870_PWMLED, pdata->pwm_assign); in adp8870_bl_setup()
441 ret = adp8870_write(client, ADP8870_BLMX1, pdata->l1_daylight_max); in adp8870_bl_setup()
445 ret = adp8870_write(client, ADP8870_BLDM1, pdata->l1_daylight_dim); in adp8870_bl_setup()
451 ret = adp8870_write(client, ADP8870_BLMX2, in adp8870_bl_setup()
455 ret = adp8870_write(client, ADP8870_BLDM2, in adp8870_bl_setup()
460 ret = adp8870_write(client, ADP8870_BLMX3, in adp8870_bl_setup()
464 ret = adp8870_write(client, ADP8870_BLDM3, in adp8870_bl_setup()
469 ret = adp8870_write(client, ADP8870_BLMX4, in adp8870_bl_setup()
474 ret = adp8870_write(client, ADP8870_BLDM4, in adp8870_bl_setup()
479 ret = adp8870_write(client, ADP8870_BLMX5, in adp8870_bl_setup()
484 ret = adp8870_write(client, ADP8870_BLDM5, in adp8870_bl_setup()
489 ret = adp8870_write(client, ADP8870_L2TRP, pdata->l2_trip); in adp8870_bl_setup()
493 ret = adp8870_write(client, ADP8870_L2HYS, pdata->l2_hyst); in adp8870_bl_setup()
497 ret = adp8870_write(client, ADP8870_L3TRP, pdata->l3_trip); in adp8870_bl_setup()
501 ret = adp8870_write(client, ADP8870_L3HYS, pdata->l3_hyst); in adp8870_bl_setup()
505 ret = adp8870_write(client, ADP8870_L4TRP, pdata->l4_trip); in adp8870_bl_setup()
509 ret = adp8870_write(client, ADP8870_L4HYS, pdata->l4_hyst); in adp8870_bl_setup()
513 ret = adp8870_write(client, ADP8870_L5TRP, pdata->l5_trip); in adp8870_bl_setup()
517 ret = adp8870_write(client, ADP8870_L5HYS, pdata->l5_hyst); in adp8870_bl_setup()
521 ret = adp8870_write(client, ADP8870_ALS1_EN, L5_EN | L4_EN | in adp8870_bl_setup()
526 ret = adp8870_write(client, ADP8870_CMP_CTL, in adp8870_bl_setup()
532 ret = adp8870_write(client, ADP8870_CFGR, in adp8870_bl_setup()
537 ret = adp8870_write(client, ADP8870_BLFR, FADE_VAL(pdata->bl_fade_in, in adp8870_bl_setup()
545 ret = adp8870_set_bits(client, ADP8870_MDCR, BLEN | DIM_EN | NSTBY | in adp8870_bl_setup()
558 error = adp8870_read(data->client, reg, ®_val); in adp8870_show()
579 adp8870_write(data->client, reg, val); in adp8870_store()
750 error = adp8870_read(data->client, ADP8870_PH1LEVL, ®_val); in adp8870_bl_ambient_light_level_show()
756 error = adp8870_read(data->client, ADP8870_PH1LEVH, ®_val); in adp8870_bl_ambient_light_level_show()
778 error = adp8870_read(data->client, ADP8870_CFGR, ®_val); in adp8870_bl_ambient_light_zone_show()
803 adp8870_set_bits(data->client, ADP8870_MDCR, CMP_AUTOEN); in adp8870_bl_ambient_light_zone_store()
806 adp8870_clr_bits(data->client, ADP8870_MDCR, CMP_AUTOEN); in adp8870_bl_ambient_light_zone_store()
810 adp8870_read(data->client, ADP8870_CFGR, ®_val); in adp8870_bl_ambient_light_zone_store()
813 adp8870_write(data->client, ADP8870_CFGR, reg_val); in adp8870_bl_ambient_light_zone_store()
846 static int adp8870_probe(struct i2c_client *client, in adp8870_probe() argument
853 dev_get_platdata(&client->dev); in adp8870_probe()
857 if (!i2c_check_functionality(client->adapter, in adp8870_probe()
859 dev_err(&client->dev, "SMBUS Byte Data not Supported\n"); in adp8870_probe()
864 dev_err(&client->dev, "no platform data?\n"); in adp8870_probe()
868 ret = adp8870_read(client, ADP8870_MFDVID, ®_val); in adp8870_probe()
873 dev_err(&client->dev, "failed to probe\n"); in adp8870_probe()
877 data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); in adp8870_probe()
882 data->client = client; in adp8870_probe()
886 i2c_set_clientdata(client, data); in adp8870_probe()
893 bl = devm_backlight_device_register(&client->dev, in adp8870_probe()
894 dev_driver_string(&client->dev), in adp8870_probe()
895 &client->dev, data, &adp8870_bl_ops, &props); in adp8870_probe()
897 dev_err(&client->dev, "failed to register backlight\n"); in adp8870_probe()
907 dev_err(&client->dev, "failed to register sysfs\n"); in adp8870_probe()
920 dev_info(&client->dev, "Rev.%d Backlight\n", data->revid); in adp8870_probe()
923 adp8870_led_probe(client); in adp8870_probe()
935 static int adp8870_remove(struct i2c_client *client) in adp8870_remove() argument
937 struct adp8870_bl *data = i2c_get_clientdata(client); in adp8870_remove()
939 adp8870_clr_bits(client, ADP8870_MDCR, NSTBY); in adp8870_remove()
942 adp8870_led_remove(client); in adp8870_remove()
954 struct i2c_client *client = to_i2c_client(dev); in adp8870_i2c_suspend() local
956 adp8870_clr_bits(client, ADP8870_MDCR, NSTBY); in adp8870_i2c_suspend()
963 struct i2c_client *client = to_i2c_client(dev); in adp8870_i2c_resume() local
965 adp8870_set_bits(client, ADP8870_MDCR, NSTBY | BLEN); in adp8870_i2c_resume()