Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5431845imm; Sun, 26 Aug 2018 20:04:11 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYutE/rCVovTDrNChSgh5lI0tODnzvsSA6IMxkfdWP6iwneCtyRR4fnkYJE6B3HLohkqa9j X-Received: by 2002:a62:1815:: with SMTP id 21-v6mr12181629pfy.227.1535339051121; Sun, 26 Aug 2018 20:04:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535339051; cv=none; d=google.com; s=arc-20160816; b=OGQ7bylP8g6Qe//soeuBUggPtfho3ZiJg5q9NtYAINnnhbyr1UBYnhsIbOu18yxy3g 9T83Q+MrNaE8kEYMAb3O41sFEIMSKeom9o1jTNPyOk7uFZfhMz2TFKWXlAxgZ9yAgSq9 upd8xOB8RzGT9M/K29iEjAfMS5Fxfs6ozm3p2sJTv2pTD2f00KkfJ5nu26pXRMXAyMGK UsNvU2H/gV4e21dmeP1W50f3ryM9u80JQW56Udi+WntDxmW4cagcW2/mtHSlunIqM+PI DiGZZyNDLf8wikBBoIrWuCEIGtNk6z3ubUkv7DFFpaHvmBlTED20e9MY8zgDEqtRRIWu H91g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=7j5Xil8wzfC7pDWizB4i+j9yZsZ36G0W6x6Dz1oh7Ak=; b=KrF6s4xcF6encANAGbRc9LD2wnjREG1C3BKCkjp2WMl4pJN09bMeaNcriMCyU0tRRX RRCOj3raLsOG32fp7UxBlahE/a7mhUxmIaIDtyC86MNiZGk9twgx90wSREl2955LVM15 kapNPMXmVTTdgj+UFZJnADEoHvR46KWwdmHI8hzoRGPCLMU/99cRlFsCtefu7F2IGRO8 ru8NqWmMV/KniQCx1hDPz/9ye+07Yu4fiwwRwrvBhc6E7tkW0jzWa3UAZkoemBy9+BTX koKPXZQjne5GLLUrHlQLYoY6A9nsmThGOfHG0z+2PRXl5a/NHSzx1DiXaJIG/Pe0ZHVR 75Pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="de/l1u48"; 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 g26-v6si13366520pgb.349.2018.08.26.20.03.55; Sun, 26 Aug 2018 20:04:11 -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; dkim=pass header.i=@linaro.org header.s=google header.b="de/l1u48"; 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 S1727212AbeH0Gr3 (ORCPT + 99 others); Mon, 27 Aug 2018 02:47:29 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:41338 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727014AbeH0Gr2 (ORCPT ); Mon, 27 Aug 2018 02:47:28 -0400 Received: by mail-pf1-f196.google.com with SMTP id h79-v6so6141351pfk.8 for ; Sun, 26 Aug 2018 20:02:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=7j5Xil8wzfC7pDWizB4i+j9yZsZ36G0W6x6Dz1oh7Ak=; b=de/l1u48y/YIuZez0CzRhy4RvAWfkOxuCkeZOAt54V/nWISavWXfHicXY3tVAYFnke L6ziqHhEpaC70SYErQBlK8vZsbrjOCghxFWskkLM0mjpRn+MhCGWe46ccWnkv2srvdfk kth0oxvUjD9GiLF7jGmeFjQw6PrL2S72eA0Y4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=7j5Xil8wzfC7pDWizB4i+j9yZsZ36G0W6x6Dz1oh7Ak=; b=AAoNJsq1UkNBppbbMhzw2I1Xq5w9TrBUtKnk3aiKkOMX15FgJZh5BnswvA05ppOFrL wJrCfk6tt3+Vlb0axAobQWbW/Z0U0aLha68//9oC5/bb7oEzLKZ9TbPKdlD0b4qcXqCv MJPxNSB/iOt4CL8V4IRDMu0wXBP8d5NOujjrx+bnOis7xd1chAhLclXKHXqwHMN+u40i b8Z+Gzmm9k1CbEWPc+S6bTiouRRcKxbLObvf8N9jNrJM/UX+GFPnxjmrPIo7P+RenXz4 FPtpiZRiHn2k1a+iXQFAmHbwJDnyO4D4lHInvn2UIokfxLAmr8ESM4e+E3lyA4WVuZL1 b3Ng== X-Gm-Message-State: APzg51DT87fiR8sWKWQeGfOdkH3Ms9J2JdQ1xUJOq55SphZTO/UZd5f4 yFwYypXpCzIMDTQaoPiwJkYODg== X-Received: by 2002:a62:1192:: with SMTP id 18-v6mr12426670pfr.54.1535338969538; Sun, 26 Aug 2018 20:02:49 -0700 (PDT) Received: from tuxbook-pro (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id l84-v6sm26008391pfg.3.2018.08.26.20.02.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 26 Aug 2018 20:02:48 -0700 (PDT) Date: Sun, 26 Aug 2018 20:06:28 -0700 From: Bjorn Andersson To: Stephen Boyd Cc: Linus Walleij , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-arm-msm@vger.kernel.org, Doug Anderson Subject: Re: [PATCH v3 2/3] pinctrl: msm: Mux out gpio function with gpio_request() Message-ID: <20180827030628.GI3048@tuxbook-pro> References: <20180816200648.90458-1-swboyd@chromium.org> <20180816200648.90458-3-swboyd@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180816200648.90458-3-swboyd@chromium.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 16 Aug 13:06 PDT 2018, Stephen Boyd wrote: > We rely on devices to use pinmuxing configurations in DT to select the > GPIO function (function 0) if they're going to use the gpio in GPIO > mode. Let's simplify things for driver authors by implementing > gpio_request_enable() for this pinctrl driver to mux out the GPIO > function when the gpio is use from gpiolib. > > Cc: Bjorn Andersson > Cc: Doug Anderson > Signed-off-by: Stephen Boyd Reviewed-by: Bjorn Andersson Regards, Bjorn > --- > drivers/pinctrl/qcom/pinctrl-msm.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c > index 5d72ffad32c2..793504057ad0 100644 > --- a/drivers/pinctrl/qcom/pinctrl-msm.c > +++ b/drivers/pinctrl/qcom/pinctrl-msm.c > @@ -176,11 +176,27 @@ static int msm_pinmux_set_mux(struct pinctrl_dev *pctldev, > return 0; > } > > +static int msm_pinmux_request_gpio(struct pinctrl_dev *pctldev, > + struct pinctrl_gpio_range *range, > + unsigned offset) > +{ > + struct msm_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); > + const struct msm_pingroup *g = &pctrl->soc->groups[offset]; > + > + /* No funcs? Probably ACPI so can't do anything here */ > + if (!g->nfuncs) > + return 0; > + > + /* For now assume function 0 is GPIO because it always is */ > + return msm_pinmux_set_mux(pctldev, 0, offset); > +} > + > static const struct pinmux_ops msm_pinmux_ops = { > .request = msm_pinmux_request, > .get_functions_count = msm_get_functions_count, > .get_function_name = msm_get_function_name, > .get_function_groups = msm_get_function_groups, > + .gpio_request_enable = msm_pinmux_request_gpio, > .set_mux = msm_pinmux_set_mux, > }; > > -- > Sent by a computer through tubes >