From patchwork Wed Jul 26 13:55:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yegor Yefremov X-Patchwork-Id: 9864895 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3903D6038C for ; Wed, 26 Jul 2017 13:55:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C21F28740 for ; Wed, 26 Jul 2017 13:55:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 10E5128769; Wed, 26 Jul 2017 13:55:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE4A728740 for ; Wed, 26 Jul 2017 13:55:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751654AbdGZNzX (ORCPT ); Wed, 26 Jul 2017 09:55:23 -0400 Received: from mail-ua0-f196.google.com ([209.85.217.196]:38564 "EHLO mail-ua0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751652AbdGZNzW (ORCPT ); Wed, 26 Jul 2017 09:55:22 -0400 Received: by mail-ua0-f196.google.com with SMTP id x24so14059917uah.5; Wed, 26 Jul 2017 06:55:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=hpMmDroIq0+GStoAFmt3mer8/C51n12VnGjsVXbyzdI=; b=BB8MMWueu9rOBDR5RqDIhWnAOrGkCE57F37oxbwCB3DUQR6+P6v2U6AzmZZscjuL75 0x1JkF10EKecXdjdCgo0HA+qDfkyJpqLVNqyx+X6ifaVZxoxBKGIOsW1OgRRsmn2JOTT oxcAwQRRaavWke0vWdJOD65ZY20dkXc+y4SZKMdMf4NCqyDuQJPSJWhxoQcvNXQ2mElC Ryu8a5jtchAT6CYLtsRfJgOitM5oPgfrGityqTkeC+3ae4LgOOQHeknkIL7c+rdselUs CMmAd5Xn0udwAp1eJ99i0uqmkv1E8qySC+JIIOOpT3LEMCiHKS10DhwP1vZytzQ8Jt/m XzYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=hpMmDroIq0+GStoAFmt3mer8/C51n12VnGjsVXbyzdI=; b=CGz8uM4jsqqlck/eQ/erC29+OSi0MA/i2uW3BVL/TDGVaEhQ7xJI+NSjUhFKMAUJLk Wd+xet0V8TkMcND/8Nmc+GG08PxfgGW+CAZS7Sky6DCu82cWzUQ/JuGeE/eC9m6sFkmr 4H+apX/hWFVwyVp7OOtAnFVM+L6Mgllz7dAk3TsLGHdAkojPOSIjbAAA4iBCC1J39kF/ HXip3WEvVTd+HS17VXfvxuRyu1zw7cEKT5o45fdWNxLs1fTJJze8V2ZwdXxy+ohGk6Ya JaLYms2r1W1WlQ4/EZD1FGntrN4ar/WtFEAZbJRb3EgM65oL3ReSyZlzkmo9AfzGuhBw ElJg== X-Gm-Message-State: AIVw113JbrfUou/u/GBH70CXC0sH9P4WZxJrVtt3NSHpGwofM7r8juNz Z4VzlGuba8LT1NdBmeKb+Z/hAdUf5g== X-Received: by 10.176.74.71 with SMTP id r7mr576958uae.180.1501077321613; Wed, 26 Jul 2017 06:55:21 -0700 (PDT) MIME-Version: 1.0 Received: by 10.176.94.110 with HTTP; Wed, 26 Jul 2017 06:55:01 -0700 (PDT) In-Reply-To: <1501076149.29303.255.camel@linux.intel.com> References: <1500921580.29303.220.camel@linux.intel.com> <1500974314.29303.222.camel@linux.intel.com> <1501076149.29303.255.camel@linux.intel.com> From: Yegor Yefremov Date: Wed, 26 Jul 2017 15:55:01 +0200 Message-ID: Subject: Re: 8250: Use mctrl_gpio helpers To: Andy Shevchenko Cc: "linux-serial@vger.kernel.org" , Greg Kroah-Hartman , Mika Westerberg , "Jarkko Nikula (jarkko.nikula@linux.intel.com)" , "linux-omap@vger.kernel.org" , =?UTF-8?Q?Uwe_Kleine=2DK=C3=B6nig?= , Peter Hurley Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Wed, Jul 26, 2017 at 3:35 PM, Andy Shevchenko wrote: > On Wed, 2017-07-26 at 15:26 +0200, Yegor Yefremov wrote: >> On Tue, Jul 25, 2017 at 11:18 AM, Andy Shevchenko >> wrote: >> > On Tue, 2017-07-25 at 07:43 +0200, Yegor Yefremov wrote: >> > > On Mon, Jul 24, 2017 at 8:48 PM, Yegor Yefremov >> > > wrote: >> > > > On Mon, Jul 24, 2017 at 8:39 PM, Andy Shevchenko >> > > > wrote: >> > > > > Hi! >> > > > > >> > > > > Since my big ACPI GPIO fix made the vanilla, I think we may >> > > > > return >> > > > > back >> > > > > the commit 4ef03d328769 ("tty/serial/8250: use mctrl_gpio >> > > > > helpers"). >> > > > > >> > > > > I just have tested it on two x86 boards: >> > > > > 1) Broxton (without _DSD properties) >> > > > > 2) ApolloLake (with _DSD properties for RX and CTS pins) >> > > > > >> > > > > Opinions, more testing? >> > >> > Alas, I did more deep testing and the patch breaks the console. >> > >> > It looks like we need to distinguish what those GPIOs are used for: >> > a) modem control lines, or >> > b) wakeup source. >> > >> > There are few options to distinguish: >> > 1) check if GPIO resource is marked as wakeup source (ACPI only) >> > 2) use "wakeup-source" device property, for now looks like there is >> > no >> > serial driver is using it (might be collision with the real wake >> > capable >> > serial drivers) >> > 3) similar to 2), though introduce another property like "oob- >> > wakeup- >> > source" or any variations of that >> > 4) something else? >> > > >> AFAIK this patch was needed in order to avoid serial port breakage, >> where some modem signals were defined in ACPI tables. Mika and some >> other devs reported the issue as "tty/serial/8250: use mctrl_gpio >> helpers" was part of the kernel. > > I am one from those devs. > > >> Perhaps I should just augment my patch like this? >> > >> + sprintf(mctrl_property, "%s-gpios", >> mctrl_gpios_desc[i].name); >> + if (!device_property_present(dev, mctrl_property) > > This is not needed any more. My patch series for GPIO ACPI library makes > this clean (no fallback is allowed if name is supplied). > > The problen now while property _is_ there in ACPI table. > >> || >> + of_property_read_bool(dev->of_node, >> "wakeup-source")) > > ...and this should be device_property besides that fact that you need to > check it once in _noauto() and forbid requesting GPIOs by returning an > error immediately. Something like that: return ERR_PTR(-ENOMEM); --- > P.S. Take into account that use of this property should be described in > the bindings. Before that it should be discussed (I pointed above what > might be cons of use this name/property). OK. Let's wait for suggestions. Yegor -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/tty/serial/serial_mctrl_gpio.c b/drivers/tty/serial/serial_mctrl_gpio.c index d2da6aa..8871213 100644 --- a/drivers/tty/serial/serial_mctrl_gpio.c +++ b/drivers/tty/serial/serial_mctrl_gpio.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -118,6 +119,9 @@ struct mctrl_gpios *mctrl_gpio_init_noauto(struct device *dev, unsigned int idx) struct mctrl_gpios *gpios; enum mctrl_gpio_idx i; + if (device_property_present(dev, "wakeup-source")) + return ERR_PTR(-EINVAL); + gpios = devm_kzalloc(dev, sizeof(*gpios), GFP_KERNEL); if (!gpios)