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