Lines Matching defs:led

116 static int pca963x_brightness(struct pca963x_led *led,
119 struct i2c_client *client = led->chip->client;
120 struct pca963x_chipdef *chipdef = led->chip->chipdef;
125 ledout_addr = chipdef->ledout_base + (led->led_num / 4);
126 shift = 2 * (led->led_num % 4);
142 led->led_num,
155 static void pca963x_blink(struct pca963x_led *led)
157 struct i2c_client *client = led->chip->client;
158 struct pca963x_chipdef *chipdef = led->chip->chipdef;
162 ledout_addr = chipdef->ledout_base + (led->led_num / 4);
163 shift = 2 * (led->led_num % 4);
167 i2c_smbus_write_byte_data(client, chipdef->grppwm, led->gdc);
169 i2c_smbus_write_byte_data(client, chipdef->grpfreq, led->gfrq);
175 mutex_lock(&led->chip->mutex);
183 mutex_unlock(&led->chip->mutex);
186 static int pca963x_power_state(struct pca963x_led *led)
188 struct i2c_client *client = led->chip->client;
189 unsigned long *leds_on = &led->chip->leds_on;
192 if (led->led_cdev.brightness)
193 set_bit(led->led_num, leds_on);
195 clear_bit(led->led_num, leds_on);
207 struct pca963x_led *led;
210 led = container_of(led_cdev, struct pca963x_led, led_cdev);
212 mutex_lock(&led->chip->mutex);
214 ret = pca963x_brightness(led, value);
217 ret = pca963x_power_state(led);
220 mutex_unlock(&led->chip->mutex);
224 static unsigned int pca963x_period_scale(struct pca963x_led *led,
227 unsigned int scaling = led->chip->chipdef->scaling;
236 struct pca963x_led *led;
239 led = container_of(led_cdev, struct pca963x_led, led_cdev);
250 period = pca963x_period_scale(led, time_on + time_off);
257 period = pca963x_period_scale(led, 1000);
265 gdc = (pca963x_period_scale(led, time_on) * 256) / period;
274 led->gdc = gdc;
275 led->gfrq = gfrq;
277 pca963x_blink(led);
289 struct pca963x_led *led = chip->leds;
335 led->led_num = reg;
336 led->chip = chip;
337 led->led_cdev.brightness_set_blocking = pca963x_led_set;
339 led->led_cdev.blink_set = pca963x_blink_set;
348 ret = devm_led_classdev_register_ext(dev, &led->led_cdev,
356 ++led;