提交 23869e23 编写于 作者: A Andres Salomon 提交者: Mauro Carvalho Chehab

V4L/DVB (6235): cafe_ccic: default to allocating DMA buffers at probe time

By default, we allocate DMA buffers when actually reading from the video
capture device.  On a system with 128MB or 256MB of ram, it's very easy
for that memory to quickly become fragmented.  We've had users report
having 30+MB of memory free, but the cafe_ccic driver is still unable to
allocate DMA buffers.

Our workaround has been to make use of the 'alloc_bufs_at_load' parameter
to allocate DMA buffers during device probing.  This patch makes DMA
buffer allocation happen during device probe by default, and changes
the parameter to 'alloc_bufs_at_read'.  The camera hardware is there,
if the cafe_ccic driver is enabled/loaded it should do its best to ensure
that the camera is actually usable; delaying DMA buffer allocation
saves an insignicant amount of memory, and causes the driver to be much
less useful.
Signed-off-by: NAndres Salomon <dilinger@debian.org>
Acked-by: NJonathan Corbet <corbet@lwn.net>
Signed-off-by: NMauro Carvalho Chehab <mchehab@infradead.org>
上级 4562fbea
...@@ -62,13 +62,13 @@ MODULE_SUPPORTED_DEVICE("Video"); ...@@ -62,13 +62,13 @@ MODULE_SUPPORTED_DEVICE("Video");
*/ */
#define MAX_DMA_BUFS 3 #define MAX_DMA_BUFS 3
static int alloc_bufs_at_load = 0; static int alloc_bufs_at_read = 0;
module_param(alloc_bufs_at_load, bool, 0444); module_param(alloc_bufs_at_read, bool, 0444);
MODULE_PARM_DESC(alloc_bufs_at_load, MODULE_PARM_DESC(alloc_bufs_at_read,
"Non-zero value causes DMA buffers to be allocated at module " "Non-zero value causes DMA buffers to be allocated when the "
"load time. This increases the chances of successfully getting " "video capture device is read, rather than at module load "
"those buffers, but at the cost of nailing down the memory from " "time. This saves memory, but decreases the chances of "
"the outset."); "successfully getting those buffers.");
static int n_dma_bufs = 3; static int n_dma_bufs = 3;
module_param(n_dma_bufs, uint, 0644); module_param(n_dma_bufs, uint, 0644);
...@@ -1502,7 +1502,7 @@ static int cafe_v4l_release(struct inode *inode, struct file *filp) ...@@ -1502,7 +1502,7 @@ static int cafe_v4l_release(struct inode *inode, struct file *filp)
} }
if (cam->users == 0) { if (cam->users == 0) {
cafe_ctlr_power_down(cam); cafe_ctlr_power_down(cam);
if (! alloc_bufs_at_load) if (alloc_bufs_at_read)
cafe_free_dma_bufs(cam); cafe_free_dma_bufs(cam);
} }
mutex_unlock(&cam->s_mutex); mutex_unlock(&cam->s_mutex);
...@@ -2161,7 +2161,7 @@ static int cafe_pci_probe(struct pci_dev *pdev, ...@@ -2161,7 +2161,7 @@ static int cafe_pci_probe(struct pci_dev *pdev,
/* /*
* If so requested, try to get our DMA buffers now. * If so requested, try to get our DMA buffers now.
*/ */
if (alloc_bufs_at_load) { if (!alloc_bufs_at_read) {
if (cafe_alloc_dma_bufs(cam, 1)) if (cafe_alloc_dma_bufs(cam, 1))
cam_warn(cam, "Unable to alloc DMA buffers at load" cam_warn(cam, "Unable to alloc DMA buffers at load"
" will try again later."); " will try again later.");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册