From patchwork Mon Mar 18 09:56:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joy Zou X-Patchwork-Id: 13595164 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0AB49C54E58 for ; Mon, 18 Mar 2024 09:49:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=HiAzaoqEHrIOPVr0OCPiw1AuM7hz8Rd5cNSBcirwvR4=; b=CSLlkiVjVVhk4I NJahxpMCuRndoU7kFRVlREMkRWKweRSnapnsMyPDKGVlRfdMnEpZNsH+FN0xQZLZEgOhgIl6dLjrl Rr+O/CoCPRzaKaMo1A8TiaWOUTRBqFRJ0LS+d4+oaGLKGroz2bw6jZTO08EKjk0432vzaapHrQ/Xg tNn2Sr8S+KFmEQzj6u+eCGnQLklEBnYc9fn+TtaU1ao7lSra0InXBKjT6SyEA5BNOjjm9+hD1XVCR x9YKz7lWI5J9Yh3lDUPMMbSaRxgwmyEovfjh/etlaCbOKtu1atOp/1dIr8gW8Q9Dq30k8D0Zl4puX Yz5L4KB7gXBy3zAqs5yA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rm9c7-00000007zyY-0DaO; Mon, 18 Mar 2024 09:49:03 +0000 Received: from mail-he1eur01on060f.outbound.protection.outlook.com ([2a01:111:f400:fe1e::60f] helo=EUR01-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rm9c1-00000007zuW-16fg for linux-arm-kernel@lists.infradead.org; Mon, 18 Mar 2024 09:48:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QjjgLXrkLS7IE/ENlXCwMIU3CuoR+vAUuWGM43zdmzrUO/2rXYRmil02HU/0CSJo4Lk85SOYl+EHolcRs30VMqLJzaDYsq6momO6DXYbcCmyxQDp2CL7VU2H21bmW0lW1j7Q1HgyUFYJ6KRW6kAbq1f8iU2dEcpbiLgXlsZRozKabnZPRgWU7au9EaMusqUsrginrdUXq4ZN8wsWVfki+3gxAcXIc5oup9y7mCtkGwrYarfORBu5aembDrCsAwq8SPZFFQA0ta/mPUifdG1duB+atFy8DAk5UXTfdigjRyCZLH7gfjjcKZRWfEi6JPrREYYwngPSVXxuft4Bj+VJvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=hmAVGc5sVLAp2q+kXlRMubSP+Jhbn1vzo3R9teb5aoc=; b=QQTM7/4XwwDGpX3AULH669IrGTYrl7gzrzX9Jw9BoOUjvuDT1mDm/uSNXLPJBOElz/qPpj9jfzqMH/WSngm6Dd1ZW6NXvpe5EKg1Q2DBoXdaeKcVk7D61NOrKRH/EPAH8nxVo1E3yCINVLX/lw7p4k5feHyeLaww+C9DmSgq/N2Qy/B6Z7ZxCShn38qLONYvg2VMaZXSs4kHF4SbsVFyAPaXYyy1kDW8H8iu84sREI4+SA3LAernmpX6ZFy0JUc2HYAIP+d2B23IyNj1/dNVIjyMWaKHhbgnSHXx7Wpmjb2q0s62IGI1CsfpLL0AQ7NHaV5l6yhXeSCL9RTxkmyXUw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hmAVGc5sVLAp2q+kXlRMubSP+Jhbn1vzo3R9teb5aoc=; b=WwFFUJmjND0xxRYEif9ImQXeRbIQPsbOkf1cDEmEJxBaEW5wU5cFckKpr9T/478yaror9KIwruEryxQeyQvq0X05PkpCrEHtMzd71nOxvRwR4ZMTXgWeiCgcR+ZuvAZx2CuvwMtmdAH5dNyqSx6l76pHFppnKtgbfVIBkVJsCKg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PA4PR04MB9367.eurprd04.prod.outlook.com (2603:10a6:102:2aa::7) by AM9PR04MB8938.eurprd04.prod.outlook.com (2603:10a6:20b:409::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.25; Mon, 18 Mar 2024 09:48:52 +0000 Received: from PA4PR04MB9367.eurprd04.prod.outlook.com ([fe80::688c:22a3:9638:9ded]) by PA4PR04MB9367.eurprd04.prod.outlook.com ([fe80::688c:22a3:9638:9ded%5]) with mapi id 15.20.7386.023; Mon, 18 Mar 2024 09:48:52 +0000 From: Joy Zou To: frank.li@nxp.com, ping.bai@nxp.com, lgirdwood@gmail.com, broonie@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de Cc: kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev Subject: [PATCH v5 2/3] regulator: pca9450: add pca9451a support Date: Mon, 18 Mar 2024 17:56:32 +0800 Message-Id: <20240318095633.4079027-3-joy.zou@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20240318095633.4079027-1-joy.zou@nxp.com> References: <20240318095633.4079027-1-joy.zou@nxp.com> X-ClientProxiedBy: SI2PR01CA0016.apcprd01.prod.exchangelabs.com (2603:1096:4:191::20) To PA4PR04MB9367.eurprd04.prod.outlook.com (2603:10a6:102:2aa::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PA4PR04MB9367:EE_|AM9PR04MB8938:EE_ X-MS-Office365-Filtering-Correlation-Id: 686d1b49-7b14-4e99-1ad6-08dc47309e58 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ABv7QdgvO9VsgllmcVuc1NLfZlfxch5rJDuYQIfit9TN+Y4bG6GsHCjJ5rQg6M+7qNc8UWd7mC9nELfakNvnxfXHfZVFpIooEVellfGFzN2U9pjXuq7BWGKugpcZfhXY9IUwH2GPq/berEoBu2gMsqFuV6rEwuE5t5DDIHB7ThMFloC4auh8RU0DW0MRKLkhy4M4qqNt2ovbPLvvFC9av2iEindouICAzt2+JAb+70zBIq/7qtcs5C92DSwhYYmC7XHEjGLzVkAp90Th0Jpfe5885I46NmxR9es0QFD5ZwkDS9EwWpXHjGiKSSIodrp/rcOidfnocVfhYLJtJw0AI9+ZNAkWaRR27hxj2dD2oAvZwqvHLnq1rJzpNEpuqP7irf5y4lJp2nGv9rYGi3jM7IpXWVYmDoq2LZz+dmRzClf/mL++VmsML+zhA76j/mPQUYjxI249VIkjRL1NT4SQkGmbMsRuUcIlU4wRmvONs/ytIlt4gfvtmxfHLw+kw/1DM1N1TY6W+mmXlpSn6bAH+AENglhkdOsjWR5iC5IR3vL+8Wy40Fm9+cvIa97tTcNKYvXSwYE9pLVrK67NxkfBXi1T4Kk/8soCd5bzsLWSeKf3HkstrHgZi7v0Z7l+/p1kJQ+i/aFx4mEhby4ACmpcOC4xaFg5097CHMiF3dgpF6FpUy/mN4fDhepM/Z8TbmgZeQRgz4XnwogLnKN9HSrLMV5yCHqtQPO9avbKe3GiVxc= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PA4PR04MB9367.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376005)(7416005)(52116005)(366007)(1800799015)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Uu7Rzsx8iXsCJpjavf4mCQ4q2gXngOlR38Afdp/iatFR+4DzLffOOnX/csz/RdjW3rHVaNsw9VjEAM77KVURilRN6QNc4y0p99AnweVWqaIKwPnufWoH1fpezmlLCAExJE015BEzdGIuwCugn7anB4ct7CuvqIoAFmAbqnoTnMZj6UhRhoWGTpu3aakuTod8GP8nzApps4abvLwXYaLloXreefB1mN892Ks5R0sFiGNRvh2lPRIzViaoznII7AQXaIqzA0+wvg0rUGxhlvKWk8y1jRYBxnga3n3jL5re0JRI069gBW7DPVlc2S34RqywJViZfG51Tvr4uFtc1a/dG+76GQqbA/oBBzpubrLaWkiqlKxtTh79xSxaKicfm//RdSx3hQdDpgLpWUcv2k7Z2N912+aB6xgwzAuXhYOgDKVmYWiXqsJCKQcdvDl57/ywgrjUCt3VVGCciaK2aKonTvsRvPxBSmA3K3xWpG3IlW74WKIWD/P58Mo1mrJ1+X8rLxQ1hTS11eYj9vPaN6n1f3oKB5TC65rTuyXFuUGwEIJkraumc7NktrqRFX9TZOFHDWaImu63GSuDUJZxq5bblZPGIJSMk8M6Tp7N8SVM2LHN8RvED5PwQrDFvz7AKWQUD+mAU116DkgfgKMrunj9nhTTGgo6NU8duO8UOU2m/gKGYdn7aeOEKYecKxCX1L2hFpoV7IAsIEfpTP7FEZ3x5f1JdIqleNobfhPLdz8UA93jq00HxyDP0tjZ9NL29pJv8s+DGsf3b89y03dqkOQLVx8O4UdYjVTdB9yt6pDP0z0tm41dYGUz/0CqCjtEizvYjCvdkgfW0Z0pQXCY30kH+SfXR4RtUkayIiHetSOYem7oblF1lryahL+kDi2Nh+mpK/VxOxSG5/B7JKh63fhAf1op2dT0f0DCOQiv2rBEmo03l1ZegV04JmsocaPLBBc/h6x3Od1f8PKWP18bnewQIQQJBwFzqVnidgfPB9wfzshPWZ9LK7zPSvLvA35x+bzxljl/a2ovoCSHziSR3GnWayvrGv/X+956oHKo3Kwo7N9W0qr25tTk6nkOAUHk+SplAKJ4IrlkUZSdFw6UeH2IS/Qk7SuPjoSX3z+wgni9YxqKBv4w2oG9TQ2NsJiWf2Xn7AB2gPI+P1EaEJts3rXv8s/XmS77iZ5Tqd5vV+qhAVLArxXQCiSvcKyFyuyInx2MW4K1mlKU4MWp2/bBuyepuffApwTmrYP/+XnfHTfJepV+JqwjWiDQOahMjokKJYZ9LAKykZbJU6lnljXlW+O237fCaMT1kGHx5dQqf5YT/aFL5XP8tbKqdwKGid6pqNJurlYT44FEir8drfhuu6VPmyhsp4KL7UOULXBqed9kZtBgasNxYK5BigT6bXW01WGzciowfv26m+kuqGSJqSYZeXSkU91D/VHlCRsyFm2/2uPl1Txm8xU/85LtRE4hsMzJ/u0MshI2s09UlMZFnVEQlDAZI26RWYyaIRZHcysvDFy0kuwkT+x2bWY7TEXsBpNifhqEn3wPomcqC9PWNYyN+aYiQJ1GeD6f6wKdfg59D8Kgp/iML3TCo9r2rAitXQfs X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 686d1b49-7b14-4e99-1ad6-08dc47309e58 X-MS-Exchange-CrossTenant-AuthSource: PA4PR04MB9367.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Mar 2024 09:48:52.4410 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: AmIVb3EGcxAbHgKdwR38hjQC7pdJGckyL+Cy8lUEJ4btWvAfnVLqLkEEKE1SEO/m X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8938 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240318_024857_530594_69862B9F X-CRM114-Status: GOOD ( 17.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Adding support for new pmic pca9451a. Signed-off-by: Joy Zou --- Changes in v3: 1. remove not related change. 2. delete unnecessary empty line. 3. modify commit message. Changes in v2: 1. remove the old part support because the old part only is used for sample and is diffcult to distinguish old and new part. so drop old part. 2. remove the unnecessary marco definition in the file pca9450.h. --- drivers/regulator/pca9450-regulator.c | 194 +++++++++++++++++++++++++- include/linux/regulator/pca9450.h | 1 + 2 files changed, 193 insertions(+), 2 deletions(-) diff --git a/drivers/regulator/pca9450-regulator.c b/drivers/regulator/pca9450-regulator.c index 2ab365d2749f..242ff25f5b83 100644 --- a/drivers/regulator/pca9450-regulator.c +++ b/drivers/regulator/pca9450-regulator.c @@ -106,6 +106,14 @@ static const struct linear_range pca9450_dvs_buck_volts[] = { REGULATOR_LINEAR_RANGE(600000, 0x00, 0x7F, 12500), }; +/* + * BUCK1/3 + * 0.65 to 2.2375V (12.5mV step) + */ +static const struct linear_range pca9451a_dvs_buck_volts[] = { + REGULATOR_LINEAR_RANGE(650000, 0x00, 0x7F, 12500), +}; + /* * BUCK4/5/6 * 0.6V to 3.4V (25mV step) @@ -662,6 +670,178 @@ static const struct pca9450_regulator_desc pca9450bc_regulators[] = { }, }; +static const struct pca9450_regulator_desc pca9451a_regulators[] = { + { + .desc = { + .name = "buck1", + .of_match = of_match_ptr("BUCK1"), + .regulators_node = of_match_ptr("regulators"), + .id = PCA9450_BUCK1, + .ops = &pca9450_dvs_buck_regulator_ops, + .type = REGULATOR_VOLTAGE, + .n_voltages = PCA9450_BUCK1_VOLTAGE_NUM, + .linear_ranges = pca9451a_dvs_buck_volts, + .n_linear_ranges = ARRAY_SIZE(pca9451a_dvs_buck_volts), + .vsel_reg = PCA9450_REG_BUCK1OUT_DVS0, + .vsel_mask = BUCK1OUT_DVS0_MASK, + .enable_reg = PCA9450_REG_BUCK1CTRL, + .enable_mask = BUCK1_ENMODE_MASK, + .enable_val = BUCK_ENMODE_ONREQ, + .ramp_mask = BUCK1_RAMP_MASK, + .ramp_delay_table = pca9450_dvs_buck_ramp_table, + .n_ramp_values = ARRAY_SIZE(pca9450_dvs_buck_ramp_table), + .owner = THIS_MODULE, + .of_parse_cb = pca9450_set_dvs_levels, + }, + .dvs = { + .run_reg = PCA9450_REG_BUCK1OUT_DVS0, + .run_mask = BUCK1OUT_DVS0_MASK, + .standby_reg = PCA9450_REG_BUCK1OUT_DVS1, + .standby_mask = BUCK1OUT_DVS1_MASK, + }, + }, + { + .desc = { + .name = "buck2", + .of_match = of_match_ptr("BUCK2"), + .regulators_node = of_match_ptr("regulators"), + .id = PCA9450_BUCK2, + .ops = &pca9450_dvs_buck_regulator_ops, + .type = REGULATOR_VOLTAGE, + .n_voltages = PCA9450_BUCK2_VOLTAGE_NUM, + .linear_ranges = pca9450_dvs_buck_volts, + .n_linear_ranges = ARRAY_SIZE(pca9450_dvs_buck_volts), + .vsel_reg = PCA9450_REG_BUCK2OUT_DVS0, + .vsel_mask = BUCK2OUT_DVS0_MASK, + .enable_reg = PCA9450_REG_BUCK2CTRL, + .enable_mask = BUCK2_ENMODE_MASK, + .enable_val = BUCK_ENMODE_ONREQ_STBYREQ, + .ramp_mask = BUCK2_RAMP_MASK, + .ramp_delay_table = pca9450_dvs_buck_ramp_table, + .n_ramp_values = ARRAY_SIZE(pca9450_dvs_buck_ramp_table), + .owner = THIS_MODULE, + .of_parse_cb = pca9450_set_dvs_levels, + }, + .dvs = { + .run_reg = PCA9450_REG_BUCK2OUT_DVS0, + .run_mask = BUCK2OUT_DVS0_MASK, + .standby_reg = PCA9450_REG_BUCK2OUT_DVS1, + .standby_mask = BUCK2OUT_DVS1_MASK, + }, + }, + { + .desc = { + .name = "buck4", + .of_match = of_match_ptr("BUCK4"), + .regulators_node = of_match_ptr("regulators"), + .id = PCA9450_BUCK4, + .ops = &pca9450_buck_regulator_ops, + .type = REGULATOR_VOLTAGE, + .n_voltages = PCA9450_BUCK4_VOLTAGE_NUM, + .linear_ranges = pca9450_buck_volts, + .n_linear_ranges = ARRAY_SIZE(pca9450_buck_volts), + .vsel_reg = PCA9450_REG_BUCK4OUT, + .vsel_mask = BUCK4OUT_MASK, + .enable_reg = PCA9450_REG_BUCK4CTRL, + .enable_mask = BUCK4_ENMODE_MASK, + .enable_val = BUCK_ENMODE_ONREQ, + .owner = THIS_MODULE, + }, + }, + { + .desc = { + .name = "buck5", + .of_match = of_match_ptr("BUCK5"), + .regulators_node = of_match_ptr("regulators"), + .id = PCA9450_BUCK5, + .ops = &pca9450_buck_regulator_ops, + .type = REGULATOR_VOLTAGE, + .n_voltages = PCA9450_BUCK5_VOLTAGE_NUM, + .linear_ranges = pca9450_buck_volts, + .n_linear_ranges = ARRAY_SIZE(pca9450_buck_volts), + .vsel_reg = PCA9450_REG_BUCK5OUT, + .vsel_mask = BUCK5OUT_MASK, + .enable_reg = PCA9450_REG_BUCK5CTRL, + .enable_mask = BUCK5_ENMODE_MASK, + .enable_val = BUCK_ENMODE_ONREQ, + .owner = THIS_MODULE, + }, + }, + { + .desc = { + .name = "buck6", + .of_match = of_match_ptr("BUCK6"), + .regulators_node = of_match_ptr("regulators"), + .id = PCA9450_BUCK6, + .ops = &pca9450_buck_regulator_ops, + .type = REGULATOR_VOLTAGE, + .n_voltages = PCA9450_BUCK6_VOLTAGE_NUM, + .linear_ranges = pca9450_buck_volts, + .n_linear_ranges = ARRAY_SIZE(pca9450_buck_volts), + .vsel_reg = PCA9450_REG_BUCK6OUT, + .vsel_mask = BUCK6OUT_MASK, + .enable_reg = PCA9450_REG_BUCK6CTRL, + .enable_mask = BUCK6_ENMODE_MASK, + .enable_val = BUCK_ENMODE_ONREQ, + .owner = THIS_MODULE, + }, + }, + { + .desc = { + .name = "ldo1", + .of_match = of_match_ptr("LDO1"), + .regulators_node = of_match_ptr("regulators"), + .id = PCA9450_LDO1, + .ops = &pca9450_ldo_regulator_ops, + .type = REGULATOR_VOLTAGE, + .n_voltages = PCA9450_LDO1_VOLTAGE_NUM, + .linear_ranges = pca9450_ldo1_volts, + .n_linear_ranges = ARRAY_SIZE(pca9450_ldo1_volts), + .vsel_reg = PCA9450_REG_LDO1CTRL, + .vsel_mask = LDO1OUT_MASK, + .enable_reg = PCA9450_REG_LDO1CTRL, + .enable_mask = LDO1_EN_MASK, + .owner = THIS_MODULE, + }, + }, + { + .desc = { + .name = "ldo4", + .of_match = of_match_ptr("LDO4"), + .regulators_node = of_match_ptr("regulators"), + .id = PCA9450_LDO4, + .ops = &pca9450_ldo_regulator_ops, + .type = REGULATOR_VOLTAGE, + .n_voltages = PCA9450_LDO4_VOLTAGE_NUM, + .linear_ranges = pca9450_ldo34_volts, + .n_linear_ranges = ARRAY_SIZE(pca9450_ldo34_volts), + .vsel_reg = PCA9450_REG_LDO4CTRL, + .vsel_mask = LDO4OUT_MASK, + .enable_reg = PCA9450_REG_LDO4CTRL, + .enable_mask = LDO4_EN_MASK, + .owner = THIS_MODULE, + }, + }, + { + .desc = { + .name = "ldo5", + .of_match = of_match_ptr("LDO5"), + .regulators_node = of_match_ptr("regulators"), + .id = PCA9450_LDO5, + .ops = &pca9450_ldo_regulator_ops, + .type = REGULATOR_VOLTAGE, + .n_voltages = PCA9450_LDO5_VOLTAGE_NUM, + .linear_ranges = pca9450_ldo5_volts, + .n_linear_ranges = ARRAY_SIZE(pca9450_ldo5_volts), + .vsel_reg = PCA9450_REG_LDO5CTRL_H, + .vsel_mask = LDO5HOUT_MASK, + .enable_reg = PCA9450_REG_LDO5CTRL_H, + .enable_mask = LDO5H_EN_MASK, + .owner = THIS_MODULE, + }, + }, +}; + static irqreturn_t pca9450_irq_handler(int irq, void *data) { struct pca9450 *pca9450 = data; @@ -729,6 +909,10 @@ static int pca9450_i2c_probe(struct i2c_client *i2c) regulator_desc = pca9450bc_regulators; pca9450->rcnt = ARRAY_SIZE(pca9450bc_regulators); break; + case PCA9450_TYPE_PCA9451A: + regulator_desc = pca9451a_regulators; + pca9450->rcnt = ARRAY_SIZE(pca9451a_regulators); + break; default: dev_err(&i2c->dev, "Unknown device type"); return -EINVAL; @@ -755,7 +939,8 @@ static int pca9450_i2c_probe(struct i2c_client *i2c) /* Check your board and dts for match the right pmic */ if (((device_id >> 4) != 0x1 && type == PCA9450_TYPE_PCA9450A) || - ((device_id >> 4) != 0x3 && type == PCA9450_TYPE_PCA9450BC)) { + ((device_id >> 4) != 0x3 && type == PCA9450_TYPE_PCA9450BC) || + ((device_id >> 4) != 0x9 && type == PCA9450_TYPE_PCA9451A)) { dev_err(&i2c->dev, "Device id(%x) mismatched\n", device_id >> 4); return -EINVAL; @@ -846,7 +1031,8 @@ static int pca9450_i2c_probe(struct i2c_client *i2c) } dev_info(&i2c->dev, "%s probed.\n", - type == PCA9450_TYPE_PCA9450A ? "pca9450a" : "pca9450bc"); + type == PCA9450_TYPE_PCA9450A ? "pca9450a" : + (type == PCA9450_TYPE_PCA9451A ? "pca9451a" : "pca9450bc")); return 0; } @@ -864,6 +1050,10 @@ static const struct of_device_id pca9450_of_match[] = { .compatible = "nxp,pca9450c", .data = (void *)PCA9450_TYPE_PCA9450BC, }, + { + .compatible = "nxp,pca9451a", + .data = (void *)PCA9450_TYPE_PCA9451A, + }, { } }; MODULE_DEVICE_TABLE(of, pca9450_of_match); diff --git a/include/linux/regulator/pca9450.h b/include/linux/regulator/pca9450.h index 505c908dbb81..243633c8dceb 100644 --- a/include/linux/regulator/pca9450.h +++ b/include/linux/regulator/pca9450.h @@ -9,6 +9,7 @@ enum pca9450_chip_type { PCA9450_TYPE_PCA9450A = 0, PCA9450_TYPE_PCA9450BC, + PCA9450_TYPE_PCA9451A, PCA9450_TYPE_AMOUNT, };