Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp509206pxb; Thu, 9 Sep 2021 06:08:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzi/XxyOJ6XzxcmQZozERUtPcXxEoCjqqbytDF5rBEX1NkCeqLPUD6c6WwVsbqQ7FLyQ6bd X-Received: by 2002:a05:6402:3116:: with SMTP id dc22mr3131690edb.398.1631192887018; Thu, 09 Sep 2021 06:08:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631192887; cv=none; d=google.com; s=arc-20160816; b=TU8/sZ3NQ1q4Mv2gHltKAt8coT28Usz95Kwtoiqaho2EBTXXU84DBM7e9z/nFfeEXV y38XfzzRNJUH4R3/vFWar4YxxpxmcsdC8vfyEcyPINBLgnQLwkPZUNwAfWwo8a9rEION BBm2PKxL5Sl5TtbJou7uQmq4Ig3D/HaV3x0yOecqhtD8gU7eWT0s+3XDjTJdUALRENCM GQLQLnrXJQozDQxT4OmxzSjCf6LGN0qWP1J4I6yJn/m2pXBXp4SIOYJ/bHmt3acaGYSD DpP96tyxhkZqYq8w1O6k3rcBQAmyWTJ18Sx6Ppl34kLYmMBPNqCtDSY5+kZVZ32kOmDo 1heQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BfPmRLhKwIxAdyQh56aCtbIUlXMv6T3qnS3hozXdbOo=; b=jar0BLwh5vZsa0U8JNXP33cFEu8alw7rEFnvaUG/dSxDHMB+e3/hY8e8Fd1RWCeWHV CEfeexVpfdZxRpkOHM1KcuLpwgCJlyiSsb+XJavbODm+VkmOuzrH6iWE+6VrZH3ibXmL rvZDqoUgVUPa4A7TyJ5xzKXBBjQnbDds2kvvMjlQ8/D7JoapZalmIi9Q9pEpWQB+Mej/ y+F9HIPYl3HhNgV7/GsNd7Y/Bl++qWO8LbC+LzbJjcnWA/Mk+8dMXXkAyvYPkctWJFj4 dkSQSeFc3lMqTJtdEP2z+tnnMW9T9/8yolqJqvS22X/LyOGDJe9br2OAX5TxYccHO15R wDhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Tr17GjJl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x2si2177174ejy.385.2021.09.09.06.07.17; Thu, 09 Sep 2021 06:08:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Tr17GjJl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354655AbhIINDc (ORCPT + 99 others); Thu, 9 Sep 2021 09:03:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:40982 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354499AbhIIMvK (ORCPT ); Thu, 9 Sep 2021 08:51:10 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8AEF761244; Thu, 9 Sep 2021 11:57:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631188630; bh=u2DIAJJgWUW9OXz/a22CKXR/jrEiN+pCzEW9gNXti34=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tr17GjJlLEDMWgx9y0IP8fLj/9rtGFHvS/pZUL0OOeOrxPxe7vwsPnqC8GQE0EDVO DtWorOGw42EBKUQ6t+q/+cE36ecqjhAqP0iiTpOktPhKbD06ZdDBXFvHJJ+rUM32Oj lULVz193pWNqEe7xNnAq//0gSPeQGPaNuOD1Rq714VZJ62Yrsqc3RYqtZawdeYHWm2 B/DO5M3uQ8sqI7N3BU1MApZVIedseFVfQoC42s+C2h6NKlzaAIwbCw0RAR6KOqR5HB BdPpDuoCj3opunBam+HGRk8VGU5YEk4ZCfSsLHBLJ3kcfR3jMiWphJJ3vpaKQ845Wn rR3iLXCzofhVA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Sugar Zhang , Mark Brown , Sasha Levin , alsa-devel@alsa-project.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org Subject: [PATCH AUTOSEL 5.4 097/109] ASoC: rockchip: i2s: Fix regmap_ops hang Date: Thu, 9 Sep 2021 07:54:54 -0400 Message-Id: <20210909115507.147917-97-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210909115507.147917-1-sashal@kernel.org> References: <20210909115507.147917-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sugar Zhang [ Upstream commit 53ca9b9777b95cdd689181d7c547e38dc79adad0 ] API 'set_fmt' maybe called when PD is off, in the situation, any register access will hang the system. so, enable PD before r/w register. Signed-off-by: Sugar Zhang Link: https://lore.kernel.org/r/1629950520-14190-4-git-send-email-sugar.zhang@rock-chips.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/rockchip/rockchip_i2s.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c index 61c984f10d8e..f48b146cd96a 100644 --- a/sound/soc/rockchip/rockchip_i2s.c +++ b/sound/soc/rockchip/rockchip_i2s.c @@ -186,7 +186,9 @@ static int rockchip_i2s_set_fmt(struct snd_soc_dai *cpu_dai, { struct rk_i2s_dev *i2s = to_info(cpu_dai); unsigned int mask = 0, val = 0; + int ret = 0; + pm_runtime_get_sync(cpu_dai->dev); mask = I2S_CKR_MSS_MASK; switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { case SND_SOC_DAIFMT_CBS_CFS: @@ -199,7 +201,8 @@ static int rockchip_i2s_set_fmt(struct snd_soc_dai *cpu_dai, i2s->is_master_mode = false; break; default: - return -EINVAL; + ret = -EINVAL; + goto err_pm_put; } regmap_update_bits(i2s->regmap, I2S_CKR, mask, val); @@ -213,7 +216,8 @@ static int rockchip_i2s_set_fmt(struct snd_soc_dai *cpu_dai, val = I2S_CKR_CKP_POS; break; default: - return -EINVAL; + ret = -EINVAL; + goto err_pm_put; } regmap_update_bits(i2s->regmap, I2S_CKR, mask, val); @@ -236,7 +240,8 @@ static int rockchip_i2s_set_fmt(struct snd_soc_dai *cpu_dai, val = I2S_TXCR_TFS_PCM | I2S_TXCR_PBM_MODE(1); break; default: - return -EINVAL; + ret = -EINVAL; + goto err_pm_put; } regmap_update_bits(i2s->regmap, I2S_TXCR, mask, val); @@ -259,12 +264,16 @@ static int rockchip_i2s_set_fmt(struct snd_soc_dai *cpu_dai, val = I2S_RXCR_TFS_PCM | I2S_RXCR_PBM_MODE(1); break; default: - return -EINVAL; + ret = -EINVAL; + goto err_pm_put; } regmap_update_bits(i2s->regmap, I2S_RXCR, mask, val); - return 0; +err_pm_put: + pm_runtime_put(cpu_dai->dev); + + return ret; } static int rockchip_i2s_hw_params(struct snd_pcm_substream *substream, -- 2.30.2