• Home
  • Raw
  • Download

Lines Matching +full:led +full:- +full:2

6  * Based on leds-da903x:
10 * Copyright (C) 2006-2008 Marvell International Ltd.
14 * it under the terms of the GNU General Public License version 2 as
42 struct mc13xxx_led *led; member
58 struct mc13xxx_led *led = in mc13xxx_led_set() local
60 struct mc13xxx_leds *leds = led->leds; in mc13xxx_led_set()
63 switch (led->id) { in mc13xxx_led_set()
67 reg = 2; in mc13xxx_led_set()
68 shift = 9 + (led->id - MC13783_LED_MD) * 4; in mc13xxx_led_set()
79 off = led->id - MC13783_LED_R1; in mc13xxx_led_set()
82 shift = (off - bank * 3) * 5 + 6; in mc13xxx_led_set()
87 off = led->id - MC13892_LED_MD; in mc13xxx_led_set()
88 reg = off / 2; in mc13xxx_led_set()
89 shift = 3 + (off - reg * 2) * 12; in mc13xxx_led_set()
94 off = led->id - MC13892_LED_R; in mc13xxx_led_set()
95 bank = off / 2; in mc13xxx_led_set()
96 reg = 2 + bank; in mc13xxx_led_set()
97 shift = (off - bank * 2) * 12 + 3; in mc13xxx_led_set()
102 shift = 3 + (led->id - MC34708_LED_R) * 12; in mc13xxx_led_set()
108 return mc13xxx_reg_rmw(leds->master, leds->devtype->ledctrl_base + reg, in mc13xxx_led_set()
109 mc13xxx_max_brightness(led->id) << shift, in mc13xxx_led_set()
120 struct device *dev = &pdev->dev; in mc13xxx_led_probe_dt()
121 int i = 0, ret = -ENODATA; in mc13xxx_led_probe_dt()
125 return ERR_PTR(-ENOMEM); in mc13xxx_led_probe_dt()
127 parent = of_get_child_by_name(dev->parent->of_node, "leds"); in mc13xxx_led_probe_dt()
131 ret = of_property_read_u32_array(parent, "led-control", in mc13xxx_led_probe_dt()
132 pdata->led_control, in mc13xxx_led_probe_dt()
133 leds->devtype->num_regs); in mc13xxx_led_probe_dt()
137 pdata->num_leds = of_get_child_count(parent); in mc13xxx_led_probe_dt()
139 pdata->led = devm_kcalloc(dev, pdata->num_leds, sizeof(*pdata->led), in mc13xxx_led_probe_dt()
141 if (!pdata->led) { in mc13xxx_led_probe_dt()
142 ret = -ENOMEM; in mc13xxx_led_probe_dt()
152 pdata->led[i].id = leds->devtype->led_min + tmp; in mc13xxx_led_probe_dt()
155 pdata->led[i].name = str; in mc13xxx_led_probe_dt()
156 if (!of_property_read_string(child, "linux,default-trigger", in mc13xxx_led_probe_dt()
158 pdata->led[i].default_trigger = str; in mc13xxx_led_probe_dt()
163 pdata->num_leds = i; in mc13xxx_led_probe_dt()
164 ret = i > 0 ? 0 : -ENODATA; in mc13xxx_led_probe_dt()
175 return ERR_PTR(-ENOSYS); in mc13xxx_led_probe_dt()
181 struct device *dev = &pdev->dev; in mc13xxx_led_probe()
183 struct mc13xxx *mcdev = dev_get_drvdata(dev->parent); in mc13xxx_led_probe()
185 (struct mc13xxx_led_devtype *)pdev->id_entry->driver_data; in mc13xxx_led_probe()
187 int i, id, ret = -ENODATA; in mc13xxx_led_probe()
192 return -ENOMEM; in mc13xxx_led_probe()
194 leds->devtype = devtype; in mc13xxx_led_probe()
195 leds->master = mcdev; in mc13xxx_led_probe()
198 if (dev->parent->of_node) { in mc13xxx_led_probe()
203 return -ENODATA; in mc13xxx_led_probe()
205 leds->num_leds = pdata->num_leds; in mc13xxx_led_probe()
207 if ((leds->num_leds < 1) || in mc13xxx_led_probe()
208 (leds->num_leds > (devtype->led_max - devtype->led_min + 1))) { in mc13xxx_led_probe()
209 dev_err(dev, "Invalid LED count %d\n", leds->num_leds); in mc13xxx_led_probe()
210 return -EINVAL; in mc13xxx_led_probe()
213 leds->led = devm_kcalloc(dev, leds->num_leds, sizeof(*leds->led), in mc13xxx_led_probe()
215 if (!leds->led) in mc13xxx_led_probe()
216 return -ENOMEM; in mc13xxx_led_probe()
218 for (i = 0; i < devtype->num_regs; i++) { in mc13xxx_led_probe()
219 ret = mc13xxx_reg_write(mcdev, leds->devtype->ledctrl_base + i, in mc13xxx_led_probe()
220 pdata->led_control[i]); in mc13xxx_led_probe()
225 for (i = 0; i < leds->num_leds; i++) { in mc13xxx_led_probe()
228 ret = -EINVAL; in mc13xxx_led_probe()
230 id = pdata->led[i].id; in mc13xxx_led_probe()
231 name = pdata->led[i].name; in mc13xxx_led_probe()
232 trig = pdata->led[i].default_trigger; in mc13xxx_led_probe()
234 if ((id > devtype->led_max) || (id < devtype->led_min)) { in mc13xxx_led_probe()
240 dev_warn(dev, "LED %i already initialized\n", id); in mc13xxx_led_probe()
245 leds->led[i].id = id; in mc13xxx_led_probe()
246 leds->led[i].leds = leds; in mc13xxx_led_probe()
247 leds->led[i].cdev.name = name; in mc13xxx_led_probe()
248 leds->led[i].cdev.default_trigger = trig; in mc13xxx_led_probe()
249 leds->led[i].cdev.flags = LED_CORE_SUSPENDRESUME; in mc13xxx_led_probe()
250 leds->led[i].cdev.brightness_set_blocking = mc13xxx_led_set; in mc13xxx_led_probe()
251 leds->led[i].cdev.max_brightness = mc13xxx_max_brightness(id); in mc13xxx_led_probe()
253 ret = led_classdev_register(dev->parent, &leds->led[i].cdev); in mc13xxx_led_probe()
255 dev_err(dev, "Failed to register LED %i\n", id); in mc13xxx_led_probe()
261 while (--i >= 0) in mc13xxx_led_probe()
262 led_classdev_unregister(&leds->led[i].cdev); in mc13xxx_led_probe()
272 for (i = 0; i < leds->num_leds; i++) in mc13xxx_led_remove()
273 led_classdev_unregister(&leds->led[i].cdev); in mc13xxx_led_remove()
300 { "mc13783-led", (kernel_ulong_t)&mc13783_led_devtype, },
301 { "mc13892-led", (kernel_ulong_t)&mc13892_led_devtype, },
302 { "mc34708-led", (kernel_ulong_t)&mc34708_led_devtype, },
309 .name = "mc13xxx-led",