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