Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 466326c7 authored by Mark Brown's avatar Mark Brown
Browse files

Merge remote-tracking branch 'asoc/topic/pcm186x' into asoc-next

parents b68cbc1d dce231a4
Loading
Loading
Loading
Loading
+42 −0
Original line number Diff line number Diff line
Texas Instruments PCM186x Universal Audio ADC

These devices support both I2C and SPI (configured with pin strapping
on the board).

Required properties:

 - compatible : "ti,pcm1862",
                "ti,pcm1863",
                "ti,pcm1864",
                "ti,pcm1865"

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

 - avdd-supply: Analog core power supply (3.3v)
 - dvdd-supply: Digital core power supply
 - iovdd-supply: Digital IO power supply
        See regulator/regulator.txt for more information

CODEC input pins:
 * VINL1
 * VINR1
 * VINL2
 * VINR2
 * VINL3
 * VINR3
 * VINL4
 * VINR4

The pins can be used in referring sound node's audio-routing property.

Example:

	pcm186x: audio-codec@4a {
		compatible = "ti,pcm1865";
		reg = <0x4a>;

		avdd-supply = <&reg_3v3_analog>;
		dvdd-supply = <&reg_3v3>;
		iovdd-supply = <&reg_1v8>;
	};
+17 −0
Original line number Diff line number Diff line
@@ -109,6 +109,8 @@ config SND_SOC_ALL_CODECS
	select SND_SOC_PCM1681 if I2C
	select SND_SOC_PCM179X_I2C if I2C
	select SND_SOC_PCM179X_SPI if SPI_MASTER
	select SND_SOC_PCM186X_I2C if I2C
	select SND_SOC_PCM186X_SPI if SPI_MASTER
	select SND_SOC_PCM3008
	select SND_SOC_PCM3168A_I2C if I2C
	select SND_SOC_PCM3168A_SPI if SPI_MASTER
@@ -660,6 +662,21 @@ config SND_SOC_PCM179X_SPI
	  Enable support for Texas Instruments PCM179x CODEC.
	  Select this if your PCM179x is connected via an SPI bus.

config SND_SOC_PCM186X
	tristate

config SND_SOC_PCM186X_I2C
	tristate "Texas Instruments PCM186x CODECs - I2C"
	depends on I2C
	select SND_SOC_PCM186X
	select REGMAP_I2C

config SND_SOC_PCM186X_SPI
	tristate "Texas Instruments PCM186x CODECs - SPI"
	depends on SPI_MASTER
	select SND_SOC_PCM186X
	select REGMAP_SPI

config SND_SOC_PCM3008
       tristate

+6 −0
Original line number Diff line number Diff line
@@ -105,6 +105,9 @@ snd-soc-pcm1681-objs := pcm1681.o
snd-soc-pcm179x-codec-objs := pcm179x.o
snd-soc-pcm179x-i2c-objs := pcm179x-i2c.o
snd-soc-pcm179x-spi-objs := pcm179x-spi.o
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-pcm3168a-objs := pcm3168a.o
snd-soc-pcm3168a-i2c-objs := pcm3168a-i2c.o
@@ -344,6 +347,9 @@ obj-$(CONFIG_SND_SOC_PCM1681) += snd-soc-pcm1681.o
obj-$(CONFIG_SND_SOC_PCM179X)	+= snd-soc-pcm179x-codec.o
obj-$(CONFIG_SND_SOC_PCM179X_I2C)	+= snd-soc-pcm179x-i2c.o
obj-$(CONFIG_SND_SOC_PCM179X_SPI)	+= snd-soc-pcm179x-spi.o
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_PCM3168A)	+= snd-soc-pcm3168a.o
obj-$(CONFIG_SND_SOC_PCM3168A_I2C)	+= snd-soc-pcm3168a-i2c.o
+69 −0
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
/*
 * Texas Instruments PCM186x Universal Audio ADC - I2C
 *
 * Copyright (C) 2015-2017 Texas Instruments Incorporated - http://www.ti.com
 *	Andreas Dannenberg <dannenberg@ti.com>
 *	Andrew F. Davis <afd@ti.com>
 */

#include <linux/init.h>
#include <linux/module.h>
#include <linux/i2c.h>

#include "pcm186x.h"

static const struct of_device_id pcm186x_of_match[] = {
	{ .compatible = "ti,pcm1862", .data = (void *)PCM1862 },
	{ .compatible = "ti,pcm1863", .data = (void *)PCM1863 },
	{ .compatible = "ti,pcm1864", .data = (void *)PCM1864 },
	{ .compatible = "ti,pcm1865", .data = (void *)PCM1865 },
	{ }
};
MODULE_DEVICE_TABLE(of, pcm186x_of_match);

static int pcm186x_i2c_probe(struct i2c_client *i2c,
			     const struct i2c_device_id *id)
{
	const enum pcm186x_type type = (enum pcm186x_type)id->driver_data;
	int irq = i2c->irq;
	struct regmap *regmap;

	regmap = devm_regmap_init_i2c(i2c, &pcm186x_regmap);
	if (IS_ERR(regmap))
		return PTR_ERR(regmap);

	return pcm186x_probe(&i2c->dev, type, irq, regmap);
}

static int pcm186x_i2c_remove(struct i2c_client *i2c)
{
	pcm186x_remove(&i2c->dev);

	return 0;
}

static const struct i2c_device_id pcm186x_i2c_id[] = {
	{ "pcm1862", PCM1862 },
	{ "pcm1863", PCM1863 },
	{ "pcm1864", PCM1864 },
	{ "pcm1865", PCM1865 },
	{ }
};
MODULE_DEVICE_TABLE(i2c, pcm186x_i2c_id);

static struct i2c_driver pcm186x_i2c_driver = {
	.probe		= pcm186x_i2c_probe,
	.remove		= pcm186x_i2c_remove,
	.id_table	= pcm186x_i2c_id,
	.driver		= {
		.name	= "pcm186x",
		.of_match_table = pcm186x_of_match,
	},
};
module_i2c_driver(pcm186x_i2c_driver);

MODULE_AUTHOR("Andreas Dannenberg <dannenberg@ti.com>");
MODULE_AUTHOR("Andrew F. Davis <afd@ti.com>");
MODULE_DESCRIPTION("PCM186x Universal Audio ADC I2C Interface Driver");
MODULE_LICENSE("GPL v2");
+69 −0
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
/*
 * Texas Instruments PCM186x Universal Audio ADC - SPI
 *
 * Copyright (C) 2015-2017 Texas Instruments Incorporated - http://www.ti.com
 *	Andreas Dannenberg <dannenberg@ti.com>
 *	Andrew F. Davis <afd@ti.com>
 */

#include <linux/init.h>
#include <linux/module.h>
#include <linux/spi/spi.h>

#include "pcm186x.h"

static const struct of_device_id pcm186x_of_match[] = {
	{ .compatible = "ti,pcm1862", .data = (void *)PCM1862 },
	{ .compatible = "ti,pcm1863", .data = (void *)PCM1863 },
	{ .compatible = "ti,pcm1864", .data = (void *)PCM1864 },
	{ .compatible = "ti,pcm1865", .data = (void *)PCM1865 },
	{ }
};
MODULE_DEVICE_TABLE(of, pcm186x_of_match);

static int pcm186x_spi_probe(struct spi_device *spi)
{
	const enum pcm186x_type type =
			 (enum pcm186x_type)spi_get_device_id(spi)->driver_data;
	int irq = spi->irq;
	struct regmap *regmap;

	regmap = devm_regmap_init_spi(spi, &pcm186x_regmap);
	if (IS_ERR(regmap))
		return PTR_ERR(regmap);

	return pcm186x_probe(&spi->dev, type, irq, regmap);
}

static int pcm186x_spi_remove(struct spi_device *spi)
{
	pcm186x_remove(&spi->dev);

	return 0;
}

static const struct spi_device_id pcm186x_spi_id[] = {
	{ "pcm1862", PCM1862 },
	{ "pcm1863", PCM1863 },
	{ "pcm1864", PCM1864 },
	{ "pcm1865", PCM1865 },
	{ }
};
MODULE_DEVICE_TABLE(spi, pcm186x_spi_id);

static struct spi_driver pcm186x_spi_driver = {
	.probe		= pcm186x_spi_probe,
	.remove		= pcm186x_spi_remove,
	.id_table	= pcm186x_spi_id,
	.driver		= {
		.name	= "pcm186x",
		.of_match_table = pcm186x_of_match,
	},
};
module_spi_driver(pcm186x_spi_driver);

MODULE_AUTHOR("Andreas Dannenberg <dannenberg@ti.com>");
MODULE_AUTHOR("Andrew F. Davis <afd@ti.com>");
MODULE_DESCRIPTION("PCM186x Universal Audio ADC SPI Interface Driver");
MODULE_LICENSE("GPL v2");
Loading