From patchwork Fri Feb 15 12:56:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 14895 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 1276023E01 for ; Fri, 15 Feb 2013 12:57:43 +0000 (UTC) Received: from mail-vb0-f48.google.com (mail-vb0-f48.google.com [209.85.212.48]) by fiordland.canonical.com (Postfix) with ESMTP id AAF07A18025 for ; Fri, 15 Feb 2013 12:57:42 +0000 (UTC) Received: by mail-vb0-f48.google.com with SMTP id fc21so2092372vbb.21 for ; Fri, 15 Feb 2013 04:57:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=JX84lmZkn9DT3zmVHDU7bT3K/yIKxI/kKomIbSK/qZE=; b=oxW/nLH4V6JYUEdUNGhP2uNM+ljgnro7G8uJg25kdM0GKh+pCLs1VESC+Wcl7bL6rt SRoqwkL5ALtbtOSDfL079imHckKQX0aeIT8JQnGy+QOQijakdsHu3ExqamVbvu3VnaWE 8fKLztbBJgVtPdJh3OXjQl8at9a5bg1gF7QJW5x31jwgYU/I4nPHv2VvWB4WATYFtzZo O+QCmaEPJyMzXBWeK5zuvAA+yXZ6lXfABs5uCbNP4v6phRlvquX3J2AfRJbFEiKhS48K MM4nVDnIKW8ghJY6xJQbtv13Fwc3Q4xI96dFi/MMeEr2Y0/1S2nJ/ncsn4zM+HqL5wtZ qaZg== X-Received: by 10.52.38.163 with SMTP id h3mr2670910vdk.35.1360933062197; Fri, 15 Feb 2013 04:57:42 -0800 (PST) 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.221.4.5 with SMTP id oa5csp11372vcb; Fri, 15 Feb 2013 04:57:41 -0800 (PST) X-Received: by 10.180.87.98 with SMTP id w2mr3895872wiz.30.1360933061277; Fri, 15 Feb 2013 04:57:41 -0800 (PST) Received: from mail-we0-x234.google.com ([2a00:1450:400c:c03::234]) by mx.google.com with ESMTPS id o12si1041196wiv.112.2013.02.15.04.57.40 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 15 Feb 2013 04:57:41 -0800 (PST) Received-SPF: neutral (google.com: 2a00:1450:400c:c03::234 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=2a00:1450:400c:c03::234; Authentication-Results: mx.google.com; spf=neutral (google.com: 2a00:1450:400c:c03::234 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) smtp.mail=lee.jones@linaro.org Received: by mail-we0-f180.google.com with SMTP id k14so2773215wer.39 for ; Fri, 15 Feb 2013 04:57:40 -0800 (PST) X-Received: by 10.194.121.38 with SMTP id lh6mr3610339wjb.27.1360933060861; Fri, 15 Feb 2013 04:57:40 -0800 (PST) Received: from localhost.localdomain (cpc34-aztw25-2-0-cust250.18-1.cable.virginmedia.com. [86.16.136.251]) by mx.google.com with ESMTPS id j4sm2852410wiz.10.2013.02.15.04.57.38 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 15 Feb 2013 04:57:39 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, sameo@linux.intel.com Cc: arnd@arndb.de, linus.walleij@stericsson.com, Lee Jones Subject: [PATCH 10/35] mfd: ab8500-core: Rework MFD sub-device initialisation structures Date: Fri, 15 Feb 2013 12:56:41 +0000 Message-Id: <1360933026-30325-11-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1360933026-30325-1-git-send-email-lee.jones@linaro.org> References: <1360933026-30325-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQmr8Wkrt58lK+yvzApnFjPXPmBgKde5Y4gmjFFxSx+3EjX3nNNKbAFXYt0FnbZGm+uWKfde Here we're separating Battery Management devices into their own structure, removing the common device structure & redistribute them amongst the individual platform structs and completing the population of them. Signed-off-by: Lee Jones --- drivers/mfd/ab8500-core.c | 257 +++++++++++++++++++++++++++++++++------------ 1 file changed, 189 insertions(+), 68 deletions(-) diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c index ecf570f..8af002c 100644 --- a/drivers/mfd/ab8500-core.c +++ b/drivers/mfd/ab8500-core.c @@ -604,7 +604,7 @@ static struct resource ab8500_gpadc_resources[] = { }, }; -static struct resource ab8540_gpadc_resources[] = { +static struct resource ab8505_gpadc_resources[] = { { .name = "SW_CONV_END", .start = AB8500_INT_GP_SW_ADC_CONV_END, @@ -941,7 +941,50 @@ static struct resource ab8500_temp_resources[] = { }, }; -static struct mfd_cell abx500_common_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", + .of_compatible = "stericsson,ab8500-btemp", + .num_resources = ARRAY_SIZE(ab8500_btemp_resources), + .resources = ab8500_btemp_resources, +#ifndef CONFIG_OF + .platform_data = &ab8500_bm_data, + .pdata_size = sizeof(ab8500_bm_data), +#endif + }, + { + .name = "ab8500-fg", + .of_compatible = "stericsson,ab8500-fg", + .num_resources = ARRAY_SIZE(ab8500_fg_resources), + .resources = ab8500_fg_resources, +#ifndef CONFIG_OF + .platform_data = &ab8500_bm_data, + .pdata_size = sizeof(ab8500_bm_data), +#endif + }, + { + .name = "ab8500-chargalg", + .of_compatible = "stericsson,ab8500-chargalg", + .num_resources = ARRAY_SIZE(ab8500_chargalg_resources), + .resources = ab8500_chargalg_resources, +#ifndef CONFIG_OF + .platform_data = &ab8500_bm_data, + .pdata_size = sizeof(ab8500_bm_data), +#endif + }, +}; + +static struct mfd_cell ab8500_devs[] = { #ifdef CONFIG_DEBUG_FS { .name = "ab8500-debug", @@ -963,6 +1006,11 @@ static struct mfd_cell abx500_common_devs[] = { .of_compatible = "stericsson,abx500-clk", }, { + .name = "ab8500-gpadc", + .num_resources = ARRAY_SIZE(ab8500_gpadc_resources), + .resources = ab8500_gpadc_resources, + }, + { .name = "ab8500-rtc", .of_compatible = "stericsson,ab8500-rtc", .num_resources = ARRAY_SIZE(ab8500_rtc_resources), @@ -975,6 +1023,7 @@ static struct mfd_cell abx500_common_devs[] = { .resources = ab8500_av_acc_detect_resources, }, { + .name = "ab8500-poweron-key", .of_compatible = "stericsson,ab8500-poweron-key", .num_resources = ARRAY_SIZE(ab8500_poweronkey_db_resources), @@ -1004,80 +1053,72 @@ static struct mfd_cell abx500_common_devs[] = { .of_compatible = "stericsson,ab8500-denc", }, { + .name = "ab8500-gpio", + .of_compatible = "stericsson,ab8500-gpio", + }, + { .name = "ab8500-temp", .of_compatible = "stericsson,ab8500-temp", .num_resources = ARRAY_SIZE(ab8500_temp_resources), .resources = ab8500_temp_resources, }, + { + .name = "ab8500-usb", + .num_resources = ARRAY_SIZE(ab8500_usb_resources), + .resources = ab8500_usb_resources, + }, + { + .name = "ab8500-codec", + }, }; -static struct mfd_cell ab8500_bm_devs[] = { +static struct mfd_cell ab9540_devs[] = { +#ifdef CONFIG_DEBUG_FS { - .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), + .name = "ab8500-debug", + .num_resources = ARRAY_SIZE(ab8500_debug_resources), + .resources = ab8500_debug_resources, + }, #endif + { + .name = "ab8500-sysctrl", }, { - .name = "ab8500-btemp", - .of_compatible = "stericsson,ab8500-btemp", - .num_resources = ARRAY_SIZE(ab8500_btemp_resources), - .resources = ab8500_btemp_resources, -#ifndef CONFIG_OF - .platform_data = &ab8500_bm_data, - .pdata_size = sizeof(ab8500_bm_data), -#endif + .name = "ab8500-regulator", }, { - .name = "ab8500-fg", - .of_compatible = "stericsson,ab8500-fg", - .num_resources = ARRAY_SIZE(ab8500_fg_resources), - .resources = ab8500_fg_resources, -#ifndef CONFIG_OF - .platform_data = &ab8500_bm_data, - .pdata_size = sizeof(ab8500_bm_data), -#endif + .name = "ab8500-gpadc", + .of_compatible = "stericsson,ab8500-gpadc", + .num_resources = ARRAY_SIZE(ab8500_gpadc_resources), + .resources = ab8500_gpadc_resources, }, { - .name = "ab8500-chargalg", - .of_compatible = "stericsson,ab8500-chargalg", - .num_resources = ARRAY_SIZE(ab8500_chargalg_resources), - .resources = ab8500_chargalg_resources, -#ifndef CONFIG_OF - .platform_data = &ab8500_bm_data, - .pdata_size = sizeof(ab8500_bm_data), -#endif + .name = "ab8500-rtc", + .num_resources = ARRAY_SIZE(ab8500_rtc_resources), + .resources = ab8500_rtc_resources, }, -}; - -static struct mfd_cell ab8500_devs[] = { { - .name = "ab8500-gpio", - .of_compatible = "stericsson,ab8500-gpio", + .name = "ab8500-acc-det", + .num_resources = ARRAY_SIZE(ab8500_av_acc_detect_resources), + .resources = ab8500_av_acc_detect_resources, }, { - .name = "ab8500-usb", - .of_compatible = "stericsson,ab8500-usb", - .num_resources = ARRAY_SIZE(ab8500_usb_resources), - .resources = ab8500_usb_resources, + .name = "ab8500-poweron-key", + .num_resources = ARRAY_SIZE(ab8500_poweronkey_db_resources), + .resources = ab8500_poweronkey_db_resources, }, { - .name = "ab8500-codec", - .of_compatible = "stericsson,ab8500-codec", + .name = "ab8500-pwm", + .id = 1, }, { - .name = "ab8500-gpadc", - .of_compatible = "stericsson,ab8500-gpadc", - .num_resources = ARRAY_SIZE(ab8500_gpadc_resources), - .resources = ab8500_gpadc_resources, + .name = "ab8500-leds", + }, + { + .name = "abx500-temp", + .num_resources = ARRAY_SIZE(ab8500_temp_resources), + .resources = ab8500_temp_resources, }, -}; - -static struct mfd_cell ab9540_devs[] = { { .name = "ab8500-gpio", }, @@ -1090,11 +1131,6 @@ static struct mfd_cell ab9540_devs[] = { .name = "ab9540-codec", }, { - .name = "ab8500-gpadc", - .num_resources = ARRAY_SIZE(ab8500_gpadc_resources), - .resources = ab8500_gpadc_resources, - }, - { .name = "ab-iddet", .num_resources = ARRAY_SIZE(ab8505_iddet_resources), .resources = ab8505_iddet_resources, @@ -1103,6 +1139,57 @@ static struct mfd_cell ab9540_devs[] = { /* Device list for ab8505 */ static struct mfd_cell ab8505_devs[] = { +#ifdef CONFIG_DEBUG_FS + { + .name = "ab8500-debug", + .num_resources = ARRAY_SIZE(ab8500_debug_resources), + .resources = ab8500_debug_resources, + }, +#endif + { + .name = "ab8500-sysctrl", + }, + { + .name = "ab8500-regulator", + }, + { + .name = "ab8500-gpadc", + .num_resources = ARRAY_SIZE(ab8505_gpadc_resources), + .resources = ab8505_gpadc_resources, + }, + { + .name = "ab8500-rtc", + .num_resources = ARRAY_SIZE(ab8500_rtc_resources), + .resources = ab8500_rtc_resources, + }, + { + .name = "ab8500-acc-det", + .num_resources = ARRAY_SIZE(ab8500_av_acc_detect_resources), + .resources = ab8500_av_acc_detect_resources, + }, + { + .name = "ab8500-poweron-key", + .num_resources = ARRAY_SIZE(ab8500_poweronkey_db_resources), + .resources = ab8500_poweronkey_db_resources, + }, + { + .name = "ab8500-pwm", + .id = 1, + }, + { + .name = "ab8500-leds", + }, + { + .name = "ab8500-gpio", + }, + { + .name = "ab8500-usb", + .num_resources = ARRAY_SIZE(ab8500_usb_resources), + .resources = ab8500_usb_resources, + }, + { + .name = "ab8500-codec", + }, { .name = "ab-iddet", .num_resources = ARRAY_SIZE(ab8505_iddet_resources), @@ -1111,6 +1198,51 @@ static struct mfd_cell ab8505_devs[] = { }; static struct mfd_cell ab8540_devs[] = { +#ifdef CONFIG_DEBUG_FS + { + .name = "ab8500-debug", + .num_resources = ARRAY_SIZE(ab8500_debug_resources), + .resources = ab8500_debug_resources, + }, +#endif + { + .name = "ab8500-sysctrl", + }, + { + .name = "ab8500-regulator", + }, + { + .name = "ab8500-gpadc", + .num_resources = ARRAY_SIZE(ab8505_gpadc_resources), + .resources = ab8505_gpadc_resources, + }, + { + .name = "ab8500-rtc", + .num_resources = ARRAY_SIZE(ab8500_rtc_resources), + .resources = ab8500_rtc_resources, + }, + { + .name = "ab8500-acc-det", + .num_resources = ARRAY_SIZE(ab8500_av_acc_detect_resources), + .resources = ab8500_av_acc_detect_resources, + }, + { + .name = "ab8500-poweron-key", + .num_resources = ARRAY_SIZE(ab8500_poweronkey_db_resources), + .resources = ab8500_poweronkey_db_resources, + }, + { + .name = "ab8500-pwm", + .id = 1, + }, + { + .name = "ab8500-leds", + }, + { + .name = "abx500-temp", + .num_resources = ARRAY_SIZE(ab8500_temp_resources), + .resources = ab8500_temp_resources, + }, { .name = "ab8500-gpio", }, @@ -1123,11 +1255,6 @@ static struct mfd_cell ab8540_devs[] = { .name = "ab8540-codec", }, { - .name = "ab8500-gpadc", - .num_resources = ARRAY_SIZE(ab8540_gpadc_resources), - .resources = ab8540_gpadc_resources, - }, - { .name = "ab-iddet", .num_resources = ARRAY_SIZE(ab8505_iddet_resources), .resources = ab8505_iddet_resources, @@ -1449,12 +1576,6 @@ static int ab8500_probe(struct platform_device *pdev) return ret; } - ret = mfd_add_devices(ab8500->dev, 0, abx500_common_devs, - ARRAY_SIZE(abx500_common_devs), NULL, - ab8500->irq_base, ab8500->domain); - if (ret) - return ret; - if (is_ab9540(ab8500)) ret = mfd_add_devices(ab8500->dev, 0, ab9540_devs, ARRAY_SIZE(ab9540_devs), NULL,