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] [day] [month] [year] [list]
Message-ID: <9d3181ff-5c08-697d-43fa-65bdc9544a26@collabora.com>
Date:   Wed, 8 Feb 2023 12:27:02 +0000
From:   lucas.tanure@...labora.com
To:     Charles Keepax <ckeepax@...nsource.cirrus.com>,
        David Rhodes <david.rhodes@...rus.com>,
        Liam Girdwood <lgirdwood@...il.com>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        Mark Brown <broonie@...nel.org>,
        Rob Herring <robh+dt@...nel.org>,
        Jaroslav Kysela <perex@...ex.cz>,
        Takashi Iwai <tiwai@...e.com>, alsa-devel@...a-project.org,
        devicetree@...r.kernel.org, patches@...nsource.cirrus.com,
        linux-kernel@...r.kernel.org, kernel@...labora.com
Subject: Re: [PATCH v2 3/5] ALSA: cs35l41: Add shared boost feature

On 2/8/23 10:09 AM, Charles Keepax <ckeepax@...nsource.cirrus.com> wrote:
> On Tue, Feb 07, 2023 at 04:25:24PM +0000, Lucas Tanure wrote:
> > Shared boost allows two amplifiers to share a single boost
> > circuit by communicating on the MDSYNC bus.
> > The passive amplifier does not control the boost and receives
> > data from the active amplifier.
> >
> > Shared Boost is not supported in HDA Systems.
> > Based on David Rhodes shared boost patches.
> >
> > Signed-off-by: Lucas Tanure <lucas.tanure@...labora.com>
> > ---
> > -int cs35l41_global_enable(struct regmap *regmap, enum cs35l41_boost_type b_type, int enable)
> > +int cs35l41_global_enable(struct regmap *regmap, enum cs35l41_boost_type b_type, int enable,
> > +			  struct completion *pll_lock)
> >   {
> >   	int ret;
> > +	unsigned int gpio1;
> >   
> >   	switch (b_type) {
> > +	case CS35L41_SHD_BOOST_ACTV:
> > +	case CS35L41_SHD_BOOST_PASS:
> > +		regmap_update_bits(regmap, CS35L41_PWR_CTRL3, CS35L41_SYNC_EN_MASK, 0);
> > +
> > +		gpio1 = enable ? CS35L41_GPIO1_MDSYNC : CS35L41_GPIO1_HIZ;
> > +		regmap_update_bits(regmap, CS35L41_GPIO_PAD_CONTROL, CS35L41_GPIO1_CTRL_MASK,
> > +				   gpio1 << CS35L41_GPIO1_CTRL_SHIFT);
> > +
> > +		ret = regmap_update_bits(regmap, CS35L41_PWR_CTRL1, CS35L41_GLOBAL_EN_MASK,
> > +					 enable << CS35L41_GLOBAL_EN_SHIFT);
> > +		usleep_range(3000, 3100);
> > +		if (!enable)
> > +			break;
> > +
> > +		if (!pll_lock)
> > +			return -EINVAL;
> > +
> > +		ret = wait_for_completion_timeout(pll_lock, msecs_to_jiffies(1000));
> > +		if (ret == 0) {
> > +			ret = -ETIMEDOUT;
> > +		} else {
> > +			regmap_update_bits(regmap, CS35L41_PWR_CTRL3, CS35L41_SYNC_EN_MASK, 0);
Its wrong here. Should be enabling it not disable.
I will send v3. 

> > +			regmap_update_bits(regmap, CS35L41_PWR_CTRL1, CS35L41_GLOBAL_EN_MASK,
> > +								 0 << CS35L41_GLOBAL_EN_SHIFT);
> > +			usleep_range(3000, 3100);
> > +			regmap_update_bits(regmap, CS35L41_PWR_CTRL1, CS35L41_GLOBAL_EN_MASK,
> > +								 1 << CS35L41_GLOBAL_EN_SHIFT);
> > +			usleep_range(3000, 3100);
> > +		}
> 
> This approach also makes me nervous, I was somewhat imagining the
> usage of regmap_multi_reg_write for this sequence was because it
> was very important that no other register writes could interleave
> in between these writes. But I don't know, so it could also have
> just been a random design choice. So we probably need David to
> confirm if that was the reason for the original code here.
> 
> Thanks,
> Charles
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ