Received: by 2002:a05:6520:2586:b029:fa:41f3:c225 with SMTP id u6csp4268321lky; Tue, 15 Jun 2021 18:22:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzBNofEBcAwkF4emG4xLEvbQMm0F2xwO0D8AZ52MbhPCl8ke9q1lf3wAJIZNNUZLovsGMd X-Received: by 2002:a17:906:b2d6:: with SMTP id cf22mr2415169ejb.29.1623806548366; Tue, 15 Jun 2021 18:22:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623806548; cv=none; d=google.com; s=arc-20160816; b=htPnExPvrwSlGfy2k3Kmk7DUL+gFiR5KUaDgjUBqsggCG10NTamzdbKcNVrh41ORbL emSSaBsolpaoAzZxM380AZ15Y7EJB9ky2u6dGuzsv07yhbEAT5HcdQIyM4dmMTPlHRdZ KSVH4UCsG5TwCA7A/rWY8Ew6OqDIkILDy/Bb6mHnotG39sHo+K7TrYrMDPKcS6cgv35Y 0B2PpxfXoDCzcjGDgY4Oe6oKd+xWSkSGOpvdox0T5oxUGVjuz7oJAHb1/j3dVclfWgtq WsDd3NP7XsJzpdykjP4qwPfLDZYdwruVEsLiXf5/fbqZcgwezLecslvvZGEfacjPYRvl vOYw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=TuDt1IbwqeVQA3BgOf64FsOM5Cx3ZLaB6istYzeB6+c=; b=ZVXpEaRC7PdkU0UcA+5QuGuXzaDGwK96f91pZxj4+n5ddNSw+BrHbnR8jQ8OCbt0D9 PAFhe+P5uzs4rvmDX+fA53xpUB42HEBV3GCZTTT7XNBlkwDS5dWBtfGlO+dc180UNgv0 m9fA1PfLw/2QEggNoKyVL65OAPx73G+w3yMZjPG0HeLlNvC35z93CugJCQ53XN/R0nu1 2ZLxOPKggxKz7PVOlMrsNzG8SMqsshq9A5sk91H/MNPbSubyR5FBlPVQFgRntHYhI673 xygj62AR0FNPt8L1DtITegp6283zUwotqDGWEJzH7WZLpvxQtGqDluzqCOuvE+wuJNFC gepw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ingics-com.20150623.gappssmtp.com header.s=20150623 header.b=WU58kTku; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l14si513967eda.320.2021.06.15.18.22.05; Tue, 15 Jun 2021 18:22:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ingics-com.20150623.gappssmtp.com header.s=20150623 header.b=WU58kTku; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231360AbhFPBUk (ORCPT + 99 others); Tue, 15 Jun 2021 21:20:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230371AbhFPBUj (ORCPT ); Tue, 15 Jun 2021 21:20:39 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 687BCC061574 for ; Tue, 15 Jun 2021 18:18:33 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id u18so292822plc.0 for ; Tue, 15 Jun 2021 18:18:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ingics-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=TuDt1IbwqeVQA3BgOf64FsOM5Cx3ZLaB6istYzeB6+c=; b=WU58kTkuDyalCiOMwX5OQ3GRBQ6y/Zr8OHzfWNQC8YgWmOJOwctkxfq1Dc8kdSV9kX uNfjgSvcq0nXv/VFxXiIONVckwrF20PDXNaAEzpuXuV9WQms/6qN55mfqrpMUanpNIJP A7q+OsdyjjY8eEWWETYnVA9pIZIVmdq2PPUvmU04z9u6b7XxeJTHpV255cNPGgmQJYSQ qVl73/JbPWMpSNmBfj6PdZ0q2RUeIunJAoC+SCTq4M9ppbSZiI314SlqoYMB0/9CceVS 93GLlgkXwtLNqH4OSsl/mHVsdDiZuNx345H06wu2ymRXRtLkStIwN9C+DDYK0kVgZrPM /ODQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=TuDt1IbwqeVQA3BgOf64FsOM5Cx3ZLaB6istYzeB6+c=; b=BselcM20JH37QufxQdB/bhLG/ntBo1pSPSn/KEjFw4wyuISJakogPLIuyUIdwUg0qv zENOrlJThDze8mEiliIyb0nqR0AU+FY6A+nyxQ6II4gyszQoch8pki2vCuZJgBxH/HV5 LTZUQWiqa07qddO7Q/ufJomgUOfCG4n/KnaefJzfDlY3sguWpDBhQfkO2N74iEPNMgw5 Nl513I/tahoGV6CaLorJIwpUCvvcYmtA1S4FsEfjA1wCDpy1B3hCRxZS9/xkwtsSgstc ojKsC9h7wKxg6JvEe0TE2DvPebZ9U9CHuPxyk68b8zfy1xSOJC4pqoqPyStjfwLcRj4g pkQg== X-Gm-Message-State: AOAM533fXcSCqGzBMvBI0ZC8AkJAArBNzrFXJkkunQ9piipkXdMktlc0 0aLe9f0vcSR/+BYLMO0uGZIZrnjrg0AfxUI+ X-Received: by 2002:a17:90a:b64:: with SMTP id 91mr2114474pjq.24.1623806312884; Tue, 15 Jun 2021 18:18:32 -0700 (PDT) Received: from localhost.localdomain (122-117-179-2.HINET-IP.hinet.net. [122.117.179.2]) by smtp.gmail.com with ESMTPSA id t1sm302420pfe.61.2021.06.15.18.18.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 18:18:32 -0700 (PDT) From: Axel Lin To: Mark Brown Cc: ChiYuan Huang , Liam Girdwood , linux-kernel@vger.kernel.org, Axel Lin Subject: [PATCH] regulator: rt6160: Fix setting suspend voltage Date: Wed, 16 Jun 2021 09:18:16 +0800 Message-Id: <20210616011816.3479406-1-axel.lin@ingics.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The vsel active level is for the normal voltage, the opposite level is the suspend voltage. Signed-off-by: Axel Lin --- Hi ChiYuan, I think fix it this way make the intention more clear. drivers/regulator/rt6160-regulator.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/regulator/rt6160-regulator.c b/drivers/regulator/rt6160-regulator.c index ccd023da4318..5d7b0e7ad69a 100644 --- a/drivers/regulator/rt6160-regulator.c +++ b/drivers/regulator/rt6160-regulator.c @@ -128,13 +128,19 @@ static unsigned int rt6160_get_mode(struct regulator_dev *rdev) static int rt6160_set_suspend_voltage(struct regulator_dev *rdev, int uV) { struct regmap *regmap = rdev_get_regmap(rdev); + unsigned int suspend_vsel_reg; int vsel; vsel = regulator_map_voltage_linear(rdev, uV, uV); if (vsel < 0) return vsel; - return regmap_update_bits(regmap, rdev->desc->vsel_reg, + if (rdev->desc->vsel_reg == RT6160_REG_VSELL) + suspend_vsel_reg = RT6160_REG_VSELH; + else + suspend_vsel_reg = RT6160_REG_VSELL; + + return regmap_update_bits(regmap, suspend_vsel_reg, RT6160_VSEL_MASK, vsel); } -- 2.25.1