Lines Matching refs:pchip
47 static int lm3639_chip_init(struct lm3639_chip_data *pchip)
51 struct lm3639_platform_data *pdata = pchip->pdata;
55 regmap_update_bits(pchip->regmap, REG_BL_CONF_1, 0x08,
61 ret = regmap_update_bits(pchip->regmap, REG_IO_CTRL, 0x7C, reg_val);
66 ret = regmap_write(pchip->regmap, REG_BL_CONF_4, pdata->init_brt_led);
70 ret = regmap_write(pchip->regmap, REG_BL_CONF_3, pdata->init_brt_led);
83 ret = regmap_update_bits(pchip->regmap, REG_ENABLE, 0x79, reg_val);
89 dev_err(pchip->dev, "i2c failed to access register\n");
98 struct lm3639_chip_data *pchip = bl_get_data(bl);
99 struct lm3639_platform_data *pdata = pchip->pdata;
101 ret = regmap_read(pchip->regmap, REG_FLAG, ®_val);
106 dev_info(pchip->dev, "last flag is 0x%x\n", reg_val);
114 dev_err(pchip->dev,
120 ret = regmap_write(pchip->regmap, REG_BL_CONF_4, bl->props.brightness);
123 ret = regmap_write(pchip->regmap, REG_BL_CONF_3, bl->props.brightness);
128 ret = regmap_update_bits(pchip->regmap, REG_ENABLE, 0x01, 0x00);
130 ret = regmap_update_bits(pchip->regmap, REG_ENABLE, 0x01, 0x01);
136 dev_err(pchip->dev, "i2c failed to access registers\n");
144 struct lm3639_chip_data *pchip = bl_get_data(bl);
145 struct lm3639_platform_data *pdata = pchip->pdata;
151 dev_err(pchip->dev,
156 ret = regmap_read(pchip->regmap, REG_BL_CONF_1, ®_val);
160 ret = regmap_read(pchip->regmap, REG_BL_CONF_4, ®_val);
162 ret = regmap_read(pchip->regmap, REG_BL_CONF_3, ®_val);
169 dev_err(pchip->dev, "i2c failed to access register\n");
185 struct lm3639_chip_data *pchip = dev_get_drvdata(dev);
194 regmap_update_bits(pchip->regmap, REG_BL_CONF_1, 0x10,
198 regmap_update_bits(pchip->regmap, REG_BL_CONF_1, 0x10,
207 dev_err(pchip->dev, "%s:i2c access fail to register\n", __func__);
211 dev_err(pchip->dev, "%s:input conversion fail\n", __func__);
224 struct lm3639_chip_data *pchip;
226 pchip = container_of(cdev, struct lm3639_chip_data, cdev_torch);
228 ret = regmap_read(pchip->regmap, REG_FLAG, ®_val);
232 dev_info(pchip->dev, "last flag is 0x%x\n", reg_val);
236 ret = regmap_update_bits(pchip->regmap, REG_ENABLE, 0x06, 0x00);
242 ret = regmap_update_bits(pchip->regmap,
246 ret = regmap_update_bits(pchip->regmap, REG_ENABLE, 0x06, 0x02);
252 dev_err(pchip->dev, "i2c failed to access register\n");
261 struct lm3639_chip_data *pchip;
263 pchip = container_of(cdev, struct lm3639_chip_data, cdev_flash);
265 ret = regmap_read(pchip->regmap, REG_FLAG, ®_val);
269 dev_info(pchip->dev, "last flag is 0x%x\n", reg_val);
272 ret = regmap_update_bits(pchip->regmap, REG_ENABLE, 0x06, 0x00);
280 ret = regmap_update_bits(pchip->regmap,
284 ret = regmap_update_bits(pchip->regmap, REG_ENABLE, 0x06, 0x06);
290 dev_err(pchip->dev, "i2c failed to access register\n");
303 struct lm3639_chip_data *pchip;
317 pchip = devm_kzalloc(&client->dev,
319 if (!pchip)
322 pchip->pdata = pdata;
323 pchip->dev = &client->dev;
325 pchip->regmap = devm_regmap_init_i2c(client, &lm3639_regmap);
326 if (IS_ERR(pchip->regmap)) {
327 ret = PTR_ERR(pchip->regmap);
332 i2c_set_clientdata(client, pchip);
335 ret = lm3639_chip_init(pchip);
345 pchip->bled =
346 devm_backlight_device_register(pchip->dev, "lm3639_bled",
347 pchip->dev, pchip, &lm3639_bled_ops,
349 if (IS_ERR(pchip->bled)) {
351 ret = PTR_ERR(pchip->bled);
355 ret = device_create_file(&(pchip->bled->dev), &dev_attr_bled_mode);
362 pchip->cdev_flash.name = "lm3639_flash";
363 pchip->cdev_flash.max_brightness = 16;
364 pchip->cdev_flash.brightness_set = lm3639_flash_brightness_set;
366 &client->dev, &pchip->cdev_flash);
373 pchip->cdev_torch.name = "lm3639_torch";
374 pchip->cdev_torch.max_brightness = 8;
375 pchip->cdev_torch.brightness_set = lm3639_torch_brightness_set;
377 &client->dev, &pchip->cdev_torch);
386 led_classdev_unregister(&pchip->cdev_flash);
388 device_remove_file(&(pchip->bled->dev), &dev_attr_bled_mode);
395 struct lm3639_chip_data *pchip = i2c_get_clientdata(client);
397 regmap_write(pchip->regmap, REG_ENABLE, 0x00);
399 led_classdev_unregister(&pchip->cdev_torch);
400 led_classdev_unregister(&pchip->cdev_flash);
401 if (pchip->bled)
402 device_remove_file(&(pchip->bled->dev), &dev_attr_bled_mode);