Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp5111605ybe; Tue, 17 Sep 2019 02:49:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqymGEdYd+GDpIUKiwJHcH/70rF7I9xv3yOkWmDASY66hOysC7eNhr8IVQRnSOPjmUACDSOy X-Received: by 2002:aa7:d9d5:: with SMTP id v21mr2917044eds.106.1568713795085; Tue, 17 Sep 2019 02:49:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568713795; cv=none; d=google.com; s=arc-20160816; b=nTSDH7q5o4cwmGyq/zCgBbnm7Pb9Ckk5NzVFkky61l0PlJ/lcS+MCOUNkwH+z3tgjx 4+cWgsnSSwv7uYVymKxbWniETT8I/akIBNyRR4Pw9pEEQhU2KEzOetxia3OWTg0f9cvm nf4ol/let8FmF67g13ZLENE1rW9msg2GuYWl/Z8s0bv9xe+FL504Eqhz6NaNSkEyvtXq tuzMPfGAZywXURoUpOjegFi1wwkt2gsAhEslOQM5l//2sKNm242DfCtaPZfAieOWKZIA /gsJF1Kz/xYKXog16tf4RPa22lrXrpYUokLA8sX65urTIiRJW5SGbRqjxu/AWEWMzYMp Ld1A== 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=XDgo4vq+AJKvF0Dxw1ZNVjidcffoesa2h4+pfJgHmfSBrREOlJHMlwym58aUnuCL2a XMWbJ5nBDVo3jWPzWC2Ovg6ki6cW7RscieKvySjq3ALbHJivsWcdeVoYLdTubH2Fim// dwlSoXCymPBOU6GZBN/RZHZffmt9f5yD/R6fYwUKZHhjLgqTA07V7PsB0clmwr7PKf2R uEQShFDV7Nm2Jgm6IcDjvt9V7XG5KGF/d/QVYjG/GTA+5ZC+Cbh58X6zeRb/F/mEeIoB oloNUEN7EUeOxqjz5yaEFogNuocUqq/j6GfD/XZL2wF2oEQs7keHCHkYx+ITPzZHEPSO Z7Mg== 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 u23si764954ejm.26.2019.09.17.02.49.31; Tue, 17 Sep 2019 02:49:55 -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 S1733082AbfIQI01 (ORCPT + 99 others); Tue, 17 Sep 2019 04:26:27 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:43547 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1730167AbfIQI0Y (ORCPT ); Tue, 17 Sep 2019 04:26:24 -0400 X-UUID: b44295c40ec041b3903040943412d400-20190917 X-UUID: b44295c40ec041b3903040943412d400-20190917 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 1014683135; Tue, 17 Sep 2019 16:26:20 +0800 Received: from mtkcas09.mediatek.inc (172.21.101.178) by mtkmbs08n2.mediatek.inc (172.21.101.56) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 17 Sep 2019 16:26:12 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by mtkcas09.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Tue, 17 Sep 2019 16:26:12 +0800 From: Light Hsieh To: CC: , , , , Light Hsieh Subject: [PATCH v3 2/5] pinctrl: mediatek: Supporting driving setting without mapping current to register value Date: Tue, 17 Sep 2019 16:26:08 +0800 Message-ID: <1568708771-12409-2-git-send-email-light.hsieh@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1568708771-12409-1-git-send-email-light.hsieh@mediatek.com> References: <1568708771-12409-1-git-send-email-light.hsieh@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-SNTS-SMTP: 779A3EDF185CC11FEA9694DF7CB7402E231A4FF7851995598CEF307E4F51F6F42000:8 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