All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
To: Alex Deucher
	<alexdeucher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org,
	airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	Vijendar.Mukunda-5C7GfCeVMHo@public.gmane.org,
	rajeevkumar.linux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Cc: tiwai-l3A5Bk7waGM@public.gmane.org,
	Alex Deucher <alexander.deucher-5C7GfCeVMHo@public.gmane.org>,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	perex-/Fr2/VpizcU@public.gmane.org
Subject: Re: [PATCH 1/8] drm/amd/amdgpu: Added asic_type as ACP DMA driver platform data
Date: Fri, 23 Jun 2017 18:43:19 +0200	[thread overview]
Message-ID: <fb879fdd-b241-7368-9c33-7a78dafa491d@vodafone.de> (raw)
In-Reply-To: <1498235706-31111-2-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org>

Am 23.06.2017 um 18:34 schrieb Alex Deucher:
> From: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
>
> asic_type information is passed to ACP DMA Driver as platform data.
> We need this to determine whether the asic is Carrizo (CZ) or
> Stoney (ST) in the acp sound driver.
>
> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
> Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c | 4 ++++
>   sound/soc/amd/acp-pcm-dma.c             | 8 ++------
>   sound/soc/amd/acp.h                     | 7 +++++++
>   3 files changed, 13 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
> index 06879d1..7a2a765 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
> @@ -262,6 +262,7 @@ static int acp_hw_init(void *handle)
>   	uint64_t acp_base;
>   	struct device *dev;
>   	struct i2s_platform_data *i2s_pdata;
> +	u32 asic_type;
>   
>   	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
>   
> @@ -271,6 +272,7 @@ static int acp_hw_init(void *handle)
>   	if (!ip_block)
>   		return -EINVAL;
>   
> +	asic_type = adev->asic_type;
>   	r = amd_acp_hw_init(adev->acp.cgs_device,
>   			    ip_block->version->major, ip_block->version->minor);
>   	/* -ENODEV means board uses AZ rather than ACP */
> @@ -355,6 +357,8 @@ static int acp_hw_init(void *handle)
>   	adev->acp.acp_cell[0].name = "acp_audio_dma";
>   	adev->acp.acp_cell[0].num_resources = 4;
>   	adev->acp.acp_cell[0].resources = &adev->acp.acp_res[0];
> +	adev->acp.acp_cell[0].platform_data = &asic_type;
> +	adev->acp.acp_cell[0].pdata_size = sizeof(asic_type);

Have the painkillers jellyfied my brain or are you setting a pointer in 
the amdgpu device structure to some variable on the stack?

If it's just for initialization then that's probably ok, but I would 
reset the pointer at the end of the function.

Otherwise somebody might have the idea to dereference it later on and 
that can only lead to trouble.

Christian.

>   
>   	adev->acp.acp_cell[1].name = "designware-i2s";
>   	adev->acp.acp_cell[1].num_resources = 1;
> diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c
> index 08b1399..dcbf997 100644
> --- a/sound/soc/amd/acp-pcm-dma.c
> +++ b/sound/soc/amd/acp-pcm-dma.c
> @@ -73,12 +73,6 @@ static const struct snd_pcm_hardware acp_pcm_hardware_capture = {
>   	.periods_max = CAPTURE_MAX_NUM_PERIODS,
>   };
>   
> -struct audio_drv_data {
> -	struct snd_pcm_substream *play_stream;
> -	struct snd_pcm_substream *capture_stream;
> -	void __iomem *acp_mmio;
> -};
> -
>   static u32 acp_reg_read(void __iomem *acp_mmio, u32 reg)
>   {
>   	return readl(acp_mmio + (reg * 4));
> @@ -916,6 +910,7 @@ static int acp_audio_probe(struct platform_device *pdev)
>   	int status;
>   	struct audio_drv_data *audio_drv_data;
>   	struct resource *res;
> +	const u32 *pdata = pdev->dev.platform_data;
>   
>   	audio_drv_data = devm_kzalloc(&pdev->dev, sizeof(struct audio_drv_data),
>   					GFP_KERNEL);
> @@ -932,6 +927,7 @@ static int acp_audio_probe(struct platform_device *pdev)
>   
>   	audio_drv_data->play_stream = NULL;
>   	audio_drv_data->capture_stream = NULL;
> +	audio_drv_data->asic_type =  *pdata;
>   
>   	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
>   	if (!res) {
> diff --git a/sound/soc/amd/acp.h b/sound/soc/amd/acp.h
> index 330832e..28cf914 100644
> --- a/sound/soc/amd/acp.h
> +++ b/sound/soc/amd/acp.h
> @@ -84,6 +84,13 @@ struct audio_substream_data {
>   	void __iomem *acp_mmio;
>   };
>   
> +struct audio_drv_data {
> +	struct snd_pcm_substream *play_stream;
> +	struct snd_pcm_substream *capture_stream;
> +	void __iomem *acp_mmio;
> +	u32 asic_type;
> +};
> +
>   enum {
>   	ACP_TILE_P1 = 0,
>   	ACP_TILE_P2,


_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2017-06-23 16:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-23 16:34 [PATCH 0/8] Add ASoC support for AMD Stoney APUs Alex Deucher
2017-06-23 16:35 ` [PATCH 3/8] drm/amd/amdgpu: Added a dwc quirk for Stoney platform Alex Deucher
2017-06-28 18:02   ` Mark Brown
2017-06-23 16:35 ` [PATCH 5/8] ASoC: AMD: DMA driver changes for Stoney Platform Alex Deucher
     [not found] ` <1498235706-31111-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
2017-06-23 16:34   ` [PATCH 1/8] drm/amd/amdgpu: Added asic_type as ACP DMA driver platform data Alex Deucher
     [not found]     ` <1498235706-31111-2-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
2017-06-23 16:43       ` Christian König [this message]
2017-06-23 17:05         ` Alex Deucher
2017-06-26 13:29           ` Christian König
2017-06-28 17:54           ` Mark Brown
2017-06-23 16:35   ` [PATCH 2/8] ASoC: dwc: Added a quirk DW_I2S_QUIRK_16BIT_IDX_OVERRIDE to dwc driver Alex Deucher
2017-06-28 19:23     ` Applied "ASoC: dwc: Added a quirk DW_I2S_QUIRK_16BIT_IDX_OVERRIDE to dwc driver" to the asoc tree Mark Brown
2017-06-23 16:35   ` [PATCH 4/8] ASoC: AMD: added condition checks for CZ specific code Alex Deucher
2017-06-28 18:05     ` Mark Brown
2017-06-29 12:58       ` Mukunda, Vijendar
2017-06-30 10:16         ` Mark Brown
2017-06-23 16:35   ` [PATCH 6/8] ASoC: AMD: Buffer related changes for Stoney Alex Deucher
2017-06-23 16:35   ` [PATCH 7/8] drm/amd/amdgpu: Disable ACP Power Gating for Stoney platform Alex Deucher
2017-06-23 16:35   ` [PATCH 8/8] ASoC: AMD: Add machine driver for cz rt5650 Alex Deucher
2017-06-23 20:01     ` 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=fb879fdd-b241-7368-9c33-7a78dafa491d@vodafone.de \
    --to=deathsimple-antagkrnahcb1svskn2v4q@public.gmane.org \
    --cc=Vijendar.Mukunda-5C7GfCeVMHo@public.gmane.org \
    --cc=airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=alexander.deucher-5C7GfCeVMHo@public.gmane.org \
    --cc=alexdeucher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=perex-/Fr2/VpizcU@public.gmane.org \
    --cc=rajeevkumar.linux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=tiwai-l3A5Bk7waGM@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.