X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/ms2-kexec/blobdiff_plain/76b7ce1b4f9828baf75c68eb54773b53825a4604..c4dc8ddb1a63cf2e5274d7d03ec6559e2eb28b75:/headphone_cons.c diff --git a/headphone_cons.c b/headphone_cons.c new file mode 100644 index 0000000..edf8d16 --- /dev/null +++ b/headphone_cons.c @@ -0,0 +1,39 @@ +/* + * Provide kernel console on headphone jack + */ + +#include +#include +#include + +/* + * int add_preferred_console(char *name, int idx, char *options) + * c0069208 T add_preferred_console + */ + +static int (*add_preferred_console)(char *, int, char*) = (int (*)(char*, int, char*))0xc0069208; + +static int __init headphone_cons_init(void) +{ + int hs_switch; + + /* Get the headset switch gpio number from devtree */ + hs_switch = get_gpio_by_name("headset_uart_switch"); + if (hs_switch < 0) + return -EINVAL; + + /* configure headset switch gpio as output and + direction based on devtree setting */ + gpio_request(hs_switch, "mapphone audio headset uart switch"); + + /* route kernel uart out headset jack */ + gpio_direction_output(hs_switch, 0); + + add_preferred_console("ttyS", 1, "115200"); + return 0; +} + +module_init(headphone_cons_init); + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Michael Gernoth ");