mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 11:18:45 +07:00
f229a93051
This is the work so far on dmaengine for v3.14, it is being cross merged into the Tegra tree to support a large DMA overhaul there. The main additions are a change in the DMA request API which allows better interaction at system startup using deferred probes and methods for overriding the default device and channel names used to request DMA. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.15 (GNU/Linux) iQIcBAABAgAGBQJSqO8IAAoJELSic+t+oim9IaQP/1njSN/W+o8oFwbfG9oeMaES tVrPACPW42zW1SBVBj+px5MBuicaqJ5whH+3wQnpHsnvlT2XbYDdBumf4s2xDMkn dsdEMQpWP++wg+h1gua0ZdYVy8VTVS4WwAbVGmsv4xPxQm0BvhVitIMREyeRbfvq y0JPghp3IPH9XDTvdWUS7sFqr8sVNsyRqTpCt5132YsgYksr8MRwaRnOED4vC8fR asDI9GAlagT3sm3oQ5BU/fNPX37eGQq06y8WlBApZb6lPsechWsTV5iFOD+3bTQ9 aeOD+/urk7mIX8agrrUP8KY81CBSy2y9BzedQngA+M2i0gtqG03+xf1NgG1AcAGq MHoux0e/aCJewbmWacxrDs62LIMS8UpbHUj/clUTErGr04zxtWY3qlZbDRIA57pt x3LMo8/jBv4uh4PpX5I+IYhWB7NI+mDKij2JaSPi8L8+TR/Uk/IwsBZFjgt6Huqy bWmQvJIV92CAV+neLKVw19gAOFGcvGxD6d7hJQscMpig4QItIJ+mwfxBBUf1eaSy ceG9Xe4FDO7IyrV0xcdnuumQ7hbjbWi7YuB1Adw5kPAhJKP7iD/3t8xg97/tN6Od tcIh9EfIjwQarxOconOVQV112ZM8Urzv3LZB8/5HjGJ5tl8uF820+CeLBqEZwBN0 16E/5PWB+3BtbFkK/pd2 =90D4 -----END PGP SIGNATURE----- Merge tag 'asoc-dma-v3.14' into for-3.14/dmas-resets-rework ASoC: dma: Generic ASoC dmaengine driver enhancements This is the work so far on dmaengine for v3.14, it is being cross merged into the Tegra tree to support a large DMA overhaul there. The main additions are a change in the DMA request API which allows better interaction at system startup using deferred probes and methods for overriding the default device and channel names used to request DMA.
128 lines
3.1 KiB
C
128 lines
3.1 KiB
C
/*
|
|
* soc-devres.c -- ALSA SoC Audio Layer devres functions
|
|
*
|
|
* Copyright (C) 2013 Linaro Ltd
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
* under the terms of the GNU General Public License as published by the
|
|
* Free Software Foundation; either version 2 of the License, or (at your
|
|
* option) any later version.
|
|
*/
|
|
|
|
#include <linux/module.h>
|
|
#include <linux/moduleparam.h>
|
|
#include <sound/soc.h>
|
|
#include <sound/dmaengine_pcm.h>
|
|
|
|
static void devm_component_release(struct device *dev, void *res)
|
|
{
|
|
snd_soc_unregister_component(*(struct device **)res);
|
|
}
|
|
|
|
/**
|
|
* devm_snd_soc_register_component - resource managed component registration
|
|
* @dev: Device used to manage component
|
|
* @cmpnt_drv: Component driver
|
|
* @dai_drv: DAI driver
|
|
* @num_dai: Number of DAIs to register
|
|
*
|
|
* Register a component with automatic unregistration when the device is
|
|
* unregistered.
|
|
*/
|
|
int devm_snd_soc_register_component(struct device *dev,
|
|
const struct snd_soc_component_driver *cmpnt_drv,
|
|
struct snd_soc_dai_driver *dai_drv, int num_dai)
|
|
{
|
|
struct device **ptr;
|
|
int ret;
|
|
|
|
ptr = devres_alloc(devm_component_release, sizeof(*ptr), GFP_KERNEL);
|
|
if (!ptr)
|
|
return -ENOMEM;
|
|
|
|
ret = snd_soc_register_component(dev, cmpnt_drv, dai_drv, num_dai);
|
|
if (ret == 0) {
|
|
*ptr = dev;
|
|
devres_add(dev, ptr);
|
|
} else {
|
|
devres_free(ptr);
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
EXPORT_SYMBOL_GPL(devm_snd_soc_register_component);
|
|
|
|
static void devm_card_release(struct device *dev, void *res)
|
|
{
|
|
snd_soc_unregister_card(*(struct snd_soc_card **)res);
|
|
}
|
|
|
|
/**
|
|
* devm_snd_soc_register_card - resource managed card registration
|
|
* @dev: Device used to manage card
|
|
* @card: Card to register
|
|
*
|
|
* Register a card with automatic unregistration when the device is
|
|
* unregistered.
|
|
*/
|
|
int devm_snd_soc_register_card(struct device *dev, struct snd_soc_card *card)
|
|
{
|
|
struct snd_soc_card **ptr;
|
|
int ret;
|
|
|
|
ptr = devres_alloc(devm_card_release, sizeof(*ptr), GFP_KERNEL);
|
|
if (!ptr)
|
|
return -ENOMEM;
|
|
|
|
ret = snd_soc_register_card(card);
|
|
if (ret == 0) {
|
|
*ptr = card;
|
|
devres_add(dev, ptr);
|
|
} else {
|
|
devres_free(ptr);
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
EXPORT_SYMBOL_GPL(devm_snd_soc_register_card);
|
|
|
|
#ifdef CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM
|
|
|
|
static void devm_dmaengine_pcm_release(struct device *dev, void *res)
|
|
{
|
|
snd_dmaengine_pcm_unregister(*(struct device **)res);
|
|
}
|
|
|
|
/**
|
|
* devm_snd_dmaengine_pcm_register - resource managed dmaengine PCM registration
|
|
* @dev: The parent device for the PCM device
|
|
* @config: Platform specific PCM configuration
|
|
* @flags: Platform specific quirks
|
|
*
|
|
* Register a dmaengine based PCM device with automatic unregistration when the
|
|
* device is unregistered.
|
|
*/
|
|
int devm_snd_dmaengine_pcm_register(struct device *dev,
|
|
const struct snd_dmaengine_pcm_config *config, unsigned int flags)
|
|
{
|
|
struct device **ptr;
|
|
int ret;
|
|
|
|
ptr = devres_alloc(devm_dmaengine_pcm_release, sizeof(*ptr), GFP_KERNEL);
|
|
if (!ptr)
|
|
return -ENOMEM;
|
|
|
|
ret = snd_dmaengine_pcm_register(dev, config, flags);
|
|
if (ret == 0) {
|
|
*ptr = dev;
|
|
devres_add(dev, ptr);
|
|
} else {
|
|
devres_free(ptr);
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
EXPORT_SYMBOL_GPL(devm_snd_dmaengine_pcm_register);
|
|
|
|
#endif
|