brintos

brintos / linux-shallow public Read only

0
0
Text · 2.2 KiB · 33470a0 Raw
77 lines · c
1/* SPDX-License-Identifier: GPL-2.0-or-later */2#ifndef __RADIO_TEA5777_H3#define __RADIO_TEA5777_H4 5/*6 *   v4l2 driver for TEA5777 Philips AM/FM radio tuner chips7 *8 *	Copyright (c) 2012 Hans de Goede <hdegoede@redhat.com>9 *10 *   Based on the ALSA driver for TEA5757/5759 Philips AM/FM radio tuner chips:11 *12 *	Copyright (c) 2004 Jaroslav Kysela <perex@perex.cz>13 *	Copyright (c) 2012 Hans de Goede <hdegoede@redhat.com>14 */15 16#include <linux/videodev2.h>17#include <media/v4l2-ctrls.h>18#include <media/v4l2-dev.h>19#include <media/v4l2-device.h>20 21#define TEA575X_FMIF	1070022#define TEA575X_AMIF	  45023 24struct radio_tea5777;25 26struct radio_tea5777_ops {27	/*28	 * Write the 6 bytes large write register of the tea577729	 *30	 * val represents the 6 write registers, with byte 1 from the31	 * datasheet being the most significant byte (so byte 5 of the u64),32	 * and byte 6 from the datasheet being the least significant byte.33	 *34	 * returns 0 on success.35	 */36	int (*write_reg)(struct radio_tea5777 *tea, u64 val);37	/*38	 * Read the 3 bytes large read register of the tea577739	 *40	 * The read value gets returned in val, akin to write_reg, byte 1 from41	 * the datasheet is stored as the most significant byte (so byte 2 of42	 * the u32), and byte 3 from the datasheet gets stored as the least43	 * significant byte (iow byte 0 of the u32).44	 *45	 * returns 0 on success.46	 */47	int (*read_reg)(struct radio_tea5777 *tea, u32 *val);48};49 50struct 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 */61	u32 seek_rangehigh;62	u32 read_reg;63	u64 write_reg;64	struct mutex mutex;65	const struct radio_tea5777_ops *ops;66	void *private_data;67	u8 card[32];68	u8 bus_info[32];69	struct v4l2_ctrl_handler ctrl_handler;70};71 72int radio_tea5777_init(struct radio_tea5777 *tea, struct module *owner);73void radio_tea5777_exit(struct radio_tea5777 *tea);74int radio_tea5777_set_freq(struct radio_tea5777 *tea);75 76#endif /* __RADIO_TEA5777_H */77