Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp518350pxb; Thu, 9 Sep 2021 06:18:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz36OGx8QcpwjWesEZd61TxqzaRfF1QPJ5jhIFC81aEyxRMWUdlJlRFVmucyDOE5BU/ivXO X-Received: by 2002:a92:194c:: with SMTP id e12mr2360264ilm.3.1631193483926; Thu, 09 Sep 2021 06:18:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631193483; cv=none; d=google.com; s=arc-20160816; b=V3duXioUu9fCHKFWKM7veY+ltnxw28Acq+DVqQF8P3/d/JSuAX3oXHThpgtZEwc63T KQBT+c8D3oHEzRm7LS81hpMgkZZULaSN04Bo0EvLgwlpacW6BxRQ/pAJY3mI0GSJxZWt gciWqyNGu+eQoSz1B8b67my04GIQGxV4qD5HThvOc/kQPeb6zB7xAn0zdcXVL7SKZlUK kxMvJKXQByyayX5z/mjwUn40Oq/Dcg2w1J3cqmwa5j1rM1bwy+0kyq9RHpCO7oKZvYLU lP3h0sc1cVUlNHfGPJGUrlvFfAzdyFpeLQCGOy4rqoUYJSxP53t5e7r2S0nWlIiSMefP Gl7Q== 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=gQP7ptO2Ohx801iffamu85wvFI+7Fr8q3S1GRfuACBQ=; b=uhSXWpZWuY88doUWKYwsgOqpWbwE/My+K4gFG8KbXxg0sVxOgYom+2+A6b9UcdC0gM isfasYKM8Ph+N4sszvCcObHPGDLhRht8jdOCl6RftrlvZnElZirmXOqCoXV5n0I2YJAP sBsyYxqEkk8ryHyLFvgva+q5JuluZ93ZyRy3ayIgvEonJ//yQ2Gr7f2gFnnmZU8+lSW2 U8/bDl51LDY2P0EmCcdk4TDrQOKm+mF0Gu0kOXk5deYR4hac1lAQvGwmsjcOS6zXOM7e nHB9Fc1P35go91Ft9gjSOwK4DgidXq/tDCd/G0Eb7qb++bTz01/HRsFRifFNBXR0ISrz Ootw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BTivrnSB; 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 d39si1599734jaa.115.2021.09.09.06.17.50; Thu, 09 Sep 2021 06:18:03 -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=BTivrnSB; 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 S1352830AbhIINRl (ORCPT + 99 others); Thu, 9 Sep 2021 09:17:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:53476 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357887AbhIINFS (ORCPT ); Thu, 9 Sep 2021 09:05:18 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7C9AD6329F; Thu, 9 Sep 2021 12:00:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631188807; bh=GwWGm9WFdrC2XQPy9txcEwUY19vlnXcJNvKB8+v6fa0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BTivrnSBFF7BIaA2++vGxHWiMkHl21UndMKpHnpkKsRNDBdxneWz63ICZoyyDpmnC rup/4+5/neMn5KYeh2RLWKonI0NNfbE+pvxzGzbFHPw8iiF7whH7BEiJkqF/77SUCP lPO3pUJmpva1dWWFpeTaMl/ETfxK8DPquIpq9IRc0twkpR36d63LwVE2JAq63tqfys oZb2diDJkYSuB/H9cHsbEtqdEkFjc7PNWAY6SIWeMoegLZhfi7nFfU5Pf/iXjeyJ4t Vsx3XxJ58+PGu7pbboQmryhbiqjSrH2gMZxrWXvrhHOvRLH/UVmippxHQFzC856+tw 1fug+JJWrUdIQ== 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 4.14 53/59] ASoC: rockchip: i2s: Fix regmap_ops hang Date: Thu, 9 Sep 2021 07:58:54 -0400 Message-Id: <20210909115900.149795-53-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210909115900.149795-1-sashal@kernel.org> References: <20210909115900.149795-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 0e07e3dea7de..93a4829f80cc 100644 --- a/sound/soc/rockchip/rockchip_i2s.c +++ b/sound/soc/rockchip/rockchip_i2s.c @@ -188,7 +188,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: @@ -201,7 +203,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); @@ -215,7 +218,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); @@ -238,7 +242,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); @@ -261,12 +266,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