Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp553604imu; Fri, 25 Jan 2019 06:59:17 -0800 (PST) X-Google-Smtp-Source: ALg8bN4Hs3fi17CkVFzRTDng0/4/K88tr/Wf3sW/P9GiClcfuccbVAihFTUTSgxb9MjxUZLmi1rP X-Received: by 2002:a65:60c2:: with SMTP id r2mr10358017pgv.393.1548428357779; Fri, 25 Jan 2019 06:59:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548428357; cv=none; d=google.com; s=arc-20160816; b=Agh27JdnqShPPhLMANvSkBNP8SkEPEGz2Y34bW3/r2jsvSDseD0+B8lHMqCvZqcXjL h1gKAubTidUjSaaTJVUdigJ6zHdLo2eT7FDt8NZPerdd2nPHEITh4TurZXstpLELjvO3 M7pHoh596U9A1Ion9TL+67+vYyeQ0EuFnvu8K99VOqh9u8i1Ukpoo5OoDT/IDZ7fCm2I oPx14GYDyCn586nCcRfalBvTlJLywpqBPDGz1RJ8FcgXBj36P9U180YwtexbX4k4ny2l I58qVVpwyGqXLpLLYY+Vo3XbQ5SmUrASiMi2161OUBpDsIDJMrxsfcN+ZtJDkcDGclen 1fiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=Zm+S0GqhN7CRfxj3ahwFFyqMKK1REDNjPF6K6j5oBoI=; b=mYlBxoQ7DM8uOwaRSTTHGLcrgpHM/NXSX51LN3uAM4+wD15uXty0xRCKba3/Tmzr0t hT9GmxHS8vHoAzJmzi0AXrCJW5peq/KR7fEg2K7ys+iYQfS7u/KT+bvXpq2Qww69x+8t hVb+BzuYime0ozueKQGVbZIZIB+InYIsVk/mFdX5cu+FdS2swnqZ6e3Ly2Ogv0rktwX1 Dz7DM4fuwXZeKQxz0X+PLrKB8u9A+W8b/oNb7/Pih8yAb1j6dIxU3QJo62z5q07/WqfL fG7joFrpELC8+b8EJoFNko5+9FHAlruiEylpDwjyGbheiuabHVi5ATlGZWudqsgKSCDn S3uA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w2si23159310pgp.546.2019.01.25.06.59.01; Fri, 25 Jan 2019 06:59:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726632AbfAYO6k (ORCPT + 99 others); Fri, 25 Jan 2019 09:58:40 -0500 Received: from protonic.xs4all.nl ([83.163.252.89]:50788 "EHLO protonic.nl" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726216AbfAYO6j (ORCPT ); Fri, 25 Jan 2019 09:58:39 -0500 X-Greylist: delayed 350 seconds by postgrey-1.27 at vger.kernel.org; Fri, 25 Jan 2019 09:58:39 EST Received: from erd987 (unknown [192.168.2.69]) by sparta (Postfix) with ESMTP id EA1F844A004C; Fri, 25 Jan 2019 15:54:01 +0100 (CET) Date: Fri, 25 Jan 2019 15:52:48 +0100 From: Robin van der Gracht To: Martin Kepplinger Cc: linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, ulf.hansson@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de, linux-imx@nxp.com, linux-kernel@vger.kernel.org, Martin Kepplinger Subject: Re: [PATCH] mmc: mxs-mmc: Introduce regulator support Message-ID: <20190125155248.23937600@erd987> In-Reply-To: <20190125113449.10128-1-martink@posteo.de> References: <20190125113449.10128-1-martink@posteo.de> Organization: Protonic Holland X-Mailer: Claws Mail 3.17.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Martin, On Fri, 25 Jan 2019 12:34:49 +0100 Martin Kepplinger wrote: > From: Martin Kepplinger > > This adds support for explicitly switching the mmc's power on and off. > > Signed-off-by: Martin Kepplinger > --- > > This is not my patch. It's taken from https://patchwork.kernel.org/patch/4365751/ > rebased and minimally changed; but we use this. > > Are there any objections to this? > > Robin, can I still add your Signed-off-by to this? Also, should I set you > as the author? It's old, but thanks for keeping me in the loop :) > > thanks, > > martin > > drivers/mmc/host/mxs-mmc.c | 31 +++++++++++++++++++++++-------- > 1 file changed, 23 insertions(+), 8 deletions(-) > > diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c > index add1e70195ea..e3c19fabb723 100644 > --- a/drivers/mmc/host/mxs-mmc.c > +++ b/drivers/mmc/host/mxs-mmc.c > @@ -517,6 +517,26 @@ static void mxs_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) > else > host->bus_width = 0; > > + if (ios->power_mode != host->power_mode) { > + switch (ios->power_mode) { > + case MMC_POWER_OFF: > + if ((host->vmmc) && regulator_disable(host->vmmc)) { > + dev_err(mmc_dev(host->mmc), > + "Failed to disable vmmc regulator\n"); > + } > + break; > + case MMC_POWER_UP: > + if ((host->vmmc) && regulator_enable(host->vmmc)) { > + dev_err(mmc_dev(host->mmc), > + "Failed to enable vmmc regulator\n"); > + } > + break; > + default: > + break; > + } > + host->power_mode = ios->power_mode; > + } > + A single check in the root contitional for the availability of vmmc should suffice, so: if (host->vmmc && ios->power_mode != host->power_mode) { ... case MMC_POWER_XX: if (regulator_xx(host->vmmc)) dev_err; ... > if (ios->clock) > mxs_ssp_set_clk_rate(&host->ssp, ios->clock); > } > @@ -613,16 +633,11 @@ static int mxs_mmc_probe(struct platform_device *pdev) > > host->mmc = mmc; > host->sdio_irq_en = 0; > + host->power_mode = MMC_POWER_OFF; My patch added 'power_mode' and 'vmmc' to the drivers private struct (which are missing in this email?) > > reg_vmmc = devm_regulator_get(&pdev->dev, "vmmc"); > - if (!IS_ERR(reg_vmmc)) { > - ret = regulator_enable(reg_vmmc); > - if (ret) { > - dev_err(&pdev->dev, > - "Failed to enable vmmc regulator: %d\n", ret); > - goto out_mmc_free; > - } > - } > + if (!IS_ERR(reg_vmmc)) > + host->vmmc = reg_vmmc; what about mmc_regulator_get_supply(mmc)? If we use that the vmmc will be made available under mmv->supply->vmmc if probe was successfull instead of storing it in the drivers private struct. > > ssp->clk = devm_clk_get(&pdev->dev, NULL); > if (IS_ERR(ssp->clk)) { Robin van der Gracht