#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/input.h>
#include <linux/videodev2.h>
#include <media/v4l2-device.h>
#include <media/v4l2-ioctl.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-event.h>
#include <linux/usb.h>
#include <linux/mutex.h>
#define DRIVER_AUTHOR …
#define DRIVER_DESC …
#define DRIVER_VERSION …
MODULE_AUTHOR(…);
MODULE_DESCRIPTION(…);
MODULE_LICENSE(…) …;
MODULE_VERSION(…);
#define USB_AMRADIO_VENDOR …
#define USB_AMRADIO_PRODUCT …
#define MR800_DRIVER_NAME …
#define amradio_dev_warn(dev, fmt, arg...) …
#define amradio_dev_err(dev, fmt, arg...) …
#define BUFFER_LENGTH …
#define USB_TIMEOUT …
#define FREQ_MIN …
#define FREQ_MAX …
#define FREQ_MUL …
#define AMRADIO_SET_FREQ …
#define AMRADIO_GET_READY_FLAG …
#define AMRADIO_GET_SIGNAL …
#define AMRADIO_GET_FREQ …
#define AMRADIO_SET_SEARCH_UP …
#define AMRADIO_SET_SEARCH_DOWN …
#define AMRADIO_SET_MUTE …
#define AMRADIO_SET_RIGHT_MUTE …
#define AMRADIO_SET_LEFT_MUTE …
#define AMRADIO_SET_MONO …
#define AMRADIO_SET_SEARCH_LVL …
#define AMRADIO_STOP_SEARCH …
#define WANT_STEREO …
#define WANT_MONO …
static int radio_nr = …;
module_param(radio_nr, int, 0);
MODULE_PARM_DESC(…) …;
struct amradio_device { … };
static inline struct amradio_device *to_amradio_dev(struct v4l2_device *v4l2_dev)
{ … }
static int amradio_send_cmd(struct amradio_device *radio, u8 cmd, u8 arg,
u8 *extra, u8 extralen, bool reply)
{ … }
static int amradio_set_mute(struct amradio_device *radio, bool mute)
{ … }
static int amradio_set_freq(struct amradio_device *radio, int freq)
{ … }
static int amradio_set_stereo(struct amradio_device *radio, bool stereo)
{ … }
static int amradio_get_stat(struct amradio_device *radio, bool *is_stereo, u32 *signal)
{ … }
static void usb_amradio_disconnect(struct usb_interface *intf)
{ … }
static int vidioc_querycap(struct file *file, void *priv,
struct v4l2_capability *v)
{ … }
static int vidioc_g_tuner(struct file *file, void *priv,
struct v4l2_tuner *v)
{ … }
static int vidioc_s_tuner(struct file *file, void *priv,
const struct v4l2_tuner *v)
{ … }
static int vidioc_s_frequency(struct file *file, void *priv,
const struct v4l2_frequency *f)
{ … }
static int vidioc_g_frequency(struct file *file, void *priv,
struct v4l2_frequency *f)
{ … }
static int vidioc_s_hw_freq_seek(struct file *file, void *priv,
const struct v4l2_hw_freq_seek *seek)
{ … }
static int usb_amradio_s_ctrl(struct v4l2_ctrl *ctrl)
{ … }
static int usb_amradio_init(struct amradio_device *radio)
{ … }
static int usb_amradio_suspend(struct usb_interface *intf, pm_message_t message)
{ … }
static int usb_amradio_resume(struct usb_interface *intf)
{ … }
static const struct v4l2_ctrl_ops usb_amradio_ctrl_ops = …;
static const struct v4l2_file_operations usb_amradio_fops = …;
static const struct v4l2_ioctl_ops usb_amradio_ioctl_ops = …;
static void usb_amradio_release(struct v4l2_device *v4l2_dev)
{ … }
static int usb_amradio_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{ … }
static const struct usb_device_id usb_amradio_device_table[] = …;
MODULE_DEVICE_TABLE(usb, usb_amradio_device_table);
static struct usb_driver usb_amradio_driver = …;
module_usb_driver(…) …;