Commit 6d8c2ba1 authored by Palash Bandyopadhyay's avatar Palash Bandyopadhyay Committed by Mauro Carvalho Chehab

V4L/DVB: cx25821: Removed duplicate code and cleaned up

Signed-off-by: default avatarPalash Bandyopadhyay <Palash.Bandyopadhyay@conexant.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent fab81259
cx25821-objs := cx25821-core.o cx25821-cards.o cx25821-i2c.o cx25821-gpio.o \ cx25821-objs := cx25821-core.o cx25821-cards.o cx25821-i2c.o \
cx25821-medusa-video.o cx25821-video.o cx25821-video0.o cx25821-video1.o \ cx25821-gpio.o cx25821-medusa-video.o \
cx25821-video2.o cx25821-video3.o cx25821-video4.o cx25821-video5.o \ cx25821-video.o cx25821-video-upstream.o \
cx25821-video6.o cx25821-video7.o cx25821-vidups9.o cx25821-vidups10.o \ cx25821-video-upstream-ch2.o \
cx25821-audups11.o cx25821-video-upstream.o cx25821-video-upstream-ch2.o \ cx25821-audio-upstream.o
cx25821-audio-upstream.o cx25821-videoioctl.o
obj-$(CONFIG_VIDEO_CX25821) += cx25821.o obj-$(CONFIG_VIDEO_CX25821) += cx25821.o
obj-$(CONFIG_VIDEO_CX25821_ALSA) += cx25821-alsa.o obj-$(CONFIG_VIDEO_CX25821_ALSA) += cx25821-alsa.o
......
...@@ -106,7 +106,7 @@ static __le32 *cx25821_risc_field_upstream_audio(struct cx25821_dev *dev, ...@@ -106,7 +106,7 @@ static __le32 *cx25821_risc_field_upstream_audio(struct cx25821_dev *dev,
{ {
unsigned int line; unsigned int line;
struct sram_channel *sram_ch = struct sram_channel *sram_ch =
&dev->sram_channels[dev->_audio_upstream_channel_select]; dev->channels[dev->_audio_upstream_channel_select].sram_channels;
int offset = 0; int offset = 0;
/* scan lines */ /* scan lines */
...@@ -217,7 +217,7 @@ void cx25821_free_memory_audio(struct cx25821_dev *dev) ...@@ -217,7 +217,7 @@ void cx25821_free_memory_audio(struct cx25821_dev *dev)
void cx25821_stop_upstream_audio(struct cx25821_dev *dev) void cx25821_stop_upstream_audio(struct cx25821_dev *dev)
{ {
struct sram_channel *sram_ch = struct sram_channel *sram_ch =
&dev->sram_channels[AUDIO_UPSTREAM_SRAM_CHANNEL_B]; dev->channels[AUDIO_UPSTREAM_SRAM_CHANNEL_B].sram_channels;
u32 tmp = 0; u32 tmp = 0;
if (!dev->_audio_is_running) { if (!dev->_audio_is_running) {
...@@ -353,8 +353,9 @@ static void cx25821_audioups_handler(struct work_struct *work) ...@@ -353,8 +353,9 @@ static void cx25821_audioups_handler(struct work_struct *work)
} }
cx25821_get_audio_data(dev, cx25821_get_audio_data(dev,
&dev->sram_channels[dev-> dev->channels[dev->
_audio_upstream_channel_select]); _audio_upstream_channel_select].
sram_channels);
} }
int cx25821_openfile_audio(struct cx25821_dev *dev, int cx25821_openfile_audio(struct cx25821_dev *dev,
...@@ -505,7 +506,7 @@ int cx25821_audio_upstream_irq(struct cx25821_dev *dev, int chan_num, ...@@ -505,7 +506,7 @@ int cx25821_audio_upstream_irq(struct cx25821_dev *dev, int chan_num,
{ {
int i = 0; int i = 0;
u32 int_msk_tmp; u32 int_msk_tmp;
struct sram_channel *channel = &dev->sram_channels[chan_num]; struct sram_channel *channel = dev->channels[chan_num].sram_channels;
dma_addr_t risc_phys_jump_addr; dma_addr_t risc_phys_jump_addr;
__le32 *rp; __le32 *rp;
...@@ -607,7 +608,8 @@ static irqreturn_t cx25821_upstream_irq_audio(int irq, void *dev_id) ...@@ -607,7 +608,8 @@ static irqreturn_t cx25821_upstream_irq_audio(int irq, void *dev_id)
if (!dev) if (!dev)
return -1; return -1;
sram_ch = &dev->sram_channels[dev->_audio_upstream_channel_select]; sram_ch = dev->channels[dev->_audio_upstream_channel_select].
sram_channels;
msk_stat = cx_read(sram_ch->int_mstat); msk_stat = cx_read(sram_ch->int_mstat);
audio_status = cx_read(sram_ch->int_stat); audio_status = cx_read(sram_ch->int_stat);
...@@ -731,7 +733,7 @@ int cx25821_audio_upstream_init(struct cx25821_dev *dev, int channel_select) ...@@ -731,7 +733,7 @@ int cx25821_audio_upstream_init(struct cx25821_dev *dev, int channel_select)
} }
dev->_audio_upstream_channel_select = channel_select; dev->_audio_upstream_channel_select = channel_select;
sram_ch = &dev->sram_channels[channel_select]; sram_ch = dev->channels[channel_select].sram_channels;
/* Work queue */ /* Work queue */
INIT_WORK(&dev->_audio_work_entry, cx25821_audioups_handler); INIT_WORK(&dev->_audio_work_entry, cx25821_audioups_handler);
......
...@@ -27,24 +27,25 @@ ...@@ -27,24 +27,25 @@
#define LINES_PER_BUFFER 15 #define LINES_PER_BUFFER 15
#define AUDIO_LINE_SIZE 128 #define AUDIO_LINE_SIZE 128
//Number of buffer programs to use at once. /* Number of buffer programs to use at once. */
#define NUMBER_OF_PROGRAMS 8 #define NUMBER_OF_PROGRAMS 8
//Max size of the RISC program for a buffer. - worst case is 2 writes per line /*
// Space is also added for the 4 no-op instructions added on the end. Max size of the RISC program for a buffer. - worst case is 2 writes per line
Space is also added for the 4 no-op instructions added on the end.
*/
#ifndef USE_RISC_NOOP #ifndef USE_RISC_NOOP
#define MAX_BUFFER_PROGRAM_SIZE \ #define MAX_BUFFER_PROGRAM_SIZE \
(2*LINES_PER_BUFFER*RISC_WRITE_INSTRUCTION_SIZE + RISC_WRITECR_INSTRUCTION_SIZE*4) (2*LINES_PER_BUFFER*RISC_WRITE_INSTRUCTION_SIZE + RISC_WRITECR_INSTRUCTION_SIZE*4)
#endif #endif
// MAE 12 July 2005 Try to use NOOP RISC instruction instead /* MAE 12 July 2005 Try to use NOOP RISC instruction instead */
#ifdef USE_RISC_NOOP #ifdef USE_RISC_NOOP
#define MAX_BUFFER_PROGRAM_SIZE \ #define MAX_BUFFER_PROGRAM_SIZE \
(2*LINES_PER_BUFFER*RISC_WRITE_INSTRUCTION_SIZE + RISC_NOOP_INSTRUCTION_SIZE*4) (2*LINES_PER_BUFFER*RISC_WRITE_INSTRUCTION_SIZE + RISC_NOOP_INSTRUCTION_SIZE*4)
#endif #endif
//Sizes of various instructions in bytes. Used when adding instructions. /* Sizes of various instructions in bytes. Used when adding instructions. */
#define RISC_WRITE_INSTRUCTION_SIZE 12 #define RISC_WRITE_INSTRUCTION_SIZE 12
#define RISC_JUMP_INSTRUCTION_SIZE 12 #define RISC_JUMP_INSTRUCTION_SIZE 12
#define RISC_SKIP_INSTRUCTION_SIZE 4 #define RISC_SKIP_INSTRUCTION_SIZE 4
......
This diff is collapsed.
...@@ -781,14 +781,14 @@ static void cx25821_shutdown(struct cx25821_dev *dev) ...@@ -781,14 +781,14 @@ static void cx25821_shutdown(struct cx25821_dev *dev)
/* Disable Video A/B activity */ /* Disable Video A/B activity */
for (i = 0; i < VID_CHANNEL_NUM; i++) { for (i = 0; i < VID_CHANNEL_NUM; i++) {
cx_write(dev->sram_channels[i].dma_ctl, 0); cx_write(dev->channels[i].sram_channels->dma_ctl, 0);
cx_write(dev->sram_channels[i].int_msk, 0); cx_write(dev->channels[i].sram_channels->int_msk, 0);
} }
for (i = VID_UPSTREAM_SRAM_CHANNEL_I; i <= VID_UPSTREAM_SRAM_CHANNEL_J; for (i = VID_UPSTREAM_SRAM_CHANNEL_I; i <= VID_UPSTREAM_SRAM_CHANNEL_J;
i++) { i++) {
cx_write(dev->sram_channels[i].dma_ctl, 0); cx_write(dev->channels[i].sram_channels->dma_ctl, 0);
cx_write(dev->sram_channels[i].int_msk, 0); cx_write(dev->channels[i].sram_channels->int_msk, 0);
} }
/* Disable Audio activity */ /* Disable Audio activity */
...@@ -805,12 +805,10 @@ static void cx25821_shutdown(struct cx25821_dev *dev) ...@@ -805,12 +805,10 @@ static void cx25821_shutdown(struct cx25821_dev *dev)
void cx25821_set_pixel_format(struct cx25821_dev *dev, int channel_select, void cx25821_set_pixel_format(struct cx25821_dev *dev, int channel_select,
u32 format) u32 format)
{ {
struct sram_channel *ch;
if (channel_select <= 7 && channel_select >= 0) { if (channel_select <= 7 && channel_select >= 0) {
ch = &cx25821_sram_channels[channel_select]; cx_write(dev->channels[channel_select].
cx_write(ch->pix_frmt, format); sram_channels->pix_frmt, format);
dev->pixel_formats[channel_select] = format; dev->channels[channel_select].pixel_formats = format;
} }
} }
...@@ -831,7 +829,7 @@ static void cx25821_initialize(struct cx25821_dev *dev) ...@@ -831,7 +829,7 @@ static void cx25821_initialize(struct cx25821_dev *dev)
cx_write(PCI_INT_STAT, 0xffffffff); cx_write(PCI_INT_STAT, 0xffffffff);
for (i = 0; i < VID_CHANNEL_NUM; i++) for (i = 0; i < VID_CHANNEL_NUM; i++)
cx_write(dev->sram_channels[i].int_stat, 0xffffffff); cx_write(dev->channels[i].sram_channels->int_stat, 0xffffffff);
cx_write(AUD_A_INT_STAT, 0xffffffff); cx_write(AUD_A_INT_STAT, 0xffffffff);
cx_write(AUD_B_INT_STAT, 0xffffffff); cx_write(AUD_B_INT_STAT, 0xffffffff);
...@@ -845,20 +843,21 @@ static void cx25821_initialize(struct cx25821_dev *dev) ...@@ -845,20 +843,21 @@ static void cx25821_initialize(struct cx25821_dev *dev)
mdelay(100); mdelay(100);
for (i = 0; i < VID_CHANNEL_NUM; i++) { for (i = 0; i < VID_CHANNEL_NUM; i++) {
cx25821_set_vip_mode(dev, &dev->sram_channels[i]); cx25821_set_vip_mode(dev, dev->channels[i].sram_channels);
cx25821_sram_channel_setup(dev, &dev->sram_channels[i], 1440, cx25821_sram_channel_setup(dev, dev->channels[i].sram_channels,
0); 1440, 0);
dev->pixel_formats[i] = PIXEL_FRMT_422; dev->channels[i].pixel_formats = PIXEL_FRMT_422;
dev->use_cif_resolution[i] = FALSE; dev->channels[i].use_cif_resolution = FALSE;
} }
/* Probably only affect Downstream */ /* Probably only affect Downstream */
for (i = VID_UPSTREAM_SRAM_CHANNEL_I; i <= VID_UPSTREAM_SRAM_CHANNEL_J; for (i = VID_UPSTREAM_SRAM_CHANNEL_I; i <= VID_UPSTREAM_SRAM_CHANNEL_J;
i++) { i++) {
cx25821_set_vip_mode(dev, &dev->sram_channels[i]); cx25821_set_vip_mode(dev, dev->channels[i].sram_channels);
} }
cx25821_sram_channel_setup_audio(dev, &dev->sram_channels[SRAM_CH08], cx25821_sram_channel_setup_audio(dev,
dev->channels[SRAM_CH08].sram_channels,
128, 0); 128, 0);
cx25821_gpio_init(dev); cx25821_gpio_init(dev);
...@@ -902,21 +901,6 @@ static int cx25821_dev_setup(struct cx25821_dev *dev) ...@@ -902,21 +901,6 @@ static int cx25821_dev_setup(struct cx25821_dev *dev)
{ {
int io_size = 0, i; int io_size = 0, i;
struct video_device *video_template[] = {
&cx25821_video_template0,
&cx25821_video_template1,
&cx25821_video_template2,
&cx25821_video_template3,
&cx25821_video_template4,
&cx25821_video_template5,
&cx25821_video_template6,
&cx25821_video_template7,
&cx25821_video_template9,
&cx25821_video_template10,
&cx25821_video_template11,
&cx25821_videoioctl_template,
};
printk(KERN_INFO "\n***********************************\n"); printk(KERN_INFO "\n***********************************\n");
printk(KERN_INFO "cx25821 set up\n"); printk(KERN_INFO "cx25821 set up\n");
printk(KERN_INFO "***********************************\n\n"); printk(KERN_INFO "***********************************\n\n");
...@@ -947,7 +931,8 @@ static int cx25821_dev_setup(struct cx25821_dev *dev) ...@@ -947,7 +931,8 @@ static int cx25821_dev_setup(struct cx25821_dev *dev)
/* Apply a sensible clock frequency for the PCIe bridge */ /* Apply a sensible clock frequency for the PCIe bridge */
dev->clk_freq = 28000000; dev->clk_freq = 28000000;
dev->sram_channels = cx25821_sram_channels; for (i = 0; i < MAX_VID_CHANNEL_NUM; i++)
dev->channels[i].sram_channels = &cx25821_sram_channels[i];
if (dev->nr > 1) if (dev->nr > 1)
CX25821_INFO("dev->nr > 1!"); CX25821_INFO("dev->nr > 1!");
...@@ -970,7 +955,6 @@ static int cx25821_dev_setup(struct cx25821_dev *dev) ...@@ -970,7 +955,6 @@ static int cx25821_dev_setup(struct cx25821_dev *dev)
dev->i2c_bus[0].reg_wdata = I2C1_WDATA; dev->i2c_bus[0].reg_wdata = I2C1_WDATA;
dev->i2c_bus[0].i2c_period = (0x07 << 24); /* 1.95MHz */ dev->i2c_bus[0].i2c_period = (0x07 << 24); /* 1.95MHz */
if (cx25821_get_resources(dev) < 0) { if (cx25821_get_resources(dev) < 0) {
printk(KERN_ERR "%s No more PCIe resources for " printk(KERN_ERR "%s No more PCIe resources for "
"subsystem: %04x:%04x\n", "subsystem: %04x:%04x\n",
...@@ -1018,37 +1002,24 @@ static int cx25821_dev_setup(struct cx25821_dev *dev) ...@@ -1018,37 +1002,24 @@ static int cx25821_dev_setup(struct cx25821_dev *dev)
dev->i2c_bus[0].i2c_rc); dev->i2c_bus[0].i2c_rc);
cx25821_card_setup(dev); cx25821_card_setup(dev);
medusa_video_init(dev);
for (i = 0; i < VID_CHANNEL_NUM; i++) { if (medusa_video_init(dev) < 0)
if (cx25821_video_register(dev, i, video_template[i]) < 0) { CX25821_ERR("%s() Failed to initialize medusa!\n"
printk(KERN_ERR , __func__);
"%s() Failed to register analog video adapters on VID channel %d\n",
__func__, i);
}
}
for (i = VID_UPSTREAM_SRAM_CHANNEL_I; cx25821_video_register(dev);
i <= AUDIO_UPSTREAM_SRAM_CHANNEL_B; i++) {
/* Since we don't have template8 for Audio Downstream */
if (cx25821_video_register(dev, i, video_template[i - 1]) < 0) {
printk(KERN_ERR
"%s() Failed to register analog video adapters for Upstream channel %d.\n",
__func__, i);
}
}
/* register IOCTL device */ /* register IOCTL device */
dev->ioctl_dev = dev->ioctl_dev =
cx25821_vdev_init(dev, dev->pci, video_template[VIDEO_IOCTL_CH], cx25821_vdev_init(dev, dev->pci, &cx25821_videoioctl_template,
"video"); "video");
if (video_register_device if (video_register_device
(dev->ioctl_dev, VFL_TYPE_GRABBER, VIDEO_IOCTL_CH) < 0) { (dev->ioctl_dev, VFL_TYPE_GRABBER, VIDEO_IOCTL_CH) < 0) {
cx25821_videoioctl_unregister(dev); cx25821_videoioctl_unregister(dev);
printk(KERN_ERR printk(KERN_ERR
"%s() Failed to register video adapter for IOCTL so releasing.\n", "%s() Failed to register video adapter for IOCTL, so \
__func__); unregistering videoioctl device.\n", __func__);
} }
cx25821_dev_checkrevision(dev); cx25821_dev_checkrevision(dev);
...@@ -1371,7 +1342,8 @@ static irqreturn_t cx25821_irq(int irq, void *dev_id) ...@@ -1371,7 +1342,8 @@ static irqreturn_t cx25821_irq(int irq, void *dev_id)
for (i = 0; i < VID_CHANNEL_NUM; i++) { for (i = 0; i < VID_CHANNEL_NUM; i++) {
if (pci_status & mask[i]) { if (pci_status & mask[i]) {
vid_status = cx_read(dev->sram_channels[i].int_stat); vid_status = cx_read(dev->channels[i].
sram_channels->int_stat);
if (vid_status) if (vid_status)
handled += handled +=
......
...@@ -282,6 +282,9 @@ static u32 cx25821_functionality(struct i2c_adapter *adap) ...@@ -282,6 +282,9 @@ static u32 cx25821_functionality(struct i2c_adapter *adap)
static struct i2c_algorithm cx25821_i2c_algo_template = { static struct i2c_algorithm cx25821_i2c_algo_template = {
.master_xfer = i2c_xfer, .master_xfer = i2c_xfer,
.functionality = cx25821_functionality, .functionality = cx25821_functionality,
#ifdef NEED_ALGO_CONTROL
.algo_control = dummy_algo_control,
#endif
}; };
static struct i2c_adapter cx25821_i2c_adap_template = { static struct i2c_adapter cx25821_i2c_adap_template = {
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#ifndef _MEDUSA_DEF_H_ #ifndef _MEDUSA_DEF_H_
#define _MEDUSA_DEF_H_ #define _MEDUSA_DEF_H_
// Video deocder that we supported /* Video deocder that we supported */
#define VDEC_A 0 #define VDEC_A 0
#define VDEC_B 1 #define VDEC_B 1
#define VDEC_C 2 #define VDEC_C 2
...@@ -33,19 +33,10 @@ ...@@ -33,19 +33,10 @@
#define VDEC_G 6 #define VDEC_G 6
#define VDEC_H 7 #define VDEC_H 7
//#define AUTO_SWITCH_BIT[] = { 8, 9, 10, 11, 12, 13, 14, 15 }; /* end of display sequence */
// The following bit position enables automatic source switching for decoder A-H.
// Display index per camera.
//#define VDEC_INDEX[] = {0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7};
// Select input bit to video decoder A-H.
//#define CH_SRC_SEL_BIT[] = {24, 25, 26, 27, 28, 29, 30, 31};
// end of display sequence
#define END_OF_SEQ 0xF; #define END_OF_SEQ 0xF;
// registry string size /* registry string size */
#define MAX_REGISTRY_SZ 40; #define MAX_REGISTRY_SZ 40;
#endif #endif
...@@ -23,11 +23,11 @@ ...@@ -23,11 +23,11 @@
#ifndef __MEDUSA_REGISTERS__ #ifndef __MEDUSA_REGISTERS__
#define __MEDUSA_REGISTERS__ #define __MEDUSA_REGISTERS__
// Serial Slave Registers /* Serial Slave Registers */
#define HOST_REGISTER1 0x0000 #define HOST_REGISTER1 0x0000
#define HOST_REGISTER2 0x0001 #define HOST_REGISTER2 0x0001
// Chip Configuration Registers /* Chip Configuration Registers */
#define CHIP_CTRL 0x0100 #define CHIP_CTRL 0x0100
#define AFE_AB_CTRL 0x0104 #define AFE_AB_CTRL 0x0104
#define AFE_CD_CTRL 0x0108 #define AFE_CD_CTRL 0x0108
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
#define ABIST_CLAMP_E 0x01F4 #define ABIST_CLAMP_E 0x01F4
#define ABIST_CLAMP_F 0x01F8 #define ABIST_CLAMP_F 0x01F8
// Digital Video Encoder A Registers /* Digital Video Encoder A Registers */
#define DENC_A_REG_1 0x0200 #define DENC_A_REG_1 0x0200
#define DENC_A_REG_2 0x0204 #define DENC_A_REG_2 0x0204
#define DENC_A_REG_3 0x0208 #define DENC_A_REG_3 0x0208
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
#define DENC_A_REG_7 0x0218 #define DENC_A_REG_7 0x0218
#define DENC_A_REG_8 0x021C #define DENC_A_REG_8 0x021C
// Digital Video Encoder B Registers /* Digital Video Encoder B Registers */
#define DENC_B_REG_1 0x0300 #define DENC_B_REG_1 0x0300
#define DENC_B_REG_2 0x0304 #define DENC_B_REG_2 0x0304
#define DENC_B_REG_3 0x0308 #define DENC_B_REG_3 0x0308
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
#define DENC_B_REG_7 0x0318 #define DENC_B_REG_7 0x0318
#define DENC_B_REG_8 0x031C #define DENC_B_REG_8 0x031C
// Video Decoder A Registers /* Video Decoder A Registers */
#define MODE_CTRL 0x1000 #define MODE_CTRL 0x1000
#define OUT_CTRL1 0x1004 #define OUT_CTRL1 0x1004
#define OUT_CTRL_NS 0x1008 #define OUT_CTRL_NS 0x1008
...@@ -153,7 +153,7 @@ ...@@ -153,7 +153,7 @@
#define VERSION 0x11F8 #define VERSION 0x11F8
#define SOFT_RST_CTRL 0x11FC #define SOFT_RST_CTRL 0x11FC
// Video Decoder B Registers /* Video Decoder B Registers */
#define VDEC_B_MODE_CTRL 0x1200 #define VDEC_B_MODE_CTRL 0x1200
#define VDEC_B_OUT_CTRL1 0x1204 #define VDEC_B_OUT_CTRL1 0x1204
#define VDEC_B_OUT_CTRL_NS 0x1208 #define VDEC_B_OUT_CTRL_NS 0x1208
...@@ -194,7 +194,7 @@ ...@@ -194,7 +194,7 @@
#define VDEC_B_VERSION 0x13F8 #define VDEC_B_VERSION 0x13F8
#define VDEC_B_SOFT_RST_CTRL 0x13FC #define VDEC_B_SOFT_RST_CTRL 0x13FC
// Video Decoder C Registers /* Video Decoder C Registers */
#define VDEC_C_MODE_CTRL 0x1400 #define VDEC_C_MODE_CTRL 0x1400
#define VDEC_C_OUT_CTRL1 0x1404 #define VDEC_C_OUT_CTRL1 0x1404
#define VDEC_C_OUT_CTRL_NS 0x1408 #define VDEC_C_OUT_CTRL_NS 0x1408
...@@ -235,7 +235,7 @@ ...@@ -235,7 +235,7 @@
#define VDEC_C_VERSION 0x15F8 #define VDEC_C_VERSION 0x15F8
#define VDEC_C_SOFT_RST_CTRL 0x15FC #define VDEC_C_SOFT_RST_CTRL 0x15FC
// Video Decoder D Registers /* Video Decoder D Registers */
#define VDEC_D_MODE_CTRL 0x1600 #define VDEC_D_MODE_CTRL 0x1600
#define VDEC_D_OUT_CTRL1 0x1604 #define VDEC_D_OUT_CTRL1 0x1604
#define VDEC_D_OUT_CTRL_NS 0x1608 #define VDEC_D_OUT_CTRL_NS 0x1608
...@@ -276,7 +276,7 @@ ...@@ -276,7 +276,7 @@
#define VDEC_D_VERSION 0x17F8 #define VDEC_D_VERSION 0x17F8
#define VDEC_D_SOFT_RST_CTRL 0x17FC #define VDEC_D_SOFT_RST_CTRL 0x17FC
// Video Decoder E Registers /* Video Decoder E Registers */
#define VDEC_E_MODE_CTRL 0x1800 #define VDEC_E_MODE_CTRL 0x1800
#define VDEC_E_OUT_CTRL1 0x1804 #define VDEC_E_OUT_CTRL1 0x1804
#define VDEC_E_OUT_CTRL_NS 0x1808 #define VDEC_E_OUT_CTRL_NS 0x1808
...@@ -317,7 +317,7 @@ ...@@ -317,7 +317,7 @@
#define VDEC_E_VERSION 0x19F8 #define VDEC_E_VERSION 0x19F8
#define VDEC_E_SOFT_RST_CTRL 0x19FC #define VDEC_E_SOFT_RST_CTRL 0x19FC
// Video Decoder F Registers /* Video Decoder F Registers */
#define VDEC_F_MODE_CTRL 0x1A00 #define VDEC_F_MODE_CTRL 0x1A00
#define VDEC_F_OUT_CTRL1 0x1A04 #define VDEC_F_OUT_CTRL1 0x1A04
#define VDEC_F_OUT_CTRL_NS 0x1A08 #define VDEC_F_OUT_CTRL_NS 0x1A08
...@@ -358,7 +358,7 @@ ...@@ -358,7 +358,7 @@
#define VDEC_F_VERSION 0x1BF8 #define VDEC_F_VERSION 0x1BF8
#define VDEC_F_SOFT_RST_CTRL 0x1BFC #define VDEC_F_SOFT_RST_CTRL 0x1BFC
// Video Decoder G Registers /* Video Decoder G Registers */
#define VDEC_G_MODE_CTRL 0x1C00 #define VDEC_G_MODE_CTRL 0x1C00
#define VDEC_G_OUT_CTRL1 0x1C04 #define VDEC_G_OUT_CTRL1 0x1C04
#define VDEC_G_OUT_CTRL_NS 0x1C08 #define VDEC_G_OUT_CTRL_NS 0x1C08
...@@ -399,7 +399,7 @@ ...@@ -399,7 +399,7 @@
#define VDEC_G_VERSION 0x1DF8 #define VDEC_G_VERSION 0x1DF8
#define VDEC_G_SOFT_RST_CTRL 0x1DFC #define VDEC_G_SOFT_RST_CTRL 0x1DFC
// Video Decoder H Registers /* Video Decoder H Registers */
#define VDEC_H_MODE_CTRL 0x1E00 #define VDEC_H_MODE_CTRL 0x1E00
#define VDEC_H_OUT_CTRL1 0x1E04 #define VDEC_H_OUT_CTRL1 0x1E04
#define VDEC_H_OUT_CTRL_NS 0x1E08 #define VDEC_H_OUT_CTRL_NS 0x1E08
...@@ -440,14 +440,14 @@ ...@@ -440,14 +440,14 @@
#define VDEC_H_VERSION 0x1FF8 #define VDEC_H_VERSION 0x1FF8
#define VDEC_H_SOFT_RST_CTRL 0x1FFC #define VDEC_H_SOFT_RST_CTRL 0x1FFC
//***************************************************************************** /*****************************************************************************/
// LUMA_CTRL register fields /* LUMA_CTRL register fields */
#define VDEC_A_BRITE_CTRL 0x1014 #define VDEC_A_BRITE_CTRL 0x1014
#define VDEC_A_CNTRST_CTRL 0x1015 #define VDEC_A_CNTRST_CTRL 0x1015
#define VDEC_A_PEAK_SEL 0x1016 #define VDEC_A_PEAK_SEL 0x1016
//***************************************************************************** /*****************************************************************************/
// CHROMA_CTRL register fields /* CHROMA_CTRL register fields */
#define VDEC_A_USAT_CTRL 0x1018 #define VDEC_A_USAT_CTRL 0x1018
#define VDEC_A_VSAT_CTRL 0x1019 #define VDEC_A_VSAT_CTRL 0x1019
#define VDEC_A_HUE_CTRL 0x101A #define VDEC_A_HUE_CTRL 0x101A
......
...@@ -778,9 +778,9 @@ int medusa_set_saturation(struct cx25821_dev *dev, int saturation, int decoder) ...@@ -778,9 +778,9 @@ int medusa_set_saturation(struct cx25821_dev *dev, int saturation, int decoder)
int medusa_video_init(struct cx25821_dev *dev) int medusa_video_init(struct cx25821_dev *dev)
{ {
u32 value, tmp = 0; u32 value = 0, tmp = 0;
int ret_val; int ret_val = 0;
int i; int i = 0;
mutex_lock(&dev->lock); mutex_lock(&dev->lock);
...@@ -790,6 +790,7 @@ int medusa_video_init(struct cx25821_dev *dev) ...@@ -790,6 +790,7 @@ int medusa_video_init(struct cx25821_dev *dev)
value = cx25821_i2c_read(&dev->i2c_bus[0], MON_A_CTRL, &tmp); value = cx25821_i2c_read(&dev->i2c_bus[0], MON_A_CTRL, &tmp);
value &= 0xFFFFF0FF; value &= 0xFFFFF0FF;
ret_val = cx25821_i2c_write(&dev->i2c_bus[0], MON_A_CTRL, value); ret_val = cx25821_i2c_write(&dev->i2c_bus[0], MON_A_CTRL, value);
if (ret_val < 0) if (ret_val < 0)
goto error; goto error;
...@@ -797,6 +798,7 @@ int medusa_video_init(struct cx25821_dev *dev) ...@@ -797,6 +798,7 @@ int medusa_video_init(struct cx25821_dev *dev)
value = cx25821_i2c_read(&dev->i2c_bus[0], MON_A_CTRL, &tmp); value = cx25821_i2c_read(&dev->i2c_bus[0], MON_A_CTRL, &tmp);
value &= 0xFFFFFFDF; value &= 0xFFFFFFDF;
ret_val = cx25821_i2c_write(&dev->i2c_bus[0], MON_A_CTRL, value); ret_val = cx25821_i2c_write(&dev->i2c_bus[0], MON_A_CTRL, value);
if (ret_val < 0) if (ret_val < 0)
goto error; goto error;
...@@ -812,6 +814,7 @@ int medusa_video_init(struct cx25821_dev *dev) ...@@ -812,6 +814,7 @@ int medusa_video_init(struct cx25821_dev *dev)
value &= 0xFF70FF70; value &= 0xFF70FF70;
value |= 0x00090008; /* set en_active */ value |= 0x00090008; /* set en_active */
ret_val = cx25821_i2c_write(&dev->i2c_bus[0], DENC_AB_CTRL, value); ret_val = cx25821_i2c_write(&dev->i2c_bus[0], DENC_AB_CTRL, value);
if (ret_val < 0) if (ret_val < 0)
goto error; goto error;
...@@ -826,8 +829,10 @@ int medusa_video_init(struct cx25821_dev *dev) ...@@ -826,8 +829,10 @@ int medusa_video_init(struct cx25821_dev *dev)
/* select AFE clock to output mode */ /* select AFE clock to output mode */
value = cx25821_i2c_read(&dev->i2c_bus[0], AFE_AB_DIAG_CTRL, &tmp); value = cx25821_i2c_read(&dev->i2c_bus[0], AFE_AB_DIAG_CTRL, &tmp);
value &= 0x83FFFFFF; value &= 0x83FFFFFF;
ret_val = cx25821_i2c_write(&dev->i2c_bus[0], AFE_AB_DIAG_CTRL, ret_val =
cx25821_i2c_write(&dev->i2c_bus[0], AFE_AB_DIAG_CTRL,
value | 0x10000000); value | 0x10000000);
if (ret_val < 0) if (ret_val < 0)
goto error; goto error;
...@@ -849,12 +854,15 @@ int medusa_video_init(struct cx25821_dev *dev) ...@@ -849,12 +854,15 @@ int medusa_video_init(struct cx25821_dev *dev)
value |= 7; value |= 7;
ret_val = cx25821_i2c_write(&dev->i2c_bus[0], PIN_OE_CTRL, value); ret_val = cx25821_i2c_write(&dev->i2c_bus[0], PIN_OE_CTRL, value);
if (ret_val < 0) if (ret_val < 0)
goto error; goto error;
mutex_unlock(&dev->lock); mutex_unlock(&dev->lock);
ret_val = medusa_set_videostandard(dev); ret_val = medusa_set_videostandard(dev);
return ret_val; return ret_val;
error: error:
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include "cx25821-medusa-defines.h" #include "cx25821-medusa-defines.h"
// Color control constants /* Color control constants */
#define VIDEO_PROCAMP_MIN 0 #define VIDEO_PROCAMP_MIN 0
#define VIDEO_PROCAMP_MAX 10000 #define VIDEO_PROCAMP_MAX 10000
#define UNSIGNED_BYTE_MIN 0 #define UNSIGNED_BYTE_MIN 0
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#define SIGNED_BYTE_MIN -128 #define SIGNED_BYTE_MIN -128
#define SIGNED_BYTE_MAX 127 #define SIGNED_BYTE_MAX 127
// Default video color settings /* Default video color settings */
#define SHARPNESS_DEFAULT 50 #define SHARPNESS_DEFAULT 50
#define SATURATION_DEFAULT 5000 #define SATURATION_DEFAULT 5000
#define BRIGHTNESS_DEFAULT 6200 #define BRIGHTNESS_DEFAULT 6200
......
...@@ -48,17 +48,17 @@ ...@@ -48,17 +48,17 @@
#define RISC_SYNC_EVEN_VBI 0x00000207 #define RISC_SYNC_EVEN_VBI 0x00000207
#define RISC_NOOP 0xF0000000 #define RISC_NOOP 0xF0000000
//***************************************************************************** /*****************************************************************************
// ASB SRAM * ASB SRAM
//***************************************************************************** *****************************************************************************/
#define TX_SRAM 0x000000 // Transmit SRAM #define TX_SRAM 0x000000 // Transmit SRAM
//***************************************************************************** /*****************************************************************************/
#define RX_RAM 0x010000 // Receive SRAM #define RX_RAM 0x010000 // Receive SRAM
//***************************************************************************** /*****************************************************************************
// Application Layer (AL) * Application Layer (AL)
//***************************************************************************** *****************************************************************************/
#define DEV_CNTRL2 0x040000 // Device control #define DEV_CNTRL2 0x040000 // Device control
#define FLD_RUN_RISC 0x00000020 #define FLD_RUN_RISC 0x00000020
......
...@@ -134,7 +134,7 @@ static __le32 *cx25821_risc_field_upstream(struct cx25821_dev *dev, __le32 * rp, ...@@ -134,7 +134,7 @@ static __le32 *cx25821_risc_field_upstream(struct cx25821_dev *dev, __le32 * rp,
{ {
unsigned int line, i; unsigned int line, i;
struct sram_channel *sram_ch = struct sram_channel *sram_ch =
&dev->sram_channels[dev->_channel_upstream_select]; dev->channels[dev->_channel_upstream_select].sram_channels;
int dist_betwn_starts = bpl * 2; int dist_betwn_starts = bpl * 2;
/* sync instruction */ /* sync instruction */
...@@ -253,7 +253,7 @@ int cx25821_risc_buffer_upstream(struct cx25821_dev *dev, ...@@ -253,7 +253,7 @@ int cx25821_risc_buffer_upstream(struct cx25821_dev *dev,
void cx25821_stop_upstream_video_ch1(struct cx25821_dev *dev) void cx25821_stop_upstream_video_ch1(struct cx25821_dev *dev)
{ {
struct sram_channel *sram_ch = struct sram_channel *sram_ch =
&dev->sram_channels[VID_UPSTREAM_SRAM_CHANNEL_I]; dev->channels[VID_UPSTREAM_SRAM_CHANNEL_I].sram_channels;
u32 tmp = 0; u32 tmp = 0;
if (!dev->_is_running) { if (!dev->_is_running) {
...@@ -346,19 +346,22 @@ int cx25821_get_frame(struct cx25821_dev *dev, struct sram_channel *sram_ch) ...@@ -346,19 +346,22 @@ int cx25821_get_frame(struct cx25821_dev *dev, struct sram_channel *sram_ch)
if (IS_ERR(myfile)) { if (IS_ERR(myfile)) {
const int open_errno = -PTR_ERR(myfile); const int open_errno = -PTR_ERR(myfile);
printk(KERN_ERR "%s(): ERROR opening file(%s) with errno = %d!\n", printk(KERN_ERR
"%s(): ERROR opening file(%s) with errno = %d!\n",
__func__, dev->_filename, open_errno); __func__, dev->_filename, open_errno);
return PTR_ERR(myfile); return PTR_ERR(myfile);
} else { } else {
if (!(myfile->f_op)) { if (!(myfile->f_op)) {
printk(KERN_ERR "%s: File has no file operations registered!", printk(KERN_ERR
"%s: File has no file operations registered!",
__func__); __func__);
filp_close(myfile, NULL); filp_close(myfile, NULL);
return -EIO; return -EIO;
} }
if (!myfile->f_op->read) { if (!myfile->f_op->read) {
printk(KERN_ERR "%s: File has no READ operations registered!", printk(KERN_ERR
"%s: File has no READ operations registered!",
__func__); __func__);
filp_close(myfile, NULL); filp_close(myfile, NULL);
return -EIO; return -EIO;
...@@ -386,7 +389,8 @@ int cx25821_get_frame(struct cx25821_dev *dev, struct sram_channel *sram_ch) ...@@ -386,7 +389,8 @@ int cx25821_get_frame(struct cx25821_dev *dev, struct sram_channel *sram_ch)
if (vfs_read_retval < line_size) { if (vfs_read_retval < line_size) {
printk(KERN_INFO printk(KERN_INFO
"Done: exit %s() since no more bytes to read from Video file.\n", "Done: exit %s() since no more bytes to \
read from Video file.\n",
__func__); __func__);
break; break;
} }
...@@ -411,13 +415,15 @@ static void cx25821_vidups_handler(struct work_struct *work) ...@@ -411,13 +415,15 @@ static void cx25821_vidups_handler(struct work_struct *work)
container_of(work, struct cx25821_dev, _irq_work_entry); container_of(work, struct cx25821_dev, _irq_work_entry);
if (!dev) { if (!dev) {
printk(KERN_ERR "ERROR %s(): since container_of(work_struct) FAILED!\n", printk(KERN_ERR
"ERROR %s(): since container_of(work_struct) FAILED!\n",
__func__); __func__);
return; return;
} }
cx25821_get_frame(dev, cx25821_get_frame(dev,
&dev->sram_channels[dev->_channel_upstream_select]); dev->channels[dev->_channel_upstream_select].
sram_channels);
} }
int cx25821_openfile(struct cx25821_dev *dev, struct sram_channel *sram_ch) int cx25821_openfile(struct cx25821_dev *dev, struct sram_channel *sram_ch)
...@@ -442,15 +448,17 @@ int cx25821_openfile(struct cx25821_dev *dev, struct sram_channel *sram_ch) ...@@ -442,15 +448,17 @@ int cx25821_openfile(struct cx25821_dev *dev, struct sram_channel *sram_ch)
return PTR_ERR(myfile); return PTR_ERR(myfile);
} else { } else {
if (!(myfile->f_op)) { if (!(myfile->f_op)) {
printk(KERN_ERR "%s: File has no file operations registered!", printk(KERN_ERR
"%s: File has no file operations registered!",
__func__); __func__);
filp_close(myfile, NULL); filp_close(myfile, NULL);
return -EIO; return -EIO;
} }
if (!myfile->f_op->read) { if (!myfile->f_op->read) {
printk printk(KERN_ERR
(KERN_ERR "%s: File has no READ operations registered! Returning.", "%s: File has no READ operations registered! \
Returning.",
__func__); __func__);
filp_close(myfile, NULL); filp_close(myfile, NULL);
return -EIO; return -EIO;
...@@ -480,7 +488,8 @@ int cx25821_openfile(struct cx25821_dev *dev, struct sram_channel *sram_ch) ...@@ -480,7 +488,8 @@ int cx25821_openfile(struct cx25821_dev *dev, struct sram_channel *sram_ch)
if (vfs_read_retval < line_size) { if (vfs_read_retval < line_size) {
printk(KERN_INFO printk(KERN_INFO
"Done: exit %s() since no more bytes to read from Video file.\n", "Done: exit %s() since no more \
bytes to read from Video file.\n",
__func__); __func__);
break; break;
} }
...@@ -526,7 +535,8 @@ int cx25821_upstream_buffer_prepare(struct cx25821_dev *dev, ...@@ -526,7 +535,8 @@ int cx25821_upstream_buffer_prepare(struct cx25821_dev *dev,
if (!dev->_dma_virt_addr) { if (!dev->_dma_virt_addr) {
printk printk
(KERN_ERR "cx25821: FAILED to allocate memory for Risc buffer! Returning.\n"); (KERN_ERR "cx25821: FAILED to allocate memory for Risc \
buffer! Returning.\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -547,7 +557,8 @@ int cx25821_upstream_buffer_prepare(struct cx25821_dev *dev, ...@@ -547,7 +557,8 @@ int cx25821_upstream_buffer_prepare(struct cx25821_dev *dev,
if (!dev->_data_buf_virt_addr) { if (!dev->_data_buf_virt_addr) {
printk printk
(KERN_ERR "cx25821: FAILED to allocate memory for data buffer! Returning.\n"); (KERN_ERR "cx25821: FAILED to allocate memory for data \
buffer! Returning.\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -578,7 +589,7 @@ int cx25821_video_upstream_irq(struct cx25821_dev *dev, int chan_num, ...@@ -578,7 +589,7 @@ int cx25821_video_upstream_irq(struct cx25821_dev *dev, int chan_num,
u32 status) u32 status)
{ {
u32 int_msk_tmp; u32 int_msk_tmp;
struct sram_channel *channel = &dev->sram_channels[chan_num]; struct sram_channel *channel = dev->channels[chan_num].sram_channels;
int singlefield_lines = NTSC_FIELD_HEIGHT; int singlefield_lines = NTSC_FIELD_HEIGHT;
int line_size_in_bytes = Y422_LINE_SZ; int line_size_in_bytes = Y422_LINE_SZ;
int odd_risc_prog_size = 0; int odd_risc_prog_size = 0;
...@@ -642,16 +653,16 @@ int cx25821_video_upstream_irq(struct cx25821_dev *dev, int chan_num, ...@@ -642,16 +653,16 @@ int cx25821_video_upstream_irq(struct cx25821_dev *dev, int chan_num,
} else { } else {
if (status & FLD_VID_SRC_UF) if (status & FLD_VID_SRC_UF)
printk printk
(KERN_ERR "%s: Video Received Underflow Error Interrupt!\n", (KERN_ERR "%s: Video Received Underflow Error \
__func__); Interrupt!\n", __func__);
if (status & FLD_VID_SRC_SYNC) if (status & FLD_VID_SRC_SYNC)
printk(KERN_ERR "%s: Video Received Sync Error Interrupt!\n", printk(KERN_ERR "%s: Video Received Sync Error \
__func__); Interrupt!\n", __func__);
if (status & FLD_VID_SRC_OPC_ERR) if (status & FLD_VID_SRC_OPC_ERR)
printk(KERN_ERR "%s: Video Received OpCode Error Interrupt!\n", printk(KERN_ERR "%s: Video Received OpCode Error \
__func__); Interrupt!\n", __func__);
} }
if (dev->_file_status == END_OF_FILE) { if (dev->_file_status == END_OF_FILE) {
...@@ -679,7 +690,7 @@ static irqreturn_t cx25821_upstream_irq(int irq, void *dev_id) ...@@ -679,7 +690,7 @@ static irqreturn_t cx25821_upstream_irq(int irq, void *dev_id)
channel_num = VID_UPSTREAM_SRAM_CHANNEL_I; channel_num = VID_UPSTREAM_SRAM_CHANNEL_I;
sram_ch = &dev->sram_channels[channel_num]; sram_ch = dev->channels[channel_num].sram_channels;
msk_stat = cx_read(sram_ch->int_mstat); msk_stat = cx_read(sram_ch->int_mstat);
vid_status = cx_read(sram_ch->int_stat); vid_status = cx_read(sram_ch->int_stat);
...@@ -800,14 +811,15 @@ int cx25821_vidupstream_init_ch1(struct cx25821_dev *dev, int channel_select, ...@@ -800,14 +811,15 @@ int cx25821_vidupstream_init_ch1(struct cx25821_dev *dev, int channel_select,
} }
dev->_channel_upstream_select = channel_select; dev->_channel_upstream_select = channel_select;
sram_ch = &dev->sram_channels[channel_select]; sram_ch = dev->channels[channel_select].sram_channels;
INIT_WORK(&dev->_irq_work_entry, cx25821_vidups_handler); INIT_WORK(&dev->_irq_work_entry, cx25821_vidups_handler);
dev->_irq_queues = create_singlethread_workqueue("cx25821_workqueue"); dev->_irq_queues = create_singlethread_workqueue("cx25821_workqueue");
if (!dev->_irq_queues) { if (!dev->_irq_queues) {
printk printk
(KERN_ERR "cx25821: create_singlethread_workqueue() for Video FAILED!\n"); (KERN_ERR "cx25821: create_singlethread_workqueue() for \
Video FAILED!\n");
return -ENOMEM; return -ENOMEM;
} }
/* 656/VIP SRC Upstream Channel I & J and 7 - Host Bus Interface for /* 656/VIP SRC Upstream Channel I & J and 7 - Host Bus Interface for
......
This diff is collapsed.
...@@ -80,17 +80,6 @@ extern struct sram_channel *channel7; ...@@ -80,17 +80,6 @@ extern struct sram_channel *channel7;
extern struct sram_channel *channel9; extern struct sram_channel *channel9;
extern struct sram_channel *channel10; extern struct sram_channel *channel10;
extern struct sram_channel *channel11; extern struct sram_channel *channel11;
extern struct video_device cx25821_video_template0;
extern struct video_device cx25821_video_template1;
extern struct video_device cx25821_video_template2;
extern struct video_device cx25821_video_template3;
extern struct video_device cx25821_video_template4;
extern struct video_device cx25821_video_template5;
extern struct video_device cx25821_video_template6;
extern struct video_device cx25821_video_template7;
extern struct video_device cx25821_video_template9;
extern struct video_device cx25821_video_template10;
extern struct video_device cx25821_video_template11;
extern struct video_device cx25821_videoioctl_template; extern struct video_device cx25821_videoioctl_template;
//extern const u32 *ctrl_classes[]; //extern const u32 *ctrl_classes[];
...@@ -113,7 +102,7 @@ extern int cx25821_set_tvnorm(struct cx25821_dev *dev, v4l2_std_id norm); ...@@ -113,7 +102,7 @@ extern int cx25821_set_tvnorm(struct cx25821_dev *dev, v4l2_std_id norm);
extern int cx25821_res_get(struct cx25821_dev *dev, struct cx25821_fh *fh, extern int cx25821_res_get(struct cx25821_dev *dev, struct cx25821_fh *fh,
unsigned int bit); unsigned int bit);
extern int cx25821_res_check(struct cx25821_fh *fh, unsigned int bit); extern int cx25821_res_check(struct cx25821_fh *fh, unsigned int bit);
extern int cx25821_res_locked(struct cx25821_dev *dev, unsigned int bit); extern int cx25821_res_locked(struct cx25821_fh *fh, unsigned int bit);
extern void cx25821_res_free(struct cx25821_dev *dev, struct cx25821_fh *fh, extern void cx25821_res_free(struct cx25821_dev *dev, struct cx25821_fh *fh,
unsigned int bits); unsigned int bits);
extern int cx25821_video_mux(struct cx25821_dev *dev, unsigned int input); extern int cx25821_video_mux(struct cx25821_dev *dev, unsigned int input);
...@@ -126,8 +115,7 @@ extern int cx25821_set_scale(struct cx25821_dev *dev, unsigned int width, ...@@ -126,8 +115,7 @@ extern int cx25821_set_scale(struct cx25821_dev *dev, unsigned int width,
unsigned int height, enum v4l2_field field); unsigned int height, enum v4l2_field field);
extern int cx25821_video_irq(struct cx25821_dev *dev, int chan_num, u32 status); extern int cx25821_video_irq(struct cx25821_dev *dev, int chan_num, u32 status);
extern void cx25821_video_unregister(struct cx25821_dev *dev, int chan_num); extern void cx25821_video_unregister(struct cx25821_dev *dev, int chan_num);
extern int cx25821_video_register(struct cx25821_dev *dev, int chan_num, extern int cx25821_video_register(struct cx25821_dev *dev);
struct video_device *video_template);
extern int cx25821_get_format_size(void); extern int cx25821_get_format_size(void);
extern int cx25821_buffer_setup(struct videobuf_queue *q, unsigned int *count, extern int cx25821_buffer_setup(struct videobuf_queue *q, unsigned int *count,
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
#define FALSE 0 #define FALSE 0
#define LINE_SIZE_D1 1440 #define LINE_SIZE_D1 1440
// Number of decoders and encoders /* Number of decoders and encoders */
#define MAX_DECODERS 8 #define MAX_DECODERS 8
#define MAX_ENCODERS 2 #define MAX_ENCODERS 2
#define QUAD_DECODERS 4 #define QUAD_DECODERS 4
...@@ -139,6 +139,7 @@ struct cx25821_fh { ...@@ -139,6 +139,7 @@ struct cx25821_fh {
/* video capture */ /* video capture */
struct cx25821_fmt *fmt; struct cx25821_fmt *fmt;
unsigned int width, height; unsigned int width, height;
int channel_id;
/* vbi capture */ /* vbi capture */
struct videobuf_queue vidq; struct videobuf_queue vidq;
...@@ -236,13 +237,34 @@ struct cx25821_data { ...@@ -236,13 +237,34 @@ struct cx25821_data {
struct sram_channel *channel; struct sram_channel *channel;
}; };
struct cx25821_channel {
struct v4l2_prio_state prio;
int ctl_bright;
int ctl_contrast;
int ctl_hue;
int ctl_saturation;
struct cx25821_data timeout_data;
struct video_device *video_dev;
struct cx25821_dmaqueue vidq;
struct sram_channel *sram_channels;
struct mutex lock;
int resources;
int pixel_formats;
int use_cif_resolution;
int cif_width;
};
struct cx25821_dev { struct cx25821_dev {
struct list_head devlist; struct list_head devlist;
atomic_t refcount; atomic_t refcount;
struct v4l2_device v4l2_dev; struct v4l2_device v4l2_dev;
struct v4l2_prio_state prio;
/* pci stuff */ /* pci stuff */
struct pci_dev *pci; struct pci_dev *pci;
unsigned char pci_rev, pci_lat; unsigned char pci_rev, pci_lat;
...@@ -261,13 +283,12 @@ struct cx25821_dev { ...@@ -261,13 +283,12 @@ struct cx25821_dev {
int nr; int nr;
struct mutex lock; struct mutex lock;
struct cx25821_channel channels[MAX_VID_CHANNEL_NUM];
/* board details */ /* board details */
unsigned int board; unsigned int board;
char name[32]; char name[32];
/* sram configuration */
struct sram_channel *sram_channels;
/* Analog video */ /* Analog video */
u32 resources; u32 resources;
unsigned int input; unsigned int input;
...@@ -282,13 +303,6 @@ struct cx25821_dev { ...@@ -282,13 +303,6 @@ struct cx25821_dev {
unsigned char videc_addr; unsigned char videc_addr;
unsigned short _max_num_decoders; unsigned short _max_num_decoders;
int ctl_bright;
int ctl_contrast;
int ctl_hue;
int ctl_saturation;
struct cx25821_data timeout_data[MAX_VID_CHANNEL_NUM];
/* Analog Audio Upstream */ /* Analog Audio Upstream */
int _audio_is_running; int _audio_is_running;
int _audiopixel_format; int _audiopixel_format;
...@@ -297,7 +311,7 @@ struct cx25821_dev { ...@@ -297,7 +311,7 @@ struct cx25821_dev {
int _audio_lines_count; int _audio_lines_count;
int _audioframe_count; int _audioframe_count;
int _audio_upstream_channel_select; int _audio_upstream_channel_select;
int _last_index_irq; //The last interrupt index processed. int _last_index_irq; /* The last interrupt index processed. */
__le32 *_risc_audio_jmp_addr; __le32 *_risc_audio_jmp_addr;
__le32 *_risc_virt_start_addr; __le32 *_risc_virt_start_addr;
...@@ -313,12 +327,10 @@ struct cx25821_dev { ...@@ -313,12 +327,10 @@ struct cx25821_dev {
/* V4l */ /* V4l */
u32 freq; u32 freq;
struct video_device *video_dev[MAX_VID_CHANNEL_NUM];
struct video_device *vbi_dev; struct video_device *vbi_dev;
struct video_device *radio_dev; struct video_device *radio_dev;
struct video_device *ioctl_dev; struct video_device *ioctl_dev;
struct cx25821_dmaqueue vidq[MAX_VID_CHANNEL_NUM];
spinlock_t slock; spinlock_t slock;
/* Video Upstream */ /* Video Upstream */
...@@ -401,9 +413,6 @@ struct cx25821_dev { ...@@ -401,9 +413,6 @@ struct cx25821_dev {
int pixel_format; int pixel_format;
int channel_select; int channel_select;
int command; int command;
int pixel_formats[VID_CHANNEL_NUM];
int use_cif_resolution[VID_CHANNEL_NUM];
int cif_width[VID_CHANNEL_NUM];
int channel_opened; int channel_opened;
}; };
...@@ -482,7 +491,7 @@ struct sram_channel { ...@@ -482,7 +491,7 @@ struct sram_channel {
u32 fld_aud_fifo_en; u32 fld_aud_fifo_en;
u32 fld_aud_risc_en; u32 fld_aud_risc_en;
//For Upstream Video /* For Upstream Video */
u32 vid_fmt_ctl; u32 vid_fmt_ctl;
u32 vid_active_ctl1; u32 vid_active_ctl1;
u32 vid_active_ctl2; u32 vid_active_ctl2;
......
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