From patchwork Sun Jan 9 17:29:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1833 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 31D463F1DF for ; Sun, 9 Jan 2022 18:30:09 +0100 (CET) Received: by mail-pf1-f200.google.com with SMTP id f9-20020a623809000000b004bd0fd5e057sf2087119pfa.4 for ; Sun, 09 Jan 2022 09:30:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1641749404; cv=pass; d=google.com; s=arc-20160816; b=ccmNrVr9sUF5MKlGu5vme35eRPzPNubpE0fqJCaqy8r8cJxrun6i6Gp8H/sz8gAJnT PSyV7dlANuTVXcTo8z+gYJzqcq8Y7yvMlBo6GIHG0VnA/zki3gVmTm3VjBMoPJyCGbN4 6m2s2/W1vMn+vX8rrGjfziTxEsGp7SRXGOooOrw6wOV15xS42La+HDUnAJ03Is5xHhHF SLZVh9ALHih9f/p73hc9q4VNbtMI6NqN2xp0QKsv6iCt/zRA4LcUiUsadtkoFI5HPMfi twiJACRkwq84Y2IqOCmHB/dHkLe1hzc/uupspwQwyVBgPoYFrkWi2GJJ+rGY5K8MhlMF ShFw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:message-id:date:subject:cc:to :from:dkim-signature; bh=S5GyKAJb7TdguHfzalnfCHeX13fc6p1lnpeGdlmBWMg=; b=Hy1FFonq9tUOdpwnHlAnoKQHmaQHb+JOtGViSZR94SF1U7Z8F1YkKr5cVqPHZYgHVO pb5dQEx02137nC1py8UzEQZ26yAFYff72WFsWB6Y6/CgMAC4YsbyHxR+VyDT+bDawne9 MWXisQFpa7dgoDtdaqtE8SYSifOnJ6xVywHpsbubxHUYLeTe4GCaCv3KI89hd0UAXov6 L+AMI+5icPBy0G0hXTSSVbKGSBam7tjnHgDs6iGYi0+ZKc9ppk1zFl/hN7rdhfU5W/uV HDqrogMwheTaBcidVLv5VbUDhgfjdNKgyQugvdE+lE13AG/MRiTrPzk1ZqwwXbEIDAYO uQ7A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=e9997IG3; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=S5GyKAJb7TdguHfzalnfCHeX13fc6p1lnpeGdlmBWMg=; b=Q+eQbyzSzNGlKkc1WZqaCZJNdGONbR7nUHhsXXJDMR18XtoktSQN6YLze1U4PweAIW 8AW1unNwWJe9tXNBqUSBfQv3j5BkSHKRxKnzdwA0koEL9fqLNWagdzpQ8s9xEfRaRqUb 1+WNPPBMTTCsA0s3u9+TLSl38jtzwrswoW4lI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help :list-archive:list-unsubscribe; bh=S5GyKAJb7TdguHfzalnfCHeX13fc6p1lnpeGdlmBWMg=; b=KWgUnsmtC7dkLUP2hZfbByiwW5MskL+HI9qm6Hkv7IkXx/fgZlfd6DL+3+ikLDorT3 +wWYBTATOsJ9sZi/ZvwhVBrG6hKwXLptfeweoMENqL2XUaiOAbWppyVjMBwxy5qXx+3z hlYiVDCKVIeiPByVkRpXY6ZLTQGtaQjsskr4X4RF6+mxmjaePfQg2v32hb8t44pPAmnL ux+S/C2vj8pMx5Fz11DjR1pOrOQE8WFgbScwIpnUFC2rFTDuVpVteqqEPA6tJFBC/4mT skDC5iaw42dehDxfUxcu/XvsHOl4gxQDcrL6QimsJs2nnmBZLI2DHNIAtfr06o0rFMla jsWg== X-Gm-Message-State: AOAM532lEFdCcYGFidOjzRG33ZMKzfxodbaoj/TayDjAmz6XV/3kN0jO iD8tY+SdnUSKYod7qIBb2npMjlVZ X-Google-Smtp-Source: ABdhPJyb7pfsikw2gMtgKDk6dbL98k9T7/O63ctQc7FOS0Ct6RNFfTczVokwp9lu8chPnJn0RDsjcQ== X-Received: by 2002:a05:6a00:1ac6:b0:4bd:1ad:5658 with SMTP id f6-20020a056a001ac600b004bd01ad5658mr11104366pfv.48.1641749404244; Sun, 09 Jan 2022 09:30:04 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a63:9209:: with SMTP id o9ls3433257pgd.0.gmail; Sun, 09 Jan 2022 09:30:03 -0800 (PST) X-Received: by 2002:a63:7c50:: with SMTP id l16mr3097765pgn.95.1641749403159; Sun, 09 Jan 2022 09:30:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641749403; cv=none; d=google.com; s=arc-20160816; b=EVtOL4cG7slAWMTjclw/qgg5Jw1Ne5DRuM6HN5V/BohwXggc8BMKw9FYrV7zuVT6zZ c00oz4lQuGlTKHWv54DgW/fm4S0/TZMx6WHfG5o/5i1e33ae6m7yhmc72eBBnsz7ncpw STq4h3tIufTx3car6RAZRSk93VxRo67YET5XS86Q85UrScQc8bj8xlK9e4MFwiJhDrH7 ICntyTfrbmGbYfzgqIRhk/4BlLwrydnH6lcGVKl4Im02xhxq1/9+M/w+AGRymelT4Bpm uxd9GcvdIF5CQiOngrrkWlW85Hamuy2i0vgctK3KgnzmU6gvJLJHPrnFnSEzKi97y65m Zy3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=BrAbSJiFEPNWxZQr5pU93mRKFRXoQh8mvz4tdVB9MPE=; b=c8bc5ZRIv6tjll7CtdjQzE98boIXjbZdDIoyUeCNwbbIOmuJLoO8AMi3cf7cCufLZT ol4l4XZvaP7Tgg9s/XPrQVeZX9kf8cQOLvkFSWXhgxLnRNQd8JjlBRf29F1g9srgakIE rXS9gMY2kjt3yWSLu+SqRIvU/EVr5lXZ99CLBhD/tvK8UkWUWVpRNAz461alEtCZs23r vM0I1y9rZ1hnvcfHHqBI/RB0h4NAtR+fsiBBf9Gmxva6XewPPKIZM0xvAoteKURSUlAT Bm9r1VCS8tYnjK09GdhfX12FNPSS10sEBgeT2MeDn6C+36OiZPjW0ns6/JDcrk1lve+p 9o4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=e9997IG3; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id lr7sor1512367pjb.3.2022.01.09.09.29.59 for (Google Transport Security); Sun, 09 Jan 2022 09:29:59 -0800 (PST) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a17:90b:1c8f:: with SMTP id oo15mr25272609pjb.125.1641749398764; Sun, 09 Jan 2022 09:29:58 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a0a9:2576:1414:50fa:2e4d]) by smtp.gmail.com with ESMTPSA id hi3sm1519281pjb.52.2022.01.09.09.29.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jan 2022 09:29:58 -0800 (PST) From: Jagan Teki To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart Cc: dri-devel@lists.freedesktop.org, linux-amarula@amarulasolutions.com, Jagan Teki Subject: [PATCH] drm: bridge: adv7511: Fix ADV7535 HPD enablement Date: Sun, 9 Jan 2022 22:59:49 +0530 Message-Id: <20220109172949.168167-1-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=e9997IG3; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Existing HPD enablement logic is not compatible with ADV7535 bridge, thus any runtime plug-in of HDMI cable is not working on these bridge designs. Unlike other ADV7511 family of bridges, the ADV7535 require HPD_OVERRIDE bit to set and reset for proper handling of HPD functionality. Fix it. Fixes: 8501fe4b14a3 ("drm: bridge: adv7511: Add support for ADV7535") Signed-off-by: Jagan Teki Reviewed-by: Robert Foss --- drivers/gpu/drm/bridge/adv7511/adv7511.h | 1 + drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 29 +++++++++++++++----- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511.h b/drivers/gpu/drm/bridge/adv7511/adv7511.h index 592ecfcf00ca..6a882891d91c 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511.h +++ b/drivers/gpu/drm/bridge/adv7511/adv7511.h @@ -169,6 +169,7 @@ #define ADV7511_PACKET_ENABLE_SPARE2 BIT(1) #define ADV7511_PACKET_ENABLE_SPARE1 BIT(0) +#define ADV7535_REG_POWER2_HPD_OVERRIDE BIT(6) #define ADV7511_REG_POWER2_HPD_SRC_MASK 0xc0 #define ADV7511_REG_POWER2_HPD_SRC_BOTH 0x00 #define ADV7511_REG_POWER2_HPD_SRC_HPD 0x40 diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c index f8e5da148599..77118c3395bf 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c @@ -351,11 +351,17 @@ static void __adv7511_power_on(struct adv7511 *adv7511) * from standby or are enabled. When the HPD goes low the adv7511 is * reset and the outputs are disabled which might cause the monitor to * go to standby again. To avoid this we ignore the HPD pin for the - * first few seconds after enabling the output. + * first few seconds after enabling the output. On the other hand + * adv7535 require to enable HPD Override bit for proper HPD. */ - regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER2, - ADV7511_REG_POWER2_HPD_SRC_MASK, - ADV7511_REG_POWER2_HPD_SRC_NONE); + if (adv7511->type == ADV7535) + regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER2, + ADV7535_REG_POWER2_HPD_OVERRIDE, + ADV7535_REG_POWER2_HPD_OVERRIDE); + else + regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER2, + ADV7511_REG_POWER2_HPD_SRC_MASK, + ADV7511_REG_POWER2_HPD_SRC_NONE); } static void adv7511_power_on(struct adv7511 *adv7511) @@ -375,6 +381,10 @@ static void adv7511_power_on(struct adv7511 *adv7511) static void __adv7511_power_off(struct adv7511 *adv7511) { /* TODO: setup additional power down modes */ + if (adv7511->type == ADV7535) + regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER2, + ADV7535_REG_POWER2_HPD_OVERRIDE, 0); + regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER, ADV7511_POWER_POWER_DOWN, ADV7511_POWER_POWER_DOWN); @@ -672,9 +682,14 @@ adv7511_detect(struct adv7511 *adv7511, struct drm_connector *connector) status = connector_status_disconnected; } else { /* Renable HPD sensing */ - regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER2, - ADV7511_REG_POWER2_HPD_SRC_MASK, - ADV7511_REG_POWER2_HPD_SRC_BOTH); + if (adv7511->type == ADV7535) + regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER2, + ADV7535_REG_POWER2_HPD_OVERRIDE, + ADV7535_REG_POWER2_HPD_OVERRIDE); + else + regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER2, + ADV7511_REG_POWER2_HPD_SRC_MASK, + ADV7511_REG_POWER2_HPD_SRC_BOTH); } adv7511->status = status;