diff options
author | Sujit Reddy Thumma <sthumma@codeaurora.org> | 2014-12-04 09:57:23 +0200 |
---|---|---|
committer | Subhash Jadavani <subhashj@codeaurora.org> | 2016-05-31 15:25:39 -0700 |
commit | baf82d92c551c8d87e124ead42e9b603a9bd9b1b (patch) | |
tree | d26675eeaae7d4933dc3d1ff2e4cd5aefbf3d768 /include | |
parent | 45af9e56df24904bad335486b1dc2bf6dcff3535 (diff) |
mmc: core: Add load based clock scaling support
The SD3.0/eMMC4.5/SDIO3.0 cards can support clock rates upto
200MHz (SDR104 or HS200 bus speed modes). For some workloads
like video playback it isn't necessary for these cards to run
at such high speed. Running at lower frequency, say 50MHz, in
such cases can still meet the deadlines for data transfers.
Scaling down the clock frequency dynamically has huge power
savings not only because the bus is running at lower frequency
but also has an advantage of scaling down the system core
voltage, if supported.
Provide an ondemand clock scaling support similar to cpufreq
ondemand governor having two thresholds, up_threshold and
down_threshold to decide whether to increase the frequency or
scale it down respectively. The sampling interval is in the
order of milliseconds and should be chosen by host drivers that
enable MMC_CAP2_CLK_SCALE capability to take advantage of clock
scaling. The sampling interval mainly depends on the the clock
switching delays and hence a host driver decision. If sampling
interval is too low frequent switching of frequencies can lead
to high power consumption and if sampling interval is too high,
the clock scaling logic would take long time to realize that the
underlying hardware (controller and card) is busy and scale up
the clocks.
Change-Id: I22a5054beec41b0b66b3bf030ddfcf284de448b3
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
[merez@codeaurora.org: fixed conflicts due to changes in 3.14]
Signed-off-by: Maya Erez <merez@codeaurora.org>
[venkatg@codeaurora.org: runtime pm related changes to
accommodate pm framework from 3.14 kernel]
Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
[subhashj@codeaurora.org: fixed merge conflicts and fixed compilation
errors]
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/mmc/host.h | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 1f4c2cc72b8c..dd68bc9a805d 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -156,6 +156,10 @@ struct mmc_host_ops { */ int (*multi_io_quirk)(struct mmc_card *card, unsigned int direction, int blk_size); + + unsigned long (*get_max_frequency)(struct mmc_host *host); + unsigned long (*get_min_frequency)(struct mmc_host *host); + int (*notify_load)(struct mmc_host *, enum mmc_load); }; @@ -303,6 +307,7 @@ struct mmc_host { #define MMC_CAP2_SDIO_IRQ_NOTHREAD (1 << 17) #define MMC_CAP2_NO_WRITE_PROTECT (1 << 18) /* No physical write protect pin, assume that card is always read-write */ #define MMC_CAP2_PACKED_WR_CONTROL (1 << 19) /* Allow write packing control */ +#define MMC_CAP2_CLK_SCALE (1 << 20) /* Allow dynamic clk scaling */ #define MMC_CAP2_NONHOTPLUG (1 << 25) /*Don't support hotplug*/ mmc_pm_flag_t pm_caps; /* supported pm features */ @@ -407,23 +412,6 @@ struct mmc_host { } embedded_sdio_data; #endif - struct { - unsigned long busy_time_us; - unsigned long window_time; - unsigned long curr_freq; - unsigned long polling_delay_ms; - unsigned int up_threshold; - unsigned int down_threshold; - ktime_t start_busy; - bool enable; - bool initialized; - bool in_progress; - /* freq. transitions are not allowed in invalid state */ - bool invalid_state; - struct delayed_work work; - enum mmc_load state; - } clk_scaling; - /* * Set to 1 to just stop the SDCLK to the card without * actually disabling the clock from it's source. @@ -441,7 +429,19 @@ struct mmc_host { } perf; bool perf_enable; #endif - + struct { + unsigned long busy_time_us; + unsigned long window_time; + unsigned long curr_freq; + unsigned long polling_delay_ms; + unsigned int up_threshold; + unsigned int down_threshold; + ktime_t start_busy; + bool enable; + bool initialized; + bool in_progress; + struct delayed_work work; + } clk_scaling; unsigned long private[0] ____cacheline_aligned; }; |