Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1539982pxb; Thu, 16 Sep 2021 09:31:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxlqu9M1wu1dDxXFab2EMU2u1sHJ9OvXb5ukfg53F/P7Td/+J4lZb3GNwUx5+fP9Y4JMB5D X-Received: by 2002:a05:6e02:1caa:: with SMTP id x10mr4539665ill.280.1631809877622; Thu, 16 Sep 2021 09:31:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631809877; cv=none; d=google.com; s=arc-20160816; b=ykg5ih7AUr4xIOfwno2S4a8vLe4d1uNUQmNcXQFYKw5rCO8AEU7MIaSVmW9bu98QV1 xigmb6hotzWGbrt3ABmWL5S3brB+SI7sd/mRFwra2Y3NsCC7dH9T4kqeEvuFtPCUByci 1yJ/sZVlImvLA85krU3hMV+u0z0LUpit77wW2hipLD4vtobfV95NE4n//yrFcsZw+tQa k2BgtDsj9EbOVGF+zuniKY8eQ0gxc3rpvWLvatdXdclSO5hkKISpNdzXi+Z/vtn3ijSe R/BJPVDE/E6fJ0dJ7QpEPF+DOd+5QNfJVQgb7xhXzbG/vdgs2N3h+br+KvuwMpTPddyH azaA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fGntFClYmKSKRGphr0TtAO3tHvdvcXaEC3OZ4LS1tSM=; b=cETXkE2HRNuJOKoCruygf2YbHC4btMnCQPqhuPvNFUCFR6grcfcfKu66T9h2FT4cJ0 2YFyyxA+zcAx2xbB+7iesBsGS4y3X7JQghdRS7/APJ6mG6HjkNgwE97Y9djrBiZzTXFq p5roI7KsbxJ/K9aAQPyXs8XfXQjB0Wn8k3eZ+46ZKPlbhgV2ONockSjHrZWik3YE5MmR hAZjyMsODwtWAozFTi90UQqIomExkgOfDsdPQ2Q1s/nlo8aF42iPajRWc2L9x40ALoY2 HWwKrXsYYfVoDarIqCOPUbVzoH2FyNVreR66dvTz69ioJTmKO/Zsk04E8kYyCgIk/FRN DHWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CsikIALQ; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g63si2916494jab.37.2021.09.16.09.31.04; Thu, 16 Sep 2021 09:31:17 -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=@linuxfoundation.org header.s=korg header.b=CsikIALQ; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243159AbhIPQaH (ORCPT + 99 others); Thu, 16 Sep 2021 12:30:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:58822 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241085AbhIPQVO (ORCPT ); Thu, 16 Sep 2021 12:21:14 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8471B613E8; Thu, 16 Sep 2021 16:14:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631808880; bh=wfDXRPi04DShxBHRYCT/N3OS0kv9dVg6Y8w6nbhaKdU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CsikIALQLudMZhmEaxPnkghYbR5jghwCqoPPu0+yjhdMLUyd2kpjZWUmfUXSce72F bQJBqpISoQf/BK6t0lbEJqbC0GgRYuvJTcntvCyXY8vjojsfrpjTtoM9V6vRj3Gwr+ jGWDc0pPbosxxua54N6k88F3AuSvyVDC8Xw3nBTo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sugar Zhang , Mark Brown , Sasha Levin Subject: [PATCH 5.10 257/306] ASoC: rockchip: i2s: Fix regmap_ops hang Date: Thu, 16 Sep 2021 18:00:02 +0200 Message-Id: <20210916155802.829098291@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155753.903069397@linuxfoundation.org> References: <20210916155753.903069397@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 593299675b8c..43522d7701e9 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