Re: [PATCH V2 13/16] OMAP: hsmmc: implement clock switcher

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

 



* Adrian Hunter <adrian.hunter@xxxxxxxxx> [110506 02:13]:
> From: Andy Shevchenko <ext-andriy.shevchenko@xxxxxxxxx>
> 
> There are 3 new platform data methods which should help us to do a clock
> switching when notification is happened or request is started.
> 
> The purpose of the patch is to avoid high frequency of MMC controller on low
> OPPs due to an HW bug in OMAP 3630.
...

> +static int hsmmc_clk_notifier(struct notifier_block *nb, unsigned long event,
> +			      void *data)
> +{
> +	struct cpufreq_freqs *freqs = data;
> +	unsigned int threshold = 400000; /* between opp1 and opp2 */
> +
> +	switch (event) {
> +	case CPUFREQ_PRECHANGE:
> +		if (freqs->new < threshold && freqs->old >= threshold) {
> +			/* opp2 -> opp1 */
> +			hsmmc_max_freq = HSMMC_MAX_FREQ >> 1;
> +
> +			/* Timeout is 1 sec */
> +			if (!wait_event_timeout(hsmmc_max_freq_wq,
> +						hsmmc_max_freq_ok(),
> +						msecs_to_jiffies(1000)))
> +				pr_err("MMC violates maximum frequency "
> +				       "constraint\n");
> +		}
> +		break;
> +	case CPUFREQ_POSTCHANGE:
> +		if (freqs->old < threshold && freqs->new >= threshold) {
> +			/* opp1 -> opp2 */
> +			hsmmc_max_freq = HSMMC_MAX_FREQ;
> +		}
> +		break;
> +	default:
> +		break;
> +	}
> +
> +	return NOTIFY_DONE;
> +}

I think the cpufreq notifier code should be in the driver, the platform
init code should just prepare things for the driver.

Regards,

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


[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux