From patchwork Mon Oct 14 06:01:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bough Chen X-Patchwork-Id: 13834176 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2063.outbound.protection.outlook.com [40.107.20.63]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BABD614036E for ; Mon, 14 Oct 2024 06:00:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.63 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728885647; cv=fail; b=WuEaC04LhH71+Zo6JENAVkIMxf8KC7g6JV5rTpPjFxaz8X8bnbeK3L70U0HjMnPUmC0F1dBU3b8Cordoi2yegbFkrlw1TrfLBYDewnUnDF8J1HHpmi9Di2zbL96EdQwQo/A6bOzjq3Gqdgu4EJ5iEB9XevglfylzYQrXFU3j80o= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728885647; c=relaxed/simple; bh=rOOwKzF71V2MHYYPif9n4eDxZEf3Z1fTWh5YQIIjav4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=b+T5se7NRB4xwvlsQLSv19CAyk4OPs/wgYzTOoGf9Ul5U+tjeDANAPzm4fRJbUbPRPYPkvPxZ3IVNbdNgWo2EdpQQhDOnNLaKpiCLZ69jsy7/6MJxI87Zw9m4tNVyZ1uzyNJ9CPRAzc1KnfIt6v5Uo6nuC7yJ9X2jzxf1v4yMwE= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=DrXeqW4y; arc=fail smtp.client-ip=40.107.20.63 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="DrXeqW4y" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=g9DKM2PAGoc5EH2GdnHRh++0qG33L42K06XGYjHIkL/rp3ktuIxX5abyLCDVx+lbRkjxKOLVxr1ZLtPw3nO+bfE0wtE35z6yMPWaYlAj8VN3Gv/zmSNO7759+RLaQKbnrbo4kfrqyL4BqVx/+DaitZCJzwFgwbAagtBkH2/u+OqXtq1nxQn6nlMrg6Xxoc7BrEUVPpcOgy+JM7VxIE+GKsq9g4l8sKC1StvlG4BPWAAWkJXAAb+D0fkjozhPOLO8LflALzeZ49s3ClltaI1tOXKBOgIQGa8Qcm6uszw7jvPlXqCfzdz7ep6UAu3JgJUmZqUwcQoyZleBKSLiuiUPlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=MEW+ck023C1R0wEnHSWTj2drmMrl5/32Ipeta6xg2yI=; b=I3pLm0aunJeFADpFkZOYyWPvPpUss9Ric9fK5PTJdwM6DCjtqVlQmZ0QaDWKnw4LDwxvujKSSlyThZNmPu4sNJE1GQbm0cTUbCGbDhOVBCdJKgY+Nr9C3L9Njo9cACNvWGaOShdp17MpwAn6L8Pbbsou0nhPQqkaoJHAY7ObU+9p+vPRNVyM7oh8eolaykD9BGtJ4zuWj0ad4EKIi77m2h5vb71PP5zzZXkzxwfER3mrUsaZddX9fVIWEcX/Rcw6Dfe/1SdEe30ua9YQm/gV0s2GjHlo9GZvpG3+uqWDJUwe+Uqov6PspIpzvVBE0qbd+cZQionGGSpNqL9OUCMjnA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MEW+ck023C1R0wEnHSWTj2drmMrl5/32Ipeta6xg2yI=; b=DrXeqW4yozTMksFF1jwxVdPOjw2QEiRxybyWmi0SBk2In/IWcJsmwttCQi2rzrxQREuzezLYuhSuyxfGcSpfJ2E80HQvBL7OIhTSxCSf3cEOlXuqx5K08QpCkx24UG63uFmbUN2Xt+wMmbOmwItmC0V/84GTMnyPuNBNNg3CFNYgUVyalDN4RGay1DtIcwp068DLNHzjJrmntVeUfllQlhcRrQUoKj85fe071VF5MCx5GWRY6sWU6BJ0YF71vJ1LEZKxiIFvN3DAeqYb1R3OIC1+3aOyhkymbgcU8ZzTfglVGFcsHIzPWk/MBBzrfip0Zel10+Y9ERmiS+9t56RV0A== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DU0PR04MB9496.eurprd04.prod.outlook.com (2603:10a6:10:32d::19) by PAXPR04MB8224.eurprd04.prod.outlook.com (2603:10a6:102:1cb::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26; Mon, 14 Oct 2024 06:00:40 +0000 Received: from DU0PR04MB9496.eurprd04.prod.outlook.com ([fe80::4fa3:7420:14ed:5334]) by DU0PR04MB9496.eurprd04.prod.outlook.com ([fe80::4fa3:7420:14ed:5334%7]) with mapi id 15.20.8048.020; Mon, 14 Oct 2024 06:00:40 +0000 From: haibo.chen@nxp.com To: adrian.hunter@intel.com, ulf.hansson@linaro.org, linux-mmc@vger.kernel.org Cc: imx@lists.linux.dev, haibo.chen@nxp.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, s32@nxp.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] mmc: sdhci-esdhc-imx: do not change to sleep pinctrl state in suspend if enable wakeup Date: Mon, 14 Oct 2024 14:01:30 +0800 Message-Id: <20241014060130.1162629-5-haibo.chen@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241014060130.1162629-1-haibo.chen@nxp.com> References: <20241014060130.1162629-1-haibo.chen@nxp.com> X-ClientProxiedBy: SI2PR06CA0011.apcprd06.prod.outlook.com (2603:1096:4:186::16) To DU0PR04MB9496.eurprd04.prod.outlook.com (2603:10a6:10:32d::19) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9496:EE_|PAXPR04MB8224:EE_ X-MS-Office365-Filtering-Correlation-Id: 9c41fabc-9305-4897-0918-08dcec158834 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|7416014|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: Aur5Owf93diMl1B6fs2wMDiqVo0+auyMxnjQj4qZkxBRLlx0OftoPXMX2unLqri1ijeDEZscN3sIgnJ4P9ws47SySOXNKc7Tw8970f7X9R8F3g+9SpbgMoM314KhzY/J7hGq44gfRmnL28F+nQDBTtNjcSJf5b3QHNOAXPI832W8b8drRlCiG1l8gR87KbBzc3QP8+GXDTZpXBt+HPJhZAxAkWUtR3+WjKBJQClVG+Mq3NPVR5isI+aij3nEo4hkADIQiEiUjg2USra8M+UPNeeJb1fiBePXt6+gKvPedaWShI2ORTSilZWueSwIE2QfRqnhmA3sTfn3RAhrL5D25POe4nr4IDWO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0PR04MB9496.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(7416014)(376014)(52116014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: PSG/rGY0w7+oR5llUDC3VTE8odkeM8GeP1+fjaTR9yyyGi2JrPl5fnOHj9u4hfT6Tm9NUWZiQQQnOSBG82B9caSoKH0YoKuuhy2guFYJrsKtJfyvQbw5+0JEOTJexn19k5S0FrBQNiDTd5cfNQ2euQaP8UudWXvkbgb60qlVZd+XI1dn7llGa5nUNRBaMW7x1iuie/GtaeL3ooOF0EnlJdMIOcEVV6wDJ5w/5WG+Rc8e3ruARO4zh2mA7N8RiOVI8v2c+ZCVSqK2oDtrIioga+Jgx9c6SlpC12sPg7rgj03UghLEJ2WgYBRTxtSQ4tgILw6IjxikpOL+Mgql/f+D8r5smm2yqvyp+3FVxpEvL3reKCAIvAk8E9yjTZ1KFVi4xIIkRXVhjGF6Oip8shbvCkNYpmIRTo2kYKsXsc9AcDuBXDXGT0WCCkJSfx28ZQWt+5cWUwjt75aYIEgdoWZJMZnXltcaqroPFcJ2cfo+jz2BK79AEKoV5Nqlw45z0xi1s9RzzWvxciVCpwQNp+x75YlY50FAegOCZ5oHyHsvlLTz8kR5Kkhwr6W3PZFkWOhwdtcdaPl1ds8m/FCN21FiFndA5zbQ7Z63AucPZzu3iNh6oJMLUFXE0EO/+i5hYcUcZTMo7DM0iRcZWM1gu2PDgpMIh+XEMomIyVdC267HlZ6TqCvnclq33F1Bxo3mQI16RaAImdUpClIVE4IcdWrxTHeDNSd3bjBkldsK42iWQfRPe7FYmZTJfx3uDInh/hpKSqR2xoHrL6A+kxuIRgmQ1RfuOsN1iFiRZ6VFpLrnuXo76qxbQBpMevfzrqO6PjpHIjutTlbX6V+hK79O0cCJqfEk4IzZeHeRMhg2Xju2mBUqtvpwUhhEvgT5tTlXXNyeqp0/xoBJ+aXpm+NdtNzaJL16xH+4i8L32WKUtndTG0cJIlvIVYHOmQIBItEP+R3Fp910YhV1wSTADGm0f5aEK3CpYOYDtodaM1/mrEJGw1tnsUamctXxcbePB06KHajYHlXVZLRmo+TKD12PXZPVVQ9FoVJRre4m1LE53UnQ+OnhP2qqBxef6dkliH3FEG9pf8ytDYRdtgghgL+w+jyuItxQnVSRi5SkVVukNpoJM/XRLHT1rUIxnqaJSdDQcUbCfxBpnTyQA8ibaDFoyr/RLTS259HFTvE1MkX+UZ2bvHWhUc4ezIosIc3kbfXMEp/7Ff+H055ga/kjW2rgY9wKqBuYkN+sRRu5AZ1eKaf0AvJdYBDHaHYEgQNrgG4/bm5cSPE70Rz9DkP7pOMM1PRjgB7fQ9BM5wizOfzRhi16QyrLboZ7uhH3iIFPIkSLLg3ayzDVnIkzWe9Te7ITivxFAGowkp0Kv0q1KaH0O2Ppw93hwRRxfi+8bClUrDWKYycl3gGQBTJ3wKZ8wFC/xQJq1tN4X24Tan7SY4O5GFbkFScJ7fH8Dp92gI0kajyY+0Ec0kw2oyr1YsJouUpWGUubg0YFwqKjXfzRdeWhwJuHYTetQ+bNOofyRQFEB6DlSp4RZCvLumvgrQ52SNC28gpAZ0MSyzQ+PA5u8DAHuuneJhlvgyKgjgdws+0Sur5KWDOp X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9c41fabc-9305-4897-0918-08dcec158834 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9496.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2024 06:00:40.5857 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: r875Lh6Zi/vchDxp8itrWhJp+w3WXoEybP1vBuwk08AMJm6DNr7oCDN1A/kMFiP0M8EYVvsKIOGtHQLpkX/pYA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8224 From: Haibo Chen pinctrl sleep state may config the pin mux to certain function to save power in system PM. But if usdhc is setting as wakeup source, like the card interrupt(SDIO) or card insert interrupt, it depends on the related pin mux configured to usdhc function pad. e.g. To support card interrupt(SDIO interrupt), it need the pin is configured as usdhc DATA[1] function pin. Find the issue on imx93-11x11-evk board, SDIO WiFi in band interrupt can't wakeup system because the pinctrl sleep state config the DATA[1] pin as GPIO function. Signed-off-by: Haibo Chen --- drivers/mmc/host/sdhci-esdhc-imx.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 4173967022d0..d4bb23c9e866 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -1969,9 +1969,19 @@ static int sdhci_esdhc_suspend(struct device *dev) dev_warn(dev, "Failed to enable irq wakeup\n"); } - ret = pinctrl_pm_select_sleep_state(dev); - if (ret) - return ret; + /* + * For the device which works as wakeup source, no need + * to change the pinctrl to sleep state. + * e.g. For SDIO device, the interrupt share with data pin, + * but the pinctrl sleep state may config the data pin to + * other function like GPIO function to save power in PM, + * which finally block the SDIO wakeup function. + */ + if (!device_may_wakeup(dev) || !host->irq_wake_enabled) { + ret = pinctrl_pm_select_sleep_state(dev); + if (ret) + return ret; + } ret = mmc_gpio_set_cd_wake(host->mmc, true);