Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1750737pxb; Mon, 23 Aug 2021 03:51:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwBuyle3HuYFIrkN/qnSAHPxkSkZSsi9oXNBfATiy3D9Hdi5/01fnPlNSgQyk2TZIbj3vvm X-Received: by 2002:a17:907:7848:: with SMTP id lb8mr35185097ejc.494.1629715892411; Mon, 23 Aug 2021 03:51:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629715892; cv=none; d=google.com; s=arc-20160816; b=qz34C1wjeIQAm/IXPQjCzv4g2hIvFKtRgh3dPZT5h9ujJ+WtZTN7bDn7Jx54eoS+xk 3YKKf8wk04qtjy91sNKc93DWu1QliQYcIjtalgJ60E0F17/L7fcoBPdy6qHx6gv37/Nb csz8hbsdg+bHzzkSGiuDS/K6zbOmFLUAtBtq8UNpUNceklk6rt9ZIuwr2GGaFs9K9sYA 1reBoEeSef0fysBzV6qrVojKMbgzY6ZB4zVY3IpUI1Tn921Fxt5GsN7rWwJu9VzW+6wk 1z2bfAjHlkaluIeowE692P4USLDbngVOKf+AfSD7yLDTXu4bXv8InaI66DtFTq7dgW2T pzkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=oMxUHtKEdPPPExnQ4wi0r5aDlrKTn4T7SqOPbMlB83g=; b=hlvueVSCUh/uQ2SHH1DmaU/9ZDvRAN8rhGIA4fZSDqNX9DnWYtQNPE1SvOZo1IzNbW RR8O6O18d4eSXm3ILGBB9ggzekePs+D5w396ZwTx9mikdwce6auSOM85FCTBH4Pr4rrO 91j+DJcsBA+elbjezGlWqTLsEdtb4VwqHZ6+LwN5D/sRdf1pQqXnoUf5FegpwJtW9vne 6XntOVU+6Rq/pb6s7bql/IedyrX484o9kvTNKj6T23JFKAo0XjfYdjms8bYn8xSC11G7 pt34SF3G2ceU9tifQga7etY/6f70wFDctky94Aqf7/PuSyB9IBtPOGA8vAtjzejik6rN vicQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x3si6145672edd.208.2021.08.23.03.51.08; Mon, 23 Aug 2021 03:51:32 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236301AbhHWKuR (ORCPT + 99 others); Mon, 23 Aug 2021 06:50:17 -0400 Received: from lucky1.263xmail.com ([211.157.147.135]:43246 "EHLO lucky1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234865AbhHWKuK (ORCPT ); Mon, 23 Aug 2021 06:50:10 -0400 Received: from localhost (unknown [192.168.167.235]) by lucky1.263xmail.com (Postfix) with ESMTP id ECAB3B2FDF; Mon, 23 Aug 2021 18:49:25 +0800 (CST) X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ADDR-CHECKED4: 1 X-SKE-CHECKED: 1 X-ANTISPAM-LEVEL: 2 Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.263.net (postfix) whith ESMTP id P32763T139760957703936S1629715760494266_; Mon, 23 Aug 2021 18:49:26 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: X-RL-SENDER: sugar.zhang@rock-chips.com X-SENDER: zxg@rock-chips.com X-LOGIN-NAME: sugar.zhang@rock-chips.com X-FST-TO: broonie@kernel.org X-RCPT-COUNT: 10 X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-System-Flag: 0 From: Sugar Zhang To: broonie@kernel.org, heiko@sntech.de Cc: linux-rockchip@lists.infradead.org, Sugar Zhang , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 04/15] ASoC: rockchip: i2s: Fix regmap_ops hang Date: Mon, 23 Aug 2021 18:48:18 +0800 Message-Id: <1629715710-21137-5-git-send-email-sugar.zhang@rock-chips.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1629715710-21137-1-git-send-email-sugar.zhang@rock-chips.com> References: <1629715710-21137-1-git-send-email-sugar.zhang@rock-chips.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 2e0047d..90877e8 100644 --- a/sound/soc/rockchip/rockchip_i2s.c +++ b/sound/soc/rockchip/rockchip_i2s.c @@ -187,7 +187,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: @@ -200,7 +202,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); @@ -214,7 +217,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); @@ -237,7 +241,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); @@ -260,12 +265,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.7.4