2019-05-29 23:57:50 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
2009-10-09 12:55:41 +00:00
|
|
|
/*
|
|
|
|
* ALSA SoC Texas Instruments TPA6130A2 headset stereo amplifier driver
|
|
|
|
*
|
|
|
|
* Copyright (C) Nokia Corporation
|
|
|
|
*
|
2011-05-03 15:12:41 +00:00
|
|
|
* Author: Peter Ujfalusi <peter.ujfalusi@ti.com>
|
2009-10-09 12:55:41 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/errno.h>
|
|
|
|
#include <linux/device.h>
|
|
|
|
#include <linux/i2c.h>
|
|
|
|
#include <linux/gpio.h>
|
2009-12-09 10:05:50 +00:00
|
|
|
#include <linux/regulator/consumer.h>
|
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.
percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.
http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.
* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.
* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.
The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.
2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.
3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.
4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.
5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.
6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).
* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig
8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.
Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-24 08:04:11 +00:00
|
|
|
#include <linux/slab.h>
|
2009-10-09 12:55:41 +00:00
|
|
|
#include <sound/tpa6130a2-plat.h>
|
|
|
|
#include <sound/soc.h>
|
|
|
|
#include <sound/tlv.h>
|
2014-04-04 05:59:13 +00:00
|
|
|
#include <linux/of.h>
|
2013-10-23 12:03:28 +00:00
|
|
|
#include <linux/of_gpio.h>
|
2016-06-20 17:12:30 +00:00
|
|
|
#include <linux/regmap.h>
|
2009-10-09 12:55:41 +00:00
|
|
|
|
|
|
|
#include "tpa6130a2.h"
|
|
|
|
|
2011-08-30 11:39:54 +00:00
|
|
|
enum tpa_model {
|
|
|
|
TPA6130A2,
|
|
|
|
TPA6140A2,
|
|
|
|
};
|
|
|
|
|
2009-10-09 12:55:41 +00:00
|
|
|
/* This struct is used to save the context */
|
|
|
|
struct tpa6130a2_data {
|
2016-06-23 19:23:13 +00:00
|
|
|
struct device *dev;
|
2016-06-20 17:12:30 +00:00
|
|
|
struct regmap *regmap;
|
2010-05-19 07:52:28 +00:00
|
|
|
struct regulator *supply;
|
2009-10-09 12:55:41 +00:00
|
|
|
int power_gpio;
|
2010-05-04 08:08:18 +00:00
|
|
|
enum tpa_model id;
|
2009-10-09 12:55:41 +00:00
|
|
|
};
|
|
|
|
|
2016-06-23 19:23:13 +00:00
|
|
|
static int tpa6130a2_power(struct tpa6130a2_data *data, bool enable)
|
2009-10-09 12:55:41 +00:00
|
|
|
{
|
2016-09-22 10:10:40 +00:00
|
|
|
int ret = 0, ret2;
|
2009-12-09 10:05:50 +00:00
|
|
|
|
2016-06-23 19:23:13 +00:00
|
|
|
if (enable) {
|
2010-05-19 07:52:28 +00:00
|
|
|
ret = regulator_enable(data->supply);
|
2009-12-09 10:05:50 +00:00
|
|
|
if (ret != 0) {
|
2016-06-23 19:23:13 +00:00
|
|
|
dev_err(data->dev,
|
2010-05-19 07:52:28 +00:00
|
|
|
"Failed to enable supply: %d\n", ret);
|
2016-06-23 19:23:13 +00:00
|
|
|
return ret;
|
2009-10-09 12:55:41 +00:00
|
|
|
}
|
2010-11-08 08:57:57 +00:00
|
|
|
/* Power on */
|
|
|
|
if (data->power_gpio >= 0)
|
|
|
|
gpio_set_value(data->power_gpio, 1);
|
2016-09-22 10:10:40 +00:00
|
|
|
|
|
|
|
/* Sync registers */
|
|
|
|
regcache_cache_only(data->regmap, false);
|
|
|
|
ret = regcache_sync(data->regmap);
|
|
|
|
if (ret != 0) {
|
|
|
|
dev_err(data->dev,
|
|
|
|
"Failed to sync registers: %d\n", ret);
|
2016-09-26 10:35:50 +00:00
|
|
|
regcache_cache_only(data->regmap, true);
|
|
|
|
if (data->power_gpio >= 0)
|
|
|
|
gpio_set_value(data->power_gpio, 0);
|
|
|
|
ret2 = regulator_disable(data->supply);
|
|
|
|
if (ret2 != 0)
|
|
|
|
dev_err(data->dev,
|
|
|
|
"Failed to disable supply: %d\n", ret2);
|
|
|
|
return ret;
|
2016-09-22 10:10:40 +00:00
|
|
|
}
|
2010-11-30 14:00:00 +00:00
|
|
|
} else {
|
2016-09-22 10:10:40 +00:00
|
|
|
/* Powered off device does not retain registers. While device
|
|
|
|
* is off, any register updates (i.e. volume changes) should
|
|
|
|
* happen in cache only.
|
|
|
|
*/
|
|
|
|
regcache_mark_dirty(data->regmap);
|
|
|
|
regcache_cache_only(data->regmap, true);
|
|
|
|
|
2009-10-09 12:55:41 +00:00
|
|
|
/* Power off */
|
2009-12-09 10:05:50 +00:00
|
|
|
if (data->power_gpio >= 0)
|
2009-10-09 12:55:41 +00:00
|
|
|
gpio_set_value(data->power_gpio, 0);
|
2009-12-09 10:05:50 +00:00
|
|
|
|
2016-09-26 10:35:50 +00:00
|
|
|
ret = regulator_disable(data->supply);
|
|
|
|
if (ret != 0) {
|
2016-06-23 19:23:13 +00:00
|
|
|
dev_err(data->dev,
|
2016-09-26 10:35:50 +00:00
|
|
|
"Failed to disable supply: %d\n", ret);
|
|
|
|
return ret;
|
2009-10-09 12:55:41 +00:00
|
|
|
}
|
|
|
|
}
|
2009-12-09 10:05:50 +00:00
|
|
|
|
|
|
|
return ret;
|
2009-10-09 12:55:41 +00:00
|
|
|
}
|
|
|
|
|
2016-06-23 19:23:13 +00:00
|
|
|
static int tpa6130a2_power_event(struct snd_soc_dapm_widget *w,
|
|
|
|
struct snd_kcontrol *kctrl, int event)
|
|
|
|
{
|
|
|
|
struct snd_soc_component *c = snd_soc_dapm_to_component(w->dapm);
|
|
|
|
struct tpa6130a2_data *data = snd_soc_component_get_drvdata(c);
|
|
|
|
|
|
|
|
if (SND_SOC_DAPM_EVENT_ON(event)) {
|
2016-09-22 10:10:40 +00:00
|
|
|
/* Before widget power up: turn chip on, sync registers */
|
|
|
|
return tpa6130a2_power(data, true);
|
2016-06-23 19:23:13 +00:00
|
|
|
} else {
|
2016-09-22 10:10:40 +00:00
|
|
|
/* After widget power down: turn chip off */
|
|
|
|
return tpa6130a2_power(data, false);
|
2016-06-23 19:23:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-10-09 12:55:41 +00:00
|
|
|
/*
|
|
|
|
* TPA6130 volume. From -59.5 to 4 dB with increasing step size when going
|
|
|
|
* down in gain.
|
|
|
|
*/
|
2015-08-02 15:19:55 +00:00
|
|
|
static const DECLARE_TLV_DB_RANGE(tpa6130_tlv,
|
2009-10-09 12:55:41 +00:00
|
|
|
0, 1, TLV_DB_SCALE_ITEM(-5950, 600, 0),
|
|
|
|
2, 3, TLV_DB_SCALE_ITEM(-5000, 250, 0),
|
|
|
|
4, 5, TLV_DB_SCALE_ITEM(-4550, 160, 0),
|
|
|
|
6, 7, TLV_DB_SCALE_ITEM(-4140, 190, 0),
|
|
|
|
8, 9, TLV_DB_SCALE_ITEM(-3650, 120, 0),
|
|
|
|
10, 11, TLV_DB_SCALE_ITEM(-3330, 160, 0),
|
|
|
|
12, 13, TLV_DB_SCALE_ITEM(-3040, 180, 0),
|
|
|
|
14, 20, TLV_DB_SCALE_ITEM(-2710, 110, 0),
|
|
|
|
21, 37, TLV_DB_SCALE_ITEM(-1960, 74, 0),
|
2015-08-02 15:19:55 +00:00
|
|
|
38, 63, TLV_DB_SCALE_ITEM(-720, 45, 0)
|
|
|
|
);
|
2009-10-09 12:55:41 +00:00
|
|
|
|
|
|
|
static const struct snd_kcontrol_new tpa6130a2_controls[] = {
|
2016-06-20 17:12:31 +00:00
|
|
|
SOC_SINGLE_TLV("Headphone Playback Volume",
|
2009-10-09 12:55:41 +00:00
|
|
|
TPA6130A2_REG_VOL_MUTE, 0, 0x3f, 0,
|
|
|
|
tpa6130_tlv),
|
|
|
|
};
|
|
|
|
|
2015-08-02 15:19:55 +00:00
|
|
|
static const DECLARE_TLV_DB_RANGE(tpa6140_tlv,
|
2010-05-04 08:08:18 +00:00
|
|
|
0, 8, TLV_DB_SCALE_ITEM(-5900, 400, 0),
|
|
|
|
9, 16, TLV_DB_SCALE_ITEM(-2500, 200, 0),
|
2015-08-02 15:19:55 +00:00
|
|
|
17, 31, TLV_DB_SCALE_ITEM(-1000, 100, 0)
|
|
|
|
);
|
2010-05-04 08:08:18 +00:00
|
|
|
|
|
|
|
static const struct snd_kcontrol_new tpa6140a2_controls[] = {
|
2016-06-20 17:12:31 +00:00
|
|
|
SOC_SINGLE_TLV("Headphone Playback Volume",
|
2010-05-07 11:24:10 +00:00
|
|
|
TPA6130A2_REG_VOL_MUTE, 1, 0x1f, 0,
|
|
|
|
tpa6140_tlv),
|
2010-05-04 08:08:18 +00:00
|
|
|
};
|
|
|
|
|
2016-06-20 17:12:29 +00:00
|
|
|
static int tpa6130a2_component_probe(struct snd_soc_component *component)
|
2009-10-09 12:55:41 +00:00
|
|
|
{
|
2016-06-20 17:12:29 +00:00
|
|
|
struct tpa6130a2_data *data = snd_soc_component_get_drvdata(component);
|
2010-05-04 08:08:18 +00:00
|
|
|
|
|
|
|
if (data->id == TPA6140A2)
|
2016-06-20 17:12:29 +00:00
|
|
|
return snd_soc_add_component_controls(component,
|
|
|
|
tpa6140a2_controls, ARRAY_SIZE(tpa6140a2_controls));
|
2010-05-04 08:08:18 +00:00
|
|
|
else
|
2016-06-20 17:12:29 +00:00
|
|
|
return snd_soc_add_component_controls(component,
|
|
|
|
tpa6130a2_controls, ARRAY_SIZE(tpa6130a2_controls));
|
2009-10-09 12:55:41 +00:00
|
|
|
}
|
2016-06-20 17:12:29 +00:00
|
|
|
|
2016-06-23 19:23:13 +00:00
|
|
|
static const struct snd_soc_dapm_widget tpa6130a2_dapm_widgets[] = {
|
|
|
|
SND_SOC_DAPM_INPUT("LEFTIN"),
|
|
|
|
SND_SOC_DAPM_INPUT("RIGHTIN"),
|
|
|
|
SND_SOC_DAPM_OUTPUT("HPLEFT"),
|
|
|
|
SND_SOC_DAPM_OUTPUT("HPRIGHT"),
|
|
|
|
|
|
|
|
SND_SOC_DAPM_PGA("Left Mute", TPA6130A2_REG_VOL_MUTE,
|
|
|
|
TPA6130A2_HP_EN_L_SHIFT, 1, NULL, 0),
|
|
|
|
SND_SOC_DAPM_PGA("Right Mute", TPA6130A2_REG_VOL_MUTE,
|
|
|
|
TPA6130A2_HP_EN_R_SHIFT, 1, NULL, 0),
|
|
|
|
SND_SOC_DAPM_PGA("Left PGA", TPA6130A2_REG_CONTROL,
|
|
|
|
TPA6130A2_HP_EN_L_SHIFT, 0, NULL, 0),
|
|
|
|
SND_SOC_DAPM_PGA("Right PGA", TPA6130A2_REG_CONTROL,
|
|
|
|
TPA6130A2_HP_EN_R_SHIFT, 0, NULL, 0),
|
|
|
|
|
|
|
|
SND_SOC_DAPM_SUPPLY("Power", TPA6130A2_REG_CONTROL,
|
|
|
|
TPA6130A2_SWS_SHIFT, 1, tpa6130a2_power_event,
|
|
|
|
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct snd_soc_dapm_route tpa6130a2_dapm_routes[] = {
|
|
|
|
{ "Left PGA", NULL, "LEFTIN" },
|
|
|
|
{ "Right PGA", NULL, "RIGHTIN" },
|
|
|
|
|
|
|
|
{ "Left Mute", NULL, "Left PGA" },
|
|
|
|
{ "Right Mute", NULL, "Right PGA" },
|
|
|
|
|
|
|
|
{ "HPLEFT", NULL, "Left Mute" },
|
|
|
|
{ "HPRIGHT", NULL, "Right Mute" },
|
|
|
|
|
|
|
|
{ "Left PGA", NULL, "Power" },
|
|
|
|
{ "Right PGA", NULL, "Power" },
|
|
|
|
};
|
|
|
|
|
2016-09-26 22:45:11 +00:00
|
|
|
static const struct snd_soc_component_driver tpa6130a2_component_driver = {
|
2016-06-20 17:12:29 +00:00
|
|
|
.name = "tpa6130a2",
|
|
|
|
.probe = tpa6130a2_component_probe,
|
2016-06-23 19:23:13 +00:00
|
|
|
.dapm_widgets = tpa6130a2_dapm_widgets,
|
|
|
|
.num_dapm_widgets = ARRAY_SIZE(tpa6130a2_dapm_widgets),
|
|
|
|
.dapm_routes = tpa6130a2_dapm_routes,
|
|
|
|
.num_dapm_routes = ARRAY_SIZE(tpa6130a2_dapm_routes),
|
2016-06-20 17:12:29 +00:00
|
|
|
};
|
2009-10-09 12:55:41 +00:00
|
|
|
|
2016-06-20 17:12:30 +00:00
|
|
|
static const struct reg_default tpa6130a2_reg_defaults[] = {
|
|
|
|
{ TPA6130A2_REG_CONTROL, TPA6130A2_SWS },
|
|
|
|
{ TPA6130A2_REG_VOL_MUTE, TPA6130A2_MUTE_R | TPA6130A2_MUTE_L },
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct regmap_config tpa6130a2_regmap_config = {
|
|
|
|
.reg_bits = 8,
|
|
|
|
.val_bits = 8,
|
|
|
|
.max_register = TPA6130A2_REG_VERSION,
|
|
|
|
.reg_defaults = tpa6130a2_reg_defaults,
|
|
|
|
.num_reg_defaults = ARRAY_SIZE(tpa6130a2_reg_defaults),
|
|
|
|
.cache_type = REGCACHE_RBTREE,
|
|
|
|
};
|
|
|
|
|
2012-12-07 14:26:37 +00:00
|
|
|
static int tpa6130a2_probe(struct i2c_client *client,
|
|
|
|
const struct i2c_device_id *id)
|
2009-10-09 12:55:41 +00:00
|
|
|
{
|
|
|
|
struct device *dev;
|
|
|
|
struct tpa6130a2_data *data;
|
2013-10-23 12:03:28 +00:00
|
|
|
struct tpa6130a2_platform_data *pdata = client->dev.platform_data;
|
|
|
|
struct device_node *np = client->dev.of_node;
|
2010-05-19 07:52:28 +00:00
|
|
|
const char *regulator;
|
2016-06-20 17:12:30 +00:00
|
|
|
unsigned int version;
|
2010-05-19 07:52:28 +00:00
|
|
|
int ret;
|
2009-10-09 12:55:41 +00:00
|
|
|
|
|
|
|
dev = &client->dev;
|
|
|
|
|
2011-12-29 04:12:29 +00:00
|
|
|
data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL);
|
2014-06-20 09:59:02 +00:00
|
|
|
if (!data)
|
2009-10-09 12:55:41 +00:00
|
|
|
return -ENOMEM;
|
|
|
|
|
2016-06-23 19:23:13 +00:00
|
|
|
data->dev = dev;
|
|
|
|
|
2016-06-20 17:12:30 +00:00
|
|
|
data->regmap = devm_regmap_init_i2c(client, &tpa6130a2_regmap_config);
|
|
|
|
if (IS_ERR(data->regmap))
|
|
|
|
return PTR_ERR(data->regmap);
|
|
|
|
|
2013-10-23 12:03:28 +00:00
|
|
|
if (pdata) {
|
|
|
|
data->power_gpio = pdata->power_gpio;
|
|
|
|
} else if (np) {
|
|
|
|
data->power_gpio = of_get_named_gpio(np, "power-gpio", 0);
|
|
|
|
} else {
|
|
|
|
dev_err(dev, "Platform data not set\n");
|
|
|
|
dump_stack();
|
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
|
2016-06-23 19:23:13 +00:00
|
|
|
i2c_set_clientdata(client, data);
|
2009-10-09 12:55:41 +00:00
|
|
|
|
2011-08-30 11:39:52 +00:00
|
|
|
data->id = id->driver_data;
|
2009-10-09 12:55:41 +00:00
|
|
|
|
|
|
|
if (data->power_gpio >= 0) {
|
2012-12-07 11:02:26 +00:00
|
|
|
ret = devm_gpio_request(dev, data->power_gpio,
|
|
|
|
"tpa6130a2 enable");
|
2009-10-09 12:55:41 +00:00
|
|
|
if (ret < 0) {
|
|
|
|
dev_err(dev, "Failed to request power GPIO (%d)\n",
|
|
|
|
data->power_gpio);
|
2016-06-23 19:23:14 +00:00
|
|
|
return ret;
|
2009-10-09 12:55:41 +00:00
|
|
|
}
|
|
|
|
gpio_direction_output(data->power_gpio, 0);
|
|
|
|
}
|
|
|
|
|
2010-05-04 08:08:18 +00:00
|
|
|
switch (data->id) {
|
2010-05-19 07:52:28 +00:00
|
|
|
default:
|
|
|
|
dev_warn(dev, "Unknown TPA model (%d). Assuming 6130A2\n",
|
2011-08-30 11:39:52 +00:00
|
|
|
data->id);
|
2020-07-09 01:03:59 +00:00
|
|
|
fallthrough;
|
2010-01-08 15:48:31 +00:00
|
|
|
case TPA6130A2:
|
2010-05-19 07:52:28 +00:00
|
|
|
regulator = "Vdd";
|
2010-01-08 15:48:31 +00:00
|
|
|
break;
|
|
|
|
case TPA6140A2:
|
2010-05-19 07:52:28 +00:00
|
|
|
regulator = "AVdd";
|
2010-01-08 15:48:31 +00:00
|
|
|
break;
|
|
|
|
}
|
2009-12-09 10:05:50 +00:00
|
|
|
|
2012-12-07 11:02:26 +00:00
|
|
|
data->supply = devm_regulator_get(dev, regulator);
|
2010-05-19 07:52:28 +00:00
|
|
|
if (IS_ERR(data->supply)) {
|
|
|
|
ret = PTR_ERR(data->supply);
|
|
|
|
dev_err(dev, "Failed to request supply: %d\n", ret);
|
2016-06-23 19:23:14 +00:00
|
|
|
return ret;
|
2009-12-09 10:05:50 +00:00
|
|
|
}
|
|
|
|
|
2016-06-23 19:23:13 +00:00
|
|
|
ret = tpa6130a2_power(data, true);
|
2009-12-09 10:05:50 +00:00
|
|
|
if (ret != 0)
|
2016-06-23 19:23:14 +00:00
|
|
|
return ret;
|
2009-12-09 10:05:50 +00:00
|
|
|
|
2009-10-09 12:55:41 +00:00
|
|
|
|
|
|
|
/* Read version */
|
2016-06-20 17:12:30 +00:00
|
|
|
regmap_read(data->regmap, TPA6130A2_REG_VERSION, &version);
|
|
|
|
version &= TPA6130A2_VERSION_MASK;
|
|
|
|
if ((version != 1) && (version != 2))
|
|
|
|
dev_warn(dev, "UNTESTED version detected (%d)\n", version);
|
2009-10-09 12:55:41 +00:00
|
|
|
|
|
|
|
/* Disable the chip */
|
2016-06-23 19:23:13 +00:00
|
|
|
ret = tpa6130a2_power(data, false);
|
2009-12-09 10:05:50 +00:00
|
|
|
if (ret != 0)
|
2016-06-23 19:23:14 +00:00
|
|
|
return ret;
|
2009-10-09 12:55:41 +00:00
|
|
|
|
2016-06-20 17:12:29 +00:00
|
|
|
return devm_snd_soc_register_component(&client->dev,
|
|
|
|
&tpa6130a2_component_driver, NULL, 0);
|
2009-10-09 12:55:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static const struct i2c_device_id tpa6130a2_id[] = {
|
2011-08-30 11:39:52 +00:00
|
|
|
{ "tpa6130a2", TPA6130A2 },
|
|
|
|
{ "tpa6140a2", TPA6140A2 },
|
2009-10-09 12:55:41 +00:00
|
|
|
{ }
|
|
|
|
};
|
|
|
|
MODULE_DEVICE_TABLE(i2c, tpa6130a2_id);
|
|
|
|
|
2013-10-23 12:03:28 +00:00
|
|
|
#if IS_ENABLED(CONFIG_OF)
|
|
|
|
static const struct of_device_id tpa6130a2_of_match[] = {
|
|
|
|
{ .compatible = "ti,tpa6130a2", },
|
|
|
|
{ .compatible = "ti,tpa6140a2" },
|
|
|
|
{},
|
|
|
|
};
|
|
|
|
MODULE_DEVICE_TABLE(of, tpa6130a2_of_match);
|
|
|
|
#endif
|
|
|
|
|
2009-10-09 12:55:41 +00:00
|
|
|
static struct i2c_driver tpa6130a2_i2c_driver = {
|
|
|
|
.driver = {
|
|
|
|
.name = "tpa6130a2",
|
2013-10-23 12:03:28 +00:00
|
|
|
.of_match_table = of_match_ptr(tpa6130a2_of_match),
|
2009-10-09 12:55:41 +00:00
|
|
|
},
|
|
|
|
.probe = tpa6130a2_probe,
|
|
|
|
.id_table = tpa6130a2_id,
|
|
|
|
};
|
|
|
|
|
2012-08-06 11:55:38 +00:00
|
|
|
module_i2c_driver(tpa6130a2_i2c_driver);
|
2009-10-09 12:55:41 +00:00
|
|
|
|
2011-05-03 15:12:41 +00:00
|
|
|
MODULE_AUTHOR("Peter Ujfalusi <peter.ujfalusi@ti.com>");
|
2009-10-09 12:55:41 +00:00
|
|
|
MODULE_DESCRIPTION("TPA6130A2 Headphone amplifier driver");
|
|
|
|
MODULE_LICENSE("GPL");
|