Merge tag 'nfs-for-4.17-2' of git://git.linux-nfs.org/projects/anna/linux-nfs
[sfrench/cifs-2.6.git] / include / media / drv-intf / tea575x.h
1 #ifndef __SOUND_TEA575X_TUNER_H
2 #define __SOUND_TEA575X_TUNER_H
3
4 /*
5  *   ALSA driver for TEA5757/5759 Philips AM/FM tuner chips
6  *
7  *      Copyright (c) 2004 Jaroslav Kysela <perex@perex.cz>
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 as published by
11  *   the Free Software Foundation; either version 2 of the License, or
12  *   (at your option) any later version.
13  *
14  *   This program is distributed in the hope that it will be useful,
15  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  *   GNU General Public License for more details.
18  *
19  */
20
21 #include <linux/videodev2.h>
22 #include <media/v4l2-ctrls.h>
23 #include <media/v4l2-dev.h>
24 #include <media/v4l2-device.h>
25
26 #define TEA575X_FMIF    10700
27 #define TEA575X_AMIF      450
28
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
34 struct snd_tea575x;
35
36 struct snd_tea575x_ops {
37         /* Drivers using snd_tea575x must either define read_ and write_val */
38         void (*write_val)(struct snd_tea575x *tea, u32 val);
39         u32 (*read_val)(struct snd_tea575x *tea);
40         /* Or define the 3 pin functions */
41         void (*set_pins)(struct snd_tea575x *tea, u8 pins);
42         u8 (*get_pins)(struct snd_tea575x *tea);
43         void (*set_direction)(struct snd_tea575x *tea, bool output);
44 };
45
46 struct snd_tea575x {
47         struct v4l2_device *v4l2_dev;
48         struct v4l2_file_operations fops;
49         struct video_device vd;         /* video device */
50         int radio_nr;                   /* radio_nr */
51         bool tea5759;                   /* 5759 chip is present */
52         bool has_am;                    /* Device can tune to AM freqs */
53         bool cannot_read_data;          /* Device cannot read the data pin */
54         bool cannot_mute;               /* Device cannot mute */
55         bool mute;                      /* Device is muted? */
56         bool stereo;                    /* receiving stereo */
57         bool tuned;                     /* tuned to a station */
58         unsigned int val;               /* hw value */
59         u32 band;                       /* 0: FM, 1: FM-Japan, 2: AM */
60         u32 freq;                       /* frequency */
61         struct mutex mutex;
62         const struct snd_tea575x_ops *ops;
63         void *private_data;
64         u8 card[32];
65         u8 bus_info[32];
66         struct v4l2_ctrl_handler ctrl_handler;
67         int (*ext_init)(struct snd_tea575x *tea);
68 };
69
70 int snd_tea575x_enum_freq_bands(struct snd_tea575x *tea,
71                                         struct v4l2_frequency_band *band);
72 int snd_tea575x_g_tuner(struct snd_tea575x *tea, struct v4l2_tuner *v);
73 int snd_tea575x_s_hw_freq_seek(struct file *file, struct snd_tea575x *tea,
74                                 const struct v4l2_hw_freq_seek *a);
75 int snd_tea575x_hw_init(struct snd_tea575x *tea);
76 int snd_tea575x_init(struct snd_tea575x *tea, struct module *owner);
77 void snd_tea575x_exit(struct snd_tea575x *tea);
78 void snd_tea575x_set_freq(struct snd_tea575x *tea);
79
80 #endif /* __SOUND_TEA575X_TUNER_H */