1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-or-later */ 2*4882a593Smuzhiyun #ifndef __SOUND_TEA575X_TUNER_H 3*4882a593Smuzhiyun #define __SOUND_TEA575X_TUNER_H 4*4882a593Smuzhiyun 5*4882a593Smuzhiyun /* 6*4882a593Smuzhiyun * ALSA driver for TEA5757/5759 Philips AM/FM tuner chips 7*4882a593Smuzhiyun * 8*4882a593Smuzhiyun * Copyright (c) 2004 Jaroslav Kysela <perex@perex.cz> 9*4882a593Smuzhiyun */ 10*4882a593Smuzhiyun 11*4882a593Smuzhiyun #include <linux/videodev2.h> 12*4882a593Smuzhiyun #include <media/v4l2-ctrls.h> 13*4882a593Smuzhiyun #include <media/v4l2-dev.h> 14*4882a593Smuzhiyun #include <media/v4l2-device.h> 15*4882a593Smuzhiyun 16*4882a593Smuzhiyun #define TEA575X_FMIF 10700 17*4882a593Smuzhiyun #define TEA575X_AMIF 450 18*4882a593Smuzhiyun 19*4882a593Smuzhiyun #define TEA575X_DATA (1 << 0) 20*4882a593Smuzhiyun #define TEA575X_CLK (1 << 1) 21*4882a593Smuzhiyun #define TEA575X_WREN (1 << 2) 22*4882a593Smuzhiyun #define TEA575X_MOST (1 << 3) 23*4882a593Smuzhiyun 24*4882a593Smuzhiyun struct snd_tea575x; 25*4882a593Smuzhiyun 26*4882a593Smuzhiyun struct snd_tea575x_ops { 27*4882a593Smuzhiyun /* Drivers using snd_tea575x must either define read_ and write_val */ 28*4882a593Smuzhiyun void (*write_val)(struct snd_tea575x *tea, u32 val); 29*4882a593Smuzhiyun u32 (*read_val)(struct snd_tea575x *tea); 30*4882a593Smuzhiyun /* Or define the 3 pin functions */ 31*4882a593Smuzhiyun void (*set_pins)(struct snd_tea575x *tea, u8 pins); 32*4882a593Smuzhiyun u8 (*get_pins)(struct snd_tea575x *tea); 33*4882a593Smuzhiyun void (*set_direction)(struct snd_tea575x *tea, bool output); 34*4882a593Smuzhiyun }; 35*4882a593Smuzhiyun 36*4882a593Smuzhiyun struct snd_tea575x { 37*4882a593Smuzhiyun struct v4l2_device *v4l2_dev; 38*4882a593Smuzhiyun struct v4l2_file_operations fops; 39*4882a593Smuzhiyun struct video_device vd; /* video device */ 40*4882a593Smuzhiyun int radio_nr; /* radio_nr */ 41*4882a593Smuzhiyun bool tea5759; /* 5759 chip is present */ 42*4882a593Smuzhiyun bool has_am; /* Device can tune to AM freqs */ 43*4882a593Smuzhiyun bool cannot_read_data; /* Device cannot read the data pin */ 44*4882a593Smuzhiyun bool cannot_mute; /* Device cannot mute */ 45*4882a593Smuzhiyun bool mute; /* Device is muted? */ 46*4882a593Smuzhiyun bool stereo; /* receiving stereo */ 47*4882a593Smuzhiyun bool tuned; /* tuned to a station */ 48*4882a593Smuzhiyun unsigned int val; /* hw value */ 49*4882a593Smuzhiyun u32 band; /* 0: FM, 1: FM-Japan, 2: AM */ 50*4882a593Smuzhiyun u32 freq; /* frequency */ 51*4882a593Smuzhiyun struct mutex mutex; 52*4882a593Smuzhiyun const struct snd_tea575x_ops *ops; 53*4882a593Smuzhiyun void *private_data; 54*4882a593Smuzhiyun u8 card[32]; 55*4882a593Smuzhiyun u8 bus_info[32]; 56*4882a593Smuzhiyun struct v4l2_ctrl_handler ctrl_handler; 57*4882a593Smuzhiyun int (*ext_init)(struct snd_tea575x *tea); 58*4882a593Smuzhiyun }; 59*4882a593Smuzhiyun 60*4882a593Smuzhiyun int snd_tea575x_enum_freq_bands(struct snd_tea575x *tea, 61*4882a593Smuzhiyun struct v4l2_frequency_band *band); 62*4882a593Smuzhiyun int snd_tea575x_g_tuner(struct snd_tea575x *tea, struct v4l2_tuner *v); 63*4882a593Smuzhiyun int snd_tea575x_s_hw_freq_seek(struct file *file, struct snd_tea575x *tea, 64*4882a593Smuzhiyun const struct v4l2_hw_freq_seek *a); 65*4882a593Smuzhiyun int snd_tea575x_hw_init(struct snd_tea575x *tea); 66*4882a593Smuzhiyun int snd_tea575x_init(struct snd_tea575x *tea, struct module *owner); 67*4882a593Smuzhiyun void snd_tea575x_exit(struct snd_tea575x *tea); 68*4882a593Smuzhiyun void snd_tea575x_set_freq(struct snd_tea575x *tea); 69*4882a593Smuzhiyun 70*4882a593Smuzhiyun #endif /* __SOUND_TEA575X_TUNER_H */ 71