From patchwork Thu Sep 6 20:28:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gwan-gyeong Mun X-Patchwork-Id: 10591023 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 18DD85A4 for ; Thu, 6 Sep 2018 20:29:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 049482B0BE for ; Thu, 6 Sep 2018 20:29:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ED1A52B0C0; Thu, 6 Sep 2018 20:29:11 +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=unavailable 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 A32542B0BE for ; Thu, 6 Sep 2018 20:29:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DCAC26E745; Thu, 6 Sep 2018 20:29:08 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTPS id 34C696E73B; Thu, 6 Sep 2018 20:29:06 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Sep 2018 13:29:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,339,1531810800"; d="scan'208";a="71175243" Received: from helsinki.fi.intel.com ([10.237.66.48]) by orsmga008.jf.intel.com with ESMTP; 06 Sep 2018 13:29:03 -0700 From: Gwan-gyeong Mun To: dri-devel@lists.freedesktop.org Subject: [PATCH v3 2/2] drm: Add detection of changing of edid on between suspend and resume Date: Thu, 6 Sep 2018 23:28:58 +0300 Message-Id: <20180906202858.10497-2-gwan-gyeong.mun@intel.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180906202858.10497-1-gwan-gyeong.mun@intel.com> References: <20180906202858.10497-1-gwan-gyeong.mun@intel.com> 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: airlied@linux.ie, intel-gfx@lists.freedesktop.org, stanislav.lisovskiy@intel.com, mika.kahola@intel.com, sean@poorly.run MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP The hotplug detection routine of drm_helper_hpd_irq_event() can detect changing of status of connector, but it can not detect changing of edid. Following scenario requires detection of changing of edid. 1) plug display device to a connector 2) system suspend 3) unplug 1)'s display device and plug the other display device to a connector 4) system resume It adds edid check routine when a connector status still remains as "connector_status_connected". v2: Add NULL check before comparing of EDIDs. v3: Make it as part of existing drm_helper_hpd_irq_event() (Stan, Mika) Testcase: igt/kms_chamelium/hdmi-edid-change-during-hibernate Testcase: igt/kms_chamelium/hdmi-edid-change-during-suspend Testcase: igt/kms_chamelium/dp-edid-change-during-hibernate Testcase: igt/kms_chamelium/dp-edid-change-during-suspend Signed-off-by: Gwan-gyeong Mun --- drivers/gpu/drm/drm_probe_helper.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c index a1bb157bfdfa..2705a5a0e4d6 100644 --- a/drivers/gpu/drm/drm_probe_helper.c +++ b/drivers/gpu/drm/drm_probe_helper.c @@ -742,7 +742,16 @@ EXPORT_SYMBOL(drm_kms_helper_poll_fini); * panels. * * This helper function is useful for drivers which can't or don't track hotplug - * interrupts for each connector. + * interrupts for each connector. And it also supports a detection of changing + * of edid on between suspend and resume when a connector status still remains + * as "connector_status_connected". + * + * Following scenario requires detection of changing of edid. + * 1) plug display device to a connector + * 2) system suspend + * 3) unplug 1)'s display device and plug the other display device to a + connector + * 4) system resume * * Drivers which support hotplug interrupts for each connector individually and * which have a more fine-grained detect logic should bypass this code and @@ -760,6 +769,7 @@ bool drm_helper_hpd_irq_event(struct drm_device *dev) struct drm_connector *connector; struct drm_connector_list_iter conn_iter; enum drm_connector_status old_status; + struct edid *old_edid; bool changed = false; if (!dev->mode_config.poll_enabled) @@ -773,6 +783,7 @@ bool drm_helper_hpd_irq_event(struct drm_device *dev) continue; old_status = connector->status; + old_edid = connector->detect_edid; connector->status = drm_helper_probe_detect(connector, NULL, false); DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %s to %s\n", @@ -782,6 +793,22 @@ bool drm_helper_hpd_irq_event(struct drm_device *dev) drm_get_connector_status_name(connector->status)); if (old_status != connector->status) changed = true; + + /* Check changing of edid when a connector status still remains + * as "connector_status_connected". + */ + if (old_status == connector->status && + old_status == connector_status_connected) { + if (!old_edid || !connector->detect_edid) + continue; + + if (memcmp(old_edid, connector->detect_edid, sizeof(*old_edid))) { + changed = true; + DRM_DEBUG_KMS("[CONNECTOR:%d:%s] edid updated\n", + connector->base.id, + connector->name); + } + } } drm_connector_list_iter_end(&conn_iter); mutex_unlock(&dev->mode_config.mutex);