Add ASoC support for AMD APUs [v6]
Subsystems (6)
cover Add ASoC support for AMD APUs [v6]
This patch set implements support for i2s audio and new AMD GPUs. The i2s codec is fed by a DMA engine on the GPU. To handle this we create mfd cells which we hang the i2s codec and DMA engine on. Because of this, this patch set covers two subsystems: drm and alsa. The drm patches add support for the ACP hw block which provides the DMA engine for the i2s codec. The alsa patches add the ASoC driver for the i2s codec. Since the alsa changes depend on the drm changes, I'd like to take the alsa patches in via the drm tree.
This patch set depends on the following patch from the linux-pm tree:
PM / Domains: export symbols to add/remove devices from genpd
And the following patches from the audio tree:
ASoC: dwc: add runtime suspend/resume functionality
ASoC: dwc: add quirk for different register offset
ASoC: dwc: reconfigure dwc in 'resume' from 'suspend'
I talked to Dave Airlie on IRC and he has acked the drm side.
V2 changes:
- Use the MFD subsystem rather than adding our own bus
- Squash all sub-feature patches together
- fix comments mentioned in previous review
V3 changes:
- Update the designware driver to handle slave mode, amd specific features
- Use the designware driver directly for i2s
- Move the DMA handling from the GPU driver into the AMD ASoC driver
- Change the license on the ASoC driver to GPL
v4 changes:
- patch "ASoC : dwc : support dw i2s in slave mode" accepted
- Add a _dai_fmt() operation that checks to make sure that the mode we're setting corresponds to what we read back from the hardware.
- Split specific quirks into separate patches
- Set the specific quirks that apply to AMD chips in the acp driver
v5 changes:
- patch "ASoC : dwc : add check for master/slave format" accepted
- Fix MFD_CORE selection in ACP Kconfig
- Add irq domain support to amdgpu driver
- Use genirq in ACP DMA driver
- Export some genpd symbols to support ACP powergating (Acked by PM maintainer)
- Use genpd for ACP powergating
- add separate capture and playback instances of dws in ACP init
- add runtime suspend support for dws in master mode
v6 changes:
- Squash ACP DMA and abstraction layer patches into one
- Drop dependent patches from other trees
- Fix ACP DMA irq none case
- ACP DMA coding style cleanups
- Add timeouts to wait loops
- Clarify ACP powergating banks handling
Patch 5 adds the register headers for the ACP block which is a pretty big patch so I've excluded it from email. The entire patch set can be viewed here:
http://cgit.freedesktop.org/~agd5f/linux/log/?h=acp-upstream9
Thanks,
Alex
Alex Deucher (2):
drm/amdgpu/cgs: add an interface to access PCI resources drm/amdgpu: add irq domain support
Maruthi Bayyavarapu (1):
drm/amd: add ACP driver support
Maruthi Srinivas Bayyavarapu (5):
drm/amd: add pm domain for ACP IP sub blocks
ASoC: AMD: add ACP 2.2 register headers
ASoC: AMD: add AMD ASoC ACP 2.x DMA driver
ASoC: AMD: add pm ops
ASoC: AMD: Manage ACP 2.x SRAM banks power
drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/amd/acp/Kconfig | 11 + drivers/gpu/drm/amd/acp/Makefile | 8 + drivers/gpu/drm/amd/acp/acp_hw.c | 50 + drivers/gpu/drm/amd/acp/include/acp_gfx_if.h | 34 + drivers/gpu/drm/amd/amdgpu/Makefile | 13 +- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 12 + drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c | 501 ++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_acp.h | 42 + drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c | 36 + drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 108 +- drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h | 9 + drivers/gpu/drm/amd/amdgpu/cik_ih.c | 6 + drivers/gpu/drm/amd/amdgpu/cz_ih.c | 7 + drivers/gpu/drm/amd/amdgpu/iceland_ih.c | 7 + drivers/gpu/drm/amd/amdgpu/tonga_ih.c | 7 + drivers/gpu/drm/amd/amdgpu/vi.c | 12 + drivers/gpu/drm/amd/include/amd_shared.h | 1 + drivers/gpu/drm/amd/include/cgs_common.h | 34 + sound/soc/Kconfig | 1 + sound/soc/Makefile | 1 + sound/soc/amd/Kconfig | 4 + sound/soc/amd/Makefile | 3 + sound/soc/amd/acp-pcm-dma.c | 1066 ++++++++++++ sound/soc/amd/acp.h | 119 ++ sound/soc/amd/include/acp_2_2_d.h | 609 +++++++ sound/soc/amd/include/acp_2_2_enum.h | 1068 ++++++++++++ sound/soc/amd/include/acp_2_2_sh_mask.h | 2292 ++++++++++++++++++++++++++ 28 files changed, 6054 insertions(+), 9 deletions(-) create mode 100644 drivers/gpu/drm/amd/acp/Kconfig create mode 100644 drivers/gpu/drm/amd/acp/Makefile create mode 100644 drivers/gpu/drm/amd/acp/acp_hw.c create mode 100644 drivers/gpu/drm/amd/acp/include/acp_gfx_if.h create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_acp.h create mode 100644 sound/soc/amd/Kconfig create mode 100644 sound/soc/amd/Makefile create mode 100644 sound/soc/amd/acp-pcm-dma.c create mode 100644 sound/soc/amd/acp.h create mode 100644 sound/soc/amd/include/acp_2_2_d.h create mode 100644 sound/soc/amd/include/acp_2_2_enum.h create mode 100644 sound/soc/amd/include/acp_2_2_sh_mask.h
Signature · 6 lines
2.5.0 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/8 drm/amdgpu/cgs: add an interface to access PCI resources
This provides an interface to get access to the base address of PCI resources (MMIO, DOORBELL, etc.). Only MMIO and DOORBELL are implemented right now. This is necessary to properly utilize shared drivers on platform devices. IP modules can use this interface to get the base address of the resource and add any additional offset and set the size when setting up the platform driver(s).
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c | 36 ++++++++++++++++++++++++++++++++ drivers/gpu/drm/amd/include/cgs_common.h | 34 ++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c +36 -0
@@ -398,6 +398,41 @@ static void amdgpu_cgs_write_pci_config_dword(void *cgs_device, unsigned addr,WARN (ret,"pci_write_config_dword error" ); } + +static int amdgpu_cgs_get_pci_resource (void *cgs_device, +enum cgs_resource_type resource_type, +uint64_t size, +uint64_t offset, +uint64_t *resource_base) +{ +CGS_FUNC_ADEV ; + +if (resource_base ==NULL ) +return -EINVAL ; + +switch (resource_type) { +case CGS_RESOURCE_TYPE_MMIO : +if (adev->rmmio_size ==0 ) +return -ENOENT ; +if ((offset + size) > adev->rmmio_size) +return -EINVAL ; + *resource_base = adev->rmmio_base; +return 0 ; +case CGS_RESOURCE_TYPE_DOORBELL : +if (adev->doorbell.size ==0 ) +return -ENOENT ; +if ((offset + size) > adev->doorbell.size) +return -EINVAL ; + *resource_base = adev->doorbell.base; +return 0 ; +case CGS_RESOURCE_TYPE_FB : +case CGS_RESOURCE_TYPE_IO : +case CGS_RESOURCE_TYPE_ROM : +default : +return -EINVAL ; + } +} +static const void *amdgpu_cgs_atom_get_data_table (void *cgs_device,unsigned table,uint16_t *size,uint8_t *frev,uint8_t *crev)
@@ -1041,6 +1076,7 @@ static const struct cgs_ops amdgpu_cgs_ops = { amdgpu_cgs_write_pci_config_byte, amdgpu_cgs_write_pci_config_word, amdgpu_cgs_write_pci_config_dword, + amdgpu_cgs_get_pci_resource, amdgpu_cgs_atom_get_data_table, amdgpu_cgs_atom_get_cmd_table_revs, amdgpu_cgs_atom_exec_cmd_table,
drivers/gpu/drm/amd/include/cgs_common.h +34 -0
@@ -122,6 +122,17 @@ struct cgs_system_info {uint64_t padding[13 ]; }; +/* +* enum cgs_resource_type - GPU resource type +*/ +enum cgs_resource_type { +CGS_RESOURCE_TYPE_MMIO =0 , +CGS_RESOURCE_TYPE_FB , +CGS_RESOURCE_TYPE_IO , +CGS_RESOURCE_TYPE_DOORBELL , +CGS_RESOURCE_TYPE_ROM , +}; +/** * struct cgs_clock_limits - Clock limits *
@@ -417,6 +428,23 @@ typedef void (*cgs_write_pci_config_word_t)(void *cgs_device, unsigned addr,typedef void (*cgs_write_pci_config_dword_t )(void *cgs_device,unsigned addr,uint32_t value); + +/** +* cgs_get_pci_resource() - provide access to a device resource (PCI BAR) +* @cgs_device: opaque device handle +* @resource_type: Type of Resource (MMIO, IO, ROM, FB, DOORBELL) +* @size: size of the region +* @offset: offset from the start of the region +* @resource_base: base address (not including offset) returned +* +* Return: 0 on success, -errno otherwise +*/ +typedef int (*cgs_get_pci_resource_t )(void *cgs_device, +enum cgs_resource_type resource_type, +uint64_t size, +uint64_t offset, +uint64_t *resource_base); +/** * cgs_atom_get_data_table() - Get a pointer to an ATOM BIOS data table * @cgs_device: opaque device handle
@@ -593,6 +621,8 @@ struct cgs_ops {cgs_write_pci_config_byte_t write_pci_config_byte;cgs_write_pci_config_word_t write_pci_config_word;cgs_write_pci_config_dword_t write_pci_config_dword; +/* PCI resources */ +cgs_get_pci_resource_t get_pci_resource;/* ATOM BIOS */ cgs_atom_get_data_table_t atom_get_data_table;cgs_atom_get_cmd_table_revs_t atom_get_cmd_table_revs;
@@ -708,5 +738,9 @@ struct cgs_device CGS_CALL(call_acpi_method, dev, acpi_method, acpi_function, pintput, poutput, output_count, input_size, output_size)#define cgs_query_system_info (dev, sys_info) \ CGS_CALL(query_system_info, dev, sys_info) +#define cgs_get_pci_resource (cgs_device, resource_type, size, offset, \ + resource_base) \ + CGS_CALL(get_pci_resource, cgs_device, resource_type, size, offset, \ + resource_base)#endif /* _CGS_COMMON_H */
Signature · 6 lines
2.5.0 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/8 drm/amdgpu: add irq domain support
In reply to Alex DeucherHardware blocks on the GPU like ACP generate interrupts in the GPU interrupt controller, but are driven by a separate driver. Add an irq domain to the GPU driver so that blocks like ACP can register a Linux interrupt.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 108 +++++++++++++++++++++++++++++--- drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h | 9 +++ drivers/gpu/drm/amd/amdgpu/cik_ih.c | 6 ++ drivers/gpu/drm/amd/amdgpu/cz_ih.c | 7 +++ drivers/gpu/drm/amd/amdgpu/iceland_ih.c | 7 +++ drivers/gpu/drm/amd/amdgpu/tonga_ih.c | 7 +++ 6 files changed, 136 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +100 -8
@@ -312,6 +312,7 @@ int amdgpu_irq_add_id(struct amdgpu_device *adev, unsigned src_id, } adev->irq.sources[src_id] = source; +return 0 ; }
@@ -335,15 +336,19 @@ void amdgpu_irq_dispatch(struct amdgpu_device *adev,return ; } - src = adev->irq.sources[src_id]; -if (!src) { -DRM_DEBUG ("Unhandled interrupt src_id: %d\n" , src_id); -return ; - } +if (adev->irq.virq[src_id]) { +generic_handle_irq (irq_find_mapping (adev->irq.domain, src_id)); + }else { + src = adev->irq.sources[src_id]; +if (!src) { +DRM_DEBUG ("Unhandled interrupt src_id: %d\n" , src_id); +return ; + } - r = src->funcs->process (adev, src, entry); -if (r) -DRM_ERROR ("error processing interrupt (%d)\n" , r); + r = src->funcs->process (adev, src, entry); +if (r) +DRM_ERROR ("error processing interrupt (%d)\n" , r); + } }/**
@@ -461,3 +466,90 @@ bool amdgpu_irq_enabled(struct amdgpu_device *adev, struct amdgpu_irq_src *src,return !!atomic_read (&src->enabled_types[type]); } + +/* gen irq */ +static void amdgpu_irq_mask (struct irq_data *irqd) +{ +/* XXX */ +} + +static void amdgpu_irq_unmask (struct irq_data *irqd) +{ +/* XXX */ +} + +static struct irq_chip amdgpu_irq_chip = { + .name ="amdgpu-ih" , + .irq_mask = amdgpu_irq_mask, + .irq_unmask = amdgpu_irq_unmask, +}; + +static int amdgpu_irqdomain_map (struct irq_domain *d, +unsigned int irq,irq_hw_number_t hwirq) +{ +if (hwirq >=AMDGPU_MAX_IRQ_SRC_ID ) +return -EPERM ; + +irq_set_chip_and_handler (irq, + &amdgpu_irq_chip, handle_simple_irq); +return 0 ; +} + +static struct irq_domain_ops amdgpu_hw_irqdomain_ops = { + .map = amdgpu_irqdomain_map, +}; + +/** +* amdgpu_irq_add_domain - create a linear irq domain +* +* @adev: amdgpu device pointer +* +* Create an irq domain for GPU interrupt sources +* that may be driven by another driver (e.g., ACP). +*/ +int amdgpu_irq_add_domain (struct amdgpu_device *adev) +{ + adev->irq.domain =irq_domain_add_linear (NULL ,AMDGPU_MAX_IRQ_SRC_ID , + &amdgpu_hw_irqdomain_ops, adev); +if (!adev->irq.domain) { +DRM_ERROR ("GPU irq add domain failed\n" ); +return -ENODEV ; + } + +return 0 ; +} + +/** +* amdgpu_irq_remove_domain - remove the irq domain +* +* @adev: amdgpu device pointer +* +* Remove the irq domain for GPU interrupt sources +* that may be driven by another driver (e.g., ACP). +*/ +void amdgpu_irq_remove_domain (struct amdgpu_device *adev) +{ +if (adev->irq.domain) { +irq_domain_remove (adev->irq.domain); + adev->irq.domain =NULL ; + } +} + +/** +* amdgpu_irq_create_mapping - create a mapping between a domain irq and a +* Linux irq +* +* @adev: amdgpu device pointer +* @src_id: IH source id +* +* Create a mapping between a domain irq (GPU IH src id) and a Linux irq +* Use this for components that generate a GPU interrupt, but are driven +* by a different driver (e.g., ACP). +* Returns the Linux irq. +*/ +unsigned amdgpu_irq_create_mapping (struct amdgpu_device *adev,unsigned src_id) +{ + adev->irq.virq[src_id] =irq_create_mapping (adev->irq.domain, src_id); + +return adev->irq.virq[src_id]; +}
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h +9 -0
@@ -24,6 +24,7 @@#ifndef __AMDGPU_IRQ_H__#define __AMDGPU_IRQ_H__ +#include <linux/irqdomain.h> #include "amdgpu_ih.h" #define AMDGPU_MAX_IRQ_SRC_ID 0x100
@@ -65,6 +66,10 @@ struct amdgpu_irq {/* interrupt ring */ struct amdgpu_ih_ring ih;const struct amdgpu_ih_funcs *ih_funcs; + +/* gen irq stuff */ +struct irq_domain *domain;/* GPU irq controller domain */ +unsigned virq[AMDGPU_MAX_IRQ_SRC_ID ]; };void amdgpu_irq_preinstall (struct drm_device *dev);
@@ -90,4 +95,8 @@ int amdgpu_irq_put(struct amdgpu_device *adev, struct amdgpu_irq_src *src,bool amdgpu_irq_enabled (struct amdgpu_device *adev,struct amdgpu_irq_src *src,unsigned type); +int amdgpu_irq_add_domain (struct amdgpu_device *adev); +void amdgpu_irq_remove_domain (struct amdgpu_device *adev); +unsigned amdgpu_irq_create_mapping (struct amdgpu_device *adev,unsigned src_id); +#endif
drivers/gpu/drm/amd/amdgpu/cik_ih.c +6 -0
@@ -274,6 +274,11 @@ static void cik_ih_set_rptr(struct amdgpu_device *adev)static int cik_ih_early_init (void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle; +int ret; + + ret =amdgpu_irq_add_domain (adev); +if (ret) +return ret;cik_ih_set_interrupt_funcs (adev);
@@ -300,6 +305,7 @@ static int cik_ih_sw_fini(void *handle)amdgpu_irq_fini (adev);amdgpu_ih_ring_fini (adev); +amdgpu_irq_remove_domain (adev);return 0 ; }
drivers/gpu/drm/amd/amdgpu/cz_ih.c +7 -0
@@ -253,8 +253,14 @@ static void cz_ih_set_rptr(struct amdgpu_device *adev)static int cz_ih_early_init (void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle; +int ret; + + ret =amdgpu_irq_add_domain (adev); +if (ret) +return ret;cz_ih_set_interrupt_funcs (adev); +return 0 ; }
@@ -278,6 +284,7 @@ static int cz_ih_sw_fini(void *handle)amdgpu_irq_fini (adev);amdgpu_ih_ring_fini (adev); +amdgpu_irq_remove_domain (adev);return 0 ; }
drivers/gpu/drm/amd/amdgpu/iceland_ih.c +7 -0
@@ -253,8 +253,14 @@ static void iceland_ih_set_rptr(struct amdgpu_device *adev)static int iceland_ih_early_init (void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle; +int ret; + + ret =amdgpu_irq_add_domain (adev); +if (ret) +return ret;iceland_ih_set_interrupt_funcs (adev); +return 0 ; }
@@ -278,6 +284,7 @@ static int iceland_ih_sw_fini(void *handle)amdgpu_irq_fini (adev);amdgpu_ih_ring_fini (adev); +amdgpu_irq_remove_domain (adev);return 0 ; }
drivers/gpu/drm/amd/amdgpu/tonga_ih.c +7 -0
@@ -273,8 +273,14 @@ static void tonga_ih_set_rptr(struct amdgpu_device *adev)static int tonga_ih_early_init (void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle; +int ret; + + ret =amdgpu_irq_add_domain (adev); +if (ret) +return ret;tonga_ih_set_interrupt_funcs (adev); +return 0 ; }
@@ -301,6 +307,7 @@ static int tonga_ih_sw_fini(void *handle)amdgpu_irq_fini (adev);amdgpu_ih_ring_fini (adev); +amdgpu_irq_add_domain (adev);return 0 ; }
Signature · 6 lines
2.5.0 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/8 drm/amd: add ACP driver support
In reply to Alex DeucherFrom: Maruthi Bayyavarapu <[email protected]>
This adds the ACP (Audio CoProcessor) IP driver and wires it up to the amdgpu driver. The ACP block provides the DMA engine for i2s based ALSA driver. This is required for audio on APUs that utilize an i2s codec.
---
v2: integrate i2s/az check patch
v3: s/amd_acp/amdgpu_acp/
v4: update copyright notice
v5: squash multiple patches, convert to mfd
v6: major changes as below :
1. Pass ACP register base to DMA and dw i2s drivers as IORESOURCE_MEM resources.
2. add dw i2s as a new mfd cell.
v7: specify broken out dw quirks that apply to AMD hardware
v8: Changes:
1. Select MFD_CORE
2. use genirq for ACP interrupt
3. Add separate cells for dws capture and playback
v9: drop stale include path
drivers/gpu/drm/Kconfig | 2 +
drivers/gpu/drm/amd/acp/Kconfig | 10 + drivers/gpu/drm/amd/acp/Makefile | 8 + drivers/gpu/drm/amd/acp/acp_hw.c | 50 +++++ drivers/gpu/drm/amd/acp/include/acp_gfx_if.h | 34 +++ drivers/gpu/drm/amd/amdgpu/Makefile | 13 +- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 12 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c | 297 +++++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_acp.h | 41 ++++ drivers/gpu/drm/amd/amdgpu/vi.c | 12 ++ drivers/gpu/drm/amd/include/amd_shared.h | 1 + 11 files changed, 479 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/amd/acp/Kconfig create mode 100644 drivers/gpu/drm/amd/acp/Makefile create mode 100644 drivers/gpu/drm/amd/acp/acp_hw.c create mode 100644 drivers/gpu/drm/amd/acp/include/acp_gfx_if.h create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_acp.h
drivers/gpu/drm/Kconfig +2 -0
@@ -162,6 +162,8 @@ config DRM_AMDGPU source "drivers/gpu/drm/amd/amdgpu/Kconfig" source "drivers/gpu/drm/amd/powerplay/Kconfig" +source "drivers/gpu/drm/amd/acp/Kconfig" + source "drivers/gpu/drm/nouveau/Kconfig" config DRM_I810
drivers/gpu/drm/amd/acp/Kconfig new file +10 -0
@@ -0,0 +1,10 @@ +menu "ACP Configuration" + +config DRM_AMD_ACP + bool "Enable ACP IP support" + default y + select MFD_CORE + help + Choose this option to enable ACP IP support for AMD SOCs. + +endmenu
drivers/gpu/drm/amd/acp/Makefile new file +8 -0
@@ -0,0 +1,8 @@ +# +# Makefile for the ACP, which is a sub-component +# of AMDSOC/AMDGPU drm driver. +# It provides the HW control for ACP related functionalities. + +subdir-ccflags-y += -I$(AMDACPPATH)/ -I$(AMDACPPATH)/include + +AMD_ACP_FILES := $(AMDACPPATH)/acp_hw.o
drivers/gpu/drm/amd/acp/acp_hw.c new file +50 -0
50 lines not on this page · raw message
drivers/gpu/drm/amd/acp/include/acp_gfx_if.h new file +34 -0
@@ -0,0 +1,34 @@ +/* +* Copyright 2015 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +* +*/ + +#ifndef _ACP_GFX_IF_H +#define _ACP_GFX_IF_H + +#include <linux/types.h> +#include "cgs_linux.h" +#include "cgs_common.h" + +int amd_acp_hw_init (void *cgs_device, +unsigned acp_version_major,unsigned acp_version_minor); + +#endif /* _ACP_GFX_IF_H */
drivers/gpu/drm/amd/amdgpu/Makefile +12 -1
@@ -8,7 +8,8 @@ ccflags-y := -Iinclude/drm -I$(FULL_AMD_PATH)/include/asic_reg \ -I$(FULL_AMD_PATH)/include \ -I$(FULL_AMD_PATH)/amdgpu \ -I$(FULL_AMD_PATH)/scheduler \ - -I$(FULL_AMD_PATH)/powerplay/inc + -I$(FULL_AMD_PATH)/powerplay/inc \ + -I$(FULL_AMD_PATH)/acp/include amdgpu-y := amdgpu_drv.o
@@ -93,6 +94,16 @@ amdgpu-y += \ ../scheduler/sched_fence.o \ amdgpu_sched.o +# ACP componet +ifneq ($(CONFIG_DRM_AMD_ACP),) +amdgpu-y += amdgpu_acp.o + +AMDACPPATH := ../acp +include drivers/gpu/drm/amd/acp/Makefile + +amdgpu-y += $(AMD_ACP_FILES) +endif + amdgpu-$(CONFIG_COMPAT) += amdgpu_ioc32.o amdgpu-$(CONFIG_VGA_SWITCHEROO) += amdgpu_atpx_handler.o amdgpu-$(CONFIG_ACPI) += amdgpu_acpi.o
drivers/gpu/drm/amd/amdgpu/amdgpu.h +12 -0
@@ -53,6 +53,7 @@#include "amdgpu_ucode.h" #include "amdgpu_gds.h" #include "amd_powerplay.h" +#include "amdgpu_acp.h" #include "gpu_scheduler.h"
@@ -1922,6 +1923,13 @@ void amdgpu_cgs_destroy_device(void *cgs_device);/* +* CGS +*/ +void *amdgpu_cgs_create_device (struct amdgpu_device *adev); +void amdgpu_cgs_destroy_device (void *cgs_device); + + +/* * Core structure, functions and helpers. */ typedef uint32_t (*amdgpu_rreg_t )(struct amdgpu_device *,uint32_t );
@@ -1941,6 +1949,10 @@ struct amdgpu_device {struct drm_device *ddev;struct pci_dev *pdev; +#ifdef CONFIG_DRM_AMD_ACP +struct amdgpu_acp acp; +#endif +/* ASIC */ enum amd_asic_type asic_type;uint32_t family;
drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c new file +297 -0
297 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/amdgpu_acp.h new file +41 -0
41 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/vi.c +12 -0
@@ -73,6 +73,9 @@#include "uvd_v6_0.h" #include "vce_v3_0.h" #include "amdgpu_powerplay.h" +#if defined(CONFIG_DRM_AMD_ACP ) +#include "amdgpu_acp.h" +#endif /* * Indirect registers accessor
@@ -1346,6 +1349,15 @@ static const struct amdgpu_ip_block_version cz_ip_blocks[] = .rev = 0, .funcs = &vce_v3_0_ip_funcs, }, +#if defined(CONFIG_DRM_AMD_ACP ) + { + .type = AMD_IP_BLOCK_TYPE_ACP, + .major = 2, + .minor = 2, + .rev = 0, + .funcs = &acp_ip_funcs, + }, +#endif };int vi_set_ip_blocks (struct amdgpu_device *adev)
drivers/gpu/drm/amd/include/amd_shared.h +1 -0
@@ -73,6 +73,7 @@ enum amd_ip_block_type {AMD_IP_BLOCK_TYPE_SDMA ,AMD_IP_BLOCK_TYPE_UVD ,AMD_IP_BLOCK_TYPE_VCE , + AMD_IP_BLOCK_TYPE_ACP, }; enum amd_clockgating_state {
Signature · 6 lines
2.5.0 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 4/8 drm/amd: add pm domain for ACP IP sub blocks
In reply to Alex DeucherFrom: Maruthi Srinivas Bayyavarapu <[email protected]>
ACP IP have internal DMA controller, DW I2S controller and DSPs as separate power tiles. DMA and I2S devices are added to generic pm domain, so that entire IP can be powered off/on at appropriate times. Unused DSPs are made to be powered off though they are powered on during ACP pm domain power on sequence.
---
v2: fix authorship accidently broken in last rebase
drivers/gpu/drm/amd/acp/Kconfig | 1 +
drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c | 206 +++++++++++++++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_acp.h | 1 + 3 files changed, 207 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/acp/Kconfig +1 -0
@@ -4,6 +4,7 @@ config DRM_AMD_ACP bool "Enable ACP IP support" default y select MFD_CORE + select PM_GENERIC_DOMAINS if PM help Choose this option to enable ACP IP support for AMD SOCs.
drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c +205 -1
253 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/amdgpu_acp.h +1 -0
@@ -34,6 +34,7 @@ struct amdgpu_acp {struct amd_acp_private *private;struct mfd_cell *acp_cell;struct resource *acp_res; +struct acp_pm_domain *acp_genpd; };extern const struct amd_ip_funcs acp_ip_funcs;
Signature · 6 lines
2.5.0 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 6/8 ASoC: AMD: add AMD ASoC ACP 2.x DMA driver
In reply to Alex DeucherFrom: Maruthi Srinivas Bayyavarapu <[email protected]>
ACP IP has internal DMA controller with multiple channels which can be programmed in cyclic/non cyclic manner. ACP can generate interrupt upon completion of DMA transfer, if required. The PCM driver provides the platform DMA component to ALSA core.
---
v2: Changes
1. Squash ACP DMA abstraction and DMA patches together
2. Fix IRQ_NONE case in dma_irq_handler
3. Replace ternery operations
4. Add loop timeout
sound/soc/Kconfig | 1 + sound/soc/Makefile | 1 + sound/soc/amd/Kconfig | 4 + sound/soc/amd/Makefile | 3 + sound/soc/amd/acp-pcm-dma.c | 924 ++++++++++++++++++++++++++++++++++++++++++++ sound/soc/amd/acp.h | 119 ++++++ 6 files changed, 1052 insertions(+) create mode 100644 sound/soc/amd/Kconfig create mode 100644 sound/soc/amd/Makefile create mode 100644 sound/soc/amd/acp-pcm-dma.c create mode 100644 sound/soc/amd/acp.h
sound/soc/Kconfig +1 -0
@@ -38,6 +38,7 @@ config SND_SOC_TOPOLOGY # All the supported SoCs source "sound/soc/adi/Kconfig" +source "sound/soc/amd/Kconfig" source "sound/soc/atmel/Kconfig" source "sound/soc/au1x/Kconfig" source "sound/soc/bcm/Kconfig"
sound/soc/Makefile +1 -0
@@ -18,6 +18,7 @@ obj-$(CONFIG_SND_SOC) += snd-soc-core.o obj-$(CONFIG_SND_SOC) += codecs/ obj-$(CONFIG_SND_SOC) += generic/ obj-$(CONFIG_SND_SOC) += adi/ +obj-$(CONFIG_SND_SOC) += amd/ obj-$(CONFIG_SND_SOC) += atmel/ obj-$(CONFIG_SND_SOC) += au1x/ obj-$(CONFIG_SND_SOC) += bcm/
sound/soc/amd/Kconfig new file +4 -0
@@ -0,0 +1,4 @@ +config SND_SOC_AMD_ACP + tristate "AMD Audio Coprocessor support" + help + This option enables ACP DMA support on AMD platform.
sound/soc/amd/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +snd-soc-acp-pcm-objs := acp-pcm-dma.o + +obj-$(CONFIG_SND_SOC_AMD_ACP) += snd-soc-acp-pcm.o
sound/soc/amd/acp-pcm-dma.c new file +924 -0
924 lines not on this page · raw message
sound/soc/amd/acp.h new file +119 -0
119 lines not on this page · raw message
Signature · 6 lines
2.5.0 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Mark Brown
maintainerRe: [PATCH 6/8] ASoC: AMD: add AMD ASoC ACP 2.x DMA driver
sound/soc/amd/Kconfig line 4
Quoted 7 lines · Alex Deucher
sound/soc/amd/Kconfig new file +4
-0@@ -0,0 +1,4 @@ +config SND_SOC_AMD_ACP + tristate "AMD Audio Coprocessor support" + help + This option enables ACP DMA support on AMD platform.
This has no dependencies?
sound/soc/amd/Kconfig
Quoted 13 lines
sound/soc/amd/Kconfig new file +13
-0+ + /* Designware I2S driver requries proper capabilities + * from mmACP_I2SMICSP_COMP_PARAM_1 register. The register + * reports playback and capture capabilities though the + * MIC instance of DW I2S controller supports capture only + * Provide a workaround by masking the capability into a + * scratch register and provide scratch register offset as + * though it is mmACP_I2SMICSP_COMP_PARAM_1 + */ + + val = acp_reg_read(acp_mmio, mmACP_I2SMICSP_COMP_PARAM_1); + val = val & ~BIT(5); + acp_reg_write(val, acp_mmio, mmACP_SCRATCH_REG_0);
Ugh, right. So the hardware doesn't actually have the register moved at all. Why are we doing this, if the capabilities really are buggy the more idiomatic thing would be to provide an override for the capabilities via platform data? Requiring some other driver to poke the hardware to set the capabilities is a very roundabout way to deal with things.
We should probably revert that quirk unless I'm missing something here...
sound/soc/amd/Kconfig line 5
Quoted 7 lines
+++
b/sound/soc/amd/acp.hsound/soc/amd/Kconfig new file +5
-0@@ -0,0 +1,119 @@ +#ifndef __ACP_HW_H +#define __ACP_HW_H + +#include "include/acp_2_2_d.h" +#include "include/acp_2_2_sh_mask.h"
I can't find these headers anywhere in the kernel tree or earlier in this patch series, this will break the build. The fact that they've got include in the filename is also a bit interesting...
sound/soc/amd/Kconfig line 6
Quoted 1 line
sound/soc/amd/Kconfig new file +1
-0+#define PAGE_SIZE_4K 4096
SZ_4K exists for this.
sound/soc/amd/Kconfig line 10
Quoted 4 lines
sound/soc/amd/Kconfig new file +4
-0+#define PAGE_SIZE_4K_ENABLE 0x02 + +#define PLAYBACK_PTE_OFFSET 10 +#define CAPTURE_PTE_OFFSET 0
These defines could all use namespacing, as could some of the others later than don't mention ACP.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Mark Brown
maintainerRe: [PATCH 6/8] ASoC: AMD: add AMD ASoC ACP 2.x DMA driver
Quoted 8 lines · Mark Brown
sound/soc/amd/acp.h line 5
Quoted 2 lines · Alex Deucher
sound/soc/amd/acp.h new file +2
-0+#include "include/acp_2_2_d.h" +#include "include/acp_2_2_sh_mask.h" I can't find these headers anywhere in the kernel tree or earlier in this patch series, this will break the build. The fact that they've got include in the filename is also a bit interesting...
Ugh, your cover letter says (after pages of changelog) that they're in a patch 5 which you didn't send :( Please don't do this, I can't apply or review code that isn't sent to me.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 6/8] ASoC: AMD: add AMD ASoC ACP 2.x DMA driver
In reply to Mark BrownQuoted 11 lines · Mark Brown
sound/soc/amd/Kconfig line 4
Quoted 7 lines · Alex Deucher
sound/soc/amd/Kconfig new file +4
-0@@ -0,0 +1,4 @@ +config SND_SOC_AMD_ACP + tristate "AMD Audio Coprocessor support" + help + This option enables ACP DMA support on AMD platform.This has no dependencies?
No dependencies. The ACP device discovery is triggered from GPU driver, but the ACP driver has no direct dependencies on it. Theoretically it could act as a standalone driver.
Alex
Quoted 40 lines
Quoted 4 lines
sound/soc/amd/Kconfig new file +3
-0+ + /* Designware I2S driver requries proper capabilities + * from mmACP_I2SMICSP_COMP_PARAM_1 register. The registersound/soc/amd/Kconfig
Quoted 10 lines
sound/soc/amd/Kconfig new file +10
-0+ * reports playback and capture capabilities though the + * MIC instance of DW I2S controller supports capture only + * Provide a workaround by masking the capability into a + * scratch register and provide scratch register offset as + * though it is mmACP_I2SMICSP_COMP_PARAM_1 + */ + + val = acp_reg_read(acp_mmio, mmACP_I2SMICSP_COMP_PARAM_1); + val = val & ~BIT(5); + acp_reg_write(val, acp_mmio, mmACP_SCRATCH_REG_0);Ugh, right. So the hardware doesn't actually have the register moved at all. Why are we doing this, if the capabilities really are buggy the more idiomatic thing would be to provide an override for the capabilities via platform data? Requiring some other driver to poke the hardware to set the capabilities is a very roundabout way to deal with things.
We should probably revert that quirk unless I'm missing something here...
sound/soc/amd/Kconfig line 5
Quoted 7 lines
+++
b/sound/soc/amd/acp.hsound/soc/amd/Kconfig new file +5
-0@@ -0,0 +1,119 @@ +#ifndef __ACP_HW_H +#define __ACP_HW_H + +#include "include/acp_2_2_d.h" +#include "include/acp_2_2_sh_mask.h"I can't find these headers anywhere in the kernel tree or earlier in this patch series, this will break the build. The fact that they've got include in the filename is also a bit interesting...
sound/soc/amd/Kconfig line 6
Quoted 1 line
sound/soc/amd/Kconfig new file +1
-0+#define PAGE_SIZE_4K 4096
SZ_4Kexists for this.
Quoted 7 lines
sound/soc/amd/Kconfig line 10
Quoted 4 lines
sound/soc/amd/Kconfig new file +4
-0+#define PAGE_SIZE_4K_ENABLE 0x02 + +#define PLAYBACK_PTE_OFFSET 10 +#define CAPTURE_PTE_OFFSET 0These defines could all use namespacing, as could some of the others later than don't mention ACP.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Mark Brown
maintainerRe: [PATCH 6/8] ASoC: AMD: add AMD ASoC ACP 2.x DMA driver
Quoted 13 lines · Alex Deucher
Quoted 11 lines · Mark Brown
sound/soc/amd/Kconfig line 4
Quoted 7 lines · Alex Deucher
sound/soc/amd/Kconfig new file +4
-0@@ -0,0 +1,4 @@ +config SND_SOC_AMD_ACP + tristate "AMD Audio Coprocessor support" + help + This option enables ACP DMA support on AMD platform.This has no dependencies?
Quoted 3 lines
No dependencies. The ACP device discovery is triggered from GPU driver, but the ACP driver has no direct dependencies on it. Theoretically it could act as a standalone driver.
In that case there's no need to merge everything through the DRM tree, each bit can go in separately. That makes life a bit easier process wise, people will need to merge the two to run things but that's fine.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 6/8] ASoC: AMD: add AMD ASoC ACP 2.x DMA driver
Quoted 14 lines · Mark Brown
Quoted 12 lines · Alex Deucher
Quoted 11 lines · Mark Brown
sound/soc/amd/Kconfig line 4
Quoted 7 lines · Alex Deucher
sound/soc/amd/Kconfig new file +4
-0@@ -0,0 +1,4 @@ +config SND_SOC_AMD_ACP + tristate "AMD Audio Coprocessor support" + help + This option enables ACP DMA support on AMD platform.This has no dependencies?
Quoted 7 lines
Quoted 3 lines
No dependencies. The ACP device discovery is triggered from GPU driver, but the ACP driver has no direct dependencies on it. Theoretically it could act as a standalone driver.
In that case there's no need to merge everything through the DRM tree, each bit can go in separately. That makes life a bit easier process wise, people will need to merge the two to run things but that's fine.
Sounds good. Thanks!
Alex
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 7/8 ASoC: AMD: add pm ops
In reply to Alex DeucherFrom: Maruthi Srinivas Bayyavarapu <[email protected]>
genpd will power off/on ACP to manage runtime ACP PM. ACP runtime PM hooks are added to get it deinitialized and initialized respectively, after it is powered off/on.
When system goes to suspend when audio usecase is active, ACP will be powered off through genpd. When it resumes, ACP needs to be initialized and reconfigured.
--- sound/soc/amd/acp-pcm-dma.c | 60 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+)
sound/soc/amd/acp-pcm-dma.c +60 -0
@@ -15,6 +15,7 @@#include <linux/module.h> #include <linux/delay.h> +#include <linux/pm_runtime.h> #include <sound/soc.h>
@@ -895,6 +896,10 @@ static int acp_audio_probe(struct platform_device *pdev)return status; } +pm_runtime_set_autosuspend_delay (&pdev->dev,10000 ); +pm_runtime_use_autosuspend (&pdev->dev); +pm_runtime_enable (&pdev->dev); +return status; }
@@ -904,15 +909,70 @@ static int acp_audio_remove(struct platform_device *pdev)acp_deinit (adata->acp_mmio);snd_soc_unregister_platform (&pdev->dev); +pm_runtime_disable (&pdev->dev); + +return 0 ; +} + +static int acp_pcm_resume (struct device *dev) +{ +struct snd_pcm_substream *stream; +struct snd_pcm_runtime *rtd; +struct audio_substream_data *sdata; +struct audio_drv_data *adata =dev_get_drvdata (dev); + +acp_init (adata->acp_mmio); + + stream = adata->play_stream; + rtd = stream ? stream->runtime :NULL ; +if (rtd !=NULL ) { +/* Resume playback stream from a suspended state */ + sdata = rtd->private_data; +config_acp_dma (adata->acp_mmio, sdata); + } + + stream = adata->capture_stream; + rtd = stream ? stream->runtime :NULL ; +if (rtd !=NULL ) { +/* Resume capture stream from a suspended state */ + sdata = rtd->private_data; +config_acp_dma (adata->acp_mmio, sdata); + } + +acp_reg_write (1 , adata->acp_mmio, mmACP_EXTERNAL_INTR_ENB); +return 0 ; +} + +static int acp_pcm_runtime_suspend (struct device *dev) +{ +struct audio_drv_data *adata =dev_get_drvdata (dev); +acp_deinit (adata->acp_mmio); +acp_reg_write (0 , adata->acp_mmio, mmACP_EXTERNAL_INTR_ENB);return 0 ; } +static int acp_pcm_runtime_resume (struct device *dev) +{ +struct audio_drv_data *adata =dev_get_drvdata (dev); + +acp_init (adata->acp_mmio); +acp_reg_write (1 , adata->acp_mmio, mmACP_EXTERNAL_INTR_ENB); +return 0 ; +} + +static const struct dev_pm_ops acp_pm_ops = { + .resume = acp_pcm_resume, + .runtime_suspend = acp_pcm_runtime_suspend, + .runtime_resume = acp_pcm_runtime_resume, +}; +static struct platform_driver acp_dma_driver = { .probe = acp_audio_probe, .remove = acp_audio_remove, .driver = { .name ="acp_audio_dma" , + .pm = &acp_pm_ops, }, };
Signature · 6 lines
2.5.0 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Mark Brown
maintainerRe: [PATCH 7/8] ASoC: AMD: add pm ops
sound/soc/amd/acp-pcm-dma.c static int acp_audio_remove(struct platform_device *pdev) · line 932
Quoted 7 lines · Alex Deucher
sound/soc/amd/acp-pcm-dma.c +7
-0+ stream = adata->play_stream; + rtd = stream ? stream->runtime :NULL ; +if (rtd !=NULL ) { +/* Resume playback stream from a suspended state */ + sdata = rtd->private_data; +config_acp_dma (adata->acp_mmio, sdata); + }
Please don't use the ternery operator like this, it's not bad to write if statements and they're much more legible. I was having to think far too much about the various variables and if we were safely handling all of them before I realised the next block overwrites them all anyway. This is really
stream = adata->play_stream; if (stream && stream->rtd) config_acp_dma(adata->acp_mmio, stream->rtd->private_data);
or a couple of nested if statements. Otherwise this patch looks OK.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 8/8 ASoC: AMD: Manage ACP 2.x SRAM banks power
In reply to Alex DeucherFrom: Maruthi Srinivas Bayyavarapu <[email protected]>
ACP SRAM banks gets turned on when ACP is powered on. Not all banks are used for playback/capture. So, power on required banks during audio device open and power off during audio device close.
---
v2: Changes:
1. Clean up sram bank handling to clarify operation
2. Add timeout to loop
sound/soc/amd/acp-pcm-dma.c | 90 +++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 86 insertions(+), 4 deletions(-)
sound/soc/amd/acp-pcm-dma.c +86 -4
@@ -375,9 +375,57 @@ static int acp_dma_stop(void __iomem *acp_mmio, u8 ch_num)return 0 ; } +static void acp_set_sram_bank_state (void __iomem *acp_mmio,u16 bank, +bool power_on) +{ +u32 val, req_reg, sts_reg, sts_reg_mask; +u32 loops =1000 ; + +if (bank <32 ) { + req_reg = mmACP_MEM_SHUT_DOWN_REQ_LO; + sts_reg = mmACP_MEM_SHUT_DOWN_STS_LO; + sts_reg_mask =0xFFFFFFFF ; + + }else { + bank -=32 ; + req_reg = mmACP_MEM_SHUT_DOWN_REQ_HI; + sts_reg = mmACP_MEM_SHUT_DOWN_STS_HI; + sts_reg_mask =0x0000FFFF ; + } + + val =acp_reg_read (acp_mmio, req_reg); +if (val & (1 << bank)) { +/* bank is in off state */ +if (power_on == true) +/* request to on */ + val &= ~(1 << bank); +else +/* request to off */ +return ; + }else { +/* bank is in on state */ +if (power_on == false) +/* request to off */ + val |=1 << bank; +else +/* request to on */ +return ; + } +acp_reg_write (val, acp_mmio, req_reg); + +while (acp_reg_read (acp_mmio, sts_reg) != sts_reg_mask) { +if (!loops--) { +pr_err ("ACP SRAM bank %d state change failed\n" , bank); +break ; + } +cpu_relax (); + } +} +/* Initialize and bring ACP hardware to default state. */ static int acp_init (void __iomem *acp_mmio) { +u16 bank;u32 val, count, sram_pte_offset;/* Assert Soft reset of ACP */
@@ -445,6 +493,16 @@ static int acp_init(void __iomem *acp_mmio)acp_reg_write (ACP_EXTERNAL_INTR_CNTL__DMAIOCMask_MASK, acp_mmio, mmACP_EXTERNAL_INTR_CNTL); +/* When ACP_TILE_P1 is turned on, all SRAM banks get turned on. +* Now, turn off all of them. This can't be done in 'poweron' of +* ACP pm domain, as this requires ACP to be initialized. +*/ +for (bank =1 ; bank <32 ; bank++) +acp_set_sram_bank_state (acp_mmio, bank, false); + +for (bank =32 ; bank <48 ; bank++) +acp_set_sram_bank_state (acp_mmio, bank, false); +/* Designware I2S driver requries proper capabilities * from mmACP_I2SMICSP_COMP_PARAM_1 register. The register * reports playback and capture capabilities though the
@@ -569,6 +627,7 @@ static irqreturn_t dma_irq_handler(int irq, void *arg)static int acp_dma_open (struct snd_pcm_substream *substream) { +u16 bank;int ret =0 ;struct snd_pcm_runtime *runtime = substream->runtime;struct snd_soc_pcm_runtime *prtd = substream->private_data;
@@ -602,10 +661,17 @@ static int acp_dma_open(struct snd_pcm_substream *substream)if (!intr_data->play_stream && !intr_data->capture_stream)acp_reg_write (1 , adata->acp_mmio, mmACP_EXTERNAL_INTR_ENB); -if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ) +if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ) { intr_data->play_stream = substream; -else +for (bank =1 ; bank <=4 ; bank++) +acp_set_sram_bank_state (intr_data->acp_mmio, bank, + true); + }else { intr_data->capture_stream = substream; +for (bank =5 ; bank <=8 ; bank++) +acp_set_sram_bank_state (intr_data->acp_mmio, bank, + true); + }return 0 ; }
@@ -637,6 +703,7 @@ static int acp_dma_hw_params(struct snd_pcm_substream *substream, pg =virt_to_page (substream->dma_buffer.area);if (pg !=NULL ) { +acp_set_sram_bank_state (rtd->acp_mmio,0 , true);/* Save for runtime private data */ rtd->pg = pg; rtd->order =get_order (size);
@@ -812,6 +879,7 @@ static int acp_dma_new(struct snd_soc_pcm_runtime *rtd)static int acp_dma_close (struct snd_pcm_substream *substream) { +u16 bank;struct snd_pcm_runtime *runtime = substream->runtime;struct audio_substream_data *rtd = runtime->private_data;struct snd_soc_pcm_runtime *prtd = substream->private_data;
@@ -819,10 +887,17 @@ static int acp_dma_close(struct snd_pcm_substream *substream)kfree (rtd); -if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ) +if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ) { adata->play_stream =NULL ; -else +for (bank =1 ; bank <=4 ; bank++) +acp_set_sram_bank_state (adata->acp_mmio, bank, + false); + }else { adata->capture_stream =NULL ; +for (bank =5 ; bank <=8 ; bank++) +acp_set_sram_bank_state (adata->acp_mmio, bank, + false); + }/* Disable ACP irq, when the current stream is being closed and * another stream is also not active.
@@ -916,6 +991,7 @@ static int acp_audio_remove(struct platform_device *pdev)static int acp_pcm_resume (struct device *dev) { +u16 bank;struct snd_pcm_substream *stream;struct snd_pcm_runtime *rtd;struct audio_substream_data *sdata;
@@ -927,6 +1003,9 @@ static int acp_pcm_resume(struct device *dev) rtd = stream ? stream->runtime :NULL ;if (rtd !=NULL ) {/* Resume playback stream from a suspended state */ +for (bank =1 ; bank <=4 ; bank++) +acp_set_sram_bank_state (adata->acp_mmio, bank, + true); sdata = rtd->private_data;config_acp_dma (adata->acp_mmio, sdata); }
@@ -935,6 +1014,9 @@ static int acp_pcm_resume(struct device *dev) rtd = stream ? stream->runtime :NULL ;if (rtd !=NULL ) {/* Resume capture stream from a suspended state */ +for (bank =5 ; bank <=8 ; bank++) +acp_set_sram_bank_state (adata->acp_mmio, bank, + true); sdata = rtd->private_data;config_acp_dma (adata->acp_mmio, sdata); }
Signature · 6 lines
2.5.0 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Mark Brown
maintainerRe: [PATCH 8/8] ASoC: AMD: Manage ACP 2.x SRAM banks power
Quoted 6 lines · Alex Deucher
From: Maruthi Srinivas Bayyavarapu <[email protected]>
ACP SRAM banks gets turned on when ACP is powered on. Not all banks are used for playback/capture. So, power on required banks during audio device open and power off during audio device close.
This looks good.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Mark Brown
maintainerQuoted 1 line · Alex Deucher
I talked to Dave Airlie on IRC and he has acked the drm side.
I'd expect to see any acks in the changelogs for the patches as normal.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Mark Brown
maintainerQuoted 2 lines · Alex Deucher
for the i2s codec. Since the alsa changes depend on the drm changes, I'd like to take the alsa patches in via the drm tree.
If the ALSA changes depend on the DRM changes I'd expect to see something in Kconfig otherwise I'd expect we'll see either build or link failures? Or is the dependency runtime only (in which case there's no need to worry about it for applying the patches)?
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel