ASoC: Add ADAU1372 audio CODEC support
Add support for the Analog Devices ADAU1372 audio CODEC. [Alexandre Belloni: allow 32kHz for TDM4 in slave mode] Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20201127123030.1610574-2-alexandre.belloni@bootlin.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
32025c7c50
commit
6cd4c6459e
@ -23,6 +23,8 @@ config SND_SOC_ALL_CODECS
|
|||||||
imply SND_SOC_AD193X_I2C
|
imply SND_SOC_AD193X_I2C
|
||||||
imply SND_SOC_AD1980
|
imply SND_SOC_AD1980
|
||||||
imply SND_SOC_AD73311
|
imply SND_SOC_AD73311
|
||||||
|
imply SND_SOC_ADAU1372_I2C
|
||||||
|
imply SND_SOC_ADAU1372_SPI
|
||||||
imply SND_SOC_ADAU1373
|
imply SND_SOC_ADAU1373
|
||||||
imply SND_SOC_ADAU1761_I2C
|
imply SND_SOC_ADAU1761_I2C
|
||||||
imply SND_SOC_ADAU1761_SPI
|
imply SND_SOC_ADAU1761_SPI
|
||||||
@ -364,6 +366,20 @@ config SND_SOC_AD73311
|
|||||||
config SND_SOC_ADAU_UTILS
|
config SND_SOC_ADAU_UTILS
|
||||||
tristate
|
tristate
|
||||||
|
|
||||||
|
config SND_SOC_ADAU1372
|
||||||
|
tristate
|
||||||
|
select SND_SOC_ADAU_UTILS
|
||||||
|
|
||||||
|
config SND_SOC_ADAU1372_I2C
|
||||||
|
tristate "Analog Devices ADAU1372 CODEC (I2C)"
|
||||||
|
select SND_SOC_ADAU1372
|
||||||
|
select REGMAP_I2C
|
||||||
|
|
||||||
|
config SND_SOC_ADAU1372_SPI
|
||||||
|
tristate "Analog Devices ADAU1372 CODEC (SPI)"
|
||||||
|
select SND_SOC_ADAU1372
|
||||||
|
select REGMAP_SPI
|
||||||
|
|
||||||
config SND_SOC_ADAU1373
|
config SND_SOC_ADAU1373
|
||||||
tristate
|
tristate
|
||||||
depends on I2C
|
depends on I2C
|
||||||
|
@ -9,6 +9,9 @@ snd-soc-ad193x-i2c-objs := ad193x-i2c.o
|
|||||||
snd-soc-ad1980-objs := ad1980.o
|
snd-soc-ad1980-objs := ad1980.o
|
||||||
snd-soc-ad73311-objs := ad73311.o
|
snd-soc-ad73311-objs := ad73311.o
|
||||||
snd-soc-adau-utils-objs := adau-utils.o
|
snd-soc-adau-utils-objs := adau-utils.o
|
||||||
|
snd-soc-adau1372-objs := adau1372.o
|
||||||
|
snd-soc-adau1372-i2c-objs := adau1372-i2c.o
|
||||||
|
snd-soc-adau1372-spi-objs := adau1372-spi.o
|
||||||
snd-soc-adau1373-objs := adau1373.o
|
snd-soc-adau1373-objs := adau1373.o
|
||||||
snd-soc-adau1701-objs := adau1701.o
|
snd-soc-adau1701-objs := adau1701.o
|
||||||
snd-soc-adau17x1-objs := adau17x1.o
|
snd-soc-adau17x1-objs := adau17x1.o
|
||||||
@ -319,6 +322,9 @@ obj-$(CONFIG_SND_SOC_AD193X_I2C) += snd-soc-ad193x-i2c.o
|
|||||||
obj-$(CONFIG_SND_SOC_AD1980) += snd-soc-ad1980.o
|
obj-$(CONFIG_SND_SOC_AD1980) += snd-soc-ad1980.o
|
||||||
obj-$(CONFIG_SND_SOC_AD73311) += snd-soc-ad73311.o
|
obj-$(CONFIG_SND_SOC_AD73311) += snd-soc-ad73311.o
|
||||||
obj-$(CONFIG_SND_SOC_ADAU_UTILS) += snd-soc-adau-utils.o
|
obj-$(CONFIG_SND_SOC_ADAU_UTILS) += snd-soc-adau-utils.o
|
||||||
|
obj-$(CONFIG_SND_SOC_ADAU1372) += snd-soc-adau1372.o
|
||||||
|
obj-$(CONFIG_SND_SOC_ADAU1372_I2C) += snd-soc-adau1372-i2c.o
|
||||||
|
obj-$(CONFIG_SND_SOC_ADAU1372_SPI) += snd-soc-adau1372-spi.o
|
||||||
obj-$(CONFIG_SND_SOC_ADAU1373) += snd-soc-adau1373.o
|
obj-$(CONFIG_SND_SOC_ADAU1373) += snd-soc-adau1373.o
|
||||||
obj-$(CONFIG_SND_SOC_ADAU1701) += snd-soc-adau1701.o
|
obj-$(CONFIG_SND_SOC_ADAU1701) += snd-soc-adau1701.o
|
||||||
obj-$(CONFIG_SND_SOC_ADAU17X1) += snd-soc-adau17x1.o
|
obj-$(CONFIG_SND_SOC_ADAU17X1) += snd-soc-adau17x1.o
|
||||||
|
40
sound/soc/codecs/adau1372-i2c.c
Normal file
40
sound/soc/codecs/adau1372-i2c.c
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0-only
|
||||||
|
/*
|
||||||
|
* Driver for ADAU1372 codec
|
||||||
|
*
|
||||||
|
* Copyright 2016 Analog Devices Inc.
|
||||||
|
* Author: Lars-Peter Clausen <lars@metafoo.de>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <linux/i2c.h>
|
||||||
|
#include <linux/mod_devicetable.h>
|
||||||
|
#include <linux/module.h>
|
||||||
|
#include <linux/regmap.h>
|
||||||
|
#include <sound/soc.h>
|
||||||
|
|
||||||
|
#include "adau1372.h"
|
||||||
|
|
||||||
|
static int adau1372_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id)
|
||||||
|
{
|
||||||
|
return adau1372_probe(&client->dev,
|
||||||
|
devm_regmap_init_i2c(client, &adau1372_regmap_config), NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct i2c_device_id adau1372_i2c_ids[] = {
|
||||||
|
{ "adau1372", 0 },
|
||||||
|
{ }
|
||||||
|
};
|
||||||
|
MODULE_DEVICE_TABLE(i2c, adau1372_i2c_ids);
|
||||||
|
|
||||||
|
static struct i2c_driver adau1372_i2c_driver = {
|
||||||
|
.driver = {
|
||||||
|
.name = "adau1372",
|
||||||
|
},
|
||||||
|
.probe = adau1372_i2c_probe,
|
||||||
|
.id_table = adau1372_i2c_ids,
|
||||||
|
};
|
||||||
|
module_i2c_driver(adau1372_i2c_driver);
|
||||||
|
|
||||||
|
MODULE_DESCRIPTION("ASoC ADAU1372 CODEC I2C driver");
|
||||||
|
MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
|
||||||
|
MODULE_LICENSE("GPL v2");
|
58
sound/soc/codecs/adau1372-spi.c
Normal file
58
sound/soc/codecs/adau1372-spi.c
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0-only
|
||||||
|
/*
|
||||||
|
* Driver for ADAU1372 codec
|
||||||
|
*
|
||||||
|
* Copyright 2016 Analog Devices Inc.
|
||||||
|
* Author: Lars-Peter Clausen <lars@metafoo.de>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <linux/mod_devicetable.h>
|
||||||
|
#include <linux/module.h>
|
||||||
|
#include <linux/regmap.h>
|
||||||
|
#include <linux/spi/spi.h>
|
||||||
|
#include <sound/soc.h>
|
||||||
|
|
||||||
|
#include "adau1372.h"
|
||||||
|
|
||||||
|
static void adau1372_spi_switch_mode(struct device *dev)
|
||||||
|
{
|
||||||
|
struct spi_device *spi = to_spi_device(dev);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* To get the device into SPI mode CLATCH has to be pulled low three
|
||||||
|
* times. Do this by issuing three dummy reads.
|
||||||
|
*/
|
||||||
|
spi_w8r8(spi, 0x00);
|
||||||
|
spi_w8r8(spi, 0x00);
|
||||||
|
spi_w8r8(spi, 0x00);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int adau1372_spi_probe(struct spi_device *spi)
|
||||||
|
{
|
||||||
|
struct regmap_config config;
|
||||||
|
|
||||||
|
config = adau1372_regmap_config;
|
||||||
|
config.read_flag_mask = 0x1;
|
||||||
|
|
||||||
|
return adau1372_probe(&spi->dev,
|
||||||
|
devm_regmap_init_spi(spi, &config), adau1372_spi_switch_mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct spi_device_id adau1372_spi_id[] = {
|
||||||
|
{ "adau1372", 0 },
|
||||||
|
{ }
|
||||||
|
};
|
||||||
|
MODULE_DEVICE_TABLE(spi, adau1372_spi_id);
|
||||||
|
|
||||||
|
static struct spi_driver adau1372_spi_driver = {
|
||||||
|
.driver = {
|
||||||
|
.name = "adau1372",
|
||||||
|
},
|
||||||
|
.probe = adau1372_spi_probe,
|
||||||
|
.id_table = adau1372_spi_id,
|
||||||
|
};
|
||||||
|
module_spi_driver(adau1372_spi_driver);
|
||||||
|
|
||||||
|
MODULE_DESCRIPTION("ASoC ADAU1372 CODEC SPI driver");
|
||||||
|
MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
|
||||||
|
MODULE_LICENSE("GPL v2");
|
1062
sound/soc/codecs/adau1372.c
Normal file
1062
sound/soc/codecs/adau1372.c
Normal file
File diff suppressed because it is too large
Load Diff
21
sound/soc/codecs/adau1372.h
Normal file
21
sound/soc/codecs/adau1372.h
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
|
/*
|
||||||
|
* ADAU1372 driver
|
||||||
|
*
|
||||||
|
* Copyright 2016 Analog Devices Inc.
|
||||||
|
* Author: Lars-Peter Clausen <lars@metafoo.de>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SOUND_SOC_CODECS_ADAU1372_H
|
||||||
|
#define SOUND_SOC_CODECS_ADAU1372_H
|
||||||
|
|
||||||
|
#include <linux/regmap.h>
|
||||||
|
|
||||||
|
struct device;
|
||||||
|
|
||||||
|
int adau1372_probe(struct device *dev, struct regmap *regmap,
|
||||||
|
void (*switch_mode)(struct device *dev));
|
||||||
|
|
||||||
|
extern const struct regmap_config adau1372_regmap_config;
|
||||||
|
|
||||||
|
#endif
|
Loading…
x
Reference in New Issue
Block a user