Unverified Commit 6ee47d4a authored by Kirill Marinushkin's avatar Kirill Marinushkin Committed by Mark Brown
Browse files

ASoC: pcm3060: Add codec driver

This commit adds support for TI PCM3060 CODEC.
The technical documentation is available at [1].

[1] http://ti.com/product/pcm3060



Signed-off-by: default avatarKirill Marinushkin <kmarinushkin@birdec.tech>
Cc: Mark Brown <broonie@kernel.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: M R Swami Reddy <mr.swami.reddy@ti.com>
Cc: Vishwas A Deshpande <vishwas.a.deshpande@ti.com>
Cc: Kevin Cernekee <cernekee@chromium.org>
Cc: Peter Ujfalusi <peter.ujfalusi@ti.com>
Cc: alsa-devel@alsa-project.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 6fbf9d8e
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
PCM3060 audio CODEC

This driver supports both I2C and SPI.

Required properties:

- compatible: "ti,pcm3060"

- reg : the I2C address of the device for I2C, the chip select
        number for SPI.

Examples:

	pcm3060: pcm3060@46 {
		 compatible = "ti,pcm3060";
		 reg = <0x46>;
	};
+7 −0
Original line number Diff line number Diff line
@@ -14597,6 +14597,13 @@ L: netdev@vger.kernel.org
S:	Maintained
F:	drivers/net/ethernet/ti/netcp*

TI PCM3060 ASoC CODEC DRIVER
M:	Kirill Marinushkin <kmarinushkin@birdec.tech>
L:	alsa-devel@alsa-project.org (moderated for non-subscribers)
S:	Maintained
F:	Documentation/devicetree/bindings/sound/pcm3060.txt
F:	sound/soc/codecs/pcm3060*

TI TAS571X FAMILY ASoC CODEC DRIVER
M:	Kevin Cernekee <cernekee@chromium.org>
L:	alsa-devel@alsa-project.org (moderated for non-subscribers)
+17 −0
Original line number Diff line number Diff line
@@ -120,6 +120,8 @@ config SND_SOC_ALL_CODECS
	select SND_SOC_PCM186X_I2C if I2C
	select SND_SOC_PCM186X_SPI if SPI_MASTER
	select SND_SOC_PCM3008
	select SND_SOC_PCM3060_I2C if I2C
	select SND_SOC_PCM3060_SPI if SPI_MASTER
	select SND_SOC_PCM3168A_I2C if I2C
	select SND_SOC_PCM3168A_SPI if SPI_MASTER
	select SND_SOC_PCM5102A
@@ -737,6 +739,21 @@ config SND_SOC_PCM186X_SPI
config SND_SOC_PCM3008
       tristate

config SND_SOC_PCM3060
       tristate

config SND_SOC_PCM3060_I2C
	tristate "Texas Instruments PCM3060 CODEC - I2C"
	depends on I2C
	select SND_SOC_PCM3060
	select REGMAP_I2C

config SND_SOC_PCM3060_SPI
	tristate "Texas Instruments PCM3060 CODEC - SPI"
	depends on SPI_MASTER
	select SND_SOC_PCM3060
	select REGMAP_SPI

config SND_SOC_PCM3168A
	tristate

+6 −0
Original line number Diff line number Diff line
@@ -120,6 +120,9 @@ snd-soc-pcm186x-objs := pcm186x.o
snd-soc-pcm186x-i2c-objs := pcm186x-i2c.o
snd-soc-pcm186x-spi-objs := pcm186x-spi.o
snd-soc-pcm3008-objs := pcm3008.o
snd-soc-pcm3060-objs := pcm3060.o
snd-soc-pcm3060-i2c-objs := pcm3060-i2c.o
snd-soc-pcm3060-spi-objs := pcm3060-spi.o
snd-soc-pcm3168a-objs := pcm3168a.o
snd-soc-pcm3168a-i2c-objs := pcm3168a-i2c.o
snd-soc-pcm3168a-spi-objs := pcm3168a-spi.o
@@ -381,6 +384,9 @@ obj-$(CONFIG_SND_SOC_PCM186X) += snd-soc-pcm186x.o
obj-$(CONFIG_SND_SOC_PCM186X_I2C)	+= snd-soc-pcm186x-i2c.o
obj-$(CONFIG_SND_SOC_PCM186X_SPI)	+= snd-soc-pcm186x-spi.o
obj-$(CONFIG_SND_SOC_PCM3008)	+= snd-soc-pcm3008.o
obj-$(CONFIG_SND_SOC_PCM3060)	+= snd-soc-pcm3060.o
obj-$(CONFIG_SND_SOC_PCM3060_I2C)	+= snd-soc-pcm3060-i2c.o
obj-$(CONFIG_SND_SOC_PCM3060_SPI)	+= snd-soc-pcm3060-spi.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
+61 −0
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
/*
 * PCM3060 I2C driver
 *
 * Copyright (C) 2018 Kirill Marinushkin <kmarinushkin@birdec.tech>
 */

#include <linux/i2c.h>
#include <linux/module.h>
#include <sound/soc.h>

#include "pcm3060.h"

static int pcm3060_i2c_probe(struct i2c_client *i2c,
			     const struct i2c_device_id *id)
{
	struct pcm3060_priv *priv;

	priv = devm_kzalloc(&i2c->dev, sizeof(*priv), GFP_KERNEL);
	if (!priv)
		return -ENOMEM;

	i2c_set_clientdata(i2c, priv);

	priv->regmap = devm_regmap_init_i2c(i2c, &pcm3060_regmap);
	if (IS_ERR(priv->regmap))
		return PTR_ERR(priv->regmap);

	return pcm3060_probe(&i2c->dev);
}

static const struct i2c_device_id pcm3060_i2c_id[] = {
	{ .name = "pcm3060" },
	{ },
};
MODULE_DEVICE_TABLE(i2c, pcm3060_i2c_id);

#ifdef CONFIG_OF
static const struct of_device_id pcm3060_of_match[] = {
	{ .compatible = "ti,pcm3060" },
	{ },
};
MODULE_DEVICE_TABLE(of, pcm3060_of_match);
#endif /* CONFIG_OF */

static struct i2c_driver pcm3060_i2c_driver = {
	.driver = {
		.name = "pcm3060",
#ifdef CONFIG_OF
		.of_match_table = pcm3060_of_match,
#endif /* CONFIG_OF */
	},
	.id_table = pcm3060_i2c_id,
	.probe = pcm3060_i2c_probe,
};

module_i2c_driver(pcm3060_i2c_driver);

MODULE_DESCRIPTION("PCM3060 I2C driver");
MODULE_AUTHOR("Kirill Marinushkin <kmarinushkin@birdec.tech>");
MODULE_LICENSE("GPL v2");
Loading