From patchwork Tue Jan 3 19:41:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 9495509 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 87773606A9 for ; Tue, 3 Jan 2017 19:42:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 75024272F9 for ; Tue, 3 Jan 2017 19:42:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 69EB227B2F; Tue, 3 Jan 2017 19:42:56 +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 17227272F9 for ; Tue, 3 Jan 2017 19:42:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F22C36E13B; Tue, 3 Jan 2017 19:42:53 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg0-x231.google.com (mail-pg0-x231.google.com [IPv6:2607:f8b0:400e:c05::231]) by gabe.freedesktop.org (Postfix) with ESMTPS id AB8236E655 for ; Tue, 3 Jan 2017 19:41:53 +0000 (UTC) Received: by mail-pg0-x231.google.com with SMTP id g1so178781165pgn.0 for ; Tue, 03 Jan 2017 11:41:53 -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=o+3+c5NOuLGFhJNsbZ9KF/bbL9AU7Iszpp/GJGKrJZI=; b=NK3Q3kflY46f48O0lDv/B7/xnKWXTcUPCyo2Ews409c7Tspjbx+1Ozx1MD6vSiCWjF tucMB7Q1p/p4C9m2XaDGwCk+m80zncHmLQ89aw5A1z0p+0OpWXAVFmtZG7SaUBMW0103 TBYz1yEmx5V9BU1PMNMPXEavthyOGdCwBQ0nA= 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=o+3+c5NOuLGFhJNsbZ9KF/bbL9AU7Iszpp/GJGKrJZI=; b=T0xURDVGd2glwB+Ceh4HR7Rk9XBEMCosNyADHRPae2uHFQCaBZQFDZOnXVofCpbC1x Nj8jcKhd4dI/ua96MvxiLGJhI6blVGMEgRnw1HUogGriS4IxCifIFNUDd0u/708TyNPg 6dJPpLmOlsq5QAsnUgJd0Q7Hg584oukYMgYzNnMsh6qlSou2jvvKZcFSir0NOO7I1qEd YY1SyOHnVb7OpGdZ79Q8wYWmNTHq+c47fkitt3T1RBMsHt2USCHbaP4XaPd/ZkXeTGOV m06Fhn6bhwbaVfGxZlJzKRRbGOqOseg/MY5q7w0Sm+SKE79J4uWvm8jhNzQ30GOJZAp/ sG0g== X-Gm-Message-State: AIkVDXLj4cZSOXpf4Wkb00MjZUpT+XcnKbvddwqnH8PH0cIIdy54a/0hnpkk1MJTIfQQN7V1 X-Received: by 10.98.108.3 with SMTP id h3mr59268979pfc.65.1483472512295; Tue, 03 Jan 2017 11:41:52 -0800 (PST) Received: from localhost.localdomain ([2601:1c2:1002:83f0:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id y62sm77865957pfk.52.2017.01.03.11.41.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 03 Jan 2017 11:41:51 -0800 (PST) From: John Stultz To: lkml Subject: [PATCH 2/5 v3] drm/bridge: adv7511: Switch to using drm_kms_helper_hotplug_event() Date: Tue, 3 Jan 2017 11:41:39 -0800 Message-Id: <1483472502-16403-3-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1483472502-16403-1-git-send-email-john.stultz@linaro.org> References: <1483472502-16403-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 Signed-off-by: John Stultz Reviewed-by: Laurent Pinchart Tested-by: Laurent Pinchart --- v3: Update connector.status value and only call __hotplug_event() when that status changes, 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..d93d66f 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; + + 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) + drm_kms_helper_hotplug_event(adv7511->connector.dev); - drm_helper_hpd_irq_event(adv7511->connector.dev); + adv7511->connector.status = status; } static int adv7511_irq_process(struct adv7511 *adv7511, bool process_hpd)