Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp747714ioo; Thu, 26 May 2022 13:59:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSOh1tRDLBQ4KACL8owpQmXCsAaGcY3mLek4WmObhJsfhL4ev/lJNV2NdbwC7AhErcwSWz X-Received: by 2002:a17:906:50b:b0:6ff:3049:946b with SMTP id j11-20020a170906050b00b006ff3049946bmr1842022eja.524.1653598742621; Thu, 26 May 2022 13:59:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653598742; cv=none; d=google.com; s=arc-20160816; b=n60WEjOD4TV2tuJDKH2tjIwSQmbWjBVKhNK4A3Gx3YIycgkRb6B0OtIPsrlnVnb/1t vdmJvDLzjo4LEa2E+syiVtIWnMFhYmb+vv+tkQy9j7GmrV504jE/m0MUyq7yGVLw/Vnh Os9zNUHILyXD+jB8/rCoBZZPGC2FsOXl30ka9SN/JaVkdLAeJD2ExS6WJ4AznKmPUJ81 gQN+nDGfofDdr8Ai5rzxaf05eBJaixHP9Vrrz53ByiybvVzQQb6sq/Dx9e3J4Q6V54P3 aP8+yRua3qcX83O8uqQegLM1dwNW0o9gL2/xHS2iVz0SVouAMYhYMPJABeCEloRr/ffg WcUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=+k/hqfFc9sQX6DhvkkwHpoIs3mFnvmNe9v0UmitQdak=; b=L5XrcCZhmxIMk/+2NXYqKfYhXItMPKu3WLmz3OIlatcMNe4Afd1KG7gddj4iJt5A5c w/UGmCGmdN70EgGzD2CodXQTGUn/SPfPrv4eioA0Jc6Mr9WOgK1LCwPCyj3Q9u/aBnRY 5G/icoyM+gAh1FYh5a+twxs+N7YUcdo/8oaSCxn090zAnMZRvcyKB7g80uCLNlpNiJ95 tlLun1Mn+b22ru9iJaurF1S9WG8H9apdfSQFLPW2V2a3JhZsg5O6r8Phzmx/IyrynTRJ GOkkjs7nywrye0PotEoiWJskAx5c70noYf6P01ofFKVFn3LdIpNtDRPZg2k2pYHlwTOv ViyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=Q2AYnblU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h4-20020a056402094400b0042bd53b3395si2185802edz.493.2022.05.26.13.58.36; Thu, 26 May 2022 13:59:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=Q2AYnblU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345283AbiEYVCl (ORCPT + 99 others); Wed, 25 May 2022 17:02:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345226AbiEYVCg (ORCPT ); Wed, 25 May 2022 17:02:36 -0400 Received: from alexa-out-sd-01.qualcomm.com (alexa-out-sd-01.qualcomm.com [199.106.114.38]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65482BA570; Wed, 25 May 2022 14:02:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1653512555; x=1685048555; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=+k/hqfFc9sQX6DhvkkwHpoIs3mFnvmNe9v0UmitQdak=; b=Q2AYnblULiLwrt1ZJJgA7acf2xEpql/3jxKKBDJHDt+yqXMv0yPobIMo o46UEt+xB8ME14MaqARgDB27yEYWelPX5TNmHFzat2uuL49ghjAs2xLKi 7mptlTfGtYkvkuJ456j4eqrQllEhKbnx+uQJ6l1Z9hUG0Uxvkl7Ro0q8J c=; Received: from unknown (HELO ironmsg03-sd.qualcomm.com) ([10.53.140.143]) by alexa-out-sd-01.qualcomm.com with ESMTP; 25 May 2022 14:02:35 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg03-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 May 2022 14:02:34 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Wed, 25 May 2022 14:02:34 -0700 Received: from khsieh-linux1.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Wed, 25 May 2022 14:02:33 -0700 From: Kuogee Hsieh To: , , , , , , , , , , CC: Kuogee Hsieh , , , , , , Subject: [PATCH v13 2/3] phy: qcom-qmp: add regulator_set_load to dp phy Date: Wed, 25 May 2022 14:02:19 -0700 Message-ID: <1653512540-21956-3-git-send-email-quic_khsieh@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1653512540-21956-1-git-send-email-quic_khsieh@quicinc.com> References: <1653512540-21956-1-git-send-email-quic_khsieh@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch add regulator_set_load() before enable regulator at DP phy driver. Signed-off-by: Kuogee Hsieh Reviewed-by: Stephen Boyd Reviewed-by: Douglas Anderson --- drivers/phy/qualcomm/phy-qcom-qmp.c | 40 ++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.c b/drivers/phy/qualcomm/phy-qcom-qmp.c index b144ae1..26b290c 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp.c @@ -3075,6 +3075,17 @@ static const struct qmp_phy_init_tbl sm8450_qmp_gen4x2_pcie_pcs_misc_tbl[] = { QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_PCIE_G4_PRE_GAIN, 0x2e), }; +/* list of regulators */ +struct qmp_regulator_data { + const char *name; + unsigned int enable_load; +}; + +struct qmp_regulator_data qmp_phy_vreg_l[] = { + { .name = "vdda-phy", .enable_load = 21800 }, + { .name = "vdda-pll", .enable_load = 36000 }, +}; + struct qmp_phy; /* struct qmp_phy_cfg - per-PHY initialization config */ @@ -3129,7 +3140,7 @@ struct qmp_phy_cfg { const char * const *reset_list; int num_resets; /* regulators to be requested */ - const char * const *vreg_list; + const struct qmp_regulator_data *vreg_list; int num_vregs; /* array of registers with different offsets */ @@ -3341,11 +3352,6 @@ static const char * const sdm845_pciephy_reset_l[] = { "phy", }; -/* list of regulators */ -static const char * const qmp_phy_vreg_l[] = { - "vdda-phy", "vdda-pll", -}; - static const struct qmp_phy_cfg ipq8074_usb3phy_cfg = { .type = PHY_TYPE_USB3, .nlanes = 1, @@ -5488,16 +5494,32 @@ static int qcom_qmp_phy_vreg_init(struct device *dev, const struct qmp_phy_cfg * { struct qcom_qmp *qmp = dev_get_drvdata(dev); int num = cfg->num_vregs; - int i; + int ret, i; qmp->vregs = devm_kcalloc(dev, num, sizeof(*qmp->vregs), GFP_KERNEL); if (!qmp->vregs) return -ENOMEM; for (i = 0; i < num; i++) - qmp->vregs[i].supply = cfg->vreg_list[i]; + qmp->vregs[i].supply = cfg->vreg_list[i].name; - return devm_regulator_bulk_get(dev, num, qmp->vregs); + ret = devm_regulator_bulk_get(dev, num, qmp->vregs); + if (ret) { + dev_err(dev, "failed at devm_regulator_bulk_get\n"); + return ret; + } + + for (i = 0; i < num; i++) { + ret = regulator_set_load(qmp->vregs[i].consumer, + cfg->vreg_list[i].enable_load); + if (ret) { + dev_err(dev, "failed to set load at %s\n", + qmp->vregs[i].supply); + return ret; + } + } + + return 0; } static int qcom_qmp_phy_reset_init(struct device *dev, const struct qmp_phy_cfg *cfg) -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project