25 #include <linux/module.h>
29 #include <linux/videodev2.h>
33 #include <linux/slab.h>
51 #ifndef CONFIG_RADIO_GEMTEK_PORT
52 #define CONFIG_RADIO_GEMTEK_PORT -1
54 #ifndef CONFIG_RADIO_GEMTEK_PROBE
55 #define CONFIG_RADIO_GEMTEK_PROBE 1
71 "reduce static noise.");
75 "probing is disabled or fails. The most common I/O ports are: 0x20c "
76 "0x30c, 0x24c or 0x34c (0x20c, 0x248 and 0x28c have been reported to "
77 "work for the combined sound/radiocard).");
87 #define IF_OFFSET ((unsigned int)(10.52 * 16000 * (1<<FSCALE)))
88 #define REF_FREQ ((unsigned int)(6.39 * 16 * (1<<FSCALE)))
90 #define GEMTEK_CK 0x01
91 #define GEMTEK_DA 0x02
92 #define GEMTEK_CE 0x04
93 #define GEMTEK_NS 0x08
94 #define GEMTEK_MT 0x10
95 #define GEMTEK_STDF_3_125_KHZ 0x01
96 #define GEMTEK_PLL_OFF 0x07
98 #define BU2614_BUS_SIZE 32
100 #define SHORT_DELAY 5
101 #define LONG_DELAY 75
109 #define BU2614_FREQ_BITS 16
110 #define BU2614_PORT_BITS 3
111 #define BU2614_VOID_BITS 4
112 #define BU2614_FMES_BITS 1
113 #define BU2614_STDF_BITS 3
114 #define BU2614_SWIN_BITS 1
115 #define BU2614_SWAL_BITS 1
116 #define BU2614_VOID2_BITS 1
117 #define BU2614_FMUN_BITS 1
118 #define BU2614_TEST_BITS 1
120 #define BU2614_FREQ_SHIFT 0
121 #define BU2614_PORT_SHIFT (BU2614_FREQ_BITS + BU2614_FREQ_SHIFT)
122 #define BU2614_VOID_SHIFT (BU2614_PORT_BITS + BU2614_PORT_SHIFT)
123 #define BU2614_FMES_SHIFT (BU2614_VOID_BITS + BU2614_VOID_SHIFT)
124 #define BU2614_STDF_SHIFT (BU2614_FMES_BITS + BU2614_FMES_SHIFT)
125 #define BU2614_SWIN_SHIFT (BU2614_STDF_BITS + BU2614_STDF_SHIFT)
126 #define BU2614_SWAL_SHIFT (BU2614_SWIN_BITS + BU2614_SWIN_SHIFT)
127 #define BU2614_VOID2_SHIFT (BU2614_SWAL_BITS + BU2614_SWAL_SHIFT)
128 #define BU2614_FMUN_SHIFT (BU2614_VOID2_BITS + BU2614_VOID2_SHIFT)
129 #define BU2614_TEST_SHIFT (BU2614_FMUN_BITS + BU2614_FMUN_SHIFT)
131 #define MKMASK(field) (((1<<BU2614_##field##_BITS) - 1) << \
132 BU2614_##field##_SHIFT)
133 #define BU2614_PORT_MASK MKMASK(PORT)
134 #define BU2614_FREQ_MASK MKMASK(FREQ)
135 #define BU2614_VOID_MASK MKMASK(VOID)
136 #define BU2614_FMES_MASK MKMASK(FMES)
137 #define BU2614_STDF_MASK MKMASK(STDF)
138 #define BU2614_SWIN_MASK MKMASK(SWIN)
139 #define BU2614_SWAL_MASK MKMASK(SWAL)
140 #define BU2614_VOID2_MASK MKMASK(VOID2)
141 #define BU2614_FMUN_MASK MKMASK(FMUN)
142 #define BU2614_TEST_MASK MKMASK(TEST)
147 #define gemtek_bu2614_set(dev, field, data) ((dev)->bu2614data = \
148 ((dev)->bu2614data & ~field##_MASK) | ((data) << field##_SHIFT))
153 static void gemtek_bu2614_transmit(
struct gemtek *gt)
163 for (i = 0, q = gt->
bu2614data; i < 32; i++, q >>= 1) {
178 static unsigned long gemtek_convfreq(
unsigned long freq)
199 if (hardmute && gt->
muted)
210 gemtek_bu2614_transmit(gt);
225 return gemtek_s_frequency(isa, isa->
freq);
236 gemtek_bu2614_transmit(gt);
265 for (i = 0; i < 3; ++
i) {
278 .alloc = gemtek_alloc,
279 .probe = gemtek_probe,
280 .s_mute_volume = gemtek_s_mute_volume,
281 .s_frequency = gemtek_s_frequency,
282 .g_rxsubchans = gemtek_g_rxsubchans,
285 static const int gemtek_ioports[] = { 0x20c, 0x30c, 0x24c, 0x34c, 0x248, 0x28c };
290 {.
id =
"ADS7183", .driver_data = 0},
303 .name =
"radio-gemtek",
308 .name =
"radio-gemtek",
309 .id_table = gemtek_pnp_devices,
310 .probe = radio_isa_pnp_probe,
311 .remove = radio_isa_pnp_remove,
315 .radio_nr_params = radio_nr,
316 .io_ports = gemtek_ioports,
317 .num_of_io_ports =
ARRAY_SIZE(gemtek_ioports),
319 .card =
"GemTek Radio",
324 static int __init gemtek_init(
void)
333 static void __exit gemtek_exit(
void)