From patchwork Thu Sep 27 20:08:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11777 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 1008524140 for ; Thu, 27 Sep 2012 20:09:27 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id B6777A18B57 for ; Thu, 27 Sep 2012 20:09:26 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so5234801iej.11 for ; Thu, 27 Sep 2012 13:09:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=Kgtc0mm3m4415+TNNohOarL4nygPbeGmzntmpOLU3y4=; b=J7ZEPgXoxNNqUJ4U8UQ5Ecaf+/AudD7RhqPuDn3Rk35CyOMchpmXaNhN2/FdstG+bg 0hDG2HxLd6HijNXoM7e+TmgJf0X/hDq8pTTXlsgzITHziO6NprNIawVkhoT7+1gNAG+A pEuoHSVf4ulzIBDpZFyfjG3oGgD6pZiMvMP/i77Gk2apCmpPRakZZrVlM2pkmvxz3mcF 6qNFf0OiGElAex0E3xAyfoZvl00q+Ma61g6ruJE9G6qCQnboHqYpqejSC+pO934DefrU YXT/1/Qv0gmJ84l29/ZUo7/9v0sTK4MRzMoFmSGcLLh1SvNnFGFN6sPb4tQsVPnlrsjm kWdQ== Received: by 10.50.184.129 with SMTP id eu1mr4759076igc.0.1348776566523; Thu, 27 Sep 2012 13:09:26 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.232 with SMTP id ex8csp436266igc; Thu, 27 Sep 2012 13:09:26 -0700 (PDT) Received: by 10.68.197.70 with SMTP id is6mr14380387pbc.64.1348776565817; Thu, 27 Sep 2012 13:09:25 -0700 (PDT) Received: from mail-da0-f50.google.com (mail-da0-f50.google.com [209.85.210.50]) by mx.google.com with ESMTPS id rl8si8335122pbc.292.2012.09.27.13.09.25 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 27 Sep 2012 13:09:25 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.210.50 is neither permitted nor denied by best guess record for domain of mathieu.poirier@linaro.org) client-ip=209.85.210.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.210.50 is neither permitted nor denied by best guess record for domain of mathieu.poirier@linaro.org) smtp.mail=mathieu.poirier@linaro.org Received: by daez20 with SMTP id z20so544796dae.37 for ; Thu, 27 Sep 2012 13:09:25 -0700 (PDT) Received: by 10.66.74.196 with SMTP id w4mr12149330pav.32.1348776565545; Thu, 27 Sep 2012 13:09:25 -0700 (PDT) Received: from localhost.localdomain (S0106002369de4dac.cg.shawcable.net. [70.73.24.112]) by mx.google.com with ESMTPS id sa2sm1587890pbc.4.2012.09.27.13.09.24 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 27 Sep 2012 13:09:24 -0700 (PDT) From: mathieu.poirier@linaro.org To: patches@linaro.org Subject: [PATCH 04/57] power: ab8500: bm: movimg back to ab8500 platform data managment Date: Thu, 27 Sep 2012 14:08:21 -0600 Message-Id: <1348776554-10019-5-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1348776554-10019-1-git-send-email-mathieu.poirier@linaro.org> References: <1348776554-10019-1-git-send-email-mathieu.poirier@linaro.org> X-Gm-Message-State: ALoCoQkF/hEMa/MqREKFq11OZTylE96ay8RWjkCVAzra16CgBAWWTSKlz4gK9NHEGT0/86yH2xlG From: Philippe Langlais Signed-off-by: Philippe Langlais Signed-off-by: Mathieu Poirier --- drivers/power/ab8500_btemp.c | 8 ++------ drivers/power/ab8500_charger.c | 9 +++------ drivers/power/ab8500_fg.c | 8 ++------ drivers/power/abx500_chargalg.c | 7 ++++--- include/linux/mfd/abx500/ab8500.h | 7 ++++++- 5 files changed, 17 insertions(+), 22 deletions(-) diff --git a/drivers/power/ab8500_btemp.c b/drivers/power/ab8500_btemp.c index 94a3ee8..41a8ce4 100644 --- a/drivers/power/ab8500_btemp.c +++ b/drivers/power/ab8500_btemp.c @@ -973,14 +973,9 @@ static int __devinit ab8500_btemp_probe(struct platform_device *pdev) { int irq, i, ret = 0; u8 val; - struct abx500_bm_plat_data *plat_data = pdev->dev.platform_data; + struct ab8500_platform_data *plat_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) return -ENOMEM; @@ -993,6 +988,7 @@ static int __devinit ab8500_btemp_probe(struct platform_device *pdev) di->initialized = false; /* get btemp specific platform data */ + plat_data = dev_get_platdata(di->parent->dev); di->pdata = plat_data->btemp; if (!di->pdata) { dev_err(di->dev, "no btemp platform data supplied\n"); diff --git a/drivers/power/ab8500_charger.c b/drivers/power/ab8500_charger.c index 3ceb788..22076f5 100644 --- a/drivers/power/ab8500_charger.c +++ b/drivers/power/ab8500_charger.c @@ -2628,14 +2628,9 @@ static int __devexit ab8500_charger_remove(struct platform_device *pdev) static int __devinit 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 ab8500_platform_data *plat_data; struct ab8500_charger *di; - if (!plat_data) { - dev_err(&pdev->dev, "No platform data\n"); - return -EINVAL; - } - di = kzalloc(sizeof(*di), GFP_KERNEL); if (!di) return -ENOMEM; @@ -2649,6 +2644,8 @@ static int __devinit ab8500_charger_probe(struct platform_device *pdev) spin_lock_init(&di->usb_state.usb_lock); /* get charger specific platform data */ + plat_data = dev_get_platdata(di->parent->dev); + di->pdata = plat_data->charger; if (!di->pdata) { dev_err(di->dev, "no charger platform data supplied\n"); diff --git a/drivers/power/ab8500_fg.c b/drivers/power/ab8500_fg.c index af792a8..c098ddd 100644 --- a/drivers/power/ab8500_fg.c +++ b/drivers/power/ab8500_fg.c @@ -2446,14 +2446,9 @@ static int __devinit ab8500_fg_probe(struct platform_device *pdev) { int i, irq; int ret = 0; - struct abx500_bm_plat_data *plat_data = pdev->dev.platform_data; + struct ab8500_platform_data *plat_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) return -ENOMEM; @@ -2466,6 +2461,7 @@ static int __devinit ab8500_fg_probe(struct platform_device *pdev) di->gpadc = ab8500_gpadc_get("ab8500-gpadc.0"); /* get fg specific platform data */ + plat_data = dev_get_platdata(di->parent->dev); di->pdata = plat_data->fg; if (!di->pdata) { dev_err(di->dev, "no fg platform data supplied\n"); diff --git a/drivers/power/abx500_chargalg.c b/drivers/power/abx500_chargalg.c index 804b88c..032b27d 100644 --- a/drivers/power/abx500_chargalg.c +++ b/drivers/power/abx500_chargalg.c @@ -220,6 +220,7 @@ enum maxim_ret { */ struct abx500_chargalg { struct device *dev; + struct ab8500 *parent; int charge_status; int eoc_cnt; int rch_cnt; @@ -1802,7 +1803,7 @@ static int __devexit abx500_chargalg_remove(struct platform_device *pdev) static int __devinit abx500_chargalg_probe(struct platform_device *pdev) { - struct abx500_bm_plat_data *plat_data; + struct ab8500_platform_data *plat_data; int ret = 0; struct abx500_chargalg *di = @@ -1812,8 +1813,8 @@ static int __devinit abx500_chargalg_probe(struct platform_device *pdev) /* get device struct */ di->dev = &pdev->dev; - - plat_data = pdev->dev.platform_data; + di->parent = dev_get_drvdata(pdev->dev.parent); + plat_data = dev_get_platdata(di->parent->dev); di->pdata = plat_data->chargalg; di->bat = plat_data->battery; diff --git a/include/linux/mfd/abx500/ab8500.h b/include/linux/mfd/abx500/ab8500.h index 3764cb6..db8a1e3 100644 --- a/include/linux/mfd/abx500/ab8500.h +++ b/include/linux/mfd/abx500/ab8500.h @@ -170,7 +170,7 @@ enum ab8500_version { #define AB8500_INT_ID_DET_R2F 99 #define AB8500_INT_ID_DET_R3F 100 #define AB8500_INT_ID_DET_R4F 101 -#define AB8500_INT_CHAUTORESTARTAFTSEC 102 +#define AB8500_INT_CHAUTORESTARTAFTSEC 102 #define AB8500_INT_CHSTOPBYSEC 103 /* ab8500_irq_regoffset[13] -> IT[Source|Latch|Mask]22 */ #define AB8500_INT_USB_CH_TH_PROT_F 104 @@ -289,6 +289,11 @@ struct ab8500_platform_data { struct regulator_init_data *regulator; struct ab8500_gpio_platform_data *gpio; struct ab8500_codec_platform_data *codec; + struct abx500_bm_data *battery; + struct abx500_charger_platform_data *charger; + struct abx500_btemp_platform_data *btemp; + struct abx500_fg_platform_data *fg; + struct abx500_chargalg_platform_data *chargalg; }; extern int __devinit ab8500_init(struct ab8500 *ab8500,