From patchwork Tue Nov 9 10:35:37 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alberto Panizzo X-Patchwork-Id: 310942 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oA9AaQB2028229 for ; Tue, 9 Nov 2010 10:36:26 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755176Ab0KIKfo (ORCPT ); Tue, 9 Nov 2010 05:35:44 -0500 Received: from mail-fx0-f46.google.com ([209.85.161.46]:60661 "EHLO mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755069Ab0KIKfn (ORCPT ); Tue, 9 Nov 2010 05:35:43 -0500 Received: by fxm16 with SMTP id 16so4804786fxm.19 for ; Tue, 09 Nov 2010 02:35:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:cc :in-reply-to:references:content-type:date:message-id:mime-version :x-mailer:content-transfer-encoding; bh=RSiUzcUBl2KL1GOGKWVmsOohmXlWybKwAAchzE1ylpo=; b=pzXE4t/bO/p/NeRUhZQ+SHBogbeiWqXTnqls4sAOhklLRijcxiBQkx0bcxxIKsuu+Y E1GKdhFIVFYw00wi3hRELT62wQ9NLc5Tkq2uxfsjwFK04NnXq0I5xY1BGVmXO/eA0JSK RUraZMWkCCaP2KJVFvRgXeagBr/NOKGwVM5y0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:cc:in-reply-to:references:content-type:date :message-id:mime-version:x-mailer:content-transfer-encoding; b=ry33YTJpBthxque9R3RxIDAQXX6CcRuJQMDSnYQ8wWkA5+W/W5LzZaG9mrjdYvXRfP qL/3MeeEieqtdwWjFTnpS7GUZObjNt7s+FHyuBq00eq6L4kXRm0qsWWwXY2vbXcdz1JB afmKiEH+ZV/EXWxUzPj/+KjsTLfTZ82ixiBn0= Received: by 10.223.73.207 with SMTP id r15mr4818967faj.141.1289298941812; Tue, 09 Nov 2010 02:35:41 -0800 (PST) Received: from [192.168.1.101] (host-9473-86-114.popwifi.it [94.73.86.114]) by mx.google.com with ESMTPS id r22sm561808fax.45.2010.11.09.02.35.38 (version=SSLv3 cipher=RC4-MD5); Tue, 09 Nov 2010 02:35:40 -0800 (PST) Subject: [PATCH v2] mxcmmc: update the regulator support code to the latest API From: Alberto Panizzo To: Chris Ball Cc: Daniel Mack , Andrew Morton , Uwe =?ISO-8859-1?Q?Kleine-K=F6nig?= , Eric =?ISO-8859-1?Q?B=E9nard?= , Fabio Estevam , linux-kernel , linux-mmc , Sascha Hauer , Linus Walleij In-Reply-To: <20101108143746.GA23201@void.printf.net> References: <1288656337.29881.13.camel@realization> <20101102073932.GB6017@pengutronix.de> <1288949275.3072.3.camel@realization> <1289213595.3425.23.camel@realization> <20101108143746.GA23201@void.printf.net> Date: Tue, 09 Nov 2010 11:35:37 +0100 Message-ID: <1289298937.3020.34.camel@realization> Mime-Version: 1.0 X-Mailer: Evolution 2.28.1 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Tue, 09 Nov 2010 10:36:27 +0000 (UTC) diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c index 1a7f48c..2b9f7c8 100644 --- a/drivers/mmc/host/mxcmmc.c +++ b/drivers/mmc/host/mxcmmc.c @@ -150,7 +150,6 @@ static void mxcmci_set_clk_rate(struct mxcmci_host *host, unsigned int clk_ios); static inline void mxcmci_init_ocr(struct mxcmci_host *host) { -#ifdef CONFIG_REGULATOR host->vcc = regulator_get(mmc_dev(host->mmc), "vmmc"); if (IS_ERR(host->vcc)) { @@ -161,7 +160,7 @@ static inline void mxcmci_init_ocr(struct mxcmci_host *host) dev_warn(mmc_dev(host->mmc), "pdata->ocr_avail will not be used\n"); } -#endif + if (host->vcc == NULL) { /* fall-back to platform data */ if (host->pdata && host->pdata->ocr_avail) @@ -171,12 +170,17 @@ static inline void mxcmci_init_ocr(struct mxcmci_host *host) } } -static inline void mxcmci_set_power(struct mxcmci_host *host, unsigned int vdd) +static inline void mxcmci_set_power(struct mxcmci_host *host, + unsigned char power_mode, + unsigned int vdd) { -#ifdef CONFIG_REGULATOR - if (host->vcc) - mmc_regulator_set_ocr(host->vcc, vdd); -#endif + if (host->vcc) { + if (power_mode == MMC_POWER_UP) + mmc_regulator_set_ocr(host->mmc, host->vcc, vdd); + else if (power_mode == MMC_POWER_OFF) + mmc_regulator_set_ocr(host->mmc, host->vcc, 0); + } + if (host->pdata && host->pdata->setpower) host->pdata->setpower(mmc_dev(host->mmc), vdd); } @@ -716,7 +720,7 @@ static void mxcmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) host->cmdat &= ~CMD_DAT_CONT_BUS_WIDTH_4; if (host->power_mode != ios->power_mode) { - mxcmci_set_power(host, ios->vdd); + mxcmci_set_power(host, ios->power_mode, ios->vdd); host->power_mode = ios->power_mode; if (ios->power_mode == MMC_POWER_ON)