mirror of
https://github.com/DigitalDevices/dddvb.git
synced 2025-03-01 10:35:23 +00:00
default to alt_dma for arm64 (coherent memory is slow/uncached) and some cleanup in alt_dma handling
This commit is contained in:
parent
cf7f19b8bc
commit
3ef783c393
@ -61,7 +61,7 @@ static int raw_stream;
|
|||||||
module_param(raw_stream, int, 0444);
|
module_param(raw_stream, int, 0444);
|
||||||
MODULE_PARM_DESC(raw_stream, "send data as raw stream to DVB layer");
|
MODULE_PARM_DESC(raw_stream, "send data as raw stream to DVB layer");
|
||||||
|
|
||||||
#ifdef __arm__
|
#if defined(__arm__) || defined(__aarch64__)
|
||||||
static int alt_dma = 1;
|
static int alt_dma = 1;
|
||||||
#else
|
#else
|
||||||
static int alt_dma;
|
static int alt_dma;
|
||||||
@ -325,7 +325,7 @@ static void dma_free(struct pci_dev *pdev, struct ddb_dma *dma, int dir)
|
|||||||
dma_unmap_single(&pdev->dev, dma->pbuf[i],
|
dma_unmap_single(&pdev->dev, dma->pbuf[i],
|
||||||
dma->size,
|
dma->size,
|
||||||
dir ? DMA_TO_DEVICE :
|
dir ? DMA_TO_DEVICE :
|
||||||
DMA_FROM_DEVICE);
|
DMA_BIDIRECTIONAL);
|
||||||
kfree(dma->vbuf[i]);
|
kfree(dma->vbuf[i]);
|
||||||
} else {
|
} else {
|
||||||
dma_free_coherent(&pdev->dev, dma->size,
|
dma_free_coherent(&pdev->dev, dma->size,
|
||||||
@ -356,7 +356,7 @@ static int dma_alloc(struct pci_dev *pdev, struct ddb_dma *dma, int dir)
|
|||||||
dma->vbuf[i],
|
dma->vbuf[i],
|
||||||
dma->size,
|
dma->size,
|
||||||
dir ? DMA_TO_DEVICE :
|
dir ? DMA_TO_DEVICE :
|
||||||
DMA_FROM_DEVICE);
|
DMA_BIDIRECTIONAL);
|
||||||
if (dma_mapping_error(&pdev->dev, dma->pbuf[i])) {
|
if (dma_mapping_error(&pdev->dev, dma->pbuf[i])) {
|
||||||
kfree(dma->vbuf[i]);
|
kfree(dma->vbuf[i]);
|
||||||
dma->vbuf[i] = 0;
|
dma->vbuf[i] = 0;
|
||||||
@ -795,6 +795,12 @@ static ssize_t ddb_output_write(struct ddb_output *output,
|
|||||||
}
|
}
|
||||||
if (len > left)
|
if (len > left)
|
||||||
len = left;
|
len = left;
|
||||||
|
if (alt_dma)
|
||||||
|
dma_sync_single_for_cpu(dev->dev,
|
||||||
|
output->dma->pbuf[
|
||||||
|
output->dma->cbuf],
|
||||||
|
output->dma->size,
|
||||||
|
DMA_TO_DEVICE);
|
||||||
if (copy_from_user(output->dma->vbuf[output->dma->cbuf] +
|
if (copy_from_user(output->dma->vbuf[output->dma->cbuf] +
|
||||||
output->dma->coff,
|
output->dma->coff,
|
||||||
buf, len))
|
buf, len))
|
||||||
@ -865,6 +871,12 @@ static size_t ddb_input_read(struct ddb_input *input,
|
|||||||
DMA_FROM_DEVICE);
|
DMA_FROM_DEVICE);
|
||||||
ret = copy_to_user(buf, input->dma->vbuf[input->dma->cbuf] +
|
ret = copy_to_user(buf, input->dma->vbuf[input->dma->cbuf] +
|
||||||
input->dma->coff, free);
|
input->dma->coff, free);
|
||||||
|
if (alt_dma)
|
||||||
|
dma_sync_single_for_device(dev->dev,
|
||||||
|
input->dma->pbuf[
|
||||||
|
input->dma->cbuf],
|
||||||
|
input->dma->size,
|
||||||
|
DMA_FROM_DEVICE);
|
||||||
if (ret)
|
if (ret)
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
input->dma->coff += free;
|
input->dma->coff += free;
|
||||||
@ -1155,11 +1167,8 @@ static struct dvb_frontend_ops dummy_ops = {
|
|||||||
|
|
||||||
static struct dvb_frontend *dummy_attach(void)
|
static struct dvb_frontend *dummy_attach(void)
|
||||||
{
|
{
|
||||||
#if (KERNEL_VERSION(4, 13, 0) > LINUX_VERSION_CODE)
|
struct dvb_frontend *fe = kzalloc(sizeof(*fe), GFP_KERNEL);
|
||||||
struct dvb_frontend *fe = kmalloc(sizeof(*fe), __GFP_REPEAT);
|
|
||||||
#else
|
|
||||||
struct dvb_frontend *fe = kmalloc(sizeof(*fe), __GFP_RETRY_MAYFAIL);
|
|
||||||
#endif
|
|
||||||
if (fe)
|
if (fe)
|
||||||
fe->ops = dummy_ops;
|
fe->ops = dummy_ops;
|
||||||
return fe;
|
return fe;
|
||||||
@ -2415,7 +2424,9 @@ static void input_write_dvb(struct ddb_input *input,
|
|||||||
dma2->vbuf[dma->cbuf],
|
dma2->vbuf[dma->cbuf],
|
||||||
dma2->size / 188);
|
dma2->size / 188);
|
||||||
}
|
}
|
||||||
|
//if (alt_dma)
|
||||||
|
// dma_sync_single_for_device(dev->dev, dma2->pbuf[dma->cbuf],
|
||||||
|
// dma2->size, DMA_FROM_DEVICE);
|
||||||
dma->cbuf = (dma->cbuf + 1) % dma2->num;
|
dma->cbuf = (dma->cbuf + 1) % dma2->num;
|
||||||
if (ack)
|
if (ack)
|
||||||
ddbwritel(dev, (dma->cbuf << 11),
|
ddbwritel(dev, (dma->cbuf << 11),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user