Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1534061imm; Sat, 2 Jun 2018 03:15:32 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJID7iuozF8jDkorql16DjPHOMrRw8PCwY48f+K17ZGruFjUTbTj0S9onOOY2ixp6s38oMq X-Received: by 2002:a17:902:42e4:: with SMTP id h91-v6mr14316156pld.27.1527934532272; Sat, 02 Jun 2018 03:15:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527934532; cv=none; d=google.com; s=arc-20160816; b=JaRyu3HM2rA193dMSh/ROc85AX4h4JmDTVrTqcUcp6Ejqv1h0bAO6TS1gzGU+eciGV WrVBtkd8wj9vd+hkJQ0H0w0tYpJQdw4AiwcmUOi3TaKzfZz8gKClfGM8v0CuQ+kM1W7y RbmUq6eqIvOKTwmlkA/JXl2XvY4Qo02vZHgn8VMxz4jlOx/UU2uLX+Fu4YU80fgTd3MJ oApfiapNHgYzXUwRCrAptCXreZb99BcShbGHAW2EbjDeYqwcqfoQwV14whx7q5uzKQuA 27zG9ZHN6EWqUAYvDt8YH3FjlHhcfTtReWduNdYLYlRt85rbbrjqcVdgXidXW2zJxlF8 4Baw== 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=GaW9Sgb9rAagl6uCe+nTHTdlJnFLHeLJmqUI1VnwjEA=; b=IkpX8PMQe2LQoecQ2Jt8BiNF2rD+wlDOo1S+JYbYPpfK9+YoaVzHzV45OpIkU8wUSF YaOdaF4VfFTKGTsrXtFUMcxU99SD/VlaQFQQrdZWHINu8f9WyvaJESib8aKS5FQtLSUt Ap9glCucBFf0Y20D4wY7jioxKXSjIzC1xtdg+uCJCfXNA/Z6J5V/9Bv8GNhwfSv7PvAZ flnRWsRTaEcgiAz5xlNZc5GxuPenow9NXdv+tDcDyYCoNwdM0cF5scWXskhrOoviKVB3 pszAYzwI5qcqNq7CW8tA2EZdbcMf23yhoNXnoKRV0cFJsC/ygQ4nUfGtFBy2phBPNezI 3kiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hZStQwh1; 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 i26-v6si17627717pgn.433.2018.06.02.03.14.47; Sat, 02 Jun 2018 03:15:32 -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=hZStQwh1; 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 S1752025AbeFBKM7 (ORCPT + 99 others); Sat, 2 Jun 2018 06:12:59 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:40089 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751597AbeFBKM0 (ORCPT ); Sat, 2 Jun 2018 06:12:26 -0400 Received: by mail-wm0-f66.google.com with SMTP id x2-v6so6366213wmh.5; Sat, 02 Jun 2018 03:12:25 -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=GaW9Sgb9rAagl6uCe+nTHTdlJnFLHeLJmqUI1VnwjEA=; b=hZStQwh1zXIon3RhbO5DX6XFw7xTrGxA3bxdrcLW/WQ45cDX/b+kK14mKbMLDhBcgS iK91z5ufnLLDtHVIiRXjbFbhtpM5/lhhb+8QvykeyrYsI9kHRlRMQyqOzVo3y9yVAq/L RlnOQ/EBDj4bUuKnIsLF2ccwK/fqrmDdsDoIdUVG0Lz2CHaJgkE302zvrEGe7FffvPaO le7v49sfUSgm0Zui58jJ3jBJQ7ui3V0NBgs0GELqWu8GnCUHL/yTHJ08YGtA3CXgiF2h GQpWRrr59XeUILphG0j5I+7bcq+m6X2krnJhTLlFuqKo33m/80YuQen0q7De92YhaX/n uDqQ== 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=GaW9Sgb9rAagl6uCe+nTHTdlJnFLHeLJmqUI1VnwjEA=; b=pvQx8TBcM4NS1+WOTLSMBCXkCobN6Q5tXGf/o4NAZuyZxJr8hGouhD/vXgaHR6l3Ct GoPgQZpM7VDKK1WncTMQ6JlB7h9Ns6nJS/PQuyR0L574MkqYKpphzyoq4Ry1rDUCedwd NTJG/DLURT1yIZ0n9eIwrqfzGY6j7YRgVVw98oXWm10vboMIxogh52Ah6AXB1z7tV64p nHmL/q7RC4YhJkpfHNCFbVjCzOwwtJah3bPxu5r8RvOVhrWXhEkILbWSmlnlnzsEMRff jh9UgYp82LcxG4EmXSOGl8WAnYjrYXpWIyUDbcAL4oXKxp9H2YZAS74qlLdS+84UJC6C ORIQ== X-Gm-Message-State: ALKqPwczQ7n1i1wYTzB/D2yeMF2mYY/6RC4M14jycHN4dNzmxLwWKHnr 4wYkWJo4LKyYPyLQhoiti+MUGqb0 X-Received: by 2002:a1c:f415:: with SMTP id z21-v6mr4511398wma.80.1527934344375; Sat, 02 Jun 2018 03:12:24 -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 b16-v6sm38624797wrm.89.2018.06.02.03.12.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 02 Jun 2018 03:12:23 -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 v3 09/10] mfd: da9063: Handle less LDOs on DA9063L Date: Sat, 2 Jun 2018 12:11:54 +0200 Message-Id: <20180602101155.26375-9-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180602101155.26375-1-marek.vasut+renesas@gmail.com> References: <20180602101155.26375-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 Acked-by: Mark Brown Reviewed-by: Geert Uytterhoeven --- V2: No change V3: No change --- 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 eeb0d431dda1..0c09e73e0b23 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