ASoC: rt5640: Allow snd_soc_component_set_jack() to override the codec IRQ
[linux-2.6-block.git] / sound / soc / codecs / ics43432.c
CommitLineData
f8a88917 1// SPDX-License-Identifier: GPL-2.0-only
3b7ce997 2/*
43d2c498
AD
3 * I2S MEMS microphone driver for InvenSense ICS-43432 and similar
4 * MEMS-based microphones.
3b7ce997
RW
5 *
6 * - Non configurable.
7 * - I2S interface, 64 BCLs per frame, 32 bits per channel, 24 bit data
8 *
9 * Copyright (c) 2015 Axis Communications AB
3b7ce997
RW
10 */
11
12#include <linux/module.h>
13#include <linux/init.h>
14#include <linux/slab.h>
15#include <sound/core.h>
16#include <sound/pcm.h>
17#include <sound/pcm_params.h>
18#include <sound/soc.h>
19#include <sound/initval.h>
20#include <sound/tlv.h>
21
22#define ICS43432_RATE_MIN 7190 /* Hz, from data sheet */
23#define ICS43432_RATE_MAX 52800 /* Hz, from data sheet */
24
25#define ICS43432_FORMATS (SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32)
26
27static struct snd_soc_dai_driver ics43432_dai = {
28 .name = "ics43432-hifi",
29 .capture = {
30 .stream_name = "Capture",
31 .channels_min = 1,
32 .channels_max = 2,
33 .rate_min = ICS43432_RATE_MIN,
34 .rate_max = ICS43432_RATE_MAX,
35 .rates = SNDRV_PCM_RATE_CONTINUOUS,
36 .formats = ICS43432_FORMATS,
37 },
38};
39
7c8d9059
KM
40static const struct snd_soc_component_driver ics43432_component_driver = {
41 .idle_bias_on = 1,
42 .use_pmdown_time = 1,
43 .endianness = 1,
44 .non_legacy_dai_naming = 1,
3b7ce997
RW
45};
46
47static int ics43432_probe(struct platform_device *pdev)
48{
7c8d9059
KM
49 return devm_snd_soc_register_component(&pdev->dev,
50 &ics43432_component_driver,
3b7ce997
RW
51 &ics43432_dai, 1);
52}
53
3b7ce997
RW
54#ifdef CONFIG_OF
55static const struct of_device_id ics43432_ids[] = {
56 { .compatible = "invensense,ics43432", },
43d2c498 57 { .compatible = "cui,cmm-4030d-261", },
3b7ce997
RW
58 { }
59};
b37bfdaa 60MODULE_DEVICE_TABLE(of, ics43432_ids);
3b7ce997
RW
61#endif
62
63static struct platform_driver ics43432_driver = {
64 .driver = {
65 .name = "ics43432",
3b7ce997
RW
66 .of_match_table = of_match_ptr(ics43432_ids),
67 },
68 .probe = ics43432_probe,
3b7ce997
RW
69};
70
71module_platform_driver(ics43432_driver);
72
73MODULE_DESCRIPTION("ASoC ICS43432 driver");
74MODULE_AUTHOR("Ricard Wanderlof <ricardw@axis.com>");
2f38bc88 75MODULE_LICENSE("GPL v2");