Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3852386pxb; Tue, 17 Nov 2020 05:24:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJwA8Cq9Kdy1p7+O7qmS7OYFKidynplWWn8R0/Xz52gKxrLI6mpOFjuJbx4CfhCAiRkQTHJe X-Received: by 2002:a50:9e8a:: with SMTP id a10mr21341382edf.150.1605619497173; Tue, 17 Nov 2020 05:24:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605619497; cv=none; d=google.com; s=arc-20160816; b=sVhva/YBzGyQvvImiU4dFx76DPrvntxxzcdvNyZ++7Jp5d2P03Q6VWH5ttg0ZG262Q t6MI/Co/x5/stDymETg0h5NMrkNfh602jzUc7/3dVfWrqA0BQstoHP0ruCrWJcbbiybO cVBZevoLEonSyKUnMKiD+znuKYRz6EMTfi9uhRGGqY9y3/Hqt+lamVNiVhPTBuVoTZwA tUbBc6eq+ouW9xEQIOB2Wu+y4AehFR/nqHcdekObOJ5nErTFX6PCQQdh11Gecu9wETuL kXvYLp0RuDKgSCbpoEGF2KBpVfA/mB4wc2+u7TMXAee8/9CeON6Bb7OvmCojLh4RM0W6 bHmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vPmMC4x/zurdA9Lf8RMOU+PqkznG5ZoEFjU3yzznPfc=; b=eN1CaO8S668qMrxOyKAkJoFWrx2MPaBw8C7N3tfktFUj+cF53lF6SeR6kYBdn2kuvv m/TcvbvpOMzIMrJZytSeBztFkxCIYIFbnlLhZOFil9rFT46u52hubRJtqQA0udUEAOw1 KHlgqU7zMvq74ASJB5IRU26m0yVaPRDGowJmj985V69YXJL6kUR1WW0p928iiXq7vyl7 +I4oA3PvYe9BRn0WTAJehWJNFSCuIdQrhgwFswj8zZC1la7WI6/bF9wkVmVXQFNbp+py cVFnCq5P+gRQAaJKCsYkeSCMluzGCy9/arc5uz02jTwrzr5YPR53ZHb50II5Mbcey6Fr oU0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GOat9034; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q1si13982003edc.21.2020.11.17.05.24.34; Tue, 17 Nov 2020 05:24:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GOat9034; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731198AbgKQNWr (ORCPT + 99 others); Tue, 17 Nov 2020 08:22:47 -0500 Received: from mail.kernel.org ([198.145.29.99]:54422 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730806AbgKQNUx (ORCPT ); Tue, 17 Nov 2020 08:20:53 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id ACBB6246A5; Tue, 17 Nov 2020 13:20:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605619251; bh=QgUQ5NcIl8C+hQrGgM2TC+BjeOwK1xrU9BSHfieixZI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GOat90344d9reRyhJPhm2ccB9UV+7sjBNtDGxq2GnMv/L8ltE4DfSAjh+MgzTfX4B h+ehyQs1RYRtQaPieuxCPdRtmbVv/pDo4hd9GcutCyfjq0YLesseIXVsTrYeMj+T7p IIKXQB7xU4VLdEZMuTE0IKLZPUeS7mjwjY8Zfgto= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chunyan Zhang , Baolin Wang , Chunyan Zhang , Lee Jones Subject: [PATCH 4.19 049/101] mfd: sprd: Add wakeup capability for PMIC IRQ Date: Tue, 17 Nov 2020 14:05:16 +0100 Message-Id: <20201117122115.483287415@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122113.128215851@linuxfoundation.org> References: <20201117122113.128215851@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Baolin Wang commit a75bfc824a2d33f57ebdc003bfe6b7a9e11e9cb9 upstream. When changing to use suspend-to-idle to save power, the PMIC irq can not wakeup the system due to lack of wakeup capability, which will cause the sub-irqs (such as power key) of the PMIC can not wake up the system. Thus we can add the wakeup capability for PMIC irq to solve this issue, as well as removing the IRQF_NO_SUSPEND flag to allow PMIC irq to be a wakeup source. Reported-by: Chunyan Zhang Signed-off-by: Baolin Wang Tested-by: Chunyan Zhang Signed-off-by: Lee Jones Signed-off-by: Greg Kroah-Hartman --- drivers/mfd/sprd-sc27xx-spi.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) --- a/drivers/mfd/sprd-sc27xx-spi.c +++ b/drivers/mfd/sprd-sc27xx-spi.c @@ -212,7 +212,7 @@ static int sprd_pmic_probe(struct spi_de } ret = devm_regmap_add_irq_chip(&spi->dev, ddata->regmap, ddata->irq, - IRQF_ONESHOT | IRQF_NO_SUSPEND, 0, + IRQF_ONESHOT, 0, &ddata->irq_chip, &ddata->irq_data); if (ret) { dev_err(&spi->dev, "Failed to add PMIC irq chip %d\n", ret); @@ -228,9 +228,34 @@ static int sprd_pmic_probe(struct spi_de return ret; } + device_init_wakeup(&spi->dev, true); return 0; } +#ifdef CONFIG_PM_SLEEP +static int sprd_pmic_suspend(struct device *dev) +{ + struct sprd_pmic *ddata = dev_get_drvdata(dev); + + if (device_may_wakeup(dev)) + enable_irq_wake(ddata->irq); + + return 0; +} + +static int sprd_pmic_resume(struct device *dev) +{ + struct sprd_pmic *ddata = dev_get_drvdata(dev); + + if (device_may_wakeup(dev)) + disable_irq_wake(ddata->irq); + + return 0; +} +#endif + +static SIMPLE_DEV_PM_OPS(sprd_pmic_pm_ops, sprd_pmic_suspend, sprd_pmic_resume); + static const struct of_device_id sprd_pmic_match[] = { { .compatible = "sprd,sc2731", .data = &sc2731_data }, {}, @@ -242,6 +267,7 @@ static struct spi_driver sprd_pmic_drive .name = "sc27xx-pmic", .bus = &spi_bus_type, .of_match_table = sprd_pmic_match, + .pm = &sprd_pmic_pm_ops, }, .probe = sprd_pmic_probe, };