Received: by 2002:ab2:1c04:0:b0:1f7:53ba:1ebe with SMTP id f4csp72247lqg; Fri, 26 Apr 2024 09:04:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU8Xsh/uqRW4HkYc0mLEBqADBhozHbaUgJ96DqqnU962fdtm9Exe/eSPxcUxHr8teRPNF0C6ULXdSnySxsm8SuiQtc2/x1ZsxVY7ROjAg== X-Google-Smtp-Source: AGHT+IGdoMtl8IJRVCnv0Pip7WqWYa4ICg+SW94opd1jvjhdDa0FgDb59OZxZYS+KWYxx0Dqp0L4 X-Received: by 2002:a05:6902:1351:b0:dd0:bb34:1e77 with SMTP id g17-20020a056902135100b00dd0bb341e77mr3371247ybu.53.1714147465361; Fri, 26 Apr 2024 09:04:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714147465; cv=pass; d=google.com; s=arc-20160816; b=GQ4J3MMnwK9yew22EYZLfFoGPeygklIExGS4Yg3adCWEfyO8ougRbpKLk4ywXrJOSp hGthtFwT6madiIvOTgoP5rUQQIb8RhKsCgCc3avEHXpVUluqNF43ScyEXA2CprM5R+a8 ZOpewv6fsGaJfE8sXF+OLCxv5LRnzinfn86LZBD3HnGkNWg9hWNAhODz64THuSDpV9qA hvZ12x3m27ARKIJ1tg3SNMQ2Es5E4SJc089VFZOHSzzfrIAaWnE6h6f6TU98mBx3pBWW hkHLpz93EoehvyU2voQEQ0QQ4GyJFa410ZVMYgBlcFT16zxvF0YuiH/J3FnJWCzLm9i8 S8tQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=LlYVJCYtRxxPVBcJn9HswhGBQFKRvWfDNGI/lisBMlg=; fh=ewmBvZNuSAJyDViTSqL7jR9OrzpkMckl5Pd44ZWWVBA=; b=kZyk9n4jKH+mqr/chb6z0sHZ5683Mak9d3+gwVAFLU+N2PBzsmoi92NBhZBfXgNCZc 3THzoj2WLPzQOlZmkKg2PSgqJuh+UAIwIlhsH1FobKdJizR74pxKXs6p68+sVIRe/NXP cPcUyLFRQKhKBrUfGhswf/QA7YzDW6MzkgaMM3RCvy1kmQ++GprFomT6cSDUuGO43KyE 9/zRX84BWxOv1+HbmwgcESn+3xLI35HNu6h9H3SnNHN+1CJDlcs3LI9g5+bE/stzDSKu JQwCjtFX7O1j6Xjy1QNa9WTkkBFHJRh9Z5K0Lpxyc++ZjP7yfrKlUZvhAksWaC7/4LhL RsOg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=utlDPrwG; arc=pass (i=1 spf=pass spfdomain=baylibre.com dkim=pass dkdomain=baylibre-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-160352-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160352-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id t10-20020a056902124a00b00dcc57b1abebsi9370343ybu.80.2024.04.26.09.04.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 09:04:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-160352-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=utlDPrwG; arc=pass (i=1 spf=pass spfdomain=baylibre.com dkim=pass dkdomain=baylibre-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-160352-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160352-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id A3C9E1C241BA for ; Fri, 26 Apr 2024 16:03:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D13B3152520; Fri, 26 Apr 2024 16:03:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="utlDPrwG" Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com [209.85.208.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 662C5149C64 for ; Fri, 26 Apr 2024 16:03:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714147402; cv=none; b=cQWQ9z3WkiJjFaiiovkFon9qTEA57nZmTgv1Dm8PkIbNBJNWeLY/lzVCna8qdoK1ZT6UuWAUEXnvLsLze1txRvpaOQMqS7HQW33068+UfgRCegfIoPHiG8+lOttDgpkLU+zPd5z6a3idhW6sM6dH7SWF+XxRryfSfcBAfIWnTJo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714147402; c=relaxed/simple; bh=UhWU3YDhjhCDZmu7A2apQsuTrQdWtiVU0TH4R8sMQlM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bcZ/u1YY8GebIFS4Gpeo6u0UOfaS4Zff9tYwEURQw6yOVjBAJFwGXjhDvY9Qod9x5LsgXL3lG3wx3i8i8UkBo8DuS06NgfpJIz9zYAr+h8VYDuCWeC/P3YrAO22fpRNNztrE7mturq0s5YqivrT2EJCeDcCIHlBsk0EBzyXooXw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=utlDPrwG; arc=none smtp.client-ip=209.85.208.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Received: by mail-lj1-f175.google.com with SMTP id 38308e7fff4ca-2db101c11beso25287581fa.0 for ; Fri, 26 Apr 2024 09:03:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1714147398; x=1714752198; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LlYVJCYtRxxPVBcJn9HswhGBQFKRvWfDNGI/lisBMlg=; b=utlDPrwGoehqIcAsfph1Y8eWR7W/kNoHH9vXKSlxkxCg173uZASHs+/BoUn2c5tk2p xnYJSC53oYxwGM3eciJieoRpmi8I/ro9FUS8gSaBuizOSey4eVKJ6F4JfMHIvDCdiUUs zMj/5YpZy12mRxH6vxysuxvT/1pzYUap3EDXxrjwJGwFKYtbOGqXKPbRxM1SSYbhM96f nt0i1rEjtNSiVAF1TcTZqmXGMuZ0lHgLka9lRqL17eqKmcTnlfbxApQHGjVKmBqOSGZj ITNFnVA4+pNJi9Y2XAEUFbP1NGWY+8gwJS6niw5HZvTTdOc76weu4zDYBnLDUbmK9Yzo +Prw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714147398; x=1714752198; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LlYVJCYtRxxPVBcJn9HswhGBQFKRvWfDNGI/lisBMlg=; b=hV18L8pIPJfXyCTztqVoMX9lQLPt4W1od9Rbqlkpcck2ebjT9wCiE+DUj2fS2cfcBx 2PcBV8t6uY8oFQy/6B4+7REmt53BTfkDBLPKAWksj+12exalRihIdIgRMW8E0pqWlkwz 0+gXY9l7cufb3RIneli3r3rsomxl/lwqooU9MnV4ak9Ylt0XdODArm2Ib4T2Ud3PiluW XIV8igf1MydWWkN0naU3EYMT5elgG7DdwFiXTvza72KlmjK8p+82zp+kDyiQcQqq+1lk wIfmsOCOzmFuIM2n6o1bC0OFvXY9q3vOqYEq114+KypvJtvoVwcT7G2leKS35/TVt2PM iQrw== X-Forwarded-Encrypted: i=1; AJvYcCV8iuV0OQII2VmqVxIJTeE917VE/t+3MY/3lXw56D5ztElFHgvnhHTT0R4N+gMFoIL1e1CYHtkiiNoWmwsSNlMxNAhNrOs1iny+RFnx X-Gm-Message-State: AOJu0Yw14lBzxfJCmac5bi1djRj5z6FJSOMqodJqzAPTmzLA26rOyzIe RwGKJg5CQSebGeWroE2pp30U3WuIQDkeQqCSFFPoMUtkPquwWQ5pbUauQHQA83s= X-Received: by 2002:a05:651c:1a26:b0:2df:7009:63e3 with SMTP id by38-20020a05651c1a2600b002df700963e3mr1496141ljb.29.1714147398483; Fri, 26 Apr 2024 09:03:18 -0700 (PDT) Received: from toaster.lan ([2a01:e0a:3c5:5fb1:1926:f73e:8b99:1c0a]) by smtp.googlemail.com with ESMTPSA id p14-20020a05600c1d8e00b0041bab13cd74sm1271408wms.17.2024.04.26.09.03.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 09:03:18 -0700 (PDT) From: Jerome Brunet To: Neil Armstrong , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter Cc: Jerome Brunet , Kevin Hilman , Martin Blumenstingl , dri-devel@lists.freedesktop.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] drm/meson: dw-hdmi: power up phy on device init Date: Fri, 26 Apr 2024 18:02:53 +0200 Message-ID: <20240426160256.3089978-2-jbrunet@baylibre.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240426160256.3089978-1-jbrunet@baylibre.com> References: <20240426160256.3089978-1-jbrunet@baylibre.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Bot: notify Content-Transfer-Encoding: 8bit The phy is not in a useful state right after init. It will become useful, including for auxiliary function such as CEC or ARC, after the first mode is set. This is a problem on systems where the display is using another interface like DSI or CVBS. This change refactor the init and mode change callback to power up the PHY on init and leave only what is necessary for mode changes in the related function. This is enough to fix CEC operation when HDMI display is not enabled. Fixes: 3f68be7d8e96 ("drm/meson: Add support for HDMI encoder and DW-HDMI bridge + PHY") Signed-off-by: Jerome Brunet --- drivers/gpu/drm/meson/meson_dw_hdmi.c | 51 +++++++++------------------ 1 file changed, 17 insertions(+), 34 deletions(-) diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c index 5a9538bc0e26..a83d93078537 100644 --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c @@ -384,26 +384,6 @@ static int dw_hdmi_phy_init(struct dw_hdmi *hdmi, void *data, dw_hdmi_bus_fmt_is_420(hdmi)) mode_is_420 = true; - /* Enable clocks */ - regmap_update_bits(priv->hhi, HHI_HDMI_CLK_CNTL, 0xffff, 0x100); - - /* Bring HDMITX MEM output of power down */ - regmap_update_bits(priv->hhi, HHI_MEM_PD_REG0, 0xff << 8, 0); - - /* Bring out of reset */ - dw_hdmi->data->top_write(dw_hdmi, HDMITX_TOP_SW_RESET, 0); - - /* Enable internal pixclk, tmds_clk, spdif_clk, i2s_clk, cecclk */ - dw_hdmi_top_write_bits(dw_hdmi, HDMITX_TOP_CLK_CNTL, - 0x3, 0x3); - - /* Enable cec_clk and hdcp22_tmdsclk_en */ - dw_hdmi_top_write_bits(dw_hdmi, HDMITX_TOP_CLK_CNTL, - 0x3 << 4, 0x3 << 4); - - /* Enable normal output to PHY */ - dw_hdmi->data->top_write(dw_hdmi, HDMITX_TOP_BIST_CNTL, BIT(12)); - /* TMDS pattern setup */ if (mode->clock > 340000 && !mode_is_420) { dw_hdmi->data->top_write(dw_hdmi, HDMITX_TOP_TMDS_CLK_PTTN_01, @@ -425,20 +405,6 @@ static int dw_hdmi_phy_init(struct dw_hdmi *hdmi, void *data, /* Setup PHY parameters */ meson_hdmi_phy_setup_mode(dw_hdmi, mode, mode_is_420); - /* Setup PHY */ - regmap_update_bits(priv->hhi, HHI_HDMI_PHY_CNTL1, - 0xffff << 16, 0x0390 << 16); - - /* BIT_INVERT */ - if (dw_hdmi_is_compatible(dw_hdmi, "amlogic,meson-gxl-dw-hdmi") || - dw_hdmi_is_compatible(dw_hdmi, "amlogic,meson-gxm-dw-hdmi") || - dw_hdmi_is_compatible(dw_hdmi, "amlogic,meson-g12a-dw-hdmi")) - regmap_update_bits(priv->hhi, HHI_HDMI_PHY_CNTL1, - BIT(17), 0); - else - regmap_update_bits(priv->hhi, HHI_HDMI_PHY_CNTL1, - BIT(17), BIT(17)); - /* Disable clock, fifo, fifo_wr */ regmap_update_bits(priv->hhi, HHI_HDMI_PHY_CNTL1, 0xf, 0); @@ -656,6 +622,23 @@ static void meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi) meson_dw_hdmi->data->top_write(meson_dw_hdmi, HDMITX_TOP_CLK_CNTL, 0xff); + /* Enable normal output to PHY */ + meson_dw_hdmi->data->top_write(meson_dw_hdmi, HDMITX_TOP_BIST_CNTL, BIT(12)); + + /* Setup PHY */ + regmap_update_bits(priv->hhi, HHI_HDMI_PHY_CNTL1, + 0xffff << 16, 0x0390 << 16); + + /* BIT_INVERT */ + if (dw_hdmi_is_compatible(meson_dw_hdmi, "amlogic,meson-gxl-dw-hdmi") || + dw_hdmi_is_compatible(meson_dw_hdmi, "amlogic,meson-gxm-dw-hdmi") || + dw_hdmi_is_compatible(meson_dw_hdmi, "amlogic,meson-g12a-dw-hdmi")) + regmap_update_bits(priv->hhi, HHI_HDMI_PHY_CNTL1, + BIT(17), 0); + else + regmap_update_bits(priv->hhi, HHI_HDMI_PHY_CNTL1, + BIT(17), BIT(17)); + /* Enable HDMI-TX Interrupt */ meson_dw_hdmi->data->top_write(meson_dw_hdmi, HDMITX_TOP_INTR_STAT_CLR, HDMITX_TOP_INTR_CORE); -- 2.43.0