From: Hans Verkuil <hverkuil@xs4all.nl>
To: Arun Kumar K <arun.kk@samsung.com>
Cc: linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
devicetree@vger.kernel.org, s.nawrocki@samsung.com,
swarren@wwwdotorg.org, mark.rutland@arm.com, Pawel.Moll@arm.com,
galak@codeaurora.org, a.hajda@samsung.com,
sachin.kamat@linaro.org, shaik.ameer@samsung.com,
kilyeon.im@samsung.com, arunkk.samsung@gmail.com
Subject: Re: [PATCH v9 09/13] [media] exynos5-fimc-is: Add the hardware pipeline control
Date: Mon, 30 Sep 2013 14:43:40 +0200 [thread overview]
Message-ID: <524971FC.5030907@xs4all.nl> (raw)
In-Reply-To: <1380279558-21651-10-git-send-email-arun.kk@samsung.com>
On 09/27/2013 12:59 PM, Arun Kumar K wrote:
> This patch adds the crucial hardware pipeline control for the
> fimc-is driver. All the subdev nodes will call this pipeline
> interfaces to reach the hardware. Responsibilities of this module
> involves configuring and maintaining the hardware pipeline involving
> multiple sub-ips like ISP, DRC, Scalers, ODC, 3DNR, FD etc.
>
> Signed-off-by: Arun Kumar K <arun.kk@samsung.com>
> Signed-off-by: Kilyeon Im <kilyeon.im@samsung.com>
> Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
> ---
> .../media/platform/exynos5-is/fimc-is-pipeline.c | 1708 ++++++++++++++++++++
> .../media/platform/exynos5-is/fimc-is-pipeline.h | 129 ++
> 2 files changed, 1837 insertions(+)
> create mode 100644 drivers/media/platform/exynos5-is/fimc-is-pipeline.c
> create mode 100644 drivers/media/platform/exynos5-is/fimc-is-pipeline.h
>
> diff --git a/drivers/media/platform/exynos5-is/fimc-is-pipeline.c b/drivers/media/platform/exynos5-is/fimc-is-pipeline.c
> new file mode 100644
> index 0000000..a73d952
> --- /dev/null
> +++ b/drivers/media/platform/exynos5-is/fimc-is-pipeline.c
<snip>
> +int fimc_is_pipeline_open(struct fimc_is_pipeline *pipeline,
> + struct fimc_is_sensor *sensor)
> +{
> + struct fimc_is *is = pipeline->is;
> + struct is_region *region;
> + unsigned long index[2] = {0};
> + int ret;
> +
> + if (!sensor)
> + return -EINVAL;
> +
> + mutex_lock(&pipeline->pipe_lock);
> +
> + if (test_bit(PIPELINE_OPEN, &pipeline->state)) {
> + dev_err(pipeline->dev, "Pipeline already open\n");
> + ret = -EINVAL;
> + goto err_exit;
> + }
> +
> + pipeline->fcount = 0;
> + pipeline->sensor = sensor;
> +
> + if (is->num_pipelines == 0) {
> + /* Init memory */
> + ret = fimc_is_pipeline_initmem(pipeline);
> + if (ret) {
> + dev_err(pipeline->dev, "Pipeline memory init failed\n");
> + goto err_exit;
> + }
> +
> + /* Load firmware */
> + ret = fimc_is_pipeline_load_firmware(pipeline);
> + if (ret) {
> + dev_err(pipeline->dev, "Firmware load failed\n");
> + goto err_fw;
> + }
> +
> + /* Power ON */
> + ret = fimc_is_pipeline_power(pipeline, 1);
> + if (ret) {
> + dev_err(pipeline->dev, "A5 power on failed\n");
> + goto err_fw;
> + }
> +
> + /* Wait for FW Init to complete */
> + ret = fimc_is_itf_wait_init_state(&is->interface);
> + if (ret) {
> + dev_err(pipeline->dev, "FW init failed\n");
> + goto err_fw;
> + }
> + }
> +
> + /* Open Sensor */
> + region = pipeline->is_region;
> + ret = fimc_is_itf_open_sensor(&is->interface,
> + pipeline->instance,
> + sensor->drvdata->id,
> + sensor->i2c_bus,
> + pipeline->minfo->shared.paddr);
> + if (ret) {
> + dev_err(pipeline->dev, "Open sensor failed\n");
> + goto err_exit;
> + }
> +
> + /* Load setfile */
> + ret = fimc_is_pipeline_setfile(pipeline);
> + if (ret)
> + goto err_exit;
> +
> + /* Stream off */
> + ret = fimc_is_itf_stream_off(&is->interface, pipeline->instance);
> + if (ret)
> + goto err_exit;
> +
> + /* Process off */
> + ret = fimc_is_itf_process_off(&is->interface, pipeline->instance);
> + if (ret)
> + goto err_exit;
> +
> + if (is->num_pipelines == 0) {
> + /* Copy init params to FW region */
> + memset(®ion->parameter, 0x0, sizeof(struct is_param_region));
> +
> + memcpy(®ion->parameter.sensor, &init_sensor_param,
> + sizeof(struct sensor_param));
How about:
region->parameter.sensor = init_sensor_param;
Shorter and type-safe.
Ditto for the memcpy's below.
> + memcpy(®ion->parameter.isp, &init_isp_param,
> + sizeof(struct isp_param));
> + memcpy(®ion->parameter.drc, &init_drc_param,
> + sizeof(struct drc_param));
> + memcpy(®ion->parameter.scalerc, &init_scalerc_param,
> + sizeof(struct scalerc_param));
> + memcpy(®ion->parameter.odc, &init_odc_param,
> + sizeof(struct odc_param));
> + memcpy(®ion->parameter.dis, &init_dis_param,
> + sizeof(struct dis_param));
> + memcpy(®ion->parameter.tdnr, &init_tdnr_param,
> + sizeof(struct tdnr_param));
> + memcpy(®ion->parameter.scalerp, &init_scalerp_param,
> + sizeof(struct scalerp_param));
> + memcpy(®ion->parameter.fd, &init_fd_param,
> + sizeof(struct fd_param));
> + wmb();
> +
> + /* Set all init params to FW */
> + index[0] = 0xffffffff;
> + index[1] = 0xffffffff;
> + ret = fimc_is_itf_set_param(&is->interface, pipeline->instance,
> + index[0], index[1]);
> + if (ret) {
> + dev_err(pipeline->dev, "%s failed\n", __func__);
> + return -EINVAL;
> + }
> + }
> +
> + /* Set state to OPEN */
> + set_bit(PIPELINE_OPEN, &pipeline->state);
> + is->num_pipelines++;
> +
> + mutex_unlock(&pipeline->pipe_lock);
> + return 0;
> +
> +err_fw:
> + fimc_is_pipeline_freemem(pipeline);
> +err_exit:
> + mutex_unlock(&pipeline->pipe_lock);
> + return ret;
> +}
Regards,
Hans
next prev parent reply other threads:[~2013-09-30 12:43 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-27 10:59 [PATCH v9 00/13] Exynos5 IS driver Arun Kumar K
2013-09-27 10:59 ` [PATCH v9 01/13] [media] exynos5-is: Adding media device driver for exynos5 Arun Kumar K
[not found] ` <1380279558-21651-2-git-send-email-arun.kk-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-09-27 21:01 ` Sylwester Nawrocki
2013-11-11 16:12 ` Mark Rutland
[not found] ` <20131111161213.GK21201-NuALmloUBlrZROr8t4l/smS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>
2013-11-11 19:25 ` Gerhard Sittig
[not found] ` <20131111192515.GP17929-kDjWylLy9wD0K7fsECOQyeGNnDKD8DIp@public.gmane.org>
2013-11-12 9:54 ` Mark Rutland
2013-09-27 10:59 ` [PATCH v9 02/13] [media] exynos5-fimc-is: Add Exynos5 FIMC-IS device tree bindings documentation Arun Kumar K
2013-11-11 16:19 ` Mark Rutland
2013-09-27 10:59 ` [PATCH v9 03/13] [media] exynos5-fimc-is: Add driver core files Arun Kumar K
2013-09-27 10:59 ` [PATCH v9 06/13] [media] exynos5-fimc-is: Add isp subdev Arun Kumar K
2013-09-27 10:59 ` [PATCH v9 08/13] [media] exynos5-fimc-is: Add sensor interface Arun Kumar K
2013-09-27 10:59 ` [PATCH v9 09/13] [media] exynos5-fimc-is: Add the hardware pipeline control Arun Kumar K
2013-09-30 12:43 ` Hans Verkuil [this message]
2013-10-18 4:48 ` Arun Kumar K
2013-09-27 10:59 ` [PATCH v9 11/13] [media] exynos5-is: Add Kconfig and Makefile Arun Kumar K
[not found] ` <1380279558-21651-1-git-send-email-arun.kk-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-09-27 10:59 ` [PATCH v9 04/13] [media] exynos5-fimc-is: Add common driver header files Arun Kumar K
2013-09-27 10:59 ` [PATCH v9 05/13] [media] exynos5-fimc-is: Add register definition and context header Arun Kumar K
2013-09-27 10:59 ` [PATCH v9 07/13] [media] exynos5-fimc-is: Add scaler subdev Arun Kumar K
2013-09-27 10:59 ` [PATCH v9 10/13] [media] exynos5-fimc-is: Add the hardware interface module Arun Kumar K
2013-09-27 10:59 ` [PATCH v9 12/13] V4L: s5k6a3: Change sensor min/max resolutions Arun Kumar K
2013-10-17 17:03 ` Sylwester Nawrocki
2013-10-18 2:45 ` Arun Kumar K
2013-09-27 10:59 ` [PATCH v9 13/13] V4L: Add driver for s5k4e5 image sensor Arun Kumar K
2013-10-17 17:10 ` Sylwester Nawrocki
2013-10-18 2:46 ` Arun Kumar K
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=524971FC.5030907@xs4all.nl \
--to=hverkuil@xs4all.nl \
--cc=Pawel.Moll@arm.com \
--cc=a.hajda@samsung.com \
--cc=arun.kk@samsung.com \
--cc=arunkk.samsung@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=galak@codeaurora.org \
--cc=kilyeon.im@samsung.com \
--cc=linux-media@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=s.nawrocki@samsung.com \
--cc=sachin.kamat@linaro.org \
--cc=shaik.ameer@samsung.com \
--cc=swarren@wwwdotorg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).