xref: /linux/drivers/media/radio/radio-gemtek.c (revision 95c52069)
109c434b8SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only
2f8c08524SHans Verkuil /*
3f8c08524SHans Verkuil  * GemTek radio card driver
4f8c08524SHans Verkuil  *
5f8c08524SHans Verkuil  * Copyright 1998 Jonas Munsin <jmunsin@iki.fi>
61da177e4SLinus Torvalds  *
71da177e4SLinus Torvalds  * GemTek hasn't released any specs on the card, so the protocol had to
81da177e4SLinus Torvalds  * be reverse engineered with dosemu.
91da177e4SLinus Torvalds  *
101da177e4SLinus Torvalds  * Besides the protocol changes, this is mostly a copy of:
111da177e4SLinus Torvalds  *
121da177e4SLinus Torvalds  *    RadioTrack II driver for Linux radio support (C) 1998 Ben Pfaff
131da177e4SLinus Torvalds  *
141da177e4SLinus Torvalds  *    Based on RadioTrack I/RadioReveal (C) 1997 M. Kirkwood
15d9b01449SAlan Cox  *    Converted to new API by Alan Cox <alan@lxorguk.ukuu.org.uk>
161da177e4SLinus Torvalds  *    Various bugfixes and enhancements by Russell Kroll <rkroll@exploits.org>
171da177e4SLinus Torvalds  *
18f8c08524SHans Verkuil  * Converted to the radio-isa framework by Hans Verkuil <hans.verkuil@cisco.com>
1932590819SMauro Carvalho Chehab  * Converted to V4L2 API by Mauro Carvalho Chehab <mchehab@kernel.org>
20f8c08524SHans Verkuil  *
21f8c08524SHans Verkuil  * Note: this card seems to swap the left and right audio channels!
22f8c08524SHans Verkuil  *
23f8c08524SHans Verkuil  * Fully tested with the Keene USB FM Transmitter and the v4l2-compliance tool.
241da177e4SLinus Torvalds  */
251da177e4SLinus Torvalds 
261da177e4SLinus Torvalds #include <linux/module.h>	/* Modules			*/
271da177e4SLinus Torvalds #include <linux/init.h>		/* Initdata			*/
28fb911ee8SPeter Osterlund #include <linux/ioport.h>	/* request_region		*/
291da177e4SLinus Torvalds #include <linux/delay.h>	/* udelay			*/
30d1c4ecdeSMauro Carvalho Chehab #include <linux/videodev2.h>	/* kernel radio structs		*/
31502b71b5SHans Verkuil #include <linux/mutex.h>
32502b71b5SHans Verkuil #include <linux/io.h>		/* outb, outb_p			*/
3338ed1aefSOndrej Zary #include <linux/pnp.h>
349f1dfccfSHans Verkuil #include <linux/slab.h>
35502b71b5SHans Verkuil #include <media/v4l2-ioctl.h>
36502b71b5SHans Verkuil #include <media/v4l2-device.h>
37f8c08524SHans Verkuil #include "radio-isa.h"
38502b71b5SHans Verkuil 
394753647eSPekka Seppanen /*
404753647eSPekka Seppanen  * Module info.
414753647eSPekka Seppanen  */
424753647eSPekka Seppanen 
4329834c1aSMauro Carvalho Chehab MODULE_AUTHOR("Jonas Munsin, Pekka Seppänen <pexu@kapsi.fi>");
444753647eSPekka Seppanen MODULE_DESCRIPTION("A driver for the GemTek Radio card.");
454753647eSPekka Seppanen MODULE_LICENSE("GPL");
46f8c08524SHans Verkuil MODULE_VERSION("1.0.0");
474753647eSPekka Seppanen 
484753647eSPekka Seppanen /*
494753647eSPekka Seppanen  * Module params.
504753647eSPekka Seppanen  */
514753647eSPekka Seppanen 
524753647eSPekka Seppanen #ifndef CONFIG_RADIO_GEMTEK_PORT
534753647eSPekka Seppanen #define CONFIG_RADIO_GEMTEK_PORT -1
544753647eSPekka Seppanen #endif
554753647eSPekka Seppanen #ifndef CONFIG_RADIO_GEMTEK_PROBE
564753647eSPekka Seppanen #define CONFIG_RADIO_GEMTEK_PROBE 1
574753647eSPekka Seppanen #endif
584753647eSPekka Seppanen 
59f8c08524SHans Verkuil #define GEMTEK_MAX 4
60f8c08524SHans Verkuil 
6190ab5ee9SRusty Russell static bool probe = CONFIG_RADIO_GEMTEK_PROBE;
6290ab5ee9SRusty Russell static bool hardmute;
63f8c08524SHans Verkuil static int io[GEMTEK_MAX] = { [0] = CONFIG_RADIO_GEMTEK_PORT,
64f8c08524SHans Verkuil 			      [1 ... (GEMTEK_MAX - 1)] = -1 };
65f8c08524SHans Verkuil static int radio_nr[GEMTEK_MAX]	= { [0 ... (GEMTEK_MAX - 1)] = -1 };
664753647eSPekka Seppanen 
67f8c08524SHans Verkuil module_param(probe, bool, 0444);
68f8c08524SHans Verkuil MODULE_PARM_DESC(probe, "Enable automatic device probing.");
69f8c08524SHans Verkuil 
70f8c08524SHans Verkuil module_param(hardmute, bool, 0644);
71547633deSMauro Carvalho Chehab MODULE_PARM_DESC(hardmute, "Enable 'hard muting' by shutting down PLL, may reduce static noise.");
72f8c08524SHans Verkuil 
73f8c08524SHans Verkuil module_param_array(io, int, NULL, 0444);
74547633deSMauro Carvalho Chehab MODULE_PARM_DESC(io, "Force I/O ports for the GemTek Radio card if automatic probing is disabled or fails. The most common I/O ports are: 0x20c 0x30c, 0x24c or 0x34c (0x20c, 0x248 and 0x28c have been reported to work for the combined sound/radiocard).");
754753647eSPekka Seppanen 
76f8c08524SHans Verkuil module_param_array(radio_nr, int, NULL, 0444);
77f8c08524SHans Verkuil MODULE_PARM_DESC(radio_nr, "Radio device numbers");
784753647eSPekka Seppanen 
79857e594aSTrent Piepho /*
80857e594aSTrent Piepho  * Frequency calculation constants.  Intermediate frequency 10.52 MHz (nominal
81857e594aSTrent Piepho  * value 10.7 MHz), reference divisor 6.39 kHz (nominal 6.25 kHz).
82857e594aSTrent Piepho  */
83857e594aSTrent Piepho #define FSCALE		8
84857e594aSTrent Piepho #define IF_OFFSET	((unsigned int)(10.52 * 16000 * (1<<FSCALE)))
85857e594aSTrent Piepho #define REF_FREQ	((unsigned int)(6.39 * 16 * (1<<FSCALE)))
86857e594aSTrent Piepho 
874753647eSPekka Seppanen #define GEMTEK_CK		0x01	/* Clock signal			*/
884753647eSPekka Seppanen #define GEMTEK_DA		0x02	/* Serial data			*/
894753647eSPekka Seppanen #define GEMTEK_CE		0x04	/* Chip enable			*/
904753647eSPekka Seppanen #define GEMTEK_NS		0x08	/* No signal			*/
914753647eSPekka Seppanen #define GEMTEK_MT		0x10	/* Line mute			*/
924753647eSPekka Seppanen #define GEMTEK_STDF_3_125_KHZ	0x01	/* Standard frequency 3.125 kHz	*/
934753647eSPekka Seppanen #define GEMTEK_PLL_OFF		0x07	/* PLL off			*/
944753647eSPekka Seppanen 
954753647eSPekka Seppanen #define BU2614_BUS_SIZE	32	/* BU2614 / BU2614FS bus size		*/
964753647eSPekka Seppanen 
974753647eSPekka Seppanen #define SHORT_DELAY 5		/* usec */
984753647eSPekka Seppanen #define LONG_DELAY 75		/* usec */
994753647eSPekka Seppanen 
100502b71b5SHans Verkuil struct gemtek {
101f8c08524SHans Verkuil 	struct radio_isa_card isa;
102f8c08524SHans Verkuil 	bool muted;
103b25be979STrent Piepho 	u32 bu2614data;
1044753647eSPekka Seppanen };
1054753647eSPekka Seppanen 
106b25be979STrent Piepho #define BU2614_FREQ_BITS	16 /* D0..D15, Frequency data		*/
107b25be979STrent Piepho #define BU2614_PORT_BITS	3 /* P0..P2, Output port control data	*/
108b25be979STrent Piepho #define BU2614_VOID_BITS	4 /* unused				*/
109b25be979STrent Piepho #define BU2614_FMES_BITS	1 /* CT, Frequency measurement beginning data */
110b25be979STrent Piepho #define BU2614_STDF_BITS	3 /* R0..R2, Standard frequency data	*/
111b25be979STrent Piepho #define BU2614_SWIN_BITS	1 /* S, Switch between FMIN / AMIN	*/
112b25be979STrent Piepho #define BU2614_SWAL_BITS        1 /* PS, Swallow counter division (AMIN only)*/
113b25be979STrent Piepho #define BU2614_VOID2_BITS	1 /* unused				*/
114b25be979STrent Piepho #define BU2614_FMUN_BITS	1 /* GT, Frequency measurement time & unlock */
115b25be979STrent Piepho #define BU2614_TEST_BITS	1 /* TS, Test data is input		*/
1164753647eSPekka Seppanen 
117b25be979STrent Piepho #define BU2614_FREQ_SHIFT	0
118b25be979STrent Piepho #define BU2614_PORT_SHIFT	(BU2614_FREQ_BITS + BU2614_FREQ_SHIFT)
119b25be979STrent Piepho #define BU2614_VOID_SHIFT	(BU2614_PORT_BITS + BU2614_PORT_SHIFT)
120b25be979STrent Piepho #define BU2614_FMES_SHIFT	(BU2614_VOID_BITS + BU2614_VOID_SHIFT)
121b25be979STrent Piepho #define BU2614_STDF_SHIFT	(BU2614_FMES_BITS + BU2614_FMES_SHIFT)
122b25be979STrent Piepho #define BU2614_SWIN_SHIFT	(BU2614_STDF_BITS + BU2614_STDF_SHIFT)
123b25be979STrent Piepho #define BU2614_SWAL_SHIFT	(BU2614_SWIN_BITS + BU2614_SWIN_SHIFT)
124b25be979STrent Piepho #define BU2614_VOID2_SHIFT	(BU2614_SWAL_BITS + BU2614_SWAL_SHIFT)
125b25be979STrent Piepho #define BU2614_FMUN_SHIFT	(BU2614_VOID2_BITS + BU2614_VOID2_SHIFT)
126b25be979STrent Piepho #define BU2614_TEST_SHIFT	(BU2614_FMUN_BITS + BU2614_FMUN_SHIFT)
127b25be979STrent Piepho 
128*95c52069SMauro Carvalho Chehab #define MKMASK(field)	(((1UL<<BU2614_##field##_BITS) - 1) << \
129b25be979STrent Piepho 			BU2614_##field##_SHIFT)
130b25be979STrent Piepho #define BU2614_PORT_MASK	MKMASK(PORT)
131b25be979STrent Piepho #define BU2614_FREQ_MASK	MKMASK(FREQ)
132b25be979STrent Piepho #define BU2614_VOID_MASK	MKMASK(VOID)
133b25be979STrent Piepho #define BU2614_FMES_MASK	MKMASK(FMES)
134b25be979STrent Piepho #define BU2614_STDF_MASK	MKMASK(STDF)
135b25be979STrent Piepho #define BU2614_SWIN_MASK	MKMASK(SWIN)
136b25be979STrent Piepho #define BU2614_SWAL_MASK	MKMASK(SWAL)
137b25be979STrent Piepho #define BU2614_VOID2_MASK	MKMASK(VOID2)
138b25be979STrent Piepho #define BU2614_FMUN_MASK	MKMASK(FMUN)
139b25be979STrent Piepho #define BU2614_TEST_MASK	MKMASK(TEST)
1404753647eSPekka Seppanen 
1414753647eSPekka Seppanen /*
1424753647eSPekka Seppanen  * Set data which will be sent to BU2614FS.
1434753647eSPekka Seppanen  */
144b25be979STrent Piepho #define gemtek_bu2614_set(dev, field, data) ((dev)->bu2614data = \
145b25be979STrent Piepho 	((dev)->bu2614data & ~field##_MASK) | ((data) << field##_SHIFT))
1464753647eSPekka Seppanen 
1474753647eSPekka Seppanen /*
1484753647eSPekka Seppanen  * Transmit settings to BU2614FS over GemTek IC.
1494753647eSPekka Seppanen  */
gemtek_bu2614_transmit(struct gemtek * gt)150502b71b5SHans Verkuil static void gemtek_bu2614_transmit(struct gemtek *gt)
1514753647eSPekka Seppanen {
152f8c08524SHans Verkuil 	struct radio_isa_card *isa = &gt->isa;
1534753647eSPekka Seppanen 	int i, bit, q, mute;
1544753647eSPekka Seppanen 
155502b71b5SHans Verkuil 	mute = gt->muted ? GEMTEK_MT : 0x00;
1564753647eSPekka Seppanen 
157f8c08524SHans Verkuil 	outb_p(mute | GEMTEK_CE | GEMTEK_DA | GEMTEK_CK, isa->io);
1584753647eSPekka Seppanen 	udelay(LONG_DELAY);
1594753647eSPekka Seppanen 
160502b71b5SHans Verkuil 	for (i = 0, q = gt->bu2614data; i < 32; i++, q >>= 1) {
161b25be979STrent Piepho 		bit = (q & 1) ? GEMTEK_DA : 0;
162f8c08524SHans Verkuil 		outb_p(mute | GEMTEK_CE | bit, isa->io);
1634753647eSPekka Seppanen 		udelay(SHORT_DELAY);
164f8c08524SHans Verkuil 		outb_p(mute | GEMTEK_CE | bit | GEMTEK_CK, isa->io);
1654753647eSPekka Seppanen 		udelay(SHORT_DELAY);
1664753647eSPekka Seppanen 	}
1674753647eSPekka Seppanen 
168f8c08524SHans Verkuil 	outb_p(mute | GEMTEK_DA | GEMTEK_CK, isa->io);
1694753647eSPekka Seppanen 	udelay(SHORT_DELAY);
1704753647eSPekka Seppanen }
1714753647eSPekka Seppanen 
1724753647eSPekka Seppanen /*
173857e594aSTrent Piepho  * Calculate divisor from FM-frequency for BU2614FS (3.125 KHz STDF expected).
1744753647eSPekka Seppanen  */
gemtek_convfreq(unsigned long freq)175857e594aSTrent Piepho static unsigned long gemtek_convfreq(unsigned long freq)
1764753647eSPekka Seppanen {
177857e594aSTrent Piepho 	return ((freq << FSCALE) + IF_OFFSET + REF_FREQ / 2) / REF_FREQ;
1784753647eSPekka Seppanen }
1794753647eSPekka Seppanen 
gemtek_alloc(void)180f8c08524SHans Verkuil static struct radio_isa_card *gemtek_alloc(void)
181f8c08524SHans Verkuil {
182f8c08524SHans Verkuil 	struct gemtek *gt = kzalloc(sizeof(*gt), GFP_KERNEL);
183f8c08524SHans Verkuil 
184f8c08524SHans Verkuil 	if (gt)
185f8c08524SHans Verkuil 		gt->muted = true;
186f8c08524SHans Verkuil 	return gt ? &gt->isa : NULL;
187f8c08524SHans Verkuil }
188f8c08524SHans Verkuil 
1894753647eSPekka Seppanen /*
1904753647eSPekka Seppanen  * Set FM-frequency.
1914753647eSPekka Seppanen  */
gemtek_s_frequency(struct radio_isa_card * isa,u32 freq)192f8c08524SHans Verkuil static int gemtek_s_frequency(struct radio_isa_card *isa, u32 freq)
1934753647eSPekka Seppanen {
194f8c08524SHans Verkuil 	struct gemtek *gt = container_of(isa, struct gemtek, isa);
1954753647eSPekka Seppanen 
196f8c08524SHans Verkuil 	if (hardmute && gt->muted)
197f8c08524SHans Verkuil 		return 0;
1984753647eSPekka Seppanen 
199502b71b5SHans Verkuil 	gemtek_bu2614_set(gt, BU2614_PORT, 0);
200502b71b5SHans Verkuil 	gemtek_bu2614_set(gt, BU2614_FMES, 0);
201502b71b5SHans Verkuil 	gemtek_bu2614_set(gt, BU2614_SWIN, 0);	/* FM-mode	*/
202502b71b5SHans Verkuil 	gemtek_bu2614_set(gt, BU2614_SWAL, 0);
203502b71b5SHans Verkuil 	gemtek_bu2614_set(gt, BU2614_FMUN, 1);	/* GT bit set	*/
204502b71b5SHans Verkuil 	gemtek_bu2614_set(gt, BU2614_TEST, 0);
205502b71b5SHans Verkuil 	gemtek_bu2614_set(gt, BU2614_STDF, GEMTEK_STDF_3_125_KHZ);
206502b71b5SHans Verkuil 	gemtek_bu2614_set(gt, BU2614_FREQ, gemtek_convfreq(freq));
207502b71b5SHans Verkuil 	gemtek_bu2614_transmit(gt);
208f8c08524SHans Verkuil 	return 0;
2094753647eSPekka Seppanen }
2104753647eSPekka Seppanen 
2114753647eSPekka Seppanen /*
2124753647eSPekka Seppanen  * Set mute flag.
2134753647eSPekka Seppanen  */
gemtek_s_mute_volume(struct radio_isa_card * isa,bool mute,int vol)214f8c08524SHans Verkuil static int gemtek_s_mute_volume(struct radio_isa_card *isa, bool mute, int vol)
2154753647eSPekka Seppanen {
216f8c08524SHans Verkuil 	struct gemtek *gt = container_of(isa, struct gemtek, isa);
2174753647eSPekka Seppanen 	int i;
218502b71b5SHans Verkuil 
219f8c08524SHans Verkuil 	gt->muted = mute;
2204753647eSPekka Seppanen 	if (hardmute) {
221f8c08524SHans Verkuil 		if (!mute)
222f8c08524SHans Verkuil 			return gemtek_s_frequency(isa, isa->freq);
223f8c08524SHans Verkuil 
2244753647eSPekka Seppanen 		/* Turn off PLL, disable data output */
225502b71b5SHans Verkuil 		gemtek_bu2614_set(gt, BU2614_PORT, 0);
226502b71b5SHans Verkuil 		gemtek_bu2614_set(gt, BU2614_FMES, 0);	/* CT bit off	*/
227502b71b5SHans Verkuil 		gemtek_bu2614_set(gt, BU2614_SWIN, 0);	/* FM-mode	*/
228502b71b5SHans Verkuil 		gemtek_bu2614_set(gt, BU2614_SWAL, 0);
229502b71b5SHans Verkuil 		gemtek_bu2614_set(gt, BU2614_FMUN, 0);	/* GT bit off	*/
230502b71b5SHans Verkuil 		gemtek_bu2614_set(gt, BU2614_TEST, 0);
231502b71b5SHans Verkuil 		gemtek_bu2614_set(gt, BU2614_STDF, GEMTEK_PLL_OFF);
232502b71b5SHans Verkuil 		gemtek_bu2614_set(gt, BU2614_FREQ, 0);
233502b71b5SHans Verkuil 		gemtek_bu2614_transmit(gt);
234f8c08524SHans Verkuil 		return 0;
235502b71b5SHans Verkuil 	}
236502b71b5SHans Verkuil 
2374753647eSPekka Seppanen 	/* Read bus contents (CE, CK and DA). */
238f8c08524SHans Verkuil 	i = inb_p(isa->io);
2394753647eSPekka Seppanen 	/* Write it back with mute flag set. */
240f8c08524SHans Verkuil 	outb_p((i >> 5) | (mute ? GEMTEK_MT : 0), isa->io);
2414753647eSPekka Seppanen 	udelay(SHORT_DELAY);
242f8c08524SHans Verkuil 	return 0;
2434753647eSPekka Seppanen }
2444753647eSPekka Seppanen 
gemtek_g_rxsubchans(struct radio_isa_card * isa)245f8c08524SHans Verkuil static u32 gemtek_g_rxsubchans(struct radio_isa_card *isa)
2464753647eSPekka Seppanen {
247f8c08524SHans Verkuil 	if (inb_p(isa->io) & GEMTEK_NS)
248f8c08524SHans Verkuil 		return V4L2_TUNER_SUB_MONO;
249f8c08524SHans Verkuil 	return V4L2_TUNER_SUB_STEREO;
2504753647eSPekka Seppanen }
2514753647eSPekka Seppanen 
2524753647eSPekka Seppanen /*
2534753647eSPekka Seppanen  * Check if requested card acts like GemTek Radio card.
2544753647eSPekka Seppanen  */
gemtek_probe(struct radio_isa_card * isa,int io)255f8c08524SHans Verkuil static bool gemtek_probe(struct radio_isa_card *isa, int io)
2564753647eSPekka Seppanen {
2574753647eSPekka Seppanen 	int i, q;
2584753647eSPekka Seppanen 
259f8c08524SHans Verkuil 	q = inb_p(io);	/* Read bus contents before probing. */
2604753647eSPekka Seppanen 	/* Try to turn on CE, CK and DA respectively and check if card responds
2614753647eSPekka Seppanen 	   properly. */
2624753647eSPekka Seppanen 	for (i = 0; i < 3; ++i) {
263f8c08524SHans Verkuil 		outb_p(1 << i, io);
2644753647eSPekka Seppanen 		udelay(SHORT_DELAY);
2654753647eSPekka Seppanen 
266f8c08524SHans Verkuil 		if ((inb_p(io) & ~GEMTEK_NS) != (0x17 | (1 << (i + 5))))
267f8c08524SHans Verkuil 			return false;
2684753647eSPekka Seppanen 	}
269f8c08524SHans Verkuil 	outb_p(q >> 5, io);	/* Write bus contents back. */
2704753647eSPekka Seppanen 	udelay(SHORT_DELAY);
271f8c08524SHans Verkuil 	return true;
2724753647eSPekka Seppanen }
2734753647eSPekka Seppanen 
274f8c08524SHans Verkuil static const struct radio_isa_ops gemtek_ops = {
275f8c08524SHans Verkuil 	.alloc = gemtek_alloc,
276f8c08524SHans Verkuil 	.probe = gemtek_probe,
277f8c08524SHans Verkuil 	.s_mute_volume = gemtek_s_mute_volume,
278f8c08524SHans Verkuil 	.s_frequency = gemtek_s_frequency,
279f8c08524SHans Verkuil 	.g_rxsubchans = gemtek_g_rxsubchans,
2801da177e4SLinus Torvalds };
2811da177e4SLinus Torvalds 
282f8c08524SHans Verkuil static const int gemtek_ioports[] = { 0x20c, 0x30c, 0x24c, 0x34c, 0x248, 0x28c };
283e9bb9c64SDouglas Landgraf 
28438ed1aefSOndrej Zary #ifdef CONFIG_PNP
285db4a8505SArvind Yadav static const struct pnp_device_id gemtek_pnp_devices[] = {
28638ed1aefSOndrej Zary 	/* AOpen FX-3D/Pro Radio */
28738ed1aefSOndrej Zary 	{.id = "ADS7183", .driver_data = 0},
28838ed1aefSOndrej Zary 	{.id = ""}
28938ed1aefSOndrej Zary };
29038ed1aefSOndrej Zary 
29138ed1aefSOndrej Zary MODULE_DEVICE_TABLE(pnp, gemtek_pnp_devices);
29238ed1aefSOndrej Zary #endif
29338ed1aefSOndrej Zary 
294f8c08524SHans Verkuil static struct radio_isa_driver gemtek_driver = {
295f8c08524SHans Verkuil 	.driver = {
296f8c08524SHans Verkuil 		.match		= radio_isa_match,
297f8c08524SHans Verkuil 		.probe		= radio_isa_probe,
298f8c08524SHans Verkuil 		.remove		= radio_isa_remove,
299f8c08524SHans Verkuil 		.driver		= {
300f8c08524SHans Verkuil 			.name	= "radio-gemtek",
301f8c08524SHans Verkuil 		},
302f8c08524SHans Verkuil 	},
30338ed1aefSOndrej Zary #ifdef CONFIG_PNP
30438ed1aefSOndrej Zary 	.pnp_driver = {
30538ed1aefSOndrej Zary 		.name		= "radio-gemtek",
30638ed1aefSOndrej Zary 		.id_table	= gemtek_pnp_devices,
30738ed1aefSOndrej Zary 		.probe		= radio_isa_pnp_probe,
30838ed1aefSOndrej Zary 		.remove		= radio_isa_pnp_remove,
30938ed1aefSOndrej Zary 	},
31038ed1aefSOndrej Zary #endif
311f8c08524SHans Verkuil 	.io_params = io,
312f8c08524SHans Verkuil 	.radio_nr_params = radio_nr,
313f8c08524SHans Verkuil 	.io_ports = gemtek_ioports,
314f8c08524SHans Verkuil 	.num_of_io_ports = ARRAY_SIZE(gemtek_ioports),
315f8c08524SHans Verkuil 	.region_size = 1,
316f8c08524SHans Verkuil 	.card = "GemTek Radio",
317f8c08524SHans Verkuil 	.ops = &gemtek_ops,
318f8c08524SHans Verkuil 	.has_stereo = true,
3191da177e4SLinus Torvalds };
3201da177e4SLinus Torvalds 
gemtek_init(void)3211da177e4SLinus Torvalds static int __init gemtek_init(void)
3221da177e4SLinus Torvalds {
323f8c08524SHans Verkuil 	gemtek_driver.probe = probe;
32438ed1aefSOndrej Zary #ifdef CONFIG_PNP
32538ed1aefSOndrej Zary 	pnp_register_driver(&gemtek_driver.pnp_driver);
32638ed1aefSOndrej Zary #endif
327f8c08524SHans Verkuil 	return isa_register_driver(&gemtek_driver.driver, GEMTEK_MAX);
3281da177e4SLinus Torvalds }
3291da177e4SLinus Torvalds 
gemtek_exit(void)3304753647eSPekka Seppanen static void __exit gemtek_exit(void)
3311da177e4SLinus Torvalds {
3328b4b6818SMauro Carvalho Chehab 	hardmute = true;	/* Turn off PLL */
33338ed1aefSOndrej Zary #ifdef CONFIG_PNP
33438ed1aefSOndrej Zary 	pnp_unregister_driver(&gemtek_driver.pnp_driver);
33538ed1aefSOndrej Zary #endif
336f8c08524SHans Verkuil 	isa_unregister_driver(&gemtek_driver.driver);
3371da177e4SLinus Torvalds }
3381da177e4SLinus Torvalds 
3391da177e4SLinus Torvalds module_init(gemtek_init);
3404753647eSPekka Seppanen module_exit(gemtek_exit);
341