Commit a9b17a63 authored by Damien.Horsley's avatar Damien.Horsley Committed by Mark Brown

ASoC: pcm3168a: Add driver for pcm3168a codec

Add driver for Texas Instruments pcm3168a codec
Signed-off-by: default avatarDamien.Horsley <Damien.Horsley@imgtec.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent ccfa2bef
......@@ -85,6 +85,8 @@ config SND_SOC_ALL_CODECS
select SND_SOC_PCM1681 if I2C
select SND_SOC_PCM1792A if SPI_MASTER
select SND_SOC_PCM3008
select SND_SOC_PCM3168A_I2C if I2C
select SND_SOC_PCM3168A_SPI if SPI_MASTER
select SND_SOC_PCM512x_I2C if I2C
select SND_SOC_PCM512x_SPI if SPI_MASTER
select SND_SOC_RT286 if I2C
......@@ -506,6 +508,21 @@ config SND_SOC_PCM1792A
config SND_SOC_PCM3008
tristate
config SND_SOC_PCM3168A
tristate
config SND_SOC_PCM3168A_I2C
tristate "Texas Instruments PCM3168A CODEC - I2C"
depends on I2C
select SND_SOC_PCM3168A
select REGMAP_I2C
config SND_SOC_PCM3168A_SPI
tristate "Texas Instruments PCM3168A CODEC - SPI"
depends on SPI_MASTER
select SND_SOC_PCM3168A
select REGMAP_SPI
config SND_SOC_PCM512x
tristate
......
......@@ -78,6 +78,9 @@ snd-soc-nau8825-objs := nau8825.o
snd-soc-pcm1681-objs := pcm1681.o
snd-soc-pcm1792a-codec-objs := pcm1792a.o
snd-soc-pcm3008-objs := pcm3008.o
snd-soc-pcm3168a-objs := pcm3168a.o
snd-soc-pcm3168a-i2c-objs := pcm3168a-i2c.o
snd-soc-pcm3168a-spi-objs := pcm3168a-spi.o
snd-soc-pcm512x-objs := pcm512x.o
snd-soc-pcm512x-i2c-objs := pcm512x-i2c.o
snd-soc-pcm512x-spi-objs := pcm512x-spi.o
......@@ -273,6 +276,9 @@ obj-$(CONFIG_SND_SOC_NAU8825) += snd-soc-nau8825.o
obj-$(CONFIG_SND_SOC_PCM1681) += snd-soc-pcm1681.o
obj-$(CONFIG_SND_SOC_PCM1792A) += snd-soc-pcm1792a-codec.o
obj-$(CONFIG_SND_SOC_PCM3008) += snd-soc-pcm3008.o
obj-$(CONFIG_SND_SOC_PCM3168A) += snd-soc-pcm3168a.o
obj-$(CONFIG_SND_SOC_PCM3168A_I2C) += snd-soc-pcm3168a-i2c.o
obj-$(CONFIG_SND_SOC_PCM3168A_SPI) += snd-soc-pcm3168a-spi.o
obj-$(CONFIG_SND_SOC_PCM512x) += snd-soc-pcm512x.o
obj-$(CONFIG_SND_SOC_PCM512x_I2C) += snd-soc-pcm512x-i2c.o
obj-$(CONFIG_SND_SOC_PCM512x_SPI) += snd-soc-pcm512x-spi.o
......
/*
* PCM3168A codec i2c driver
*
* Copyright (C) 2015 Imagination Technologies Ltd.
*
* Author: Damien Horsley <Damien.Horsley@imgtec.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*/
#include <linux/i2c.h>
#include <linux/init.h>
#include <linux/module.h>
#include <sound/soc.h>
#include "pcm3168a.h"
static int pcm3168a_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
struct regmap *regmap;
regmap = devm_regmap_init_i2c(i2c, &pcm3168a_regmap);
if (IS_ERR(regmap))
return PTR_ERR(regmap);
return pcm3168a_probe(&i2c->dev, regmap);
}
static int pcm3168a_i2c_remove(struct i2c_client *i2c)
{
pcm3168a_remove(&i2c->dev);
return 0;
}
static const struct i2c_device_id pcm3168a_i2c_id[] = {
{ "pcm3168a", },
{ }
};
MODULE_DEVICE_TABLE(i2c, pcm3168a_i2c_id);
static const struct of_device_id pcm3168a_of_match[] = {
{ .compatible = "ti,pcm3168a", },
{ }
};
MODULE_DEVICE_TABLE(of, pcm3168a_of_match);
static struct i2c_driver pcm3168a_i2c_driver = {
.probe = pcm3168a_i2c_probe,
.remove = pcm3168a_i2c_remove,
.id_table = pcm3168a_i2c_id,
.driver = {
.name = "pcm3168a",
.of_match_table = pcm3168a_of_match,
.pm = &pcm3168a_pm_ops,
},
};
module_i2c_driver(pcm3168a_i2c_driver);
MODULE_DESCRIPTION("PCM3168A I2C codec driver");
MODULE_AUTHOR("Damien Horsley <Damien.Horsley@imgtec.com>");
MODULE_LICENSE("GPL v2");
/*
* PCM3168A codec spi driver
*
* Copyright (C) 2015 Imagination Technologies Ltd.
*
* Author: Damien Horsley <Damien.Horsley@imgtec.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*/
#include <linux/init.h>
#include <linux/module.h>
#include <linux/spi/spi.h>
#include <sound/soc.h>
#include "pcm3168a.h"
static int pcm3168a_spi_probe(struct spi_device *spi)
{
struct regmap *regmap;
regmap = devm_regmap_init_spi(spi, &pcm3168a_regmap);
if (IS_ERR(regmap))
return PTR_ERR(regmap);
return pcm3168a_probe(&spi->dev, regmap);
}
static int pcm3168a_spi_remove(struct spi_device *spi)
{
pcm3168a_remove(&spi->dev);
return 0;
}
static const struct spi_device_id pcm3168a_spi_id[] = {
{ "pcm3168a", },
{ },
};
MODULE_DEVICE_TABLE(spi, pcm3168a_spi_id);
static const struct of_device_id pcm3168a_of_match[] = {
{ .compatible = "ti,pcm3168a", },
{ }
};
MODULE_DEVICE_TABLE(of, pcm3168a_of_match);
static struct spi_driver pcm3168a_spi_driver = {
.probe = pcm3168a_spi_probe,
.remove = pcm3168a_spi_remove,
.id_table = pcm3168a_spi_id,
.driver = {
.name = "pcm3168a",
.of_match_table = pcm3168a_of_match,
.pm = &pcm3168a_pm_ops,
},
};
module_spi_driver(pcm3168a_spi_driver);
MODULE_DESCRIPTION("PCM3168A SPI codec driver");
MODULE_AUTHOR("Damien Horsley <Damien.Horsley@imgtec.com>");
MODULE_LICENSE("GPL v2");
This diff is collapsed.
/*
* PCM3168A codec driver header
*
* Copyright (C) 2015 Imagination Technologies Ltd.
*
* Author: Damien Horsley <Damien.Horsley@imgtec.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*/
#ifndef __PCM3168A_H__
#define __PCM3168A_H__
extern const struct dev_pm_ops pcm3168a_pm_ops;
extern const struct regmap_config pcm3168a_regmap;
extern int pcm3168a_probe(struct device *dev, struct regmap *regmap);
extern void pcm3168a_remove(struct device *dev);
#define PCM3168A_RST_SMODE 0x40
#define PCM3168A_MRST_MASK 0x80
#define PCM3168A_SRST_MASK 0x40
#define PCM3168A_DAC_SRDA_SHIFT 0
#define PCM3168A_DAC_SRDA_MASK 0x3
#define PCM3168A_DAC_PWR_MST_FMT 0x41
#define PCM3168A_DAC_PSMDA_SHIFT 7
#define PCM3168A_DAC_PSMDA_MASK 0x80
#define PCM3168A_DAC_MSDA_SHIFT 4
#define PCM3168A_DAC_MSDA_MASK 0x70
#define PCM3168A_DAC_FMT_SHIFT 0
#define PCM3168A_DAC_FMT_MASK 0xf
#define PCM3168A_DAC_OP_FLT 0x42
#define PCM3168A_DAC_OPEDA_SHIFT 4
#define PCM3168A_DAC_OPEDA_MASK 0xf0
#define PCM3168A_DAC_FLT_SHIFT 0
#define PCM3168A_DAC_FLT_MASK 0xf
#define PCM3168A_DAC_INV 0x43
#define PCM3168A_DAC_MUTE 0x44
#define PCM3168A_DAC_ZERO 0x45
#define PCM3168A_DAC_ATT_DEMP_ZF 0x46
#define PCM3168A_DAC_ATMDDA_MASK 0x80
#define PCM3168A_DAC_ATMDDA_SHIFT 7
#define PCM3168A_DAC_ATSPDA_MASK 0x40
#define PCM3168A_DAC_ATSPDA_SHIFT 6
#define PCM3168A_DAC_DEMP_SHIFT 4
#define PCM3168A_DAC_DEMP_MASK 0x30
#define PCM3168A_DAC_AZRO_SHIFT 1
#define PCM3168A_DAC_AZRO_MASK 0xe
#define PCM3168A_DAC_ZREV_MASK 0x1
#define PCM3168A_DAC_ZREV_SHIFT 0
#define PCM3168A_DAC_VOL_MASTER 0x47
#define PCM3168A_DAC_VOL_CHAN_START 0x48
#define PCM3168A_ADC_SMODE 0x50
#define PCM3168A_ADC_SRAD_SHIFT 0
#define PCM3168A_ADC_SRAD_MASK 0x3
#define PCM3168A_ADC_MST_FMT 0x51
#define PCM3168A_ADC_MSAD_SHIFT 4
#define PCM3168A_ADC_MSAD_MASK 0x70
#define PCM3168A_ADC_FMTAD_SHIFT 0
#define PCM3168A_ADC_FMTAD_MASK 0x7
#define PCM3168A_ADC_PWR_HPFB 0x52
#define PCM3168A_ADC_PSVAD_SHIFT 4
#define PCM3168A_ADC_PSVAD_MASK 0x70
#define PCM3168A_ADC_BYP_SHIFT 0
#define PCM3168A_ADC_BYP_MASK 0x7
#define PCM3168A_ADC_SEAD 0x53
#define PCM3168A_ADC_INV 0x54
#define PCM3168A_ADC_MUTE 0x55
#define PCM3168A_ADC_OV 0x56
#define PCM3168A_ADC_ATT_OVF 0x57
#define PCM3168A_ADC_ATMDAD_MASK 0x80
#define PCM3168A_ADC_ATMDAD_SHIFT 7
#define PCM3168A_ADC_ATSPAD_MASK 0x40
#define PCM3168A_ADC_ATSPAD_SHIFT 6
#define PCM3168A_ADC_OVFP_MASK 0x1
#define PCM3168A_ADC_OVFP_SHIFT 0
#define PCM3168A_ADC_VOL_MASTER 0x58
#define PCM3168A_ADC_VOL_CHAN_START 0x59
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment