Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp1649775imj; Fri, 8 Feb 2019 05:12:06 -0800 (PST) X-Google-Smtp-Source: AHgI3IYeC7GA6sa/UV2RJWBV9ZYxk2KnsJtdcrmu0T+8lgH6GlBortwKRAw2uDOe6jU6fZwJM6oB X-Received: by 2002:a63:235f:: with SMTP id u31mr20198652pgm.122.1549631526522; Fri, 08 Feb 2019 05:12:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549631526; cv=none; d=google.com; s=arc-20160816; b=ZSGqNjLinlkKho/4rkuE5Y4k6XaysV2sW0PXLBMnihC9VK1SxPqYzzdSJV8bTn81NU GWZnmBMJZH4uYkWFIKlqbEAMWfeZK8stO2SJlfZO589Z9DrXfzG9kpmeFC73wpf/xDVF 2jbtOcAETtUuC3lJn3SB5zjZvgIRnurHD0+OUoyDrh4bTNNaWdr1Rn28wK3NeclYxoSg G4Bqk77iOW1MTZezTqOyPvBsHXyXb/xOknyjE4/mV9oU+0oo9/P8i7EDJMayHytR0pr0 18M+Y9TnNNECYidvUwraT/pvMbhlTH6OVkicaXmngMd9rpwMw+FcMdRfQhg0iowvffNv HOEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:in-reply-to:subject:cc:to :from:dkim-signature; bh=N8W8lNmfEUubZPPFAMJm7WEhQfRSk6ig/FBf9LTr2no=; b=nmhhACDRBKdEjPmC6ouKCbryJrenJJkR4rzZ/Kicrnnjcf0QWP7KSyGvP2Fv4N18ef g9td6DGQ3m3pj1nlU47CRAXmnmgrYsXWSUzRKByqXvjZQFlTieGT8KkkHsUqE/Ewc+7r bQf2rYON/J4WcLMsMD2jD3xSm8APm7hYzXBXHg1pAmYR6JfzcABu20IdybPiIUP7YcQ3 4fLbpW/TxKkhln9+nwYRDhoCucm9SlwftSq0PT+C/jW9i95V1UHBDZyYTc7GaRMTUexd CTkIiHeV983dE2X7R1FEZqSk0fLDwk/UBpcSCFMcu3Py2bbF8Ed3uDcfu2ujaCKy1N8P O8vQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=ZwgOA7x8; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i17si2121485pgk.233.2019.02.08.05.11.50; Fri, 08 Feb 2019 05:12:06 -0800 (PST) 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; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=ZwgOA7x8; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727722AbfBHNL1 (ORCPT + 99 others); Fri, 8 Feb 2019 08:11:27 -0500 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:38280 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726703AbfBHNLY (ORCPT ); Fri, 8 Feb 2019 08:11:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=N8W8lNmfEUubZPPFAMJm7WEhQfRSk6ig/FBf9LTr2no=; b=ZwgOA7x8yfeT RUdpe+zxP5iearuwqtsDCJ4nCVrB4qO5CU56NzEQq2RNrTJKTQ5ridybPTa17J7XfV+OuADcz6lSn gHujc3bDWTpOlS5OqVZ8Prmhg8GTPEbDJC8fyT0hXEqpgbFiGHtBxRXVd46gZ+K8npBTqscvz5RHi eyZnI=; Received: from cpc102320-sgyl38-2-0-cust46.18-2.cable.virginm.net ([82.37.168.47] helo=debutante.sirena.org.uk) by heliosphere.sirena.org.uk with esmtpa (Exim 4.89) (envelope-from ) id 1gs5vy-0001JX-0D; Fri, 08 Feb 2019 13:11:10 +0000 Received: by debutante.sirena.org.uk (Postfix, from userid 1000) id 9EBC41127F30; Fri, 8 Feb 2019 13:11:09 +0000 (GMT) From: Mark Brown To: Olivier Moysan Cc: Mark Brown , lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com, alsa-devel@alsa-project.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-kernel@vger.kernel.org, olivier.moysan@st.com, arnaud.pouliquen@st.com, benjamin.gaignard@st.com, alsa-devel@alsa-project.org Subject: Applied "ASoC: stm32: i2s: add power management" to the asoc tree In-Reply-To: <1549622994-13810-2-git-send-email-olivier.moysan@st.com> X-Patchwork-Hint: ignore Message-Id: <20190208131109.9EBC41127F30@debutante.sirena.org.uk> Date: Fri, 8 Feb 2019 13:11:09 +0000 (GMT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch ASoC: stm32: i2s: add power management has been applied to the asoc tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark From 307cce4a0017f94c6266050487c117660d66104e Mon Sep 17 00:00:00 2001 From: Olivier Moysan Date: Fri, 8 Feb 2019 11:49:53 +0100 Subject: [PATCH] ASoC: stm32: i2s: add power management Add suspend and resume sleep callbacks, to support system low power modes. Signed-off-by: Olivier Moysan Signed-off-by: Mark Brown --- sound/soc/stm/stm32_i2s.c | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/sound/soc/stm/stm32_i2s.c b/sound/soc/stm/stm32_i2s.c index 6d0bf78d114d..dbe23a709d24 100644 --- a/sound/soc/stm/stm32_i2s.c +++ b/sound/soc/stm/stm32_i2s.c @@ -186,8 +186,9 @@ enum i2s_datlen { #define STM32_I2S_IS_SLAVE(x) ((x)->ms_flg == I2S_MS_SLAVE) /** + * struct stm32_i2s_data - private data of I2S * @regmap_conf: I2S register map configuration pointer - * @egmap: I2S register map pointer + * @regmap: I2S register map pointer * @pdev: device data pointer * @dai_drv: DAI driver pointer * @dma_data_tx: dma configuration data for tx channel @@ -596,8 +597,8 @@ static int stm32_i2s_trigger(struct snd_pcm_substream *substream, int cmd, return ret; } - ret = regmap_update_bits(i2s->regmap, STM32_I2S_CR1_REG, - I2S_CR1_CSTART, I2S_CR1_CSTART); + ret = regmap_write_bits(i2s->regmap, STM32_I2S_CR1_REG, + I2S_CR1_CSTART, I2S_CR1_CSTART); if (ret < 0) { dev_err(cpu_dai->dev, "Error %d starting I2S\n", ret); return ret; @@ -703,6 +704,7 @@ static const struct regmap_config stm32_h7_i2s_regmap_conf = { .volatile_reg = stm32_i2s_volatile_reg, .writeable_reg = stm32_i2s_writeable_reg, .fast_io = true, + .cache_type = REGCACHE_FLAT, }; static const struct snd_soc_dai_ops stm32_i2s_pcm_dai_ops = { @@ -929,10 +931,35 @@ static int stm32_i2s_remove(struct platform_device *pdev) MODULE_DEVICE_TABLE(of, stm32_i2s_ids); +#ifdef CONFIG_PM_SLEEP +static int stm32_i2s_suspend(struct device *dev) +{ + struct stm32_i2s_data *i2s = dev_get_drvdata(dev); + + regcache_cache_only(i2s->regmap, true); + regcache_mark_dirty(i2s->regmap); + + return 0; +} + +static int stm32_i2s_resume(struct device *dev) +{ + struct stm32_i2s_data *i2s = dev_get_drvdata(dev); + + regcache_cache_only(i2s->regmap, false); + return regcache_sync(i2s->regmap); +} +#endif /* CONFIG_PM_SLEEP */ + +static const struct dev_pm_ops stm32_i2s_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(stm32_i2s_suspend, stm32_i2s_resume) +}; + static struct platform_driver stm32_i2s_driver = { .driver = { .name = "st,stm32-i2s", .of_match_table = stm32_i2s_ids, + .pm = &stm32_i2s_pm_ops, }, .probe = stm32_i2s_probe, .remove = stm32_i2s_remove, -- 2.20.1