Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp833367lqp; Thu, 23 May 2024 00:59:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWM1RrXiPLhiTNyIasMDEU19HqIOQZO71qQ+RIx/bHIOKBlU5jG3q8ET44TF2QT4RXHyGMkC091ksx9amQlKZIkew6wM0/BrIp272Vw+g== X-Google-Smtp-Source: AGHT+IE8K0CqGKlfwnf5HLylXTR30oR3jl2GHiyYaw1Q9ddmF+Ed0Is4GZh2ca1xx/9VSIcIVos1 X-Received: by 2002:a25:2fc8:0:b0:de5:705d:9373 with SMTP id 3f1490d57ef6-df4e0a75d02mr4084813276.12.1716451181706; Thu, 23 May 2024 00:59:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716451181; cv=pass; d=google.com; s=arc-20160816; b=VuxRqRvn/eTn0cQYMYC8uJM349lQ34LKo5FXuI0MR2jCZFiisGGoecDSrVPA6+3u3i L+h8gm9yalmLVP9G2h2+FiMvFEj2BAM1xh2QK+wbD20hnIjHRkVNixaxD8f3c7idnBhV 04IgUUwVFHRHpPLVK6wjqSeUrmXMDgNyHNRpbDnsxZb3WytDRdYBlhPWOKK7BW84nowX dt+u5sJ7p6dAD9Lsr5VDmH4VfEKBW2uFcDuRhWk262RaQUJvGSW1kpop6F4mfB88XroC V/5Mk7575X6cxqQcBpvQW9blJNfOZgAdWx4OyN38oGPBn4Ssnelxukg6RxNvmpR6TYHP aawQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Z8K16dWvOhO2qm+sr1y3MxtWvPvdycG1GWiFMpy3S5U=; fh=QzmbSlDFYyLvf54OUjTR/kRYyIcd3BbeZ/XYCkYaf3Q=; b=iIAxX4/BwVSCYS9Ajz1BiELFYqkOdVYTWYAmNwSnd28EQIiX2Qqbm3HN8qnDmtvNWm RC1f21pFQjvOQsPvE9rjsYH2QCWxHSdHBXUmNqenbZ1p5V3ZehVF5MTY6CkOy7PQzLUz qBXD1NNEG7cmtP61ZrNqcgboJATovKaeI3/FqyflolLBBLSyETLISV3tDSFbLagrhIsU LHUVXVP4QkM7O7nP7w+lGvRzawNwnFucR1hLkMRqGJYy4aoo+WgyvVHaniNafb0S0ZYg e/TkueHJu7sCs+vcCKPyvWB3FebMecN1Aqjhpnp3QYBqkpnZgpjxUkeMpYbtn2UIdj+Y GACQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=a0iZ5dJI; arc=pass (i=1 spf=pass spfdomain=baylibre.com dkim=pass dkdomain=baylibre-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-187127-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187127-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-43e3c8b3911si59889751cf.750.2024.05.23.00.59.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 00:59:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-187127-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=a0iZ5dJI; arc=pass (i=1 spf=pass spfdomain=baylibre.com dkim=pass dkdomain=baylibre-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-187127-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187127-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 5F4171C2127E for ; Thu, 23 May 2024 07:59:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8C80E13D504; Thu, 23 May 2024 07:58:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="a0iZ5dJI" Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0977213CABD for ; Thu, 23 May 2024 07:58:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716451115; cv=none; b=F4LIgnkL2Oj+XTBMkEH3inAp1ioSf0XNj4+lr29klVQCYkpahTTkGLVYlJ8SHZue9qcaVP/idWgo8TSIHnIHT2zEJXWMn8oPJmYRHsmqJBnNBiJ28d3ThsHiUT57htFoAC+PkjVmqxBS0VCH8TWXJEGTAjny1O04AER3u1OANS8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716451115; c=relaxed/simple; bh=xXMdx2YgQV2v/OWZAGfu0mLEHHS2I9maO01eCHtUDpU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Lxr24Av/8mup7RJyuf2AhfqjD/J4bnqTIJS/6w719RPnNKfIEjOJda+KkKdbwBdSkjrLoO/ltcp7LNoIaIyO+Ih8TXNFxt2eRuvAVlhnMiVUNC1GjYrKOVcPI2nTA7KLAQu98bCYzzCQiV9pIRTDWhBdgS3RSdbkfWht5UomYRo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=a0iZ5dJI; arc=none smtp.client-ip=209.85.128.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-42011507a54so9728635e9.0 for ; Thu, 23 May 2024 00:58:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1716451112; x=1717055912; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Z8K16dWvOhO2qm+sr1y3MxtWvPvdycG1GWiFMpy3S5U=; b=a0iZ5dJIddxbiN/gysft3jTV/B7x2rPIz2KUzZVqUcCgvzv9T7RGUL3LSiTNnb0jgs z7Ux8xhH62YXxfv+Bl8tQkAK0TZm3qGKnKwAHT0MWS4cX8z20nRxcV0NobccQ/1S+6xg uvFKJHOBpL/3XKe+g0HsXUNLktCAoBaDQfQ6frqBmE8L8Pgd7XOJeFOUWSfZdC3nwp4n MX+xcxq5RHeCh7OMPxyg5ybC4I2BgdA9X6+Kg347RSWaYttSPwFSSm1LtKncoFGfswnZ 8tUh2Z+bwihCUlVkx+KoYhwTzIHipE/ZGrv9gHImMWN2Jzbecb2OnjwVuCNnggjwSqT7 hguQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716451112; x=1717055912; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Z8K16dWvOhO2qm+sr1y3MxtWvPvdycG1GWiFMpy3S5U=; b=tOgMpxFRC9dxP3ewbkhf+GEI/Hk7eFpegSCuyxl3EgNWtA3Kp7S+a03KasHzwECf0+ PopdBQPz3RZUvnyOH4hducFuV16iPd7pyC6OIXDPrGrdy8by0323LA5saiIp9cj1qKf/ F6IhPDv/J0FEXgo9Z9L3jt3cHHno5jo4ufW3fRb/yb9qLoedf99Bmi5azpvr86oeZBvZ MAOpYztHkvZ3kpu1EF0Pihs5wsZ8KwRWcCySCF6Egj0Ewf/0/9KzCiotL/3wo52aR4Rw R7+3vxPKUz1oNjzq7Z43m0w3ewyv9p3vXbrQV3r1HLTtVm1SlnVEJ8FrKv5kGXXpVWfH Dutw== X-Forwarded-Encrypted: i=1; AJvYcCWknQnHHgjdBvNj3iUiQl9bGybYYrBmi/r8IrfHBw895OwzqnuDCJ+BYMeSIA1jYONr2bVnyoGmfF0AM/NWhmpklyTurMtvPDv+MPX9 X-Gm-Message-State: AOJu0YzRaaNoFVVDDYLcHak2d6v53m2nQxEjNdKqAVCXmjQIEM8MZspa oBO5HAteLdEQyHu7EQB0y+OM+nE0jtfL20XhZu4PN3sd7L0Nqa37Qbgk7UVZ5I8= X-Received: by 2002:a05:600c:4fd2:b0:418:3d59:c13a with SMTP id 5b1f17b1804b1-421015b3ca3mr13374455e9.9.1716451112348; Thu, 23 May 2024 00:58:32 -0700 (PDT) Received: from blmsp.fritz.box ([2001:4091:a246:821e:6f3b:6b50:4762:8343]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42100f01d7fsm17359125e9.1.2024.05.23.00.58.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 00:58:31 -0700 (PDT) From: Markus Schneider-Pargmann To: Greg Kroah-Hartman , Jiri Slaby , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Tony Lindgren , John Ogness , Markus Schneider-Pargmann , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Ronald Wahl , Thomas Richard , Thomas Gleixner , Andy Shevchenko , Arnd Bergmann , Vignesh Raghavendra Cc: Vibhore Vardhan , Kevin Hilman , Dhruva Gole , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH 4/5] serial: 8250: omap: Support wakeup pinctrl state Date: Thu, 23 May 2024 09:58:18 +0200 Message-ID: <20240523075819.1285554-5-msp@baylibre.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240523075819.1285554-1-msp@baylibre.com> References: <20240523075819.1285554-1-msp@baylibre.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit UART can be used as a wakeup source for am62 from a powered-off SoC state. To enable wakeup from UART am62 requires a wakeup flag being set in the pinctrl. If the device is marked as wakeup enabled, select the 'wakeup' pinctrl state on sys_off. Signed-off-by: Markus Schneider-Pargmann --- drivers/tty/serial/8250/8250_omap.c | 39 +++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c index 5b7508dfb5d8..617a421a1396 100644 --- a/drivers/tty/serial/8250/8250_omap.c +++ b/drivers/tty/serial/8250/8250_omap.c @@ -27,8 +27,10 @@ #include #include #include +#include #include #include +#include #include "8250.h" @@ -149,6 +151,9 @@ struct omap8250_priv { spinlock_t rx_dma_lock; bool rx_dma_broken; bool throttled; + + struct pinctrl *pinctrl; + struct pinctrl_state *pinctrl_wakeup; }; struct omap8250_dma_params { @@ -1345,6 +1350,30 @@ static int omap8250_no_handle_irq(struct uart_port *port) return 0; } +static int omap8250_select_wakeup_pinctrl(struct device *dev, + struct omap8250_priv *priv) +{ + if (IS_ERR_OR_NULL(priv->pinctrl_wakeup)) + return 0; + + if (!device_may_wakeup(dev)) + return 0; + + return pinctrl_select_state(priv->pinctrl, priv->pinctrl_wakeup); +} + +static int omap8250_sysoff_handler(struct sys_off_data *data) +{ + struct omap8250_priv *priv = dev_get_drvdata(data->dev); + int ret; + + ret = omap8250_select_wakeup_pinctrl(data->dev, priv); + if (ret) + dev_err(data->dev, "Failed to select pinctrl state 'wakeup', continuing poweroff\n"); + + return NOTIFY_DONE; +} + static struct omap8250_dma_params am654_dma = { .rx_size = SZ_2K, .rx_trigger = 1, @@ -1566,6 +1595,16 @@ static int omap8250_probe(struct platform_device *pdev) priv->line = ret; pm_runtime_mark_last_busy(&pdev->dev); pm_runtime_put_autosuspend(&pdev->dev); + + priv->pinctrl = devm_pinctrl_get(&pdev->dev); + if (!IS_ERR_OR_NULL(priv->pinctrl)) + priv->pinctrl_wakeup = pinctrl_lookup_state(priv->pinctrl, "wakeup"); + + devm_register_sys_off_handler(&pdev->dev, + SYS_OFF_MODE_POWER_OFF_PREPARE, + SYS_OFF_PRIO_DEFAULT, + omap8250_sysoff_handler, NULL); + return 0; err: pm_runtime_dont_use_autosuspend(&pdev->dev); -- 2.43.0