From patchwork Tue May 31 08:59:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yegor Yefremov X-Patchwork-Id: 9143829 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 8EB2460757 for ; Tue, 31 May 2016 08:59:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 81D3427BF1 for ; Tue, 31 May 2016 08:59:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 769B728187; Tue, 31 May 2016 08:59:41 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, 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 161C727BF1 for ; Tue, 31 May 2016 08:59:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756892AbcEaI7k (ORCPT ); Tue, 31 May 2016 04:59:40 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:35342 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756461AbcEaI7g (ORCPT ); Tue, 31 May 2016 04:59:36 -0400 Received: by mail-wm0-f67.google.com with SMTP id e3so30331599wme.2; Tue, 31 May 2016 01:59:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+LeuuwFjQn5FUfurG1vVMUIfZ5G9Gx+ObxpCUclWF0E=; b=WV17dMcwY+RrCy/VdnnAsJuUMCdwFfe0SsyC77M2LvtpxmgDZdcJwd0ZNKbiQ1Tt/V Bk/Z5l5mhR5HCCmPS87V3Lv0kvf47eQlBLk6kbzooq5GZCeWEeTybHJc+CFqRYAUSB1Z tOeEMnV1oscAvRxdfBf+DqC0bX9SK6CtXQ9xlZfdFbaArzTt6CUhQu+maT7Eon2azcg7 W1Ig7GjcZfA/XWqd16Gq5Kj2BmbCQO/MvLBcS1158tmjv/LZra3g9snyog6fpOragY5t DJe81XEGybKqrosFGrZUgnV3OxujED4qdv7+8tHo4FWgJJq3SpwqicwxaCAQhn2/LjoB eJXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+LeuuwFjQn5FUfurG1vVMUIfZ5G9Gx+ObxpCUclWF0E=; b=V/xY2EcSkgZuXx9Lx0Tem/tR6degoQDO6ssPNYiCvAjfWzNaMDas8SSumDFfUP0uy1 WyH/rshXqLDfpVH2nBdM+vLnKkR5gvSdkGTuJs8CPQvXNRv0hiz8GUhBgl9kW1AifxFv JP0NhCEb4JVtRM/ZqWz+HrAihMOH2NHNSLZlsv8lNTj2C15VEh0Q9+M8rMRalOdw4Xlw o0kDELsCTUdR5sFR/JtJGyBJ6yjq3fUXp7P5Fk9p8WAHMoq+Wu/aGZTX6Tyg3A9MFeom ZAnZbJY4uFQJkzQ3+phTSMVdEX92WBgZDCdFg1qryhC/EK/66tgJDm9C7UhOs9RRloMp a/nA== X-Gm-Message-State: ALyK8tLfdhXtus/X/N/LoFmoePa6GKSbVkVl6VSxfN39Gnttu0+YvEjUkcCDnF28QJ6rKw== X-Received: by 10.194.87.72 with SMTP id v8mr35129479wjz.68.1464685175171; Tue, 31 May 2016 01:59:35 -0700 (PDT) Received: from development1.visionsystems.de (mail.visionsystems.de. [213.209.99.202]) by smtp.gmail.com with ESMTPSA id w123sm27902335wmw.0.2016.05.31.01.59.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 31 May 2016 01:59:34 -0700 (PDT) From: yegorslists@googlemail.com To: linux-serial@vger.kernel.org Cc: linux-omap@vger.kernel.org, gregkh@linuxfoundation.org, u.kleine-koenig@pengutronix.de, peter@hurleysoftware.com, Yegor Yefremov Subject: [PATCH v5 2/4] serial: mctrl_gpio: add modem control read routine Date: Tue, 31 May 2016 10:59:16 +0200 Message-Id: <1464685158-17389-3-git-send-email-yegorslists@googlemail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1464685158-17389-1-git-send-email-yegorslists@googlemail.com> References: <1464685158-17389-1-git-send-email-yegorslists@googlemail.com> 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 From: Yegor Yefremov mctrl_gpio_get_outputs() returns the state of following signals: RTS, DTR While defining the routine for reading outputs, fix the comment for mctrl_gpio_get() routine as it returns only the state of the input signals. Signed-off-by: Yegor Yefremov --- Changes: v5: rework commit log message to metion mctrl_gpio_get comment fix drivers/tty/serial/serial_mctrl_gpio.c | 18 ++++++++++++++++++ drivers/tty/serial/serial_mctrl_gpio.h | 15 ++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/serial_mctrl_gpio.c b/drivers/tty/serial/serial_mctrl_gpio.c index e8dd509..a868595 100644 --- a/drivers/tty/serial/serial_mctrl_gpio.c +++ b/drivers/tty/serial/serial_mctrl_gpio.c @@ -86,6 +86,24 @@ unsigned int mctrl_gpio_get(struct mctrl_gpios *gpios, unsigned int *mctrl) } EXPORT_SYMBOL_GPL(mctrl_gpio_get); +unsigned int +mctrl_gpio_get_outputs(struct mctrl_gpios *gpios, unsigned int *mctrl) +{ + enum mctrl_gpio_idx i; + + for (i = 0; i < UART_GPIO_MAX; i++) { + if (gpios->gpio[i] && mctrl_gpios_desc[i].dir_out) { + if (gpiod_get_value(gpios->gpio[i])) + *mctrl |= mctrl_gpios_desc[i].mctrl; + else + *mctrl &= ~mctrl_gpios_desc[i].mctrl; + } + } + + return *mctrl; +} +EXPORT_SYMBOL_GPL(mctrl_gpio_get_outputs); + struct mctrl_gpios *mctrl_gpio_init_noauto(struct device *dev, unsigned int idx) { struct mctrl_gpios *gpios; diff --git a/drivers/tty/serial/serial_mctrl_gpio.h b/drivers/tty/serial/serial_mctrl_gpio.h index 332a33a..fa000bc 100644 --- a/drivers/tty/serial/serial_mctrl_gpio.h +++ b/drivers/tty/serial/serial_mctrl_gpio.h @@ -48,12 +48,19 @@ struct mctrl_gpios; void mctrl_gpio_set(struct mctrl_gpios *gpios, unsigned int mctrl); /* - * Get state of the modem control output lines from GPIOs. + * Get state of the modem control input lines from GPIOs. * The mctrl flags are updated and returned. */ unsigned int mctrl_gpio_get(struct mctrl_gpios *gpios, unsigned int *mctrl); /* + * Get state of the modem control output lines from GPIOs. + * The mctrl flags are updated and returned. + */ +unsigned int +mctrl_gpio_get_outputs(struct mctrl_gpios *gpios, unsigned int *mctrl); + +/* * Returns the associated struct gpio_desc to the modem line gidx */ struct gpio_desc *mctrl_gpio_to_gpiod(struct mctrl_gpios *gpios, @@ -107,6 +114,12 @@ unsigned int mctrl_gpio_get(struct mctrl_gpios *gpios, unsigned int *mctrl) return *mctrl; } +static inline unsigned int +mctrl_gpio_get_outputs(struct mctrl_gpios *gpios, unsigned int *mctrl) +{ + return *mctrl; +} + static inline struct gpio_desc *mctrl_gpio_to_gpiod(struct mctrl_gpios *gpios, enum mctrl_gpio_idx gidx)