From patchwork Mon Feb 13 15:58:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frieder Schrempf X-Patchwork-Id: 56357 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2423249wrn; Mon, 13 Feb 2023 08:00:34 -0800 (PST) X-Google-Smtp-Source: AK7set/KxCRROBPM4ux/LFVIGhnpD+ljwfxSqBU9vQI1659X/jZ47/HjpDilcQmFbXQnabB87R59 X-Received: by 2002:a17:90b:388b:b0:233:e0d5:a2ab with SMTP id mu11-20020a17090b388b00b00233e0d5a2abmr6385057pjb.34.1676304034416; Mon, 13 Feb 2023 08:00:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676304034; cv=none; d=google.com; s=arc-20160816; b=wgWicj1HxBtte1SC7cCEF/hqxvwEXVEI8C0TjlzTUOjDULslU5vkQ371DDON7KWkGY z+Ddvb9/ansXCANms4iLTnASQk5ShSlC3qSz6s/Y6+qo3KIHC+tCdO7jAjXJL2PS9aXG 2xjJSnx/tGpYkvUYfyojdwGPW8RQCdxdyjFCr8SRiOdCW4ZOZK6kgxAuqT4mt0fBhp64 Hi8NKyaW9EZE/F0MtQv7ByqtFlXbvGFze9Cdcq293paqAcQL7fdR40bL4tedQ3RODX2y xova2p54qTX20TKQ3SKu/Lm/zjDEAFuutpWREhV1xMtoiPWCFgUFKXuVs868R5J/9BHv jpNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1hMuNgLfmYKnEteM9D2HKTHTutb/TpNG5wgcFSK2t6I=; b=w3f+rTL39JmbGVduXlcNNGpUqLODF1coPD9mr+gBc6JCc5awV4QaIXJgYknKWPijPd GYJsXw7W1irNum+53qTuD8kQaglvW1BVo/ybdvmCXLtmSt2eAZMvbhSfA398m9jx8fLN FEPfMgLclNz/ODNICwf/kZvcLXr7/dkBSKyU3AFfBYfwZGxk7zb/mFyenZp8tlmUoe4i rlu/Hc5U0CKl6f+Zip3uamdvzCNlTpKaXFD1+VPu2s6zVvEHmgL7BWFCIPOBfxhseBeS iP17Jc5PS+yrEtBLgeNbDg1QSmvSG53SbCzn0nv6Cn0o7UOkOaW/4aI/tL2PdCeY6F9Y MHgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fris.de header.s=dkim header.b=EYOHLaah; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=fris.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lb9-20020a17090b4a4900b002307345bf7bsi16607344pjb.23.2023.02.13.08.00.21; Mon, 13 Feb 2023 08:00:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@fris.de header.s=dkim header.b=EYOHLaah; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=fris.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231311AbjBMP75 (ORCPT + 99 others); Mon, 13 Feb 2023 10:59:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231310AbjBMP7q (ORCPT ); Mon, 13 Feb 2023 10:59:46 -0500 Received: from mail.fris.de (mail.fris.de [IPv6:2a01:4f8:c2c:390b::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 028182687; Mon, 13 Feb 2023 07:59:45 -0800 (PST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 2F64DC0176; Mon, 13 Feb 2023 16:59:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fris.de; s=dkim; t=1676303984; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=1hMuNgLfmYKnEteM9D2HKTHTutb/TpNG5wgcFSK2t6I=; b=EYOHLaahGl9AS5iE/8SSCDIFFURc8P60qTcUkxBkiX+UIXON6UQC+WV3qmIwjAQmyUp6iS 01fYBcrJOXFxoOnhZ/NxCFoINDiNw5CuU6m4zL2lol829B2DEvVMGpw+Ka2r4K1GiNtohP LZaWUFbQvPH4AygtVS84gUZT8TsAmqelmsVW3IOA67Fl4u40xHr9UvOkrQKVgXL4iz3/bK rD0Vap2FcH68o11+3G1A0pZDyGT2Y09t+i0ekuqhqUHcMJQWzjt8i/3qCMP6hUnW2B7xw7 N7b3wJh+dDIs5CEGTvTbVhuGjfEw6IEWGMAf4GxsP764IPKUM751BZHog+azPg== From: Frieder Schrempf To: devicetree@vger.kernel.org, Krzysztof Kozlowski , Liam Girdwood , linux-kernel@vger.kernel.org, Mark Brown , Rob Herring , Robin Gong Cc: Marek Vasut , Frieder Schrempf , Per-Daniel Olsson , Rickard x Andersson Subject: [PATCH 1/6] dt-bindings: regulator: pca9450: Document new usage of sd-vsel-gpios Date: Mon, 13 Feb 2023 16:58:19 +0100 Message-Id: <20230213155833.1644366-2-frieder@fris.de> In-Reply-To: <20230213155833.1644366-1-frieder@fris.de> References: <20230213155833.1644366-1-frieder@fris.de> MIME-Version: 1.0 X-Last-TLS-Session-Version: TLSv1.3 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757732179308848892?= X-GMAIL-MSGID: =?utf-8?q?1757732179308848892?= From: Frieder Schrempf The sd-vsel-gpios property is abandoned in its current meaning as an output. We now use it to specify an optional signal that can be evaluated by the driver in order to retrieve the current status of the SD_VSEL signal that is used to select the control register of LDO5. Signed-off-by: Frieder Schrempf --- .../regulator/nxp,pca9450-regulator.yaml | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/Documentation/devicetree/bindings/regulator/nxp,pca9450-regulator.yaml b/Documentation/devicetree/bindings/regulator/nxp,pca9450-regulator.yaml index 835b53302db8..c86534538a4e 100644 --- a/Documentation/devicetree/bindings/regulator/nxp,pca9450-regulator.yaml +++ b/Documentation/devicetree/bindings/regulator/nxp,pca9450-regulator.yaml @@ -40,8 +40,24 @@ properties: description: | list of regulators provided by this controller + properties: + LDO5: + type: object + $ref: regulator.yaml# + description: + Properties for single LDO5 regulator. + + properties: + sd-vsel-gpios: + description: + GPIO that can be used to read the current status of the SD_VSEL + signal in order for the driver to know if LDO5CTRL_L or LDO5CTRL_H + is used by the hardware. + + unevaluatedProperties: false + patternProperties: - "^LDO[1-5]$": + "^LDO[1-4]$": type: object $ref: regulator.yaml# description: @@ -76,11 +92,6 @@ properties: additionalProperties: false - sd-vsel-gpios: - description: GPIO that is used to switch LDO5 between being configured by - LDO5CTRL_L or LDO5CTRL_H register. Use this if the SD_VSEL signal is - connected to a host GPIO. - nxp,i2c-lt-enable: type: boolean description: From patchwork Mon Feb 13 15:58:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frieder Schrempf X-Patchwork-Id: 56358 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2423288wrn; Mon, 13 Feb 2023 08:00:36 -0800 (PST) X-Google-Smtp-Source: AK7set9iTodb3zJKJXZpiSFYnZPmdlJTq1ZZHHKi5fTPsE6sSggyz47YMsspm4CoNNxnwjUSFpWV X-Received: by 2002:a05:6a20:be11:b0:b8:bc13:c838 with SMTP id ge17-20020a056a20be1100b000b8bc13c838mr18659269pzb.53.1676304036245; Mon, 13 Feb 2023 08:00:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676304036; cv=none; d=google.com; s=arc-20160816; b=F4R8ah15c3DZMhjQP/ysIJD40BE+mnQfhzUQJkoK2Jn2UiPv+VfAjCR123S4iBwPrq z8Zv6TrLKgsekKYeLgpdOOIOWr/4mzz08TYw1uU58ULNeX5rFwgr/KdriBdwDyVxcuUR LbJFNKj7JebdJkAtjic55ytABdlP1932sOPrgnxKv4Cm3mdA4Rr/d/JzkMlPr+IFySsp 35q0YKxyb9g3atnS1Qw18npQAgsJ1MhVQD5vZNmgzPXJ+Wfi1AeT1gSquKI12pmduIfv 64FL2c/9LVBr/zsPG3AsSE/rnW6QMBGh0FUlQCxS4KhDMiShbhGytNXfbTvUO6DfbQ7t 0taQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=6iA7zvhCM9q7q6dbgNS6li/HQ1lUJFB2cdCiJIYXUAY=; b=HEdVLcmzU7jx3Yl/p61dy9Ysuok1IdbRCFcIJnzlwaA0aGd+BRjGcl5W2zo0KLtTNe dKg0nFow8C3qje8o8cYNdVBi/P+hf3aKyP7GQBzoWa+nv2qF1NxXutFug2xhoHjjuWZK U/fjl4aLUOJFEuVlpglwN7jzaoPIXIY9VHglL19q9ldLqhx+2XrZ9AQoOLa5E1I6g9yN ziJI1V+LzXY1kVy/39KoByQALCMdzFBF0CXQrk3+VwaoaEe2Wm7bgE7WM7o9kLnjuU1z /xfJJ8olyZbdhg3IR3jzvvFUVfTT6X4C7KrSGc/Q0WY6p+oBKKdl2gvIW6pdaDH45XaY EblA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fris.de header.s=dkim header.b="f8mC/UOC"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=fris.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s1-20020a639e01000000b004fb2d34b7edsi12739982pgd.297.2023.02.13.08.00.23; Mon, 13 Feb 2023 08:00:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@fris.de header.s=dkim header.b="f8mC/UOC"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=fris.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231301AbjBMQAA (ORCPT + 99 others); Mon, 13 Feb 2023 11:00:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231342AbjBMP7t (ORCPT ); Mon, 13 Feb 2023 10:59:49 -0500 Received: from mail.fris.de (mail.fris.de [116.203.77.234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19783170B for ; Mon, 13 Feb 2023 07:59:49 -0800 (PST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id EC8DAC02BF; Mon, 13 Feb 2023 16:59:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fris.de; s=dkim; t=1676303987; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=6iA7zvhCM9q7q6dbgNS6li/HQ1lUJFB2cdCiJIYXUAY=; b=f8mC/UOC3TTm5KwZSo3d8k+CF/vb70jWnIhv9+6rT3k/T/rdQr7/xvnmyrP7ZW1TiUYiMr wWQ9OB1WOJs/6lc3xu/459Q/2PHcyP+P3MuJyuaN7SOH/fvI9OWCDF3i4B+KOhTqcfy23d /VM9bE0Q2tI4UDlZzPe53PvvSmvEZoggp0S8fWHoq5A+k+hSGR/QtR4ATRBqmveKRo7HDY NZNRJpfRCX8U7TvnXjYgIJ02HZpHFZnC+61jdkVMVhUmx173aFWqkqKQI63oo/wYHz1Fh9 LhUanw4BF3IL5Nd2qKxE7hQkqNdEEWO7LtZDOsOsslIbWnrzCukbwSEQaeCTFA== From: Frieder Schrempf To: Frieder Schrempf , Liam Girdwood , linux-kernel@vger.kernel.org, Mark Brown , Robin Gong Cc: Marek Vasut , Per-Daniel Olsson , Rickard x Andersson , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= Subject: [PATCH 2/6] regulator: pca9450: Fix enable register for LDO5 Date: Mon, 13 Feb 2023 16:58:20 +0100 Message-Id: <20230213155833.1644366-3-frieder@fris.de> In-Reply-To: <20230213155833.1644366-1-frieder@fris.de> References: <20230213155833.1644366-1-frieder@fris.de> MIME-Version: 1.0 X-Last-TLS-Session-Version: TLSv1.3 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757732181016582087?= X-GMAIL-MSGID: =?utf-8?q?1757732181016582087?= From: Frieder Schrempf The LDO5 regulator has two configuration registers, but only LDO5CTRL_L contains the bits for enabling/disabling the regulator. Fixes: 0935ff5f1f0a ("regulator: pca9450: add pca9450 pmic driver") Signed-off-by: Frieder Schrempf Reviewed-by: Marek Vasut --- drivers/regulator/pca9450-regulator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/regulator/pca9450-regulator.c b/drivers/regulator/pca9450-regulator.c index c6351fac9f4d..a815666566b5 100644 --- a/drivers/regulator/pca9450-regulator.c +++ b/drivers/regulator/pca9450-regulator.c @@ -447,7 +447,7 @@ static const struct pca9450_regulator_desc pca9450a_regulators[] = { .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_reg = PCA9450_REG_LDO5CTRL_L, .enable_mask = LDO5H_EN_MASK, .owner = THIS_MODULE, }, @@ -656,7 +656,7 @@ static const struct pca9450_regulator_desc pca9450bc_regulators[] = { .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_reg = PCA9450_REG_LDO5CTRL_L, .enable_mask = LDO5H_EN_MASK, .owner = THIS_MODULE, }, From patchwork Mon Feb 13 15:58:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frieder Schrempf X-Patchwork-Id: 56359 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2423740wrn; Mon, 13 Feb 2023 08:01:19 -0800 (PST) X-Google-Smtp-Source: AK7set+rmYq74arjgDC/TT8afm+vroF7HoUFP1MXN8W+vvK47FoY7HTZrSZFyAauzDpvllUsLw/5 X-Received: by 2002:a05:6a20:3d90:b0:be:da0c:fc62 with SMTP id s16-20020a056a203d9000b000beda0cfc62mr34580178pzi.38.1676304079626; Mon, 13 Feb 2023 08:01:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676304079; cv=none; d=google.com; s=arc-20160816; b=RwIODV+J8ALua1EXwMvmj3EoBtfrzKTo5DjnI0EJ3Wj+uo+Aozm/Km4tKiEEZB4hQv 5NFL8A6W4eEskcPVXz6GYHEkCCNP7Ek2h1GyrrAu2Kk0KlzNa8gZ1gxNUwXehz4Z8FjD UPW16JndnIODrBqcAI8IGO/M0VNdCcqRyY9mNkwQMIm6ddnWIWjzCoVTwMmuJDSMXkyW vX3xzMLiOMowo3UOe2tDQAZXSVkjvh5DR20m7SEy/ehpWVcDr8WONP8CdLCMHBCBcXti YxbTLrbYQQRzmd5g76AOLeLrS+lemR9feIlGnpS3ovTlpHmdt/4MacMMa4nWVrbG6O7Y pshw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ewI3/QSFAFiKru2ko/nlJ095/aScxxTskV5+d8BLT6c=; b=yv5KfpSo/ogzNQZ1mRNxZ64rDhnjwcf9MJcxvYWt4s6jaRgBGcWCLeMYbEXSy0vJlu tsAe1TWgUlpROd8wcrb9FcgA1tpSNmM2dJwmBIpVFPPkk/rE5r/vGT0JyHB7rxuIuAb0 noKh88i1ugGkDw+wwdAJVkViCkGM3SLj0GJwJigg2u4C5K0ZHb72OyolZ8radL9+JTNu 1ELK0kebz564HYCulhsttF1NRVZXbV+GNS14vHcJhIPbNDeWVOCQ3yYhQqhwnVuouIab /MmVvQplBZm/9RXI+pqnOeuNmKkvkWjzUerD+YWHJQIf/m+HrIYqrHB35KPFPEYuJCzB LxRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fris.de header.s=dkim header.b=MkxlcLA5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=fris.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t64-20020a637843000000b004fb33c7c866si11590313pgc.225.2023.02.13.08.01.06; Mon, 13 Feb 2023 08:01:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@fris.de header.s=dkim header.b=MkxlcLA5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=fris.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231340AbjBMQAC (ORCPT + 99 others); Mon, 13 Feb 2023 11:00:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231377AbjBMP7y (ORCPT ); Mon, 13 Feb 2023 10:59:54 -0500 Received: from mail.fris.de (mail.fris.de [116.203.77.234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3061B170B for ; Mon, 13 Feb 2023 07:59:53 -0800 (PST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 62C89C02BC; Mon, 13 Feb 2023 16:59:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fris.de; s=dkim; t=1676303991; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=ewI3/QSFAFiKru2ko/nlJ095/aScxxTskV5+d8BLT6c=; b=MkxlcLA52COrYKwd2SoBvgutpxQZJImOoLVAkw9FeZ0nceRbak4lumMdpIsJWoWID4tQRy hXWpOQsrdLwCpl6poVxqDhir0lWNz+xjFxc+tiVvZIKLci6ydHnApMYS2+PvXWL076oQoF 9PXOo4LXv3qKFGSpwp00Up0AGN+l52Gj0j9BeCYNS3261Ixeeh9F5jUZMICnG+6nm8EXrN F9HcpKZYsherzW3CZcwXkhAZQGwsEa6F72qeP4N+qIhTQFAK5SUDmjsgoqqQBE3WQdvrWF onBq0yzO+ykz3kQC+lggNTL5DTqfHpbx72fqzWH3cLOsXV7ttWhy49Bdv2VTqQ== From: Frieder Schrempf To: Liam Girdwood , linux-kernel@vger.kernel.org, Mark Brown Cc: Marek Vasut , Frieder Schrempf , Per-Daniel Olsson , Rickard x Andersson , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= Subject: [PATCH 3/6] Revert "regulator: pca9450: Add SD_VSEL GPIO for LDO5" Date: Mon, 13 Feb 2023 16:58:21 +0100 Message-Id: <20230213155833.1644366-4-frieder@fris.de> In-Reply-To: <20230213155833.1644366-1-frieder@fris.de> References: <20230213155833.1644366-1-frieder@fris.de> MIME-Version: 1.0 X-Last-TLS-Session-Version: TLSv1.3 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757732226578607463?= X-GMAIL-MSGID: =?utf-8?q?1757732226578607463?= From: Frieder Schrempf This reverts commit 8c67a11bae889f51fe5054364c3c789dfae3ad73. It turns out that all boards using the PCA9450 actually have the SD_VSEL input conencted to the VSELECT signal of the SoCs SD/MMC interface. Therefore we don't need manual control for this signal via GPIO and threre aren't any users. Signed-off-by: Frieder Schrempf --- drivers/regulator/pca9450-regulator.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/drivers/regulator/pca9450-regulator.c b/drivers/regulator/pca9450-regulator.c index a815666566b5..804a22c0e376 100644 --- a/drivers/regulator/pca9450-regulator.c +++ b/drivers/regulator/pca9450-regulator.c @@ -5,7 +5,6 @@ */ #include -#include #include #include #include @@ -33,7 +32,6 @@ struct pca9450_regulator_desc { struct pca9450 { struct device *dev; struct regmap *regmap; - struct gpio_desc *sd_vsel_gpio; enum pca9450_chip_type type; unsigned int rcnt; int irq; @@ -834,18 +832,6 @@ static int pca9450_i2c_probe(struct i2c_client *i2c) } } - /* - * The driver uses the LDO5CTRL_H register to control the LDO5 regulator. - * This is only valid if the SD_VSEL input of the PMIC is high. Let's - * check if the pin is available as GPIO and set it to high. - */ - pca9450->sd_vsel_gpio = gpiod_get_optional(pca9450->dev, "sd-vsel", GPIOD_OUT_HIGH); - - if (IS_ERR(pca9450->sd_vsel_gpio)) { - dev_err(&i2c->dev, "Failed to get SD_VSEL GPIO\n"); - return PTR_ERR(pca9450->sd_vsel_gpio); - } - dev_info(&i2c->dev, "%s probed.\n", type == PCA9450_TYPE_PCA9450A ? "pca9450a" : "pca9450bc"); From patchwork Mon Feb 13 15:58:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frieder Schrempf X-Patchwork-Id: 56360 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2423882wrn; Mon, 13 Feb 2023 08:01:30 -0800 (PST) X-Google-Smtp-Source: AK7set/qeKTPzp1R4k19xhSwAGXquZ/w6WBcx9PCSMNkG+9VjDyUHRxfLvDQer74R2Kn87UsbbSc X-Received: by 2002:a05:6a20:938e:b0:be:d873:9998 with SMTP id x14-20020a056a20938e00b000bed8739998mr21269928pzh.4.1676304089929; Mon, 13 Feb 2023 08:01:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676304089; cv=none; d=google.com; s=arc-20160816; b=p8soYoN2ZuN6h2bCiK3QIyxf2/WPahG2SDKkXEkcOCcsdMelWuaXvImFZgN6rH+h+A BjKZBUlgnXNnGrckqTKkWRcZEE3ddXobiRYBk8nyUOwZBMbSXrnRWSMXzXyok+Lkx2of MUMNPH9MY746rucfczV3nI635R6/yx6/KFUyEt4U7jtyWLYtkGsJtxZ2UZmLFf3eVGOS RzCgF42EJhOZecDXPkYaS8N0AuSjoKMWKcMBAusc/KFJJzwBZ4wcf8McaCV6GUH4QoMP c+Lb+ORulhjh7bUwCnz7KJhXMCwm5jntBaLTornNNL/IJ677S6pVvP8pfgMCInV3f1j0 sIJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=puyx+iiRxk3cL3YhVNnHADs9ip7L0cjTR7aBYLsdwyo=; b=gSwCdYmUZ3xwHkY0XEQyRqdWdTDLWeI8rD66osjoIoKtmbqLxm8RBEz9MNuQu0okPV UqmEjkGvId2tbFQiqqELGVdAneYCL2QbSzv6zzzG4QT7YmehaX7YN0uCOzvW1iQ5YS29 eGTZdqa85ufULj2FyQmZOHFJprsxwSAh3cq5LKfUGRx3QjcRAiSGE4YR2KsGmZZ5oL9f CRUbpWtaEu3KxKSoQb55UrVACbmSaPmioWy5pXpxZVXJLNCr06vtVs0qm4v8NpBiHCKI BH+02uB/zsAUtqUXY/MZkTlmv+tCEzYCZ1+/6XLbcj5HTRTKkNlBZaBJn/VQ5PFC5PDz qTbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fris.de header.s=dkim header.b=tmp9fOAS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=fris.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d6-20020aa797a6000000b0059248a91d9bsi11824829pfq.127.2023.02.13.08.01.17; Mon, 13 Feb 2023 08:01:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@fris.de header.s=dkim header.b=tmp9fOAS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=fris.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231361AbjBMQAK (ORCPT + 99 others); Mon, 13 Feb 2023 11:00:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231334AbjBMQAF (ORCPT ); Mon, 13 Feb 2023 11:00:05 -0500 Received: from mail.fris.de (mail.fris.de [116.203.77.234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EA741E5E5 for ; Mon, 13 Feb 2023 08:00:01 -0800 (PST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 44F21BFC15; Mon, 13 Feb 2023 16:59:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fris.de; s=dkim; t=1676304000; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=puyx+iiRxk3cL3YhVNnHADs9ip7L0cjTR7aBYLsdwyo=; b=tmp9fOASxyTRGGPhZxA+uJ0cpOaxeKHEW7pENeYZ2WDn4rMWliOwJ3O7kG1j342DA7FyNy RZOLozTbA2I5K6Q4b1MHUWN1Zl2IEUH965pSkIwnUPJJBaQQP5nKqtiUo2oBiaTjrQOPwd eeUKCbdp1G29MGQz+n2lWzvurenzsPS3aSty2HDdjiLq5hxdBNCBhD/evPzxeZab//S09j AFakjs0zCwqgKVI/ggtzhJUpU3XrYYS8qXhmOjqNmYTh2qrk5hp/J39kc2AUFAi4rKDyI7 9kXiMB/JZLoJMO8S8DNGH3nBCtKRY8UwEJr9iM34MYsOY21N2y6/zDNctmHE8Q== From: Frieder Schrempf To: Liam Girdwood , linux-kernel@vger.kernel.org, Mark Brown Cc: Marek Vasut , Frieder Schrempf , ChiYuan Huang , Mauro Carvalho Chehab Subject: [PATCH 4/6] regulator: Add operation to let drivers select vsel register Date: Mon, 13 Feb 2023 16:58:22 +0100 Message-Id: <20230213155833.1644366-5-frieder@fris.de> In-Reply-To: <20230213155833.1644366-1-frieder@fris.de> References: <20230213155833.1644366-1-frieder@fris.de> MIME-Version: 1.0 X-Last-TLS-Session-Version: TLSv1.3 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757732237237567238?= X-GMAIL-MSGID: =?utf-8?q?1757732237237567238?= From: Frieder Schrempf There are regulators that use multiple registers for storing the voltage. Add a get_reg_voltage_sel member to struct regulator_ops in order to let drivers register a function that returns the currently used register. The pca9450 driver will be a user of this as the LDO5 regulator of that chip uses two different control registers depending on the state of an external signal. Signed-off-by: Frieder Schrempf --- drivers/regulator/helpers.c | 16 ++++++++++++++-- include/linux/regulator/driver.h | 5 +++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/regulator/helpers.c b/drivers/regulator/helpers.c index ad2237a95572..e629b0bea3d0 100644 --- a/drivers/regulator/helpers.c +++ b/drivers/regulator/helpers.c @@ -223,6 +223,16 @@ int regulator_set_voltage_sel_pickable_regmap(struct regulator_dev *rdev, } EXPORT_SYMBOL_GPL(regulator_set_voltage_sel_pickable_regmap); +unsigned int regulator_get_hwreg_voltage_sel_regmap(struct regulator_dev *rdev) +{ + const struct regulator_ops *ops = rdev->desc->ops; + + if (ops->get_reg_voltage_sel) + return ops->get_reg_voltage_sel(rdev); + + return rdev->desc->vsel_reg; +} + /** * regulator_get_voltage_sel_regmap - standard get_voltage_sel for regmap users * @@ -234,10 +244,11 @@ EXPORT_SYMBOL_GPL(regulator_set_voltage_sel_pickable_regmap); */ int regulator_get_voltage_sel_regmap(struct regulator_dev *rdev) { + unsigned int vsel_reg = regulator_get_hwreg_voltage_sel_regmap(rdev); unsigned int val; int ret; - ret = regmap_read(rdev->regmap, rdev->desc->vsel_reg, &val); + ret = regmap_read(rdev->regmap, vsel_reg, &val); if (ret != 0) return ret; @@ -260,11 +271,12 @@ EXPORT_SYMBOL_GPL(regulator_get_voltage_sel_regmap); */ int regulator_set_voltage_sel_regmap(struct regulator_dev *rdev, unsigned sel) { + unsigned int vsel_reg = regulator_get_hwreg_voltage_sel_regmap(rdev); int ret; sel <<= ffs(rdev->desc->vsel_mask) - 1; - ret = regmap_update_bits(rdev->regmap, rdev->desc->vsel_reg, + ret = regmap_update_bits(rdev->regmap, vsel_reg, rdev->desc->vsel_mask, sel); if (ret) return ret; diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h index d3b4a3d4514a..c9953b2f63d5 100644 --- a/include/linux/regulator/driver.h +++ b/include/linux/regulator/driver.h @@ -77,6 +77,10 @@ enum regulator_detection_severity { * @get_voltage_sel: Return the currently configured voltage selector for the * regulator; return -ENOTRECOVERABLE if regulator can't * be read at bootup and hasn't been set yet. + * @get_reg_voltage_sel: Return the register used for getting/setting the + * voltage of the regulator. This is useful if the + * regulator uses multiple registers internally, switched + * by some condition like the state of an external signal. * @list_voltage: Return one of the supported voltages, in microvolts; zero * if the selector indicates a voltage that is unusable on this system; * or negative errno. Selectors range from zero to one less than @@ -168,6 +172,7 @@ struct regulator_ops { int (*set_voltage_sel) (struct regulator_dev *, unsigned selector); int (*get_voltage) (struct regulator_dev *); int (*get_voltage_sel) (struct regulator_dev *); + unsigned int (*get_reg_voltage_sel) (struct regulator_dev *); /* get/set regulator current */ int (*set_current_limit) (struct regulator_dev *, From patchwork Mon Feb 13 15:58:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frieder Schrempf X-Patchwork-Id: 56361 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2424631wrn; Mon, 13 Feb 2023 08:02:28 -0800 (PST) X-Google-Smtp-Source: AK7set+h/da84nZW+UyVxx3Ud07m7FxcnZj5y0D3kCGEp0o3xEs3yqSj/L/Fbe+0hcIl46cv0rMt X-Received: by 2002:a05:6a20:8e03:b0:be:e0c3:5012 with SMTP id y3-20020a056a208e0300b000bee0c35012mr19758296pzj.1.1676304147914; Mon, 13 Feb 2023 08:02:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676304147; cv=none; d=google.com; s=arc-20160816; b=rudg0re4KkOK2UH1r9n0lwTgA3GUfoom8BVVZe4LUWhaaTVIUQ2brS0OwslONblHFe Rri46+zYlWfdH9pVOyKQQrFwdaP8RNmd6sU2FsQqxhdp4hKd3Kmn2Sh9R0t9FoA5Wuq5 0XLEypc8iGa1RRax+SDTwWUvFni5CrjxwnyJ2IV5jypdi6+1DBn0loa9KTfYcxvM45/+ Fphh+MFwxVs9yg3F+6+FA+Ctj7UJe4lDpsGzXNeIUWOAkwG0GhKwzL8ms+1CtSAsuJyi OhCV6p7J0irOifIGLb3bsSpdKS6pXxC3DmllPqq59V1V1VGBwSvFq0Dyh0lV8c7+xmMW 2Alw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hUmCZGE2wb9knP0v6NH5JhHMF782alLAiH/tuWKzmDI=; b=CqA+CFK/R5rck6pnb855Wn+GtIwSY/AbKcSGpcznPl5BUd5Wwc7fxqOTUxsB1G6lXD 7CRT+hn/wZSVVYJfxE5U5kVOMs0g7Bkv1aKC2S7xhvffwXUmKRsqZ42vfVlTRz8r0Lxs Q/GG6rW8BNc2JYL9D641/WgZ+QHZRe/63Z69gW7B1rs2mAVl8Veo+LWUy8Kc9e7mj4RV uGBRvt5A1R0lMo8S7mrvaKD1Npe/h8zUB9jmReaVtR5nMXdrEIlt8tCCu5G56MSd8Ekd trDgxH9cEUjm8nC7fJWmNUkaWDjfQZohPJmcBHFCI/KQhEjHjrhpBsm5LdKvFiFSapfY QCXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fris.de header.s=dkim header.b=CA2KQRUa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=fris.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e70-20020a636949000000b004c76dcc99c2si12800127pgc.334.2023.02.13.08.02.14; Mon, 13 Feb 2023 08:02:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@fris.de header.s=dkim header.b=CA2KQRUa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=fris.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231320AbjBMQAX (ORCPT + 99 others); Mon, 13 Feb 2023 11:00:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231350AbjBMQAS (ORCPT ); Mon, 13 Feb 2023 11:00:18 -0500 Received: from mail.fris.de (mail.fris.de [116.203.77.234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3BB91C5B4 for ; Mon, 13 Feb 2023 08:00:07 -0800 (PST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 1D720BFC15; Mon, 13 Feb 2023 17:00:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fris.de; s=dkim; t=1676304005; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=hUmCZGE2wb9knP0v6NH5JhHMF782alLAiH/tuWKzmDI=; b=CA2KQRUaBqNL3lxReuQirhcBjLTKO4rM3/huFqcxhar9gVyheiCLb+3i//IttMumrfJtqy tB0oCBpnSetCEqlQ3i/Y36KbHYo93Uwx0V4TlQh57MRgCK2DP/XHkobUVftj83QCcqa5bm spg+7uyL4fI7No4HAH/iavXn3MWSFSI8+XdoWlPqwKPc5Bxa5ddj1ru1Ugogt/YW8KApfR J03OQf+8zlEbbiiO4dfzTTuHZ3R8duWPvFe2Gk27Ma4KgUfClLW4Ykfka8nC8a/1vmdtxh 8DuL9b0jS7rFZyZ0s86ErGXorNcUCdC0IfQgtxovX0sRjG/nbgjbcL2kGIDwrQ== From: Frieder Schrempf To: Liam Girdwood , linux-kernel@vger.kernel.org, Mark Brown Cc: Marek Vasut , Frieder Schrempf , Per-Daniel Olsson , Rickard x Andersson , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= Subject: [PATCH 5/6] regulator: pca9450: Fix control register for LDO5 Date: Mon, 13 Feb 2023 16:58:23 +0100 Message-Id: <20230213155833.1644366-6-frieder@fris.de> In-Reply-To: <20230213155833.1644366-1-frieder@fris.de> References: <20230213155833.1644366-1-frieder@fris.de> MIME-Version: 1.0 X-Last-TLS-Session-Version: TLSv1.3 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757732298215070741?= X-GMAIL-MSGID: =?utf-8?q?1757732298215070741?= From: Frieder Schrempf For LDO5 we need to be able to check the status of the SD_VSEL input in order to know which control register is used. Read the status of the SD_VSEL signal via GPIO and add a get_reg_voltage_sel operation for LDO5 that returns the register that is currently in use to the core. Signed-off-by: Frieder Schrempf --- drivers/regulator/pca9450-regulator.c | 45 ++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/drivers/regulator/pca9450-regulator.c b/drivers/regulator/pca9450-regulator.c index 804a22c0e376..a0802c6cb259 100644 --- a/drivers/regulator/pca9450-regulator.c +++ b/drivers/regulator/pca9450-regulator.c @@ -5,6 +5,7 @@ */ #include +#include #include #include #include @@ -32,6 +33,7 @@ struct pca9450_regulator_desc { struct pca9450 { struct device *dev; struct regmap *regmap; + struct gpio_desc *sd_vsel_gpio; enum pca9450_chip_type type; unsigned int rcnt; int irq; @@ -55,6 +57,16 @@ static const struct regmap_config pca9450_regmap_config = { .cache_type = REGCACHE_RBTREE, }; +static unsigned int pca9450_ldo5_get_reg_voltage_sel(struct regulator_dev *rdev) +{ + struct pca9450 *pca9450 = rdev_get_drvdata(rdev); + + if (pca9450->sd_vsel_gpio && !gpiod_get_value(pca9450->sd_vsel_gpio)) + return PCA9450_REG_LDO5CTRL_L; + + return PCA9450_REG_LDO5CTRL_H; +} + /* * BUCK1/2/3 * BUCK1RAM[1:0] BUCK1 DVS ramp rate setting @@ -97,6 +109,16 @@ static const struct regulator_ops pca9450_ldo_regulator_ops = { .get_voltage_sel = regulator_get_voltage_sel_regmap, }; +static const struct regulator_ops pca9450_ldo5_regulator_ops = { + .enable = regulator_enable_regmap, + .disable = regulator_disable_regmap, + .is_enabled = regulator_is_enabled_regmap, + .list_voltage = regulator_list_voltage_linear_range, + .set_voltage_sel = regulator_set_voltage_sel_regmap, + .get_voltage_sel = regulator_get_voltage_sel_regmap, + .get_reg_voltage_sel = pca9450_ldo5_get_reg_voltage_sel, +}; + /* * BUCK1/2/3 * 0.60 to 2.1875V (12.5mV step) @@ -438,12 +460,11 @@ static const struct pca9450_regulator_desc pca9450a_regulators[] = { .of_match = of_match_ptr("LDO5"), .regulators_node = of_match_ptr("regulators"), .id = PCA9450_LDO5, - .ops = &pca9450_ldo_regulator_ops, + .ops = &pca9450_ldo5_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_L, .enable_mask = LDO5H_EN_MASK, @@ -647,12 +668,11 @@ static const struct pca9450_regulator_desc pca9450bc_regulators[] = { .of_match = of_match_ptr("LDO5"), .regulators_node = of_match_ptr("regulators"), .id = PCA9450_LDO5, - .ops = &pca9450_ldo_regulator_ops, + .ops = &pca9450_ldo5_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_L, .enable_mask = LDO5H_EN_MASK, @@ -705,6 +725,7 @@ static int pca9450_i2c_probe(struct i2c_client *i2c) of_device_get_match_data(&i2c->dev); const struct pca9450_regulator_desc *regulator_desc; struct regulator_config config = { }; + struct regulator_dev *ldo5; struct pca9450 *pca9450; unsigned int device_id, i; unsigned int reset_ctrl; @@ -770,6 +791,7 @@ static int pca9450_i2c_probe(struct i2c_client *i2c) config.regmap = pca9450->regmap; config.dev = pca9450->dev; + config.driver_data = pca9450; rdev = devm_regulator_register(pca9450->dev, desc, &config); if (IS_ERR(rdev)) { @@ -779,6 +801,9 @@ static int pca9450_i2c_probe(struct i2c_client *i2c) desc->name, ret); return ret; } + + if (!strcmp(desc->name, "ldo5")) + ldo5 = rdev; } ret = devm_request_threaded_irq(pca9450->dev, pca9450->irq, NULL, @@ -832,6 +857,18 @@ static int pca9450_i2c_probe(struct i2c_client *i2c) } } + /* + * For LDO5 we need to be able to check the status of the SD_VSEL input in + * order to know which control register is used. Most boards connect SD_VSEL + * to the VSELECT signal, so we can use the GPIO that is internally routed + * to this signal (if SION bit is set in IOMUX). + */ + pca9450->sd_vsel_gpio = gpiod_get_optional(&ldo5->dev, "sd-vsel", GPIOD_IN); + if (IS_ERR(pca9450->sd_vsel_gpio)) { + dev_err(&i2c->dev, "Failed to get SD_VSEL GPIO\n"); + return ret; + } + dev_info(&i2c->dev, "%s probed.\n", type == PCA9450_TYPE_PCA9450A ? "pca9450a" : "pca9450bc"); From patchwork Mon Feb 13 15:58:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frieder Schrempf X-Patchwork-Id: 56362 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2425440wrn; Mon, 13 Feb 2023 08:03:25 -0800 (PST) X-Google-Smtp-Source: AK7set+LKY6DV81E5ttZZijdAK9O0X01iobAkCpp7S547QKwsi/9Nu2Ptw0SVT3MeR1x05XstsF+ X-Received: by 2002:a17:90a:194:b0:234:8cd:c0e4 with SMTP id 20-20020a17090a019400b0023408cdc0e4mr2824271pjc.23.1676304205222; Mon, 13 Feb 2023 08:03:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676304205; cv=none; d=google.com; s=arc-20160816; b=hhXtu5FziX8mPg7PJw5ixOuXZ8c8syd+psg5f8FBFaGN80X8AfQUG+WOarWeD39QBC l2dqTvXmnP11GtGpA2AzzaDyGkcs4NGDdhK4pfwJVbEWgIh7glCpPbRJ5gPLAalIUapg uejdq466j7mvY1XZiLri0XjGc7W+j5ledb5R45JAucjTfrO7nJHjtznWRsyI+FOu289I YqMxCObHyY8mQfxk+7Ch9kgihNKYTc6Nzy2pRcUDPX67pN3dIjSNWEpjknXuKV1+rVsZ H0a4ehIAAVgmTVzsx4W83lSF/Gw6U/5DOqfI23WBcaBId/9r5zvOORTg641jhAjXW+7K SyHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=64grUIMOl3DlMA5X19kZ/0poE7psMX9YME1d/5PcVes=; b=qdzF2yekgSdQRBnljVsSqygMLtZztRrYUvtwNZjzt5YeqWZ4+ILSMS9qOkwPc5WeOC 5KQNUaSyx1RigKydVnil+eHPOQYsYWkcN3QvdoAT0rX1vwT8PAW6fBua5GGUTrArui3d qBksahHiI72pqdegxwlUG8ZvfdHTBT3PrDGS0iMOhCa2CNsT91ORTdGprpBJ+C9ngHx/ hYekuuRZCe386OL8RFxOtCAowSTZZ6j59DCYOIHAu0m6RTaUe3ChBAQsgEMLVYmlyp0w Rgs6eUTL5QO2qrC7dxIdc4K0KgYT6+V7q+62zaqSASBc32LCb53kgj2wY0yGbUX5A24j Fv+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fris.de header.s=dkim header.b=L1VOGI7O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=fris.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pg9-20020a17090b1e0900b0023418ec51f8si972936pjb.136.2023.02.13.08.03.12; Mon, 13 Feb 2023 08:03:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@fris.de header.s=dkim header.b=L1VOGI7O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=fris.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231354AbjBMQBG (ORCPT + 99 others); Mon, 13 Feb 2023 11:01:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231324AbjBMQBE (ORCPT ); Mon, 13 Feb 2023 11:01:04 -0500 Received: from mail.fris.de (mail.fris.de [IPv6:2a01:4f8:c2c:390b::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADFE6170B; Mon, 13 Feb 2023 08:00:53 -0800 (PST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id EBEF3BFBAC; Mon, 13 Feb 2023 17:00:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fris.de; s=dkim; t=1676304051; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=64grUIMOl3DlMA5X19kZ/0poE7psMX9YME1d/5PcVes=; b=L1VOGI7OPRvZoeEBiIL1YvtAeloc7cXo3N7YfGaR5Hi1zjjfZ5jesKbiFzSvYqAhnI9AZF 5OSEmWIZIcsKIWFFN1UTBEljQoqM3M9ZjYKXJTZu8ycyPP/T0eusqmZKlgyWhMVdos9mwR fE20FwWJbTN6Ez+EuVTv2B5PcQuHrgdQVCaWncDr6laHOVhuIT0B/UcFZa2qdvp/KupjFm Qqcdwu+SFZDcrbZwnyl4oHCjvhMzQ1tm++X+d+hm01mV/d8Qcc0An/a2Ua9m7jkCZDR8W0 mbch8+RupRbo5WEChlWVcAwnBvBRaMVywoVog+751zcBgsztjq5hR2bBeTPk8g== From: Frieder Schrempf To: devicetree@vger.kernel.org, Krzysztof Kozlowski , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Rob Herring , Sascha Hauer , Shawn Guo Cc: Marek Vasut , Frieder Schrempf , Fabio Estevam , Heiko Thiery , Krzysztof Kozlowski , NXP Linux Team , Oleksij Rempel , Pengutronix Kernel Team Subject: [PATCH 6/6] arm64: dts: imx8mm-kontron: Add support for reading SD_VSEL signal Date: Mon, 13 Feb 2023 16:58:24 +0100 Message-Id: <20230213155833.1644366-7-frieder@fris.de> In-Reply-To: <20230213155833.1644366-1-frieder@fris.de> References: <20230213155833.1644366-1-frieder@fris.de> MIME-Version: 1.0 X-Last-TLS-Session-Version: TLSv1.3 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757732358098449478?= X-GMAIL-MSGID: =?utf-8?q?1757732358098449478?= From: Frieder Schrempf This fixes the LDO5 regulator handling of the pca9450 driver by taking the status of the SD_VSEL into account to determine which configuration register is used for the voltage setting. Even without this change there is no functional issue, as the code for switching the voltage in sdhci.c currently switches both, the VSELECT/SD_VSEL signal and the regulator voltage at the same time and doesn't run into an invalid corner case. We should still make sure, that we always use the correct register when controlling the regulator. At least in U-Boot this fixes an actual bug where the wrong IO voltage is used. Signed-off-by: Frieder Schrempf --- arch/arm64/boot/dts/freescale/imx8mm-kontron-bl-osm-s.dts | 6 +++--- arch/arm64/boot/dts/freescale/imx8mm-kontron-bl.dts | 6 +++--- arch/arm64/boot/dts/freescale/imx8mm-kontron-osm-s.dtsi | 1 + arch/arm64/boot/dts/freescale/imx8mm-kontron-sl.dtsi | 1 + 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/arch/arm64/boot/dts/freescale/imx8mm-kontron-bl-osm-s.dts b/arch/arm64/boot/dts/freescale/imx8mm-kontron-bl-osm-s.dts index 8b16bd68576c..bdcd9cd843c7 100644 --- a/arch/arm64/boot/dts/freescale/imx8mm-kontron-bl-osm-s.dts +++ b/arch/arm64/boot/dts/freescale/imx8mm-kontron-bl-osm-s.dts @@ -344,7 +344,7 @@ MX8MM_IOMUXC_SD2_DATA1_USDHC2_DATA1 0x1d0 MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2 0x1d0 MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3 0x1d0 MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x019 - MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x1d0 + MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x400001d0 >; }; @@ -357,7 +357,7 @@ MX8MM_IOMUXC_SD2_DATA1_USDHC2_DATA1 0x1d4 MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2 0x1d4 MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3 0x1d4 MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x019 - MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x1d0 + MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x400001d0 >; }; @@ -370,7 +370,7 @@ MX8MM_IOMUXC_SD2_DATA1_USDHC2_DATA1 0x1d6 MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2 0x1d6 MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3 0x1d6 MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x019 - MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x1d0 + MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x400001d0 >; }; }; diff --git a/arch/arm64/boot/dts/freescale/imx8mm-kontron-bl.dts b/arch/arm64/boot/dts/freescale/imx8mm-kontron-bl.dts index a079322a3793..ba2a4491cf31 100644 --- a/arch/arm64/boot/dts/freescale/imx8mm-kontron-bl.dts +++ b/arch/arm64/boot/dts/freescale/imx8mm-kontron-bl.dts @@ -321,7 +321,7 @@ MX8MM_IOMUXC_SD2_DATA1_USDHC2_DATA1 0x1d0 MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2 0x1d0 MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3 0x1d0 MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x019 - MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x1d0 + MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x400001d0 >; }; @@ -334,7 +334,7 @@ MX8MM_IOMUXC_SD2_DATA1_USDHC2_DATA1 0x1d4 MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2 0x1d4 MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3 0x1d4 MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x019 - MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x1d0 + MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x400001d0 >; }; @@ -347,7 +347,7 @@ MX8MM_IOMUXC_SD2_DATA1_USDHC2_DATA1 0x1d6 MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2 0x1d6 MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3 0x1d6 MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x019 - MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x1d0 + MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x400001d0 >; }; }; diff --git a/arch/arm64/boot/dts/freescale/imx8mm-kontron-osm-s.dtsi b/arch/arm64/boot/dts/freescale/imx8mm-kontron-osm-s.dtsi index 5172883717d1..90daaf54e704 100644 --- a/arch/arm64/boot/dts/freescale/imx8mm-kontron-osm-s.dtsi +++ b/arch/arm64/boot/dts/freescale/imx8mm-kontron-osm-s.dtsi @@ -196,6 +196,7 @@ reg_nvcc_sd: LDO5 { regulator-name = "NVCC_SD (LDO5)"; regulator-min-microvolt = <1800000>; regulator-max-microvolt = <3300000>; + sd-vsel-gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>; }; }; }; diff --git a/arch/arm64/boot/dts/freescale/imx8mm-kontron-sl.dtsi b/arch/arm64/boot/dts/freescale/imx8mm-kontron-sl.dtsi index 1f8326613ee9..7468a8aa771d 100644 --- a/arch/arm64/boot/dts/freescale/imx8mm-kontron-sl.dtsi +++ b/arch/arm64/boot/dts/freescale/imx8mm-kontron-sl.dtsi @@ -195,6 +195,7 @@ reg_nvcc_sd: LDO5 { regulator-name = "NVCC_SD (LDO5)"; regulator-min-microvolt = <1800000>; regulator-max-microvolt = <3300000>; + sd-vsel-gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>; }; }; };