From: Anton Vorontsov Date: Wed, 12 Dec 2012 06:15:57 +0000 (-0800) Subject: Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux X-Git-Tag: v3.8-rc1~50^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=76d8a23b127020472207b281427d3e9f4f1227e4;p=platform%2Fupstream%2Fkernel-adaptation-pc.git Merge git://git./linux/kernel/git/torvalds/linux The merge is merely to fix conflicts before sending a pull request. Conflicts: drivers/power/ab8500_btemp.c drivers/power/ab8500_charger.c drivers/power/ab8500_fg.c drivers/power/abx500_chargalg.c drivers/power/max8925_power.c Signed-off-by: Anton Vorontsov --- 76d8a23b127020472207b281427d3e9f4f1227e4 diff --cc drivers/mfd/ab8500-core.c index 5ec70f2,127b00a..908d09b --- a/drivers/mfd/ab8500-core.c +++ b/drivers/mfd/ab8500-core.c @@@ -1038,16 -1038,11 +1038,16 @@@ static struct mfd_cell abx500_common_de }, }; - static struct mfd_cell __devinitdata ab8500_bm_devs[] = { + static struct mfd_cell ab8500_bm_devs[] = { { .name = "ab8500-charger", + .of_compatible = "stericsson,ab8500-charger", .num_resources = ARRAY_SIZE(ab8500_charger_resources), .resources = ab8500_charger_resources, +#ifndef CONFIG_OF + .platform_data = &ab8500_bm_data, + .pdata_size = sizeof(ab8500_bm_data), +#endif }, { .name = "ab8500-btemp", diff --cc drivers/power/ab8500_btemp.c index 8135542,989b099..20e2a7d --- a/drivers/power/ab8500_btemp.c +++ b/drivers/power/ab8500_btemp.c @@@ -959,39 -960,21 +959,39 @@@ static int ab8500_btemp_remove(struct p return 0; } +static char *supply_interface[] = { + "ab8500_chargalg", + "ab8500_fg", +}; + - static int __devinit ab8500_btemp_probe(struct platform_device *pdev) + static int ab8500_btemp_probe(struct platform_device *pdev) { + struct device_node *np = pdev->dev.of_node; + struct ab8500_btemp *di; int irq, i, ret = 0; u8 val; - struct abx500_bm_plat_data *plat_data = pdev->dev.platform_data; - struct ab8500_btemp *di; - - if (!plat_data) { - dev_err(&pdev->dev, "No platform data\n"); - return -EINVAL; - } - di = kzalloc(sizeof(*di), GFP_KERNEL); - if (!di) + di = devm_kzalloc(&pdev->dev, sizeof(*di), GFP_KERNEL); + if (!di) { + dev_err(&pdev->dev, "%s no mem for ab8500_btemp\n", __func__); return -ENOMEM; + } + di->bat = pdev->mfd_cell->platform_data; + if (!di->bat) { + if (np) { + ret = bmdevs_of_probe(&pdev->dev, np, &di->bat); + if (ret) { + dev_err(&pdev->dev, + "failed to get battery information\n"); + return ret; + } + } else { + dev_err(&pdev->dev, "missing dt node for ab8500_btemp\n"); + return -EINVAL; + } + } else { + dev_info(&pdev->dev, "falling back to legacy platform data\n"); + } /* get parent data */ di->dev = &pdev->dev; @@@ -1096,14 -1096,12 +1096,14 @@@ free_btemp_wq return ret; } +static const struct of_device_id ab8500_btemp_match[] = { + { .compatible = "stericsson,ab8500-btemp", }, + { }, +}; + static struct platform_driver ab8500_btemp_driver = { .probe = ab8500_btemp_probe, - .remove = __devexit_p(ab8500_btemp_remove), + .remove = ab8500_btemp_remove, .suspend = ab8500_btemp_suspend, .resume = ab8500_btemp_resume, .driver = { diff --cc drivers/power/ab8500_charger.c index dddc947,7ecb8ab..3be9c0e --- a/drivers/power/ab8500_charger.c +++ b/drivers/power/ab8500_charger.c @@@ -2532,41 -2531,20 +2532,41 @@@ static int ab8500_charger_remove(struc return 0; } +static char *supply_interface[] = { + "ab8500_chargalg", + "ab8500_fg", + "ab8500_btemp", +}; + - static int __devinit ab8500_charger_probe(struct platform_device *pdev) + static int ab8500_charger_probe(struct platform_device *pdev) { - int irq, i, charger_status, ret = 0; - struct abx500_bm_plat_data *plat_data = pdev->dev.platform_data; + struct device_node *np = pdev->dev.of_node; struct ab8500_charger *di; + int irq, i, charger_status, ret = 0; - if (!plat_data) { - dev_err(&pdev->dev, "No platform data\n"); - return -EINVAL; - } - - di = kzalloc(sizeof(*di), GFP_KERNEL); - if (!di) + di = devm_kzalloc(&pdev->dev, sizeof(*di), GFP_KERNEL); + if (!di) { + dev_err(&pdev->dev, "%s no mem for ab8500_charger\n", __func__); return -ENOMEM; + } + di->bat = pdev->mfd_cell->platform_data; + if (!di->bat) { + if (np) { + ret = bmdevs_of_probe(&pdev->dev, np, &di->bat); + if (ret) { + dev_err(&pdev->dev, + "failed to get battery information\n"); + return ret; + } + di->autopower_cfg = of_property_read_bool(np, "autopower_cfg"); + } else { + dev_err(&pdev->dev, "missing dt node for ab8500_charger\n"); + return -EINVAL; + } + } else { + dev_info(&pdev->dev, "falling back to legacy platform data\n"); + di->autopower_cfg = false; + } /* get parent data */ di->dev = &pdev->dev; @@@ -2765,14 -2760,12 +2765,14 @@@ free_charger_wq return ret; } +static const struct of_device_id ab8500_charger_match[] = { + { .compatible = "stericsson,ab8500-charger", }, + { }, +}; + static struct platform_driver ab8500_charger_driver = { .probe = ab8500_charger_probe, - .remove = __devexit_p(ab8500_charger_remove), + .remove = ab8500_charger_remove, .suspend = ab8500_charger_suspend, .resume = ab8500_charger_resume, .driver = { diff --cc drivers/power/ab8500_fg.c index ed62ef7,331dc43..b3bf178 --- a/drivers/power/ab8500_fg.c +++ b/drivers/power/ab8500_fg.c @@@ -2440,39 -2442,21 +2440,39 @@@ static struct ab8500_fg_interrupts ab85 {"CCEOC", ab8500_fg_cc_data_end_handler}, }; +static char *supply_interface[] = { + "ab8500_chargalg", + "ab8500_usb", +}; + - static int __devinit ab8500_fg_probe(struct platform_device *pdev) + static int ab8500_fg_probe(struct platform_device *pdev) { + struct device_node *np = pdev->dev.of_node; + struct ab8500_fg *di; int i, irq; int ret = 0; - struct abx500_bm_plat_data *plat_data = pdev->dev.platform_data; - struct ab8500_fg *di; - - if (!plat_data) { - dev_err(&pdev->dev, "No platform data\n"); - return -EINVAL; - } - di = kzalloc(sizeof(*di), GFP_KERNEL); - if (!di) + di = devm_kzalloc(&pdev->dev, sizeof(*di), GFP_KERNEL); + if (!di) { + dev_err(&pdev->dev, "%s no mem for ab8500_fg\n", __func__); return -ENOMEM; + } + di->bat = pdev->mfd_cell->platform_data; + if (!di->bat) { + if (np) { + ret = bmdevs_of_probe(&pdev->dev, np, &di->bat); + if (ret) { + dev_err(&pdev->dev, + "failed to get battery information\n"); + return ret; + } + } else { + dev_err(&pdev->dev, "missing dt node for ab8500_fg\n"); + return -EINVAL; + } + } else { + dev_info(&pdev->dev, "falling back to legacy platform data\n"); + } mutex_init(&di->cc_lock); @@@ -2608,14 -2609,12 +2608,14 @@@ free_inst_curr_wq return ret; } +static const struct of_device_id ab8500_fg_match[] = { + { .compatible = "stericsson,ab8500-fg", }, + { }, +}; + static struct platform_driver ab8500_fg_driver = { .probe = ab8500_fg_probe, - .remove = __devexit_p(ab8500_fg_remove), + .remove = ab8500_fg_remove, .suspend = ab8500_fg_suspend, .resume = ab8500_fg_resume, .driver = { diff --cc drivers/power/abx500_chargalg.c index dcdc439,19f2541..2970891 --- a/drivers/power/abx500_chargalg.c +++ b/drivers/power/abx500_chargalg.c @@@ -1799,37 -1800,15 +1799,37 @@@ static int abx500_chargalg_remove(struc return 0; } +static char *supply_interface[] = { + "ab8500_fg", +}; + - static int __devinit abx500_chargalg_probe(struct platform_device *pdev) + static int abx500_chargalg_probe(struct platform_device *pdev) { - struct abx500_bm_plat_data *plat_data; + struct device_node *np = pdev->dev.of_node; + struct abx500_chargalg *di; int ret = 0; - struct abx500_chargalg *di = - kzalloc(sizeof(struct abx500_chargalg), GFP_KERNEL); - if (!di) + di = devm_kzalloc(&pdev->dev, sizeof(*di), GFP_KERNEL); + if (!di) { + dev_err(&pdev->dev, "%s no mem for ab8500_chargalg\n", __func__); return -ENOMEM; + } + di->bat = pdev->mfd_cell->platform_data; + if (!di->bat) { + if (np) { + ret = bmdevs_of_probe(&pdev->dev, np, &di->bat); + if (ret) { + dev_err(&pdev->dev, + "failed to get battery information\n"); + return ret; + } + } else { + dev_err(&pdev->dev, "missing dt node for ab8500_chargalg\n"); + return -EINVAL; + } + } else { + dev_info(&pdev->dev, "falling back to legacy platform data\n"); + } /* get device struct */ di->dev = &pdev->dev; @@@ -1905,14 -1888,12 +1905,14 @@@ free_chargalg_wq return ret; } +static const struct of_device_id ab8500_chargalg_match[] = { + { .compatible = "stericsson,ab8500-chargalg", }, + { }, +}; + static struct platform_driver abx500_chargalg_driver = { .probe = abx500_chargalg_probe, - .remove = __devexit_p(abx500_chargalg_remove), + .remove = abx500_chargalg_remove, .suspend = abx500_chargalg_suspend, .resume = abx500_chargalg_resume, .driver = { diff --cc drivers/power/max8925_power.c index b5a3ccb,1a075f1..665cdc7 --- a/drivers/power/max8925_power.c +++ b/drivers/power/max8925_power.c @@@ -427,55 -426,7 +427,55 @@@ static int max8925_deinit_charger(struc return 0; } +#ifdef CONFIG_OF +static struct max8925_power_pdata * +max8925_power_dt_init(struct platform_device *pdev) +{ + struct device_node *nproot = pdev->dev.parent->of_node; + struct device_node *np; + int batt_detect; + int topoff_threshold; + int fast_charge; + int no_temp_support; + int no_insert_detect; + struct max8925_power_pdata *pdata; + + if (!nproot) + return pdev->dev.platform_data; + + np = of_find_node_by_name(nproot, "charger"); + if (!np) { + dev_err(&pdev->dev, "failed to find charger node\n"); + return NULL; + } + + pdata = devm_kzalloc(&pdev->dev, + sizeof(struct max8925_power_pdata), + GFP_KERNEL); + + of_property_read_u32(np, "topoff-threshold", &topoff_threshold); + of_property_read_u32(np, "batt-detect", &batt_detect); + of_property_read_u32(np, "fast-charge", &fast_charge); + of_property_read_u32(np, "no-insert-detect", &no_insert_detect); + of_property_read_u32(np, "no-temp-support", &no_temp_support); + + pdata->batt_detect = batt_detect; + pdata->fast_charge = fast_charge; + pdata->topoff_threshold = topoff_threshold; + pdata->no_insert_detect = no_insert_detect; + pdata->no_temp_support = no_temp_support; + + return pdata; +} +#else +static struct max8925_power_pdata * +max8925_power_dt_init(struct platform_device *pdev) +{ + return pdev->dev.platform_data; +} +#endif + - static __devinit int max8925_power_probe(struct platform_device *pdev) + static int max8925_power_probe(struct platform_device *pdev) { struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent); struct max8925_power_pdata *pdata = NULL;