Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp563176ybd; Wed, 26 Jun 2019 02:57:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqxIGf1gr+nzqSEeFu/ufLT8ypSj2bv0s/kE96jaUBpUYHUPNneEpjfpfQS36n05DxHDzuXO X-Received: by 2002:a17:902:2d01:: with SMTP id o1mr4518571plb.105.1561543024972; Wed, 26 Jun 2019 02:57:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561543024; cv=none; d=google.com; s=arc-20160816; b=wc2YaErYs1wxyXvnwBxfsIBcNyR0uotZ4cyRk2QSWeY8gh0wu+nxnualcQWayROHr0 poK3S1Gnb9Xsor75WDooLpPN54YKXf3lb3GFD1ApoE7blA+ogxFkPPRgd2jwmZIsyPBy bqRPjLc+GGOxdNdsNiHiWoa0ZBAuY7/D0Cy6zHJYRJL4kpMmEzBpP9zvy/1IXkZKBx2U 5lf9AEx88BTR7sIoyWX46M/8Yp4V/CVPwjdPOySIAf47sflTK2hBwPUQk/mTGPTRMNdx unkGNI///kh8jH8Wmhz9xTatcbndlrsNQTd3Y07iYkIkSUGyE16B32N33nfO6ThMfP3n fLhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:cc:to:subject:dkim-signature:dkim-filter; bh=Hk7za34B6PtC3S7miNX/a+oGyxVJXmwKHDbecortBKc=; b=M4o/dIPaqBnqjIKCIKvv6bo/5qk0YEcQpd4ziANhIKnzWM7LZFJAj9ZPxBqYjDvvxl OEm/8MTqKEaasQfaSGiFxmJQmY2IIH+yy47jZh11gC5t3wTM34JDC0/nHBq+2c+k+pi+ eSxCatHCZEtMyGLg5R3wJDmfhHIZ/RS1VzvaQpxKPKMLYw8uEsUmfADQ17Q2wDbCGmHY Ub9QfyJ70yWsRL6ZfDZZcuMnIyR7IU5PLdTe4zRXipReyuBiWWYH1KRq1KQIgNrtMlIy /VbKmtRFKeE1yaMgIEIOcWUNwS6cIdzusqDeACOBT+6vsnm2cgsjdFm9EgVyOkJ1IaiT K8Gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=o8SrkhJl; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q185si9382052pga.565.2019.06.26.02.56.48; Wed, 26 Jun 2019 02:57:04 -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=@samsung.com header.s=mail20170921 header.b=o8SrkhJl; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726820AbfFZJ4W (ORCPT + 99 others); Wed, 26 Jun 2019 05:56:22 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:57700 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725379AbfFZJ4W (ORCPT ); Wed, 26 Jun 2019 05:56:22 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20190626095621euoutp023321bbccea6ec2c07f7d043754d3daca~rtxFc9Yhr0686106861euoutp02Z for ; Wed, 26 Jun 2019 09:56:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20190626095621euoutp023321bbccea6ec2c07f7d043754d3daca~rtxFc9Yhr0686106861euoutp02Z DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1561542981; bh=Hk7za34B6PtC3S7miNX/a+oGyxVJXmwKHDbecortBKc=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=o8SrkhJl7F3EciyZZ8tAVTRp/vCSsciUyEUwNJkp0PIAWUdSZbmvtubfdWbA4cxQf dk3iqkM/quo23adh7MC8wN7iH02ejeP3rdwYUFbjXz3ejC7I/7HbyS/0faf8Oow6XZ YDKmE2SYxte1goj2aAqVCCY3WhxYQa/U1BhUwSzw= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20190626095620eucas1p14bfef993fc308e8e3cf36688cbac4b15~rtxE1lwZU0280502805eucas1p1l; Wed, 26 Jun 2019 09:56:20 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id AE.AE.04325.441431D5; Wed, 26 Jun 2019 10:56:20 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20190626095619eucas1p2d17e9b495f3bdebf27b06c3fcec52ad8~rtxEHWQyy0312703127eucas1p2y; Wed, 26 Jun 2019 09:56:19 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20190626095619eusmtrp2c277c1fcef3823b35811e8632b7e7722~rtxD4-cjB0511105111eusmtrp2j; Wed, 26 Jun 2019 09:56:19 +0000 (GMT) X-AuditID: cbfec7f5-b8fff700000010e5-47-5d13414449d4 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 7D.90.04140.341431D5; Wed, 26 Jun 2019 10:56:19 +0100 (BST) Received: from [106.120.51.74] (unknown [106.120.51.74]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20190626095618eusmtip26d78c3c13eebcac38721956ffff22091~rtxDJsg3V2662626626eusmtip26; Wed, 26 Jun 2019 09:56:18 +0000 (GMT) Subject: Re: [PATCH v2 1/2] drm/bridge/synopsys: dw-hdmi: Handle audio for more clock rates To: Doug Anderson Cc: Laurent Pinchart , Sean Paul , Jernej Skrabec , =?UTF-8?Q?Heiko_St=c3=bcbner?= , Jonas Karlman , Maxime Ripard , Neil Armstrong , "open list:ARM/Rockchip SoC..." , Dylan Reid , Cheng-Yi Chiang , Jerome Brunet , Sam Ravnborg , dri-devel , LKML , David Airlie , Daniel Vetter From: Andrzej Hajda Message-ID: Date: Wed, 26 Jun 2019 11:56:17 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: Content-Transfer-Encoding: 7bit Content-Language: en-US X-Brightmail-Tracker: H4sIAAAAAAAAA02Sa1BMYRjHvXvOnk47bU6bpkdF2dGHomIY85LJrQ9njBkMH4w0LM5Uo032 SBJakm6KiLTRGrNpU7mUShlkM11Qo6tc29xTTaM2ppmydves0bf/8zz/3/s8/5mXJmTJlAcd FXOQU8UoouWUhKxunGgLCF3jGr4oV0/hrLYWEc6qvivC5uocAmub31C49cYTCneNj1DY/HFQ jIc+PiVw9+8BArcMdZM4PUfngDvrrlB41GgmsHHgMcKG7DCsn6hC+P2dVrTahR3pTXFgC8sS 2QJ1O8k+/HWNZAvS8sVs87kOEVvzyyhm+zKbRGylLonVXeqm2PqsCyRb01NIsGMVczdJt0tW 7uWiow5xqqCQXZLI5gujROwHn8OfBjMoNeqcnYEcaWCWQvpkHZmBJLSM0SO4W9wpEgoTgu8d RWKhGLMUb1PRP2TwWY8dKUZQOfbD7hpGUHq1xMHqcmXCobXZRFj1LMYPvqoHCKuJYErF0Pjl PWkdUJbBVOVryqqlTAhc71fbYJLxhexLG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i 0cMGsHUsAqoSfdNmgU0SFYiQmL2rgQWiRlDi5MwnYDanQKBEz86/YDXMAuoSf+ZdgrLlJba/ nQNli0vcejKfaQKj0Cwk7bOQtMxC0jILScsCRpZVjCKppcW56bnFRnrFibnFpXnpesn5uZsY gWli27GfW3Ywdr0LPsQowMGoxMPbIC8UK8SaWFZcmXuIUYKDWUmEd2miQKwQb0piZVVqUX58 UWlOavEhRlOg5yYyS4km5wNTWF5JvKGpobmFpaG5sbmxmYWSOG+HwMEYIYH0xJLU7NTUgtQi mD4mDk4pYDTJdyVkpiQkme9fqbTggoPX7OnKSes2XYuUnP/p+i7ZDcneqS8XXzIuPbDmQO7P 2eXncxZkW9lPEzPdLzb5UE2084Fsj5UvgnIsVVlnR38oWsH2k1u0jzuy6V/h/8zuXq1HPw+J R3s7/dU7dmSu3O4/v3d8YZflfx/2XdvwvlmJD3N1bmLQeSWW4oxEQy3mouJEAAnGQcIpAwAA X-CMS-MailID: 20190626095619eucas1p2d17e9b495f3bdebf27b06c3fcec52ad8 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20190619211151epcas3p4dbb163c034afa4063869c761b93e24b1 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20190619211151epcas3p4dbb163c034afa4063869c761b93e24b1 References: <20190619210718.134951-1-dianders@chromium.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 25.06.2019 18:26, Doug Anderson wrote: > Hi, > > > On Tue, Jun 25, 2019 at 9:07 AM Andrzej Hajda wrote: >> On 19.06.2019 23:07, Douglas Anderson wrote: >>> Let's add some better support for HDMI audio to dw_hdmi. >>> Specifically: >>> >>> 1. For 44.1 kHz audio the old code made the assumption that an N of >>> 6272 was right most of the time. That wasn't true and the new table >>> should pick a more ideal value. >> >> Why? I ask because it is against recommendation from HDMI specs. > The place where it does matter (and why I originally did this work) is > when you don't have auto-CTS. In such a case you really need "N" and > "CTS" to make the math work and both be integral. This makes sure > that you don't slowly accumulate offsets. I'm hoping that this point > should be non-controversial so I won't argue it more. > > I am an admitted non-expert, but I have a feeling that with Auto-CTS > either the old number or the new numbers would produce pretty much the > same experience. Because Auto-CTS mechanism will alternate between two or more CTS values every frame, thus it will compensate non-rational clock relationship. > AKA: anyone using auto-CTS won't notice any change > at all. I guess the question is: with Auto-CTS should you pick the > "ideal" 6272 or a value that allows CTS to be the closest to integral > as possible. By reading between the lines of the spec, I decided that > it was slightly more important to allow for an integral CTS. If > achieving an integral CTS wasn't a goal then the spec wouldn't even > have listed special cases for any of the clock rates. We would just > be using the ideal N and Auto-CTS and be done with it. The whole > point of the tables they list is to make CTS integral. Specification recommends many contradictory things without explicit prioritization, at least I have not found it. So we should relay on our intuition. I guess that with auto-cts N we should follow recommendation - I guess most sinks have been better tested with recommended values. So what with non-auto-cts case: 1. How many devices do not have auto-cts? how many alternative TMDS clocks we have? Maybe it is theoretical problem. 2. Alternating CTS in software is possible, but quite complicated/annoying, but at least it will follow recommendation :) Regards Andrzej > > >>> 2. The new table has values from the HDMI spec for 297 MHz and 594 >>> MHz. >>> >>> 3. There is now code to try to come up with a more idea N/CTS for >>> clock rates that aren't in the table. This code is a bit slow because >>> it iterates over every possible value of N and picks the best one, but >>> it should make a good fallback. >>> >>> NOTES: >>> - The oddest part of this patch comes about because computing the >>> ideal N/CTS means knowing the _exact_ clock rate, not a rounded >>> version of it. The drm framework makes this harder by rounding >>> rates to kHz, but even if it didn't there might be cases where the >>> ideal rate could only be calculated if we knew the real >>> (non-integral) rate. This means that in cases where we know (or >>> believe) that the true rate is something other than the rate we are >>> told by drm. >>> - This patch makes much less of a difference after the patch >>> ("drm/bridge: dw-hdmi: Use automatic CTS generation mode when using >>> non-AHB audio"), at least if you're using I2S audio. The main goal >>> of picking a good N is to make it possible to get a nice integral >>> CTS value, but if CTS is automatic then that's much less critical. >> >> As I said above HDMI recommendations are different from those from your >> patch. Please elaborate why? >> >> Btw I've seen your old patches introducing recommended N/CTS calculation >> helpers in HDMI framework, unfortunately abandoned due to lack of interest. >> >> Maybe resurrecting them would be a good idea, with assumption there will >> be users :) > I have old patches introducing this into the HDMI framework? I don't > remember them / can't find them. Can you provide a pointer? > > -Doug > >