Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5175369ybl; Wed, 22 Jan 2020 11:43:04 -0800 (PST) X-Google-Smtp-Source: APXvYqyEMQPSFPZpJEHUxPlaPAZLtl91xQ4S6+9pM/9E30q32Mq91Z9YpUPqFfnMm+4670OVlX/Z X-Received: by 2002:aca:d484:: with SMTP id l126mr7727854oig.114.1579722184830; Wed, 22 Jan 2020 11:43:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579722184; cv=none; d=google.com; s=arc-20160816; b=TtsJdiRbFwetrQxAGtqKG1SopyKmEXSJEnJXEf9rgHx0gwkCjfkB3vYWY3WEipPZVa f38Y92+VjUNGARkObkfRRs0zhwU51TgqxKVXoklYPF/15MYNPp1ErEsQ1fYVZP/VplpO jhWpNFw5vVsasAvXGL/RjkCsP7f6NZN+NQRHzU3k9mOoyfd45Jc67o5quJowbSi7iTnR xxfXKhm6h4Od2kN56sTjdXGfFHFbQmEoku3nISHhwh6WMjMyFA2hNKK3a6lw2+WJbhog XP3Dss2kOhJfymEFW4pRX3bmhGgB5yAAA5xopMYbGdKoy5Y5/4yvwvnOv3B/zL1oCqb4 TbvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=jOe+E8dVipF8OqntrdTnYl3vBo/Azp+zmHmwcF0RMOc=; b=XpxDMy2wKfDiIsTjpETc2K8oOcLRQmY+x4Tk3Ym1DTbDr0COF5oU/6sHnx6zETJPTU 97NkRfMsPaSuVt7bR34Ko/CAhQPiGIGTIRaerOqg49nsHM8LpnMWTdQgSpLzIqFVihCC 2vCs2odtKDu7YG+zuIscR2yXkAKoJeFeYSJcvpYzPk5BoITgnc2r3htaGu38EavSv8sx xRUZPUQKdqeQUA609/iznd580qKTsH9ymRDITDOOyPOKy8pICEYFsPLjCHt/eLkhDXeV 2eKbfvlrXz0MOqrK+YKFiuiKIWwRTB+V/aAEfMsx/jt32MqK9MWTyPnvmzEwCvUOFBy5 xHNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LsNumBbK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t1si21359536oic.140.2020.01.22.11.42.53; Wed, 22 Jan 2020 11:43:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LsNumBbK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726103AbgAVTlt (ORCPT + 99 others); Wed, 22 Jan 2020 14:41:49 -0500 Received: from mail.kernel.org ([198.145.29.99]:38330 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725827AbgAVTlt (ORCPT ); Wed, 22 Jan 2020 14:41:49 -0500 Received: from mail-io1-f48.google.com (mail-io1-f48.google.com [209.85.166.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 55FB62465A; Wed, 22 Jan 2020 19:41:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579722108; bh=e9Bx3cpa8c9tVIw9Lu1g7sNSWpGserqqeFYjYE4gSC4=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=LsNumBbK5m2fDieVpvj7b802xW7FYj1pkAa9ZrlPM7q4sKL2fQ9gMM5cSRkTpidum +okRbEgag0ntj4pH65vHTRkxQcpOWwo75vW/Ak1MLSTOIb440SwQklIc4JeGGypopq 0tFTdhKTMBOFdkzc7S4WOeFYjERxBVMUJdmyVfis= Received: by mail-io1-f48.google.com with SMTP id t26so427748ioi.13; Wed, 22 Jan 2020 11:41:48 -0800 (PST) X-Gm-Message-State: APjAAAUPModunUzKPmQCU/qSe2v+dJP4tgHtRi8G+zG1xwAe3VUeYkH2 w+sgC9XKYai03ayMNnm4aNxWnEPa1Tzn2wWOvqo= X-Received: by 2002:a5d:9d11:: with SMTP id j17mr988679ioj.83.1579722107745; Wed, 22 Jan 2020 11:41:47 -0800 (PST) MIME-Version: 1.0 References: <1579675994-7001-1-git-send-email-light.hsieh@mediatek.com> <1579675994-7001-2-git-send-email-light.hsieh@mediatek.com> In-Reply-To: <1579675994-7001-2-git-send-email-light.hsieh@mediatek.com> From: Sean Wang Date: Wed, 22 Jan 2020 11:41:37 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v8 2/6] pinctrl: mediatek: Supporting driving setting without mapping current to register value To: Light Hsieh Cc: Linus Walleij , "moderated list:ARM/Mediatek SoC support" , "open list:GPIO SUBSYSTEM" , lkml , kuohong.wang@mediatek.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 21, 2020 at 10:53 PM wrote: > > From: Light Hsieh > > MediaTek's smartphone project actual usage does need to know current value > (in mA) in procedure of finding the best driving setting. > The steps in the procedure is like as follow: > > 1. set driving setting field in setting register as 0, measure waveform, > perform test, and etc. > 2. set driving setting field in setting register as 1, measure waveform, > perform test, and etc. > ... > n. set driving setting field in setting register as n-1, measure > waveform, perform test, and etc. > Check the results of steps 1~n and adopt the setting that get best result. > > This procedure does need to know the mapping between current to register > value. > Therefore, setting driving without mapping current is more practical for > MediaTek's smartphone usage. > > Signed-off-by: Light Hsieh Acked-by: Sean Wang > --- > drivers/pinctrl/mediatek/pinctrl-mt6765.c | 4 ++-- > drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c | 12 ++++++++++++ > drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h | 5 +++++ > 3 files changed, 19 insertions(+), 2 deletions(-) > > diff --git a/drivers/pinctrl/mediatek/pinctrl-mt6765.c b/drivers/pinctrl/mediatek/pinctrl-mt6765.c > index 32451e8..1212264 100644 > --- a/drivers/pinctrl/mediatek/pinctrl-mt6765.c > +++ b/drivers/pinctrl/mediatek/pinctrl-mt6765.c > @@ -1077,8 +1077,8 @@ > .bias_disable_get = mtk_pinconf_bias_disable_get, > .bias_set = mtk_pinconf_bias_set, > .bias_get = mtk_pinconf_bias_get, > - .drive_set = mtk_pinconf_drive_set_rev1, > - .drive_get = mtk_pinconf_drive_get_rev1, > + .drive_set = mtk_pinconf_drive_set_raw, > + .drive_get = mtk_pinconf_drive_get_raw, > .adv_pull_get = mtk_pinconf_adv_pull_get, > .adv_pull_set = mtk_pinconf_adv_pull_set, > }; > diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c > index d63e05e..2247eae 100644 > --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c > +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c > @@ -608,6 +608,18 @@ int mtk_pinconf_drive_get_rev1(struct mtk_pinctrl *hw, > return 0; > } > > +int mtk_pinconf_drive_set_raw(struct mtk_pinctrl *hw, > + const struct mtk_pin_desc *desc, u32 arg) > +{ > + return mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_DRV, arg); > +} > + > +int mtk_pinconf_drive_get_raw(struct mtk_pinctrl *hw, > + const struct mtk_pin_desc *desc, int *val) > +{ > + return mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_DRV, val); > +} > + > int mtk_pinconf_adv_pull_set(struct mtk_pinctrl *hw, > const struct mtk_pin_desc *desc, bool pullup, > u32 arg) > diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h > index 1b7da42..75d0e07 100644 > --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h > +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h > @@ -288,6 +288,11 @@ int mtk_pinconf_drive_set_rev1(struct mtk_pinctrl *hw, > int mtk_pinconf_drive_get_rev1(struct mtk_pinctrl *hw, > const struct mtk_pin_desc *desc, int *val); > > +int mtk_pinconf_drive_set_raw(struct mtk_pinctrl *hw, > + const struct mtk_pin_desc *desc, u32 arg); > +int mtk_pinconf_drive_get_raw(struct mtk_pinctrl *hw, > + const struct mtk_pin_desc *desc, int *val); > + > int mtk_pinconf_adv_pull_set(struct mtk_pinctrl *hw, > const struct mtk_pin_desc *desc, bool pullup, > u32 arg); > -- > 1.8.1.1.dirty