Commit 050afc92 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Staging: Merge Ben Collins solo6x10 tree with upstream

There were some duplicate changes that needed to be hand-merged due to
fixes needed to keep .37 building and working properly.
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parents 391a169e 5bf68592
config SOLO6X10 config SOLO6X10
tristate "Softlogic 6x10 MPEG codec cards" tristate "Softlogic 6x10 MPEG codec cards"
depends on PCI && VIDEO_DEV && SND depends on PCI && VIDEO_DEV && SND
select VIDEOBUF_DMA_CONTIG select VIDEOBUF_DMA_SG
---help--- ---help---
This driver supports the Softlogic based MPEG-4 and h.264 codec This driver supports the Softlogic based MPEG-4 and h.264 codec
codec cards. codec cards.
TODO (staging => main): TODO (staging => main):
* checkpatch.pl (haven't run it yet)
* Lindent (should be clean, but check)
* Motion detection flags need to be moved to v4l2 * Motion detection flags need to be moved to v4l2
* Some private CIDs need to be moved to v4l2 * Some private CIDs need to be moved to v4l2
...@@ -21,8 +19,6 @@ TODO (general): ...@@ -21,8 +19,6 @@ TODO (general):
- implement playback via external sound jack - implement playback via external sound jack
- implement loopback of external sound jack with incoming audio? - implement loopback of external sound jack with incoming audio?
- implement pause/resume - implement pause/resume
- check into jacking sound from tx28xx chips directly (to avoid
g.723/8khz limitations)
Plase send patches to Greg Kroah-Hartman <greg@kroah.com> and Cc Ben Collins Plase send patches to Greg Kroah-Hartman <greg@kroah.com> and Cc Ben Collins
<bcollins@bluecherry.net> <bcollins@bluecherry.net>
...@@ -136,6 +136,7 @@ static int __devinit solo6010_pci_probe(struct pci_dev *pdev, ...@@ -136,6 +136,7 @@ static int __devinit solo6010_pci_probe(struct pci_dev *pdev,
int ret; int ret;
int sdram; int sdram;
u8 chip_id; u8 chip_id;
solo_dev = kzalloc(sizeof(*solo_dev), GFP_KERNEL); solo_dev = kzalloc(sizeof(*solo_dev), GFP_KERNEL);
if (solo_dev == NULL) if (solo_dev == NULL)
return -ENOMEM; return -ENOMEM;
...@@ -261,13 +262,18 @@ static void __devexit solo6010_pci_remove(struct pci_dev *pdev) ...@@ -261,13 +262,18 @@ static void __devexit solo6010_pci_remove(struct pci_dev *pdev)
} }
static struct pci_device_id solo6010_id_table[] = { static struct pci_device_id solo6010_id_table[] = {
/* 6010 based cards */
{PCI_DEVICE(PCI_VENDOR_ID_SOFTLOGIC, PCI_DEVICE_ID_SOLO6010)}, {PCI_DEVICE(PCI_VENDOR_ID_SOFTLOGIC, PCI_DEVICE_ID_SOLO6010)},
{PCI_DEVICE(PCI_VENDOR_ID_BLUECHERRY, PCI_DEVICE_ID_NEUSOLO_4)}, {PCI_DEVICE(PCI_VENDOR_ID_BLUECHERRY, PCI_DEVICE_ID_NEUSOLO_4)},
{PCI_DEVICE(PCI_VENDOR_ID_BLUECHERRY, PCI_DEVICE_ID_NEUSOLO_9)}, {PCI_DEVICE(PCI_VENDOR_ID_BLUECHERRY, PCI_DEVICE_ID_NEUSOLO_9)},
{PCI_DEVICE(PCI_VENDOR_ID_BLUECHERRY, PCI_DEVICE_ID_NEUSOLO_16)}, {PCI_DEVICE(PCI_VENDOR_ID_BLUECHERRY, PCI_DEVICE_ID_NEUSOLO_16)},
{PCI_DEVICE(PCI_VENDOR_ID_BLUECHERRY, PCI_DEVICE_ID_COMMSOLO_4)}, {PCI_DEVICE(PCI_VENDOR_ID_BLUECHERRY, PCI_DEVICE_ID_BC_SOLO_4)},
{PCI_DEVICE(PCI_VENDOR_ID_BLUECHERRY, PCI_DEVICE_ID_COMMSOLO_9)}, {PCI_DEVICE(PCI_VENDOR_ID_BLUECHERRY, PCI_DEVICE_ID_BC_SOLO_9)},
{PCI_DEVICE(PCI_VENDOR_ID_BLUECHERRY, PCI_DEVICE_ID_COMMSOLO_16)}, {PCI_DEVICE(PCI_VENDOR_ID_BLUECHERRY, PCI_DEVICE_ID_BC_SOLO_16)},
/* 6110 based cards */
{PCI_DEVICE(PCI_VENDOR_ID_BLUECHERRY, PCI_DEVICE_ID_BC_6110_4)},
{PCI_DEVICE(PCI_VENDOR_ID_BLUECHERRY, PCI_DEVICE_ID_BC_6110_8)},
{PCI_DEVICE(PCI_VENDOR_ID_BLUECHERRY, PCI_DEVICE_ID_BC_6110_16)},
{0,} {0,}
}; };
......
...@@ -227,7 +227,7 @@ static int solo_i2c_master_xfer(struct i2c_adapter *adap, ...@@ -227,7 +227,7 @@ static int solo_i2c_master_xfer(struct i2c_adapter *adap,
if (i == SOLO_I2C_ADAPTERS) if (i == SOLO_I2C_ADAPTERS)
return num; // XXX Right return value for failure? return num; // XXX Right return value for failure?
down(&solo_dev->i2c_sem); mutex_lock(&solo_dev->i2c_mutex);
solo_dev->i2c_id = i; solo_dev->i2c_id = i;
solo_dev->i2c_msg = msgs; solo_dev->i2c_msg = msgs;
solo_dev->i2c_msg_num = num; solo_dev->i2c_msg_num = num;
...@@ -258,7 +258,7 @@ static int solo_i2c_master_xfer(struct i2c_adapter *adap, ...@@ -258,7 +258,7 @@ static int solo_i2c_master_xfer(struct i2c_adapter *adap,
solo_dev->i2c_state = IIC_STATE_IDLE; solo_dev->i2c_state = IIC_STATE_IDLE;
solo_dev->i2c_id = -1; solo_dev->i2c_id = -1;
up(&solo_dev->i2c_sem); mutex_unlock(&solo_dev->i2c_mutex);
return ret; return ret;
} }
...@@ -284,7 +284,7 @@ int solo_i2c_init(struct solo6010_dev *solo_dev) ...@@ -284,7 +284,7 @@ int solo_i2c_init(struct solo6010_dev *solo_dev)
solo_dev->i2c_id = -1; solo_dev->i2c_id = -1;
solo_dev->i2c_state = IIC_STATE_IDLE; solo_dev->i2c_state = IIC_STATE_IDLE;
init_waitqueue_head(&solo_dev->i2c_wait); init_waitqueue_head(&solo_dev->i2c_wait);
sema_init(&solo_dev->i2c_sem, 1); mutex_init(&solo_dev->i2c_mutex);
for (i = 0; i < SOLO_I2C_ADAPTERS; i++) { for (i = 0; i < SOLO_I2C_ADAPTERS; i++) {
struct i2c_adapter *adap = &solo_dev->i2c_adap[i]; struct i2c_adapter *adap = &solo_dev->i2c_adap[i];
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/scatterlist.h>
#include "solo6010.h" #include "solo6010.h"
...@@ -30,8 +31,9 @@ int solo_p2m_dma(struct solo6010_dev *solo_dev, u8 id, int wr, ...@@ -30,8 +31,9 @@ int solo_p2m_dma(struct solo6010_dev *solo_dev, u8 id, int wr,
int ret; int ret;
WARN_ON(!size); WARN_ON(!size);
WARN_ON(id >= SOLO_NR_P2M); BUG_ON(id >= SOLO_NR_P2M);
if (!size || id >= SOLO_NR_P2M)
if (!size)
return -EINVAL; return -EINVAL;
dma_addr = pci_map_single(solo_dev->pdev, sys_addr, size, dma_addr = pci_map_single(solo_dev->pdev, sys_addr, size,
...@@ -47,42 +49,137 @@ int solo_p2m_dma(struct solo6010_dev *solo_dev, u8 id, int wr, ...@@ -47,42 +49,137 @@ int solo_p2m_dma(struct solo6010_dev *solo_dev, u8 id, int wr,
int solo_p2m_dma_t(struct solo6010_dev *solo_dev, u8 id, int wr, int solo_p2m_dma_t(struct solo6010_dev *solo_dev, u8 id, int wr,
dma_addr_t dma_addr, u32 ext_addr, u32 size) dma_addr_t dma_addr, u32 ext_addr, u32 size)
{
struct p2m_desc *desc = kzalloc(sizeof(*desc) * 2, GFP_DMA);
int ret;
if (desc == NULL)
return -ENOMEM;
solo_p2m_push_desc(&desc[1], wr, dma_addr, ext_addr, size, 0, 0);
ret = solo_p2m_dma_desc(solo_dev, id, desc, 2);
kfree(desc);
return ret;
}
void solo_p2m_push_desc(struct p2m_desc *desc, int wr, dma_addr_t dma_addr,
u32 ext_addr, u32 size, int repeat, u32 ext_size)
{
desc->ta = dma_addr;
desc->fa = ext_addr;
desc->ext = SOLO_P2M_COPY_SIZE(size >> 2);
desc->ctrl = SOLO_P2M_BURST_SIZE(SOLO_P2M_BURST_256) |
(wr ? SOLO_P2M_WRITE : 0) | SOLO_P2M_TRANS_ON;
/* Ext size only matters when we're repeating */
if (repeat) {
desc->ext |= SOLO_P2M_EXT_INC(ext_size >> 2);
desc->ctrl |= SOLO_P2M_PCI_INC(size >> 2) |
SOLO_P2M_REPEAT(repeat);
}
}
int solo_p2m_dma_desc(struct solo6010_dev *solo_dev, u8 id,
struct p2m_desc *desc, int desc_count)
{ {
struct solo_p2m_dev *p2m_dev; struct solo_p2m_dev *p2m_dev;
unsigned int timeout = 0; unsigned int timeout;
int ret = 0;
u32 config = 0;
dma_addr_t desc_dma = 0;
WARN_ON(!size); BUG_ON(id >= SOLO_NR_P2M);
WARN_ON(id >= SOLO_NR_P2M); BUG_ON(!desc_count || desc_count > SOLO_NR_P2M_DESC);
if (!size || id >= SOLO_NR_P2M)
return -EINVAL;
p2m_dev = &solo_dev->p2m_dev[id]; p2m_dev = &solo_dev->p2m_dev[id];
down(&p2m_dev->sem); mutex_lock(&p2m_dev->mutex);
solo_reg_write(solo_dev, SOLO_P2M_CONTROL(id), 0);
start_dma:
INIT_COMPLETION(p2m_dev->completion); INIT_COMPLETION(p2m_dev->completion);
p2m_dev->error = 0; p2m_dev->error = 0;
solo_reg_write(solo_dev, SOLO_P2M_TAR_ADR(id), dma_addr);
solo_reg_write(solo_dev, SOLO_P2M_EXT_ADR(id), ext_addr);
solo_reg_write(solo_dev, SOLO_P2M_EXT_CFG(id),
SOLO_P2M_COPY_SIZE(size >> 2));
solo_reg_write(solo_dev, SOLO_P2M_CONTROL(id),
SOLO_P2M_BURST_SIZE(SOLO_P2M_BURST_256) |
(wr ? SOLO_P2M_WRITE : 0) | SOLO_P2M_TRANS_ON);
/* Enable the descriptors */
config = solo_reg_read(solo_dev, SOLO_P2M_CONFIG(id));
desc_dma = pci_map_single(solo_dev->pdev, desc,
desc_count * sizeof(*desc),
PCI_DMA_TODEVICE);
solo_reg_write(solo_dev, SOLO_P2M_DES_ADR(id), desc_dma);
solo_reg_write(solo_dev, SOLO_P2M_DESC_ID(id), desc_count - 1);
solo_reg_write(solo_dev, SOLO_P2M_CONFIG(id), config |
SOLO_P2M_DESC_MODE);
/* Should have all descriptors completed from one interrupt */
timeout = wait_for_completion_timeout(&p2m_dev->completion, HZ); timeout = wait_for_completion_timeout(&p2m_dev->completion, HZ);
solo_reg_write(solo_dev, SOLO_P2M_CONTROL(id), 0); solo_reg_write(solo_dev, SOLO_P2M_CONTROL(id), 0);
/* XXX Really looks to me like we will get stuck here if a /* Reset back to non-descriptor mode */
* real PCI P2M error occurs */ solo_reg_write(solo_dev, SOLO_P2M_CONFIG(id), config);
solo_reg_write(solo_dev, SOLO_P2M_DESC_ID(id), 0);
solo_reg_write(solo_dev, SOLO_P2M_DES_ADR(id), 0);
pci_unmap_single(solo_dev->pdev, desc_dma,
desc_count * sizeof(*desc),
PCI_DMA_TODEVICE);
if (p2m_dev->error) if (p2m_dev->error)
goto start_dma; ret = -EIO;
else if (timeout == 0)
ret = -EAGAIN;
mutex_unlock(&p2m_dev->mutex);
WARN_ON_ONCE(ret);
return ret;
}
int solo_p2m_dma_sg(struct solo6010_dev *solo_dev, u8 id,
struct p2m_desc *pdesc, int wr,
struct scatterlist *sg, u32 sg_off,
u32 ext_addr, u32 size)
{
int i;
int idx;
BUG_ON(id >= SOLO_NR_P2M);
up(&p2m_dev->sem); if (WARN_ON_ONCE(!size))
return -EINVAL;
memset(pdesc, 0, sizeof(*pdesc));
/* Should rewrite this to handle > SOLO_NR_P2M_DESC transactions */
for (i = 0, idx = 1; idx < SOLO_NR_P2M_DESC && sg && size > 0;
i++, sg = sg_next(sg)) {
struct p2m_desc *desc = &pdesc[idx];
u32 sg_len = sg_dma_len(sg);
u32 len;
if (sg_off >= sg_len) {
sg_off -= sg_len;
continue;
}
return (timeout == 0) ? -EAGAIN : 0; sg_len -= sg_off;
len = min(sg_len, size);
solo_p2m_push_desc(desc, wr, sg_dma_address(sg) + sg_off,
ext_addr, len, 0, 0);
size -= len;
ext_addr += len;
idx++;
sg_off = 0;
}
WARN_ON_ONCE(size || i >= SOLO_NR_P2M_DESC);
return solo_p2m_dma_desc(solo_dev, id, pdesc, idx);
} }
#ifdef SOLO_TEST_P2M #ifdef SOLO_TEST_P2M
...@@ -152,8 +249,11 @@ static void run_p2m_test(struct solo6010_dev *solo_dev) ...@@ -152,8 +249,11 @@ static void run_p2m_test(struct solo6010_dev *solo_dev)
void solo_p2m_isr(struct solo6010_dev *solo_dev, int id) void solo_p2m_isr(struct solo6010_dev *solo_dev, int id)
{ {
struct solo_p2m_dev *p2m_dev = &solo_dev->p2m_dev[id];
solo_reg_write(solo_dev, SOLO_IRQ_STAT, SOLO_IRQ_P2M(id)); solo_reg_write(solo_dev, SOLO_IRQ_STAT, SOLO_IRQ_P2M(id));
complete(&solo_dev->p2m_dev[id].completion);
complete(&p2m_dev->completion);
} }
void solo_p2m_error_isr(struct solo6010_dev *solo_dev, u32 status) void solo_p2m_error_isr(struct solo6010_dev *solo_dev, u32 status)
...@@ -188,16 +288,14 @@ int solo_p2m_init(struct solo6010_dev *solo_dev) ...@@ -188,16 +288,14 @@ int solo_p2m_init(struct solo6010_dev *solo_dev)
for (i = 0; i < SOLO_NR_P2M; i++) { for (i = 0; i < SOLO_NR_P2M; i++) {
p2m_dev = &solo_dev->p2m_dev[i]; p2m_dev = &solo_dev->p2m_dev[i];
sema_init(&p2m_dev->sem, 1); mutex_init(&p2m_dev->mutex);
init_completion(&p2m_dev->completion); init_completion(&p2m_dev->completion);
solo_reg_write(solo_dev, SOLO_P2M_DES_ADR(i),
__pa(p2m_dev->desc));
solo_reg_write(solo_dev, SOLO_P2M_CONTROL(i), 0); solo_reg_write(solo_dev, SOLO_P2M_CONTROL(i), 0);
solo_reg_write(solo_dev, SOLO_P2M_CONFIG(i), solo_reg_write(solo_dev, SOLO_P2M_CONFIG(i),
SOLO_P2M_CSC_16BIT_565 | SOLO_P2M_CSC_16BIT_565 |
SOLO_P2M_DMA_INTERVAL(0) | SOLO_P2M_DMA_INTERVAL(3) |
SOLO_P2M_DESC_INTR_OPT |
SOLO_P2M_PCI_MASTER_MODE); SOLO_P2M_PCI_MASTER_MODE);
solo6010_irq_on(solo_dev, SOLO_IRQ_P2M(i)); solo6010_irq_on(solo_dev, SOLO_IRQ_P2M(i));
} }
......
...@@ -24,14 +24,13 @@ ...@@ -24,14 +24,13 @@
#include <media/v4l2-ioctl.h> #include <media/v4l2-ioctl.h>
#include <media/v4l2-common.h> #include <media/v4l2-common.h>
#include <media/videobuf-dma-contig.h> #include <media/videobuf-dma-sg.h>
#include "solo6010.h" #include "solo6010.h"
#include "solo6010-tw28.h" #include "solo6010-tw28.h"
#define SOLO_HW_BPL 2048 #define SOLO_HW_BPL 2048
#define SOLO_DISP_PIX_FIELD V4L2_FIELD_INTERLACED #define SOLO_DISP_PIX_FIELD V4L2_FIELD_INTERLACED
#define SOLO_DISP_BUF_SIZE (64 * 1024) // 64k
/* Image size is two fields, SOLO_HW_BPL is one horizontal line */ /* Image size is two fields, SOLO_HW_BPL is one horizontal line */
#define solo_vlines(__solo) (__solo->video_vsize * 2) #define solo_vlines(__solo) (__solo->video_vsize * 2)
...@@ -49,6 +48,8 @@ struct solo_filehandle { ...@@ -49,6 +48,8 @@ struct solo_filehandle {
spinlock_t slock; spinlock_t slock;
int old_write; int old_write;
struct list_head vidq_active; struct list_head vidq_active;
struct p2m_desc desc[SOLO_NR_P2M_DESC];
int desc_idx;
}; };
unsigned video_nr = -1; unsigned video_nr = -1;
...@@ -203,50 +204,148 @@ static int solo_v4l2_set_ch(struct solo6010_dev *solo_dev, u8 ch) ...@@ -203,50 +204,148 @@ static int solo_v4l2_set_ch(struct solo6010_dev *solo_dev, u8 ch)
return 0; return 0;
} }
static void disp_reset_desc(struct solo_filehandle *fh)
{
/* We use desc mode, which ignores desc 0 */
memset(fh->desc, 0, sizeof(*fh->desc));
fh->desc_idx = 1;
}
static int disp_flush_descs(struct solo_filehandle *fh)
{
int ret;
if (!fh->desc_idx)
return 0;
ret = solo_p2m_dma_desc(fh->solo_dev, SOLO_P2M_DMA_ID_DISP,
fh->desc, fh->desc_idx);
disp_reset_desc(fh);
return ret;
}
static int disp_push_desc(struct solo_filehandle *fh, dma_addr_t dma_addr,
u32 ext_addr, int size, int repeat, int ext_size)
{
if (fh->desc_idx >= SOLO_NR_P2M_DESC) {
int ret = disp_flush_descs(fh);
if (ret)
return ret;
}
solo_p2m_push_desc(&fh->desc[fh->desc_idx], 0, dma_addr, ext_addr,
size, repeat, ext_size);
fh->desc_idx++;
return 0;
}
static void solo_fillbuf(struct solo_filehandle *fh, static void solo_fillbuf(struct solo_filehandle *fh,
struct videobuf_buffer *vb) struct videobuf_buffer *vb)
{ {
struct solo6010_dev *solo_dev = fh->solo_dev; struct solo6010_dev *solo_dev = fh->solo_dev;
dma_addr_t vbuf; struct videobuf_dmabuf* vbuf;
unsigned int fdma_addr; unsigned int fdma_addr;
int frame_size;
int error = 1; int error = 1;
int i; int i;
struct scatterlist* sg;
dma_addr_t sg_dma;
int sg_size_left;
if (!(vbuf = videobuf_to_dma_contig(vb))) if (!(vbuf = videobuf_to_dma(vb)))
goto finish_buf; goto finish_buf;
if (erase_off(solo_dev)) { if (erase_off(solo_dev)) {
void *p = videobuf_queue_to_vaddr(&fh->vidq, vb); int i;
int image_size = solo_image_size(solo_dev);
for (i = 0; i < image_size; i += 2) { /* Just blit to the entire sg list, ignoring size */
for_each_sg(vbuf->sglist, sg, vbuf->sglen, i) {
void *p = sg_virt(sg);
size_t len = sg_dma_len(sg);
for (i = 0; i < len; i += 2) {
((u8 *)p)[i] = 0x80; ((u8 *)p)[i] = 0x80;
((u8 *)p)[i + 1] = 0x00; ((u8 *)p)[i + 1] = 0x00;
} }
}
error = 0; error = 0;
goto finish_buf; goto finish_buf;
} }
frame_size = SOLO_HW_BPL * solo_vlines(solo_dev); disp_reset_desc(fh);
fdma_addr = SOLO_DISP_EXT_ADDR(solo_dev) + (fh->old_write * frame_size); sg = vbuf->sglist;
sg_dma = sg_dma_address(sg);
sg_size_left = sg_dma_len(sg);
fdma_addr = SOLO_DISP_EXT_ADDR(solo_dev) + (fh->old_write *
(SOLO_HW_BPL * solo_vlines(solo_dev)));
for (i = 0; i < frame_size / SOLO_DISP_BUF_SIZE; i++) { for (i = 0; i < solo_vlines(solo_dev); i++) {
int j; int line_len = solo_bytesperline(solo_dev);
for (j = 0; j < (SOLO_DISP_BUF_SIZE / SOLO_HW_BPL); j++) { int lines;
if (solo_p2m_dma_t(solo_dev, SOLO_P2M_DMA_ID_DISP, 0,
vbuf, fdma_addr + (j * SOLO_HW_BPL), if (!sg_size_left) {
solo_bytesperline(solo_dev))) sg = sg_next(sg);
if (sg == NULL)
goto finish_buf; goto finish_buf;
vbuf += solo_bytesperline(solo_dev); sg_dma = sg_dma_address(sg);
sg_size_left = sg_dma_len(sg);
} }
fdma_addr += SOLO_DISP_BUF_SIZE;
/* No room for an entire line, so chunk it up */
if (sg_size_left < line_len) {
int this_addr = fdma_addr;
while (line_len > 0) {
int this_write;
if (!sg_size_left) {
sg = sg_next(sg);
if (sg == NULL)
goto finish_buf;
sg_dma = sg_dma_address(sg);
sg_size_left = sg_dma_len(sg);
} }
error = 0;
this_write = min(sg_size_left, line_len);
if (disp_push_desc(fh, sg_dma, this_addr,
this_write, 0, 0))
goto finish_buf;
line_len -= this_write;
sg_size_left -= this_write;
sg_dma += this_write;
this_addr += this_write;
}
fdma_addr += SOLO_HW_BPL;
continue;
}
/* Shove as many lines into a repeating descriptor as possible */
lines = min(sg_size_left / line_len,
solo_vlines(solo_dev) - i);
if (disp_push_desc(fh, sg_dma, fdma_addr, line_len,
lines - 1, SOLO_HW_BPL))
goto finish_buf;
i += lines - 1;
fdma_addr += SOLO_HW_BPL * lines;
sg_dma += lines * line_len;
sg_size_left -= lines * line_len;
}
error = disp_flush_descs(fh);
finish_buf: finish_buf:
if (error) { if (error) {
vb->state = VIDEOBUF_ERROR; vb->state = VIDEOBUF_ERROR;
} else { } else {
vb->size = solo_vlines(solo_dev) * solo_bytesperline(solo_dev);
vb->state = VIDEOBUF_DONE; vb->state = VIDEOBUF_DONE;
vb->field_count++; vb->field_count++;
do_gettimeofday(&vb->ts); do_gettimeofday(&vb->ts);
...@@ -364,7 +463,9 @@ static int solo_buf_prepare(struct videobuf_queue *vq, ...@@ -364,7 +463,9 @@ static int solo_buf_prepare(struct videobuf_queue *vq,
if (vb->state == VIDEOBUF_NEEDS_INIT) { if (vb->state == VIDEOBUF_NEEDS_INIT) {
int rc = videobuf_iolock(vq, vb, NULL); int rc = videobuf_iolock(vq, vb, NULL);
if (rc < 0) { if (rc < 0) {
videobuf_dma_contig_free(vq, vb); struct videobuf_dmabuf *dma = videobuf_to_dma(vb);
videobuf_dma_unmap(vq->dev, dma);
videobuf_dma_free(dma);
vb->state = VIDEOBUF_NEEDS_INIT; vb->state = VIDEOBUF_NEEDS_INIT;
return rc; return rc;
} }
...@@ -388,7 +489,10 @@ static void solo_buf_queue(struct videobuf_queue *vq, ...@@ -388,7 +489,10 @@ static void solo_buf_queue(struct videobuf_queue *vq,
static void solo_buf_release(struct videobuf_queue *vq, static void solo_buf_release(struct videobuf_queue *vq,
struct videobuf_buffer *vb) struct videobuf_buffer *vb)
{ {
videobuf_dma_contig_free(vq, vb); struct videobuf_dmabuf *dma = videobuf_to_dma(vb);
videobuf_dma_unmap(vq->dev, dma);
videobuf_dma_free(dma);
vb->state = VIDEOBUF_NEEDS_INIT; vb->state = VIDEOBUF_NEEDS_INIT;
} }
...@@ -433,7 +537,7 @@ static int solo_v4l2_open(struct file *file) ...@@ -433,7 +537,7 @@ static int solo_v4l2_open(struct file *file)
return ret; return ret;
} }
videobuf_queue_dma_contig_init(&fh->vidq, &solo_video_qops, videobuf_queue_sg_init(&fh->vidq, &solo_video_qops,
&solo_dev->pdev->dev, &fh->slock, &solo_dev->pdev->dev, &fh->slock,
V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_BUF_TYPE_VIDEO_CAPTURE,
SOLO_DISP_PIX_FIELD, SOLO_DISP_PIX_FIELD,
...@@ -530,7 +634,7 @@ static int solo_enum_input(struct file *file, void *priv, ...@@ -530,7 +634,7 @@ static int solo_enum_input(struct file *file, void *priv,
if (solo_dev->video_type == SOLO_VO_FMT_TYPE_NTSC) if (solo_dev->video_type == SOLO_VO_FMT_TYPE_NTSC)
input->std = V4L2_STD_NTSC_M; input->std = V4L2_STD_NTSC_M;
else else
input->std = V4L2_STD_PAL_M; input->std = V4L2_STD_PAL_B;
return 0; return 0;
} }
...@@ -795,7 +899,7 @@ static struct video_device solo_v4l2_template = { ...@@ -795,7 +899,7 @@ static struct video_device solo_v4l2_template = {
.minor = -1, .minor = -1,
.release = video_device_release, .release = video_device_release,
.tvnorms = V4L2_STD_NTSC_M | V4L2_STD_PAL_M, .tvnorms = V4L2_STD_NTSC_M | V4L2_STD_PAL_B,
.current_norm = V4L2_STD_NTSC_M, .current_norm = V4L2_STD_NTSC_M,
}; };
......
...@@ -26,8 +26,8 @@ ...@@ -26,8 +26,8 @@
#include <linux/semaphore.h> #include <linux/semaphore.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/delay.h>
#include <linux/wait.h> #include <linux/wait.h>
#include <linux/delay.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/atomic.h> #include <asm/atomic.h>
...@@ -48,10 +48,14 @@ ...@@ -48,10 +48,14 @@
#define PCI_DEVICE_ID_NEUSOLO_4 0x4304 #define PCI_DEVICE_ID_NEUSOLO_4 0x4304
#define PCI_DEVICE_ID_NEUSOLO_9 0x4309 #define PCI_DEVICE_ID_NEUSOLO_9 0x4309
#define PCI_DEVICE_ID_NEUSOLO_16 0x4310 #define PCI_DEVICE_ID_NEUSOLO_16 0x4310
/* Commell Softlogic 6010 based cards */ /* Bluecherry Softlogic 6010 based cards */
#define PCI_DEVICE_ID_COMMSOLO_4 0x4E04 #define PCI_DEVICE_ID_BC_SOLO_4 0x4E04
#define PCI_DEVICE_ID_COMMSOLO_9 0x4E09 #define PCI_DEVICE_ID_BC_SOLO_9 0x4E09
#define PCI_DEVICE_ID_COMMSOLO_16 0x4E10 #define PCI_DEVICE_ID_BC_SOLO_16 0x4E10
/* Bluecherry Softlogic 6110 based cards */
#define PCI_DEVICE_ID_BC_6110_4 0x5304
#define PCI_DEVICE_ID_BC_6110_8 0x5308
#define PCI_DEVICE_ID_BC_6110_16 0x5310
#endif /* Bluecherry */ #endif /* Bluecherry */
#define SOLO6010_NAME "solo6010" #define SOLO6010_NAME "solo6010"
...@@ -78,7 +82,6 @@ ...@@ -78,7 +82,6 @@
/* DMA Engine setup */ /* DMA Engine setup */
#define SOLO_NR_P2M 4 #define SOLO_NR_P2M 4
#define SOLO_NR_P2M_DESC 256 #define SOLO_NR_P2M_DESC 256
#define SOLO_P2M_DESC_SIZE (SOLO_NR_P2M_DESC * 16)
/* MPEG and JPEG share the same interrupt and locks so they must be together /* MPEG and JPEG share the same interrupt and locks so they must be together
* in the same dma channel. */ * in the same dma channel. */
#define SOLO_P2M_DMA_ID_MP4E 0 #define SOLO_P2M_DMA_ID_MP4E 0
...@@ -123,11 +126,17 @@ enum SOLO_I2C_STATE { ...@@ -123,11 +126,17 @@ enum SOLO_I2C_STATE {
IIC_STATE_STOP IIC_STATE_STOP
}; };
struct p2m_desc {
u32 ctrl;
u32 ext;
u32 ta;
u32 fa;
};
struct solo_p2m_dev { struct solo_p2m_dev {
struct semaphore sem; struct mutex mutex;
struct completion completion; struct completion completion;
int error; int error;
u8 desc[SOLO_P2M_DESC_SIZE];
}; };
#define OSD_TEXT_MAX 30 #define OSD_TEXT_MAX 30
...@@ -185,7 +194,7 @@ struct solo6010_dev { ...@@ -185,7 +194,7 @@ struct solo6010_dev {
/* i2c related items */ /* i2c related items */
struct i2c_adapter i2c_adap[SOLO_I2C_ADAPTERS]; struct i2c_adapter i2c_adap[SOLO_I2C_ADAPTERS];
enum SOLO_I2C_STATE i2c_state; enum SOLO_I2C_STATE i2c_state;
struct semaphore i2c_sem; struct mutex i2c_mutex;
int i2c_id; int i2c_id;
wait_queue_head_t i2c_wait; wait_queue_head_t i2c_wait;
struct i2c_msg *i2c_msg; struct i2c_msg *i2c_msg;
...@@ -306,6 +315,14 @@ int solo_p2m_dma_t(struct solo6010_dev *solo_dev, u8 id, int wr, ...@@ -306,6 +315,14 @@ int solo_p2m_dma_t(struct solo6010_dev *solo_dev, u8 id, int wr,
dma_addr_t dma_addr, u32 ext_addr, u32 size); dma_addr_t dma_addr, u32 ext_addr, u32 size);
int solo_p2m_dma(struct solo6010_dev *solo_dev, u8 id, int wr, int solo_p2m_dma(struct solo6010_dev *solo_dev, u8 id, int wr,
void *sys_addr, u32 ext_addr, u32 size); void *sys_addr, u32 ext_addr, u32 size);
int solo_p2m_dma_sg(struct solo6010_dev *solo_dev, u8 id,
struct p2m_desc *pdesc, int wr,
struct scatterlist *sglist, u32 sg_off,
u32 ext_addr, u32 size);
void solo_p2m_push_desc(struct p2m_desc *desc, int wr, dma_addr_t dma_addr,
u32 ext_addr, u32 size, int repeat, u32 ext_size);
int solo_p2m_dma_desc(struct solo6010_dev *solo_dev, u8 id,
struct p2m_desc *desc, int desc_count);
/* Set the threshold for motion detection */ /* Set the threshold for motion detection */
void solo_set_motion_threshold(struct solo6010_dev *solo_dev, u8 ch, u16 val); void solo_set_motion_threshold(struct solo6010_dev *solo_dev, u8 ch, u16 val);
......
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