Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp729429imm; Wed, 23 May 2018 04:46:06 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpHCsOCYK0NE1lrcOqLQV+mK4SNmzHmD2vnNwpaA89n1dsceGXZ8Mgipqe09CG6xi4xtgix X-Received: by 2002:a63:84c6:: with SMTP id k189-v6mr2109558pgd.49.1527075966253; Wed, 23 May 2018 04:46:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527075966; cv=none; d=google.com; s=arc-20160816; b=y3Qlj8NMFqPyMn1HEu/9ws4igBZfMRMMJj8swqeJcq5iibcZYZFQ2DKKxkHk0rWTOx NN6ls8yeFaWRilOqhdYLlzr7LOLiaj0b0NmvMVxInPlrlRv//UNe2hwpvkzPHG1pwZKl kmfdAfMuF9Py/ZDPEI7gpu7qmP8osUtMAuUVkTxudczgRwSv4yEbb4Ts8v6hSZw/ucjF ekWvp/dxV6IBE3eJSyU//gjGrFHiVB0ZE6iFr7PxPKVi51XcIA8i3C8ORauG+QWL2RCG 0WrA0LRRlOLEuSV61Eq4xM0WBOFp84bB1Zd5YRjYFuFZtKCs8mBz7+/+1feAHr8mL86r 0vAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=OCkFVS3ThUCJ6GIfULxqW5ftZzdEsZZ2Ghrpq2a5Phk=; b=LdTFvkRSjIt4hhYm1p3e64aVDeqYzG3VYllbXcuebbHmjF3DEwwaouNYpDdiPyTLTa xxL5d3EstmvgU47DUOfvdmsXb2kcmS7726vmSH9F9GyrZCXn4xoJ1rpc6EHYY8tFOWMS FCyB7txzH+sgY8qnEpCJNiuIh3f29ZyAojODn95fIxyxiKXHzrc+wB3riCLI1NjGrPIB lW8kr7kbaLHAro9/9L0LqVrFWtP1KYZbT9SFySu+WKpDpOT5TcVIABCcySiZL8qCwssC h1MM/A5V1JbQ1K6xsBR5NRiAnG6ZN89VWlSq3+QQgmvDU+Ty7OUxPrmwXyCKbQIm7/of //2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=b2gVbyk6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d90-v6si18776498pld.92.2018.05.23.04.45.51; Wed, 23 May 2018 04:46:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=b2gVbyk6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932757AbeEWLnx (ORCPT + 99 others); Wed, 23 May 2018 07:43:53 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:35172 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932663AbeEWLm6 (ORCPT ); Wed, 23 May 2018 07:42:58 -0400 Received: by mail-wm0-f66.google.com with SMTP id o78-v6so8389443wmg.0; Wed, 23 May 2018 04:42:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=OCkFVS3ThUCJ6GIfULxqW5ftZzdEsZZ2Ghrpq2a5Phk=; b=b2gVbyk6NuSN/x81W/WkIQUe3/DWa8RxjkJR5lB6iQ2LbaULJvMYUvD/yyVSH2i3M3 DQqZCmCsG1zJqbwIYvG7dpHkSy8AYrM0YbtUy7DY1Ln19ch8HAQ5cNMlZT8fbtEUJ2Km UKo5HpeGdhOYFroY/w+4jyO0BiQj5yS2CzN7IQF3JTTd9Yw6hnzpSkVVqRfhqtasRB4M 7Jx696bhgss6QamwdG6GYBpnf9vQBS3xAEz5OKAQ/h6x6j6qha4Z34cI2YCvyq80Uqjl PBoCqbh6y8eQIy6c1NkxI5BqMAIvw/Jqt+WYEnJmng7k1emlTc9BLh0NAZQsd0D7jU51 CI+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=OCkFVS3ThUCJ6GIfULxqW5ftZzdEsZZ2Ghrpq2a5Phk=; b=RzYcF56cDEvsIytzLe1vxukCPpZq7AodXu7Cy9JjY54OPwhsUbTDHUZmS2XkBRk+lB j1pp/f0NNa1C3g8tvBTZP1Gtfg7fa/6bSU+bLJUvo1y8RD/aa3mH02dMhdQ1IZ0v3oHX OUU2i+S8Yx4tuSij3oUAMWGzLmVq22BKbghJ/Bdw8G+jka7t2B+AqDX0rN5/kvLBJybM erw61EuNh+8+D8T0oVJG6hWfHQqeGxjVOZ/ODtRCLVMaf/WV9XznI5gpSDWAoYdvWU1W 0XdP/4pYyjPxR8viJjEifhAUyxxLJYlKCoW8JWTuOhIr3eb/W0McXQJFiox/Uqpnhy/X Nbiw== X-Gm-Message-State: ALKqPweZ81CfrM/doCN7X+Qu1eQzbrvM7PxFoMlcCrNLoYOAQOSz5B5M SIzAXRtbURTw1M/ShDnJ5i6ZHmqn X-Received: by 2002:a1c:2703:: with SMTP id n3-v6mr3826974wmn.109.1527075776567; Wed, 23 May 2018 04:42:56 -0700 (PDT) Received: from kurokawa.lan (ip-86-49-107-50.net.upcbroadband.cz. [86.49.107.50]) by smtp.gmail.com with ESMTPSA id y45-v6sm17382223wrd.97.2018.05.23.04.42.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 May 2018 04:42:55 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: linux-kernel@vger.kernel.org Cc: Marek Vasut , Geert Uytterhoeven , Lee Jones , Mark Brown , Steve Twiss , Wolfram Sang , linux-renesas-soc@vger.kernel.org Subject: [PATCH 5/6] mfd: da9063: Handle less LDOs on DA9063L Date: Wed, 23 May 2018 13:42:29 +0200 Message-Id: <20180523114230.10109-5-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180523114230.10109-1-marek.vasut+renesas@gmail.com> References: <20180523114230.10109-1-marek.vasut+renesas@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Move the LDOs present only on DA9063 at the end of the list, so that the DA9063L can simply indicate less LDOs and still share the list of regulators with DA9063. Signed-off-by: Marek Vasut Cc: Geert Uytterhoeven Cc: Lee Jones Cc: Mark Brown Cc: Steve Twiss Cc: Wolfram Sang Cc: linux-renesas-soc@vger.kernel.org --- drivers/regulator/da9063-regulator.c | 76 +++++++++++++++++++++--------------- 1 file changed, 45 insertions(+), 31 deletions(-) diff --git a/drivers/regulator/da9063-regulator.c b/drivers/regulator/da9063-regulator.c index 9b5c28392ae6..92569bed24b9 100644 --- a/drivers/regulator/da9063-regulator.c +++ b/drivers/regulator/da9063-regulator.c @@ -529,6 +529,32 @@ static const struct da9063_regulator_info da9063_regulator_info[] = { .ilimit = BFIELD(DA9063_REG_BUCK_ILIM_A, DA9063_BMEM_ILIM_MASK), }, + { + DA9063_LDO(DA9063, LDO3, 900, 20, 3440), + .suspend = BFIELD(DA9063_REG_DVC_1, DA9063_VLDO3_SEL), + .oc_event = BFIELD(DA9063_REG_STATUS_D, DA9063_LDO3_LIM), + }, + { + DA9063_LDO(DA9063, LDO7, 900, 50, 3600), + .suspend = BFIELD(DA9063_REG_LDO7_CONT, DA9063_VLDO7_SEL), + .oc_event = BFIELD(DA9063_REG_STATUS_D, DA9063_LDO7_LIM), + }, + { + DA9063_LDO(DA9063, LDO8, 900, 50, 3600), + .suspend = BFIELD(DA9063_REG_LDO8_CONT, DA9063_VLDO8_SEL), + .oc_event = BFIELD(DA9063_REG_STATUS_D, DA9063_LDO8_LIM), + }, + { + DA9063_LDO(DA9063, LDO9, 950, 50, 3600), + .suspend = BFIELD(DA9063_REG_LDO9_CONT, DA9063_VLDO9_SEL), + }, + { + DA9063_LDO(DA9063, LDO11, 900, 50, 3600), + .suspend = BFIELD(DA9063_REG_LDO11_CONT, DA9063_VLDO11_SEL), + .oc_event = BFIELD(DA9063_REG_STATUS_D, DA9063_LDO11_LIM), + }, + + /* The following LDOs are present only on DA9063, not on DA9063L */ { DA9063_LDO(DA9063, LDO1, 600, 20, 1860), .suspend = BFIELD(DA9063_REG_DVC_1, DA9063_VLDO1_SEL), @@ -537,11 +563,6 @@ static const struct da9063_regulator_info da9063_regulator_info[] = { DA9063_LDO(DA9063, LDO2, 600, 20, 1860), .suspend = BFIELD(DA9063_REG_DVC_1, DA9063_VLDO2_SEL), }, - { - DA9063_LDO(DA9063, LDO3, 900, 20, 3440), - .suspend = BFIELD(DA9063_REG_DVC_1, DA9063_VLDO3_SEL), - .oc_event = BFIELD(DA9063_REG_STATUS_D, DA9063_LDO3_LIM), - }, { DA9063_LDO(DA9063, LDO4, 900, 20, 3440), .suspend = BFIELD(DA9063_REG_DVC_2, DA9063_VLDO4_SEL), @@ -555,29 +576,11 @@ static const struct da9063_regulator_info da9063_regulator_info[] = { DA9063_LDO(DA9063, LDO6, 900, 50, 3600), .suspend = BFIELD(DA9063_REG_LDO6_CONT, DA9063_VLDO6_SEL), }, - { - DA9063_LDO(DA9063, LDO7, 900, 50, 3600), - .suspend = BFIELD(DA9063_REG_LDO7_CONT, DA9063_VLDO7_SEL), - .oc_event = BFIELD(DA9063_REG_STATUS_D, DA9063_LDO7_LIM), - }, - { - DA9063_LDO(DA9063, LDO8, 900, 50, 3600), - .suspend = BFIELD(DA9063_REG_LDO8_CONT, DA9063_VLDO8_SEL), - .oc_event = BFIELD(DA9063_REG_STATUS_D, DA9063_LDO8_LIM), - }, - { - DA9063_LDO(DA9063, LDO9, 950, 50, 3600), - .suspend = BFIELD(DA9063_REG_LDO9_CONT, DA9063_VLDO9_SEL), - }, + { DA9063_LDO(DA9063, LDO10, 900, 50, 3600), .suspend = BFIELD(DA9063_REG_LDO10_CONT, DA9063_VLDO10_SEL), }, - { - DA9063_LDO(DA9063, LDO11, 900, 50, 3600), - .suspend = BFIELD(DA9063_REG_LDO11_CONT, DA9063_VLDO11_SEL), - .oc_event = BFIELD(DA9063_REG_STATUS_D, DA9063_LDO11_LIM), - }, }; /* Link chip model with regulators info table */ @@ -587,6 +590,11 @@ static struct da9063_dev_model regulators_models[] = { .n_regulators = ARRAY_SIZE(da9063_regulator_info), .type = PMIC_TYPE_DA9063, }, + { + .regulator_info = da9063_regulator_info, + .n_regulators = ARRAY_SIZE(da9063_regulator_info) - 6, + .type = PMIC_TYPE_DA9063L, + }, { } }; @@ -641,28 +649,34 @@ static struct of_regulator_match da9063_matches[] = { [DA9063_ID_BPERI] = { .name = "bperi", }, [DA9063_ID_BCORES_MERGED] = { .name = "bcores-merged" }, [DA9063_ID_BMEM_BIO_MERGED] = { .name = "bmem-bio-merged", }, + [DA9063_ID_LDO3] = { .name = "ldo3", }, + [DA9063_ID_LDO7] = { .name = "ldo7", }, + [DA9063_ID_LDO8] = { .name = "ldo8", }, + [DA9063_ID_LDO9] = { .name = "ldo9", }, + [DA9063_ID_LDO11] = { .name = "ldo11", }, + /* The following LDOs are present only on DA9063, not on DA9063L */ [DA9063_ID_LDO1] = { .name = "ldo1", }, [DA9063_ID_LDO2] = { .name = "ldo2", }, - [DA9063_ID_LDO3] = { .name = "ldo3", }, [DA9063_ID_LDO4] = { .name = "ldo4", }, [DA9063_ID_LDO5] = { .name = "ldo5", }, [DA9063_ID_LDO6] = { .name = "ldo6", }, - [DA9063_ID_LDO7] = { .name = "ldo7", }, - [DA9063_ID_LDO8] = { .name = "ldo8", }, - [DA9063_ID_LDO9] = { .name = "ldo9", }, [DA9063_ID_LDO10] = { .name = "ldo10", }, - [DA9063_ID_LDO11] = { .name = "ldo11", }, }; static struct da9063_regulators_pdata *da9063_parse_regulators_dt( struct platform_device *pdev, struct of_regulator_match **da9063_reg_matches) { + struct da9063 *da9063 = dev_get_drvdata(pdev->dev.parent); struct da9063_regulators_pdata *pdata; struct da9063_regulator_data *rdata; struct device_node *node; + int da9063_matches_len = ARRAY_SIZE(da9063_matches); int i, n, num; + if (da9063->type == PMIC_TYPE_DA9063L) + da9063_matches_len -= 6; + node = of_get_child_by_name(pdev->dev.parent->of_node, "regulators"); if (!node) { dev_err(&pdev->dev, "Regulators device node not found\n"); @@ -670,7 +684,7 @@ static struct da9063_regulators_pdata *da9063_parse_regulators_dt( } num = of_regulator_match(&pdev->dev, node, da9063_matches, - ARRAY_SIZE(da9063_matches)); + da9063_matches_len); of_node_put(node); if (num < 0) { dev_err(&pdev->dev, "Failed to match regulators\n"); @@ -689,7 +703,7 @@ static struct da9063_regulators_pdata *da9063_parse_regulators_dt( pdata->n_regulators = num; n = 0; - for (i = 0; i < ARRAY_SIZE(da9063_matches); i++) { + for (i = 0; i < da9063_matches_len; i++) { if (!da9063_matches[i].init_data) continue; -- 2.16.2