0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #include <linux/module.h>
0013 #include <linux/init.h>
0014 #include <linux/slab.h>
0015 #include <sound/core.h>
0016 #include <sound/pcm.h>
0017 #include <sound/pcm_params.h>
0018 #include <sound/soc.h>
0019 #include <sound/initval.h>
0020 #include <sound/tlv.h>
0021
0022 #define ICS43432_RATE_MIN 7190
0023 #define ICS43432_RATE_MAX 52800
0024
0025 #define ICS43432_FORMATS (SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32)
0026
0027 static struct snd_soc_dai_driver ics43432_dai = {
0028 .name = "ics43432-hifi",
0029 .capture = {
0030 .stream_name = "Capture",
0031 .channels_min = 1,
0032 .channels_max = 2,
0033 .rate_min = ICS43432_RATE_MIN,
0034 .rate_max = ICS43432_RATE_MAX,
0035 .rates = SNDRV_PCM_RATE_CONTINUOUS,
0036 .formats = ICS43432_FORMATS,
0037 },
0038 };
0039
0040 static const struct snd_soc_component_driver ics43432_component_driver = {
0041 .idle_bias_on = 1,
0042 .use_pmdown_time = 1,
0043 .endianness = 1,
0044 };
0045
0046 static int ics43432_probe(struct platform_device *pdev)
0047 {
0048 return devm_snd_soc_register_component(&pdev->dev,
0049 &ics43432_component_driver,
0050 &ics43432_dai, 1);
0051 }
0052
0053 #ifdef CONFIG_OF
0054 static const struct of_device_id ics43432_ids[] = {
0055 { .compatible = "invensense,ics43432", },
0056 { .compatible = "cui,cmm-4030d-261", },
0057 { }
0058 };
0059 MODULE_DEVICE_TABLE(of, ics43432_ids);
0060 #endif
0061
0062 static struct platform_driver ics43432_driver = {
0063 .driver = {
0064 .name = "ics43432",
0065 .of_match_table = of_match_ptr(ics43432_ids),
0066 },
0067 .probe = ics43432_probe,
0068 };
0069
0070 module_platform_driver(ics43432_driver);
0071
0072 MODULE_DESCRIPTION("ASoC ICS43432 driver");
0073 MODULE_AUTHOR("Ricard Wanderlof <ricardw@axis.com>");
0074 MODULE_LICENSE("GPL v2");