Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4484872ybg; Mon, 21 Oct 2019 09:41:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqwoSwnm/N0ZJOcumG4yUVjLesaKKGYtODybjtsn9K1M60rnvbsgjKsJFdsX1Ny7m3YXteLc X-Received: by 2002:a50:cbcd:: with SMTP id l13mr25924914edi.18.1571676092832; Mon, 21 Oct 2019 09:41:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571676092; cv=none; d=google.com; s=arc-20160816; b=TEO5K7zJaEpGugfCFe7yFxNWJzYi9p8PdJE6MmuyJml53SK2IKa2DFjxU/gt1ORRgT woJ1UyzR5Y0QTMixAg5hKPFoKgDdb6YKwW6ZF+ex8SBTw6hDvv9khQas75CXoF9GHuDd UVcZRI5iy4jbsBKRPCSZ862VzAr9DownTKvXMhsLz+mBRPg0dJY7SiYbZdVl5OifSo3V PNy+4MXvwhZCqGyoiqFcGm9AmgHZd92eYPQCJFG3H9+WQEREgEJrEgSarbgivXqAv3Zp 8DhShoC6F0FDR3Kx9AFg0k3V9S8BDQ7gl6p5xlcELz93p70G0kYFQtizE6XNKA3XMsCC 1goQ== 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 :message-id:date:subject:cc:to:from; bh=f1jboLQF08Nk01XPjPEv1GO0NA6sMlhX/MAZdLwfMS4=; b=aNvqqSoqKVK6ho0Uw3zHQx6PqacMiVVgYVRQRPBmdyX4Dt9tAwlZrHmvLeWFreE2vX n9tRgmquQFspz2mD8SpXXB3ND7WYWX9GFSbzY3+45cBdB8uGC3SUi+1u5Gt4QnW752ec FIKUxN5oVZRu/fS+7MeJSrVMtijNZPIUyVh2J+XNECu7BfYShd2fUtMWloIgDLRYeRZZ QzwzV4p5XdpziQmMvUi7TOfiupcXd63IIL+nu0fCu3s5JiUl0oyKQGE+WCb7YsB6QAAI gnbBhVDwF3/s9Z6J5Im0igb5yONI2cF2FzkvNC0t4DfHYlvQQnaPLkCiXE+UwXkv20qT +HNA== 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 g18si9469049edq.209.2019.10.21.09.41.09; Mon, 21 Oct 2019 09:41:32 -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; 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 S1728238AbfJUQkp (ORCPT + 99 others); Mon, 21 Oct 2019 12:40:45 -0400 Received: from mo4-p01-ob.smtp.rzone.de ([85.215.255.52]:13891 "EHLO mo4-p01-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726289AbfJUQkp (ORCPT ); Mon, 21 Oct 2019 12:40:45 -0400 X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVORvLd4SsytBXQrEOHTIXsMv3qxU1" X-RZG-CLASS-ID: mo00 Received: from localhost.localdomain by smtp.strato.de (RZmta 44.28.1 AUTH) with ESMTPSA id 409989v9LGedQlb (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Mon, 21 Oct 2019 18:40:39 +0200 (CEST) From: Stephan Gerhold To: Rob Clark , Sean Paul Cc: David Airlie , Daniel Vetter , Hai Li , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Stephan Gerhold , Nikita Travkin Subject: [PATCH] drm/msm/dsi: Implement qcom,dsi-phy-regulator-ldo-mode for 28nm PHY Date: Mon, 21 Oct 2019 18:34:25 +0200 Message-Id: <20191021163425.83697-1-stephan@gerhold.net> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The DSI PHY regulator supports two regulator modes: LDO and DCDC. This mode can be selected using the "qcom,dsi-phy-regulator-ldo-mode" device tree property. However, at the moment only the 20nm PHY driver actually implements that option. Add a check in the 28nm PHY driver to program the registers correctly for LDO mode. Tested-by: Nikita Travkin # l8150 Signed-off-by: Stephan Gerhold --- This is needed to make the display work on Longcheer L8150, which has recently gained mainline support in: https://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux.git/commit/?id=16e8e8072108426029f0c16dff7fbe77fae3df8f This patch is based on code from the downstream kernel: https://source.codeaurora.org/quic/la/kernel/msm-3.10/tree/drivers/video/msm/mdss/msm_mdss_io_8974.c?h=LA.BR.1.2.9.1-02310-8x16.0#n152 The LDO regulator configuration is taken from msm8916-qrd.dtsi: https://source.codeaurora.org/quic/la/kernel/msm-3.10/tree/arch/arm/boot/dts/qcom/msm8916-qrd.dtsi?h=LA.BR.1.2.9.1-02310-8x16.0#n56 --- drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c index b3f678f6c2aa..4579e6de4532 100644 --- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c +++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c @@ -48,6 +48,25 @@ static void dsi_28nm_phy_regulator_ctrl(struct msm_dsi_phy *phy, bool enable) return; } + if (phy->regulator_ldo_mode) { + u32 ldo_ctrl; + + if (phy->cfg->type == MSM_DSI_PHY_28NM_LP) + ldo_ctrl = 0x05; + else + ldo_ctrl = 0x0d; + + dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CTRL_0, 0x0); + dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CAL_PWR_CFG, 0); + dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CTRL_5, 0x7); + dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CTRL_3, 0); + dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CTRL_2, 0x1); + dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CTRL_1, 0x1); + dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CTRL_4, 0x20); + dsi_phy_write(phy->base + REG_DSI_28nm_PHY_LDO_CNTRL, ldo_ctrl); + return; + } + dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CTRL_0, 0x0); dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CAL_PWR_CFG, 1); dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CTRL_5, 0); @@ -56,6 +75,7 @@ static void dsi_28nm_phy_regulator_ctrl(struct msm_dsi_phy *phy, bool enable) dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CTRL_1, 0x9); dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CTRL_0, 0x7); dsi_phy_write(base + REG_DSI_28nm_PHY_REGULATOR_CTRL_4, 0x20); + dsi_phy_write(phy->base + REG_DSI_28nm_PHY_LDO_CNTRL, 0x00); } static int dsi_28nm_phy_enable(struct msm_dsi_phy *phy, int src_pll_id, @@ -77,8 +97,6 @@ static int dsi_28nm_phy_enable(struct msm_dsi_phy *phy, int src_pll_id, dsi_28nm_phy_regulator_ctrl(phy, true); - dsi_phy_write(base + REG_DSI_28nm_PHY_LDO_CNTRL, 0x00); - dsi_28nm_dphy_set_timing(phy, timing); dsi_phy_write(base + REG_DSI_28nm_PHY_CTRL_1, 0x00); -- 2.23.0