Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 230278
b: refs/heads/master
c: 414c73a
h: refs/heads/master
v: v3
  • Loading branch information
Jarkko Nikula authored and Liam Girdwood committed Nov 3, 2010
1 parent 063d047 commit 88cdef1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 79ee820d2aa24ac2577ca4e89ecc49c26d099707
refs/heads/master: 414c73abfd0e565950f3b02336cf516147f0e104
28 changes: 25 additions & 3 deletions trunk/sound/soc/codecs/tlv320aic3x.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ static const char *aic3x_supply_names[AIC3X_NUM_SUPPLIES] = {
"DRVDD", /* ADC Analog and Output Driver Voltage */
};

static LIST_HEAD(reset_list);

struct aic3x_priv;

struct aic3x_disable_nb {
Expand All @@ -77,6 +79,7 @@ struct aic3x_priv {
struct aic3x_setup_data *setup;
void *control_data;
unsigned int sysclk;
struct list_head list;
int master;
int gpio_reset;
int power;
Expand Down Expand Up @@ -1344,11 +1347,25 @@ static int aic3x_init(struct snd_soc_codec *codec)
return 0;
}

static bool aic3x_is_shared_reset(struct aic3x_priv *aic3x)
{
struct aic3x_priv *a;

list_for_each_entry(a, &reset_list, list) {
if (gpio_is_valid(aic3x->gpio_reset) &&
aic3x->gpio_reset == a->gpio_reset)
return true;
}

return false;
}

static int aic3x_probe(struct snd_soc_codec *codec)
{
struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec);
int ret, i;

INIT_LIST_HEAD(&aic3x->list);
codec->control_data = aic3x->control_data;
aic3x->codec = codec;
codec->idle_bias_off = 1;
Expand All @@ -1359,7 +1376,8 @@ static int aic3x_probe(struct snd_soc_codec *codec)
return ret;
}

if (gpio_is_valid(aic3x->gpio_reset)) {
if (gpio_is_valid(aic3x->gpio_reset) &&
!aic3x_is_shared_reset(aic3x)) {
ret = gpio_request(aic3x->gpio_reset, "tlv320aic3x reset");
if (ret != 0)
goto err_gpio;
Expand Down Expand Up @@ -1405,6 +1423,7 @@ static int aic3x_probe(struct snd_soc_codec *codec)
snd_soc_add_controls(codec, &aic3x_classd_amp_gain_ctrl, 1);

aic3x_add_widgets(codec);
list_add(&aic3x->list, &reset_list);

return 0;

Expand All @@ -1414,7 +1433,8 @@ static int aic3x_probe(struct snd_soc_codec *codec)
&aic3x->disable_nb[i].nb);
regulator_bulk_free(ARRAY_SIZE(aic3x->supplies), aic3x->supplies);
err_get:
if (gpio_is_valid(aic3x->gpio_reset))
if (gpio_is_valid(aic3x->gpio_reset) &&
!aic3x_is_shared_reset(aic3x))
gpio_free(aic3x->gpio_reset);
err_gpio:
kfree(aic3x);
Expand All @@ -1427,7 +1447,9 @@ static int aic3x_remove(struct snd_soc_codec *codec)
int i;

aic3x_set_bias_level(codec, SND_SOC_BIAS_OFF);
if (gpio_is_valid(aic3x->gpio_reset)) {
list_del(&aic3x->list);
if (gpio_is_valid(aic3x->gpio_reset) &&
!aic3x_is_shared_reset(aic3x)) {
gpio_set_value(aic3x->gpio_reset, 0);
gpio_free(aic3x->gpio_reset);
}
Expand Down

0 comments on commit 88cdef1

Please sign in to comment.