Re: [PATCH v2 2/3] sdhci-pci : Enable runtime PM support

From: Chris Ball
Date: Mon Feb 21 2011 - 15:45:57 EST


Hi Pierre,

On Sun, Feb 13, 2011 at 11:42:01AM +0100, Pierre Tardy wrote:
> > [   10.892280] sdhci-pci 0000:17:00.0: Unbalanced pm_runtime_enable!
>
> I never have seen this before. I'm not testing those patches on
> mmc-next, as our platform is not totally upstream yet, and do not boot
> on 2.6.37+ based kernel.
> However, we backported the pm_runtime patches from 2.6.37. Is there
> some differences in very latest patches on default enablement of
> runtime_pm?

It's getting enabled by drivers/pci/pci-driver.c:local_pci_probe(),
before the sdhci-pci probe function runs. local_pci_probe() does:

/* Unbound PCI devices are always set to disabled and suspended.
* During probe, the device is set to enabled and active and the
* usage count is incremented. If the driver supports runtime PM,
* it should call pm_runtime_put_noidle() in its probe routine and
* pm_runtime_get_noresume() in its remove routine.
*/
pm_runtime_get_noresume(dev);
pm_runtime_set_active(dev);
pm_runtime_enable(dev);

and then the "Unbalanced pm_runtime_enable!" message appears when
sdhci_pci_probe() calls pm_runtime_enable() for the second time.

> > I then removed the card and reinserted it, but there's no dmesg output
> > related to the reinsert, only to the card removal:
> >
> > [   65.381047] mmc0: card d555 removed
> >
> > So, card insertion is broken.  I then did rmmod sdhci-pci && modprobe
> > sdhci-pci, and it picked up the card again.
>
> So what you have here is non working card-detection when device is in PCI_D3.
> This sounds like a HW limitation in you platform.
>
> D3 is originally meant for suspend to ram, so it sounds logic that
> some HW wont support wake on card detect.
> it sounds like we need a SDHCI_RUNTIME_PM_CAP, so that we can properly
> describe which HW can be safely put D3 at runtime.
> Also, maybe on some HW, D1 will support wake on card detect. I dont
> know how can the driver hint pci subsystem that it should go D1 rather
> than D3 in the runtime_pm flow.
> Maybe Rafael can advice on this.

The controller advertises the ability to generate PME wakeups from D3
in its PCI capabilities; perhaps we just aren't programming it properly.
I don't see anything in your patch that would set SDHCI wakeup bits or
unmask card insertion/removal IRQs -- maybe that could be it?

Thanks,

--
Chris Ball <cjb@xxxxxxxxxx> <http://printf.net/>
One Laptop Per Child
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/