From patchwork Wed Apr 5 19:47:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 79889 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp552196vqo; Wed, 5 Apr 2023 12:50:48 -0700 (PDT) X-Google-Smtp-Source: AKy350aZa2GUAI0MzVwMKRv48kTCUW/j4mJ4ZAdKFNeJxwozcEyWhOcVyOe6JlLZOkkLC12IKVtc X-Received: by 2002:a05:6402:b36:b0:501:e22f:86b9 with SMTP id bo22-20020a0564020b3600b00501e22f86b9mr3102161edb.36.1680724248405; Wed, 05 Apr 2023 12:50:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680724248; cv=none; d=google.com; s=arc-20160816; b=Wll2onT+RFT67vvZpxjiBxdcM8dQWCAtkxee8uvwuaZ/3VLjVUGmZOKsOqAEUbNtT4 xt+Qg3gX1ekbpzM/4Zr9fqlOJBgUz5/UClVBzGJhVfLYGbdFhHGRKba1jvA9TfFskEpk VZcfBVR77fXio7EoARQ97o9sxNYDgvbASTDVY2NAPRndNjGOh1OvoJi/0z8t4CTjHeHs Kb5VbBaWMyuJlrX14JmbCuyIpSF5Ln3bLTapsBgbOePdXHlvaENJJky8vG1jtXUw03Kk 1dmdhZHWh9oGwEX0Hz7w8gDocVXEpS6yPI5EwCodCJNZBxI5t19AHPfH6vZ10VCV6/74 Fpgw== 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=3VVtx4xxRuBMB09z54Xr4Ol+FlkhEs/DWdEbvbycJLM=; b=FJ+sAVMW0LKMIj4nGGNpnXjWUVNfQBHfHMmq4u9LViutEEIP4wTBEP48DF2QqeY/Tb zs/E9pKVyMADGuAsEHFKrzQmQc2QRFnvShZYp5azTFZbco4TGHIRbSVCYP6WvnJv32dx LdSBQuQ7SMVloUHXKZBuBUEBNi8cvFtDTwWY/2ikz6rn9kyaulaSBM4uN2vA/aU6hAx3 CFPikb8sq67uYPL58jnNOc0XxT1gt6fUVEvK72RBP3ZwgaHC/ZSAJYZHRJHpmO1/STCs Iu6RGV2rPkiiioyVApxtihGJuH1nJ0k/BC2jL7HI6Wh7Mvy64sDrH4V5JnUPo7LHL9lV uNMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=eVAqYtsk; 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 e15-20020a056402148f00b005002ebedfc7si607813edv.403.2023.04.05.12.50.24; Wed, 05 Apr 2023 12:50:48 -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=eVAqYtsk; 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 S233282AbjDETry (ORCPT + 99 others); Wed, 5 Apr 2023 15:47:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231574AbjDETrv (ORCPT ); Wed, 5 Apr 2023 15:47:51 -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 A46851BCB; Wed, 5 Apr 2023 12:47:50 -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 111B366031B8; Wed, 5 Apr 2023 20:47:49 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1680724069; bh=S3QFPGksFul8EKDz4REcYGEFNQkePdH+o2Lfo0bgFJY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eVAqYtskWJnmjdyHOVgtNUkQps0Y9AWTS3YkRNEjAzdW0luaqGqTvNmxU2MUlpKse H14sRKt6TyD2Vpy50G5zW1JN3rjXP/UQ+SfpWm1H52qM53qLHqsoDwq93ydCFDHxJr gqTIF0ajoeslVK4gNSC/pdFG90w0QOiFWmPg7/fgjxZU/+qq1Fk8wgy10qNRkNI4xP ePcR4Eu/49vSNLEKxPONX+Ab6C5rio+YcQWZ2JpwiTz87RaFqt4tUDZy6WGJP2b4kQ VvPUYlp95YSeWqS/ojWThGkicUFScex/jdqQXXeg6x8EfN31NJTJphxfXxCPb1rcqr /qvT4GrDHBDvA== 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 1/8] regulator: dt-bindings: fcs,fan53555: Add support for RK860X Date: Wed, 5 Apr 2023 22:47:14 +0300 Message-Id: <20230405194721.821536-2-cristian.ciocaltea@collabora.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230405194721.821536-1-cristian.ciocaltea@collabora.com> References: <20230405194721.821536-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?1762367109662525263?= X-GMAIL-MSGID: =?utf-8?q?1762367109662525263?= Add compatibles to support Rockchip RK860X regulators. RK8600/RK8601 are compatible with Fairchild FAN53555 regulators, while RK8602/RK8603 are a bit different, having a wider voltage selection range. Signed-off-by: Cristian Ciocaltea Acked-by: Krzysztof Kozlowski --- Documentation/devicetree/bindings/regulator/fcs,fan53555.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/regulator/fcs,fan53555.yaml b/Documentation/devicetree/bindings/regulator/fcs,fan53555.yaml index c0dbba843f70..687eda31ad90 100644 --- a/Documentation/devicetree/bindings/regulator/fcs,fan53555.yaml +++ b/Documentation/devicetree/bindings/regulator/fcs,fan53555.yaml @@ -17,6 +17,10 @@ properties: enum: - fcs,fan53555 - fcs,fan53526 + - rockchip,rk8600 + - rockchip,rk8601 + - rockchip,rk8602 + - rockchip,rk8603 - silergy,syr827 - silergy,syr828 - tcs,tcs4525 From patchwork Wed Apr 5 19:47:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 79895 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp556674vqo; Wed, 5 Apr 2023 13:00:38 -0700 (PDT) X-Google-Smtp-Source: AKy350b99zSiWVoiX0n/CDQi3/7WtMu0eXnP78BuHgOeFzarZgNsLYdRQivELyjI8SyY7kb12PPT X-Received: by 2002:a17:90a:1911:b0:240:70dc:cf46 with SMTP id 17-20020a17090a191100b0024070dccf46mr8341041pjg.11.1680724838041; Wed, 05 Apr 2023 13:00:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680724838; cv=none; d=google.com; s=arc-20160816; b=RcEBCWMkaL4rIA1RgCkJjta7URqLBnaxmYtZkOCnoHV3/3hosE9LY20tssmaXeEs9x aKvMsBH4Ylq/aFkpiktfXzY6Ec4umW8x5T4p3RymyC/0vw4UaVm0yoahgU50c6SwVQoA qtpxYDCYbDmixaShcAvhuPK0+kZFqRgDv/+pIM6W0V5XURtoxcQ+B7ekZ9m16EGmgYRh yB7lSBkZtL97sc6I7VwCR67uTKMGBhYmis3NGE3URJ1ktjQp5grNCxCjk3ati/5C3Mll 2RPIsVkAMtWbwleYdHTeCr57wSCg+JovalCZvcNy8r/7K5wsaSCCahuUmtV87s6DNgqR GABQ== 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=C52VjquN2WeHFLbijixXXvdn3+sAs2kDDLEat+1uzigBi4BLtkiMAipKaeRCMty6Jq RsvnTOHeXEGIhyMZsRlgEqjpnA8jZLfnYcA4Pnk0nWlTi72/vKAG2Ie+Y6JTRaKW+Jq1 jj6kQoZJiaEorAHhlCcwCXYzPPu2fMf3BT1y046j8DC0PRF0t4ch/84wjlzH3dsDiKEt LB2Am4ia1lyuqeN5khYIfOdj47/Toh8YcKJLCUj5anvUCNftsjmeW8fj0+TlvQmnZ3wJ l9vM9VqrTQ8JTWY/XqMjg69HEutBJVK5ifowBzA/0BuuMhStO/pkoBed9aw3qcZ0XLHf O6xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=BhdI9GvK; 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 c20-20020a6566d4000000b005139b6e0977si12698448pgw.555.2023.04.05.13.00.24; Wed, 05 Apr 2023 13:00:38 -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=BhdI9GvK; 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 S234012AbjDETsE (ORCPT + 99 others); Wed, 5 Apr 2023 15:48:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233612AbjDETsA (ORCPT ); Wed, 5 Apr 2023 15:48:00 -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 EC59F7684; Wed, 5 Apr 2023 12:47:53 -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 A1F72660319A; Wed, 5 Apr 2023 20:47:52 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1680724072; bh=DMsss3S5xTQ3vBQF9dvbUFqzefuTEWVYo2dfHUqUcKc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BhdI9GvKF1tR9YsiQ78zOGCUmuzVrO+6ZU5PjS22PcJ6tifbGaFJaWAvTBYA8mmTL R02TqaFtoOxFRTRHoOC+moQt7c7eJ3Mg0mSw5dB97ALq5SJrXqtbgXqwf4Hqaq+sAu EZeHz1uMmydtWi52bjqoPDwKv8dF2fWvX2YwCjk1pLoFZsKUQFqdATeJ82IId4Yirg lKrszM/2u/2iX5ahgiLSNRZeM5z2O6sQxCZLdS0o428EVcuEu9KxkJ+O6i8hVz49W8 xho/+Qw7Z/p8nUjCidl/DE7hKGxsTIbeJhXrP4A4lPjjrwzSEsmSuDr5fiK020w0Nh rBKHwQBBBGp1g== 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 2/8] regulator: fan53555: Explicitly include bits header Date: Wed, 5 Apr 2023 22:47:15 +0300 Message-Id: <20230405194721.821536-3-cristian.ciocaltea@collabora.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230405194721.821536-1-cristian.ciocaltea@collabora.com> References: <20230405194721.821536-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?1762367727781487177?= X-GMAIL-MSGID: =?utf-8?q?1762367727781487177?= 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 Wed Apr 5 19:47:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 79894 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp556530vqo; Wed, 5 Apr 2023 13:00:24 -0700 (PDT) X-Google-Smtp-Source: AKy350afXibZVylAtpKLuo5TZmcH7aydaB29Wd05zgSpG21OJADiedlf5+HCGxX0ZE6iH2tLm6rs X-Received: by 2002:a17:90b:3b81:b0:23f:a667:4efa with SMTP id pc1-20020a17090b3b8100b0023fa6674efamr8203860pjb.15.1680724824347; Wed, 05 Apr 2023 13:00:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680724824; cv=none; d=google.com; s=arc-20160816; b=O13Zbzgkl9VIDE3XU/jp1bVCex57I6UH/CmARBHZqj6LpxmXhkcwhfC9GuJTAr0/Il iac+9+NBNPq7OYmln1cnxx6ef8rGP/HhZmbVyB/boLCA4VeZhSAs1KEfJhkQApEXVhWr Wg8rFm1J6GxOZolkrxEZsT+eXnDQOaviPRgvEtCfjpLuN4Z6ER3/Ze3D8v9H3rl3ywq9 yuG4Sv6FKUJQeBZSUsUdHkUo7/73PdAYtr/8FRt67cDXZajIUVU+uGmHrHOlVUB1TVfE VbQUEAP7AxyeWMEVsi6qa31apqHvdr6eKG28aJ/bWyldV7Nf9WYi+K/Y4JqbQR2HcAFS Tkig== 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=0uxq27Mia6Ih2Bxj/t/7fjNzqXBASPZfuwvRT1S9J7dGTou6NGsm4jdvhIFHVZc4Gu yYnGBJqNYU+e0w/f4SKEOEUou05OUuW2OrPQly/pSA7U50N2T68E8WZLgmo25ERIbHwK T9MeODk0tx71kPVk/NwtDn7R1NaJiPQPX7VeQGqAKdhQjWw6Ve3rt94erYySoezWnvIx fmRBVgCBRvN3e0S090JA++CYw2w1h6aAfj+x9CMJrX5uXIuNIE0dkaHlg3EBrn0/Zsb5 za6aw+EqbnCvZwrgpLHekRnH5dFE3DyhuvO7E6pHhCh+0E8uK6ml3ilPsexWMJ0oGZRt f3Fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=iI9APUue; 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 e11-20020a17090a804b00b002366a535553si2012947pjw.107.2023.04.05.13.00.11; Wed, 05 Apr 2023 13:00:24 -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=iI9APUue; 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 S234131AbjDETsK (ORCPT + 99 others); Wed, 5 Apr 2023 15:48:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233912AbjDETsD (ORCPT ); Wed, 5 Apr 2023 15:48:03 -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 5CB3B92; Wed, 5 Apr 2023 12:47:57 -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 DDCF96602F91; Wed, 5 Apr 2023 20:47:55 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1680724076; bh=lFOZ5esxl/tbYIcE53Cn4DHfBeM2O3R87VdL+HeZPkw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iI9APUue2/K4FqjztLPgUI7rn2j0HfLHAk1LAw6Apgdha9JB6y0Gs5d2X6saWELs/ cAUONc+FPvzxUGIy38aWlD8toh0BtYXW6xhk+/YlILQqPb4iRWQJYQmxtdYkh5kZhX dx4gBQ7C/gjBf7cWEzdHKa6VENfwD2pfk0TtsePIrFo1VwF0dTXkOddGK5+1h82rXJ oAzV33h4zAd9tDs0AiUdLOsvjmFPK4qHrWXjKiPnw87qoCoQqpM7MyCpe7sOAnSOMT sxDy3xDAPdNydI1aYFZ166FwSHVmn6LB1wtLDqbmITRsuGoKRmeSnpsAdd8t71vpbp 36xykL0F44eRA== 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 3/8] regulator: fan53555: Fix wrong TCS_SLEW_MASK Date: Wed, 5 Apr 2023 22:47:16 +0300 Message-Id: <20230405194721.821536-4-cristian.ciocaltea@collabora.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230405194721.821536-1-cristian.ciocaltea@collabora.com> References: <20230405194721.821536-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?1762367713316873445?= X-GMAIL-MSGID: =?utf-8?q?1762367713316873445?= 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 Wed Apr 5 19:47:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 79890 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp552315vqo; Wed, 5 Apr 2023 12:51:08 -0700 (PDT) X-Google-Smtp-Source: AKy350agzRD7mdpn0nc9rgg4dI8vHTSSMTHDCp8Q3ocasxii81PfpVTktqIBymqNmOG9UV3QDwwJ X-Received: by 2002:aa7:c156:0:b0:4fb:2060:4c20 with SMTP id r22-20020aa7c156000000b004fb20604c20mr3163015edp.31.1680724268495; Wed, 05 Apr 2023 12:51:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680724268; cv=none; d=google.com; s=arc-20160816; b=QZ2oLQKfOWgCfwpljSGkyt6ZLoFpREUk5gPHC5MsSA9wG5yxuYRnsAVO42iFFVdqmM OCWxWDA5TEMacZVHGFVMmmPGF19NobDkTlEBHgxFjsWjfBvVgq4nE+4Klu2JvfsUOnYi 9dL637UUBs+pT34V6qHZgCpWQNBBOt6Il2Xc2INdKcvPo7K7MwHM9AP24saKbMtjyYf5 YVbgTHV/Lz+viuUgG8QG++4cjf571NM2IMatPvnkamDsN16visxn1OnH01fEotdft/Ph R5hr1iCDp/cK8J9rYQvpdPtlc3ov0Yv7eGqyuZRM+jxZJE3TlOA1t7UKgornZoeQIIjG indw== 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=C/rvKUYa5O4LGVk2kW++XDMA0eBtUOdMVHacBVdzQfr5wILZ9p5jSeh0Ml31Oe6V6w sowHOTW7qT3U2WpgQoW6MpnVVXPz/3vykLF2DtNPIf0u2Uvp5vrtKNlKw9t4aXqQ/4DK kSTVi1uZsNDEtRKw8jG6cqwG+E6FWAt8rIo+eHJGBQ4RRiqEmTYN1L70FsKHcqztQ4F5 APj2a3COmXecFk4C95uelMIezhcUnbnWucyfSbIj2Jej/E88KJvZqb6NgM8bBhRHY4S7 /a0WO1mNFm4ekCRoY/QfQr46YwThwEA8dGTaA++a2hH36BtPhzhRvOJXnykmYtiNtTvZ h7hA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="IM1kI/vO"; 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 b15-20020aa7cd0f000000b004c698b50197si1669777edw.342.2023.04.05.12.50.43; Wed, 05 Apr 2023 12:51:08 -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="IM1kI/vO"; 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 S233117AbjDETsS (ORCPT + 99 others); Wed, 5 Apr 2023 15:48:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233852AbjDETsG (ORCPT ); Wed, 5 Apr 2023 15:48:06 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69396E47; Wed, 5 Apr 2023 12:48:01 -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 480B06603197; Wed, 5 Apr 2023 20:47:59 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1680724079; bh=iPoOGVI0NPGMRksIN5FgAEe90yrWeul7So9tDiTWunw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IM1kI/vOGqYbUP9Yx/v+QlMUos/rtTnHgi7kxxktXihcWQpw0fmPPbXFXUL8uHPDB N0qms8J6ivKUze8Y0FGgFO+aGxlFtaJUc7vygSmo5/zhdHsW+wV73uswdPRMvRdLhi oY87bXoNGGPzTcFqK+zuU66rvK4h04ZEETSovNY9SSSjPV8b8+L8br3zXn8wAA8+k5 +PvsizxGSQj5Lt/JS+Ip7fc6xNbvRUERUtHLMwbuxIZQ2ERqmBgxWnG6Y2ykMiHfOs sWOFUKXHeT9LIoPTw/L4i9fIpwbNx72C/v+1IqX48EQ6cLv/qjWzBa/vVLRUK7BbdN s7zDvHfnZet4w== 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 4/8] regulator: fan53555: Remove unused *_SLEW_SHIFT definitions Date: Wed, 5 Apr 2023 22:47:17 +0300 Message-Id: <20230405194721.821536-5-cristian.ciocaltea@collabora.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230405194721.821536-1-cristian.ciocaltea@collabora.com> References: <20230405194721.821536-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?1762367130134593086?= X-GMAIL-MSGID: =?utf-8?q?1762367130134593086?= 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 Wed Apr 5 19:47:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 79893 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp553377vqo; Wed, 5 Apr 2023 12:53:24 -0700 (PDT) X-Google-Smtp-Source: AKy350YHTu952r3/RZIoO7JDULKCW7m9kf/Lls75zfaIvS4/yrbPmMFpKQ5l9QVVBvwVYo19CFmb X-Received: by 2002:a17:906:c005:b0:947:55ce:1217 with SMTP id e5-20020a170906c00500b0094755ce1217mr3934926ejz.73.1680724403862; Wed, 05 Apr 2023 12:53:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680724403; cv=none; d=google.com; s=arc-20160816; b=CCWpSdMbu4/NOLNfXBQdMh0AZye9KfEsbr4134HDuaPrXPAJZ1/pL77nf7KWiEOPmb LCYkHXsGM5gFHjcZaAAGNnqTSlnSIHecqYYb9yxs4UsqmuXy3qtD24c75c3Zl9+e2C32 BthbzDg7f1TMe+/E4US5hE/PYau26qeEpjkvriz2kB2uGYOGOWXuRCyCqKWzVo93LYQ2 gc/HFnItYHTI8LpNyTVCCDWMTYav9ijI1L2swLiokp35QLeH/UhMnWCOcWdaaIlgsJf4 cjJ0lJGNe+ZZOq6ud9MyeXeXujn5O2xNe8C0bZo3k4NSSM9EAgo9QMy12NfAO1CrRs8S nOLA== 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=IgVzhE6sGo8umK9hcpysgHEf7NUDzm4gTBW6QlSqIiuwi9Q6OqwPYCNCQeWCla9yJw 2vOchz81Avx503DQOanVRJwLPScRC1PSYsiLgyFGr5fIf7AkS4WefITSObMsT4jWURwY 6kZ4U6u75J/WSHkJFVxwznjxbIaq0fc+vSRJbNLOL4UYgDe0ausrbE2pDOdpf3lcBVjI GH4CrlGwsZMfplINvoiBIBKBvjSUb1lDwUm4oc+qVgUAkp82HgGYZRSv9cFwg9txMVN3 mxV3JKiaVVCVoAa2OtqHRkTjbDj0Qzs/MTAFDGDWBbyr/Q0T74y5ojk7Cp8mNsie0nJt tvHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=jI54pcEo; 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 qw28-20020a1709066a1c00b00948b988992csi7764030ejc.920.2023.04.05.12.52.59; Wed, 05 Apr 2023 12:53:23 -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=jI54pcEo; 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 S234366AbjDETsc (ORCPT + 99 others); Wed, 5 Apr 2023 15:48:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233254AbjDETsM (ORCPT ); Wed, 5 Apr 2023 15:48: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 1D701E69; Wed, 5 Apr 2023 12:48:04 -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 A574F6602F91; Wed, 5 Apr 2023 20:48:02 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1680724082; bh=qXAW+NxBtXP2ZLN97K9FdNC+pkjm39ZBXXRQWxqaxDQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jI54pcEom6oKehCae89+key+iuWfRqK5M0z93IuXr/3R84HmEvBny+6oNQVYpir36 Al1wn80Py1T1YTc00wy0s4oOHM79qjxwLKx1kVM61UtrvL2S/jsKDTUENk94dZW/Ji Ci7Rm/b2OL186mgFEnfDoBjA9ON2U1gs81gheRu2CX4YeVoy1O+lCwxZwiSDb3EI75 iQgyHtcjgyYH+6kIROaWPPMkv+g0DZL1B62RKb5YReT8r4f5gWtucpWArsTmxrxlkl 45Kc2my4uQ+9+66IEvn7AWn7zN8epKUYwiK88EBFr/rgRev1GKIMrI7uj75X1CySK+ EyvvIOG82m4Lw== 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 5/8] regulator: fan53555: Make use of the bit macros Date: Wed, 5 Apr 2023 22:47:18 +0300 Message-Id: <20230405194721.821536-6-cristian.ciocaltea@collabora.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230405194721.821536-1-cristian.ciocaltea@collabora.com> References: <20230405194721.821536-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?1762367272644515559?= X-GMAIL-MSGID: =?utf-8?q?1762367272644515559?= 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 Wed Apr 5 19:47:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 79892 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp552855vqo; Wed, 5 Apr 2023 12:52:21 -0700 (PDT) X-Google-Smtp-Source: AKy350Z6p3ktLA7oEn0dw8EmDWomJSC55IOsTpQmzz1iionZC4hdJgkooFvHKc1/kWW1DXDVP7kE X-Received: by 2002:a17:906:d8c6:b0:8e9:afb1:65c6 with SMTP id re6-20020a170906d8c600b008e9afb165c6mr3272557ejb.13.1680724341715; Wed, 05 Apr 2023 12:52:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680724341; cv=none; d=google.com; s=arc-20160816; b=cIXKXQa+AlufPDBZWrMTtLyBJWzFTKIgjsHwyEWQDr3my/KFlZJyjCZV0qJdOT4hkg aT0987zEuW+tNXX5Kl2rcAODlzSm4W2r+uVuZdTPWcmE5VKhTBvWLlRoNC8NeJbg1BDL IiGoDtdI5UkeueB/2fOuDo5IQcCBYRWkWPfA4XscKOiZsYiBaYXhRJhBaQUBm9S3plhj pRHIb+8tsFnJUjarLWryAjIW7vI2TUPi2P1Cw49BKZRkNo6hE/OvaWZo3C2lkU4vimrx hV3+l6jijKZ5pXTvKsQogtVcsTOezcK5S+N7wN6VokaLAFCAsStRvGaAQdF6Axh24xd4 O4NQ== 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=i/SwyFacF6oMKT79zLf8EpR+p0kP7n52UzUrRHbgpyaU1wxqLhNY4hUUNHI8tDWe2r pJtBWBSYIFl461hxUG5+Gx79sYJBf+o1DEDLJdujv0eAVK4rAdYzF5BOVz2YukMGgmXr n0fvtEblS6A/FX1H4jofLYitYivqqK+MEA09xc7mk4dVjX2PtzJTuZ/vadKqAnlcMnEc cME9266yzPBMgd6djo/hv1gG3mjlaNIAKtNE4u7bhC0Cftf1ODvL+r6wvdu0SMgxUCe6 PyJe68ohmndc4m6Jl+1xMrUY6Vq34Fj7ecCH0nwj2YPX03nlALMwzBIcAew6czI6DLno drlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=EnhXiLNm; 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 n20-20020a1709067b5400b00939d46bb776si5023586ejo.60.2023.04.05.12.51.57; Wed, 05 Apr 2023 12:52:21 -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=EnhXiLNm; 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 S234009AbjDETsr (ORCPT + 99 others); Wed, 5 Apr 2023 15:48:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234248AbjDETsZ (ORCPT ); Wed, 5 Apr 2023 15:48:25 -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 AB18B126; Wed, 5 Apr 2023 12:48: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 A5592660319A; Wed, 5 Apr 2023 20:48:05 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1680724085; bh=3rBxNv391K3rouaSGtWY3Lj00PK9hBEW9sLwGyEnlTc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EnhXiLNmJCUAUTpemSZKRY6QGx5m8BuVXFtUZHtmDPKjHE8BGmqcB/1U4cWOywysj feO9LKSQNtsbWg5ZOuQ/SuQEjQFeqftQ8LHI3iL3NTYzj296jWJcbf6+uke8JIpa2g mMrz8y6OoSiJjMGAr0//NYoURi3l1qPrCr3WnjL/EqimSo868HwgY/mD4ibbsXjB+B 9cYIdsNoEMME6b475woL7TVaKliMpdeZjlj94uam2NelYt8yYB8WetxvvvdnlermSI SCYPGD2Al88qM2VicPFs3s4jxfLDvyi5JF2vZocNkWsPBOWDUu6nwEYW5bgz6hSMsJ I77fmCpMfTv6A== 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 6/8] regulator: fan53555: Improve vsel_mask computation Date: Wed, 5 Apr 2023 22:47:19 +0300 Message-Id: <20230405194721.821536-7-cristian.ciocaltea@collabora.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230405194721.821536-1-cristian.ciocaltea@collabora.com> References: <20230405194721.821536-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?1762367207131224073?= X-GMAIL-MSGID: =?utf-8?q?1762367207131224073?= 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 Wed Apr 5 19:47:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 79896 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp558172vqo; Wed, 5 Apr 2023 13:02:34 -0700 (PDT) X-Google-Smtp-Source: AKy350agbVBTYiFj6AqrVEuybnOCRewS0NU0UN1RBo8PtAcWhONAlTWERzDTZu9UsOKM6s/Qn7V6 X-Received: by 2002:a17:902:ec8c:b0:1a1:903f:de61 with SMTP id x12-20020a170902ec8c00b001a1903fde61mr9437703plg.63.1680724954459; Wed, 05 Apr 2023 13:02:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680724954; cv=none; d=google.com; s=arc-20160816; b=Hoo7+oDjSlUV4CpHNlUW2TbOZnknrKU3x+pUPcpMGrNnbo0btkVKibF6UHo6SGKKpH e8AcJ9GbEf19foT5jUXx6RyEWQMNgadDKzwYpt6atqyQgbIjtUHO8eLmjEqEi3MrMKKA subco0A69Yns+6DSPhYrq0mO9X1UuEyoXRC/Mkekv1Af3dj1/8mPhfNEO3i4+vuPS0o8 Y8wtwOtw4AmqAqSbrhA24nslILEslQow9JCf9T9I/Y4vtyBnd/IfU4DZl+HFa3ED8WaX BoVVZE6kDpi+KMNsVO0xeBsg/QH1P3n4dAhKziwFlq8Yft5LDiekAXaHo+9and0I8f1K jI1g== 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=dfYAK1yyluF0il9N4SIWF1sAD8va9bMIPCYCy7cfbNtNw3eHTR3UBw50vdZRWqZZsG Q/ik7GQ25CL4QtbKzUbxbzvg5PRfUGwh/TEleIHhjGuys41cH9AJizup1gYEK/n26RlX WHY1Wt8KIG378tLQ/29+nUC/QjeKkhWcw4PKzhvET7p1QX6MvvXBpMVHqpMF9iq1+F52 UJbOCiELIFwAkPB9Jd3UkTeGXxhef0a+aGQGeEBc3+zMWkEwh9oa+B20sJuy777WBo2q hFelERL62nSuqki/r+ivp10Hwy6O54+xxkXy56vHpmWM0retp6mHDwdOBjJSW67OyfIo /2rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=AsrzUygB; 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 iw12-20020a170903044c00b001a1a8e190besi12537072plb.29.2023.04.05.13.02.21; Wed, 05 Apr 2023 13:02: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=AsrzUygB; 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 S233000AbjDETs7 (ORCPT + 99 others); Wed, 5 Apr 2023 15:48:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234327AbjDETs1 (ORCPT ); Wed, 5 Apr 2023 15:48:27 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBC9C7AB4; Wed, 5 Apr 2023 12:48:09 -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 4DEC666031B9; Wed, 5 Apr 2023 20:48:08 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1680724088; bh=aW4fe1+DDo3cV0bZP+53AoiJSFgqHyfIP7z13IHIZi4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AsrzUygB9XtzLTLVaxrkH5xgjavj4Le4Tjkm+1LtItcCyIECk7rZVIAgU8F4OnHL9 1QSDqw5HRVpC1v7s7kwdgcbuA0DpyCW+o+hRg+KrolH66ChvDBiqxOselWXDbR30p1 hS0Ew9V4aL9gDmceCDKWQnbt+JpLmUIjh6x55ybnjpJrBDwtx1JGEe6ff9OhxDePU8 nvyl84L2qMjIL+c9z7IQN2xlpUdqrJHaXaEgGNPP69MDq5ESP8Tp4s7F/DS/l17QvJ EaOcetXPdToyXCTDF+AGzwFztluWQliaOBhgkW/+UMfOSSbXzhZz7jb5t9RFUVgFrU G9G/bUYg67VsQ== 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 7/8] regulator: fan53555: Use dev_err_probe Date: Wed, 5 Apr 2023 22:47:20 +0300 Message-Id: <20230405194721.821536-8-cristian.ciocaltea@collabora.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230405194721.821536-1-cristian.ciocaltea@collabora.com> References: <20230405194721.821536-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?1762367849670664471?= X-GMAIL-MSGID: =?utf-8?q?1762367849670664471?= 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 Wed Apr 5 19:47:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 79891 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp552800vqo; Wed, 5 Apr 2023 12:52:12 -0700 (PDT) X-Google-Smtp-Source: AKy350YSFJuVdF1W/G+rl6JUtPPNKp33auyykGOHrihCHf7kppE2ELmgp1HHyUZaoCNgZUFP5aNK X-Received: by 2002:a17:906:e104:b0:930:a74:52bb with SMTP id gj4-20020a170906e10400b009300a7452bbmr3406995ejb.14.1680724332228; Wed, 05 Apr 2023 12:52:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680724332; cv=none; d=google.com; s=arc-20160816; b=k88xkLRUVMTtXNpiJmYtkKV16NFpvLcnyantE1/QLlKFRn9S0UwpnSd9rsvjgSghod RWbecgV+yi6ML3CJOMcSrTosQ0vh/XdAwqFkxvI5LmGjS9LtvEM/DkeWuuG/AXQMeJml Cv3hNNzf686sTLmRYcpFYic1h3fGi8yBAcBQk1p/rYSsHou2ExB6By6+br9HVWgPGJB7 D7PRwJXGOVJ0Ha6W69482VJlEkKP16R9IIYrB5tQSyGYrV3tBPxHLRdaPM/i1jOkZFvF 2c2rGjTlfu3Jlx0YwGYK4DpDIJXqWyJ3+1jb7wkRrHAs1O1RYpk7I3SEq7osY819FPED 4ofw== 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=wGn5KNxlPSa5xIbw93FcmLKYzofD0V2dwAGsdCasshc=; b=VGHp6uI13xbW+SQp540t197KBTNNToCNm60lIQzlGUOyE2bWb6pNKQVJAdCAyzlINQ lpJPh83D86zxnC1cqMeTODjrlU/7JV8T/xqvq0iCuss5ywj/kPtL7xORShXVFEHRzA54 mEWN9CdHKGnxWr0X5y9YgmslVeEEPNzByndiM7SrQ7z1SEjCXXO3V/P5NYm6boWjAZBr YQs9LrUwSH2nbscpqVTYlf/OUVJEuZVJr2OpuaUTnZiuq3pBzBP45sMx6AZ61sQhsVl8 ZcX5qwqCw/5lo0Ctl/laUcoPEMUdFtn9+B9X9agdzklfwoilgNOSvd4FaW82d75FeH9r R1wA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=IF4xNkn9; 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 gu26-20020a170906f29a00b0091f2869a9d5si9972337ejb.691.2023.04.05.12.51.48; Wed, 05 Apr 2023 12:52: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=IF4xNkn9; 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 S231889AbjDETs5 (ORCPT + 99 others); Wed, 5 Apr 2023 15:48:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233704AbjDETsc (ORCPT ); Wed, 5 Apr 2023 15:48:32 -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 F115E7DBB; Wed, 5 Apr 2023 12:48:12 -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 4E1D966031C5; Wed, 5 Apr 2023 20:48:11 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1680724091; bh=ubsfMb1V7JFXAOo/IUXZ95ghB2VR04uZVFIbnCt86Qo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IF4xNkn9fzTNEp3KgLrqRR/wm+O9b5McizMbrzB8+shRNTt8tPHKxGz0sA4H7cQ+D DfRsxQsmz8bYdBDy2I5XDTsfTOf1COm2hGuSFK1bsR0tCYCn06CckiLkH+/zbB5cdX AZP/t01FQuxrQyXtL26KMb93xZWZJKWrN7BwST1BOsROfB1D8wRCwRRtdi9Q6a36YM h08ewXeLftVMHYBvdr3MaBLTjGekV7DRShLxpt7D6Df7S8qFVl+4/hYWYMp/pKHkvP p2MTENkfRXPuPBX51imJ8N92WvRPwEGlHT2ByDd/CqsdBcsaZ0pcrHWTT2jdnXDD8C 2Gr7lttsJdtJw== 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 8/8] regulator: fan53555: Add support for RK860X Date: Wed, 5 Apr 2023 22:47:21 +0300 Message-Id: <20230405194721.821536-9-cristian.ciocaltea@collabora.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230405194721.821536-1-cristian.ciocaltea@collabora.com> References: <20230405194721.821536-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?1762367197697491214?= X-GMAIL-MSGID: =?utf-8?q?1762367197697491214?= Extend the existing fan53555 driver to support the Rockchip RK860X regulators. RK8600/RK8601 are fully compatible with 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 --- drivers/regulator/fan53555.c | 133 ++++++++++++++++++++++++++++++++++- 1 file changed, 130 insertions(+), 3 deletions(-) diff --git a/drivers/regulator/fan53555.c b/drivers/regulator/fan53555.c index acf14ba7aaa6..1c662d6ea57b 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,18 @@ 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,rk8601", + .data = (void *)FAN53555_VENDOR_ROCKCHIP + }, { + .compatible = "rockchip,rk8602", + .data = (void *)RK8602_VENDOR_ROCKCHIP + }, { + .compatible = "rockchip,rk8603", + .data = (void *)RK8602_VENDOR_ROCKCHIP }, { .compatible = "silergy,syr827", .data = (void *)FAN53555_VENDOR_SILERGY, @@ -637,6 +752,18 @@ static const struct i2c_device_id fan53555_id[] = { }, { .name = "fan53555", .driver_data = FAN53555_VENDOR_FAIRCHILD + }, { + .name = "rk8600", + .driver_data = FAN53555_VENDOR_ROCKCHIP + }, { + .name = "rk8601", + .driver_data = FAN53555_VENDOR_ROCKCHIP + }, { + .name = "rk8602", + .driver_data = RK8602_VENDOR_ROCKCHIP + }, { + .name = "rk8603", + .driver_data = RK8602_VENDOR_ROCKCHIP }, { .name = "syr827", .driver_data = FAN53555_VENDOR_SILERGY