simtec-audio.c 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /* linux/arch/arm/plat-s3c24xx/simtec-audio.c
  2. *
  3. * Copyright (c) 2009 Simtec Electronics
  4. * http://armlinux.simtec.co.uk/
  5. * Ben Dooks <ben@simtec.co.uk>
  6. *
  7. * Audio setup for various Simtec S3C24XX implementations
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. */
  13. #include <linux/kernel.h>
  14. #include <linux/interrupt.h>
  15. #include <linux/init.h>
  16. #include <linux/device.h>
  17. #include <linux/io.h>
  18. #include <mach/hardware.h>
  19. #include <mach/regs-gpio.h>
  20. #include <linux/platform_data/asoc-s3c24xx_simtec.h>
  21. #include <plat/devs.h>
  22. #include "bast.h"
  23. #include "simtec.h"
  24. /* platform ops for audio */
  25. static void simtec_audio_startup_lrroute(void)
  26. {
  27. unsigned int tmp;
  28. unsigned long flags;
  29. local_irq_save(flags);
  30. tmp = __raw_readb(BAST_VA_CTRL1);
  31. tmp &= ~BAST_CPLD_CTRL1_LRMASK;
  32. tmp |= BAST_CPLD_CTRL1_LRCDAC;
  33. __raw_writeb(tmp, BAST_VA_CTRL1);
  34. local_irq_restore(flags);
  35. }
  36. static struct s3c24xx_audio_simtec_pdata simtec_audio_platdata;
  37. static char our_name[32];
  38. static struct platform_device simtec_audio_dev = {
  39. .name = our_name,
  40. .id = -1,
  41. .dev = {
  42. .parent = &s3c_device_iis.dev,
  43. .platform_data = &simtec_audio_platdata,
  44. },
  45. };
  46. int __init simtec_audio_add(const char *name, bool has_lr_routing,
  47. struct s3c24xx_audio_simtec_pdata *spd)
  48. {
  49. if (!name)
  50. name = "tlv320aic23";
  51. snprintf(our_name, sizeof(our_name)-1, "s3c24xx-simtec-%s", name);
  52. /* copy platform data so the source can be __initdata */
  53. if (spd)
  54. simtec_audio_platdata = *spd;
  55. if (has_lr_routing)
  56. simtec_audio_platdata.startup = simtec_audio_startup_lrroute;
  57. platform_device_register(&s3c_device_iis);
  58. platform_device_register(&simtec_audio_dev);
  59. return 0;
  60. }