diff options
Diffstat (limited to 'sound/soc/codecs/tlv320dac33.c')
-rw-r--r-- | sound/soc/codecs/tlv320dac33.c | 223 |
1 files changed, 118 insertions, 105 deletions
diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c index 3eddaec728c1..ad5e2636c944 100644 --- a/sound/soc/codecs/tlv320dac33.c +++ b/sound/soc/codecs/tlv320dac33.c | |||
@@ -61,6 +61,8 @@ | |||
61 | #define US_TO_SAMPLES(rate, us) \ | 61 | #define US_TO_SAMPLES(rate, us) \ |
62 | (rate / (1000000 / us)) | 62 | (rate / (1000000 / us)) |
63 | 63 | ||
64 | static void dac33_calculate_times(struct snd_pcm_substream *substream); | ||
65 | static int dac33_prepare_chip(struct snd_pcm_substream *substream); | ||
64 | 66 | ||
65 | static struct snd_soc_codec *tlv320dac33_codec; | 67 | static struct snd_soc_codec *tlv320dac33_codec; |
66 | 68 | ||
@@ -91,6 +93,7 @@ struct tlv320dac33_priv { | |||
91 | struct work_struct work; | 93 | struct work_struct work; |
92 | struct snd_soc_codec codec; | 94 | struct snd_soc_codec codec; |
93 | struct regulator_bulk_data supplies[DAC33_NUM_SUPPLIES]; | 95 | struct regulator_bulk_data supplies[DAC33_NUM_SUPPLIES]; |
96 | struct snd_pcm_substream *substream; | ||
94 | int power_gpio; | 97 | int power_gpio; |
95 | int chip_power; | 98 | int chip_power; |
96 | int irq; | 99 | int irq; |
@@ -284,45 +287,47 @@ static int dac33_write16(struct snd_soc_codec *codec, unsigned int reg, | |||
284 | return ret; | 287 | return ret; |
285 | } | 288 | } |
286 | 289 | ||
287 | static void dac33_restore_regs(struct snd_soc_codec *codec) | 290 | static void dac33_init_chip(struct snd_soc_codec *codec) |
288 | { | 291 | { |
289 | struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec); | 292 | struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec); |
290 | u8 *cache = codec->reg_cache; | ||
291 | u8 data[2]; | ||
292 | int i, ret; | ||
293 | 293 | ||
294 | if (!dac33->chip_power) | 294 | if (unlikely(!dac33->chip_power)) |
295 | return; | 295 | return; |
296 | 296 | ||
297 | for (i = DAC33_PWR_CTRL; i <= DAC33_INTP_CTRL_B; i++) { | 297 | /* 44-46: DAC Control Registers */ |
298 | data[0] = i; | 298 | /* A : DAC sample rate Fsref/1.5 */ |
299 | data[1] = cache[i]; | 299 | dac33_write(codec, DAC33_DAC_CTRL_A, DAC33_DACRATE(0)); |
300 | /* Skip the read only registers */ | 300 | /* B : DAC src=normal, not muted */ |
301 | if ((i >= DAC33_INT_OSC_STATUS && | 301 | dac33_write(codec, DAC33_DAC_CTRL_B, DAC33_DACSRCR_RIGHT | |
302 | i <= DAC33_INT_OSC_FREQ_RAT_READ_B) || | 302 | DAC33_DACSRCL_LEFT); |
303 | (i >= DAC33_FIFO_WPTR_MSB && i <= DAC33_FIFO_IRQ_FLAG) || | 303 | /* C : (defaults) */ |
304 | i == DAC33_DAC_STATUS_FLAGS || | 304 | dac33_write(codec, DAC33_DAC_CTRL_C, 0x00); |
305 | i == DAC33_SRC_EST_REF_CLK_RATIO_A || | 305 | |
306 | i == DAC33_SRC_EST_REF_CLK_RATIO_B) | 306 | /* 73 : volume soft stepping control, |
307 | continue; | 307 | clock source = internal osc (?) */ |
308 | ret = codec->hw_write(codec->control_data, data, 2); | 308 | dac33_write(codec, DAC33_ANA_VOL_SOFT_STEP_CTRL, DAC33_VOLCLKEN); |
309 | if (ret != 2) | 309 | |
310 | dev_err(codec->dev, "Write failed (%d)\n", ret); | 310 | dac33_write(codec, DAC33_PWR_CTRL, DAC33_PDNALLB); |
311 | } | 311 | |
312 | for (i = DAC33_LDAC_PWR_CTRL; i <= DAC33_LINEL_TO_LLO_VOL; i++) { | 312 | /* Restore only selected registers (gains mostly) */ |
313 | data[0] = i; | 313 | dac33_write(codec, DAC33_LDAC_DIG_VOL_CTRL, |
314 | data[1] = cache[i]; | 314 | dac33_read_reg_cache(codec, DAC33_LDAC_DIG_VOL_CTRL)); |
315 | ret = codec->hw_write(codec->control_data, data, 2); | 315 | dac33_write(codec, DAC33_RDAC_DIG_VOL_CTRL, |
316 | if (ret != 2) | 316 | dac33_read_reg_cache(codec, DAC33_RDAC_DIG_VOL_CTRL)); |
317 | dev_err(codec->dev, "Write failed (%d)\n", ret); | 317 | |
318 | } | 318 | dac33_write(codec, DAC33_LINEL_TO_LLO_VOL, |
319 | for (i = DAC33_LINER_TO_RLO_VOL; i <= DAC33_OSC_TRIM; i++) { | 319 | dac33_read_reg_cache(codec, DAC33_LINEL_TO_LLO_VOL)); |
320 | data[0] = i; | 320 | dac33_write(codec, DAC33_LINER_TO_RLO_VOL, |
321 | data[1] = cache[i]; | 321 | dac33_read_reg_cache(codec, DAC33_LINER_TO_RLO_VOL)); |
322 | ret = codec->hw_write(codec->control_data, data, 2); | 322 | } |
323 | if (ret != 2) | 323 | |
324 | dev_err(codec->dev, "Write failed (%d)\n", ret); | 324 | static inline void dac33_read_id(struct snd_soc_codec *codec) |
325 | } | 325 | { |
326 | u8 reg; | ||
327 | |||
328 | dac33_read(codec, DAC33_DEVICE_ID_MSB, ®); | ||
329 | dac33_read(codec, DAC33_DEVICE_ID_LSB, ®); | ||
330 | dac33_read(codec, DAC33_DEVICE_REV_ID, ®); | ||
326 | } | 331 | } |
327 | 332 | ||
328 | static inline void dac33_soft_power(struct snd_soc_codec *codec, int power) | 333 | static inline void dac33_soft_power(struct snd_soc_codec *codec, int power) |
@@ -341,9 +346,17 @@ static inline void dac33_soft_power(struct snd_soc_codec *codec, int power) | |||
341 | static int dac33_hard_power(struct snd_soc_codec *codec, int power) | 346 | static int dac33_hard_power(struct snd_soc_codec *codec, int power) |
342 | { | 347 | { |
343 | struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec); | 348 | struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec); |
344 | int ret; | 349 | int ret = 0; |
345 | 350 | ||
346 | mutex_lock(&dac33->mutex); | 351 | mutex_lock(&dac33->mutex); |
352 | |||
353 | /* Safety check */ | ||
354 | if (unlikely(power == dac33->chip_power)) { | ||
355 | dev_warn(codec->dev, "Trying to set the same power state: %s\n", | ||
356 | power ? "ON" : "OFF"); | ||
357 | goto exit; | ||
358 | } | ||
359 | |||
347 | if (power) { | 360 | if (power) { |
348 | ret = regulator_bulk_enable(ARRAY_SIZE(dac33->supplies), | 361 | ret = regulator_bulk_enable(ARRAY_SIZE(dac33->supplies), |
349 | dac33->supplies); | 362 | dac33->supplies); |
@@ -357,11 +370,6 @@ static int dac33_hard_power(struct snd_soc_codec *codec, int power) | |||
357 | gpio_set_value(dac33->power_gpio, 1); | 370 | gpio_set_value(dac33->power_gpio, 1); |
358 | 371 | ||
359 | dac33->chip_power = 1; | 372 | dac33->chip_power = 1; |
360 | |||
361 | /* Restore registers */ | ||
362 | dac33_restore_regs(codec); | ||
363 | |||
364 | dac33_soft_power(codec, 1); | ||
365 | } else { | 373 | } else { |
366 | dac33_soft_power(codec, 0); | 374 | dac33_soft_power(codec, 0); |
367 | if (dac33->power_gpio >= 0) | 375 | if (dac33->power_gpio >= 0) |
@@ -383,6 +391,22 @@ exit: | |||
383 | return ret; | 391 | return ret; |
384 | } | 392 | } |
385 | 393 | ||
394 | static int playback_event(struct snd_soc_dapm_widget *w, | ||
395 | struct snd_kcontrol *kcontrol, int event) | ||
396 | { | ||
397 | struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(w->codec); | ||
398 | |||
399 | switch (event) { | ||
400 | case SND_SOC_DAPM_PRE_PMU: | ||
401 | if (likely(dac33->substream)) { | ||
402 | dac33_calculate_times(dac33->substream); | ||
403 | dac33_prepare_chip(dac33->substream); | ||
404 | } | ||
405 | break; | ||
406 | } | ||
407 | return 0; | ||
408 | } | ||
409 | |||
386 | static int dac33_get_nsample(struct snd_kcontrol *kcontrol, | 410 | static int dac33_get_nsample(struct snd_kcontrol *kcontrol, |
387 | struct snd_ctl_elem_value *ucontrol) | 411 | struct snd_ctl_elem_value *ucontrol) |
388 | { | 412 | { |
@@ -512,6 +536,8 @@ static const struct snd_soc_dapm_widget dac33_dapm_widgets[] = { | |||
512 | DAC33_OUT_AMP_PWR_CTRL, 6, 3, 3, 0), | 536 | DAC33_OUT_AMP_PWR_CTRL, 6, 3, 3, 0), |
513 | SND_SOC_DAPM_REG(snd_soc_dapm_mixer, "Output Right Amp Power", | 537 | SND_SOC_DAPM_REG(snd_soc_dapm_mixer, "Output Right Amp Power", |
514 | DAC33_OUT_AMP_PWR_CTRL, 4, 3, 3, 0), | 538 | DAC33_OUT_AMP_PWR_CTRL, 4, 3, 3, 0), |
539 | |||
540 | SND_SOC_DAPM_PRE("Prepare Playback", playback_event), | ||
515 | }; | 541 | }; |
516 | 542 | ||
517 | static const struct snd_soc_dapm_route audio_map[] = { | 543 | static const struct snd_soc_dapm_route audio_map[] = { |
@@ -554,18 +580,18 @@ static int dac33_set_bias_level(struct snd_soc_codec *codec, | |||
554 | break; | 580 | break; |
555 | case SND_SOC_BIAS_STANDBY: | 581 | case SND_SOC_BIAS_STANDBY: |
556 | if (codec->bias_level == SND_SOC_BIAS_OFF) { | 582 | if (codec->bias_level == SND_SOC_BIAS_OFF) { |
583 | /* Coming from OFF, switch on the codec */ | ||
557 | ret = dac33_hard_power(codec, 1); | 584 | ret = dac33_hard_power(codec, 1); |
558 | if (ret != 0) | 585 | if (ret != 0) |
559 | return ret; | 586 | return ret; |
560 | } | ||
561 | 587 | ||
562 | dac33_soft_power(codec, 0); | 588 | dac33_init_chip(codec); |
589 | } | ||
563 | break; | 590 | break; |
564 | case SND_SOC_BIAS_OFF: | 591 | case SND_SOC_BIAS_OFF: |
565 | ret = dac33_hard_power(codec, 0); | 592 | ret = dac33_hard_power(codec, 0); |
566 | if (ret != 0) | 593 | if (ret != 0) |
567 | return ret; | 594 | return ret; |
568 | |||
569 | break; | 595 | break; |
570 | } | 596 | } |
571 | codec->bias_level = level; | 597 | codec->bias_level = level; |
@@ -708,6 +734,31 @@ static void dac33_oscwait(struct snd_soc_codec *codec) | |||
708 | "internal oscillator calibration failed\n"); | 734 | "internal oscillator calibration failed\n"); |
709 | } | 735 | } |
710 | 736 | ||
737 | static int dac33_startup(struct snd_pcm_substream *substream, | ||
738 | struct snd_soc_dai *dai) | ||
739 | { | ||
740 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
741 | struct snd_soc_device *socdev = rtd->socdev; | ||
742 | struct snd_soc_codec *codec = socdev->card->codec; | ||
743 | struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec); | ||
744 | |||
745 | /* Stream started, save the substream pointer */ | ||
746 | dac33->substream = substream; | ||
747 | |||
748 | return 0; | ||
749 | } | ||
750 | |||
751 | static void dac33_shutdown(struct snd_pcm_substream *substream, | ||
752 | struct snd_soc_dai *dai) | ||
753 | { | ||
754 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
755 | struct snd_soc_device *socdev = rtd->socdev; | ||
756 | struct snd_soc_codec *codec = socdev->card->codec; | ||
757 | struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec); | ||
758 | |||
759 | dac33->substream = NULL; | ||
760 | } | ||
761 | |||
711 | static int dac33_hw_params(struct snd_pcm_substream *substream, | 762 | static int dac33_hw_params(struct snd_pcm_substream *substream, |
712 | struct snd_pcm_hw_params *params, | 763 | struct snd_pcm_hw_params *params, |
713 | struct snd_soc_dai *dai) | 764 | struct snd_soc_dai *dai) |
@@ -791,6 +842,16 @@ static int dac33_prepare_chip(struct snd_pcm_substream *substream) | |||
791 | } | 842 | } |
792 | 843 | ||
793 | mutex_lock(&dac33->mutex); | 844 | mutex_lock(&dac33->mutex); |
845 | |||
846 | if (!dac33->chip_power) { | ||
847 | /* | ||
848 | * Chip is not powered yet. | ||
849 | * Do the init in the dac33_set_bias_level later. | ||
850 | */ | ||
851 | mutex_unlock(&dac33->mutex); | ||
852 | return 0; | ||
853 | } | ||
854 | |||
794 | dac33_soft_power(codec, 0); | 855 | dac33_soft_power(codec, 0); |
795 | dac33_soft_power(codec, 1); | 856 | dac33_soft_power(codec, 1); |
796 | 857 | ||
@@ -997,15 +1058,6 @@ static void dac33_calculate_times(struct snd_pcm_substream *substream) | |||
997 | 1058 | ||
998 | } | 1059 | } |
999 | 1060 | ||
1000 | static int dac33_pcm_prepare(struct snd_pcm_substream *substream, | ||
1001 | struct snd_soc_dai *dai) | ||
1002 | { | ||
1003 | dac33_calculate_times(substream); | ||
1004 | dac33_prepare_chip(substream); | ||
1005 | |||
1006 | return 0; | ||
1007 | } | ||
1008 | |||
1009 | static int dac33_pcm_trigger(struct snd_pcm_substream *substream, int cmd, | 1061 | static int dac33_pcm_trigger(struct snd_pcm_substream *substream, int cmd, |
1010 | struct snd_soc_dai *dai) | 1062 | struct snd_soc_dai *dai) |
1011 | { | 1063 | { |
@@ -1269,35 +1321,6 @@ static int dac33_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
1269 | return 0; | 1321 | return 0; |
1270 | } | 1322 | } |
1271 | 1323 | ||
1272 | static void dac33_init_chip(struct snd_soc_codec *codec) | ||
1273 | { | ||
1274 | /* 44-46: DAC Control Registers */ | ||
1275 | /* A : DAC sample rate Fsref/1.5 */ | ||
1276 | dac33_write(codec, DAC33_DAC_CTRL_A, DAC33_DACRATE(0)); | ||
1277 | /* B : DAC src=normal, not muted */ | ||
1278 | dac33_write(codec, DAC33_DAC_CTRL_B, DAC33_DACSRCR_RIGHT | | ||
1279 | DAC33_DACSRCL_LEFT); | ||
1280 | /* C : (defaults) */ | ||
1281 | dac33_write(codec, DAC33_DAC_CTRL_C, 0x00); | ||
1282 | |||
1283 | /* 64-65 : L&R DAC power control | ||
1284 | Line In -> OUT 1V/V Gain, DAC -> OUT 4V/V Gain*/ | ||
1285 | dac33_write(codec, DAC33_LDAC_PWR_CTRL, DAC33_LROUT_GAIN(2)); | ||
1286 | dac33_write(codec, DAC33_RDAC_PWR_CTRL, DAC33_LROUT_GAIN(2)); | ||
1287 | |||
1288 | /* 73 : volume soft stepping control, | ||
1289 | clock source = internal osc (?) */ | ||
1290 | dac33_write(codec, DAC33_ANA_VOL_SOFT_STEP_CTRL, DAC33_VOLCLKEN); | ||
1291 | |||
1292 | /* 66 : LOP/LOM Modes */ | ||
1293 | dac33_write(codec, DAC33_OUT_AMP_CM_CTRL, 0xff); | ||
1294 | |||
1295 | /* 68 : LOM inverted from LOP */ | ||
1296 | dac33_write(codec, DAC33_OUT_AMP_CTRL, (3<<2)); | ||
1297 | |||
1298 | dac33_write(codec, DAC33_PWR_CTRL, DAC33_PDNALLB); | ||
1299 | } | ||
1300 | |||
1301 | static int dac33_soc_probe(struct platform_device *pdev) | 1324 | static int dac33_soc_probe(struct platform_device *pdev) |
1302 | { | 1325 | { |
1303 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); | 1326 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); |
@@ -1311,11 +1334,6 @@ static int dac33_soc_probe(struct platform_device *pdev) | |||
1311 | socdev->card->codec = codec; | 1334 | socdev->card->codec = codec; |
1312 | dac33 = snd_soc_codec_get_drvdata(codec); | 1335 | dac33 = snd_soc_codec_get_drvdata(codec); |
1313 | 1336 | ||
1314 | /* Power up the codec */ | ||
1315 | dac33_hard_power(codec, 1); | ||
1316 | /* Set default configuration */ | ||
1317 | dac33_init_chip(codec); | ||
1318 | |||
1319 | /* register pcms */ | 1337 | /* register pcms */ |
1320 | ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); | 1338 | ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); |
1321 | if (ret < 0) { | 1339 | if (ret < 0) { |
@@ -1332,12 +1350,6 @@ static int dac33_soc_probe(struct platform_device *pdev) | |||
1332 | 1350 | ||
1333 | dac33_add_widgets(codec); | 1351 | dac33_add_widgets(codec); |
1334 | 1352 | ||
1335 | /* power on device */ | ||
1336 | dac33_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | ||
1337 | |||
1338 | /* Bias level configuration has enabled regulator an extra time */ | ||
1339 | regulator_bulk_disable(ARRAY_SIZE(dac33->supplies), dac33->supplies); | ||
1340 | |||
1341 | return 0; | 1353 | return 0; |
1342 | 1354 | ||
1343 | pcm_err: | 1355 | pcm_err: |
@@ -1374,6 +1386,8 @@ static int dac33_soc_resume(struct platform_device *pdev) | |||
1374 | struct snd_soc_codec *codec = socdev->card->codec; | 1386 | struct snd_soc_codec *codec = socdev->card->codec; |
1375 | 1387 | ||
1376 | dac33_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 1388 | dac33_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
1389 | if (codec->suspend_bias_level == SND_SOC_BIAS_ON) | ||
1390 | dac33_set_bias_level(codec, SND_SOC_BIAS_PREPARE); | ||
1377 | dac33_set_bias_level(codec, codec->suspend_bias_level); | 1391 | dac33_set_bias_level(codec, codec->suspend_bias_level); |
1378 | 1392 | ||
1379 | return 0; | 1393 | return 0; |
@@ -1392,8 +1406,9 @@ EXPORT_SYMBOL_GPL(soc_codec_dev_tlv320dac33); | |||
1392 | #define DAC33_FORMATS SNDRV_PCM_FMTBIT_S16_LE | 1406 | #define DAC33_FORMATS SNDRV_PCM_FMTBIT_S16_LE |
1393 | 1407 | ||
1394 | static struct snd_soc_dai_ops dac33_dai_ops = { | 1408 | static struct snd_soc_dai_ops dac33_dai_ops = { |
1409 | .startup = dac33_startup, | ||
1410 | .shutdown = dac33_shutdown, | ||
1395 | .hw_params = dac33_hw_params, | 1411 | .hw_params = dac33_hw_params, |
1396 | .prepare = dac33_pcm_prepare, | ||
1397 | .trigger = dac33_pcm_trigger, | 1412 | .trigger = dac33_pcm_trigger, |
1398 | .delay = dac33_dai_delay, | 1413 | .delay = dac33_dai_delay, |
1399 | .set_sysclk = dac33_set_dai_sysclk, | 1414 | .set_sysclk = dac33_set_dai_sysclk, |
@@ -1447,6 +1462,7 @@ static int __devinit dac33_i2c_probe(struct i2c_client *client, | |||
1447 | codec->hw_write = (hw_write_t) i2c_master_send; | 1462 | codec->hw_write = (hw_write_t) i2c_master_send; |
1448 | codec->bias_level = SND_SOC_BIAS_OFF; | 1463 | codec->bias_level = SND_SOC_BIAS_OFF; |
1449 | codec->set_bias_level = dac33_set_bias_level; | 1464 | codec->set_bias_level = dac33_set_bias_level; |
1465 | codec->idle_bias_off = 1; | ||
1450 | codec->dai = &dac33_dai; | 1466 | codec->dai = &dac33_dai; |
1451 | codec->num_dai = 1; | 1467 | codec->num_dai = 1; |
1452 | codec->reg_cache_size = ARRAY_SIZE(dac33_reg); | 1468 | codec->reg_cache_size = ARRAY_SIZE(dac33_reg); |
@@ -1487,8 +1503,6 @@ static int __devinit dac33_i2c_probe(struct i2c_client *client, | |||
1487 | goto error_gpio; | 1503 | goto error_gpio; |
1488 | } | 1504 | } |
1489 | gpio_direction_output(dac33->power_gpio, 0); | 1505 | gpio_direction_output(dac33->power_gpio, 0); |
1490 | } else { | ||
1491 | dac33->chip_power = 1; | ||
1492 | } | 1506 | } |
1493 | 1507 | ||
1494 | /* Check if the IRQ number is valid and request it */ | 1508 | /* Check if the IRQ number is valid and request it */ |
@@ -1526,12 +1540,14 @@ static int __devinit dac33_i2c_probe(struct i2c_client *client, | |||
1526 | goto err_get; | 1540 | goto err_get; |
1527 | } | 1541 | } |
1528 | 1542 | ||
1529 | ret = regulator_bulk_enable(ARRAY_SIZE(dac33->supplies), | 1543 | /* Read the tlv320dac33 ID registers */ |
1530 | dac33->supplies); | 1544 | ret = dac33_hard_power(codec, 1); |
1531 | if (ret != 0) { | 1545 | if (ret != 0) { |
1532 | dev_err(codec->dev, "Failed to enable supplies: %d\n", ret); | 1546 | dev_err(codec->dev, "Failed to power up codec: %d\n", ret); |
1533 | goto err_enable; | 1547 | goto error_codec; |
1534 | } | 1548 | } |
1549 | dac33_read_id(codec); | ||
1550 | dac33_hard_power(codec, 0); | ||
1535 | 1551 | ||
1536 | ret = snd_soc_register_codec(codec); | 1552 | ret = snd_soc_register_codec(codec); |
1537 | if (ret != 0) { | 1553 | if (ret != 0) { |
@@ -1546,14 +1562,9 @@ static int __devinit dac33_i2c_probe(struct i2c_client *client, | |||
1546 | goto error_codec; | 1562 | goto error_codec; |
1547 | } | 1563 | } |
1548 | 1564 | ||
1549 | /* Shut down the codec for now */ | ||
1550 | dac33_hard_power(codec, 0); | ||
1551 | |||
1552 | return ret; | 1565 | return ret; |
1553 | 1566 | ||
1554 | error_codec: | 1567 | error_codec: |
1555 | regulator_bulk_disable(ARRAY_SIZE(dac33->supplies), dac33->supplies); | ||
1556 | err_enable: | ||
1557 | regulator_bulk_free(ARRAY_SIZE(dac33->supplies), dac33->supplies); | 1568 | regulator_bulk_free(ARRAY_SIZE(dac33->supplies), dac33->supplies); |
1558 | err_get: | 1569 | err_get: |
1559 | if (dac33->irq >= 0) { | 1570 | if (dac33->irq >= 0) { |
@@ -1577,7 +1588,9 @@ static int __devexit dac33_i2c_remove(struct i2c_client *client) | |||
1577 | struct tlv320dac33_priv *dac33; | 1588 | struct tlv320dac33_priv *dac33; |
1578 | 1589 | ||
1579 | dac33 = i2c_get_clientdata(client); | 1590 | dac33 = i2c_get_clientdata(client); |
1580 | dac33_hard_power(&dac33->codec, 0); | 1591 | |
1592 | if (unlikely(dac33->chip_power)) | ||
1593 | dac33_hard_power(&dac33->codec, 0); | ||
1581 | 1594 | ||
1582 | if (dac33->power_gpio >= 0) | 1595 | if (dac33->power_gpio >= 0) |
1583 | gpio_free(dac33->power_gpio); | 1596 | gpio_free(dac33->power_gpio); |