From patchwork Mon Feb 1 22:27:18 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Murali Karicheri X-Patchwork-Id: 76188 Received: from devils.ext.ti.com (devils.ext.ti.com [198.47.26.153]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o11Mdsi7005307 for ; Mon, 1 Feb 2010 22:40:30 GMT Received: from dlep36.itg.ti.com ([157.170.170.91]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id o11MSSUK023859 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 1 Feb 2010 16:28:28 -0600 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep36.itg.ti.com (8.13.8/8.13.8) with ESMTP id o11MSR49016003; Mon, 1 Feb 2010 16:28:28 -0600 (CST) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 113A68067A; Mon, 1 Feb 2010 16:28:15 -0600 (CST) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dlep35.itg.ti.com (dlep35.itg.ti.com [157.170.170.118]) by linux.omap.com (Postfix) with ESMTP id 5863D8062B for ; Mon, 1 Feb 2010 16:27:22 -0600 (CST) Received: from legion.dal.design.ti.com (localhost [127.0.0.1]) by dlep35.itg.ti.com (8.13.7/8.13.7) with ESMTP id o11MRL7P021074; Mon, 1 Feb 2010 16:27:21 -0600 (CST) Received: from gt516km11.gt.design.ti.com (gt516km11.gt.design.ti.com [158.218.100.179]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id o11MRLZ22584; Mon, 1 Feb 2010 16:27:21 -0600 (CST) Received: from gt516km11.gt.design.ti.com (localhost.localdomain [127.0.0.1]) by gt516km11.gt.design.ti.com (8.13.1/8.13.1) with ESMTP id o11MRKub029139; Mon, 1 Feb 2010 17:27:20 -0500 Received: (from a0868495@localhost) by gt516km11.gt.design.ti.com (8.13.1/8.13.1/Submit) id o11MRKbk029135; Mon, 1 Feb 2010 17:27:20 -0500 From: m-karicheri2@ti.com To: linux-media@vger.kernel.org, khilman@deeprootsystems.com Subject: [PATCH v3 4/6] V4L - vpfe_capture - bug fixes and enhancements Date: Mon, 1 Feb 2010 17:27:18 -0500 Message-Id: <1265063238-29072-6-git-send-email-m-karicheri2@ti.com> X-Mailer: git-send-email 1.6.0.4 In-Reply-To: <1265063238-29072-5-git-send-email-m-karicheri2@ti.com> References: <1265063238-29072-1-git-send-email-m-karicheri2@ti.com> <1265063238-29072-2-git-send-email-m-karicheri2@ti.com> <1265063238-29072-3-git-send-email-m-karicheri2@ti.com> <1265063238-29072-4-git-send-email-m-karicheri2@ti.com> <1265063238-29072-5-git-send-email-m-karicheri2@ti.com> Cc: davinci-linux-open-source@linux.davincidsp.com X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: davinci-linux-open-source-bounces@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 01 Feb 2010 22:40:30 +0000 (UTC) diff --git a/drivers/media/video/davinci/vpfe_capture.c b/drivers/media/video/davinci/vpfe_capture.c index 885cd54..175ae47 100644 --- a/drivers/media/video/davinci/vpfe_capture.c +++ b/drivers/media/video/davinci/vpfe_capture.c @@ -758,12 +758,83 @@ static unsigned int vpfe_poll(struct file *file, poll_table *wait) return 0; } +static long vpfe_param_handler(struct file *file, void *priv, + int cmd, void *param) +{ + struct vpfe_device *vpfe_dev = video_drvdata(file); + int ret = 0; + + v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_param_handler\n"); + + if (NULL == param) { + v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, + "Invalid user ptr\n"); + return -EINVAL; + } + + if (vpfe_dev->started) { + /* only allowed if streaming is not started */ + v4l2_err(&vpfe_dev->v4l2_dev, "device already started\n"); + return -EBUSY; + } + + switch (cmd) { + case VPFE_CMD_S_CCDC_RAW_PARAMS: + v4l2_warn(&vpfe_dev->v4l2_dev, + "VPFE_CMD_S_CCDC_RAW_PARAMS: experimental ioctl\n"); + ret = mutex_lock_interruptible(&vpfe_dev->lock); + if (ret) + return ret; + ret = ccdc_dev->hw_ops.set_params(param); + if (ret) { + v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, + "Error in setting parameters in CCDC\n"); + goto unlock_out; + } + + if (vpfe_get_ccdc_image_format(vpfe_dev, &vpfe_dev->fmt) < 0) { + v4l2_err(&vpfe_dev->v4l2_dev, + "Invalid image format at CCDC\n"); + ret = -EINVAL; + } +unlock_out: + mutex_unlock(&vpfe_dev->lock); + break; + case VPFE_CMD_G_CCDC_RAW_PARAMS: + v4l2_warn(&vpfe_dev->v4l2_dev, + "VPFE_CMD_G_CCDC_RAW_PARAMS: experimental ioctl\n"); + if (!ccdc_dev->hw_ops.get_params) { + ret = -EINVAL; + break; + } + ret = ccdc_dev->hw_ops.get_params(param); + if (ret) { + v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, + "Error in getting parameters from CCDC\n"); + } + break; + default: + ret = -EINVAL; + break; + } + return ret; +} + +static long vpfe_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +{ + if (cmd == VPFE_CMD_S_CCDC_RAW_PARAMS || + cmd == VPFE_CMD_G_CCDC_RAW_PARAMS) + return vpfe_param_handler(file, file->private_data, cmd, + (void *)arg); + return video_ioctl2(file, cmd, arg); +} + /* vpfe capture driver file operations */ static const struct v4l2_file_operations vpfe_fops = { .owner = THIS_MODULE, .open = vpfe_open, .release = vpfe_release, - .unlocked_ioctl = video_ioctl2, + .unlocked_ioctl = vpfe_ioctl, .mmap = vpfe_mmap, .poll = vpfe_poll }; @@ -1681,50 +1752,6 @@ unlock_out: return ret; } - -static long vpfe_param_handler(struct file *file, void *priv, - int cmd, void *param) -{ - struct vpfe_device *vpfe_dev = video_drvdata(file); - int ret = 0; - - v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_param_handler\n"); - - if (vpfe_dev->started) { - /* only allowed if streaming is not started */ - v4l2_err(&vpfe_dev->v4l2_dev, "device already started\n"); - return -EBUSY; - } - - ret = mutex_lock_interruptible(&vpfe_dev->lock); - if (ret) - return ret; - - switch (cmd) { - case VPFE_CMD_S_CCDC_RAW_PARAMS: - v4l2_warn(&vpfe_dev->v4l2_dev, - "VPFE_CMD_S_CCDC_RAW_PARAMS: experimental ioctl\n"); - ret = ccdc_dev->hw_ops.set_params(param); - if (ret) { - v4l2_err(&vpfe_dev->v4l2_dev, - "Error in setting parameters in CCDC\n"); - goto unlock_out; - } - if (vpfe_get_ccdc_image_format(vpfe_dev, &vpfe_dev->fmt) < 0) { - v4l2_err(&vpfe_dev->v4l2_dev, - "Invalid image format at CCDC\n"); - goto unlock_out; - } - break; - default: - ret = -EINVAL; - } -unlock_out: - mutex_unlock(&vpfe_dev->lock); - return ret; -} - - /* vpfe capture ioctl operations */ static const struct v4l2_ioctl_ops vpfe_ioctl_ops = { .vidioc_querycap = vpfe_querycap, @@ -1750,7 +1777,6 @@ static const struct v4l2_ioctl_ops vpfe_ioctl_ops = { .vidioc_cropcap = vpfe_cropcap, .vidioc_g_crop = vpfe_g_crop, .vidioc_s_crop = vpfe_s_crop, - .vidioc_default = vpfe_param_handler, }; static struct vpfe_device *vpfe_initialize(void) diff --git a/include/media/davinci/vpfe_capture.h b/include/media/davinci/vpfe_capture.h index d863e5e..9bdfaad 100644 --- a/include/media/davinci/vpfe_capture.h +++ b/include/media/davinci/vpfe_capture.h @@ -31,8 +31,6 @@ #include #include -#define VPFE_CAPTURE_NUM_DECODERS 5 - /* Macros */ #define VPFE_MAJOR_RELEASE 0 #define VPFE_MINOR_RELEASE 0 @@ -91,9 +89,6 @@ struct vpfe_config { char *card_name; /* ccdc name */ char *ccdc; - /* vpfe clock */ - struct clk *vpssclk; - struct clk *slaveclk; }; struct vpfe_device { @@ -193,8 +188,12 @@ struct vpfe_config_params { * color space conversion, culling etc. This is an experimental ioctl that * will change in future kernels. So use this ioctl with care ! * TODO: This is to be split into multiple ioctls and also explore the - * possibility of extending the v4l2 api to include this + * possibility of extending the v4l2 api to include this. + * VPFE_CMD_G_CCDC_RAW_PARAMS - EXPERIMENTAL IOCTL to get the current raw + * capture parameters **/ #define VPFE_CMD_S_CCDC_RAW_PARAMS _IOW('V', BASE_VIDIOC_PRIVATE + 1, \ void *) +#define VPFE_CMD_G_CCDC_RAW_PARAMS _IOR('V', BASE_VIDIOC_PRIVATE + 2, \ + void *) #endif /* _DAVINCI_VPFE_H */