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: <49c925e8-b6e9-0dcb-b8ed-7e03d9e2b188@opensource.cirrus.com>
Date:   Fri, 21 Jan 2022 10:22:54 +0000
From:   Richard Fitzgerald <rf@...nsource.cirrus.com>
To:     <broonie@...nel.org>
CC:     <alsa-devel@...a-project.org>, <linux-kernel@...r.kernel.org>,
        <patches@...nsource.cirrus.com>
Subject: Re: [PATCH 3/3] ASoC: cs42l42: Handle system suspend

On 20/01/2022 17:55, Richard Fitzgerald wrote:

> +static int __maybe_unused cs42l42_resume(struct device *dev)
> +{
> +	struct cs42l42_private *cs42l42 = dev_get_drvdata(dev);
> +	int ret;
> +
> +	/*
> +	 * If jack was unplugged and re-plugged during suspend it could
> +	 * have changed type but the tip-sense state hasn't changed.
> +	 * Force a plugged state to be re-evaluated.
> +	 */
> +	if (cs42l42->plug_state != CS42L42_TS_UNPLUG)
> +		cs42l42->plug_state = CS42L42_TS_TRANS;
> +
> +	ret = regulator_bulk_enable(ARRAY_SIZE(cs42l42->supplies), cs42l42->supplies);
> +	if (ret != 0) {
> +		dev_err(dev, "Failed to enable supplies: %d\n", ret);
> +		return ret;
> +	}
> +
> +	gpiod_set_value_cansleep(cs42l42->reset_gpio, 1);
> +	usleep_range(CS42L42_BOOT_TIME_US, CS42L42_BOOT_TIME_US * 2);
> +
> +	regcache_cache_only(cs42l42->regmap, false);
> +	regcache_mark_dirty(cs42l42->regmap);
> +
> +	/* Sync LATCH_TO_VP first so the VP domain registers sync correctly */
> +	regcache_sync_region(cs42l42->regmap, CS42L42_MIC_DET_CTL1, CS42L42_MIC_DET_CTL1);
> +	regcache_sync(cs42l42->regmap);
> +
> +	cs42l42->suspended = false;

This should be taking the irq_mutex around the regcache_sync() so that
we don't get unhandled interrupts after the interrupts are unmasked
but before cs42l42->suspended is cleared.

Will push a V2 with this fix.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ