simtec-audio.c 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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/bast-map.h>
  19. #include <mach/bast-irq.h>
  20. #include <mach/bast-cpld.h>
  21. #include <mach/hardware.h>
  22. #include <mach/regs-gpio.h>
  23. #include <plat/audio-simtec.h>
  24. #include <plat/devs.h>
  25. #include "simtec.h"
  26. /* platform ops for audio */
  27. static void simtec_audio_startup_lrroute(void)
  28. {
  29. unsigned int tmp;
  30. unsigned long flags;
  31. local_irq_save(flags);
  32. tmp = __raw_readb(BAST_VA_CTRL1);
  33. tmp &= ~BAST_CPLD_CTRL1_LRMASK;
  34. tmp |= BAST_CPLD_CTRL1_LRCDAC;
  35. __raw_writeb(tmp, BAST_VA_CTRL1);
  36. local_irq_restore(flags);
  37. }
  38. static struct s3c24xx_audio_simtec_pdata simtec_audio_platdata;
  39. static char our_name[32];
  40. static struct platform_device simtec_audio_dev = {
  41. .name = our_name,
  42. .id = -1,
  43. .dev = {
  44. .parent = &s3c_device_iis.dev,
  45. .platform_data = &simtec_audio_platdata,
  46. },
  47. };
  48. int __init simtec_audio_add(const char *name, bool has_lr_routing,
  49. struct s3c24xx_audio_simtec_pdata *spd)
  50. {
  51. if (!name)
  52. name = "tlv320aic23";
  53. snprintf(our_name, sizeof(our_name)-1, "s3c24xx-simtec-%s", name);
  54. /* copy platform data so the source can be __initdata */
  55. if (spd)
  56. simtec_audio_platdata = *spd;
  57. if (has_lr_routing)
  58. simtec_audio_platdata.startup = simtec_audio_startup_lrroute;
  59. platform_device_register(&s3c_device_iis);
  60. platform_device_register(&simtec_audio_dev);
  61. return 0;
  62. }