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

Commit 89c172e2 authored by Mark Brown's avatar Mark Brown
Browse files

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

parents a93202fa a9b17a63
Loading
Loading
Loading
Loading
+48 −0
Original line number Diff line number Diff line
Texas Instruments pcm3168a DT bindings

This driver supports both SPI and I2C bus access for this codec

Required properties:

  - compatible: "ti,pcm3168a"

  - clocks : Contains an entry for each entry in clock-names

  - clock-names : Includes the following entries:
	"scki"	The system clock

  - VDD1-supply : Digital power supply regulator 1 (+3.3V)

  - VDD2-supply : Digital power supply regulator 2 (+3.3V)

  - VCCAD1-supply : ADC power supply regulator 1 (+5V)

  - VCCAD2-supply : ADC power supply regulator 2 (+5V)

  - VCCDA1-supply : DAC power supply regulator 1 (+5V)

  - VCCDA2-supply : DAC power supply regulator 2 (+5V)

For required properties on SPI/I2C, consult SPI/I2C device tree documentation

Examples:

i2c0: i2c0@0 {

	...

	pcm3168a: audio-codec@44 {
		compatible = "ti,pcm3168a";
		reg = <0x44>;
		clocks = <&clk_core CLK_AUDIO>;
		clock-names = "scki";
		VDD1-supply = <&supply3v3>;
		VDD2-supply = <&supply3v3>;
		VCCAD1-supply = <&supply5v0>;
		VCCAD2-supply = <&supply5v0>;
		VCCDA1-supply = <&supply5v0>;
		VCCDA2-supply = <&supply5v0>;
		pinctrl-names = "default";
		pinctrl-0 = <&dac_clk_pin>;
	};
};
+8 −0
Original line number Diff line number Diff line
@@ -110,6 +110,14 @@
	.put = snd_soc_put_volsw, \
	.private_value = SOC_DOUBLE_VALUE(reg, shift_left, shift_right, \
					  max, invert, 0) }
#define SOC_DOUBLE_STS(xname, reg, shift_left, shift_right, max, invert) \
{									\
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),		\
	.info = snd_soc_info_volsw, .get = snd_soc_get_volsw,		\
	.access = SNDRV_CTL_ELEM_ACCESS_READ |				\
		SNDRV_CTL_ELEM_ACCESS_VOLATILE,				\
	.private_value = SOC_DOUBLE_VALUE(reg, shift_left, shift_right,	\
					  max, invert, 0) }
#define SOC_DOUBLE_R(xname, reg_left, reg_right, xshift, xmax, xinvert) \
{	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
	.info = snd_soc_info_volsw, \
+17 −0
Original line number Diff line number Diff line
@@ -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

+6 −0
Original line number Diff line number Diff line
@@ -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
+66 −0
Original line number Diff line number Diff line
/*
 * 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");
Loading