Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp3533972pxb; Fri, 4 Feb 2022 10:29:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJynvkuUg6I5niE3UypQJw03VtjQC60oVU/sj4m5VIRN16p9thD0B0eAa+1pkRLnWvuTNIik X-Received: by 2002:a17:903:1212:: with SMTP id l18mr4470856plh.77.1643999365977; Fri, 04 Feb 2022 10:29:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643999365; cv=none; d=google.com; s=arc-20160816; b=d8tPZ5ROhf9NRl7rP+2aVv6kQV/e9YqhCDydw3O7j40VKS7TZar+iFsOFMVsAsUgnW 8AJBq8nmJGtnYprGHBmRTj/0s4AQT10L/d7CTAC0wgwqwEO+TbsqZFUEWflwOCsFbZaS gsYjdcpfu/NACXWUc/9a1qzxCmNyRLCfZfNNcVz9g8w+yfFFV8hhDzmQkYsXHDhTsArs 61GRfSNzXq1Uw7lxlXRZ/C15fWiGICaoqRqW84tcTEZXMNoPoDuRyR4OOO3GR7ocIBCd lXlMF0FrVuhRH1cpbSlaa2n0OXn9XspPZYye4cOJFIlvTafBiUESurLui14xTPJPG7R/ 7q3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=AglS7CjM5YP8DK4AQeHdlXrIgQZulAnAMUNDfA9asfI=; b=a+MoqI4CUKP7iyd+3jhX3S97KghSZ+FJ1S4AH39lOK/K2h5wVB61flTIPT6Mt0PWXh IBuaFIEpNHnI1eM0CMj/dfhAZCo8KJqcnTU23sXJz3ii8rMyO2UuU9nxzERyv6d1nKWJ IGV0I9CNgfugdy6JQkS+il2pytz8Bqfc2CA/CQQcoagM79dUN85CO+KMCMmEcxpDbcq5 RmjTEfRki/SKeDrNz0YwE6zq0JWMgfKFtQNUPHgYODkuTXT3EYC1anLLFavWIizzW4yx KlCQEysVzW3G/NdpZtbzlBDW9jbl4DY4uw0bihkrDJ0GuejVYynpUNGQfLgo31Ku9EI5 2Xag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=4xqXISGN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s17si2537093pgm.852.2022.02.04.10.29.14; Fri, 04 Feb 2022 10:29:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=4xqXISGN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352764AbiBCRTC (ORCPT + 99 others); Thu, 3 Feb 2022 12:19:02 -0500 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:41050 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1352675AbiBCRS7 (ORCPT ); Thu, 3 Feb 2022 12:18:59 -0500 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 213FKZHg012451; Thu, 3 Feb 2022 18:16:49 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=selector1; bh=AglS7CjM5YP8DK4AQeHdlXrIgQZulAnAMUNDfA9asfI=; b=4xqXISGNWGY2Emt4pZgDgvrVc6aW8PdwBS7cEazVIKK7mVQ5BDnE3x7ddDEQ5zLvlzsL sqY4mc2ZpxrkXFwBmTH1E+Hwi73ZO++7xKgqZVK+RZ114598SZTeI2Aw40kRF2d/pdj0 sQctKqVRERDt+ZDaiu+RoqB5MJBQVGgoOqQVeZ0UXft6uHCB4CSA3m29ICRsCrHF8xE7 FsxhJMclYTqaCizuhzuhM9UlLpDrfOu+JsLHdqv+sEZUXCpljLB9fMkLBR0Oletzcv9q NI59qUmEXDuufa9qJSYrqf0Sh7p/HOAzIJ7juLoWAIANerbjNM2JnbMGoO+TSpNxTFAq uw== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3e0c4fje1x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 03 Feb 2022 18:16:49 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 59AD5100034; Thu, 3 Feb 2022 18:16:48 +0100 (CET) Received: from Webmail-eu.st.com (sfhdag2node2.st.com [10.75.127.5]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 5150422F7AF; Thu, 3 Feb 2022 18:16:48 +0100 (CET) Received: from localhost (10.75.127.44) by SFHDAG2NODE2.st.com (10.75.127.5) with Microsoft SMTP Server (TLS) id 15.0.1497.26; Thu, 3 Feb 2022 18:16:47 +0100 From: Erwan Le Ray To: Greg Kroah-Hartman CC: Jiri Slaby , Maxime Coquelin , Alexandre Torgue , Gerald Baeza , Erwan Le Ray , Valentin Caron , , , , Subject: [PATCH 1/2] serial: mctrl_gpio: add a new API to enable / disable wake_irq Date: Thu, 3 Feb 2022 18:16:43 +0100 Message-ID: <20220203171644.12231-2-erwan.leray@foss.st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220203171644.12231-1-erwan.leray@foss.st.com> References: <20220203171644.12231-1-erwan.leray@foss.st.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.75.127.44] X-ClientProxiedBy: SFHDAG2NODE2.st.com (10.75.127.5) To SFHDAG2NODE2.st.com (10.75.127.5) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-02-03_06,2022-02-03_01,2021-12-02_01 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a new API to enable / disable wake_irq in order to enable gpio irqs as wakeup irqs for the uart port. Signed-off-by: Erwan Le Ray diff --git a/drivers/tty/serial/serial_mctrl_gpio.c b/drivers/tty/serial/serial_mctrl_gpio.c index c41d8911ce95..1663b3afc3a0 100644 --- a/drivers/tty/serial/serial_mctrl_gpio.c +++ b/drivers/tty/serial/serial_mctrl_gpio.c @@ -299,4 +299,42 @@ void mctrl_gpio_disable_ms(struct mctrl_gpios *gpios) } EXPORT_SYMBOL_GPL(mctrl_gpio_disable_ms); +void mctrl_gpio_enable_irq_wake(struct mctrl_gpios *gpios) +{ + enum mctrl_gpio_idx i; + + if (!gpios) + return; + + if (!gpios->mctrl_on) + return; + + for (i = 0; i < UART_GPIO_MAX; ++i) { + if (!gpios->irq[i]) + continue; + + enable_irq_wake(gpios->irq[i]); + } +} +EXPORT_SYMBOL_GPL(mctrl_gpio_enable_irq_wake); + +void mctrl_gpio_disable_irq_wake(struct mctrl_gpios *gpios) +{ + enum mctrl_gpio_idx i; + + if (!gpios) + return; + + if (!gpios->mctrl_on) + return; + + for (i = 0; i < UART_GPIO_MAX; ++i) { + if (!gpios->irq[i]) + continue; + + disable_irq_wake(gpios->irq[i]); + } +} +EXPORT_SYMBOL_GPL(mctrl_gpio_disable_irq_wake); + MODULE_LICENSE("GPL"); diff --git a/drivers/tty/serial/serial_mctrl_gpio.h b/drivers/tty/serial/serial_mctrl_gpio.h index b134a0ffc894..fc76910fb105 100644 --- a/drivers/tty/serial/serial_mctrl_gpio.h +++ b/drivers/tty/serial/serial_mctrl_gpio.h @@ -91,6 +91,16 @@ void mctrl_gpio_enable_ms(struct mctrl_gpios *gpios); */ void mctrl_gpio_disable_ms(struct mctrl_gpios *gpios); +/* + * Enable gpio wakeup interrupts to enable wake up source. + */ +void mctrl_gpio_enable_irq_wake(struct mctrl_gpios *gpios); + +/* + * Disable gpio wakeup interrupts to enable wake up source. + */ +void mctrl_gpio_disable_irq_wake(struct mctrl_gpios *gpios); + #else /* GPIOLIB */ static inline @@ -142,6 +152,14 @@ static inline void mctrl_gpio_disable_ms(struct mctrl_gpios *gpios) { } +static inline void mctrl_gpio_enable_irq_wake(struct mctrl_gpios *gpios) +{ +} + +static inline void mctrl_gpio_disable_irq_wake(struct mctrl_gpios *gpios) +{ +} + #endif /* GPIOLIB */ #endif -- 2.17.1