aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorAndreas Oberritter <obi@linuxtv.org>2007-04-02 09:44:35 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-04-02 10:03:05 -0400
commit1489f90a49f0603a393e1800d729050f6e332bec (patch)
tree6a3dbd5358a90da9ff6ba339e10df6c8f8981c33 /drivers/media
parentd420cb44693b8370cbf06c3e31b4b5dec66c9f86 (diff)
V4L/DVB (5496): Pluto2: fix incorrect TSCR register setting
The ADEF bits in the TSCR register have different meanings in read and write mode. For this reason ADEF has to be reset on every read-modify-write operation. This patch introduces a special write function for this register, which takes care of it. Thanks to Holger Magnussen for pointing my nose at this problem. Signed-off-by: Andreas Oberritter <obi@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/dvb/pluto2/pluto2.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/media/dvb/pluto2/pluto2.c b/drivers/media/dvb/pluto2/pluto2.c
index ffda71dfdd65..058df5c10034 100644
--- a/drivers/media/dvb/pluto2/pluto2.c
+++ b/drivers/media/dvb/pluto2/pluto2.c
@@ -149,6 +149,15 @@ static inline void pluto_rw(struct pluto *pluto, u32 reg, u32 mask, u32 bits)
149 writel(val, &pluto->io_mem[reg]); 149 writel(val, &pluto->io_mem[reg]);
150} 150}
151 151
152static void pluto_write_tscr(struct pluto *pluto, u32 val)
153{
154 /* set the number of packets */
155 val &= ~TSCR_ADEF;
156 val |= TS_DMA_PACKETS / 2;
157
158 pluto_writereg(pluto, REG_TSCR, val);
159}
160
152static void pluto_setsda(void *data, int state) 161static void pluto_setsda(void *data, int state)
153{ 162{
154 struct pluto *pluto = data; 163 struct pluto *pluto = data;
@@ -213,11 +222,11 @@ static void pluto_reset_ts(struct pluto *pluto, int reenable)
213 222
214 if (val & TSCR_RSTN) { 223 if (val & TSCR_RSTN) {
215 val &= ~TSCR_RSTN; 224 val &= ~TSCR_RSTN;
216 pluto_writereg(pluto, REG_TSCR, val); 225 pluto_write_tscr(pluto, val);
217 } 226 }
218 if (reenable) { 227 if (reenable) {
219 val |= TSCR_RSTN; 228 val |= TSCR_RSTN;
220 pluto_writereg(pluto, REG_TSCR, val); 229 pluto_write_tscr(pluto, val);
221 } 230 }
222} 231}
223 232
@@ -339,7 +348,7 @@ static irqreturn_t pluto_irq(int irq, void *dev_id)
339 } 348 }
340 349
341 /* ACK the interrupt */ 350 /* ACK the interrupt */
342 pluto_writereg(pluto, REG_TSCR, tscr | TSCR_IACK); 351 pluto_write_tscr(pluto, tscr | TSCR_IACK);
343 352
344 return IRQ_HANDLED; 353 return IRQ_HANDLED;
345} 354}
@@ -348,9 +357,6 @@ static void __devinit pluto_enable_irqs(struct pluto *pluto)
348{ 357{
349 u32 val = pluto_readreg(pluto, REG_TSCR); 358 u32 val = pluto_readreg(pluto, REG_TSCR);
350 359
351 /* set the number of packets */
352 val &= ~TSCR_ADEF;
353 val |= TS_DMA_PACKETS / 2;
354 /* disable AFUL and LOCK interrupts */ 360 /* disable AFUL and LOCK interrupts */
355 val |= (TSCR_MSKA | TSCR_MSKL); 361 val |= (TSCR_MSKA | TSCR_MSKL);
356 /* enable DMA and OVERFLOW interrupts */ 362 /* enable DMA and OVERFLOW interrupts */
@@ -358,7 +364,7 @@ static void __devinit pluto_enable_irqs(struct pluto *pluto)
358 /* clear pending interrupts */ 364 /* clear pending interrupts */
359 val |= TSCR_IACK; 365 val |= TSCR_IACK;
360 366
361 pluto_writereg(pluto, REG_TSCR, val); 367 pluto_write_tscr(pluto, val);
362} 368}
363 369
364static void pluto_disable_irqs(struct pluto *pluto) 370static void pluto_disable_irqs(struct pluto *pluto)
@@ -370,7 +376,7 @@ static void pluto_disable_irqs(struct pluto *pluto)
370 /* clear pending interrupts */ 376 /* clear pending interrupts */
371 val |= TSCR_IACK; 377 val |= TSCR_IACK;
372 378
373 pluto_writereg(pluto, REG_TSCR, val); 379 pluto_write_tscr(pluto, val);
374} 380}
375 381
376static int __devinit pluto_hw_init(struct pluto *pluto) 382static int __devinit pluto_hw_init(struct pluto *pluto)