2 * Copyright (C) 2007 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 /*******************************************************************************
34 *------------------------------------------------------------------------------
40 *******************************************************************************/
43 /*****************************************************************************
44 * C O M P I L E R F L A G S
45 *****************************************************************************/
48 /*****************************************************************************
49 * E X T E R N A L R E F E R E N C E S
50 *****************************************************************************/
52 #include <linux/dma-mapping.h>
53 #include <linux/init.h>
54 #include <linux/module.h>
55 #include <linux/device.h>
56 #include <linux/platform_device.h>
57 #include <sound/core.h>
58 #include <sound/pcm.h>
59 #include <sound/soc.h>
61 #include "AudDrv_Common.h"
62 #include "AudDrv_Def.h"
63 #include "AudDrv_Afe.h"
64 #include "AudDrv_Ana.h"
65 #include "AudDrv_Clk.h"
66 #include "AudDrv_Kernel.h"
69 /* Conventional and unconventional sample rate supported */
71 static unsigned int supported_sample_rates
[] =
73 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000,
77 static int mt6589_routing_startup(struct snd_pcm_substream
*substream
, struct snd_soc_dai
*Daiport
)
79 printk("mt6589_routing_startup \n");
83 static int mt6589_routing_prepare(struct snd_pcm_substream
*substream
, struct snd_soc_dai
*Daiport
)
85 printk("mt6589_routing_prepare \n ");
89 static int mt6589_routing_trigger(struct snd_pcm_substream
*substream
, int command
,struct snd_soc_dai
*Daiport
)
91 printk("mt6589_routing_trigger command = %d\n ",command
);
95 static const struct snd_soc_dai_ops mtk_routing_ops
=
97 .startup
= mt6589_routing_startup
,
98 .prepare
= mt6589_routing_prepare
,
99 .trigger
= mt6589_routing_trigger
,
102 static struct snd_soc_dai_driver mtk_routing_dai
[] =
106 .stream_name
= MT_SOC_ROUTING_STREAM_NAME
,
107 .rates
= SNDRV_PCM_RATE_8000_48000
,
108 .formats
= SNDRV_PCM_FMTBIT_S16_LE
,
116 .stream_name = MT_SOC_ROUTING_STREAM_NAME,
117 .rates = SNDRV_PCM_RATE_8000_48000,
118 .formats = SNDRV_PCM_FMTBIT_S16_LE,
125 .name
= "PLATOFRM_CONTROL",
126 .ops
= &mtk_routing_ops
,
130 static const struct snd_soc_component_driver dai_routing_component
= {
131 .name
= "PLATOFRM_CONTROL",
134 static int mtk_routing_dev_probe(struct platform_device
*pdev
)
138 printk("mtk_routing_dev_probe name %s\n", dev_name(&pdev
->dev
));
140 pdev
->dev
.coherent_dma_mask
= DMA_BIT_MASK(64);
141 if (pdev
->dev
.dma_mask
== NULL
)
143 pdev
->dev
.dma_mask
= &pdev
->dev
.coherent_dma_mask
;
146 if (pdev
->dev
.of_node
)
148 dev_set_name(&pdev
->dev
, "%s", MT_SOC_ROUTING_DAI_NAME
);
150 printk("%s: dev name %s\n", __func__
, dev_name(&pdev
->dev
));
152 rc
= snd_soc_register_component(&pdev
->dev
, &dai_routing_component
,
153 mtk_routing_dai
, ARRAY_SIZE(mtk_routing_dai
));
157 static int mtk_routing_dev_remove(struct platform_device
*pdev
)
159 printk("%s:\n", __func__
);
161 snd_soc_unregister_component(&pdev
->dev
);
167 static const struct of_device_id mt_soc_dai_routing_of_ids
[] =
169 { .compatible
= "mediatek,mt_soc_dai_routing", },
174 static struct platform_driver mtk_routing_driver
=
176 .probe
= mtk_routing_dev_probe
,
177 .remove
= mtk_routing_dev_remove
,
179 .name
= MT_SOC_ROUTING_DAI_NAME
,
180 .owner
= THIS_MODULE
,
182 .of_match_table
= mt_soc_dai_routing_of_ids
,
188 static struct platform_device
*soc_routing_dev
;
191 static int __init
mtk_routing_init(void)
193 printk("%s:\n", __func__
);
196 soc_routing_dev
= platform_device_alloc(MT_SOC_ROUTING_DAI_NAME
, -1);
197 if (!soc_routing_dev
)
202 ret
= platform_device_add(soc_routing_dev
);
205 platform_device_put(soc_routing_dev
);
209 return platform_driver_register(&mtk_routing_driver
);
211 module_init(mtk_routing_init
);
213 static void __exit
mtk_routing_exit(void)
215 printk("%s:\n", __func__
);
217 platform_driver_unregister(&mtk_routing_driver
);
220 module_exit(mtk_routing_exit
);
222 /* Module information */
223 MODULE_DESCRIPTION("MTK Routing driver");
224 MODULE_LICENSE("GPL v2");