Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3265317rdh; Thu, 28 Sep 2023 07:14:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFPC0pR473avOlGkACQ5NR41sQBytv+5qnjNj/OwkA0b1jTGWCIyXNbExWpk0bXOhZRM6u3 X-Received: by 2002:a54:4102:0:b0:3a8:f3e7:d696 with SMTP id l2-20020a544102000000b003a8f3e7d696mr1333746oic.45.1695910441683; Thu, 28 Sep 2023 07:14:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695910441; cv=none; d=google.com; s=arc-20160816; b=D6QzPh2I7V1OW+hkK+xTGMGy6Q1iv53WlBYicxReNauwH45qJkj1RHlymsEDucuxI3 tXZzOSkI2tHSLQaoIttsqi9kNb3bUAxGpiNO9VwqNhYrThHEwwSE36hdqbLNdiu/I5Kb ODwOwEaxXCCR/qgTtsoTTPi8ajMkT8Ptp/0OtO/lHQbkp+UkAwnmKGcyUAhYWyRyb3P8 bQPeYbAveDF2oZNpn8TZtpZgE5lK+suuyFhTZqWGSZ5K4LEjGW3d+qa2gomijbF7jMWd SQIfb7E6yUes9eG+kQFoat1XwqQjRTlrLS2UV/BklTRctGFMSI3SIPxGty/cz6RcF2WU DXlg== 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=CZNL2xap7oS9tgNofh5Q08A9m6sr7oqpmvudQ+aQQzo=; fh=sOQOQRvUYFm0Ujq+ly/te4e/c0tPxHc72NvhCBlxy94=; b=QMS29idfYWPabrgU8MNKkZYlZHMgw5rC59qGCb2AmZ6F0/oHJtkBydzk/qzBJEhcGL VZV3nO/Dgik0kqFy67fG5Z8XSKumJvOXyZ5bX+uvB+cWLfzF5vTFyr3L5u4IkLPgvxaL KOBhbArWIsP/VBck1jIR0PHomOsBtsH+oi6OaZwde8VhXAVu2vufzePFCJhipIsL0pBR vGXhKxOXP/Qbqg8OiSmjNgIG0NoXPYqTfCIZqYljgFzUKLtUOLoGZFCwzmi54weeZSWG bszCwc0ZLJkb4jF0HqdALN5M9Hx5Zf1cplaT51rPKnaih1Hs7mzri8o9lrFXMjI4vEtO RJWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Pi6sg70S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id j191-20020a638bc8000000b0056357813fc2si17948196pge.183.2023.09.28.07.14.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 07:14:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Pi6sg70S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 57F8180A9932; Thu, 28 Sep 2023 01:56:54 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231405AbjI1I4h (ORCPT + 99 others); Thu, 28 Sep 2023 04:56:37 -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-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: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 28 Sep 2023 01:56:54 -0700 (PDT) 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/mt6358-regulator.c index c4ecac5f3fc8..f966eedbbd6e 100644 --- a/drivers/regulator/mt6358-regulator.c +++ b/drivers/regulator/mt6358-regulator.c @@ -13,8 +13,7 @@ #include #include -#define MT6358_BUCK_MODE_AUTO 0 -#define MT6358_BUCK_MODE_FORCE_PWM 1 +#include /* * MT6358 regulators' information @@ -326,7 +325,7 @@ static const struct linear_range vldo28_ranges[] = { static unsigned int mt6358_map_mode(unsigned int mode) { - return mode == MT6358_BUCK_MODE_AUTO ? + return mode == MT6397_BUCK_MODE_AUTO ? REGULATOR_MODE_NORMAL : REGULATOR_MODE_FAST; } @@ -371,10 +370,10 @@ static int mt6358_regulator_set_mode(struct regulator_dev *rdev, switch (mode) { case REGULATOR_MODE_FAST: - val = MT6358_BUCK_MODE_FORCE_PWM; + val = MT6397_BUCK_MODE_FORCE_PWM; break; case REGULATOR_MODE_NORMAL: - val = MT6358_BUCK_MODE_AUTO; + val = MT6397_BUCK_MODE_AUTO; break; default: return -EINVAL; @@ -402,9 +401,9 @@ static unsigned int mt6358_regulator_get_mode(struct regulator_dev *rdev) } 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; -- 2.42.0.582.g8ccd20d70d-goog