Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1231693pxb; Fri, 21 Jan 2022 12:55:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJz1Xg054Ps8Ci0irn9WqYFx4H2VqUAYB8vTrufgwlzKIkvBSsMWWSOeVZki4tvbu5W7NtLq X-Received: by 2002:a17:90a:f2ce:: with SMTP id gt14mr2433090pjb.160.1642798511246; Fri, 21 Jan 2022 12:55:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642798511; cv=none; d=google.com; s=arc-20160816; b=qfkSMGiMdgkCtEMQr9e04Nno6BKWdonkc58cGMGE7E4BAWTJmUlCe251Cw+x9HqaRO /gpMR4R/5wVRUQYZRhmtON3VJQ+g3a31s2VAh/giqngERddU70V+ZCzX5VFJeysPtFTG 7Jjcye8Q/QpbmeGzg5I0+q9lK4pphSY6iuEcBgiaMsob5mPXeCW2HMcT51qKYcEgzJJy a6ecV8D0a3h/x+QHBWB+C8aqcnC9mGMLVwC+1uCce5ZxG1TAJrPiw1jDtNRf77P/JFOS 90q9hGBGa+u4uWcSODxKosg15wa3FcLlirDlfMmUTjRZZL3Vt2KFUTMDskuphtAj41OO vMYg== 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:date:cc:to:from:subject:message-id; bh=CMga/J8qV2rlCReoZnyuTEyAk0pXzoK1+C9JYICrAt8=; b=FnOTqN7sm/r6kPXsT1Bz+6iYeoVSHZmvlKDtcR1MfKOhAphkv9RPFrpdGEnjAP3xGO NwOAlVSvfgcnvarPo8MUE3wH4l8lukn/PTLqV7RBocijvh5oO9E6+nFve3F2CuzDsroE A89o0Sj/UehXQe4VgdbLrFiOYypvUJkaFFVKnwNH9pfxRMHIVJD0ngaoh86NbscKyXTQ dgto+VvyDUt4s6v5XO6Wtyvd8R46N+re4hx83w9h3XDo3IY6NdHX/bP8oPp0KSVMe2+P 1DNI5cRUwlWQf9WTuRps8TyBqAbwo8y5+IPSfyEfVGdukZcZonm6L4NoPz8LA4nSlK5e k7iA== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ng18si7614872pjb.173.2022.01.21.12.54.59; Fri, 21 Jan 2022 12:55:11 -0800 (PST) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358092AbiATBrI (ORCPT + 99 others); Wed, 19 Jan 2022 20:47:08 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:34354 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1358052AbiATBrH (ORCPT ); Wed, 19 Jan 2022 20:47:07 -0500 X-UUID: 242f6a14f1454019a8b2e2b6c9b59e30-20220120 X-UUID: 242f6a14f1454019a8b2e2b6c9b59e30-20220120 Received: from mtkexhb02.mediatek.inc [(172.21.101.103)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1829855336; Thu, 20 Jan 2022 09:47:02 +0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.792.3; Thu, 20 Jan 2022 09:47:01 +0800 Received: from mhfsdcap04 (10.17.3.154) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 20 Jan 2022 09:47:00 +0800 Message-ID: <883391d5642d217e79fb09bebd81f9b5027ce20a.camel@mediatek.com> Subject: Re: [PATCH 2/7] pinctrl: mediatek: paris: Fix PIN_CONFIG_BIAS_DISABLE readback From: Guodong Liu To: Chen-Yu Tsai CC: Sean Wang , Linus Walleij , Matthias Brugger , , , , , Zhiyong Tao , Hui Liu , Light Hsieh Date: Thu, 20 Jan 2022 09:47:00 +0800 In-Reply-To: References: <20220111112244.1483783-1-wenst@chromium.org> <20220111112244.1483783-3-wenst@chromium.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org -----Original Message----- From: Chen-Yu Tsai To: Guodong Liu Cc: Sean Wang , Linus Walleij < linus.walleij@linaro.org>, Matthias Brugger , linux-mediatek@lists.infradead.org, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Zhiyong Tao , Hui Liu , Light Hsieh Subject: Re: [PATCH 2/7] pinctrl: mediatek: paris: Fix PIN_CONFIG_BIAS_DISABLE readback Date: Wed, 19 Jan 2022 13:57:18 +0800 On Wed, Jan 19, 2022 at 9:42 AM Guodong Liu wrote: > > -----Original Message----- > From: Chen-Yu Tsai > To: Sean Wang , Linus Walleij < > linus.walleij@linaro.org>, Matthias Brugger > Cc: Chen-Yu Tsai , > linux-mediatek@lists.infradead.org, linux-gpio@vger.kernel.org, > linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, > Zhiyong Tao , Guodong Liu < > guodong.liu@mediatek.com> > Subject: [PATCH 2/7] pinctrl: mediatek: paris: Fix > PIN_CONFIG_BIAS_DISABLE readback > Date: Tue, 11 Jan 2022 19:22:39 +0800 > > When reading back pin bias settings, if the pin is not in a > bias-disabled state, the function should return -EINVAL. > > Fix this in the mediatek-paris pinctrl library so that the read back > state is not littered with bogus a "input bias disabled" combined > with > "pull up" or "pull down" states. > > Fixes: 805250982bb5 ("pinctrl: mediatek: add pinctrl-paris that > implements the vendor dt-bindings") > Signed-off-by: Chen-Yu Tsai > --- > drivers/pinctrl/mediatek/pinctrl-paris.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/pinctrl/mediatek/pinctrl-paris.c > b/drivers/pinctrl/mediatek/pinctrl-paris.c > index f9f9110f2107..1ca598ea7ba7 100644 > --- a/drivers/pinctrl/mediatek/pinctrl-paris.c > +++ b/drivers/pinctrl/mediatek/pinctrl-paris.c > @@ -97,8 +97,8 @@ static int mtk_pinconf_get(struct pinctrl_dev > *pctldev, > if (err) > goto out; > if (param == PIN_CONFIG_BIAS_DISABLE) { > - if (ret == MTK_PUPD_SET_R1R0_00) > - ret = MTK_DISABLE; > + if (ret != MTK_PUPD_SET_R1R0_00) > + err = -EINVAL; > Hi Chen-Yu > > When the API "hw->soc->bias_get_combo(hw, desc, &pullup, &ret)" is > called, > The ret vaule of ret may be MTK_DISABLE or MTK_PUPD_SET_R1R0_00 > or (pullen > == 0), All those cases are expected to be as "bias-disable". > We advices to keep original code, > + if (ret == MTK_PUPD_SET_R1R0_00) > + ret = MTK_DISABLE; > + if (ret != MTK_DISABLE) > + err = -EINVAL; IIUC you are suggesting to assign MTK_DISABLE to ret in the other two cases, and then check if ret == MTK_DISABLE. Thanks for pointing that out. ChenYu > Thanks Hi Chen-Yu Yes, just for pins with config of MTK_PUPD_SET_R1R0_00 are required to do additional assignment operations(ret = MTK_DISABLE;), in the other two cases, the assignment operations of ret as MTK_DISABLE is obtained by function call "hw->soc->bias_get_combo(hw, desc, &pullup, &ret)". Thanks > } else if (param == PIN_CONFIG_BIAS_PULL_UP) > { > /* When desire to get pull-up value, > return > * error if current setting is pull- > down >