Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp320389pxb; Fri, 8 Jan 2021 06:02:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJyPA5KqUcVgdWNvAF3qnpYTo49WdDjq/ETN+9wUmeAONv2f9mZTAc4FjyA2WWqV7/mF0OHc X-Received: by 2002:aa7:cb49:: with SMTP id w9mr5553517edt.357.1610114558068; Fri, 08 Jan 2021 06:02:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610114558; cv=none; d=google.com; s=arc-20160816; b=Q4b2mN3jIeMhBDbNei7SKleO3LmaoQ87JkvgDWGn2j16QuOKzI9avKaP0xciwgYMqP puo0Abhn+7QuFs7uKnmCNGdQLySWFQpL7h5dt2xdD2mOnaJEktWJIXKz5tGTUAcOt6rX vPEetgSPJFugywEpwqopoHyt2ltR+qP81ALyiEHEA17KidapkSg+/3xNUWu2aEe2d+oL /3jNARglX6S79s4gWO4+mH7z7Tg+8s+ZaV/UNeVR7LDu2SPrscRC8Cble2VcZL66oYVK PopmaStUBz7PxajTG+BmwHnnhuqtiarmmSanxUWGxYFNpjBv168Cnuuly1fgru/VovoH oMOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=v3YUKh3Pg+3HEmWFEzA6lV+W8xXHYJpJ+0Kz0Ylu/I0=; b=lEU8hH40f5tukfaYEjG7Mvzxlu8dUMHD5Oo4bsWWTqXJXZ/o21biZl1MlphC73XJPv tbJ7vFWdYZgIfAveBU1N3cMqWrSBOmdpvsg3tmusmUec5FhKesfnU/jlbxgLgQg11ket 3vdlosxjI+mDRKXoLlar7YiHiP5Q+Brdg7A0fRidzsb6FoXlZYq72yZkfxcQbtiVQdg8 Ho+CY4jL7PPC0odfoz/Rt4xvSPFPT1UMqrxHT6vZa0HVPuMFRuhPkO7VTl/0z0ods6dP hRmf5di64ifcT9cahLlYhW5DrH84HYDZ72CUvTkOeZaidPREnHm0BNxSmWDd+ycxf378 +muA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=GOEfVOeF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bw26si3565566ejb.644.2021.01.08.06.02.11; Fri, 08 Jan 2021 06:02:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=GOEfVOeF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727396AbhAHOAU (ORCPT + 99 others); Fri, 8 Jan 2021 09:00:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727176AbhAHOAP (ORCPT ); Fri, 8 Jan 2021 09:00:15 -0500 Received: from mail-io1-xd31.google.com (mail-io1-xd31.google.com [IPv6:2607:f8b0:4864:20::d31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6308DC0612F6; Fri, 8 Jan 2021 05:59:35 -0800 (PST) Received: by mail-io1-xd31.google.com with SMTP id d9so9825930iob.6; Fri, 08 Jan 2021 05:59:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=v3YUKh3Pg+3HEmWFEzA6lV+W8xXHYJpJ+0Kz0Ylu/I0=; b=GOEfVOeF+iauU8s3f5xN+vySJJL75+qUxx13gPkp6BxYrf3ZpvDuz6iLgsQ+1qV84Y TtTnmu9ZLNEj9fSZsIHZeBF7IRDWzLvLoRurqNKGEJ2Ys1OVUt4zntLQYChpTuk/ZTmy lAXGAicWa/C9SFlDLPTWyNlMEm/xC1aKOhWguiaffn3r/eIe4vRr3aaAWUzMpUCa/qzl eDLd8Z3d1uGg5HnPbFIa7IIJxTrR5KISNk/hOKd206XMfSPFHaLdLKhC88FsNtOTQs7x qn/PK2LHIEMmjFm5mcRS5IBYY3rGX2Uxdom7V2KV4BEdclUtOEvMqx1laFL4vyDKAks8 5TsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=v3YUKh3Pg+3HEmWFEzA6lV+W8xXHYJpJ+0Kz0Ylu/I0=; b=HmfSXR5kkIBVgF/e0N9Uj3Qdjem4+ng+3p92KRpiyTK6v7eJFDo8RqL7cTu6ifKrDI 3ZqHarLnB/CYTEdNk8oaJtgmXV635XFo8Nyw/tzHPO4+k123oyfBGZk+V5nBmB0QB7PP rx5rfCqQX/I50F0iqrUSiNl6/SAghFHdWJMHTX8+w5w665QUpy8TBeTomobjK4JyI7ln 3JifZ6QH7UuUEk97EpM2Wttxl/HcK5IteISUwam+7nPnm7cDTEHfgINXpU5WtCkZ8VGx GmmezEA2xMZIjsSKdDFvuY/L/5c0p7xlz/g5gyAkVHriCgeePIuwEn7wEUUwEP7rVfMc AZhw== X-Gm-Message-State: AOAM532aLAUctS5WOAOkX21dV0wPlywkk2+x7JX1pCsuKVGYT0y4v8zt rnBa2wS2NYsKiezOxcDcZsQ= X-Received: by 2002:a5d:8a1a:: with SMTP id w26mr5458680iod.112.1610114374783; Fri, 08 Jan 2021 05:59:34 -0800 (PST) Received: from rockpro64.hsd1.md.comcast.net ([2601:153:900:7730::20]) by smtp.gmail.com with ESMTPSA id l6sm7570063ili.78.2021.01.08.05.59.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 05:59:34 -0800 (PST) From: Peter Geis To: Michael Turquette , Stephen Boyd , Peter De Schrijver , Prashant Gaikwad , Thierry Reding , Jonathan Hunter , Jaroslav Kysela , Takashi Iwai , Sameer Pujar , Mohan Kumar Cc: linux-clk@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, Peter Geis , Ion Agorria Subject: [PATCH v2 2/2] ALSA: hda/tegra: fix tegra-hda on tegra30 soc Date: Fri, 8 Jan 2021 13:59:13 +0000 Message-Id: <20210108135913.2421585-3-pgwipeout@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210108135913.2421585-1-pgwipeout@gmail.com> References: <20210108135913.2421585-1-pgwipeout@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently hda on tegra30 fails to open a stream with an input/output error. For example: speaker-test -Dhw:0,3 -c 2 speaker-test 1.2.2 Playback device is hw:0,3 Stream parameters are 48000Hz, S16_LE, 2 channels Using 16 octaves of pink noise Rate set to 48000Hz (requested 48000Hz) Buffer size range from 64 to 16384 Period size range from 32 to 8192 Using max buffer size 16384 Periods = 4 was set period_size = 4096 was set buffer_size = 16384 0 - Front Left Write error: -5,Input/output error xrun_recovery failed: -5,Input/output error Transfer failed: Input/output error The tegra-hda device was introduced in tegra30 but only utilized in tegra124 until recent chips. Tegra210/186 work only due to a hardware change. For this reason it is unknown when this issue first manifested. Discussions with the hardware team show this applies to all current tegra chips. It has been resolved in the tegra234, which does not have hda support at this time. The explanation from the hardware team is this: Below is the striping formula referenced from HD audio spec. { ((num_channels * bits_per_sample) / number of SDOs) >= 8 } The current issue is seen because Tegra HW has a problem with boundary condition (= 8) for striping. The reason why it is not seen on Tegra210/Tegra186 is because it uses max 2SDO lines. Max SDO lines is read from GCAP register. For the given stream (channels = 2, bps = 16); ratio = (channels * bps) / NSDO = 32 / NSDO; On Tegra30, ratio = 32/4 = 8 (FAIL) On Tegra210/186, ratio = 32/2 = 16 (PASS) On Tegra194, ratio = 32/4 = 8 (FAIL) ==> Earlier workaround was applied for it If Tegra210/186 is forced to use 4SDO, it fails there as well. So the behavior is consistent across all these chips. Applying the fix in [1] universally resolves this issue on tegra30-hda. Tested on the Ouya game console and the tf201 tablet. [1] commit 60019d8c650d ("ALSA: hda/tegra: workaround playback failure on Tegra194") Reviewed-by: Jon Hunter Tested-by: Ion Agorria Signed-off-by: Peter Geis --- sound/pci/hda/hda_tegra.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c index 70164d1428d4..361cf2041911 100644 --- a/sound/pci/hda/hda_tegra.c +++ b/sound/pci/hda/hda_tegra.c @@ -388,7 +388,7 @@ static int hda_tegra_first_init(struct azx *chip, struct platform_device *pdev) * in powers of 2, next available ratio is 16 which can be * used as a limiting factor here. */ - if (of_device_is_compatible(np, "nvidia,tegra194-hda")) + if (of_device_is_compatible(np, "nvidia,tegra30-hda")) chip->bus.core.sdo_limit = 16; /* codec detection */ -- 2.25.1