2 * Framework for ISA radio drivers.
3 * This takes care of all the V4L2 scaffolding, allowing the ISA drivers
4 * to concentrate on the actual hardware operation.
6 * Copyright (C) 2012 Hans Verkuil <hans.verkuil@cisco.com>
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
26 #include <linux/isa.h>
27 #include <linux/videodev2.h>
28 #include <media/v4l2-device.h>
29 #include <media/v4l2-ctrls.h>
31 struct radio_isa_driver;
34 /* Core structure for radio ISA cards */
35 struct radio_isa_card {
36 const struct radio_isa_driver *drv;
37 struct v4l2_device v4l2_dev;
38 struct v4l2_ctrl_handler hdl;
39 struct video_device vdev;
41 const struct radio_isa_ops *ops;
42 struct { /* mute/volume cluster */
43 struct v4l2_ctrl *mute;
44 struct v4l2_ctrl *volume;
49 /* Card is in stereo audio mode */
51 /* Current frequency */
55 struct radio_isa_ops {
56 /* Allocate and initialize a radio_isa_card struct */
57 struct radio_isa_card *(*alloc)(void);
58 /* Probe whether a card is present at the given port */
59 bool (*probe)(struct radio_isa_card *isa, int io);
60 /* Special card initialization can be done here, this is called after
61 * the standard controls are registered, but before they are setup,
62 * thus allowing drivers to add their own controls here. */
63 int (*init)(struct radio_isa_card *isa);
64 /* Set mute and volume. */
65 int (*s_mute_volume)(struct radio_isa_card *isa, bool mute, int volume);
67 int (*s_frequency)(struct radio_isa_card *isa, u32 freq);
68 /* Set stereo/mono audio mode */
69 int (*s_stereo)(struct radio_isa_card *isa, bool stereo);
70 /* Get rxsubchans value for VIDIOC_G_TUNER */
71 u32 (*g_rxsubchans)(struct radio_isa_card *isa);
72 /* Get the signal strength for VIDIOC_G_TUNER */
73 u32 (*g_signal)(struct radio_isa_card *isa);
76 /* Top level structure needed to instantiate the cards */
77 struct radio_isa_driver {
78 struct isa_driver driver;
79 const struct radio_isa_ops *ops;
80 /* The module_param_array with the specified I/O ports */
82 /* The module_param_array with the radio_nr values */
84 /* Whether we should probe for possible cards */
86 /* The list of possible I/O ports */
88 /* The size of that list */
90 /* The region size to request */
92 /* The name of the card */
94 /* Card can capture stereo audio */
96 /* The maximum volume for the volume control. If 0, then there
97 is no volume control possible. */
101 int radio_isa_match(struct device *pdev, unsigned int dev);
102 int radio_isa_probe(struct device *pdev, unsigned int dev);
103 int radio_isa_remove(struct device *pdev, unsigned int dev);