From patchwork Mon Feb 4 11:54:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 14517 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 3ED2C23F96 for ; Mon, 4 Feb 2013 11:58:07 +0000 (UTC) Received: from mail-vc0-f172.google.com (mail-vc0-f172.google.com [209.85.220.172]) by fiordland.canonical.com (Postfix) with ESMTP id C824CA19239 for ; Mon, 4 Feb 2013 11:58:06 +0000 (UTC) Received: by mail-vc0-f172.google.com with SMTP id l6so3811773vcl.31 for ; Mon, 04 Feb 2013 03:58:06 -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=VNPf+qavm0yotdyLN7259N4IhodTYdFN+1IaKCvb/8U=; b=dQuUFL8q5zTCBQvE0C3F5g0NQo6fzA/561ThvmTeP2Cx2005XzSTePorJjEEDcAOAV EIuF/nFaEM9j2SEBHot5J1owHJgbieovKF1pa/tu2Jl4EIh9VU3hcX23d7Jh7cBfu+xT YKnYsPp8FsDBC4f3LXB2K/Q2rTO7cZsf9njODitZ5i6ezY1+Qme4C/46b+LnyKRGVpuA xdVGy1RosmDcLsyDnk3t7k7OohM17Kbojp3luR2fYhV4y7T/VleRRX6wowTZFtlzSxRH g2GwnbKgwzk/kx63WFMpoXmhm+DnhWWfLjuMv+BJBfPsPiaGuWzHa+prNnmwxT9QP2vo mI8g== X-Received: by 10.52.66.168 with SMTP id g8mr19462699vdt.27.1359979086245; Mon, 04 Feb 2013 03:58:06 -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.58.252.8 with SMTP id zo8csp83143vec; Mon, 4 Feb 2013 03:58:05 -0800 (PST) X-Received: by 10.180.84.162 with SMTP id a2mr9825581wiz.14.1359979085156; Mon, 04 Feb 2013 03:58:05 -0800 (PST) Received: from mail-we0-x230.google.com ([2a00:1450:400c:c03::230]) by mx.google.com with ESMTPS id be9si5721985wjb.75.2013.02.04.03.58.04 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 04 Feb 2013 03:58:05 -0800 (PST) Received-SPF: neutral (google.com: 2a00:1450:400c:c03::230 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=2a00:1450:400c:c03::230; Authentication-Results: mx.google.com; spf=neutral (google.com: 2a00:1450:400c:c03::230 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-f176.google.com with SMTP id s43so4561355wey.21 for ; Mon, 04 Feb 2013 03:58:04 -0800 (PST) X-Received: by 10.194.71.244 with SMTP id y20mr34534621wju.19.1359979084735; Mon, 04 Feb 2013 03:58:04 -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 j9sm12937128wia.5.2013.02.04.03.58.03 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 04 Feb 2013 03:58:03 -0800 (PST) From: Lee Jones To: linux-kernel@vger.kernel.org, broonie@opensource.wolfsonmicro.com Cc: Lee Jones Subject: [PATCH 68/73] regulator: ab8500: Provide DT support for additional platforms Date: Mon, 4 Feb 2013 11:54:23 +0000 Message-Id: <1359978868-28736-69-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1359978868-28736-1-git-send-email-lee.jones@linaro.org> References: <1359978868-28736-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQmhzVEhnm+6h5aoDv4YV/4i0q4IttB3L7XA9DQpWI3mrulkedoBqy9r7UM1IrfbLxtkf4r3 Here we use the new infrastructure to 'match' to the correct platform when booing with Device Tree support enabled. Signed-off-by: Lee Jones --- drivers/regulator/ab8500.c | 76 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 59 insertions(+), 17 deletions(-) diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c index b6e8f4d..142c5fb 100644 --- a/drivers/regulator/ab8500.c +++ b/drivers/regulator/ab8500.c @@ -2850,6 +2850,8 @@ static struct { int info_size; struct ab8500_reg_init *init; int init_size; + struct of_regulator_match *match; + int match_size; } abx500_regulator; static int ab8500_regulator_init_registers(struct platform_device *pdev, @@ -2941,18 +2943,49 @@ static struct of_regulator_match ab8500_regulator_match[] = { { .name = "ab8500_ldo_ana", .driver_data = (void *) AB8500_LDO_ANA, }, }; +static struct of_regulator_match ab8505_regulator_match[] = { + { .name = "ab8500_ldo_aux1", .driver_data = (void *) AB8505_LDO_AUX1, }, + { .name = "ab8500_ldo_aux2", .driver_data = (void *) AB8505_LDO_AUX2, }, + { .name = "ab8500_ldo_aux3", .driver_data = (void *) AB8505_LDO_AUX3, }, + { .name = "ab8500_ldo_aux4", .driver_data = (void *) AB8505_LDO_AUX4, }, + { .name = "ab8500_ldo_aux5", .driver_data = (void *) AB8505_LDO_AUX5, }, + { .name = "ab8500_ldo_aux6", .driver_data = (void *) AB8505_LDO_AUX6, }, + { .name = "ab8500_ldo_intcore", .driver_data = (void *) AB8505_LDO_INTCORE, }, + { .name = "ab8500_ldo_adc", .driver_data = (void *) AB8505_LDO_ADC, }, + { .name = "ab8500_ldo_audio", .driver_data = (void *) AB8505_LDO_AUDIO, }, + { .name = "ab8500_ldo_anamic1", .driver_data = (void *) AB8505_LDO_ANAMIC1, }, + { .name = "ab8500_ldo_amamic2", .driver_data = (void *) AB8505_LDO_ANAMIC2, }, + { .name = "ab8500_ldo_aux8", .driver_data = (void *) AB8505_LDO_AUX8, }, + { .name = "ab8500_ldo_ana", .driver_data = (void *) AB8505_LDO_ANA, }, +}; + +static struct of_regulator_match ab8540_regulator_match[] = { + { .name = "ab8500_ldo_aux1", .driver_data = (void *) AB8540_LDO_AUX1, }, + { .name = "ab8500_ldo_aux2", .driver_data = (void *) AB8540_LDO_AUX2, }, + { .name = "ab8500_ldo_aux3", .driver_data = (void *) AB8540_LDO_AUX3, }, + { .name = "ab8500_ldo_aux4", .driver_data = (void *) AB8540_LDO_AUX4, }, + { .name = "ab8500_ldo_intcore", .driver_data = (void *) AB8540_LDO_INTCORE, }, + { .name = "ab8500_ldo_tvout", .driver_data = (void *) AB8540_LDO_TVOUT, }, + { .name = "ab8500_ldo_audio", .driver_data = (void *) AB8540_LDO_AUDIO, }, + { .name = "ab8500_ldo_anamic1", .driver_data = (void *) AB8540_LDO_ANAMIC1, }, + { .name = "ab8500_ldo_amamic2", .driver_data = (void *) AB8540_LDO_ANAMIC2, }, + { .name = "ab8500_ldo_dmic", .driver_data = (void *) AB8540_LDO_DMIC, }, + { .name = "ab8500_ldo_ana", .driver_data = (void *) AB8540_LDO_ANA, }, + { .name = "ab8500_ldo_sdio", .driver_data = (void *) AB8540_LDO_SDIO, }, +}; + static struct of_regulator_match ab9540_regulator_match[] = { - { .name = "ab9540_ldo_aux1", .driver_data = (void *) AB9540_LDO_AUX1, }, - { .name = "ab9540_ldo_aux2", .driver_data = (void *) AB9540_LDO_AUX2, }, - { .name = "ab9540_ldo_aux3", .driver_data = (void *) AB9540_LDO_AUX3, }, - { .name = "ab9540_ldo_intcore", .driver_data = (void *) AB9540_LDO_INTCORE, }, - { .name = "ab9540_ldo_tvout", .driver_data = (void *) AB9540_LDO_TVOUT, }, + { .name = "ab9540_ldo_aux1", .driver_data = (void *) AB9540_LDO_AUX1, }, + { .name = "ab9540_ldo_aux2", .driver_data = (void *) AB9540_LDO_AUX2, }, + { .name = "ab9540_ldo_aux3", .driver_data = (void *) AB9540_LDO_AUX3, }, + { .name = "ab9540_ldo_intcore", .driver_data = (void *) AB9540_LDO_INTCORE, }, + { .name = "ab9540_ldo_tvout", .driver_data = (void *) AB9540_LDO_TVOUT, }, { .name = "ab9540_ldo_usb", .driver_data = (void *) AB9540_LDO_USB, }, { .name = "ab9540_ldo_audio", .driver_data = (void *) AB9540_LDO_AUDIO, }, - { .name = "ab9540_ldo_anamic1", .driver_data = (void *) AB9540_LDO_ANAMIC1, }, - { .name = "ab9540_ldo_amamic2", .driver_data = (void *) AB9540_LDO_ANAMIC2, }, - { .name = "ab9540_ldo_dmic", .driver_data = (void *) AB9540_LDO_DMIC, }, - { .name = "ab9540_ldo_ana", .driver_data = (void *) AB9540_LDO_ANA, }, + { .name = "ab9540_ldo_anamic1", .driver_data = (void *) AB9540_LDO_ANAMIC1, }, + { .name = "ab9540_ldo_amamic2", .driver_data = (void *) AB9540_LDO_ANAMIC2, }, + { .name = "ab9540_ldo_dmic", .driver_data = (void *) AB9540_LDO_DMIC, }, + { .name = "ab9540_ldo_ana", .driver_data = (void *) AB9540_LDO_ANA, }, }; static void abx500_get_regulator_info(struct ab8500 *ab8500) @@ -2962,21 +2995,29 @@ static void abx500_get_regulator_info(struct ab8500 *ab8500) abx500_regulator.info_size = ARRAY_SIZE(ab9540_regulator_info); abx500_regulator.init = ab9540_reg_init; abx500_regulator.init_size = AB9540_NUM_REGULATOR_REGISTERS; + abx500_regulator.match = ab9540_regulator_match; + abx500_regulator.match_size = ARRAY_SIZE(ab9540_regulator_match); } else if (is_ab8505(ab8500)) { abx500_regulator.info = ab8505_regulator_info; abx500_regulator.info_size = ARRAY_SIZE(ab8505_regulator_info); abx500_regulator.init = ab8505_reg_init; abx500_regulator.init_size = AB8505_NUM_REGULATOR_REGISTERS; + abx500_regulator.match = ab8505_regulator_match; + abx500_regulator.match_size = ARRAY_SIZE(ab8505_regulator_match); } else if (is_ab8540(ab8500)) { abx500_regulator.info = ab8540_regulator_info; abx500_regulator.info_size = ARRAY_SIZE(ab8540_regulator_info); abx500_regulator.init = ab8540_reg_init; abx500_regulator.init_size = AB8540_NUM_REGULATOR_REGISTERS; + abx500_regulator.match = ab8540_regulator_match; + abx500_regulator.match_size = ARRAY_SIZE(ab8540_regulator_match); } else { abx500_regulator.info = ab8500_regulator_info; abx500_regulator.info_size = ARRAY_SIZE(ab8500_regulator_info); abx500_regulator.init = ab8500_reg_init; abx500_regulator.init_size = AB8500_NUM_REGULATOR_REGISTERS; + abx500_regulator.match = ab8500_regulator_match; + abx500_regulator.match_size = ARRAY_SIZE(ab8500_regulator_match); } } @@ -3004,29 +3045,30 @@ static int ab8500_regulator_probe(struct platform_device *pdev) struct ab8500_platform_data *ppdata; struct ab8500_regulator_platform_data *pdata; int i, err; - struct ab8500_reg_init *reg_init; /* cache values needed repeatedly inside for-loops */ + if (!ab8500) { + dev_err(&pdev->dev, "null mfd parent\n"); + return -EINVAL; + } + abx500_get_regulator_info(ab8500); if (np) { - err = of_regulator_match(&pdev->dev, np, match, match_size); + err = of_regulator_match(&pdev->dev, np, + abx500_regulator.match, + abx500_regulator.match_size); if (err < 0) { dev_err(&pdev->dev, "Error parsing regulator init data: %d\n", err); return err; } - err = ab8500_regulator_of_probe(pdev, match, np); + err = ab8500_regulator_of_probe(pdev, np); return err; } - if (!ab8500) { - dev_err(&pdev->dev, "null mfd parent\n"); - return -EINVAL; - } - ppdata = dev_get_platdata(ab8500->dev); if (!ppdata) { dev_err(&pdev->dev, "null parent pdata\n");