fsl_asrc.c 29 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058
  1. /*
  2. * Freescale ASRC ALSA SoC Digital Audio Interface (DAI) driver
  3. *
  4. * Copyright (C) 2014 Freescale Semiconductor, Inc.
  5. *
  6. * Author: Nicolin Chen <nicoleotsuka@gmail.com>
  7. *
  8. * This file is licensed under the terms of the GNU General Public License
  9. * version 2. This program is licensed "as is" without any warranty of any
  10. * kind, whether express or implied.
  11. */
  12. #include <linux/clk.h>
  13. #include <linux/delay.h>
  14. #include <linux/dma-mapping.h>
  15. #include <linux/module.h>
  16. #include <linux/of_platform.h>
  17. #include <linux/platform_data/dma-imx.h>
  18. #include <linux/pm_runtime.h>
  19. #include <sound/dmaengine_pcm.h>
  20. #include <sound/pcm_params.h>
  21. #include "fsl_asrc.h"
  22. #define IDEAL_RATIO_DECIMAL_DEPTH 26
  23. #define pair_err(fmt, ...) \
  24. dev_err(&asrc_priv->pdev->dev, "Pair %c: " fmt, 'A' + index, ##__VA_ARGS__)
  25. #define pair_dbg(fmt, ...) \
  26. dev_dbg(&asrc_priv->pdev->dev, "Pair %c: " fmt, 'A' + index, ##__VA_ARGS__)
  27. /* Sample rates are aligned with that defined in pcm.h file */
  28. static const u8 process_option[][12][2] = {
  29. /* 8kHz 11.025kHz 16kHz 22.05kHz 32kHz 44.1kHz 48kHz 64kHz 88.2kHz 96kHz 176kHz 192kHz */
  30. {{0, 1}, {0, 1}, {0, 1}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},}, /* 5512Hz */
  31. {{0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},}, /* 8kHz */
  32. {{0, 2}, {0, 1}, {0, 1}, {0, 1}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},}, /* 11025Hz */
  33. {{1, 2}, {0, 2}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},}, /* 16kHz */
  34. {{1, 2}, {1, 2}, {0, 2}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},}, /* 22050Hz */
  35. {{1, 2}, {2, 1}, {2, 1}, {0, 2}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 0}, {0, 0}, {0, 0},}, /* 32kHz */
  36. {{2, 2}, {2, 2}, {2, 1}, {2, 1}, {0, 2}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 0}, {0, 0},}, /* 44.1kHz */
  37. {{2, 2}, {2, 2}, {2, 1}, {2, 1}, {0, 2}, {0, 2}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 0}, {0, 0},}, /* 48kHz */
  38. {{2, 2}, {2, 2}, {2, 2}, {2, 1}, {1, 2}, {0, 2}, {0, 2}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 0},}, /* 64kHz */
  39. {{2, 2}, {2, 2}, {2, 2}, {2, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1},}, /* 88.2kHz */
  40. {{2, 2}, {2, 2}, {2, 2}, {2, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1},}, /* 96kHz */
  41. {{2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 1}, {2, 1}, {2, 1}, {2, 1}, {2, 1},}, /* 176kHz */
  42. {{2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 1}, {2, 1}, {2, 1}, {2, 1}, {2, 1},}, /* 192kHz */
  43. };
  44. /* Corresponding to process_option */
  45. static int supported_input_rate[] = {
  46. 5512, 8000, 11025, 16000, 22050, 32000, 44100, 48000, 64000, 88200,
  47. 96000, 176400, 192000,
  48. };
  49. static int supported_asrc_rate[] = {
  50. 8000, 11025, 16000, 22050, 32000, 44100, 48000, 64000, 88200, 96000, 176400, 192000,
  51. };
  52. /**
  53. * The following tables map the relationship between asrc_inclk/asrc_outclk in
  54. * fsl_asrc.h and the registers of ASRCSR
  55. */
  56. static unsigned char input_clk_map_imx35[] = {
  57. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf,
  58. };
  59. static unsigned char output_clk_map_imx35[] = {
  60. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf,
  61. };
  62. /* i.MX53 uses the same map for input and output */
  63. static unsigned char input_clk_map_imx53[] = {
  64. /* 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf */
  65. 0x0, 0x1, 0x2, 0x7, 0x4, 0x5, 0x6, 0x3, 0x8, 0x9, 0xa, 0xb, 0xc, 0xf, 0xe, 0xd,
  66. };
  67. static unsigned char output_clk_map_imx53[] = {
  68. /* 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf */
  69. 0x8, 0x9, 0xa, 0x7, 0xc, 0x5, 0x6, 0xb, 0x0, 0x1, 0x2, 0x3, 0x4, 0xf, 0xe, 0xd,
  70. };
  71. static unsigned char *clk_map[2];
  72. /**
  73. * Request ASRC pair
  74. *
  75. * It assigns pair by the order of A->C->B because allocation of pair B,
  76. * within range [ANCA, ANCA+ANCB-1], depends on the channels of pair A
  77. * while pair A and pair C are comparatively independent.
  78. */
  79. static int fsl_asrc_request_pair(int channels, struct fsl_asrc_pair *pair)
  80. {
  81. enum asrc_pair_index index = ASRC_INVALID_PAIR;
  82. struct fsl_asrc *asrc_priv = pair->asrc_priv;
  83. struct device *dev = &asrc_priv->pdev->dev;
  84. unsigned long lock_flags;
  85. int i, ret = 0;
  86. spin_lock_irqsave(&asrc_priv->lock, lock_flags);
  87. for (i = ASRC_PAIR_A; i < ASRC_PAIR_MAX_NUM; i++) {
  88. if (asrc_priv->pair[i] != NULL)
  89. continue;
  90. index = i;
  91. if (i != ASRC_PAIR_B)
  92. break;
  93. }
  94. if (index == ASRC_INVALID_PAIR) {
  95. dev_err(dev, "all pairs are busy now\n");
  96. ret = -EBUSY;
  97. } else if (asrc_priv->channel_avail < channels) {
  98. dev_err(dev, "can't afford required channels: %d\n", channels);
  99. ret = -EINVAL;
  100. } else {
  101. asrc_priv->channel_avail -= channels;
  102. asrc_priv->pair[index] = pair;
  103. pair->channels = channels;
  104. pair->index = index;
  105. }
  106. spin_unlock_irqrestore(&asrc_priv->lock, lock_flags);
  107. return ret;
  108. }
  109. /**
  110. * Release ASRC pair
  111. *
  112. * It clears the resource from asrc_priv and releases the occupied channels.
  113. */
  114. static void fsl_asrc_release_pair(struct fsl_asrc_pair *pair)
  115. {
  116. struct fsl_asrc *asrc_priv = pair->asrc_priv;
  117. enum asrc_pair_index index = pair->index;
  118. unsigned long lock_flags;
  119. /* Make sure the pair is disabled */
  120. regmap_update_bits(asrc_priv->regmap, REG_ASRCTR,
  121. ASRCTR_ASRCEi_MASK(index), 0);
  122. spin_lock_irqsave(&asrc_priv->lock, lock_flags);
  123. asrc_priv->channel_avail += pair->channels;
  124. asrc_priv->pair[index] = NULL;
  125. pair->error = 0;
  126. spin_unlock_irqrestore(&asrc_priv->lock, lock_flags);
  127. }
  128. /**
  129. * Configure input and output thresholds
  130. */
  131. static void fsl_asrc_set_watermarks(struct fsl_asrc_pair *pair, u32 in, u32 out)
  132. {
  133. struct fsl_asrc *asrc_priv = pair->asrc_priv;
  134. enum asrc_pair_index index = pair->index;
  135. regmap_update_bits(asrc_priv->regmap, REG_ASRMCR(index),
  136. ASRMCRi_EXTTHRSHi_MASK |
  137. ASRMCRi_INFIFO_THRESHOLD_MASK |
  138. ASRMCRi_OUTFIFO_THRESHOLD_MASK,
  139. ASRMCRi_EXTTHRSHi |
  140. ASRMCRi_INFIFO_THRESHOLD(in) |
  141. ASRMCRi_OUTFIFO_THRESHOLD(out));
  142. }
  143. /**
  144. * Calculate the total divisor between asrck clock rate and sample rate
  145. *
  146. * It follows the formula clk_rate = samplerate * (2 ^ prescaler) * divider
  147. */
  148. static u32 fsl_asrc_cal_asrck_divisor(struct fsl_asrc_pair *pair, u32 div)
  149. {
  150. u32 ps;
  151. /* Calculate the divisors: prescaler [2^0, 2^7], divder [1, 8] */
  152. for (ps = 0; div > 8; ps++)
  153. div >>= 1;
  154. return ((div - 1) << ASRCDRi_AxCPi_WIDTH) | ps;
  155. }
  156. /**
  157. * Calculate and set the ratio for Ideal Ratio mode only
  158. *
  159. * The ratio is a 32-bit fixed point value with 26 fractional bits.
  160. */
  161. static int fsl_asrc_set_ideal_ratio(struct fsl_asrc_pair *pair,
  162. int inrate, int outrate)
  163. {
  164. struct fsl_asrc *asrc_priv = pair->asrc_priv;
  165. enum asrc_pair_index index = pair->index;
  166. unsigned long ratio;
  167. int i;
  168. if (!outrate) {
  169. pair_err("output rate should not be zero\n");
  170. return -EINVAL;
  171. }
  172. /* Calculate the intergal part of the ratio */
  173. ratio = (inrate / outrate) << IDEAL_RATIO_DECIMAL_DEPTH;
  174. /* ... and then the 26 depth decimal part */
  175. inrate %= outrate;
  176. for (i = 1; i <= IDEAL_RATIO_DECIMAL_DEPTH; i++) {
  177. inrate <<= 1;
  178. if (inrate < outrate)
  179. continue;
  180. ratio |= 1 << (IDEAL_RATIO_DECIMAL_DEPTH - i);
  181. inrate -= outrate;
  182. if (!inrate)
  183. break;
  184. }
  185. regmap_write(asrc_priv->regmap, REG_ASRIDRL(index), ratio);
  186. regmap_write(asrc_priv->regmap, REG_ASRIDRH(index), ratio >> 24);
  187. return 0;
  188. }
  189. /**
  190. * Configure the assigned ASRC pair
  191. *
  192. * It configures those ASRC registers according to a configuration instance
  193. * of struct asrc_config which includes in/output sample rate, width, channel
  194. * and clock settings.
  195. */
  196. static int fsl_asrc_config_pair(struct fsl_asrc_pair *pair)
  197. {
  198. struct asrc_config *config = pair->config;
  199. struct fsl_asrc *asrc_priv = pair->asrc_priv;
  200. enum asrc_pair_index index = pair->index;
  201. u32 inrate, outrate, indiv, outdiv;
  202. u32 clk_index[2], div[2];
  203. int in, out, channels;
  204. struct clk *clk;
  205. bool ideal;
  206. if (!config) {
  207. pair_err("invalid pair config\n");
  208. return -EINVAL;
  209. }
  210. /* Validate channels */
  211. if (config->channel_num < 1 || config->channel_num > 10) {
  212. pair_err("does not support %d channels\n", config->channel_num);
  213. return -EINVAL;
  214. }
  215. /* Validate output width */
  216. if (config->output_word_width == ASRC_WIDTH_8_BIT) {
  217. pair_err("does not support 8bit width output\n");
  218. return -EINVAL;
  219. }
  220. inrate = config->input_sample_rate;
  221. outrate = config->output_sample_rate;
  222. ideal = config->inclk == INCLK_NONE;
  223. /* Validate input and output sample rates */
  224. for (in = 0; in < ARRAY_SIZE(supported_input_rate); in++)
  225. if (inrate == supported_input_rate[in])
  226. break;
  227. if (in == ARRAY_SIZE(supported_input_rate)) {
  228. pair_err("unsupported input sample rate: %dHz\n", inrate);
  229. return -EINVAL;
  230. }
  231. for (out = 0; out < ARRAY_SIZE(supported_asrc_rate); out++)
  232. if (outrate == supported_asrc_rate[out])
  233. break;
  234. if (out == ARRAY_SIZE(supported_asrc_rate)) {
  235. pair_err("unsupported output sample rate: %dHz\n", outrate);
  236. return -EINVAL;
  237. }
  238. if ((outrate > 8000 && outrate < 30000) &&
  239. (outrate/inrate > 24 || inrate/outrate > 8)) {
  240. pair_err("exceed supported ratio range [1/24, 8] for \
  241. inrate/outrate: %d/%d\n", inrate, outrate);
  242. return -EINVAL;
  243. }
  244. /* Validate input and output clock sources */
  245. clk_index[IN] = clk_map[IN][config->inclk];
  246. clk_index[OUT] = clk_map[OUT][config->outclk];
  247. /* We only have output clock for ideal ratio mode */
  248. clk = asrc_priv->asrck_clk[clk_index[ideal ? OUT : IN]];
  249. div[IN] = clk_get_rate(clk) / inrate;
  250. if (div[IN] == 0) {
  251. pair_err("failed to support input sample rate %dHz by asrck_%x\n",
  252. inrate, clk_index[ideal ? OUT : IN]);
  253. return -EINVAL;
  254. }
  255. clk = asrc_priv->asrck_clk[clk_index[OUT]];
  256. /* Use fixed output rate for Ideal Ratio mode (INCLK_NONE) */
  257. if (ideal)
  258. div[OUT] = clk_get_rate(clk) / IDEAL_RATIO_RATE;
  259. else
  260. div[OUT] = clk_get_rate(clk) / outrate;
  261. if (div[OUT] == 0) {
  262. pair_err("failed to support output sample rate %dHz by asrck_%x\n",
  263. outrate, clk_index[OUT]);
  264. return -EINVAL;
  265. }
  266. /* Set the channel number */
  267. channels = config->channel_num;
  268. if (asrc_priv->channel_bits < 4)
  269. channels /= 2;
  270. /* Update channels for current pair */
  271. regmap_update_bits(asrc_priv->regmap, REG_ASRCNCR,
  272. ASRCNCR_ANCi_MASK(index, asrc_priv->channel_bits),
  273. ASRCNCR_ANCi(index, channels, asrc_priv->channel_bits));
  274. /* Default setting: Automatic selection for processing mode */
  275. regmap_update_bits(asrc_priv->regmap, REG_ASRCTR,
  276. ASRCTR_ATSi_MASK(index), ASRCTR_ATS(index));
  277. regmap_update_bits(asrc_priv->regmap, REG_ASRCTR,
  278. ASRCTR_USRi_MASK(index), 0);
  279. /* Set the input and output clock sources */
  280. regmap_update_bits(asrc_priv->regmap, REG_ASRCSR,
  281. ASRCSR_AICSi_MASK(index) | ASRCSR_AOCSi_MASK(index),
  282. ASRCSR_AICS(index, clk_index[IN]) |
  283. ASRCSR_AOCS(index, clk_index[OUT]));
  284. /* Calculate the input clock divisors */
  285. indiv = fsl_asrc_cal_asrck_divisor(pair, div[IN]);
  286. outdiv = fsl_asrc_cal_asrck_divisor(pair, div[OUT]);
  287. /* Suppose indiv and outdiv includes prescaler, so add its MASK too */
  288. regmap_update_bits(asrc_priv->regmap, REG_ASRCDR(index),
  289. ASRCDRi_AOCPi_MASK(index) | ASRCDRi_AICPi_MASK(index) |
  290. ASRCDRi_AOCDi_MASK(index) | ASRCDRi_AICDi_MASK(index),
  291. ASRCDRi_AOCP(index, outdiv) | ASRCDRi_AICP(index, indiv));
  292. /* Implement word_width configurations */
  293. regmap_update_bits(asrc_priv->regmap, REG_ASRMCR1(index),
  294. ASRMCR1i_OW16_MASK | ASRMCR1i_IWD_MASK,
  295. ASRMCR1i_OW16(config->output_word_width) |
  296. ASRMCR1i_IWD(config->input_word_width));
  297. /* Enable BUFFER STALL */
  298. regmap_update_bits(asrc_priv->regmap, REG_ASRMCR(index),
  299. ASRMCRi_BUFSTALLi_MASK, ASRMCRi_BUFSTALLi);
  300. /* Set default thresholds for input and output FIFO */
  301. fsl_asrc_set_watermarks(pair, ASRC_INPUTFIFO_THRESHOLD,
  302. ASRC_INPUTFIFO_THRESHOLD);
  303. /* Configure the followings only for Ideal Ratio mode */
  304. if (!ideal)
  305. return 0;
  306. /* Clear ASTSx bit to use Ideal Ratio mode */
  307. regmap_update_bits(asrc_priv->regmap, REG_ASRCTR,
  308. ASRCTR_ATSi_MASK(index), 0);
  309. /* Enable Ideal Ratio mode */
  310. regmap_update_bits(asrc_priv->regmap, REG_ASRCTR,
  311. ASRCTR_IDRi_MASK(index) | ASRCTR_USRi_MASK(index),
  312. ASRCTR_IDR(index) | ASRCTR_USR(index));
  313. /* Apply configurations for pre- and post-processing */
  314. regmap_update_bits(asrc_priv->regmap, REG_ASRCFG,
  315. ASRCFG_PREMODi_MASK(index) | ASRCFG_POSTMODi_MASK(index),
  316. ASRCFG_PREMOD(index, process_option[in][out][0]) |
  317. ASRCFG_POSTMOD(index, process_option[in][out][1]));
  318. return fsl_asrc_set_ideal_ratio(pair, inrate, outrate);
  319. }
  320. /**
  321. * Start the assigned ASRC pair
  322. *
  323. * It enables the assigned pair and makes it stopped at the stall level.
  324. */
  325. static void fsl_asrc_start_pair(struct fsl_asrc_pair *pair)
  326. {
  327. struct fsl_asrc *asrc_priv = pair->asrc_priv;
  328. enum asrc_pair_index index = pair->index;
  329. int reg, retry = 10, i;
  330. /* Enable the current pair */
  331. regmap_update_bits(asrc_priv->regmap, REG_ASRCTR,
  332. ASRCTR_ASRCEi_MASK(index), ASRCTR_ASRCE(index));
  333. /* Wait for status of initialization */
  334. do {
  335. udelay(5);
  336. regmap_read(asrc_priv->regmap, REG_ASRCFG, &reg);
  337. reg &= ASRCFG_INIRQi_MASK(index);
  338. } while (!reg && --retry);
  339. /* Make the input fifo to ASRC STALL level */
  340. regmap_read(asrc_priv->regmap, REG_ASRCNCR, &reg);
  341. for (i = 0; i < pair->channels * 4; i++)
  342. regmap_write(asrc_priv->regmap, REG_ASRDI(index), 0);
  343. /* Enable overload interrupt */
  344. regmap_write(asrc_priv->regmap, REG_ASRIER, ASRIER_AOLIE);
  345. }
  346. /**
  347. * Stop the assigned ASRC pair
  348. */
  349. static void fsl_asrc_stop_pair(struct fsl_asrc_pair *pair)
  350. {
  351. struct fsl_asrc *asrc_priv = pair->asrc_priv;
  352. enum asrc_pair_index index = pair->index;
  353. /* Stop the current pair */
  354. regmap_update_bits(asrc_priv->regmap, REG_ASRCTR,
  355. ASRCTR_ASRCEi_MASK(index), 0);
  356. }
  357. /**
  358. * Get DMA channel according to the pair and direction.
  359. */
  360. struct dma_chan *fsl_asrc_get_dma_channel(struct fsl_asrc_pair *pair, bool dir)
  361. {
  362. struct fsl_asrc *asrc_priv = pair->asrc_priv;
  363. enum asrc_pair_index index = pair->index;
  364. char name[4];
  365. sprintf(name, "%cx%c", dir == IN ? 'r' : 't', index + 'a');
  366. return dma_request_slave_channel(&asrc_priv->pdev->dev, name);
  367. }
  368. EXPORT_SYMBOL_GPL(fsl_asrc_get_dma_channel);
  369. static int fsl_asrc_dai_hw_params(struct snd_pcm_substream *substream,
  370. struct snd_pcm_hw_params *params,
  371. struct snd_soc_dai *dai)
  372. {
  373. struct fsl_asrc *asrc_priv = snd_soc_dai_get_drvdata(dai);
  374. int width = params_width(params);
  375. struct snd_pcm_runtime *runtime = substream->runtime;
  376. struct fsl_asrc_pair *pair = runtime->private_data;
  377. unsigned int channels = params_channels(params);
  378. unsigned int rate = params_rate(params);
  379. struct asrc_config config;
  380. int word_width, ret;
  381. ret = fsl_asrc_request_pair(channels, pair);
  382. if (ret) {
  383. dev_err(dai->dev, "fail to request asrc pair\n");
  384. return ret;
  385. }
  386. pair->config = &config;
  387. if (width == 16)
  388. width = ASRC_WIDTH_16_BIT;
  389. else
  390. width = ASRC_WIDTH_24_BIT;
  391. if (asrc_priv->asrc_width == 16)
  392. word_width = ASRC_WIDTH_16_BIT;
  393. else
  394. word_width = ASRC_WIDTH_24_BIT;
  395. config.pair = pair->index;
  396. config.channel_num = channels;
  397. config.inclk = INCLK_NONE;
  398. config.outclk = OUTCLK_ASRCK1_CLK;
  399. if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
  400. config.input_word_width = width;
  401. config.output_word_width = word_width;
  402. config.input_sample_rate = rate;
  403. config.output_sample_rate = asrc_priv->asrc_rate;
  404. } else {
  405. config.input_word_width = word_width;
  406. config.output_word_width = width;
  407. config.input_sample_rate = asrc_priv->asrc_rate;
  408. config.output_sample_rate = rate;
  409. }
  410. ret = fsl_asrc_config_pair(pair);
  411. if (ret) {
  412. dev_err(dai->dev, "fail to config asrc pair\n");
  413. return ret;
  414. }
  415. return 0;
  416. }
  417. static int fsl_asrc_dai_hw_free(struct snd_pcm_substream *substream,
  418. struct snd_soc_dai *dai)
  419. {
  420. struct snd_pcm_runtime *runtime = substream->runtime;
  421. struct fsl_asrc_pair *pair = runtime->private_data;
  422. if (pair)
  423. fsl_asrc_release_pair(pair);
  424. return 0;
  425. }
  426. static int fsl_asrc_dai_trigger(struct snd_pcm_substream *substream, int cmd,
  427. struct snd_soc_dai *dai)
  428. {
  429. struct snd_pcm_runtime *runtime = substream->runtime;
  430. struct fsl_asrc_pair *pair = runtime->private_data;
  431. switch (cmd) {
  432. case SNDRV_PCM_TRIGGER_START:
  433. case SNDRV_PCM_TRIGGER_RESUME:
  434. case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
  435. fsl_asrc_start_pair(pair);
  436. break;
  437. case SNDRV_PCM_TRIGGER_STOP:
  438. case SNDRV_PCM_TRIGGER_SUSPEND:
  439. case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
  440. fsl_asrc_stop_pair(pair);
  441. break;
  442. default:
  443. return -EINVAL;
  444. }
  445. return 0;
  446. }
  447. static struct snd_soc_dai_ops fsl_asrc_dai_ops = {
  448. .hw_params = fsl_asrc_dai_hw_params,
  449. .hw_free = fsl_asrc_dai_hw_free,
  450. .trigger = fsl_asrc_dai_trigger,
  451. };
  452. static int fsl_asrc_dai_probe(struct snd_soc_dai *dai)
  453. {
  454. struct fsl_asrc *asrc_priv = snd_soc_dai_get_drvdata(dai);
  455. snd_soc_dai_init_dma_data(dai, &asrc_priv->dma_params_tx,
  456. &asrc_priv->dma_params_rx);
  457. return 0;
  458. }
  459. #define FSL_ASRC_RATES SNDRV_PCM_RATE_8000_192000
  460. #define FSL_ASRC_FORMATS (SNDRV_PCM_FMTBIT_S24_LE | \
  461. SNDRV_PCM_FMTBIT_S16_LE | \
  462. SNDRV_PCM_FMTBIT_S20_3LE)
  463. static struct snd_soc_dai_driver fsl_asrc_dai = {
  464. .probe = fsl_asrc_dai_probe,
  465. .playback = {
  466. .stream_name = "ASRC-Playback",
  467. .channels_min = 1,
  468. .channels_max = 10,
  469. .rates = FSL_ASRC_RATES,
  470. .formats = FSL_ASRC_FORMATS,
  471. },
  472. .capture = {
  473. .stream_name = "ASRC-Capture",
  474. .channels_min = 1,
  475. .channels_max = 10,
  476. .rates = FSL_ASRC_RATES,
  477. .formats = FSL_ASRC_FORMATS,
  478. },
  479. .ops = &fsl_asrc_dai_ops,
  480. };
  481. static const struct snd_soc_component_driver fsl_asrc_component = {
  482. .name = "fsl-asrc-dai",
  483. };
  484. static bool fsl_asrc_readable_reg(struct device *dev, unsigned int reg)
  485. {
  486. switch (reg) {
  487. case REG_ASRCTR:
  488. case REG_ASRIER:
  489. case REG_ASRCNCR:
  490. case REG_ASRCFG:
  491. case REG_ASRCSR:
  492. case REG_ASRCDR1:
  493. case REG_ASRCDR2:
  494. case REG_ASRSTR:
  495. case REG_ASRPM1:
  496. case REG_ASRPM2:
  497. case REG_ASRPM3:
  498. case REG_ASRPM4:
  499. case REG_ASRPM5:
  500. case REG_ASRTFR1:
  501. case REG_ASRCCR:
  502. case REG_ASRDOA:
  503. case REG_ASRDOB:
  504. case REG_ASRDOC:
  505. case REG_ASRIDRHA:
  506. case REG_ASRIDRLA:
  507. case REG_ASRIDRHB:
  508. case REG_ASRIDRLB:
  509. case REG_ASRIDRHC:
  510. case REG_ASRIDRLC:
  511. case REG_ASR76K:
  512. case REG_ASR56K:
  513. case REG_ASRMCRA:
  514. case REG_ASRFSTA:
  515. case REG_ASRMCRB:
  516. case REG_ASRFSTB:
  517. case REG_ASRMCRC:
  518. case REG_ASRFSTC:
  519. case REG_ASRMCR1A:
  520. case REG_ASRMCR1B:
  521. case REG_ASRMCR1C:
  522. return true;
  523. default:
  524. return false;
  525. }
  526. }
  527. static bool fsl_asrc_volatile_reg(struct device *dev, unsigned int reg)
  528. {
  529. switch (reg) {
  530. case REG_ASRSTR:
  531. case REG_ASRDIA:
  532. case REG_ASRDIB:
  533. case REG_ASRDIC:
  534. case REG_ASRDOA:
  535. case REG_ASRDOB:
  536. case REG_ASRDOC:
  537. case REG_ASRFSTA:
  538. case REG_ASRFSTB:
  539. case REG_ASRFSTC:
  540. case REG_ASRCFG:
  541. return true;
  542. default:
  543. return false;
  544. }
  545. }
  546. static bool fsl_asrc_writeable_reg(struct device *dev, unsigned int reg)
  547. {
  548. switch (reg) {
  549. case REG_ASRCTR:
  550. case REG_ASRIER:
  551. case REG_ASRCNCR:
  552. case REG_ASRCFG:
  553. case REG_ASRCSR:
  554. case REG_ASRCDR1:
  555. case REG_ASRCDR2:
  556. case REG_ASRSTR:
  557. case REG_ASRPM1:
  558. case REG_ASRPM2:
  559. case REG_ASRPM3:
  560. case REG_ASRPM4:
  561. case REG_ASRPM5:
  562. case REG_ASRTFR1:
  563. case REG_ASRCCR:
  564. case REG_ASRDIA:
  565. case REG_ASRDIB:
  566. case REG_ASRDIC:
  567. case REG_ASRIDRHA:
  568. case REG_ASRIDRLA:
  569. case REG_ASRIDRHB:
  570. case REG_ASRIDRLB:
  571. case REG_ASRIDRHC:
  572. case REG_ASRIDRLC:
  573. case REG_ASR76K:
  574. case REG_ASR56K:
  575. case REG_ASRMCRA:
  576. case REG_ASRMCRB:
  577. case REG_ASRMCRC:
  578. case REG_ASRMCR1A:
  579. case REG_ASRMCR1B:
  580. case REG_ASRMCR1C:
  581. return true;
  582. default:
  583. return false;
  584. }
  585. }
  586. static struct reg_default fsl_asrc_reg[] = {
  587. { REG_ASRCTR, 0x0000 }, { REG_ASRIER, 0x0000 },
  588. { REG_ASRCNCR, 0x0000 }, { REG_ASRCFG, 0x0000 },
  589. { REG_ASRCSR, 0x0000 }, { REG_ASRCDR1, 0x0000 },
  590. { REG_ASRCDR2, 0x0000 }, { REG_ASRSTR, 0x0000 },
  591. { REG_ASRRA, 0x0000 }, { REG_ASRRB, 0x0000 },
  592. { REG_ASRRC, 0x0000 }, { REG_ASRPM1, 0x0000 },
  593. { REG_ASRPM2, 0x0000 }, { REG_ASRPM3, 0x0000 },
  594. { REG_ASRPM4, 0x0000 }, { REG_ASRPM5, 0x0000 },
  595. { REG_ASRTFR1, 0x0000 }, { REG_ASRCCR, 0x0000 },
  596. { REG_ASRDIA, 0x0000 }, { REG_ASRDOA, 0x0000 },
  597. { REG_ASRDIB, 0x0000 }, { REG_ASRDOB, 0x0000 },
  598. { REG_ASRDIC, 0x0000 }, { REG_ASRDOC, 0x0000 },
  599. { REG_ASRIDRHA, 0x0000 }, { REG_ASRIDRLA, 0x0000 },
  600. { REG_ASRIDRHB, 0x0000 }, { REG_ASRIDRLB, 0x0000 },
  601. { REG_ASRIDRHC, 0x0000 }, { REG_ASRIDRLC, 0x0000 },
  602. { REG_ASR76K, 0x0A47 }, { REG_ASR56K, 0x0DF3 },
  603. { REG_ASRMCRA, 0x0000 }, { REG_ASRFSTA, 0x0000 },
  604. { REG_ASRMCRB, 0x0000 }, { REG_ASRFSTB, 0x0000 },
  605. { REG_ASRMCRC, 0x0000 }, { REG_ASRFSTC, 0x0000 },
  606. { REG_ASRMCR1A, 0x0000 }, { REG_ASRMCR1B, 0x0000 },
  607. { REG_ASRMCR1C, 0x0000 },
  608. };
  609. static const struct regmap_config fsl_asrc_regmap_config = {
  610. .reg_bits = 32,
  611. .reg_stride = 4,
  612. .val_bits = 32,
  613. .max_register = REG_ASRMCR1C,
  614. .reg_defaults = fsl_asrc_reg,
  615. .num_reg_defaults = ARRAY_SIZE(fsl_asrc_reg),
  616. .readable_reg = fsl_asrc_readable_reg,
  617. .volatile_reg = fsl_asrc_volatile_reg,
  618. .writeable_reg = fsl_asrc_writeable_reg,
  619. .cache_type = REGCACHE_FLAT,
  620. };
  621. /**
  622. * Initialize ASRC registers with a default configurations
  623. */
  624. static int fsl_asrc_init(struct fsl_asrc *asrc_priv)
  625. {
  626. /* Halt ASRC internal FP when input FIFO needs data for pair A, B, C */
  627. regmap_write(asrc_priv->regmap, REG_ASRCTR, ASRCTR_ASRCEN);
  628. /* Disable interrupt by default */
  629. regmap_write(asrc_priv->regmap, REG_ASRIER, 0x0);
  630. /* Apply recommended settings for parameters from Reference Manual */
  631. regmap_write(asrc_priv->regmap, REG_ASRPM1, 0x7fffff);
  632. regmap_write(asrc_priv->regmap, REG_ASRPM2, 0x255555);
  633. regmap_write(asrc_priv->regmap, REG_ASRPM3, 0xff7280);
  634. regmap_write(asrc_priv->regmap, REG_ASRPM4, 0xff7280);
  635. regmap_write(asrc_priv->regmap, REG_ASRPM5, 0xff7280);
  636. /* Base address for task queue FIFO. Set to 0x7C */
  637. regmap_update_bits(asrc_priv->regmap, REG_ASRTFR1,
  638. ASRTFR1_TF_BASE_MASK, ASRTFR1_TF_BASE(0xfc));
  639. /* Set the processing clock for 76KHz to 133M */
  640. regmap_write(asrc_priv->regmap, REG_ASR76K, 0x06D6);
  641. /* Set the processing clock for 56KHz to 133M */
  642. return regmap_write(asrc_priv->regmap, REG_ASR56K, 0x0947);
  643. }
  644. /**
  645. * Interrupt handler for ASRC
  646. */
  647. static irqreturn_t fsl_asrc_isr(int irq, void *dev_id)
  648. {
  649. struct fsl_asrc *asrc_priv = (struct fsl_asrc *)dev_id;
  650. struct device *dev = &asrc_priv->pdev->dev;
  651. enum asrc_pair_index index;
  652. u32 status;
  653. regmap_read(asrc_priv->regmap, REG_ASRSTR, &status);
  654. /* Clean overload error */
  655. regmap_write(asrc_priv->regmap, REG_ASRSTR, ASRSTR_AOLE);
  656. /*
  657. * We here use dev_dbg() for all exceptions because ASRC itself does
  658. * not care if FIFO overflowed or underrun while a warning in the
  659. * interrupt would result a ridged conversion.
  660. */
  661. for (index = ASRC_PAIR_A; index < ASRC_PAIR_MAX_NUM; index++) {
  662. if (!asrc_priv->pair[index])
  663. continue;
  664. if (status & ASRSTR_ATQOL) {
  665. asrc_priv->pair[index]->error |= ASRC_TASK_Q_OVERLOAD;
  666. dev_dbg(dev, "ASRC Task Queue FIFO overload\n");
  667. }
  668. if (status & ASRSTR_AOOL(index)) {
  669. asrc_priv->pair[index]->error |= ASRC_OUTPUT_TASK_OVERLOAD;
  670. pair_dbg("Output Task Overload\n");
  671. }
  672. if (status & ASRSTR_AIOL(index)) {
  673. asrc_priv->pair[index]->error |= ASRC_INPUT_TASK_OVERLOAD;
  674. pair_dbg("Input Task Overload\n");
  675. }
  676. if (status & ASRSTR_AODO(index)) {
  677. asrc_priv->pair[index]->error |= ASRC_OUTPUT_BUFFER_OVERFLOW;
  678. pair_dbg("Output Data Buffer has overflowed\n");
  679. }
  680. if (status & ASRSTR_AIDU(index)) {
  681. asrc_priv->pair[index]->error |= ASRC_INPUT_BUFFER_UNDERRUN;
  682. pair_dbg("Input Data Buffer has underflowed\n");
  683. }
  684. }
  685. return IRQ_HANDLED;
  686. }
  687. static int fsl_asrc_probe(struct platform_device *pdev)
  688. {
  689. struct device_node *np = pdev->dev.of_node;
  690. struct fsl_asrc *asrc_priv;
  691. struct resource *res;
  692. void __iomem *regs;
  693. int irq, ret, i;
  694. char tmp[16];
  695. asrc_priv = devm_kzalloc(&pdev->dev, sizeof(*asrc_priv), GFP_KERNEL);
  696. if (!asrc_priv)
  697. return -ENOMEM;
  698. asrc_priv->pdev = pdev;
  699. /* Get the addresses and IRQ */
  700. res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  701. regs = devm_ioremap_resource(&pdev->dev, res);
  702. if (IS_ERR(regs))
  703. return PTR_ERR(regs);
  704. asrc_priv->paddr = res->start;
  705. asrc_priv->regmap = devm_regmap_init_mmio_clk(&pdev->dev, "mem", regs,
  706. &fsl_asrc_regmap_config);
  707. if (IS_ERR(asrc_priv->regmap)) {
  708. dev_err(&pdev->dev, "failed to init regmap\n");
  709. return PTR_ERR(asrc_priv->regmap);
  710. }
  711. irq = platform_get_irq(pdev, 0);
  712. if (irq < 0) {
  713. dev_err(&pdev->dev, "no irq for node %s\n", pdev->name);
  714. return irq;
  715. }
  716. ret = devm_request_irq(&pdev->dev, irq, fsl_asrc_isr, 0,
  717. dev_name(&pdev->dev), asrc_priv);
  718. if (ret) {
  719. dev_err(&pdev->dev, "failed to claim irq %u: %d\n", irq, ret);
  720. return ret;
  721. }
  722. asrc_priv->mem_clk = devm_clk_get(&pdev->dev, "mem");
  723. if (IS_ERR(asrc_priv->mem_clk)) {
  724. dev_err(&pdev->dev, "failed to get mem clock\n");
  725. return PTR_ERR(asrc_priv->mem_clk);
  726. }
  727. asrc_priv->ipg_clk = devm_clk_get(&pdev->dev, "ipg");
  728. if (IS_ERR(asrc_priv->ipg_clk)) {
  729. dev_err(&pdev->dev, "failed to get ipg clock\n");
  730. return PTR_ERR(asrc_priv->ipg_clk);
  731. }
  732. asrc_priv->spba_clk = devm_clk_get(&pdev->dev, "spba");
  733. if (IS_ERR(asrc_priv->spba_clk))
  734. dev_warn(&pdev->dev, "failed to get spba clock\n");
  735. for (i = 0; i < ASRC_CLK_MAX_NUM; i++) {
  736. sprintf(tmp, "asrck_%x", i);
  737. asrc_priv->asrck_clk[i] = devm_clk_get(&pdev->dev, tmp);
  738. if (IS_ERR(asrc_priv->asrck_clk[i])) {
  739. dev_err(&pdev->dev, "failed to get %s clock\n", tmp);
  740. return PTR_ERR(asrc_priv->asrck_clk[i]);
  741. }
  742. }
  743. if (of_device_is_compatible(np, "fsl,imx35-asrc")) {
  744. asrc_priv->channel_bits = 3;
  745. clk_map[IN] = input_clk_map_imx35;
  746. clk_map[OUT] = output_clk_map_imx35;
  747. } else {
  748. asrc_priv->channel_bits = 4;
  749. clk_map[IN] = input_clk_map_imx53;
  750. clk_map[OUT] = output_clk_map_imx53;
  751. }
  752. ret = fsl_asrc_init(asrc_priv);
  753. if (ret) {
  754. dev_err(&pdev->dev, "failed to init asrc %d\n", ret);
  755. return ret;
  756. }
  757. asrc_priv->channel_avail = 10;
  758. ret = of_property_read_u32(np, "fsl,asrc-rate",
  759. &asrc_priv->asrc_rate);
  760. if (ret) {
  761. dev_err(&pdev->dev, "failed to get output rate\n");
  762. return ret;
  763. }
  764. ret = of_property_read_u32(np, "fsl,asrc-width",
  765. &asrc_priv->asrc_width);
  766. if (ret) {
  767. dev_err(&pdev->dev, "failed to get output width\n");
  768. return ret;
  769. }
  770. if (asrc_priv->asrc_width != 16 && asrc_priv->asrc_width != 24) {
  771. dev_warn(&pdev->dev, "unsupported width, switching to 24bit\n");
  772. asrc_priv->asrc_width = 24;
  773. }
  774. platform_set_drvdata(pdev, asrc_priv);
  775. pm_runtime_enable(&pdev->dev);
  776. spin_lock_init(&asrc_priv->lock);
  777. ret = devm_snd_soc_register_component(&pdev->dev, &fsl_asrc_component,
  778. &fsl_asrc_dai, 1);
  779. if (ret) {
  780. dev_err(&pdev->dev, "failed to register ASoC DAI\n");
  781. return ret;
  782. }
  783. ret = devm_snd_soc_register_platform(&pdev->dev, &fsl_asrc_platform);
  784. if (ret) {
  785. dev_err(&pdev->dev, "failed to register ASoC platform\n");
  786. return ret;
  787. }
  788. return 0;
  789. }
  790. #ifdef CONFIG_PM
  791. static int fsl_asrc_runtime_resume(struct device *dev)
  792. {
  793. struct fsl_asrc *asrc_priv = dev_get_drvdata(dev);
  794. int i, ret;
  795. ret = clk_prepare_enable(asrc_priv->mem_clk);
  796. if (ret)
  797. return ret;
  798. ret = clk_prepare_enable(asrc_priv->ipg_clk);
  799. if (ret)
  800. goto disable_mem_clk;
  801. if (!IS_ERR(asrc_priv->spba_clk)) {
  802. ret = clk_prepare_enable(asrc_priv->spba_clk);
  803. if (ret)
  804. goto disable_ipg_clk;
  805. }
  806. for (i = 0; i < ASRC_CLK_MAX_NUM; i++) {
  807. ret = clk_prepare_enable(asrc_priv->asrck_clk[i]);
  808. if (ret)
  809. goto disable_asrck_clk;
  810. }
  811. return 0;
  812. disable_asrck_clk:
  813. for (i--; i >= 0; i--)
  814. clk_disable_unprepare(asrc_priv->asrck_clk[i]);
  815. if (!IS_ERR(asrc_priv->spba_clk))
  816. clk_disable_unprepare(asrc_priv->spba_clk);
  817. disable_ipg_clk:
  818. clk_disable_unprepare(asrc_priv->ipg_clk);
  819. disable_mem_clk:
  820. clk_disable_unprepare(asrc_priv->mem_clk);
  821. return ret;
  822. }
  823. static int fsl_asrc_runtime_suspend(struct device *dev)
  824. {
  825. struct fsl_asrc *asrc_priv = dev_get_drvdata(dev);
  826. int i;
  827. for (i = 0; i < ASRC_CLK_MAX_NUM; i++)
  828. clk_disable_unprepare(asrc_priv->asrck_clk[i]);
  829. if (!IS_ERR(asrc_priv->spba_clk))
  830. clk_disable_unprepare(asrc_priv->spba_clk);
  831. clk_disable_unprepare(asrc_priv->ipg_clk);
  832. clk_disable_unprepare(asrc_priv->mem_clk);
  833. return 0;
  834. }
  835. #endif /* CONFIG_PM */
  836. #ifdef CONFIG_PM_SLEEP
  837. static int fsl_asrc_suspend(struct device *dev)
  838. {
  839. struct fsl_asrc *asrc_priv = dev_get_drvdata(dev);
  840. regmap_read(asrc_priv->regmap, REG_ASRCFG,
  841. &asrc_priv->regcache_cfg);
  842. regcache_cache_only(asrc_priv->regmap, true);
  843. regcache_mark_dirty(asrc_priv->regmap);
  844. return 0;
  845. }
  846. static int fsl_asrc_resume(struct device *dev)
  847. {
  848. struct fsl_asrc *asrc_priv = dev_get_drvdata(dev);
  849. u32 asrctr;
  850. /* Stop all pairs provisionally */
  851. regmap_read(asrc_priv->regmap, REG_ASRCTR, &asrctr);
  852. regmap_update_bits(asrc_priv->regmap, REG_ASRCTR,
  853. ASRCTR_ASRCEi_ALL_MASK, 0);
  854. /* Restore all registers */
  855. regcache_cache_only(asrc_priv->regmap, false);
  856. regcache_sync(asrc_priv->regmap);
  857. regmap_update_bits(asrc_priv->regmap, REG_ASRCFG,
  858. ASRCFG_NDPRi_ALL_MASK | ASRCFG_POSTMODi_ALL_MASK |
  859. ASRCFG_PREMODi_ALL_MASK, asrc_priv->regcache_cfg);
  860. /* Restart enabled pairs */
  861. regmap_update_bits(asrc_priv->regmap, REG_ASRCTR,
  862. ASRCTR_ASRCEi_ALL_MASK, asrctr);
  863. return 0;
  864. }
  865. #endif /* CONFIG_PM_SLEEP */
  866. static const struct dev_pm_ops fsl_asrc_pm = {
  867. SET_RUNTIME_PM_OPS(fsl_asrc_runtime_suspend, fsl_asrc_runtime_resume, NULL)
  868. SET_SYSTEM_SLEEP_PM_OPS(fsl_asrc_suspend, fsl_asrc_resume)
  869. };
  870. static const struct of_device_id fsl_asrc_ids[] = {
  871. { .compatible = "fsl,imx35-asrc", },
  872. { .compatible = "fsl,imx53-asrc", },
  873. {}
  874. };
  875. MODULE_DEVICE_TABLE(of, fsl_asrc_ids);
  876. static struct platform_driver fsl_asrc_driver = {
  877. .probe = fsl_asrc_probe,
  878. .driver = {
  879. .name = "fsl-asrc",
  880. .of_match_table = fsl_asrc_ids,
  881. .pm = &fsl_asrc_pm,
  882. },
  883. };
  884. module_platform_driver(fsl_asrc_driver);
  885. MODULE_DESCRIPTION("Freescale ASRC ASoC driver");
  886. MODULE_AUTHOR("Nicolin Chen <nicoleotsuka@gmail.com>");
  887. MODULE_ALIAS("platform:fsl-asrc");
  888. MODULE_LICENSE("GPL v2");