tea575x.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. #ifndef __SOUND_TEA575X_TUNER_H
  3. #define __SOUND_TEA575X_TUNER_H
  4. /*
  5. * ALSA driver for TEA5757/5759 Philips AM/FM tuner chips
  6. *
  7. * Copyright (c) 2004 Jaroslav Kysela <[email protected]>
  8. */
  9. #include <linux/videodev2.h>
  10. #include <media/v4l2-ctrls.h>
  11. #include <media/v4l2-dev.h>
  12. #include <media/v4l2-device.h>
  13. #define TEA575X_FMIF 10700
  14. #define TEA575X_AMIF 450
  15. #define TEA575X_DATA (1 << 0)
  16. #define TEA575X_CLK (1 << 1)
  17. #define TEA575X_WREN (1 << 2)
  18. #define TEA575X_MOST (1 << 3)
  19. struct snd_tea575x;
  20. struct snd_tea575x_ops {
  21. /* Drivers using snd_tea575x must either define read_ and write_val */
  22. void (*write_val)(struct snd_tea575x *tea, u32 val);
  23. u32 (*read_val)(struct snd_tea575x *tea);
  24. /* Or define the 3 pin functions */
  25. void (*set_pins)(struct snd_tea575x *tea, u8 pins);
  26. u8 (*get_pins)(struct snd_tea575x *tea);
  27. void (*set_direction)(struct snd_tea575x *tea, bool output);
  28. };
  29. struct snd_tea575x {
  30. struct v4l2_device *v4l2_dev;
  31. struct v4l2_file_operations fops;
  32. struct video_device vd; /* video device */
  33. int radio_nr; /* radio_nr */
  34. bool tea5759; /* 5759 chip is present */
  35. bool has_am; /* Device can tune to AM freqs */
  36. bool cannot_read_data; /* Device cannot read the data pin */
  37. bool cannot_mute; /* Device cannot mute */
  38. bool mute; /* Device is muted? */
  39. bool stereo; /* receiving stereo */
  40. bool tuned; /* tuned to a station */
  41. unsigned int val; /* hw value */
  42. u32 band; /* 0: FM, 1: FM-Japan, 2: AM */
  43. u32 freq; /* frequency */
  44. struct mutex mutex;
  45. const struct snd_tea575x_ops *ops;
  46. void *private_data;
  47. u8 card[32];
  48. u8 bus_info[32];
  49. struct v4l2_ctrl_handler ctrl_handler;
  50. int (*ext_init)(struct snd_tea575x *tea);
  51. };
  52. int snd_tea575x_enum_freq_bands(struct snd_tea575x *tea,
  53. struct v4l2_frequency_band *band);
  54. int snd_tea575x_g_tuner(struct snd_tea575x *tea, struct v4l2_tuner *v);
  55. int snd_tea575x_s_hw_freq_seek(struct file *file, struct snd_tea575x *tea,
  56. const struct v4l2_hw_freq_seek *a);
  57. int snd_tea575x_hw_init(struct snd_tea575x *tea);
  58. int snd_tea575x_init(struct snd_tea575x *tea, struct module *owner);
  59. void snd_tea575x_exit(struct snd_tea575x *tea);
  60. void snd_tea575x_set_freq(struct snd_tea575x *tea);
  61. #endif /* __SOUND_TEA575X_TUNER_H */