tea575x.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #ifndef __SOUND_TEA575X_TUNER_H
  2. #define __SOUND_TEA575X_TUNER_H
  3. /*
  4. * ALSA driver for TEA5757/5759 Philips AM/FM tuner chips
  5. *
  6. * Copyright (c) 2004 Jaroslav Kysela <perex@perex.cz>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  21. *
  22. */
  23. #include <linux/videodev2.h>
  24. #include <media/v4l2-ctrls.h>
  25. #include <media/v4l2-dev.h>
  26. #include <media/v4l2-device.h>
  27. #define TEA575X_FMIF 10700
  28. #define TEA575X_AMIF 450
  29. #define TEA575X_DATA (1 << 0)
  30. #define TEA575X_CLK (1 << 1)
  31. #define TEA575X_WREN (1 << 2)
  32. #define TEA575X_MOST (1 << 3)
  33. struct snd_tea575x;
  34. struct snd_tea575x_ops {
  35. /* Drivers using snd_tea575x must either define read_ and write_val */
  36. void (*write_val)(struct snd_tea575x *tea, u32 val);
  37. u32 (*read_val)(struct snd_tea575x *tea);
  38. /* Or define the 3 pin functions */
  39. void (*set_pins)(struct snd_tea575x *tea, u8 pins);
  40. u8 (*get_pins)(struct snd_tea575x *tea);
  41. void (*set_direction)(struct snd_tea575x *tea, bool output);
  42. };
  43. struct snd_tea575x {
  44. struct v4l2_device *v4l2_dev;
  45. struct v4l2_file_operations fops;
  46. struct video_device vd; /* video device */
  47. int radio_nr; /* radio_nr */
  48. bool tea5759; /* 5759 chip is present */
  49. bool has_am; /* Device can tune to AM freqs */
  50. bool cannot_read_data; /* Device cannot read the data pin */
  51. bool cannot_mute; /* Device cannot mute */
  52. bool mute; /* Device is muted? */
  53. bool stereo; /* receiving stereo */
  54. bool tuned; /* tuned to a station */
  55. unsigned int val; /* hw value */
  56. u32 band; /* 0: FM, 1: FM-Japan, 2: AM */
  57. u32 freq; /* frequency */
  58. struct mutex mutex;
  59. struct snd_tea575x_ops *ops;
  60. void *private_data;
  61. u8 card[32];
  62. u8 bus_info[32];
  63. struct v4l2_ctrl_handler ctrl_handler;
  64. int (*ext_init)(struct snd_tea575x *tea);
  65. };
  66. int snd_tea575x_enum_freq_bands(struct snd_tea575x *tea,
  67. struct v4l2_frequency_band *band);
  68. int snd_tea575x_g_tuner(struct snd_tea575x *tea, struct v4l2_tuner *v);
  69. int snd_tea575x_s_hw_freq_seek(struct file *file, struct snd_tea575x *tea,
  70. const struct v4l2_hw_freq_seek *a);
  71. int snd_tea575x_hw_init(struct snd_tea575x *tea);
  72. int snd_tea575x_init(struct snd_tea575x *tea, struct module *owner);
  73. void snd_tea575x_exit(struct snd_tea575x *tea);
  74. void snd_tea575x_set_freq(struct snd_tea575x *tea);
  75. #endif /* __SOUND_TEA575X_TUNER_H */