Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp5224218ybe; Tue, 17 Sep 2019 04:52:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqxsm26CDG+9yZ8eHsFwkGZ3JbPP+DGIa42PbYotrvEK2qXyUMgNuxeg4AeZlqD4rkWwfKgO X-Received: by 2002:a17:906:b283:: with SMTP id q3mr1560869ejz.7.1568721123391; Tue, 17 Sep 2019 04:52:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568721123; cv=none; d=google.com; s=arc-20160816; b=WxLQX7qIpWs1w0DL4Xd5SXBxAGG85VbZCLj6GMo5ARAsVO3+5l35jhlwb4HEC16PcM vRjBL1tR8IrmUiSWp2arRcFll8LCFqpexvR9TuNRqXj9F4PYCNOXsM9OWAjFi7Y1335Q UUG77iAHTKpXpZO4TkJTpKc1+wBDf7aV3t13/xQsh8BfHwxWlXnII1SWZu5abimGYR2V LmfMIL38Qzo0mXf7KncGzuywqzs4/bCOr/L6KTr9d7WO7/Xl+Ehi/m1Ar0ITJY3fUgTe eyE4+VL7VkBtjhAZm3maBis888C7+irsYFpVzpZi9jgcV0U5UQnjoWhKCEQqxId0eDBD Urng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=38lEe5g7H9RxWfU5mZPe3iTulw6o9q5pYarVzroFTNo=; b=R3Gji5aO4REr07rQVvpuvf8zM3vYJcBVhmxV70aijGyhXXoh9aLOyk/vuZwGR/Z2zc pG02ENg6jFyYC6mp62lOQbotfitiTOsuxwLLrd008jboN/tZTZeq4IEsFpUK2CjHE/9G XDrAOcK3u6eMa0uvaOYoatE7MRTByOpb7r1BFPMcOXPD3NdY4JDsInxFje7u5JmtUl+r v+lyDfMIugzrRwFhem0lTkUHArlxMPu0wPwqw/CbUAaQiOG6GFsXWWjkBP0rwnfcDqST vt/aN3A3z8Xcq4R/16ccMESSxtzoMJ+XmPcigpqpctuFVQfNeLB34cUrLUhziwO7Oh/a uhew== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g21si1140318edg.339.2019.09.17.04.51.39; Tue, 17 Sep 2019 04:52:03 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727323AbfIQLrn (ORCPT + 99 others); Tue, 17 Sep 2019 07:47:43 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:29391 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726820AbfIQLrk (ORCPT ); Tue, 17 Sep 2019 07:47:40 -0400 X-UUID: 9f1d4879e7414e8bb55a9f8979c2bb43-20190917 X-UUID: 9f1d4879e7414e8bb55a9f8979c2bb43-20190917 Received: from mtkcas09.mediatek.inc [(172.21.101.178)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 768415715; Tue, 17 Sep 2019 19:47:28 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 17 Sep 2019 19:47:26 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Tue, 17 Sep 2019 19:47:26 +0800 From: Light Hsieh To: CC: , , , , Light Hsieh Subject: [PATCH v4 2/5] pinctrl: mediatek: Supporting driving setting without mapping current to register value Date: Tue, 17 Sep 2019 19:47:22 +0800 Message-ID: <1568720845-20254-2-git-send-email-light.hsieh@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1568720845-20254-1-git-send-email-light.hsieh@mediatek.com> References: <1568720845-20254-1-git-send-email-light.hsieh@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Mediatek's smarphone 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 pratical for Mediatek's smartphone usage. --- drivers/pinctrl/mediatek/pinctrl-mt6765.c | 4 ++-- drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c | 21 +++++++++++++++++++++ drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h | 5 +++++ drivers/pinctrl/mediatek/pinctrl-paris.c | 1 + 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/mediatek/pinctrl-mt6765.c b/drivers/pinctrl/mediatek/pinctrl-mt6765.c index 32451e8..e024ebc 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_direct_val, + .drive_get = mtk_pinconf_drive_get_direct_val, .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 4687f63..23a9529 100644 --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c @@ -607,6 +607,27 @@ int mtk_pinconf_drive_get_rev1(struct mtk_pinctrl *hw, return 0; } +/* Revision direct value */ +int mtk_pinconf_drive_set_direct_val(struct mtk_pinctrl *hw, + const struct mtk_pin_desc *desc, u32 arg) +{ + int err; + + err = mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_DRV, arg); + + return err; +} + +int mtk_pinconf_drive_get_direct_val(struct mtk_pinctrl *hw, + const struct mtk_pin_desc *desc, int *val) +{ + int err; + + err = mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_DRV, val); + + return err; +} + 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..b3bada0 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_direct_val(struct mtk_pinctrl *hw, + const struct mtk_pin_desc *desc, u32 arg); +int mtk_pinconf_drive_get_direct_val(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); diff --git a/drivers/pinctrl/mediatek/pinctrl-paris.c b/drivers/pinctrl/mediatek/pinctrl-paris.c index 28b4951..71c94b2 100644 --- a/drivers/pinctrl/mediatek/pinctrl-paris.c +++ b/drivers/pinctrl/mediatek/pinctrl-paris.c @@ -964,3 +964,4 @@ static int mtk_paris_pinctrl_resume(struct device *device) .suspend_noirq = mtk_paris_pinctrl_suspend, .resume_noirq = mtk_paris_pinctrl_resume, }; + -- 1.8.1.1.dirty