lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 14 May 2018 16:05:30 +0200
From:   Maxime Ripard <maxime.ripard@...tlin.com>
To:     Danny Milosavljevic <dannym@...atchpost.org>
Cc:     Liam Girdwood <lgirdwood@...il.com>,
        Mark Brown <broonie@...nel.org>,
        Jaroslav Kysela <perex@...ex.cz>,
        Takashi Iwai <tiwai@...e.com>, Chen-Yu Tsai <wens@...e.org>,
        Andrea Bondavalli <andrea.bondavalli74@...il.com>,
        Fabio Estevam <fabio.estevam@....com>,
        Icenowy Zheng <icenowy@...c.xyz>,
        Philipp Zabel <p.zabel@...gutronix.de>,
        Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>,
        alsa-devel@...a-project.org, linux-arm-kernel@...ts.infradead.org,
        linux-kernel@...r.kernel.org, linux-sunxi@...glegroups.com
Subject: Re: [PATCH v14 2/8] ASoC: sun4i-codec: Add Mic1 Boost Volume, Mic2
 Boost Volume

On Sat, May 05, 2018 at 09:05:13AM +0200, Danny Milosavljevic wrote:
> Hi Maxime,
> 
> On Thu, 3 May 2018 16:33:19 +0200
> Maxime Ripard <maxime.ripard@...tlin.com> wrote:
> 
> > > +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_component *codec)
> > > +{
> > > +	const struct sun4i_codec_quirks *quirks;
> > > +
> > > +	quirks = of_device_get_match_data(codec->dev);
> > > +	return snd_soc_add_component_controls(codec,
> > > +					      quirks->controls,
> > > +					      quirks->num_controls);  
> > 
> > Why not just extending the sun4i_codec_controls to add it, and create
> > a duplicate one for the A20?
> 
> 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_controls,
> 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.
> 
> 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

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ