Lines Matching full:ncp
46 struct ncp5623 *ncp = container_of(mc_cdev, struct ncp5623, mc_dev); in ncp5623_brightness_set() local
49 guard(mutex)(&ncp->lock); in ncp5623_brightness_set()
51 if (ncp->delay && time_is_after_jiffies(ncp->delay)) in ncp5623_brightness_set()
54 ncp->delay = 0; in ncp5623_brightness_set()
57 ret = ncp5623_write(ncp->client, in ncp5623_brightness_set()
65 ret = ncp5623_write(ncp->client, NCP5623_DIMMING_TIME_REG, 0); in ncp5623_brightness_set()
69 ret = ncp5623_write(ncp->client, NCP5623_ILED_REG, brightness); in ncp5623_brightness_set()
73 ncp->current_brightness = brightness; in ncp5623_brightness_set()
83 struct ncp5623 *ncp = container_of(mc_cdev, struct ncp5623, mc_dev); in ncp5623_pattern_set() local
88 guard(mutex)(&ncp->lock); in ncp5623_pattern_set()
90 if (ncp->delay && time_is_after_jiffies(ncp->delay)) in ncp5623_pattern_set()
93 ncp->delay = 0; in ncp5623_pattern_set()
99 brightness_diff = pattern[0].brightness - ncp->current_brightness; in ncp5623_pattern_set()
113 ret = ncp5623_write(ncp->client, reg, in ncp5623_pattern_set()
118 ret = ncp5623_write(ncp->client, in ncp5623_pattern_set()
137 ncp->delay = NCP5623_MAX_BRIGHTNESS + brightness_diff; in ncp5623_pattern_set()
139 ncp->delay = abs(brightness_diff); in ncp5623_pattern_set()
141 ncp->delay = msecs_to_jiffies(ncp->delay * pattern[0].delta_t) + jiffies; in ncp5623_pattern_set()
143 ncp->current_brightness = pattern[0].brightness; in ncp5623_pattern_set()
159 struct ncp5623 *ncp; in ncp5623_probe() local
165 ncp = devm_kzalloc(dev, sizeof(*ncp), GFP_KERNEL); in ncp5623_probe()
166 if (!ncp) in ncp5623_probe()
169 ncp->client = client; in ncp5623_probe()
193 subled_info[ncp->mc_dev.num_colors].channel = reg; in ncp5623_probe()
194 subled_info[ncp->mc_dev.num_colors++].color_index = color_index; in ncp5623_probe()
199 ncp->mc_dev.led_cdev.max_brightness = NCP5623_MAX_BRIGHTNESS; in ncp5623_probe()
200 ncp->mc_dev.subled_info = subled_info; in ncp5623_probe()
201 ncp->mc_dev.led_cdev.brightness_set_blocking = ncp5623_brightness_set; in ncp5623_probe()
202 ncp->mc_dev.led_cdev.pattern_set = ncp5623_pattern_set; in ncp5623_probe()
203 ncp->mc_dev.led_cdev.pattern_clear = ncp5623_pattern_clear; in ncp5623_probe()
204 ncp->mc_dev.led_cdev.default_trigger = "pattern"; in ncp5623_probe()
206 mutex_init(&ncp->lock); in ncp5623_probe()
207 i2c_set_clientdata(client, ncp); in ncp5623_probe()
209 ret = led_classdev_multicolor_register_ext(dev, &ncp->mc_dev, &init_data); in ncp5623_probe()
216 mutex_destroy(&ncp->lock); in ncp5623_probe()
230 struct ncp5623 *ncp = i2c_get_clientdata(client); in ncp5623_remove() local
232 mutex_lock(&ncp->lock); in ncp5623_remove()
233 ncp->delay = 0; in ncp5623_remove()
234 mutex_unlock(&ncp->lock); in ncp5623_remove()
237 led_classdev_multicolor_unregister(&ncp->mc_dev); in ncp5623_remove()
238 mutex_destroy(&ncp->lock); in ncp5623_remove()
243 struct ncp5623 *ncp = i2c_get_clientdata(client); in ncp5623_shutdown() local
245 if (!(ncp->mc_dev.led_cdev.flags & LED_RETAIN_AT_SHUTDOWN)) in ncp5623_shutdown()
248 mutex_destroy(&ncp->lock); in ncp5623_shutdown()