Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / drivers / media / radio / radio-tea5777.h
blob6b5af3c8457b57852e65b67834fc7442431f0473
1 #ifndef __RADIO_TEA5777_H
2 #define __RADIO_TEA5777_H
4 /*
5 * v4l2 driver for TEA5777 Philips AM/FM radio tuner chips
7 * Copyright (c) 2012 Hans de Goede <hdegoede@redhat.com>
9 * Based on the ALSA driver for TEA5757/5759 Philips AM/FM radio tuner chips:
11 * Copyright (c) 2004 Jaroslav Kysela <perex@perex.cz>
12 * Copyright (c) 2012 Hans de Goede <hdegoede@redhat.com>
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
26 #include <linux/videodev2.h>
27 #include <media/v4l2-ctrls.h>
28 #include <media/v4l2-dev.h>
29 #include <media/v4l2-device.h>
31 #define TEA575X_FMIF 10700
32 #define TEA575X_AMIF 450
34 struct radio_tea5777;
36 struct radio_tea5777_ops {
38 * Write the 6 bytes large write register of the tea5777
40 * val represents the 6 write registers, with byte 1 from the
41 * datasheet being the most significant byte (so byte 5 of the u64),
42 * and byte 6 from the datasheet being the least significant byte.
44 * returns 0 on success.
46 int (*write_reg)(struct radio_tea5777 *tea, u64 val);
48 * Read the 3 bytes large read register of the tea5777
50 * The read value gets returned in val, akin to write_reg, byte 1 from
51 * the datasheet is stored as the most significant byte (so byte 2 of
52 * the u32), and byte 3 from the datasheet gets stored as the least
53 * significant byte (iow byte 0 of the u32).
55 * returns 0 on success.
57 int (*read_reg)(struct radio_tea5777 *tea, u32 *val);
60 struct radio_tea5777 {
61 struct v4l2_device *v4l2_dev;
62 struct v4l2_file_operations fops;
63 struct video_device vd; /* video device */
64 bool has_am; /* Device can tune to AM freqs */
65 bool write_before_read; /* must write before read quirk */
66 bool needs_write; /* for write before read quirk */
67 u32 band; /* current band */
68 u32 freq; /* current frequency */
69 u32 audmode; /* last set audmode */
70 u32 seek_rangelow; /* current hwseek limits */
71 u32 seek_rangehigh;
72 u32 read_reg;
73 u64 write_reg;
74 struct mutex mutex;
75 const struct radio_tea5777_ops *ops;
76 void *private_data;
77 u8 card[32];
78 u8 bus_info[32];
79 struct v4l2_ctrl_handler ctrl_handler;
82 int radio_tea5777_init(struct radio_tea5777 *tea, struct module *owner);
83 void radio_tea5777_exit(struct radio_tea5777 *tea);
84 int radio_tea5777_set_freq(struct radio_tea5777 *tea);
86 #endif /* __RADIO_TEA5777_H */