mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-26 05:34:13 +08:00
43d2c4982f
Despite minimal datasheet differences, the driver seems perfectly compatible with CMM-4030D-261. Tested CMM-4030D-261 to work with this changes: / { cmm4030d: cmm4030d { #sound-dai-cells = <0>; compatible = "cui,cmm-4030d-261"; }; sound_mic { compatible = "simple-audio-card"; simple-audio-card,name = "i2s mem mic"; simple-audio-card,format = "i2s"; simple-audio-card,bitclock-master = <&sound_master>; simple-audio-card,frame-master = <&sound_master>; sound_master: simple-audio-card,cpu { sound-dai = <&ssi2>; system-clock-frequency = <2822400>; }; simple-audio-card,codec { sound-dai = <&cmm4030d>; }; }; }; Audio has been captured and tested successfully by: arecord -D "hw:1,0" -f S24_LE > test.wav aplay test.wav Signed-off-by: Angelo Dureghello <angelo.dureghello@timesys.com> Link: https://lore.kernel.org/r/20210821082658.4147595-1-angelo.dureghello@timesys.com Signed-off-by: Mark Brown <broonie@kernel.org>
76 lines
1.8 KiB
C
76 lines
1.8 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* I2S MEMS microphone driver for InvenSense ICS-43432 and similar
|
|
* MEMS-based microphones.
|
|
*
|
|
* - Non configurable.
|
|
* - I2S interface, 64 BCLs per frame, 32 bits per channel, 24 bit data
|
|
*
|
|
* Copyright (c) 2015 Axis Communications AB
|
|
*/
|
|
|
|
#include <linux/module.h>
|
|
#include <linux/init.h>
|
|
#include <linux/slab.h>
|
|
#include <sound/core.h>
|
|
#include <sound/pcm.h>
|
|
#include <sound/pcm_params.h>
|
|
#include <sound/soc.h>
|
|
#include <sound/initval.h>
|
|
#include <sound/tlv.h>
|
|
|
|
#define ICS43432_RATE_MIN 7190 /* Hz, from data sheet */
|
|
#define ICS43432_RATE_MAX 52800 /* Hz, from data sheet */
|
|
|
|
#define ICS43432_FORMATS (SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32)
|
|
|
|
static struct snd_soc_dai_driver ics43432_dai = {
|
|
.name = "ics43432-hifi",
|
|
.capture = {
|
|
.stream_name = "Capture",
|
|
.channels_min = 1,
|
|
.channels_max = 2,
|
|
.rate_min = ICS43432_RATE_MIN,
|
|
.rate_max = ICS43432_RATE_MAX,
|
|
.rates = SNDRV_PCM_RATE_CONTINUOUS,
|
|
.formats = ICS43432_FORMATS,
|
|
},
|
|
};
|
|
|
|
static const struct snd_soc_component_driver ics43432_component_driver = {
|
|
.idle_bias_on = 1,
|
|
.use_pmdown_time = 1,
|
|
.endianness = 1,
|
|
.non_legacy_dai_naming = 1,
|
|
};
|
|
|
|
static int ics43432_probe(struct platform_device *pdev)
|
|
{
|
|
return devm_snd_soc_register_component(&pdev->dev,
|
|
&ics43432_component_driver,
|
|
&ics43432_dai, 1);
|
|
}
|
|
|
|
#ifdef CONFIG_OF
|
|
static const struct of_device_id ics43432_ids[] = {
|
|
{ .compatible = "invensense,ics43432", },
|
|
{ .compatible = "cui,cmm-4030d-261", },
|
|
{ }
|
|
};
|
|
MODULE_DEVICE_TABLE(of, ics43432_ids);
|
|
#endif
|
|
|
|
static struct platform_driver ics43432_driver = {
|
|
.driver = {
|
|
.name = "ics43432",
|
|
.of_match_table = of_match_ptr(ics43432_ids),
|
|
},
|
|
.probe = ics43432_probe,
|
|
};
|
|
|
|
module_platform_driver(ics43432_driver);
|
|
|
|
MODULE_DESCRIPTION("ASoC ICS43432 driver");
|
|
MODULE_AUTHOR("Ricard Wanderlof <ricardw@axis.com>");
|
|
MODULE_LICENSE("GPL v2");
|