aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/radio/radio-isa.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/radio/radio-isa.h')
-rw-r--r--drivers/media/radio/radio-isa.h105
1 files changed, 105 insertions, 0 deletions
diff --git a/drivers/media/radio/radio-isa.h b/drivers/media/radio/radio-isa.h
new file mode 100644
index 000000000000..8a0ea84d86de
--- /dev/null
+++ b/drivers/media/radio/radio-isa.h
@@ -0,0 +1,105 @@
1/*
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.
5 *
6 * Copyright (C) 2012 Hans Verkuil <hans.verkuil@cisco.com>
7 *
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.
11 *
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.
16 *
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
20 * 02110-1301 USA
21 */
22
23#ifndef _RADIO_ISA_H_
24#define _RADIO_ISA_H_
25
26#include <linux/isa.h>
27#include <linux/videodev2.h>
28#include <media/v4l2-device.h>
29#include <media/v4l2-ctrls.h>
30
31struct radio_isa_driver;
32struct radio_isa_ops;
33
34/* Core structure for radio ISA cards */
35struct 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;
40 struct mutex lock;
41 const struct radio_isa_ops *ops;
42 struct { /* mute/volume cluster */
43 struct v4l2_ctrl *mute;
44 struct v4l2_ctrl *volume;
45 };
46 /* I/O port */
47 int io;
48
49 /* Card is in stereo audio mode */
50 bool stereo;
51 /* Current frequency */
52 u32 freq;
53};
54
55struct 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);
66 /* Set frequency */
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);
74};
75
76/* Top level structure needed to instantiate the cards */
77struct 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 */
81 int *io_params;
82 /* The module_param_array with the radio_nr values */
83 int *radio_nr_params;
84 /* Whether we should probe for possible cards */
85 bool probe;
86 /* The list of possible I/O ports */
87 const int *io_ports;
88 /* The size of that list */
89 int num_of_io_ports;
90 /* The region size to request */
91 unsigned region_size;
92 /* The name of the card */
93 const char *card;
94 /* Card can capture stereo audio */
95 bool has_stereo;
96 /* The maximum volume for the volume control. If 0, then there
97 is no volume control possible. */
98 int max_volume;
99};
100
101int radio_isa_match(struct device *pdev, unsigned int dev);
102int radio_isa_probe(struct device *pdev, unsigned int dev);
103int radio_isa_remove(struct device *pdev, unsigned int dev);
104
105#endif