Lines Matching defs:led
117 static int pca963x_brightness(struct pca963x_led *led,
120 struct i2c_client *client = led->chip->client;
121 struct pca963x_chipdef *chipdef = led->chip->chipdef;
126 ledout_addr = chipdef->ledout_base + (led->led_num / 4);
127 shift = 2 * (led->led_num % 4);
133 if (led->blinking) {
137 led->led_num,
147 led->blinking = false;
152 led->led_num,
157 if (led->blinking)
169 static void pca963x_blink(struct pca963x_led *led)
171 struct i2c_client *client = led->chip->client;
172 struct pca963x_chipdef *chipdef = led->chip->chipdef;
176 ledout_addr = chipdef->ledout_base + (led->led_num / 4);
177 shift = 2 * (led->led_num % 4);
181 i2c_smbus_write_byte_data(client, chipdef->grppwm, led->gdc);
183 i2c_smbus_write_byte_data(client, chipdef->grpfreq, led->gfrq);
189 mutex_lock(&led->chip->mutex);
197 mutex_unlock(&led->chip->mutex);
198 led->blinking = true;
201 static int pca963x_power_state(struct pca963x_led *led)
203 struct i2c_client *client = led->chip->client;
204 unsigned long *leds_on = &led->chip->leds_on;
207 if (led->led_cdev.brightness)
208 set_bit(led->led_num, leds_on);
210 clear_bit(led->led_num, leds_on);
222 struct pca963x_led *led;
225 led = container_of(led_cdev, struct pca963x_led, led_cdev);
227 mutex_lock(&led->chip->mutex);
229 ret = pca963x_brightness(led, value);
232 ret = pca963x_power_state(led);
235 mutex_unlock(&led->chip->mutex);
239 static unsigned int pca963x_period_scale(struct pca963x_led *led,
242 unsigned int scaling = led->chip->chipdef->scaling;
251 struct pca963x_led *led;
254 led = container_of(led_cdev, struct pca963x_led, led_cdev);
265 period = pca963x_period_scale(led, time_on + time_off);
272 period = pca963x_period_scale(led, 1000);
280 gdc = (pca963x_period_scale(led, time_on) * 256) / period;
289 led->gdc = gdc;
290 led->gfrq = gfrq;
292 pca963x_blink(led);
293 led->led_cdev.brightness = LED_FULL;
306 struct pca963x_led *led = chip->leds;
352 led->led_num = reg;
353 led->chip = chip;
354 led->led_cdev.brightness_set_blocking = pca963x_led_set;
356 led->led_cdev.blink_set = pca963x_blink_set;
357 led->blinking = false;
366 ret = devm_led_classdev_register_ext(dev, &led->led_cdev,
374 ++led;