Lines Matching +full:led +full:- +full:green

2  * drivers/leds/leds-mlxcpld.c
38 #include <linux/hwmon-sysfs.h>
57 #define MLXCPLD_LED_GREEN_STATIC_ON 0x0D /* Solid green */
66 * struct mlxcpld_param - LED access parameters:
67 * @offset: offset for LED access in CPLD device
68 * @mask: mask for LED access in CPLD device
69 * @base_color: base color code for LED
78 * struct mlxcpld_led_priv - LED private data:
79 * @cdev: LED class device instance
80 * @param: LED CPLD access parameters
90 * struct mlxcpld_led_profile - system LED profile (defined per system class):
91 * @offset: offset for LED access in CPLD device
92 * @mask: mask for LED access in CPLD device
95 * @name: LED name
106 * struct mlxcpld_led_pdata - system LED private data
108 * @pled: LED class device instance
110 * @num_led_instances: number of LED instances
130 "mlxcpld:fan1:green",
138 "mlxcpld:fan2:green",
146 "mlxcpld:fan3:green",
154 "mlxcpld:fan4:green",
162 "mlxcpld:psu:green",
170 "mlxcpld:status:green",
182 "mlxcpld:fan:green",
190 "mlxcpld:psu1:green",
198 "mlxcpld:psu2:green",
206 "mlxcpld:status:green",
262 * Each LED is controlled through low or high nibble of the relevant in mlxcpld_led_store_hw()
265 * 0x6 for 3Hz blink red, 0xd for solid green, 0xe for 3Hz blink in mlxcpld_led_store_hw()
266 * green. in mlxcpld_led_store_hw()
267 * Parameter mask specifies which nibble is used for specific LED: mask in mlxcpld_led_store_hw()
268 * 0xf0 - lower nibble is to be used (bits from 0 to 3), mask 0x0f - in mlxcpld_led_store_hw()
271 spin_lock(&mlxcpld_led->lock); in mlxcpld_led_store_hw()
278 spin_unlock(&mlxcpld_led->lock); in mlxcpld_led_store_hw()
281 static void mlxcpld_led_brightness_set(struct led_classdev *led, in mlxcpld_led_brightness_set() argument
284 struct mlxcpld_led_priv *pled = cdev_to_priv(led); in mlxcpld_led_brightness_set()
287 mlxcpld_led_store_hw(pled->param.mask, pled->param.offset, in mlxcpld_led_brightness_set()
288 pled->param.base_color); in mlxcpld_led_brightness_set()
292 mlxcpld_led_store_hw(pled->param.mask, pled->param.offset, in mlxcpld_led_brightness_set()
296 static int mlxcpld_led_blink_set(struct led_classdev *led, in mlxcpld_led_blink_set() argument
300 struct mlxcpld_led_priv *pled = cdev_to_priv(led); in mlxcpld_led_blink_set()
311 return -EINVAL; in mlxcpld_led_blink_set()
314 mlxcpld_led_store_hw(pled->param.mask, pled->param.offset, in mlxcpld_led_blink_set()
315 pled->param.base_color + in mlxcpld_led_blink_set()
318 mlxcpld_led_store_hw(pled->param.mask, pled->param.offset, in mlxcpld_led_blink_set()
319 pled->param.base_color + in mlxcpld_led_blink_set()
331 cpld->pled = devm_kcalloc(dev, in mlxcpld_led_config()
332 cpld->num_led_instances, in mlxcpld_led_config()
335 if (!cpld->pled) in mlxcpld_led_config()
336 return -ENOMEM; in mlxcpld_led_config()
338 for (i = 0; i < cpld->num_led_instances; i++) { in mlxcpld_led_config()
339 cpld->pled[i].cdev.name = cpld->profile[i].name; in mlxcpld_led_config()
340 cpld->pled[i].cdev.brightness = cpld->profile[i].brightness; in mlxcpld_led_config()
341 cpld->pled[i].cdev.max_brightness = 1; in mlxcpld_led_config()
342 cpld->pled[i].cdev.brightness_set = mlxcpld_led_brightness_set; in mlxcpld_led_config()
343 cpld->pled[i].cdev.blink_set = mlxcpld_led_blink_set; in mlxcpld_led_config()
344 cpld->pled[i].cdev.flags = LED_CORE_SUSPENDRESUME; in mlxcpld_led_config()
345 err = devm_led_classdev_register(dev, &cpld->pled[i].cdev); in mlxcpld_led_config()
349 cpld->pled[i].param.offset = mlxcpld_led->profile[i].offset; in mlxcpld_led_config()
350 cpld->pled[i].param.mask = mlxcpld_led->profile[i].mask; in mlxcpld_led_config()
351 cpld->pled[i].param.base_color = in mlxcpld_led_config()
352 mlxcpld_led->profile[i].base_color; in mlxcpld_led_config()
354 if (mlxcpld_led->profile[i].brightness) in mlxcpld_led_config()
355 mlxcpld_led_brightness_set(&cpld->pled[i].cdev, in mlxcpld_led_config()
356 mlxcpld_led->profile[i].brightness); in mlxcpld_led_config()
367 mlxcpld_led = devm_kzalloc(&pdev->dev, sizeof(*mlxcpld_led), in mlxcpld_led_probe()
370 return -ENOMEM; in mlxcpld_led_probe()
372 mlxcpld_led->pdev = pdev; in mlxcpld_led_probe()
376 mlxcpld_led->profile = mlxcpld_led_msn2100_profile; in mlxcpld_led_probe()
377 mlxcpld_led->num_led_instances = in mlxcpld_led_probe()
382 mlxcpld_led->profile = mlxcpld_led_default_profile; in mlxcpld_led_probe()
383 mlxcpld_led->num_led_instances = in mlxcpld_led_probe()
388 spin_lock_init(&mlxcpld_led->lock); in mlxcpld_led_probe()
390 return mlxcpld_led_config(&pdev->dev, mlxcpld_led); in mlxcpld_led_probe()
405 return -ENODEV; in mlxcpld_led_init()
407 pdev = platform_device_register_simple(KBUILD_MODNAME, -1, NULL, 0); in mlxcpld_led_init()
424 platform_device_unregister(mlxcpld_led->pdev); in mlxcpld_led_exit()
432 MODULE_DESCRIPTION("Mellanox board LED driver");