···3737MODULE_AUTHOR("Gerd Knorr");3838MODULE_LICENSE("GPL");39394040-static unsigned int debug = 0;4040+static unsigned int debug;4141module_param(debug, int, 0644);4242MODULE_PARM_DESC(debug,"debug messages, default is 0 (no)");4343
+3-3
drivers/media/video/bttv-cards.c
···9292static int __devinit pvr_boot(struct bttv *btv);93939494/* config variables */9595-static unsigned int triton1=0;9696-static unsigned int vsfx=0;9595+static unsigned int triton1;9696+static unsigned int vsfx;9797static unsigned int latency = UNSET;9898int no_overlay=-1;9999···106106#ifdef MODULE107107static unsigned int autoload = 1;108108#else109109-static unsigned int autoload = 0;109109+static unsigned int autoload;110110#endif111111static unsigned int gpiomask = UNSET;112112static unsigned int audioall = UNSET;
+43-44
drivers/media/video/bttv-driver.c
···4848unsigned int bttv_num; /* number of Bt848s in use */4949struct bttv bttvs[BTTV_MAX];50505151-unsigned int bttv_debug = 0;5151+unsigned int bttv_debug;5252unsigned int bttv_verbose = 1;5353-unsigned int bttv_gpio = 0;5353+unsigned int bttv_gpio;54545555/* config variables */5656#ifdef __BIG_ENDIAN5757static unsigned int bigendian=1;5858#else5959-static unsigned int bigendian=0;5959+static unsigned int bigendian;6060#endif6161static unsigned int radio[BTTV_MAX];6262-static unsigned int irq_debug = 0;6262+static unsigned int irq_debug;6363static unsigned int gbuffers = 8;6464static unsigned int gbufsize = 0x208000;65656666static int video_nr = -1;6767static int radio_nr = -1;6868static int vbi_nr = -1;6969-static int debug_latency = 0;6969+static int debug_latency;70707171-static unsigned int fdsr = 0;7171+static unsigned int fdsr;72727373/* options */7474-static unsigned int combfilter = 0;7575-static unsigned int lumafilter = 0;7474+static unsigned int combfilter;7575+static unsigned int lumafilter;7676static unsigned int automute = 1;7777-static unsigned int chroma_agc = 0;7777+static unsigned int chroma_agc;7878static unsigned int adc_crush = 1;7979static unsigned int whitecrush_upper = 0xCF;8080static unsigned int whitecrush_lower = 0x7F;8181-static unsigned int vcr_hack = 0;8282-static unsigned int irq_iswitch = 0;8181+static unsigned int vcr_hack;8282+static unsigned int irq_iswitch;8383static unsigned int uv_ratio = 50;8484-static unsigned int full_luma_range = 0;8585-static unsigned int coring = 0;8484+static unsigned int full_luma_range;8585+static unsigned int coring;8686extern int no_overlay;87878888/* API features (turn on/off stuff for testing) */8989static unsigned int v4l2 = 1;9090-91909291/* insmod args */9392module_param(bttv_verbose, int, 0644);···684685 return 1;685686686687 /* is it free? */687687- down(&btv->reslock);688688+ mutex_lock(&btv->reslock);688689 if (btv->resources & bit) {689690 /* no, someone else uses it */690690- up(&btv->reslock);691691+ mutex_unlock(&btv->reslock);691692 return 0;692693 }693694 /* it's free, grab it */694695 fh->resources |= bit;695696 btv->resources |= bit;696696- up(&btv->reslock);697697+ mutex_unlock(&btv->reslock);697698 return 1;698699}699700···716717 /* trying to free ressources not allocated by us ... */717718 printk("bttv: BUG! (btres)\n");718719 }719719- down(&btv->reslock);720720+ mutex_lock(&btv->reslock);720721 fh->resources &= ~bits;721722 btv->resources &= ~bits;722722- up(&btv->reslock);723723+ mutex_unlock(&btv->reslock);723724}724725725726/* ----------------------------------------------------------------------- */···15361537 case VIDIOCSFREQ:15371538 {15381539 unsigned long *freq = arg;15391539- down(&btv->lock);15401540+ mutex_lock(&btv->lock);15401541 btv->freq=*freq;15411542 bttv_call_i2c_clients(btv,VIDIOCSFREQ,freq);15421543 if (btv->has_matchbox && btv->radio_user)15431544 tea5757_set_freq(btv,*freq);15441544- up(&btv->lock);15451545+ mutex_unlock(&btv->lock);15451546 return 0;15461547 }15471548···15711572 if (v->mode >= BTTV_TVNORMS)15721573 return -EINVAL;1573157415741574- down(&btv->lock);15751575+ mutex_lock(&btv->lock);15751576 set_tvnorm(btv,v->mode);15761577 bttv_call_i2c_clients(btv,cmd,v);15771577- up(&btv->lock);15781578+ mutex_unlock(&btv->lock);15781579 return 0;15791580 }15801581···16111612 if (v->norm >= BTTV_TVNORMS)16121613 return -EINVAL;1613161416141614- down(&btv->lock);16151615+ mutex_lock(&btv->lock);16151616 if (channel == btv->input &&16161617 v->norm == btv->tvnorm) {16171618 /* nothing to do */16181618- up(&btv->lock);16191619+ mutex_unlock(&btv->lock);16191620 return 0;16201621 }1621162216221623 btv->tvnorm = v->norm;16231624 set_input(btv,v->channel);16241624- up(&btv->lock);16251625+ mutex_unlock(&btv->lock);16251626 return 0;16261627 }16271628···16341635 v->flags |= VIDEO_AUDIO_MUTABLE;16351636 v->mode = VIDEO_SOUND_MONO;1636163716371637- down(&btv->lock);16381638+ mutex_lock(&btv->lock);16381639 bttv_call_i2c_clients(btv,cmd,v);1639164016401641 /* card specific hooks */16411642 if (btv->audio_hook)16421643 btv->audio_hook(btv,v,0);1643164416441644- up(&btv->lock);16451645+ mutex_unlock(&btv->lock);16451646 return 0;16461647 }16471648 case VIDIOCSAUDIO:···16521653 if (audio >= bttv_tvcards[btv->c.type].audio_inputs)16531654 return -EINVAL;1654165516551655- down(&btv->lock);16561656+ mutex_lock(&btv->lock);16561657 audio_mux(btv, (v->flags&VIDEO_AUDIO_MUTE) ? AUDIO_MUTE : AUDIO_UNMUTE);16571658 bttv_call_i2c_clients(btv,cmd,v);16581659···16601661 if (btv->audio_hook)16611662 btv->audio_hook(btv,v,1);1662166316631663- up(&btv->lock);16641664+ mutex_unlock(&btv->lock);16641665 return 0;16651666 }16661667···16941695 if (i == BTTV_TVNORMS)16951696 return -EINVAL;1696169716971697- down(&btv->lock);16981698+ mutex_lock(&btv->lock);16981699 set_tvnorm(btv,i);16991700 i2c_vidiocschan(btv);17001700- up(&btv->lock);17011701+ mutex_unlock(&btv->lock);17011702 return 0;17021703 }17031704 case VIDIOC_QUERYSTD:···1755175617561757 if (*i > bttv_tvcards[btv->c.type].video_inputs)17571758 return -EINVAL;17581758- down(&btv->lock);17591759+ mutex_lock(&btv->lock);17591760 set_input(btv,*i);17601760- up(&btv->lock);17611761+ mutex_unlock(&btv->lock);17611762 return 0;17621763 }17631764···17691770 return -EINVAL;17701771 if (0 != t->index)17711772 return -EINVAL;17721772- down(&btv->lock);17731773+ mutex_lock(&btv->lock);17731774 memset(t,0,sizeof(*t));17741775 strcpy(t->name, "Television");17751776 t->type = V4L2_TUNER_ANALOG_TV;···18041805 }18051806 }18061807 /* FIXME: fill capability+audmode */18071807- up(&btv->lock);18081808+ mutex_unlock(&btv->lock);18081809 return 0;18091810 }18101811 case VIDIOC_S_TUNER:···18151816 return -EINVAL;18161817 if (0 != t->index)18171818 return -EINVAL;18181818- down(&btv->lock);18191819+ mutex_lock(&btv->lock);18191820 {18201821 struct video_audio va;18211822 memset(&va, 0, sizeof(struct video_audio));···18321833 if (btv->audio_hook)18331834 btv->audio_hook(btv,&va,1);18341835 }18351835- up(&btv->lock);18361836+ mutex_unlock(&btv->lock);18361837 return 0;18371838 }18381839···18531854 return -EINVAL;18541855 if (unlikely (f->type != V4L2_TUNER_ANALOG_TV))18551856 return -EINVAL;18561856- down(&btv->lock);18571857+ mutex_lock(&btv->lock);18571858 btv->freq = f->frequency;18581859 bttv_call_i2c_clients(btv,VIDIOCSFREQ,&btv->freq);18591860 if (btv->has_matchbox && btv->radio_user)18601861 tea5757_set_freq(btv,btv->freq);18611861- up(&btv->lock);18621862+ mutex_unlock(&btv->lock);18621863 return 0;18631864 }18641865 case VIDIOC_LOG_STATUS:···31563157 return -ENODEV;3157315831583159 dprintk("bttv%d: open called (radio)\n",btv->c.nr);31593159- down(&btv->lock);31603160+ mutex_lock(&btv->lock);3160316131613162 btv->radio_user++;31623163···31653166 bttv_call_i2c_clients(btv,AUDC_SET_RADIO,&btv->tuner_type);31663167 audio_mux(btv,AUDIO_RADIO);3167316831683168- up(&btv->lock);31693169+ mutex_unlock(&btv->lock);31693170 return 0;31703171}31713172···39203921 sprintf(btv->c.name,"bttv%d",btv->c.nr);3921392239223923 /* initialize structs / fill in defaults */39233923- init_MUTEX(&btv->lock);39243924- init_MUTEX(&btv->reslock);39243924+ mutex_init(&btv->lock);39253925+ mutex_init(&btv->reslock);39253926 spin_lock_init(&btv->s_lock);39263927 spin_lock_init(&btv->gpio_lock);39273928 init_waitqueue_head(&btv->gpioq);
+3-3
drivers/media/video/bttv-i2c.c
···41414242static int attach_inform(struct i2c_client *client);43434444-static int i2c_debug = 0;4545-static int i2c_hw = 0;4646-static int i2c_scan = 0;4444+static int i2c_debug;4545+static int i2c_hw;4646+static int i2c_scan;4747module_param(i2c_debug, int, 0644);4848module_param(i2c_hw, int, 0444);4949module_param(i2c_scan, int, 0444);
···4343static unsigned short normal_i2c[] = { 0x88 >> 1, I2C_CLIENT_END };444445454646-int cx25840_debug = 0;4646+static int cx25840_debug;47474848module_param_named(debug,cx25840_debug, int, 0644);4949
+1-2
drivers/media/video/cx88/Kconfig
···31313232config VIDEO_CX88_ALSA3333 tristate "ALSA DMA audio support"3434- depends on VIDEO_CX88 && SND3535- select SND_PCM_OSS3434+ depends on VIDEO_CX88 && SND && EXPERIMENTAL3635 ---help---3736 This is a video4linux driver for direct (DMA) audio on3837 Conexant 2388x based TV cards.
···66666767/* module parameters */6868static int opmode = OPMODE_AUTO;6969-int msp_debug = 0; /* msp_debug output */7070-int msp_once = 0; /* no continous stereo monitoring */7171-int msp_amsound = 0; /* hard-wire AM sound at 6.5 Hz (france),7272- the autoscan seems work well only with FM... */6969+int msp_debug; /* msp_debug output */7070+int msp_once; /* no continous stereo monitoring */7171+int msp_amsound; /* hard-wire AM sound at 6.5 Hz (france),7272+ the autoscan seems work well only with FM... */7373int msp_standard = 1; /* Override auto detect of audio msp_standard, if needed. */7474-int msp_dolby = 0;7474+int msp_dolby;75757676int msp_stereo_thresh = 0x190; /* a2 threshold for stereo/bilingual7777 (msp34xxg only) 0x00a0-0x03c0 */···10311031 }1032103210331033 default:10341034- /* nothing */10351035- break;10341034+ /* unknown */10351035+ return -EINVAL;10361036 }10371037 return 0;10381038}
-8
drivers/media/video/msp3400.h
···6677/* ---------------------------------------------------------------------- */8899-struct msp_matrix {1010- int input;1111- int output;1212-};1313-1414-/* ioctl for MSP_SET_MATRIX will have to be registered */1515-#define MSP_SET_MATRIX _IOW('m',17,struct msp_matrix)1616-179/* This macro is allowed for *constants* only, gcc must calculate it1810 at compile time. Remember -- no floats in kernel mode */1911#define MSP_CARRIER(freq) ((int)((float)(freq / 18.432) * (1 << 24)))
···2929#include <linux/devfs_fs_kernel.h>3030#include <asm/uaccess.h>3131#include <asm/system.h>3232-#include <asm/semaphore.h>33323433#include <linux/videodev.h>3534···8283 */83848485static struct video_device *video_device[VIDEO_NUM_DEVICES];8585-static DECLARE_MUTEX(videodev_lock);8686+static DEFINE_MUTEX(videodev_lock);86878788struct video_device* video_devdata(struct file *file)8889{···101102102103 if(minor>=VIDEO_NUM_DEVICES)103104 return -ENODEV;104104- down(&videodev_lock);105105+ mutex_lock(&videodev_lock);105106 vfl=video_device[minor];106107 if(vfl==NULL) {107107- up(&videodev_lock);108108+ mutex_unlock(&videodev_lock);108109 request_module("char-major-%d-%d", VIDEO_MAJOR, minor);109109- down(&videodev_lock);110110+ mutex_lock(&videodev_lock);110111 vfl=video_device[minor];111112 if (vfl==NULL) {112112- up(&videodev_lock);113113+ mutex_unlock(&videodev_lock);113114 return -ENODEV;114115 }115116 }···122123 file->f_op = fops_get(old_fops);123124 }124125 fops_put(old_fops);125125- up(&videodev_lock);126126+ mutex_unlock(&videodev_lock);126127 return err;127128}128129···303304 }304305305306 /* pick a minor number */306306- down(&videodev_lock);307307+ mutex_lock(&videodev_lock);307308 if (nr >= 0 && nr < end-base) {308309 /* use the one the driver asked for */309310 i = base+nr;310311 if (NULL != video_device[i]) {311311- up(&videodev_lock);312312+ mutex_unlock(&videodev_lock);312313 return -ENFILE;313314 }314315 } else {···317318 if (NULL == video_device[i])318319 break;319320 if (i == end) {320320- up(&videodev_lock);321321+ mutex_unlock(&videodev_lock);321322 return -ENFILE;322323 }323324 }324325 video_device[i]=vfd;325326 vfd->minor=i;326326- up(&videodev_lock);327327+ mutex_unlock(&videodev_lock);327328328329 sprintf(vfd->devfs_name, "v4l/%s%d", name_base, i - base);329330 devfs_mk_cdev(MKDEV(VIDEO_MAJOR, vfd->minor),···361362362363void video_unregister_device(struct video_device *vfd)363364{364364- down(&videodev_lock);365365+ mutex_lock(&videodev_lock);365366 if(video_device[vfd->minor]!=vfd)366367 panic("videodev: bad unregister");367368368369 devfs_remove(vfd->devfs_name);369370 video_device[vfd->minor]=NULL;370371 class_device_unregister(&vfd->class_dev);371371- up(&videodev_lock);372372+ mutex_unlock(&videodev_lock);372373}373374374375
+4
include/linux/i2c-id.h
···104104#define I2C_DRIVERID_AKITAIOEXP 74 /* IO Expander on Sharp SL-C1000 */105105#define I2C_DRIVERID_INFRARED 75 /* I2C InfraRed on Video boards */106106#define I2C_DRIVERID_TVP5150 76 /* TVP5150 video decoder */107107+#define I2C_DRIVERID_WM8739 77 /* wm8739 audio processor */108108+#define I2C_DRIVERID_UPD64083 78 /* upd64083 video processor */109109+#define I2C_DRIVERID_UPD64031A 79 /* upd64031a video processor */110110+#define I2C_DRIVERID_SAA717X 80 /* saa717x video encoder */107111108112#define I2C_DRIVERID_I2CDEV 900109113#define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */
+55
include/media/tuner-types.h
···11+/*22+ * descriptions for simple tuners.33+ */44+55+#ifndef __TUNER_TYPES_H__66+#define __TUNER_TYPES_H__77+88+enum param_type {99+ TUNER_PARAM_TYPE_RADIO, \1010+ TUNER_PARAM_TYPE_PAL, \1111+ TUNER_PARAM_TYPE_SECAM, \1212+ TUNER_PARAM_TYPE_NTSC1313+};1414+1515+struct tuner_range {1616+ unsigned short limit;1717+ unsigned char cb;1818+};1919+2020+struct tuner_params {2121+ enum param_type type;2222+ /* Many Philips based tuners have a comment like this in their2323+ * datasheet:2424+ *2525+ * For channel selection involving band switching, and to ensure2626+ * smooth tuning to the desired channel without causing2727+ * unnecessary charge pump action, it is recommended to consider2828+ * the difference between wanted channel frequency and the2929+ * current channel frequency. Unnecessary charge pump action3030+ * will result in very low tuning voltage which may drive the3131+ * oscillator to extreme conditions.3232+ *3333+ * Set cb_first_if_lower_freq to 1, if this check is3434+ * required for this tuner.3535+ *3636+ * I tested this for PAL by first setting the TV frequency to3737+ * 203 MHz and then switching to 96.6 MHz FM radio. The result was3838+ * static unless the control byte was sent first.3939+ */4040+ unsigned int cb_first_if_lower_freq:1;4141+ unsigned char config; /* to be moved into struct tuner_range for dvb-pll merge */4242+4343+ unsigned int count;4444+ struct tuner_range *ranges;4545+};4646+4747+struct tunertype {4848+ char *name;4949+ struct tuner_params *params;5050+};5151+5252+extern struct tunertype tuners[];5353+extern unsigned const int tuner_count;5454+5555+#endif
+7-3
include/media/tuner.h
···2323#define _TUNER_H24242525#include <linux/videodev2.h>2626+#include <media/tuner-types.h>26272728#define ADDR_UNSET (255)2829···115114116115#define TUNER_PHILIPS_TUV1236D 68 /* ATI HDTV Wonder */117116#define TUNER_TNF_5335MF 69 /* Sabrent Bt848 */117117+#define TUNER_SAMSUNG_TCPN_2121P30A 70 /* Hauppauge PVR-500MCE NTSC */118118119119/* tv card specific */120120#define TDA9887_PRESENT (1<<0)···179177 unsigned int mode;180178 unsigned int mode_mask; /* Combination of allowable modes */181179182182- unsigned int freq; /* keep track of the current settings */180180+ unsigned int tv_freq; /* keep track of the current settings */181181+ unsigned int radio_freq;182182+ u16 last_div;183183 unsigned int audmode;184184 v4l2_std_id std;185185···199195 unsigned int sgIF;200196201197 /* function ptrs */202202- void (*tv_freq)(struct i2c_client *c, unsigned int freq);203203- void (*radio_freq)(struct i2c_client *c, unsigned int freq);198198+ void (*set_tv_freq)(struct i2c_client *c, unsigned int freq);199199+ void (*set_radio_freq)(struct i2c_client *c, unsigned int freq);204200 int (*has_signal)(struct i2c_client *c);205201 int (*is_stereo)(struct i2c_client *c);206202 void (*standby)(struct i2c_client *c);
+7
include/media/v4l2-common.h
···120120/* select from TV,radio,extern,MUTE */121121#define AUDC_SET_INPUT _IOW('d',89,int)122122123123+/* msp3400 ioctl: will be removed in the near future */124124+struct msp_matrix {125125+ int input;126126+ int output;127127+};128128+#define MSP_SET_MATRIX _IOW('m',17,struct msp_matrix)129129+123130/* tuner ioctls */124131/* Sets tuner type and its I2C addr */125132#define TUNER_SET_TYPE_ADDR _IOW('d',90,int)