void my_omap_serial_init(int wake_gpio_strobe, unsigned int wake_strobe_enable_mask);
int my_omap_hs_init(void);
-int my_serial_omap_init(void);
void activate_emu_uart(void);
#define MAPPHONE_BPWAKE_STROBE_GPIO 157
+static int find_ms2_dev(struct device *dev, void *data)
+{
+ if (!strncmp((char*)data, dev_name(dev), strlen((char*)data))) {
+ printk(KERN_INFO "Found it\n");
+ return 1;
+ }
+ return 0;
+}
+
static int __init headphone_cons_init(void)
{
+ int bpwake_strobe_gpio;
+ struct device *uart3 = NULL;
+
+ /* Remove old uart3 device which was disabled... */
+ printk(KERN_INFO "Searching for omap-uart.3...\n");
+
+ uart3 = device_find_child(&platform_bus, "omap-uart.3", find_ms2_dev);
+ if (uart3 == NULL)
+ return-ENODEV;
+
+ printk(KERN_INFO "Deleting old device...\n");
+ device_del(uart3);
+
/* Get the headset switch gpio number from devtree */
hs_switch = get_gpio_by_name("headset_uart_switch");
if (hs_switch < 0)
if (!gpio_get_value(hs_switch))
return -ENODEV;
- printk(KERN_INFO "Loading slightly modified omap serial driver...\n");
- my_serial_omap_init();
+ printk(KERN_INFO "Activating emu_uart on mini-usb port\n");
+ activate_emu_uart();
printk(KERN_INFO "Enabling UART3...\n");
- my_omap_serial_init(MAPPHONE_BPWAKE_STROBE_GPIO, 0x01);
+ bpwake_strobe_gpio = get_gpio_by_name("ipc_bpwake_strobe");
+ if (bpwake_strobe_gpio < 0)
+ bpwake_strobe_gpio = MAPPHONE_BPWAKE_STROBE_GPIO;
+ printk("Serial init with strobe pin %d\n", bpwake_strobe_gpio);
+ my_omap_serial_init(bpwake_strobe_gpio, 0x01);
my_omap_hs_init();
/* route kernel uart out headset jack */
gpio_set_value(hs_switch, 0);
printk(KERN_INFO "headset_uart_switch: %d, value: %d\n", hs_switch, gpio_get_value(hs_switch));
- activate_emu_uart();
-
- //add_preferred_console("ttyS", 2, "115200");
+ add_preferred_console("ttyS", 2, "115200");
return 0;
}