Skip to content

Commit 3ee3c4d

Browse files
committed
media: apple: isp: Limit maximal number of buffers
ISP (FW 12.3) on t6001 times out if more buffers than count in the buffer pool config are submitted before streaming is started. To avoid keeping track of the number of submitted buffers limit the number. 16 buffers / frames should be more than enough. Signed-off-by: Janne Grunau <j@jannau.net>
1 parent 155f440 commit 3ee3c4d

3 files changed

Lines changed: 12 additions & 1 deletion

File tree

drivers/media/platform/apple/isp/isp-cmd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ int isp_cmd_ch_buffer_pool_config_set(struct apple_isp *isp, u32 chan, u16 type)
395395
.opcode = CISP_OPCODE(CISP_CMD_CH_BUFFER_POOL_CONFIG_SET),
396396
.chan = chan,
397397
.type = type,
398-
.count = 16,
398+
.count = ISP_MAX_BUFFERS,
399399
.meta_size0 = isp->hw->meta_size,
400400
.meta_size1 = isp->hw->meta_size,
401401
.unk0 = 0,

drivers/media/platform/apple/isp/isp-drv.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
#define ISP_META_SIZE_T8103 0x4640
2424
#define ISP_META_SIZE_T8112 0x4840
2525

26+
/* used to limit the user space buffers to the buffer_pool_config */
27+
#define ISP_MAX_BUFFERS 16
28+
2629
enum isp_generation {
2730
ISP_GEN_T8103,
2831
ISP_GEN_T8112,

drivers/media/platform/apple/isp/isp-v4l2.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
#include "isp-cam.h"
1313
#include "isp-cmd.h"
14+
#include "isp-drv.h"
1415
#include "isp-iommu.h"
1516
#include "isp-ipc.h"
1617
#include "isp-v4l2.h"
@@ -143,6 +144,13 @@ static int isp_vb2_queue_setup(struct vb2_queue *vq, unsigned int *nbuffers,
143144
struct apple_isp *isp = vb2_get_drv_priv(vq);
144145
struct isp_format *fmt = isp_get_current_format(isp);
145146

147+
/* This is not strictly neccessary but makes it easy to enforce that
148+
* at most 16 buffers are submitted at once. ISP on t6001 (FW 12.3)
149+
* times out if more buffers are submitted than set in the buffer pool
150+
* config before streaming is started.
151+
*/
152+
*nbuffers = min_t(unsigned int, *nbuffers, ISP_MAX_BUFFERS);
153+
146154
if (*num_planes) {
147155
if (sizes[0] < fmt->total_size)
148156
return -EINVAL;

0 commit comments

Comments
 (0)