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

Commit 19142ae6 authored by Mark Brown's avatar Mark Brown
Browse files

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

parents fc122f63 e0236f54
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
Texas Instruments pcm179x DT bindings

This driver supports the SPI bus.
This driver supports both the I2C and SPI bus.

Required properties:

@@ -9,6 +9,11 @@ Required properties:
For required properties on SPI, please consult
Documentation/devicetree/bindings/spi/spi-bus.txt

Required properties on I2C:

 - reg: the I2C address


Examples:

	codec_spi: 1792a@0 {
@@ -16,3 +21,7 @@ Examples:
		spi-max-frequency = <600000>;
	};

	codec_i2c: 1792a@4c {
		compatible = "ti,pcm1792a";
		reg = <0x4c>;
	};
+18 −2
Original line number Diff line number Diff line
@@ -87,7 +87,8 @@ config SND_SOC_ALL_CODECS
	select SND_SOC_ML26124 if I2C
	select SND_SOC_NAU8825 if I2C
	select SND_SOC_PCM1681 if I2C
	select SND_SOC_PCM179X if SPI_MASTER
	select SND_SOC_PCM179X_I2C if I2C
	select SND_SOC_PCM179X_SPI if SPI_MASTER
	select SND_SOC_PCM3008
	select SND_SOC_PCM3168A_I2C if I2C
	select SND_SOC_PCM3168A_SPI if SPI_MASTER
@@ -528,8 +529,23 @@ config SND_SOC_PCM1681
	depends on I2C

config SND_SOC_PCM179X
	tristate "Texas Instruments PCM179X CODEC"
	tristate

config SND_SOC_PCM179X_I2C
	tristate "Texas Instruments PCM179X CODEC (I2C)"
	depends on I2C
	select SND_SOC_PCM179X
	help
	  Enable support for Texas Instruments PCM179x CODEC.
	  Select this if your PCM179x is connected via an I2C bus.

config SND_SOC_PCM179X_SPI
	tristate "Texas Instruments PCM179X CODEC (SPI)"
	depends on SPI_MASTER
	select SND_SOC_PCM179X
	help
	  Enable support for Texas Instruments PCM179x CODEC.
	  Select this if your PCM179x is connected via an SPI bus.

config SND_SOC_PCM3008
       tristate
+4 −0
Original line number Diff line number Diff line
@@ -81,6 +81,8 @@ snd-soc-ml26124-objs := ml26124.o
snd-soc-nau8825-objs := nau8825.o
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-pcm3008-objs := pcm3008.o
snd-soc-pcm3168a-objs := pcm3168a.o
snd-soc-pcm3168a-i2c-objs := pcm3168a-i2c.o
@@ -285,6 +287,8 @@ obj-$(CONFIG_SND_SOC_ML26124) += snd-soc-ml26124.o
obj-$(CONFIG_SND_SOC_NAU8825)   += snd-soc-nau8825.o
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_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
+73 −0
Original line number Diff line number Diff line
/*
 * PCM179X ASoC I2C driver
 *
 * Copyright (c) Teenage Engineering AB 2016
 *
 *     Jacob Siverskog <jacob@teenage.engineering>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#include <linux/module.h>
#include <linux/of.h>
#include <linux/i2c.h>
#include <linux/regmap.h>

#include "pcm179x.h"

static int pcm179x_i2c_probe(struct i2c_client *client,
			      const struct i2c_device_id *id)
{
	struct regmap *regmap;
	int ret;

	regmap = devm_regmap_init_i2c(client, &pcm179x_regmap_config);
	if (IS_ERR(regmap)) {
		ret = PTR_ERR(regmap);
		dev_err(&client->dev, "Failed to allocate regmap: %d\n", ret);
		return ret;
	}

	return pcm179x_common_init(&client->dev, regmap);
}

static int pcm179x_i2c_remove(struct i2c_client *client)
{
	return pcm179x_common_exit(&client->dev);
}

static const struct of_device_id pcm179x_of_match[] = {
	{ .compatible = "ti,pcm1792a", },
	{ }
};
MODULE_DEVICE_TABLE(of, pcm179x_of_match);

static const struct i2c_device_id pcm179x_i2c_ids[] = {
	{ "pcm179x", 0 },
	{ }
};
MODULE_DEVICE_TABLE(i2c, pcm179x_i2c_ids);

static struct i2c_driver pcm179x_i2c_driver = {
	.driver = {
		.name	= "pcm179x",
		.of_match_table = of_match_ptr(pcm179x_of_match),
	},
	.id_table	= pcm179x_i2c_ids,
	.probe		= pcm179x_i2c_probe,
	.remove		= pcm179x_i2c_remove,
};

module_i2c_driver(pcm179x_i2c_driver);

MODULE_DESCRIPTION("ASoC PCM179X I2C driver");
MODULE_AUTHOR("Jacob Siverskog <jacob@teenage.engineering>");
MODULE_LICENSE("GPL");
+72 −0
Original line number Diff line number Diff line
/*
 * PCM179X ASoC SPI driver
 *
 * Copyright (c) Amarula Solutions B.V. 2013
 *
 *     Michael Trimarchi <michael@amarulasolutions.com>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#include <linux/module.h>
#include <linux/of.h>
#include <linux/spi/spi.h>
#include <linux/regmap.h>

#include "pcm179x.h"

static int pcm179x_spi_probe(struct spi_device *spi)
{
	struct regmap *regmap;
	int ret;

	regmap = devm_regmap_init_spi(spi, &pcm179x_regmap_config);
	if (IS_ERR(regmap)) {
		ret = PTR_ERR(regmap);
		dev_err(&spi->dev, "Failed to allocate regmap: %d\n", ret);
		return ret;
	}

	return pcm179x_common_init(&spi->dev, regmap);
}

static int pcm179x_spi_remove(struct spi_device *spi)
{
	return pcm179x_common_exit(&spi->dev);
}

static const struct of_device_id pcm179x_of_match[] = {
	{ .compatible = "ti,pcm1792a", },
	{ }
};
MODULE_DEVICE_TABLE(of, pcm179x_of_match);

static const struct spi_device_id pcm179x_spi_ids[] = {
	{ "pcm179x", 0 },
	{ },
};
MODULE_DEVICE_TABLE(spi, pcm179x_spi_ids);

static struct spi_driver pcm179x_spi_driver = {
	.driver = {
		.name = "pcm179x",
		.of_match_table = of_match_ptr(pcm179x_of_match),
	},
	.id_table = pcm179x_spi_ids,
	.probe = pcm179x_spi_probe,
	.remove = pcm179x_spi_remove,
};

module_spi_driver(pcm179x_spi_driver);

MODULE_DESCRIPTION("ASoC PCM179X SPI driver");
MODULE_AUTHOR("Michael Trimarchi <michael@amarulasolutions.com>");
MODULE_LICENSE("GPL");
Loading