aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/coda.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/platform/coda.c')
-rw-r--r--drivers/media/platform/coda.c58
1 files changed, 26 insertions, 32 deletions
diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
index 04a2d8be20d4..23c2111fa916 100644
--- a/drivers/media/platform/coda.c
+++ b/drivers/media/platform/coda.c
@@ -44,10 +44,6 @@
44 44
45#define CODADX6_MAX_INSTANCES 4 45#define CODADX6_MAX_INSTANCES 4
46 46
47#define CODA_FMO_BUF_SIZE 32
48#define CODADX6_WORK_BUF_SIZE (288 * 1024 + CODA_FMO_BUF_SIZE * 8 * 1024)
49#define CODA7_WORK_BUF_SIZE (128 * 1024)
50#define CODA9_WORK_BUF_SIZE (80 * 1024)
51#define CODA7_TEMP_BUF_SIZE (304 * 1024) 47#define CODA7_TEMP_BUF_SIZE (304 * 1024)
52#define CODA9_TEMP_BUF_SIZE (204 * 1024) 48#define CODA9_TEMP_BUF_SIZE (204 * 1024)
53#define CODA_PARA_BUF_SIZE (10 * 1024) 49#define CODA_PARA_BUF_SIZE (10 * 1024)
@@ -1982,18 +1978,8 @@ static int coda_alloc_context_buffers(struct coda_ctx *ctx,
1982 size_t size; 1978 size_t size;
1983 int ret; 1979 int ret;
1984 1980
1985 switch (dev->devtype->product) { 1981 if (dev->devtype->product == CODA_DX6)
1986 case CODA_7541:
1987 size = CODA7_WORK_BUF_SIZE;
1988 break;
1989 case CODA_960:
1990 size = CODA9_WORK_BUF_SIZE;
1991 if (q_data->fourcc == V4L2_PIX_FMT_H264)
1992 size += CODA9_PS_SAVE_SIZE;
1993 break;
1994 default:
1995 return 0; 1982 return 0;
1996 }
1997 1983
1998 if (ctx->psbuf.vaddr) { 1984 if (ctx->psbuf.vaddr) {
1999 v4l2_err(&dev->v4l2_dev, "psmembuf still allocated\n"); 1985 v4l2_err(&dev->v4l2_dev, "psmembuf still allocated\n");
@@ -2029,6 +2015,10 @@ static int coda_alloc_context_buffers(struct coda_ctx *ctx,
2029 } 2015 }
2030 } 2016 }
2031 2017
2018 size = dev->devtype->workbuf_size;
2019 if (dev->devtype->product == CODA_960 &&
2020 q_data->fourcc == V4L2_PIX_FMT_H264)
2021 size += CODA9_PS_SAVE_SIZE;
2032 ret = coda_alloc_context_buf(ctx, &ctx->workbuf, size, "workbuf"); 2022 ret = coda_alloc_context_buf(ctx, &ctx->workbuf, size, "workbuf");
2033 if (ret < 0) { 2023 if (ret < 0) {
2034 v4l2_err(&dev->v4l2_dev, "failed to allocate %d byte context buffer", 2024 v4l2_err(&dev->v4l2_dev, "failed to allocate %d byte context buffer",
@@ -3684,28 +3674,32 @@ enum coda_platform {
3684 3674
3685static const struct coda_devtype coda_devdata[] = { 3675static const struct coda_devtype coda_devdata[] = {
3686 [CODA_IMX27] = { 3676 [CODA_IMX27] = {
3687 .firmware = "v4l-codadx6-imx27.bin", 3677 .firmware = "v4l-codadx6-imx27.bin",
3688 .product = CODA_DX6, 3678 .product = CODA_DX6,
3689 .codecs = codadx6_codecs, 3679 .codecs = codadx6_codecs,
3690 .num_codecs = ARRAY_SIZE(codadx6_codecs), 3680 .num_codecs = ARRAY_SIZE(codadx6_codecs),
3681 .workbuf_size = 288 * 1024 + FMO_SLICE_SAVE_BUF_SIZE * 8 * 1024,
3691 }, 3682 },
3692 [CODA_IMX53] = { 3683 [CODA_IMX53] = {
3693 .firmware = "v4l-coda7541-imx53.bin", 3684 .firmware = "v4l-coda7541-imx53.bin",
3694 .product = CODA_7541, 3685 .product = CODA_7541,
3695 .codecs = coda7_codecs, 3686 .codecs = coda7_codecs,
3696 .num_codecs = ARRAY_SIZE(coda7_codecs), 3687 .num_codecs = ARRAY_SIZE(coda7_codecs),
3688 .workbuf_size = 128 * 1024,
3697 }, 3689 },
3698 [CODA_IMX6Q] = { 3690 [CODA_IMX6Q] = {
3699 .firmware = "v4l-coda960-imx6q.bin", 3691 .firmware = "v4l-coda960-imx6q.bin",
3700 .product = CODA_960, 3692 .product = CODA_960,
3701 .codecs = coda9_codecs, 3693 .codecs = coda9_codecs,
3702 .num_codecs = ARRAY_SIZE(coda9_codecs), 3694 .num_codecs = ARRAY_SIZE(coda9_codecs),
3695 .workbuf_size = 80 * 1024,
3703 }, 3696 },
3704 [CODA_IMX6DL] = { 3697 [CODA_IMX6DL] = {
3705 .firmware = "v4l-coda960-imx6dl.bin", 3698 .firmware = "v4l-coda960-imx6dl.bin",
3706 .product = CODA_960, 3699 .product = CODA_960,
3707 .codecs = coda9_codecs, 3700 .codecs = coda9_codecs,
3708 .num_codecs = ARRAY_SIZE(coda9_codecs), 3701 .num_codecs = ARRAY_SIZE(coda9_codecs),
3702 .workbuf_size = 80 * 1024,
3709 }, 3703 },
3710}; 3704};
3711 3705
@@ -3828,7 +3822,7 @@ static int coda_probe(struct platform_device *pdev)
3828 switch (dev->devtype->product) { 3822 switch (dev->devtype->product) {
3829 case CODA_DX6: 3823 case CODA_DX6:
3830 ret = coda_alloc_aux_buf(dev, &dev->workbuf, 3824 ret = coda_alloc_aux_buf(dev, &dev->workbuf,
3831 CODADX6_WORK_BUF_SIZE, "workbuf", 3825 dev->devtype->workbuf_size, "workbuf",
3832 dev->debugfs_root); 3826 dev->debugfs_root);
3833 if (ret < 0) { 3827 if (ret < 0) {
3834 dev_err(&pdev->dev, "failed to allocate work buffer\n"); 3828 dev_err(&pdev->dev, "failed to allocate work buffer\n");