From patchwork Thu Apr 6 17:17:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 80363 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1192059vqo; Thu, 6 Apr 2023 10:33:10 -0700 (PDT) X-Google-Smtp-Source: AKy350aMdN6CpwNhUxx5CjTjDgMa/gU8fVoRsd2yq6roCB25MnbNnCNCBo9RBgObGIecJ+pN98un X-Received: by 2002:a17:90b:3802:b0:233:c301:32b3 with SMTP id mq2-20020a17090b380200b00233c30132b3mr12159293pjb.3.1680802390202; Thu, 06 Apr 2023 10:33:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680802390; cv=none; d=google.com; s=arc-20160816; b=SDKz9zjUPrERQ9ZZw9lC92gmz3apFL2SRWGBw8ZL9Qr6gMgrlC8hxLQQWwQ/p+nSuG wVxRHh7C+RGfQi0xtjQrWt3mqJOt4V0UbdX+0Zr66GkQZNpED4cCjRIWcfnz7r3gLq1B FPbKolipMqMdAN7yFSZxf9+Ywc7tg2GTIoT+pe9+v7cFEMXag5zuWtPv0+jycTgcKqLn O0P4//e1Dx14D1U1Cx6LCPHEtfEgCahHFBlWCGGqotN2SMqWIt8NShNA7LRKPfoxypP9 aSSO7iP3S+6pKGQziJ5Y+kD4wO7wnNktvDDqxFUHC6jCCAb4d1Aw2YGUlyngGEsdKQQY HRag== 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=+Yp6B6vhdp6a7lzJnKn8bic10DzYnwYB4YOw7ERIQ9I=; b=gx6MvOenv6liFjqYXv9vkMWp1MnN0eOYO8AY38Tbdt4D7eVJkT+o6SM4VXuUBkhDXL vaQ97Cyqwh/KjohF9pQ8w74j921kryVuyIN3PmdJjpbkN/6JKXwaoqj4BQEGeevoZq3Z 1kJARCgppd7VNM9pgCu3YSLB0TqMGJLecPmDJOf8ZDOv4Z+Ew/wZ8qMF3ZT+PoPjgqcX r913BX0fpSbFrB3/cXYDJzZ4cFi/slxUb1rlp2RFbg9lvLyPyWZq8hWzeeZOiH13mSuO SASn30e3hN3NFj5PIIB8A1nmM737PD8ubPt/nDfMuMDcs5XanLEUWfgUFXXFS4FdEAte qAuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=RKPJUWOy; 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=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f7-20020a17090ab94700b00230c8e3ed4bsi4385584pjw.24.2023.04.06.10.32.31; Thu, 06 Apr 2023 10:33:10 -0700 (PDT) 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=@collabora.com header.s=mail header.b=RKPJUWOy; 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=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239353AbjDFRST (ORCPT + 99 others); Thu, 6 Apr 2023 13:18:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239208AbjDFRSR (ORCPT ); Thu, 6 Apr 2023 13:18:17 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C45E68A5B; Thu, 6 Apr 2023 10:18:15 -0700 (PDT) Received: from localhost (unknown [188.27.34.213]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: cristicc) by madras.collabora.co.uk (Postfix) with ESMTPSA id 4897666031CA; Thu, 6 Apr 2023 18:18:14 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1680801494; bh=pLRtimAMK8xZZG9VOP5UPhlbV7ruDA4KIYdGHVjscvM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RKPJUWOyhM28Q1PB7BPsnRaSwoxFXvnqW/JmAEkt4SwM+u+IYSeY40kDgi778ag7F sYOhG/R4CT7IrXlqizuXb+cqtNg9sVkp4dmTSxv4K4cJafFpCxZC3S3+5/UHXqqhc3 em+QicXABp3XhzFVCfffjL/qF0ihFesD5xv83/L0xHJOydo7Qs9xXNwRDuYs7HC9jO y0O8g/K5Gnp1E0UMSfXvVy1gfNclIWRKg3o2/W2+eT3LUiosvD9YpmJEBBj2ruktrb QLHljNoZ4ssJrWlizmw3b52F0H0Hy4omacx45foTTbJGAZVIA+ay37AjPZJg8MQuaT g6erqSzMbibBw== From: Cristian Ciocaltea To: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Heiko Stuebner , Bjorn Andersson , Joseph Chen , Ezequiel Garcia Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kernel@collabora.com Subject: [PATCH v2 1/8] regulator: dt-bindings: fcs,fan53555: Add support for RK860X Date: Thu, 6 Apr 2023 20:17:59 +0300 Message-Id: <20230406171806.948290-2-cristian.ciocaltea@collabora.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230406171806.948290-1-cristian.ciocaltea@collabora.com> References: <20230406171806.948290-1-cristian.ciocaltea@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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?1762449047378541355?= X-GMAIL-MSGID: =?utf-8?q?1762449047378541355?= Add compatibles to support Rockchip RK860X regulators. RK8600/RK8601 are pretty similar to the FAN53555 regulators, while RK8602/RK8603 are a bit different, having a wider voltage selection range. Signed-off-by: Cristian Ciocaltea --- .../bindings/regulator/fcs,fan53555.yaml | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/Documentation/devicetree/bindings/regulator/fcs,fan53555.yaml b/Documentation/devicetree/bindings/regulator/fcs,fan53555.yaml index c0dbba843f70..7547c130ff7d 100644 --- a/Documentation/devicetree/bindings/regulator/fcs,fan53555.yaml +++ b/Documentation/devicetree/bindings/regulator/fcs,fan53555.yaml @@ -14,12 +14,22 @@ allOf: properties: compatible: - enum: - - fcs,fan53555 - - fcs,fan53526 - - silergy,syr827 - - silergy,syr828 - - tcs,tcs4525 + oneOf: + - items: + - enum: + - fcs,fan53555 + - fcs,fan53526 + - rockchip,rk8600 + - rockchip,rk8602 + - silergy,syr827 + - silergy,syr828 + - tcs,tcs4525 + - items: + - const: rockchip,rk8601 + - const: rockchip,rk8600 + - items: + - const: rockchip,rk8603 + - const: rockchip,rk8602 reg: maxItems: 1 From patchwork Thu Apr 6 17:18:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 80358 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1184819vqo; Thu, 6 Apr 2023 10:20:12 -0700 (PDT) X-Google-Smtp-Source: AKy350a5biqqtnqqQUYYbfAwDQlh8UUq0tRvx4zUDR1Pkk/lZIkTM4Ru+XeBZjzuSc16PKguourZ X-Received: by 2002:aa7:d518:0:b0:4c0:9bd7:54cc with SMTP id y24-20020aa7d518000000b004c09bd754ccmr309985edq.11.1680801612414; Thu, 06 Apr 2023 10:20:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680801612; cv=none; d=google.com; s=arc-20160816; b=DxjE5GCiuA+i2J0ZSFQ8KxqEDOPcargBCvLJt0MwDje7pTLpMNoRc1+DVSdYr/Ogiw yu9hshzXWrgSifuFTWyKJu/tRAAgzIGpp8Bp7QaWpnfKu1w39/utn0GNoOh3kOK1DPkI 9qr5oiv4I0Nooyfubq+KMbaxcs02zPzBm9R2JBg76dKeAiwOTsiLaiiwL37VP/nvPXH4 tNIT3EAg/4sW8bI2WZE+pEyOgm7aXA/LxiQWC/vEBJjBxPKnpnfrAYzADc7jCdOvUzYW O/OjDBuycBfRzstldBe0SSZQrc61g4iRc3V+RAmHq8Oygl5b5GBRrMuatAVw2fiJ4yga uElg== 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=ZTkIHTAaWcmCAdfh8LEoseDgXTgaeNEHoaGgbbSmg1w=; b=gvoNz9YLzchcO7MNJuLiP3WYEOC9aoeCb0gTUI+khOpy99W2dCDy9KNUzYTx7YA+vs x+iRcUuIB66OKuvG4x/zU5b7ipmtBHdtRtzderJLS9pmZL8BChKNiFfuoTnDOrEjI43c mmzFY2AnwZd/6bulKd523Hqh2prbzrPNA43uYcf7icofMAKvjmUYoP0vO6qq//XebzJz +yV2RNDV6EYId5+7QZ1nPwUyEnWgLv+3WxL98EKN0SrWRUNX9NtBJvaMiCtiKLZ99M4D ebQ1ysdTBoIx/QPo3ltCM1YYi+d6n4FRKMqr08T34idehtvnqyBMixY6wU3LNiZFWTSF EzKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=YKxZ5geP; 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=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n26-20020a170906379a00b00930371d2698si1406977ejc.894.2023.04.06.10.19.25; Thu, 06 Apr 2023 10:20:12 -0700 (PDT) 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=@collabora.com header.s=mail header.b=YKxZ5geP; 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=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239471AbjDFRSW (ORCPT + 99 others); Thu, 6 Apr 2023 13:18:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239398AbjDFRST (ORCPT ); Thu, 6 Apr 2023 13:18:19 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C91475FDB; Thu, 6 Apr 2023 10:18:18 -0700 (PDT) Received: from localhost (unknown [188.27.34.213]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: cristicc) by madras.collabora.co.uk (Postfix) with ESMTPSA id 7F8FA66031CD; Thu, 6 Apr 2023 18:18:17 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1680801497; bh=DMsss3S5xTQ3vBQF9dvbUFqzefuTEWVYo2dfHUqUcKc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YKxZ5gePb8ndrxeBAkwjljaCvho1N/q1cGnl0K8S3BGELL+AogCDIBNFCTraV/uCa bAKwXnbQOLCOBaSkxu8c/FwdNbSqGbfNlBISL8NLY07kO3BJFvkSCmwC1WLySv+COK +IlyYip6sdlbck++XR6XW0Us24VsTjE/87lTAMu43+06598O1bMEfMtyaOo54JE5qr ixGwWdXp8h5Hb6pRwCnSTIkITost+V272zVADSgAkMDipyEbk9V712ZsIToh3tS22z tb9zwo498HchQ3nI6YDakzIOsl199xUNfkIXYVFXjvdInxoHNBK+vOAtSYXXkR4DZ6 yh2seXxBq6bWQ== From: Cristian Ciocaltea To: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Heiko Stuebner , Bjorn Andersson , Joseph Chen , Ezequiel Garcia Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kernel@collabora.com Subject: [PATCH v2 2/8] regulator: fan53555: Explicitly include bits header Date: Thu, 6 Apr 2023 20:18:00 +0300 Message-Id: <20230406171806.948290-3-cristian.ciocaltea@collabora.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230406171806.948290-1-cristian.ciocaltea@collabora.com> References: <20230406171806.948290-1-cristian.ciocaltea@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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?1762448231606958441?= X-GMAIL-MSGID: =?utf-8?q?1762448231606958441?= Since commit f2a9eb975ab2 ("regulator: fan53555: Add support for FAN53526") the driver makes use of the BIT() macro, but relies on the bits header being implicitly included. Explicitly pull the header in to avoid potential build failures in some configurations. While here, reorder include directives alphabetically. Fixes: f2a9eb975ab2 ("regulator: fan53555: Add support for FAN53526") Signed-off-by: Cristian Ciocaltea --- drivers/regulator/fan53555.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/regulator/fan53555.c b/drivers/regulator/fan53555.c index d0c678767294..0754c370a21c 100644 --- a/drivers/regulator/fan53555.c +++ b/drivers/regulator/fan53555.c @@ -8,18 +8,19 @@ // Copyright (c) 2012 Marvell Technology Ltd. // Yunfan Zhang +#include +#include +#include #include +#include #include -#include #include +#include #include +#include #include #include -#include -#include #include -#include -#include /* Voltage setting */ #define FAN53555_VSEL0 0x00 From patchwork Thu Apr 6 17:18:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 80375 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1193746vqo; Thu, 6 Apr 2023 10:36:03 -0700 (PDT) X-Google-Smtp-Source: AKy350YmNuolOPY4aE9k0lmbucZi4Xyt8i8dTW1zNiWUnH09+1ETpsZsuJWxiVqhh2tMFDCHXHoO X-Received: by 2002:a05:6a20:6aa6:b0:cc:d96c:1090 with SMTP id bi38-20020a056a206aa600b000ccd96c1090mr377526pzb.2.1680802563127; Thu, 06 Apr 2023 10:36:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680802563; cv=none; d=google.com; s=arc-20160816; b=X6+rXWG4sBjLwnzdGtERg2dtROmH8vU1uZ/rp4+ihn7BoRf6w0z/wgoovLJUFBKzLO ktf/xaUYV4anFj8LYnVpWta+eeGymh5FQ7dK6I50e3i29tzx0UJvph5tUTu4Xs0YjNbK 5Ydq+5IrcC1TJC1lySolWNSWuoQUGBgr+CylV+faOCEGfRMWnKlcA43lHh7KVggoBLoj iwi/9svmxb2MxCWiiDC2drIZ52mjw+E1sOA4DN5Y1SEso1DkXF8TCGqaK9Mf21Zo2Vp3 t6pp00CubChtpPiV9VQMLPR2p9q7E4ha6u8R4vuQswz0RpmAdMweIhHwXLqdmaAQI4Oh jmHQ== 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=7dt069c8NJSutavb/KHBQd046A/DpjlsUVruXM3SBao=; b=Iq7nAbsRZ1K7c7+aEOWxqrkx49pDKp6YRdeeH3+Ps7g+qslGjCEt/tAozfuZ42J8if xtixD1W0O2ielWB8gHGrX53A8ZbozBO+VxhO8X4gQTIzeq/QWJGYky3TbtZYWrdqaVoX E6ECQwc0stAhmUTb7lpuCUqCcgysiHYX70tviI98/R67ICeYEZniIJeqhMUohnePnW0I mP/MimOqVbbV7guIAnZJuOq2pcPF5BFus0YEzG/4S7DVaoZs4QvAhLOW+RlHu6H9ylKR W7L1l9bdwgWqgJpeUXXW86xdeiCm/WIvaiBJAzGzKWcFgDdWM5UmQhv51Fl9qOKdf+/7 k7eA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=DqNAB+Dk; 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=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bs127-20020a632885000000b0050b1a4d8625si1683663pgb.723.2023.04.06.10.35.49; Thu, 06 Apr 2023 10:36:03 -0700 (PDT) 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=@collabora.com header.s=mail header.b=DqNAB+Dk; 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=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239398AbjDFRSb (ORCPT + 99 others); Thu, 6 Apr 2023 13:18:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239513AbjDFRS0 (ORCPT ); Thu, 6 Apr 2023 13:18:26 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC3AC977F; Thu, 6 Apr 2023 10:18:21 -0700 (PDT) Received: from localhost (unknown [188.27.34.213]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: cristicc) by madras.collabora.co.uk (Postfix) with ESMTPSA id 725BE66031CB; Thu, 6 Apr 2023 18:18:20 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1680801500; bh=lFOZ5esxl/tbYIcE53Cn4DHfBeM2O3R87VdL+HeZPkw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DqNAB+DkL1pKNih8XoenkmU0wKLDk8DyjxEBQX7AmLSJH/EqJywyOurgpcXYtfrO+ qg33/YtaBeISAjtp/4dM1kNpIIjialOUuTaDhukDpPrDyAwwhPoCMu6O0RV2FLmXiO NoEFu4vqxldA8AraNJWP9aTJuWbmhSNffr5kok0hZoNEansUfYziZyZUGHXLb9NE+g acQjwVJ6ZUCxXgBjveTNunoFId7TqA5T3j2m6+jfrZKZYHxOb+WjHAChxrYRiLUUFe o4c4CMMMXm0/dCRRM8T3uyZ69froNwKTJ/ISRgTQa64ghhBzZR6CNIEVbVsugmlhsZ gJJfwdqCj87gQ== From: Cristian Ciocaltea To: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Heiko Stuebner , Bjorn Andersson , Joseph Chen , Ezequiel Garcia Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kernel@collabora.com Subject: [PATCH v2 3/8] regulator: fan53555: Fix wrong TCS_SLEW_MASK Date: Thu, 6 Apr 2023 20:18:01 +0300 Message-Id: <20230406171806.948290-4-cristian.ciocaltea@collabora.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230406171806.948290-1-cristian.ciocaltea@collabora.com> References: <20230406171806.948290-1-cristian.ciocaltea@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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?1762449228858816007?= X-GMAIL-MSGID: =?utf-8?q?1762449228858816007?= The support for TCS4525 regulator has been introduced with a wrong ramp-rate mask, which has been defined as a logical expression instead of a bit shift operation. For clarity, fix it using GENMASK() macro. Fixes: 914df8faa7d6 ("regulator: fan53555: Add TCS4525 DCDC support") Signed-off-by: Cristian Ciocaltea --- drivers/regulator/fan53555.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/fan53555.c b/drivers/regulator/fan53555.c index 0754c370a21c..4d2104c3a077 100644 --- a/drivers/regulator/fan53555.c +++ b/drivers/regulator/fan53555.c @@ -61,7 +61,7 @@ #define TCS_VSEL1_MODE (1 << 6) #define TCS_SLEW_SHIFT 3 -#define TCS_SLEW_MASK (0x3 < 3) +#define TCS_SLEW_MASK GENMASK(4, 3) enum fan53555_vendor { FAN53526_VENDOR_FAIRCHILD = 0, From patchwork Thu Apr 6 17:18:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 80371 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1193079vqo; Thu, 6 Apr 2023 10:34:59 -0700 (PDT) X-Google-Smtp-Source: AKy350bdwxmWTgAdBuo/j41J8EHMpqa1Bo1xX3fvEnueCsenUT4urX7T/l57G277QD1wq0C/4Ftp X-Received: by 2002:a17:90b:2250:b0:237:d59d:5f89 with SMTP id hk16-20020a17090b225000b00237d59d5f89mr12183659pjb.4.1680802499661; Thu, 06 Apr 2023 10:34:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680802499; cv=none; d=google.com; s=arc-20160816; b=T7ttTICwGTmPU9mpgw9JTzqIkofANB8MrL6LMtlzSrQhtu+HZj/uA3xhel6KGAsTBK cAolZQMENZHrP6d6VadOX3yOU0UW57N86lk/CLkswvjg3J1EyRg8pK1lwz3x3O+72taO 2pHB6mZ5AgePvLDh+PgxQJOMgOZmDPoYD/T4FaoASHM1FZsMtzUgALZ/4N+3gS8YBbyZ /sjcAstKue23Ho1I02d7K43uBOdx5fzsLfYxOpPRvHmuX7TRaPdIE7rIgOtHH37ytFO1 gilOjgGmaoMbsKwnH+dhVzZ8n1zr1kUiy+RZiX7Fh9RCKCnAKjo7fUabuPTs8ZpPmuaY eAkw== 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=3025jqnqBpaA7qkvwONR5ovPWRk8DLhch3emVgyCPGI=; b=hDSQ1FkD89Nfg88N8W97Egy03CaF9Qa7g3VCzZUzS+8C7SABm5OsCBmzEnWSiN2wHA d2lrLRFIJVXdLXV+9ltlP7QAMixuQtoNBb6S82hycFNH72dHje4umFkEtdnfP6kMOMzW 6EH8fMOu/Ge2ztPHBggHWCWnVatbBhOt4clFVi9eMTlyp9I8gXdQH25VcFB2QKF7GdtI Xs0wnconDDsJc+w2nU2lEMS8Iv8QprfQbMz6mX5SVN2VizH9Oa6LSvkomp1+g8vcyoFW 0saSNelH486v63XSoFrPieB4jYw2G9Z4BS6DK8DR1PZHPcp0oAgOVszeaQCA3e6dPpEC R5Ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Z0UEvyxW; 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=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t19-20020a17090a449300b0023a147a7892si1762446pjg.64.2023.04.06.10.34.47; Thu, 06 Apr 2023 10:34:59 -0700 (PDT) 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=@collabora.com header.s=mail header.b=Z0UEvyxW; 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=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239593AbjDFRSg (ORCPT + 99 others); Thu, 6 Apr 2023 13:18:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239599AbjDFRSa (ORCPT ); Thu, 6 Apr 2023 13:18:30 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20E86A24B; Thu, 6 Apr 2023 10:18:25 -0700 (PDT) Received: from localhost (unknown [188.27.34.213]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: cristicc) by madras.collabora.co.uk (Postfix) with ESMTPSA id 4B0EE66031C8; Thu, 6 Apr 2023 18:18:23 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1680801503; bh=iPoOGVI0NPGMRksIN5FgAEe90yrWeul7So9tDiTWunw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z0UEvyxWgXK+xlhyFK+rykswWjx4HC7FaJCFzDKdHPxhs3jJBW8ta1crGasexRz6v km0usz6dHX/Va4qMD4KKl8ox0TNPmT+H1JAOTExiJvMB5/J5N3nLZ7Gz6JhDSWXReP ICyh3PFZ73wD6UiEiBRvHN7GFzB5OqHdr7jHkKIGnE4mQ4ZlH2PMVOfFCbZA1h2jKf 5GeitLYgQhfIsUqyDeTHfD0/6OOqm4/xBaZ3xi2xCkfm9QDvZ0VYR/VfD8KUbNzQel dwxxbW3t387Za1FNQESm1tSLYJDGAWMn3bliax/hHcmK658RPR6N3c1BypKnho2pEj E6TvKx9iLnGGA== From: Cristian Ciocaltea To: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Heiko Stuebner , Bjorn Andersson , Joseph Chen , Ezequiel Garcia Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kernel@collabora.com Subject: [PATCH v2 4/8] regulator: fan53555: Remove unused *_SLEW_SHIFT definitions Date: Thu, 6 Apr 2023 20:18:02 +0300 Message-Id: <20230406171806.948290-5-cristian.ciocaltea@collabora.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230406171806.948290-1-cristian.ciocaltea@collabora.com> References: <20230406171806.948290-1-cristian.ciocaltea@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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?1762449162102601051?= X-GMAIL-MSGID: =?utf-8?q?1762449162102601051?= Commit b61ac767db4d ("regulator: fan53555: Convert to use regulator_set_ramp_delay_regmap") removed the slew_shift member from struct fan53555_device_info, hence the {CTL,TCS}_SLEW_SHIFT definitions remained unused. Drop them. Signed-off-by: Cristian Ciocaltea --- drivers/regulator/fan53555.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/regulator/fan53555.c b/drivers/regulator/fan53555.c index 4d2104c3a077..68ebcd4ccef7 100644 --- a/drivers/regulator/fan53555.c +++ b/drivers/regulator/fan53555.c @@ -49,7 +49,6 @@ /* Control bit definitions */ #define CTL_OUTPUT_DISCHG (1 << 7) #define CTL_SLEW_MASK (0x7 << 4) -#define CTL_SLEW_SHIFT 4 #define CTL_RESET (1 << 2) #define CTL_MODE_VSEL0_MODE BIT(0) #define CTL_MODE_VSEL1_MODE BIT(1) @@ -60,7 +59,6 @@ #define TCS_VSEL0_MODE (1 << 7) #define TCS_VSEL1_MODE (1 << 6) -#define TCS_SLEW_SHIFT 3 #define TCS_SLEW_MASK GENMASK(4, 3) enum fan53555_vendor { From patchwork Thu Apr 6 17:18:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 80372 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1193120vqo; Thu, 6 Apr 2023 10:35:05 -0700 (PDT) X-Google-Smtp-Source: AKy350awe6kpC2e687gLskDvdwvtjvfnbFn+swSceGdS3idbeAdY8S9rPqmOJDpy3r9j7EUKux9B X-Received: by 2002:a17:902:d2cc:b0:1a2:37fc:b591 with SMTP id n12-20020a170902d2cc00b001a237fcb591mr12786369plc.69.1680802504758; Thu, 06 Apr 2023 10:35:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680802504; cv=none; d=google.com; s=arc-20160816; b=T/C93mQ/VPKglPX83RU9a+CCS0hYdPMu25uwz7Q3bSnvT42IrarVIcap0zN7mmWLuT vfD8VlwlsdEbUDdViaCetB/btGrdnzQdH9YuAlABIZRvUlWGuNSZN6tqKIy9QI5+52VP 7FoQOKVH9RgySP4HHVssXPwg0o6qs7I6FOiXSoHfUFlPlMFc4fksNoxI6Ya1kSxZX+xs vID1ll5F2n7XdRZl2ZJzuMJMxPYHLpkq06Qu9sjGY4FZoOOOfiN/GDD6RbzO/ivtKq1u a1hpB2rnU7emQF6iXA1pcXzj2BgaCVBwPnSs2ernEjBcu249H50LiwZwzxFRM5zYerIx Cbfg== 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=+HY613/cWpilX/UQhldIyeAAp/lXCX0yrKtKN9LFBRw=; b=n1zFNrtwNtp/75+yNGMQZBX1dXIAZMN3cMi7PISb7bKDH8R2vLI/cD5vUzZdVNGlwB Lw6mf2a/KrSWVIHoKtt7hYeQrr3B1fJeSeyrLOq6pa5MGzXaN0xrxXoa2wMB6jCY+Qtw HiZ5A5iqQd9h9i9dddnYbDh2Ibf0OgtxqQ5fkW7eQGIj7/+yQwA9jLs/tCslBmhOU5/R qmHBdUWkm9NLS/KLUEsFyb5UupReO8vl3EMs5JeYpkMe17Rff0CmRrhYtj9BETWB8M3n iBSVz7d9ogm8hw0xzxu5AlF9U6o2CniqQaCKWWMPGWIPLp652Rv2ZmhwUoQ9ZmAupuWb 20jQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Ci7RrtHc; 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=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v63-20020a638942000000b00513ac9473casi1754298pgd.893.2023.04.06.10.34.51; Thu, 06 Apr 2023 10:35:04 -0700 (PDT) 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=@collabora.com header.s=mail header.b=Ci7RrtHc; 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=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239468AbjDFRSn (ORCPT + 99 others); Thu, 6 Apr 2023 13:18:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239799AbjDFRSd (ORCPT ); Thu, 6 Apr 2023 13:18:33 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9757FA5F8; Thu, 6 Apr 2023 10:18:27 -0700 (PDT) Received: from localhost (unknown [188.27.34.213]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: cristicc) by madras.collabora.co.uk (Postfix) with ESMTPSA id 29CF666031D8; Thu, 6 Apr 2023 18:18:26 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1680801506; bh=qXAW+NxBtXP2ZLN97K9FdNC+pkjm39ZBXXRQWxqaxDQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ci7RrtHc9ZBNPOLRstPWC2OfXurE6hOiXoO0xHokWOqtETMDVeKr5a2cgZfpU9qZu C8TCUnss3cRqVa/nrK+V1sgtwpglXXJezjiafg4mO/MvhtRUwliCQR9HAwQYcKDq10 yt3yWVja6aB/A5t+/bBxpU6Wiuf9+XeqFoOWB57YP8uMw4KSh3RhW0YXjK0025xFdQ 5eam5pCDuPDqVoWPzf7Lr9Jv2LOJL+v8dg5hWsGEOCyDWha7cqVk7YVwj7n4HZ6idl XCp9FHDM6cWwtr4hl+UXUXB62/uckrMQV/Axi/FcvnAYlYzLFoFl4nWFoc4Qt3WTZS 8RtYV5NrCxm3w== From: Cristian Ciocaltea To: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Heiko Stuebner , Bjorn Andersson , Joseph Chen , Ezequiel Garcia Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kernel@collabora.com Subject: [PATCH v2 5/8] regulator: fan53555: Make use of the bit macros Date: Thu, 6 Apr 2023 20:18:03 +0300 Message-Id: <20230406171806.948290-6-cristian.ciocaltea@collabora.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230406171806.948290-1-cristian.ciocaltea@collabora.com> References: <20230406171806.948290-1-cristian.ciocaltea@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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?1762449167279704238?= X-GMAIL-MSGID: =?utf-8?q?1762449167279704238?= For consistency and improved clarity, use BIT() and GENMASK() macros for defining the bitfields inside the registers. No functional changes intended. While here, also fix DIE_{ID,REV} inconsistent indentation. Signed-off-by: Cristian Ciocaltea --- drivers/regulator/fan53555.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/regulator/fan53555.c b/drivers/regulator/fan53555.c index 68ebcd4ccef7..181e5eb00e7a 100644 --- a/drivers/regulator/fan53555.c +++ b/drivers/regulator/fan53555.c @@ -41,23 +41,23 @@ #define FAN53555_MONITOR 0x05 /* VSEL bit definitions */ -#define VSEL_BUCK_EN (1 << 7) -#define VSEL_MODE (1 << 6) +#define VSEL_BUCK_EN BIT(7) +#define VSEL_MODE BIT(6) /* Chip ID and Verison */ -#define DIE_ID 0x0F /* ID1 */ -#define DIE_REV 0x0F /* ID2 */ +#define DIE_ID 0x0F /* ID1 */ +#define DIE_REV 0x0F /* ID2 */ /* Control bit definitions */ -#define CTL_OUTPUT_DISCHG (1 << 7) -#define CTL_SLEW_MASK (0x7 << 4) -#define CTL_RESET (1 << 2) +#define CTL_OUTPUT_DISCHG BIT(7) +#define CTL_SLEW_MASK GENMASK(6, 4) +#define CTL_RESET BIT(2) #define CTL_MODE_VSEL0_MODE BIT(0) #define CTL_MODE_VSEL1_MODE BIT(1) #define FAN53555_NVOLTAGES 64 /* Numbers of voltages */ #define FAN53526_NVOLTAGES 128 -#define TCS_VSEL0_MODE (1 << 7) -#define TCS_VSEL1_MODE (1 << 6) +#define TCS_VSEL0_MODE BIT(7) +#define TCS_VSEL1_MODE BIT(6) #define TCS_SLEW_MASK GENMASK(4, 3) From patchwork Thu Apr 6 17:18:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 80369 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1192823vqo; Thu, 6 Apr 2023 10:34:34 -0700 (PDT) X-Google-Smtp-Source: AKy350bOJPxjcNzzf7KxwccbVt/SayrhtknB72+MsSbt9SubBESr20DdCB80a+uBoc/QWtW8KxTH X-Received: by 2002:a17:902:e846:b0:19e:d6f2:feea with SMTP id t6-20020a170902e84600b0019ed6f2feeamr57906plg.9.1680802474605; Thu, 06 Apr 2023 10:34:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680802474; cv=none; d=google.com; s=arc-20160816; b=X286I5XjGnXTw2UsedB9WRE8RVQOCzyn4RjwyRrr6eRSfg793ox2fwiAI54Jw/49uY poAnh4YUIb7jVN1iT2ndTuh+1THJ/GAgr8Pf45TmV+CPlG56Bnj5zmAAYd4FVbxr/NBq A3QxnF6w/Kn6ROLy0EUxxVxxpZXcdPkg2SPxGZdPmhLnCSX1RFtLL5MLnqZ+OZp/J4+/ tMKulX59byzjPR7VJf+if2zV9h9FOJZjbJerQyE9uMl1Ka8HshcSzh64EYWXdwP4nV2p E/sbzMu/ZL9nA3paUfqk0OCpEr1bbte0f2k9IoA4hid9j9owY3PZqdyJT0NgbOSdfge4 +CXQ== 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=/cXCL/lhl2q9N+8AhilWbHqXjXE0F8hhkrOWrfcURFM=; b=r6HQuJYz3S7upD6Si1oKW6NxL2CDwgRYaLryBFTMKHaPWTUUQP4FiqTtNmKwuiXxwd tWO7MA2FpuLVFntB6oAvaf89L9fGzvWMdpET93XFS+G3Tr0SXhE4tu5DgW3hKy3w5dB4 e8sVsWL+VadPcdxWAB+rXn7VPAGUUCZZg0YogiBKX8Mpo1PxCH24F5cJJt20Hw0Tcxll HR2tCDrRhJg+49Nkl/0+B24cfluIvoAQ3xFQFYQ6FScAkMvvl1KeGzxPbq6BXavrdJo8 QqQdBFA9SR5TTZb5jTIQVgOWuZ5cJCIDNzAJH+NgI1uJbbUThBRDLqyCL/OP7Ur9QZUP 2o/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=bl4w6nXZ; 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=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x12-20020a17090300cc00b001a0767b58e7si2024054plc.68.2023.04.06.10.34.22; Thu, 06 Apr 2023 10:34:34 -0700 (PDT) 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=@collabora.com header.s=mail header.b=bl4w6nXZ; 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=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239985AbjDFRTC (ORCPT + 99 others); Thu, 6 Apr 2023 13:19:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239681AbjDFRSk (ORCPT ); Thu, 6 Apr 2023 13:18:40 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3094E8A63; Thu, 6 Apr 2023 10:18:31 -0700 (PDT) Received: from localhost (unknown [188.27.34.213]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: cristicc) by madras.collabora.co.uk (Postfix) with ESMTPSA id 698F566031C8; Thu, 6 Apr 2023 18:18:29 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1680801509; bh=3rBxNv391K3rouaSGtWY3Lj00PK9hBEW9sLwGyEnlTc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bl4w6nXZGqf18D4iiH+vG/e5Wf4FQyayN1k9plwSHhE78gG9RyfROQ7nmV1gBSyBF rgOvHtGwhraHpJGDVCKzvmN0upDAX6/J0FpWxPvmSrnIywJ4IucS1x87tGWs6Muzaw tSd1O3yeOlxtyPnKMnFUEEO/d4fMWchz0gSyR4PHoD5iyyF5ncm5Qfn80NkvcSx0SG +D6XWEg+5ty4LEReXeUBtUyCE0IAIKZk9GVEqnYDBQOJCwrknCfVIV5PGXx4r/RXsV u0TAWwWMCshNiuHxxNbJop+XX7gPT+lAz1CPIhaKmCxjBkDK58NEODNcylatt2nFGv hGcvfIsDgZzPA== From: Cristian Ciocaltea To: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Heiko Stuebner , Bjorn Andersson , Joseph Chen , Ezequiel Garcia Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kernel@collabora.com Subject: [PATCH v2 6/8] regulator: fan53555: Improve vsel_mask computation Date: Thu, 6 Apr 2023 20:18:04 +0300 Message-Id: <20230406171806.948290-7-cristian.ciocaltea@collabora.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230406171806.948290-1-cristian.ciocaltea@collabora.com> References: <20230406171806.948290-1-cristian.ciocaltea@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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?1762449135507612946?= X-GMAIL-MSGID: =?utf-8?q?1762449135507612946?= In preparation for introducing support for additional regulators which do not use the maximum number of voltage selectors available for a given mask, improve the mask computation formula by using fls(). Note fls() requires the bitops header, hence include it explicitly and drop bits.h which is already pulled by bitops.h. Signed-off-by: Cristian Ciocaltea --- drivers/regulator/fan53555.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/regulator/fan53555.c b/drivers/regulator/fan53555.c index 181e5eb00e7a..39c9c29f4ff6 100644 --- a/drivers/regulator/fan53555.c +++ b/drivers/regulator/fan53555.c @@ -8,7 +8,7 @@ // Copyright (c) 2012 Marvell Technology Ltd. // Yunfan Zhang -#include +#include #include #include #include @@ -486,7 +486,7 @@ static int fan53555_regulator_register(struct fan53555_device_info *di, rdesc->min_uV = di->vsel_min; rdesc->uV_step = di->vsel_step; rdesc->vsel_reg = di->vol_reg; - rdesc->vsel_mask = di->vsel_count - 1; + rdesc->vsel_mask = BIT(fls(di->vsel_count - 1)) - 1; rdesc->ramp_reg = di->slew_reg; rdesc->ramp_mask = di->slew_mask; rdesc->ramp_delay_table = di->ramp_delay_table; From patchwork Thu Apr 6 17:18:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 80365 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1192085vqo; Thu, 6 Apr 2023 10:33:13 -0700 (PDT) X-Google-Smtp-Source: AKy350bSvrV03xpJOungePB4DsMNwW9k2k41+d9Xbs3L/o3GcuCi2RFLcJQmgoA814SUpktrsSra X-Received: by 2002:a62:6204:0:b0:625:d697:c386 with SMTP id w4-20020a626204000000b00625d697c386mr9162868pfb.22.1680802392821; Thu, 06 Apr 2023 10:33:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680802392; cv=none; d=google.com; s=arc-20160816; b=Us/7mHdYwMT+LJBLNYDKnF7kuTBNgtD3OxDQ3Zeby4f/z+o+2oWGGmVHZqR1ul5KWA dk/ht5iRCEJQvjsl43R6sTBnuEHCxL3l7LDyMh2/ewoPAjLP8bwF+s35nCswyGR5hzZT LQFR4PT4JXXJpk5ObBPZQm22lIkCT2kx6rrMpts0Rj7Qv2NTeOiDQ4iCWw3oy48pejhI E3oafX8chL4lgYYEvNFxMaz+7liVDs6YZfsCsuE/95UyktxkoY2CmPBM48tIdaVSVXE9 CzVXXtwJXt5trCXCTdeJzS5xjniRVnCYogXVOP/HeC0DtVu7JprWoJ+q4cRMThw/KL35 4SYw== 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=icEeTUkukgMzfs5qelAig8rLR7lBbSi5G7d6Jn1tzIk=; b=owMfJJPjS3qS4kf7elOgBC4wXKOfzDV9djsdHrs9gVB3PM0SYtdtgm98jUoFRXGYeg RROFHIBB2Kl0EafQBgtc/9lw453s4Zt1mQp2SwOaxVolRCspmKtgGkrFcSLzlUdIGlKJ V8GMKXSvitPZ9SohJHOv2MqLdUIOAfDRd5gbAycufcQlPzoS1dIZFMY61Phlg3bEFuHI 3BuDxjlMO59x2coX7MmFpScAoz0OZWKT9Cx4rTSY80EfdQee9sqAeSL25hVn5EXR8xla gxjwhB2rd1dMzebfDeB6GHzkCBeEzSFHZOTUEOma3xdsoMkNhVJO7rJCS2JbgZfnPCum 1t9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=dgYIHtmW; 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=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e26-20020a65689a000000b0050fa5891fc1si1712501pgt.551.2023.04.06.10.33.00; Thu, 06 Apr 2023 10:33:12 -0700 (PDT) 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=@collabora.com header.s=mail header.b=dgYIHtmW; 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=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240005AbjDFRTI (ORCPT + 99 others); Thu, 6 Apr 2023 13:19:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239466AbjDFRSt (ORCPT ); Thu, 6 Apr 2023 13:18:49 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2045E9EE0; Thu, 6 Apr 2023 10:18:34 -0700 (PDT) Received: from localhost (unknown [188.27.34.213]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: cristicc) by madras.collabora.co.uk (Postfix) with ESMTPSA id 6F06F66031DA; Thu, 6 Apr 2023 18:18:32 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1680801512; bh=aW4fe1+DDo3cV0bZP+53AoiJSFgqHyfIP7z13IHIZi4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dgYIHtmW20viYgzAuiHT2LtpL7/xhPrk9vZfBJ6ZPdokPx8xMx2lEgXqQ6Uy2/Rus UfUs7WwxyeGsmIMfSFIOQyiW2elF8SAiY24KIClzUYtMVhUZRkek5ygB0HRFyvVDV1 KCVDJbUGH9Hby0yvgHvK5WTYut9vfw/nee9HT+95o54kM2oufz7pPdFVr0gbPxqpXO Hlf9bZHlERlaBzTNGjnTxYmVm182bVqFZZssWwDbB2fmMO4mdIAK2p/GLnO5XgffFC MEKtFsRjLQjUAY/pvTb7sr7hrb5IoBFg+S+i7kacYnUf783tXiPbRqXdRJPeG556sN nRwEAFa8bWO6A== From: Cristian Ciocaltea To: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Heiko Stuebner , Bjorn Andersson , Joseph Chen , Ezequiel Garcia Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kernel@collabora.com Subject: [PATCH v2 7/8] regulator: fan53555: Use dev_err_probe Date: Thu, 6 Apr 2023 20:18:05 +0300 Message-Id: <20230406171806.948290-8-cristian.ciocaltea@collabora.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230406171806.948290-1-cristian.ciocaltea@collabora.com> References: <20230406171806.948290-1-cristian.ciocaltea@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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?1762449049822659938?= X-GMAIL-MSGID: =?utf-8?q?1762449049822659938?= Use dev_err_probe() instead of dev_err() in the probe function, which ensures the error code is always printed and, additionally, simplifies the code a bit. Signed-off-by: Cristian Ciocaltea --- drivers/regulator/fan53555.c | 47 ++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 26 deletions(-) diff --git a/drivers/regulator/fan53555.c b/drivers/regulator/fan53555.c index 39c9c29f4ff6..acf14ba7aaa6 100644 --- a/drivers/regulator/fan53555.c +++ b/drivers/regulator/fan53555.c @@ -568,10 +568,9 @@ static int fan53555_regulator_probe(struct i2c_client *client) if (!pdata) pdata = fan53555_parse_dt(&client->dev, np, &di->desc); - if (!pdata || !pdata->regulator) { - dev_err(&client->dev, "Platform data not found!\n"); - return -ENODEV; - } + if (!pdata || !pdata->regulator) + return dev_err_probe(&client->dev, -ENODEV, + "Platform data not found!\n"); di->regulator = pdata->regulator; if (client->dev.of_node) { @@ -580,10 +579,9 @@ static int fan53555_regulator_probe(struct i2c_client *client) } else { /* if no ramp constraint set, get the pdata ramp_delay */ if (!di->regulator->constraints.ramp_delay) { - if (pdata->slew_rate >= ARRAY_SIZE(slew_rates)) { - dev_err(&client->dev, "Invalid slew_rate\n"); - return -EINVAL; - } + if (pdata->slew_rate >= ARRAY_SIZE(slew_rates)) + return dev_err_probe(&client->dev, -EINVAL, + "Invalid slew_rate\n"); di->regulator->constraints.ramp_delay = slew_rates[pdata->slew_rate]; @@ -593,34 +591,31 @@ static int fan53555_regulator_probe(struct i2c_client *client) } regmap = devm_regmap_init_i2c(client, &fan53555_regmap_config); - if (IS_ERR(regmap)) { - dev_err(&client->dev, "Failed to allocate regmap!\n"); - return PTR_ERR(regmap); - } + if (IS_ERR(regmap)) + return dev_err_probe(&client->dev, PTR_ERR(regmap), + "Failed to allocate regmap!\n"); + di->dev = &client->dev; i2c_set_clientdata(client, di); /* Get chip ID */ ret = regmap_read(regmap, FAN53555_ID1, &val); - if (ret < 0) { - dev_err(&client->dev, "Failed to get chip ID!\n"); - return ret; - } + if (ret < 0) + return dev_err_probe(&client->dev, ret, "Failed to get chip ID!\n"); + di->chip_id = val & DIE_ID; /* Get chip revision */ ret = regmap_read(regmap, FAN53555_ID2, &val); - if (ret < 0) { - dev_err(&client->dev, "Failed to get chip Rev!\n"); - return ret; - } + if (ret < 0) + return dev_err_probe(&client->dev, ret, "Failed to get chip Rev!\n"); + di->chip_rev = val & DIE_REV; dev_info(&client->dev, "FAN53555 Option[%d] Rev[%d] Detected!\n", di->chip_id, di->chip_rev); /* Device init */ ret = fan53555_device_setup(di, pdata); - if (ret < 0) { - dev_err(&client->dev, "Failed to setup device!\n"); - return ret; - } + if (ret < 0) + return dev_err_probe(&client->dev, ret, "Failed to setup device!\n"); + /* Register regulator */ config.dev = di->dev; config.init_data = di->regulator; @@ -630,9 +625,9 @@ static int fan53555_regulator_probe(struct i2c_client *client) ret = fan53555_regulator_register(di, &config); if (ret < 0) - dev_err(&client->dev, "Failed to register regulator!\n"); - return ret; + dev_err_probe(&client->dev, ret, "Failed to register regulator!\n"); + return ret; } static const struct i2c_device_id fan53555_id[] = { From patchwork Thu Apr 6 17:18:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 80359 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1185219vqo; Thu, 6 Apr 2023 10:20:58 -0700 (PDT) X-Google-Smtp-Source: AKy350ZowAhbznJ5I/rxFNwFl3CEZblTu3cJb4oFx5gTW13df8nhRTuXVbA8sDzOD7bsKmboeHIe X-Received: by 2002:aa7:d883:0:b0:4fc:154:3fda with SMTP id u3-20020aa7d883000000b004fc01543fdamr307806edq.4.1680801658173; Thu, 06 Apr 2023 10:20:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680801658; cv=none; d=google.com; s=arc-20160816; b=MwMT3cxgnKsbVwIzJPWemuTHWgoojAqh7VpAqsPrGuw3Wtu4tlgq0Ig1eQBTtfc56v EeFqsMukEzoid+VoDMhmFMC8a4BE2NtrQwO3g39HjH36C5EgCNO0Bk338xoE+NInkxBA 1XXNxA/qa3TvMSqU5V/LwP+/SPJIDwYATCZw4lmiw8b1xqi7M4q1h2kF18Z0mBCRehUS vtAfWS0/w98TImfJVv3J2yMjcpGH5DKWe7JAmWtR13oE/iSsrAXJ4BsPgf5xU2hjrT2S FtCHj22RgvF4jIH7LUjkxwpU2zFSQd4xhLfLCoKBhuNGdaxXv2c4O6NPkkF5URgEarIR O6Jw== 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=XPG0q9Hwm+jfRv7riWO0S8FFf5NIdKBRxyZg/ZXsov0=; b=0/NUzMDeuCao4CqVP4Ysg8tuW8LNWZUrWQtRYykeva84GiiB93bT9++uXfN4Yv0ny7 UJw0sD5dFqY2U9safauiuVM612OMccqXfXpMAZc6OTcYpXyNcyQOMhMp8iu8y3ai9Nam m4+jgaQmi0wMAz7RIuMn3wygq67TGLI9DXLCLKrFCSY/RJRpLXVpQfvG7mKvC71puBET 7og+X3dRno/Ic3cMMfAGyVw4tsf9zY2vmcky/qcPzJsmYZBWpdITsjtqkhKYHTKJrML2 RLiUSG9oi3ldEPHgmdSTKyd1esJcLNwbQYHhKYBN2TTMESyMrXvmr031j5tMAIM8ib+X N1QQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=cC1hbJmB; 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=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u20-20020a056402065400b005021d251232si1492975edx.20.2023.04.06.10.20.29; Thu, 06 Apr 2023 10:20:58 -0700 (PDT) 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=@collabora.com header.s=mail header.b=cC1hbJmB; 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=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240013AbjDFRTQ (ORCPT + 99 others); Thu, 6 Apr 2023 13:19:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239520AbjDFRS7 (ORCPT ); Thu, 6 Apr 2023 13:18:59 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 814F79ED2; Thu, 6 Apr 2023 10:18:36 -0700 (PDT) Received: from localhost (unknown [188.27.34.213]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: cristicc) by madras.collabora.co.uk (Postfix) with ESMTPSA id 2D01B66031EE; Thu, 6 Apr 2023 18:18:35 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1680801515; bh=xfQ/7UvlTEZNT/nG8uJjsoHa3zrmCqKaD8nZ/sO9yw8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cC1hbJmBRiPzHXy/VJ3ilY8S2BWATdTMQ/D4yw0gbl7nsElNOW8mYbRMAmjrF5PHj accV9rYFxUwzB+MkOAcyN5mjF4Aya+QN9c9HU4N1id5m4K6nr7pNUESV1wEfDFyNxN uufmvjL1dAXUUWHf2HB+wqFB+fRNvqFhZswwnubuK8wfJ9ozbLLiWmQQTwr+uiMZIw ZFROdwQvMgrBZqZansWbgpdjJ5IWCsL7KDzUSZ/DSy3fJgRCsbkSed8JdE5Ev4+V7l DKxxFPG99NhSDHgZZCb7eLikFj3ET7O+GCm4CggVmW+UEt9+uIc5C7iWLnAgXEJHy2 ARjbUsZ+n+VKA== From: Cristian Ciocaltea To: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Heiko Stuebner , Bjorn Andersson , Joseph Chen , Ezequiel Garcia Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kernel@collabora.com Subject: [PATCH v2 8/8] regulator: fan53555: Add support for RK860X Date: Thu, 6 Apr 2023 20:18:06 +0300 Message-Id: <20230406171806.948290-9-cristian.ciocaltea@collabora.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230406171806.948290-1-cristian.ciocaltea@collabora.com> References: <20230406171806.948290-1-cristian.ciocaltea@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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?1762448279274997277?= X-GMAIL-MSGID: =?utf-8?q?1762448279274997277?= Extend the existing fan53555 driver to support the Rockchip RK860X regulators. RK8600/RK8601 are pretty similar to the FAN53555 regulators. RK8602/RK8603 are a bit different, having a wider output voltage selection range, from 0.5 V to 1.5 V in 6.25 mV steps. They also use additional VSEL0/VSEL1 registers for the voltage selector, but the enable and mode bits are still located in the original FAN53555 specific VSEL0/VSEL1 registers. Signed-off-by: Cristian Ciocaltea Acked-by: Krzysztof Kozlowski --- drivers/regulator/fan53555.c | 121 ++++++++++++++++++++++++++++++++++- 1 file changed, 118 insertions(+), 3 deletions(-) diff --git a/drivers/regulator/fan53555.c b/drivers/regulator/fan53555.c index acf14ba7aaa6..130f3dbe9840 100644 --- a/drivers/regulator/fan53555.c +++ b/drivers/regulator/fan53555.c @@ -26,6 +26,9 @@ #define FAN53555_VSEL0 0x00 #define FAN53555_VSEL1 0x01 +#define RK8602_VSEL0 0x06 +#define RK8602_VSEL1 0x07 + #define TCS4525_VSEL0 0x11 #define TCS4525_VSEL1 0x10 #define TCS4525_TIME 0x13 @@ -55,6 +58,7 @@ #define FAN53555_NVOLTAGES 64 /* Numbers of voltages */ #define FAN53526_NVOLTAGES 128 +#define RK8602_NVOLTAGES 160 #define TCS_VSEL0_MODE BIT(7) #define TCS_VSEL1_MODE BIT(6) @@ -64,6 +68,8 @@ enum fan53555_vendor { FAN53526_VENDOR_FAIRCHILD = 0, FAN53555_VENDOR_FAIRCHILD, + FAN53555_VENDOR_ROCKCHIP, /* RK8600, RK8601 */ + RK8602_VENDOR_ROCKCHIP, /* RK8602, RK8603 */ FAN53555_VENDOR_SILERGY, FAN53526_VENDOR_TCS, }; @@ -87,6 +93,14 @@ enum { FAN53555_CHIP_ID_08 = 8, }; +enum { + RK8600_CHIP_ID_08 = 8, /* RK8600, RK8601 */ +}; + +enum { + RK8602_CHIP_ID_10 = 10, /* RK8602, RK8603 */ +}; + enum { TCS4525_CHIP_ID_12 = 12, }; @@ -117,6 +131,8 @@ struct fan53555_device_info { /* Voltage setting register */ unsigned int vol_reg; unsigned int sleep_reg; + unsigned int en_reg; + unsigned int sleep_en_reg; /* Voltage range and step(linear) */ unsigned int vsel_min; unsigned int vsel_step; @@ -159,7 +175,7 @@ static int fan53555_set_suspend_enable(struct regulator_dev *rdev) { struct fan53555_device_info *di = rdev_get_drvdata(rdev); - return regmap_update_bits(rdev->regmap, di->sleep_reg, + return regmap_update_bits(rdev->regmap, di->sleep_en_reg, VSEL_BUCK_EN, VSEL_BUCK_EN); } @@ -167,7 +183,7 @@ static int fan53555_set_suspend_disable(struct regulator_dev *rdev) { struct fan53555_device_info *di = rdev_get_drvdata(rdev); - return regmap_update_bits(rdev->regmap, di->sleep_reg, + return regmap_update_bits(rdev->regmap, di->sleep_en_reg, VSEL_BUCK_EN, 0); } @@ -317,6 +333,50 @@ static int fan53555_voltages_setup_fairchild(struct fan53555_device_info *di) return 0; } +static int fan53555_voltages_setup_rockchip(struct fan53555_device_info *di) +{ + /* Init voltage range and step */ + switch (di->chip_id) { + case RK8600_CHIP_ID_08: + di->vsel_min = 712500; + di->vsel_step = 12500; + break; + default: + dev_err(di->dev, + "Chip ID %d not supported!\n", di->chip_id); + return -EINVAL; + } + di->slew_reg = FAN53555_CONTROL; + di->slew_mask = CTL_SLEW_MASK; + di->ramp_delay_table = slew_rates; + di->n_ramp_values = ARRAY_SIZE(slew_rates); + di->vsel_count = FAN53555_NVOLTAGES; + + return 0; +} + +static int rk8602_voltages_setup_rockchip(struct fan53555_device_info *di) +{ + /* Init voltage range and step */ + switch (di->chip_id) { + case RK8602_CHIP_ID_10: + di->vsel_min = 500000; + di->vsel_step = 6250; + break; + default: + dev_err(di->dev, + "Chip ID %d not supported!\n", di->chip_id); + return -EINVAL; + } + di->slew_reg = FAN53555_CONTROL; + di->slew_mask = CTL_SLEW_MASK; + di->ramp_delay_table = slew_rates; + di->n_ramp_values = ARRAY_SIZE(slew_rates); + di->vsel_count = RK8602_NVOLTAGES; + + return 0; +} + static int fan53555_voltages_setup_silergy(struct fan53555_device_info *di) { /* Init voltage range and step */ @@ -377,6 +437,7 @@ static int fan53555_device_setup(struct fan53555_device_info *di, switch (di->vendor) { case FAN53526_VENDOR_FAIRCHILD: case FAN53555_VENDOR_FAIRCHILD: + case FAN53555_VENDOR_ROCKCHIP: case FAN53555_VENDOR_SILERGY: switch (pdata->sleep_vsel_id) { case FAN53555_VSEL_ID_0: @@ -391,6 +452,27 @@ static int fan53555_device_setup(struct fan53555_device_info *di, dev_err(di->dev, "Invalid VSEL ID!\n"); return -EINVAL; } + di->sleep_en_reg = di->sleep_reg; + di->en_reg = di->vol_reg; + break; + case RK8602_VENDOR_ROCKCHIP: + switch (pdata->sleep_vsel_id) { + case FAN53555_VSEL_ID_0: + di->sleep_reg = RK8602_VSEL0; + di->vol_reg = RK8602_VSEL1; + di->sleep_en_reg = FAN53555_VSEL0; + di->en_reg = FAN53555_VSEL1; + break; + case FAN53555_VSEL_ID_1: + di->sleep_reg = RK8602_VSEL1; + di->vol_reg = RK8602_VSEL0; + di->sleep_en_reg = FAN53555_VSEL1; + di->en_reg = FAN53555_VSEL0; + break; + default: + dev_err(di->dev, "Invalid VSEL ID!\n"); + return -EINVAL; + } break; case FAN53526_VENDOR_TCS: switch (pdata->sleep_vsel_id) { @@ -406,6 +488,8 @@ static int fan53555_device_setup(struct fan53555_device_info *di, dev_err(di->dev, "Invalid VSEL ID!\n"); return -EINVAL; } + di->sleep_en_reg = di->sleep_reg; + di->en_reg = di->vol_reg; break; default: dev_err(di->dev, "vendor %d not supported!\n", di->vendor); @@ -427,10 +511,23 @@ static int fan53555_device_setup(struct fan53555_device_info *di, } break; case FAN53555_VENDOR_FAIRCHILD: + case FAN53555_VENDOR_ROCKCHIP: case FAN53555_VENDOR_SILERGY: di->mode_reg = di->vol_reg; di->mode_mask = VSEL_MODE; break; + case RK8602_VENDOR_ROCKCHIP: + di->mode_mask = VSEL_MODE; + + switch (pdata->sleep_vsel_id) { + case FAN53555_VSEL_ID_0: + di->mode_reg = FAN53555_VSEL1; + break; + case FAN53555_VSEL_ID_1: + di->mode_reg = FAN53555_VSEL0; + break; + } + break; case FAN53526_VENDOR_TCS: di->mode_reg = TCS4525_COMMAND; @@ -456,6 +553,12 @@ static int fan53555_device_setup(struct fan53555_device_info *di, case FAN53555_VENDOR_FAIRCHILD: ret = fan53555_voltages_setup_fairchild(di); break; + case FAN53555_VENDOR_ROCKCHIP: + ret = fan53555_voltages_setup_rockchip(di); + break; + case RK8602_VENDOR_ROCKCHIP: + ret = rk8602_voltages_setup_rockchip(di); + break; case FAN53555_VENDOR_SILERGY: ret = fan53555_voltages_setup_silergy(di); break; @@ -481,7 +584,7 @@ static int fan53555_regulator_register(struct fan53555_device_info *di, rdesc->ops = &fan53555_regulator_ops; rdesc->type = REGULATOR_VOLTAGE; rdesc->n_voltages = di->vsel_count; - rdesc->enable_reg = di->vol_reg; + rdesc->enable_reg = di->en_reg; rdesc->enable_mask = VSEL_BUCK_EN; rdesc->min_uV = di->vsel_min; rdesc->uV_step = di->vsel_step; @@ -531,6 +634,12 @@ static const struct of_device_id __maybe_unused fan53555_dt_ids[] = { }, { .compatible = "fcs,fan53555", .data = (void *)FAN53555_VENDOR_FAIRCHILD + }, { + .compatible = "rockchip,rk8600", + .data = (void *)FAN53555_VENDOR_ROCKCHIP + }, { + .compatible = "rockchip,rk8602", + .data = (void *)RK8602_VENDOR_ROCKCHIP }, { .compatible = "silergy,syr827", .data = (void *)FAN53555_VENDOR_SILERGY, @@ -637,6 +746,12 @@ static const struct i2c_device_id fan53555_id[] = { }, { .name = "fan53555", .driver_data = FAN53555_VENDOR_FAIRCHILD + }, { + .name = "rk8600", + .driver_data = FAN53555_VENDOR_ROCKCHIP + }, { + .name = "rk8602", + .driver_data = RK8602_VENDOR_ROCKCHIP }, { .name = "syr827", .driver_data = FAN53555_VENDOR_SILERGY