Lines Matching refs:tps65217_bl
20 struct tps65217_bl { struct
27 static int tps65217_bl_enable(struct tps65217_bl *tps65217_bl) in tps65217_bl_enable() argument
31 rc = tps65217_set_bits(tps65217_bl->tps, TPS65217_REG_WLEDCTRL1, in tps65217_bl_enable()
35 dev_err(tps65217_bl->dev, in tps65217_bl_enable()
40 tps65217_bl->is_enabled = true; in tps65217_bl_enable()
42 dev_dbg(tps65217_bl->dev, "backlight enabled\n"); in tps65217_bl_enable()
47 static int tps65217_bl_disable(struct tps65217_bl *tps65217_bl) in tps65217_bl_disable() argument
51 rc = tps65217_clear_bits(tps65217_bl->tps, in tps65217_bl_disable()
56 dev_err(tps65217_bl->dev, in tps65217_bl_disable()
61 tps65217_bl->is_enabled = false; in tps65217_bl_disable()
63 dev_dbg(tps65217_bl->dev, "backlight disabled\n"); in tps65217_bl_disable()
70 struct tps65217_bl *tps65217_bl = bl_get_data(bl); in tps65217_bl_update_status() local
75 rc = tps65217_reg_write(tps65217_bl->tps, in tps65217_bl_update_status()
80 dev_err(tps65217_bl->dev, in tps65217_bl_update_status()
85 dev_dbg(tps65217_bl->dev, "brightness set to %d\n", brightness); in tps65217_bl_update_status()
87 if (!tps65217_bl->is_enabled) in tps65217_bl_update_status()
88 rc = tps65217_bl_enable(tps65217_bl); in tps65217_bl_update_status()
90 rc = tps65217_bl_disable(tps65217_bl); in tps65217_bl_update_status()
101 static int tps65217_bl_hw_init(struct tps65217_bl *tps65217_bl, in tps65217_bl_hw_init() argument
106 rc = tps65217_bl_disable(tps65217_bl); in tps65217_bl_hw_init()
113 rc = tps65217_clear_bits(tps65217_bl->tps, in tps65217_bl_hw_init()
118 dev_err(tps65217_bl->dev, in tps65217_bl_hw_init()
124 dev_dbg(tps65217_bl->dev, "selected ISET1 current level\n"); in tps65217_bl_hw_init()
130 rc = tps65217_set_bits(tps65217_bl->tps, TPS65217_REG_WLEDCTRL1, in tps65217_bl_hw_init()
134 dev_err(tps65217_bl->dev, in tps65217_bl_hw_init()
140 dev_dbg(tps65217_bl->dev, "selected ISET2 current level\n"); in tps65217_bl_hw_init()
145 dev_err(tps65217_bl->dev, in tps65217_bl_hw_init()
151 rc = tps65217_set_bits(tps65217_bl->tps, in tps65217_bl_hw_init()
157 dev_err(tps65217_bl->dev, in tps65217_bl_hw_init()
257 struct tps65217_bl *tps65217_bl; in tps65217_bl_probe() local
265 tps65217_bl = devm_kzalloc(&pdev->dev, sizeof(*tps65217_bl), in tps65217_bl_probe()
267 if (tps65217_bl == NULL) in tps65217_bl_probe()
270 tps65217_bl->tps = tps; in tps65217_bl_probe()
271 tps65217_bl->dev = &pdev->dev; in tps65217_bl_probe()
272 tps65217_bl->is_enabled = false; in tps65217_bl_probe()
274 rc = tps65217_bl_hw_init(tps65217_bl, pdata); in tps65217_bl_probe()
282 tps65217_bl->bl = devm_backlight_device_register(&pdev->dev, pdev->name, in tps65217_bl_probe()
283 tps65217_bl->dev, tps65217_bl, in tps65217_bl_probe()
285 if (IS_ERR(tps65217_bl->bl)) { in tps65217_bl_probe()
286 dev_err(tps65217_bl->dev, in tps65217_bl_probe()
288 return PTR_ERR(tps65217_bl->bl); in tps65217_bl_probe()
291 tps65217_bl->bl->props.brightness = pdata->dft_brightness; in tps65217_bl_probe()
292 backlight_update_status(tps65217_bl->bl); in tps65217_bl_probe()
293 platform_set_drvdata(pdev, tps65217_bl); in tps65217_bl_probe()