Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 216656
b: refs/heads/master
c: 872a64d
h: refs/heads/master
v: v3
  • Loading branch information
Peter Ujfalusi authored and Liam Girdwood committed Oct 21, 2010
1 parent b44d3fd commit 8007577
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 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: cf4bb69884c8f6a5791e0e251f0b9dc5d32fc256
refs/heads/master: 872a64d7e73f0e4dc435295da393db25332172b8
28 changes: 22 additions & 6 deletions trunk/sound/soc/codecs/tpa6130a2.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,21 @@ static u8 tpa6130a2_read(int reg)
return data->regs[reg];
}

static void tpa6130a2_initialize(void)
static int tpa6130a2_initialize(void)
{
struct tpa6130a2_data *data;
int i;
int i, ret = 0;

BUG_ON(tpa6130a2_client == NULL);
data = i2c_get_clientdata(tpa6130a2_client);

for (i = 1; i < TPA6130A2_REG_VERSION; i++)
tpa6130a2_i2c_write(i, data->regs[i]);
for (i = 1; i < TPA6130A2_REG_VERSION; i++) {
ret = tpa6130a2_i2c_write(i, data->regs[i]);
if (ret < 0)
break;
}

return ret;
}

static int tpa6130a2_power(int power)
Expand All @@ -133,7 +138,16 @@ static int tpa6130a2_power(int power)
}

data->power_state = 1;
tpa6130a2_initialize();
ret = tpa6130a2_initialize();
if (ret < 0) {
dev_err(&tpa6130a2_client->dev,
"Failed to initialize chip\n");
if (data->power_gpio >= 0)
gpio_set_value(data->power_gpio, 0);
regulator_disable(data->supply);
data->power_state = 0;
goto exit;
}

/* Clear SWS */
val = tpa6130a2_read(TPA6130A2_REG_CONTROL);
Expand Down Expand Up @@ -375,7 +389,9 @@ int tpa6130a2_add_controls(struct snd_soc_codec *codec)
{
struct tpa6130a2_data *data;

BUG_ON(tpa6130a2_client == NULL);
if (tpa6130a2_client == NULL)
return -ENODEV;

data = i2c_get_clientdata(tpa6130a2_client);

snd_soc_dapm_new_controls(codec, tpa6130a2_dapm_widgets,
Expand Down

0 comments on commit 8007577

Please sign in to comment.