diff options
Diffstat (limited to 'arch/arm/mach-mx5/mx53_smd_pmic_da9053.c')
-rwxr-xr-x | arch/arm/mach-mx5/mx53_smd_pmic_da9053.c | 172 |
1 files changed, 126 insertions, 46 deletions
diff --git a/arch/arm/mach-mx5/mx53_smd_pmic_da9053.c b/arch/arm/mach-mx5/mx53_smd_pmic_da9053.c index ae39b8451c39..0ae551e07deb 100755 --- a/arch/arm/mach-mx5/mx53_smd_pmic_da9053.c +++ b/arch/arm/mach-mx5/mx53_smd_pmic_da9053.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2011 Freescale Semiconductor, Inc. All Rights Reserved. + * Copyright (C) 2010-2012 Freescale Semiconductor, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -39,7 +39,7 @@ #include <mach/iomux-mx53.h> #include <mach/gpio.h> -#define DA9052_LDO(max, min, rname, suspend_mv) \ +#define DA9052_LDO(max, min, rname, suspend_mv, num_consumers, consumers) \ {\ .constraints = {\ .name = (rname), \ @@ -55,67 +55,76 @@ .disabled = 0, \ }, \ },\ + .num_consumer_supplies = (num_consumers), \ + .consumer_supplies = (consumers), \ } -/* currently the suspend_mv field here takes no effects for DA9053 +/* CPU */ +static struct regulator_consumer_supply sw1_consumers[] = { + { + .supply = "cpu_vddgp", + } +}; + +/* OV5642 Camera */ +static struct regulator_consumer_supply ld07_consumers[] = { + { + .supply = "DA9052_LDO7", + } +}; + +static struct regulator_consumer_supply ld09_consumers[] = { + { + .supply = "DA9052_LDO9", + } +}; + +/* HDMI SII902x regulator */ +static struct regulator_consumer_supply ld02_consumers[] = { + { + .supply = "DA9052_LDO2", + } +}; + +/* currently the suspend_mv here takes no effects for DA9053 preset-voltage have to be done in the latest stage during suspend*/ static struct regulator_init_data da9052_regulators_init[] = { DA9052_LDO(DA9052_LDO1_VOLT_UPPER, - DA9052_LDO1_VOLT_LOWER, "DA9052_LDO1", 1300), + DA9052_LDO1_VOLT_LOWER, "DA9052_LDO1", 1300, 0, NULL), DA9052_LDO(DA9052_LDO2_VOLT_UPPER, - DA9052_LDO2_VOLT_LOWER, "DA9052_LDO2", 1300), + DA9052_LDO2_VOLT_LOWER, "DA9052_LDO2", 1300, + ARRAY_SIZE(ld02_consumers), ld02_consumers), DA9052_LDO(DA9052_LDO34_VOLT_UPPER, - DA9052_LDO34_VOLT_LOWER, "DA9052_LDO3", 3300), + DA9052_LDO34_VOLT_LOWER, "DA9052_LDO3", 3300, 0, NULL), DA9052_LDO(DA9052_LDO34_VOLT_UPPER, - DA9052_LDO34_VOLT_LOWER, "DA9052_LDO4", 2775), + DA9052_LDO34_VOLT_LOWER, "DA9052_LDO4", 2775, 0, NULL), DA9052_LDO(DA9052_LDO567810_VOLT_UPPER, - DA9052_LDO567810_VOLT_LOWER, "DA9052_LDO5", 1300), + DA9052_LDO567810_VOLT_LOWER, "DA9052_LDO5", 1300, 0, NULL), DA9052_LDO(DA9052_LDO567810_VOLT_UPPER, - DA9052_LDO567810_VOLT_LOWER, "DA9052_LDO6", 1200), + DA9052_LDO567810_VOLT_LOWER, "DA9052_LDO6", 1200, 0, NULL), DA9052_LDO(DA9052_LDO567810_VOLT_UPPER, - DA9052_LDO567810_VOLT_LOWER, "DA9052_LDO7", 2750), + DA9052_LDO567810_VOLT_LOWER, "DA9052_LDO7", 2750, + ARRAY_SIZE(ld07_consumers), ld07_consumers), DA9052_LDO(DA9052_LDO567810_VOLT_UPPER, - DA9052_LDO567810_VOLT_LOWER, "DA9052_LDO8", 1800), + DA9052_LDO567810_VOLT_LOWER, "DA9052_LDO8", 1800, 0, NULL), DA9052_LDO(DA9052_LDO9_VOLT_UPPER, - DA9052_LDO9_VOLT_LOWER, "DA9052_LDO9", 2500), + DA9052_LDO9_VOLT_LOWER, "DA9052_LDO9", 2500, + ARRAY_SIZE(ld09_consumers), ld09_consumers), DA9052_LDO(DA9052_LDO567810_VOLT_UPPER, - DA9052_LDO567810_VOLT_LOWER, "DA9052_LDO10", 1200), + DA9052_LDO567810_VOLT_LOWER, "DA9052_LDO10", 1200, 0, NULL), /* BUCKS */ DA9052_LDO(DA9052_BUCK_CORE_PRO_VOLT_UPPER, - DA9052_BUCK_CORE_PRO_VOLT_LOWER, "DA9052_BUCK_CORE", 850), + DA9052_BUCK_CORE_PRO_VOLT_LOWER, "DA9052_BUCK_CORE", 850, + ARRAY_SIZE(sw1_consumers), sw1_consumers), DA9052_LDO(DA9052_BUCK_CORE_PRO_VOLT_UPPER, - DA9052_BUCK_CORE_PRO_VOLT_LOWER, "DA9052_BUCK_PRO", 950), + DA9052_BUCK_CORE_PRO_VOLT_LOWER, "DA9052_BUCK_PRO", 950, + 0, NULL), DA9052_LDO(DA9052_BUCK_MEM_VOLT_UPPER, - DA9052_BUCK_MEM_VOLT_LOWER, "DA9052_BUCK_MEM", 1500), + DA9052_BUCK_MEM_VOLT_LOWER, "DA9052_BUCK_MEM", 1500, 0, NULL), DA9052_LDO(DA9052_BUCK_PERI_VOLT_UPPER, - DA9052_BUCK_PERI_VOLT_LOWER, "DA9052_BUCK_PERI", 2500) -}; - - -#define MX53_SMD_WiFi_BT_PWR_EN (2*32 + 10) /*GPIO_3_10 */ -struct regulator_init_data wifi_bt_reg_initdata = { - .constraints = { - .valid_ops_mask = REGULATOR_CHANGE_STATUS, - }, -}; - -static struct fixed_voltage_config wifi_bt_reg_config = { - .supply_name = "wifi_bt", - .microvolts = 3300000, - .gpio = MX53_SMD_WiFi_BT_PWR_EN, - .enable_high = 1, - .enabled_at_boot = 0, - .init_data = &wifi_bt_reg_initdata, -}; - -static struct platform_device wifi_bt_reg_device = { - .name = "reg-fixed-voltage", - .id = 0, - .dev = { - .platform_data = &wifi_bt_reg_config, - }, + DA9052_BUCK_PERI_VOLT_LOWER, "DA9052_BUCK_PERI", 2500, 0, NULL) }; #ifdef CONFIG_SND_SOC_SGTL5000 @@ -123,6 +132,7 @@ static struct platform_device wifi_bt_reg_device = { static struct regulator_consumer_supply sgtl5000_consumer[] = { REGULATOR_SUPPLY("VDDA", NULL), REGULATOR_SUPPLY("VDDIO", NULL), + REGULATOR_SUPPLY("VDDD", NULL), }; static struct regulator_init_data sgtl5000_reg_initdata = { @@ -150,6 +160,56 @@ static struct platform_device sgtl5000_reg_devices = { }; #endif /* CONFIG_SND_SOC_SGTL5000 */ +static struct regulator_consumer_supply mx53_smd_vmmc_consumers[] = { + REGULATOR_SUPPLY("vmmc", "sdhci-esdhc-imx.0"), + REGULATOR_SUPPLY("vmmc", "sdhci-esdhc-imx.1"), + REGULATOR_SUPPLY("vmmc", "sdhci-esdhc-imx.2"), +}; + +static struct regulator_init_data mx53_smd_vmmc_init = { + .num_consumer_supplies = ARRAY_SIZE(mx53_smd_vmmc_consumers), + .consumer_supplies = mx53_smd_vmmc_consumers, +}; + +static struct fixed_voltage_config mx53_smd_vmmc_reg_config = { + .supply_name = "vmmc", + .microvolts = 3300000, + .gpio = -1, + .init_data = &mx53_smd_vmmc_init, +}; + +static struct platform_device mx53_smd_vmmc_reg_devices = { + .name = "reg-fixed-voltage", + .id = 3, + .dev = { + .platform_data = &mx53_smd_vmmc_reg_config, + }, +}; + +static struct regulator_consumer_supply mx53_smd_cpu_vddvpu_consumers[] = { + REGULATOR_SUPPLY("cpu_vddvpu", NULL), +}; + +static struct regulator_init_data mx53_smd_cpu_vddvpu_init = { + .num_consumer_supplies = ARRAY_SIZE(mx53_smd_cpu_vddvpu_consumers), + .consumer_supplies = mx53_smd_cpu_vddvpu_consumers, +}; + +static struct fixed_voltage_config mx53_smd_cpu_vddvpu_reg_config = { + .supply_name = "cpu_vddvpu", + .microvolts = 3300000, + .gpio = -1, + .init_data = &mx53_smd_cpu_vddvpu_init, +}; + +static struct platform_device mx53_smd_cpu_vddvpu_reg_devices = { + .name = "reg-fixed-voltage", + .id = 2, + .dev = { + .platform_data = &mx53_smd_cpu_vddvpu_reg_config, + }, +}; + static struct da9052_tsi_platform_data da9052_tsi = { .pen_up_interval = 50, .tsi_delay_bit_shift = 6, @@ -179,6 +239,25 @@ static struct da9052_leds_platform_data da9052_gpio_leds = { }; +static struct da9052_bat_platform_data da9052_bat = { + .sw_temp_control_en = 0, + .monitoring_interval = 500, + .sw_bat_temp_threshold = 60, + .sw_junc_temp_threshold = 120, + .hysteresis_window_size = 1, + .current_monitoring_window = 10, + .bat_with_no_resistor = 62, + .bat_capacity_limit_low = 4, + .bat_capacity_full = 100, + .bat_capacity_limit_high = 70, + .chg_hysteresis_const = 89, + .hysteresis_reading_interval = 1000, + .hysteresis_no_of_reading = 10, + .filter_size = 4, + .bat_volt_cutoff = 2800, + .vbat_first_valid_detect_iteration = 3, +}; + static void da9052_init_ssc_cache(struct da9052 *da9052) { unsigned char cnt; @@ -278,15 +357,16 @@ static int __init smd_da9052_init(struct da9052 *da9052) { /* Configuring for DA9052 interrupt servce */ /* s3c_gpio_setpull(DA9052_IRQ_PIN, S3C_GPIO_PULL_UP);*/ - int ret; + /* Set interrupt as LOW LEVEL interrupt source */ - set_irq_type(gpio_to_irq(MX53_SMD_DA9052_IRQ), IRQF_TRIGGER_LOW); + irq_set_irq_type(gpio_to_irq(MX53_SMD_DA9052_IRQ), IRQF_TRIGGER_LOW); da9052_init_ssc_cache(da9052); #ifdef CONFIG_SND_SOC_SGTL5000 platform_device_register(&sgtl5000_reg_devices); #endif - ret = platform_device_register(&wifi_bt_reg_device); + platform_device_register(&mx53_smd_vmmc_reg_devices); + platform_device_register(&mx53_smd_cpu_vddvpu_reg_devices); return 0; } @@ -297,7 +377,7 @@ static struct da9052_platform_data __initdata da9052_plat = { .regulators = da9052_regulators_init, .led_data = &da9052_gpio_leds, .tsi_data = &da9052_tsi, - /* .bat_data = &da9052_bat, */ + .bat_data = &da9052_bat, /* .gpio_base = GPIO_BOARD_START, */ }; |