aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/pxa
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/pxa')
-rw-r--r--sound/soc/pxa/magician.c54
-rw-r--r--sound/soc/pxa/pxa-ssp.c50
2 files changed, 43 insertions, 61 deletions
diff --git a/sound/soc/pxa/magician.c b/sound/soc/pxa/magician.c
index 326955dea36c..8889cd371608 100644
--- a/sound/soc/pxa/magician.c
+++ b/sound/soc/pxa/magician.c
@@ -20,12 +20,14 @@
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/delay.h> 21#include <linux/delay.h>
22#include <linux/gpio.h> 22#include <linux/gpio.h>
23#include <linux/i2c.h>
23 24
24#include <sound/core.h> 25#include <sound/core.h>
25#include <sound/pcm.h> 26#include <sound/pcm.h>
26#include <sound/pcm_params.h> 27#include <sound/pcm_params.h>
27#include <sound/soc.h> 28#include <sound/soc.h>
28#include <sound/soc-dapm.h> 29#include <sound/soc-dapm.h>
30#include <sound/uda1380.h>
29 31
30#include <mach/magician.h> 32#include <mach/magician.h>
31#include <asm/mach-types.h> 33#include <asm/mach-types.h>
@@ -447,34 +449,47 @@ static struct snd_soc_card snd_soc_card_magician = {
447 .platform = &pxa2xx_soc_platform, 449 .platform = &pxa2xx_soc_platform,
448}; 450};
449 451
450/* magician audio private data */
451static struct uda1380_setup_data magician_uda1380_setup = {
452 .i2c_address = 0x18,
453 .dac_clk = UDA1380_DAC_CLK_WSPLL,
454};
455
456/* magician audio subsystem */ 452/* magician audio subsystem */
457static struct snd_soc_device magician_snd_devdata = { 453static struct snd_soc_device magician_snd_devdata = {
458 .card = &snd_soc_card_magician, 454 .card = &snd_soc_card_magician,
459 .codec_dev = &soc_codec_dev_uda1380, 455 .codec_dev = &soc_codec_dev_uda1380,
460 .codec_data = &magician_uda1380_setup,
461}; 456};
462 457
463static struct platform_device *magician_snd_device; 458static struct platform_device *magician_snd_device;
464 459
460/*
461 * FIXME: move into magician board file once merged into the pxa tree
462 */
463static struct uda1380_platform_data uda1380_info = {
464 .gpio_power = EGPIO_MAGICIAN_CODEC_POWER,
465 .gpio_reset = EGPIO_MAGICIAN_CODEC_RESET,
466 .dac_clk = UDA1380_DAC_CLK_WSPLL,
467};
468
469static struct i2c_board_info i2c_board_info[] = {
470 {
471 I2C_BOARD_INFO("uda1380", 0x18),
472 .platform_data = &uda1380_info,
473 },
474};
475
465static int __init magician_init(void) 476static int __init magician_init(void)
466{ 477{
467 int ret; 478 int ret;
479 struct i2c_adapter *adapter;
480 struct i2c_client *client;
468 481
469 if (!machine_is_magician()) 482 if (!machine_is_magician())
470 return -ENODEV; 483 return -ENODEV;
471 484
472 ret = gpio_request(EGPIO_MAGICIAN_CODEC_POWER, "CODEC_POWER"); 485 adapter = i2c_get_adapter(0);
473 if (ret) 486 if (!adapter)
474 goto err_request_power; 487 return -ENODEV;
475 ret = gpio_request(EGPIO_MAGICIAN_CODEC_RESET, "CODEC_RESET"); 488 client = i2c_new_device(adapter, i2c_board_info);
476 if (ret) 489 i2c_put_adapter(adapter);
477 goto err_request_reset; 490 if (!client)
491 return -ENODEV;
492
478 ret = gpio_request(EGPIO_MAGICIAN_SPK_POWER, "SPK_POWER"); 493 ret = gpio_request(EGPIO_MAGICIAN_SPK_POWER, "SPK_POWER");
479 if (ret) 494 if (ret)
480 goto err_request_spk; 495 goto err_request_spk;
@@ -491,14 +506,8 @@ static int __init magician_init(void)
491 if (ret) 506 if (ret)
492 goto err_request_in_sel1; 507 goto err_request_in_sel1;
493 508
494 gpio_set_value(EGPIO_MAGICIAN_CODEC_POWER, 1);
495 gpio_set_value(EGPIO_MAGICIAN_IN_SEL0, 0); 509 gpio_set_value(EGPIO_MAGICIAN_IN_SEL0, 0);
496 510
497 /* we may need to have the clock running here - pH5 */
498 gpio_set_value(EGPIO_MAGICIAN_CODEC_RESET, 1);
499 udelay(5);
500 gpio_set_value(EGPIO_MAGICIAN_CODEC_RESET, 0);
501
502 magician_snd_device = platform_device_alloc("soc-audio", -1); 511 magician_snd_device = platform_device_alloc("soc-audio", -1);
503 if (!magician_snd_device) { 512 if (!magician_snd_device) {
504 ret = -ENOMEM; 513 ret = -ENOMEM;
@@ -526,10 +535,6 @@ err_request_mic:
526err_request_ep: 535err_request_ep:
527 gpio_free(EGPIO_MAGICIAN_SPK_POWER); 536 gpio_free(EGPIO_MAGICIAN_SPK_POWER);
528err_request_spk: 537err_request_spk:
529 gpio_free(EGPIO_MAGICIAN_CODEC_RESET);
530err_request_reset:
531 gpio_free(EGPIO_MAGICIAN_CODEC_POWER);
532err_request_power:
533 return ret; 538 return ret;
534} 539}
535 540
@@ -540,15 +545,12 @@ static void __exit magician_exit(void)
540 gpio_set_value(EGPIO_MAGICIAN_SPK_POWER, 0); 545 gpio_set_value(EGPIO_MAGICIAN_SPK_POWER, 0);
541 gpio_set_value(EGPIO_MAGICIAN_EP_POWER, 0); 546 gpio_set_value(EGPIO_MAGICIAN_EP_POWER, 0);
542 gpio_set_value(EGPIO_MAGICIAN_MIC_POWER, 0); 547 gpio_set_value(EGPIO_MAGICIAN_MIC_POWER, 0);
543 gpio_set_value(EGPIO_MAGICIAN_CODEC_POWER, 0);
544 548
545 gpio_free(EGPIO_MAGICIAN_IN_SEL1); 549 gpio_free(EGPIO_MAGICIAN_IN_SEL1);
546 gpio_free(EGPIO_MAGICIAN_IN_SEL0); 550 gpio_free(EGPIO_MAGICIAN_IN_SEL0);
547 gpio_free(EGPIO_MAGICIAN_MIC_POWER); 551 gpio_free(EGPIO_MAGICIAN_MIC_POWER);
548 gpio_free(EGPIO_MAGICIAN_EP_POWER); 552 gpio_free(EGPIO_MAGICIAN_EP_POWER);
549 gpio_free(EGPIO_MAGICIAN_SPK_POWER); 553 gpio_free(EGPIO_MAGICIAN_SPK_POWER);
550 gpio_free(EGPIO_MAGICIAN_CODEC_RESET);
551 gpio_free(EGPIO_MAGICIAN_CODEC_POWER);
552} 554}
553 555
554module_init(magician_init); 556module_init(magician_init);
diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c
index 19c45409d94c..e22c5cef8fec 100644
--- a/sound/soc/pxa/pxa-ssp.c
+++ b/sound/soc/pxa/pxa-ssp.c
@@ -457,31 +457,27 @@ static int pxa_ssp_set_dai_fmt(struct snd_soc_dai *cpu_dai,
457 return -EINVAL; 457 return -EINVAL;
458 } 458 }
459 459
460 ssp_write_reg(ssp, SSCR0, sscr0); 460 switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
461 ssp_write_reg(ssp, SSCR1, sscr1); 461 case SND_SOC_DAIFMT_NB_NF:
462 ssp_write_reg(ssp, SSPSP, sspsp); 462 sspsp |= SSPSP_SFRMP;
463 break;
464 case SND_SOC_DAIFMT_NB_IF:
465 break;
466 case SND_SOC_DAIFMT_IB_IF:
467 sspsp |= SSPSP_SCMODE(2);
468 break;
469 case SND_SOC_DAIFMT_IB_NF:
470 sspsp |= SSPSP_SCMODE(2) | SSPSP_SFRMP;
471 break;
472 default:
473 return -EINVAL;
474 }
463 475
464 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { 476 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
465 case SND_SOC_DAIFMT_I2S: 477 case SND_SOC_DAIFMT_I2S:
466 sscr0 |= SSCR0_PSP; 478 sscr0 |= SSCR0_PSP;
467 sscr1 |= SSCR1_RWOT | SSCR1_TRAIL; 479 sscr1 |= SSCR1_RWOT | SSCR1_TRAIL;
468
469 /* See hw_params() */ 480 /* See hw_params() */
470 switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
471 case SND_SOC_DAIFMT_NB_NF:
472 sspsp |= SSPSP_SFRMP;
473 break;
474 case SND_SOC_DAIFMT_NB_IF:
475 break;
476 case SND_SOC_DAIFMT_IB_IF:
477 sspsp |= SSPSP_SCMODE(2);
478 break;
479 case SND_SOC_DAIFMT_IB_NF:
480 sspsp |= SSPSP_SCMODE(2) | SSPSP_SFRMP;
481 break;
482 default:
483 return -EINVAL;
484 }
485 break; 481 break;
486 482
487 case SND_SOC_DAIFMT_DSP_A: 483 case SND_SOC_DAIFMT_DSP_A:
@@ -489,22 +485,6 @@ static int pxa_ssp_set_dai_fmt(struct snd_soc_dai *cpu_dai,
489 case SND_SOC_DAIFMT_DSP_B: 485 case SND_SOC_DAIFMT_DSP_B:
490 sscr0 |= SSCR0_MOD | SSCR0_PSP; 486 sscr0 |= SSCR0_MOD | SSCR0_PSP;
491 sscr1 |= SSCR1_TRAIL | SSCR1_RWOT; 487 sscr1 |= SSCR1_TRAIL | SSCR1_RWOT;
492
493 switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
494 case SND_SOC_DAIFMT_NB_NF:
495 sspsp |= SSPSP_SFRMP;
496 break;
497 case SND_SOC_DAIFMT_NB_IF:
498 break;
499 case SND_SOC_DAIFMT_IB_IF:
500 sspsp |= SSPSP_SCMODE(2);
501 break;
502 case SND_SOC_DAIFMT_IB_NF:
503 sspsp |= SSPSP_SCMODE(2) | SSPSP_SFRMP;
504 break;
505 default:
506 return -EINVAL;
507 }
508 break; 488 break;
509 489
510 default: 490 default: