static void ftr_gpio_init(struct gpio_runtime *rt) { get_gpio("headphone-mute", NULL, &headphone_mute_gpio, &headphone_mute_gpio_activestate); get_gpio("amp-mute", NULL, &_mute_gpio, &_mute_gpio_activestate); get_gpio("lineout-mute", NULL, &lineout_mute_gpio, &lineout_mute_gpio_activestate); get_gpio("hw-reset", "audio-hw-reset", &hw_reset_gpio, &hw_reset_gpio_activestate); headphone_detect_node = get_gpio("headphone-detect", NULL, &headphone_detect_gpio, &headphone_detect_gpio_activestate); /* go Apple, and thanks for giving these different names * across the board... */ lineout_detect_node = get_gpio("lineout-detect", "line-output-detect", &lineout_detect_gpio, &lineout_detect_gpio_activestate); linein_detect_node = get_gpio("linein-detect", "line-input-detect", &linein_detect_gpio, &linein_detect_gpio_activestate); gpio_enable_dual_edge(headphone_detect_gpio); gpio_enable_dual_edge(lineout_detect_gpio); gpio_enable_dual_edge(linein_detect_gpio); get_irq(headphone_detect_node, &headphone_detect_irq); get_irq(lineout_detect_node, &lineout_detect_irq); get_irq(linein_detect_node, &linein_detect_irq); ftr_gpio_all_amps_off(rt); rt->implementation_private = 0; INIT_WORK(&rt->headphone_notify.work, ftr_handle_notify, &rt->headphone_notify); INIT_WORK(&rt->line_in_notify.work, ftr_handle_notify, &rt->line_in_notify); INIT_WORK(&rt->line_out_notify.work, ftr_handle_notify, &rt->line_out_notify); mutex_init(&rt->headphone_notify.mutex); mutex_init(&rt->line_in_notify.mutex); mutex_init(&rt->line_out_notify.mutex); }
static void ftr_gpio_exit(struct gpio_runtime *rt) { ftr_gpio_all_amps_off(rt); rt->implementation_private = 0; if (rt->headphone_notify.notify) free_irq(headphone_detect_irq, &rt->headphone_notify); if (rt->line_in_notify.gpio_private) free_irq(linein_detect_irq, &rt->line_in_notify); if (rt->line_out_notify.gpio_private) free_irq(lineout_detect_irq, &rt->line_out_notify); cancel_delayed_work(&rt->headphone_notify.work); cancel_delayed_work(&rt->line_in_notify.work); cancel_delayed_work(&rt->line_out_notify.work); flush_scheduled_work(); mutex_destroy(&rt->headphone_notify.mutex); mutex_destroy(&rt->line_in_notify.mutex); mutex_destroy(&rt->line_out_notify.mutex); }