diff options
author | Pavan Kunapuli <pkunapuli@nvidia.com> | 2013-04-04 17:49:28 +0530 |
---|---|---|
committer | Mrutyunjay Sawant <msawant@nvidia.com> | 2013-04-10 03:50:16 -0700 |
commit | 3786765f78811bd495732e05fe050f754ddd1884 (patch) | |
tree | 6deda2420d285813715ad054e47e4bef29b74759 /drivers/mmc | |
parent | d93ba8bd5d993d51024571a25a2d9d1649752bbf (diff) |
mmc: sdhci: Support MMC freq scaling governor
Added the functions to be used for determining the device frequency
when mmc frequency is enabled. An optional callback is added to be
used by the platform drivers for custom algorithms.
Bug 1238045
Bug 1044607
Change-Id: I6ef56ec4dbdf35da4deef1a09536b9f77a1b7a47
Signed-off-by: Pavan Kunapuli <pkunapuli@nvidia.com>
Reviewed-on: http://git-master/r/213619
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Naveen Kumar Arepalli <naveenk@nvidia.com>
Tested-by: Naveen Kumar Arepalli <naveenk@nvidia.com>
Reviewed-by: Venu Byravarasu <vbyravarasu@nvidia.com>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/host/sdhci.c | 39 | ||||
-rw-r--r-- | drivers/mmc/host/sdhci.h | 4 |
2 files changed, 43 insertions, 0 deletions
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 1b49af6aac88..dd7fc3b2cfa7 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -2036,6 +2036,40 @@ int sdhci_disable(struct mmc_host *mmc) return 0; } +#ifdef CONFIG_MMC_FREQ_SCALING +/* + * Wrapper functions to call any platform specific implementation for + * supporting dynamic frequency scaling for SD/MMC devices. + */ +static int sdhci_gov_get_target(struct mmc_host *mmc, unsigned long *freq) +{ + struct sdhci_host *host = mmc_priv(mmc); + + if (host->ops->dfs_gov_get_target_freq) + *freq = host->ops->dfs_gov_get_target_freq(host, + mmc->devfreq_stats); + + return 0; +} + +static int sdhci_gov_init(struct mmc_host *mmc) +{ + struct sdhci_host *host = mmc_priv(mmc); + + if (host->ops->dfs_gov_init) + return host->ops->dfs_gov_init(host); + + return 0; +} + +static void sdhci_gov_exit(struct mmc_host *mmc) +{ + struct sdhci_host *host = mmc_priv(mmc); + + if (host->ops->dfs_gov_exit) + host->ops->dfs_gov_exit(host); +} +#endif static const struct mmc_host_ops sdhci_ops = { .request = sdhci_request, .set_ios = sdhci_set_ios, @@ -2047,6 +2081,11 @@ static const struct mmc_host_ops sdhci_ops = { .start_signal_voltage_switch = sdhci_start_signal_voltage_switch, .execute_tuning = sdhci_execute_tuning, .enable_preset_value = sdhci_enable_preset_value, +#ifdef CONFIG_MMC_FREQ_SCALING + .dfs_governor_init = sdhci_gov_init, + .dfs_governor_exit = sdhci_gov_exit, + .dfs_governor_get_target = sdhci_gov_get_target, +#endif }; /*****************************************************************************\ diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 17a855eb585f..a870cea37d77 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -287,6 +287,10 @@ struct sdhci_ops { int (*execute_freq_tuning)(struct sdhci_host *sdhci, u32 opcode); int (*get_tuning_counter)(struct sdhci_host *sdhci); int (*sd_error_stats)(struct sdhci_host *host, u32 int_status); + int (*dfs_gov_init)(struct sdhci_host *host); + void (*dfs_gov_exit)(struct sdhci_host *host); + unsigned long (*dfs_gov_get_target_freq)(struct sdhci_host *host, + struct devfreq_dev_status *dev_status); }; #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS |