Received: by 10.223.185.116 with SMTP id b49csp5959805wrg; Wed, 7 Mar 2018 22:41:23 -0800 (PST) X-Google-Smtp-Source: AG47ELt6ExAnbAtl/qnAS/Z1KtoY+NXppHPBsJfy9lc1ljfam+lAUcsUJqflRbnyF6FUFXK5HQh/ X-Received: by 2002:a17:902:b686:: with SMTP id c6-v6mr22942196pls.339.1520491283619; Wed, 07 Mar 2018 22:41:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520491283; cv=none; d=google.com; s=arc-20160816; b=XJO9pG8iz0XF+5ay/xoGV63QQv1AqSR7iGzT9cbuGYuFmJiW22OFnpqcxkqb5XzGkK 8agzs64y8FLhR1c4pF+6/i0PODUReveOV8Az/xusH8fYJsSMMOMjhpO33Endkg8MnUl8 4Jndx8U+l9yoKRKpiTnaxBk+5kGaPraIERKw6uvXmYOkAOlJ1CgK5ue3uZ/6edQn7GVV 4mZ7wbtQKSQjuy80AdZgB28x+p68ON2TLo6NscJtkkoykCv+W9s0ixDRYog6MnDrvz+j 3ORONxvNx1nDqzHsxa5NiOcdcTyb4TIuRLJFT/ZtrSMeGMrxx1pTScmW3iBgvUe8uWNz VJjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=Ol9eB5SGB7fkHgiZAsHBazfxbQLhk/3ooy1A8lHGukE=; b=oY4FqmpHtLQF/MUjg93chgjzfe6SwLECuvD0vOnWUCOo639Y2uP0LWQhV0hmHJwJ4i 4I+MFbPTrpqh8lviyk5xdiHYEZM4oCCRed+EtZQdY7EC3tiK/RQnvy8hLECqkxEnF7QW 10BqgEWgrkeAdQJvH7EJOfWRnzeU1WrJl5BlvVJsDwiqRcDqVpoH12S7T/uG+QfbBYF9 de7csB4li5eWUVpqWE+z5upGclV4O2MTyuMw56ksPCLz0isbXyK3oNzCujNBvo87SIhA /PfosJaER8QQsTUefa+BQ1Y9Y0E7w88MIitcyxXptarmnKcxWdTaa8tsQWa5li6UbBH0 VUeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=HZ9L7TVU; 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=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k91-v6si14244181pld.361.2018.03.07.22.41.08; Wed, 07 Mar 2018 22:41:23 -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=@microsoft.com header.s=selector1 header.b=HZ9L7TVU; 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=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965445AbeCHGi7 (ORCPT + 99 others); Thu, 8 Mar 2018 01:38:59 -0500 Received: from mail-sn1nam01on0106.outbound.protection.outlook.com ([104.47.32.106]:14491 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965329AbeCHE7L (ORCPT ); Wed, 7 Mar 2018 23:59:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Ol9eB5SGB7fkHgiZAsHBazfxbQLhk/3ooy1A8lHGukE=; b=HZ9L7TVUCcu2rsy4cv37Rvy+TbXSs+zj7JoDSz6ahYIGhrV9r3C/pjvVn+TojkY+AU0Vks/hBJ5QQgmxK4eW7jSj2MuaLcQ6E/CpFUEc4TWzLk97ViFMsgMRYPrwMBhjhUDwiDhcLhnu3FzuTd5ZDG1FmzOHd7aATTVa2Jp4BIw= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1015.namprd21.prod.outlook.com (52.132.133.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.588.3; Thu, 8 Mar 2018 04:59:08 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8063:c68a:b210:7446]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8063:c68a:b210:7446%2]) with mapi id 15.20.0588.008; Thu, 8 Mar 2018 04:59:08 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Brian Norris , Linus Walleij , Sasha Levin Subject: [PATCH AUTOSEL for 4.14 51/67] pinctrl: rockchip: enable clock when reading pin direction register Thread-Topic: [PATCH AUTOSEL for 4.14 51/67] pinctrl: rockchip: enable clock when reading pin direction register Thread-Index: AQHTtpoE4u2lMJiWWkOklSJRgVO/6g== Date: Thu, 8 Mar 2018 04:57:53 +0000 Message-ID: <20180308045641.7814-51-alexander.levin@microsoft.com> References: <20180308045641.7814-1-alexander.levin@microsoft.com> In-Reply-To: <20180308045641.7814-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB1015;7:e3soiwB1BBChQF50NRm76sEUrx6reihwtnzgYA3DtvcaRRZGgJjm3drYbTr2Qnhasg+9dF50h9uWU9oxasLF6qe5j9R1HLBv4GYS/xg7jG4Zy1ps69DKyIFFASYJQCraBH/vXyxjshLL25zhOxlYyt+8ABY+1+Re+HX4vRpXYVVHeRwmMIAJ23GxqYLMEDaEvK3HyV9LQOG2Mdlnc3VJ4RBL4mdDBcGWqeduMEZfimb9UoZE3ZArwCJD25NLc041;20:YmQGER0fFn91Kb0a3qzQ3kpBoiEpLNEd8a6UHUjpfKeGn2GEHWKfaTWPmZvC+FMLvFvCy90X47M1vM8s4WPF7br1hSRVkXmo341qrzuUWt3MqPr6gykqvDKGavZawdV4e6B3iTdS1fJqFKQmjQ4RiXxfkPirlWxZ5//Kej9KmOY= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 1eca9a1f-611f-43dd-d3c5-08d584b1535f x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB1015; x-ms-traffictypediagnostic: DM5PR2101MB1015: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040501)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231220)(944501244)(52105095)(10201501046)(3002001)(6055026)(61426038)(61427038)(6041288)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011);SRVR:DM5PR2101MB1015;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1015; x-forefront-prvs: 060503E79B x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(376002)(396003)(366004)(39860400002)(39380400002)(346002)(189003)(199004)(6116002)(53936002)(1076002)(107886003)(3846002)(3660700001)(10090500001)(6666003)(2950100002)(2906002)(6512007)(99286004)(8936002)(6486002)(76176011)(6506007)(68736007)(59450400001)(316002)(110136005)(81156014)(81166006)(8676002)(54906003)(3280700002)(2900100001)(6436002)(97736004)(72206003)(25786009)(10290500003)(86612001)(4326008)(305945005)(7736002)(66066001)(22452003)(478600001)(5660300001)(86362001)(14454004)(106356001)(36756003)(102836004)(5250100002)(105586002)(26005)(2501003)(186003)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1015;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: qbFNLU6pUYCOL1eGSGy55L4FAQc+nNQC03npNsQ1Z+3jyuRn2nBYGxtmmJKhR4fXvDJvCORbNxi66Gq7BDEEsxyEQ/7ORy+57w23p9/4HBAUl/H4d6GYurF+wAmKaVSTMfCdOSREfjziHVzWIeW0ygLOkzsDVWVb3ORj7PT4ehhOPAWVhIFbGGcBrJF8j+XzZqalCBJiwQTtVpxxlKR4r5618YbPCVLc63EvdCWoJe19E5iuT2cOFno5JMdOhvHWH9pMq5xkEZAJiIUUgdtPJ4uumjzQ75coFiLJrOinTb0D+WLvS1LWKKpKwFL8MX8lYWj81T6SwpOmI/uq1+fsTg== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1eca9a1f-611f-43dd-d3c5-08d584b1535f X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Mar 2018 04:57:53.7583 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1015 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Brian Norris [ Upstream commit 5c9d8c4f6b8168738a26bcf288516cc3a0886810 ] We generally leave the GPIO clock disabled, unless an interrupt is requested or we're accessing IO registers. We forgot to do this for the ->get_direction() callback, which means we can sometimes [1] get incorrect results [2] from, e.g., /sys/kernel/debug/gpio. Enable the clock, so we get the right results! [1] Sometimes, because many systems have 1 or mor interrupt requested on each GPIO bank, so they always leave their clock on. [2] Incorrect, meaning the register returns 0, and so we interpret that as "input". Signed-off-by: Brian Norris Reviewed-by: Heiko Stuebner Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin --- drivers/pinctrl/pinctrl-rockchip.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-r= ockchip.c index b5cb7858ffdc..a9bc1e01f982 100644 --- a/drivers/pinctrl/pinctrl-rockchip.c +++ b/drivers/pinctrl/pinctrl-rockchip.c @@ -1989,8 +1989,16 @@ static int rockchip_gpio_get_direction(struct gpio_c= hip *chip, unsigned offset) { struct rockchip_pin_bank *bank =3D gpiochip_get_data(chip); u32 data; + int ret; =20 + ret =3D clk_enable(bank->clk); + if (ret < 0) { + dev_err(bank->drvdata->dev, + "failed to enable clock for bank %s\n", bank->name); + return ret; + } data =3D readl_relaxed(bank->reg_base + GPIO_SWPORT_DDR); + clk_disable(bank->clk); =20 return !(data & BIT(offset)); } --=20 2.14.1