1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Framework for ISA radio drivers.
4 * This takes care of all the V4L2 scaffolding, allowing the ISA drivers
5 * to concentrate on the actual hardware operation.
7 * Copyright (C) 2012 Hans Verkuil <hans.verkuil@cisco.com>
13 #include <linux/isa.h>
14 #include <linux/pnp.h>
15 #include <linux/videodev2.h>
16 #include <media/v4l2-device.h>
17 #include <media/v4l2-ctrls.h>
19 struct radio_isa_driver
;
22 /* Core structure for radio ISA cards */
23 struct radio_isa_card
{
24 const struct radio_isa_driver
*drv
;
25 struct v4l2_device v4l2_dev
;
26 struct v4l2_ctrl_handler hdl
;
27 struct video_device vdev
;
29 const struct radio_isa_ops
*ops
;
30 struct { /* mute/volume cluster */
31 struct v4l2_ctrl
*mute
;
32 struct v4l2_ctrl
*volume
;
37 /* Card is in stereo audio mode */
39 /* Current frequency */
43 struct radio_isa_ops
{
44 /* Allocate and initialize a radio_isa_card struct */
45 struct radio_isa_card
*(*alloc
)(void);
46 /* Probe whether a card is present at the given port */
47 bool (*probe
)(struct radio_isa_card
*isa
, int io
);
48 /* Special card initialization can be done here, this is called after
49 * the standard controls are registered, but before they are setup,
50 * thus allowing drivers to add their own controls here. */
51 int (*init
)(struct radio_isa_card
*isa
);
52 /* Set mute and volume. */
53 int (*s_mute_volume
)(struct radio_isa_card
*isa
, bool mute
, int volume
);
55 int (*s_frequency
)(struct radio_isa_card
*isa
, u32 freq
);
56 /* Set stereo/mono audio mode */
57 int (*s_stereo
)(struct radio_isa_card
*isa
, bool stereo
);
58 /* Get rxsubchans value for VIDIOC_G_TUNER */
59 u32 (*g_rxsubchans
)(struct radio_isa_card
*isa
);
60 /* Get the signal strength for VIDIOC_G_TUNER */
61 u32 (*g_signal
)(struct radio_isa_card
*isa
);
64 /* Top level structure needed to instantiate the cards */
65 struct radio_isa_driver
{
66 struct isa_driver driver
;
68 struct pnp_driver pnp_driver
;
70 const struct radio_isa_ops
*ops
;
71 /* The module_param_array with the specified I/O ports */
73 /* The module_param_array with the radio_nr values */
75 /* Whether we should probe for possible cards */
77 /* The list of possible I/O ports */
79 /* The size of that list */
81 /* The region size to request */
83 /* The name of the card */
85 /* Card can capture stereo audio */
87 /* The maximum volume for the volume control. If 0, then there
88 is no volume control possible. */
92 int radio_isa_match(struct device
*pdev
, unsigned int dev
);
93 int radio_isa_probe(struct device
*pdev
, unsigned int dev
);
94 int radio_isa_remove(struct device
*pdev
, unsigned int dev
);
96 int radio_isa_pnp_probe(struct pnp_dev
*dev
,
97 const struct pnp_device_id
*dev_id
);
98 void radio_isa_pnp_remove(struct pnp_dev
*dev
);