From patchwork Mon May 15 07:10:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bard Liao X-Patchwork-Id: 93923 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp6727560vqo; Mon, 15 May 2023 00:17:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5l0gIRG1KdRyM5UE+puM1PtAwLUN691tBDxoElGz399ErtdbCWBz7mU/ug7qTJJR5x2TFb X-Received: by 2002:a17:90a:df0f:b0:250:c353:8bc3 with SMTP id gp15-20020a17090adf0f00b00250c3538bc3mr17659438pjb.49.1684135036314; Mon, 15 May 2023 00:17:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684135036; cv=none; d=google.com; s=arc-20160816; b=XOeAX2IVcmk51XzHGztH+rftSMy3Vh741JaXXVwIyKtf214JXX7XGMmdkaxioSrHh1 8O/M6M0QnSELGySORgHqbZH67pXEJ91x9KPjc23+dzxtiu96Xq5AfEQrUktXl+spHoG3 venUwZRqsu1D2c4sc/ITAtHqRDN2HmOoz6TseNxnCKDLAdQV8VqCw9N68Soj2pNBvwyj UhxTY8ttbopTyVQv798GrY53nKAahjrRmHXUzAUtjNh7vnrxJBdrWZ6O7fZqth/hxOd2 aJUhJfOCRi8B6vQZZQ/HuwO76wwULopJOqHRFmxJqjp8QXSUBANMbBjoS0oxi0qkcP78 2khw== 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=egEOeknk3ct5mrQBAPnSZnHykbXok01mTcCxV3XOUdI=; b=obW4AaiSY3aMM8L3KmdxQUhRw5pW++AXdl40D68lb+FRMEdQFGJlCf633WOa3Qj3d6 jDuh1On+29pbn+9CFBczGA+cUR2X/q3rvO545mhIjkN9B1L6LWhCZ7e/Qy9ihlmc2++i cY3fRB36dstxfUu5UU3QGpq/YiH9mIGBovmq9rMiA9/7XvrakuluVZpI3WrhopS5CETe ZV4aXswAFTQNy7+7o7Zwhe3LVDjH7H709AfYXKR55uHtAQCNK0B68u3snfds0YIQdp75 gN14BG8Ud1CQ3fBsZQBINurm6UAbMpt8APfWAsXYetHJFOHJzFls6GWJAMOw/Z8YIbCn gD1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=G9lxGxSw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x36-20020a17090a6c2700b00233e301c780si29236677pjj.31.2023.05.15.00.17.04; Mon, 15 May 2023 00:17:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=G9lxGxSw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240309AbjEOGu6 (ORCPT + 99 others); Mon, 15 May 2023 02:50:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240170AbjEOGus (ORCPT ); Mon, 15 May 2023 02:50:48 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CDE72699 for ; Sun, 14 May 2023 23:50:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684133438; x=1715669438; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xKsOmGgpfRTaoYi/C0Rex9lD4JYFMvLzVqkjtEvqo9k=; b=G9lxGxSw372a26MCw7DfcNPWonstBGIqWG1Rvv0liJ+h1tginpiDrVKY YVbasQqng62u0zT33XIEtAB/KoJdN1goq3YFListrqGYT/EXNoVOUXSd7 h5dtdFVl2wETI1ymY1yQZdmFlf9OZ7XejBMVJzQIUXzWWuHN7HxIeNbsE ZkU0Fh/z3/OAjzSZZGfaxxLkC0X4uaXMGwjdaDZYbQb/wn0qbIANCRzif 3Br/5IVqnsF+fZkoHINikTUfsLZg1n/yACQmO5PPvT/lToI1/NIZHfnA2 LuLlKa0jj/LGI8Q3s7DeOg98iBh0o1s3cLbmR32f37Xq14AV3qMytz13a A==; X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="349966331" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="349966331" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2023 23:50:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="694908641" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="694908641" Received: from bard-ubuntu.sh.intel.com ([10.239.185.57]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2023 23:50:35 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org, tiwai@suse.de Cc: linux-kernel@vger.kernel.org, vinod.koul@linaro.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 07/26] soundwire: intel: add eml_lock in the interface for new platforms Date: Mon, 15 May 2023 15:10:23 +0800 Message-Id: <20230515071042.2038-8-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230515071042.2038-1-yung-chuan.liao@linux.intel.com> References: <20230515071042.2038-1-yung-chuan.liao@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765943579736229875?= X-GMAIL-MSGID: =?utf-8?q?1765943579736229875?= From: Pierre-Louis Bossart In existing Intel/SoundWire systems, all the SoundWire configuration is 'self-contained', with the 'shim_lock' mutex used to protect access to shared registers in multi-link configurations. With the move of part of the SoundWire registers to the HDaudio multi-link structure, we need a unified lock. The hda-mlink implementation provides an 'eml_lock' that is used to protect shared registers such as LCTL and LSYNC, we can pass it to the SoundWire side. There is no issue with possible dangling pointers since the SoundWire auxiliary devices are children of the PCI device, so the 'eml_lock' cannot be removed while the SoundWire side is in use. This patch only adds the interface for now. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: Péter Ujfalusi Reviewed-by: Ranjani Sridharan Signed-off-by: Bard Liao --- include/linux/soundwire/sdw_intel.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/soundwire/sdw_intel.h b/include/linux/soundwire/sdw_intel.h index c4281aa06e2e..bafc6f2554b0 100644 --- a/include/linux/soundwire/sdw_intel.h +++ b/include/linux/soundwire/sdw_intel.h @@ -327,6 +327,8 @@ struct sdw_intel_ctx { * @alh_base: sdw alh base. * @ext: extended HDaudio link support * @hbus: hdac_bus pointer, needed for power management + * @eml_lock: mutex protecting shared registers in the HDaudio multi-link + * space */ struct sdw_intel_res { const struct sdw_intel_hw_ops *hw_ops; @@ -343,6 +345,7 @@ struct sdw_intel_res { u32 alh_base; bool ext; struct hdac_bus *hbus; + struct mutex *eml_lock; }; /*