Lines Matching +full:pm8058 +full:- +full:led
1 // SPDX-License-Identifier: GPL-2.0-only
30 struct pm8058_led *led; in pm8058_led_set() local
35 led = container_of(cled, struct pm8058_led, cdev); in pm8058_led_set()
36 switch (led->ledtype) { in pm8058_led_set()
50 ret = regmap_update_bits(led->map, led->reg, mask, val); in pm8058_led_set()
52 pr_err("Failed to set LED brightness\n"); in pm8058_led_set()
57 struct pm8058_led *led; in pm8058_led_get() local
61 led = container_of(cled, struct pm8058_led, cdev); in pm8058_led_get()
63 ret = regmap_read(led->map, led->reg, &val); in pm8058_led_get()
65 pr_err("Failed to get LED brightness\n"); in pm8058_led_get()
69 switch (led->ledtype) { in pm8058_led_get()
90 struct device *dev = &pdev->dev; in pm8058_led_probe()
91 struct pm8058_led *led; in pm8058_led_probe() local
98 led = devm_kzalloc(dev, sizeof(*led), GFP_KERNEL); in pm8058_led_probe()
99 if (!led) in pm8058_led_probe()
100 return -ENOMEM; in pm8058_led_probe()
102 led->ledtype = (u32)(unsigned long)of_device_get_match_data(dev); in pm8058_led_probe()
104 map = dev_get_regmap(dev->parent, NULL); in pm8058_led_probe()
107 return -ENXIO; in pm8058_led_probe()
109 led->map = map; in pm8058_led_probe()
113 ret = of_property_read_u32(np, "reg", &led->reg); in pm8058_led_probe()
116 return -EINVAL; in pm8058_led_probe()
119 led->cdev.brightness_set = pm8058_led_set; in pm8058_led_probe()
120 led->cdev.brightness_get = pm8058_led_get; in pm8058_led_probe()
121 if (led->ledtype == PM8058_LED_TYPE_COMMON) in pm8058_led_probe()
125 led->cdev.max_brightness = maxbright; in pm8058_led_probe()
132 led->cdev.brightness = maxbright; in pm8058_led_probe()
133 pm8058_led_set(&led->cdev, maxbright); in pm8058_led_probe()
136 led->cdev.brightness = pm8058_led_get(&led->cdev); in pm8058_led_probe()
139 led->cdev.brightness = LED_OFF; in pm8058_led_probe()
140 pm8058_led_set(&led->cdev, LED_OFF); in pm8058_led_probe()
143 if (led->ledtype == PM8058_LED_TYPE_KEYPAD || in pm8058_led_probe()
144 led->ledtype == PM8058_LED_TYPE_FLASH) in pm8058_led_probe()
145 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",
180 MODULE_DESCRIPTION("PM8058 LEDs driver");
182 MODULE_ALIAS("platform:pm8058-leds");