root/drivers/media/radio/radio-tea5777.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /* SPDX-License-Identifier: GPL-2.0-or-later */
   2 #ifndef __RADIO_TEA5777_H
   3 #define __RADIO_TEA5777_H
   4 
   5 /*
   6  *   v4l2 driver for TEA5777 Philips AM/FM radio tuner chips
   7  *
   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    10700
  22 #define TEA575X_AMIF      450
  23 
  24 struct radio_tea5777;
  25 
  26 struct radio_tea5777_ops {
  27         /*
  28          * Write the 6 bytes large write register of the tea5777
  29          *
  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.
  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 tea5777
  39          *
  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).
  44          *
  45          * returns 0 on success.
  46          */
  47         int (*read_reg)(struct radio_tea5777 *tea, u32 *val);
  48 };
  49 
  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 */
  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 
  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);
  75 
  76 #endif /* __RADIO_TEA5777_H */

/* [<][>][^][v][top][bottom][index][help] */