Received: by 10.213.65.68 with SMTP id h4csp1988778imn; Sun, 1 Apr 2018 21:27:22 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+87jEJpUOJ2SqBC7u76LzwxoqyHBafFV6jBqwOpBOuQhmTL4/YJayvBexElYfr4jm8aoS3 X-Received: by 10.98.253.9 with SMTP id p9mr6163807pfh.152.1522643242516; Sun, 01 Apr 2018 21:27:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522643242; cv=none; d=google.com; s=arc-20160816; b=Y5OorPt5LD4iwiUGlnfOMWaIhcZF2AAOIo+A8Aow7yVpEJIsXu1hUQPGrRAeT3uUwf sSMrVhSGJcSqft7Sc3Mv0CkWgbmo2t39Qs4SU2EeG3EDzsJ6pC3xq/BH4IWlVUCQyq/c xF3W/wtw0k+BQWg079RDZt7xzQ378wlsXwdiLQZJ8UxoTuFQjDd120chBQGxZJsN0GQk DFISso1Vd3E8RKoragjdj41dGY/Yadk2d8sTeLg6FQ094JXpJfOYsy/MmLXhdH6n93hi +B33CI0e/1yG/EHxBLSnmS20kgviWW1iGxqgdgDCrOqUMYTm7QFfwKuw84pgmxiKBGJ0 4d2w== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:subject:from:dmarc-filter :dkim-signature:dkim-signature:arc-authentication-results; bh=w7cf1fItn5MGxZ1+C3qDe2YoMl9Ys6wIE6ztRuKZdF8=; b=Wob7/q+wzZl5EhyUZu2IVSYZ0kj0BeLZSo9MQbLVpStTntJLnlsfkeRNHSnwErxF8D cD5TKJbglYOzfafm3Qeyp8a5UXMZcItBo7Mp8M6FKhrhAFOnpjccuSkokMqV6MFB7lkN 6E6C9m1ESIcrNhk00JK1IZ9dwGG5aM3npuZZz95BtygzKuM4I6NGMc7R7VDSzNWP1iI+ n2fHOtuXlRA/rpNNs8yt6Nc29a/b55HJZin0/eD4sFqO7IRsRHjmNxylC0rcq9HcyN3r anADgd8q7JEjlFQaUj85fVvPAw+YYirL7UHSBCyuhZ2VAudKgydeuVZnjcSLAh1zZoDX SogA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=fUEBWRY0; dkim=pass header.i=@codeaurora.org header.s=default header.b=K2zGlHLX; 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 m14si9084239pgt.287.2018.04.01.21.26.34; Sun, 01 Apr 2018 21:27:22 -0700 (PDT) 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; dkim=pass header.i=@codeaurora.org header.s=default header.b=fUEBWRY0; dkim=pass header.i=@codeaurora.org header.s=default header.b=K2zGlHLX; 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 S1751362AbeDBEXX (ORCPT + 99 others); Mon, 2 Apr 2018 00:23:23 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:48344 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750729AbeDBEXV (ORCPT ); Mon, 2 Apr 2018 00:23:21 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id EA75F60C55; Mon, 2 Apr 2018 04:23:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1522643000; bh=DUX5/lZkM2sys/z+rb1ahpb4YiRizJFyHKzsg1Zbjr4=; h=From:Subject:To:Cc:References:Date:In-Reply-To:From; b=fUEBWRY0qTrsPDSjWtO6+xmjHmbPemQFhes8l8J7t8HNLUCyaNzif23fhj/LryAwW ptwpCq4a0VArqQtl+31bf2VOYdP+4My91uDLiVVb+EsdpMaFHV9ryV3jERJL4WHvPO c1v1e+WxjjSZro9OnpWSL8d/K4QjPMXtMMDkoSwY= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from [10.206.25.30] (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: vviswana@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 9483C607A2; Mon, 2 Apr 2018 04:23:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1522642999; bh=DUX5/lZkM2sys/z+rb1ahpb4YiRizJFyHKzsg1Zbjr4=; h=From:Subject:To:Cc:References:Date:In-Reply-To:From; b=K2zGlHLX4Svym3Xmb1Bw9+Oh1koR0PEoBCw9UrkNT7MN4Hv26Ytu0BNu3eG/KzaE4 XJOQ88kDfh7yjkSSd5o/yMfVmOhaJY34imPDd0++Rj7qkUHd5pxMAooYvkM14oip8U BjV68Wga1+lEnOttTBU+PjddMjJZH1L/Qd54OjFc= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 9483C607A2 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 Subject: Re: [PATCH V4 1/2] mmc: sdhci-msm: Add support to store supported vdd-io voltages To: Doug Anderson Cc: Adrian Hunter , Ulf Hansson , linux-mmc@vger.kernel.org, LKML , Shawn Lin , linux-arm-msm@vger.kernel.org, georgi.djakov@linaro.org, asutoshd@codeaurora.org, stummala@codeaurora.org, venkatg@codeaurora.org, pramod.gurav@linaro.org, jeremymc@redhat.com, Bjorn Andersson , riteshh@codeaurora.org References: <1522242500-10556-1-git-send-email-vviswana@codeaurora.org> <1522242500-10556-2-git-send-email-vviswana@codeaurora.org> Message-ID: Date: Mon, 2 Apr 2018 09:53:13 +0530 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/29/2018 4:22 AM, Doug Anderson wrote: > Hi, > > On Wed, Mar 28, 2018 at 6:08 AM, Vijay Viswanath > wrote: >> During probe check whether the vdd-io regulator of sdhc platform device >> can support 1.8V and 3V and store this information as a capability of >> platform device. >> >> Signed-off-by: Vijay Viswanath >> --- >> drivers/mmc/host/sdhci-msm.c | 35 ++++++++++++++++++++++++++++++++++- >> 1 file changed, 34 insertions(+), 1 deletion(-) > > Since I commented on v2, please copy me for this series going forward. Thanks. > > Will do. Sorry I missed. >> diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c >> index c283291..2fcd9010 100644 >> --- a/drivers/mmc/host/sdhci-msm.c >> +++ b/drivers/mmc/host/sdhci-msm.c >> @@ -21,6 +21,7 @@ >> #include >> #include >> #include >> +#include >> >> #include "sdhci-pltfm.h" >> >> @@ -81,6 +82,9 @@ >> #define CORE_HC_SELECT_IN_HS400 (6 << 19) >> #define CORE_HC_SELECT_IN_MASK (7 << 19) >> >> +#define CORE_3_0V_SUPPORT (1 << 25) >> +#define CORE_1_8V_SUPPORT (1 << 26) >> + >> #define CORE_CSR_CDC_CTLR_CFG0 0x130 >> #define CORE_SW_TRIG_FULL_CALIB BIT(16) >> #define CORE_HW_AUTOCAL_ENA BIT(17) >> @@ -148,6 +152,7 @@ struct sdhci_msm_host { >> u32 curr_io_level; >> wait_queue_head_t pwr_irq_wait; >> bool pwr_irq_flag; >> + u32 caps_0; >> }; >> >> static unsigned int msm_get_clock_rate_for_bus_mode(struct sdhci_host *host, >> @@ -1103,7 +1108,7 @@ static void sdhci_msm_handle_pwr_irq(struct sdhci_host *host, int irq) >> struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host); >> u32 irq_status, irq_ack = 0; >> int retry = 10; >> - int pwr_state = 0, io_level = 0; >> + u32 pwr_state = 0, io_level = 0; >> >> >> irq_status = readl_relaxed(msm_host->core_mem + CORE_PWRCTL_STATUS); >> @@ -1313,6 +1318,30 @@ static void sdhci_msm_writeb(struct sdhci_host *host, u8 val, int reg) >> sdhci_msm_check_power_status(host, req_type); >> } >> >> +static int sdhci_msm_set_regulator_caps(struct sdhci_msm_host *msm_host) > > This function always returns 0. Make it void. > > >> +{ >> + struct mmc_host *mmc = msm_host->mmc; >> + struct regulator *supply = mmc->supply.vqmmc; >> + u32 caps = 0; >> + >> + if (!IS_ERR(mmc->supply.vqmmc)) { >> + if (regulator_is_supported_voltage(supply, 1700000, 1950000)) >> + caps |= CORE_1_8V_SUPPORT; >> + if (regulator_is_supported_voltage(supply, 2700000, 3600000)) >> + caps |= CORE_3_0V_SUPPORT; >> + >> + if (!caps) >> + pr_warn("%s: %s: 1.8/3V not supported for vqmmc\n", >> + mmc_hostname(mmc), __func__); > > Please remove __func__. You already have the unique thing to find the > right driver (AKA mmc_hostname(mmc)) and the string itself should be > enough from there. > > >> + } >> + >> + msm_host->caps_0 |= caps; >> + pr_debug("%s: %s: supported caps: 0x%08x\n", mmc_hostname(mmc), >> + __func__, caps); > > Same, no need for __func__. > > will remove all unnecessary __func__ references. >> + >> + return 0; >> +} >> + >> static const struct of_device_id sdhci_msm_dt_match[] = { >> { .compatible = "qcom,sdhci-msm-v4" }, >> {}, >> @@ -1530,6 +1559,10 @@ static int sdhci_msm_probe(struct platform_device *pdev) >> ret = sdhci_add_host(host); >> if (ret) >> goto pm_runtime_disable; >> + ret = sdhci_msm_set_regulator_caps(msm_host); >> + if (ret) >> + dev_err(&pdev->dev, "Failed to set regulator caps: %d\n", >> + ret); > > If you find some reason _not_ to make sdhci_msm_set_regulator_caps() > return "void" as per above, you should actually do something about > this error. You've used "dev_err" which makes me feel like you > consider this a serious error. Presumably it should cause the probe > to fail? > > > -Doug > yeah, we don't need to print anything here as a warning is printed in sdhci_msm_set_regulator_caps() anyway.