···156 struct dtt200u_fe_state* state = NULL;157158 /* allocate memory for the internal state */159- state = (struct dtt200u_fe_state*) kmalloc(sizeof(struct dtt200u_fe_state), GFP_KERNEL);160 if (state == NULL)161 goto error;162- memset(state,0,sizeof(struct dtt200u_fe_state));163164 deb_info("attaching frontend dtt200u\n");165
···156 struct dtt200u_fe_state* state = NULL;157158 /* allocate memory for the internal state */159+ state = kzalloc(sizeof(struct dtt200u_fe_state), GFP_KERNEL);160 if (state == NULL)161 goto error;0162163 deb_info("attaching frontend dtt200u\n");164
···154 }155156 info("found a '%s' in warm state.",desc->name);157- d = kmalloc(sizeof(struct dvb_usb_device),GFP_KERNEL);158 if (d == NULL) {159 err("no memory for 'struct dvb_usb_device'");160 return ret;161 }162- memset(d,0,sizeof(struct dvb_usb_device));163164 d->udev = udev;165 memcpy(&d->props,props,sizeof(struct dvb_usb_properties));···166 d->owner = owner;167168 if (d->props.size_of_priv > 0) {169- d->priv = kmalloc(d->props.size_of_priv,GFP_KERNEL);170 if (d->priv == NULL) {171 err("no memory for priv in 'struct dvb_usb_device'");172 kfree(d);173 return -ENOMEM;174 }175- memset(d->priv,0,d->props.size_of_priv);176 }177178 usb_set_intfdata(intf, d);
···154 }155156 info("found a '%s' in warm state.",desc->name);157+ d = kzalloc(sizeof(struct dvb_usb_device),GFP_KERNEL);158 if (d == NULL) {159 err("no memory for 'struct dvb_usb_device'");160 return ret;161 }0162163 d->udev = udev;164 memcpy(&d->props,props,sizeof(struct dvb_usb_properties));···167 d->owner = owner;168169 if (d->props.size_of_priv > 0) {170+ d->priv = kzalloc(d->props.size_of_priv,GFP_KERNEL);171 if (d->priv == NULL) {172 err("no memory for priv in 'struct dvb_usb_device'");173 kfree(d);174 return -ENOMEM;175 }0176 }177178 usb_set_intfdata(intf, d);
+3-6
drivers/media/dvb/dvb-usb/dvb-usb-urb.c
···175176 deb_mem("all in all I will use %lu bytes for streaming\n",num*size);177178- if ((d->buf_list = kmalloc(num*sizeof(u8 *), GFP_ATOMIC)) == NULL)179 return -ENOMEM;180181- if ((d->dma_addr = kmalloc(num*sizeof(dma_addr_t), GFP_ATOMIC)) == NULL) {182 kfree(d->buf_list);183 return -ENOMEM;184 }185- memset(d->buf_list,0,num*sizeof(u8 *));186- memset(d->dma_addr,0,num*sizeof(dma_addr_t));187188 d->state |= DVB_USB_STATE_URB_BUF;189···283 usb_clear_halt(d->udev,usb_rcvbulkpipe(d->udev,d->props.urb.endpoint));284285 /* allocate the array for the data transfer URBs */286- d->urb_list = kmalloc(d->props.urb.count * sizeof(struct urb *),GFP_KERNEL);287 if (d->urb_list == NULL)288 return -ENOMEM;289- memset(d->urb_list,0,d->props.urb.count * sizeof(struct urb *));290 d->state |= DVB_USB_STATE_URB_LIST;291292 switch (d->props.urb.type) {
···175176 deb_mem("all in all I will use %lu bytes for streaming\n",num*size);177178+ if ((d->buf_list = kcalloc(num, sizeof(u8 *), GFP_ATOMIC)) == NULL)179 return -ENOMEM;180181+ if ((d->dma_addr = kcalloc(num, sizeof(dma_addr_t), GFP_ATOMIC)) == NULL) {182 kfree(d->buf_list);183 return -ENOMEM;184 }00185186 d->state |= DVB_USB_STATE_URB_BUF;187···285 usb_clear_halt(d->udev,usb_rcvbulkpipe(d->udev,d->props.urb.endpoint));286287 /* allocate the array for the data transfer URBs */288+ d->urb_list = kzalloc(d->props.urb.count * sizeof(struct urb *),GFP_KERNEL);289 if (d->urb_list == NULL)290 return -ENOMEM;0291 d->state |= DVB_USB_STATE_URB_LIST;292293 switch (d->props.urb.type) {
···782 bcm3510_register_value v;783784 /* allocate memory for the internal state */785- state = kmalloc(sizeof(struct bcm3510_state), GFP_KERNEL);786 if (state == NULL)787 goto error;788- memset(state,0,sizeof(struct bcm3510_state));789790 /* setup the state */791
···782 bcm3510_register_value v;783784 /* allocate memory for the internal state */785+ state = kzalloc(sizeof(struct bcm3510_state), GFP_KERNEL);786 if (state == NULL)787 goto error;0788789 /* setup the state */790
+1-2
drivers/media/dvb/frontends/dib3000mb.c
···700 struct dib3000_state* state = NULL;701702 /* allocate memory for the internal state */703- state = kmalloc(sizeof(struct dib3000_state), GFP_KERNEL);704 if (state == NULL)705 goto error;706- memset(state,0,sizeof(struct dib3000_state));707708 /* setup the state */709 state->i2c = i2c;
···700 struct dib3000_state* state = NULL;701702 /* allocate memory for the internal state */703+ state = kzalloc(sizeof(struct dib3000_state), GFP_KERNEL);704 if (state == NULL)705 goto error;0706707 /* setup the state */708 state->i2c = i2c;
+1-2
drivers/media/dvb/frontends/dib3000mc.c
···832 u16 devid;833834 /* allocate memory for the internal state */835- state = kmalloc(sizeof(struct dib3000_state), GFP_KERNEL);836 if (state == NULL)837 goto error;838- memset(state,0,sizeof(struct dib3000_state));839840 /* setup the state */841 state->i2c = i2c;
···832 u16 devid;833834 /* allocate memory for the internal state */835+ state = kzalloc(sizeof(struct dib3000_state), GFP_KERNEL);836 if (state == NULL)837 goto error;0838839 /* setup the state */840 state->i2c = i2c;
···714 u8 buf[1];715716 /* Allocate memory for the internal state */717- state = (struct lgdt330x_state*) kmalloc(sizeof(struct lgdt330x_state), GFP_KERNEL);718 if (state == NULL)719 goto error;720- memset(state,0,sizeof(*state));721722 /* Setup the state */723 state->config = config;
···714 u8 buf[1];715716 /* Allocate memory for the internal state */717+ state = kzalloc(sizeof(struct lgdt330x_state), GFP_KERNEL);718 if (state == NULL)719 goto error;0720721 /* Setup the state */722 state->config = config;
+1-2
drivers/media/dvb/frontends/mt352.c
···535 struct mt352_state* state = NULL;536537 /* allocate memory for the internal state */538- state = kmalloc(sizeof(struct mt352_state), GFP_KERNEL);539 if (state == NULL) goto error;540- memset(state,0,sizeof(*state));541542 /* setup the state */543 state->i2c = i2c;
···535 struct mt352_state* state = NULL;536537 /* allocate memory for the internal state */538+ state = kzalloc(sizeof(struct mt352_state), GFP_KERNEL);539 if (state == NULL) goto error;0540541 /* setup the state */542 state->i2c = i2c;
+1-2
drivers/media/dvb/frontends/nxt200x.c
···1110 u8 buf [] = {0,0,0,0,0};11111112 /* allocate memory for the internal state */1113- state = (struct nxt200x_state*) kmalloc(sizeof(struct nxt200x_state), GFP_KERNEL);1114 if (state == NULL)1115 goto error;1116- memset(state,0,sizeof(*state));11171118 /* setup the state */1119 state->config = config;
···1110 u8 buf [] = {0,0,0,0,0};11111112 /* allocate memory for the internal state */1113+ state = kzalloc(sizeof(struct nxt200x_state), GFP_KERNEL);1114 if (state == NULL)1115 goto error;011161117 /* setup the state */1118 state->config = config;
+1-2
drivers/media/dvb/pluto2/pluto2.c
···584 struct dmx_demux *dmx;585 int ret = -ENOMEM;586587- pluto = kmalloc(sizeof(struct pluto), GFP_KERNEL);588 if (!pluto)589 goto out;590591- memset(pluto, 0, sizeof(struct pluto));592 pluto->pdev = pdev;593594 ret = pci_enable_device(pdev);
···584 struct dmx_demux *dmx;585 int ret = -ENOMEM;586587+ pluto = kzalloc(sizeof(struct pluto), GFP_KERNEL);588 if (!pluto)589 goto out;5900591 pluto->pdev = pdev;592593 ret = pci_enable_device(pdev);
···183 help184 Say Y here to enable support for the Stradis 4:2:2 MPEG-2 video185 driver for PCI. There is a product page at186- <http://www.stradis.com/decoder.html>.187188config VIDEO_ZORAN189 tristate "Zoran ZR36057/36067 Video For Linux"
···183 help184 Say Y here to enable support for the Stradis 4:2:2 MPEG-2 video185 driver for PCI. There is a product page at186+ <http://www.stradis.com/>.187188config VIDEO_ZORAN189 tristate "Zoran ZR36057/36067 Video For Linux"
···697 case CX88_BOARD_HAUPPAUGE_DVB_T1:698 case CX88_BOARD_HAUPPAUGE_NOVASE2_S1:699 case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1:0700 ircode = ir_decode_biphase(ir->samples, ir->scount, 5, 7);701 ir_dprintk("biphase decoded: %x\n", ircode);702 if ((ircode & 0xfffff000) != 0x3000)
···697 case CX88_BOARD_HAUPPAUGE_DVB_T1:698 case CX88_BOARD_HAUPPAUGE_NOVASE2_S1:699 case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1:700+ case CX88_BOARD_HAUPPAUGE_HVR1100:701 ircode = ir_decode_biphase(ir->samples, ir->scount, 5, 7);702 ir_dprintk("biphase decoded: %x\n", ircode);703 if ((ircode & 0xfffff000) != 0x3000)
+2-4
drivers/media/video/cx88/cx88-video.c
···750 minor,radio,v4l2_type_names[type]);751752 /* allocate + initialize per filehandle data */753- fh = kmalloc(sizeof(*fh),GFP_KERNEL);754 if (NULL == fh)755 return -ENOMEM;756- memset(fh,0,sizeof(*fh));757 file->private_data = fh;758 fh->dev = dev;759 fh->radio = radio;···1808 struct cx88_core *core;1809 int err;18101811- dev = kmalloc(sizeof(*dev),GFP_KERNEL);1812 if (NULL == dev)1813 return -ENOMEM;1814- memset(dev,0,sizeof(*dev));18151816 /* pci init */1817 dev->pci = pci_dev;
···750 minor,radio,v4l2_type_names[type]);751752 /* allocate + initialize per filehandle data */753+ fh = kzalloc(sizeof(*fh),GFP_KERNEL);754 if (NULL == fh)755 return -ENOMEM;0756 file->private_data = fh;757 fh->dev = dev;758 fh->radio = radio;···1809 struct cx88_core *core;1810 int err;18111812+ dev = kzalloc(sizeof(*dev),GFP_KERNEL);1813 if (NULL == dev)1814 return -ENOMEM;018151816 /* pci init */1817 dev->pci = pci_dev;
+1-2
drivers/media/video/dpc7146.c
···94 struct i2c_client *client;95 struct list_head *item;9697- dpc = (struct dpc*)kmalloc(sizeof(struct dpc), GFP_KERNEL);98 if( NULL == dpc ) {99 printk("dpc_v4l2.o: dpc_probe: not enough kernel memory.\n");100 return -ENOMEM;101 }102- memset(dpc, 0x0, sizeof(struct dpc)); 103104 /* FIXME: enable i2c-port pins, video-port-pins105 video port pins should be enabled here ?! */
···94 struct i2c_client *client;95 struct list_head *item;9697+ dpc = kzalloc(sizeof(struct dpc), GFP_KERNEL);98 if( NULL == dpc ) {99 printk("dpc_v4l2.o: dpc_probe: not enough kernel memory.\n");100 return -ENOMEM;101 }0102103 /* FIXME: enable i2c-port pins, video-port-pins104 video port pins should be enabled here ?! */
+1-2
drivers/media/video/em28xx/em28xx-video.c
···1861 }18621863 /* allocate memory for our device state and initialize it */1864- dev = kmalloc(sizeof(*dev), GFP_KERNEL);1865 if (dev == NULL) {1866 em28xx_err(DRIVER_NAME ": out of memory!\n");1867 return -ENOMEM;1868 }1869- memset(dev, 0, sizeof(*dev));18701871 /* compute alternate max packet sizes */1872 uif = udev->actconfig->interface[0];
···1861 }18621863 /* allocate memory for our device state and initialize it */1864+ dev = kzalloc(sizeof(*dev), GFP_KERNEL);1865 if (dev == NULL) {1866 em28xx_err(DRIVER_NAME ": out of memory!\n");1867 return -ENOMEM;1868 }018691870 /* compute alternate max packet sizes */1871 uif = udev->actconfig->interface[0];
···289 printk(KERN_INFO "SGI IndyCam driver version %s\n",290 INDYCAM_MODULE_VERSION);291292+ client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);293 if (!client)294 return -ENOMEM;295+ camera = kzalloc(sizeof(struct indycam), GFP_KERNEL);296 if (!camera) {297 err = -ENOMEM;298 goto out_free_client;299 }000300301 client->addr = addr;302 client->adapter = adap;
+32-32
drivers/media/video/msp3400-driver.c
···6667/* module parameters */68static int opmode = OPMODE_AUTO;69-int debug = 0; /* debug output */70-int once = 0; /* no continous stereo monitoring */71-int amsound = 0; /* hard-wire AM sound at 6.5 Hz (france),72 the autoscan seems work well only with FM... */73-int standard = 1; /* Override auto detect of audio standard, if needed. */74-int dolby = 0;7576-int stereo_threshold = 0x190; /* a2 threshold for stereo/bilingual77 (msp34xxg only) 0x00a0-0x03c0 */7879/* read-only */80module_param(opmode, int, 0444);8182/* read-write */83-module_param(once, bool, 0644);84-module_param(debug, int, 0644);85-module_param(stereo_threshold, int, 0644);86-module_param(standard, int, 0644);87-module_param(amsound, bool, 0644);88-module_param(dolby, bool, 0644);8990MODULE_PARM_DESC(opmode, "Forces a MSP3400 opmode. 0=Manual, 1=Autodetect, 2=Autodetect and autoselect");91MODULE_PARM_DESC(once, "No continuous stereo monitoring");···127 { client->addr, I2C_M_RD, 2, read },128 };129130- v4l_dbg(3, client, "msp_reset\n");131 if (i2c_transfer(client->adapter, &reset[0], 1) != 1 ||132 i2c_transfer(client->adapter, &reset[1], 1) != 1 ||133 i2c_transfer(client->adapter, test, 2) != 2) {···165 return -1;166 }167 retval = read[0] << 8 | read[1];168- v4l_dbg(3, client, "msp_read(0x%x, 0x%x): 0x%x\n", dev, addr, retval);169 return retval;170}171···190 buffer[3] = val >> 8;191 buffer[4] = val & 0xff;192193- v4l_dbg(3, client, "msp_write(0x%x, 0x%x, 0x%x)\n", dev, addr, val);194 for (err = 0; err < 3; err++) {195 if (i2c_master_send(client, buffer, 5) == 5)196 break;···273 } else274 state->acb = 0xf60; /* Mute Input and SCART 1 Output */275276- v4l_dbg(1, client, "scart switch: %s => %d (ACB=0x%04x)\n",277 scart_names[in], out, state->acb);278 msp_write_dsp(client, 0x13, state->acb);279···285{286 struct msp_state *state = i2c_get_clientdata(client);287288- v4l_dbg(1, client, "mute audio\n");289 msp_write_dsp(client, 0x0000, 0);290 msp_write_dsp(client, 0x0007, 1);291 if (state->has_scart2_out_volume)···303 if (!state->muted)304 val = (state->volume * 0x7f / 65535) << 8;305306- v4l_dbg(1, client, "mute=%s volume=%d\n",307 state->muted ? "on" : "off", state->volume);308309 msp_write_dsp(client, 0x0000, val);···321 treble = ((state->treble - 32768) * 0x60 / 65535) << 8;322 loudness = state->loudness ? ((5 * 4) << 8) : 0;323324- v4l_dbg(1, client, "balance=%d bass=%d treble=%d loudness=%d\n",325 state->balance, state->bass, state->treble, state->loudness);326327 msp_write_dsp(client, 0x0001, bal << 8);···341 struct msp_state *state = i2c_get_clientdata(client);342343 if (state->radio) {344- v4l_dbg(1, client, "video mode selected to Radio\n");345 return 0x0003;346 }347348 if (state->v4l2_std & V4L2_STD_PAL) {349- v4l_dbg(1, client, "video mode selected to PAL\n");350351#if 1352 /* experimental: not sure this works with all chip versions */···357#endif358 }359 if (state->v4l2_std & V4L2_STD_NTSC) {360- v4l_dbg(1, client, "video mode selected to NTSC\n");361 return 0x2003;362 }363 if (state->v4l2_std & V4L2_STD_SECAM) {364- v4l_dbg(1, client, "video mode selected to SECAM\n");365 return 0x0003;366 }367 return 0x0003;···619 u16 *sarg = arg;620 int scart = 0;621622- if (debug >= 2)623 v4l_i2c_print_ioctl(client, cmd);624625 switch (cmd) {···666 if (state->radio)667 return 0;668 state->radio = 1;669- v4l_dbg(1, client, "switching to radio mode\n");670 state->watch_stereo = 0;671 switch (state->opmode) {672 case OPMODE_MANUAL:···937 if (a->index < 0 || a->index > 2)938 return -EINVAL;939940- v4l_dbg(1, client, "Setting audio out on msp34xx to input %i\n", a->index);941 msp_set_scart(client, state->in_scart, a->index + 1);942943 break;···947 {948 u32 *a = (u32 *)arg;949950- v4l_dbg(1, client, "Setting I2S speed to %d\n", *a);951952 switch (*a) {953 case 1024000:···1041{1042 struct i2c_client *client = container_of(dev, struct i2c_client, dev);10431044- v4l_dbg(1, client, "suspend\n");1045 msp_reset(client);1046 return 0;1047}···1050{1051 struct i2c_client *client = container_of(dev, struct i2c_client, dev);10521053- v4l_dbg(1, client, "resume\n");1054 msp_wake_thread(client);1055 return 0;1056}···1080 snprintf(client->name, sizeof(client->name) - 1, "msp3400");10811082 if (msp_reset(client) == -1) {1083- v4l_dbg(1, client, "msp3400 not found\n");1084 kfree(client);1085 return -1;1086 }···1107 state->rev1 = msp_read_dsp(client, 0x1e);1108 if (state->rev1 != -1)1109 state->rev2 = msp_read_dsp(client, 0x1f);1110- v4l_dbg(1, client, "rev1=0x%04x, rev2=0x%04x\n", state->rev1, state->rev2);1111 if (state->rev1 == -1 || (state->rev1 == 0 && state->rev2 == 0)) {1112- v4l_dbg(1, client, "not an msp3400 (cannot read chip version)\n");1113 kfree(state);1114 kfree(client);1115 return -1;
···6667/* module parameters */68static int opmode = OPMODE_AUTO;69+int msp_debug = 0; /* msp_debug output */70+int msp_once = 0; /* no continous stereo monitoring */71+int msp_amsound = 0; /* hard-wire AM sound at 6.5 Hz (france),72 the autoscan seems work well only with FM... */73+int msp_standard = 1; /* Override auto detect of audio msp_standard, if needed. */74+int msp_dolby = 0;7576+int msp_stereo_thresh = 0x190; /* a2 threshold for stereo/bilingual77 (msp34xxg only) 0x00a0-0x03c0 */7879/* read-only */80module_param(opmode, int, 0444);8182/* read-write */83+module_param_named(once,msp_once, bool, 0644);84+module_param_named(debug,msp_debug, int, 0644);85+module_param_named(stereo_threshold,msp_stereo_thresh, int, 0644);86+module_param_named(standard,msp_standard, int, 0644);87+module_param_named(amsound,msp_amsound, bool, 0644);88+module_param_named(dolby,msp_dolby, bool, 0644);8990MODULE_PARM_DESC(opmode, "Forces a MSP3400 opmode. 0=Manual, 1=Autodetect, 2=Autodetect and autoselect");91MODULE_PARM_DESC(once, "No continuous stereo monitoring");···127 { client->addr, I2C_M_RD, 2, read },128 };129130+ v4l_dbg(3, msp_debug, client, "msp_reset\n");131 if (i2c_transfer(client->adapter, &reset[0], 1) != 1 ||132 i2c_transfer(client->adapter, &reset[1], 1) != 1 ||133 i2c_transfer(client->adapter, test, 2) != 2) {···165 return -1;166 }167 retval = read[0] << 8 | read[1];168+ v4l_dbg(3, msp_debug, client, "msp_read(0x%x, 0x%x): 0x%x\n", dev, addr, retval);169 return retval;170}171···190 buffer[3] = val >> 8;191 buffer[4] = val & 0xff;192193+ v4l_dbg(3, msp_debug, client, "msp_write(0x%x, 0x%x, 0x%x)\n", dev, addr, val);194 for (err = 0; err < 3; err++) {195 if (i2c_master_send(client, buffer, 5) == 5)196 break;···273 } else274 state->acb = 0xf60; /* Mute Input and SCART 1 Output */275276+ v4l_dbg(1, msp_debug, client, "scart switch: %s => %d (ACB=0x%04x)\n",277 scart_names[in], out, state->acb);278 msp_write_dsp(client, 0x13, state->acb);279···285{286 struct msp_state *state = i2c_get_clientdata(client);287288+ v4l_dbg(1, msp_debug, client, "mute audio\n");289 msp_write_dsp(client, 0x0000, 0);290 msp_write_dsp(client, 0x0007, 1);291 if (state->has_scart2_out_volume)···303 if (!state->muted)304 val = (state->volume * 0x7f / 65535) << 8;305306+ v4l_dbg(1, msp_debug, client, "mute=%s volume=%d\n",307 state->muted ? "on" : "off", state->volume);308309 msp_write_dsp(client, 0x0000, val);···321 treble = ((state->treble - 32768) * 0x60 / 65535) << 8;322 loudness = state->loudness ? ((5 * 4) << 8) : 0;323324+ v4l_dbg(1, msp_debug, client, "balance=%d bass=%d treble=%d loudness=%d\n",325 state->balance, state->bass, state->treble, state->loudness);326327 msp_write_dsp(client, 0x0001, bal << 8);···341 struct msp_state *state = i2c_get_clientdata(client);342343 if (state->radio) {344+ v4l_dbg(1, msp_debug, client, "video mode selected to Radio\n");345 return 0x0003;346 }347348 if (state->v4l2_std & V4L2_STD_PAL) {349+ v4l_dbg(1, msp_debug, client, "video mode selected to PAL\n");350351#if 1352 /* experimental: not sure this works with all chip versions */···357#endif358 }359 if (state->v4l2_std & V4L2_STD_NTSC) {360+ v4l_dbg(1, msp_debug, client, "video mode selected to NTSC\n");361 return 0x2003;362 }363 if (state->v4l2_std & V4L2_STD_SECAM) {364+ v4l_dbg(1, msp_debug, client, "video mode selected to SECAM\n");365 return 0x0003;366 }367 return 0x0003;···619 u16 *sarg = arg;620 int scart = 0;621622+ if (msp_debug >= 2)623 v4l_i2c_print_ioctl(client, cmd);624625 switch (cmd) {···666 if (state->radio)667 return 0;668 state->radio = 1;669+ v4l_dbg(1, msp_debug, client, "switching to radio mode\n");670 state->watch_stereo = 0;671 switch (state->opmode) {672 case OPMODE_MANUAL:···937 if (a->index < 0 || a->index > 2)938 return -EINVAL;939940+ v4l_dbg(1, msp_debug, client, "Setting audio out on msp34xx to input %i\n", a->index);941 msp_set_scart(client, state->in_scart, a->index + 1);942943 break;···947 {948 u32 *a = (u32 *)arg;949950+ v4l_dbg(1, msp_debug, client, "Setting I2S speed to %d\n", *a);951952 switch (*a) {953 case 1024000:···1041{1042 struct i2c_client *client = container_of(dev, struct i2c_client, dev);10431044+ v4l_dbg(1, msp_debug, client, "suspend\n");1045 msp_reset(client);1046 return 0;1047}···1050{1051 struct i2c_client *client = container_of(dev, struct i2c_client, dev);10521053+ v4l_dbg(1, msp_debug, client, "resume\n");1054 msp_wake_thread(client);1055 return 0;1056}···1080 snprintf(client->name, sizeof(client->name) - 1, "msp3400");10811082 if (msp_reset(client) == -1) {1083+ v4l_dbg(1, msp_debug, client, "msp3400 not found\n");1084 kfree(client);1085 return -1;1086 }···1107 state->rev1 = msp_read_dsp(client, 0x1e);1108 if (state->rev1 != -1)1109 state->rev2 = msp_read_dsp(client, 0x1f);1110+ v4l_dbg(1, msp_debug, client, "rev1=0x%04x, rev2=0x%04x\n", state->rev1, state->rev2);1111 if (state->rev1 == -1 || (state->rev1 == 0 && state->rev2 == 0)) {1112+ v4l_dbg(1, msp_debug, client, "not an msp3400 (cannot read chip version)\n");1113 kfree(state);1114 kfree(client);1115 return -1;
+62-62
drivers/media/video/msp3400-kthreads.c
···168 struct msp_state *state = i2c_get_clientdata(client);169 int i;170171- v4l_dbg(1, client, "setmode: %d\n", type);172 state->mode = type;173 state->audmode = V4L2_TUNER_MODE_MONO;174 state->rxsubchans = V4L2_TUNER_SUB_MONO;···191192 msp_write_dem(client, 0x0056, 0); /*LOAD_REG_1/2*/193194- if (dolby) {195 msp_write_dsp(client, 0x0008, 0x0520); /* I2S1 */196 msp_write_dsp(client, 0x0009, 0x0620); /* I2S2 */197 msp_write_dsp(client, 0x000b, msp3400c_init_data[type].dsp_src);···221 /* this method would break everything, let's make sure222 * it's never called223 */224- v4l_dbg(1, client, "setstereo called with mode=%d instead of set_source (ignored)\n",225 mode);226 return;227 }···229 /* switch demodulator */230 switch (state->mode) {231 case MSP_MODE_FM_TERRA:232- v4l_dbg(1, client, "FM setstereo: %s\n", strmode[mode]);233 msp3400c_setcarrier(client, state->second, state->main);234 switch (mode) {235 case V4L2_TUNER_MODE_STEREO:···243 }244 break;245 case MSP_MODE_FM_SAT:246- v4l_dbg(1, client, "SAT setstereo: %s\n", strmode[mode]);247 switch (mode) {248 case V4L2_TUNER_MODE_MONO:249 msp3400c_setcarrier(client, MSP_CARRIER(6.5), MSP_CARRIER(6.5));···262 case MSP_MODE_FM_NICAM1:263 case MSP_MODE_FM_NICAM2:264 case MSP_MODE_AM_NICAM:265- v4l_dbg(1, client, "NICAM setstereo: %s\n",strmode[mode]);266 msp3400c_setcarrier(client,state->second,state->main);267 if (state->nicam_on)268 nicam=0x0100;269 break;270 case MSP_MODE_BTSC:271- v4l_dbg(1, client, "BTSC setstereo: %s\n",strmode[mode]);272 nicam=0x0300;273 break;274 case MSP_MODE_EXTERN:275- v4l_dbg(1, client, "extern setstereo: %s\n",strmode[mode]);276 nicam = 0x0200;277 break;278 case MSP_MODE_FM_RADIO:279- v4l_dbg(1, client, "FM-Radio setstereo: %s\n",strmode[mode]);280 break;281 default:282- v4l_dbg(1, client, "mono setstereo\n");283 return;284 }285···290 break;291 case V4L2_TUNER_MODE_MONO:292 if (state->mode == MSP_MODE_AM_NICAM) {293- v4l_dbg(1, client, "switching to AM mono\n");294 /* AM mono decoding is handled by tuner, not MSP chip */295 /* SCART switching control register */296 msp_set_scart(client, SCART_MONO, 0);···304 src = 0x0010 | nicam;305 break;306 }307- v4l_dbg(1, client, "setstereo final source/matrix = 0x%x\n", src);308309- if (dolby) {310 msp_write_dsp(client, 0x0008, 0x0520);311 msp_write_dsp(client, 0x0009, 0x0620);312 msp_write_dsp(client, 0x000a, src);···327 struct msp_state *state = i2c_get_clientdata(client);328329 if (state->main == state->second) {330- v4l_dbg(1, client, "mono sound carrier: %d.%03d MHz\n",331 state->main / 910000, (state->main / 910) % 1000);332 } else {333- v4l_dbg(1, client, "main sound carrier: %d.%03d MHz\n",334 state->main / 910000, (state->main / 910) % 1000);335 }336 if (state->mode == MSP_MODE_FM_NICAM1 || state->mode == MSP_MODE_FM_NICAM2)337- v4l_dbg(1, client, "NICAM/FM carrier : %d.%03d MHz\n",338 state->second / 910000, (state->second/910) % 1000);339 if (state->mode == MSP_MODE_AM_NICAM)340- v4l_dbg(1, client, "NICAM/AM carrier : %d.%03d MHz\n",341 state->second / 910000, (state->second / 910) % 1000);342 if (state->mode == MSP_MODE_FM_TERRA && state->main != state->second) {343- v4l_dbg(1, client, "FM-stereo carrier : %d.%03d MHz\n",344 state->second / 910000, (state->second / 910) % 1000);345 }346}···360 val = msp_read_dsp(client, 0x18);361 if (val > 32767)362 val -= 65536;363- v4l_dbg(2, client, "stereo detect register: %d\n", val);364 if (val > 4096) {365 rxsubchans = V4L2_TUNER_SUB_STEREO | V4L2_TUNER_SUB_MONO;366 } else if (val < -4096) {···374 case MSP_MODE_FM_NICAM2:375 case MSP_MODE_AM_NICAM:376 val = msp_read_dem(client, 0x23);377- v4l_dbg(2, client, "nicam sync=%d, mode=%d\n",378 val & 1, (val & 0x1e) >> 1);379380 if (val & 1) {···407 break;408 case MSP_MODE_BTSC:409 val = msp_read_dem(client, 0x200);410- v4l_dbg(2, client, "status=0x%x (pri=%s, sec=%s, %s%s%s)\n",411 val,412 (val & 0x0002) ? "no" : "yes",413 (val & 0x0004) ? "no" : "yes",···421 }422 if (rxsubchans != state->rxsubchans) {423 update = 1;424- v4l_dbg(1, client, "watch: rxsubchans %d => %d\n",425 state->rxsubchans,rxsubchans);426 state->rxsubchans = rxsubchans;427 }428 if (newnicam != state->nicam_on) {429 update = 1;430- v4l_dbg(1, client, "watch: nicam %d => %d\n",431 state->nicam_on,newnicam);432 state->nicam_on = newnicam;433 }···452 msp3400c_setstereo(client, V4L2_TUNER_MODE_MONO);453 }454455- if (once)456 state->watch_stereo = 0;457}458···464 int count, max1,max2,val1,val2, val,this;465466467- v4l_dbg(1, client, "msp3400 daemon started\n");468 for (;;) {469- v4l_dbg(2, client, "msp3400 thread: sleep\n");470 msp_sleep(state, -1);471- v4l_dbg(2, client, "msp3400 thread: wakeup\n");472473 restart:474- v4l_dbg(1, client, "thread: restart scan\n");475 state->restart = 0;476 if (kthread_should_stop())477 break;478479 if (state->radio || MSP_MODE_EXTERN == state->mode) {480 /* no carrier scan, just unmute */481- v4l_dbg(1, client, "thread: no carrier scan\n");482 msp_set_audio(client);483 continue;484 }···498 cd = msp3400c_carrier_detect_main;499 count = ARRAY_SIZE(msp3400c_carrier_detect_main);500501- if (amsound && (state->v4l2_std & V4L2_STD_SECAM)) {502 /* autodetect doesn't work well with AM ... */503 max1 = 3;504 count = 0;505- v4l_dbg(1, client, "AM sound override\n");506 }507508 for (this = 0; this < count; this++) {···514 val -= 65536;515 if (val1 < val)516 val1 = val, max1 = this;517- v4l_dbg(1, client, "carrier1 val: %5d / %s\n", val,cd[this].name);518 }519520 /* carrier detect pass #2 -- second (stereo) carrier */···535 break;536 }537538- if (amsound && (state->v4l2_std & V4L2_STD_SECAM)) {539 /* autodetect doesn't work well with AM ... */540 cd = NULL;541 count = 0;···550 val -= 65536;551 if (val2 < val)552 val2 = val, max2 = this;553- v4l_dbg(1, client, "carrier2 val: %5d / %s\n", val,cd[this].name);554 }555556 /* program the msp3400 according to the results */···627 /* unmute */628 msp_set_audio(client);629630- if (debug)631 msp3400c_print_mode(client);632633 /* monitor tv audio mode */···637 watch_stereo(client);638 }639 }640- v4l_dbg(1, client, "thread: exit\n");641 return 0;642}643···648 struct msp_state *state = i2c_get_clientdata(client);649 int val, i, std;650651- v4l_dbg(1, client, "msp3410 daemon started\n");652653 for (;;) {654- v4l_dbg(2, client, "msp3410 thread: sleep\n");655 msp_sleep(state,-1);656- v4l_dbg(2, client, "msp3410 thread: wakeup\n");657658 restart:659- v4l_dbg(1, client, "thread: restart scan\n");660 state->restart = 0;661 if (kthread_should_stop())662 break;663664 if (state->mode == MSP_MODE_EXTERN) {665 /* no carrier scan needed, just unmute */666- v4l_dbg(1, client, "thread: no carrier scan\n");667 msp_set_audio(client);668 continue;669 }···682 std = (state->v4l2_std & V4L2_STD_NTSC) ? 0x20 : 1;683 state->watch_stereo = 0;684685- if (debug)686- v4l_dbg(1, client, "setting standard: %s (0x%04x)\n",687 msp_standard_std_name(std), std);688689 if (std != 1) {···700 val = msp_read_dem(client, 0x7e);701 if (val < 0x07ff)702 break;703- v4l_dbg(1, client, "detection still in progress\n");704 }705 }706 for (i = 0; msp_stdlist[i].name != NULL; i++)707 if (msp_stdlist[i].retval == val)708 break;709- v4l_dbg(1, client, "current standard: %s (0x%04x)\n",710 msp_standard_std_name(val), val);711 state->main = msp_stdlist[i].main;712 state->second = msp_stdlist[i].second;713 state->std = val;714715- if (amsound && !state->radio && (state->v4l2_std & V4L2_STD_SECAM) &&716 (val != 0x0009)) {717 /* autodetection has failed, let backup */718- v4l_dbg(1, client, "autodetection failed,"719 " switching to backup standard: %s (0x%04x)\n",720 msp_stdlist[8].name ? msp_stdlist[8].name : "unknown",val);721 val = 0x0009;···798 watch_stereo(client);799 }800 }801- v4l_dbg(1, client, "thread: exit\n");802 return 0;803}804805/* ----------------------------------------------------------------------- */806807-/* msp34xxG + (autoselect no-thread) */808/* this one uses both automatic standard detection and automatic sound */809/* select which are available in the newer G versions */810/* struct msp: only norm, acb and source are really used in this mode */···825 */826 int value = (source & 0x07) << 8 | (source == 0 ? 0x30 : 0x20);827828- v4l_dbg(1, client, "set source to %d (0x%x)\n", source, value);829 /* Loudspeaker Output */830 msp_write_dsp(client, 0x08, value);831 /* SCART1 DA Output */···840 * 0x7f0 = forced mono mode841 */842 /* a2 threshold for stereo/bilingual */843- msp_write_dem(client, 0x22, stereo_threshold);844 state->source = source;845}846···897 struct msp_state *state = i2c_get_clientdata(client);898 int val, std, i;899900- v4l_dbg(1, client, "msp34xxg daemon started\n");901902 state->source = 1; /* default */903 for (;;) {904- v4l_dbg(2, client, "msp34xxg thread: sleep\n");905 msp_sleep(state, -1);906- v4l_dbg(2, client, "msp34xxg thread: wakeup\n");907908 restart:909- v4l_dbg(1, client, "thread: restart scan\n");910 state->restart = 0;911 if (kthread_should_stop())912 break;913914 /* setup the chip*/915 msp34xxg_reset(client);916- std = standard;917 if (std != 0x01)918 goto unmute;919920 /* watch autodetect */921- v4l_dbg(1, client, "triggered autodetect, waiting for result\n");922 for (i = 0; i < 10; i++) {923 if (msp_sleep(state, 100))924 goto restart;···929 std = val;930 break;931 }932- v4l_dbg(2, client, "detection still in progress\n");933 }934 if (std == 1) {935- v4l_dbg(1, client, "detection still in progress after 10 tries. giving up.\n");936 continue;937 }938939 unmute:940 state->std = std;941- v4l_dbg(1, client, "current standard: %s (0x%04x)\n",942 msp_standard_std_name(std), std);943944 /* unmute: dispatch sound to scart output, set scart volume */···950951 msp_write_dem(client, 0x40, state->i2s_mode);952 }953- v4l_dbg(1, client, "thread: exit\n");954 return 0;955}956···976 * this is a problem, I'll handle SAP just like lang1/lang2.977 */978 }979- v4l_dbg(1, client, "status=0x%x, stereo=%d, bilingual=%d -> rxsubchans=%d\n",980 status, is_stereo, is_bilingual, state->rxsubchans);981}982
···168 struct msp_state *state = i2c_get_clientdata(client);169 int i;170171+ v4l_dbg(1, msp_debug, client, "setmode: %d\n", type);172 state->mode = type;173 state->audmode = V4L2_TUNER_MODE_MONO;174 state->rxsubchans = V4L2_TUNER_SUB_MONO;···191192 msp_write_dem(client, 0x0056, 0); /*LOAD_REG_1/2*/193194+ if (msp_dolby) {195 msp_write_dsp(client, 0x0008, 0x0520); /* I2S1 */196 msp_write_dsp(client, 0x0009, 0x0620); /* I2S2 */197 msp_write_dsp(client, 0x000b, msp3400c_init_data[type].dsp_src);···221 /* this method would break everything, let's make sure222 * it's never called223 */224+ v4l_dbg(1, msp_debug, client, "setstereo called with mode=%d instead of set_source (ignored)\n",225 mode);226 return;227 }···229 /* switch demodulator */230 switch (state->mode) {231 case MSP_MODE_FM_TERRA:232+ v4l_dbg(1, msp_debug, client, "FM setstereo: %s\n", strmode[mode]);233 msp3400c_setcarrier(client, state->second, state->main);234 switch (mode) {235 case V4L2_TUNER_MODE_STEREO:···243 }244 break;245 case MSP_MODE_FM_SAT:246+ v4l_dbg(1, msp_debug, client, "SAT setstereo: %s\n", strmode[mode]);247 switch (mode) {248 case V4L2_TUNER_MODE_MONO:249 msp3400c_setcarrier(client, MSP_CARRIER(6.5), MSP_CARRIER(6.5));···262 case MSP_MODE_FM_NICAM1:263 case MSP_MODE_FM_NICAM2:264 case MSP_MODE_AM_NICAM:265+ v4l_dbg(1, msp_debug, client, "NICAM setstereo: %s\n",strmode[mode]);266 msp3400c_setcarrier(client,state->second,state->main);267 if (state->nicam_on)268 nicam=0x0100;269 break;270 case MSP_MODE_BTSC:271+ v4l_dbg(1, msp_debug, client, "BTSC setstereo: %s\n",strmode[mode]);272 nicam=0x0300;273 break;274 case MSP_MODE_EXTERN:275+ v4l_dbg(1, msp_debug, client, "extern setstereo: %s\n",strmode[mode]);276 nicam = 0x0200;277 break;278 case MSP_MODE_FM_RADIO:279+ v4l_dbg(1, msp_debug, client, "FM-Radio setstereo: %s\n",strmode[mode]);280 break;281 default:282+ v4l_dbg(1, msp_debug, client, "mono setstereo\n");283 return;284 }285···290 break;291 case V4L2_TUNER_MODE_MONO:292 if (state->mode == MSP_MODE_AM_NICAM) {293+ v4l_dbg(1, msp_debug, client, "switching to AM mono\n");294 /* AM mono decoding is handled by tuner, not MSP chip */295 /* SCART switching control register */296 msp_set_scart(client, SCART_MONO, 0);···304 src = 0x0010 | nicam;305 break;306 }307+ v4l_dbg(1, msp_debug, client, "setstereo final source/matrix = 0x%x\n", src);308309+ if (msp_dolby) {310 msp_write_dsp(client, 0x0008, 0x0520);311 msp_write_dsp(client, 0x0009, 0x0620);312 msp_write_dsp(client, 0x000a, src);···327 struct msp_state *state = i2c_get_clientdata(client);328329 if (state->main == state->second) {330+ v4l_dbg(1, msp_debug, client, "mono sound carrier: %d.%03d MHz\n",331 state->main / 910000, (state->main / 910) % 1000);332 } else {333+ v4l_dbg(1, msp_debug, client, "main sound carrier: %d.%03d MHz\n",334 state->main / 910000, (state->main / 910) % 1000);335 }336 if (state->mode == MSP_MODE_FM_NICAM1 || state->mode == MSP_MODE_FM_NICAM2)337+ v4l_dbg(1, msp_debug, client, "NICAM/FM carrier : %d.%03d MHz\n",338 state->second / 910000, (state->second/910) % 1000);339 if (state->mode == MSP_MODE_AM_NICAM)340+ v4l_dbg(1, msp_debug, client, "NICAM/AM carrier : %d.%03d MHz\n",341 state->second / 910000, (state->second / 910) % 1000);342 if (state->mode == MSP_MODE_FM_TERRA && state->main != state->second) {343+ v4l_dbg(1, msp_debug, client, "FM-stereo carrier : %d.%03d MHz\n",344 state->second / 910000, (state->second / 910) % 1000);345 }346}···360 val = msp_read_dsp(client, 0x18);361 if (val > 32767)362 val -= 65536;363+ v4l_dbg(2, msp_debug, client, "stereo detect register: %d\n", val);364 if (val > 4096) {365 rxsubchans = V4L2_TUNER_SUB_STEREO | V4L2_TUNER_SUB_MONO;366 } else if (val < -4096) {···374 case MSP_MODE_FM_NICAM2:375 case MSP_MODE_AM_NICAM:376 val = msp_read_dem(client, 0x23);377+ v4l_dbg(2, msp_debug, client, "nicam sync=%d, mode=%d\n",378 val & 1, (val & 0x1e) >> 1);379380 if (val & 1) {···407 break;408 case MSP_MODE_BTSC:409 val = msp_read_dem(client, 0x200);410+ v4l_dbg(2, msp_debug, client, "status=0x%x (pri=%s, sec=%s, %s%s%s)\n",411 val,412 (val & 0x0002) ? "no" : "yes",413 (val & 0x0004) ? "no" : "yes",···421 }422 if (rxsubchans != state->rxsubchans) {423 update = 1;424+ v4l_dbg(1, msp_debug, client, "watch: rxsubchans %d => %d\n",425 state->rxsubchans,rxsubchans);426 state->rxsubchans = rxsubchans;427 }428 if (newnicam != state->nicam_on) {429 update = 1;430+ v4l_dbg(1, msp_debug, client, "watch: nicam %d => %d\n",431 state->nicam_on,newnicam);432 state->nicam_on = newnicam;433 }···452 msp3400c_setstereo(client, V4L2_TUNER_MODE_MONO);453 }454455+ if (msp_once)456 state->watch_stereo = 0;457}458···464 int count, max1,max2,val1,val2, val,this;465466467+ v4l_dbg(1, msp_debug, client, "msp3400 daemon started\n");468 for (;;) {469+ v4l_dbg(2, msp_debug, client, "msp3400 thread: sleep\n");470 msp_sleep(state, -1);471+ v4l_dbg(2, msp_debug, client, "msp3400 thread: wakeup\n");472473 restart:474+ v4l_dbg(1, msp_debug, client, "thread: restart scan\n");475 state->restart = 0;476 if (kthread_should_stop())477 break;478479 if (state->radio || MSP_MODE_EXTERN == state->mode) {480 /* no carrier scan, just unmute */481+ v4l_dbg(1, msp_debug, client, "thread: no carrier scan\n");482 msp_set_audio(client);483 continue;484 }···498 cd = msp3400c_carrier_detect_main;499 count = ARRAY_SIZE(msp3400c_carrier_detect_main);500501+ if (msp_amsound && (state->v4l2_std & V4L2_STD_SECAM)) {502 /* autodetect doesn't work well with AM ... */503 max1 = 3;504 count = 0;505+ v4l_dbg(1, msp_debug, client, "AM sound override\n");506 }507508 for (this = 0; this < count; this++) {···514 val -= 65536;515 if (val1 < val)516 val1 = val, max1 = this;517+ v4l_dbg(1, msp_debug, client, "carrier1 val: %5d / %s\n", val,cd[this].name);518 }519520 /* carrier detect pass #2 -- second (stereo) carrier */···535 break;536 }537538+ if (msp_amsound && (state->v4l2_std & V4L2_STD_SECAM)) {539 /* autodetect doesn't work well with AM ... */540 cd = NULL;541 count = 0;···550 val -= 65536;551 if (val2 < val)552 val2 = val, max2 = this;553+ v4l_dbg(1, msp_debug, client, "carrier2 val: %5d / %s\n", val,cd[this].name);554 }555556 /* program the msp3400 according to the results */···627 /* unmute */628 msp_set_audio(client);629630+ if (msp_debug)631 msp3400c_print_mode(client);632633 /* monitor tv audio mode */···637 watch_stereo(client);638 }639 }640+ v4l_dbg(1, msp_debug, client, "thread: exit\n");641 return 0;642}643···648 struct msp_state *state = i2c_get_clientdata(client);649 int val, i, std;650651+ v4l_dbg(1, msp_debug, client, "msp3410 daemon started\n");652653 for (;;) {654+ v4l_dbg(2, msp_debug, client, "msp3410 thread: sleep\n");655 msp_sleep(state,-1);656+ v4l_dbg(2, msp_debug, client, "msp3410 thread: wakeup\n");657658 restart:659+ v4l_dbg(1, msp_debug, client, "thread: restart scan\n");660 state->restart = 0;661 if (kthread_should_stop())662 break;663664 if (state->mode == MSP_MODE_EXTERN) {665 /* no carrier scan needed, just unmute */666+ v4l_dbg(1, msp_debug, client, "thread: no carrier scan\n");667 msp_set_audio(client);668 continue;669 }···682 std = (state->v4l2_std & V4L2_STD_NTSC) ? 0x20 : 1;683 state->watch_stereo = 0;684685+ if (msp_debug)686+ v4l_dbg(1, msp_debug, client, "setting standard: %s (0x%04x)\n",687 msp_standard_std_name(std), std);688689 if (std != 1) {···700 val = msp_read_dem(client, 0x7e);701 if (val < 0x07ff)702 break;703+ v4l_dbg(1, msp_debug, client, "detection still in progress\n");704 }705 }706 for (i = 0; msp_stdlist[i].name != NULL; i++)707 if (msp_stdlist[i].retval == val)708 break;709+ v4l_dbg(1, msp_debug, client, "current standard: %s (0x%04x)\n",710 msp_standard_std_name(val), val);711 state->main = msp_stdlist[i].main;712 state->second = msp_stdlist[i].second;713 state->std = val;714715+ if (msp_amsound && !state->radio && (state->v4l2_std & V4L2_STD_SECAM) &&716 (val != 0x0009)) {717 /* autodetection has failed, let backup */718+ v4l_dbg(1, msp_debug, client, "autodetection failed,"719 " switching to backup standard: %s (0x%04x)\n",720 msp_stdlist[8].name ? msp_stdlist[8].name : "unknown",val);721 val = 0x0009;···798 watch_stereo(client);799 }800 }801+ v4l_dbg(1, msp_debug, client, "thread: exit\n");802 return 0;803}804805/* ----------------------------------------------------------------------- */806807+/* msp34xxG + (autoselect no-thread) */808/* this one uses both automatic standard detection and automatic sound */809/* select which are available in the newer G versions */810/* struct msp: only norm, acb and source are really used in this mode */···825 */826 int value = (source & 0x07) << 8 | (source == 0 ? 0x30 : 0x20);827828+ v4l_dbg(1, msp_debug, client, "set source to %d (0x%x)\n", source, value);829 /* Loudspeaker Output */830 msp_write_dsp(client, 0x08, value);831 /* SCART1 DA Output */···840 * 0x7f0 = forced mono mode841 */842 /* a2 threshold for stereo/bilingual */843+ msp_write_dem(client, 0x22, msp_stereo_thresh);844 state->source = source;845}846···897 struct msp_state *state = i2c_get_clientdata(client);898 int val, std, i;899900+ v4l_dbg(1, msp_debug, client, "msp34xxg daemon started\n");901902 state->source = 1; /* default */903 for (;;) {904+ v4l_dbg(2, msp_debug, client, "msp34xxg thread: sleep\n");905 msp_sleep(state, -1);906+ v4l_dbg(2, msp_debug, client, "msp34xxg thread: wakeup\n");907908 restart:909+ v4l_dbg(1, msp_debug, client, "thread: restart scan\n");910 state->restart = 0;911 if (kthread_should_stop())912 break;913914 /* setup the chip*/915 msp34xxg_reset(client);916+ std = msp_standard;917 if (std != 0x01)918 goto unmute;919920 /* watch autodetect */921+ v4l_dbg(1, msp_debug, client, "triggered autodetect, waiting for result\n");922 for (i = 0; i < 10; i++) {923 if (msp_sleep(state, 100))924 goto restart;···929 std = val;930 break;931 }932+ v4l_dbg(2, msp_debug, client, "detection still in progress\n");933 }934 if (std == 1) {935+ v4l_dbg(1, msp_debug, client, "detection still in progress after 10 tries. giving up.\n");936 continue;937 }938939 unmute:940 state->std = std;941+ v4l_dbg(1, msp_debug, client, "current standard: %s (0x%04x)\n",942 msp_standard_std_name(std), std);943944 /* unmute: dispatch sound to scart output, set scart volume */···950951 msp_write_dem(client, 0x40, state->i2s_mode);952 }953+ v4l_dbg(1, msp_debug, client, "thread: exit\n");954 return 0;955}956···976 * this is a problem, I'll handle SAP just like lang1/lang2.977 */978 }979+ v4l_dbg(1, msp_debug, client, "status=0x%x, stereo=%d, bilingual=%d -> rxsubchans=%d\n",980 status, is_stereo, is_bilingual, state->rxsubchans);981}982
+6-6
drivers/media/video/msp3400.h
···48#define OPMODE_AUTOSELECT 2 /* use autodetect & autoselect (>= msp34xxG) */4950/* module parameters */51-extern int debug;52-extern int once;53-extern int amsound;54-extern int standard;55-extern int dolby;56-extern int stereo_threshold;5758struct msp_state {59 int rev1, rev2;
···48#define OPMODE_AUTOSELECT 2 /* use autodetect & autoselect (>= msp34xxG) */4950/* module parameters */51+extern int msp_debug;52+extern int msp_once;53+extern int msp_amsound;54+extern int msp_standard;55+extern int msp_dolby;56+extern int msp_stereo_thresh;5758struct msp_state {59 int rev1, rev2;
+4-4
drivers/media/video/mt20xx.c
···21module_param(radio_antenna, int, 0644);2223/* from tuner-core.c */24-extern int debug;2526/* ---------------------------------------------------------------------- */27···404 div2a=(lo2/8)-1;405 div2b=lo2-(div2a+1)*8;406407- if (debug > 1) {408 tuner_dbg("lo1 lo2 = %d %d\n", lo1, lo2);409 tuner_dbg("num1 num2 div1a div1b div2a div2b= %x %x %x %x %x %x\n",410 num1,num2,div1a,div1b,div2a,div2b);···420 buf[5]=div2a;421 if(num2!=0) buf[5]=buf[5]|0x40;422423- if (debug > 1) {424 int i;425 tuner_dbg("bufs is: ");426 for(i=0;i<6;i++)···508509 i2c_master_send(c,buf,1);510 i2c_master_recv(c,buf,21);511- if (debug) {512 int i;513 tuner_dbg("MT20xx hexdump:");514 for(i=0;i<21;i++) {
···21module_param(radio_antenna, int, 0644);2223/* from tuner-core.c */24+extern int tuner_debug;2526/* ---------------------------------------------------------------------- */27···404 div2a=(lo2/8)-1;405 div2b=lo2-(div2a+1)*8;406407+ if (tuner_debug > 1) {408 tuner_dbg("lo1 lo2 = %d %d\n", lo1, lo2);409 tuner_dbg("num1 num2 div1a div1b div2a div2b= %x %x %x %x %x %x\n",410 num1,num2,div1a,div1b,div2a,div2b);···420 buf[5]=div2a;421 if(num2!=0) buf[5]=buf[5]|0x40;422423+ if (tuner_debug > 1) {424 int i;425 tuner_dbg("bufs is: ");426 for(i=0;i<6;i++)···508509 i2c_master_send(c,buf,1);510 i2c_master_recv(c,buf,21);511+ if (tuner_debug) {512 int i;513 tuner_dbg("MT20xx hexdump:");514 for(i=0;i<21;i++) {
···15config VIDEO_SAA7134_ALSA16 tristate "Philips SAA7134 DMA audio support"17 depends on VIDEO_SAA7134 && SND18- select SND_PCM_OSS19 ---help---20 This is a video4linux driver for direct (DMA) audio in21 Philips SAA713x based TV cards using ALSA
···15config VIDEO_SAA7134_ALSA16 tristate "Philips SAA7134 DMA audio support"17 depends on VIDEO_SAA7134 && SND18+ select SND_PCM19 ---help---20 This is a video4linux driver for direct (DMA) audio in21 Philips SAA713x based TV cards using ALSA
···803 struct saa7134_mpeg_ops *mops;804 int err;805806- dev = kmalloc(sizeof(*dev),GFP_KERNEL);807 if (NULL == dev)808 return -ENOMEM;809- memset(dev,0,sizeof(*dev));810811 /* pci init */812 dev->pci = pci_dev;
···803 struct saa7134_mpeg_ops *mops;804 int err;805806+ dev = kzalloc(sizeof(*dev),GFP_KERNEL);807 if (NULL == dev)808 return -ENOMEM;0809810 /* pci init */811 dev->pci = pci_dev;
+1-2
drivers/media/video/saa7134/saa7134-video.c
···1264 v4l2_type_names[type]);12651266 /* allocate + initialize per filehandle data */1267- fh = kmalloc(sizeof(*fh),GFP_KERNEL);1268 if (NULL == fh)1269 return -ENOMEM;1270- memset(fh,0,sizeof(*fh));1271 file->private_data = fh;1272 fh->dev = dev;1273 fh->radio = radio;
···1264 v4l2_type_names[type]);12651266 /* allocate + initialize per filehandle data */1267+ fh = kzalloc(sizeof(*fh),GFP_KERNEL);1268 if (NULL == fh)1269 return -ENOMEM;01270 file->private_data = fh;1271 fh->dev = dev;1272 fh->radio = radio;
-1
drivers/media/video/saa7146.h
···73 unsigned int nr;74 unsigned long irq; /* IRQ used by SAA7146 card */75 unsigned short id;76- struct pci_dev *dev;77 unsigned char revision;78 unsigned char boardcfg[64]; /* 64 bytes of config from eeprom */79 unsigned long saa7146_adr; /* bus address of IO mem from PCI BIOS */
···73 unsigned int nr;74 unsigned long irq; /* IRQ used by SAA7146 card */75 unsigned short id;076 unsigned char revision;77 unsigned char boardcfg[64]; /* 64 bytes of config from eeprom */78 unsigned long saa7146_adr; /* bus address of IO mem from PCI BIOS */
···1050 /* allocate memory *before* doing anything to the hardware1051 * in case allocation fails */1052 mem_needed = BUZ_NUM_STAT_COM * 4;1053- mem = (unsigned long) kmalloc(mem_needed, GFP_KERNEL);1054 vdev = (void *) kmalloc(sizeof(struct video_device), GFP_KERNEL);1055 if (!mem || !vdev) {1056 dprintk(1,···1061 kfree((void *)mem);1062 return -ENOMEM;1063 }1064- memset((void *) mem, 0, mem_needed);1065 zr->stat_com = (u32 *) mem;1066 for (j = 0; j < BUZ_NUM_STAT_COM; j++) {1067 zr->stat_com[j] = 1; /* mark as unavailable to zr36057 */
···1050 /* allocate memory *before* doing anything to the hardware1051 * in case allocation fails */1052 mem_needed = BUZ_NUM_STAT_COM * 4;1053+ mem = kzalloc(mem_needed, GFP_KERNEL);1054 vdev = (void *) kmalloc(sizeof(struct video_device), GFP_KERNEL);1055 if (!mem || !vdev) {1056 dprintk(1,···1061 kfree((void *)mem);1062 return -ENOMEM;1063 }01064 zr->stat_com = (u32 *) mem;1065 for (j = 0; j < BUZ_NUM_STAT_COM; j++) {1066 zr->stat_com[j] = 1; /* mark as unavailable to zr36057 */
+1-2
drivers/media/video/zoran_driver.c
···1345 ZR_DEVNAME(zr), current->comm, current->pid, zr->user);13461347 /* now, create the open()-specific file_ops struct */1348- fh = kmalloc(sizeof(struct zoran_fh), GFP_KERNEL);1349 if (!fh) {1350 dprintk(1,1351 KERN_ERR···1354 res = -ENOMEM;1355 goto open_unlock_and_return;1356 }1357- memset(fh, 0, sizeof(struct zoran_fh));1358 /* used to be BUZ_MAX_WIDTH/HEIGHT, but that gives overflows1359 * on norm-change! */1360 fh->overlay_mask =
···1345 ZR_DEVNAME(zr), current->comm, current->pid, zr->user);13461347 /* now, create the open()-specific file_ops struct */1348+ fh = kzalloc(sizeof(struct zoran_fh), GFP_KERNEL);1349 if (!fh) {1350 dprintk(1,1351 KERN_ERR···1354 res = -ENOMEM;1355 goto open_unlock_and_return;1356 }01357 /* used to be BUZ_MAX_WIDTH/HEIGHT, but that gives overflows1358 * on norm-change! */1359 fh->overlay_mask =
···218 printk(KERN_INFO "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \219 i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0)220#define tuner_dbg(fmt, arg...) do {\221- extern int debug; \222- if (debug) \223 printk(KERN_DEBUG "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \224 i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0)225
···218 printk(KERN_INFO "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \219 i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0)220#define tuner_dbg(fmt, arg...) do {\221+ extern int tuner_debug; \222+ if (tuner_debug) \223 printk(KERN_DEBUG "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \224 i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0)225
+1-2
include/media/v4l2-common.h
···4950/* These three macros assume that the debug level is set with a module51 parameter called 'debug'. */52-#define v4l_dbg(level, client, fmt, arg...) \53 do { \54- extern int debug; \55 if (debug >= (level)) \56 v4l_client_printk(KERN_DEBUG, client, fmt , ## arg); \57 } while (0)
···4950/* These three macros assume that the debug level is set with a module51 parameter called 'debug'. */52+#define v4l_dbg(level, debug, client, fmt, arg...) \53 do { \054 if (debug >= (level)) \55 v4l_client_printk(KERN_DEBUG, client, fmt , ## arg); \56 } while (0)