• Home
  • Raw
  • Download

Lines Matching refs:led

58 static void regulator_led_enable(struct regulator_led *led)  in regulator_led_enable()  argument
62 if (led->enabled) in regulator_led_enable()
65 ret = regulator_enable(led->vcc); in regulator_led_enable()
67 dev_err(led->cdev.dev, "Failed to enable vcc: %d\n", ret); in regulator_led_enable()
71 led->enabled = 1; in regulator_led_enable()
74 static void regulator_led_disable(struct regulator_led *led) in regulator_led_disable() argument
78 if (!led->enabled) in regulator_led_disable()
81 ret = regulator_disable(led->vcc); in regulator_led_disable()
83 dev_err(led->cdev.dev, "Failed to disable vcc: %d\n", ret); in regulator_led_disable()
87 led->enabled = 0; in regulator_led_disable()
93 struct regulator_led *led = to_regulator_led(led_cdev); in regulator_led_brightness_set() local
97 mutex_lock(&led->mutex); in regulator_led_brightness_set()
100 regulator_led_disable(led); in regulator_led_brightness_set()
104 if (led->cdev.max_brightness > 1) { in regulator_led_brightness_set()
105 voltage = led_regulator_get_voltage(led->vcc, value); in regulator_led_brightness_set()
106 dev_dbg(led->cdev.dev, "brightness: %d voltage: %d\n", in regulator_led_brightness_set()
109 ret = regulator_set_voltage(led->vcc, voltage, voltage); in regulator_led_brightness_set()
111 dev_err(led->cdev.dev, "Failed to set voltage %d: %d\n", in regulator_led_brightness_set()
115 regulator_led_enable(led); in regulator_led_brightness_set()
118 mutex_unlock(&led->mutex); in regulator_led_brightness_set()
126 struct regulator_led *led; in regulator_led_probe() local
141 led = devm_kzalloc(&pdev->dev, sizeof(*led), GFP_KERNEL); in regulator_led_probe()
142 if (led == NULL) in regulator_led_probe()
145 led->cdev.max_brightness = led_regulator_get_max_brightness(vcc); in regulator_led_probe()
146 if (pdata->brightness > led->cdev.max_brightness) { in regulator_led_probe()
152 led->cdev.brightness_set_blocking = regulator_led_brightness_set; in regulator_led_probe()
153 led->cdev.name = pdata->name; in regulator_led_probe()
154 led->cdev.flags |= LED_CORE_SUSPENDRESUME; in regulator_led_probe()
155 led->vcc = vcc; in regulator_led_probe()
158 if (regulator_is_enabled(led->vcc)) in regulator_led_probe()
159 led->enabled = 1; in regulator_led_probe()
161 mutex_init(&led->mutex); in regulator_led_probe()
163 platform_set_drvdata(pdev, led); in regulator_led_probe()
165 ret = led_classdev_register(&pdev->dev, &led->cdev); in regulator_led_probe()
170 led->cdev.brightness = pdata->brightness; in regulator_led_probe()
173 regulator_led_brightness_set(&led->cdev, led->cdev.brightness); in regulator_led_probe()
180 struct regulator_led *led = platform_get_drvdata(pdev); in regulator_led_remove() local
182 led_classdev_unregister(&led->cdev); in regulator_led_remove()
183 regulator_led_disable(led); in regulator_led_remove()