Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp566384img; Thu, 28 Feb 2019 04:25:05 -0800 (PST) X-Google-Smtp-Source: AHgI3IacZAIhQ3BTN10Fo9emu+EFQul0MKLVSc6ue7rI7OWyCcXR4dtSeCsXTgDFnvh5xwc6jMh6 X-Received: by 2002:a17:902:1125:: with SMTP id d34mr7727402pla.75.1551356705670; Thu, 28 Feb 2019 04:25:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551356705; cv=none; d=google.com; s=arc-20160816; b=R8zxpZ1zSzJGpPS95pysviEZ+DLwUMHcEVn/G/Bdbh5T0NdpE+EwauF2CWD2MyLJ2C 5Ulrc3844WB7+33wqf4FKyinl9aKGqK4LkJLdCmfLZ3gd4WMEWc2LDw5Ny8PQZhc27/b gu8TRqwHYqOop9kxYxTZ6x3+z5uHJD1BDYLkQbXvi0qExi36EjpQFMLZQX3W4BWmRLeS pymQUyJsfkpb53apItel8V7UhbmyyqzRg7Ko2P5hzfLzjBWoey1cnDbJ3YtPBh/6c6f/ 5OwtZ5EgJCKSgpKk1lG3/Usz6nczuEiyeCucSXH7TdhTQWSajiqNP+epQXUZUQJ3UeH2 dweA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature; bh=p0W9HcQqab7nM5jJ/dzDgwg4tVnj5Fdz9Bwq8WtH2Eg=; b=FcYT8WvbpFmFNL82vvO20R4zud/+8r1euz5w1fi0/t/DdVmWvsKMahBrFNq9aeZQB/ ahutvDSTCr4zfVzPg6o9+R4UV9kPCkZyoUW1ivPm4SIzs0CCDrTPOSAoNarSNlRQpGx1 mavZcfMZDJ9NQkUNKg75raum8OuEw0LI8IOwlutKgmLimjmFhf9Sj9lpQSMhYJ2AjTHj GWPgW5NCOYsrH3eEJdgL313TNK4k7ivnv5KYfOaecXbFCtgLlHacmtAXQXb8kFBWr8Ei PffK/trPZlTjYwnFfZrFJzqa2BEnveTfLwVHeCiin0LZkQZlVmxqPp/9FakB3Bsqdxnp x+lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=CwQA5+I5; 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=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d12si17399383plo.143.2019.02.28.04.24.50; Thu, 28 Feb 2019 04:25:05 -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=neutral (body hash did not verify) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=CwQA5+I5; 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=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731153AbfB1MPe (ORCPT + 99 others); Thu, 28 Feb 2019 07:15:34 -0500 Received: from pandora.armlinux.org.uk ([78.32.30.218]:47320 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726231AbfB1MP3 (ORCPT ); Thu, 28 Feb 2019 07:15:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:Content-Type:MIME-Version: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=sy8WD7E5hbj/pJXZ4C/UvxTXoj++mbXA/ezOBCWHgls=; b=CwQA5+I5gukWEIFjjOySNDuKf kIbaeUOrsZuPhZe5NFCDpaDWD+TWe79InTB8NKQ0gXz8FZsd3+TMuMcLB/lz2gfLmuiJCGlGifsu9 Yj2rLX/c768J9qN8+dlHxT2rlR40lYqIa4No2b+Y4k0t7Bh3Udy7m7eoLvduM7ch+9EXwnubLOxAj 1Kcfeq86AIkmlvVimIHGZ8ZRzb1ym5SvjR91KLzT/HhwYeQAThqJihpFjbAEBr7SY2ZzSlc38kZjt pujskUvoWvlVR1HkssyR5DRYrbMjzcQiS0j6giC3uLtCsS4Y19OcberjNZWcc+rWS95hQXwYUaWQA 0fzGLWOKg==; Received: from shell.armlinux.org.uk ([2002:4e20:1eda:1:5054:ff:fe00:4ec]:37170) by pandora.armlinux.org.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1gzKat-0000Eb-6p; Thu, 28 Feb 2019 12:15:19 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.89) (envelope-from ) id 1gzKaq-0007O0-Kr; Thu, 28 Feb 2019 12:15:16 +0000 Date: Thu, 28 Feb 2019 12:15:16 +0000 From: Russell King - ARM Linux admin To: Jyri Sarha , Liam Girdwood , Mark Brown Cc: alsa-devel@alsa-project.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: hdmi-codec: modifying params in hw_params() callback Message-ID: <20190228121516.swd3vweisgcxlvld@shell.armlinux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? 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? Thanks. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up According to speedtest.net: 11.9Mbps down 500kbps up