~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/led-class-multicolor.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 /* LED Multicolor class interface
  3  * Copyright (C) 2019-20 Texas Instruments Incorporated - http://www.ti.com/
  4  */
  5 
  6 #ifndef _LINUX_MULTICOLOR_LEDS_H_INCLUDED
  7 #define _LINUX_MULTICOLOR_LEDS_H_INCLUDED
  8 
  9 #include <linux/leds.h>
 10 #include <dt-bindings/leds/common.h>
 11 
 12 struct mc_subled {
 13         unsigned int color_index;
 14         unsigned int brightness;
 15         unsigned int intensity;
 16         unsigned int channel;
 17 };
 18 
 19 struct led_classdev_mc {
 20         /* led class device */
 21         struct led_classdev led_cdev;
 22         unsigned int num_colors;
 23 
 24         struct mc_subled *subled_info;
 25 };
 26 
 27 static inline struct led_classdev_mc *lcdev_to_mccdev(
 28                                                 struct led_classdev *led_cdev)
 29 {
 30         return container_of(led_cdev, struct led_classdev_mc, led_cdev);
 31 }
 32 
 33 /**
 34  * led_classdev_multicolor_register_ext - register a new object of led_classdev
 35  *                                    class with support for multicolor LEDs
 36  * @parent: the multicolor LED to register
 37  * @mcled_cdev: the led_classdev_mc structure for this device
 38  * @init_data: the LED class multicolor device initialization data
 39  *
 40  * Returns: 0 on success or negative error value on failure
 41  */
 42 int led_classdev_multicolor_register_ext(struct device *parent,
 43                                             struct led_classdev_mc *mcled_cdev,
 44                                             struct led_init_data *init_data);
 45 
 46 /**
 47  * led_classdev_multicolor_unregister - unregisters an object of led_classdev
 48  *                                      class with support for multicolor LEDs
 49  * @mcled_cdev: the multicolor LED to unregister
 50  *
 51  * Unregister a previously registered via led_classdev_multicolor_register
 52  * object
 53  */
 54 void led_classdev_multicolor_unregister(struct led_classdev_mc *mcled_cdev);
 55 
 56 /* Calculate brightness for the monochrome LED cluster */
 57 int led_mc_calc_color_components(struct led_classdev_mc *mcled_cdev,
 58                                  enum led_brightness brightness);
 59 
 60 int devm_led_classdev_multicolor_register_ext(struct device *parent,
 61                                           struct led_classdev_mc *mcled_cdev,
 62                                           struct led_init_data *init_data);
 63 
 64 void devm_led_classdev_multicolor_unregister(struct device *parent,
 65                                             struct led_classdev_mc *mcled_cdev);
 66 
 67 static inline int led_classdev_multicolor_register(struct device *parent,
 68                                             struct led_classdev_mc *mcled_cdev)
 69 {
 70         return led_classdev_multicolor_register_ext(parent, mcled_cdev, NULL);
 71 }
 72 
 73 static inline int devm_led_classdev_multicolor_register(struct device *parent,
 74                                              struct led_classdev_mc *mcled_cdev)
 75 {
 76         return devm_led_classdev_multicolor_register_ext(parent, mcled_cdev,
 77                                                          NULL);
 78 }
 79 
 80 #endif  /* _LINUX_MULTICOLOR_LEDS_H_INCLUDED */
 81 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php