From: Richard Fitzgerald <rf@opensource.cirrus.com>
To: <broonie@kernel.org>
Cc: <alsa-devel@alsa-project.org>, <linux-kernel@vger.kernel.org>,
<patches@opensource.cirrus.com>
Subject: Re: [PATCH 3/3] ASoC: cs42l42: Handle system suspend
Date: Fri, 21 Jan 2022 10:22:54 +0000 [thread overview]
Message-ID: <49c925e8-b6e9-0dcb-b8ed-7e03d9e2b188@opensource.cirrus.com> (raw)
In-Reply-To: <20220120175549.671831-4-rf@opensource.cirrus.com>
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.
prev parent reply other threads:[~2022-01-21 10:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-20 17:55 [PATCH 0/3] ASOC: cs42l42: Add support for " Richard Fitzgerald
2022-01-20 17:55 ` [PATCH 1/3] ASoC: cs42l42: Report full jack status when plug is detected Richard Fitzgerald
2022-01-20 17:55 ` [PATCH 2/3] ASoC: cs42l42: Change jack_detect_mutex to a lock of all IRQ handling Richard Fitzgerald
2022-01-20 17:55 ` [PATCH 3/3] ASoC: cs42l42: Handle system suspend Richard Fitzgerald
2022-01-21 10:22 ` Richard Fitzgerald [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49c925e8-b6e9-0dcb-b8ed-7e03d9e2b188@opensource.cirrus.com \
--to=rf@opensource.cirrus.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=patches@opensource.cirrus.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®