From patchwork Mon Mar 21 05:03:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: libin.yang@linux.intel.com X-Patchwork-Id: 8629521 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6ACF99F372 for ; Mon, 21 Mar 2016 05:04:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A2AD8201F4 for ; Mon, 21 Mar 2016 05:04:43 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 89799201F2 for ; Mon, 21 Mar 2016 05:04:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0AC986E090; Mon, 21 Mar 2016 05:04:37 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id A5CD16E090 for ; Mon, 21 Mar 2016 05:04:34 +0000 (UTC) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP; 20 Mar 2016 22:04:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,369,1455004800"; d="scan'208";a="938118244" Received: from younglee-grantley.sh.intel.com ([10.239.159.22]) by orsmga002.jf.intel.com with ESMTP; 20 Mar 2016 22:04:33 -0700 From: libin.yang@linux.intel.com To: intel-gfx@lists.freedesktop.org, conselvan2@gmail.com, jani.nikula@linux.intel.com, ville.syrjala@linux.intel.com, daniel.vetter@intel.com, tiwai@suse.de Date: Mon, 21 Mar 2016 13:03:29 +0800 Message-Id: <1458536609-70400-1-git-send-email-libin.yang@linux.intel.com> X-Mailer: git-send-email 1.9.1 Cc: Libin Yang Subject: [Intel-gfx] [PATCH] drm/i915: intel_audio clear eld buf when disconnecting monitor X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Libin Yang When disconnecting monitor, dev_priv->dig_port_map[port] will be set NULL, which causes eld will not be updated in i915_audio_component_get_eld(). This patch clears the eld buf when dev_priv->dig_port_map[port] is NULL. Signed-off-by: Libin Yang --- drivers/gpu/drm/i915/intel_audio.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_audio.c b/drivers/gpu/drm/i915/intel_audio.c index fdc8b2a..9d3879e 100644 --- a/drivers/gpu/drm/i915/intel_audio.c +++ b/drivers/gpu/drm/i915/intel_audio.c @@ -732,6 +732,13 @@ static int i915_audio_component_get_eld(struct device *dev, int port, ret = drm_eld_size(eld); memcpy(buf, eld, min(max_bytes, ret)); } + } else { + /* dev_priv->dig_port_map[port] will be set NULL in + * intel_audio_codec_disable when disconnecting monitor. + * We need clear the eld buf. + */ + memset(buf, 0, max_bytes); + ret = 0; } mutex_unlock(&dev_priv->av_mutex);