mxs-saif.c (7bcc1ec07748cae3552dc9b46701c117926c8923) | mxs-saif.c (b25b5aa06667b01fee8fe2648d4ea9db32c87d1a) |
---|---|
1/* 2 * Copyright 2011 Freescale Semiconductor, Inc. 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * --- 215 unchanged lines hidden (view full) --- 224 __raw_writel(BM_SAIF_CTRL_CLKGATE, 225 saif->base + SAIF_CTRL + MXS_SET_ADDR); 226 __raw_writel(BM_SAIF_CTRL_RUN, 227 saif->base + SAIF_CTRL + MXS_CLR_ADDR); 228 229 saif->mclk_in_use = 0; 230 return 0; 231} | 1/* 2 * Copyright 2011 Freescale Semiconductor, Inc. 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * --- 215 unchanged lines hidden (view full) --- 224 __raw_writel(BM_SAIF_CTRL_CLKGATE, 225 saif->base + SAIF_CTRL + MXS_SET_ADDR); 226 __raw_writel(BM_SAIF_CTRL_RUN, 227 saif->base + SAIF_CTRL + MXS_CLR_ADDR); 228 229 saif->mclk_in_use = 0; 230 return 0; 231} |
232EXPORT_SYMBOL_GPL(mxs_saif_put_mclk); |
|
232 233/* 234 * Get MCLK and set clock rate, then enable it 235 * 236 * This interface is used for codecs who are using MCLK provided 237 * by saif. 238 */ 239int mxs_saif_get_mclk(unsigned int saif_id, unsigned int mclk, --- 37 unchanged lines hidden (view full) --- 277 return ret; 278 279 /* enable MCLK output */ 280 __raw_writel(BM_SAIF_CTRL_RUN, 281 saif->base + SAIF_CTRL + MXS_SET_ADDR); 282 283 return 0; 284} | 233 234/* 235 * Get MCLK and set clock rate, then enable it 236 * 237 * This interface is used for codecs who are using MCLK provided 238 * by saif. 239 */ 240int mxs_saif_get_mclk(unsigned int saif_id, unsigned int mclk, --- 37 unchanged lines hidden (view full) --- 278 return ret; 279 280 /* enable MCLK output */ 281 __raw_writel(BM_SAIF_CTRL_RUN, 282 saif->base + SAIF_CTRL + MXS_SET_ADDR); 283 284 return 0; 285} |
286EXPORT_SYMBOL_GPL(mxs_saif_get_mclk); |
|
285 286/* 287 * SAIF DAI format configuration. 288 * Should only be called when port is inactive. 289 */ 290static int mxs_saif_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt) 291{ 292 u32 scr, stat; --- 357 unchanged lines hidden (view full) --- 650 651 dev_dbg(saif->dev, "SAIF_CTRL %x SAIF_STAT %x\n", 652 __raw_readl(saif->base + SAIF_CTRL), 653 __raw_readl(saif->base + SAIF_STAT)); 654 655 return IRQ_HANDLED; 656} 657 | 287 288/* 289 * SAIF DAI format configuration. 290 * Should only be called when port is inactive. 291 */ 292static int mxs_saif_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt) 293{ 294 u32 scr, stat; --- 357 unchanged lines hidden (view full) --- 652 653 dev_dbg(saif->dev, "SAIF_CTRL %x SAIF_STAT %x\n", 654 __raw_readl(saif->base + SAIF_CTRL), 655 __raw_readl(saif->base + SAIF_STAT)); 656 657 return IRQ_HANDLED; 658} 659 |
658static int __devinit mxs_saif_probe(struct platform_device *pdev) | 660static int mxs_saif_probe(struct platform_device *pdev) |
659{ 660 struct device_node *np = pdev->dev.of_node; 661 struct resource *iores, *dmares; 662 struct mxs_saif *saif; 663 struct mxs_saif_platform_data *pdata; 664 struct pinctrl *pinctrl; 665 int ret = 0; 666 --- 50 unchanged lines hidden (view full) --- 717 ret = PTR_ERR(saif->clk); 718 dev_err(&pdev->dev, "Cannot get the clock: %d\n", 719 ret); 720 return ret; 721 } 722 723 iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); 724 | 661{ 662 struct device_node *np = pdev->dev.of_node; 663 struct resource *iores, *dmares; 664 struct mxs_saif *saif; 665 struct mxs_saif_platform_data *pdata; 666 struct pinctrl *pinctrl; 667 int ret = 0; 668 --- 50 unchanged lines hidden (view full) --- 719 ret = PTR_ERR(saif->clk); 720 dev_err(&pdev->dev, "Cannot get the clock: %d\n", 721 ret); 722 return ret; 723 } 724 725 iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); 726 |
725 saif->base = devm_request_and_ioremap(&pdev->dev, iores); 726 if (!saif->base) { 727 dev_err(&pdev->dev, "ioremap failed\n"); 728 return -ENODEV; 729 } | 727 saif->base = devm_ioremap_resource(&pdev->dev, iores); 728 if (IS_ERR(saif->base)) 729 return PTR_ERR(saif->base); |
730 731 dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0); 732 if (!dmares) { 733 /* 734 * TODO: This is a temporary solution and should be changed 735 * to use generic DMA binding later when the helplers get in. 736 */ 737 ret = of_property_read_u32(np, "fsl,saif-dma-channel", --- 47 unchanged lines hidden (view full) --- 785 return 0; 786 787failed_pdev_alloc: 788 snd_soc_unregister_dai(&pdev->dev); 789 790 return ret; 791} 792 | 730 731 dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0); 732 if (!dmares) { 733 /* 734 * TODO: This is a temporary solution and should be changed 735 * to use generic DMA binding later when the helplers get in. 736 */ 737 ret = of_property_read_u32(np, "fsl,saif-dma-channel", --- 47 unchanged lines hidden (view full) --- 785 return 0; 786 787failed_pdev_alloc: 788 snd_soc_unregister_dai(&pdev->dev); 789 790 return ret; 791} 792 |
793static int __devexit mxs_saif_remove(struct platform_device *pdev) | 793static int mxs_saif_remove(struct platform_device *pdev) |
794{ 795 mxs_pcm_platform_unregister(&pdev->dev); 796 snd_soc_unregister_dai(&pdev->dev); 797 798 return 0; 799} 800 801static const struct of_device_id mxs_saif_dt_ids[] = { 802 { .compatible = "fsl,imx28-saif", }, 803 { /* sentinel */ } 804}; 805MODULE_DEVICE_TABLE(of, mxs_saif_dt_ids); 806 807static struct platform_driver mxs_saif_driver = { 808 .probe = mxs_saif_probe, | 794{ 795 mxs_pcm_platform_unregister(&pdev->dev); 796 snd_soc_unregister_dai(&pdev->dev); 797 798 return 0; 799} 800 801static const struct of_device_id mxs_saif_dt_ids[] = { 802 { .compatible = "fsl,imx28-saif", }, 803 { /* sentinel */ } 804}; 805MODULE_DEVICE_TABLE(of, mxs_saif_dt_ids); 806 807static struct platform_driver mxs_saif_driver = { 808 .probe = mxs_saif_probe, |
809 .remove = __devexit_p(mxs_saif_remove), | 809 .remove = mxs_saif_remove, |
810 811 .driver = { 812 .name = "mxs-saif", 813 .owner = THIS_MODULE, 814 .of_match_table = mxs_saif_dt_ids, 815 }, 816}; 817 818module_platform_driver(mxs_saif_driver); 819 820MODULE_AUTHOR("Freescale Semiconductor, Inc."); 821MODULE_DESCRIPTION("MXS ASoC SAIF driver"); 822MODULE_LICENSE("GPL"); 823MODULE_ALIAS("platform:mxs-saif"); | 810 811 .driver = { 812 .name = "mxs-saif", 813 .owner = THIS_MODULE, 814 .of_match_table = mxs_saif_dt_ids, 815 }, 816}; 817 818module_platform_driver(mxs_saif_driver); 819 820MODULE_AUTHOR("Freescale Semiconductor, Inc."); 821MODULE_DESCRIPTION("MXS ASoC SAIF driver"); 822MODULE_LICENSE("GPL"); 823MODULE_ALIAS("platform:mxs-saif"); |