aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/s3c24xx
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@linux.intel.com>2008-10-17 12:20:26 -0400
committerArjan van de Ven <arjan@linux.intel.com>2008-10-17 12:20:26 -0400
commit651dab4264e4ba0e563f5ff56f748127246e9065 (patch)
tree016630974bdcb00fe529b673f96d389e0fd6dc94 /sound/soc/s3c24xx
parent40b8606253552109815786e5d4b0de98782d31f5 (diff)
parent2e532d68a2b3e2aa6b19731501222069735c741c (diff)
Merge commit 'linus/master' into merge-linus
Conflicts: arch/x86/kvm/i8254.c
Diffstat (limited to 'sound/soc/s3c24xx')
-rw-r--r--sound/soc/s3c24xx/neo1973_wm8753.c96
1 files changed, 37 insertions, 59 deletions
diff --git a/sound/soc/s3c24xx/neo1973_wm8753.c b/sound/soc/s3c24xx/neo1973_wm8753.c
index 8089f8ee05c0..87ddfefcc2fb 100644
--- a/sound/soc/s3c24xx/neo1973_wm8753.c
+++ b/sound/soc/s3c24xx/neo1973_wm8753.c
@@ -24,6 +24,7 @@
24#include <sound/soc-dapm.h> 24#include <sound/soc-dapm.h>
25#include <sound/tlv.h> 25#include <sound/tlv.h>
26 26
27#include <asm/mach-types.h>
27#include <asm/hardware/scoop.h> 28#include <asm/hardware/scoop.h>
28#include <mach/regs-clock.h> 29#include <mach/regs-clock.h>
29#include <mach/regs-gpio.h> 30#include <mach/regs-gpio.h>
@@ -510,21 +511,20 @@ static int neo1973_wm8753_init(struct snd_soc_codec *codec)
510 DBG("Entered %s\n", __func__); 511 DBG("Entered %s\n", __func__);
511 512
512 /* set up NC codec pins */ 513 /* set up NC codec pins */
513 snd_soc_dapm_disable_pin(codec, "LOUT2"); 514 snd_soc_dapm_nc_pin(codec, "LOUT2");
514 snd_soc_dapm_disable_pin(codec, "ROUT2"); 515 snd_soc_dapm_nc_pin(codec, "ROUT2");
515 snd_soc_dapm_disable_pin(codec, "OUT3"); 516 snd_soc_dapm_nc_pin(codec, "OUT3");
516 snd_soc_dapm_disable_pin(codec, "OUT4"); 517 snd_soc_dapm_nc_pin(codec, "OUT4");
517 snd_soc_dapm_disable_pin(codec, "LINE1"); 518 snd_soc_dapm_nc_pin(codec, "LINE1");
518 snd_soc_dapm_disable_pin(codec, "LINE2"); 519 snd_soc_dapm_nc_pin(codec, "LINE2");
519
520
521 /* set endpoints to default mode */
522 set_scenario_endpoints(codec, NEO_AUDIO_OFF);
523 520
524 /* Add neo1973 specific widgets */ 521 /* Add neo1973 specific widgets */
525 snd_soc_dapm_new_controls(codec, wm8753_dapm_widgets, 522 snd_soc_dapm_new_controls(codec, wm8753_dapm_widgets,
526 ARRAY_SIZE(wm8753_dapm_widgets)); 523 ARRAY_SIZE(wm8753_dapm_widgets));
527 524
525 /* set endpoints to default mode */
526 set_scenario_endpoints(codec, NEO_AUDIO_OFF);
527
528 /* add neo1973 specific controls */ 528 /* add neo1973 specific controls */
529 for (i = 0; i < ARRAY_SIZE(wm8753_neo1973_controls); i++) { 529 for (i = 0; i < ARRAY_SIZE(wm8753_neo1973_controls); i++) {
530 err = snd_ctl_add(codec->card, 530 err = snd_ctl_add(codec->card,
@@ -586,6 +586,7 @@ static struct snd_soc_machine neo1973 = {
586}; 586};
587 587
588static struct wm8753_setup_data neo1973_wm8753_setup = { 588static struct wm8753_setup_data neo1973_wm8753_setup = {
589 .i2c_bus = 0,
589 .i2c_address = 0x1a, 590 .i2c_address = 0x1a,
590}; 591};
591 592
@@ -596,54 +597,24 @@ static struct snd_soc_device neo1973_snd_devdata = {
596 .codec_data = &neo1973_wm8753_setup, 597 .codec_data = &neo1973_wm8753_setup,
597}; 598};
598 599
599static struct i2c_client client_template; 600static int lm4857_i2c_probe(struct i2c_client *client,
600 601 const struct i2c_device_id *id)
601static const unsigned short normal_i2c[] = { 0x7C, I2C_CLIENT_END };
602
603/* Magic definition of all other variables and things */
604I2C_CLIENT_INSMOD;
605
606static int lm4857_amp_probe(struct i2c_adapter *adap, int addr, int kind)
607{ 602{
608 int ret;
609
610 DBG("Entered %s\n", __func__); 603 DBG("Entered %s\n", __func__);
611 604
612 client_template.adapter = adap; 605 i2c = client;
613 client_template.addr = addr;
614
615 i2c = kmemdup(&client_template, sizeof(client_template), GFP_KERNEL);
616 if (i2c == NULL)
617 return -ENOMEM;
618
619 ret = i2c_attach_client(i2c);
620 if (ret < 0) {
621 printk(KERN_ERR "LM4857 failed to attach at addr %x\n", addr);
622 goto exit_err;
623 }
624 606
625 lm4857_write_regs(); 607 lm4857_write_regs();
626 return ret;
627
628exit_err:
629 kfree(i2c);
630 return ret;
631}
632
633static int lm4857_i2c_detach(struct i2c_client *client)
634{
635 DBG("Entered %s\n", __func__);
636
637 i2c_detach_client(client);
638 kfree(client);
639 return 0; 608 return 0;
640} 609}
641 610
642static int lm4857_i2c_attach(struct i2c_adapter *adap) 611static int lm4857_i2c_remove(struct i2c_client *client)
643{ 612{
644 DBG("Entered %s\n", __func__); 613 DBG("Entered %s\n", __func__);
645 614
646 return i2c_probe(adap, &addr_data, lm4857_amp_probe); 615 i2c = NULL;
616
617 return 0;
647} 618}
648 619
649static u8 lm4857_state; 620static u8 lm4857_state;
@@ -681,24 +652,22 @@ static void lm4857_shutdown(struct i2c_client *dev)
681 lm4857_write_regs(); 652 lm4857_write_regs();
682} 653}
683 654
684/* corgi i2c codec control layer */ 655static const struct i2c_device_id lm4857_i2c_id[] = {
656 { "neo1973_lm4857", 0 },
657 { }
658};
659
685static struct i2c_driver lm4857_i2c_driver = { 660static struct i2c_driver lm4857_i2c_driver = {
686 .driver = { 661 .driver = {
687 .name = "LM4857 I2C Amp", 662 .name = "LM4857 I2C Amp",
688 .owner = THIS_MODULE, 663 .owner = THIS_MODULE,
689 }, 664 },
690 .id = I2C_DRIVERID_LM4857,
691 .suspend = lm4857_suspend, 665 .suspend = lm4857_suspend,
692 .resume = lm4857_resume, 666 .resume = lm4857_resume,
693 .shutdown = lm4857_shutdown, 667 .shutdown = lm4857_shutdown,
694 .attach_adapter = lm4857_i2c_attach, 668 .probe = lm4857_i2c_probe,
695 .detach_client = lm4857_i2c_detach, 669 .remove = lm4857_i2c_remove,
696 .command = NULL, 670 .id_table = lm4857_i2c_id,
697};
698
699static struct i2c_client client_template = {
700 .name = "LM4857",
701 .driver = &lm4857_i2c_driver,
702}; 671};
703 672
704static struct platform_device *neo1973_snd_device; 673static struct platform_device *neo1973_snd_device;
@@ -709,6 +678,12 @@ static int __init neo1973_init(void)
709 678
710 DBG("Entered %s\n", __func__); 679 DBG("Entered %s\n", __func__);
711 680
681 if (!machine_is_neo1973_gta01()) {
682 printk(KERN_INFO
683 "Only GTA01 hardware supported by ASoC driver\n");
684 return -ENODEV;
685 }
686
712 neo1973_snd_device = platform_device_alloc("soc-audio", -1); 687 neo1973_snd_device = platform_device_alloc("soc-audio", -1);
713 if (!neo1973_snd_device) 688 if (!neo1973_snd_device)
714 return -ENOMEM; 689 return -ENOMEM;
@@ -717,12 +692,15 @@ static int __init neo1973_init(void)
717 neo1973_snd_devdata.dev = &neo1973_snd_device->dev; 692 neo1973_snd_devdata.dev = &neo1973_snd_device->dev;
718 ret = platform_device_add(neo1973_snd_device); 693 ret = platform_device_add(neo1973_snd_device);
719 694
720 if (ret) 695 if (ret) {
721 platform_device_put(neo1973_snd_device); 696 platform_device_put(neo1973_snd_device);
697 return ret;
698 }
722 699
723 ret = i2c_add_driver(&lm4857_i2c_driver); 700 ret = i2c_add_driver(&lm4857_i2c_driver);
701
724 if (ret != 0) 702 if (ret != 0)
725 printk(KERN_ERR "can't add i2c driver"); 703 platform_device_unregister(neo1973_snd_device);
726 704
727 return ret; 705 return ret;
728} 706}