Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1085100ybl; Wed, 14 Aug 2019 10:27:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqxd4x05hVjHQfBz4gcDkZZwvSc4j+7vTaHpk9+roVO9P30fnYSSmTK04h9e5FIqMK1cQBlj X-Received: by 2002:aa7:9591:: with SMTP id z17mr1041062pfj.215.1565803631632; Wed, 14 Aug 2019 10:27:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565803631; cv=none; d=google.com; s=arc-20160816; b=QWsIPoPNQKSsCqw/DsBnexbkE2lthlXWh3PLO1Eip7S0bTcQ0SPP1dES1b6BveWxlZ a9eEOnlZcO+soTdIB8ryOx/s9tdIF3HZonoWusmvQmAAuDnACOC8rT6KN1ictBNTgMfG mTYllccxAwVcsci0NqEZAlmLsgr6YMnm6KG5ozJDUHB2kLV+ZrJEvYqMqcgO//L2NpPZ fjssnScTJzAvjaAYWuMqfB02ld/21jGUFAssQE1tCWe4cXug3vDrb2xljNQvRboF8Bp5 sx5zOIwUKipS2asVA8ZqIFgimrmE7kE7i700JMPhLitx1wtlCIQW0x2Am0eo+Z9JzvCu 18Og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rJLrYLE7j9fQ6AbBTjkMZuyzubr0fZVJyEEUajAKEGc=; b=Z+99gXre0RA4V34E4BPBft+ONV/hJgRpRVIhodxeTRd9P4zegv9FVjlYdF4MR8iuvv /EYJQI7MEEUj6ZBc8j/wYp4tIOjP6I2ZOaNOtofqvmB6RAq/RlXvpYBaVG2Nw0Nwfpv8 VtBagT93M/s8I8cpZveY8sZTfF3Hy2OLQAZepAmssn6lwXM48BjXmYbh5ntGU7t3cMrR L+dBX4NnInTMmi7T/8yQJvCK6XA2gxapMBTAPQzsLBuKrpilPVtIfy1BNkuBvCSqi2ce x93ngpnd4tIrx/lGi1Foams9Wk/D23HuIRKs3JT5vo6SyfYo6qM3WplKP+knWfwgNJ23 1cgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=15SCLeI1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k192si173796pge.222.2019.08.14.10.26.55; Wed, 14 Aug 2019 10:27:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=15SCLeI1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729242AbfHNR0X (ORCPT + 99 others); Wed, 14 Aug 2019 13:26:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:53692 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728741AbfHNREu (ORCPT ); Wed, 14 Aug 2019 13:04:50 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BDCE9214DA; Wed, 14 Aug 2019 17:04:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565802289; bh=pj+wkDPVO5SjIcDRmC1kkJGApAvAt413xZlwsZDQK9w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=15SCLeI1CrmW9gfhkkjyGwejN/oJCc+ZY6WD2HftPfyTEeCHyuIqRZwTR0eVl2i0c yE/1bJs1Gef7mfc96idBiwYKaTHe3rpn630uQX7xkGES/ftLRvYW6SF4UJbmAMNYBE mh+o3fxOanOvBwWai/8ktg0orFXJ22B2nQXmH1oI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tai Man , Charlene Liu , Leo Li , Alex Deucher , Sasha Levin Subject: [PATCH 5.2 068/144] drm/amd/display: use encoders engine id to find matched free audio device Date: Wed, 14 Aug 2019 19:00:24 +0200 Message-Id: <20190814165802.690615448@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190814165759.466811854@linuxfoundation.org> References: <20190814165759.466811854@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 74eda776d7a4e69ec7aa1ce30a87636f14220fbb ] [Why] On some platforms, the encoder id 3 is not populated. So the encoders are not stored in right order as index (id: 0, 1, 2, 4, 5) at pool. This would cause encoders id 4 & id 5 to fail when finding corresponding audio device, defaulting to the first available audio device. As result, we cannot stream audio into two DP ports with encoders id 4 & id 5. [How] It need to create enough audio device objects (0 - 5) to perform matching. Then use encoder engine id to find matched audio device. Signed-off-by: Tai Man Reviewed-by: Charlene Liu Acked-by: Leo Li Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c index 12142d13f22f2..6ad7b54812f1c 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c @@ -254,7 +254,7 @@ bool resource_construct( * PORT_CONNECTIVITY == 1 (as instructed by HW team). */ update_num_audio(&straps, &num_audio, &pool->audio_support); - for (i = 0; i < pool->pipe_count && i < num_audio; i++) { + for (i = 0; i < caps->num_audio; i++) { struct audio *aud = create_funcs->create_audio(ctx, i); if (aud == NULL) { @@ -1702,6 +1702,12 @@ static struct audio *find_first_free_audio( return pool->audios[i]; } } + + /* use engine id to find free audio */ + if ((id < pool->audio_count) && (res_ctx->is_audio_acquired[id] == false)) { + return pool->audios[id]; + } + /*not found the matching one, first come first serve*/ for (i = 0; i < pool->audio_count; i++) { if (res_ctx->is_audio_acquired[i] == false) { -- 2.20.1