diff options
author | Mark Farrugia <mark.farrugia@fiberdyne.com.au> | 2018-10-07 22:00:10 +1100 |
---|---|---|
committer | Mark Farrugia <mark.farrugia@fiberdyne.com.au> | 2018-10-26 17:27:38 +1100 |
commit | 0acef1799beace4dd38d41bda9df77e84a5fe398 (patch) | |
tree | a7d85c3b49db82b2cd1789b49c8860a562a4805b | |
parent | f834eb7b0799a4678639d2a9f71c1dc4352469ce (diff) |
Remove blocksize from audiopath
This is no longer needed in AVIRT, since it is only actually used for the ADSP Audio Path.
Clean up white space, add function documentation, remove out of place debug prints
Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
-rw-r--r-- | alsa-pcm.c | 13 | ||||
-rw-r--r-- | core.c | 5 | ||||
-rw-r--r-- | core.h | 21 | ||||
-rw-r--r-- | core_internal.h | 10 | ||||
-rw-r--r-- | dummy/dummy.c | 1 | ||||
-rw-r--r-- | loopback/loopback.c | 2 |
6 files changed, 24 insertions, 28 deletions
@@ -49,7 +49,7 @@ static int pcm_open(struct snd_pcm_substream *substream) struct avirt_audiopath *audiopath; struct avirt_stream *stream; struct snd_pcm_hardware *hw; - unsigned int bytes_per_sample = 0, blocksize = 0, chans = 0; + unsigned int chans = 0; char *uid = "ap_fddsp"; // TD MF: Make this dynamic! audiopath = avirt_audiopath_get(uid); @@ -57,20 +57,9 @@ static int pcm_open(struct snd_pcm_substream *substream) uid); substream->private_data = audiopath; - blocksize = audiopath->blocksize; - // Copy the hw params from the audiopath to the pcm hw = &substream->runtime->hw; memcpy(hw, audiopath->hw, sizeof(struct snd_pcm_hardware)); - pr_info("%s %d %d", __func__, blocksize, hw->periods_max); - - if (hw->formats == SNDRV_PCM_FMTBIT_S16_LE) { - bytes_per_sample = 2; - } else { - pr_err("[%s] PCM only supports SNDRV_PCM_FMTBIT_S16_LE", - __func__); - return -EINVAL; - } stream = __avirt_stream_find_by_device(substream->pcm->device); if (IS_ERR_VALUE(stream) || !stream) @@ -241,9 +241,8 @@ int avirt_audiopath_register(struct avirt_audiopath *audiopath, audiopath_obj->path = audiopath; audiopath->context = audiopath_obj; - pr_info("Registered new Audio Path: %s\n", audiopath->uid); - pr_info("\tBlocksize: %d, Periods: %d\n", audiopath->blocksize, - audiopath->hw->periods_max); + D_INFOK("Registered new Audio Path: %s", audiopath->name); + list_add_tail(&audiopath_obj->list, &audiopath_list); // If we have already sealed the streams, configure this AP @@ -28,12 +28,11 @@ typedef int (*avirt_audiopath_configure)(struct config_group *stream_group, * AVIRT Audio Path info */ struct avirt_audiopath { - const char *uid; /* Unique identifier */ - const char *name; /* Pretty name */ - unsigned int version[3]; /* Version - Major.Minor.Ext */ - struct snd_pcm_hardware *hw; /* ALSA PCM HW conf */ - struct snd_pcm_ops *pcm_ops; /* ALSA PCM op table */ - unsigned int blocksize; /* Audio frame size accepted */ + const char *uid; /* Unique identifier */ + const char *name; /* Pretty name */ + unsigned int version[3]; /* Version - Major.Minor.Ext */ + const struct snd_pcm_hardware *hw; /* ALSA PCM HW conf */ + const struct snd_pcm_ops *pcm_ops; /* ALSA PCM op table */ avirt_audiopath_configure configure; /* Configure callback function */ void *context; @@ -44,10 +43,10 @@ struct avirt_audiopath { */ struct avirt_stream { char name[MAX_NAME_LEN]; /* Stream name */ - char map[MAX_NAME_LEN]; /* Stream Audio Path mapping */ - unsigned int channels; /* Stream channel count */ - unsigned int device; /* Stream PCM device no. */ - unsigned int direction; /* Stream direction */ + char map[MAX_NAME_LEN]; /* Stream Audio Path mapping */ + unsigned int channels; /* Stream channel count */ + unsigned int device; /* Stream PCM device no. */ + unsigned int direction; /* Stream direction */ struct config_item item; /* configfs item reference */ }; @@ -94,7 +93,7 @@ int avirt_stream_count(unsigned int direction); * @return: The item's avirt_stream if successful, NULL otherwise */ static inline struct avirt_stream * -avirt_stream_from_config_item(struct config_item *item) + avirt_stream_from_config_item(struct config_item *item) { return item ? container_of(item, struct avirt_stream, item) : NULL; } diff --git a/core_internal.h b/core_internal.h index e7bea07..5979a50 100644 --- a/core_internal.h +++ b/core_internal.h @@ -23,7 +23,17 @@ struct avirt_core { bool streams_sealed; }; +/** + * __avirt_configfs_init - Initialise the configfs system + * @core: The avirt_core pointer + * @return: 0 on success, negative ERRNO on failure + */ int __init __avirt_configfs_init(struct avirt_core *core); + +/** + * __avirt_configfs_exit - Clean up and exit the configfs system + * @core: The avirt_core pointer + */ void __exit __avirt_configfs_exit(struct avirt_core *core); /** diff --git a/dummy/dummy.c b/dummy/dummy.c index 606b22d..8808e8e 100644 --- a/dummy/dummy.c +++ b/dummy/dummy.c @@ -268,7 +268,6 @@ static struct avirt_audiopath dummyap_module = { .version = { 0, 0, 1 }, .hw = &dummyap_hw, .pcm_ops = &dummyap_pcm_ops, - .blocksize = DUMMY_BLOCKSIZE, .configure = dummy_configure, }; diff --git a/loopback/loopback.c b/loopback/loopback.c index 5694dce..e9c4bcb 100644 --- a/loopback/loopback.c +++ b/loopback/loopback.c @@ -279,7 +279,7 @@ static struct avirt_audiopath loopbackap_module = { .value = 10, .hw = &loopbackap_hw, .pcm_ops = &loopbackap_pcm_ops, - .blocksize = 512, + .configure = loopback_configure, }; static int __init loopback_init(void) |