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/pnp.h>
28 #include <linux/videodev2.h>
29 #include <media/v4l2-device.h>
30 #include <media/v4l2-ctrls.h>
32 struct radio_isa_driver
;
35 /* Core structure for radio ISA cards */
36 struct radio_isa_card
{
37 const struct radio_isa_driver
*drv
;
38 struct v4l2_device v4l2_dev
;
39 struct v4l2_ctrl_handler hdl
;
40 struct video_device vdev
;
42 const struct radio_isa_ops
*ops
;
43 struct { /* mute/volume cluster */
44 struct v4l2_ctrl
*mute
;
45 struct v4l2_ctrl
*volume
;
50 /* Card is in stereo audio mode */
52 /* Current frequency */
56 struct radio_isa_ops
{
57 /* Allocate and initialize a radio_isa_card struct */
58 struct radio_isa_card
*(*alloc
)(void);
59 /* Probe whether a card is present at the given port */
60 bool (*probe
)(struct radio_isa_card
*isa
, int io
);
61 /* Special card initialization can be done here, this is called after
62 * the standard controls are registered, but before they are setup,
63 * thus allowing drivers to add their own controls here. */
64 int (*init
)(struct radio_isa_card
*isa
);
65 /* Set mute and volume. */
66 int (*s_mute_volume
)(struct radio_isa_card
*isa
, bool mute
, int volume
);
68 int (*s_frequency
)(struct radio_isa_card
*isa
, u32 freq
);
69 /* Set stereo/mono audio mode */
70 int (*s_stereo
)(struct radio_isa_card
*isa
, bool stereo
);
71 /* Get rxsubchans value for VIDIOC_G_TUNER */
72 u32 (*g_rxsubchans
)(struct radio_isa_card
*isa
);
73 /* Get the signal strength for VIDIOC_G_TUNER */
74 u32 (*g_signal
)(struct radio_isa_card
*isa
);
77 /* Top level structure needed to instantiate the cards */
78 struct radio_isa_driver
{
79 struct isa_driver driver
;
81 struct pnp_driver pnp_driver
;
83 const struct radio_isa_ops
*ops
;
84 /* The module_param_array with the specified I/O ports */
86 /* The module_param_array with the radio_nr values */
88 /* Whether we should probe for possible cards */
90 /* The list of possible I/O ports */
92 /* The size of that list */
94 /* The region size to request */
96 /* The name of the card */
98 /* Card can capture stereo audio */
100 /* The maximum volume for the volume control. If 0, then there
101 is no volume control possible. */
105 int radio_isa_match(struct device
*pdev
, unsigned int dev
);
106 int radio_isa_probe(struct device
*pdev
, unsigned int dev
);
107 int radio_isa_remove(struct device
*pdev
, unsigned int dev
);
109 int radio_isa_pnp_probe(struct pnp_dev
*dev
,
110 const struct pnp_device_id
*dev_id
);
111 void radio_isa_pnp_remove(struct pnp_dev
*dev
);