Lines Matching +full:async +full:- +full:enum

1 // SPDX-License-Identifier: GPL-2.0-or-later
29 {-1, NULL},
68 return -1; in powernv_get_led_type()
77 enum led_brightness value) in powernv_led_set()
83 struct device *dev = powernv_led->cdev.dev; in powernv_led_set()
84 struct powernv_led_common *powernv_led_common = powernv_led->common; in powernv_led_set()
87 max_type = powernv_led_common->max_led_type; in powernv_led_set()
88 led_mask = OPAL_SLOT_LED_STATE_ON << powernv_led->led_type; in powernv_led_set()
92 /* OPAL async call */ in powernv_led_set()
95 if (token != -ERESTARTSYS) in powernv_led_set()
96 dev_err(dev, "%s: Couldn't get OPAL async token\n", in powernv_led_set()
101 rc = opal_leds_set_ind(token, powernv_led->loc_code, in powernv_led_set()
105 __func__, powernv_led->loc_code, rc); in powernv_led_set()
112 "%s: Failed to wait for the async response [rc=%d]\n", in powernv_led_set()
119 dev_err(dev, "%s : OAPL async call returned failed [rc=%d]\n", in powernv_led_set()
131 static enum led_brightness powernv_led_get(struct powernv_led_data *powernv_led) in powernv_led_get()
136 struct device *dev = powernv_led->cdev.dev; in powernv_led_get()
137 struct powernv_led_common *powernv_led_common = powernv_led->common; in powernv_led_get()
142 max_type = powernv_led_common->max_led_type; in powernv_led_get()
144 rc = opal_leds_get_ind(powernv_led->loc_code, in powernv_led_get()
156 if (!((led_mask >> powernv_led->led_type) & OPAL_SLOT_LED_STATE_ON)) { in powernv_led_get()
158 __func__, powernv_led->cdev.name); in powernv_led_get()
163 if ((led_value >> powernv_led->led_type) & OPAL_SLOT_LED_STATE_ON) in powernv_led_get()
174 enum led_brightness value) in powernv_brightness_set()
178 struct powernv_led_common *powernv_led_common = powernv_led->common; in powernv_brightness_set()
182 if (powernv_led_common->led_disabled) in powernv_brightness_set()
185 mutex_lock(&powernv_led_common->lock); in powernv_brightness_set()
187 mutex_unlock(&powernv_led_common->lock); in powernv_brightness_set()
193 static enum led_brightness powernv_brightness_get(struct led_classdev *led_cdev) in powernv_brightness_get()
212 powernv_led->led_type = powernv_get_led_type(led_type_desc); in powernv_led_create()
213 if (powernv_led->led_type == -1) { in powernv_led_create()
216 return -EINVAL; in powernv_led_create()
220 powernv_led->cdev.name = devm_kasprintf(dev, GFP_KERNEL, "%s:%s", in powernv_led_create()
221 powernv_led->loc_code, in powernv_led_create()
223 if (!powernv_led->cdev.name) in powernv_led_create()
224 return -ENOMEM; in powernv_led_create()
226 powernv_led->cdev.brightness_set_blocking = powernv_brightness_set; in powernv_led_create()
227 powernv_led->cdev.brightness_get = powernv_brightness_get; in powernv_led_create()
228 powernv_led->cdev.brightness = LED_OFF; in powernv_led_create()
229 powernv_led->cdev.max_brightness = LED_FULL; in powernv_led_create()
232 rc = devm_led_classdev_register(dev, &powernv_led->cdev); in powernv_led_create()
235 __func__, powernv_led->cdev.name); in powernv_led_create()
247 int rc = -1; in powernv_led_classdev()
250 struct device *dev = &pdev->dev; in powernv_led_classdev()
253 p = of_find_property(np, "led-types", NULL); in powernv_led_classdev()
259 return -ENOMEM; in powernv_led_classdev()
261 powernv_led->common = powernv_led_common; in powernv_led_classdev()
262 powernv_led->loc_code = (char *)np->name; in powernv_led_classdev()
278 struct device *dev = &pdev->dev; in powernv_led_probe()
285 return -EINVAL; in powernv_led_probe()
291 return -ENOMEM; in powernv_led_probe()
293 mutex_init(&powernv_led_common->lock); in powernv_led_probe()
294 powernv_led_common->max_led_type = cpu_to_be64(OPAL_SLOT_LED_TYPE_MAX); in powernv_led_probe()
308 powernv_led_common->led_disabled = true; in powernv_led_remove()
311 mutex_destroy(&powernv_led_common->lock); in powernv_led_remove()
313 dev_info(&pdev->dev, "PowerNV led module unregistered\n"); in powernv_led_remove()
319 .compatible = "ibm,opal-v3-led",
329 .name = "powernv-led-driver",