From: <Claudiu.Beznea@microchip.com>
To: <alsa-devel@alsa-project.org>
Subject: Re: [PATCH V3 2/8] soundwire: amd: Add support for AMD Manager driver
Date: Wed, 22 Feb 2023 09:31:06 +0000 [thread overview]
Message-ID: <dfe01dbd-cdc5-a51e-a0cc-7fc352822a9d@microchip.com> (raw)
In-Reply-To: <20230220100418.76754-3-Vijendar.Mukunda@amd.com>
On 20.02.2023 12:04, Vijendar Mukunda wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> AMD ACP(v6.x) IP block has two SoundWire manager devices.
> Add support for
> - Manager driver probe & remove sequence
> - Helper functions to enable/disable interrupts, Initialize sdw manager,
> enable sdw pads
> - Manager driver sdw_master_ops & port_ops callbacks
>
> Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
> ---
> drivers/soundwire/amd_manager.c | 761 ++++++++++++++++++++++++++++++
> drivers/soundwire/amd_manager.h | 252 ++++++++++
> include/linux/soundwire/sdw_amd.h | 67 +++
> 3 files changed, 1080 insertions(+)
> 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
>
> diff --git a/drivers/soundwire/amd_manager.c b/drivers/soundwire/amd_manager.c
> new file mode 100644
> index 000000000000..b820e04ca09f
> --- /dev/null
> +++ b/drivers/soundwire/amd_manager.c
> @@ -0,0 +1,761 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * SoundWire AMD Manager driver
> + *
> + * Copyright 2023 Advanced Micro Devices, Inc.
> + */
> +
> +#include <linux/completion.h>
> +#include <linux/device.h>
> +#include <linux/io.h>
> +#include <linux/jiffies.h>
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/slab.h>
> +#include <linux/soundwire/sdw.h>
> +#include <linux/soundwire/sdw_registers.h>
> +#include <linux/wait.h>
> +#include <sound/pcm_params.h>
> +#include <sound/soc.h>
> +#include "bus.h"
> +#include "amd_manager.h"
> +
> +#define DRV_NAME "amd_sdw_manager"
> +
> +#define to_amd_sdw(b) container_of(b, struct amd_sdw_manager, bus)
> +
> +static void amd_enable_sdw_pads(struct amd_sdw_manager *amd_manager)
> +{
> + u32 sw_pad_pulldown_val;
> + u32 val;
> +
> + mutex_lock(amd_manager->acp_sdw_lock);
> + val = acp_reg_readl(amd_manager->acp_mmio + ACP_SW_PAD_KEEPER_EN);
> + val |= amd_manager->reg_mask->sw_pad_enable_mask;
> + acp_reg_writel(val, amd_manager->acp_mmio + ACP_SW_PAD_KEEPER_EN);
> + usleep_range(1000, 1500);
> +
> + sw_pad_pulldown_val = acp_reg_readl(amd_manager->acp_mmio + ACP_PAD_PULLDOWN_CTRL);
> + sw_pad_pulldown_val &= amd_manager->reg_mask->sw_pad_pulldown_mask;
> + acp_reg_writel(sw_pad_pulldown_val, amd_manager->acp_mmio + ACP_PAD_PULLDOWN_CTRL);
> + mutex_unlock(amd_manager->acp_sdw_lock);
> +}
> +
> +static int amd_init_sdw_manager(struct amd_sdw_manager *amd_manager)
> +{
> + u32 val;
> + u32 timeout = 0;
> + u32 retry_count = 0;
> +
> + acp_reg_writel(AMD_SDW_ENABLE, amd_manager->mmio + ACP_SW_EN);
> + do {
> + val = acp_reg_readl(amd_manager->mmio + ACP_SW_EN_STATUS);
> + if (val)
> + break;
> + usleep_range(10, 50);
> + } while (retry_count++ < AMD_SDW_STAT_MAX_RETRY_COUNT);
Can't these timeout loops be addressed w/ read_poll_timeout()?
[ ... ]
next prev parent reply other threads:[~2023-02-22 9:32 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-20 10:04 [PATCH V3 0/8] Add SoundWire support for AMD platforms Vijendar Mukunda
2023-02-20 10:04 ` [PATCH V3 1/8] soundwire: export sdw_compute_slave_ports() function Vijendar Mukunda
2023-02-20 10:04 ` [PATCH V3 2/8] soundwire: amd: Add support for AMD Manager driver Vijendar Mukunda
2023-02-21 15:57 ` Pierre-Louis Bossart
2023-02-22 7:18 ` Mukunda,Vijendar
2023-02-22 9:31 ` Claudiu.Beznea [this message]
2023-02-20 10:04 ` [PATCH V3 3/8] soundwire: amd: register SoundWire manager dai ops Vijendar Mukunda
2023-02-21 15:59 ` Pierre-Louis Bossart
2023-02-21 21:05 ` Mukunda,Vijendar
2023-02-21 23:48 ` Pierre-Louis Bossart
2023-02-22 5:39 ` Mukunda,Vijendar
2023-02-20 10:04 ` [PATCH V3 4/8] soundwire: amd: enable build for AMD SoundWire manager driver Vijendar Mukunda
2023-02-21 16:01 ` Pierre-Louis Bossart
2023-02-20 10:04 ` [PATCH V3 5/8] soundwire: amd: add SoundWire manager interrupt handling Vijendar Mukunda
2023-02-21 16:05 ` Pierre-Louis Bossart
2023-02-22 9:02 ` Mukunda,Vijendar
2023-02-20 10:04 ` [PATCH V3 6/8] soundwire: amd: add runtime pm ops for AMD SoundWire manager driver Vijendar Mukunda
2023-02-21 16:10 ` Pierre-Louis Bossart
2023-02-21 20:50 ` Mukunda,Vijendar
2023-02-20 10:04 ` [PATCH V3 7/8] soundwire: amd: handle SoundWire wake enable interrupt Vijendar Mukunda
2023-02-21 16:13 ` Pierre-Louis Bossart
2023-02-21 20:40 ` Mukunda,Vijendar
2023-02-20 10:04 ` [PATCH V3 8/8] soundwire: amd: add pm_prepare callback and pm ops support Vijendar Mukunda
2023-02-21 16:24 ` Pierre-Louis Bossart
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dfe01dbd-cdc5-a51e-a0cc-7fc352822a9d@microchip.com \
--to=claudiu.beznea@microchip.com \
--cc=alsa-devel@alsa-project.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox