From patchwork Thu Mar 3 10:19:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Boichat X-Patchwork-Id: 8490971 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B143BC0553 for ; Thu, 3 Mar 2016 10:22:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DA8D420351 for ; Thu, 3 Mar 2016 10:22:15 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 06F2C202FF for ; Thu, 3 Mar 2016 10:22:15 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1abQMx-0002jo-FM; Thu, 03 Mar 2016 10:20:31 +0000 Received: from mail-pa0-x234.google.com ([2607:f8b0:400e:c03::234]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1abQMp-0001hS-TN for linux-arm-kernel@lists.infradead.org; Thu, 03 Mar 2016 10:20:24 +0000 Received: by mail-pa0-x234.google.com with SMTP id fy10so12478792pac.1 for ; Thu, 03 Mar 2016 02:20:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=TijQK38ThESkvhUzd/PsSkV583403HLxA8v5t1/usg8=; b=iCULWF0lCBbOQvokh+KusK8Uwnua4h4uVdcH/RlK1Llyb2FYLc7+AFHTovgkDgu9jx Sciw7W7G/ux9WabdUAKPaJqxtA62GvOHLLiK6G8KrPcnN7RUXvME9BX5y1kLx4fzqI62 XxzBQVAMnsoD0NEF2pyvUoI7qorrGQuiva5AY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TijQK38ThESkvhUzd/PsSkV583403HLxA8v5t1/usg8=; b=QtmivJGZKdM0a7o00sPJsQ5DHLwtU3fxQ9JxYVAEglFHyb1zFRXkvTSssscecNqMm2 DEZlMAKxBMWbEuz7SGiYyhi+hOBkQ4OihZ8F9n5i9+bB4rQ+10a1F3ixpSXIL2GyCl+W memKxsmMCS3LQcUzwSaJdBqGRlocqmH4phSnKYimgpgNb/kDQSKfnz2ir9KRdSKL5e+u ouwaZpVBbNY9ozpMhfMe0Uu/whwJVk5vXqx3Cr/ECS0xCsywJEl1gLc8UJZakBbvnUrJ D5A7wzQNjIo5G6NJqOZ+yw1YvdPXVWeuN9LODvVI2w/yWvv4BeMS1udNgjYU/NleP1Uh 6dHg== X-Gm-Message-State: AD7BkJKjQBG/VWkQ1yTRpEyzrRZgp1Rav57GV3zGQ5LRVumVcRxtMhLVtPyxALb1nkEqcQ== X-Received: by 10.66.140.39 with SMTP id rd7mr2497164pab.92.1457000403120; Thu, 03 Mar 2016 02:20:03 -0800 (PST) Received: from drinkcat.tpe.corp.google.com ([172.30.210.53]) by smtp.gmail.com with ESMTPSA id wx3sm57842230pab.25.2016.03.03.02.20.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 03 Mar 2016 02:20:02 -0800 (PST) From: Nicolas Boichat To: Ulf Hansson Subject: [PATCH 2/2] mmc: mediatek: Use mmc_regulator_set_vqmmc in start_signal_voltage_switch Date: Thu, 3 Mar 2016 18:19:45 +0800 Message-Id: <1457000385-2317-2-git-send-email-drinkcat@chromium.org> X-Mailer: git-send-email 2.7.0.rc3.207.g0ac5344 In-Reply-To: <1457000385-2317-1-git-send-email-drinkcat@chromium.org> References: <1457000385-2317-1-git-send-email-drinkcat@chromium.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160303_022024_119462_A4D62349 X-CRM114-Status: GOOD ( 14.75 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nicolas Boichat , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, dianders@chromium.org, Geert Uytterhoeven , Chaotian Jing , Matthias Brugger , linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We've introduced a new helper in the MMC core: mmc_regulator_set_vqmmc(). Let's use this in mtk-sd. Using this new helper has some advantages: 1. We get the mmc_regulator_set_vqmmc() behavior of trying to match VQMMC and VMMC when the signal voltage is 3.3V. This ensures max compatibility. 2. We get rid of a few more warnings when probing unsupported voltages. 3. We get rid of some non-mediatek specific code in mtk-sd. Signed-off-by: Nicolas Boichat Reviewed-by: Douglas Anderson --- Similar to e0848f5d294c703917260a6228cc08b8be46c527 mmc: dw_mmc: Use mmc_regulator_set_vqmmc in start_signal_voltage_switch , where I copied the commit message from. drivers/mmc/host/mtk-sd.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c index 07809f4..b17f30d 100644 --- a/drivers/mmc/host/mtk-sd.c +++ b/drivers/mmc/host/mtk-sd.c @@ -1021,26 +1021,19 @@ static void msdc_set_buswidth(struct msdc_host *host, u32 width) static int msdc_ops_switch_volt(struct mmc_host *mmc, struct mmc_ios *ios) { struct msdc_host *host = mmc_priv(mmc); - int min_uv, max_uv; int ret = 0; if (!IS_ERR(mmc->supply.vqmmc)) { - if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_330) { - min_uv = 3300000; - max_uv = 3300000; - } else if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_180) { - min_uv = 1800000; - max_uv = 1800000; - } else { + if (ios->signal_voltage != MMC_SIGNAL_VOLTAGE_330 && + ios->signal_voltage != MMC_SIGNAL_VOLTAGE_180) { dev_err(host->dev, "Unsupported signal voltage!\n"); return -EINVAL; } - ret = regulator_set_voltage(mmc->supply.vqmmc, min_uv, max_uv); + ret = mmc_regulator_set_vqmmc(mmc, ios); if (ret) { - dev_dbg(host->dev, - "Regulator set error %d: %d - %d\n", - ret, min_uv, max_uv); + dev_dbg(host->dev, "Regulator set error %d (%d)\n", + ret, ios->signal_voltage); } else { /* Apply different pinctrl settings for different signal voltage */ if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_180)