diff options
Diffstat (limited to 'drivers/media/radio/radio-gemtek-pci.c')
-rw-r--r-- | drivers/media/radio/radio-gemtek-pci.c | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/drivers/media/radio/radio-gemtek-pci.c b/drivers/media/radio/radio-gemtek-pci.c index 8e499b8f64c7..d5c3c4b878c7 100644 --- a/drivers/media/radio/radio-gemtek-pci.c +++ b/drivers/media/radio/radio-gemtek-pci.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | *************************************************************************** | 2 | *************************************************************************** |
3 | * | 3 | * |
4 | * radio-gemtek-pci.c - Gemtek PCI Radio driver | 4 | * radio-gemtek-pci.c - Gemtek PCI Radio driver |
5 | * (C) 2001 Vladimir Shebordaev <vshebordaev@mail.ru> | 5 | * (C) 2001 Vladimir Shebordaev <vshebordaev@mail.ru> |
6 | * | 6 | * |
@@ -31,7 +31,7 @@ | |||
31 | * radio device driver. | 31 | * radio device driver. |
32 | * | 32 | * |
33 | * Please, let me know if this piece of code was useful :) | 33 | * Please, let me know if this piece of code was useful :) |
34 | * | 34 | * |
35 | * TODO: multiple device support and portability were not tested | 35 | * TODO: multiple device support and portability were not tested |
36 | * | 36 | * |
37 | *************************************************************************** | 37 | *************************************************************************** |
@@ -69,18 +69,18 @@ | |||
69 | #define TRUE (1) | 69 | #define TRUE (1) |
70 | #endif | 70 | #endif |
71 | 71 | ||
72 | #ifndef FALSE | 72 | #ifndef FALSE |
73 | #define FALSE (0) | 73 | #define FALSE (0) |
74 | #endif | 74 | #endif |
75 | 75 | ||
76 | struct gemtek_pci_card { | 76 | struct gemtek_pci_card { |
77 | struct video_device *videodev; | 77 | struct video_device *videodev; |
78 | 78 | ||
79 | u32 iobase; | 79 | u32 iobase; |
80 | u32 length; | 80 | u32 length; |
81 | u8 chiprev; | 81 | u8 chiprev; |
82 | u16 model; | 82 | u16 model; |
83 | 83 | ||
84 | u32 current_frequency; | 84 | u32 current_frequency; |
85 | u8 mute; | 85 | u8 mute; |
86 | }; | 86 | }; |
@@ -96,7 +96,7 @@ static inline u8 gemtek_pci_out( u16 value, u32 port ) | |||
96 | return (u8)value; | 96 | return (u8)value; |
97 | } | 97 | } |
98 | 98 | ||
99 | #define _b0( v ) *((u8 *)&v) | 99 | #define _b0( v ) *((u8 *)&v) |
100 | static void __gemtek_pci_cmd( u16 value, u32 port, u8 *last_byte, int keep ) | 100 | static void __gemtek_pci_cmd( u16 value, u32 port, u8 *last_byte, int keep ) |
101 | { | 101 | { |
102 | register u8 byte = *last_byte; | 102 | register u8 byte = *last_byte; |
@@ -104,7 +104,7 @@ static void __gemtek_pci_cmd( u16 value, u32 port, u8 *last_byte, int keep ) | |||
104 | if ( !value ) { | 104 | if ( !value ) { |
105 | if ( !keep ) | 105 | if ( !keep ) |
106 | value = (u16)port; | 106 | value = (u16)port; |
107 | byte &= 0xfd; | 107 | byte &= 0xfd; |
108 | } else | 108 | } else |
109 | byte |= 2; | 109 | byte |= 2; |
110 | 110 | ||
@@ -116,7 +116,7 @@ static void __gemtek_pci_cmd( u16 value, u32 port, u8 *last_byte, int keep ) | |||
116 | byte &= 0xfe; | 116 | byte &= 0xfe; |
117 | _b0( value ) = byte; | 117 | _b0( value ) = byte; |
118 | outw( value, port ); | 118 | outw( value, port ); |
119 | 119 | ||
120 | *last_byte = byte; | 120 | *last_byte = byte; |
121 | } | 121 | } |
122 | 122 | ||
@@ -193,13 +193,13 @@ static int gemtek_pci_do_ioctl(struct inode *inode, struct file *file, | |||
193 | c->audios = 1; | 193 | c->audios = 1; |
194 | strcpy( c->name, "Gemtek PCI Radio" ); | 194 | strcpy( c->name, "Gemtek PCI Radio" ); |
195 | return 0; | 195 | return 0; |
196 | } | 196 | } |
197 | 197 | ||
198 | case VIDIOCGTUNER: | 198 | case VIDIOCGTUNER: |
199 | { | 199 | { |
200 | struct video_tuner *t = arg; | 200 | struct video_tuner *t = arg; |
201 | 201 | ||
202 | if ( t->tuner ) | 202 | if ( t->tuner ) |
203 | return -EINVAL; | 203 | return -EINVAL; |
204 | 204 | ||
205 | t->rangelow = GEMTEK_PCI_RANGE_LOW; | 205 | t->rangelow = GEMTEK_PCI_RANGE_LOW; |
@@ -228,7 +228,7 @@ static int gemtek_pci_do_ioctl(struct inode *inode, struct file *file, | |||
228 | case VIDIOCSFREQ: | 228 | case VIDIOCSFREQ: |
229 | { | 229 | { |
230 | unsigned long *freq = arg; | 230 | unsigned long *freq = arg; |
231 | 231 | ||
232 | if ( (*freq < GEMTEK_PCI_RANGE_LOW) || | 232 | if ( (*freq < GEMTEK_PCI_RANGE_LOW) || |
233 | (*freq > GEMTEK_PCI_RANGE_HIGH) ) | 233 | (*freq > GEMTEK_PCI_RANGE_HIGH) ) |
234 | return -EINVAL; | 234 | return -EINVAL; |
@@ -239,9 +239,9 @@ static int gemtek_pci_do_ioctl(struct inode *inode, struct file *file, | |||
239 | 239 | ||
240 | return 0; | 240 | return 0; |
241 | } | 241 | } |
242 | 242 | ||
243 | case VIDIOCGAUDIO: | 243 | case VIDIOCGAUDIO: |
244 | { | 244 | { |
245 | struct video_audio *a = arg; | 245 | struct video_audio *a = arg; |
246 | 246 | ||
247 | memset( a, 0, sizeof( *a ) ); | 247 | memset( a, 0, sizeof( *a ) ); |
@@ -249,17 +249,17 @@ static int gemtek_pci_do_ioctl(struct inode *inode, struct file *file, | |||
249 | a->volume = 1; | 249 | a->volume = 1; |
250 | a->step = 65535; | 250 | a->step = 65535; |
251 | strcpy( a->name, "Radio" ); | 251 | strcpy( a->name, "Radio" ); |
252 | return 0; | 252 | return 0; |
253 | } | 253 | } |
254 | 254 | ||
255 | case VIDIOCSAUDIO: | 255 | case VIDIOCSAUDIO: |
256 | { | 256 | { |
257 | struct video_audio *a = arg; | 257 | struct video_audio *a = arg; |
258 | 258 | ||
259 | if ( a->audio ) | 259 | if ( a->audio ) |
260 | return -EINVAL; | 260 | return -EINVAL; |
261 | 261 | ||
262 | if ( a->flags & VIDEO_AUDIO_MUTE ) | 262 | if ( a->flags & VIDEO_AUDIO_MUTE ) |
263 | gemtek_pci_mute( card ); | 263 | gemtek_pci_mute( card ); |
264 | else | 264 | else |
265 | gemtek_pci_unmute( card ); | 265 | gemtek_pci_unmute( card ); |
@@ -323,9 +323,9 @@ static int __devinit gemtek_pci_probe( struct pci_dev *pci_dev, const struct pci | |||
323 | return -ENOMEM; | 323 | return -ENOMEM; |
324 | } | 324 | } |
325 | 325 | ||
326 | if ( pci_enable_device( pci_dev ) ) | 326 | if ( pci_enable_device( pci_dev ) ) |
327 | goto err_pci; | 327 | goto err_pci; |
328 | 328 | ||
329 | card->iobase = pci_resource_start( pci_dev, 0 ); | 329 | card->iobase = pci_resource_start( pci_dev, 0 ); |
330 | card->length = pci_resource_len( pci_dev, 0 ); | 330 | card->length = pci_resource_len( pci_dev, 0 ); |
331 | 331 | ||
@@ -338,7 +338,7 @@ static int __devinit gemtek_pci_probe( struct pci_dev *pci_dev, const struct pci | |||
338 | pci_read_config_word( pci_dev, PCI_SUBSYSTEM_ID, &card->model ); | 338 | pci_read_config_word( pci_dev, PCI_SUBSYSTEM_ID, &card->model ); |
339 | 339 | ||
340 | pci_set_drvdata( pci_dev, card ); | 340 | pci_set_drvdata( pci_dev, card ); |
341 | 341 | ||
342 | if ( (devradio = kmalloc( sizeof( struct video_device ), GFP_KERNEL )) == NULL ) { | 342 | if ( (devradio = kmalloc( sizeof( struct video_device ), GFP_KERNEL )) == NULL ) { |
343 | printk( KERN_ERR "gemtek_pci: out of memory\n" ); | 343 | printk( KERN_ERR "gemtek_pci: out of memory\n" ); |
344 | goto err_video; | 344 | goto err_video; |
@@ -354,7 +354,7 @@ static int __devinit gemtek_pci_probe( struct pci_dev *pci_dev, const struct pci | |||
354 | devradio->priv = card; | 354 | devradio->priv = card; |
355 | gemtek_pci_mute( card ); | 355 | gemtek_pci_mute( card ); |
356 | 356 | ||
357 | printk( KERN_INFO "Gemtek PCI Radio (rev. %d) found at 0x%04x-0x%04x.\n", | 357 | printk( KERN_INFO "Gemtek PCI Radio (rev. %d) found at 0x%04x-0x%04x.\n", |
358 | card->chiprev, card->iobase, card->iobase + card->length - 1 ); | 358 | card->chiprev, card->iobase, card->iobase + card->length - 1 ); |
359 | 359 | ||
360 | return 0; | 360 | return 0; |
@@ -364,7 +364,7 @@ err_video: | |||
364 | 364 | ||
365 | err_pci: | 365 | err_pci: |
366 | kfree( card ); | 366 | kfree( card ); |
367 | return -ENODEV; | 367 | return -ENODEV; |
368 | } | 368 | } |
369 | 369 | ||
370 | static void __devexit gemtek_pci_remove( struct pci_dev *pci_dev ) | 370 | static void __devexit gemtek_pci_remove( struct pci_dev *pci_dev ) |
@@ -375,12 +375,12 @@ static void __devexit gemtek_pci_remove( struct pci_dev *pci_dev ) | |||
375 | kfree( card->videodev ); | 375 | kfree( card->videodev ); |
376 | 376 | ||
377 | release_region( card->iobase, card->length ); | 377 | release_region( card->iobase, card->length ); |
378 | 378 | ||
379 | if ( mx ) | 379 | if ( mx ) |
380 | gemtek_pci_mute( card ); | 380 | gemtek_pci_mute( card ); |
381 | 381 | ||
382 | kfree( card ); | 382 | kfree( card ); |
383 | 383 | ||
384 | pci_set_drvdata( pci_dev, NULL ); | 384 | pci_set_drvdata( pci_dev, NULL ); |
385 | } | 385 | } |
386 | 386 | ||