]> git.zerfleddert.de Git - ms2-kexec/blob - headphone_cons.c
edf8d165cd53415ead347121d4b0b66db52b1baf
[ms2-kexec] / headphone_cons.c
1 /*
2 * Provide kernel console on headphone jack
3 */
4
5 #include <linux/module.h>
6 #include <linux/gpio_mapping.h>
7 #include <linux/gpio.h>
8
9 /*
10 * int add_preferred_console(char *name, int idx, char *options)
11 * c0069208 T add_preferred_console
12 */
13
14 static int (*add_preferred_console)(char *, int, char*) = (int (*)(char*, int, char*))0xc0069208;
15
16 static int __init headphone_cons_init(void)
17 {
18 int hs_switch;
19
20 /* Get the headset switch gpio number from devtree */
21 hs_switch = get_gpio_by_name("headset_uart_switch");
22 if (hs_switch < 0)
23 return -EINVAL;
24
25 /* configure headset switch gpio as output and
26 direction based on devtree setting */
27 gpio_request(hs_switch, "mapphone audio headset uart switch");
28
29 /* route kernel uart out headset jack */
30 gpio_direction_output(hs_switch, 0);
31
32 add_preferred_console("ttyS", 1, "115200");
33 return 0;
34 }
35
36 module_init(headphone_cons_init);
37
38 MODULE_LICENSE("GPL");
39 MODULE_AUTHOR("Michael Gernoth <michael@gernoth.net>");
Impressum, Datenschutz