Lines Matching refs:rt
15 static void pmf_gpio_set_##name(struct gpio_runtime *rt, int on)\
20 if (unlikely(!rt)) return; \
21 rc = pmf_call_function(rt->node, #name "-mute", &args); \
25 rt->implementation_private &= ~(1<<bit); \
26 rt->implementation_private |= (!!on << bit); \
28 static int pmf_gpio_get_##name(struct gpio_runtime *rt) \
30 if (unlikely(!rt)) return 0; \
31 return (rt->implementation_private>>bit)&1; \
38 static void pmf_gpio_set_hw_reset(struct gpio_runtime *rt, int on) in pmf_gpio_set_hw_reset() argument
43 if (unlikely(!rt)) return; in pmf_gpio_set_hw_reset()
44 rc = pmf_call_function(rt->node, "hw-reset", &args); in pmf_gpio_set_hw_reset()
50 static void pmf_gpio_all_amps_off(struct gpio_runtime *rt) in pmf_gpio_all_amps_off() argument
54 if (unlikely(!rt)) return; in pmf_gpio_all_amps_off()
55 saved = rt->implementation_private; in pmf_gpio_all_amps_off()
56 pmf_gpio_set_headphone(rt, 0); in pmf_gpio_all_amps_off()
57 pmf_gpio_set_amp(rt, 0); in pmf_gpio_all_amps_off()
58 pmf_gpio_set_lineout(rt, 0); in pmf_gpio_all_amps_off()
59 rt->implementation_private = saved; in pmf_gpio_all_amps_off()
62 static void pmf_gpio_all_amps_restore(struct gpio_runtime *rt) in pmf_gpio_all_amps_restore() argument
66 if (unlikely(!rt)) return; in pmf_gpio_all_amps_restore()
67 s = rt->implementation_private; in pmf_gpio_all_amps_restore()
68 pmf_gpio_set_headphone(rt, (s>>0)&1); in pmf_gpio_all_amps_restore()
69 pmf_gpio_set_amp(rt, (s>>1)&1); in pmf_gpio_all_amps_restore()
70 pmf_gpio_set_lineout(rt, (s>>2)&1); in pmf_gpio_all_amps_restore()
84 static void pmf_gpio_init(struct gpio_runtime *rt) in pmf_gpio_init() argument
86 pmf_gpio_all_amps_off(rt); in pmf_gpio_init()
87 rt->implementation_private = 0; in pmf_gpio_init()
88 INIT_DELAYED_WORK(&rt->headphone_notify.work, pmf_handle_notify); in pmf_gpio_init()
89 INIT_DELAYED_WORK(&rt->line_in_notify.work, pmf_handle_notify); in pmf_gpio_init()
90 INIT_DELAYED_WORK(&rt->line_out_notify.work, pmf_handle_notify); in pmf_gpio_init()
91 mutex_init(&rt->headphone_notify.mutex); in pmf_gpio_init()
92 mutex_init(&rt->line_in_notify.mutex); in pmf_gpio_init()
93 mutex_init(&rt->line_out_notify.mutex); in pmf_gpio_init()
96 static void pmf_gpio_exit(struct gpio_runtime *rt) in pmf_gpio_exit() argument
98 pmf_gpio_all_amps_off(rt); in pmf_gpio_exit()
99 rt->implementation_private = 0; in pmf_gpio_exit()
101 if (rt->headphone_notify.gpio_private) in pmf_gpio_exit()
102 pmf_unregister_irq_client(rt->headphone_notify.gpio_private); in pmf_gpio_exit()
103 if (rt->line_in_notify.gpio_private) in pmf_gpio_exit()
104 pmf_unregister_irq_client(rt->line_in_notify.gpio_private); in pmf_gpio_exit()
105 if (rt->line_out_notify.gpio_private) in pmf_gpio_exit()
106 pmf_unregister_irq_client(rt->line_out_notify.gpio_private); in pmf_gpio_exit()
110 cancel_delayed_work_sync(&rt->headphone_notify.work); in pmf_gpio_exit()
111 cancel_delayed_work_sync(&rt->line_in_notify.work); in pmf_gpio_exit()
112 cancel_delayed_work_sync(&rt->line_out_notify.work); in pmf_gpio_exit()
114 mutex_destroy(&rt->headphone_notify.mutex); in pmf_gpio_exit()
115 mutex_destroy(&rt->line_in_notify.mutex); in pmf_gpio_exit()
116 mutex_destroy(&rt->line_out_notify.mutex); in pmf_gpio_exit()
118 kfree(rt->headphone_notify.gpio_private); in pmf_gpio_exit()
119 kfree(rt->line_in_notify.gpio_private); in pmf_gpio_exit()
120 kfree(rt->line_out_notify.gpio_private); in pmf_gpio_exit()
130 static int pmf_set_notify(struct gpio_runtime *rt, in pmf_set_notify() argument
143 notif = &rt->headphone_notify; in pmf_set_notify()
147 notif = &rt->line_in_notify; in pmf_set_notify()
151 notif = &rt->line_out_notify; in pmf_set_notify()
189 err = pmf_register_irq_client(rt->node, in pmf_set_notify()
209 static int pmf_get_detect(struct gpio_runtime *rt, in pmf_get_detect() argument
230 err = pmf_call_function(rt->node, name, &args); in pmf_get_detect()