From patchwork Thu Apr 6 19:41:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 80431 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1273885vqo; Thu, 6 Apr 2023 13:09:37 -0700 (PDT) X-Google-Smtp-Source: AKy350b5YxfEixocsDve4GXJb+Ogk0sHFKaFM09lEhoVCbg/jtzFLm/7K14dzJs78+7z9c3bYdH7 X-Received: by 2002:a05:6a20:49a7:b0:de:af2f:fddb with SMTP id fs39-20020a056a2049a700b000deaf2ffddbmr3371546pzb.23.1680811777354; Thu, 06 Apr 2023 13:09:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680811777; cv=none; d=google.com; s=arc-20160816; b=Qw7JTqGzU2x6XPcGcQLNEenVxlLZA8bdkQEJjoRNUtAxJNM+ohDuH9qfTcNX6j1De6 YmNJt65BV2SIFX7CDhMAZkjcC8B2G+9/rfBKvQbP3fzjwfeZ/yrknR39Kl0BJAgVcdZ5 Ewvn/Oc0cgYmOQ9gA/oB7d7XZn3s3kNv+eMpVJQnRaDNVQoDmiFm0/fjZlXbkXSDEJU3 XN7K6pE2t3ngHrAMcWSaDuY03Vxxhhwdc2sVLL65OksDblfyy6ygCz9RAKNwXFFOIycN JCDzKJzo7AbyRNIT2mwpQq/TP6BHJoZCILYDq8P0loQeYM/nZEnXVZ66/Q3ZpqKqMBne a2bA== 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=H6bxSBrASOQShWI6O77OVGB7xsXCGEXdXIQ9Z+fJe7U=; b=fRQXudJR0zgKDwYsAMPK17OMStxCqXwJ9la7R8cCrM1q5z+Msex1FftHjIrsW9T0MF mUMjbVN0pg0+13uqDhQNkL29xln06a5gYToTcb5eK3sRvn4GK4Ld21aY4IMkS65ZDv6R LJfHNxuSugp9sLKSDV230CH/U56JckjdYuG6F/HHHdNAmjTPjc7arVmpPRf0ySALQ5W0 UuUbap1uMslX4ymPcmVmwntfHSNQPln2hGZ0EdemBaJvaa5O10DbEZMB2gN20Bp431p+ mq7aVoeB9KxBtxcHRRkIfuksSpkfbcPo6BPWCZlm0cnFks0q4dlOyrwbycO3WHIPRoll lIGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Sht2ZCmG; 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 z27-20020aa7991b000000b0062e2316ead0si2025427pff.283.2023.04.06.13.09.24; Thu, 06 Apr 2023 13:09:37 -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=Sht2ZCmG; 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 S237353AbjDFTmL (ORCPT + 99 others); Thu, 6 Apr 2023 15:42:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237215AbjDFTmI (ORCPT ); Thu, 6 Apr 2023 15:42:08 -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 BDA5D94; Thu, 6 Apr 2023 12:42:07 -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 666C066031C7; Thu, 6 Apr 2023 20:42:06 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1680810126; bh=kBM0XoqygD9m31/+bsMxaUmEkxsl4CMhuMZFxsCQYWg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sht2ZCmGbEYhavLnY+NCANLveT6wQWW7hhDdLk0Xo+MMdXBJux7XG0A6OcTmp/+/L TP1g/tDSEtjrK3wWF6sxsAvXwE4MNZ8OtyiXYG6vkBP8Oi/xRGTn3ZxEMoCwi/WKI6 8R0LEcmrIfZ8UCyNSoFogpXdEYj/bmlHVpvvhqfvLI/1ydxEI+hAwps/QM3b8dd0C9 aSQ0kjkTX+lpzwJMXKFuSx4t4Mle/LIJbYnZGKMZF0ANZ66ZrdXYlpVosBILh//dfe 17caENSMR4QQx1/TTwtSaFDQQT2N29ZtN/VtJ5iZHHOlhtMsuDYrm60RHkKzQamqCk alNfHvcaMGuiw== 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 v3 1/8] regulator: dt-bindings: fcs,fan53555: Add support for RK860X Date: Thu, 6 Apr 2023 22:41:51 +0300 Message-Id: <20230406194158.963352-2-cristian.ciocaltea@collabora.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230406194158.963352-1-cristian.ciocaltea@collabora.com> References: <20230406194158.963352-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?1762458890376543741?= X-GMAIL-MSGID: =?utf-8?q?1762458890376543741?= 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 Reviewed-by: Krzysztof Kozlowski --- .../bindings/regulator/fcs,fan53555.yaml | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/Documentation/devicetree/bindings/regulator/fcs,fan53555.yaml b/Documentation/devicetree/bindings/regulator/fcs,fan53555.yaml index c0dbba843f70..69bae90fc4b2 100644 --- a/Documentation/devicetree/bindings/regulator/fcs,fan53555.yaml +++ b/Documentation/devicetree/bindings/regulator/fcs,fan53555.yaml @@ -14,12 +14,21 @@ allOf: properties: compatible: - enum: - - fcs,fan53555 - - fcs,fan53526 - - silergy,syr827 - - silergy,syr828 - - tcs,tcs4525 + oneOf: + - 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 19:41:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 80422 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1270664vqo; Thu, 6 Apr 2023 13:04:13 -0700 (PDT) X-Google-Smtp-Source: AKy350bsDZjNKxf5Ja/nNsP3JoT6nVAQ+EpJxPtLzPP3FnuqHf/Vd+iCKzSKOfH6nMRPllcJ1UK6 X-Received: by 2002:a17:902:e5c8:b0:1a5:898:37b0 with SMTP id u8-20020a170902e5c800b001a5089837b0mr518895plf.8.1680811453122; Thu, 06 Apr 2023 13:04:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680811453; cv=none; d=google.com; s=arc-20160816; b=t87y2iTMuegBJKTSsFBsgYBu51jpweX0OKdZm6Uv47HRyqwELmjDS3BvJRVh5ge53k nIhuY7TRpOO0yctfTjH3brlLGFiNhQwfD0e/AfJjrqBccGYt29Y5I6B4bZ3iKlysurhi QvzBz1qcNBYeL2iSFZOUwQlI8Vf0Yu8foSEu4bLtcOtj8EbpYjDy+LGUU91a+FsLWezL beJInCwkk3C1ylKkf9Eiuok6Klb5z6N9euo44bJFGjZw+kbUlDfjp8oQisFIWNuO2bJU TnE4lhHma4witbRRD8RVxcnWC8E7ks94e6L5K0umW7rEdviZ7srK5v3yU+yoeBkrhEeR 5SpQ== 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=KYrd1WL5pWrHw9CdM6mOb91l2WRgQCfpvA65U69sbnUeF/HppGdTSTZvqoJeSIFiJS iRwVhFXlYuSOyj9BvOqvOXYw/eIMwjjbq6VMt/DWrqeq3deaLeNe0/KZFLUaEOd/Bpda mmMoMGcEe69nZB83asgSvPSPKqMmWu5MTNIkDTuWlhfQXNnPsSj72JAgEX3Jc669OwPY uAdD39pjrJKZLOMKp0M0V4/sPM0GgB87+wMCt6ALMxzioDpHDdkfTlioRGl7YdNxT7Fi AbPEyzarxR+Mnc2UM+8J95r4mi7JFygIklBAO+xtle625gojR6dWr8Wf913WZvA2EmVH hScg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=UAWGR+qf; 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 jf18-20020a170903269200b001994a4f9d34si2212502plb.145.2023.04.06.13.03.59; Thu, 06 Apr 2023 13:04:13 -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=UAWGR+qf; 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 S237423AbjDFTmR (ORCPT + 99 others); Thu, 6 Apr 2023 15:42:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237421AbjDFTmM (ORCPT ); Thu, 6 Apr 2023 15:42:12 -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 27CE9901C; Thu, 6 Apr 2023 12:42:11 -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 55F0566031C6; Thu, 6 Apr 2023 20:42:09 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1680810129; bh=DMsss3S5xTQ3vBQF9dvbUFqzefuTEWVYo2dfHUqUcKc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UAWGR+qfYF3RFkE7l9I5AyTdcp+XZdrxRpcRClsYpmjtG/M0fPkOAxxVOW3m4w9gQ 0oBYtas/BJ/orcf1IpVWdX1b5PQeF8kf5AtT7XFeB+gkF6O1Yt0GzPF7q1NTCuZ4jQ mOCcK4m25miwwjyaWUWFMPjbq7xjHLZ7AaBOUsL1h97Nj5xIm6P7AdSWpx+GZPzGdB ZgzF4MbwbvXZKL/LQ13bsLnvn4/QAzMFOMJgPjB3Tp9HYuZg4xzTLIHdi8wtFy1m0J Ern8oM11GmbZClgqK25glf5mSwIjUCwSOFj1EDMYjEhXkSeaazr1SBLVqJo//13w/Z 8R94scQLhtOVQ== 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 v3 2/8] regulator: fan53555: Explicitly include bits header Date: Thu, 6 Apr 2023 22:41:52 +0300 Message-Id: <20230406194158.963352-3-cristian.ciocaltea@collabora.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230406194158.963352-1-cristian.ciocaltea@collabora.com> References: <20230406194158.963352-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?1762458550563784442?= X-GMAIL-MSGID: =?utf-8?q?1762458550563784442?= 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 19:41:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 80419 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1266977vqo; Thu, 6 Apr 2023 12:57:54 -0700 (PDT) X-Google-Smtp-Source: AKy350YhhLzHjxQtHnqAXIzaqPzXKAbyR/8fSF5XAyzsgNILCS76PGpQSQw2PvgjWXmzt2Z2/Q/J X-Received: by 2002:a17:90b:3b48:b0:23d:29c7:916f with SMTP id ot8-20020a17090b3b4800b0023d29c7916fmr12257639pjb.32.1680811073964; Thu, 06 Apr 2023 12:57:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680811073; cv=none; d=google.com; s=arc-20160816; b=nt4v3TpJiIJnHv1BSrabLcyWnjSQD4ezI4fUl1CWf+ahBhpzb4ruxVTyqubepi6o/2 dcPMK1BBe3h15hWghZaF+/hYVeA/QJxIGcQx+sDeY0n4vZ2G/UAYmonuwGf7+sHdqr2C +NVZ5gO1ojNQ7Lhl7H3HoVvUn2RDonJNcKVinArY0ETFPG/hsGd6NsbdKvnSAvoEPY2M 1Uf/sZ1eS3eF0BtnNZZmaAoMIxe1filFPAmKsqUK1jeh/w0jv+gj6X+zhlYI2BEPQt0D Re8gwq2+uReTXPG4xNknG1OzwDJWhu2U1z1RgSnUe+Io3GoZrBHVgG+atjiAYWFgbvPm YhJQ== 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=OusJJkPi2xaL30PvtYlb66Lfe9EyXYQL1XFW9U2M6qeI4z04rsrRh7BcK3lbxBb4vR xYJ2+Z+a35kAfRUfPiPnhZpuEOOC5uqiFXzlFvyvvVV4Z9pZOw2s20qrkTb0PZ+a9mlW cfKjTtkB1Bb1MmMTkXvfZbHW3kgkdEU1pQZdaf4OjWsnTU6FO5l2C0084VHvatQif8VE NQvIuTTFNWkXQU56rWidhoIXRfOdzhaQrij5ZeIFWCRgsq/WHPC7qkSm4EWwk2TK1Pyu mdn2hsmCPMBmpuPrQNQsykIK3VSvsoHhynTkMwAZdIK2/ttxFziJl4Gu2McVBRvPhjmM 0XOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=nxcc6qse; 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 i2-20020a17090acf8200b002406d55224fsi4410778pju.178.2023.04.06.12.57.40; Thu, 06 Apr 2023 12:57:53 -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=nxcc6qse; 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 S237561AbjDFTmU (ORCPT + 99 others); Thu, 6 Apr 2023 15:42:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237451AbjDFTmP (ORCPT ); Thu, 6 Apr 2023 15:42:15 -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 636BB7EFE; Thu, 6 Apr 2023 12:42:13 -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 1F05A66031CE; Thu, 6 Apr 2023 20:42:12 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1680810132; bh=lFOZ5esxl/tbYIcE53Cn4DHfBeM2O3R87VdL+HeZPkw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nxcc6qsej83m4UnOh2Bw4Mg3nUltXYSpcBJbTaPeB9jYbEpc5JKhLWylwsoihVMsd SMKoWPoOSzypcittADYQE5s/bF6+N6ZFVqUDpT/XDcbCcoIg40o7DPnt0lcK53k3qU Skbwo9JPOb5DWIE+6zrGXobR2fObR8X2E6YVqmukj9NPT6zw5onEhSMEJCYabG61yx WtDiy3eXNmmXdHYow3Holqo6jUx59W/8EMpRNsa7cvKtkHtCl6dYeeDmW0NCErnnmK TlSW55gjmhBhxDxeDcZkbKXkKvPq4Wb9q4auv9PF+Wwg+0o4iVsASKceuCL0bfgP+/ CtHxguKZebQeQ== 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 v3 3/8] regulator: fan53555: Fix wrong TCS_SLEW_MASK Date: Thu, 6 Apr 2023 22:41:53 +0300 Message-Id: <20230406194158.963352-4-cristian.ciocaltea@collabora.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230406194158.963352-1-cristian.ciocaltea@collabora.com> References: <20230406194158.963352-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?1762458152499852345?= X-GMAIL-MSGID: =?utf-8?q?1762458152499852345?= 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 19:41:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 80427 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1273337vqo; Thu, 6 Apr 2023 13:08:37 -0700 (PDT) X-Google-Smtp-Source: AKy350aGLx6UUCYQ/nWeRcCKs/srcgevzj8bnRCjfnQ0H/6eyPH+KDyuKYmuAH7vyH/4mvPb3DD3 X-Received: by 2002:a17:903:32cb:b0:1a2:98b1:1ee2 with SMTP id i11-20020a17090332cb00b001a298b11ee2mr474617plr.15.1680811717624; Thu, 06 Apr 2023 13:08:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680811717; cv=none; d=google.com; s=arc-20160816; b=l6DNDxBycPv6nwG3ERm0KSuf8Mz3wmwiixUtQoJjsDjKsoiXVwU1sbbqp9/1IHmv5N B/FS3Mz5b19VTXN+uARXssrc1HqvAwoeEL4FYGStarLxUMnI/F/K5VnKpiyGVl5LmGcR kJXkLT8D43epoxR4UhMf1ZlWsqZ9Er/p/ZkSZ9HMSAaJ6rwz4HGeZlZL5eqtq/TgJEOa vjZ8DZrCcKmLZywWsJwZQLLCVlJe4FJUYXVVpuPPqExV+HO+42Tfrxwp7ZYDThe1Rlea 3u5YWfziePnqTlctazVbOJukuIE6SFTjle5JMZQE8cX1zHZr28k2pQ6Xn+4XVJ0LCq6y l3bQ== 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=Mi87LKa9kKnwm29BYkM2W1YSKy13dy6J4mPJGCMxslKINTDnaQ/vRsYqYQXe3dTJuK 1qfHAz4hn+bACp/KBmFU9/irKYQji+BnTfbFn6CCJ80TPmiHG57wA33Zi3AMY9agxO5X hSXyYdO+cfdifF06vZp7NnvezV/LEqA9u1913J7znSSNhlUrjW82Mlc9QKdXvkzyLYKq XZq/1DMIA26isJo/qXTrW3zSzpU6t2EPX4mmsqGzy8hsiNZh1Cmsg+ggaRBRZm2nClRW NY2NbS3LCxO1lyQsxtCz6yL+vxXBveRzaK6LhYvhtUkaHYryg47GdEQXDxiytqljcfk3 Z4Yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="PHm/GIAi"; 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 a6-20020a170902ecc600b001a04212a4b1si2440446plh.439.2023.04.06.13.08.25; Thu, 06 Apr 2023 13:08:37 -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="PHm/GIAi"; 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 S237763AbjDFTmX (ORCPT + 99 others); Thu, 6 Apr 2023 15:42:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237575AbjDFTmR (ORCPT ); Thu, 6 Apr 2023 15:42: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 28280170A; Thu, 6 Apr 2023 12:42:16 -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 AB51C66031C7; Thu, 6 Apr 2023 20:42:14 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1680810134; bh=iPoOGVI0NPGMRksIN5FgAEe90yrWeul7So9tDiTWunw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PHm/GIAiBdMaG9xwViY0RqCXDHLoB5k9YTFnSgggVzds6JXpYGV7N9ye39RDjJnPX q8/YmV6BikN+n5PAajhumVpoIXPNaQczpMTsOgmphRKFvxRj6U1u9qKKvDnUrJpt/c eCrF9mHbmjiUwE+kJmqs2ehyVrIhau+420FuDxbzaaIiy/pCf2ib1Vy5DXsTcDwwLE wufCjcKdeanfWDJogxZbZGrxqVB8M+vW/rxcWLxXphJii6F0imakdO5fwg9w90iQOB 6+VRSayeJG2doCbhEju+ceojL41o57mkzAzA6pYX1Z737TbaAtEkL3VbpE2itN1Ojn 89oHg1/topL0w== 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 v3 4/8] regulator: fan53555: Remove unused *_SLEW_SHIFT definitions Date: Thu, 6 Apr 2023 22:41:54 +0300 Message-Id: <20230406194158.963352-5-cristian.ciocaltea@collabora.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230406194158.963352-1-cristian.ciocaltea@collabora.com> References: <20230406194158.963352-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?1762458827128283428?= X-GMAIL-MSGID: =?utf-8?q?1762458827128283428?= 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 19:41:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 80421 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1269580vqo; Thu, 6 Apr 2023 13:02:32 -0700 (PDT) X-Google-Smtp-Source: AKy350Z9dXK2FCHtBcg9lGNVvhnmoETLomlJlNBwyElwRrzkPZf4qz7MkDT1ElphfKXltKog0PdG X-Received: by 2002:a62:1d8f:0:b0:627:82a7:11f9 with SMTP id d137-20020a621d8f000000b0062782a711f9mr110456pfd.12.1680811352110; Thu, 06 Apr 2023 13:02:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680811352; cv=none; d=google.com; s=arc-20160816; b=K4y9eBm66CEWNQh2UCca1M3g7+wMDydeBltDGES7QPF9nLC9z61aCLokTGM2/Njqap /IYtzgQVCKBl+1sU3R0C6uz/aNO5P38tyqc7MI9FzjLcXLcol05vASWMrzzvkG5IGWjn sZJUdC/jKX5RheCSKKHH6W4IFBjrCaNlpopQVUcL1hnQGL+6wCCCquXU/mCF7uKo2L/5 W2QbebhJbdP2RneNWqxqMxnAh5UVdD6QsNKJcvifIdYXcZsL/waU+nTU8fZBo0qOWWZi cyzxQErp7owmfL6fM2K3drpWEFOSmLhefrNHrHvoPV0/qVH565tZsWXcJp4nLfSI4NqX dt2A== 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=phWVQijBVoQ5zEwHows33CrHR+M2kAs0UewdGrrm12WYN9ODMXXD7t7+clLy487OEh 6W2ymxuYPzmewhfK5jFa3wGqWP8hwAPY3EMSPMIf136QYUaACBGPlfjTh3g0yWs1ALZG 0DTUqquUk7knh60eMkAqZZ86HbyjoeEAJZleo3p+AHBF+NguYTS+nrEhMketSVUvPAXd B/4W+9LcWJyjCPZ5tRYn+6xHnR7OliAsllqEees/wUocOXvulwg7tDaFKLN3ZW19kZ4g xeUPje67UI/3ltTPckzYWIRFjPr3Ul4HaCKvE9Mg8Z5mDW2vA8R98k6S2M1Y30ntNS3g z/QA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=TgS7KSHK; 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 a5-20020aa79705000000b00628030da823si1994445pfg.318.2023.04.06.13.02.19; Thu, 06 Apr 2023 13:02:32 -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=TgS7KSHK; 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 S238043AbjDFTmi (ORCPT + 99 others); Thu, 6 Apr 2023 15:42:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237645AbjDFTmV (ORCPT ); Thu, 6 Apr 2023 15:42:21 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D42393EB; Thu, 6 Apr 2023 12:42:19 -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 1769D66031D9; Thu, 6 Apr 2023 20:42:18 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1680810138; bh=qXAW+NxBtXP2ZLN97K9FdNC+pkjm39ZBXXRQWxqaxDQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TgS7KSHKboSv+CoImq/CKFcCgmLJj45/PlLVqOVMSP3e9kEM8tGV9UzfeUui/1YVX db0p4Be/OLxL3fcUbchrp40Vd5cMCCn3Jqfa+Vf1Ws0qtqJsQhO4D5pVQAvhosTyNv oh0ihIRa7DueIIuVFS+YD/xwGrnhDYjznf22qRohUJxyabGXM5RcjizseK7UtJe1lN J79ftHnjTCQqtusGY8UKy9oxE7sl3u6VORkiE/mdfIRLxFpM6SrW8pI8XV+g6I7xVK n1HA+YidW2h7dvG4e07FAsnnZIZilxeXmZZmEJxQGvnUNzhRjpMrB5ZIE1j1aGpuvF YT1BfbvqXqlhQ== 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 v3 5/8] regulator: fan53555: Make use of the bit macros Date: Thu, 6 Apr 2023 22:41:55 +0300 Message-Id: <20230406194158.963352-6-cristian.ciocaltea@collabora.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230406194158.963352-1-cristian.ciocaltea@collabora.com> References: <20230406194158.963352-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?1762458444607301443?= X-GMAIL-MSGID: =?utf-8?q?1762458444607301443?= 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 19:41:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 80420 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1266975vqo; Thu, 6 Apr 2023 12:57:54 -0700 (PDT) X-Google-Smtp-Source: AKy350ZGfQQr7TX864r9EUF6h/8HumpNcYiYIdplEs7CwUr2CMwrfKEjaaNIucuQy8+Py2tGeGH1 X-Received: by 2002:aa7:9404:0:b0:619:53de:8880 with SMTP id x4-20020aa79404000000b0061953de8880mr88883pfo.16.1680811073963; Thu, 06 Apr 2023 12:57:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680811073; cv=none; d=google.com; s=arc-20160816; b=PMmJbfHpK1/3AaKZPCeYHexX/CfTeeFRlZGTChVvxBqWNk7ldZy+Sy4HxIF6167zIP B4cfwuDPnZhYKaKgXpl7HXgCOrPz68FmdGxy2NaDyeej0ZPqkqJ8h4qPx1QGqxxQHe2G jvMhA45EfNlPGwCTPm76rPxSX0eu43/G9LlOdB9//7qWPlFgYFAlZUmda1ffJHNoUrPj P1ycaaMk9BI4Ikkx5lAEIGZa3Cqix1LW70f8PbgF56ZNdLLUqlUqxPi8Y6UXvrZq+uoo LQqRNbO6BUPHH147cVFLdNBQ4z4GTzbmffLylkXZAk+xcH/aTAhNmosIP8wyjSnXZ1XC XUZQ== 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=Zt6IizVOxNr+Qy1mePpxX1SQ+MuygjS1pX8hQDoCCisehgADplmKZi8Waj2mIw8DlT bH2MRD/bOp21lBhe+xwJQxxfzWHPymlBJCdWSygo3hvQbK8l8ItsuwVgKHLaqVX+wCOH RbElfpvleVXIZSaBeZVDGYGA3WFe/v94q0MdlawPTjhCtV1QpJAJmzmROoB3O8yk6Iq+ YCesvMQxPbH1ZpSbz99k8DJ5vqE4F7gCWI99L+qCr8zEVFGn6SMaF4w8NMIbTRLS2+dU ARQvtECn1RXVXrfpxjwoI+sAWMV9RgBo6IOV3moPq3/TkGP3HqLQ3dImRjWPjoycSGla x2lQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=EUXiqy5X; 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 c9-20020aa79529000000b00627ec453561si2105678pfp.99.2023.04.06.12.57.41; Thu, 06 Apr 2023 12:57:53 -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=EUXiqy5X; 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 S237464AbjDFTml (ORCPT + 99 others); Thu, 6 Apr 2023 15:42:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237472AbjDFTm0 (ORCPT ); Thu, 6 Apr 2023 15:42:26 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0AAAA245; Thu, 6 Apr 2023 12:42: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 81D2866031ED; Thu, 6 Apr 2023 20:42:20 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1680810140; bh=3rBxNv391K3rouaSGtWY3Lj00PK9hBEW9sLwGyEnlTc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EUXiqy5XrwJiWDpluiGuRSuDuPcb2xZLn6UTsz5p1jUmRonWnMEBji9XPm6hGS0Nu bCatyGmEkkJTjWin7L5ipoW694UikATPzvbvBaEY3BeR4mxb0Xor5s+EOjFwDApodX D7EG+UkH7xFKFEuSRD2mYgFRh1dR2NEIy3jQoYvW0S4L21BFvl6gWZCoTeJa7QU8us 4qjppkApegQMDfF2oSHdJQAgNT3BYYPLfMUP2xGLwIYvzKquDf9fkXSVr1c/vWe8Ai qjHnT4eqyp7bvuW1g1NiSCV0r1qeazVzlQtPbucscHhSlqHZ24t+9XPw6fhw4V6jV/ lcoqXnRCFwA8Q== 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 v3 6/8] regulator: fan53555: Improve vsel_mask computation Date: Thu, 6 Apr 2023 22:41:56 +0300 Message-Id: <20230406194158.963352-7-cristian.ciocaltea@collabora.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230406194158.963352-1-cristian.ciocaltea@collabora.com> References: <20230406194158.963352-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?1762458152637894908?= X-GMAIL-MSGID: =?utf-8?q?1762458152637894908?= 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 19:41:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 80429 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1273548vqo; Thu, 6 Apr 2023 13:08:55 -0700 (PDT) X-Google-Smtp-Source: AKy350YRo52UEjV3pPcYBXPNyWsDlvx++zYKH4y5gCuw4573aRRvvk7MlHtYj32fgVw2AK/2jMmR X-Received: by 2002:a05:6a20:b729:b0:da:4e05:768 with SMTP id fg41-20020a056a20b72900b000da4e050768mr582866pzb.38.1680811735215; Thu, 06 Apr 2023 13:08:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680811735; cv=none; d=google.com; s=arc-20160816; b=r3o/sb1PL9Wzb9BVy9oPLZzAnCkmU8+gm2uzQLlHbtw9WkfMtDmGrTU85Z+xdYN7TO UfSDycilR4Tl0Y6JlGUDFS3jZiqRt4gZPYBeL/R4sjWsuVrsiCnqaK4Yc7c7wYRRex1V M7/61T+n+suSwY76R8vjTAjA4RMtZEcb8Cz/ZUu3TYpzSlTqs4LtH9sCgmmx++P5ScrB uJ5oy80c7KXi8XHZvshmrndrUHoFY/RF1aGsDrQ5skXrCsBJyq8iUk2FlD/D+ZFK4cJO QjW2RPbXIV9QXl6V0sf9l9HUGKqY3eE2VLq7o2Yeo20PefcuTjkohNgaUuIJkYZI6I77 SnLw== 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=CSsiK7M3MgKjQd9990MsHhDao4CZnlHYMINjAtu1oWjGnuVx8J+HqahN96BbH7iia+ Sndqo4eRJd9MOOvz6YsD0EQnz6U0UaKSGfjhs93NQPp5QnRwpd+NftwMS76EyZJDeSCq iflXcOyryu935tZKoIMCVFiaaq0KGmLzWmlTwr4R4tQPJmhQQGGxpZptC1im+1hILYAX isYmf7H9hbjLSte7978etZbJugHB27vYY9yDvskPI4flrsnkudot4bn2ua4lYf8wlh8c Gb6jJAo2iFZ496SXwPsL+fRJqhk9/tw9/Dwh49VnKQZRl9pnzWL/3bW47nhJmVy+nMA8 4rzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=aEHJyh2X; 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 d28-20020a630e1c000000b005138c1f1fcdsi1817313pgl.663.2023.04.06.13.08.42; Thu, 06 Apr 2023 13:08:55 -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=aEHJyh2X; 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 S237914AbjDFTmu (ORCPT + 99 others); Thu, 6 Apr 2023 15:42:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237881AbjDFTmf (ORCPT ); Thu, 6 Apr 2023 15:42:35 -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 B6CA39747; Thu, 6 Apr 2023 12:42:24 -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 5E70F66031CF; Thu, 6 Apr 2023 20:42:23 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1680810143; bh=aW4fe1+DDo3cV0bZP+53AoiJSFgqHyfIP7z13IHIZi4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aEHJyh2X1YhOg4vQKdBRIVPbQn8OBAJuEP3l1Iqrt6aX9fw7XYha1LnPXjg1Y3xMt zZwhhnDiZQM9phbDAtQEIEU4gvY3faGu6uR6zkhVn80soUn8dVf+Uy8uO45FRMAi5S VeOV/hTHD41F8ibJRNumKBIqbLICGj08djW58vqkLeiNWZ66lgVAfR/UbVBzZFL3vF tIRteF2by+S7azDg/t1pXjalQsWjA3dmNkan7AzL7p5Vp3Q34jyJvRTnL+X/f8ciUV oCz+P+4GhoF4TxalYYjoJV+EKEg0boZ9WEeZU1ikmM7ZQEGd0pSVnItkMhdRCAhGDr cDxqG7J21FlRA== 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 v3 7/8] regulator: fan53555: Use dev_err_probe Date: Thu, 6 Apr 2023 22:41:57 +0300 Message-Id: <20230406194158.963352-8-cristian.ciocaltea@collabora.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230406194158.963352-1-cristian.ciocaltea@collabora.com> References: <20230406194158.963352-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?1762458846105016188?= X-GMAIL-MSGID: =?utf-8?q?1762458846105016188?= 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 19:41:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 80424 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1273086vqo; Thu, 6 Apr 2023 13:08:11 -0700 (PDT) X-Google-Smtp-Source: AKy350YglizHr8zM3ZjBR8jqsBijLRmIuf6MADbVlyCWLh5f8JS6jDmcS7EaKfjvi6DHKC+EUuG0 X-Received: by 2002:a17:90a:c90e:b0:23c:ffd2:6502 with SMTP id v14-20020a17090ac90e00b0023cffd26502mr12861542pjt.12.1680811690763; Thu, 06 Apr 2023 13:08:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680811690; cv=none; d=google.com; s=arc-20160816; b=JJRPKDyoxcO8gyXIk4TVWYTRx61NecVGigEEpKs27qhEHo7PYZVH98/3tGgkTwza0l hPNbq6hndIj4wyfn5CHTdJisg7Mr+ztIvcw6W+BunDeaNRFp2b2TTQ1tysgCrzDdejlP dkVuvHZECm3LjdY/UHXvjAnyZLyfoQBTc9jFCBy14ODFert78Cwrwuj4dUKegFWRh8OD ZRauKHtvNKu6SE5Jtq4jRWujYmk7gpx9sIzvIEGXy3A3RdyTMaND+C83xfOWu0mVj74y LtN43Mt+mrzNVP91hbMXMHtdHv6XFZ/hhRI/Jq7MkUw78FnPVzzC6hGZD3IgxbzaiRxL R88w== 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=2+qdr45f2kprN7RyyZw5QdODQ9JdIW1gbTYH5iEHJKk=; b=KYvlRifuP2ndMH2fZMVIqyzlDGpf5W2ptiTBFMEZdjt6k59dHS0bUr0geVbq+zNdPQ rlwIjh6PuMBB2/xqu7ml3Pcz3d5pXlieeDFio0sQ3Sfda2F34R/bvtIZgPu24v0tbVSX 5FoMd6O05vTeivo5Et20bRnnaslPCYtUQqVP//qtq57ZWGctUIYrntyt3cTo+ePw4rvd PRM4EQQ/SkBMLzdYIl39W3AWa2UMRWW8w/KTCRLZRfwPEbrm3mBQaPDB8I/WLNGstaQC fK8qsoDD4kWNprxNm489GT18oc5QIPtX1AtdVQa5XWCMhlqdTrhT7Po/RGadO8ShJBqf NpsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=hSBDoBw4; 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 ml20-20020a17090b361400b00237b958814fsi1955819pjb.74.2023.04.06.13.07.57; Thu, 06 Apr 2023 13:08: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=hSBDoBw4; 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 S238304AbjDFTnA (ORCPT + 99 others); Thu, 6 Apr 2023 15:43:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238021AbjDFTmi (ORCPT ); Thu, 6 Apr 2023 15:42:38 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81E889EF8; Thu, 6 Apr 2023 12:42: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 32FA866031D5; Thu, 6 Apr 2023 20:42:26 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1680810146; bh=+YdIcETyNfpkQmcW9tbiByQb/VvaW4lYVnY65X/faAA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hSBDoBw4JTBIOsSd+p6eH3UYEvcmvVzlf6IKW4YrDN0TdvIab8Cw6bQVHp0spzBmx VroCDm6aA/W3WnbcoJvpcv+zgRQ2Y95LJJCFWgwPw77aLzkXr13zWEMNtUzRH9FS3X Ezo7hIHnGFUHZjZiIhYtFwYz0OGPY6Vls9YwQZ/oSX5zdvsjtAgF29Eaf/8tDv4btE Fv8cVH63yA0BjA7WxJ0MVGXEKLdG5oHO2wiwsccn/pAQ91ixs0x0pmX+oW80zBCaKb QjjV/Nk1CZxeZSoWMWUHEH7UiGinV0bDDM2B2bNSnSqrGQaSgg4XHfVWAj8uNUQiBI c+fpFeCTpS1jg== 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, Krzysztof Kozlowski Subject: [PATCH v3 8/8] regulator: fan53555: Add support for RK860X Date: Thu, 6 Apr 2023 22:41:58 +0300 Message-Id: <20230406194158.963352-9-cristian.ciocaltea@collabora.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230406194158.963352-1-cristian.ciocaltea@collabora.com> References: <20230406194158.963352-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?1762458799334288893?= X-GMAIL-MSGID: =?utf-8?q?1762458799334288893?= 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