Commit 72ab3f46 authored by Ge Lei's avatar Ge Lei Committed by Chen Liangjun

ENGR00233570-1 ASRC: Use hook to add support for ASRC loadable

ASoC ESAI machine driver and pcm platform driver use the APIs from mxc_asrc.c,
but once ASRC is used as a loadable module, these files can't find the APIs
from this ko. In this patch, we use 'asrc_p2p_hook' to hook the APIs which will
be used in ASoC ESAI machine driver and pcm platform driver.
Signed-off-by: default avatarGe Lei <>
parent 3a34fe70
......@@ -154,6 +154,8 @@ static unsigned char output_clk_map_v2[] = {
static unsigned char *input_clk_map, *output_clk_map;
struct asrc_p2p_ops asrc_pcm_p2p_ops_asrc;
static struct dma_chan *imx_asrc_dma_alloc(u32 dma_req);
static int imx_asrc_dma_config(
struct asrc_pair_params *params,
......@@ -2060,6 +2062,18 @@ static struct platform_driver mxc_asrc_driver = {
static __init int asrc_init(void)
int ret;
asrc_pcm_p2p_ops_asrc.asrc_p2p_start_conv = asrc_start_conv;
asrc_pcm_p2p_ops_asrc.asrc_p2p_stop_conv = asrc_stop_conv;
asrc_pcm_p2p_ops_asrc.asrc_p2p_get_dma_request = asrc_get_dma_request;
asrc_pcm_p2p_ops_asrc.asrc_p2p_per_addr = asrc_get_per_addr;
asrc_pcm_p2p_ops_asrc.asrc_p2p_req_pair = asrc_req_pair;
asrc_pcm_p2p_ops_asrc.asrc_p2p_config_pair = asrc_config_pair;
asrc_pcm_p2p_ops_asrc.asrc_p2p_release_pair = asrc_release_pair;
asrc_pcm_p2p_ops_asrc.asrc_p2p_finish_conv = asrc_finish_conv;
ret = platform_driver_register(&mxc_asrc_driver);
return ret;
......@@ -2069,6 +2083,8 @@ static __init int asrc_init(void)
*/ static void __exit asrc_exit(void)
......@@ -259,6 +259,19 @@ struct asrc_data {
struct device *dev;
struct asrc_p2p_ops {
void (*asrc_p2p_start_conv)(enum asrc_pair_index);
void (*asrc_p2p_stop_conv)(enum asrc_pair_index);
int (*asrc_p2p_get_dma_request)(enum asrc_pair_index, bool);
u32 (*asrc_p2p_per_addr)(enum asrc_pair_index, bool);
int (*asrc_p2p_req_pair)(int, enum asrc_pair_index *index);
int (*asrc_p2p_config_pair)(struct asrc_config *config);
void (*asrc_p2p_release_pair)(enum asrc_pair_index);
void (*asrc_p2p_finish_conv)(enum asrc_pair_index);
extern void asrc_p2p_hook(struct asrc_p2p_ops *asrc_p2p_ct);
extern int asrc_req_pair(int chn_num, enum asrc_pair_index *index);
extern void asrc_release_pair(enum asrc_pair_index index);
extern int asrc_config_pair(struct asrc_config *config);
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment