Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp373306imm; Thu, 21 Jun 2018 20:52:01 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI5PgwFMlPb8gnSgAvgfuhDqQhJtmJ2CEsw/hulJGsY01v3cm0hi4p6L0vKrcPZWO2mAF+C X-Received: by 2002:a62:8a0a:: with SMTP id y10-v6mr30240918pfd.237.1529639521445; Thu, 21 Jun 2018 20:52:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529639521; cv=none; d=google.com; s=arc-20160816; b=XQkDDXhG9toYKEuVllk5A1blYvqZtIL0HhtHQ9iStAmPDNX1mGx69UnX3KE4AMLnHC U6KuQnleQst2+Kxsj/5Zr2w4Nn6TpV7eCaCX7Ij7vJ7R08fDWiZpWbnsDZG4L+q1Nzuj FlMn03yzij+ZdkldYz3njFq7OncAfj+2tbmiiKhO1PvFjVRFOJR7fAC4x58FtQGjaDEd RjuK1UjlauCEC1d8kNDM1Av5xT+aSRfrvKergNGFPrmZAaDc6rIhKrWD4N313694H/kf AfUAJhooMhJkMs7Dgdj0rqf+Gm4yDWtTTxw1pI1WFK9CYFFmcLPXb5RonX2bqZsRTX4o qjIQ== 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:arc-authentication-results; bh=51bKfa34iQiXVZH/Yk/r+EcZ0HPRZhjlWr9z5QkwJYA=; b=Ks+zKyeVHlGMSePO6wxGGJqziEIotCwkMDhqd2haBw8iMUDWdKX4nMeKq91+R22gqU tNR8EGh/91Uj6/sj/qGgyo6mw+DNVrljbikqkq/lCNn4RRL/MU2+y7MTsj39mjqYle81 Nznf9T61BaOm3+Mx+5dW1qVrNPGhWuQ9hwlAErExQXu2fsVUBdYxYYHTeEwpm5vcE1es 74QqLJCAfIU8WKpMuu2o2S53z5yyO0Dsx5sSjDd2/xDtIuwCKUjqx5SGAucIdDjc0thh V6Q3frvf0jkPvf4iB3RhlMmOGWYEPHnIW/OymydmT+uE185caiCsghq59rlwFMnUIfbp 1QIQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s1-v6si5467197pgb.486.2018.06.21.20.51.47; Thu, 21 Jun 2018 20:52:01 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934366AbeFVDt1 (ORCPT + 99 others); Thu, 21 Jun 2018 23:49:27 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:24161 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S934326AbeFVDtZ (ORCPT ); Thu, 21 Jun 2018 23:49:25 -0400 X-UUID: 23b70955c3144c49af73027b5eac1282-20180622 Received: from mtkexhb02.mediatek.inc [(172.21.101.103)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1091699482; Fri, 22 Jun 2018 11:49:16 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Fri, 22 Jun 2018 11:49:14 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1210.3 via Frontend Transport; Fri, 22 Jun 2018 11:49:15 +0800 From: To: , CC: , , , Sean Wang , Subject: [PATCH 3/7] pinctrl: mt7622: fix that pinctrl_claim_hogs cannot work Date: Fri, 22 Jun 2018 11:49:06 +0800 Message-ID: <3b1fa378e0a83a5f39497fe8efaf4c992507ed5d.1529639050.git.sean.wang@mediatek.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: 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 From: Sean Wang To allow claiming hogs by pinctrl, we cannot enable pinctrl until all groups and functions are being added done. Also, it's necessary that the corresponding gpiochip is being added when the pinctrl device is enabled. Cc: stable@vger.kernel.org Fixes: d6ed93551320 ("pinctrl: mediatek: add pinctrl driver for MT7622 SoC") Signed-off-by: Sean Wang --- drivers/pinctrl/mediatek/pinctrl-mt7622.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/pinctrl/mediatek/pinctrl-mt7622.c b/drivers/pinctrl/mediatek/pinctrl-mt7622.c index e9eba62..42155d4 100644 --- a/drivers/pinctrl/mediatek/pinctrl-mt7622.c +++ b/drivers/pinctrl/mediatek/pinctrl-mt7622.c @@ -1695,9 +1695,10 @@ static int mtk_pinctrl_probe(struct platform_device *pdev) mtk_desc.custom_conf_items = mtk_conf_items; #endif - hw->pctrl = devm_pinctrl_register(&pdev->dev, &mtk_desc, hw); - if (IS_ERR(hw->pctrl)) - return PTR_ERR(hw->pctrl); + err = devm_pinctrl_register_and_init(&pdev->dev, &mtk_desc, hw, + &hw->pctrl); + if (err) + return err; /* Setup groups descriptions per SoC types */ err = mtk_build_groups(hw); @@ -1713,11 +1714,19 @@ static int mtk_pinctrl_probe(struct platform_device *pdev) return err; } + /* For able to make pinctrl_claim_hogs, we must not enable pinctrl + * until all groups and functions are being added one. + */ + err = pinctrl_enable(hw->pctrl); + if (err) + return err; + err = mtk_build_eint(hw, pdev); if (err) dev_warn(&pdev->dev, "Failed to add EINT, but pinctrl still can work\n"); + /* Build gpiochip should be after pinctrl_enable is done */ err = mtk_build_gpiochip(hw, pdev->dev.of_node); if (err) { dev_err(&pdev->dev, "Failed to add gpio_chip\n"); -- 2.7.4