Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 #ifndef __SOUND_TEA575X_TUNER_H
0003 #define __SOUND_TEA575X_TUNER_H
0004 
0005 /*
0006  *   ALSA driver for TEA5757/5759 Philips AM/FM tuner chips
0007  *
0008  *  Copyright (c) 2004 Jaroslav Kysela <perex@perex.cz>
0009  */
0010 
0011 #include <linux/videodev2.h>
0012 #include <media/v4l2-ctrls.h>
0013 #include <media/v4l2-dev.h>
0014 #include <media/v4l2-device.h>
0015 
0016 #define TEA575X_FMIF    10700
0017 #define TEA575X_AMIF      450
0018 
0019 #define TEA575X_DATA    (1 << 0)
0020 #define TEA575X_CLK (1 << 1)
0021 #define TEA575X_WREN    (1 << 2)
0022 #define TEA575X_MOST    (1 << 3)
0023 
0024 struct snd_tea575x;
0025 
0026 struct snd_tea575x_ops {
0027     /* Drivers using snd_tea575x must either define read_ and write_val */
0028     void (*write_val)(struct snd_tea575x *tea, u32 val);
0029     u32 (*read_val)(struct snd_tea575x *tea);
0030     /* Or define the 3 pin functions */
0031     void (*set_pins)(struct snd_tea575x *tea, u8 pins);
0032     u8 (*get_pins)(struct snd_tea575x *tea);
0033     void (*set_direction)(struct snd_tea575x *tea, bool output);
0034 };
0035 
0036 struct snd_tea575x {
0037     struct v4l2_device *v4l2_dev;
0038     struct v4l2_file_operations fops;
0039     struct video_device vd;     /* video device */
0040     int radio_nr;           /* radio_nr */
0041     bool tea5759;           /* 5759 chip is present */
0042     bool has_am;            /* Device can tune to AM freqs */
0043     bool cannot_read_data;      /* Device cannot read the data pin */
0044     bool cannot_mute;       /* Device cannot mute */
0045     bool mute;          /* Device is muted? */
0046     bool stereo;            /* receiving stereo */
0047     bool tuned;         /* tuned to a station */
0048     unsigned int val;       /* hw value */
0049     u32 band;           /* 0: FM, 1: FM-Japan, 2: AM */
0050     u32 freq;           /* frequency */
0051     struct mutex mutex;
0052     const struct snd_tea575x_ops *ops;
0053     void *private_data;
0054     u8 card[32];
0055     u8 bus_info[32];
0056     struct v4l2_ctrl_handler ctrl_handler;
0057     int (*ext_init)(struct snd_tea575x *tea);
0058 };
0059 
0060 int snd_tea575x_enum_freq_bands(struct snd_tea575x *tea,
0061                     struct v4l2_frequency_band *band);
0062 int snd_tea575x_g_tuner(struct snd_tea575x *tea, struct v4l2_tuner *v);
0063 int snd_tea575x_s_hw_freq_seek(struct file *file, struct snd_tea575x *tea,
0064                 const struct v4l2_hw_freq_seek *a);
0065 int snd_tea575x_hw_init(struct snd_tea575x *tea);
0066 int snd_tea575x_init(struct snd_tea575x *tea, struct module *owner);
0067 void snd_tea575x_exit(struct snd_tea575x *tea);
0068 void snd_tea575x_set_freq(struct snd_tea575x *tea);
0069 
0070 #endif /* __SOUND_TEA575X_TUNER_H */