Commit d6f410bd authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'master' of ssh://master.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb

* 'master' of ssh://master.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb:
  V4L/DVB (5880): wm8775/wm8739: Fix memory leak when unloading module
  V4L/DVB (5877): radio-gemtek-pci: remove unused structure member
  V4L/DVB (5871): Conexant 2388x: check for kthread_run
  V4L/DVB (5869): Add check for valid control ID to v4l2_ctrl_next.
  V4L/DVB (5867): videodev2.h: add missing <sys/time.h> for userspace
  V4L/DVB (5866): ivtv: fix DMA timeout when capturing VBI + another stream
  V4L/DVB (5865): Remove usage of HZ on ivtv driver, replacing by msecs_to_jiffies
  V4L/DVB (5861): Use msecs_to_jiffies instead of HZ on bttv, cx88 and saa7134
  V4L/DVB (5860): Use msecs_to_jiffies instead of HZ on some webcam drivers
  V4L/DVB (5859): use msecs_to_jiffies on InfraRed RC5 timeout
  V4L/DVB (5858): Use msecs_to_jiffies instead of HZ on media/video I2C drivers
  V4L/DVB (5857): Use msecs_to_jiffies instead of HZ on radio drivers
  V4L/DVB (5855): ivtv: fix Kconfig typo and refer to the driver homepage.
  V4L/DVB (5854): ivtv: cleanup of driver messages
  V4L/DVB (5853): ivtv: add support to suppress high volume i2c debug messages.
  V4L/DVB (5852): ivtv: don't recompile needlessly
  V4L/DVB (5851): ivtv: fix missing I2C_ALGOBIT config option
  V4L/DVB (5850): ivtv: improve API command debugging
  V4L/DVB (5848): Av7110: fix typo
parents eaf729c8 1b2232ab
...@@ -345,8 +345,8 @@ void ir_rc5_timer_end(unsigned long data) ...@@ -345,8 +345,8 @@ void ir_rc5_timer_end(unsigned long data)
} }
/* Set/reset key-up timer */ /* Set/reset key-up timer */
timeout = current_jiffies + (500 + ir->rc5_key_timeout timeout = current_jiffies +
* HZ) / 1000; msecs_to_jiffies(ir->rc5_key_timeout);
mod_timer(&ir->timer_keyup, timeout); mod_timer(&ir->timer_keyup, timeout);
/* Save code for repeat test */ /* Save code for repeat test */
......
...@@ -2267,7 +2267,7 @@ static int frontend_init(struct av7110 *av7110) ...@@ -2267,7 +2267,7 @@ static int frontend_init(struct av7110 *av7110)
FE_FUNC_OVERRIDE(av7110->fe->ops.diseqc_send_master_cmd, av7110->fe_diseqc_send_master_cmd, av7110_fe_diseqc_send_master_cmd); FE_FUNC_OVERRIDE(av7110->fe->ops.diseqc_send_master_cmd, av7110->fe_diseqc_send_master_cmd, av7110_fe_diseqc_send_master_cmd);
FE_FUNC_OVERRIDE(av7110->fe->ops.diseqc_send_burst, av7110->fe_diseqc_send_burst, av7110_fe_diseqc_send_burst); FE_FUNC_OVERRIDE(av7110->fe->ops.diseqc_send_burst, av7110->fe_diseqc_send_burst, av7110_fe_diseqc_send_burst);
FE_FUNC_OVERRIDE(av7110->fe->ops.set_tone, av7110->fe_set_tone, av7110_fe_set_tone); FE_FUNC_OVERRIDE(av7110->fe->ops.set_tone, av7110->fe_set_tone, av7110_fe_set_tone);
FE_FUNC_OVERRIDE(av7110->fe->ops.set_voltage, av7110->fe_set_voltage, av7110_fe_set_voltage;) FE_FUNC_OVERRIDE(av7110->fe->ops.set_voltage, av7110->fe_set_voltage, av7110_fe_set_voltage);
FE_FUNC_OVERRIDE(av7110->fe->ops.dishnetwork_send_legacy_command, av7110->fe_dishnetwork_send_legacy_command, av7110_fe_dishnetwork_send_legacy_command); FE_FUNC_OVERRIDE(av7110->fe->ops.dishnetwork_send_legacy_command, av7110->fe_dishnetwork_send_legacy_command, av7110_fe_dishnetwork_send_legacy_command);
FE_FUNC_OVERRIDE(av7110->fe->ops.set_frontend, av7110->fe_set_frontend, av7110_fe_set_frontend); FE_FUNC_OVERRIDE(av7110->fe->ops.set_frontend, av7110->fe_set_frontend, av7110_fe_set_frontend);
......
...@@ -63,7 +63,7 @@ struct rt_device ...@@ -63,7 +63,7 @@ struct rt_device
static void sleep_delay(long n) static void sleep_delay(long n)
{ {
/* Sleep nicely for 'n' uS */ /* Sleep nicely for 'n' uS */
int d=n/(1000000/HZ); int d=n/msecs_to_jiffies(1000);
if(!d) if(!d)
udelay(n); udelay(n);
else else
......
...@@ -329,7 +329,7 @@ cadet_handler(unsigned long data) ...@@ -329,7 +329,7 @@ cadet_handler(unsigned long data)
init_timer(&readtimer); init_timer(&readtimer);
readtimer.function=cadet_handler; readtimer.function=cadet_handler;
readtimer.data=(unsigned long)0; readtimer.data=(unsigned long)0;
readtimer.expires=jiffies+(HZ/20); readtimer.expires=jiffies+msecs_to_jiffies(50);
add_timer(&readtimer); add_timer(&readtimer);
} }
...@@ -349,7 +349,7 @@ cadet_read(struct file *file, char __user *data, size_t count, loff_t *ppos) ...@@ -349,7 +349,7 @@ cadet_read(struct file *file, char __user *data, size_t count, loff_t *ppos)
init_timer(&readtimer); init_timer(&readtimer);
readtimer.function=cadet_handler; readtimer.function=cadet_handler;
readtimer.data=(unsigned long)0; readtimer.data=(unsigned long)0;
readtimer.expires=jiffies+(HZ/20); readtimer.expires=jiffies+msecs_to_jiffies(50);
add_timer(&readtimer); add_timer(&readtimer);
} }
if(rdsin==rdsout) { if(rdsin==rdsout) {
......
...@@ -94,7 +94,6 @@ struct gemtek_pci_card { ...@@ -94,7 +94,6 @@ struct gemtek_pci_card {
u32 iobase; u32 iobase;
u32 length; u32 length;
u16 model;
u32 current_frequency; u32 current_frequency;
u8 mute; u8 mute;
...@@ -413,8 +412,6 @@ static int __devinit gemtek_pci_probe( struct pci_dev *pci_dev, const struct pci ...@@ -413,8 +412,6 @@ static int __devinit gemtek_pci_probe( struct pci_dev *pci_dev, const struct pci
goto err_pci; goto err_pci;
} }
pci_read_config_word( pci_dev, PCI_SUBSYSTEM_ID, &card->model );
pci_set_drvdata( pci_dev, card ); pci_set_drvdata( pci_dev, card );
if ( (devradio = kmalloc( sizeof( struct video_device ), GFP_KERNEL )) == NULL ) { if ( (devradio = kmalloc( sizeof( struct video_device ), GFP_KERNEL )) == NULL ) {
......
...@@ -257,7 +257,7 @@ static int bt866_write(struct bt866 *encoder, ...@@ -257,7 +257,7 @@ static int bt866_write(struct bt866 *encoder,
printk(KERN_WARNING "%s: I/O error #%d " printk(KERN_WARNING "%s: I/O error #%d "
"(write 0x%02x/0x%02x)\n", "(write 0x%02x/0x%02x)\n",
encoder->i2c->name, err, encoder->addr, subaddr); encoder->i2c->name, err, encoder->addr, subaddr);
schedule_timeout_interruptible(HZ/10); schedule_timeout_interruptible(msecs_to_jiffies(100));
} }
if (err == 3) { if (err == 3) {
printk(KERN_WARNING "%s: giving up\n", printk(KERN_WARNING "%s: giving up\n",
......
...@@ -4209,7 +4209,7 @@ static int tea5757_read(struct bttv *btv) ...@@ -4209,7 +4209,7 @@ static int tea5757_read(struct bttv *btv)
bus_low(btv,btv->mbox_clk); bus_low(btv,btv->mbox_clk);
udelay(10); udelay(10);
timeout= jiffies + HZ; timeout= jiffies + msecs_to_jiffies(1000);
/* wait for DATA line to go low; error if it doesn't */ /* wait for DATA line to go low; error if it doesn't */
while (bus_in(btv,btv->mbox_data) && time_before(jiffies, timeout)) while (bus_in(btv,btv->mbox_data) && time_before(jiffies, timeout))
......
...@@ -153,7 +153,7 @@ static void bttv_ir_start(struct bttv *btv, struct card_ir *ir) ...@@ -153,7 +153,7 @@ static void bttv_ir_start(struct bttv *btv, struct card_ir *ir)
{ {
if (ir->polling) { if (ir->polling) {
setup_timer(&ir->timer, bttv_input_timer, (unsigned long)btv); setup_timer(&ir->timer, bttv_input_timer, (unsigned long)btv);
ir->timer.expires = jiffies + HZ; ir->timer.expires = jiffies + msecs_to_jiffies(1000);
add_timer(&ir->timer); add_timer(&ir->timer);
} else if (ir->rc5_gpio) { } else if (ir->rc5_gpio) {
/* set timer_end for code completion */ /* set timer_end for code completion */
......
...@@ -284,8 +284,8 @@ extern int fini_bttv_i2c(struct bttv *btv); ...@@ -284,8 +284,8 @@ extern int fini_bttv_i2c(struct bttv *btv);
#define d2printk if (bttv_debug >= 2) printk #define d2printk if (bttv_debug >= 2) printk
#define BTTV_MAX_FBUF 0x208000 #define BTTV_MAX_FBUF 0x208000
#define BTTV_TIMEOUT (HZ/2) /* 0.5 seconds */ #define BTTV_TIMEOUT msecs_to_jiffies(500) /* 0.5 seconds */
#define BTTV_FREE_IDLE (HZ) /* one second */ #define BTTV_FREE_IDLE msecs_to_jiffies(1000) /* one second */
struct bttv_pll_info { struct bttv_pll_info {
......
...@@ -95,7 +95,7 @@ static unsigned int qcam_await_ready1(struct qcam_device *qcam, ...@@ -95,7 +95,7 @@ static unsigned int qcam_await_ready1(struct qcam_device *qcam,
unsigned long oldjiffies = jiffies; unsigned long oldjiffies = jiffies;
unsigned int i; unsigned int i;
for (oldjiffies = jiffies; (jiffies - oldjiffies) < (HZ/25); ) for (oldjiffies = jiffies; (jiffies - oldjiffies) < msecs_to_jiffies(40); )
if (qcam_ready1(qcam) == value) if (qcam_ready1(qcam) == value)
return 0; return 0;
...@@ -120,7 +120,7 @@ static unsigned int qcam_await_ready2(struct qcam_device *qcam, int value) ...@@ -120,7 +120,7 @@ static unsigned int qcam_await_ready2(struct qcam_device *qcam, int value)
unsigned long oldjiffies = jiffies; unsigned long oldjiffies = jiffies;
unsigned int i; unsigned int i;
for (oldjiffies = jiffies; (jiffies - oldjiffies) < (HZ/25); ) for (oldjiffies = jiffies; (jiffies - oldjiffies) < msecs_to_jiffies(40); )
if (qcam_ready2(qcam) == value) if (qcam_ready2(qcam) == value)
return 0; return 0;
......
...@@ -1881,8 +1881,14 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev, ...@@ -1881,8 +1881,14 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
mutex_unlock(&core->lock); mutex_unlock(&core->lock);
/* start tvaudio thread */ /* start tvaudio thread */
if (core->tuner_type != TUNER_ABSENT) if (core->tuner_type != TUNER_ABSENT) {
core->kthread = kthread_run(cx88_audio_thread, core, "cx88 tvaudio"); core->kthread = kthread_run(cx88_audio_thread, core, "cx88 tvaudio");
if (IS_ERR(core->kthread)) {
err = PTR_ERR(core->kthread);
printk(KERN_ERR "Failed to create cx88 audio thread, err=%d\n",
err);
}
}
return 0; return 0;
fail_unreg: fail_unreg:
......
...@@ -259,7 +259,7 @@ struct cx88_subid { ...@@ -259,7 +259,7 @@ struct cx88_subid {
#define RESOURCE_VIDEO 2 #define RESOURCE_VIDEO 2
#define RESOURCE_VBI 4 #define RESOURCE_VBI 4
#define BUFFER_TIMEOUT (HZ/2) /* 0.5 seconds */ #define BUFFER_TIMEOUT msecs_to_jiffies(500) /* 0.5 seconds */
/* buffer for one video frame */ /* buffer for one video frame */
struct cx88_buffer { struct cx88_buffer {
......
config VIDEO_IVTV config VIDEO_IVTV
tristate "Conexant cx23416/cx23415 MPEG encoder/decoder support" tristate "Conexant cx23416/cx23415 MPEG encoder/decoder support"
depends on VIDEO_V4L1 && VIDEO_V4L2 && PCI && I2C && EXPERIMENTAL depends on VIDEO_V4L1 && VIDEO_V4L2 && PCI && I2C && EXPERIMENTAL
select I2C_ALGOBIT
select FW_LOADER select FW_LOADER
select VIDEO_TUNER select VIDEO_TUNER
select VIDEO_TVEEPROM select VIDEO_TVEEPROM
...@@ -16,11 +17,11 @@ config VIDEO_IVTV ...@@ -16,11 +17,11 @@ config VIDEO_IVTV
select VIDEO_UPD64031A select VIDEO_UPD64031A
select VIDEO_UPD64083 select VIDEO_UPD64083
---help--- ---help---
This is a video4linux driver for Conexant cx23416 or cx23416 based This is a video4linux driver for Conexant cx23416 or cx23415 based
PCI personal video recorder devices. PCI personal video recorder devices.
This is used in devices such as the Hauppauge PVR-150/250/350/500 This is used in devices such as the Hauppauge PVR-150/250/350/500
cards. cards. There is a driver homepage at <http://www.ivtvdriver.org>.
To compile this driver as a module, choose M here: the To compile this driver as a module, choose M here: the
module will be called ivtv. module will be called ivtv.
...@@ -56,7 +56,6 @@ ...@@ -56,7 +56,6 @@
#include "ivtv-gpio.h" #include "ivtv-gpio.h"
#include "ivtv-yuv.h" #include "ivtv-yuv.h"
#include <linux/vermagic.h>
#include <media/tveeprom.h> #include <media/tveeprom.h>
#include <media/v4l2-chip-ident.h> #include <media/v4l2-chip-ident.h>
...@@ -276,9 +275,10 @@ int ivtv_waitq(wait_queue_head_t *waitq) ...@@ -276,9 +275,10 @@ int ivtv_waitq(wait_queue_head_t *waitq)
} }
/* Generic utility functions */ /* Generic utility functions */
int ivtv_sleep_timeout(int timeout, int intr) int ivtv_msleep_timeout(unsigned int msecs, int intr)
{ {
int ret; int ret;
int timeout = msecs_to_jiffies(msecs);
do { do {
set_current_state(intr ? TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE); set_current_state(intr ? TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE);
...@@ -427,7 +427,7 @@ static void ivtv_process_eeprom(struct ivtv *itv) ...@@ -427,7 +427,7 @@ static void ivtv_process_eeprom(struct ivtv *itv)
if (itv->options.newi2c == -1 && tv.has_ir != -1 && tv.has_ir != 2) { if (itv->options.newi2c == -1 && tv.has_ir != -1 && tv.has_ir != 2) {
itv->options.newi2c = (tv.has_ir & 2) ? 1 : 0; itv->options.newi2c = (tv.has_ir & 2) ? 1 : 0;
if (itv->options.newi2c) { if (itv->options.newi2c) {
IVTV_INFO("reopen i2c bus for IR-blaster support\n"); IVTV_INFO("Reopen i2c bus for IR-blaster support\n");
exit_ivtv_i2c(itv); exit_ivtv_i2c(itv);
init_ivtv_i2c(itv); init_ivtv_i2c(itv);
} }
...@@ -951,7 +951,7 @@ static int __devinit ivtv_probe(struct pci_dev *dev, ...@@ -951,7 +951,7 @@ static int __devinit ivtv_probe(struct pci_dev *dev,
/* Make sure we've got a place for this card */ /* Make sure we've got a place for this card */
if (ivtv_cards_active == IVTV_MAX_CARDS) { if (ivtv_cards_active == IVTV_MAX_CARDS) {
printk(KERN_ERR "ivtv: Maximum number of cards detected (%d).\n", printk(KERN_ERR "ivtv: Maximum number of cards detected (%d)\n",
ivtv_cards_active); ivtv_cards_active);
spin_unlock(&ivtv_cards_lock); spin_unlock(&ivtv_cards_lock);
return -ENOMEM; return -ENOMEM;
...@@ -966,9 +966,7 @@ static int __devinit ivtv_probe(struct pci_dev *dev, ...@@ -966,9 +966,7 @@ static int __devinit ivtv_probe(struct pci_dev *dev,
itv->dev = dev; itv->dev = dev;
itv->num = ivtv_cards_active++; itv->num = ivtv_cards_active++;
snprintf(itv->name, sizeof(itv->name) - 1, "ivtv%d", itv->num); snprintf(itv->name, sizeof(itv->name) - 1, "ivtv%d", itv->num);
if (itv->num) { IVTV_INFO("Initializing card #%d\n", itv->num);
printk(KERN_INFO "ivtv: ====================== NEXT CARD ======================\n");
}
spin_unlock(&ivtv_cards_lock); spin_unlock(&ivtv_cards_lock);
...@@ -1215,7 +1213,7 @@ static int __devinit ivtv_probe(struct pci_dev *dev, ...@@ -1215,7 +1213,7 @@ static int __devinit ivtv_probe(struct pci_dev *dev,
if (itv->has_cx23415) if (itv->has_cx23415)
ivtv_set_osd_alpha(itv); ivtv_set_osd_alpha(itv);
IVTV_INFO("Initialized %s, card #%d\n", itv->card_name, itv->num); IVTV_INFO("Initialized card #%d: %s\n", itv->num, itv->card_name);
return 0; return 0;
...@@ -1248,15 +1246,15 @@ static void ivtv_remove(struct pci_dev *pci_dev) ...@@ -1248,15 +1246,15 @@ static void ivtv_remove(struct pci_dev *pci_dev)
{ {
struct ivtv *itv = pci_get_drvdata(pci_dev); struct ivtv *itv = pci_get_drvdata(pci_dev);
IVTV_DEBUG_INFO("Removing Card #%d.\n", itv->num); IVTV_DEBUG_INFO("Removing Card #%d\n", itv->num);
/* Stop all captures */ /* Stop all captures */
IVTV_DEBUG_INFO(" Stopping all streams.\n"); IVTV_DEBUG_INFO("Stopping all streams\n");
if (atomic_read(&itv->capturing) > 0) if (atomic_read(&itv->capturing) > 0)
ivtv_stop_all_captures(itv); ivtv_stop_all_captures(itv);
/* Stop all decoding */ /* Stop all decoding */
IVTV_DEBUG_INFO(" Stopping decoding.\n"); IVTV_DEBUG_INFO("Stopping decoding\n");
if (atomic_read(&itv->decoding) > 0) { if (atomic_read(&itv->decoding) > 0) {
int type; int type;
...@@ -1269,30 +1267,30 @@ static void ivtv_remove(struct pci_dev *pci_dev) ...@@ -1269,30 +1267,30 @@ static void ivtv_remove(struct pci_dev *pci_dev)
} }
/* Interrupts */ /* Interrupts */
IVTV_DEBUG_INFO(" Disabling interrupts.\n"); IVTV_DEBUG_INFO("Disabling interrupts\n");
ivtv_set_irq_mask(itv, 0xffffffff); ivtv_set_irq_mask(itv, 0xffffffff);
del_timer_sync(&itv->dma_timer); del_timer_sync(&itv->dma_timer);
/* Stop all Work Queues */ /* Stop all Work Queues */
IVTV_DEBUG_INFO(" Stop Work Queues.\n"); IVTV_DEBUG_INFO("Stop Work Queues\n");
flush_workqueue(itv->irq_work_queues); flush_workqueue(itv->irq_work_queues);
destroy_workqueue(itv->irq_work_queues); destroy_workqueue(itv->irq_work_queues);
IVTV_DEBUG_INFO(" Stopping Firmware.\n"); IVTV_DEBUG_INFO("Stopping Firmware\n");
ivtv_halt_firmware(itv); ivtv_halt_firmware(itv);
IVTV_DEBUG_INFO(" Unregistering v4l devices.\n"); IVTV_DEBUG_INFO("Unregistering v4l devices\n");
ivtv_streams_cleanup(itv); ivtv_streams_cleanup(itv);
IVTV_DEBUG_INFO(" Freeing dma resources.\n"); IVTV_DEBUG_INFO("Freeing dma resources\n");
ivtv_udma_free(itv); ivtv_udma_free(itv);
exit_ivtv_i2c(itv); exit_ivtv_i2c(itv);
IVTV_DEBUG_INFO(" Releasing irq.\n"); IVTV_DEBUG_INFO(" Releasing irq\n");
free_irq(itv->dev->irq, (void *)itv); free_irq(itv->dev->irq, (void *)itv);
ivtv_iounmap(itv); ivtv_iounmap(itv);
IVTV_DEBUG_INFO(" Releasing mem.\n"); IVTV_DEBUG_INFO(" Releasing mem\n");
release_mem_region(itv->base_addr, IVTV_ENCODER_SIZE); release_mem_region(itv->base_addr, IVTV_ENCODER_SIZE);
release_mem_region(itv->base_addr + IVTV_REG_OFFSET, IVTV_REG_SIZE); release_mem_region(itv->base_addr + IVTV_REG_OFFSET, IVTV_REG_SIZE);
if (itv->has_cx23415) if (itv->has_cx23415)
...@@ -1313,28 +1311,27 @@ static struct pci_driver ivtv_pci_driver = { ...@@ -1313,28 +1311,27 @@ static struct pci_driver ivtv_pci_driver = {
static int module_start(void) static int module_start(void)
{ {
printk(KERN_INFO "ivtv: ==================== START INIT IVTV ====================\n"); printk(KERN_INFO "ivtv: Start initialization, version %s\n", IVTV_VERSION);
printk(KERN_INFO "ivtv: version %s (" VERMAGIC_STRING ") loading\n", IVTV_VERSION);
memset(ivtv_cards, 0, sizeof(ivtv_cards)); memset(ivtv_cards, 0, sizeof(ivtv_cards));
/* Validate parameters */ /* Validate parameters */
if (ivtv_first_minor < 0 || ivtv_first_minor >= IVTV_MAX_CARDS) { if (ivtv_first_minor < 0 || ivtv_first_minor >= IVTV_MAX_CARDS) {
printk(KERN_ERR "ivtv: ivtv_first_minor must be between 0 and %d. Exiting...\n", printk(KERN_ERR "ivtv: Exiting, ivtv_first_minor must be between 0 and %d\n",
IVTV_MAX_CARDS - 1); IVTV_MAX_CARDS - 1);
return -1; return -1;
} }
if (ivtv_debug < 0 || ivtv_debug > 1023) { if (ivtv_debug < 0 || ivtv_debug > 1023) {
ivtv_debug = 0; ivtv_debug = 0;
printk(KERN_INFO "ivtv: debug value must be >= 0 and <= 1023!\n"); printk(KERN_INFO "ivtv: Debug value must be >= 0 and <= 1023\n");
} }
if (pci_register_driver(&ivtv_pci_driver)) { if (pci_register_driver(&ivtv_pci_driver)) {
printk(KERN_ERR "ivtv: Error detecting PCI card\n"); printk(KERN_ERR "ivtv: Error detecting PCI card\n");
return -ENODEV; return -ENODEV;
} }
printk(KERN_INFO "ivtv: ==================== END INIT IVTV ====================\n"); printk(KERN_INFO "ivtv: End initialization\n");
return 0; return 0;
} }
......
...@@ -848,7 +848,7 @@ int ivtv_set_output_mode(struct ivtv *itv, int mode); ...@@ -848,7 +848,7 @@ int ivtv_set_output_mode(struct ivtv *itv, int mode);
struct ivtv_stream *ivtv_get_output_stream(struct ivtv *itv); struct ivtv_stream *ivtv_get_output_stream(struct ivtv *itv);
/* Return non-zero if a signal is pending */ /* Return non-zero if a signal is pending */
int ivtv_sleep_timeout(int timeout, int intr); int ivtv_msleep_timeout(unsigned int msecs, int intr);
/* Wait on queue, returns -EINTR if interrupted */ /* Wait on queue, returns -EINTR if interrupted */
int ivtv_waitq(wait_queue_head_t *waitq); int ivtv_waitq(wait_queue_head_t *waitq);
......
...@@ -218,7 +218,7 @@ static struct ivtv_buffer *ivtv_get_buffer(struct ivtv_stream *s, int non_block, ...@@ -218,7 +218,7 @@ static struct ivtv_buffer *ivtv_get_buffer(struct ivtv_stream *s, int non_block,
/* Process pending program info updates and pending VBI data */ /* Process pending program info updates and pending VBI data */
ivtv_update_pgm_info(itv); ivtv_update_pgm_info(itv);
if (jiffies - itv->dualwatch_jiffies > HZ) { if (jiffies - itv->dualwatch_jiffies > msecs_to_jiffies(1000)) {
itv->dualwatch_jiffies = jiffies; itv->dualwatch_jiffies = jiffies;
ivtv_dualwatch(itv); ivtv_dualwatch(itv);
} }
...@@ -832,7 +832,7 @@ int ivtv_v4l2_open(struct inode *inode, struct file *filp) ...@@ -832,7 +832,7 @@ int ivtv_v4l2_open(struct inode *inode, struct file *filp)
if (itv == NULL) { if (itv == NULL) {
/* Couldn't find a device registered /* Couldn't find a device registered
on that minor, shouldn't happen! */ on that minor, shouldn't happen! */
printk(KERN_WARNING "ivtv: no ivtv device found on minor %d\n", minor); printk(KERN_WARNING "ivtv: No ivtv device found on minor %d\n", minor);
return -ENXIO; return -ENXIO;
} }
...@@ -924,7 +924,7 @@ void ivtv_unmute(struct ivtv *itv) ...@@ -924,7 +924,7 @@ void ivtv_unmute(struct ivtv *itv)
if (atomic_read(&itv->capturing) == 0) if (atomic_read(&itv->capturing) == 0)
ivtv_vapi(itv, CX2341X_ENC_INITIALIZE_INPUT, 0); ivtv_vapi(itv, CX2341X_ENC_INITIALIZE_INPUT, 0);
ivtv_sleep_timeout(HZ / 10, 0); ivtv_msleep_timeout(100, 0);
if (atomic_read(&itv->capturing)) { if (atomic_read(&itv->capturing)) {
ivtv_vapi(itv, CX2341X_ENC_MISC, 1, 12); ivtv_vapi(itv, CX2341X_ENC_MISC, 1, 12);
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#define IVTV_CMD_SPU_STOP 0x00000001 #define IVTV_CMD_SPU_STOP 0x00000001
#define IVTV_CMD_SDRAM_PRECHARGE_INIT 0x0000001A #define IVTV_CMD_SDRAM_PRECHARGE_INIT 0x0000001A
#define IVTV_CMD_SDRAM_REFRESH_INIT 0x80000640 #define IVTV_CMD_SDRAM_REFRESH_INIT 0x80000640
#define IVTV_SDRAM_SLEEPTIME (60 * HZ / 100) /* 600 ms */ #define IVTV_SDRAM_SLEEPTIME 600
#define IVTV_DECODE_INIT_MPEG_FILENAME "v4l-cx2341x-init.mpg" #define IVTV_DECODE_INIT_MPEG_FILENAME "v4l-cx2341x-init.mpg"
#define IVTV_DECODE_INIT_MPEG_SIZE (152*1024) #define IVTV_DECODE_INIT_MPEG_SIZE (152*1024)
...@@ -61,7 +61,7 @@ static int load_fw_direct(const char *fn, volatile u8 __iomem *mem, struct ivtv ...@@ -61,7 +61,7 @@ static int load_fw_direct(const char *fn, volatile u8 __iomem *mem, struct ivtv
the wrong file was sometimes loaded. So we check filesizes to the wrong file was sometimes loaded. So we check filesizes to
see if at least the right-sized file was loaded. If not, then we see if at least the right-sized file was loaded. If not, then we
retry. */ retry. */
IVTV_INFO("retry: file loaded was not %s (expected size %ld, got %zd)\n", fn, size, fw->size); IVTV_INFO("Retry: file loaded was not %s (expected size %ld, got %zd)\n", fn, size, fw->size);
release_firmware(fw); release_firmware(fw);
retries--; retries--;
goto retry; goto retry;
...@@ -73,11 +73,11 @@ static int load_fw_direct(const char *fn, volatile u8 __iomem *mem, struct ivtv ...@@ -73,11 +73,11 @@ static int load_fw_direct(const char *fn, volatile u8 __iomem *mem, struct ivtv
src++; src++;
} }
release_firmware(fw); release_firmware(fw);
IVTV_INFO("loaded %s firmware (%zd bytes)\n", fn, fw->size); IVTV_INFO("Loaded %s firmware (%zd bytes)\n", fn, fw->size);
return size; return size;
} }
IVTV_ERR("unable to open firmware %s (must be %ld bytes)\n", fn, size); IVTV_ERR("Unable to open firmware %s (must be %ld bytes)\n", fn, size);
IVTV_ERR("did you put the firmware in the hotplug firmware directory?\n"); IVTV_ERR("Did you put the firmware in the hotplug firmware directory?\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -89,7 +89,7 @@ void ivtv_halt_firmware(struct ivtv *itv) ...@@ -89,7 +89,7 @@ void ivtv_halt_firmware(struct ivtv *itv)
if (itv->enc_mbox.mbox) if (itv->enc_mbox.mbox)
ivtv_vapi(itv, CX2341X_ENC_HALT_FW, 0); ivtv_vapi(itv, CX2341X_ENC_HALT_FW, 0);
ivtv_sleep_timeout(HZ / 100, 0); ivtv_msleep_timeout(10, 0);
itv->enc_mbox.mbox = itv->dec_mbox.mbox = NULL; itv->enc_mbox.mbox = itv->dec_mbox.mbox = NULL;
IVTV_DEBUG_INFO("Stopping VDM\n"); IVTV_DEBUG_INFO("Stopping VDM\n");
...@@ -113,7 +113,7 @@ void ivtv_halt_firmware(struct ivtv *itv) ...@@ -113,7 +113,7 @@ void ivtv_halt_firmware(struct ivtv *itv)
IVTV_DEBUG_INFO("Stopping SPU\n"); IVTV_DEBUG_INFO("Stopping SPU\n");
write_reg(IVTV_CMD_SPU_STOP, IVTV_REG_SPU); write_reg(IVTV_CMD_SPU_STOP, IVTV_REG_SPU);
ivtv_sleep_timeout(HZ / 100, 0); ivtv_msleep_timeout(10, 0);
IVTV_DEBUG_INFO("init Encoder SDRAM pre-charge\n"); IVTV_DEBUG_INFO("init Encoder SDRAM pre-charge\n");
write_reg(IVTV_CMD_SDRAM_PRECHARGE_INIT, IVTV_REG_ENC_SDRAM_PRECHARGE); write_reg(IVTV_CMD_SDRAM_PRECHARGE_INIT, IVTV_REG_ENC_SDRAM_PRECHARGE);
...@@ -129,9 +129,8 @@ void ivtv_halt_firmware(struct ivtv *itv) ...@@ -129,9 +129,8 @@ void ivtv_halt_firmware(struct ivtv *itv)
write_reg(IVTV_CMD_SDRAM_REFRESH_INIT, IVTV_REG_DEC_SDRAM_REFRESH); write_reg(IVTV_CMD_SDRAM_REFRESH_INIT, IVTV_REG_DEC_SDRAM_REFRESH);
} }
IVTV_DEBUG_INFO("Sleeping for %dms (600 recommended)\n", IVTV_DEBUG_INFO("Sleeping for %dms\n", IVTV_SDRAM_SLEEPTIME);
(int)(IVTV_SDRAM_SLEEPTIME * 1000 / HZ)); ivtv_msleep_timeout(IVTV_SDRAM_SLEEPTIME, 0);
ivtv_sleep_timeout(IVTV_SDRAM_SLEEPTIME, 0);
} }
void ivtv_firmware_versions(struct ivtv *itv) void ivtv_firmware_versions(struct ivtv *itv)
...@@ -204,12 +203,12 @@ int ivtv_firmware_init(struct ivtv *itv) ...@@ -204,12 +203,12 @@ int ivtv_firmware_init(struct ivtv *itv)
/* start firmware */ /* start firmware */
write_reg(read_reg(IVTV_REG_SPU) & IVTV_MASK_SPU_ENABLE, IVTV_REG_SPU); write_reg(read_reg(IVTV_REG_SPU) & IVTV_MASK_SPU_ENABLE, IVTV_REG_SPU);
ivtv_sleep_timeout(HZ / 10, 0); ivtv_msleep_timeout(100, 0);
if (itv->has_cx23415) if (itv->has_cx23415)
write_reg(read_reg(IVTV_REG_VPU) & IVTV_MASK_VPU_ENABLE15, IVTV_REG_VPU); write_reg(read_reg(IVTV_REG_VPU) & IVTV_MASK_VPU_ENABLE15, IVTV_REG_VPU);
else else
write_reg(read_reg(IVTV_REG_VPU) & IVTV_MASK_VPU_ENABLE16, IVTV_REG_VPU); write_reg(read_reg(IVTV_REG_VPU) & IVTV_MASK_VPU_ENABLE16, IVTV_REG_VPU);
ivtv_sleep_timeout(HZ / 10, 0); ivtv_msleep_timeout(100, 0);
/* find mailboxes and ping firmware */ /* find mailboxes and ping firmware */
itv->enc_mbox.mbox = ivtv_search_mailbox(itv->enc_mem, IVTV_ENCODER_SIZE); itv->enc_mbox.mbox = ivtv_search_mailbox(itv->enc_mem, IVTV_ENCODER_SIZE);
...@@ -264,7 +263,7 @@ void ivtv_init_mpeg_decoder(struct ivtv *itv) ...@@ -264,7 +263,7 @@ void ivtv_init_mpeg_decoder(struct ivtv *itv)
IVTV_DECODE_INIT_MPEG_FILENAME); IVTV_DECODE_INIT_MPEG_FILENAME);
} else { } else {
ivtv_vapi(itv, CX2341X_DEC_SCHED_DMA_FROM_HOST, 3, 0, readbytes, 0); ivtv_vapi(itv, CX2341X_DEC_SCHED_DMA_FROM_HOST, 3, 0, readbytes, 0);
ivtv_sleep_timeout(HZ / 10, 0); ivtv_msleep_timeout(100, 0);
} }
ivtv_vapi(itv, CX2341X_DEC_STOP_PLAYBACK, 4, 0, 0, 0, 1); ivtv_vapi(itv, CX2341X_DEC_STOP_PLAYBACK, 4, 0, 0, 0, 1);
} }
...@@ -130,7 +130,7 @@ int ivtv_reset_tuner_gpio(enum v4l2_tuner_type mode, void *priv, int ptr) ...@@ -130,7 +130,7 @@ int ivtv_reset_tuner_gpio(enum v4l2_tuner_type mode, void *priv, int ptr)
if (itv->card->type != IVTV_CARD_PG600V2 || itv->options.tuner != TUNER_XCEIVE_XC3028) if (itv->card->type != IVTV_CARD_PG600V2 || itv->options.tuner != TUNER_XCEIVE_XC3028)
return -EINVAL; return -EINVAL;
IVTV_INFO("Resetting tuner.\n"); IVTV_INFO("Resetting tuner\n");
curout = read_reg(IVTV_REG_GPIO_OUT); curout = read_reg(IVTV_REG_GPIO_OUT);
curdir = read_reg(IVTV_REG_GPIO_DIR); curdir = read_reg(IVTV_REG_GPIO_DIR);
curdir |= (1 << 12); /* GPIO bit 12 */ curdir |= (1 << 12); /* GPIO bit 12 */
......
...@@ -144,7 +144,7 @@ static int attach_inform(struct i2c_client *client) ...@@ -144,7 +144,7 @@ static int attach_inform(struct i2c_client *client)
} }
} }
if (i == I2C_CLIENTS_MAX) { if (i == I2C_CLIENTS_MAX) {
IVTV_ERR("insufficient room for new I2C client!\n"); IVTV_ERR("Insufficient room for new I2C client\n");
} }
return 0; return 0;
} }
...@@ -236,7 +236,7 @@ static int ivtv_ack(struct ivtv *itv) ...@@ -236,7 +236,7 @@ static int ivtv_ack(struct ivtv *itv)
int ret = 0; int ret = 0;
if (ivtv_getscl(itv) == 1) { if (ivtv_getscl(itv) == 1) {
IVTV_DEBUG_I2C("SCL was high starting an ack\n"); IVTV_DEBUG_HI_I2C("SCL was high starting an ack\n");
ivtv_setscl(itv, 0); ivtv_setscl(itv, 0);
if (!ivtv_waitscl(itv, 0)) { if (!ivtv_waitscl(itv, 0)) {
IVTV_DEBUG_I2C("Could not set SCL low starting an ack\n"); IVTV_DEBUG_I2C("Could not set SCL low starting an ack\n");
...@@ -263,7 +263,7 @@ static int ivtv_sendbyte(struct ivtv *itv, unsigned char byte) ...@@ -263,7 +263,7 @@ static int ivtv_sendbyte(struct ivtv *itv, unsigned char byte)
{ {
int i, bit; int i, bit;
IVTV_DEBUG_I2C("write %x\n",byte); IVTV_DEBUG_HI_I2C("write %x\n",byte);
for (i = 0; i < 8; ++i, byte<<=1) { for (i = 0; i < 8; ++i, byte<<=1) {
ivtv_setscl(itv, 0); ivtv_setscl(itv, 0);
if (!ivtv_waitscl(itv, 0)) { if (!ivtv_waitscl(itv, 0)) {
...@@ -318,7 +318,7 @@ static int ivtv_readbyte(struct ivtv *itv, unsigned char *byte, int nack) ...@@ -318,7 +318,7 @@ static int ivtv_readbyte(struct ivtv *itv, unsigned char *byte, int nack)
ivtv_scldelay(itv); ivtv_scldelay(itv);
ivtv_setscl(itv, 0); ivtv_setscl(itv, 0);
ivtv_scldelay(itv); ivtv_scldelay(itv);
IVTV_DEBUG_I2C("read %x\n",*byte); IVTV_DEBUG_HI_I2C("read %x\n",*byte);
return 0; return 0;
} }
...@@ -330,7 +330,7 @@ static int ivtv_start(struct ivtv *itv) ...@@ -330,7 +330,7 @@ static int ivtv_start(struct ivtv *itv)
sda = ivtv_getsda(itv); sda = ivtv_getsda(itv);
if (sda != 1) { if (sda != 1) {
IVTV_DEBUG_I2C("SDA was low at start\n"); IVTV_DEBUG_HI_I2C("SDA was low at start\n");
ivtv_setsda(itv, 1); ivtv_setsda(itv, 1);
if (!ivtv_waitsda(itv, 1)) { if (!ivtv_waitsda(itv, 1)) {
IVTV_DEBUG_I2C("SDA stuck low\n"); IVTV_DEBUG_I2C("SDA stuck low\n");
...@@ -355,7 +355,7 @@ static int ivtv_stop(struct ivtv *itv) ...@@ -355,7 +355,7 @@ static int ivtv_stop(struct ivtv *itv)
int i; int i;
if (ivtv_getscl(itv) != 0) { if (ivtv_getscl(itv) != 0) {
IVTV_DEBUG_I2C("SCL not low when stopping\n"); IVTV_DEBUG_HI_I2C("SCL not low when stopping\n");
ivtv_setscl(itv, 0); ivtv_setscl(itv, 0);
if (!ivtv_waitscl(itv, 0)) { if (!ivtv_waitscl(itv, 0)) {
IVTV_DEBUG_I2C("SCL could not be set low\n"); IVTV_DEBUG_I2C("SCL could not be set low\n");
...@@ -569,7 +569,7 @@ int ivtv_call_i2c_client(struct ivtv *itv, int addr, unsigned int cmd, void *arg ...@@ -569,7 +569,7 @@ int ivtv_call_i2c_client(struct ivtv *itv, int addr, unsigned int cmd, void *arg
} }
} }
if (cmd != VIDIOC_G_CHIP_IDENT) if (cmd != VIDIOC_G_CHIP_IDENT)
IVTV_ERR("i2c addr 0x%02x not found for command 0x%x!\n", addr, cmd); IVTV_ERR("i2c addr 0x%02x not found for command 0x%x\n", addr, cmd);
return -ENODEV; return -ENODEV;
} }
...@@ -640,7 +640,7 @@ int ivtv_i2c_hw(struct ivtv *itv, u32 hw, unsigned int cmd, void *arg) ...@@ -640,7 +640,7 @@ int ivtv_i2c_hw(struct ivtv *itv, u32 hw, unsigned int cmd, void *arg)
addr = ivtv_i2c_hw_addr(itv, hw); addr = ivtv_i2c_hw_addr(itv, hw);
if (addr < 0) { if (addr < 0) {
IVTV_ERR("i2c hardware 0x%08x (%s) not found for command 0x%x!\n", IVTV_ERR("i2c hardware 0x%08x (%s) not found for command 0x%x\n",
hw, ivtv_i2c_hw_name(hw), cmd); hw, ivtv_i2c_hw_name(hw), cmd);
return addr; return addr;
} }
...@@ -655,7 +655,7 @@ int ivtv_i2c_id(struct ivtv *itv, u32 id, unsigned int cmd, void *arg) ...@@ -655,7 +655,7 @@ int ivtv_i2c_id(struct ivtv *itv, u32 id, unsigned int cmd, void *arg)
addr = ivtv_i2c_id_addr(itv, id); addr = ivtv_i2c_id_addr(itv, id);
if (addr < 0) { if (addr < 0) {
if (cmd != VIDIOC_G_CHIP_IDENT) if (cmd != VIDIOC_G_CHIP_IDENT)
IVTV_ERR("i2c ID 0x%08x (%s) not found for command 0x%x!\n", IVTV_ERR("i2c ID 0x%08x (%s) not found for command 0x%x\n",
id, ivtv_i2c_id_name(id), cmd); id, ivtv_i2c_id_name(id), cmd);
return addr; return addr;
} }
...@@ -696,7 +696,7 @@ int ivtv_upd64083(struct ivtv *itv, unsigned int cmd, void *arg) ...@@ -696,7 +696,7 @@ int ivtv_upd64083(struct ivtv *itv, unsigned int cmd, void *arg)
void ivtv_call_i2c_clients(struct ivtv *itv, unsigned int cmd, void *arg) void ivtv_call_i2c_clients(struct ivtv *itv, unsigned int cmd, void *arg)
{ {
if (itv->i2c_adap.algo == NULL) { if (itv->i2c_adap.algo == NULL) {
IVTV_ERR("adapter is not set"); IVTV_ERR("Adapter is not set");
return; return;
} }
i2c_clients_command(&itv->i2c_adap, cmd, arg); i2c_clients_command(&itv->i2c_adap, cmd, arg);
......
...@@ -403,6 +403,11 @@ static void ivtv_dma_enc_start(struct ivtv_stream *s) ...@@ -403,6 +403,11 @@ static void ivtv_dma_enc_start(struct ivtv_stream *s)
/* Mark last buffer size for Interrupt flag */ /* Mark last buffer size for Interrupt flag */
s->SGarray[s->SG_length - 1].size |= cpu_to_le32(0x80000000); s->SGarray[s->SG_length - 1].size |= cpu_to_le32(0x80000000);
if (s->type == IVTV_ENC_STREAM_TYPE_VBI)
set_bit(IVTV_F_I_ENC_VBI, &itv->i_flags);
else
clear_bit(IVTV_F_I_ENC_VBI, &itv->i_flags);
if (ivtv_use_pio(s)) { if (ivtv_use_pio(s)) {
for (i = 0; i < s->SG_length; i++) { for (i = 0; i < s->SG_length; i++) {
s->PIOarray[i].src = le32_to_cpu(s->SGarray[i].src); s->PIOarray[i].src = le32_to_cpu(s->SGarray[i].src);
...@@ -420,7 +425,7 @@ static void ivtv_dma_enc_start(struct ivtv_stream *s) ...@@ -420,7 +425,7 @@ static void ivtv_dma_enc_start(struct ivtv_stream *s)
write_reg_sync(read_reg(IVTV_REG_DMAXFER) | 0x02, IVTV_REG_DMAXFER); write_reg_sync(read_reg(IVTV_REG_DMAXFER) | 0x02, IVTV_REG_DMAXFER);
set_bit(IVTV_F_I_DMA, &itv->i_flags); set_bit(IVTV_F_I_DMA, &itv->i_flags);
itv->cur_dma_stream = s->type; itv->cur_dma_stream = s->type;
itv->dma_timer.expires = jiffies + HZ / 10; itv->dma_timer.expires = jiffies + msecs_to_jiffies(100);
add_timer(&itv->dma_timer); add_timer(&itv->dma_timer);
} }
} }
...@@ -437,7 +442,7 @@ static void ivtv_dma_dec_start(struct ivtv_stream *s) ...@@ -437,7 +442,7 @@ static void ivtv_dma_dec_start(struct ivtv_stream *s)
write_reg_sync(read_reg(IVTV_REG_DMAXFER) | 0x01, IVTV_REG_DMAXFER); write_reg_sync(read_reg(IVTV_REG_DMAXFER) | 0x01, IVTV_REG_DMAXFER);
set_bit(IVTV_F_I_DMA, &itv->i_flags); set_bit(IVTV_F_I_DMA, &itv->i_flags);
itv->cur_dma_stream = s->type; itv->cur_dma_stream = s->type;
itv->dma_timer.expires = jiffies + HZ / 10; itv->dma_timer.expires = jiffies + msecs_to_jiffies(100);
add_timer(&itv->dma_timer); add_timer(&itv->dma_timer);
} }
...@@ -597,7 +602,6 @@ static void ivtv_irq_enc_start_cap(struct ivtv *itv) ...@@ -597,7 +602,6 @@ static void ivtv_irq_enc_start_cap(struct ivtv *itv)
data[0], data[1], data[2]); data[0], data[1], data[2]);
return; return;
} }
clear_bit(IVTV_F_I_ENC_VBI, &itv->i_flags);
s = &itv->streams[ivtv_stream_map[data[0]]]; s = &itv->streams[ivtv_stream_map[data[0]]];
if (!stream_enc_dma_append(s, data)) { if (!stream_enc_dma_append(s, data)) {
set_bit(ivtv_use_pio(s) ? IVTV_F_S_PIO_PENDING : IVTV_F_S_DMA_PENDING, &s->s_flags); set_bit(ivtv_use_pio(s) ? IVTV_F_S_PIO_PENDING : IVTV_F_S_DMA_PENDING, &s->s_flags);
...@@ -634,7 +638,6 @@ static void ivtv_irq_enc_vbi_cap(struct ivtv *itv) ...@@ -634,7 +638,6 @@ static void ivtv_irq_enc_vbi_cap(struct ivtv *itv)
then start a DMA request for just the VBI data. */ then start a DMA request for just the VBI data. */
if (!stream_enc_dma_append(s, data) && if (!stream_enc_dma_append(s, data) &&
!test_bit(IVTV_F_S_STREAMING, &s_mpg->s_flags)) { !test_bit(IVTV_F_S_STREAMING, &s_mpg->s_flags)) {
set_bit(IVTV_F_I_ENC_VBI, &itv->i_flags);
set_bit(ivtv_use_pio(s) ? IVTV_F_S_PIO_PENDING : IVTV_F_S_DMA_PENDING, &s->s_flags); set_bit(ivtv_use_pio(s) ? IVTV_F_S_PIO_PENDING : IVTV_F_S_DMA_PENDING, &s->s_flags);
} }
} }
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#define API_RESULT (1 << 1) /* Allow 1 second for this cmd to end */ #define API_RESULT (1 << 1) /* Allow 1 second for this cmd to end */
#define API_FAST_RESULT (3 << 1) /* Allow 0.1 second for this cmd to end */ #define API_FAST_RESULT (3 << 1) /* Allow 0.1 second for this cmd to end */
#define API_DMA (1 << 3) /* DMA mailbox, has special handling */ #define API_DMA (1 << 3) /* DMA mailbox, has special handling */
#define API_HIGH_VOL (1 << 5) /* High volume command (i.e. called during encoding or decoding) */
#define API_NO_WAIT_MB (1 << 4) /* Command may not wait for a free mailbox */ #define API_NO_WAIT_MB (1 << 4) /* Command may not wait for a free mailbox */
#define API_NO_WAIT_RES (1 << 5) /* Command may not wait for the result */ #define API_NO_WAIT_RES (1 << 5) /* Command may not wait for the result */
...@@ -77,11 +78,11 @@ static const struct ivtv_api_info api_info[256] = { ...@@ -77,11 +78,11 @@ static const struct ivtv_api_info api_info[256] = {
API_ENTRY(CX2341X_ENC_SET_DMA_BLOCK_SIZE, API_CACHE), API_ENTRY(CX2341X_ENC_SET_DMA_BLOCK_SIZE, API_CACHE),
API_ENTRY(CX2341X_ENC_GET_PREV_DMA_INFO_MB_10, API_FAST_RESULT), API_ENTRY(CX2341X_ENC_GET_PREV_DMA_INFO_MB_10, API_FAST_RESULT),
API_ENTRY(CX2341X_ENC_GET_PREV_DMA_INFO_MB_9, API_FAST_RESULT), API_ENTRY(CX2341X_ENC_GET_PREV_DMA_INFO_MB_9, API_FAST_RESULT),
API_ENTRY(CX2341X_ENC_SCHED_DMA_TO_HOST, API_DMA), API_ENTRY(CX2341X_ENC_SCHED_DMA_TO_HOST, API_DMA | API_HIGH_VOL),
API_ENTRY(CX2341X_ENC_INITIALIZE_INPUT, API_RESULT), API_ENTRY(CX2341X_ENC_INITIALIZE_INPUT, API_RESULT),
API_ENTRY(CX2341X_ENC_SET_FRAME_DROP_RATE, API_CACHE), API_ENTRY(CX2341X_ENC_SET_FRAME_DROP_RATE, API_CACHE),
API_ENTRY(CX2341X_ENC_PAUSE_ENCODER, API_RESULT), API_ENTRY(CX2341X_ENC_PAUSE_ENCODER, API_RESULT),
API_ENTRY(CX2341X_ENC_REFRESH_INPUT, API_NO_WAIT_MB), API_ENTRY(CX2341X_ENC_REFRESH_INPUT, API_NO_WAIT_MB | API_HIGH_VOL),
API_ENTRY(CX2341X_ENC_SET_COPYRIGHT, API_CACHE), API_ENTRY(CX2341X_ENC_SET_COPYRIGHT, API_CACHE),
API_ENTRY(CX2341X_ENC_SET_EVENT_NOTIFICATION, API_RESULT), API_ENTRY(CX2341X_ENC_SET_EVENT_NOTIFICATION, API_RESULT),
API_ENTRY(CX2341X_ENC_SET_NUM_VSYNC_LINES, API_CACHE), API_ENTRY(CX2341X_ENC_SET_NUM_VSYNC_LINES, API_CACHE),
...@@ -102,7 +103,7 @@ static const struct ivtv_api_info api_info[256] = { ...@@ -102,7 +103,7 @@ static const struct ivtv_api_info api_info[256] = {
API_ENTRY(CX2341X_DEC_SET_DMA_BLOCK_SIZE, API_CACHE), API_ENTRY(CX2341X_DEC_SET_DMA_BLOCK_SIZE, API_CACHE),
API_ENTRY(CX2341X_DEC_GET_XFER_INFO, API_FAST_RESULT), API_ENTRY(CX2341X_DEC_GET_XFER_INFO, API_FAST_RESULT),
API_ENTRY(CX2341X_DEC_GET_DMA_STATUS, API_FAST_RESULT), API_ENTRY(CX2341X_DEC_GET_DMA_STATUS, API_FAST_RESULT),
API_ENTRY(CX2341X_DEC_SCHED_DMA_FROM_HOST, API_DMA), API_ENTRY(CX2341X_DEC_SCHED_DMA_FROM_HOST, API_DMA | API_HIGH_VOL),
API_ENTRY(CX2341X_DEC_PAUSE_PLAYBACK, API_RESULT), API_ENTRY(CX2341X_DEC_PAUSE_PLAYBACK, API_RESULT),
API_ENTRY(CX2341X_DEC_HALT_FW, API_FAST_RESULT), API_ENTRY(CX2341X_DEC_HALT_FW, API_FAST_RESULT),
API_ENTRY(CX2341X_DEC_SET_STANDARD, API_CACHE), API_ENTRY(CX2341X_DEC_SET_STANDARD, API_CACHE),
...@@ -175,9 +176,9 @@ static int get_mailbox(struct ivtv *itv, struct ivtv_mailbox_data *mbdata, int f ...@@ -175,9 +176,9 @@ static int get_mailbox(struct ivtv *itv, struct ivtv_mailbox_data *mbdata, int f
/* Sleep before a retry, if not atomic */ /* Sleep before a retry, if not atomic */
if (!(flags & API_NO_WAIT_MB)) { if (!(flags & API_NO_WAIT_MB)) {
if (jiffies - then > retries * HZ / 100) if (jiffies - then > msecs_to_jiffies(10*retries))
break; break;
ivtv_sleep_timeout(HZ / 100, 0); ivtv_msleep_timeout(10, 0);
} }
} }
return -ENODEV; return -ENODEV;
...@@ -212,7 +213,7 @@ static int ivtv_api_call(struct ivtv *itv, int cmd, int args, u32 data[]) ...@@ -212,7 +213,7 @@ static int ivtv_api_call(struct ivtv *itv, int cmd, int args, u32 data[])
{ {
struct ivtv_mailbox_data *mbdata = (cmd >= 128) ? &itv->enc_mbox : &itv->dec_mbox; struct ivtv_mailbox_data *mbdata = (cmd >= 128) ? &itv->enc_mbox : &itv->dec_mbox;
volatile struct ivtv_mailbox __iomem *mbox; volatile struct ivtv_mailbox __iomem *mbox;
int api_timeout = HZ; int api_timeout = msecs_to_jiffies(1000);
int flags, mb, i; int flags, mb, i;
unsigned long then; unsigned long then;
...@@ -227,7 +228,12 @@ static int ivtv_api_call(struct ivtv *itv, int cmd, int args, u32 data[]) ...@@ -227,7 +228,12 @@ static int ivtv_api_call(struct ivtv *itv, int cmd, int args, u32 data[])
return -EINVAL; return -EINVAL;
} }
if (api_info[cmd].flags & API_HIGH_VOL) {
IVTV_DEBUG_HI_API("API Call: %s\n", api_info[cmd].name);
}
else {
IVTV_DEBUG_API("API Call: %s\n", api_info[cmd].name); IVTV_DEBUG_API("API Call: %s\n", api_info[cmd].name);
}
/* clear possibly uninitialized part of data array */ /* clear possibly uninitialized part of data array */
for (i = args; i < CX2341X_MBOX_MAX_DATA; i++) for (i = args; i < CX2341X_MBOX_MAX_DATA; i++)
...@@ -237,7 +243,7 @@ static int ivtv_api_call(struct ivtv *itv, int cmd, int args, u32 data[]) ...@@ -237,7 +243,7 @@ static int ivtv_api_call(struct ivtv *itv, int cmd, int args, u32 data[])
data, then just return 0 as there is no need to issue this command again. data, then just return 0 as there is no need to issue this command again.
Just an optimization to prevent unnecessary use of mailboxes. */ Just an optimization to prevent unnecessary use of mailboxes. */
if (itv->api_cache[cmd].last_jiffies && if (itv->api_cache[cmd].last_jiffies &&
jiffies - itv->api_cache[cmd].last_jiffies < HZ * 1800 && jiffies - itv->api_cache[cmd].last_jiffies < msecs_to_jiffies(1800000) &&
!memcmp(data, itv->api_cache[cmd].data, sizeof(itv->api_cache[cmd].data))) { !memcmp(data, itv->api_cache[cmd].data, sizeof(itv->api_cache[cmd].data))) {
itv->api_cache[cmd].last_jiffies = jiffies; itv->api_cache[cmd].last_jiffies = jiffies;
return 0; return 0;
...@@ -262,7 +268,7 @@ static int ivtv_api_call(struct ivtv *itv, int cmd, int args, u32 data[]) ...@@ -262,7 +268,7 @@ static int ivtv_api_call(struct ivtv *itv, int cmd, int args, u32 data[])
} }
if ((flags & API_FAST_RESULT) == API_FAST_RESULT) if ((flags & API_FAST_RESULT) == API_FAST_RESULT)
api_timeout = HZ / 10; api_timeout = msecs_to_jiffies(100);
mb = get_mailbox(itv, mbdata, flags); mb = get_mailbox(itv, mbdata, flags);
if (mb < 0) { if (mb < 0) {
...@@ -295,11 +301,12 @@ static int ivtv_api_call(struct ivtv *itv, int cmd, int args, u32 data[]) ...@@ -295,11 +301,12 @@ static int ivtv_api_call(struct ivtv *itv, int cmd, int args, u32 data[])
if (flags & API_NO_WAIT_RES) if (flags & API_NO_WAIT_RES)
mdelay(1); mdelay(1);
else else
ivtv_sleep_timeout(HZ / 100, 0); ivtv_msleep_timeout(10, 0);
} }
if (jiffies - then > HZ / 10) if (jiffies - then > msecs_to_jiffies(100))
IVTV_DEBUG_WARN("%s took %lu jiffies (%d per HZ)\n", IVTV_DEBUG_WARN("%s took %u jiffies\n",
api_info[cmd].name, jiffies - then, HZ); api_info[cmd].name,
jiffies_to_msecs(jiffies - then));
for (i = 0; i < CX2341X_MBOX_MAX_DATA; i++) for (i = 0; i < CX2341X_MBOX_MAX_DATA; i++)
data[i] = readl(&mbox->data[i]); data[i] = readl(&mbox->data[i]);
......
...@@ -565,7 +565,7 @@ int ivtv_start_v4l2_encode_stream(struct ivtv_stream *s) ...@@ -565,7 +565,7 @@ int ivtv_start_v4l2_encode_stream(struct ivtv_stream *s)
/* Initialize Digitizer for Capture */ /* Initialize Digitizer for Capture */
ivtv_vapi(itv, CX2341X_ENC_INITIALIZE_INPUT, 0); ivtv_vapi(itv, CX2341X_ENC_INITIALIZE_INPUT, 0);
ivtv_sleep_timeout(HZ / 10, 0); ivtv_msleep_timeout(100, 0);
} }
/* begin_capture */ /* begin_capture */
...@@ -781,8 +781,9 @@ int ivtv_stop_v4l2_encode_stream(struct ivtv_stream *s, int gop_end) ...@@ -781,8 +781,9 @@ int ivtv_stop_v4l2_encode_stream(struct ivtv_stream *s, int gop_end)
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
/* wait 2s for EOS interrupt */ /* wait 2s for EOS interrupt */
while (!test_bit(IVTV_F_I_EOS, &itv->i_flags) && jiffies < then + 2 * HZ) { while (!test_bit(IVTV_F_I_EOS, &itv->i_flags) &&
schedule_timeout(HZ / 100); jiffies < then + msecs_to_jiffies (2000)) {
schedule_timeout(msecs_to_jiffies(10));
} }
/* To convert jiffies to ms, we must multiply by 1000 /* To convert jiffies to ms, we must multiply by 1000
...@@ -821,7 +822,8 @@ int ivtv_stop_v4l2_encode_stream(struct ivtv_stream *s, int gop_end) ...@@ -821,7 +822,8 @@ int ivtv_stop_v4l2_encode_stream(struct ivtv_stream *s, int gop_end)
} else if (read_reg(IVTV_REG_DMASTATUS) & 0x02) { } else if (read_reg(IVTV_REG_DMASTATUS) & 0x02) {
break; break;
} }
} while (!ivtv_sleep_timeout(HZ / 100, 1) && then + HZ * 2 > jiffies); } while (!ivtv_msleep_timeout(10, 1) &&
then + msecs_to_jiffies(2000) > jiffies);
set_current_state(TASK_RUNNING); set_current_state(TASK_RUNNING);
remove_wait_queue(&s->waitq, &wait); remove_wait_queue(&s->waitq, &wait);
...@@ -892,7 +894,7 @@ int ivtv_stop_v4l2_decode_stream(struct ivtv_stream *s, int flags, u64 pts) ...@@ -892,7 +894,7 @@ int ivtv_stop_v4l2_decode_stream(struct ivtv_stream *s, int flags, u64 pts)
break; break;
tmp = data[3]; tmp = data[3];
} }
if (ivtv_sleep_timeout(HZ/10, 1)) if (ivtv_msleep_timeout(100, 1))
break; break;
} }
} }
......
...@@ -86,9 +86,9 @@ static const int disp_modes[8][3] = ...@@ -86,9 +86,9 @@ static const int disp_modes[8][3] =
#define PAGE_WAIT (300*HZ/1000) /* Time between requesting page and */ #define PAGE_WAIT msecs_to_jiffies(300) /* Time between requesting page and */
/* checking status bits */ /* checking status bits */
#define PGBUF_EXPIRE (15*HZ) /* Time to wait before retransmitting */ #define PGBUF_EXPIRE msecs_to_jiffies(15000) /* Time to wait before retransmitting */
/* page regardless of infobits */ /* page regardless of infobits */
typedef struct { typedef struct {
u8 pgbuf[VTX_VIRTUALSIZE]; /* Page-buffer */ u8 pgbuf[VTX_VIRTUALSIZE]; /* Page-buffer */
...@@ -115,8 +115,8 @@ struct saa5249_device ...@@ -115,8 +115,8 @@ struct saa5249_device
#define CCTWR 34 /* IC write/read-address of vtx-chip */ #define CCTWR 34 /* IC write/read-address of vtx-chip */
#define CCTRD 35 #define CCTRD 35
#define NOACK_REPEAT 10 /* Retry access this many times on failure */ #define NOACK_REPEAT 10 /* Retry access this many times on failure */
#define CLEAR_DELAY (HZ/20) /* Time required to clear a page */ #define CLEAR_DELAY msecs_to_jiffies(50) /* Time required to clear a page */
#define READY_TIMEOUT (30*HZ/1000) /* Time to wait for ready signal of IC-bus interface */ #define READY_TIMEOUT msecs_to_jiffies(30) /* Time to wait for ready signal of I2C-bus interface */
#define INIT_DELAY 500 /* Time in usec to wait at initialization of CEA interface */ #define INIT_DELAY 500 /* Time in usec to wait at initialization of CEA interface */
#define START_DELAY 10 /* Time in usec to wait before starting write-cycle (CEA) */ #define START_DELAY 10 /* Time in usec to wait before starting write-cycle (CEA) */
......
...@@ -208,7 +208,7 @@ determine_norm (struct i2c_client *client) ...@@ -208,7 +208,7 @@ determine_norm (struct i2c_client *client)
saa7110_write_block(client, initseq, sizeof(initseq)); saa7110_write_block(client, initseq, sizeof(initseq));
saa7110_selmux(client, decoder->input); saa7110_selmux(client, decoder->input);
prepare_to_wait(&decoder->wq, &wait, TASK_UNINTERRUPTIBLE); prepare_to_wait(&decoder->wq, &wait, TASK_UNINTERRUPTIBLE);
schedule_timeout(HZ/4); schedule_timeout(msecs_to_jiffies(250));
finish_wait(&decoder->wq, &wait); finish_wait(&decoder->wq, &wait);
status = saa7110_read(client); status = saa7110_read(client);
if (status & 0x40) { if (status & 0x40) {
...@@ -249,7 +249,7 @@ determine_norm (struct i2c_client *client) ...@@ -249,7 +249,7 @@ determine_norm (struct i2c_client *client)
//saa7110_write(client,0x2E,0x9A); //saa7110_write(client,0x2E,0x9A);
prepare_to_wait(&decoder->wq, &wait, TASK_UNINTERRUPTIBLE); prepare_to_wait(&decoder->wq, &wait, TASK_UNINTERRUPTIBLE);
schedule_timeout(HZ/4); schedule_timeout(msecs_to_jiffies(250));
finish_wait(&decoder->wq, &wait); finish_wait(&decoder->wq, &wait);
status = saa7110_read(client); status = saa7110_read(client);
......
...@@ -314,7 +314,7 @@ struct saa7134_board { ...@@ -314,7 +314,7 @@ struct saa7134_board {
#define INTERLACE_ON 1 #define INTERLACE_ON 1
#define INTERLACE_OFF 2 #define INTERLACE_OFF 2
#define BUFFER_TIMEOUT (HZ/2) /* 0.5 seconds */ #define BUFFER_TIMEOUT msecs_to_jiffies(500) /* 0.5 seconds */
struct saa7134_dev; struct saa7134_dev;
struct saa7134_dma; struct saa7134_dma;
......
...@@ -290,7 +290,7 @@ static int chip_thread(void *data) ...@@ -290,7 +290,7 @@ static int chip_thread(void *data)
desc->checkmode(chip); desc->checkmode(chip);
/* schedule next check */ /* schedule next check */
mod_timer(&chip->wt, jiffies+2*HZ); mod_timer(&chip->wt, jiffies+msecs_to_jiffies(2000));
} }
v4l_dbg(1, debug, &chip->c, "%s: thread exiting\n", chip->c.name); v4l_dbg(1, debug, &chip->c, "%s: thread exiting\n", chip->c.name);
...@@ -1770,7 +1770,7 @@ static int chip_command(struct i2c_client *client, ...@@ -1770,7 +1770,7 @@ static int chip_command(struct i2c_client *client,
desc->setmode(chip,VIDEO_SOUND_MONO); desc->setmode(chip,VIDEO_SOUND_MONO);
if (chip->prevmode != VIDEO_SOUND_MONO) if (chip->prevmode != VIDEO_SOUND_MONO)
chip->prevmode = -1; /* reset previous mode */ chip->prevmode = -1; /* reset previous mode */
mod_timer(&chip->wt, jiffies+2*HZ); mod_timer(&chip->wt, jiffies+msecs_to_jiffies(2000));
/* the thread will call checkmode() later */ /* the thread will call checkmode() later */
} }
break; break;
......
...@@ -939,16 +939,25 @@ int v4l2_ctrl_query_menu(struct v4l2_querymenu *qmenu, struct v4l2_queryctrl *qc ...@@ -939,16 +939,25 @@ int v4l2_ctrl_query_menu(struct v4l2_querymenu *qmenu, struct v4l2_queryctrl *qc
When no more controls are available 0 is returned. */ When no more controls are available 0 is returned. */
u32 v4l2_ctrl_next(const u32 * const * ctrl_classes, u32 id) u32 v4l2_ctrl_next(const u32 * const * ctrl_classes, u32 id)
{ {
u32 ctrl_class; u32 ctrl_class = V4L2_CTRL_ID2CLASS(id);
const u32 *pctrl; const u32 *pctrl;
/* if no query is desired, then just return the control ID */
if ((id & V4L2_CTRL_FLAG_NEXT_CTRL) == 0)
return id;
if (ctrl_classes == NULL) if (ctrl_classes == NULL)
return 0; return 0;
/* if no query is desired, then check if the ID is part of ctrl_classes */
if ((id & V4L2_CTRL_FLAG_NEXT_CTRL) == 0) {
/* find class */
while (*ctrl_classes && V4L2_CTRL_ID2CLASS(**ctrl_classes) != ctrl_class)
ctrl_classes++;
if (*ctrl_classes == NULL)
return 0;
pctrl = *ctrl_classes;
/* find control ID */
while (*pctrl && *pctrl != id) pctrl++;
return *pctrl ? id : 0;
}
id &= V4L2_CTRL_ID_MASK; id &= V4L2_CTRL_ID_MASK;
ctrl_class = V4L2_CTRL_ID2CLASS(id);
id++; /* select next control */ id++; /* select next control */
/* find first class that matches (or is greater than) the class of /* find first class that matches (or is greater than) the class of
the ID */ the ID */
......
...@@ -2080,7 +2080,7 @@ static int vino_wait_for_frame(struct vino_channel_settings *vcs) ...@@ -2080,7 +2080,7 @@ static int vino_wait_for_frame(struct vino_channel_settings *vcs)
/* to ensure that schedule_timeout will return immediately /* to ensure that schedule_timeout will return immediately
* if VINO interrupt was triggered meanwhile */ * if VINO interrupt was triggered meanwhile */
schedule_timeout_interruptible(HZ / 10); schedule_timeout_interruptible(msecs_to_jiffies(100));
if (signal_pending(current)) if (signal_pending(current))
err = -EINTR; err = -EINTR;
......
...@@ -321,12 +321,14 @@ static int wm8739_probe(struct i2c_adapter *adapter) ...@@ -321,12 +321,14 @@ static int wm8739_probe(struct i2c_adapter *adapter)
static int wm8739_detach(struct i2c_client *client) static int wm8739_detach(struct i2c_client *client)
{ {
struct wm8739_state *state = i2c_get_clientdata(client);
int err; int err;
err = i2c_detach_client(client); err = i2c_detach_client(client);
if (err) if (err)
return err; return err;
kfree(state);
kfree(client); kfree(client);
return 0; return 0;
} }
......
...@@ -222,12 +222,14 @@ static int wm8775_probe(struct i2c_adapter *adapter) ...@@ -222,12 +222,14 @@ static int wm8775_probe(struct i2c_adapter *adapter)
static int wm8775_detach(struct i2c_client *client) static int wm8775_detach(struct i2c_client *client)
{ {
struct wm8775_state *state = i2c_get_clientdata(client);
int err; int err;
err = i2c_detach_client(client); err = i2c_detach_client(client);
if (err) { if (err) {
return err; return err;
} }
kfree(state);
kfree(client); kfree(client);
return 0; return 0;
......
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
#include <linux/compiler.h> /* need __user */ #include <linux/compiler.h> /* need __user */
#else #else
#define __user #define __user
#include <sys/time.h>
#endif #endif
#include <linux/types.h> #include <linux/types.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment