Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4401817imm; Mon, 14 May 2018 07:06:27 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoQr0RL9cssOQ8OyCwUVwk6+tE39w5JS/gNo6spAx0BjdilukZDvCg454PR0Bc0XSpuboko X-Received: by 2002:a63:a06a:: with SMTP id u42-v6mr8338283pgn.389.1526306787344; Mon, 14 May 2018 07:06:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526306787; cv=none; d=google.com; s=arc-20160816; b=aJbClcXllP6f64vFnis9rNGSLkcvqQHj8ArlI+qI4Bf3q1vKOPcKcYsiixl35EJ5aa Nx6xZ5JOrjQwpJDVIC9ZF1UtWjO6j87D9VTl35n1X4lOOr8edcsY7v9bZitvkeVexbHc ZmcE3K0oR9fRV0yUZMKBptQr3QabLoRtiQbRn28C9/yQyICKjTf/dPvLrq9LUYyCRMQW vtKWmwjRVL9gJcrN5roes5cGRkFS5YkexMqLanPnPw4R12r2vohf4XJHr5m6BUy4K3UD 2nUj0KyDsN5k3/Prsil9Ewx4FOzjEyZ4HQfh3Kva1C0MDFWH9g7Shtq5svcHP0DkjCpO fJRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=W6AsKQWJz8HurGf/SThiseBy02L9Yn+z6HggHZs5uI4=; b=Er33M9HcK6Kh+/iwVlM5TA+4ZTKwoL9NFAKUuBQ4X5MvEXh79ZelYtw/W6/7C4WQmU jTt8RGuc6LV+mbS/18UXCw+ZKWOr4cgPf2c4HkSPM01njv5CBuyu3F5W6ZSEIv0Wb/RM V7iCrC1ThDGaSos7MrB1dqXeBqhu0oEGdHUBs/mRHjmtpKzRlPB3iyXqtnlXJzYR07wQ FQrDmkQgiFi6UxOd2E11pE37jYtKBhLt+TnsFnqZqwRQq150Fq9BSyNlT7VKLmPc9TGw YEhWqLjm/yrG6dyMjCZTUTqA2/Xe0WVZQzs5/OfMY2m7usGRpR51cSXAS/ph8LrJoE0f MOlg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j4-v6si8124257plt.430.2018.05.14.07.06.11; Mon, 14 May 2018 07:06:27 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932294AbeENOFm (ORCPT + 99 others); Mon, 14 May 2018 10:05:42 -0400 Received: from mail.bootlin.com ([62.4.15.54]:50158 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753422AbeENOFl (ORCPT ); Mon, 14 May 2018 10:05:41 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 6AF9B206F6; Mon, 14 May 2018 16:05:39 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.bootlin.com (Postfix) with ESMTPSA id 3D12F20376; Mon, 14 May 2018 16:05:29 +0200 (CEST) Date: Mon, 14 May 2018 16:05:30 +0200 From: Maxime Ripard To: Danny Milosavljevic Cc: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Chen-Yu Tsai , Andrea Bondavalli , Fabio Estevam , Icenowy Zheng , Philipp Zabel , Kuninori Morimoto , alsa-devel@alsa-project.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: Re: [PATCH v14 2/8] ASoC: sun4i-codec: Add Mic1 Boost Volume, Mic2 Boost Volume Message-ID: <20180514140530.bnedijfm6hvnpyq4@flea> References: <20180502210800.1971-1-dannym@scratchpost.org> <20180502210800.1971-3-dannym@scratchpost.org> <20180503143319.4vyh2y5sluatssnv@flea> <20180505090513.7e3f02c2@scratchpost.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="a6p7tq4lwuvkohwp" Content-Disposition: inline In-Reply-To: <20180505090513.7e3f02c2@scratchpost.org> User-Agent: NeoMutt/20180323 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --a6p7tq4lwuvkohwp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, May 05, 2018 at 09:05:13AM +0200, Danny Milosavljevic wrote: > Hi Maxime, >=20 > On Thu, 3 May 2018 16:33:19 +0200 > Maxime Ripard wrote: >=20 > > > +struct sun4i_codec_quirks { > > > + const struct regmap_config *regmap_config; > > > + const struct snd_soc_component_driver *codec; > > > + struct snd_soc_card * (*create_card)(struct device *dev); > > > + struct reg_field reg_adc_fifoc; /* used for regmap_field */ > > > + unsigned int reg_dac_txdata; /* TX FIFO offset for DMA config */ > > > + unsigned int reg_adc_rxdata; /* RX FIFO offset for DMA config */ > > > + bool has_reset; > > > + const struct snd_kcontrol_new *controls; > > > + unsigned int num_controls; > > > +}; > > > + > > > +static int sun4i_codec_component_driver_probe(struct snd_soc_compone= nt *codec) > > > +{ > > > + const struct sun4i_codec_quirks *quirks; > > > + > > > + quirks =3D of_device_get_match_data(codec->dev); > > > + return snd_soc_add_component_controls(codec, > > > + quirks->controls, > > > + quirks->num_controls); =20 > >=20 > > Why not just extending the sun4i_codec_controls to add it, and create > > a duplicate one for the A20? >=20 > Because sun4i_codec_controls has five controls shared between A10 and A20, > and only two not shared. > > And if we extended sun4i_codec_controls, we'd also have to duplicate > sun4i_codec_codec in order to use sun4i_codec_controls vs. sun7i_codec_co= ntrols, > which really contains exactly the same data otherwise. What I don't really like is that with this patch we have two variants of the same mechanism: one to add the controls that are mostly shared, and one to add the controls that are not shared, without any clear definition of when you should add a new control to one list or the other. So far, we had one mechanism, it was easy to understand and to know what to do about it. And the code was simple as well. > The quirks here are just for two controls, Mic1 Boost Volume and > Mic2 Boost Volume, and there not even for the names or anything - > just for some reason the register moved away. >=20 > The simplest way was to add it to the quirks - which already have a > variant selection etc. Actually, I think that having to do add a new control explicitly to an A10 and an A20 list is a feature if the two controls set aren't exactly the same. It makes you explicitly think about what you're doing, and hopefully double check if it is actually shared or not, instead of exposing a control because one didn't pay attention that it was shared. Chen-Yu, any opinion on this? Maxime --=20 Maxime Ripard, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com --a6p7tq4lwuvkohwp Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEE0VqZU19dR2zEVaqr0rTAlCFNr3QFAlr5l6kACgkQ0rTAlCFN r3SWZw//abRI9OE2fDIEEJpKrOcj8UwhvkXOubxrvM3fDVnqCHHVYP82AZwOdbUW 7lOzZSzz5McmfhthMrLCLgR7c2upUn2youAVUtpEwwehEKM2rV+nM3oR4V6SlXJK XIjNyLuLHM+NaBuEKclQG+loE+Vmo0/m9IQXwW+H2lUZC17r7sEpbLQp3GhUfFBL OI69LhvsVYtkHqe0xRixlcLc6oGQOAP3qwJYaKuD2hRPHe7v9BsqBtTagybiK0iq J4aG74VyWNmM0lA90YBnxOP5DdHGSo8+fdYBgo77dJlH3U4aVv+rWf/gTYEhGGD9 pMP+9s3NRqEfD2MgGuOBUnJjAk8NnYcx6IORUBcxLtkmzwoJKylgtoCPcqgvnWv/ P+KAGvMwDHmWkyfUmhDyHBQhLV4hfXosjyHQ2OWsFlAuHpqFGrZNhOj/VJbMae0W Wf2YVGEjOTHALg9ReXQY08cdJeG7kS2yy57IIl6/tfgcP918rL9lc4C5PEIRRVNl xfNiPmklL4dgUQsRFUNMrHqLuHZGX8YNGTnZtb734jes0qoUytB0Q3J+GGHYkVRb 6t38IgiNbS7vPZC/ugIrz8Yemfu/b8ytm+vINnNeTPwq+47xn0gCMVtj4Xu5CnVZ cSc2T+P21wymZa6bjcwpG7SPCk06Jo2rG4UzeBnTfcm244ck094= =HsIE -----END PGP SIGNATURE----- --a6p7tq4lwuvkohwp--