Lines Matching +full:led +full:-
1 // SPDX-License-Identifier: GPL-2.0-only
31 struct pm8058_led *led; in pm8058_led_set() local
36 led = container_of(cled, struct pm8058_led, cdev); in pm8058_led_set()
37 switch (led->ledtype) { in pm8058_led_set()
51 ret = regmap_update_bits(led->map, led->reg, mask, val); in pm8058_led_set()
53 pr_err("Failed to set LED brightness\n"); in pm8058_led_set()
58 struct pm8058_led *led; in pm8058_led_get() local
62 led = container_of(cled, struct pm8058_led, cdev); in pm8058_led_get()
64 ret = regmap_read(led->map, led->reg, &val); in pm8058_led_get()
66 pr_err("Failed to get LED brightness\n"); in pm8058_led_get()
70 switch (led->ledtype) { in pm8058_led_get()
91 struct device *dev = &pdev->dev; in pm8058_led_probe()
92 struct pm8058_led *led; in pm8058_led_probe() local
99 led = devm_kzalloc(dev, sizeof(*led), GFP_KERNEL); in pm8058_led_probe()
100 if (!led) in pm8058_led_probe()
101 return -ENOMEM; in pm8058_led_probe()
103 led->ledtype = (u32)(unsigned long)of_device_get_match_data(dev); in pm8058_led_probe()
105 map = dev_get_regmap(dev->parent, NULL); in pm8058_led_probe()
108 return -ENXIO; in pm8058_led_probe()
110 led->map = map; in pm8058_led_probe()
114 ret = of_property_read_u32(np, "reg", &led->reg); in pm8058_led_probe()
117 return -EINVAL; in pm8058_led_probe()
120 led->cdev.brightness_set = pm8058_led_set; in pm8058_led_probe()
121 led->cdev.brightness_get = pm8058_led_get; in pm8058_led_probe()
122 if (led->ledtype == PM8058_LED_TYPE_COMMON) in pm8058_led_probe()
126 led->cdev.max_brightness = maxbright; in pm8058_led_probe()
128 state = of_get_property(np, "default-state", NULL); in pm8058_led_probe()
131 led->cdev.brightness = pm8058_led_get(&led->cdev); in pm8058_led_probe()
133 led->cdev.brightness = maxbright; in pm8058_led_probe()
134 pm8058_led_set(&led->cdev, maxbright); in pm8058_led_probe()
136 led->cdev.brightness = LED_OFF; in pm8058_led_probe()
137 pm8058_led_set(&led->cdev, LED_OFF); in pm8058_led_probe()
141 if (led->ledtype == PM8058_LED_TYPE_KEYPAD || in pm8058_led_probe()
142 led->ledtype == PM8058_LED_TYPE_FLASH) in pm8058_led_probe()
143 led->cdev.flags = LED_CORE_SUSPENDRESUME; in pm8058_led_probe()
147 ret = devm_led_classdev_register_ext(dev, &led->cdev, &init_data); in pm8058_led_probe()
149 dev_err(dev, "Failed to register LED for %pOF\n", np); in pm8058_led_probe()
156 .compatible = "qcom,pm8058-led",
160 .compatible = "qcom,pm8058-keypad-led",
164 .compatible = "qcom,pm8058-flash-led",
174 .name = "pm8058-leds",
182 MODULE_ALIAS("platform:pm8058-leds");