aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2013-04-13 05:28:54 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-04-16 17:01:29 -0400
commitbfef0d35e57c08dff295e3203d30f9ca4077415a (patch)
treee8cc8eeab902c7e4eec26a8be3d8a0d56bafa3d4
parent3dd473ca58838f1dd93e915cfa7a5c150186bb0f (diff)
[media] cx25821: make cx25821_sram_channels const
And get rid of the channel0-11 external pointers and two more unused fields in cx25821.h. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/pci/cx25821/cx25821-alsa.c2
-rw-r--r--drivers/media/pci/cx25821/cx25821-audio-upstream.c22
-rw-r--r--drivers/media/pci/cx25821/cx25821-core.c28
-rw-r--r--drivers/media/pci/cx25821/cx25821-video-upstream-ch2.c20
-rw-r--r--drivers/media/pci/cx25821/cx25821-video-upstream.c22
-rw-r--r--drivers/media/pci/cx25821/cx25821-video.c14
-rw-r--r--drivers/media/pci/cx25821/cx25821-video.h15
-rw-r--r--drivers/media/pci/cx25821/cx25821.h26
8 files changed, 57 insertions, 92 deletions
diff --git a/drivers/media/pci/cx25821/cx25821-alsa.c b/drivers/media/pci/cx25821/cx25821-alsa.c
index 1858a45dd081..b3cac75a4891 100644
--- a/drivers/media/pci/cx25821/cx25821-alsa.c
+++ b/drivers/media/pci/cx25821/cx25821-alsa.c
@@ -151,7 +151,7 @@ static int _cx25821_start_audio_dma(struct cx25821_audio_dev *chip)
151{ 151{
152 struct cx25821_audio_buffer *buf = chip->buf; 152 struct cx25821_audio_buffer *buf = chip->buf;
153 struct cx25821_dev *dev = chip->dev; 153 struct cx25821_dev *dev = chip->dev;
154 struct sram_channel *audio_ch = 154 const struct sram_channel *audio_ch =
155 &cx25821_sram_channels[AUDIO_SRAM_CHANNEL]; 155 &cx25821_sram_channels[AUDIO_SRAM_CHANNEL];
156 u32 tmp = 0; 156 u32 tmp = 0;
157 157
diff --git a/drivers/media/pci/cx25821/cx25821-audio-upstream.c b/drivers/media/pci/cx25821/cx25821-audio-upstream.c
index ea973202a66c..b9be535e32b8 100644
--- a/drivers/media/pci/cx25821/cx25821-audio-upstream.c
+++ b/drivers/media/pci/cx25821/cx25821-audio-upstream.c
@@ -45,7 +45,7 @@ static int _intr_msk = FLD_AUD_SRC_RISCI1 | FLD_AUD_SRC_OF |
45 FLD_AUD_SRC_SYNC | FLD_AUD_SRC_OPC_ERR; 45 FLD_AUD_SRC_SYNC | FLD_AUD_SRC_OPC_ERR;
46 46
47static int cx25821_sram_channel_setup_upstream_audio(struct cx25821_dev *dev, 47static int cx25821_sram_channel_setup_upstream_audio(struct cx25821_dev *dev,
48 struct sram_channel *ch, 48 const struct sram_channel *ch,
49 unsigned int bpl, u32 risc) 49 unsigned int bpl, u32 risc)
50{ 50{
51 unsigned int i, lines; 51 unsigned int i, lines;
@@ -106,7 +106,7 @@ static __le32 *cx25821_risc_field_upstream_audio(struct cx25821_dev *dev,
106 int fifo_enable) 106 int fifo_enable)
107{ 107{
108 unsigned int line; 108 unsigned int line;
109 struct sram_channel *sram_ch = 109 const struct sram_channel *sram_ch =
110 dev->channels[dev->_audio_upstream_channel].sram_channels; 110 dev->channels[dev->_audio_upstream_channel].sram_channels;
111 int offset = 0; 111 int offset = 0;
112 112
@@ -215,7 +215,7 @@ static void cx25821_free_memory_audio(struct cx25821_dev *dev)
215 215
216void cx25821_stop_upstream_audio(struct cx25821_dev *dev) 216void cx25821_stop_upstream_audio(struct cx25821_dev *dev)
217{ 217{
218 struct sram_channel *sram_ch = 218 const struct sram_channel *sram_ch =
219 dev->channels[AUDIO_UPSTREAM_SRAM_CHANNEL_B].sram_channels; 219 dev->channels[AUDIO_UPSTREAM_SRAM_CHANNEL_B].sram_channels;
220 u32 tmp = 0; 220 u32 tmp = 0;
221 221
@@ -257,7 +257,7 @@ void cx25821_free_mem_upstream_audio(struct cx25821_dev *dev)
257} 257}
258 258
259static int cx25821_get_audio_data(struct cx25821_dev *dev, 259static int cx25821_get_audio_data(struct cx25821_dev *dev,
260 struct sram_channel *sram_ch) 260 const struct sram_channel *sram_ch)
261{ 261{
262 struct file *myfile; 262 struct file *myfile;
263 int frame_index_temp = dev->_audioframe_index; 263 int frame_index_temp = dev->_audioframe_index;
@@ -352,7 +352,7 @@ static void cx25821_audioups_handler(struct work_struct *work)
352} 352}
353 353
354static int cx25821_openfile_audio(struct cx25821_dev *dev, 354static int cx25821_openfile_audio(struct cx25821_dev *dev,
355 struct sram_channel *sram_ch) 355 const struct sram_channel *sram_ch)
356{ 356{
357 struct file *myfile; 357 struct file *myfile;
358 int i = 0, j = 0; 358 int i = 0, j = 0;
@@ -433,7 +433,7 @@ static int cx25821_openfile_audio(struct cx25821_dev *dev,
433} 433}
434 434
435static int cx25821_audio_upstream_buffer_prepare(struct cx25821_dev *dev, 435static int cx25821_audio_upstream_buffer_prepare(struct cx25821_dev *dev,
436 struct sram_channel *sram_ch, 436 const struct sram_channel *sram_ch,
437 int bpl) 437 int bpl)
438{ 438{
439 int ret = 0; 439 int ret = 0;
@@ -495,7 +495,7 @@ static int cx25821_audio_upstream_irq(struct cx25821_dev *dev, int chan_num,
495{ 495{
496 int i = 0; 496 int i = 0;
497 u32 int_msk_tmp; 497 u32 int_msk_tmp;
498 struct sram_channel *channel = dev->channels[chan_num].sram_channels; 498 const struct sram_channel *channel = dev->channels[chan_num].sram_channels;
499 dma_addr_t risc_phys_jump_addr; 499 dma_addr_t risc_phys_jump_addr;
500 __le32 *rp; 500 __le32 *rp;
501 501
@@ -587,7 +587,7 @@ static irqreturn_t cx25821_upstream_irq_audio(int irq, void *dev_id)
587 struct cx25821_dev *dev = dev_id; 587 struct cx25821_dev *dev = dev_id;
588 u32 audio_status; 588 u32 audio_status;
589 int handled = 0; 589 int handled = 0;
590 struct sram_channel *sram_ch; 590 const struct sram_channel *sram_ch;
591 591
592 if (!dev) 592 if (!dev)
593 return -1; 593 return -1;
@@ -611,7 +611,7 @@ static irqreturn_t cx25821_upstream_irq_audio(int irq, void *dev_id)
611} 611}
612 612
613static void cx25821_wait_fifo_enable(struct cx25821_dev *dev, 613static void cx25821_wait_fifo_enable(struct cx25821_dev *dev,
614 struct sram_channel *sram_ch) 614 const struct sram_channel *sram_ch)
615{ 615{
616 int count = 0; 616 int count = 0;
617 u32 tmp; 617 u32 tmp;
@@ -635,7 +635,7 @@ static void cx25821_wait_fifo_enable(struct cx25821_dev *dev,
635} 635}
636 636
637static int cx25821_start_audio_dma_upstream(struct cx25821_dev *dev, 637static int cx25821_start_audio_dma_upstream(struct cx25821_dev *dev,
638 struct sram_channel *sram_ch) 638 const struct sram_channel *sram_ch)
639{ 639{
640 u32 tmp = 0; 640 u32 tmp = 0;
641 int err = 0; 641 int err = 0;
@@ -699,7 +699,7 @@ fail_irq:
699 699
700int cx25821_audio_upstream_init(struct cx25821_dev *dev, int channel_select) 700int cx25821_audio_upstream_init(struct cx25821_dev *dev, int channel_select)
701{ 701{
702 struct sram_channel *sram_ch; 702 const struct sram_channel *sram_ch;
703 int err = 0; 703 int err = 0;
704 704
705 if (dev->_audio_is_running) { 705 if (dev->_audio_is_running) {
diff --git a/drivers/media/pci/cx25821/cx25821-core.c b/drivers/media/pci/cx25821/cx25821-core.c
index 2b38a5005d0e..48faf6fc273d 100644
--- a/drivers/media/pci/cx25821/cx25821-core.c
+++ b/drivers/media/pci/cx25821/cx25821-core.c
@@ -48,7 +48,7 @@ EXPORT_SYMBOL(cx25821_devlist_mutex);
48LIST_HEAD(cx25821_devlist); 48LIST_HEAD(cx25821_devlist);
49EXPORT_SYMBOL(cx25821_devlist); 49EXPORT_SYMBOL(cx25821_devlist);
50 50
51struct sram_channel cx25821_sram_channels[] = { 51const struct sram_channel cx25821_sram_channels[] = {
52 [SRAM_CH00] = { 52 [SRAM_CH00] = {
53 .i = SRAM_CH00, 53 .i = SRAM_CH00,
54 .name = "VID A", 54 .name = "VID A",
@@ -317,20 +317,6 @@ struct sram_channel cx25821_sram_channels[] = {
317}; 317};
318EXPORT_SYMBOL(cx25821_sram_channels); 318EXPORT_SYMBOL(cx25821_sram_channels);
319 319
320struct sram_channel *channel0 = &cx25821_sram_channels[SRAM_CH00];
321struct sram_channel *channel1 = &cx25821_sram_channels[SRAM_CH01];
322struct sram_channel *channel2 = &cx25821_sram_channels[SRAM_CH02];
323struct sram_channel *channel3 = &cx25821_sram_channels[SRAM_CH03];
324struct sram_channel *channel4 = &cx25821_sram_channels[SRAM_CH04];
325struct sram_channel *channel5 = &cx25821_sram_channels[SRAM_CH05];
326struct sram_channel *channel6 = &cx25821_sram_channels[SRAM_CH06];
327struct sram_channel *channel7 = &cx25821_sram_channels[SRAM_CH07];
328struct sram_channel *channel9 = &cx25821_sram_channels[SRAM_CH09];
329struct sram_channel *channel10 = &cx25821_sram_channels[SRAM_CH10];
330struct sram_channel *channel11 = &cx25821_sram_channels[SRAM_CH11];
331
332struct cx25821_dmaqueue mpegq;
333
334static int cx25821_risc_decode(u32 risc) 320static int cx25821_risc_decode(u32 risc)
335{ 321{
336 static const char * const instr[16] = { 322 static const char * const instr[16] = {
@@ -457,7 +443,7 @@ static void cx25821_registers_init(struct cx25821_dev *dev)
457} 443}
458 444
459int cx25821_sram_channel_setup(struct cx25821_dev *dev, 445int cx25821_sram_channel_setup(struct cx25821_dev *dev,
460 struct sram_channel *ch, 446 const struct sram_channel *ch,
461 unsigned int bpl, u32 risc) 447 unsigned int bpl, u32 risc)
462{ 448{
463 unsigned int i, lines; 449 unsigned int i, lines;
@@ -523,10 +509,9 @@ int cx25821_sram_channel_setup(struct cx25821_dev *dev,
523 509
524 return 0; 510 return 0;
525} 511}
526EXPORT_SYMBOL(cx25821_sram_channel_setup);
527 512
528int cx25821_sram_channel_setup_audio(struct cx25821_dev *dev, 513int cx25821_sram_channel_setup_audio(struct cx25821_dev *dev,
529 struct sram_channel *ch, 514 const struct sram_channel *ch,
530 unsigned int bpl, u32 risc) 515 unsigned int bpl, u32 risc)
531{ 516{
532 unsigned int i, lines; 517 unsigned int i, lines;
@@ -592,7 +577,7 @@ int cx25821_sram_channel_setup_audio(struct cx25821_dev *dev,
592} 577}
593EXPORT_SYMBOL(cx25821_sram_channel_setup_audio); 578EXPORT_SYMBOL(cx25821_sram_channel_setup_audio);
594 579
595void cx25821_sram_channel_dump(struct cx25821_dev *dev, struct sram_channel *ch) 580void cx25821_sram_channel_dump(struct cx25821_dev *dev, const struct sram_channel *ch)
596{ 581{
597 static char *name[] = { 582 static char *name[] = {
598 "init risc lo", 583 "init risc lo",
@@ -652,10 +637,9 @@ void cx25821_sram_channel_dump(struct cx25821_dev *dev, struct sram_channel *ch)
652 pr_warn(" : cnt2_reg: 0x%08x\n", 637 pr_warn(" : cnt2_reg: 0x%08x\n",
653 cx_read(ch->cnt2_reg)); 638 cx_read(ch->cnt2_reg));
654} 639}
655EXPORT_SYMBOL(cx25821_sram_channel_dump);
656 640
657void cx25821_sram_channel_dump_audio(struct cx25821_dev *dev, 641void cx25821_sram_channel_dump_audio(struct cx25821_dev *dev,
658 struct sram_channel *ch) 642 const struct sram_channel *ch)
659{ 643{
660 static const char * const name[] = { 644 static const char * const name[] = {
661 "init risc lo", 645 "init risc lo",
@@ -803,7 +787,7 @@ void cx25821_set_pixel_format(struct cx25821_dev *dev, int channel_select,
803} 787}
804 788
805static void cx25821_set_vip_mode(struct cx25821_dev *dev, 789static void cx25821_set_vip_mode(struct cx25821_dev *dev,
806 struct sram_channel *ch) 790 const struct sram_channel *ch)
807{ 791{
808 cx_write(ch->pix_frmt, PIXEL_FRMT_422); 792 cx_write(ch->pix_frmt, PIXEL_FRMT_422);
809 cx_write(ch->vip_ctl, PIXEL_ENGINE_VIP1); 793 cx_write(ch->vip_ctl, PIXEL_ENGINE_VIP1);
diff --git a/drivers/media/pci/cx25821/cx25821-video-upstream-ch2.c b/drivers/media/pci/cx25821/cx25821-video-upstream-ch2.c
index cf2723c7197f..2381bdce99fd 100644
--- a/drivers/media/pci/cx25821/cx25821-video-upstream-ch2.c
+++ b/drivers/media/pci/cx25821/cx25821-video-upstream-ch2.c
@@ -83,7 +83,7 @@ static __le32 *cx25821_risc_field_upstream_ch2(struct cx25821_dev *dev,
83 int fifo_enable, int field_type) 83 int fifo_enable, int field_type)
84{ 84{
85 unsigned int line, i; 85 unsigned int line, i;
86 struct sram_channel *sram_ch = 86 const struct sram_channel *sram_ch =
87 dev->channels[dev->_channel2_upstream_select].sram_channels; 87 dev->channels[dev->_channel2_upstream_select].sram_channels;
88 int dist_betwn_starts = bpl * 2; 88 int dist_betwn_starts = bpl * 2;
89 89
@@ -201,7 +201,7 @@ static int cx25821_risc_buffer_upstream_ch2(struct cx25821_dev *dev,
201 201
202void cx25821_stop_upstream_video_ch2(struct cx25821_dev *dev) 202void cx25821_stop_upstream_video_ch2(struct cx25821_dev *dev)
203{ 203{
204 struct sram_channel *sram_ch = 204 const struct sram_channel *sram_ch =
205 dev->channels[VID_UPSTREAM_SRAM_CHANNEL_J].sram_channels; 205 dev->channels[VID_UPSTREAM_SRAM_CHANNEL_J].sram_channels;
206 u32 tmp = 0; 206 u32 tmp = 0;
207 207
@@ -257,7 +257,7 @@ void cx25821_free_mem_upstream_ch2(struct cx25821_dev *dev)
257} 257}
258 258
259static int cx25821_get_frame_ch2(struct cx25821_dev *dev, 259static int cx25821_get_frame_ch2(struct cx25821_dev *dev,
260 struct sram_channel *sram_ch) 260 const struct sram_channel *sram_ch)
261{ 261{
262 struct file *myfile; 262 struct file *myfile;
263 int frame_index_temp = dev->_frame_index_ch2; 263 int frame_index_temp = dev->_frame_index_ch2;
@@ -363,7 +363,7 @@ static void cx25821_vidups_handler_ch2(struct work_struct *work)
363} 363}
364 364
365static int cx25821_openfile_ch2(struct cx25821_dev *dev, 365static int cx25821_openfile_ch2(struct cx25821_dev *dev,
366 struct sram_channel *sram_ch) 366 const struct sram_channel *sram_ch)
367{ 367{
368 struct file *myfile; 368 struct file *myfile;
369 int i = 0, j = 0; 369 int i = 0, j = 0;
@@ -445,7 +445,7 @@ static int cx25821_openfile_ch2(struct cx25821_dev *dev,
445} 445}
446 446
447static int cx25821_upstream_buffer_prepare_ch2(struct cx25821_dev *dev, 447static int cx25821_upstream_buffer_prepare_ch2(struct cx25821_dev *dev,
448 struct sram_channel *sram_ch, 448 const struct sram_channel *sram_ch,
449 int bpl) 449 int bpl)
450{ 450{
451 int ret = 0; 451 int ret = 0;
@@ -515,7 +515,7 @@ static int cx25821_video_upstream_irq_ch2(struct cx25821_dev *dev,
515 u32 status) 515 u32 status)
516{ 516{
517 u32 int_msk_tmp; 517 u32 int_msk_tmp;
518 struct sram_channel *channel = dev->channels[chan_num].sram_channels; 518 const struct sram_channel *channel = dev->channels[chan_num].sram_channels;
519 int singlefield_lines = NTSC_FIELD_HEIGHT; 519 int singlefield_lines = NTSC_FIELD_HEIGHT;
520 int line_size_in_bytes = Y422_LINE_SZ; 520 int line_size_in_bytes = Y422_LINE_SZ;
521 int odd_risc_prog_size = 0; 521 int odd_risc_prog_size = 0;
@@ -594,7 +594,7 @@ static irqreturn_t cx25821_upstream_irq_ch2(int irq, void *dev_id)
594 u32 vid_status; 594 u32 vid_status;
595 int handled = 0; 595 int handled = 0;
596 int channel_num = 0; 596 int channel_num = 0;
597 struct sram_channel *sram_ch; 597 const struct sram_channel *sram_ch;
598 598
599 if (!dev) 599 if (!dev)
600 return -1; 600 return -1;
@@ -618,7 +618,7 @@ static irqreturn_t cx25821_upstream_irq_ch2(int irq, void *dev_id)
618} 618}
619 619
620static void cx25821_set_pixelengine_ch2(struct cx25821_dev *dev, 620static void cx25821_set_pixelengine_ch2(struct cx25821_dev *dev,
621 struct sram_channel *ch, int pix_format) 621 const struct sram_channel *ch, int pix_format)
622{ 622{
623 int width = WIDTH_D1; 623 int width = WIDTH_D1;
624 int height = dev->_lines_count_ch2; 624 int height = dev->_lines_count_ch2;
@@ -652,7 +652,7 @@ static void cx25821_set_pixelengine_ch2(struct cx25821_dev *dev,
652} 652}
653 653
654static int cx25821_start_video_dma_upstream_ch2(struct cx25821_dev *dev, 654static int cx25821_start_video_dma_upstream_ch2(struct cx25821_dev *dev,
655 struct sram_channel *sram_ch) 655 const struct sram_channel *sram_ch)
656{ 656{
657 u32 tmp = 0; 657 u32 tmp = 0;
658 int err = 0; 658 int err = 0;
@@ -706,7 +706,7 @@ fail_irq:
706int cx25821_vidupstream_init_ch2(struct cx25821_dev *dev, int channel_select, 706int cx25821_vidupstream_init_ch2(struct cx25821_dev *dev, int channel_select,
707 int pixel_format) 707 int pixel_format)
708{ 708{
709 struct sram_channel *sram_ch; 709 const struct sram_channel *sram_ch;
710 u32 tmp; 710 u32 tmp;
711 int err = 0; 711 int err = 0;
712 int data_frame_size = 0; 712 int data_frame_size = 0;
diff --git a/drivers/media/pci/cx25821/cx25821-video-upstream.c b/drivers/media/pci/cx25821/cx25821-video-upstream.c
index 7fc97110d973..223aae77c7eb 100644
--- a/drivers/media/pci/cx25821/cx25821-video-upstream.c
+++ b/drivers/media/pci/cx25821/cx25821-video-upstream.c
@@ -44,7 +44,7 @@ static int _intr_msk = FLD_VID_SRC_RISC1 | FLD_VID_SRC_UF | FLD_VID_SRC_SYNC |
44 FLD_VID_SRC_OPC_ERR; 44 FLD_VID_SRC_OPC_ERR;
45 45
46int cx25821_sram_channel_setup_upstream(struct cx25821_dev *dev, 46int cx25821_sram_channel_setup_upstream(struct cx25821_dev *dev,
47 struct sram_channel *ch, 47 const struct sram_channel *ch,
48 unsigned int bpl, u32 risc) 48 unsigned int bpl, u32 risc)
49{ 49{
50 unsigned int i, lines; 50 unsigned int i, lines;
@@ -135,7 +135,7 @@ static __le32 *cx25821_risc_field_upstream(struct cx25821_dev *dev, __le32 * rp,
135 int fifo_enable, int field_type) 135 int fifo_enable, int field_type)
136{ 136{
137 unsigned int line, i; 137 unsigned int line, i;
138 struct sram_channel *sram_ch = 138 const struct sram_channel *sram_ch =
139 dev->channels[dev->_channel_upstream_select].sram_channels; 139 dev->channels[dev->_channel_upstream_select].sram_channels;
140 int dist_betwn_starts = bpl * 2; 140 int dist_betwn_starts = bpl * 2;
141 141
@@ -247,7 +247,7 @@ static int cx25821_risc_buffer_upstream(struct cx25821_dev *dev,
247 247
248void cx25821_stop_upstream_video_ch1(struct cx25821_dev *dev) 248void cx25821_stop_upstream_video_ch1(struct cx25821_dev *dev)
249{ 249{
250 struct sram_channel *sram_ch = 250 const struct sram_channel *sram_ch =
251 dev->channels[VID_UPSTREAM_SRAM_CHANNEL_I].sram_channels; 251 dev->channels[VID_UPSTREAM_SRAM_CHANNEL_I].sram_channels;
252 u32 tmp = 0; 252 u32 tmp = 0;
253 253
@@ -301,7 +301,7 @@ void cx25821_free_mem_upstream_ch1(struct cx25821_dev *dev)
301} 301}
302 302
303static int cx25821_get_frame(struct cx25821_dev *dev, 303static int cx25821_get_frame(struct cx25821_dev *dev,
304 struct sram_channel *sram_ch) 304 const struct sram_channel *sram_ch)
305{ 305{
306 struct file *myfile; 306 struct file *myfile;
307 int frame_index_temp = dev->_frame_index; 307 int frame_index_temp = dev->_frame_index;
@@ -407,7 +407,7 @@ static void cx25821_vidups_handler(struct work_struct *work)
407} 407}
408 408
409static int cx25821_openfile(struct cx25821_dev *dev, 409static int cx25821_openfile(struct cx25821_dev *dev,
410 struct sram_channel *sram_ch) 410 const struct sram_channel *sram_ch)
411{ 411{
412 struct file *myfile; 412 struct file *myfile;
413 int i = 0, j = 0; 413 int i = 0, j = 0;
@@ -489,7 +489,7 @@ static int cx25821_openfile(struct cx25821_dev *dev,
489} 489}
490 490
491static int cx25821_upstream_buffer_prepare(struct cx25821_dev *dev, 491static int cx25821_upstream_buffer_prepare(struct cx25821_dev *dev,
492 struct sram_channel *sram_ch, 492 const struct sram_channel *sram_ch,
493 int bpl) 493 int bpl)
494{ 494{
495 int ret = 0; 495 int ret = 0;
@@ -555,7 +555,7 @@ static int cx25821_video_upstream_irq(struct cx25821_dev *dev, int chan_num,
555 u32 status) 555 u32 status)
556{ 556{
557 u32 int_msk_tmp; 557 u32 int_msk_tmp;
558 struct sram_channel *channel = dev->channels[chan_num].sram_channels; 558 const struct sram_channel *channel = dev->channels[chan_num].sram_channels;
559 int singlefield_lines = NTSC_FIELD_HEIGHT; 559 int singlefield_lines = NTSC_FIELD_HEIGHT;
560 int line_size_in_bytes = Y422_LINE_SZ; 560 int line_size_in_bytes = Y422_LINE_SZ;
561 int odd_risc_prog_size = 0; 561 int odd_risc_prog_size = 0;
@@ -643,7 +643,7 @@ static irqreturn_t cx25821_upstream_irq(int irq, void *dev_id)
643 u32 vid_status; 643 u32 vid_status;
644 int handled = 0; 644 int handled = 0;
645 int channel_num = 0; 645 int channel_num = 0;
646 struct sram_channel *sram_ch; 646 const struct sram_channel *sram_ch;
647 647
648 if (!dev) 648 if (!dev)
649 return -1; 649 return -1;
@@ -668,7 +668,7 @@ static irqreturn_t cx25821_upstream_irq(int irq, void *dev_id)
668} 668}
669 669
670static void cx25821_set_pixelengine(struct cx25821_dev *dev, 670static void cx25821_set_pixelengine(struct cx25821_dev *dev,
671 struct sram_channel *ch, 671 const struct sram_channel *ch,
672 int pix_format) 672 int pix_format)
673{ 673{
674 int width = WIDTH_D1; 674 int width = WIDTH_D1;
@@ -701,7 +701,7 @@ static void cx25821_set_pixelengine(struct cx25821_dev *dev,
701} 701}
702 702
703static int cx25821_start_video_dma_upstream(struct cx25821_dev *dev, 703static int cx25821_start_video_dma_upstream(struct cx25821_dev *dev,
704 struct sram_channel *sram_ch) 704 const struct sram_channel *sram_ch)
705{ 705{
706 u32 tmp = 0; 706 u32 tmp = 0;
707 int err = 0; 707 int err = 0;
@@ -755,7 +755,7 @@ fail_irq:
755int cx25821_vidupstream_init_ch1(struct cx25821_dev *dev, int channel_select, 755int cx25821_vidupstream_init_ch1(struct cx25821_dev *dev, int channel_select,
756 int pixel_format) 756 int pixel_format)
757{ 757{
758 struct sram_channel *sram_ch; 758 const struct sram_channel *sram_ch;
759 u32 tmp; 759 u32 tmp;
760 int err = 0; 760 int err = 0;
761 int data_frame_size = 0; 761 int data_frame_size = 0;
diff --git a/drivers/media/pci/cx25821/cx25821-video.c b/drivers/media/pci/cx25821/cx25821-video.c
index 7cd888581f9e..c418e0d38c24 100644
--- a/drivers/media/pci/cx25821/cx25821-video.c
+++ b/drivers/media/pci/cx25821/cx25821-video.c
@@ -258,7 +258,7 @@ int cx25821_video_mux(struct cx25821_dev *dev, unsigned int input)
258int cx25821_start_video_dma(struct cx25821_dev *dev, 258int cx25821_start_video_dma(struct cx25821_dev *dev,
259 struct cx25821_dmaqueue *q, 259 struct cx25821_dmaqueue *q,
260 struct cx25821_buffer *buf, 260 struct cx25821_buffer *buf,
261 struct sram_channel *channel) 261 const struct sram_channel *channel)
262{ 262{
263 int tmp = 0; 263 int tmp = 0;
264 264
@@ -285,7 +285,7 @@ int cx25821_start_video_dma(struct cx25821_dev *dev,
285 285
286static int cx25821_restart_video_queue(struct cx25821_dev *dev, 286static int cx25821_restart_video_queue(struct cx25821_dev *dev,
287 struct cx25821_dmaqueue *q, 287 struct cx25821_dmaqueue *q,
288 struct sram_channel *channel) 288 const struct sram_channel *channel)
289{ 289{
290 struct cx25821_buffer *buf, *prev; 290 struct cx25821_buffer *buf, *prev;
291 struct list_head *item; 291 struct list_head *item;
@@ -338,7 +338,7 @@ static void cx25821_vid_timeout(unsigned long data)
338{ 338{
339 struct cx25821_data *timeout_data = (struct cx25821_data *)data; 339 struct cx25821_data *timeout_data = (struct cx25821_data *)data;
340 struct cx25821_dev *dev = timeout_data->dev; 340 struct cx25821_dev *dev = timeout_data->dev;
341 struct sram_channel *channel = timeout_data->channel; 341 const struct sram_channel *channel = timeout_data->channel;
342 struct cx25821_dmaqueue *q = &dev->channels[channel->i].vidq; 342 struct cx25821_dmaqueue *q = &dev->channels[channel->i].vidq;
343 struct cx25821_buffer *buf; 343 struct cx25821_buffer *buf;
344 unsigned long flags; 344 unsigned long flags;
@@ -365,7 +365,7 @@ int cx25821_video_irq(struct cx25821_dev *dev, int chan_num, u32 status)
365 u32 count = 0; 365 u32 count = 0;
366 int handled = 0; 366 int handled = 0;
367 u32 mask; 367 u32 mask;
368 struct sram_channel *channel = dev->channels[chan_num].sram_channels; 368 const struct sram_channel *channel = dev->channels[chan_num].sram_channels;
369 369
370 mask = cx_read(channel->int_msk); 370 mask = cx_read(channel->int_msk);
371 if (0 == (status & mask)) 371 if (0 == (status & mask))
@@ -787,9 +787,11 @@ static int video_release(struct file *file)
787{ 787{
788 struct cx25821_fh *fh = file->private_data; 788 struct cx25821_fh *fh = file->private_data;
789 struct cx25821_dev *dev = fh->dev; 789 struct cx25821_dev *dev = fh->dev;
790 const struct sram_channel *sram_ch =
791 dev->channels[0].sram_channels;
790 792
791 /* stop the risc engine and fifo */ 793 /* stop the risc engine and fifo */
792 cx_write(channel0->dma_ctl, 0); /* FIFO and RISC disable */ 794 cx_write(sram_ch->dma_ctl, 0); /* FIFO and RISC disable */
793 795
794 /* stop video capture */ 796 /* stop video capture */
795 if (cx25821_res_check(fh, RESOURCE_VIDEO0)) { 797 if (cx25821_res_check(fh, RESOURCE_VIDEO0)) {
@@ -923,7 +925,7 @@ static int vidioc_log_status(struct file *file, void *priv)
923{ 925{
924 struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev; 926 struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev;
925 struct cx25821_fh *fh = priv; 927 struct cx25821_fh *fh = priv;
926 struct sram_channel *sram_ch = 928 const struct sram_channel *sram_ch =
927 dev->channels[fh->channel_id].sram_channels; 929 dev->channels[fh->channel_id].sram_channels;
928 u32 tmp = 0; 930 u32 tmp = 0;
929 931
diff --git a/drivers/media/pci/cx25821/cx25821-video.h b/drivers/media/pci/cx25821/cx25821-video.h
index eb12e35d6de1..505b7f0b45b4 100644
--- a/drivers/media/pci/cx25821/cx25821-video.h
+++ b/drivers/media/pci/cx25821/cx25821-video.h
@@ -63,19 +63,6 @@ do { \
63#define MEDUSA_READ 910 63#define MEDUSA_READ 910
64#define MEDUSA_WRITE 911 64#define MEDUSA_WRITE 911
65 65
66extern struct sram_channel *channel0;
67extern struct sram_channel *channel1;
68extern struct sram_channel *channel2;
69extern struct sram_channel *channel3;
70extern struct sram_channel *channel4;
71extern struct sram_channel *channel5;
72extern struct sram_channel *channel6;
73extern struct sram_channel *channel7;
74extern struct sram_channel *channel9;
75extern struct sram_channel *channel10;
76extern struct sram_channel *channel11;
77/* extern const u32 *ctrl_classes[]; */
78
79extern unsigned int vid_limit; 66extern unsigned int vid_limit;
80 67
81#define FORMAT_FLAGS_PACKED 0x01 68#define FORMAT_FLAGS_PACKED 0x01
@@ -98,7 +85,7 @@ extern int cx25821_video_mux(struct cx25821_dev *dev, unsigned int input);
98extern int cx25821_start_video_dma(struct cx25821_dev *dev, 85extern int cx25821_start_video_dma(struct cx25821_dev *dev,
99 struct cx25821_dmaqueue *q, 86 struct cx25821_dmaqueue *q,
100 struct cx25821_buffer *buf, 87 struct cx25821_buffer *buf,
101 struct sram_channel *channel); 88 const struct sram_channel *channel);
102 89
103extern int cx25821_set_scale(struct cx25821_dev *dev, unsigned int width, 90extern int cx25821_set_scale(struct cx25821_dev *dev, unsigned int width,
104 unsigned int height, enum v4l2_field field); 91 unsigned int height, enum v4l2_field field);
diff --git a/drivers/media/pci/cx25821/cx25821.h b/drivers/media/pci/cx25821/cx25821.h
index fdeecdf09ef5..d7e71f46defc 100644
--- a/drivers/media/pci/cx25821/cx25821.h
+++ b/drivers/media/pci/cx25821/cx25821.h
@@ -126,20 +126,11 @@ struct cx25821_fh {
126 126
127 enum v4l2_priority prio; 127 enum v4l2_priority prio;
128 128
129 /* video overlay */
130 struct v4l2_window win;
131 struct v4l2_clip *clips;
132 unsigned int nclips;
133
134 /* video capture */ 129 /* video capture */
135 struct cx25821_fmt *fmt; 130 struct cx25821_fmt *fmt;
136 unsigned int width, height; 131 unsigned int width, height;
137 int channel_id; 132 int channel_id;
138 struct videobuf_queue vidq; 133 struct videobuf_queue vidq;
139
140 /* H264 Encoder specifics ONLY */
141 struct videobuf_queue mpegq;
142 atomic_t v4l_reading;
143}; 134};
144 135
145enum cx25821_itype { 136enum cx25821_itype {
@@ -222,7 +213,7 @@ struct cx25821_dmaqueue {
222 213
223struct cx25821_data { 214struct cx25821_data {
224 struct cx25821_dev *dev; 215 struct cx25821_dev *dev;
225 struct sram_channel *channel; 216 const struct sram_channel *channel;
226}; 217};
227 218
228struct cx25821_channel { 219struct cx25821_channel {
@@ -237,7 +228,7 @@ struct cx25821_channel {
237 struct video_device *video_dev; 228 struct video_device *video_dev;
238 struct cx25821_dmaqueue vidq; 229 struct cx25821_dmaqueue vidq;
239 230
240 struct sram_channel *sram_channels; 231 const struct sram_channel *sram_channels;
241 232
242 struct mutex lock; 233 struct mutex lock;
243 int resources; 234 int resources;
@@ -470,7 +461,8 @@ struct sram_channel {
470 u32 jumponly; 461 u32 jumponly;
471 u32 irq_bit; 462 u32 irq_bit;
472}; 463};
473extern struct sram_channel cx25821_sram_channels[]; 464
465extern const struct sram_channel cx25821_sram_channels[];
474 466
475#define STATUS_SUCCESS 0 467#define STATUS_SUCCESS 0
476#define STATUS_UNSUCCESSFUL -1 468#define STATUS_UNSUCCESSFUL -1
@@ -518,7 +510,7 @@ extern int medusa_set_saturation(struct cx25821_dev *dev, int saturation,
518 int decoder); 510 int decoder);
519 511
520extern int cx25821_sram_channel_setup(struct cx25821_dev *dev, 512extern int cx25821_sram_channel_setup(struct cx25821_dev *dev,
521 struct sram_channel *ch, unsigned int bpl, 513 const struct sram_channel *ch, unsigned int bpl,
522 u32 risc); 514 u32 risc);
523 515
524extern int cx25821_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc, 516extern int cx25821_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc,
@@ -537,16 +529,16 @@ extern void cx25821_free_buffer(struct videobuf_queue *q,
537extern int cx25821_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc, 529extern int cx25821_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc,
538 u32 reg, u32 mask, u32 value); 530 u32 reg, u32 mask, u32 value);
539extern void cx25821_sram_channel_dump(struct cx25821_dev *dev, 531extern void cx25821_sram_channel_dump(struct cx25821_dev *dev,
540 struct sram_channel *ch); 532 const struct sram_channel *ch);
541extern void cx25821_sram_channel_dump_audio(struct cx25821_dev *dev, 533extern void cx25821_sram_channel_dump_audio(struct cx25821_dev *dev,
542 struct sram_channel *ch); 534 const struct sram_channel *ch);
543 535
544extern struct cx25821_dev *cx25821_dev_get(struct pci_dev *pci); 536extern struct cx25821_dev *cx25821_dev_get(struct pci_dev *pci);
545extern void cx25821_print_irqbits(char *name, char *tag, char **strings, 537extern void cx25821_print_irqbits(char *name, char *tag, char **strings,
546 int len, u32 bits, u32 mask); 538 int len, u32 bits, u32 mask);
547extern void cx25821_dev_unregister(struct cx25821_dev *dev); 539extern void cx25821_dev_unregister(struct cx25821_dev *dev);
548extern int cx25821_sram_channel_setup_audio(struct cx25821_dev *dev, 540extern int cx25821_sram_channel_setup_audio(struct cx25821_dev *dev,
549 struct sram_channel *ch, 541 const struct sram_channel *ch,
550 unsigned int bpl, u32 risc); 542 unsigned int bpl, u32 risc);
551 543
552extern int cx25821_vidupstream_init_ch1(struct cx25821_dev *dev, 544extern int cx25821_vidupstream_init_ch1(struct cx25821_dev *dev,
@@ -570,7 +562,7 @@ extern void cx25821_stop_upstream_video_ch1(struct cx25821_dev *dev);
570extern void cx25821_stop_upstream_video_ch2(struct cx25821_dev *dev); 562extern void cx25821_stop_upstream_video_ch2(struct cx25821_dev *dev);
571extern void cx25821_stop_upstream_audio(struct cx25821_dev *dev); 563extern void cx25821_stop_upstream_audio(struct cx25821_dev *dev);
572extern int cx25821_sram_channel_setup_upstream(struct cx25821_dev *dev, 564extern int cx25821_sram_channel_setup_upstream(struct cx25821_dev *dev,
573 struct sram_channel *ch, 565 const struct sram_channel *ch,
574 unsigned int bpl, u32 risc); 566 unsigned int bpl, u32 risc);
575extern void cx25821_set_pixel_format(struct cx25821_dev *dev, int channel, 567extern void cx25821_set_pixel_format(struct cx25821_dev *dev, int channel,
576 u32 format); 568 u32 format);