From 7fc3ce7312fec9320aeffb1a6c6c6d4bf2408669 Mon Sep 17 00:00:00 2001 From: sbrissen Date: Wed, 23 Oct 2013 13:19:08 -0400 Subject: Add support for Note 8 (N5100 and N5110) Change-Id: I6c9798682f9f6349b37cb452353bd0c0e6958401 --- arch/arm/mach-exynos/px-switch.c | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) (limited to 'arch/arm/mach-exynos/px-switch.c') diff --git a/arch/arm/mach-exynos/px-switch.c b/arch/arm/mach-exynos/px-switch.c index 37173bb..2b31e71 100644 --- a/arch/arm/mach-exynos/px-switch.c +++ b/arch/arm/mach-exynos/px-switch.c @@ -212,7 +212,7 @@ void set_usb_connection_state(bool connected) static void pmic_safeout2(int onoff) { -#if !defined(CONFIG_MACH_P4NOTE) +#if !defined(CONFIG_MACH_P4NOTE) && !defined(CONFIG_MACH_KONA) struct regulator *regulator; regulator = regulator_get(NULL, "safeout2"); @@ -233,7 +233,11 @@ static void pmic_safeout2(int onoff) __func__, onoff); } } - +#if defined(CONFIG_MACH_KONA) + /* kona have switching charger instead of analog USB_VBUS switch + * So, just return */ + return; +#endif regulator_put(regulator); #else if (onoff) { @@ -261,6 +265,10 @@ static void usb_apply_path(enum usb_path_t path) __func__, gpio_get_value(GPIO_USB_SEL0), gpio_get_value(GPIO_USB_SEL1), gpio_get_value(GPIO_USB_SEL_CP)); pr_info("%s: target path %x\n", __func__, path); +#elif defined(CONFIG_MACH_KONA) + pr_info("%s: current gpio before changing : sel0:%d sel1:%d\n", + __func__, gpio_get_value(GPIO_USB_SEL0), + gpio_get_value(GPIO_USB_SEL1)); #else pr_info("%s: current gpio before changing : sel1:%d sel2:%d sel3:%d\n", __func__, gpio_get_value(GPIO_USB_SEL1), @@ -270,7 +278,7 @@ static void usb_apply_path(enum usb_path_t path) /* following checks are ordered according to priority */ if (path & USB_PATH_ADCCHECK) { -#if defined(CONFIG_MACH_P4NOTE) +#if defined(CONFIG_MACH_P4NOTE) || defined(CONFIG_MACH_KONA) gpio_set_value(GPIO_USB_SEL0, 1); gpio_set_value(GPIO_USB_SEL1, 0); #else @@ -284,7 +292,7 @@ static void usb_apply_path(enum usb_path_t path) goto out_nochange; } -#if defined(CONFIG_MACH_P4NOTE) +#if defined(CONFIG_MACH_P4NOTE) || defined(CONFIG_MACH_KONA) if (path & USB_PATH_TA) { gpio_set_value(GPIO_USB_SEL0, 0); gpio_set_value(GPIO_USB_SEL1, 0); @@ -294,7 +302,7 @@ static void usb_apply_path(enum usb_path_t path) if (path & USB_PATH_CP) { pr_info("DEBUG: set USB path to CP\n"); -#if defined(CONFIG_MACH_P4NOTE) +#if defined(CONFIG_MACH_P4NOTE) || defined(CONFIG_MACH_KONA) gpio_set_value(GPIO_USB_SEL0, 0); gpio_set_value(GPIO_USB_SEL1, 1); #else @@ -308,7 +316,7 @@ static void usb_apply_path(enum usb_path_t path) mdelay(3); goto out_cp; } -#if defined(CONFIG_MACH_P4NOTE) +#if defined(CONFIG_MACH_P4NOTE) || defined(CONFIG_MACH_KONA) if (path & USB_PATH_AP) { gpio_set_value(GPIO_USB_SEL0, 1); gpio_set_value(GPIO_USB_SEL1, 1); @@ -332,7 +340,7 @@ static void usb_apply_path(enum usb_path_t path) #endif /* CONFIG_MACH_P4NOTE */ /* default */ -#if defined(CONFIG_MACH_P4NOTE) +#if defined(CONFIG_MACH_P4NOTE) || defined(CONFIG_MACH_KONA) gpio_set_value(GPIO_USB_SEL0, 1); gpio_set_value(GPIO_USB_SEL1, 1); #else @@ -417,7 +425,7 @@ void usb_switch_unlock(void) up(&usb_switch_sem); } -#ifdef CONFIG_MACH_P4NOTE +#if defined(CONFIG_MACH_P4NOTE) || defined(CONFIG_MACH_KONA) static void init_gpio(void) { int uart_sel = -1; @@ -515,7 +523,7 @@ static int __init usb_switch_init(void) int ret; /* USB_SEL gpio_request */ -#if defined(CONFIG_MACH_P4NOTE) +#if defined(CONFIG_MACH_P4NOTE) || defined(CONFIG_MACH_KONA) gpio_request(GPIO_USB_SEL0, "GPIO_USB_SEL0"); gpio_request(GPIO_USB_SEL1, "GPIO_USB_SEL1"); #if defined(GPIO_USB_SEL_CP) @@ -539,7 +547,7 @@ static int __init usb_switch_init(void) #endif /* CONFIG_MACH_P8LTE */ /* USB_SEL gpio_export */ -#if defined(CONFIG_MACH_P4NOTE) +#if defined(CONFIG_MACH_P4NOTE) || defined(CONFIG_MACH_KONA) gpio_export(GPIO_USB_SEL0, 1); gpio_export(GPIO_USB_SEL1, 1); #if defined(GPIO_USB_SEL_CP) @@ -568,7 +576,7 @@ static int __init usb_switch_init(void) BUG_ON(!sec_switch_dev); /* USB_SEL gpio_export_link */ -#if defined(CONFIG_MACH_P4NOTE) +#if defined(CONFIG_MACH_P4NOTE) || defined(CONFIG_MACH_KONA) gpio_export_link(sec_switch_dev, "GPIO_USB_SEL0", GPIO_USB_SEL0); gpio_export_link(sec_switch_dev, "GPIO_USB_SEL1", GPIO_USB_SEL1); #if defined(GPIO_USB_SEL_CP) @@ -605,14 +613,14 @@ static int __init usb_switch_init(void) /*init_MUTEX(&usb_switch_sem);*/ sema_init(&usb_switch_sem, 1); -#ifdef CONFIG_MACH_P4NOTE +#if defined(CONFIG_MACH_P4NOTE) || defined(CONFIG_MACH_KONA) init_gpio(); #endif -#if !defined(CONFIG_MACH_P4NOTE) - if (!gpio_get_value(GPIO_USB_SEL1)) { -#else +#if defined(CONFIG_MACH_P4NOTE) || defined(CONFIG_MACH_KONA) if ((!gpio_get_value(GPIO_USB_SEL0)) && (gpio_get_value(GPIO_USB_SEL1))) { +#else + if (!gpio_get_value(GPIO_USB_SEL1)) { #endif usb_switch_lock(); usb_switch_set_path(USB_PATH_CP); -- cgit v1.1