From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755727AbcJZRw2 (ORCPT ); Wed, 26 Oct 2016 13:52:28 -0400 Received: from mezzanine.sirena.org.uk ([106.187.55.193]:52720 "EHLO mezzanine.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754686AbcJZRwY (ORCPT ); Wed, 26 Oct 2016 13:52:24 -0400 Date: Wed, 26 Oct 2016 18:50:52 +0100 From: Mark Brown To: Chen-Yu Tsai Cc: Liam Girdwood , Jaroslav Kysela , Takashi Iwai , Rob Herring , Mark Rutland , Russell King , Maxime Ripard , alsa-devel@alsa-project.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-sunxi@googlegroups.com Message-ID: <20161026175052.GE25322@sirena.org.uk> References: <20161003110804.28235-1-wens@csie.org> <20161003110804.28235-3-wens@csie.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="bi5JUZtvcfApsciF" Content-Disposition: inline In-Reply-To: <20161003110804.28235-3-wens@csie.org> X-Cookie: Stay together, drag each other down. User-Agent: Mutt/1.6.0 (2016-04-01) X-SA-Exim-Connect-IP: 77.103.18.231 X-SA-Exim-Mail-From: broonie@sirena.org.uk Subject: Re: [PATCH 02/12] ASoC: dapm: Implement stereo mixer control support X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: No (on mezzanine.sirena.org.uk); Unknown failure Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --bi5JUZtvcfApsciF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Oct 03, 2016 at 07:07:54PM +0800, Chen-Yu Tsai wrote: > /* find dapm widget path assoc with kcontrol */ > dapm_kcontrol_for_each_path(path, kcontrol) { > + /* > + * If status for the second channel was given ( >= 0 ), > + * consider the second and later paths as the second > + * channel. > + */ > + if (found && rconnect >= 0) > + soc_dapm_connect_path(path, rconnect, "mixer update"); > + else > + soc_dapm_connect_path(path, connect, "mixer update"); > found = 1; > - soc_dapm_connect_path(path, connect, "mixer update"); This really only works for two channels with the current inteface - the comment makes it sound like it'll work for more but we can only pass in two (and there's only support for specifying two everywhere). > - change = dapm_kcontrol_set_value(kcontrol, val); > + /* This assumes field width < (bits in unsigned int / 2) */ > + change = dapm_kcontrol_set_value(kcontrol, val | (rval << width)); That seems like a bit of an assumption in cases where we've got a single control for both power and volume? They're very rare though, I'm not even sure any exist. It'd be good to have a check in the code just in case it does come up, it'll likely be a nightmare to debug if someone does run into it. Otherwise I think this makes sense. --bi5JUZtvcfApsciF Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJYEOz7AAoJECTWi3JdVIfQbT0H/27AlcbUBtsUD125FSBySi/I +COXD+0smbe88HGuCGE2GFmtryM4aJBJRcITWegbDvLvF1ve8aalikhS5tz+WSjl H01zmCz57M8cigWrgLMUlNrglvJH2nRNAuP63IHOQ1GPQbOXdjAlno4mwEJHl+YF vQsLany1Ww1bbxGKk1RCjvFP8kNS8VdruC0eK3O1fGjUQ1KjiN8VDCvj8Y3wlnpt OeaFxCxiay/z8qIvrOTtyDOwEwfrpF4eP2paKg99+FlSk2KxQYyWP47p6QUoU/gI uFKlOKLmg1f+46FdcF34ZYTsTfcMFwNftEjFCDnQJBG2QWIV+OW6wuBaXJNdW58= =6bpl -----END PGP SIGNATURE----- --bi5JUZtvcfApsciF--