Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 72028
b: refs/heads/master
c: c458473
h: refs/heads/master
v: v3
  • Loading branch information
Maxim Levitsky authored and Mauro Carvalho Chehab committed Oct 22, 2007
1 parent c5eb0b7 commit b3535f4
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7e7f05ca156d34b80e53105e4ef9bc1497a68439
refs/heads/master: c458473ebf31755373ca2f8063c9ec9744205924
42 changes: 34 additions & 8 deletions trunk/drivers/media/video/saa7134/saa7134-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ int saa7134_set_dmabits(struct saa7134_dev *dev)

assert_spin_locked(&dev->slock);

if (dev->inresume)
if (dev->insuspend)
return 0;

/* video capture -- dma 0 + video task A */
Expand Down Expand Up @@ -563,6 +563,9 @@ static irqreturn_t saa7134_irq(int irq, void *dev_id)
unsigned long report,status;
int loop, handled = 0;

if (dev->insuspend)
goto out;

for (loop = 0; loop < 10; loop++) {
report = saa_readl(SAA7134_IRQ_REPORT);
status = saa_readl(SAA7134_IRQ_STATUS);
Expand Down Expand Up @@ -1163,6 +1166,7 @@ static void __devexit saa7134_finidev(struct pci_dev *pci_dev)
kfree(dev);
}

#ifdef CONFIG_PM
static int saa7134_suspend(struct pci_dev *pci_dev , pm_message_t state)
{

Expand All @@ -1176,6 +1180,17 @@ static int saa7134_suspend(struct pci_dev *pci_dev , pm_message_t state)
saa_writel(SAA7134_IRQ2, 0);
saa_writel(SAA7134_MAIN_CTRL, 0);

synchronize_irq(pci_dev->irq);
dev->insuspend = 1;

/* Disable timeout timers - if we have active buffers, we will
fill them on resume*/

del_timer(&dev->video_q.timeout);
del_timer(&dev->vbi_q.timeout);
del_timer(&dev->ts_q.timeout);
saa7134_ir_stop(dev);

pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state));
pci_save_state(pci_dev);

Expand All @@ -1194,38 +1209,47 @@ static int saa7134_resume(struct pci_dev *pci_dev)
/* Do things that are done in saa7134_initdev ,
except of initializing memory structures.*/

dev->inresume = 1;
saa7134_board_init1(dev);

/* saa7134_hwinit1 */
if (saa7134_boards[dev->board].video_out)
saa7134_videoport_init(dev);

if (card_has_mpeg(dev))
saa7134_ts_init_hw(dev);

if (dev->remote)
saa7134_ir_start(dev, dev->remote);
saa7134_hw_enable1(dev);
saa7134_set_decoder(dev);
saa7134_i2c_call_clients(dev, VIDIOC_S_STD, &dev->tvnorm->id);


saa7134_board_init2(dev);
saa7134_hw_enable2(dev);

/*saa7134_hwinit2*/
saa7134_set_tvnorm_hw(dev);
saa7134_tvaudio_setmute(dev);
saa7134_tvaudio_setvolume(dev, dev->ctl_volume);
saa7134_tvaudio_do_scan(dev);
saa7134_enable_i2s(dev);
saa7134_hw_enable2(dev);

/*resume unfinished buffer(s)*/
spin_lock_irqsave(&dev->slock, flags);
saa7134_buffer_requeue(dev, &dev->video_q);
saa7134_buffer_requeue(dev, &dev->vbi_q);
saa7134_buffer_requeue(dev, &dev->ts_q);

/* FIXME: Disable DMA audio sound - temporary till proper support
is implemented*/

dev->dmasound.dma_running = 0;

/* start DMA now*/
dev->inresume = 0;
dev->insuspend = 0;
saa7134_set_dmabits(dev);
spin_unlock_irqrestore(&dev->slock, flags);

return 0;
}
#endif

/* ----------------------------------------------------------- */

Expand Down Expand Up @@ -1262,8 +1286,10 @@ static struct pci_driver saa7134_pci_driver = {
.id_table = saa7134_pci_tbl,
.probe = saa7134_initdev,
.remove = __devexit_p(saa7134_finidev),
#ifdef CONFIG_PM
.suspend = saa7134_suspend,
.resume = saa7134_resume
#endif
};

static int saa7134_init(void)
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/media/video/saa7134/saa7134-input.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ static void saa7134_input_timer(unsigned long data)
mod_timer(&ir->timer, jiffies + msecs_to_jiffies(ir->polling));
}

static void saa7134_ir_start(struct saa7134_dev *dev, struct card_ir *ir)
void saa7134_ir_start(struct saa7134_dev *dev, struct card_ir *ir)
{
if (ir->polling) {
setup_timer(&ir->timer, saa7134_input_timer,
Expand All @@ -182,7 +182,7 @@ static void saa7134_ir_start(struct saa7134_dev *dev, struct card_ir *ir)
}
}

static void saa7134_ir_stop(struct saa7134_dev *dev)
void saa7134_ir_stop(struct saa7134_dev *dev)
{
if (dev->remote->polling)
del_timer_sync(&dev->remote->timer);
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/media/video/saa7134/saa7134-tvaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ static void mute_input_7134(struct saa7134_dev *dev)
}

if (dev->hw_mute == mute &&
dev->hw_input == in && !dev->inresume) {
dev->hw_input == in && !dev->insuspend) {
dprintk("mute/input: nothing to do [mute=%d,input=%s]\n",
mute,in->name);
return;
Expand Down
25 changes: 16 additions & 9 deletions trunk/drivers/media/video/saa7134/saa7134-video.c
Original file line number Diff line number Diff line change
Expand Up @@ -560,15 +560,8 @@ void set_tvnorm(struct saa7134_dev *dev, struct saa7134_tvnorm *norm)

dev->crop_current = dev->crop_defrect;

saa7134_set_decoder(dev);
saa7134_set_tvnorm_hw(dev);

if (card_in(dev, dev->ctl_input).tv) {
if ((card(dev).tuner_type == TUNER_PHILIPS_TDA8290)
&& ((card(dev).tuner_config == 1)
|| (card(dev).tuner_config == 2)))
saa7134_set_gpio(dev, 22, 5);
saa7134_i2c_call_clients(dev, VIDIOC_S_STD, &norm->id);
}
}

static void video_mux(struct saa7134_dev *dev, int input)
Expand All @@ -579,7 +572,8 @@ static void video_mux(struct saa7134_dev *dev, int input)
saa7134_tvaudio_setinput(dev, &card_in(dev, input));
}

void saa7134_set_decoder(struct saa7134_dev *dev)

static void saa7134_set_decoder(struct saa7134_dev *dev)
{
int luma_control, sync_control, mux;

Expand Down Expand Up @@ -630,6 +624,19 @@ void saa7134_set_decoder(struct saa7134_dev *dev)
saa_writeb(SAA7134_RAW_DATA_OFFSET, 0x80);
}

void saa7134_set_tvnorm_hw(struct saa7134_dev *dev)
{
saa7134_set_decoder(dev);

if (card_in(dev, dev->ctl_input).tv) {
if ((card(dev).tuner_type == TUNER_PHILIPS_TDA8290)
&& ((card(dev).tuner_config == 1)
|| (card(dev).tuner_config == 2)))
saa7134_set_gpio(dev, 22, 5);
saa7134_i2c_call_clients(dev, VIDIOC_S_STD, &dev->tvnorm->id);
}
}

static void set_h_prescale(struct saa7134_dev *dev, int task, int prescale)
{
static const struct {
Expand Down
6 changes: 4 additions & 2 deletions trunk/drivers/media/video/saa7134/saa7134.h
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ struct saa7134_dev {
unsigned int hw_mute;
int last_carrier;
int nosignal;
unsigned int inresume;
unsigned int insuspend;

/* SAA7134_MPEG_* */
struct saa7134_ts ts;
Expand Down Expand Up @@ -632,7 +632,7 @@ extern struct video_device saa7134_radio_template;

void set_tvnorm(struct saa7134_dev *dev, struct saa7134_tvnorm *norm);
int saa7134_videoport_init(struct saa7134_dev *dev);
void saa7134_set_decoder(struct saa7134_dev *dev);
void saa7134_set_tvnorm_hw(struct saa7134_dev *dev);

int saa7134_common_ioctl(struct saa7134_dev *dev,
unsigned int cmd, void *arg);
Expand Down Expand Up @@ -706,6 +706,8 @@ int saa7134_input_init1(struct saa7134_dev *dev);
void saa7134_input_fini(struct saa7134_dev *dev);
void saa7134_input_irq(struct saa7134_dev *dev);
void saa7134_set_i2c_ir(struct saa7134_dev *dev, struct IR_i2c *ir);
void saa7134_ir_start(struct saa7134_dev *dev, struct card_ir *ir);
void saa7134_ir_stop(struct saa7134_dev *dev);


/*
Expand Down

0 comments on commit b3535f4

Please sign in to comment.