[PATCH 5/8] MXC: mach-mx31_3ds: Add support for SD card slot in the personality board.

Mark Brown broonie at opensource.wolfsonmicro.com
Wed Mar 24 09:26:55 EDT 2010


On Tue, Mar 23, 2010 at 07:53:58PM +0100, Alberto Panizzo wrote:

> +static void mx31_3ds_setpower(struct device *dev, unsigned int vdd)
> +{
> +	int voltage = 0;
> +
> +	if (vdd <= ilog2(MMC_VDD_165_195))
> +		voltage = 1800000;
> +	else if (vdd == ilog2(MMC_VDD_20_21))
> +		voltage = 2000000;
> +	else
> +		voltage = 2000000 + (vdd - 7) * 100000;
> +
> +	pr_debug("%s: vdd = %d -> REGU_VMMC2 = %d\n", __func__, vdd, voltage);
> +
> +	regulator_set_voltage(vmmc_reg, voltage, voltage);

This code looks wrong - the MMC core is requesting voltage ranges but
these are being non-linearly translated into specific voltages.  I
rather suspect that the standard mmc_regulator_set_ocr() function ought
to be able to cope with this, in conjunction with a regulator constraint
limiting the minimum voltage to 1.8V.  If not, some comments explaining
what's going on would really help.

> +static struct regulator_consumer_supply gpo3_consumers[] = {
> +	{
> +		.dev	= &mxcsdhc_device0.dev,

Use dev_name, not dev.



More information about the linux-arm-kernel mailing list