From patchwork Tue May 1 10:39:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijay Viswanath X-Patchwork-Id: 10373533 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6BB756032A for ; Tue, 1 May 2018 10:40:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5BE8828C28 for ; Tue, 1 May 2018 10:40:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 50BF928C2D; Tue, 1 May 2018 10:40:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 01C4728C28 for ; Tue, 1 May 2018 10:40:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754613AbeEAKjr (ORCPT ); Tue, 1 May 2018 06:39:47 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:39124 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754198AbeEAKjo (ORCPT ); Tue, 1 May 2018 06:39:44 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 22DDA6090E; Tue, 1 May 2018 10:39:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1525171184; bh=D9v/OZzGjUd2ADIXzvvZzMu/56WrF5lFQvmqdGiK5iw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m+YfrVWS7cqsM3vL2X75WCw/f7Z+wGn3uG+M+UUIR5GrwQvTP7KKENddA+k2lD90D 0bgER1Am6sdAtkhtcqzkpTR8pfvFndQfZmHYgRA64XtStVBR4PxuI97brg3wIgtT+M 5jcHkz1V5ePIL/2hchP25GAgBzAC7x1plcojdDDE= Received: from hydcbspbld03.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: vviswana@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 431CD60710; Tue, 1 May 2018 10:39:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1525171183; bh=D9v/OZzGjUd2ADIXzvvZzMu/56WrF5lFQvmqdGiK5iw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lkpiSYa+T4aEAXLIvxsntXQCtdFk1tn4kGx/xLkCrqw66Tm2X3acnF8+7ObVWD3xF McbXbemkYmmI+rpeJf31LGImqgGyy9dVqAG30/M0BdaFDj9K0CsN1H4To0o3tGtrXS DvHohbIgJJ/Ipw2WbN7x85UHFJ2m7GFk/nfh6TJ8= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 431CD60710 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=vviswana@codeaurora.org From: Vijay Viswanath To: adrian.hunter@intel.com, ulf.hansson@linaro.org Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, shawn.lin@rock-chips.com, linux-arm-msm@vger.kernel.org, georgi.djakov@linaro.org, asutoshd@codeaurora.org, stummala@codeaurora.org, venkatg@codeaurora.org, jeremymc@redhat.com, vviswana@codeaurora.org, bjorn.andersson@linaro.org, riteshh@codeaurora.org, vbadigan@codeaurora.org, dianders@google.com, sayalil@codeaurora.org Subject: [PATCH RFC 3/4] host: sdhci: fix current caps when there is no host->vmmc Date: Tue, 1 May 2018 16:09:12 +0530 Message-Id: <1525171153-24476-4-git-send-email-vviswana@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1525171153-24476-1-git-send-email-vviswana@codeaurora.org> References: <1525171153-24476-1-git-send-email-vviswana@codeaurora.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sahitya Tummala When the regulators are not managed by SDHCI host driver (i.e., when host->vmmc and host->vmmcq are absent), get the regulator current capabilities through a new host op get_current_limit(). Signed-off-by: Sahitya Tummala Signed-off-by: Sayali Lokhande [vviswana@codeaurora.org: fixed trivial merge conflicts] Signed-off-by: Vijay Viswanath Change-Id: I3370a2411beec1f03cc5f102bf95cd816c60351e --- drivers/mmc/host/sdhci.c | 11 ++++++++--- drivers/mmc/host/sdhci.h | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 0d5fcca..edc2ccd 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -3570,10 +3570,15 @@ int sdhci_setup_host(struct sdhci_host *host) * value. */ max_current_caps = sdhci_readl(host, SDHCI_MAX_CURRENT); - if (!max_current_caps && !IS_ERR(mmc->supply.vmmc)) { - int curr = regulator_get_current_limit(mmc->supply.vmmc); - if (curr > 0) { + if (!max_current_caps) { + u32 curr = 0; + + if (!IS_ERR(mmc->supply.vmmc)) + curr = regulator_get_current_limit(mmc->supply.vmmc); + else if (host->ops->get_current_limit) + curr = host->ops->get_current_limit(host); + if (curr > 0) { /* convert to SDHCI_MAX_CURRENT format */ curr = curr/1000; /* convert to mA */ curr = curr/SDHCI_MAX_CURRENT_MULTIPLIER; diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 54bc444..a01af78 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -584,6 +584,7 @@ struct sdhci_ops { void (*adma_workaround)(struct sdhci_host *host, u32 intmask); void (*card_event)(struct sdhci_host *host); void (*voltage_switch)(struct sdhci_host *host); + unsigned int (*get_current_limit)(struct sdhci_host *host); }; #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS