aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/sound/ts3a227e.txt5
-rw-r--r--sound/soc/codecs/ts3a227e.c35
-rw-r--r--sound/soc/txx9/txx9aclc.c6
3 files changed, 37 insertions, 9 deletions
diff --git a/Documentation/devicetree/bindings/sound/ts3a227e.txt b/Documentation/devicetree/bindings/sound/ts3a227e.txt
index e8bf23eb1803..a836881d9608 100644
--- a/Documentation/devicetree/bindings/sound/ts3a227e.txt
+++ b/Documentation/devicetree/bindings/sound/ts3a227e.txt
@@ -13,6 +13,11 @@ Required properties:
13 - interrupt-parent: The parent interrupt controller 13 - interrupt-parent: The parent interrupt controller
14 - interrupts: Interrupt number for /INT pin from the 227e 14 - interrupts: Interrupt number for /INT pin from the 227e
15 15
16Optional properies:
17 - ti,micbias: Intended MICBIAS voltage (datasheet section 9.6.7).
18 Select 0/1/2/3/4/5/6/7 to specify MACBIAS voltage
19 2.1V/2.2V/2.3V/2.4V/2.5V/2.6V/2.7V/2.8V
20 Default value is "1" (2.2V).
16 21
17Examples: 22Examples:
18 23
diff --git a/sound/soc/codecs/ts3a227e.c b/sound/soc/codecs/ts3a227e.c
index 9f2dced046de..9fd80ac1897f 100644
--- a/sound/soc/codecs/ts3a227e.c
+++ b/sound/soc/codecs/ts3a227e.c
@@ -20,6 +20,8 @@
20#include <sound/jack.h> 20#include <sound/jack.h>
21#include <sound/soc.h> 21#include <sound/soc.h>
22 22
23#include "ts3a227e.h"
24
23struct ts3a227e { 25struct ts3a227e {
24 struct regmap *regmap; 26 struct regmap *regmap;
25 struct snd_soc_jack *jack; 27 struct snd_soc_jack *jack;
@@ -79,6 +81,10 @@ static const int ts3a227e_buttons[] = {
79/* TS3A227E_REG_SETTING_2 0x05 */ 81/* TS3A227E_REG_SETTING_2 0x05 */
80#define KP_ENABLE 0x04 82#define KP_ENABLE 0x04
81 83
84/* TS3A227E_REG_SETTING_3 0x06 */
85#define MICBIAS_SETTING_SFT (3)
86#define MICBIAS_SETTING_MASK (0x7 << MICBIAS_SETTING_SFT)
87
82/* TS3A227E_REG_ACCESSORY_STATUS 0x0b */ 88/* TS3A227E_REG_ACCESSORY_STATUS 0x0b */
83#define TYPE_3_POLE 0x01 89#define TYPE_3_POLE 0x01
84#define TYPE_4_POLE_OMTP 0x02 90#define TYPE_4_POLE_OMTP 0x02
@@ -221,9 +227,9 @@ int ts3a227e_enable_jack_detect(struct snd_soc_component *component,
221 struct ts3a227e *ts3a227e = snd_soc_component_get_drvdata(component); 227 struct ts3a227e *ts3a227e = snd_soc_component_get_drvdata(component);
222 228
223 snd_jack_set_key(jack->jack, SND_JACK_BTN_0, KEY_MEDIA); 229 snd_jack_set_key(jack->jack, SND_JACK_BTN_0, KEY_MEDIA);
224 snd_jack_set_key(jack->jack, SND_JACK_BTN_1, KEY_VOLUMEUP); 230 snd_jack_set_key(jack->jack, SND_JACK_BTN_1, KEY_VOICECOMMAND);
225 snd_jack_set_key(jack->jack, SND_JACK_BTN_2, KEY_VOLUMEDOWN); 231 snd_jack_set_key(jack->jack, SND_JACK_BTN_2, KEY_VOLUMEUP);
226 snd_jack_set_key(jack->jack, SND_JACK_BTN_3, KEY_VOICECOMMAND); 232 snd_jack_set_key(jack->jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN);
227 233
228 ts3a227e->jack = jack; 234 ts3a227e->jack = jack;
229 ts3a227e_jack_report(ts3a227e); 235 ts3a227e_jack_report(ts3a227e);
@@ -248,6 +254,21 @@ static const struct regmap_config ts3a227e_regmap_config = {
248 .num_reg_defaults = ARRAY_SIZE(ts3a227e_reg_defaults), 254 .num_reg_defaults = ARRAY_SIZE(ts3a227e_reg_defaults),
249}; 255};
250 256
257static int ts3a227e_parse_dt(struct ts3a227e *ts3a227e, struct device_node *np)
258{
259 u32 micbias;
260 int err;
261
262 err = of_property_read_u32(np, "ti,micbias", &micbias);
263 if (!err) {
264 regmap_update_bits(ts3a227e->regmap, TS3A227E_REG_SETTING_3,
265 MICBIAS_SETTING_MASK,
266 (micbias & 0x07) << MICBIAS_SETTING_SFT);
267 }
268
269 return 0;
270}
271
251static int ts3a227e_i2c_probe(struct i2c_client *i2c, 272static int ts3a227e_i2c_probe(struct i2c_client *i2c,
252 const struct i2c_device_id *id) 273 const struct i2c_device_id *id)
253{ 274{
@@ -266,6 +287,14 @@ static int ts3a227e_i2c_probe(struct i2c_client *i2c,
266 if (IS_ERR(ts3a227e->regmap)) 287 if (IS_ERR(ts3a227e->regmap))
267 return PTR_ERR(ts3a227e->regmap); 288 return PTR_ERR(ts3a227e->regmap);
268 289
290 if (dev->of_node) {
291 ret = ts3a227e_parse_dt(ts3a227e, dev->of_node);
292 if (ret) {
293 dev_err(dev, "Failed to parse device tree: %d\n", ret);
294 return ret;
295 }
296 }
297
269 ret = devm_request_threaded_irq(dev, i2c->irq, NULL, ts3a227e_interrupt, 298 ret = devm_request_threaded_irq(dev, i2c->irq, NULL, ts3a227e_interrupt,
270 IRQF_TRIGGER_LOW | IRQF_ONESHOT, 299 IRQF_TRIGGER_LOW | IRQF_ONESHOT,
271 "TS3A227E", ts3a227e); 300 "TS3A227E", ts3a227e);
diff --git a/sound/soc/txx9/txx9aclc.c b/sound/soc/txx9/txx9aclc.c
index 070e44e251ce..88eacfd83da6 100644
--- a/sound/soc/txx9/txx9aclc.c
+++ b/sound/soc/txx9/txx9aclc.c
@@ -282,11 +282,6 @@ static struct snd_pcm_ops txx9aclc_pcm_ops = {
282 .pointer = txx9aclc_pcm_pointer, 282 .pointer = txx9aclc_pcm_pointer,
283}; 283};
284 284
285static void txx9aclc_pcm_free_dma_buffers(struct snd_pcm *pcm)
286{
287 snd_pcm_lib_preallocate_free_for_all(pcm);
288}
289
290static int txx9aclc_pcm_new(struct snd_soc_pcm_runtime *rtd) 285static int txx9aclc_pcm_new(struct snd_soc_pcm_runtime *rtd)
291{ 286{
292 struct snd_card *card = rtd->card->snd_card; 287 struct snd_card *card = rtd->card->snd_card;
@@ -412,7 +407,6 @@ static struct snd_soc_platform_driver txx9aclc_soc_platform = {
412 .remove = txx9aclc_pcm_remove, 407 .remove = txx9aclc_pcm_remove,
413 .ops = &txx9aclc_pcm_ops, 408 .ops = &txx9aclc_pcm_ops,
414 .pcm_new = txx9aclc_pcm_new, 409 .pcm_new = txx9aclc_pcm_new,
415 .pcm_free = txx9aclc_pcm_free_dma_buffers,
416}; 410};
417 411
418static int txx9aclc_soc_platform_probe(struct platform_device *pdev) 412static int txx9aclc_soc_platform_probe(struct platform_device *pdev)