diff mbox

DRAFT: shdci: allows custom wakeup irqs for runtime PM

Message ID 1458921903-11133-2-git-send-email-ludovic.desroches@atmel.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Ludovic Desroches March 25, 2016, 4:05 p.m. UTC
Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
---
 drivers/mmc/host/sdhci-of-at91.c | 36 ++++++++++--------------------------
 drivers/mmc/host/sdhci.c         | 12 +++++-------
 drivers/mmc/host/sdhci.h         |  2 +-
 3 files changed, 16 insertions(+), 34 deletions(-)

Comments

kernel test robot March 25, 2016, 4:46 p.m. UTC | #1
Hi Ludovic,

[auto build test ERROR on ulf.hansson-mmc/next]
[also build test ERROR on v4.5 next-20160324]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Ludovic-Desroches/DRAFT-shdci-allows-custom-wakeup-irqs-for-runtime-PM/20160326-000948
base:   https://git.linaro.org/people/ulf.hansson/mmc next
config: x86_64-allyesdebian (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/mmc/host/sdhci-pci-core.c: In function 'sdhci_pci_runtime_suspend':
>> drivers/mmc/host/sdhci-pci-core.c:1497:9: error: too few arguments to function 'sdhci_runtime_suspend_host'
      ret = sdhci_runtime_suspend_host(slot->host);
            ^
   In file included from drivers/mmc/host/sdhci-pci-core.c:31:0:
   drivers/mmc/host/sdhci.h:671:12: note: declared here
    extern int sdhci_runtime_suspend_host(struct sdhci_host *host, u32 wakeup_irqs);
               ^

vim +/sdhci_runtime_suspend_host +1497 drivers/mmc/host/sdhci-pci-core.c

66fd8ad5 drivers/mmc/host/sdhci-pci.c Adrian Hunter 2011-10-03  1491  
66fd8ad5 drivers/mmc/host/sdhci-pci.c Adrian Hunter 2011-10-03  1492  	for (i = 0; i < chip->num_slots; i++) {
66fd8ad5 drivers/mmc/host/sdhci-pci.c Adrian Hunter 2011-10-03  1493  		slot = chip->slots[i];
66fd8ad5 drivers/mmc/host/sdhci-pci.c Adrian Hunter 2011-10-03  1494  		if (!slot)
66fd8ad5 drivers/mmc/host/sdhci-pci.c Adrian Hunter 2011-10-03  1495  			continue;
66fd8ad5 drivers/mmc/host/sdhci-pci.c Adrian Hunter 2011-10-03  1496  
66fd8ad5 drivers/mmc/host/sdhci-pci.c Adrian Hunter 2011-10-03 @1497  		ret = sdhci_runtime_suspend_host(slot->host);
66fd8ad5 drivers/mmc/host/sdhci-pci.c Adrian Hunter 2011-10-03  1498  
b678b91f drivers/mmc/host/sdhci-pci.c Axel Lin      2011-12-03  1499  		if (ret)
b678b91f drivers/mmc/host/sdhci-pci.c Axel Lin      2011-12-03  1500  			goto err_pci_runtime_suspend;

:::::: The code at line 1497 was first introduced by commit
:::::: 66fd8ad5100b5003046aa744a4f12fa31bb831f9 mmc: sdhci-pci: add runtime pm support

:::::: TO: Adrian Hunter <adrian.hunter@intel.com>
:::::: CC: Chris Ball <cjb@laptop.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot March 25, 2016, 4:50 p.m. UTC | #2
Hi Ludovic,

[auto build test ERROR on ulf.hansson-mmc/next]
[also build test ERROR on v4.5 next-20160324]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Ludovic-Desroches/DRAFT-shdci-allows-custom-wakeup-irqs-for-runtime-PM/20160326-000948
base:   https://git.linaro.org/people/ulf.hansson/mmc next
config: x86_64-rhel (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All error/warnings (new ones prefixed by >>):

   drivers/mmc/host/sdhci-acpi.c: In function 'sdhci_acpi_runtime_suspend':
>> drivers/mmc/host/sdhci-acpi.c:466:9: error: too few arguments to function 'sdhci_runtime_suspend_host'
     return sdhci_runtime_suspend_host(c->host);
            ^
   In file included from drivers/mmc/host/sdhci-acpi.c:44:0:
   drivers/mmc/host/sdhci.h:671:12: note: declared here
    extern int sdhci_runtime_suspend_host(struct sdhci_host *host, u32 wakeup_irqs);
               ^
>> drivers/mmc/host/sdhci-acpi.c:467:1: warning: control reaches end of non-void function [-Wreturn-type]
    }
    ^

vim +/sdhci_runtime_suspend_host +466 drivers/mmc/host/sdhci-acpi.c

162d6f98 Rafael J. Wysocki 2014-12-05  460  #ifdef CONFIG_PM
c4e05037 Adrian Hunter     2012-11-23  461  
c4e05037 Adrian Hunter     2012-11-23  462  static int sdhci_acpi_runtime_suspend(struct device *dev)
c4e05037 Adrian Hunter     2012-11-23  463  {
c4e05037 Adrian Hunter     2012-11-23  464  	struct sdhci_acpi_host *c = dev_get_drvdata(dev);
c4e05037 Adrian Hunter     2012-11-23  465  
c4e05037 Adrian Hunter     2012-11-23 @466  	return sdhci_runtime_suspend_host(c->host);
c4e05037 Adrian Hunter     2012-11-23 @467  }
c4e05037 Adrian Hunter     2012-11-23  468  
c4e05037 Adrian Hunter     2012-11-23  469  static int sdhci_acpi_runtime_resume(struct device *dev)
c4e05037 Adrian Hunter     2012-11-23  470  {

:::::: The code at line 466 was first introduced by commit
:::::: c4e050376c69bb9d67895842665264df2a2004d9 mmc: sdhci-acpi: add SDHCI ACPI driver

:::::: TO: Adrian Hunter <adrian.hunter@intel.com>
:::::: CC: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot March 25, 2016, 5:12 p.m. UTC | #3
Hi Ludovic,

[auto build test WARNING on ulf.hansson-mmc/next]
[also build test WARNING on v4.5 next-20160324]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Ludovic-Desroches/DRAFT-shdci-allows-custom-wakeup-irqs-for-runtime-PM/20160326-000948
base:   https://git.linaro.org/people/ulf.hansson/mmc next
reproduce:
        # apt-get install sparse
        make ARCH=x86_64 allmodconfig
        make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

   include/linux/compiler.h:228:8: sparse: attribute 'no_sanitize_address': unknown attribute
>> drivers/mmc/host/sdhci-pci-core.c:1497:49: sparse: not enough arguments for function sdhci_runtime_suspend_host
   drivers/mmc/host/sdhci-pci-core.c: In function 'sdhci_pci_runtime_suspend':
   drivers/mmc/host/sdhci-pci-core.c:1497:9: error: too few arguments to function 'sdhci_runtime_suspend_host'
      ret = sdhci_runtime_suspend_host(slot->host);
            ^
   In file included from drivers/mmc/host/sdhci-pci-core.c:31:0:
   drivers/mmc/host/sdhci.h:671:12: note: declared here
    extern int sdhci_runtime_suspend_host(struct sdhci_host *host, u32 wakeup_irqs);
               ^
--
   include/linux/compiler.h:228:8: sparse: attribute 'no_sanitize_address': unknown attribute
>> drivers/mmc/host/sdhci-acpi.c:466:42: sparse: not enough arguments for function sdhci_runtime_suspend_host
   drivers/mmc/host/sdhci-acpi.c: In function 'sdhci_acpi_runtime_suspend':
   drivers/mmc/host/sdhci-acpi.c:466:9: error: too few arguments to function 'sdhci_runtime_suspend_host'
     return sdhci_runtime_suspend_host(c->host);
            ^
   In file included from drivers/mmc/host/sdhci-acpi.c:44:0:
   drivers/mmc/host/sdhci.h:671:12: note: declared here
    extern int sdhci_runtime_suspend_host(struct sdhci_host *host, u32 wakeup_irqs);
               ^
   drivers/mmc/host/sdhci-acpi.c:467:1: warning: control reaches end of non-void function [-Wreturn-type]
    }
    ^
--
   include/linux/compiler.h:228:8: sparse: attribute 'no_sanitize_address': unknown attribute
>> drivers/mmc/host/sdhci-pxav3.c:539:41: sparse: not enough arguments for function sdhci_runtime_suspend_host
   drivers/mmc/host/sdhci-pxav3.c: In function 'sdhci_pxav3_runtime_suspend':
   drivers/mmc/host/sdhci-pxav3.c:539:8: error: too few arguments to function 'sdhci_runtime_suspend_host'
     ret = sdhci_runtime_suspend_host(host);
           ^
   In file included from drivers/mmc/host/sdhci-pxav3.c:39:0:
   drivers/mmc/host/sdhci.h:671:12: note: declared here
    extern int sdhci_runtime_suspend_host(struct sdhci_host *host, u32 wakeup_irqs);
               ^

vim +1497 drivers/mmc/host/sdhci-pci-core.c

66fd8ad5 drivers/mmc/host/sdhci-pci.c      Adrian Hunter 2011-10-03  1481  static int sdhci_pci_runtime_suspend(struct device *dev)
66fd8ad5 drivers/mmc/host/sdhci-pci.c      Adrian Hunter 2011-10-03  1482  {
923a231c drivers/mmc/host/sdhci-pci-core.c Geliang Tang  2015-12-27  1483  	struct pci_dev *pdev = to_pci_dev(dev);
66fd8ad5 drivers/mmc/host/sdhci-pci.c      Adrian Hunter 2011-10-03  1484  	struct sdhci_pci_chip *chip;
66fd8ad5 drivers/mmc/host/sdhci-pci.c      Adrian Hunter 2011-10-03  1485  	struct sdhci_pci_slot *slot;
66fd8ad5 drivers/mmc/host/sdhci-pci.c      Adrian Hunter 2011-10-03  1486  	int i, ret;
66fd8ad5 drivers/mmc/host/sdhci-pci.c      Adrian Hunter 2011-10-03  1487  
66fd8ad5 drivers/mmc/host/sdhci-pci.c      Adrian Hunter 2011-10-03  1488  	chip = pci_get_drvdata(pdev);
66fd8ad5 drivers/mmc/host/sdhci-pci.c      Adrian Hunter 2011-10-03  1489  	if (!chip)
66fd8ad5 drivers/mmc/host/sdhci-pci.c      Adrian Hunter 2011-10-03  1490  		return 0;
66fd8ad5 drivers/mmc/host/sdhci-pci.c      Adrian Hunter 2011-10-03  1491  
66fd8ad5 drivers/mmc/host/sdhci-pci.c      Adrian Hunter 2011-10-03  1492  	for (i = 0; i < chip->num_slots; i++) {
66fd8ad5 drivers/mmc/host/sdhci-pci.c      Adrian Hunter 2011-10-03  1493  		slot = chip->slots[i];
66fd8ad5 drivers/mmc/host/sdhci-pci.c      Adrian Hunter 2011-10-03  1494  		if (!slot)
66fd8ad5 drivers/mmc/host/sdhci-pci.c      Adrian Hunter 2011-10-03  1495  			continue;
66fd8ad5 drivers/mmc/host/sdhci-pci.c      Adrian Hunter 2011-10-03  1496  
66fd8ad5 drivers/mmc/host/sdhci-pci.c      Adrian Hunter 2011-10-03 @1497  		ret = sdhci_runtime_suspend_host(slot->host);
66fd8ad5 drivers/mmc/host/sdhci-pci.c      Adrian Hunter 2011-10-03  1498  
b678b91f drivers/mmc/host/sdhci-pci.c      Axel Lin      2011-12-03  1499  		if (ret)
b678b91f drivers/mmc/host/sdhci-pci.c      Axel Lin      2011-12-03  1500  			goto err_pci_runtime_suspend;
66fd8ad5 drivers/mmc/host/sdhci-pci.c      Adrian Hunter 2011-10-03  1501  	}
66fd8ad5 drivers/mmc/host/sdhci-pci.c      Adrian Hunter 2011-10-03  1502  
66fd8ad5 drivers/mmc/host/sdhci-pci.c      Adrian Hunter 2011-10-03  1503  	if (chip->fixes && chip->fixes->suspend) {
29495aa0 drivers/mmc/host/sdhci-pci.c      Manuel Lauss  2011-11-03  1504  		ret = chip->fixes->suspend(chip);
b678b91f drivers/mmc/host/sdhci-pci.c      Axel Lin      2011-12-03  1505  		if (ret)

:::::: The code at line 1497 was first introduced by commit
:::::: 66fd8ad5100b5003046aa744a4f12fa31bb831f9 mmc: sdhci-pci: add runtime pm support

:::::: TO: Adrian Hunter <adrian.hunter@intel.com>
:::::: CC: Chris Ball <cjb@laptop.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
kernel test robot March 25, 2016, 5:27 p.m. UTC | #4
Hi Ludovic,

[auto build test ERROR on ulf.hansson-mmc/next]
[also build test ERROR on v4.5 next-20160324]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Ludovic-Desroches/DRAFT-shdci-allows-custom-wakeup-irqs-for-runtime-PM/20160326-000948
base:   https://git.linaro.org/people/ulf.hansson/mmc next
config: i386-allmodconfig (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   drivers/mmc/host/sdhci-pxav3.c: In function 'sdhci_pxav3_runtime_suspend':
>> drivers/mmc/host/sdhci-pxav3.c:539:8: error: too few arguments to function 'sdhci_runtime_suspend_host'
     ret = sdhci_runtime_suspend_host(host);
           ^
   In file included from drivers/mmc/host/sdhci-pxav3.c:39:0:
   drivers/mmc/host/sdhci.h:671:12: note: declared here
    extern int sdhci_runtime_suspend_host(struct sdhci_host *host, u32 wakeup_irqs);
               ^

vim +/sdhci_runtime_suspend_host +539 drivers/mmc/host/sdhci-pxav3.c

bb691ae4 Kevin Liu     2013-02-01  533  {
bb691ae4 Kevin Liu     2013-02-01  534  	struct sdhci_host *host = dev_get_drvdata(dev);
bb691ae4 Kevin Liu     2013-02-01  535  	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
f599da40 Jisheng Zhang 2016-02-16  536  	struct sdhci_pxa *pxa = sdhci_pltfm_priv(pltfm_host);
3bb10f60 Jisheng Zhang 2015-01-23  537  	int ret;
bb691ae4 Kevin Liu     2013-02-01  538  
3bb10f60 Jisheng Zhang 2015-01-23 @539  	ret = sdhci_runtime_suspend_host(host);
3bb10f60 Jisheng Zhang 2015-01-23  540  	if (ret)
3bb10f60 Jisheng Zhang 2015-01-23  541  		return ret;
bb691ae4 Kevin Liu     2013-02-01  542  

:::::: The code at line 539 was first introduced by commit
:::::: 3bb10f60933e84abfe2be69f60b3486f9b96348b mmc: sdhci-pxav3: fix race between runtime pm and irq

:::::: TO: Jisheng Zhang <jszhang@marvell.com>
:::::: CC: Ulf Hansson <ulf.hansson@linaro.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
index 2703aa9..d70bb7a 100644
--- a/drivers/mmc/host/sdhci-of-at91.c
+++ b/drivers/mmc/host/sdhci-of-at91.c
@@ -62,12 +62,14 @@  static int sdhci_at91_runtime_suspend(struct device *dev)
 	struct sdhci_at91_priv *priv = sdhci_pltfm_priv(pltfm_host);
 	int ret;
 
-	ret = sdhci_runtime_suspend_host(host);
+	ret = sdhci_runtime_suspend_host(host, SDHCI_INT_CARD_INT | SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE);
 
 	clk_disable_unprepare(priv->gck);
-	clk_disable_unprepare(priv->hclock);
+	//clk_disable_unprepare(priv->hclock);
 	clk_disable_unprepare(priv->mainck);
 
+	printk("sdhci_at91_runtime_suspend\n");
+
 	return ret;
 }
 
@@ -78,17 +80,18 @@  static int sdhci_at91_runtime_resume(struct device *dev)
 	struct sdhci_at91_priv *priv = sdhci_pltfm_priv(pltfm_host);
 	int ret;
 
+	printk("sdhci_at91_runtime_resume\n");
 	ret = clk_prepare_enable(priv->mainck);
 	if (ret) {
 		dev_err(dev, "can't enable mainck\n");
 		return ret;
 	}
 
-	ret = clk_prepare_enable(priv->hclock);
-	if (ret) {
-		dev_err(dev, "can't enable hclock\n");
-		return ret;
-	}
+	//ret = clk_prepare_enable(priv->hclock);
+	//if (ret) {
+	//	dev_err(dev, "can't enable hclock\n");
+	//	return ret;
+	//}
 
 	ret = clk_prepare_enable(priv->gck);
 	if (ret) {
@@ -205,25 +208,6 @@  static int sdhci_at91_probe(struct platform_device *pdev)
 	if (ret)
 		goto pm_runtime_disable;
 
-	/*
-	 * When calling sdhci_runtime_suspend_host(), the sdhci layer makes
-	 * the assumption that all the clocks of the controller are disabled.
-	 * It means we can't get irq from it when it is runtime suspended.
-	 * For that reason, it is not planned to wake-up on a card detect irq
-	 * from the controller.
-	 * If we want to use runtime PM and to be able to wake-up on card
-	 * insertion, we have to use a GPIO for the card detection or we can
-	 * use polling. Be aware that using polling will resume/suspend the
-	 * controller between each attempt.
-	 * Disable SDHCI_QUIRK_BROKEN_CARD_DETECTION to be sure nobody tries
-	 * to enable polling via device tree with broken-cd property.
-	 */
-	if (!(host->mmc->caps & MMC_CAP_NONREMOVABLE) &&
-	    IS_ERR_VALUE(mmc_gpio_get_cd(host->mmc))) {
-		host->mmc->caps |= MMC_CAP_NEEDS_POLL;
-		host->quirks &= ~SDHCI_QUIRK_BROKEN_CARD_DETECTION;
-	}
-
 	pm_runtime_put_autosuspend(&pdev->dev);
 
 	return 0;
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 8670f16..619a64a 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2467,11 +2467,6 @@  static irqreturn_t sdhci_irq(int irq, void *dev_id)
 
 	spin_lock(&host->lock);
 
-	if (host->runtime_suspended && !sdhci_sdio_irq_enabled(host)) {
-		spin_unlock(&host->lock);
-		return IRQ_NONE;
-	}
-
 	intmask = sdhci_readl(host, SDHCI_INT_STATUS);
 	if (!intmask || intmask == 0xffffffff) {
 		result = IRQ_NONE;
@@ -2709,7 +2704,7 @@  static void sdhci_runtime_pm_bus_off(struct sdhci_host *host)
 	pm_runtime_put_noidle(host->mmc->parent);
 }
 
-int sdhci_runtime_suspend_host(struct sdhci_host *host)
+int sdhci_runtime_suspend_host(struct sdhci_host *host, u32 wakeup_irqs)
 {
 	unsigned long flags;
 
@@ -2717,7 +2712,10 @@  int sdhci_runtime_suspend_host(struct sdhci_host *host)
 	mmc_retune_needed(host->mmc);
 
 	spin_lock_irqsave(&host->lock, flags);
-	host->ier &= SDHCI_INT_CARD_INT;
+	if (wakeup_irqs)
+		host->ier = wakeup_irqs;
+	else
+		host->ier &= SDHCI_INT_CARD_INT;
 	sdhci_writel(host, host->ier, SDHCI_INT_ENABLE);
 	sdhci_writel(host, host->ier, SDHCI_SIGNAL_ENABLE);
 	spin_unlock_irqrestore(&host->lock, flags);
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index 3bd2803..b932e15 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -668,7 +668,7 @@  void sdhci_set_uhs_signaling(struct sdhci_host *host, unsigned timing);
 extern int sdhci_suspend_host(struct sdhci_host *host);
 extern int sdhci_resume_host(struct sdhci_host *host);
 extern void sdhci_enable_irq_wakeups(struct sdhci_host *host);
-extern int sdhci_runtime_suspend_host(struct sdhci_host *host);
+extern int sdhci_runtime_suspend_host(struct sdhci_host *host, u32 wakeup_irqs);
 extern int sdhci_runtime_resume_host(struct sdhci_host *host);
 #endif