From patchwork Tue Jul 3 16:56:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 10504753 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1D7B26035E for ; Tue, 3 Jul 2018 16:56:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0BF8628C22 for ; Tue, 3 Jul 2018 16:56:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F2CEE28C3A; Tue, 3 Jul 2018 16:56:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B16D128C22 for ; Tue, 3 Jul 2018 16:56:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AFB2488E9B; Tue, 3 Jul 2018 16:56:52 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yb0-x242.google.com (mail-yb0-x242.google.com [IPv6:2607:f8b0:4002:c09::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1DEC388E9B for ; Tue, 3 Jul 2018 16:56:51 +0000 (UTC) Received: by mail-yb0-x242.google.com with SMTP id s14-v6so989076ybp.13 for ; Tue, 03 Jul 2018 09:56:51 -0700 (PDT) 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; bh=b9srsZ0GYYSkuaa1x11ekBoJxoe07HKDB7Im3bBN8F8=; b=AwTmyYn7IMGie0UuHIRfqOzZOEI4K//4kSzFRpBSJVJITQ2NeVos8OmmiqhvLeqUbU sXHqmq4z3SHzMo2QLUTvZoCdgftJ8Q93LGZVPdt1KcJ+X7pBiGCruFHnvzu26bScQaJB nZHhrWz+BubBsRvXwnY1K+CJzC3xiy7u5LFC5tBQTGEKWJ/SV6VwwD+tpb6YJAZp3rVw /AmvGiemospkWg4K745YwT4Nc3K9mI97dAc0d7bukY8cgq/5J4nixWrXScSAnq7c+ufE 35I/Cuxfe82IHM4RuB5jDfHAOT1zNWC30SnwnWOmnIxHWj9vC5YqD7fuaS3Mjr1+3UUG U/Zw== X-Gm-Message-State: APt69E2j85qxT3G4gzDM/kGycw24RtH4+YEpYlqQqroZAP2FYZ23/Jm6 AVT8tCXs5va1oxpd3pLe9v94c1PubRg= X-Google-Smtp-Source: AAOMgpfl0QlpGl3g8APMVZijyhXw0AZasE4L0RgyHdux+hQOB70Q7wITGnDuBgweYXKLMnK8W4nqaw== X-Received: by 2002:a25:c614:: with SMTP id k20-v6mr5183122ybf.375.1530637010122; Tue, 03 Jul 2018 09:56:50 -0700 (PDT) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:ad55:b1db:adfe:3b9f]) by smtp.gmail.com with ESMTPSA id q131-v6sm999898ywq.8.2018.07.03.09.56.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Jul 2018 09:56:49 -0700 (PDT) From: Sean Paul To: dri-devel@lists.freedesktop.org, robdclark@gmail.com, linux-arm-msm@vger.kernel.org Subject: [PATCH] drm/bridge: adv7511: Reset registers on hotplug Date: Tue, 3 Jul 2018 12:56:03 -0400 Message-Id: <20180703165648.120401-1-seanpaul@chromium.org> X-Mailer: git-send-email 2.18.0.399.gad0ab374a1-goog X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Pinchart MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP The bridge loses its hw state when the cable is unplugged. If we detect this case in the hpd handler, reset its state. Reported-by: Rob Clark Signed-off-by: Sean Paul Tested-by: Rob Clark Reviewed-by: Archit Taneja --- This is the follow-up to "drm/msm: Disable mdp5 crtc when there are no active planes". I incorrectly assumed the modeset was required from the msm side, but Rob pointed out that he thought it might be a bridge issue. drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c index 73021b388e12..dd3ff2f2cdce 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c @@ -429,6 +429,18 @@ static void adv7511_hpd_work(struct work_struct *work) else status = connector_status_disconnected; + /* + * The bridge resets its registers on unplug. So when we get a plug + * event and we're already supposed to be powered, cycle the bridge to + * restore its state. + */ + if (status == connector_status_connected && + adv7511->connector.status == connector_status_disconnected && + adv7511->powered) { + regcache_mark_dirty(adv7511->regmap); + adv7511_power_on(adv7511); + } + if (adv7511->connector.status != status) { adv7511->connector.status = status; if (status == connector_status_disconnected)