]>
git.zerfleddert.de Git - ms2-kexec/blob - headphone_cons.c
2 * Provide kernel console on headphone jack
5 #include <linux/module.h>
6 #include <linux/gpio_mapping.h>
7 #include <linux/gpio.h>
9 static int hs_switch
= -1;
12 * int add_preferred_console(char *name, int idx, char *options)
13 * c0069208 T add_preferred_console
16 static int (*add_preferred_console
)(char *, int, char*) = (int (*)(char*, int, char*))0xc0069208;
18 static int __init
headphone_cons_init(void)
20 /* Get the headset switch gpio number from devtree */
21 hs_switch
= get_gpio_by_name("headset_uart_switch");
25 printk(KERN_INFO
"headset_uart_switch: %d\n", hs_switch
);
27 printk(KERN_INFO
"value: %d\n", gpio_get_value(hs_switch
));
30 /* configure headset switch gpio as output and
31 direction based on devtree setting */
32 if (gpio_request(hs_switch
, "mapphone audio headset uart switch") < 0)
36 /* route kernel uart out headset jack */
37 gpio_direction_output(hs_switch
, 0);
38 printk(KERN_INFO
"value: %d\n", gpio_get_value(hs_switch
));
40 add_preferred_console("ttyS", 0, "115200");
44 static void __exit
headphone_cons_exit(void)
49 printk(KERN_INFO
"value: %d\n", gpio_get_value(hs_switch
));
50 gpio_direction_output(hs_switch
, 1);
51 printk(KERN_INFO
"value: %d\n", gpio_get_value(hs_switch
));
55 module_init(headphone_cons_init
);
56 module_exit(headphone_cons_exit
);
58 MODULE_LICENSE("GPL");
59 MODULE_AUTHOR("Michael Gernoth <michael@gernoth.net>");