void my_omap_serial_init(int wake_gpio_strobe, unsigned int wake_strobe_enable_mask);
int my_omap_hs_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)
return -EINVAL;
- printk(KERN_INFO "headset_uart_switch: %d\n", hs_switch);
+ printk(KERN_INFO "headset_uart_switch: %d, value: %d\n", hs_switch, gpio_get_value(hs_switch));
- printk(KERN_INFO "value: %d\n", gpio_get_value(hs_switch));
if (!gpio_get_value(hs_switch))
return -ENODEV;
+ 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_direction_output(hs_switch, 0);
- printk(KERN_INFO "value: %d\n", gpio_get_value(hs_switch));
+ gpio_set_value(hs_switch, 0);
+ printk(KERN_INFO "headset_uart_switch: %d, value: %d\n", hs_switch, gpio_get_value(hs_switch));
- //add_preferred_console("ttyS", 2, "115200");
+ add_preferred_console("ttyS", 2, "115200");
return 0;
}