From patchwork Mon Dec 12 21:00:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 9471359 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 0A60260573 for ; Mon, 12 Dec 2016 21:01:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F3F3B284CA for ; Mon, 12 Dec 2016 21:01:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E8E0B2851D; Mon, 12 Dec 2016 21:01:00 +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 A12F0284CA for ; Mon, 12 Dec 2016 21:01:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D07706E40B; Mon, 12 Dec 2016 21:00:53 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg0-x236.google.com (mail-pg0-x236.google.com [IPv6:2607:f8b0:400e:c05::236]) by gabe.freedesktop.org (Postfix) with ESMTPS id EEF5E6E35D for ; Mon, 12 Dec 2016 21:00:47 +0000 (UTC) Received: by mail-pg0-x236.google.com with SMTP id p66so39082518pga.2 for ; Mon, 12 Dec 2016 13:00:47 -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=EWT1/2E/Jy2+pBKgM/aaeeaZVzlNMxLNL5ypvQtBCwk=; b=esmlUkfBg7zQ+Tpq/x8H4o1ei4Bzjp/waoVv0h5QMZ7OnO92xFQ8Dng/v2NwRpYKPI Lwl2wJ62cJow2bcobUua67QMs5U9ANh6sxEPtJYtb7XwJ/Wb0u1+4PmXjJCyuWBN6cfu 1X+tnNmEHUZyDnae428mVpzERDIgriZohDUl0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=EWT1/2E/Jy2+pBKgM/aaeeaZVzlNMxLNL5ypvQtBCwk=; b=S8XWgfV9ssiUz5OJwaL4Ef7kUIeXrGEYV13RrsVcw5/WQGtyD8B/7Kzb31YYoZsNkF ribVtmtJAXtIFA3DpB7o/kA3PS70xiPcPXl36E0XH8UkJTblSVlC6fvtZKMF9iJmL5Hs WN4rxtZmrCA4Ly1NTLGk8DobHNQ9EXchRc1ZmmAqULT6Jer0XhjQRO/mTE7ZtL+KuRbl CUKFfeKEUMzOfa1iISPB1iDV2Ljz4teh22oO8QK0amqF7uRbY+jg4FZu02yZVaar71hg kFd0yQzEsC7Ie24Z6vGZCxAFAG95zcDivs+pXjrMgytHEjLNfBJ7yvgw46OArJUD6Yq5 07cA== X-Gm-Message-State: AKaTC03jdZZKJL0A1MwMXao04NbqkLvQLO712BTSMtxBHrJrkyZf5KbEqzM7GttBJ7fK0lOt X-Received: by 10.99.171.65 with SMTP id k1mr170401354pgp.87.1481576447340; Mon, 12 Dec 2016 13:00:47 -0800 (PST) Received: from localhost.localdomain ([2601:1c2:1002:83f0:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id f3sm41074078pga.45.2016.12.12.13.00.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 12 Dec 2016 13:00:46 -0800 (PST) From: John Stultz To: lkml Subject: [RFC][PATCH 2/5 v3] drm/bridge: adv7511: Switch to using drm_kms_helper_hotplug_event() Date: Mon, 12 Dec 2016 13:00:38 -0800 Message-Id: <1481576441-23529-3-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1481576441-23529-1-git-send-email-john.stultz@linaro.org> References: <1481576441-23529-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 --- 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)