From patchwork Tue Mar 7 13:31:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 13163515 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 95EFBC678D4 for ; Tue, 7 Mar 2023 13:29:10 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id AAFF11468; Tue, 7 Mar 2023 14:28:17 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz AAFF11468 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1678195747; bh=JzQj8KlG9vnDcTc9SudYRD/XvYHf+ZJ57RoQO0rDylw=; h=To:Subject:Date:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From:Reply-To:Cc:From; b=PDvKI0+UL72KXTiH93HrsUC1NpUpl+O+axcDXUCbYdL7b9a3m0fcw+SxB6KTlYGEq 1/9NI/xGDg3qY+kaibfQdAdKqy+MgAkycErwuTVg7QadeoPqbm2RqKFmI/RU5VE2ex WnOvSxiD3ulOGMyUqbhpKxYU1pvFMJ7HpfWPvx9k= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 9D743F80093; Tue, 7 Mar 2023 14:27:54 +0100 (CET) To: Subject: [PATCH V6 0/8] Add SoundWire support for AMD platforms Date: Tue, 7 Mar 2023 19:01:27 +0530 X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: <> List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <167819567298.26.4782008491561930327@mailman-core.alsa-project.org> X-Patchwork-Original-From: Vijendar Mukunda via Alsa-devel From: Vijendar Mukunda Reply-To: Vijendar Mukunda Cc: alsa-devel@alsa-project.org, pierre-louis.bossart@linux.intel.com, Basavaraj.Hiregoudar@amd.com, Sunil-kumar.Dommati@amd.com, Mario.Limonciello@amd.com, amadeuszx.slawinski@linux.intel.com, Mastan.Katragadda@amd.com, Arungopal.kondaveeti@amd.com, claudiu.beznea@microchip.com, Vijendar Mukunda Content-Disposition: inline ACP IP(v6.x) block has two SoundWire manager instance support. This patchset adds support for AMD SoundWire manager driver. Signed-off-by: Vijendar Mukunda changes since v5: - replace loops logic with read_poll_timeout() throughout the code. changes since v4: - fix nit-picks in the code. - update naming convention for control word and response buffer vairables. - drop pm_suspend check in prepare callback. - use return statement instead of returning ret variable. changes since v3: - add usleep_range() in command/response implementation. - add usleep_range() in clock stop sequence. - modify usleep_range() values throughout the code. - remove unncessary debug statement from code. - update comment in probe() call. - fix timeout condition checks in the code. - drop "ret" variable in amd_disable_sdw_manager(). changes since v2: - Remove useless variable initializations. - Add helper function to interpret peripheral status. - Move runtime pm sequence to probe_work workqueue. - Use string "SoundWire" instead of "soundwire" in code. - Update comments in interrupt handler and probe sequence. - Rename "sdw_lock" as "acp_sdw_lock". - Remove __func__ from dev_dbg statements. changes since v1: - Drop asoc tree based patches. will send asoc patches as a separate series. - Fixed double space errors. - Use dev instead of pci->dev. - Use SoundWire manager terminology. - Remove amd_sdw_compute_slave_ports() function and use exported sdw_compute_slave_ports() function. - Remove unused variable "num_ports" from amd_manager structure. - Drop startup and shutdown dai callbacks. - Drop reset_page_addr callback. - Use relative address offset to program SoundWire manager registers throughout the code. - Separate wake enable interrupt handling from slave status handling logic. - Use acp_mmio to program ACP common registers. - Use dai_runtime_array implementation in dai_ops. - Refactor port_ops callbacks. - Add comments in port_ops callbacks. - Add retry count logic in irq thread to address faulty case. - Add helper function to interpret command response. - Add generic bandwidth allocation dependency in Kconfig options. - Add comments for AMD SoundWire power modes. - Add missing timeout check in amd_init_sdw_manager callback. - Declare frameshape parameters in probe call. - Handle error case in clock stop sequence. - Add comments in pm_prepare and pm_ops callbacks. Vijendar Mukunda (8): soundwire: export sdw_compute_slave_ports() function soundwire: amd: Add support for AMD Manager driver soundwire: amd: register SoundWire manager dai ops soundwire: amd: enable build for AMD SoundWire manager driver soundwire: amd: add SoundWire manager interrupt handling soundwire: amd: add runtime pm ops for AMD SoundWire manager driver soundwire: amd: handle SoundWire wake enable interrupt soundwire: amd: add pm_prepare callback and pm ops support drivers/soundwire/Kconfig | 10 + drivers/soundwire/Makefile | 4 + drivers/soundwire/amd_manager.c | 1245 +++++++++++++++++ drivers/soundwire/amd_manager.h | 274 ++++ drivers/soundwire/bus.h | 9 + .../soundwire/generic_bandwidth_allocation.c | 12 +- include/linux/soundwire/sdw_amd.h | 109 ++ 7 files changed, 1654 insertions(+), 9 deletions(-) create mode 100644 drivers/soundwire/amd_manager.c create mode 100644 drivers/soundwire/amd_manager.h create mode 100644 include/linux/soundwire/sdw_amd.h