Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp464281pxb; Thu, 9 Sep 2021 05:11:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSJngegDwQu91CJLxTaR3Dg1xDZTuupFZq5W1/0fsD3YjvvE6vXEQ4iOmsFaQra/01ZbcH X-Received: by 2002:aa7:c4d0:: with SMTP id p16mr2775376edr.263.1631189468412; Thu, 09 Sep 2021 05:11:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631189468; cv=none; d=google.com; s=arc-20160816; b=HL7bL67mtejmHytM0P/NabroNxwBTp8uhBXzi0Ut2kxRh8Rbw54gI0krkOUe3c3d4Q +AjPi/hIKiNDBKiktdrfzfCHTjQLysIjleuD5AuxHTVWyfhUN5H4/k5SAGI5dxE51Ppo 7dEKcvnN1x8QHMhj/UCa2O4exP4WRRa5UYqCBcC7vbtq03nokIus36LExuYTQ89Hxo31 J5ycMAzS/wxPMeoBZoB2a1GWWmisIpD0AYLv2p7FQoCx+UfYTZ//IwtBaZueeOFUYY0y 2UWM9DKDzX6rnWr0TFt7RuV2LA+H+oTCTBlyNXwIGVE3zKfItJDLx9jZVkx/B0gDM4S8 0qPw== 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=jsYH6uy9XncH1tKcuxjbAaEzLM8CVIH9eARJ+HRu9VU=; b=bIODiN9915mAEuHmme9QbBve+q5hJ/i4U3SCdLTOaAo7WIf8SWH0ukTKKI8aSRJOif x2JgtgUww2JR/QO42htwniVUWAgmd0gM4Oiu8bfQkIrBnSn7SOZxcmkGQx+28AXiIrxt 6eOQMnH8fa38LGnLR3RBOyS4lPiL+z2cQRH4E9DsAt+0DRqkeCuUqDbTl2syeX4ilKxe XUDF3BgAJPdhtYwWUg5dFi+m2hkNrE6oYlrERBvHG794Q2924D5qmEc1WJkOynVSP9L9 5PqQLj9yzgC0XiFlDSVxpLAjeNPzgX5VWZYCeN7tj5YfHRe5w7DBIyeLWSpECOp8iLFz isog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=D6JeJooM; 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 o11si1652028ejy.49.2021.09.09.05.10.39; Thu, 09 Sep 2021 05:11:08 -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=D6JeJooM; 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 S240488AbhIIMKR (ORCPT + 99 others); Thu, 9 Sep 2021 08:10:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:34928 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343604AbhIIL7E (ORCPT ); Thu, 9 Sep 2021 07:59:04 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AEE87613A9; Thu, 9 Sep 2021 11:45:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631187955; bh=VXGuYL61ANt4FhnQuzUI9Qfv/IaOG8jtek1j0NNjLsY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D6JeJooMnmOChYDQi689bkMC6YAs5AlqnZRy3M2vTZFDboBveZho/R9CRMaMqhGz/ F+rZsOu4tLco3WUrdQuQ+nrPd9p1LN5ohHedlmH++sNf4fDH+4kZyOWnSeRmOKeBgV zKnyTgVjWXvtcd+mPxShIxH1oPfMyw/R5JM6CXkmPkVdn7OSx9+S2UqiREiBKLJ5yX FnniTLWs/qi6gwDDjom4DgA8GVqsQ7ve6NH5x3byDbKUG0DUqzNJ2oL8DgIiEX3uK7 5cI0MRurZOeVg0aj7zwtTUGGqtB+e48gRR6yOk3HXzEvayReKe4RERV3oG/6ZbOo8a IUG5XYP8yxdCQ== 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.14 222/252] ASoC: rockchip: i2s: Fix regmap_ops hang Date: Thu, 9 Sep 2021 07:40:36 -0400 Message-Id: <20210909114106.141462-222-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210909114106.141462-1-sashal@kernel.org> References: <20210909114106.141462-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 c7dc3509bceb..1fd47e56c77f 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