diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-07-18 06:09:42 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-07-18 06:09:42 -0400 |
commit | bca146578c863a1f37cb191995317e855a0364e1 (patch) | |
tree | 904fc09989e570775a57148005ea7701d4131771 | |
parent | 0c11f655553c84bb695fdd5ea8b19d42b41b7133 (diff) |
ASoC: Fix checkpatch issues in AD1938
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r-- | sound/soc/codecs/ad1938.c | 156 |
1 files changed, 78 insertions, 78 deletions
diff --git a/sound/soc/codecs/ad1938.c b/sound/soc/codecs/ad1938.c index 5a7d00cad69a..ffc97c9b797f 100644 --- a/sound/soc/codecs/ad1938.c +++ b/sound/soc/codecs/ad1938.c | |||
@@ -43,9 +43,8 @@ | |||
43 | 43 | ||
44 | /* codec private data */ | 44 | /* codec private data */ |
45 | struct ad1938_priv { | 45 | struct ad1938_priv { |
46 | struct snd_soc_codec codec; | 46 | struct snd_soc_codec codec; |
47 | u8 reg_cache[AD1938_NUM_REGS]; | 47 | u8 reg_cache[AD1938_NUM_REGS]; |
48 | |||
49 | }; | 48 | }; |
50 | 49 | ||
51 | static struct snd_soc_codec *ad1938_codec; | 50 | static struct snd_soc_codec *ad1938_codec; |
@@ -136,7 +135,7 @@ static int ad1938_set_tdm_slot(struct snd_soc_dai *dai, | |||
136 | dac_reg &= ~AD1938_DAC_CHAN_MASK; | 135 | dac_reg &= ~AD1938_DAC_CHAN_MASK; |
137 | adc_reg &= ~AD1938_ADC_CHAN_MASK; | 136 | adc_reg &= ~AD1938_ADC_CHAN_MASK; |
138 | 137 | ||
139 | switch(slots) { | 138 | switch (slots) { |
140 | case 2: | 139 | case 2: |
141 | dac_reg |= AD1938_DAC_2_CHANNELS << AD1938_DAC_CHAN_SHFT; | 140 | dac_reg |= AD1938_DAC_2_CHANNELS << AD1938_DAC_CHAN_SHFT; |
142 | adc_reg |= AD1938_ADC_2_CHANNELS << AD1938_ADC_CHAN_SHFT; | 141 | adc_reg |= AD1938_ADC_2_CHANNELS << AD1938_ADC_CHAN_SHFT; |
@@ -324,7 +323,7 @@ static int ad1938_write_reg(struct snd_soc_codec *codec, unsigned int reg, | |||
324 | u8 *reg_cache = codec->reg_cache; | 323 | u8 *reg_cache = codec->reg_cache; |
325 | int ret = 0; | 324 | int ret = 0; |
326 | 325 | ||
327 | if(value != reg_cache[reg]) { | 326 | if (value != reg_cache[reg]) { |
328 | uint8_t buf[AD1938_SPI_BUFLEN]; | 327 | uint8_t buf[AD1938_SPI_BUFLEN]; |
329 | struct spi_transfer t = { | 328 | struct spi_transfer t = { |
330 | .tx_buf = buf, | 329 | .tx_buf = buf, |
@@ -337,7 +336,8 @@ static int ad1938_write_reg(struct snd_soc_codec *codec, unsigned int reg, | |||
337 | buf[2] = value; | 336 | buf[2] = value; |
338 | spi_message_init(&m); | 337 | spi_message_init(&m); |
339 | spi_message_add_tail(&t, &m); | 338 | spi_message_add_tail(&t, &m); |
340 | if((ret = spi_sync(codec->control_data, &m)) == 0) | 339 | ret = spi_sync(codec->control_data, &m); |
340 | if (ret == 0) | ||
341 | reg_cache[reg] = value; | 341 | reg_cache[reg] = value; |
342 | } | 342 | } |
343 | 343 | ||
@@ -349,14 +349,14 @@ static int ad1938_write_reg(struct snd_soc_codec *codec, unsigned int reg, | |||
349 | */ | 349 | */ |
350 | 350 | ||
351 | static unsigned int ad1938_read_reg_cache(struct snd_soc_codec *codec, | 351 | static unsigned int ad1938_read_reg_cache(struct snd_soc_codec *codec, |
352 | unsigned int reg) | 352 | unsigned int reg) |
353 | { | 353 | { |
354 | u8 *reg_cache = codec->reg_cache; | 354 | u8 *reg_cache = codec->reg_cache; |
355 | 355 | ||
356 | if (reg >= codec->reg_cache_size) | 356 | if (reg >= codec->reg_cache_size) |
357 | return -EINVAL; | 357 | return -EINVAL; |
358 | 358 | ||
359 | return reg_cache[reg]; | 359 | return reg_cache[reg]; |
360 | } | 360 | } |
361 | 361 | ||
362 | /* | 362 | /* |
@@ -391,20 +391,20 @@ static unsigned int ad1938_read_reg(struct snd_soc_codec *codec, unsigned int re | |||
391 | 391 | ||
392 | static int ad1938_fill_cache(struct snd_soc_codec *codec) | 392 | static int ad1938_fill_cache(struct snd_soc_codec *codec) |
393 | { | 393 | { |
394 | int i; | 394 | int i; |
395 | u8 *reg_cache = codec->reg_cache; | 395 | u8 *reg_cache = codec->reg_cache; |
396 | struct spi_device *spi = codec->control_data; | 396 | struct spi_device *spi = codec->control_data; |
397 | 397 | ||
398 | for (i = 0; i < codec->reg_cache_size; i++) { | 398 | for (i = 0; i < codec->reg_cache_size; i++) { |
399 | int ret = ad1938_read_reg(codec, i); | 399 | int ret = ad1938_read_reg(codec, i); |
400 | if (ret == -EIO) { | 400 | if (ret == -EIO) { |
401 | dev_err(&spi->dev, "AD1938 SPI read failure\n"); | 401 | dev_err(&spi->dev, "AD1938 SPI read failure\n"); |
402 | return ret; | 402 | return ret; |
403 | } | 403 | } |
404 | reg_cache[i] = ret; | 404 | reg_cache[i] = ret; |
405 | } | 405 | } |
406 | 406 | ||
407 | return 0; | 407 | return 0; |
408 | } | 408 | } |
409 | 409 | ||
410 | static int __devinit ad1938_spi_probe(struct spi_device *spi) | 410 | static int __devinit ad1938_spi_probe(struct spi_device *spi) |
@@ -498,8 +498,8 @@ static int ad1938_register(struct ad1938_priv *ad1938) | |||
498 | INIT_LIST_HEAD(&codec->dapm_widgets); | 498 | INIT_LIST_HEAD(&codec->dapm_widgets); |
499 | INIT_LIST_HEAD(&codec->dapm_paths); | 499 | INIT_LIST_HEAD(&codec->dapm_paths); |
500 | 500 | ||
501 | ad1938_dai.dev = codec->dev; | 501 | ad1938_dai.dev = codec->dev; |
502 | ad1938_codec = codec; | 502 | ad1938_codec = codec; |
503 | 503 | ||
504 | /* default setting for ad1938 */ | 504 | /* default setting for ad1938 */ |
505 | codec->write(codec, AD1938_DAC_CHNL_MUTE, 0x0); /* unmute dac channels */ | 505 | codec->write(codec, AD1938_DAC_CHNL_MUTE, 0x0); /* unmute dac channels */ |
@@ -512,85 +512,85 @@ static int ad1938_register(struct ad1938_priv *ad1938) | |||
512 | 512 | ||
513 | ad1938_fill_cache(codec); | 513 | ad1938_fill_cache(codec); |
514 | 514 | ||
515 | ret = snd_soc_register_codec(codec); | 515 | ret = snd_soc_register_codec(codec); |
516 | if (ret != 0) { | 516 | if (ret != 0) { |
517 | dev_err(codec->dev, "Failed to register codec: %d\n", ret); | 517 | dev_err(codec->dev, "Failed to register codec: %d\n", ret); |
518 | return ret; | 518 | return ret; |
519 | } | 519 | } |
520 | 520 | ||
521 | ret = snd_soc_register_dai(&ad1938_dai); | 521 | ret = snd_soc_register_dai(&ad1938_dai); |
522 | if (ret != 0) { | 522 | if (ret != 0) { |
523 | dev_err(codec->dev, "Failed to register DAI: %d\n", ret); | 523 | dev_err(codec->dev, "Failed to register DAI: %d\n", ret); |
524 | snd_soc_unregister_codec(codec); | 524 | snd_soc_unregister_codec(codec); |
525 | return ret; | 525 | return ret; |
526 | } | 526 | } |
527 | 527 | ||
528 | return 0; | 528 | return 0; |
529 | } | 529 | } |
530 | 530 | ||
531 | static void ad1938_unregister(struct ad1938_priv *ad1938) | 531 | static void ad1938_unregister(struct ad1938_priv *ad1938) |
532 | { | 532 | { |
533 | ad1938_set_bias_level(&ad1938->codec, SND_SOC_BIAS_OFF); | 533 | ad1938_set_bias_level(&ad1938->codec, SND_SOC_BIAS_OFF); |
534 | snd_soc_unregister_dai(&ad1938_dai); | 534 | snd_soc_unregister_dai(&ad1938_dai); |
535 | snd_soc_unregister_codec(&ad1938->codec); | 535 | snd_soc_unregister_codec(&ad1938->codec); |
536 | kfree(ad1938); | 536 | kfree(ad1938); |
537 | ad1938_codec = NULL; | 537 | ad1938_codec = NULL; |
538 | } | 538 | } |
539 | 539 | ||
540 | static int ad1938_probe(struct platform_device *pdev) | 540 | static int ad1938_probe(struct platform_device *pdev) |
541 | { | 541 | { |
542 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); | 542 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); |
543 | struct snd_soc_codec *codec; | 543 | struct snd_soc_codec *codec; |
544 | int ret = 0; | 544 | int ret = 0; |
545 | 545 | ||
546 | if (ad1938_codec == NULL) { | 546 | if (ad1938_codec == NULL) { |
547 | dev_err(&pdev->dev, "Codec device not registered\n"); | 547 | dev_err(&pdev->dev, "Codec device not registered\n"); |
548 | return -ENODEV; | 548 | return -ENODEV; |
549 | } | 549 | } |
550 | 550 | ||
551 | socdev->card->codec = ad1938_codec; | 551 | socdev->card->codec = ad1938_codec; |
552 | codec = ad1938_codec; | 552 | codec = ad1938_codec; |
553 | 553 | ||
554 | /* register pcms */ | 554 | /* register pcms */ |
555 | ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); | 555 | ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); |
556 | if (ret < 0) { | 556 | if (ret < 0) { |
557 | dev_err(codec->dev, "failed to create pcms: %d\n", ret); | 557 | dev_err(codec->dev, "failed to create pcms: %d\n", ret); |
558 | goto pcm_err; | 558 | goto pcm_err; |
559 | } | 559 | } |
560 | 560 | ||
561 | snd_soc_add_controls(codec, ad1938_snd_controls, | 561 | snd_soc_add_controls(codec, ad1938_snd_controls, |
562 | ARRAY_SIZE(ad1938_snd_controls)); | 562 | ARRAY_SIZE(ad1938_snd_controls)); |
563 | snd_soc_dapm_new_controls(codec, ad1938_dapm_widgets, | 563 | snd_soc_dapm_new_controls(codec, ad1938_dapm_widgets, |
564 | ARRAY_SIZE(ad1938_dapm_widgets)); | 564 | ARRAY_SIZE(ad1938_dapm_widgets)); |
565 | snd_soc_dapm_add_routes(codec, audio_paths, ARRAY_SIZE(audio_paths)); | 565 | snd_soc_dapm_add_routes(codec, audio_paths, ARRAY_SIZE(audio_paths)); |
566 | snd_soc_dapm_new_widgets(codec); | 566 | snd_soc_dapm_new_widgets(codec); |
567 | 567 | ||
568 | ad1938_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 568 | ad1938_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
569 | 569 | ||
570 | ret = snd_soc_init_card(socdev); | 570 | ret = snd_soc_init_card(socdev); |
571 | if (ret < 0) { | 571 | if (ret < 0) { |
572 | dev_err(codec->dev, "failed to register card: %d\n", ret); | 572 | dev_err(codec->dev, "failed to register card: %d\n", ret); |
573 | goto card_err; | 573 | goto card_err; |
574 | } | 574 | } |
575 | 575 | ||
576 | return ret; | 576 | return ret; |
577 | 577 | ||
578 | card_err: | 578 | card_err: |
579 | snd_soc_free_pcms(socdev); | 579 | snd_soc_free_pcms(socdev); |
580 | snd_soc_dapm_free(socdev); | 580 | snd_soc_dapm_free(socdev); |
581 | pcm_err: | 581 | pcm_err: |
582 | return ret; | 582 | return ret; |
583 | } | 583 | } |
584 | 584 | ||
585 | /* power down chip */ | 585 | /* power down chip */ |
586 | static int ad1938_remove(struct platform_device *pdev) | 586 | static int ad1938_remove(struct platform_device *pdev) |
587 | { | 587 | { |
588 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); | 588 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); |
589 | 589 | ||
590 | snd_soc_free_pcms(socdev); | 590 | snd_soc_free_pcms(socdev); |
591 | snd_soc_dapm_free(socdev); | 591 | snd_soc_dapm_free(socdev); |
592 | 592 | ||
593 | return 0; | 593 | return 0; |
594 | } | 594 | } |
595 | 595 | ||
596 | #ifdef CONFIG_PM | 596 | #ifdef CONFIG_PM |