Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp410814pxb; Wed, 3 Mar 2021 06:28:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJwA7etX4JsIsZM153TmwO83vykd+JAEFrGZxuQmmpbAtUggeYQJUtg0mDkMRD+9NtnO0D/X X-Received: by 2002:aa7:c7c8:: with SMTP id o8mr14934113eds.176.1614781707619; Wed, 03 Mar 2021 06:28:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614781707; cv=none; d=google.com; s=arc-20160816; b=xJSubVHW3zb9/urhf2GWEKjed/mUfut8xL8gDYOTm3D025GHt0wN9YIKW+BqWzKaib 0DgeTG0WS6P8cm6iSJHfFwuJ6hqdA7KIAOd0d/BS5guwxS5tWh2E6BpitYpcZDED4Jkl HNWiARgbdT76WpdmkVoS32aYiTBykUrvd5SKhPoDXaupMVsUgmN9kf4g4fVQoWDWfImG PHG1WvXBUKxa5u3RAtrbOYyy6NNm57wn1yhsFg2ybJZ0ckTH4GJ450H0IetDHsw5U9n8 JGTmr4Oq2WZkw9lFPHfozbLI6EpkquSs3QgfBReGgE4bQxb263WBAhGDccHxfHVA4tis xgRQ== 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=HdixDk1QP6R4OT3A+xgiWXtdFjQlG93bdKncwVDiNTw=; b=Lk0vXT3Q2MCYu/ElFjtVkutDnWygzWn1WGoouKB1JnDfJ2FwaDnpDKhGVwcvWOy+XD 9MVkhM3OT5nfZP/mE6rCe0EE8042Xkaa4bVJ2yQK2dWA8bRmo6m1O/cnqbQjXet4nxFN VIFwLHuDtuOzLu52nWh1DoeskPY7tqrbZ6VhItxU+7kCnMvZ0l07VW0G2ywsx+FvtHYF zflnKIYbtp5WoD6hzbb6HD0Q04+KdmRbfmsPjC9rTBJQZiIkXLNKZiACEiapKwwuSnzQ fhT6KR4cQCEY4uK9cSb0ItGVFP90bAse4v+uvUzXNbLRDMO33VSAazuOkUqIyr37R0BH WcEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gAr7+Fem; 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 p23si15409184edw.196.2021.03.03.06.27.43; Wed, 03 Mar 2021 06:28:27 -0800 (PST) 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=gAr7+Fem; 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 S244126AbhCAVIz (ORCPT + 99 others); Mon, 1 Mar 2021 16:08:55 -0500 Received: from mail.kernel.org ([198.145.29.99]:46226 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237847AbhCARNe (ORCPT ); Mon, 1 Mar 2021 12:13:34 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id B956664EF4; Mon, 1 Mar 2021 16:44:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614617066; bh=+amFEaX6YjAjhN2OgmQjdKQ+gqTpkn+fpxnSV39yhbo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gAr7+Femvk8NBScZzPAshGIb9mizM49w/poGxfctmTfQ/OSo4TZdMefLy1kpQtUnP eQGwzU5nnVtNC7o+gdWEyeRa7U0i6n6ANs0GkJDn9++jMNuP1D+abXcvkWNVnA4tGX p5u+GuvY0XHL1fvZ7Uvinj1W3zkexNT614edZDB0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bard Liao , Mark Brown , Vinod Koul , Sasha Levin Subject: [PATCH 4.19 161/247] regmap: sdw: use _no_pm functions in regmap_read/write Date: Mon, 1 Mar 2021 17:13:01 +0100 Message-Id: <20210301161039.554979488@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161031.684018251@linuxfoundation.org> References: <20210301161031.684018251@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: Bard Liao [ Upstream commit d288a5712ef961e16d588bbdb2d846e00b5ef154 ] sdw_update_slave_status will be invoked when a codec is attached, and the codec driver will initialize the codec with regmap functions while the codec device is pm_runtime suspended. regmap routines currently rely on regular SoundWire IO functions, which will call pm_runtime_get_sync()/put_autosuspend. This causes a deadlock where the resume routine waits for an initialization complete signal that while the initialization complete can only be reached when the resume completes. The only solution if we allow regmap functions to be used in resume operations as well as during codec initialization is to use _no_pm routines. The duty of making sure the bus is operational needs to be handled above the regmap level. Fixes: 7c22ce6e21840 ('regmap: Add SoundWire bus support') Signed-off-by: Bard Liao Acked-by: Mark Brown Link: https://lore.kernel.org/r/20210122070634.12825-6-yung-chuan.liao@linux.intel.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/base/regmap/regmap-sdw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/base/regmap/regmap-sdw.c b/drivers/base/regmap/regmap-sdw.c index 50a66382d87d0..e75168b941d0c 100644 --- a/drivers/base/regmap/regmap-sdw.c +++ b/drivers/base/regmap/regmap-sdw.c @@ -12,7 +12,7 @@ static int regmap_sdw_write(void *context, unsigned int reg, unsigned int val) struct device *dev = context; struct sdw_slave *slave = dev_to_sdw_dev(dev); - return sdw_write(slave, reg, val); + return sdw_write_no_pm(slave, reg, val); } static int regmap_sdw_read(void *context, unsigned int reg, unsigned int *val) @@ -21,7 +21,7 @@ static int regmap_sdw_read(void *context, unsigned int reg, unsigned int *val) struct sdw_slave *slave = dev_to_sdw_dev(dev); int read; - read = sdw_read(slave, reg); + read = sdw_read_no_pm(slave, reg); if (read < 0) return read; -- 2.27.0