]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - drivers/media/radio/radio-isa.h
Merge branches 'for-4.11/upstream-fixes', 'for-4.12/accutouch', 'for-4.12/cp2112...
[mirror_ubuntu-bionic-kernel.git] / drivers / media / radio / radio-isa.h
CommitLineData
137c579c
HV
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.
137c579c
HV
16 */
17
18#ifndef _RADIO_ISA_H_
19#define _RADIO_ISA_H_
20
21#include <linux/isa.h>
865d7ec9 22#include <linux/pnp.h>
137c579c
HV
23#include <linux/videodev2.h>
24#include <media/v4l2-device.h>
25#include <media/v4l2-ctrls.h>
26
27struct radio_isa_driver;
28struct radio_isa_ops;
29
30/* Core structure for radio ISA cards */
31struct 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;
36 struct mutex lock;
37 const struct radio_isa_ops *ops;
38 struct { /* mute/volume cluster */
39 struct v4l2_ctrl *mute;
40 struct v4l2_ctrl *volume;
41 };
42 /* I/O port */
43 int io;
44
45 /* Card is in stereo audio mode */
46 bool stereo;
47 /* Current frequency */
48 u32 freq;
49};
50
51struct 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);
62 /* Set frequency */
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);
70};
71
72/* Top level structure needed to instantiate the cards */
73struct radio_isa_driver {
74 struct isa_driver driver;
865d7ec9
OZ
75#ifdef CONFIG_PNP
76 struct pnp_driver pnp_driver;
77#endif
137c579c
HV
78 const struct radio_isa_ops *ops;
79 /* The module_param_array with the specified I/O ports */
80 int *io_params;
81 /* The module_param_array with the radio_nr values */
82 int *radio_nr_params;
83 /* Whether we should probe for possible cards */
84 bool probe;
85 /* The list of possible I/O ports */
86 const int *io_ports;
87 /* The size of that list */
88 int num_of_io_ports;
89 /* The region size to request */
90 unsigned region_size;
91 /* The name of the card */
92 const char *card;
93 /* Card can capture stereo audio */
94 bool has_stereo;
95 /* The maximum volume for the volume control. If 0, then there
96 is no volume control possible. */
97 int max_volume;
98};
99
100int radio_isa_match(struct device *pdev, unsigned int dev);
101int radio_isa_probe(struct device *pdev, unsigned int dev);
102int radio_isa_remove(struct device *pdev, unsigned int dev);
865d7ec9
OZ
103#ifdef CONFIG_PNP
104int radio_isa_pnp_probe(struct pnp_dev *dev,
105 const struct pnp_device_id *dev_id);
106void radio_isa_pnp_remove(struct pnp_dev *dev);
107#endif
137c579c
HV
108
109#endif