1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 #ifndef __RADIO_TEA5777_H
3 #define __RADIO_TEA5777_H
6 * v4l2 driver for TEA5777 Philips AM/FM radio tuner chips
8 * Copyright (c) 2012 Hans de Goede <hdegoede@redhat.com>
10 * Based on the ALSA driver for TEA5757/5759 Philips AM/FM radio tuner chips:
12 * Copyright (c) 2004 Jaroslav Kysela <perex@perex.cz>
13 * Copyright (c) 2012 Hans de Goede <hdegoede@redhat.com>
16 #include <linux/videodev2.h>
17 #include <media/v4l2-ctrls.h>
18 #include <media/v4l2-dev.h>
19 #include <media/v4l2-device.h>
21 #define TEA575X_FMIF 10700
22 #define TEA575X_AMIF 450
26 struct radio_tea5777_ops
{
28 * Write the 6 bytes large write register of the tea5777
30 * val represents the 6 write registers, with byte 1 from the
31 * datasheet being the most significant byte (so byte 5 of the u64),
32 * and byte 6 from the datasheet being the least significant byte.
34 * returns 0 on success.
36 int (*write_reg
)(struct radio_tea5777
*tea
, u64 val
);
38 * Read the 3 bytes large read register of the tea5777
40 * The read value gets returned in val, akin to write_reg, byte 1 from
41 * the datasheet is stored as the most significant byte (so byte 2 of
42 * the u32), and byte 3 from the datasheet gets stored as the least
43 * significant byte (iow byte 0 of the u32).
45 * returns 0 on success.
47 int (*read_reg
)(struct radio_tea5777
*tea
, u32
*val
);
50 struct radio_tea5777
{
51 struct v4l2_device
*v4l2_dev
;
52 struct v4l2_file_operations fops
;
53 struct video_device vd
; /* video device */
54 bool has_am
; /* Device can tune to AM freqs */
55 bool write_before_read
; /* must write before read quirk */
56 bool needs_write
; /* for write before read quirk */
57 u32 band
; /* current band */
58 u32 freq
; /* current frequency */
59 u32 audmode
; /* last set audmode */
60 u32 seek_rangelow
; /* current hwseek limits */
65 const struct radio_tea5777_ops
*ops
;
69 struct v4l2_ctrl_handler ctrl_handler
;
72 int radio_tea5777_init(struct radio_tea5777
*tea
, struct module
*owner
);
73 void radio_tea5777_exit(struct radio_tea5777
*tea
);
74 int radio_tea5777_set_freq(struct radio_tea5777
*tea
);
76 #endif /* __RADIO_TEA5777_H */