From nobody Thu Sep 19 01:28:55 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5FF2CE7B0E for ; Thu, 28 Sep 2023 08:56:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231462AbjI1I4j (ORCPT ); Thu, 28 Sep 2023 04:56:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231533AbjI1I4U (ORCPT ); Thu, 28 Sep 2023 04:56:20 -0400 Received: from mail-oi1-x22d.google.com (mail-oi1-x22d.google.com [IPv6:2607:f8b0:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29CD5CD4 for ; Thu, 28 Sep 2023 01:56:10 -0700 (PDT) Received: by mail-oi1-x22d.google.com with SMTP id 5614622812f47-3af5fd13004so1134833b6e.0 for ; Thu, 28 Sep 2023 01:56:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1695891369; x=1696496169; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CZNL2xap7oS9tgNofh5Q08A9m6sr7oqpmvudQ+aQQzo=; b=Pi6sg70SRjLSglgNkc5AykJsgPCuze6X1goXdzOuX1CbqC3ht2ksbmd4W2QAKL7fgD Joyw+Pml3skD+rkp0ewHnf407YrALIvSfU7ZqnT5aYdSMsxan9Dd0KxHxWbtnyD5oPCq P9UWpgFxgTpV0UwIQkPjKyGf+KxmasN8beyNg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695891369; x=1696496169; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CZNL2xap7oS9tgNofh5Q08A9m6sr7oqpmvudQ+aQQzo=; b=Oqyapj3fsF7C4VhLq7Tq2I0bvr5ATcSLwGpWtGiusacCU5wg+LuRCsuQMM0S15tG82 M37YvNwn/hJR4EMglIX+CR0tdEh280fH5+AwyZ56Xi3THdNDJPCrgXvvWzV55BeIMukz i3jLh+YZkCt+upd2xCAXEWGL5OcuIZh2qP2U8qSE9C0IgflEfOXBtf3v42Hrqt2g9x0M +OvnOmUHm7Lvchb0MgVjh6j1r1YnkSXAksTCiU3kwDCOcb9M2k2aHJ74XovkTRg5vaqC Yk2qzhmaOv0LKffqYCJvawhh3wH2sacfeIrNryGxdNfy1zgmfsaOFMhGzChQux55TiJ4 H4Pw== X-Gm-Message-State: AOJu0YxRDIByy+zfNeBOaF24/CLXio3r8+x4YL9c39WhnROGuWirgGxJ v3lq+eJazCoQQMXiovpE0QymKMniVN8yYKDF8lI= X-Google-Smtp-Source: AGHT+IHebtThJXaKtrU9g5yT/aInEDgutgbt2q6VlFhzqf+DJC7Yjfbm2/1ZK8V2h/BRrv/cAxfijQ== X-Received: by 2002:a05:6808:1b29:b0:3a4:2941:af49 with SMTP id bx41-20020a0568081b2900b003a42941af49mr787460oib.22.1695891369299; Thu, 28 Sep 2023 01:56:09 -0700 (PDT) Received: from wenstp920.tpe.corp.google.com ([2401:fa00:1:10:6747:c12a:dbfd:2cc7]) by smtp.gmail.com with ESMTPSA id y7-20020aa78047000000b006879493aca0sm1754016pfm.26.2023.09.28.01.56.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 01:56:08 -0700 (PDT) From: Chen-Yu Tsai To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , Mark Brown Cc: Chen-Yu Tsai , Lee Jones , Zhiyong Tao , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH v4 06/12] regulator: mt6358: Use mt6397-regulator.h binding header for buck mode macros Date: Thu, 28 Sep 2023 16:55:29 +0800 Message-ID: <20230928085537.3246669-7-wenst@chromium.org> X-Mailer: git-send-email 2.42.0.582.g8ccd20d70d-goog In-Reply-To: <20230928085537.3246669-1-wenst@chromium.org> References: <20230928085537.3246669-1-wenst@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The (undocumented) possible values for the buck operating modes on the MT6358 are the same as those on the MT6397, both for the device tree bindings and the actual hardware register values. Reuse the macros for the MT6397 PMIC in the MT6358 regulator driver by including the mt6397-regulator.h binding header and replacing the existing macros. This aligns it with other PMIC. Signed-off-by: Chen-Yu Tsai Reviewed-by: AngeloGioacchino Del Regno --- Changes since v3: none Changes since v2: - new patch drivers/regulator/mt6358-regulator.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/regulator/mt6358-regulator.c b/drivers/regulator/mt635= 8-regulator.c index c4ecac5f3fc8..f966eedbbd6e 100644 --- a/drivers/regulator/mt6358-regulator.c +++ b/drivers/regulator/mt6358-regulator.c @@ -13,8 +13,7 @@ #include #include =20 -#define MT6358_BUCK_MODE_AUTO 0 -#define MT6358_BUCK_MODE_FORCE_PWM 1 +#include =20 /* * MT6358 regulators' information @@ -326,7 +325,7 @@ static const struct linear_range vldo28_ranges[] =3D { =20 static unsigned int mt6358_map_mode(unsigned int mode) { - return mode =3D=3D MT6358_BUCK_MODE_AUTO ? + return mode =3D=3D MT6397_BUCK_MODE_AUTO ? REGULATOR_MODE_NORMAL : REGULATOR_MODE_FAST; } =20 @@ -371,10 +370,10 @@ static int mt6358_regulator_set_mode(struct regulator= _dev *rdev, =20 switch (mode) { case REGULATOR_MODE_FAST: - val =3D MT6358_BUCK_MODE_FORCE_PWM; + val =3D MT6397_BUCK_MODE_FORCE_PWM; break; case REGULATOR_MODE_NORMAL: - val =3D MT6358_BUCK_MODE_AUTO; + val =3D MT6397_BUCK_MODE_AUTO; break; default: return -EINVAL; @@ -402,9 +401,9 @@ static unsigned int mt6358_regulator_get_mode(struct re= gulator_dev *rdev) } =20 switch ((regval & info->modeset_mask) >> (ffs(info->modeset_mask) - 1)) { - case MT6358_BUCK_MODE_AUTO: + case MT6397_BUCK_MODE_AUTO: return REGULATOR_MODE_NORMAL; - case MT6358_BUCK_MODE_FORCE_PWM: + case MT6397_BUCK_MODE_FORCE_PWM: return REGULATOR_MODE_FAST; default: return -EINVAL; --=20 2.42.0.582.g8ccd20d70d-goog