Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp70462ybl; Tue, 7 Jan 2020 02:21:40 -0800 (PST) X-Google-Smtp-Source: APXvYqx6EYuYmf1haqPPeuYxTHoIWqFh17U8e/HV1kT4ZavDarfa0+NLtzDakzfiNxalDSBOlTs6 X-Received: by 2002:a05:6830:15a:: with SMTP id j26mr115278479otp.137.1578392499997; Tue, 07 Jan 2020 02:21:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578392499; cv=none; d=google.com; s=arc-20160816; b=FirGJ4N7xn81fG9y0SDcrYYcKCMAwhZ+9QWLuHHCGdjTfS22dMZGc0HxPKwnbVP3Hd l9GpjtXdzB1V/absm5BZiZZWNq0d2/aqDD7Aivv7RhfWWtYzAaQdAp+2JYa22mNumnFd tcMcVbcl1YTM8c0q3di6BdHoKeQDFZLtohm0UQXCCIOOc/vZOsJ+8ShjPQDrfVEM2hxt +CLL45QK5+a/sgx9rU5ufkF7j4JSQaCGp3UPk8ca6KSL9YeO2N7uBoamzBcda0DgKmdW 9/V7bkStOpfrNBc73qhuqWx6t1o8GLMxU1TGyt5847uesleiCqtQlHuDd1rtva4pwVXc XWAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=eMXkNg8gjjjP4/UPSl/T3BVhY6m7trOu4dhjFlvWIdM=; b=yshB4KqzzfRO14eB8IUFQlj9tqROgWR3FzdsWWd2GXVkESN3GlCatPCeeiIj9FB6lY 1gwGiPGxhySTQIsEwYSMsqTKnUcKsAwbcxPH4xZtRQzHR22NRIkkxWWmpWmuXuHcWFdQ Z9LpiVQ63hmTTR0NyXnDCTEPrzZUmKs8YiYwzE2F7nrz/z63hj+zyh8kZ1HRoPseNzeI /Ytj+LjA5Wd6atZ7fwRL8Ra8CZBsOnfEwTmMk9L1or4pUTwhjzMAyE3oPJWkdBgTNcFT NsM4FnCD8K3OSYLf9d9V0fRH4HijbNNvxy91iaQS+f6558LPpt2G0FKfOiuZDtjy+c1/ n6zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xCw2aOcD; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k84si32957844oib.46.2020.01.07.02.21.27; Tue, 07 Jan 2020 02:21:39 -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=@linaro.org header.s=google header.b=xCw2aOcD; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727846AbgAGKUY (ORCPT + 99 others); Tue, 7 Jan 2020 05:20:24 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:44609 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727084AbgAGKUX (ORCPT ); Tue, 7 Jan 2020 05:20:23 -0500 Received: by mail-lf1-f68.google.com with SMTP id v201so38431926lfa.11 for ; Tue, 07 Jan 2020 02:20:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=eMXkNg8gjjjP4/UPSl/T3BVhY6m7trOu4dhjFlvWIdM=; b=xCw2aOcDbDhAosRUZpI6S8jMUrGPkDQqWqFwb5KY/DgItDqPB6ptgX5V8gs2yDC82+ TQSjZ5E2cLNKjaz6JtEmt4T7mFfIrrPYNyrT3jiAN6/2Iyc2srA526cttuVeaA9GgZy7 RsjrRB4c79+Wti1TvIpqtZa5J1rHZihfl2JV8GWrftEngwr59RFHWw/BAxyZc22OAW9/ mAqEQpKUAtdMyffk8S0eL1YYz/+fwuQPZL+9BCsW8/zdkEbMRl8S/rExnFRhho40HLDS VkvUCyyWA7t7vhznmbNtN4ENfD3DyIk0oCQtLNU+auQQZHfpdNT541zidQxXe0Qz4M0T FgfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=eMXkNg8gjjjP4/UPSl/T3BVhY6m7trOu4dhjFlvWIdM=; b=cQ1VJzkOfd/O9KARpgMgnOkkLekc+XixUPHMLdGOt3SqjleXuPog4ATStZW5j2bMVE wBtoJpLi5zznKsAS/ql33OvPX6MZt5IaNzNJGuFBzy6ZFtZSEcX9ohDD4bjsevUlwGJF rVx899TcZIqAh00H3nN0ABul7q+qEBVAcfgjc9CNRYsfMb/hjn6DLUPRrjmUgUOhNUQ/ HucCUEFsdW/y8KkdFgw5Mijf9HxuCACTlMbT7TxqgnyaC2gu17mmkL+G4Nu01l9INmuG BldTyJ4PHZzMudWeDcfUopR+Hr1dgbwqDeOOzk5eiDHkye/jz+6MBlYzLL8YBnzNsTWT 1NBg== X-Gm-Message-State: APjAAAVubEOG628oJjMrftvDLCkoHcbct26GRyLU0EqdE+x33sTAytbS OYasLwRsYNr3Mn9sbNVEzFluBeZxX50urhsopzY+8g== X-Received: by 2002:ac2:55a8:: with SMTP id y8mr58557682lfg.117.1578392421291; Tue, 07 Jan 2020 02:20:21 -0800 (PST) MIME-Version: 1.0 References: <1566206502-4347-1-git-send-email-mars.cheng@mediatek.com> <1566206502-4347-6-git-send-email-mars.cheng@mediatek.com> <1577022724.7468.20.camel@mtkswgap22> In-Reply-To: <1577022724.7468.20.camel@mtkswgap22> From: Linus Walleij Date: Tue, 7 Jan 2020 11:20:10 +0100 Message-ID: Subject: Re: [PATCH v2 05/11] pinctrl: mediatek: avoid virtual gpio trying to set reg To: Hanks Chen Cc: Mars Cheng , Matthias Brugger , Rob Herring , Marc Zyngier , Stephen Boyd , Sean Wang , CC Hwang , Loda Chou , "linux-kernel@vger.kernel.org" , "moderated list:ARM/Mediatek SoC support" , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , wsd_upstream@mediatek.com, mtk01761 , linux-clk Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 23, 2019 at 4:11 AM Hanks Chen wrote: > On Fri, 2019-08-23 at 10:57 +0200, Linus Walleij wrote: > > On Mon, Aug 19, 2019 at 11:22 AM Mars Cheng wrote: > > This does not explain what a "virtual GPIO" is in this > > context, so please elaborate. What is this? Why does > > it exist? What is it used for? > > > > GPIO is "general purpose input/output" and it is a > > pretty rubbery category already as it is, so we need > > to define our terms pretty strictly. > > > Virtual GPIO only used inside SOC and not being exported to outside SOC > in MTK platform. Some modules use virtual GPIO as eint (e.g. pmic or > usb). I would call that internal GPIOs, those are very real rails inside the chip made with polysilicone so there is nothing "virtual" about them. If the documentation for the chip calls them virtual then explain in the driver that these are SoC-internal lines so that everyone will get it. Is the PMIC inside the SoC? I thought that was usually outside of it in its own chip. But I suppose there could be some interface to it in the SoC and then that interface has this EINT? > In MTK platform, external interrupt (EINT) and GPIO is 1-1 mapping and > we can set GPIO as eint. > But some modules use specific eint which doesn't have real GPIO pin. > So we use virtual GPIO to map it. OK I get it I think... just put these comments into the code as well so we understand when reading the code what is going on. > > > + if (mtk_is_virt_gpio(hw, gpio)) > > > + return 1; > > > > Why are "virtual GPIOs" always inputs? > > We set virtual GPIO as eint. > It mean virtual GPIO only used inside SOC and not being exported to > outside SOC. Are you saying that: - "Virtual" GPIOs are always and only used for interrupts - Since they are only used for interrupts, they are always inputs Then write that in a comment to the above change so we know this context. Yours, Linus Walleij