Lines Matching refs:rt

133 static void ftr_gpio_set_##name(struct gpio_runtime *rt, int on)\
137 if (unlikely(!rt)) return; \
152 rt->implementation_private &= ~(1<<bit); \
153 rt->implementation_private |= (!!on << bit); \
155 static int ftr_gpio_get_##name(struct gpio_runtime *rt) \
157 if (unlikely(!rt)) return 0; \
158 return (rt->implementation_private>>bit)&1; \
166 static void ftr_gpio_set_hw_reset(struct gpio_runtime *rt, int on) in ftr_gpio_set_hw_reset() argument
170 if (unlikely(!rt)) return; in ftr_gpio_set_hw_reset()
183 static void ftr_gpio_all_amps_off(struct gpio_runtime *rt) in ftr_gpio_all_amps_off() argument
187 if (unlikely(!rt)) return; in ftr_gpio_all_amps_off()
188 saved = rt->implementation_private; in ftr_gpio_all_amps_off()
189 ftr_gpio_set_headphone(rt, 0); in ftr_gpio_all_amps_off()
190 ftr_gpio_set_amp(rt, 0); in ftr_gpio_all_amps_off()
191 ftr_gpio_set_lineout(rt, 0); in ftr_gpio_all_amps_off()
193 ftr_gpio_set_master(rt, 0); in ftr_gpio_all_amps_off()
194 rt->implementation_private = saved; in ftr_gpio_all_amps_off()
197 static void ftr_gpio_all_amps_restore(struct gpio_runtime *rt) in ftr_gpio_all_amps_restore() argument
201 if (unlikely(!rt)) return; in ftr_gpio_all_amps_restore()
202 s = rt->implementation_private; in ftr_gpio_all_amps_restore()
203 ftr_gpio_set_headphone(rt, (s>>0)&1); in ftr_gpio_all_amps_restore()
204 ftr_gpio_set_amp(rt, (s>>1)&1); in ftr_gpio_all_amps_restore()
205 ftr_gpio_set_lineout(rt, (s>>2)&1); in ftr_gpio_all_amps_restore()
207 ftr_gpio_set_master(rt, (s>>3)&1); in ftr_gpio_all_amps_restore()
232 static void ftr_gpio_init(struct gpio_runtime *rt) in ftr_gpio_init() argument
273 ftr_gpio_all_amps_off(rt); in ftr_gpio_init()
274 rt->implementation_private = 0; in ftr_gpio_init()
275 INIT_DELAYED_WORK(&rt->headphone_notify.work, ftr_handle_notify); in ftr_gpio_init()
276 INIT_DELAYED_WORK(&rt->line_in_notify.work, ftr_handle_notify); in ftr_gpio_init()
277 INIT_DELAYED_WORK(&rt->line_out_notify.work, ftr_handle_notify); in ftr_gpio_init()
278 mutex_init(&rt->headphone_notify.mutex); in ftr_gpio_init()
279 mutex_init(&rt->line_in_notify.mutex); in ftr_gpio_init()
280 mutex_init(&rt->line_out_notify.mutex); in ftr_gpio_init()
283 static void ftr_gpio_exit(struct gpio_runtime *rt) in ftr_gpio_exit() argument
285 ftr_gpio_all_amps_off(rt); in ftr_gpio_exit()
286 rt->implementation_private = 0; in ftr_gpio_exit()
287 if (rt->headphone_notify.notify) in ftr_gpio_exit()
288 free_irq(headphone_detect_irq, &rt->headphone_notify); in ftr_gpio_exit()
289 if (rt->line_in_notify.gpio_private) in ftr_gpio_exit()
290 free_irq(linein_detect_irq, &rt->line_in_notify); in ftr_gpio_exit()
291 if (rt->line_out_notify.gpio_private) in ftr_gpio_exit()
292 free_irq(lineout_detect_irq, &rt->line_out_notify); in ftr_gpio_exit()
293 cancel_delayed_work_sync(&rt->headphone_notify.work); in ftr_gpio_exit()
294 cancel_delayed_work_sync(&rt->line_in_notify.work); in ftr_gpio_exit()
295 cancel_delayed_work_sync(&rt->line_out_notify.work); in ftr_gpio_exit()
296 mutex_destroy(&rt->headphone_notify.mutex); in ftr_gpio_exit()
297 mutex_destroy(&rt->line_in_notify.mutex); in ftr_gpio_exit()
298 mutex_destroy(&rt->line_out_notify.mutex); in ftr_gpio_exit()
310 static int ftr_set_notify(struct gpio_runtime *rt, in ftr_set_notify() argument
323 notif = &rt->headphone_notify; in ftr_set_notify()
328 notif = &rt->line_in_notify; in ftr_set_notify()
333 notif = &rt->line_out_notify; in ftr_set_notify()
377 static int ftr_get_detect(struct gpio_runtime *rt, in ftr_get_detect() argument