]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - include/media/drv-intf/tea575x.h
Merge branches 'for-4.11/upstream-fixes', 'for-4.12/accutouch', 'for-4.12/cp2112...
[mirror_ubuntu-artful-kernel.git] / include / media / drv-intf / tea575x.h
CommitLineData
1da177e4
LT
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 *
c1017a4c 7 * Copyright (c) 2004 Jaroslav Kysela <perex@perex.cz>
1da177e4
LT
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 *
7477ddaa 19 */
1da177e4 20
9b76ede4 21#include <linux/videodev2.h>
4522e825 22#include <media/v4l2-ctrls.h>
7477ddaa 23#include <media/v4l2-dev.h>
d4ecc83b 24#include <media/v4l2-device.h>
1da177e4 25
ea27316e 26#define TEA575X_FMIF 10700
fc488517 27#define TEA575X_AMIF 450
ea27316e 28
14219d06
OZ
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
97f02e05 34struct snd_tea575x;
1da177e4
LT
35
36struct snd_tea575x_ops {
31a62d41
HG
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 */
14219d06
OZ
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);
1da177e4
LT
44};
45
46struct snd_tea575x {
d4ecc83b 47 struct v4l2_device *v4l2_dev;
5daf53a6 48 struct v4l2_file_operations fops;
4522e825 49 struct video_device vd; /* video device */
d4ecc83b 50 int radio_nr; /* radio_nr */
375d1358 51 bool tea5759; /* 5759 chip is present */
fc488517 52 bool has_am; /* Device can tune to AM freqs */
d4ecc83b 53 bool cannot_read_data; /* Device cannot read the data pin */
3d0fe51c 54 bool cannot_mute; /* Device cannot mute */
375d1358
OZ
55 bool mute; /* Device is muted? */
56 bool stereo; /* receiving stereo */
57 bool tuned; /* tuned to a station */
1da177e4 58 unsigned int val; /* hw value */
fc488517 59 u32 band; /* 0: FM, 1: FM-Japan, 2: AM */
d4ecc83b 60 u32 freq; /* frequency */
6a529c1a 61 struct mutex mutex;
22dbec26 62 const struct snd_tea575x_ops *ops;
1da177e4 63 void *private_data;
10ca7201
OZ
64 u8 card[32];
65 u8 bus_info[32];
4522e825
OZ
66 struct v4l2_ctrl_handler ctrl_handler;
67 int (*ext_init)(struct snd_tea575x *tea);
1da177e4
LT
68};
69
6994ca3d
OZ
70int snd_tea575x_enum_freq_bands(struct snd_tea575x *tea,
71 struct v4l2_frequency_band *band);
72int snd_tea575x_g_tuner(struct snd_tea575x *tea, struct v4l2_tuner *v);
73int snd_tea575x_s_hw_freq_seek(struct file *file, struct snd_tea575x *tea,
74 const struct v4l2_hw_freq_seek *a);
8fd79579 75int snd_tea575x_hw_init(struct snd_tea575x *tea);
5daf53a6 76int snd_tea575x_init(struct snd_tea575x *tea, struct module *owner);
97f02e05 77void snd_tea575x_exit(struct snd_tea575x *tea);
559c2009 78void snd_tea575x_set_freq(struct snd_tea575x *tea);
1da177e4
LT
79
80#endif /* __SOUND_TEA575X_TUNER_H */