Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp632643img; Thu, 28 Feb 2019 05:29:14 -0800 (PST) X-Google-Smtp-Source: AHgI3IZx9d0qO8Axp3XI+RK1WMiU0RfWbw9HrlOhttERwDefGaS0XJdIFIJFtNtn54jaTFW7C0I0 X-Received: by 2002:aa7:838c:: with SMTP id u12mr7351328pfm.189.1551360554576; Thu, 28 Feb 2019 05:29:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551360554; cv=none; d=google.com; s=arc-20160816; b=mPBrlPqqjSHO6czlYYrR4O46NMGLDaRti0FWUQekoAOWSxarjwza7/MHXOpmOsIAp7 S+WkF71K8I2QKSc6SrlPaaKEZ7t2M7hU9wP0C/uAnj1gBMGjXKGv3mb+5kkvWyiWQt4G HrISpco+9Tx6VfX7tjQgxcNRGnTMZ9OxCphgPJFdbIPLdTXtlWGXg6C4e0HAiH8GtlKU 8H0qRmT188MKt22X1qkgzE7PDa6og+VXSg1EAb87FXTOWAEiJUNlQV7XQjU9VlMHFopR Lc3w4UGeN1tORBSepslFwl/FiE40c1sbR9kwkGd+d5uUnW2urjfG23SeNxcBKrpDyciy PenA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject :dkim-signature; bh=lWwH/P4OAmob59EqtRKHff7XRlIfMDlLY8hU8PWCI6Y=; b=Wii1wWL2UglPBJURmHHkEjSJLwPu/TLtjn2mVz2j32wqUSqVr13yVN4kq8kIYhJ80E /0cEQxG4Ce0DPz5FwNO0snKx1/mlD/npwI4gPVMHD8amHVj4FIz1lGGIX5qmwyUckKss VJoNwjiIY1OaQGvJIlSteuD1y+JETcaQ3qKYtq3EC4CeG2awS3PQLl314HDPze3nM+fv pQBxdo9wJ86M9nM7RsWaUqqIC9+TZIoVbToYsitb1n1B959C86dd8wajEV/0G+GiXkwN eDPrguL0I/VPJI/mEIf0gMMaIV+yn/ikHDXTWBMp6502mhHY34r/mXt9yFz15mi+wuai W1tQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=sWM2QJ+K; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bi9si7952285plb.174.2019.02.28.05.28.58; Thu, 28 Feb 2019 05:29:14 -0800 (PST) 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=@ti.com header.s=ti-com-17Q1 header.b=sWM2QJ+K; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732531AbfB1Myu (ORCPT + 99 others); Thu, 28 Feb 2019 07:54:50 -0500 Received: from fllv0015.ext.ti.com ([198.47.19.141]:54526 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726232AbfB1Myt (ORCPT ); Thu, 28 Feb 2019 07:54:49 -0500 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id x1SCsWJp001367; Thu, 28 Feb 2019 06:54:32 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1551358472; bh=lWwH/P4OAmob59EqtRKHff7XRlIfMDlLY8hU8PWCI6Y=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=sWM2QJ+K8gQYdv6kH1XTTqNVoGoyAvPqLPHuHEWWiapfCPRJOVShIFvKMtjoCB6WX AjQWKQqHaQ4hi4cOANaSXhDZR+0B3vaBLPuQCFuSP0EwVa3W+7YCqrt+PCMq40+f8P Nmg/Z2eMMUAunLYbrP+sGpZXGaU2ss5iLAHTIAt8= Received: from DLEE107.ent.ti.com (dlee107.ent.ti.com [157.170.170.37]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x1SCsWOh073054 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 28 Feb 2019 06:54:32 -0600 Received: from DLEE101.ent.ti.com (157.170.170.31) by DLEE107.ent.ti.com (157.170.170.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Thu, 28 Feb 2019 06:54:31 -0600 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE101.ent.ti.com (157.170.170.31) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1591.10 via Frontend Transport; Thu, 28 Feb 2019 06:54:31 -0600 Received: from [10.1.3.6] (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id x1SCsUvY004054; Thu, 28 Feb 2019 06:54:30 -0600 Subject: Re: hdmi-codec: modifying params in hw_params() callback To: Russell King - ARM Linux admin , Liam Girdwood , Mark Brown CC: , , References: <20190228121516.swd3vweisgcxlvld@shell.armlinux.org.uk> From: Jyri Sarha Openpgp: preference=signencrypt Autocrypt: addr=jsarha@ti.com; prefer-encrypt=mutual; keydata= mQINBFbdWt8BEADnCIkQrHIvAmuDcDzp1h2pO9s22nacEffl0ZyzIS//ruiwjMfSnuzhhB33 fNEWzMjm7eqoUBi1BUAQIReS6won0cXIEXFg9nDYQ3wNTPyh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XVEl2kkuMuIWkgtuuLQ7ZwqgxGP3dMA5z3Iv/N+VNRGbaw oxf+ZkTbJHEE/dWclj1TDtpET/t6BJNLaldLtJ1PborQH+0jTmGbsquemKPgaHeSU8vYLCdc GV/Rz+3FN0/fRdmoq2+bIHght4T6KZJ6jsrnBhm7y6gzjMOiftH6M5GXPjU0/FsU09qsk/af jbwLETaea0mlWMrLd9FC2KfVITA/f/YG2gqtUUF9WlizidyctWJqSTZn08MdzaoPItIkRUTv 6Bv6rmFn0daWkHt23BLd0ZP7e7pON1rqNVljWjWQ/b/E/SzeETrehgiyDr8pP+CLlC+vSQxi XtjhWjt1ItFLXxb4/HLZbb/L4gYX7zbZ3NwkON6Ifn3VU7UwqxGLmKfUwu/mFV+DXif1cKSS v6vWkVQ6Go9jPsSMFxMXPA5317sZZk/v18TAkIiwFqda3/SSjwc3e8Y76/DwPvUQd36lEbva uBrUXDDhCoiZnjQaNz/J+o9iYjuMTpY1Wp+igjIretYr9+kLvGsoPo/kTPWyiuh/WiFU2d6J PMCGFGhodTS5qmQA6IOuazek1qSZIl475u3E2uG98AEX/kRhSzgpsbvADPEUPaz75uvlmOCX tv+Sye9QT4Z1QCh3lV/Zh4GlY5lt4MwYnqFCxroK/1LpkLgdyQ4rRVw= Message-ID: <421c1217-6ff6-6ca2-8169-db026284fb29@ti.com> Date: Thu, 28 Feb 2019 14:54:29 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190228121516.swd3vweisgcxlvld@shell.armlinux.org.uk> Content-Type: text/plain; charset="utf-8" Content-Language: en-GB Content-Transfer-Encoding: 8bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 28/02/2019 14:15, Russell King - ARM Linux admin wrote: > Hi all, > > While looking at hdmi-codec issues, I spotted this code: > > static int hdmi_codec_hw_params(struct snd_pcm_substream *substream, > struct snd_pcm_hw_params *params, > struct snd_soc_dai *dai) > { > ... > if (params_width(params) > 24) > params->msbits = 24; > > params->msbits is a parameter that is negotiated and refined by > libasound, and is part of the ALSA constraint system. The "Writing an > ALSA driver" documentation says about the hw_params callback: > > "This is called when the hardware parameter (``hw_params``) is set up > by the application, that is, once when the buffer size, the period > size, the format, etc. are defined for the pcm substream." > > which suggests we should only be reading the parameters, not writing > to them. > > What's more is that the msbits is a parameter that is refined with > userspace, so surely the above should be a declared constraint? > Certainly not a constraint. While HDMI can only pass up to 24-bit per sample audio the most (or at least the two I have worked with) encoders can take 32-bit wide (and probably wider) samples trough i2s. So the system can play 32-bit samples, just the 4 LSB is ignored. Actually there is very little difference between the case of playing 32-bit stereo audio with matching i2s bclk ratio, and playing 24-bit stereo audio with 64-bit bclk ratio. Especially when the 4 LSB is anyway ignored like in HDMI audio case. > Digging a bit deeper, ASoC passes a private copy of the params to each > codec - a copy is made, then fixups for TDM slots are applied, followed > by any topology fixups by the DAI link (be_hw_params_fixup) before the > codec driver's hw_params() callback is made. Afterwards, ASoC reads > back the rate, channels and physical (memory) width and stores them > in the codec's DAI structure. The msbits are not read. > > hdmi-codec also seems to do nothing with the msbits parameter other > than the above code. > > So, all in all, it seems that the above code limiting msbits is > redundant - nothing will read this modified value. Can we kill it? > It certainly looks that way, so yes. In any case struct snd_soc_dai_driver .playback.sig_bits = 24 should be all that is needed. Regards, Jyri -- Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki