Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp3375586ybp; Sun, 6 Oct 2019 10:33:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqzqOt9U6O8BTXRZTinnhIHNcKuilGYGT+/buWZhEIRZ4U+fLCW0tXEdXpZUzaSYynLDosYb X-Received: by 2002:a17:906:1c5b:: with SMTP id l27mr20872099ejg.27.1570383209817; Sun, 06 Oct 2019 10:33:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570383209; cv=none; d=google.com; s=arc-20160816; b=iO0AtWR95lZoo56DDxowGHZSDY8jk0YI1TIm2h1IAiCYZw/r/0fVMk4e/64Ymi+1Ji Qp2m7mWhhbAanu7AfNoe2y+mX08croKogb8Z5tY4U36lsgMKEmZHFgG9I/56/Yw6MU9d 1yEBO9O2GFontEBPXQ2hRA0fQf7qXkWeUSlz7jG3m3Z1jYw9lKCQHz4iI+2wlUW1mvK9 69TJerG4Q7ZvSFPMmSng3LuXWLsYv9GlIKXErLcSS/XgolzxbdpdX4krBsjO2QybiUnE Q3TPxRL/eMB1jxSyZmjj99MIWLdrL32bYxfCV3n08OpCIWvnOSisVZF75hpxhAOl5+a7 gY7Q== 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=3oEfTPEF0ujum7xsaD5e057secNI32fZWqguQkXX7Nk=; b=ghhN1+OdQma7e89Ov5ucPExiH0dFOQD8o6JX7Mz5fzSJhtjz1nHsOjeZCQjZ8S+AiT dldvmUq3CNzFcpMyL85BIzw2ErxE09pHc3yJWN4UYpa2ns5FP82DVOH4bp0TU3QeJ0hj /qSQLJjEAeLkgCRPKvtP5i989aYCW38CGJJXzaBARUKkFy0dHpnICTUoYJgT2m11orr/ 4uWegVkJKM9z2gJTmoJtW+iMuHh3fp7fGn1IDckfLhQ/VSvyYsxOec7zu/B0r705kSCY Y85h8xgygUjnjUM6rR9JsTKVg9XtKbZdEXaNi8QPch6LhFP0mvbyQjxZlsP6vioOrn+H fjHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=f96qSILk; 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 n23si640250ejr.376.2019.10.06.10.33.05; Sun, 06 Oct 2019 10:33:29 -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=f96qSILk; 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 S1728979AbfJFR3Y (ORCPT + 99 others); Sun, 6 Oct 2019 13:29:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:55028 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728969AbfJFR3U (ORCPT ); Sun, 6 Oct 2019 13:29:20 -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 2770C217D6; Sun, 6 Oct 2019 17:29:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570382959; bh=K4T6lRYMyRRepGM0P+BdfI9+GRjzZhv/1SdRP6HK8Lo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f96qSILktnJZ02/ghg3o1dJQgLdZ7wxfQlsVBsYMYxzxOU+/kdo+I3pt/4zZHqJio DL9UmIXR1+8QKEkmPugmy0XdAENLNBg0S5IyooUR11lT4Mo0dIG1MGvVAI6QHdSocw 9rkOwOSr7YPq5662NJyhzzhv+gimdN2UgSc/zElI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Charlene Liu , Dmytro Laktyushkin , Bhawanpreet Lakha , Alex Deucher , Sasha Levin Subject: [PATCH 4.19 033/106] drm/amd/display: support spdif Date: Sun, 6 Oct 2019 19:20:39 +0200 Message-Id: <20191006171140.114447492@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191006171124.641144086@linuxfoundation.org> References: <20191006171124.641144086@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 From: Charlene Liu [ Upstream commit b5a41620bb88efb9fb31a4fa5e652e3d5bead7d4 ] [Description] port spdif fix to staging: spdif hardwired to afmt inst 1. spdif func pointer spdif resource allocation (reserve last audio endpoint for spdif only) Signed-off-by: Charlene Liu Reviewed-by: Dmytro Laktyushkin Acked-by: Bhawanpreet Lakha Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- .../gpu/drm/amd/display/dc/core/dc_resource.c | 17 ++++++++--------- drivers/gpu/drm/amd/display/dc/dce/dce_audio.c | 4 ++-- 2 files changed, 10 insertions(+), 11 deletions(-) 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 f0d68aa7c8fcc..d440b28ee43fb 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c @@ -229,12 +229,10 @@ bool resource_construct( DC_ERR("DC: failed to create audio!\n"); return false; } - if (!aud->funcs->endpoint_valid(aud)) { aud->funcs->destroy(&aud); break; } - pool->audios[i] = aud; pool->audio_count++; } @@ -1703,24 +1701,25 @@ static struct audio *find_first_free_audio( const struct resource_pool *pool, enum engine_id id) { - int i; - for (i = 0; i < pool->audio_count; i++) { + int i, available_audio_count; + + available_audio_count = pool->audio_count; + + for (i = 0; i < available_audio_count; i++) { if ((res_ctx->is_audio_acquired[i] == false) && (res_ctx->is_stream_enc_acquired[i] == true)) { /*we have enough audio endpoint, find the matching inst*/ if (id != i) continue; - return pool->audios[i]; } } - /* use engine id to find free audio */ - if ((id < pool->audio_count) && (res_ctx->is_audio_acquired[id] == false)) { + /* use engine id to find free audio */ + if ((id < available_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++) { + for (i = 0; i < available_audio_count; i++) { if (res_ctx->is_audio_acquired[i] == false) { return pool->audios[i]; } diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c b/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c index 7f6d724686f1a..abb559ce64085 100644 --- a/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c +++ b/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c @@ -611,6 +611,8 @@ void dce_aud_az_configure( AZ_REG_WRITE(AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO1, value); + DC_LOG_HW_AUDIO("\n\tAUDIO:az_configure: index: %u data, 0x%x, displayName %s: \n", + audio->inst, value, audio_info->display_name); /* *write the port ID: @@ -922,7 +924,6 @@ static const struct audio_funcs funcs = { .az_configure = dce_aud_az_configure, .destroy = dce_aud_destroy, }; - void dce_aud_destroy(struct audio **audio) { struct dce_audio *aud = DCE_AUD(*audio); @@ -953,7 +954,6 @@ struct audio *dce_audio_create( audio->regs = reg; audio->shifts = shifts; audio->masks = masks; - return &audio->base; } -- 2.20.1