From: keke.li Date: Fri, 19 Oct 2018 05:58:38 +0000 (+0800) Subject: gdc: add a new handle interface [1/1] X-Git-Tag: khadas-vims-v0.9.6-release~1255 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a840cbfec7f9706163f85f0f59b175b6f69e6327;p=platform%2Fkernel%2Flinux-amlogic.git gdc: add a new handle interface [1/1] PD#173042 Problem: user app need a new ioctl interface to handle image Solution: add a new ioctl cmd GDC_HANDLE to handle image Verify: verify by keke.li Change-Id: I79ddc01962e4b2a40130ecd32cfebe5c1a7133e6 Signed-off-by: Keke Li --- diff --git a/drivers/amlogic/media/gdc/app/gdc_module.c b/drivers/amlogic/media/gdc/app/gdc_module.c index 7e9ad5f..e48c1d2 100644 --- a/drivers/amlogic/media/gdc/app/gdc_module.c +++ b/drivers/amlogic/media/gdc/app/gdc_module.c @@ -388,6 +388,38 @@ static long meson_gdc_ioctl(struct file *file, unsigned int cmd, fh->o_paddr, fh->o_len); mutex_unlock(&fh->gdev->d_mutext); break; + case GDC_HANDLE: + ret = copy_from_user(gs, argp, sizeof(*gs)); + if (ret < 0) + LOG(LOG_ERR, "copy from user failed\n"); + + gs->buffer_addr = fh->o_paddr; + gs->buffer_size = fh->o_len; + + gs->base_gdc = 0; + gs->current_addr = gs->buffer_addr; + + gc->config_addr = fh->c_paddr; + + gs->fh = fh; + + mutex_lock(&fh->gdev->d_mutext); + meson_gdc_dma_flush(&fh->gdev->pdev->dev, + fh->c_paddr, fh->c_len); + ret = gdc_run(gs); + if (ret < 0) + LOG(LOG_ERR, "gdc process failed ret = %ld\n", ret); + + ret = wait_for_completion_timeout(&fh->gdev->d_com, + msecs_to_jiffies(40)); + if (ret == 0) + LOG(LOG_ERR, "gdc timeout\n"); + + gdc_stop(gs); + meson_gdc_cache_flush(&fh->gdev->pdev->dev, + fh->o_paddr, fh->o_len); + mutex_unlock(&fh->gdev->d_mutext); + break; case GDC_REQUEST_BUFF: ret = copy_from_user(&buf_cfg, argp, sizeof(buf_cfg)); if (ret < 0 || buf_cfg.type >= GDC_BUFF_TYPE_MAX) { diff --git a/drivers/amlogic/media/gdc/inc/api/gdc_api.h b/drivers/amlogic/media/gdc/inc/api/gdc_api.h index da66a02..30554c2 100644 --- a/drivers/amlogic/media/gdc/inc/api/gdc_api.h +++ b/drivers/amlogic/media/gdc/inc/api/gdc_api.h @@ -86,6 +86,7 @@ struct gdc_settings { #define GDC_PROCESS_NO_BLOCK _IOW(GDC_IOC_MAGIC, 0x01, struct gdc_settings) #define GDC_RUN _IOW(GDC_IOC_MAGIC, 0x02, struct gdc_settings) #define GDC_REQUEST_BUFF _IOW(GDC_IOC_MAGIC, 0x03, struct gdc_settings) +#define GDC_HANDLE _IOW(GDC_IOC_MAGIC, 0x04, struct gdc_settings) enum { INPUT_BUFF_TYPE = 0x1000,