Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp703168rdb; Tue, 19 Sep 2023 07:53:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHAVkD8kxCX5Mjv9XVgQBCbi58v0AHYdR2h6JPwjU94259CgZfF/6eyMXeeR3dx7CoOw12C X-Received: by 2002:a05:6a00:80ec:b0:690:ca4e:661e with SMTP id ei44-20020a056a0080ec00b00690ca4e661emr1163032pfb.19.1695135210261; Tue, 19 Sep 2023 07:53:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695135210; cv=none; d=google.com; s=arc-20160816; b=nAaYQpevL6zn7iNhBUKCu3QEKHdhbQUdIyDXEHvpCB+mbnxXVcsjeyiWq4YfgJos5E YUkd51TnCAIiRBbgYWqxJWZ2Fdu0oL9SDHpT3qDIWvNV7SISkebGXq8fIlRQJssXk4D7 XnJAfUbuXdZ/yyFnHPufRGoV6E5LHqnBCc3Fi4R1cTANvjRR286tvEp4tkomFLIN6g0U YfD8jAONpi2C9jEEacQPpBQKQDG0+mk9CpMeKk3uNkut2+HuCbq9V9FHlxve+NgslGAC SRNXhf397rczdFLhMf/TZU5zUyVCB5rj4Esy6m6PpA3t18H4VS5qi71s+QWSpg0f7oCw EiBw== 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=3xQUn/IJIaVFS0x99xumnipF7RzW+wF0bxWwjg0oCIk=; fh=V9OHkENDB80hqt4mznI/iuUuuKxIjmAW9KtwlmjCzec=; b=IcCDsRblyLvlIo8I8bLxVAUNEtVcQFphukSxb1BDmkbE2HO1tJSzre4iVuJEH1Xp26 ixrveeyA1DZweK21mcSADDcGscmJxIXtHSxil6tE0ias9oSbibDUi9KAr+9PaP47+C8Y 9+FgRaa9qtXq1Xu8zjnPlw+ir7gTn/+3zpmNChP67vjGn3CCYmk0uVj2ti1YQ1XtgPVK b1xnbm9yS5BdoKyEG/rZnc/OaQ6kQ8gvNx6MEabOOaFmwpFnEr12fc7SM9sozNFzjHGk /8ly2V8yic/CACHVQxgNHP1T8KaiGUgBwzDpnU/kg+Xsz2NxqNeZv2KoCxpll8lNrmZD WDag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=HPZ3QuhO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id cp21-20020a056a00349500b0068895dea43csi9521899pfb.78.2023.09.19.07.53.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 07:53:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=HPZ3QuhO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id 0AB62825A0E7; Tue, 19 Sep 2023 03:48:12 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231989AbjISKsE (ORCPT + 99 others); Tue, 19 Sep 2023 06:48:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231937AbjISKry (ORCPT ); Tue, 19 Sep 2023 06:47:54 -0400 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B44E188 for ; Tue, 19 Sep 2023 03:47:40 -0700 (PDT) Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1c453379020so21264905ad.1 for ; Tue, 19 Sep 2023 03:47:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1695120459; x=1695725259; 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=3xQUn/IJIaVFS0x99xumnipF7RzW+wF0bxWwjg0oCIk=; b=HPZ3QuhOK8hf4Vk5Qx7kdD+K5prsC9/0Y2aVrjzjVsxNFbu9joD2Ou0lZqDqAnavy0 YOQSbKM6L+WLCiA0/hlxq+inTIT7aBwsJnit2V+GLmppHUnVHIScGsa9RUTefOL21fwW Zl/BDv+eI6zSzpRl6xHhaghkdECFJWScLhtTU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695120459; x=1695725259; 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=3xQUn/IJIaVFS0x99xumnipF7RzW+wF0bxWwjg0oCIk=; b=EniMLJnNWCHvotwAWyjAmFJzR3/KCirRnelcfEshpO9LLpA0HeZBx1yWn1XzN3HnXf FUWjyebZLN+Khq15HpttingPbXWHmvidMwu2zS291PhNJHFxINB3yEI42K4NL1zuWV3Q NyfmDdUxflj7HzwtSIzVl+FG+eFgiF6ijbRmTat3w902IklhGkAimh4sSAS0h/HPqjLQ T+T7a+L/H/Nw8PcuDmfSQkuAAvrIIcYicP6z2aazX46dbe1YAOPOtpzveTkC8B0psOhK yvOtFuK+xxB4hwhgswuNvnMfQcWiZndFuPElVfmMBzdGSCvd1VJod71xh3hQSTIVc/r5 tLqw== X-Gm-Message-State: AOJu0Yx5UxC1LwemPixC/9gVd/WWMrJJPVF68LOB3uuykmMZMqM1OQSB zlLi+FY6RGvPqbWHJLvhRPpajQ== X-Received: by 2002:a17:903:1cd:b0:1bf:650b:14fb with SMTP id e13-20020a17090301cd00b001bf650b14fbmr11811076plh.42.1695120459673; Tue, 19 Sep 2023 03:47:39 -0700 (PDT) Received: from wenstp920.tpe.corp.google.com ([2401:fa00:1:10:40a:900d:e731:5a43]) by smtp.gmail.com with ESMTPSA id c10-20020a170902d48a00b001bc445e249asm6719578plg.124.2023.09.19.03.47.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 03:47:39 -0700 (PDT) From: Chen-Yu Tsai To: Lee Jones , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , Mark Brown Cc: Chen-Yu Tsai , Zhiyong Tao , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH v3 06/12] regulator: mt6358: Use mt6397-regulator.h binding header for buck mode macros Date: Tue, 19 Sep 2023 18:43:49 +0800 Message-ID: <20230919104357.3971512-7-wenst@chromium.org> X-Mailer: git-send-email 2.42.0.459.ge4e396fd5e-goog In-Reply-To: <20230919104357.3971512-1-wenst@chromium.org> References: <20230919104357.3971512-1-wenst@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,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 lipwig.vger.email 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 (lipwig.vger.email [0.0.0.0]); Tue, 19 Sep 2023 03:48:12 -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 --- 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 4a6ad0ccf03b..c312e79a0a39 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; } @@ -374,10 +373,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; @@ -408,9 +407,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.459.ge4e396fd5e-goog