Lines Matching +full:led +full:- +full:red
2 * drivers/leds/leds-mlxcpld.c
39 #include <linux/hwmon-sysfs.h>
53 #define MLXCPLD_LED_RED_STATIC_ON 0x05 /* Solid red */
67 * struct mlxcpld_param - LED access parameters:
68 * @offset: offset for LED access in CPLD device
69 * @mask: mask for LED access in CPLD device
70 * @base_color: base color code for LED
79 * struct mlxcpld_led_priv - LED private data:
80 * @cdev: LED class device instance
81 * @param: LED CPLD access parameters
91 * struct mlxcpld_led_profile - system LED profile (defined per system class):
92 * @offset: offset for LED access in CPLD device
93 * @mask: mask for LED access in CPLD device
96 * @name: LED name
107 * struct mlxcpld_led_pdata - system LED private data
109 * @pled: LED class device instance
111 * @num_led_instances: number of LED instances
135 "mlxcpld:fan1:red",
143 "mlxcpld:fan2:red",
151 "mlxcpld:fan3:red",
159 "mlxcpld:fan4:red",
167 "mlxcpld:psu:red",
175 "mlxcpld:status:red",
187 "mlxcpld:fan:red",
195 "mlxcpld:psu1:red",
203 "mlxcpld:psu2:red",
211 "mlxcpld:status:red",
263 * Each LED is controlled through low or high nibble of the relevant in mlxcpld_led_store_hw()
265 * Parameter vset provides color code: 0x0 for off, 0x5 for solid red, in mlxcpld_led_store_hw()
266 * 0x6 for 3Hz blink red, 0xd for solid green, 0xe for 3Hz blink in mlxcpld_led_store_hw()
268 * Parameter mask specifies which nibble is used for specific LED: mask in mlxcpld_led_store_hw()
269 * 0xf0 - lower nibble is to be used (bits from 0 to 3), mask 0x0f - in mlxcpld_led_store_hw()
272 spin_lock(&mlxcpld_led->lock); in mlxcpld_led_store_hw()
279 spin_unlock(&mlxcpld_led->lock); in mlxcpld_led_store_hw()
282 static void mlxcpld_led_brightness_set(struct led_classdev *led, in mlxcpld_led_brightness_set() argument
285 struct mlxcpld_led_priv *pled = cdev_to_priv(led); in mlxcpld_led_brightness_set()
288 mlxcpld_led_store_hw(pled->param.mask, pled->param.offset, in mlxcpld_led_brightness_set()
289 pled->param.base_color); in mlxcpld_led_brightness_set()
293 mlxcpld_led_store_hw(pled->param.mask, pled->param.offset, in mlxcpld_led_brightness_set()
297 static int mlxcpld_led_blink_set(struct led_classdev *led, in mlxcpld_led_blink_set() argument
301 struct mlxcpld_led_priv *pled = cdev_to_priv(led); in mlxcpld_led_blink_set()
312 return -EINVAL; in mlxcpld_led_blink_set()
315 mlxcpld_led_store_hw(pled->param.mask, pled->param.offset, in mlxcpld_led_blink_set()
316 pled->param.base_color + in mlxcpld_led_blink_set()
319 mlxcpld_led_store_hw(pled->param.mask, pled->param.offset, in mlxcpld_led_blink_set()
320 pled->param.base_color + in mlxcpld_led_blink_set()
332 cpld->pled = devm_kcalloc(dev, in mlxcpld_led_config()
333 cpld->num_led_instances, in mlxcpld_led_config()
336 if (!cpld->pled) in mlxcpld_led_config()
337 return -ENOMEM; in mlxcpld_led_config()
339 for (i = 0; i < cpld->num_led_instances; i++) { in mlxcpld_led_config()
340 cpld->pled[i].cdev.name = cpld->profile[i].name; in mlxcpld_led_config()
341 cpld->pled[i].cdev.brightness = cpld->profile[i].brightness; in mlxcpld_led_config()
342 cpld->pled[i].cdev.max_brightness = 1; in mlxcpld_led_config()
343 cpld->pled[i].cdev.brightness_set = mlxcpld_led_brightness_set; in mlxcpld_led_config()
344 cpld->pled[i].cdev.blink_set = mlxcpld_led_blink_set; in mlxcpld_led_config()
345 cpld->pled[i].cdev.flags = LED_CORE_SUSPENDRESUME; in mlxcpld_led_config()
346 err = devm_led_classdev_register(dev, &cpld->pled[i].cdev); in mlxcpld_led_config()
350 cpld->pled[i].param.offset = mlxcpld_led->profile[i].offset; in mlxcpld_led_config()
351 cpld->pled[i].param.mask = mlxcpld_led->profile[i].mask; in mlxcpld_led_config()
352 cpld->pled[i].param.base_color = in mlxcpld_led_config()
353 mlxcpld_led->profile[i].base_color; in mlxcpld_led_config()
355 if (mlxcpld_led->profile[i].brightness) in mlxcpld_led_config()
356 mlxcpld_led_brightness_set(&cpld->pled[i].cdev, in mlxcpld_led_config()
357 mlxcpld_led->profile[i].brightness); in mlxcpld_led_config()
368 mlxcpld_led = devm_kzalloc(&pdev->dev, sizeof(*mlxcpld_led), in mlxcpld_led_probe()
371 return -ENOMEM; in mlxcpld_led_probe()
373 mlxcpld_led->pdev = pdev; in mlxcpld_led_probe()
377 mlxcpld_led->profile = mlxcpld_led_msn2100_profile; in mlxcpld_led_probe()
378 mlxcpld_led->num_led_instances = in mlxcpld_led_probe()
383 mlxcpld_led->profile = mlxcpld_led_default_profile; in mlxcpld_led_probe()
384 mlxcpld_led->num_led_instances = in mlxcpld_led_probe()
389 spin_lock_init(&mlxcpld_led->lock); in mlxcpld_led_probe()
391 return mlxcpld_led_config(&pdev->dev, mlxcpld_led); in mlxcpld_led_probe()
406 return -ENODEV; in mlxcpld_led_init()
408 pdev = platform_device_register_simple(KBUILD_MODNAME, -1, NULL, 0); in mlxcpld_led_init()
425 platform_device_unregister(mlxcpld_led->pdev); in mlxcpld_led_exit()
433 MODULE_DESCRIPTION("Mellanox board LED driver");