Skip to content

Commit

Permalink
mmc: rtsx: Let MMC core handle runtime PM
Browse files Browse the repository at this point in the history
BugLink: https://bugs.launchpad.net/bugs/1963615

Since MMC core handles runtime PM reference counting, we can avoid doing
redundant runtime PM work in the driver. That means the only thing
commit 5b4258f ("misc: rtsx: rts5249 support runtime PM") misses is
to always enable runtime PM, to let its parent driver enable ASPM in the
runtime idle routine.

Fixes: 7499b52 ("mmc: rtsx: Use pm_runtime_{get,put}() to handle runtime PM")
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Link: https://lore.kernel.org/r/20220216055435.2335297-1-kai.heng.feng@canonical.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 7570fb4 linux-next)
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Signed-off-by: Timo Aaltonen <timo.aaltonen@canonical.com>
  • Loading branch information
Kai-Heng Feng authored and Timo Aaltonen committed Mar 14, 2022
1 parent cfa6974 commit 09214ad
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions drivers/mmc/host/rtsx_pci_sdmmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,6 @@ static void sd_request(struct work_struct *work)
}

mutex_lock(&pcr->pcr_mutex);
pm_runtime_get_sync(dev);

rtsx_pci_start_run(pcr);

Expand Down Expand Up @@ -860,8 +859,6 @@ static void sd_request(struct work_struct *work)
data->bytes_xfered = data->blocks * data->blksz;
}

pm_runtime_mark_last_busy(dev);
pm_runtime_put_autosuspend(dev);
mutex_unlock(&pcr->pcr_mutex);

finish:
Expand Down Expand Up @@ -1093,7 +1090,6 @@ static void sdmmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
return;

mutex_lock(&pcr->pcr_mutex);
pm_runtime_get_sync(dev);

rtsx_pci_start_run(pcr);

Expand Down Expand Up @@ -1127,8 +1123,6 @@ static void sdmmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
rtsx_pci_switch_clock(pcr, ios->clock, host->ssc_depth,
host->initial_mode, host->double_clk, host->vpclk);

pm_runtime_mark_last_busy(dev);
pm_runtime_put_autosuspend(dev);
mutex_unlock(&pcr->pcr_mutex);
}

Expand All @@ -1144,7 +1138,6 @@ static int sdmmc_get_ro(struct mmc_host *mmc)
return -ENOMEDIUM;

mutex_lock(&pcr->pcr_mutex);
pm_runtime_get_sync(dev);

rtsx_pci_start_run(pcr);

Expand All @@ -1154,8 +1147,6 @@ static int sdmmc_get_ro(struct mmc_host *mmc)
if (val & SD_WRITE_PROTECT)
ro = 1;

pm_runtime_mark_last_busy(dev);
pm_runtime_put_autosuspend(dev);
mutex_unlock(&pcr->pcr_mutex);

return ro;
Expand All @@ -1173,7 +1164,6 @@ static int sdmmc_get_cd(struct mmc_host *mmc)
return cd;

mutex_lock(&pcr->pcr_mutex);
pm_runtime_get_sync(dev);

rtsx_pci_start_run(pcr);

Expand All @@ -1183,8 +1173,6 @@ static int sdmmc_get_cd(struct mmc_host *mmc)
if (val & SD_EXIST)
cd = 1;

pm_runtime_mark_last_busy(dev);
pm_runtime_put_autosuspend(dev);
mutex_unlock(&pcr->pcr_mutex);

return cd;
Expand Down Expand Up @@ -1282,7 +1270,6 @@ static int sdmmc_switch_voltage(struct mmc_host *mmc, struct mmc_ios *ios)
return err;

mutex_lock(&pcr->pcr_mutex);
pm_runtime_get_sync(dev);

rtsx_pci_start_run(pcr);

Expand Down Expand Up @@ -1312,8 +1299,6 @@ static int sdmmc_switch_voltage(struct mmc_host *mmc, struct mmc_ios *ios)
err = rtsx_pci_write_register(pcr, SD_BUS_STAT,
SD_CLK_TOGGLE_EN | SD_CLK_FORCE_STOP, 0);

pm_runtime_mark_last_busy(dev);
pm_runtime_put_autosuspend(dev);
mutex_unlock(&pcr->pcr_mutex);

return err;
Expand All @@ -1334,7 +1319,6 @@ static int sdmmc_execute_tuning(struct mmc_host *mmc, u32 opcode)
return err;

mutex_lock(&pcr->pcr_mutex);
pm_runtime_get_sync(dev);

rtsx_pci_start_run(pcr);

Expand Down Expand Up @@ -1367,8 +1351,6 @@ static int sdmmc_execute_tuning(struct mmc_host *mmc, u32 opcode)
err = sd_change_phase(host, DDR50_RX_PHASE(pcr), true);

out:
pm_runtime_mark_last_busy(dev);
pm_runtime_put_autosuspend(dev);
mutex_unlock(&pcr->pcr_mutex);

return err;
Expand Down

0 comments on commit 09214ad

Please sign in to comment.