Re: [PATCH] mmc: sdio: reset card during power_restore

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>> So wlan probe function should be called for re-downloading, is it be
>> achieved by calling pm_runtime_get_sync and mmc_power_restore_host?
>
> Not really;
>
> I assume you refer to libertas_sdio, which AFAICT, is built to power
> on the device (and configure it) on ->probe(), and then power it off
> on ->remove().
> It then seems that this model was extended to support suspend/resume
> by asking the MMC core to ->remove() the card on suspend, and then
> relying on it to re-detect and re-add the card on resume, which will
> trigger libertas' ->probe() again.
>
> IMHO this model is a little awkward; as you can see, powering on/off
> the chip requires re-probing the driver.
>
> Take a look how mac80211 drivers (and wl12xx in particular) behave:
> they are powered on (and firmware is downloaded) when the user brings
> the wlan0 interface up, and then powered off when the wlan interface
> is brought down.
>
> The runtime PM API is only being used to control the power to the
> device, but downloading the firmware and doing driver-specific
> configuration is up to the driver to do.

Thanks Ohad for your kind explanation.

However still not fully understand how to call ->remove to power off
wlan, using suspend system looks to me is only test method, which
counting on bus_ops->suspend returns -ENOSYS.

What we do before is
1. From user space use rfkill unblock wifi, or echo on/off > "/sys/~"
to enable/disable wlan power, which could be replaced by pm_runtime of
course.
2. Explicitly call mmc_detect_change,
when power off, mmc_rescan -> bus_ops->detect(host) -> mmc_select_card
fail -> mmc_sdio_remove;
when power on, mmc_rescan ->  mmc_attach_sdio->wlan probe.

However, this is not workable if using mmc_power_save_host, since
bus_ops->detect not workable after power off card.
1. detect is only for !MMC_CAP_NONREMOVABLE
2. In mmc_sdio_detect, power is provided before mmc_select_card via
pm_runtime_get_sync.
3. Most important, mmc_power_save_host->mmc_power_off->set clk=0 via
set_ios, so controller will no response and timeout.

How to enable/disable mac80211 at runtime from user space?
In wl12xx/debugfs.c, gpio_power_write->wl1271_sdio_power_off? still
unclear how remove is called.

Thanks
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux