mirror of
https://github.com/Dasharo/linux.git
synced 2026-03-06 15:25:10 -08:00
[media] cx231xx: Added support for Carraera, Shelby, RDx_253S and VIDEO_GRABBER
Added support for new cx231xx boards - Carraera, Shelby, RDx_253S and VIDEO_GRABBER. [mchehab@redhat.com: Fix a merge conflict with BKL removal patches] Signed-off-by: Palash Bandyopadhyay <palash.bandyopadhyay@conexant.com> Signed-off-by: Devin Heitmueller <dheitmueller@hauppauge.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
committed by
Mauro Carvalho Chehab
parent
47b75ec146
commit
64fbf44455
@@ -1,5 +1,5 @@
|
||||
cx231xx-objs := cx231xx-video.o cx231xx-i2c.o cx231xx-cards.o cx231xx-core.o \
|
||||
cx231xx-avcore.o cx231xx-pcb-cfg.o cx231xx-vbi.o
|
||||
cx231xx-avcore.o cx231xx-417.o cx231xx-pcb-cfg.o cx231xx-vbi.o
|
||||
|
||||
cx231xx-alsa-objs := cx231xx-audio.o
|
||||
|
||||
|
||||
2230
drivers/media/video/cx231xx/cx231xx-417.c
Normal file
2230
drivers/media/video/cx231xx/cx231xx-417.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -75,6 +75,30 @@ static int cx231xx_isoc_audio_deinit(struct cx231xx *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cx231xx_bulk_audio_deinit(struct cx231xx *dev)
|
||||
{
|
||||
int i;
|
||||
|
||||
dprintk("Stopping bulk\n");
|
||||
|
||||
for (i = 0; i < CX231XX_AUDIO_BUFS; i++) {
|
||||
if (dev->adev.urb[i]) {
|
||||
if (!irqs_disabled())
|
||||
usb_kill_urb(dev->adev.urb[i]);
|
||||
else
|
||||
usb_unlink_urb(dev->adev.urb[i]);
|
||||
|
||||
usb_free_urb(dev->adev.urb[i]);
|
||||
dev->adev.urb[i] = NULL;
|
||||
|
||||
kfree(dev->adev.transfer_buffer[i]);
|
||||
dev->adev.transfer_buffer[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void cx231xx_audio_isocirq(struct urb *urb)
|
||||
{
|
||||
struct cx231xx *dev = urb->context;
|
||||
@@ -158,14 +182,92 @@ static void cx231xx_audio_isocirq(struct urb *urb)
|
||||
return;
|
||||
}
|
||||
|
||||
static void cx231xx_audio_bulkirq(struct urb *urb)
|
||||
{
|
||||
struct cx231xx *dev = urb->context;
|
||||
unsigned int oldptr;
|
||||
int period_elapsed = 0;
|
||||
int status;
|
||||
unsigned char *cp;
|
||||
unsigned int stride;
|
||||
struct snd_pcm_substream *substream;
|
||||
struct snd_pcm_runtime *runtime;
|
||||
|
||||
switch (urb->status) {
|
||||
case 0: /* success */
|
||||
case -ETIMEDOUT: /* NAK */
|
||||
break;
|
||||
case -ECONNRESET: /* kill */
|
||||
case -ENOENT:
|
||||
case -ESHUTDOWN:
|
||||
return;
|
||||
default: /* error */
|
||||
dprintk("urb completition error %d.\n", urb->status);
|
||||
break;
|
||||
}
|
||||
|
||||
if (dev->adev.capture_pcm_substream) {
|
||||
substream = dev->adev.capture_pcm_substream;
|
||||
runtime = substream->runtime;
|
||||
stride = runtime->frame_bits >> 3;
|
||||
|
||||
if (1) {
|
||||
int length = urb->actual_length /
|
||||
stride;
|
||||
cp = (unsigned char *)urb->transfer_buffer;
|
||||
|
||||
oldptr = dev->adev.hwptr_done_capture;
|
||||
if (oldptr + length >= runtime->buffer_size) {
|
||||
unsigned int cnt;
|
||||
|
||||
cnt = runtime->buffer_size - oldptr;
|
||||
memcpy(runtime->dma_area + oldptr * stride, cp,
|
||||
cnt * stride);
|
||||
memcpy(runtime->dma_area, cp + cnt * stride,
|
||||
length * stride - cnt * stride);
|
||||
} else {
|
||||
memcpy(runtime->dma_area + oldptr * stride, cp,
|
||||
length * stride);
|
||||
}
|
||||
|
||||
snd_pcm_stream_lock(substream);
|
||||
|
||||
dev->adev.hwptr_done_capture += length;
|
||||
if (dev->adev.hwptr_done_capture >=
|
||||
runtime->buffer_size)
|
||||
dev->adev.hwptr_done_capture -=
|
||||
runtime->buffer_size;
|
||||
|
||||
dev->adev.capture_transfer_done += length;
|
||||
if (dev->adev.capture_transfer_done >=
|
||||
runtime->period_size) {
|
||||
dev->adev.capture_transfer_done -=
|
||||
runtime->period_size;
|
||||
period_elapsed = 1;
|
||||
}
|
||||
snd_pcm_stream_unlock(substream);
|
||||
}
|
||||
if (period_elapsed)
|
||||
snd_pcm_period_elapsed(substream);
|
||||
}
|
||||
urb->status = 0;
|
||||
|
||||
status = usb_submit_urb(urb, GFP_ATOMIC);
|
||||
if (status < 0) {
|
||||
cx231xx_errdev("resubmit of audio urb failed (error=%i)\n",
|
||||
status);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
static int cx231xx_init_audio_isoc(struct cx231xx *dev)
|
||||
{
|
||||
int i, errCode;
|
||||
int sb_size;
|
||||
|
||||
cx231xx_info("%s: Starting AUDIO transfers\n", __func__);
|
||||
cx231xx_info("%s: Starting ISO AUDIO transfers\n", __func__);
|
||||
|
||||
sb_size = CX231XX_NUM_AUDIO_PACKETS * dev->adev.max_pkt_size;
|
||||
sb_size = CX231XX_ISO_NUM_AUDIO_PACKETS * dev->adev.max_pkt_size;
|
||||
|
||||
for (i = 0; i < CX231XX_AUDIO_BUFS; i++) {
|
||||
struct urb *urb;
|
||||
@@ -176,7 +278,7 @@ static int cx231xx_init_audio_isoc(struct cx231xx *dev)
|
||||
return -ENOMEM;
|
||||
|
||||
memset(dev->adev.transfer_buffer[i], 0x80, sb_size);
|
||||
urb = usb_alloc_urb(CX231XX_NUM_AUDIO_PACKETS, GFP_ATOMIC);
|
||||
urb = usb_alloc_urb(CX231XX_ISO_NUM_AUDIO_PACKETS, GFP_ATOMIC);
|
||||
if (!urb) {
|
||||
cx231xx_errdev("usb_alloc_urb failed!\n");
|
||||
for (j = 0; j < i; j++) {
|
||||
@@ -194,10 +296,10 @@ static int cx231xx_init_audio_isoc(struct cx231xx *dev)
|
||||
urb->transfer_buffer = dev->adev.transfer_buffer[i];
|
||||
urb->interval = 1;
|
||||
urb->complete = cx231xx_audio_isocirq;
|
||||
urb->number_of_packets = CX231XX_NUM_AUDIO_PACKETS;
|
||||
urb->number_of_packets = CX231XX_ISO_NUM_AUDIO_PACKETS;
|
||||
urb->transfer_buffer_length = sb_size;
|
||||
|
||||
for (j = k = 0; j < CX231XX_NUM_AUDIO_PACKETS;
|
||||
for (j = k = 0; j < CX231XX_ISO_NUM_AUDIO_PACKETS;
|
||||
j++, k += dev->adev.max_pkt_size) {
|
||||
urb->iso_frame_desc[j].offset = k;
|
||||
urb->iso_frame_desc[j].length = dev->adev.max_pkt_size;
|
||||
@@ -216,6 +318,59 @@ static int cx231xx_init_audio_isoc(struct cx231xx *dev)
|
||||
return errCode;
|
||||
}
|
||||
|
||||
static int cx231xx_init_audio_bulk(struct cx231xx *dev)
|
||||
{
|
||||
int i, errCode;
|
||||
int sb_size;
|
||||
|
||||
cx231xx_info("%s: Starting BULK AUDIO transfers\n", __func__);
|
||||
|
||||
sb_size = CX231XX_NUM_AUDIO_PACKETS * dev->adev.max_pkt_size;
|
||||
|
||||
for (i = 0; i < CX231XX_AUDIO_BUFS; i++) {
|
||||
struct urb *urb;
|
||||
int j;
|
||||
|
||||
dev->adev.transfer_buffer[i] = kmalloc(sb_size, GFP_ATOMIC);
|
||||
if (!dev->adev.transfer_buffer[i])
|
||||
return -ENOMEM;
|
||||
|
||||
memset(dev->adev.transfer_buffer[i], 0x80, sb_size);
|
||||
urb = usb_alloc_urb(CX231XX_NUM_AUDIO_PACKETS, GFP_ATOMIC);
|
||||
if (!urb) {
|
||||
cx231xx_errdev("usb_alloc_urb failed!\n");
|
||||
for (j = 0; j < i; j++) {
|
||||
usb_free_urb(dev->adev.urb[j]);
|
||||
kfree(dev->adev.transfer_buffer[j]);
|
||||
}
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
urb->dev = dev->udev;
|
||||
urb->context = dev;
|
||||
urb->pipe = usb_rcvbulkpipe(dev->udev,
|
||||
dev->adev.end_point_addr);
|
||||
urb->transfer_flags = 0;
|
||||
urb->transfer_buffer = dev->adev.transfer_buffer[i];
|
||||
urb->complete = cx231xx_audio_bulkirq;
|
||||
urb->transfer_buffer_length = sb_size;
|
||||
|
||||
dev->adev.urb[i] = urb;
|
||||
|
||||
}
|
||||
|
||||
for (i = 0; i < CX231XX_AUDIO_BUFS; i++) {
|
||||
errCode = usb_submit_urb(dev->adev.urb[i], GFP_ATOMIC);
|
||||
if (errCode < 0) {
|
||||
cx231xx_bulk_audio_deinit(dev);
|
||||
return errCode;
|
||||
}
|
||||
}
|
||||
|
||||
return errCode;
|
||||
}
|
||||
|
||||
|
||||
static int cx231xx_cmd(struct cx231xx *dev, int cmd, int arg)
|
||||
{
|
||||
dprintk("%s transfer\n", (dev->adev.capture_stream == STREAM_ON) ?
|
||||
@@ -225,7 +380,12 @@ static int cx231xx_cmd(struct cx231xx *dev, int cmd, int arg)
|
||||
case CX231XX_CAPTURE_STREAM_EN:
|
||||
if (dev->adev.capture_stream == STREAM_OFF && arg == 1) {
|
||||
dev->adev.capture_stream = STREAM_ON;
|
||||
cx231xx_init_audio_isoc(dev);
|
||||
if (is_fw_load(dev) == 0)
|
||||
cx25840_call(dev, core, load_fw);
|
||||
if (dev->USE_ISO)
|
||||
cx231xx_init_audio_isoc(dev);
|
||||
else
|
||||
cx231xx_init_audio_bulk(dev);
|
||||
} else if (dev->adev.capture_stream == STREAM_ON && arg == 0) {
|
||||
dev->adev.capture_stream = STREAM_OFF;
|
||||
cx231xx_isoc_audio_deinit(dev);
|
||||
@@ -300,7 +460,10 @@ static int snd_cx231xx_capture_open(struct snd_pcm_substream *substream)
|
||||
|
||||
/* set alternate setting for audio interface */
|
||||
/* 1 - 48000 samples per sec */
|
||||
ret = cx231xx_set_alt_setting(dev, INDEX_AUDIO, 1);
|
||||
if (dev->USE_ISO)
|
||||
ret = cx231xx_set_alt_setting(dev, INDEX_AUDIO, 1);
|
||||
else
|
||||
ret = cx231xx_set_alt_setting(dev, INDEX_AUDIO, 0);
|
||||
if (ret < 0) {
|
||||
cx231xx_errdev("failed to set alternate setting !\n");
|
||||
|
||||
@@ -330,6 +493,9 @@ static int snd_cx231xx_pcm_close(struct snd_pcm_substream *substream)
|
||||
|
||||
dprintk("closing device\n");
|
||||
|
||||
/* inform hardware to start streaming */
|
||||
ret = cx231xx_capture_start(dev, 0, Audio);
|
||||
|
||||
/* set alternate setting for audio interface */
|
||||
/* 1 - 48000 samples per sec */
|
||||
ret = cx231xx_set_alt_setting(dev, INDEX_AUDIO, 0);
|
||||
@@ -339,9 +505,6 @@ static int snd_cx231xx_pcm_close(struct snd_pcm_substream *substream)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* inform hardware to start streaming */
|
||||
ret = cx231xx_capture_start(dev, 0, Audio);
|
||||
|
||||
dev->mute = 1;
|
||||
mutex_lock(&dev->lock);
|
||||
dev->adev.users--;
|
||||
@@ -391,6 +554,11 @@ static int snd_cx231xx_hw_capture_free(struct snd_pcm_substream *substream)
|
||||
|
||||
static int snd_cx231xx_prepare(struct snd_pcm_substream *substream)
|
||||
{
|
||||
struct cx231xx *dev = snd_pcm_substream_chip(substream);
|
||||
|
||||
dev->adev.hwptr_done_capture = 0;
|
||||
dev->adev.capture_transfer_done = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -495,6 +663,7 @@ static int cx231xx_audio_init(struct cx231xx *dev)
|
||||
pcm->info_flags = 0;
|
||||
pcm->private_data = dev;
|
||||
strcpy(pcm->name, "Conexant cx231xx Capture");
|
||||
snd_card_set_dev(card, &dev->udev->dev);
|
||||
strcpy(card->driver, "Cx231xx-Audio");
|
||||
strcpy(card->shortname, "Cx231xx Audio");
|
||||
strcpy(card->longname, "Conexant cx231xx Audio");
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -41,6 +41,10 @@ static int tuner = -1;
|
||||
module_param(tuner, int, 0444);
|
||||
MODULE_PARM_DESC(tuner, "tuner type");
|
||||
|
||||
static int transfer_mode = 1;
|
||||
module_param(transfer_mode, int, 0444);
|
||||
MODULE_PARM_DESC(transfer_mode, "transfer mode (1-ISO or 0-BULK)");
|
||||
|
||||
static unsigned int disable_ir;
|
||||
module_param(disable_ir, int, 0444);
|
||||
MODULE_PARM_DESC(disable_ir, "disable infrared remote support");
|
||||
@@ -86,8 +90,8 @@ struct cx231xx_board cx231xx_boards[] = {
|
||||
}
|
||||
},
|
||||
},
|
||||
[CX231XX_BOARD_CNXT_RDE_250] = {
|
||||
.name = "Conexant Hybrid TV - RDE250",
|
||||
[CX231XX_BOARD_CNXT_CARRAERA] = {
|
||||
.name = "Conexant Hybrid TV - CARRAERA",
|
||||
.tuner_type = TUNER_XC5000,
|
||||
.tuner_addr = 0x61,
|
||||
.tuner_gpio = RDE250_XCV_TUNER,
|
||||
@@ -125,9 +129,8 @@ struct cx231xx_board cx231xx_boards[] = {
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
[CX231XX_BOARD_CNXT_RDU_250] = {
|
||||
.name = "Conexant Hybrid TV - RDU250",
|
||||
[CX231XX_BOARD_CNXT_SHELBY] = {
|
||||
.name = "Conexant Hybrid TV - SHELBY",
|
||||
.tuner_type = TUNER_XC5000,
|
||||
.tuner_addr = 0x61,
|
||||
.tuner_gpio = RDE250_XCV_TUNER,
|
||||
@@ -165,6 +168,183 @@ struct cx231xx_board cx231xx_boards[] = {
|
||||
}
|
||||
},
|
||||
},
|
||||
[CX231XX_BOARD_CNXT_RDE_253S] = {
|
||||
.name = "Conexant Hybrid TV - RDE253S",
|
||||
.tuner_type = TUNER_NXP_TDA18271,
|
||||
.tuner_addr = 0x60,
|
||||
.tuner_gpio = RDE250_XCV_TUNER,
|
||||
.tuner_sif_gpio = 0x05,
|
||||
.tuner_scl_gpio = 0x1a,
|
||||
.tuner_sda_gpio = 0x1b,
|
||||
.decoder = CX231XX_AVDECODER,
|
||||
.demod_xfer_mode = 0,
|
||||
.ctl_pin_status_mask = 0xFFFFFFC4,
|
||||
.agc_analog_digital_select_gpio = 0x1c,
|
||||
.gpio_pin_status_mask = 0x4001000,
|
||||
.tuner_i2c_master = 1,
|
||||
.demod_i2c_master = 2,
|
||||
.has_dvb = 1,
|
||||
.demod_addr = 0x02,
|
||||
.norm = V4L2_STD_PAL,
|
||||
|
||||
.input = {{
|
||||
.type = CX231XX_VMUX_TELEVISION,
|
||||
.vmux = CX231XX_VIN_3_1,
|
||||
.amux = CX231XX_AMUX_VIDEO,
|
||||
.gpio = NULL,
|
||||
}, {
|
||||
.type = CX231XX_VMUX_COMPOSITE1,
|
||||
.vmux = CX231XX_VIN_2_1,
|
||||
.amux = CX231XX_AMUX_LINE_IN,
|
||||
.gpio = NULL,
|
||||
}, {
|
||||
.type = CX231XX_VMUX_SVIDEO,
|
||||
.vmux = CX231XX_VIN_1_1 |
|
||||
(CX231XX_VIN_1_2 << 8) |
|
||||
CX25840_SVIDEO_ON,
|
||||
.amux = CX231XX_AMUX_LINE_IN,
|
||||
.gpio = NULL,
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
[CX231XX_BOARD_CNXT_RDU_253S] = {
|
||||
.name = "Conexant Hybrid TV - RDU253S",
|
||||
.tuner_type = TUNER_NXP_TDA18271,
|
||||
.tuner_addr = 0x60,
|
||||
.tuner_gpio = RDE250_XCV_TUNER,
|
||||
.tuner_sif_gpio = 0x05,
|
||||
.tuner_scl_gpio = 0x1a,
|
||||
.tuner_sda_gpio = 0x1b,
|
||||
.decoder = CX231XX_AVDECODER,
|
||||
.demod_xfer_mode = 0,
|
||||
.ctl_pin_status_mask = 0xFFFFFFC4,
|
||||
.agc_analog_digital_select_gpio = 0x1c,
|
||||
.gpio_pin_status_mask = 0x4001000,
|
||||
.tuner_i2c_master = 1,
|
||||
.demod_i2c_master = 2,
|
||||
.has_dvb = 1,
|
||||
.demod_addr = 0x02,
|
||||
.norm = V4L2_STD_PAL,
|
||||
|
||||
.input = {{
|
||||
.type = CX231XX_VMUX_TELEVISION,
|
||||
.vmux = CX231XX_VIN_3_1,
|
||||
.amux = CX231XX_AMUX_VIDEO,
|
||||
.gpio = NULL,
|
||||
}, {
|
||||
.type = CX231XX_VMUX_COMPOSITE1,
|
||||
.vmux = CX231XX_VIN_2_1,
|
||||
.amux = CX231XX_AMUX_LINE_IN,
|
||||
.gpio = NULL,
|
||||
}, {
|
||||
.type = CX231XX_VMUX_SVIDEO,
|
||||
.vmux = CX231XX_VIN_1_1 |
|
||||
(CX231XX_VIN_1_2 << 8) |
|
||||
CX25840_SVIDEO_ON,
|
||||
.amux = CX231XX_AMUX_LINE_IN,
|
||||
.gpio = NULL,
|
||||
}
|
||||
},
|
||||
},
|
||||
[CX231XX_BOARD_CNXT_VIDEO_GRABBER] = {
|
||||
.name = "Conexant VIDEO GRABBER",
|
||||
.tuner_type = TUNER_NXP_TDA18271,
|
||||
.tuner_addr = 0x60,
|
||||
.tuner_gpio = RDE250_XCV_TUNER,
|
||||
.tuner_sif_gpio = 0x05,
|
||||
.tuner_scl_gpio = 0x1a,
|
||||
.tuner_sda_gpio = 0x1b,
|
||||
.decoder = CX231XX_AVDECODER,
|
||||
.demod_xfer_mode = 0,
|
||||
.ctl_pin_status_mask = 0xFFFFFFC4,
|
||||
.agc_analog_digital_select_gpio = 0x1c,
|
||||
.gpio_pin_status_mask = 0x4001000,
|
||||
.tuner_i2c_master = 1,
|
||||
.demod_i2c_master = 2,
|
||||
.has_dvb = 0,
|
||||
.demod_addr = 0x02,
|
||||
.norm = V4L2_STD_PAL,
|
||||
|
||||
.input = {{
|
||||
.type = CX231XX_VMUX_COMPOSITE1,
|
||||
.vmux = CX231XX_VIN_2_1,
|
||||
.amux = CX231XX_AMUX_LINE_IN,
|
||||
.gpio = NULL,
|
||||
}, {
|
||||
.type = CX231XX_VMUX_SVIDEO,
|
||||
.vmux = CX231XX_VIN_1_1 |
|
||||
(CX231XX_VIN_1_2 << 8) |
|
||||
CX25840_SVIDEO_ON,
|
||||
.amux = CX231XX_AMUX_LINE_IN,
|
||||
.gpio = NULL,
|
||||
}, {
|
||||
.type = CX231XX_VMUX_TELEVISION,
|
||||
.vmux = CX231XX_VIN_3_1,
|
||||
.amux = CX231XX_AMUX_VIDEO,
|
||||
.gpio = NULL,
|
||||
}
|
||||
},
|
||||
},
|
||||
[CX231XX_BOARD_CNXT_RDE_250] = {
|
||||
.name = "Conexant Hybrid TV - rde 250",
|
||||
.tuner_type = TUNER_XC5000,
|
||||
.tuner_addr = 0x61,
|
||||
.tuner_gpio = RDE250_XCV_TUNER,
|
||||
.tuner_sif_gpio = 0x05,
|
||||
.tuner_scl_gpio = 0x1a,
|
||||
.tuner_sda_gpio = 0x1b,
|
||||
.decoder = CX231XX_AVDECODER,
|
||||
.demod_xfer_mode = 0,
|
||||
.ctl_pin_status_mask = 0xFFFFFFC4,
|
||||
.agc_analog_digital_select_gpio = 0x0c,
|
||||
.gpio_pin_status_mask = 0x4001000,
|
||||
.tuner_i2c_master = 1,
|
||||
.demod_i2c_master = 2,
|
||||
.has_dvb = 1,
|
||||
.demod_addr = 0x02,
|
||||
.norm = V4L2_STD_PAL,
|
||||
|
||||
.input = {{
|
||||
.type = CX231XX_VMUX_TELEVISION,
|
||||
.vmux = CX231XX_VIN_2_1,
|
||||
.amux = CX231XX_AMUX_VIDEO,
|
||||
.gpio = NULL,
|
||||
}
|
||||
},
|
||||
},
|
||||
[CX231XX_BOARD_CNXT_RDU_250] = {
|
||||
.name = "Conexant Hybrid TV - RDU 250",
|
||||
.tuner_type = TUNER_XC5000,
|
||||
.tuner_addr = 0x61,
|
||||
.tuner_gpio = RDE250_XCV_TUNER,
|
||||
.tuner_sif_gpio = 0x05,
|
||||
.tuner_scl_gpio = 0x1a,
|
||||
.tuner_sda_gpio = 0x1b,
|
||||
.decoder = CX231XX_AVDECODER,
|
||||
.demod_xfer_mode = 0,
|
||||
.ctl_pin_status_mask = 0xFFFFFFC4,
|
||||
.agc_analog_digital_select_gpio = 0x0c,
|
||||
.gpio_pin_status_mask = 0x4001000,
|
||||
.tuner_i2c_master = 1,
|
||||
.demod_i2c_master = 2,
|
||||
.has_dvb = 1,
|
||||
.demod_addr = 0x32,
|
||||
.norm = V4L2_STD_NTSC,
|
||||
|
||||
.input = {{
|
||||
.type = CX231XX_VMUX_TELEVISION,
|
||||
.vmux = CX231XX_VIN_2_1,
|
||||
.amux = CX231XX_AMUX_VIDEO,
|
||||
.gpio = NULL,
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
const unsigned int cx231xx_bcount = ARRAY_SIZE(cx231xx_boards);
|
||||
|
||||
@@ -173,8 +353,18 @@ struct usb_device_id cx231xx_id_table[] = {
|
||||
{USB_DEVICE(0x0572, 0x5A3C),
|
||||
.driver_info = CX231XX_BOARD_UNKNOWN},
|
||||
{USB_DEVICE(0x0572, 0x58A2),
|
||||
.driver_info = CX231XX_BOARD_CNXT_RDE_250},
|
||||
.driver_info = CX231XX_BOARD_CNXT_CARRAERA},
|
||||
{USB_DEVICE(0x0572, 0x58A1),
|
||||
.driver_info = CX231XX_BOARD_CNXT_SHELBY},
|
||||
{USB_DEVICE(0x0572, 0x58A4),
|
||||
.driver_info = CX231XX_BOARD_CNXT_RDE_253S},
|
||||
{USB_DEVICE(0x0572, 0x58A5),
|
||||
.driver_info = CX231XX_BOARD_CNXT_RDU_253S},
|
||||
{USB_DEVICE(0x0572, 0x58A6),
|
||||
.driver_info = CX231XX_BOARD_CNXT_VIDEO_GRABBER},
|
||||
{USB_DEVICE(0x0572, 0x589E),
|
||||
.driver_info = CX231XX_BOARD_CNXT_RDE_250},
|
||||
{USB_DEVICE(0x0572, 0x58A0),
|
||||
.driver_info = CX231XX_BOARD_CNXT_RDU_250},
|
||||
{USB_DEVICE_VER(USB_VID_PIXELVIEW, USB_PID_PIXELVIEW_SBTVD, 0x4000,0x4fff),
|
||||
.driver_info = CX231XX_BOARD_UNKNOWN},
|
||||
@@ -212,6 +402,23 @@ int cx231xx_tuner_callback(void *ptr, int component, int command, int arg)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cx231xx_tuner_callback);
|
||||
|
||||
void cx231xx_reset_out(struct cx231xx *dev)
|
||||
{
|
||||
cx231xx_set_gpio_value(dev, CX23417_RESET, 1);
|
||||
msleep(200);
|
||||
cx231xx_set_gpio_value(dev, CX23417_RESET, 0);
|
||||
msleep(200);
|
||||
cx231xx_set_gpio_value(dev, CX23417_RESET, 1);
|
||||
}
|
||||
void cx231xx_enable_OSC(struct cx231xx *dev)
|
||||
{
|
||||
cx231xx_set_gpio_value(dev, CX23417_OSC_EN, 1);
|
||||
}
|
||||
void cx231xx_sleep_s5h1432(struct cx231xx *dev)
|
||||
{
|
||||
cx231xx_set_gpio_value(dev, SLEEP_S5H1432, 0);
|
||||
}
|
||||
|
||||
static inline void cx231xx_set_model(struct cx231xx *dev)
|
||||
{
|
||||
memcpy(&dev->board, &cx231xx_boards[dev->model], sizeof(dev->board));
|
||||
@@ -235,9 +442,6 @@ void cx231xx_pre_card_setup(struct cx231xx *dev)
|
||||
cx231xx_set_gpio_direction(dev, dev->board.tuner_sif_gpio, 1);
|
||||
|
||||
/* request some modules if any required */
|
||||
|
||||
/* reset the Tuner */
|
||||
cx231xx_gpio_set(dev, dev->board.tuner_gpio);
|
||||
}
|
||||
|
||||
/* set the mode to Analog mode initially */
|
||||
@@ -297,10 +501,20 @@ void cx231xx_register_i2c_ir(struct cx231xx *dev)
|
||||
/* detect & configure */
|
||||
switch (dev->model) {
|
||||
|
||||
case CX231XX_BOARD_CNXT_CARRAERA:
|
||||
break;
|
||||
case CX231XX_BOARD_CNXT_RDE_250:
|
||||
break;
|
||||
case CX231XX_BOARD_CNXT_SHELBY:
|
||||
break;
|
||||
case CX231XX_BOARD_CNXT_RDU_250:
|
||||
break;
|
||||
case CX231XX_BOARD_CNXT_RDE_253S:
|
||||
break;
|
||||
case CX231XX_BOARD_CNXT_RDU_253S:
|
||||
break;
|
||||
case CX231XX_BOARD_CNXT_VIDEO_GRABBER:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -326,14 +540,38 @@ void cx231xx_card_setup(struct cx231xx *dev)
|
||||
|
||||
}
|
||||
|
||||
if (dev->board.tuner_type != TUNER_ABSENT) {
|
||||
dev->sd_tuner = v4l2_i2c_new_subdev(&dev->v4l2_dev,
|
||||
&dev->i2c_bus[1].i2c_adap,
|
||||
"tuner", "tuner", 0xc2 >> 1, NULL);
|
||||
if (dev->sd_tuner == NULL)
|
||||
cx231xx_info("tuner subdev registration failure\n");
|
||||
switch (dev->model) {
|
||||
case CX231XX_BOARD_CNXT_CARRAERA:
|
||||
case CX231XX_BOARD_CNXT_RDE_250:
|
||||
case CX231XX_BOARD_CNXT_SHELBY:
|
||||
case CX231XX_BOARD_CNXT_RDU_250:
|
||||
if (dev->board.tuner_type != TUNER_ABSENT) {
|
||||
dev->sd_tuner = v4l2_i2c_new_subdev(&dev->v4l2_dev,
|
||||
&dev->i2c_bus[1].i2c_adap,
|
||||
"tuner", "tuner", 0xc2 >> 1, NULL);
|
||||
if (dev->sd_tuner == NULL)
|
||||
cx231xx_info(
|
||||
"tuner subdev registration failure\n");
|
||||
|
||||
cx231xx_config_tuner(dev);
|
||||
cx231xx_config_tuner(dev);
|
||||
}
|
||||
break;
|
||||
case CX231XX_BOARD_CNXT_RDE_253S:
|
||||
case CX231XX_BOARD_CNXT_RDU_253S:
|
||||
case CX231XX_BOARD_CNXT_VIDEO_GRABBER:
|
||||
if (dev->board.tuner_type != TUNER_ABSENT) {
|
||||
dev->sd_tuner = v4l2_i2c_new_subdev(&dev->v4l2_dev,
|
||||
&dev->i2c_bus[1].i2c_adap,
|
||||
"tuner", "tuner", 0xc0 >> 1, NULL);
|
||||
if (dev->sd_tuner == NULL)
|
||||
cx231xx_info(
|
||||
"tuner subdev registration failure\n");
|
||||
|
||||
cx231xx_config_tuner(dev);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
cx231xx_config_tuner(dev);
|
||||
@@ -409,6 +647,7 @@ static int cx231xx_init_dev(struct cx231xx **devhandle, struct usb_device *udev,
|
||||
mutex_init(&dev->lock);
|
||||
mutex_init(&dev->ctrl_urb_lock);
|
||||
mutex_init(&dev->gpio_i2c_lock);
|
||||
mutex_init(&dev->i2c_lock);
|
||||
|
||||
spin_lock_init(&dev->video_mode.slock);
|
||||
spin_lock_init(&dev->vbi_mode.slock);
|
||||
@@ -427,6 +666,12 @@ static int cx231xx_init_dev(struct cx231xx **devhandle, struct usb_device *udev,
|
||||
/* Query cx231xx to find what pcb config it is related to */
|
||||
initialize_cx231xx(dev);
|
||||
|
||||
/*To workaround error number=-71 on EP0 for VideoGrabber,
|
||||
need set alt here.*/
|
||||
if (dev->model == CX231XX_BOARD_CNXT_VIDEO_GRABBER) {
|
||||
cx231xx_set_alt_setting(dev, INDEX_VIDEO, 3);
|
||||
cx231xx_set_alt_setting(dev, INDEX_VANC, 1);
|
||||
}
|
||||
/* Cx231xx pre card setup */
|
||||
cx231xx_pre_card_setup(dev);
|
||||
|
||||
@@ -442,6 +687,7 @@ static int cx231xx_init_dev(struct cx231xx **devhandle, struct usb_device *udev,
|
||||
/* register i2c bus */
|
||||
errCode = cx231xx_dev_init(dev);
|
||||
if (errCode < 0) {
|
||||
cx231xx_dev_uninit(dev);
|
||||
cx231xx_errdev("%s: cx231xx_i2c_register - errCode [%d]!\n",
|
||||
__func__, errCode);
|
||||
return errCode;
|
||||
@@ -480,9 +726,17 @@ static int cx231xx_init_dev(struct cx231xx **devhandle, struct usb_device *udev,
|
||||
INIT_LIST_HEAD(&dev->vbi_mode.vidq.queued);
|
||||
|
||||
/* Reset other chips required if they are tied up with GPIO pins */
|
||||
|
||||
cx231xx_add_into_devlist(dev);
|
||||
|
||||
printk(KERN_INFO "attach 417 %d\n", dev->model);
|
||||
if (dev->model == CX231XX_BOARD_CNXT_VIDEO_GRABBER) {
|
||||
if (cx231xx_417_register(dev) < 0) {
|
||||
printk(KERN_ERR
|
||||
"%s() Failed to register 417 on VID_B\n",
|
||||
__func__);
|
||||
}
|
||||
}
|
||||
|
||||
retval = cx231xx_register_analog_devices(dev);
|
||||
if (retval < 0) {
|
||||
cx231xx_release_resources(dev);
|
||||
@@ -552,8 +806,8 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
|
||||
cx231xx_devused |= 1 << nr;
|
||||
|
||||
if (nr >= CX231XX_MAXBOARDS) {
|
||||
cx231xx_err(DRIVER_NAME ": Supports only %i cx231xx boards.\n",
|
||||
CX231XX_MAXBOARDS);
|
||||
cx231xx_err(DRIVER_NAME
|
||||
": Supports only %i cx231xx boards.\n", CX231XX_MAXBOARDS);
|
||||
cx231xx_devused &= ~(1 << nr);
|
||||
return -ENOMEM;
|
||||
}
|
||||
@@ -578,6 +832,7 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
|
||||
dev->xc_fw_load_done = 0;
|
||||
dev->has_alsa_audio = 1;
|
||||
dev->power_mode = -1;
|
||||
atomic_set(&dev->devlist_count, 0);
|
||||
|
||||
/* 0 - vbi ; 1 -sliced cc mode */
|
||||
dev->vbi_or_sliced_cc_mode = 0;
|
||||
@@ -591,6 +846,11 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
|
||||
/* store the current interface */
|
||||
lif = interface;
|
||||
|
||||
/*mode_tv: digital=1 or analog=0*/
|
||||
dev->mode_tv = 0;
|
||||
|
||||
dev->USE_ISO = transfer_mode;
|
||||
|
||||
switch (udev->speed) {
|
||||
case USB_SPEED_LOW:
|
||||
speed = "1.5";
|
||||
@@ -645,7 +905,7 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
|
||||
* set skip interface, for all interfaces but
|
||||
* interface 1 and the last one
|
||||
*/
|
||||
if ((ifnum != 1) && ((dev->interface_count - 1)
|
||||
if ((ifnum != 1) && ((ifnum)
|
||||
!= dev->max_iad_interface_count))
|
||||
skip_interface = 1;
|
||||
|
||||
@@ -667,7 +927,7 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
|
||||
/* save our data pointer in this interface device */
|
||||
usb_set_intfdata(lif, dev);
|
||||
|
||||
if ((dev->interface_count - 1) != dev->max_iad_interface_count)
|
||||
if ((ifnum) != dev->max_iad_interface_count)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
@@ -680,15 +940,18 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
|
||||
cx231xx_errdev("v4l2_device_register failed\n");
|
||||
cx231xx_devused &= ~(1 << nr);
|
||||
kfree(dev);
|
||||
dev = NULL;
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
/* allocate device struct */
|
||||
retval = cx231xx_init_dev(&dev, udev, nr);
|
||||
if (retval) {
|
||||
cx231xx_devused &= ~(1 << dev->devno);
|
||||
v4l2_device_unregister(&dev->v4l2_dev);
|
||||
kfree(dev);
|
||||
dev = NULL;
|
||||
usb_set_intfdata(lif, NULL);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -711,6 +974,7 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
|
||||
cx231xx_devused &= ~(1 << nr);
|
||||
v4l2_device_unregister(&dev->v4l2_dev);
|
||||
kfree(dev);
|
||||
dev = NULL;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@@ -744,6 +1008,7 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
|
||||
cx231xx_devused &= ~(1 << nr);
|
||||
v4l2_device_unregister(&dev->v4l2_dev);
|
||||
kfree(dev);
|
||||
dev = NULL;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@@ -778,6 +1043,7 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
|
||||
cx231xx_devused &= ~(1 << nr);
|
||||
v4l2_device_unregister(&dev->v4l2_dev);
|
||||
kfree(dev);
|
||||
dev = NULL;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@@ -813,6 +1079,7 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
|
||||
cx231xx_devused &= ~(1 << nr);
|
||||
v4l2_device_unregister(&dev->v4l2_dev);
|
||||
kfree(dev);
|
||||
dev = NULL;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@@ -827,6 +1094,15 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
|
||||
}
|
||||
}
|
||||
|
||||
if (dev->model == CX231XX_BOARD_CNXT_VIDEO_GRABBER) {
|
||||
cx231xx_enable_OSC(dev);
|
||||
cx231xx_reset_out(dev);
|
||||
cx231xx_set_alt_setting(dev, INDEX_VIDEO, 3);
|
||||
}
|
||||
|
||||
if (dev->model == CX231XX_BOARD_CNXT_RDE_253S)
|
||||
cx231xx_sleep_s5h1432(dev);
|
||||
|
||||
/* load other modules required */
|
||||
request_modules(dev);
|
||||
|
||||
@@ -867,7 +1143,10 @@ static void cx231xx_usb_disconnect(struct usb_interface *interface)
|
||||
video_device_node_name(dev->vdev));
|
||||
|
||||
dev->state |= DEV_MISCONFIGURED;
|
||||
cx231xx_uninit_isoc(dev);
|
||||
if (dev->USE_ISO)
|
||||
cx231xx_uninit_isoc(dev);
|
||||
else
|
||||
cx231xx_uninit_bulk(dev);
|
||||
dev->state |= DEV_DISCONNECTED;
|
||||
wake_up_interruptible(&dev->wait_frame);
|
||||
wake_up_interruptible(&dev->wait_stream);
|
||||
@@ -886,6 +1165,7 @@ static void cx231xx_usb_disconnect(struct usb_interface *interface)
|
||||
kfree(dev->sliced_cc_mode.alt_max_pkt_size);
|
||||
kfree(dev->ts1_mode.alt_max_pkt_size);
|
||||
kfree(dev);
|
||||
dev = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#define CIR_CAR_REG 0x38
|
||||
#define CIR_OT_CFG1 0x40
|
||||
#define CIR_OT_CFG2 0x44
|
||||
#define GBULK_BIT_EN 0x68
|
||||
#define PWR_CTL_EN 0x74
|
||||
|
||||
/* Polaris Endpoints capture mask for register EP_MODE_SET */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
3178
drivers/media/video/cx231xx/cx231xx-dif.h
Normal file
3178
drivers/media/video/cx231xx/cx231xx-dif.h
Normal file
File diff suppressed because it is too large
Load Diff
@@ -29,6 +29,9 @@
|
||||
|
||||
#include "xc5000.h"
|
||||
#include "dvb_dummy_fe.h"
|
||||
#include "s5h1432.h"
|
||||
#include "tda18271.h"
|
||||
#include "s5h1411.h"
|
||||
|
||||
MODULE_DESCRIPTION("driver for cx231xx based DVB cards");
|
||||
MODULE_AUTHOR("Srinivasa Deevi <srinivasa.deevi@conexant.com>");
|
||||
@@ -65,6 +68,48 @@ struct cx231xx_dvb {
|
||||
struct dvb_net net;
|
||||
};
|
||||
|
||||
static struct s5h1432_config dvico_s5h1432_config = {
|
||||
.output_mode = S5H1432_SERIAL_OUTPUT,
|
||||
.gpio = S5H1432_GPIO_ON,
|
||||
.qam_if = S5H1432_IF_4000,
|
||||
.vsb_if = S5H1432_IF_4000,
|
||||
.inversion = S5H1432_INVERSION_OFF,
|
||||
.status_mode = S5H1432_DEMODLOCKING,
|
||||
.mpeg_timing = S5H1432_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK,
|
||||
};
|
||||
|
||||
static struct tda18271_std_map cnxt_rde253s_tda18271_std_map = {
|
||||
.dvbt_6 = { .if_freq = 4000, .agc_mode = 3, .std = 4,
|
||||
.if_lvl = 1, .rfagc_top = 0x37, },
|
||||
.dvbt_7 = { .if_freq = 4000, .agc_mode = 3, .std = 5,
|
||||
.if_lvl = 1, .rfagc_top = 0x37, },
|
||||
.dvbt_8 = { .if_freq = 4000, .agc_mode = 3, .std = 6,
|
||||
.if_lvl = 1, .rfagc_top = 0x37, },
|
||||
};
|
||||
|
||||
static struct tda18271_config cnxt_rde253s_tunerconfig = {
|
||||
.std_map = &cnxt_rde253s_tda18271_std_map,
|
||||
.gate = TDA18271_GATE_ANALOG,
|
||||
};
|
||||
|
||||
static struct s5h1411_config tda18271_s5h1411_config = {
|
||||
.output_mode = S5H1411_SERIAL_OUTPUT,
|
||||
.gpio = S5H1411_GPIO_OFF,
|
||||
.vsb_if = S5H1411_IF_3250,
|
||||
.qam_if = S5H1411_IF_4000,
|
||||
.inversion = S5H1411_INVERSION_ON,
|
||||
.status_mode = S5H1411_DEMODLOCKING,
|
||||
.mpeg_timing = S5H1411_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK,
|
||||
};
|
||||
static struct s5h1411_config xc5000_s5h1411_config = {
|
||||
.output_mode = S5H1411_SERIAL_OUTPUT,
|
||||
.gpio = S5H1411_GPIO_OFF,
|
||||
.vsb_if = S5H1411_IF_3250,
|
||||
.qam_if = S5H1411_IF_3250,
|
||||
.inversion = S5H1411_INVERSION_OFF,
|
||||
.status_mode = S5H1411_DEMODLOCKING,
|
||||
.mpeg_timing = S5H1411_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK,
|
||||
};
|
||||
static inline void print_err_status(struct cx231xx *dev, int packet, int status)
|
||||
{
|
||||
char *errmsg = "Unknown";
|
||||
@@ -128,34 +173,81 @@ static inline int dvb_isoc_copy(struct cx231xx *dev, struct urb *urb)
|
||||
continue;
|
||||
}
|
||||
|
||||
dvb_dmx_swfilter(&dev->dvb->demux, urb->transfer_buffer +
|
||||
urb->iso_frame_desc[i].offset,
|
||||
urb->iso_frame_desc[i].actual_length);
|
||||
dvb_dmx_swfilter(&dev->dvb->demux,
|
||||
urb->transfer_buffer +
|
||||
urb->iso_frame_desc[i].offset,
|
||||
urb->iso_frame_desc[i].actual_length);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int dvb_bulk_copy(struct cx231xx *dev, struct urb *urb)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!dev)
|
||||
return 0;
|
||||
|
||||
if ((dev->state & DEV_DISCONNECTED) || (dev->state & DEV_MISCONFIGURED))
|
||||
return 0;
|
||||
|
||||
if (urb->status < 0) {
|
||||
print_err_status(dev, -1, urb->status);
|
||||
if (urb->status == -ENOENT)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Feed the transport payload into the kernel demux */
|
||||
dvb_dmx_swfilter(&dev->dvb->demux,
|
||||
urb->transfer_buffer, urb->actual_length);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int start_streaming(struct cx231xx_dvb *dvb)
|
||||
{
|
||||
int rc;
|
||||
struct cx231xx *dev = dvb->adapter.priv;
|
||||
|
||||
usb_set_interface(dev->udev, 0, 1);
|
||||
rc = cx231xx_set_mode(dev, CX231XX_DIGITAL_MODE);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
if (dev->USE_ISO) {
|
||||
cx231xx_info("DVB transfer mode is ISO.\n");
|
||||
mutex_lock(&dev->i2c_lock);
|
||||
cx231xx_enable_i2c_for_tuner(dev, I2C_1);
|
||||
cx231xx_set_alt_setting(dev, INDEX_TS1, 4);
|
||||
cx231xx_enable_i2c_for_tuner(dev, I2C_3);
|
||||
mutex_unlock(&dev->i2c_lock);
|
||||
rc = cx231xx_set_mode(dev, CX231XX_DIGITAL_MODE);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
dev->mode_tv = 1;
|
||||
return cx231xx_init_isoc(dev, CX231XX_DVB_MAX_PACKETS,
|
||||
CX231XX_DVB_NUM_BUFS,
|
||||
dev->ts1_mode.max_pkt_size,
|
||||
dvb_isoc_copy);
|
||||
} else {
|
||||
cx231xx_info("DVB transfer mode is BULK.\n");
|
||||
cx231xx_set_alt_setting(dev, INDEX_TS1, 0);
|
||||
rc = cx231xx_set_mode(dev, CX231XX_DIGITAL_MODE);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
dev->mode_tv = 1;
|
||||
return cx231xx_init_bulk(dev, CX231XX_DVB_MAX_PACKETS,
|
||||
CX231XX_DVB_NUM_BUFS,
|
||||
dev->ts1_mode.max_pkt_size,
|
||||
dvb_bulk_copy);
|
||||
}
|
||||
|
||||
return cx231xx_init_isoc(dev, CX231XX_DVB_MAX_PACKETS,
|
||||
CX231XX_DVB_NUM_BUFS,
|
||||
CX231XX_DVB_MAX_PACKETSIZE, dvb_isoc_copy);
|
||||
}
|
||||
|
||||
static int stop_streaming(struct cx231xx_dvb *dvb)
|
||||
{
|
||||
struct cx231xx *dev = dvb->adapter.priv;
|
||||
|
||||
cx231xx_uninit_isoc(dev);
|
||||
if (dev->USE_ISO)
|
||||
cx231xx_uninit_isoc(dev);
|
||||
else
|
||||
cx231xx_uninit_bulk(dev);
|
||||
|
||||
cx231xx_set_mode(dev, CX231XX_SUSPEND);
|
||||
|
||||
@@ -216,7 +308,11 @@ static int cx231xx_dvb_bus_ctrl(struct dvb_frontend *fe, int acquire)
|
||||
|
||||
static struct xc5000_config cnxt_rde250_tunerconfig = {
|
||||
.i2c_address = 0x61,
|
||||
.if_khz = 5380,
|
||||
.if_khz = 4000,
|
||||
};
|
||||
static struct xc5000_config cnxt_rdu250_tunerconfig = {
|
||||
.i2c_address = 0x61,
|
||||
.if_khz = 3250,
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
@@ -268,7 +364,6 @@ int cx231xx_set_analog_freq(struct cx231xx *dev, u32 freq)
|
||||
/*params.audmode = ; */
|
||||
|
||||
/* Set the analog parameters to set the frequency */
|
||||
cx231xx_info("Setting Frequency for XC5000\n");
|
||||
dops->set_analog_params(dev->dvb->frontend, ¶ms);
|
||||
}
|
||||
|
||||
@@ -446,18 +541,19 @@ static int dvb_init(struct cx231xx *dev)
|
||||
dev->cx231xx_reset_analog_tuner = cx231xx_reset_analog_tuner;
|
||||
|
||||
cx231xx_set_mode(dev, CX231XX_DIGITAL_MODE);
|
||||
cx231xx_demod_reset(dev);
|
||||
/* init frontend */
|
||||
switch (dev->model) {
|
||||
case CX231XX_BOARD_CNXT_CARRAERA:
|
||||
case CX231XX_BOARD_CNXT_RDE_250:
|
||||
|
||||
/* dev->dvb->frontend = dvb_attach(s5h1411_attach,
|
||||
&dvico_s5h1411_config,
|
||||
&dev->i2c_bus[1].i2c_adap); */
|
||||
dev->dvb->frontend = dvb_attach(dvb_dummy_fe_ofdm_attach);
|
||||
dev->dvb->frontend = dvb_attach(s5h1432_attach,
|
||||
&dvico_s5h1432_config,
|
||||
&dev->i2c_bus[2].i2c_adap);
|
||||
|
||||
if (dev->dvb->frontend == NULL) {
|
||||
printk(DRIVER_NAME
|
||||
": Failed to attach dummy front end\n");
|
||||
": Failed to attach s5h1432 front end\n");
|
||||
result = -EINVAL;
|
||||
goto out_free;
|
||||
}
|
||||
@@ -473,9 +569,12 @@ static int dvb_init(struct cx231xx *dev)
|
||||
}
|
||||
|
||||
break;
|
||||
case CX231XX_BOARD_CNXT_SHELBY:
|
||||
case CX231XX_BOARD_CNXT_RDU_250:
|
||||
|
||||
dev->dvb->frontend = dvb_attach(dvb_dummy_fe_ofdm_attach);
|
||||
dev->dvb->frontend = dvb_attach(s5h1411_attach,
|
||||
&xc5000_s5h1411_config,
|
||||
&dev->i2c_bus[2].i2c_adap);
|
||||
|
||||
if (dev->dvb->frontend == NULL) {
|
||||
printk(DRIVER_NAME
|
||||
@@ -489,7 +588,53 @@ static int dvb_init(struct cx231xx *dev)
|
||||
|
||||
if (!dvb_attach(xc5000_attach, dev->dvb->frontend,
|
||||
&dev->i2c_bus[1].i2c_adap,
|
||||
&cnxt_rde250_tunerconfig)) {
|
||||
&cnxt_rdu250_tunerconfig)) {
|
||||
result = -EINVAL;
|
||||
goto out_free;
|
||||
}
|
||||
break;
|
||||
case CX231XX_BOARD_CNXT_RDE_253S:
|
||||
|
||||
dev->dvb->frontend = dvb_attach(s5h1432_attach,
|
||||
&dvico_s5h1432_config,
|
||||
&dev->i2c_bus[2].i2c_adap);
|
||||
|
||||
if (dev->dvb->frontend == NULL) {
|
||||
printk(DRIVER_NAME
|
||||
": Failed to attach s5h1432 front end\n");
|
||||
result = -EINVAL;
|
||||
goto out_free;
|
||||
}
|
||||
|
||||
/* define general-purpose callback pointer */
|
||||
dvb->frontend->callback = cx231xx_tuner_callback;
|
||||
|
||||
if (!dvb_attach(tda18271_attach, dev->dvb->frontend,
|
||||
0x60, &dev->i2c_bus[1].i2c_adap,
|
||||
&cnxt_rde253s_tunerconfig)) {
|
||||
result = -EINVAL;
|
||||
goto out_free;
|
||||
}
|
||||
break;
|
||||
case CX231XX_BOARD_CNXT_RDU_253S:
|
||||
|
||||
dev->dvb->frontend = dvb_attach(s5h1411_attach,
|
||||
&tda18271_s5h1411_config,
|
||||
&dev->i2c_bus[2].i2c_adap);
|
||||
|
||||
if (dev->dvb->frontend == NULL) {
|
||||
printk(DRIVER_NAME
|
||||
": Failed to attach dummy front end\n");
|
||||
result = -EINVAL;
|
||||
goto out_free;
|
||||
}
|
||||
|
||||
/* define general-purpose callback pointer */
|
||||
dvb->frontend->callback = cx231xx_tuner_callback;
|
||||
|
||||
if (!dvb_attach(tda18271_attach, dev->dvb->frontend,
|
||||
0x60, &dev->i2c_bus[1].i2c_adap,
|
||||
&cnxt_rde253s_tunerconfig)) {
|
||||
result = -EINVAL;
|
||||
goto out_free;
|
||||
}
|
||||
|
||||
@@ -359,7 +359,7 @@ static int cx231xx_i2c_xfer(struct i2c_adapter *i2c_adap,
|
||||
|
||||
if (num <= 0)
|
||||
return 0;
|
||||
|
||||
mutex_lock(&dev->i2c_lock);
|
||||
for (i = 0; i < num; i++) {
|
||||
|
||||
addr = msgs[i].addr >> 1;
|
||||
@@ -372,6 +372,7 @@ static int cx231xx_i2c_xfer(struct i2c_adapter *i2c_adap,
|
||||
rc = cx231xx_i2c_check_for_device(i2c_adap, &msgs[i]);
|
||||
if (rc < 0) {
|
||||
dprintk2(2, " no device\n");
|
||||
mutex_lock(&dev->i2c_lock);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -384,7 +385,7 @@ static int cx231xx_i2c_xfer(struct i2c_adapter *i2c_adap,
|
||||
}
|
||||
} else if (i + 1 < num && (msgs[i + 1].flags & I2C_M_RD) &&
|
||||
msgs[i].addr == msgs[i + 1].addr
|
||||
&& (msgs[i].len <= 2) && (bus->nr < 2)) {
|
||||
&& (msgs[i].len <= 2) && (bus->nr < 3)) {
|
||||
/* read bytes */
|
||||
rc = cx231xx_i2c_recv_bytes_with_saddr(i2c_adap,
|
||||
&msgs[i],
|
||||
@@ -407,10 +408,11 @@ static int cx231xx_i2c_xfer(struct i2c_adapter *i2c_adap,
|
||||
if (i2c_debug >= 2)
|
||||
printk("\n");
|
||||
}
|
||||
|
||||
mutex_unlock(&dev->i2c_lock);
|
||||
return num;
|
||||
err:
|
||||
dprintk2(2, " ERROR: %i\n", rc);
|
||||
mutex_unlock(&dev->i2c_lock);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ struct cx231xx_ir_poll_result {
|
||||
struct cx231xx_IR {
|
||||
struct cx231xx *dev;
|
||||
struct input_dev *input;
|
||||
struct ir_input_state ir;
|
||||
char name[32];
|
||||
char phys[32];
|
||||
|
||||
@@ -68,7 +69,9 @@ struct cx231xx_IR {
|
||||
int polling;
|
||||
struct work_struct work;
|
||||
struct timer_list timer;
|
||||
unsigned int last_toggle:1;
|
||||
unsigned int last_readcount;
|
||||
unsigned int repeat_interval;
|
||||
|
||||
int (*get_key) (struct cx231xx_IR *, struct cx231xx_ir_poll_result *);
|
||||
};
|
||||
@@ -80,6 +83,7 @@ struct cx231xx_IR {
|
||||
static void cx231xx_ir_handle_key(struct cx231xx_IR *ir)
|
||||
{
|
||||
int result;
|
||||
int do_sendkey = 0;
|
||||
struct cx231xx_ir_poll_result poll_result;
|
||||
|
||||
/* read the registers containing the IR status */
|
||||
@@ -93,23 +97,44 @@ static void cx231xx_ir_handle_key(struct cx231xx_IR *ir)
|
||||
poll_result.toggle_bit, poll_result.read_count,
|
||||
ir->last_readcount, poll_result.rc_data[0]);
|
||||
|
||||
if (poll_result.read_count > 0 &&
|
||||
poll_result.read_count != ir->last_readcount)
|
||||
ir_keydown(ir->input,
|
||||
poll_result.rc_data[0],
|
||||
poll_result.toggle_bit);
|
||||
|
||||
if (ir->dev->chip_id == CHIP_ID_EM2874)
|
||||
if (ir->dev->chip_id == CHIP_ID_EM2874) {
|
||||
/* The em2874 clears the readcount field every time the
|
||||
register is read. The em2860/2880 datasheet says that it
|
||||
is supposed to clear the readcount, but it doesn't. So with
|
||||
the em2874, we are looking for a non-zero read count as
|
||||
opposed to a readcount that is incrementing */
|
||||
ir->last_readcount = 0;
|
||||
else
|
||||
ir->last_readcount = poll_result.read_count;
|
||||
|
||||
}
|
||||
|
||||
if (poll_result.read_count == 0) {
|
||||
/* The button has not been pressed since the last read */
|
||||
} else if (ir->last_toggle != poll_result.toggle_bit) {
|
||||
/* A button has been pressed */
|
||||
dprintk("button has been pressed\n");
|
||||
ir->last_toggle = poll_result.toggle_bit;
|
||||
ir->repeat_interval = 0;
|
||||
do_sendkey = 1;
|
||||
} else if (poll_result.toggle_bit == ir->last_toggle &&
|
||||
poll_result.read_count > 0 &&
|
||||
poll_result.read_count != ir->last_readcount) {
|
||||
/* The button is still being held down */
|
||||
dprintk("button being held down\n");
|
||||
|
||||
/* Debouncer for first keypress */
|
||||
if (ir->repeat_interval++ > 9) {
|
||||
/* Start repeating after 1 second */
|
||||
do_sendkey = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (do_sendkey) {
|
||||
dprintk("sending keypress\n");
|
||||
ir_input_keydown(ir->input, &ir->ir, poll_result.rc_data[0]);
|
||||
ir_input_nokey(ir->input, &ir->ir);
|
||||
}
|
||||
|
||||
ir->last_readcount = poll_result.read_count;
|
||||
return;
|
||||
}
|
||||
|
||||
static void ir_timer(unsigned long data)
|
||||
@@ -175,6 +200,10 @@ int cx231xx_ir_init(struct cx231xx *dev)
|
||||
usb_make_path(dev->udev, ir->phys, sizeof(ir->phys));
|
||||
strlcat(ir->phys, "/input0", sizeof(ir->phys));
|
||||
|
||||
err = ir_input_init(input_dev, &ir->ir, IR_TYPE_OTHER);
|
||||
if (err < 0)
|
||||
goto err_out_free;
|
||||
|
||||
input_dev->name = ir->name;
|
||||
input_dev->phys = ir->phys;
|
||||
input_dev->id.bustype = BUS_USB;
|
||||
@@ -190,7 +219,7 @@ int cx231xx_ir_init(struct cx231xx *dev)
|
||||
cx231xx_ir_start(ir);
|
||||
|
||||
/* all done */
|
||||
err = __ir_input_register(ir->input, dev->board.ir_codes,
|
||||
err = ir_input_register(ir->input, dev->board.ir_codes,
|
||||
NULL, MODULE_NAME);
|
||||
if (err)
|
||||
goto err_out_stop;
|
||||
|
||||
@@ -102,7 +102,7 @@ static inline int cx231xx_isoc_vbi_copy(struct cx231xx *dev, struct urb *urb)
|
||||
return 0;
|
||||
}
|
||||
|
||||
buf = dev->vbi_mode.isoc_ctl.buf;
|
||||
buf = dev->vbi_mode.bulk_ctl.buf;
|
||||
|
||||
/* get buffer pointer and length */
|
||||
p_buffer = urb->transfer_buffer;
|
||||
@@ -209,8 +209,8 @@ static void free_buffer(struct videobuf_queue *vq, struct cx231xx_buffer *buf)
|
||||
VIDEOBUF_ACTIVE, it won't be, though.
|
||||
*/
|
||||
spin_lock_irqsave(&dev->vbi_mode.slock, flags);
|
||||
if (dev->vbi_mode.isoc_ctl.buf == buf)
|
||||
dev->vbi_mode.isoc_ctl.buf = NULL;
|
||||
if (dev->vbi_mode.bulk_ctl.buf == buf)
|
||||
dev->vbi_mode.bulk_ctl.buf = NULL;
|
||||
spin_unlock_irqrestore(&dev->vbi_mode.slock, flags);
|
||||
|
||||
videobuf_vmalloc_free(&buf->vb);
|
||||
@@ -246,7 +246,7 @@ vbi_buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb,
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!dev->vbi_mode.isoc_ctl.num_bufs)
|
||||
if (!dev->vbi_mode.bulk_ctl.num_bufs)
|
||||
urb_init = 1;
|
||||
|
||||
if (urb_init) {
|
||||
@@ -328,7 +328,7 @@ static void cx231xx_irq_vbi_callback(struct urb *urb)
|
||||
|
||||
/* Copy data from URB */
|
||||
spin_lock(&dev->vbi_mode.slock);
|
||||
rc = dev->vbi_mode.isoc_ctl.isoc_copy(dev, urb);
|
||||
rc = dev->vbi_mode.bulk_ctl.bulk_copy(dev, urb);
|
||||
spin_unlock(&dev->vbi_mode.slock);
|
||||
|
||||
/* Reset status */
|
||||
@@ -351,34 +351,34 @@ void cx231xx_uninit_vbi_isoc(struct cx231xx *dev)
|
||||
|
||||
cx231xx_info(DRIVER_NAME "cx231xx: called cx231xx_uninit_vbi_isoc\n");
|
||||
|
||||
dev->vbi_mode.isoc_ctl.nfields = -1;
|
||||
for (i = 0; i < dev->vbi_mode.isoc_ctl.num_bufs; i++) {
|
||||
urb = dev->vbi_mode.isoc_ctl.urb[i];
|
||||
dev->vbi_mode.bulk_ctl.nfields = -1;
|
||||
for (i = 0; i < dev->vbi_mode.bulk_ctl.num_bufs; i++) {
|
||||
urb = dev->vbi_mode.bulk_ctl.urb[i];
|
||||
if (urb) {
|
||||
if (!irqs_disabled())
|
||||
usb_kill_urb(urb);
|
||||
else
|
||||
usb_unlink_urb(urb);
|
||||
|
||||
if (dev->vbi_mode.isoc_ctl.transfer_buffer[i]) {
|
||||
if (dev->vbi_mode.bulk_ctl.transfer_buffer[i]) {
|
||||
|
||||
kfree(dev->vbi_mode.isoc_ctl.
|
||||
kfree(dev->vbi_mode.bulk_ctl.
|
||||
transfer_buffer[i]);
|
||||
dev->vbi_mode.isoc_ctl.transfer_buffer[i] =
|
||||
dev->vbi_mode.bulk_ctl.transfer_buffer[i] =
|
||||
NULL;
|
||||
}
|
||||
usb_free_urb(urb);
|
||||
dev->vbi_mode.isoc_ctl.urb[i] = NULL;
|
||||
dev->vbi_mode.bulk_ctl.urb[i] = NULL;
|
||||
}
|
||||
dev->vbi_mode.isoc_ctl.transfer_buffer[i] = NULL;
|
||||
dev->vbi_mode.bulk_ctl.transfer_buffer[i] = NULL;
|
||||
}
|
||||
|
||||
kfree(dev->vbi_mode.isoc_ctl.urb);
|
||||
kfree(dev->vbi_mode.isoc_ctl.transfer_buffer);
|
||||
kfree(dev->vbi_mode.bulk_ctl.urb);
|
||||
kfree(dev->vbi_mode.bulk_ctl.transfer_buffer);
|
||||
|
||||
dev->vbi_mode.isoc_ctl.urb = NULL;
|
||||
dev->vbi_mode.isoc_ctl.transfer_buffer = NULL;
|
||||
dev->vbi_mode.isoc_ctl.num_bufs = 0;
|
||||
dev->vbi_mode.bulk_ctl.urb = NULL;
|
||||
dev->vbi_mode.bulk_ctl.transfer_buffer = NULL;
|
||||
dev->vbi_mode.bulk_ctl.num_bufs = 0;
|
||||
|
||||
cx231xx_capture_start(dev, 0, Vbi);
|
||||
}
|
||||
@@ -389,7 +389,7 @@ EXPORT_SYMBOL_GPL(cx231xx_uninit_vbi_isoc);
|
||||
*/
|
||||
int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets,
|
||||
int num_bufs, int max_pkt_size,
|
||||
int (*isoc_copy) (struct cx231xx *dev,
|
||||
int (*bulk_copy) (struct cx231xx *dev,
|
||||
struct urb *urb))
|
||||
{
|
||||
struct cx231xx_dmaqueue *dma_q = &dev->vbi_mode.vidq;
|
||||
@@ -408,8 +408,8 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets,
|
||||
usb_rcvbulkpipe(dev->udev,
|
||||
dev->vbi_mode.end_point_addr));
|
||||
|
||||
dev->vbi_mode.isoc_ctl.isoc_copy = isoc_copy;
|
||||
dev->vbi_mode.isoc_ctl.num_bufs = num_bufs;
|
||||
dev->vbi_mode.bulk_ctl.bulk_copy = bulk_copy;
|
||||
dev->vbi_mode.bulk_ctl.num_bufs = num_bufs;
|
||||
dma_q->pos = 0;
|
||||
dma_q->is_partial_line = 0;
|
||||
dma_q->last_sav = 0;
|
||||
@@ -421,42 +421,42 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets,
|
||||
for (i = 0; i < 8; i++)
|
||||
dma_q->partial_buf[i] = 0;
|
||||
|
||||
dev->vbi_mode.isoc_ctl.urb = kzalloc(sizeof(void *) * num_bufs,
|
||||
dev->vbi_mode.bulk_ctl.urb = kzalloc(sizeof(void *) * num_bufs,
|
||||
GFP_KERNEL);
|
||||
if (!dev->vbi_mode.isoc_ctl.urb) {
|
||||
if (!dev->vbi_mode.bulk_ctl.urb) {
|
||||
cx231xx_errdev("cannot alloc memory for usb buffers\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
dev->vbi_mode.isoc_ctl.transfer_buffer =
|
||||
dev->vbi_mode.bulk_ctl.transfer_buffer =
|
||||
kzalloc(sizeof(void *) * num_bufs, GFP_KERNEL);
|
||||
if (!dev->vbi_mode.isoc_ctl.transfer_buffer) {
|
||||
if (!dev->vbi_mode.bulk_ctl.transfer_buffer) {
|
||||
cx231xx_errdev("cannot allocate memory for usbtransfer\n");
|
||||
kfree(dev->vbi_mode.isoc_ctl.urb);
|
||||
kfree(dev->vbi_mode.bulk_ctl.urb);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
dev->vbi_mode.isoc_ctl.max_pkt_size = max_pkt_size;
|
||||
dev->vbi_mode.isoc_ctl.buf = NULL;
|
||||
dev->vbi_mode.bulk_ctl.max_pkt_size = max_pkt_size;
|
||||
dev->vbi_mode.bulk_ctl.buf = NULL;
|
||||
|
||||
sb_size = max_packets * dev->vbi_mode.isoc_ctl.max_pkt_size;
|
||||
sb_size = max_packets * dev->vbi_mode.bulk_ctl.max_pkt_size;
|
||||
|
||||
/* allocate urbs and transfer buffers */
|
||||
for (i = 0; i < dev->vbi_mode.isoc_ctl.num_bufs; i++) {
|
||||
for (i = 0; i < dev->vbi_mode.bulk_ctl.num_bufs; i++) {
|
||||
|
||||
urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if (!urb) {
|
||||
cx231xx_err(DRIVER_NAME
|
||||
": cannot alloc isoc_ctl.urb %i\n", i);
|
||||
": cannot alloc bulk_ctl.urb %i\n", i);
|
||||
cx231xx_uninit_vbi_isoc(dev);
|
||||
return -ENOMEM;
|
||||
}
|
||||
dev->vbi_mode.isoc_ctl.urb[i] = urb;
|
||||
dev->vbi_mode.bulk_ctl.urb[i] = urb;
|
||||
urb->transfer_flags = 0;
|
||||
|
||||
dev->vbi_mode.isoc_ctl.transfer_buffer[i] =
|
||||
dev->vbi_mode.bulk_ctl.transfer_buffer[i] =
|
||||
kzalloc(sb_size, GFP_KERNEL);
|
||||
if (!dev->vbi_mode.isoc_ctl.transfer_buffer[i]) {
|
||||
if (!dev->vbi_mode.bulk_ctl.transfer_buffer[i]) {
|
||||
cx231xx_err(DRIVER_NAME
|
||||
": unable to allocate %i bytes for transfer"
|
||||
" buffer %i%s\n", sb_size, i,
|
||||
@@ -467,15 +467,15 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets,
|
||||
|
||||
pipe = usb_rcvbulkpipe(dev->udev, dev->vbi_mode.end_point_addr);
|
||||
usb_fill_bulk_urb(urb, dev->udev, pipe,
|
||||
dev->vbi_mode.isoc_ctl.transfer_buffer[i],
|
||||
dev->vbi_mode.bulk_ctl.transfer_buffer[i],
|
||||
sb_size, cx231xx_irq_vbi_callback, dma_q);
|
||||
}
|
||||
|
||||
init_waitqueue_head(&dma_q->wq);
|
||||
|
||||
/* submit urbs and enables IRQ */
|
||||
for (i = 0; i < dev->vbi_mode.isoc_ctl.num_bufs; i++) {
|
||||
rc = usb_submit_urb(dev->vbi_mode.isoc_ctl.urb[i], GFP_ATOMIC);
|
||||
for (i = 0; i < dev->vbi_mode.bulk_ctl.num_bufs; i++) {
|
||||
rc = usb_submit_urb(dev->vbi_mode.bulk_ctl.urb[i], GFP_ATOMIC);
|
||||
if (rc) {
|
||||
cx231xx_err(DRIVER_NAME
|
||||
": submit of urb %i failed (error=%i)\n", i,
|
||||
@@ -536,7 +536,7 @@ static inline void vbi_buffer_filled(struct cx231xx *dev,
|
||||
buf->vb.field_count++;
|
||||
do_gettimeofday(&buf->vb.ts);
|
||||
|
||||
dev->vbi_mode.isoc_ctl.buf = NULL;
|
||||
dev->vbi_mode.bulk_ctl.buf = NULL;
|
||||
|
||||
list_del(&buf->vb.queue);
|
||||
wake_up(&buf->vb.done);
|
||||
@@ -553,7 +553,7 @@ u32 cx231xx_copy_vbi_line(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q,
|
||||
cx231xx_reset_vbi_buffer(dev, dma_q);
|
||||
|
||||
/* get the buffer pointer */
|
||||
buf = dev->vbi_mode.isoc_ctl.buf;
|
||||
buf = dev->vbi_mode.bulk_ctl.buf;
|
||||
|
||||
/* Remember the field number for next time */
|
||||
dma_q->current_field = field_number;
|
||||
@@ -618,7 +618,7 @@ static inline void get_next_vbi_buf(struct cx231xx_dmaqueue *dma_q,
|
||||
|
||||
if (list_empty(&dma_q->active)) {
|
||||
cx231xx_err(DRIVER_NAME ": No active queue to serve\n");
|
||||
dev->vbi_mode.isoc_ctl.buf = NULL;
|
||||
dev->vbi_mode.bulk_ctl.buf = NULL;
|
||||
*buf = NULL;
|
||||
return;
|
||||
}
|
||||
@@ -630,7 +630,7 @@ static inline void get_next_vbi_buf(struct cx231xx_dmaqueue *dma_q,
|
||||
outp = videobuf_to_vmalloc(&(*buf)->vb);
|
||||
memset(outp, 0, (*buf)->vb.size);
|
||||
|
||||
dev->vbi_mode.isoc_ctl.buf = *buf;
|
||||
dev->vbi_mode.bulk_ctl.buf = *buf;
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -640,7 +640,7 @@ void cx231xx_reset_vbi_buffer(struct cx231xx *dev,
|
||||
{
|
||||
struct cx231xx_buffer *buf;
|
||||
|
||||
buf = dev->vbi_mode.isoc_ctl.buf;
|
||||
buf = dev->vbi_mode.bulk_ctl.buf;
|
||||
|
||||
if (buf == NULL) {
|
||||
/* first try to get the buffer */
|
||||
@@ -664,7 +664,7 @@ int cx231xx_do_vbi_copy(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q,
|
||||
void *startwrite;
|
||||
int offset, lencopy;
|
||||
|
||||
buf = dev->vbi_mode.isoc_ctl.buf;
|
||||
buf = dev->vbi_mode.bulk_ctl.buf;
|
||||
|
||||
if (buf == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
@@ -41,7 +41,7 @@ extern struct videobuf_queue_ops cx231xx_vbi_qops;
|
||||
/* stream functions */
|
||||
int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets,
|
||||
int num_bufs, int max_pkt_size,
|
||||
int (*isoc_copy) (struct cx231xx *dev,
|
||||
int (*bulk_copy) (struct cx231xx *dev,
|
||||
struct urb *urb));
|
||||
|
||||
void cx231xx_uninit_vbi_isoc(struct cx231xx *dev);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -29,6 +29,7 @@
|
||||
#include <linux/i2c-algo-bit.h>
|
||||
#include <linux/mutex.h>
|
||||
|
||||
#include <media/cx2341x.h>
|
||||
|
||||
#include <media/videobuf-vmalloc.h>
|
||||
#include <media/v4l2-device.h>
|
||||
@@ -49,12 +50,18 @@
|
||||
#define AFE_DEVICE_ADDRESS 0x60
|
||||
#define I2S_BLK_DEVICE_ADDRESS 0x98
|
||||
#define VID_BLK_I2C_ADDRESS 0x88
|
||||
#define VERVE_I2C_ADDRESS 0x40
|
||||
#define DIF_USE_BASEBAND 0xFFFFFFFF
|
||||
|
||||
/* Boards supported by driver */
|
||||
#define CX231XX_BOARD_UNKNOWN 0
|
||||
#define CX231XX_BOARD_CNXT_RDE_250 1
|
||||
#define CX231XX_BOARD_CNXT_RDU_250 2
|
||||
#define CX231XX_BOARD_CNXT_CARRAERA 1
|
||||
#define CX231XX_BOARD_CNXT_SHELBY 2
|
||||
#define CX231XX_BOARD_CNXT_RDE_253S 3
|
||||
#define CX231XX_BOARD_CNXT_RDU_253S 4
|
||||
#define CX231XX_BOARD_CNXT_VIDEO_GRABBER 5
|
||||
#define CX231XX_BOARD_CNXT_RDE_250 6
|
||||
#define CX231XX_BOARD_CNXT_RDU_250 7
|
||||
|
||||
/* Limits minimum and default number of buffers */
|
||||
#define CX231XX_MIN_BUF 4
|
||||
@@ -95,6 +102,24 @@
|
||||
#define CX231XX_URB_TIMEOUT \
|
||||
msecs_to_jiffies(CX231XX_NUM_BUFS * CX231XX_NUM_PACKETS)
|
||||
|
||||
#define CX231xx_NORMS (\
|
||||
V4L2_STD_NTSC_M | V4L2_STD_NTSC_M_JP | V4L2_STD_NTSC_443 | \
|
||||
V4L2_STD_PAL_BG | V4L2_STD_PAL_DK | V4L2_STD_PAL_I | \
|
||||
V4L2_STD_PAL_M | V4L2_STD_PAL_N | V4L2_STD_PAL_Nc | \
|
||||
V4L2_STD_PAL_60 | V4L2_STD_SECAM_L | V4L2_STD_SECAM_DK)
|
||||
#define CX231xx_VERSION_CODE KERNEL_VERSION(0, 0, 2)
|
||||
|
||||
#define SLEEP_S5H1432 30
|
||||
#define CX23417_OSC_EN 8
|
||||
#define CX23417_RESET 9
|
||||
|
||||
struct cx23417_fmt {
|
||||
char *name;
|
||||
u32 fourcc; /* v4l2 format id */
|
||||
int depth;
|
||||
int flags;
|
||||
u32 cxformat;
|
||||
};
|
||||
enum cx231xx_mode {
|
||||
CX231XX_SUSPEND,
|
||||
CX231XX_ANALOG_MODE,
|
||||
@@ -114,7 +139,7 @@ enum cx231xx_stream_state {
|
||||
|
||||
struct cx231xx;
|
||||
|
||||
struct cx231xx_usb_isoc_ctl {
|
||||
struct cx231xx_isoc_ctl {
|
||||
/* max packet size of isoc transaction */
|
||||
int max_pkt_size;
|
||||
|
||||
@@ -148,6 +173,40 @@ struct cx231xx_usb_isoc_ctl {
|
||||
int (*isoc_copy) (struct cx231xx *dev, struct urb *urb);
|
||||
};
|
||||
|
||||
struct cx231xx_bulk_ctl {
|
||||
/* max packet size of bulk transaction */
|
||||
int max_pkt_size;
|
||||
|
||||
/* number of allocated urbs */
|
||||
int num_bufs;
|
||||
|
||||
/* urb for bulk transfers */
|
||||
struct urb **urb;
|
||||
|
||||
/* transfer buffers for bulk transfer */
|
||||
char **transfer_buffer;
|
||||
|
||||
/* Last buffer command and region */
|
||||
u8 cmd;
|
||||
int pos, size, pktsize;
|
||||
|
||||
/* Last field: ODD or EVEN? */
|
||||
int field;
|
||||
|
||||
/* Stores incomplete commands */
|
||||
u32 tmp_buf;
|
||||
int tmp_buf_len;
|
||||
|
||||
/* Stores already requested buffers */
|
||||
struct cx231xx_buffer *buf;
|
||||
|
||||
/* Stores the number of received fields */
|
||||
int nfields;
|
||||
|
||||
/* bulk urb callback */
|
||||
int (*bulk_copy) (struct cx231xx *dev, struct urb *urb);
|
||||
};
|
||||
|
||||
struct cx231xx_fmt {
|
||||
char *name;
|
||||
u32 fourcc; /* v4l2 format id */
|
||||
@@ -165,6 +224,11 @@ struct cx231xx_buffer {
|
||||
int receiving;
|
||||
};
|
||||
|
||||
enum ps_package_head {
|
||||
CX231XX_NEED_ADD_PS_PACKAGE_HEAD = 0,
|
||||
CX231XX_NONEED_PS_PACKAGE_HEAD
|
||||
};
|
||||
|
||||
struct cx231xx_dmaqueue {
|
||||
struct list_head active;
|
||||
struct list_head queued;
|
||||
@@ -181,6 +245,14 @@ struct cx231xx_dmaqueue {
|
||||
u32 lines_completed;
|
||||
u8 field1_done;
|
||||
u32 lines_per_field;
|
||||
|
||||
/*Mpeg2 control buffer*/
|
||||
u8 *p_left_data;
|
||||
u32 left_data_count;
|
||||
u8 mpeg_buffer_done;
|
||||
u32 mpeg_buffer_completed;
|
||||
enum ps_package_head add_ps_package_head;
|
||||
char ps_head[10];
|
||||
};
|
||||
|
||||
/* inputs */
|
||||
@@ -309,7 +381,8 @@ enum AUDIO_INPUT {
|
||||
};
|
||||
|
||||
#define CX231XX_AUDIO_BUFS 5
|
||||
#define CX231XX_NUM_AUDIO_PACKETS 64
|
||||
#define CX231XX_NUM_AUDIO_PACKETS 16
|
||||
#define CX231XX_ISO_NUM_AUDIO_PACKETS 64
|
||||
#define CX231XX_CAPTURE_STREAM_EN 1
|
||||
#define CX231XX_STOP_AUDIO 0
|
||||
#define CX231XX_START_AUDIO 1
|
||||
@@ -331,6 +404,7 @@ struct cx231xx_audio {
|
||||
|
||||
int users, shutdown;
|
||||
enum cx231xx_stream_state capture_stream;
|
||||
/* locks */
|
||||
spinlock_t slock;
|
||||
|
||||
int alt; /* alternate */
|
||||
@@ -350,6 +424,28 @@ struct cx231xx_fh {
|
||||
struct videobuf_queue vb_vidq;
|
||||
|
||||
enum v4l2_buf_type type;
|
||||
|
||||
|
||||
|
||||
/*following is copyed from cx23885.h*/
|
||||
u32 resources;
|
||||
|
||||
/* video overlay */
|
||||
struct v4l2_window win;
|
||||
struct v4l2_clip *clips;
|
||||
unsigned int nclips;
|
||||
|
||||
/* video capture */
|
||||
struct cx23417_fmt *fmt;
|
||||
unsigned int width, height;
|
||||
|
||||
/* vbi capture */
|
||||
struct videobuf_queue vidq;
|
||||
struct videobuf_queue vbiq;
|
||||
|
||||
/* MPEG Encoder specifics ONLY */
|
||||
|
||||
atomic_t v4l_reading;
|
||||
};
|
||||
|
||||
/*****************************************************************/
|
||||
@@ -403,6 +499,13 @@ struct VENDOR_REQUEST_IN {
|
||||
u8 *pBuff;
|
||||
};
|
||||
|
||||
struct cx231xx_tvnorm {
|
||||
char *name;
|
||||
v4l2_std_id id;
|
||||
u32 cxiformat;
|
||||
u32 cxoformat;
|
||||
};
|
||||
|
||||
struct cx231xx_ctrl {
|
||||
struct v4l2_queryctrl v;
|
||||
u32 off;
|
||||
@@ -424,7 +527,9 @@ enum TRANSFER_TYPE {
|
||||
struct cx231xx_video_mode {
|
||||
/* Isoc control struct */
|
||||
struct cx231xx_dmaqueue vidq;
|
||||
struct cx231xx_usb_isoc_ctl isoc_ctl;
|
||||
struct cx231xx_isoc_ctl isoc_ctl;
|
||||
struct cx231xx_bulk_ctl bulk_ctl;
|
||||
/* locks */
|
||||
spinlock_t slock;
|
||||
|
||||
/* usb transfer */
|
||||
@@ -434,6 +539,64 @@ struct cx231xx_video_mode {
|
||||
unsigned int *alt_max_pkt_size; /* array of wMaxPacketSize */
|
||||
u16 end_point_addr;
|
||||
};
|
||||
/*
|
||||
struct cx23885_dmaqueue {
|
||||
struct list_head active;
|
||||
struct list_head queued;
|
||||
struct timer_list timeout;
|
||||
struct btcx_riscmem stopper;
|
||||
u32 count;
|
||||
};
|
||||
*/
|
||||
struct cx231xx_tsport {
|
||||
struct cx231xx *dev;
|
||||
|
||||
int nr;
|
||||
int sram_chno;
|
||||
|
||||
struct videobuf_dvb_frontends frontends;
|
||||
|
||||
/* dma queues */
|
||||
|
||||
u32 ts_packet_size;
|
||||
u32 ts_packet_count;
|
||||
|
||||
int width;
|
||||
int height;
|
||||
|
||||
/* locks */
|
||||
spinlock_t slock;
|
||||
|
||||
/* registers */
|
||||
u32 reg_gpcnt;
|
||||
u32 reg_gpcnt_ctl;
|
||||
u32 reg_dma_ctl;
|
||||
u32 reg_lngth;
|
||||
u32 reg_hw_sop_ctrl;
|
||||
u32 reg_gen_ctrl;
|
||||
u32 reg_bd_pkt_status;
|
||||
u32 reg_sop_status;
|
||||
u32 reg_fifo_ovfl_stat;
|
||||
u32 reg_vld_misc;
|
||||
u32 reg_ts_clk_en;
|
||||
u32 reg_ts_int_msk;
|
||||
u32 reg_ts_int_stat;
|
||||
u32 reg_src_sel;
|
||||
|
||||
/* Default register vals */
|
||||
int pci_irqmask;
|
||||
u32 dma_ctl_val;
|
||||
u32 ts_int_msk_val;
|
||||
u32 gen_ctrl_val;
|
||||
u32 ts_clk_en_val;
|
||||
u32 src_sel_val;
|
||||
u32 vld_misc_val;
|
||||
u32 hw_sop_ctrl_val;
|
||||
|
||||
/* Allow a single tsport to have multiple frontends */
|
||||
u32 num_frontends;
|
||||
void *port_priv;
|
||||
};
|
||||
|
||||
/* main device struct */
|
||||
struct cx231xx {
|
||||
@@ -465,7 +628,9 @@ struct cx231xx {
|
||||
/* I2C adapters: Master 1 & 2 (External) & Master 3 (Internal only) */
|
||||
struct cx231xx_i2c i2c_bus[3];
|
||||
unsigned int xc_fw_load_done:1;
|
||||
/* locks */
|
||||
struct mutex gpio_i2c_lock;
|
||||
struct mutex i2c_lock;
|
||||
|
||||
/* video for linux */
|
||||
int users; /* user count for exclusive use */
|
||||
@@ -505,6 +670,8 @@ struct cx231xx {
|
||||
struct cx231xx_video_mode sliced_cc_mode;
|
||||
struct cx231xx_video_mode ts1_mode;
|
||||
|
||||
atomic_t devlist_count;
|
||||
|
||||
struct usb_device *udev; /* the usb device */
|
||||
char urb_buf[URB_MAX_CTRL_SIZE]; /* urb control msg buffer */
|
||||
|
||||
@@ -550,8 +717,24 @@ struct cx231xx {
|
||||
u8 vbi_or_sliced_cc_mode; /* 0 - vbi ; 1 - sliced cc mode */
|
||||
enum cx231xx_std_mode std_mode; /* 0 - Air; 1 - cable */
|
||||
|
||||
/*mode: digital=1 or analog=0*/
|
||||
u8 mode_tv;
|
||||
|
||||
u8 USE_ISO;
|
||||
struct cx231xx_tvnorm encodernorm;
|
||||
struct cx231xx_tsport ts1, ts2;
|
||||
struct cx2341x_mpeg_params mpeg_params;
|
||||
struct video_device *v4l_device;
|
||||
atomic_t v4l_reader_count;
|
||||
u32 freq;
|
||||
unsigned int input;
|
||||
u32 cx23417_mailbox;
|
||||
u32 __iomem *lmmio;
|
||||
u8 __iomem *bmmio;
|
||||
};
|
||||
|
||||
extern struct list_head cx231xx_devlist;
|
||||
|
||||
#define cx25840_call(cx231xx, o, f, args...) \
|
||||
v4l2_subdev_call(cx231xx->sd_cx25840, o, f, ##args)
|
||||
#define tuner_call(cx231xx, o, f, args...) \
|
||||
@@ -577,6 +760,10 @@ int cx231xx_i2c_register(struct cx231xx_i2c *bus);
|
||||
int cx231xx_i2c_unregister(struct cx231xx_i2c *bus);
|
||||
|
||||
/* Internal block control functions */
|
||||
int cx231xx_read_i2c_master(struct cx231xx *dev, u8 dev_addr, u16 saddr,
|
||||
u8 saddr_len, u32 *data, u8 data_len, int master);
|
||||
int cx231xx_write_i2c_master(struct cx231xx *dev, u8 dev_addr, u16 saddr,
|
||||
u8 saddr_len, u32 data, u8 data_len, int master);
|
||||
int cx231xx_read_i2c_data(struct cx231xx *dev, u8 dev_addr,
|
||||
u16 saddr, u8 saddr_len, u32 *data, u8 data_len);
|
||||
int cx231xx_write_i2c_data(struct cx231xx *dev, u8 dev_addr,
|
||||
@@ -588,6 +775,9 @@ int cx231xx_read_modify_write_i2c_dword(struct cx231xx *dev, u8 dev_addr,
|
||||
u16 saddr, u32 mask, u32 value);
|
||||
u32 cx231xx_set_field(u32 field_mask, u32 data);
|
||||
|
||||
/*verve r/w*/
|
||||
void initGPIO(struct cx231xx *dev);
|
||||
void uninitGPIO(struct cx231xx *dev);
|
||||
/* afe related functions */
|
||||
int cx231xx_afe_init_super_block(struct cx231xx *dev, u32 ref_count);
|
||||
int cx231xx_afe_init_channels(struct cx231xx *dev);
|
||||
@@ -607,6 +797,19 @@ int cx231xx_i2s_blk_set_audio_input(struct cx231xx *dev, u8 audio_input);
|
||||
/* DIF related functions */
|
||||
int cx231xx_dif_configure_C2HH_for_low_IF(struct cx231xx *dev, u32 mode,
|
||||
u32 function_mode, u32 standard);
|
||||
void cx231xx_set_Colibri_For_LowIF(struct cx231xx *dev, u32 if_freq,
|
||||
u8 spectral_invert, u32 mode);
|
||||
u32 cx231xx_Get_Colibri_CarrierOffset(u32 mode, u32 standerd);
|
||||
void cx231xx_set_DIF_bandpass(struct cx231xx *dev, u32 if_freq,
|
||||
u8 spectral_invert, u32 mode);
|
||||
void cx231xx_Setup_AFE_for_LowIF(struct cx231xx *dev);
|
||||
void reset_s5h1432_demod(struct cx231xx *dev);
|
||||
void cx231xx_dump_HH_reg(struct cx231xx *dev);
|
||||
void update_HH_register_after_set_DIF(struct cx231xx *dev);
|
||||
void cx231xx_dump_SC_reg(struct cx231xx *dev);
|
||||
|
||||
|
||||
|
||||
int cx231xx_dif_set_standard(struct cx231xx *dev, u32 standard);
|
||||
int cx231xx_tuner_pre_channel_change(struct cx231xx *dev);
|
||||
int cx231xx_tuner_post_channel_change(struct cx231xx *dev);
|
||||
@@ -675,12 +878,26 @@ int cx231xx_capture_start(struct cx231xx *dev, int start, u8 media_type);
|
||||
int cx231xx_resolution_set(struct cx231xx *dev);
|
||||
int cx231xx_set_video_alternate(struct cx231xx *dev);
|
||||
int cx231xx_set_alt_setting(struct cx231xx *dev, u8 index, u8 alt);
|
||||
int is_fw_load(struct cx231xx *dev);
|
||||
int cx231xx_check_fw(struct cx231xx *dev);
|
||||
int cx231xx_init_isoc(struct cx231xx *dev, int max_packets,
|
||||
int num_bufs, int max_pkt_size,
|
||||
int (*isoc_copy) (struct cx231xx *dev,
|
||||
struct urb *urb));
|
||||
int cx231xx_init_bulk(struct cx231xx *dev, int max_packets,
|
||||
int num_bufs, int max_pkt_size,
|
||||
int (*bulk_copy) (struct cx231xx *dev,
|
||||
struct urb *urb));
|
||||
void cx231xx_stop_TS1(struct cx231xx *dev);
|
||||
void cx231xx_start_TS1(struct cx231xx *dev);
|
||||
void cx231xx_uninit_isoc(struct cx231xx *dev);
|
||||
void cx231xx_uninit_bulk(struct cx231xx *dev);
|
||||
int cx231xx_set_mode(struct cx231xx *dev, enum cx231xx_mode set_mode);
|
||||
int cx231xx_unmute_audio(struct cx231xx *dev);
|
||||
int cx231xx_ep5_bulkout(struct cx231xx *dev, u8 *firmware, u16 size);
|
||||
void cx231xx_disable656(struct cx231xx *dev);
|
||||
void cx231xx_enable656(struct cx231xx *dev);
|
||||
int cx231xx_demod_reset(struct cx231xx *dev);
|
||||
int cx231xx_gpio_set(struct cx231xx *dev, struct cx231xx_reg_seq *gpio);
|
||||
|
||||
/* Device list functions */
|
||||
@@ -740,6 +957,10 @@ int cx231xx_tuner_callback(void *ptr, int component, int command, int arg);
|
||||
int cx231xx_ir_init(struct cx231xx *dev);
|
||||
int cx231xx_ir_fini(struct cx231xx *dev);
|
||||
|
||||
/* cx23885-417.c */
|
||||
extern int cx231xx_417_register(struct cx231xx *dev);
|
||||
extern void cx231xx_417_unregister(struct cx231xx *dev);
|
||||
|
||||
/* printk macros */
|
||||
|
||||
#define cx231xx_err(fmt, arg...) do {\
|
||||
|
||||
Reference in New Issue
Block a user