]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ENGR00233570-1 ASRC: Use hook to add support for ASRC loadable
authorGe Lei <b42127@freescale.com>
Thu, 15 Nov 2012 06:46:19 +0000 (14:46 +0800)
committerOliver Wendt <ow@karo-electronics.de>
Mon, 30 Sep 2013 12:13:25 +0000 (14:13 +0200)
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: Ge Lei <b42127@freescale.com>
drivers/mxc/asrc/mxc_asrc.c
include/linux/mxc_asrc.h

index d7edf78cc87d9fb2d789c3f4233e6ee936bfe067..6c5daed7ce53bb12b85d365e330aa1662b838334 100644 (file)
@@ -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;
+
+       asrc_p2p_hook(&asrc_pcm_p2p_ops_asrc);
+
        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)
 {
+       asrc_p2p_hook(NULL);
+
        platform_driver_unregister(&mxc_asrc_driver);
        return;
 }
index 72817e6ece0f53f5d24aa8dbc9dc849ca77000c5..37c64b7c2200bf21db9faca0a44775675db1dc59 100644 (file)
@@ -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);