ARM: tegra114: register excon power supply driver
Laxman Dewangan [Mon, 3 Jun 2013 15:51:30 +0000 (20:51 +0530)]
Register extcon power supply driver for generating AC/USB online
power source status event for Macallan, Tegratab and roth platform.
The driver receive the extcon notification generated by USB driver
for charging cable type.

bug 1286396

Change-Id: Id6c94ea581a5aa57507eec81bd7b44f608f008a9
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/234758
Reviewed-by: Riham Haidar <rhaidar@nvidia.com>
Tested-by: Riham Haidar <rhaidar@nvidia.com>

arch/arm/mach-tegra/board-macallan-power.c
arch/arm/mach-tegra/board-roth-power.c
arch/arm/mach-tegra/board-tegratab-power.c

index 3686c79..aa552e7 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/mfd/palmas.h>
 #include <linux/power/bq2419x-charger.h>
 #include <linux/max17048_battery.h>
+#include <linux/power/power_supply_extcon.h>
 #include <linux/gpio.h>
 #include <linux/interrupt.h>
 #include <linux/regulator/userspace-consumer.h>
@@ -77,8 +78,6 @@ static struct bq2419x_vbus_platform_data bq2419x_vbus_pdata = {
 };
 
 struct bq2419x_charger_platform_data macallan_bq2419x_charger_pdata = {
-       .use_usb = 1,
-       .use_mains = 1,
        .update_status = max17048_battery_status,
        .battery_check = max17048_check_battery,
        .max_charge_current_mA = 3000,
@@ -89,8 +88,6 @@ struct bq2419x_charger_platform_data macallan_bq2419x_charger_pdata = {
 };
 
 struct max17048_platform_data macallan_max17048_pdata = {
-       .use_ac = 0,
-       .use_usb = 0,
        .model_data = &macallan_yoku_4100mA_max17048_battery,
 };
 
@@ -113,6 +110,17 @@ static struct i2c_board_info __initdata bq2419x_boardinfo[] = {
        },
 };
 
+static struct power_supply_extcon_plat_data psy_extcon_pdata = {
+       .extcon_name = "tegra-udc",
+};
+
+static struct platform_device psy_extcon_device = {
+       .name = "power-supply-extcon",
+       .id = -1,
+       .dev = {
+               .platform_data = &psy_extcon_pdata,
+       },
+};
 
 /************************ Macallan based regulator ****************/
 static struct regulator_consumer_supply palmas_smps123_supply[] = {
@@ -694,6 +702,7 @@ int __init macallan_regulator_init(void)
        i2c_register_board_info(0, bq2419x_boardinfo,
                        ARRAY_SIZE(bq2419x_boardinfo));
 
+       platform_device_register(&psy_extcon_device);
        platform_device_register(&macallan_pda_power_device);
 
        return 0;
index 92adea4..ab7eb75 100644 (file)
@@ -29,6 +29,7 @@
 #include <linux/regulator/tps51632-regulator.h>
 #include <linux/power/bq2419x-charger.h>
 #include <linux/max17048_battery.h>
+#include <linux/power/power_supply_extcon.h>
 #include <linux/gpio.h>
 #include <linux/regulator/userspace-consumer.h>
 
@@ -110,8 +111,6 @@ static struct bq2419x_vbus_platform_data bq2419x_vbus_pdata = {
 };
 
 struct bq2419x_charger_platform_data bq2419x_charger_pdata = {
-       .use_usb = 1,
-       .use_mains = 1,
        .update_status = max17048_battery_status,
        .battery_check = max17048_check_battery,
        .max_charge_current_mA = 3000,
@@ -148,8 +147,6 @@ struct max17048_battery_model max17048_mdata = {
 };
 
 struct max17048_platform_data max17048_pdata = {
-       .use_ac = 0,
-       .use_usb = 0,
        .model_data = &max17048_mdata,
 };
 
@@ -172,6 +169,18 @@ static struct i2c_board_info __initdata bq2419x_boardinfo[] = {
        },
 };
 
+static struct power_supply_extcon_plat_data psy_extcon_pdata = {
+       .extcon_name = "tegra-udc",
+};
+
+static struct platform_device psy_extcon_device = {
+       .name = "power-supply-extcon",
+       .id = -1,
+       .dev = {
+               .platform_data = &psy_extcon_pdata,
+       },
+};
+
 /************************ Palmas based regulator ****************/
 static struct regulator_consumer_supply palmas_smps12_supply[] = {
        REGULATOR_SUPPLY("vddio_ddr0", NULL),
@@ -734,6 +743,7 @@ int __init roth_regulator_init(void)
        i2c_register_board_info(4, tps51632_boardinfo, 1);
        i2c_register_board_info(0, max17048_boardinfo, 1);
        i2c_register_board_info(0, bq2419x_boardinfo, 1);
+       platform_device_register(&psy_extcon_device);
        platform_device_register(&roth_pda_power_device);
        return 0;
 }
index e7c9576..1fdc61d 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/mfd/palmas.h>
 #include <linux/power/bq2419x-charger.h>
 #include <linux/max17048_battery.h>
+#include <linux/power/power_supply_extcon.h>
 #include <linux/gpio.h>
 #include <linux/interrupt.h>
 #include <linux/regulator/userspace-consumer.h>
@@ -73,8 +74,6 @@ static struct bq2419x_vbus_platform_data tegratab_bq2419x_vbus_pdata = {
 };
 
 struct bq2419x_charger_platform_data tegratab_bq2419x_charger_pdata = {
-       .use_usb = 1,
-       .use_mains = 1,
        .update_status = max17048_battery_status,
        .battery_check = max17048_check_battery,
        .max_charge_current_mA = 3000,
@@ -111,8 +110,6 @@ struct max17048_battery_model tegratab_max17048_mdata = {
 };
 
 struct max17048_platform_data tegratab_max17048_pdata = {
-       .use_ac = 0,
-       .use_usb = 0,
        .model_data = &tegratab_max17048_mdata,
 };
 
@@ -136,6 +133,18 @@ static struct i2c_board_info __initdata tegratab_bq2419x_boardinfo[] = {
        },
 };
 
+static struct power_supply_extcon_plat_data psy_extcon_pdata = {
+       .extcon_name = "tegra-udc",
+};
+
+static struct platform_device psy_extcon_device = {
+       .name = "power-supply-extcon",
+       .id = -1,
+       .dev = {
+               .platform_data = &psy_extcon_pdata,
+       },
+};
+
 /************************ Tegratab based regulator ****************/
 static struct regulator_consumer_supply palmas_smps123_supply[] = {
        REGULATOR_SUPPLY("vdd_cpu", NULL),
@@ -714,6 +723,7 @@ int __init tegratab_regulator_init(void)
        i2c_register_board_info(0, tegratab_bq2419x_boardinfo, 1);
 
        regulator_has_full_constraints();
+       platform_device_register(&psy_extcon_device);
        platform_device_register(&tegratab_pda_power_device);
 
        return 0;