Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp6209164ybe; Tue, 17 Sep 2019 22:58:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqzs2DLx9mZxIeSopYXEUWNlk81ShxGv22Yily/L/CDB5mrKkHSQ3+uBduqLQhJFlRHwbuiz X-Received: by 2002:aa7:d698:: with SMTP id d24mr8602025edr.32.1568786299083; Tue, 17 Sep 2019 22:58:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568786299; cv=none; d=google.com; s=arc-20160816; b=QogZgpohjmy+OSnMMmjIcVDof0oX6+NQ2oYcATPhO8KYkOSBJJVkpsChYuNZEFtTM4 qj3H0nug6lR2gHZFqsxbts82QZbW0h2NgknlwtkAuZSnIbaOE04ZNCeK4ppTH3rmiUzX +0/qBIzNHcHyv9PQaA9cqxotO4eyVTwYUnUDU//z8KuFSXYNUvGhERUXKBcxdnD8LTc8 MFxhodDupjYuzGOphqYVgvtc6BrWZ3Q3Xa5FSZZr7efY1Y76+/ut/4K/IyAAPC/8jDWG 6YD2pGaCAKJSNp2Be4FBTIiar5VF10memWobDGR+N10qF/pO/kZ+O1Tafq2mxK88Kl3e Sjhw== 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=DJB7cE7xCkdS7bna9MExTnneDvFufyKyJ6gUsK9YFEuVv1hyaDsJGXaLmP1GKRT5MQ kNr6VytNdOLQcccPEwh0kw1Ez7rl90mGw7IsxVZ5wfkuZbIEJCQ1sYHsRU2e1BySZspj TMWyL9TEymFdk4FvBF7y7R4D0yvp+BrivhGr2mtPMpZakndGWDSaVsax0ZOX2umZZ5zf Drcfz8FsRDe2+e6YW8s2CTYgWCRTUDNS1WydR73xpo6O01AYjf9URDshOhvbWKCU7UJo Rrb+3gpcXiiGeVL8F7vhn32dSWqpJ8DfhAR30ymhfuudFuA0Kmj1P4I15XE3AnwXp/e/ O/8Q== 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 p39si2578644eda.416.2019.09.17.22.57.55; Tue, 17 Sep 2019 22:58:19 -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 S1727443AbfIRCjR (ORCPT + 99 others); Tue, 17 Sep 2019 22:39:17 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:43113 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727264AbfIRCjR (ORCPT ); Tue, 17 Sep 2019 22:39:17 -0400 X-UUID: 85dc673ca7c147bd80e7adf6878c3347-20190918 X-UUID: 85dc673ca7c147bd80e7adf6878c3347-20190918 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 498736375; Wed, 18 Sep 2019 10:39:11 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 18 Sep 2019 10:39:07 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Wed, 18 Sep 2019 10:39:07 +0800 From: Light Hsieh To: CC: , , , , Light Hsieh Subject: [PATCH v5 2/5] pinctrl: mediatek: Supporting driving setting without mapping current to register value Date: Wed, 18 Sep 2019 10:39:05 +0800 Message-ID: <1568774348-24363-2-git-send-email-light.hsieh@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1568774348-24363-1-git-send-email-light.hsieh@mediatek.com> References: <1568774348-24363-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