Received: by 10.223.185.116 with SMTP id b49csp7923927wrg; Thu, 1 Mar 2018 13:40:05 -0800 (PST) X-Google-Smtp-Source: AG47ELupadD5Lsaf+iPSOJsclO4unlhx+5eFL0uxe/3DhCwomHqkJwoQUHo7EfbF4i4DhacbAtIL X-Received: by 10.101.93.71 with SMTP id e7mr2728514pgt.248.1519940405148; Thu, 01 Mar 2018 13:40:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519940405; cv=none; d=google.com; s=arc-20160816; b=nS+GBe04z8U3fZ+UzkddspsP0vWjtmtKMe6RjD7d2bBYtbpd00QzYvccQFGlcxlRDA BtQh1XmL9btoR41AKCw2PyCRauzZVtr60WOc1bXDGZI0Bj22gJo8Wc/qpC3NiYXEb2b5 UNOuqMHcXBVeUrOlAZ/n6JlZ4KV8uO1OLllGTgNTEFj2rKcqq+BkmOqjH8MFEoYXQ0Jq aIaGHpas5T07PzrjMO+ujGsOQnUMzD5kJBuPp6tE9PYoPpwpKAdJEwANvqJqnffTkBE+ vpWmDxzKRPDO3gYvhivrKIrTwZ6TysdHPwyHSFIUlYLjldqRBc7rF3RAs4Q7UQ18RNdA cIBQ== 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:arc-authentication-results; bh=cSZ0R/tid8JdicGvud0luSO3jGI3MkKnpRGbksynA6U=; b=gmKXb1dQDgaSG7eN6zpTcWRTFHUmMOpIosIOkc8MXzsj+fi4dsNurizJQR3fwnaQtI kAzFEcv7S/Om9hgG+aoBBclhHA+UdQxe+wY3r9vADDT3wOXw6CBfZXymOoIZyczVRaGB VcgwZqIvPUg2vVQKT+uFuQq80RF0dafkhldbYa4/Bk3J2GH2W17WrExtpgrZCMAOVW2c Ed9JW652z6pFO6jbg03wNafGsMB8gIdlzZsJ8//8MM2b7o+kZYfTPgHmfn02jdlNSgwc xxcxOyQH0csoSuUsncQTDClDLvNZNQBLBTFN1gCIvm4iuy14O1NpX619Pp23U36SkKo/ zbqA== 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 t7-v6si3559203plz.752.2018.03.01.13.39.50; Thu, 01 Mar 2018 13:40:05 -0800 (PST) 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 S1162170AbeCAVfV (ORCPT + 99 others); Thu, 1 Mar 2018 16:35:21 -0500 Received: from mailoutvs4.siol.net ([213.250.19.137]:33171 "EHLO mail.siol.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1162157AbeCAVfR (ORCPT ); Thu, 1 Mar 2018 16:35:17 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.siol.net (Postfix) with ESMTP id C02FA522F92; Thu, 1 Mar 2018 22:35:15 +0100 (CET) X-Virus-Scanned: amavisd-new at psrvmta11.zcs-production.pri Received: from mail.siol.net ([127.0.0.1]) by localhost (psrvmta11.zcs-production.pri [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id zUwE1G7umtp7; Thu, 1 Mar 2018 22:35:15 +0100 (CET) Received: from mail.siol.net (localhost [127.0.0.1]) by mail.siol.net (Postfix) with ESMTPS id 48A6F522F8F; Thu, 1 Mar 2018 22:35:15 +0100 (CET) Received: from localhost.localdomain (cpe-86-58-68-135.ftth.triera.net [86.58.68.135]) (Authenticated sender: 031275009) by mail.siol.net (Postfix) with ESMTPSA id E0ED9522F92; Thu, 1 Mar 2018 22:35:12 +0100 (CET) From: Jernej Skrabec To: maxime.ripard@free-electrons.com, wens@csie.org, airlied@linux.ie, robh+dt@kernel.org, mark.rutland@arm.com, mturquette@baylibre.com, sboyd@kernel.org Cc: jernej.skrabec@siol.net, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH v3 09/16] drm/sun4i: Fix polarity configuration for DW HDMI PHY Date: Thu, 1 Mar 2018 22:34:35 +0100 Message-Id: <20180301213442.16677-10-jernej.skrabec@siol.net> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180301213442.16677-1-jernej.skrabec@siol.net> References: <20180301213442.16677-1-jernej.skrabec@siol.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Current polarity configuration code is cleary wrong since it compares same flag two times. However, even if flag name is fixed, it won't work well for resolutions which have one polarity positive and another negative. Fix that by properly set each bit according to each polarity. Since those two bits are not described in any documentation, relationships were obtained by experimentation. Fixes: b7c7436a5ff0 ("drm/sun4i: Implement A83T HDMI driver") Signed-off-by: Jernej Skrabec --- drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c index e5bfcdd43ec9..9d2f11ca3538 100644 --- a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c +++ b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c @@ -10,7 +10,8 @@ #define SUN8I_HDMI_PHY_DBG_CTRL_REG 0x0000 #define SUN8I_HDMI_PHY_DBG_CTRL_PX_LOCK BIT(0) #define SUN8I_HDMI_PHY_DBG_CTRL_POL_MASK GENMASK(15, 8) -#define SUN8I_HDMI_PHY_DBG_CTRL_POL(val) (val << 8) +#define SUN8I_HDMI_PHY_DBG_CTRL_POL_NHSYNC BIT(8) +#define SUN8I_HDMI_PHY_DBG_CTRL_POL_NVSYNC BIT(9) #define SUN8I_HDMI_PHY_DBG_CTRL_ADDR_MASK GENMASK(23, 16) #define SUN8I_HDMI_PHY_DBG_CTRL_ADDR(addr) (addr << 16) @@ -35,14 +36,14 @@ static int sun8i_hdmi_phy_config(struct dw_hdmi *hdmi, void *data, struct sun8i_hdmi_phy *phy = (struct sun8i_hdmi_phy *)data; u32 val = 0; - if ((mode->flags & DRM_MODE_FLAG_NHSYNC) && - (mode->flags & DRM_MODE_FLAG_NHSYNC)) { - val = 0x03; - } + if (mode->flags & DRM_MODE_FLAG_NHSYNC) + val |= SUN8I_HDMI_PHY_DBG_CTRL_POL_NHSYNC; + + if (mode->flags & DRM_MODE_FLAG_NVSYNC) + val |= SUN8I_HDMI_PHY_DBG_CTRL_POL_NVSYNC; regmap_update_bits(phy->regs, SUN8I_HDMI_PHY_DBG_CTRL_REG, - SUN8I_HDMI_PHY_DBG_CTRL_POL_MASK, - SUN8I_HDMI_PHY_DBG_CTRL_POL(val)); + SUN8I_HDMI_PHY_DBG_CTRL_POL_MASK, val); regmap_update_bits(phy->regs, SUN8I_HDMI_PHY_REXT_CTRL_REG, SUN8I_HDMI_PHY_REXT_CTRL_REXT_EN, -- 2.16.2