Lines Matching +full:default +full:- +full:brightness
1 // SPDX-License-Identifier: GPL-2.0-only
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()
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()
72 int brightness = backlight_get_brightness(bl); in tps65217_bl_update_status() local
74 if (brightness > 0) { in tps65217_bl_update_status()
75 rc = tps65217_reg_write(tps65217_bl->tps, in tps65217_bl_update_status()
77 brightness - 1, in tps65217_bl_update_status()
80 dev_err(tps65217_bl->dev, in tps65217_bl_update_status()
81 "failed to set brightness level: %d\n", rc); 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()
110 switch (pdata->isel) { 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()
144 default: in tps65217_bl_hw_init()
145 dev_err(tps65217_bl->dev, in tps65217_bl_hw_init()
146 "invalid value for current level: %d\n", pdata->isel); in tps65217_bl_hw_init()
147 return -EINVAL; in tps65217_bl_hw_init()
151 rc = tps65217_set_bits(tps65217_bl->tps, in tps65217_bl_hw_init()
154 pdata->fdim, in tps65217_bl_hw_init()
157 dev_err(tps65217_bl->dev, in tps65217_bl_hw_init()
170 struct tps65217 *tps = dev_get_drvdata(pdev->dev.parent); in tps65217_bl_parse_dt()
175 node = of_get_child_by_name(tps->dev->of_node, "backlight"); in tps65217_bl_parse_dt()
177 return ERR_PTR(-ENODEV); in tps65217_bl_parse_dt()
179 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); in tps65217_bl_parse_dt()
181 err = ERR_PTR(-ENOMEM); in tps65217_bl_parse_dt()
185 pdata->isel = TPS65217_BL_ISET1; in tps65217_bl_parse_dt()
189 dev_err(&pdev->dev, in tps65217_bl_parse_dt()
191 err = ERR_PTR(-EINVAL); in tps65217_bl_parse_dt()
195 pdata->isel = val; in tps65217_bl_parse_dt()
198 pdata->fdim = TPS65217_BL_FDIM_200HZ; in tps65217_bl_parse_dt()
202 pdata->fdim = TPS65217_BL_FDIM_100HZ; in tps65217_bl_parse_dt()
206 pdata->fdim = TPS65217_BL_FDIM_200HZ; in tps65217_bl_parse_dt()
210 pdata->fdim = TPS65217_BL_FDIM_500HZ; in tps65217_bl_parse_dt()
214 pdata->fdim = TPS65217_BL_FDIM_1000HZ; in tps65217_bl_parse_dt()
217 default: in tps65217_bl_parse_dt()
218 dev_err(&pdev->dev, in tps65217_bl_parse_dt()
220 err = ERR_PTR(-EINVAL); in tps65217_bl_parse_dt()
225 if (!of_property_read_u32(node, "default-brightness", &val)) { in tps65217_bl_parse_dt()
227 dev_err(&pdev->dev, in tps65217_bl_parse_dt()
228 "invalid 'default-brightness' value in the device tree\n"); in tps65217_bl_parse_dt()
229 err = ERR_PTR(-EINVAL); in tps65217_bl_parse_dt()
233 pdata->dft_brightness = val; in tps65217_bl_parse_dt()
256 struct tps65217 *tps = dev_get_drvdata(pdev->dev.parent); in tps65217_bl_probe()
265 tps65217_bl = devm_kzalloc(&pdev->dev, sizeof(*tps65217_bl), in tps65217_bl_probe()
268 return -ENOMEM; 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()
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()
300 { .compatible = "ti,tps65217-bl", },
309 .name = "tps65217-bl",