23 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
29 #include <linux/errno.h>
30 #include <linux/kernel.h>
32 #include <linux/module.h>
35 #include <linux/fcntl.h>
36 #include <linux/slab.h>
48 unsigned int bpl,
u32 risc)
50 unsigned int i, lines;
71 for (i = 0; i < lines; i++) {
88 for (i = 24; i < 80; i += 4)
102 unsigned int bpl,
u32 sync_line,
103 unsigned int lines,
int fifo_enable,
106 unsigned int line,
i;
107 int dist_betwn_starts = bpl * 2;
117 for (line = 0; line < lines; line++) {
124 offset += dist_betwn_starts;
133 unsigned int offset,
u32 sync_line,
134 unsigned int bpl,
unsigned int lines,
135 int fifo_enable,
int field_type)
137 unsigned int line,
i;
140 int dist_betwn_starts = bpl * 2;
152 for (line = 0; line < lines; line++) {
160 offset += dist_betwn_starts;
165 if (fifo_enable && line == 3) {
169 *(rp++) = 0x00000001;
178 unsigned int top_offset,
179 unsigned int bpl,
unsigned int lines)
184 int singlefield_lines = lines >> 1;
185 int odd_num_lines = singlefield_lines;
188 int databuf_offset = 0;
189 int risc_program_size = 0;
191 unsigned int bottom_offset = bpl;
195 odd_num_lines = singlefield_lines + 1;
208 for (frame = 0; frame <
NUM_FRAMES; frame++) {
209 databuf_offset = frame_size *
frame;
211 if (
UNSET != top_offset) {
213 rp = cx25821_risc_field_upstream(dev, rp,
215 databuf_offset, top_offset, 0, bpl,
222 rp = cx25821_risc_field_upstream(dev, rp,
224 databuf_offset, bottom_offset,
225 0x200, bpl, singlefield_lines,
255 pr_info(
"No video file is currently running so return!\n");
313 char mybuf[line_size];
328 frame_offset = (frame_index_temp > 0) ? frame_size : 0;
333 if (IS_ERR(myfile)) {
334 const int open_errno = -PTR_ERR(myfile);
335 pr_err(
"%s(): ERROR opening file(%s) with errno = %d!\n",
337 return PTR_ERR(myfile);
339 if (!(myfile->
f_op)) {
340 pr_err(
"%s(): File has no file operations registered!\n",
346 if (!myfile->
f_op->read) {
347 pr_err(
"%s(): File has no READ operations registered!\n",
360 vfs_read_retval =
vfs_read(myfile, mybuf, line_size,
363 if (vfs_read_retval > 0 && vfs_read_retval == line_size
366 frame_offset / 4), mybuf,
370 file_offset += vfs_read_retval;
371 frame_offset += vfs_read_retval;
373 if (vfs_read_retval < line_size) {
374 pr_info(
"Done: exit %s() since no more bytes to read from Video file\n",
399 pr_err(
"ERROR %s(): since container_of(work_struct) FAILED!\n",
415 char mybuf[line_size];
417 loff_t offset = (
unsigned long)0;
422 if (IS_ERR(myfile)) {
423 const int open_errno = -PTR_ERR(myfile);
424 pr_err(
"%s(): ERROR opening file(%s) with errno = %d!\n",
426 return PTR_ERR(myfile);
428 if (!(myfile->
f_op)) {
429 pr_err(
"%s(): File has no file operations registered!\n",
435 if (!myfile->
f_op->read) {
436 pr_err(
"%s(): File has no READ operations registered! Returning\n",
450 vfs_read_retval =
vfs_read(myfile, mybuf,
453 if (vfs_read_retval > 0
454 && vfs_read_retval == line_size
457 _data_buf_virt_addr +
462 offset += vfs_read_retval;
464 if (vfs_read_retval < line_size) {
465 pr_info(
"Done: exit %s() since no more bytes to read from Video file\n",
474 if (vfs_read_retval < line_size)
508 pr_err(
"FAILED to allocate memory for Risc buffer! Returning\n");
526 pr_err(
"FAILED to allocate memory for data buffer! Returning\n");
541 pr_info(
"Failed creating Video Upstream Risc programs!\n");
558 int odd_risc_prog_size = 0;
572 spin_lock(&dev->
slock);
582 singlefield_lines += 1;
594 risc_phys_jump_addr =
598 rp = cx25821_update_riscprogram(dev,
600 line_size_in_bytes, 0x0,
611 spin_unlock(&dev->
slock);
614 pr_err(
"%s(): Video Received Underflow Error Interrupt!\n",
618 pr_err(
"%s(): Video Received Sync Error Interrupt!\n",
622 pr_err(
"%s(): Video Received OpCode Error Interrupt!\n",
650 sram_ch = dev->
channels[channel_num].sram_channels;
672 int num_lines, odd_num_lines;
676 value = ((pix_format & 0x3) << 12) | (vip_mode & 0x7);
678 value |= dev->
_isNTSC ? 0 : 0x10;
685 num_lines = (height / 2) & 0x3FF;
686 odd_num_lines = num_lines;
691 value = (num_lines << 16) | odd_num_lines;
732 pr_err(
"%s: can't get upstream IRQ %d\n",
758 int data_frame_size = 0;
759 int risc_buffer_size = 0;
763 pr_info(
"Video Channel is still running so return!\n");
768 sram_ch = dev->
channels[channel_select].sram_channels;
774 pr_err(
"create_singlethread_workqueue() for Video FAILED!\n");
791 risc_buffer_size = dev->
_isNTSC ?
815 "/root/vid411.yuv" :
"/root/vidtest.yuv";
819 "/root/pal411.yuv" :
"/root/pal422.yuv";
843 pr_err(
"%s: Failed to set up Video upstream buffers!\n",