mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-23 03:45:20 +07:00
a180ba45b1
Declare snd_soc_codec_driver structures as const as they are only passed as an argument to the function snd_soc_register_codec. This argument is of type const, so declare the structures with this property as const. In file codecs/sn95031.c, snd_soc_codec_driver structure is also used in a copy operation along with getting passed to snd_soc_register_codec. So, it can be made const too. Done using Coccinelle: @match disable optional_qualifier@ identifier s; position p; @@ static struct snd_soc_codec_driver s@p={...}; @good1@ identifier match.s; position p; @@ snd_soc_register_codec(...,&s@p,...) @bad@ identifier match.s; position p!={match.p,good1.p}; @@ s@p @depends on !bad disable optional_qualifier@ identifier match.s; @@ static +const struct snd_soc_codec_driver s={...}; Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
77 lines
1.8 KiB
C
77 lines
1.8 KiB
C
/*
|
|
* I2S MEMS microphone driver for InvenSense ICS-43432
|
|
*
|
|
* - Non configurable.
|
|
* - I2S interface, 64 BCLs per frame, 32 bits per channel, 24 bit data
|
|
*
|
|
* Copyright (c) 2015 Axis Communications AB
|
|
*
|
|
* Licensed under GPL v2.
|
|
*/
|
|
|
|
#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_codec_driver ics43432_codec_driver = {
|
|
};
|
|
|
|
static int ics43432_probe(struct platform_device *pdev)
|
|
{
|
|
return snd_soc_register_codec(&pdev->dev, &ics43432_codec_driver,
|
|
&ics43432_dai, 1);
|
|
}
|
|
|
|
static int ics43432_remove(struct platform_device *pdev)
|
|
{
|
|
snd_soc_unregister_codec(&pdev->dev);
|
|
return 0;
|
|
}
|
|
|
|
#ifdef CONFIG_OF
|
|
static const struct of_device_id ics43432_ids[] = {
|
|
{ .compatible = "invensense,ics43432", },
|
|
{ }
|
|
};
|
|
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,
|
|
.remove = ics43432_remove,
|
|
};
|
|
|
|
module_platform_driver(ics43432_driver);
|
|
|
|
MODULE_DESCRIPTION("ASoC ICS43432 driver");
|
|
MODULE_AUTHOR("Ricard Wanderlof <ricardw@axis.com>");
|
|
MODULE_LICENSE("GPL v2");
|