Skip to content

Commit

Permalink
ASoC: amd: ps: add mutex lock for accessing common registers
Browse files Browse the repository at this point in the history
Add mutex lock for accessing ACP common registers across different
modules.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://lore.kernel.org/r/20230104055435.321327-1-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Vijendar Mukunda authored and Mark Brown committed Jan 5, 2023
1 parent 892dbe0 commit f763fb2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions sound/soc/amd/ps/acp63.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ struct acp63_dev_data {
struct resource *res;
bool acp63_audio_mode;
struct platform_device *pdev[ACP63_DEVS];
struct mutex acp_lock; /* protect shared registers */
u16 pdev_mask;
u16 pdev_count;
u16 pdm_dev_index;
Expand Down
4 changes: 3 additions & 1 deletion sound/soc/amd/ps/pci-ps.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@ static int create_acp63_platform_devs(struct pci_dev *pci, struct acp63_dev_data
case ACP63_PDM_DEV_MASK:
adata->pdm_dev_index = 0;
acp63_fill_platform_dev_info(&pdevinfo[0], parent, NULL, "acp_ps_pdm_dma",
0, adata->res, 1, NULL, 0);
0, adata->res, 1, &adata->acp_lock,
sizeof(adata->acp_lock));
acp63_fill_platform_dev_info(&pdevinfo[1], parent, NULL, "dmic-codec",
0, NULL, 0, NULL, 0);
acp63_fill_platform_dev_info(&pdevinfo[2], parent, NULL, "acp_ps_mach",
Expand Down Expand Up @@ -283,6 +284,7 @@ static int snd_acp63_probe(struct pci_dev *pci,
}
pci_set_master(pci);
pci_set_drvdata(pci, adata);
mutex_init(&adata->acp_lock);
ret = acp63_init(adata->acp63_base, &pci->dev);
if (ret)
goto release_regions;
Expand Down

0 comments on commit f763fb2

Please sign in to comment.