/* * itel.c -- ALSA SoC Audio Layer utility functions * * Copyright 2009 Wolfson Microelectronics PLC. * * Author: Mark Brown * Liam Girdwood * * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. */ #include #include #include #include #include #include #include static struct snd_soc_platform_driver itel_platform = { //.ops = &dummy_dma_ops, }; #define ITEL_RX_RATES SNDRV_PCM_RATE_8000_192000 #define ITEL_RX_FORMATS ( SNDRV_PCM_FMTBIT_S16_LE | \ SNDRV_PCM_FMTBIT_S20_3LE| \ SNDRV_PCM_FMTBIT_S24_LE | \ SNDRV_PCM_FMTBIT_S32_LE ) #define ITEL_TX_RATES SNDRV_PCM_RATE_8000_192000 #define ITEL_TX_FORMATS ( SNDRV_PCM_FMTBIT_S16_LE | \ SNDRV_PCM_FMTBIT_S20_3LE| \ SNDRV_PCM_FMTBIT_S24_LE | \ SNDRV_PCM_FMTBIT_S32_LE) static const struct snd_soc_dapm_widget itel_widgets[] = { SND_SOC_DAPM_INPUT("i2s-in"), SND_SOC_DAPM_OUTPUT("i2s-out"), }; static const struct snd_soc_dapm_route itel_routes[] = { { "Capture", NULL, "i2s-in" }, { "i2s-out", NULL, "Playback" }, }; static struct snd_soc_codec_driver itel_codec = { .dapm_widgets = itel_widgets, .num_dapm_widgets = ARRAY_SIZE(itel_widgets), .dapm_routes = itel_routes, .num_dapm_routes = ARRAY_SIZE(itel_routes), }; static struct snd_soc_dai_driver itel_dai = { .name = "snd-soc-itel-dai", .playback = { .stream_name = "Playback", .channels_min = 1, .channels_max = 2, .rates = ITEL_TX_RATES, .formats = ITEL_TX_FORMATS, }, .capture = { .stream_name = "Capture", .channels_min = 1, .channels_max = 2, .rates = ITEL_RX_RATES, .formats = ITEL_RX_FORMATS, }, }; static int snd_soc_itel_probe(struct platform_device *pdev) { int ret; return snd_soc_register_codec(&pdev->dev, &itel_codec, &itel_dai, 1); if (ret < 0) return ret; ret = snd_soc_register_platform(&pdev->dev, &itel_platform); if (ret < 0) { snd_soc_unregister_codec(&pdev->dev); return ret; } return ret; } static int snd_soc_itel_remove(struct platform_device *pdev) { snd_soc_unregister_platform(&pdev->dev); snd_soc_unregister_codec(&pdev->dev); return 0; } #ifdef CONFIG_OF static const struct of_device_id soc_itel_ids[] = { { .compatible = "fsl,snd-soc-itel", }, { } }; MODULE_DEVICE_TABLE(of, soc_itel_ids); #endif static struct platform_driver soc_itel_driver = { .probe = snd_soc_itel_probe, .remove = snd_soc_itel_remove, .driver = { .name = "snd-soc-itel", .owner = THIS_MODULE, .of_match_table = of_match_ptr(soc_itel_ids), }, }; module_platform_driver(soc_itel_driver); MODULE_AUTHOR("Nicola Lunghi "); MODULE_DESCRIPTION("ITEL I2S Codec Driver"); MODULE_LICENSE("GPL"); MODULE_ALIAS("platform:snd-soc-itel");