Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4301844imm; Fri, 18 May 2018 02:51:35 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqh3mazweO11n/Bv078Uo67SfGHgyjQ+UD5LpLc7adgd05u6cXEyhzCbGA2kreBXbQOURjr X-Received: by 2002:a62:93c8:: with SMTP id r69-v6mr8706746pfk.59.1526637095119; Fri, 18 May 2018 02:51:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526637095; cv=none; d=google.com; s=arc-20160816; b=NAkso3kTN1Oanr5NbZY9ttPnaoO5dDtS9KlflQ3n77mUn2BoLQMJ2lWw7opD4dSbb5 vgXGOrjnkvRhzmX84vnDk3W9TOMsr9jvEYLV40ZjCC5L/RMywzSthlsLlYiXrVpHHUmy 75cRKwPnbmuXRLwhaLEnrL7ipkXacf8wClRpbKyE31ddu6Unw1o0/OJ/0raRzuVa1nVB UxpCfEtnt5QuDN1eQDR1gbNq9CmqtYI2BVZ0MO+J1CEPvia1ogQ9BrwWPpqlc1g3u2aB 68EcOgCZXTkt1W8s8BUBI41VU2bH/3xeylsCWxVhgdmHj+efQsYyJav68SFEFdUC3zEy WzWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=KmgiegBpzOs7MZSbvYAYJJwQFNv12NzGqQPTm5FS1RE=; b=aXazr07vWcLvuFVlYEMgT/gnwkVcL2G5UWYawPWObMxgi1Ig/yzEZqfyV8n22X4Ati wu9gTb0IN+Es4fZn+m+aZ2lY7N9iu5ws1cjyn+vEfv8fJ6cHUZYq8mJz6WQt4g5WO/lX fTmmA4llpEMddUDXr/0XGc1TBtwtsC94rv/G4GK8WTz5hlP0QRhglWRQ2Gij1PmSqDcm gQ/ZvRisNhBwgnWs+dS+iP3VEuBXZvHmgTU/ldsZs7wD5Szhai4vSYJWVXdeRbwqBeh2 hAC4GO/RB0CkJguTeSqlkyd3WnIHu7gDM08wyxS6wHiP4krFeqkJSIdqdL0soDc+hRAL poxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=HZ92rTu8; 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 p14-v6si5840982pgc.216.2018.05.18.02.51.20; Fri, 18 May 2018 02:51:35 -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=@amarulasolutions.com header.s=google header.b=HZ92rTu8; 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 S1753005AbeERJsT (ORCPT + 99 others); Fri, 18 May 2018 05:48:19 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:34664 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752915AbeERJsN (ORCPT ); Fri, 18 May 2018 05:48:13 -0400 Received: by mail-pl0-f67.google.com with SMTP id ay10-v6so4297857plb.1 for ; Fri, 18 May 2018 02:48:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=KmgiegBpzOs7MZSbvYAYJJwQFNv12NzGqQPTm5FS1RE=; b=HZ92rTu8mUPS69bY7Vlxk7lQbS8oX+l+NvOawAtNGjDQFl1uP4yHcdzeBzeEg5BqCr ndIX/BdAMhWtibU6U0/6VQPj8AUF1reJ3lPvzMikJze1wvh11TG4VI6PEkwfFLcJEc4O Nwi1fhHMIPSf3MevLcKz0F+l6UlMBWySCllBo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=KmgiegBpzOs7MZSbvYAYJJwQFNv12NzGqQPTm5FS1RE=; b=KN9b5FEU9VWx0w8Rp4aN6Ex/r5q9uPbTwz0MfswYuwbhADO7kXYFG/yutpvtHU+Eu1 3TO0+atSlODhlmWi1Lel74VfmV+jcU2AGQgR0kBZDH7WazdRsb1cxj/Z9ryuUkvR9Rb6 2LWeE5kS/GHm/X61GYC1Lfk2Z/heakAi6eUt2RC97NAj0fYE+4CGzaW1aXEXr+w7q+cx DRVPngNM7komNNL0LBdJchlvVcRW2MrG93qVYn6djv8bYdrSUe4Rh/00gItJ8OKXGZAk FnT4RZkg37/Q3JlUtMq1i1SJd1TiQUKorPXUJtoWQLvH53Pe9k8JA+zY0UvICsuE2p64 zY+Q== X-Gm-Message-State: ALKqPwfwV84CceU7rrLMaGsAK2x3ax9vCz03fKphsMM8cEYQKV7B7+xX NIYQVJPcof/GTcq9od7vU6U9aA== X-Received: by 2002:a17:902:8308:: with SMTP id bd8-v6mr962739plb.195.1526636893079; Fri, 18 May 2018 02:48:13 -0700 (PDT) Received: from localhost.localdomain ([183.82.227.74]) by smtp.gmail.com with ESMTPSA id j11-v6sm12694097pff.64.2018.05.18.02.48.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 May 2018 02:48:12 -0700 (PDT) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Icenowy Zheng , Jernej Skrabec , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , David Airlie , dri-devel@lists.freedesktop.org, Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, Michael Trimarchi , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Cc: Jagan Teki Subject: [PATCH v2 20/26] drm: sun4i: add support for HVCC regulator for DWC HDMI glue Date: Fri, 18 May 2018 15:15:30 +0530 Message-Id: <20180518094536.17201-21-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180518094536.17201-1-jagan@amarulasolutions.com> References: <20180518094536.17201-1-jagan@amarulasolutions.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Icenowy Zheng Allwinner SoCs with DWC HDMI controller have a "HVCC" power pin for the HDMI part, and on some boards it's connected to a dedicated regulator rather than the main 3.3v. Add support for optional HVCC regulator. For boards that doesn't use a dedicated regulator to power it, the default dummy regulator is used. Signed-off-by: Icenowy Zheng Signed-off-by: Jagan Teki --- Changes for v2: - none drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c | 14 ++++++++++++++ drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c index 9f40a44b456b..7c33faff7ad4 100644 --- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c +++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c @@ -73,6 +73,12 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master, if (encoder->possible_crtcs == 0) return -EPROBE_DEFER; + hdmi->vcc_hdmi = devm_regulator_get(dev, "hvcc"); + if (IS_ERR(hdmi->vcc_hdmi)) { + dev_err(dev, "Could not get HDMI power supply\n"); + return PTR_ERR(hdmi->vcc_hdmi); + } + hdmi->rst_ctrl = devm_reset_control_get(dev, "ctrl"); if (IS_ERR(hdmi->rst_ctrl)) { dev_err(dev, "Could not get ctrl reset control\n"); @@ -91,6 +97,12 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master, return ret; } + ret = regulator_enable(hdmi->vcc_hdmi); + if (ret) { + dev_err(dev, "Cannot enable HDMI power supply\n"); + goto err_disable_vcc; + } + ret = clk_prepare_enable(hdmi->clk_tmds); if (ret) { dev_err(dev, "Could not enable tmds clock\n"); @@ -143,6 +155,8 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master, clk_disable_unprepare(hdmi->clk_tmds); err_assert_ctrl_reset: reset_control_assert(hdmi->rst_ctrl); +err_disable_vcc: + regulator_disable(hdmi->vcc_hdmi); return ret; } diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h index 303189d6602c..65366eeb38d8 100644 --- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h +++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h @@ -10,6 +10,7 @@ #include #include #include +#include #include #define SUN8I_HDMI_PHY_DBG_CTRL_REG 0x0000 @@ -175,6 +176,7 @@ struct sun8i_dw_hdmi { struct drm_encoder encoder; struct sun8i_hdmi_phy *phy; struct dw_hdmi_plat_data plat_data; + struct regulator *vcc_hdmi; struct reset_control *rst_ctrl; }; -- 2.14.3