Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp6156244rwn; Mon, 12 Sep 2022 22:54:57 -0700 (PDT) X-Google-Smtp-Source: AA6agR7bvnng5JdprEbkYA2PAO8cSD3pjyGiAiCiPUGsycWtmT79wiyPREI/8oC7ibpKZlnQmI+d X-Received: by 2002:a17:907:6e25:b0:77e:3d52:cea0 with SMTP id sd37-20020a1709076e2500b0077e3d52cea0mr4812784ejc.186.1663048497494; Mon, 12 Sep 2022 22:54:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663048497; cv=none; d=google.com; s=arc-20160816; b=lLF4WjJQJDd9DazKgeH5lJxvlUpEhdUJ0OKM8FJIsmvdAMvZ8mec4v/EjpI2Wt51fh mDXSivmfjTyVzr5gxWx95gEMUrT9VZHfbWjCo4S5HqiuBWN7ruZ6mI0883VneUpWo8Nd L9W0ZQsQEj9kV9ndxL/CX2Zn/C/OvjXf1f1QUAX5G2RkZDc4Fb9isetSkoRQNYFUxGWo HYJxlo5KLGSjofuWotHiUkEq7dfk2zK4QeXqTFYpymEEafDVr+vP+/zECb6zbWH4r2Br B9MJ39zeck3Ck+97UPJM9DwDqRCm1FK0zwZfevDahMX2tbdCWZw1gFaXTOUaoiaeZ5X5 Hjtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature:dkim-signature; bh=LL+0QmFDBXrLM+is61xFAGwnXTKxqNCWgAvg8pawgpY=; b=Q83qN+01d+8Eu/4O0NArMuKewvdVem6Iw6fMyldauAaWF8/Ldk8qb9myuCw+Bv3IuM 0bAsBaUn/sv3EZOHEnTUu/KiRKOgpNZlNEVfP5VVVEQDYFocjJMKq+FaqpEct8g2Oj1h fyGLtYHX8eS03XjArrsQX2VrSy6x+ppwNOcbK+fn8ZluEGOf40tPCviAQH3mUSHJyZO4 VQB8N2BZ6OunIeFaKAscrWvELDp1maKVNsRnc5Y+lNZOCu+EoK0MeQqcEhkOSJuW9T7K SAvTfacpKuqNDENTrlDAXxIcjdLlDgq8vEj224lqgclbE5pcsUK0btCC4MnWV5xIKJW/ vHAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=EaU+gESL; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=NBwRBC0k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dt21-20020a170907729500b0077f3a9c58e2si2738815ejc.6.2022.09.12.22.54.32; Mon, 12 Sep 2022 22:54:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=EaU+gESL; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=NBwRBC0k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230083AbiIMFkl (ORCPT + 99 others); Tue, 13 Sep 2022 01:40:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230053AbiIMFkj (ORCPT ); Tue, 13 Sep 2022 01:40:39 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CE51564FD; Mon, 12 Sep 2022 22:40:38 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 574873473C; Tue, 13 Sep 2022 05:40:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1663047637; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=LL+0QmFDBXrLM+is61xFAGwnXTKxqNCWgAvg8pawgpY=; b=EaU+gESL3xtq/aEen3T6blqRalP6siQO2A4hDwumO3toCWNH7t2ywz+PKGUn/lOXzilCIV 5PsLQJfv25g4NppsZt9HuSNBzaiwQlfd8/TVLTyGwmJXBsgTr0w32V7Kpfd8r6VPBtoStx 1+jSWvNsB3iGv0XW2pORS86S0AW8XPk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1663047637; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=LL+0QmFDBXrLM+is61xFAGwnXTKxqNCWgAvg8pawgpY=; b=NBwRBC0kBCjLONgs8/lnfMfslVYqM9MnUtIIK0MSn+b3kqNiBG+3TkO3PvwHE6q7J/Xswx wW7Tt3hIOaoYXYCw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 31A3613A86; Tue, 13 Sep 2022 05:40:37 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 4lN6C9UXIGMlWgAAMHmgww (envelope-from ); Tue, 13 Sep 2022 05:40:37 +0000 Date: Tue, 13 Sep 2022 07:40:36 +0200 Message-ID: <87fsgvhlwr.wl-tiwai@suse.de> From: Takashi Iwai To: Mohan Kumar Cc: , , , , , , Subject: Re: [PATCH] ALSA: hda: Fix tegra hda dp infoframe struct In-Reply-To: <20220913034410.17502-1-mkumard@nvidia.com> References: <20220913034410.17502-1-mkumard@nvidia.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 13 Sep 2022 05:44:10 +0200, Mohan Kumar wrote: > > Tegra HDA HW expects infoframe data bytes order same for both > HDMI and DP i.e infoframe data starts from 5th bytes offset. > This hw behavior mandates to have dummy bytes for dp infoframe > structure for Tegra. > > Signed-off-by: Mohan Kumar > --- > sound/pci/hda/patch_hdmi.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c > index 6c209cd26c0c..a52e764db2e0 100644 > --- a/sound/pci/hda/patch_hdmi.c > +++ b/sound/pci/hda/patch_hdmi.c > @@ -218,6 +218,9 @@ struct dp_audio_infoframe { > u8 type; /* 0x84 */ > u8 len; /* 0x1b */ > u8 ver; /* 0x11 << 2 */ > +#if IS_ENABLED(CONFIG_SND_HDA_TEGRA) > + u8 checksum; /* Tegra HW expects infoframe bytes from 5th offset */ > +#endif I'm afraid that we can't use ifdef here, as this is another module that is used not only by snd-hda-tegra. In theory, snd-hda-intel can run on Arm using the same codec driver. That is, the check has to be dynamically. Maybe we need to set a flag at tegra_hdmi_init(). If I understand correctly, Tegra uses the same byte layout for both DP and HDMI? If so, the patch like below should work instead. Of course, if that's really specific to Tegra, not generically for Nvidia graphics, the flag has to be set in a different way... thanks, Takashi -- 8< -- --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -171,6 +171,7 @@ struct hdmi_spec { /* hdmi interrupt trigger control flag for Nvidia codec */ bool hdmi_intr_trig_ctrl; bool intel_hsw_fixup; /* apply Intel platform-specific fixups */ + bool tegra_dp_workaround; /* workaround DP audio infoframe for Tegra */ /* * Non-generic VIA/NVIDIA specific */ @@ -679,15 +680,24 @@ static void hdmi_pin_setup_infoframe(struct hda_codec *codec, int ca, int active_channels, int conn_type) { + struct hdmi_spec *spec = codec->spec; union audio_infoframe ai; memset(&ai, 0, sizeof(ai)); - if (conn_type == 0) { /* HDMI */ + if (conn_type == 0 || /* HDMI */ + /* DisplayPort for Tegra: Tegra HW expects same layout as HDMI */ + (conn_type == 1 && spec->tegra_dp_workaround)) { struct hdmi_audio_infoframe *hdmi_ai = &ai.hdmi; - hdmi_ai->type = 0x84; - hdmi_ai->ver = 0x01; - hdmi_ai->len = 0x0a; + if (conn_type == 0) { /* HDMI */ + hdmi_ai->type = 0x84; + hdmi_ai->ver = 0x01; + hdmi_ai->len = 0x0a; + } else { /* Tegra DP */ + hdmi_ai->type = 0x84; + hdmi_ai->len = 0x1b; + hdmi_ai->ver = 0x11 << 2; + } hdmi_ai->CC02_CT47 = active_channels - 1; hdmi_ai->CA = ca; hdmi_checksum_audio_infoframe(hdmi_ai); @@ -3992,6 +4002,7 @@ static int tegra_hdmi_init(struct hda_codec *codec) spec->chmap.ops.chmap_cea_alloc_validate_get_type = nvhdmi_chmap_cea_alloc_validate_get_type; spec->chmap.ops.chmap_validate = nvhdmi_chmap_validate; + spec->tegra_dp_workaround = true; return 0; }