From patchwork Tue Jan 17 00:52:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 9519703 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 67E17601C3 for ; Tue, 17 Jan 2017 00:53:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 52F6728339 for ; Tue, 17 Jan 2017 00:53:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 479DF28441; Tue, 17 Jan 2017 00:53:03 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID 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 F1A0028339 for ; Tue, 17 Jan 2017 00:53:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7DA1E6E598; Tue, 17 Jan 2017 00:53:01 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg0-x22b.google.com (mail-pg0-x22b.google.com [IPv6:2607:f8b0:400e:c05::22b]) by gabe.freedesktop.org (Postfix) with ESMTPS id 17DF46E594 for ; Tue, 17 Jan 2017 00:52:59 +0000 (UTC) Received: by mail-pg0-x22b.google.com with SMTP id 204so19524553pge.0 for ; Mon, 16 Jan 2017 16:52:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=sWjlHfkAdFPS7THvUnxewh0hlmeuHPyRDdSMGB2nyb0=; b=MRDjhUhC2FOXq2OPuRfJVkOt1BElZwYgmcNmaxj450YHTpixPV+wOpEiNyW4OBW5Hp TmSCiJvvaMnkyQtciLcGwqEzm+ffymWN+Y12Vf3wrVcKhnuHIxNLR1CNDRM9BgtdZiiJ AZrXzn8Ax7DGAiMF4JEYD5LVPhcN+CSVce1bE= 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=sWjlHfkAdFPS7THvUnxewh0hlmeuHPyRDdSMGB2nyb0=; b=TjaTLq/bV4BvlOTmxUASjmGcQXcuh0zGTpv2v+wDs9OWdKuIaWo4Wb0ywAYXwrPB2z 8eQSMmbIYlQdO/hBL3Qsfe+AYGeLl7nRkbH7Fan4+l64KXU2u/cAYn98lCKvWX1pm1f5 qEaefRKr06ZXaFwtSz7Ae0NKrwL2XDiyITBvt0CLwCGoY7TpofrOS53Rl/L/q8ZJtY6K k7wv0MoILQnGT9brk/iNkAhngGs/dh2XUnnj80h/Zy1Zvtn2QFadq4wHXRmqhwKu+lvO w2Elx4aZ2Y/MLvQiGUnICd1YPrN8FSWXKkyhSsLhfHDvQy12Vl/B7EE1nNKoDWFUzyyK mqXQ== X-Gm-Message-State: AIkVDXIEr0rPG2wfaO8f2//fIxS9CsYeC9x7/+KmxuC97JKOwSYH8pbYFpQYN26jmS3KNvLu X-Received: by 10.98.134.2 with SMTP id x2mr40967057pfd.158.1484614378737; Mon, 16 Jan 2017 16:52:58 -0800 (PST) Received: from localhost.localdomain ([2601:1c2:1002:83f0:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id q19sm50220516pfl.21.2017.01.16.16.52.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 16 Jan 2017 16:52:58 -0800 (PST) From: John Stultz To: lkml Subject: [PATCH 2/6] drm/bridge: adv7511: Switch to using drm_kms_helper_hotplug_event() Date: Mon, 16 Jan 2017 16:52:48 -0800 Message-Id: <1484614372-15342-3-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1484614372-15342-1-git-send-email-john.stultz@linaro.org> References: <1484614372-15342-1-git-send-email-john.stultz@linaro.org> Cc: dri-devel@lists.freedesktop.org, Wolfram Sang , Laurent Pinchart X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP In chasing down a previous issue with EDID probing from calling drm_helper_hpd_irq_event() from irq context, Laurent noticed that the DRM documentation suggests that drm_kms_helper_hotplug_event() should be used instead. Thus this patch replaces drm_helper_hpd_irq_event() with drm_kms_helper_hotplug_event(), which requires we update the connector.status entry and only call _hotplug_event() when the status changes. Cc: David Airlie Cc: Archit Taneja Cc: Wolfram Sang Cc: Lars-Peter Clausen Cc: Laurent Pinchart Cc: dri-devel@lists.freedesktop.org Reviewed-by: Laurent Pinchart Tested-by: Laurent Pinchart Signed-off-by: John Stultz --- v3: Update connector.status value and only call __hotplug_event() when that status changes, as suggested by Laurent. v4: Set adv7511->connector.status before calling adv7511->connector.status, as suggested by Laurent. --- drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c index 4fcea44..7b2b5af 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c @@ -405,8 +405,22 @@ static bool adv7511_hpd(struct adv7511 *adv7511) static void adv7511_hpd_work(struct work_struct *work) { struct adv7511 *adv7511 = container_of(work, struct adv7511, hpd_work); + enum drm_connector_status status; + unsigned int val; + int ret; - drm_helper_hpd_irq_event(adv7511->connector.dev); + ret = regmap_read(adv7511->regmap, ADV7511_REG_STATUS, &val); + if (ret < 0) + status = connector_status_disconnected; + else if (val & ADV7511_STATUS_HPD) + status = connector_status_connected; + else + status = connector_status_disconnected; + + if (adv7511->connector.status != status) { + adv7511->connector.status = status; + drm_kms_helper_hotplug_event(adv7511->connector.dev); + } } static int adv7511_irq_process(struct adv7511 *adv7511, bool process_hpd)