A V4L2 driver for Exynos4x12 Imaging Subsystem
Subsystems (3)
cover A V4L2 driver for Exynos4x12 Imaging Subsystem
This patch series is an initial version of a driver for the camera ISP subsystem (FIMC-IS) embedded in Samsung Exynos4x12 SoCs.
The FIMC-IS subsystem is build around a ARM Cortex-A5 CPU that controls its dedicated peripherals, like I2C, SPI, UART, PWM, ADC,... and the ISP chain. There are 3 hardware image processing blocks: ISP, DRC (dynamic range compression) and FD (face detection) that are normally controlled by the Cortex-A5 firmware.
The driver currently exposes two additional sub-device to user space:
the image sensor and FIMC-IS-ISP sub-device. Another one might be added in future for the FD features.
The FIMC-IS has various data inputs, it can capture data from memory or from other SoC IP blocks (FIMC-LITE). It is currently plugged between FIMC-LITE and FIMC IP blocks, so there is a media pipeline like:
sensor -> MIPI-CSIS -> FIMC-LITE -> FIMC-IS-ISP -> FIMC -> memory
A raw Bayer image data can be captured from the ISP block which has it's own DMA engines. Support for this is not really included in this series though, only a video capture node driver stubs are added.
This is a bit complicated code, nevertheless I would really appreciate any review comments you might have.
And this is just a basic set of futures this patch series addresses. Others include input/output DMA support for the DRC and FD blocks, support for more ISP controls, etc.
But it all is not immediately needed to make use of this really great ISP!
A full git tree with all dependencies can be found at:git://linuxtv.org/snawrocki/samsung.git
http://git.linuxtv.org/snawrocki/samsung.git/exynos4-fimc-is
Sylwester Nawrocki (8):
s5p-fimc: Add Exynos4x12 FIMC-IS driver
s5p-fimc: Add FIMC-IS ISP I2C bus driver
s5p-fimc: Add FIMC-IS parameter region definitions
s5p-fimc: Add common FIMC-IS image sensor driver
s5p-fimc: Add ISP video capture driver stubs
fimc-is: Add Exynos4x12 FIMC-IS device tree bindings documentation
s5p-fimc: Add fimc-is subdevs registration
s5p-fimc: Create media links for the FIMC-IS entities
.../devicetree/bindings/media/exynos4-fimc-is.txt | 41 + drivers/media/platform/s5p-fimc/Kconfig | 13 + drivers/media/platform/s5p-fimc/Makefile | 4 + drivers/media/platform/s5p-fimc/fimc-is-command.h | 147 +++ drivers/media/platform/s5p-fimc/fimc-is-errno.c | 272 ++++++ drivers/media/platform/s5p-fimc/fimc-is-errno.h | 248 +++++ drivers/media/platform/s5p-fimc/fimc-is-i2c.c | 81 ++ drivers/media/platform/s5p-fimc/fimc-is-i2c.h | 15 + drivers/media/platform/s5p-fimc/fimc-is-param.c | 971 +++++++++++++++++++ drivers/media/platform/s5p-fimc/fimc-is-param.h | 1018 ++++++++++++++++++++ drivers/media/platform/s5p-fimc/fimc-is-regs.c | 242 +++++ drivers/media/platform/s5p-fimc/fimc-is-regs.h | 164 ++++ drivers/media/platform/s5p-fimc/fimc-is-sensor.c | 308 ++++++ drivers/media/platform/s5p-fimc/fimc-is-sensor.h | 80 ++ drivers/media/platform/s5p-fimc/fimc-is.c | 970 +++++++++++++++++++ drivers/media/platform/s5p-fimc/fimc-is.h | 344 +++++++ drivers/media/platform/s5p-fimc/fimc-isp-video.c | 414 ++++++++ drivers/media/platform/s5p-fimc/fimc-isp-video.h | 50 + drivers/media/platform/s5p-fimc/fimc-isp.c | 791 +++++++++++++++ drivers/media/platform/s5p-fimc/fimc-isp.h | 205 ++++ drivers/media/platform/s5p-fimc/fimc-mdevice.c | 129 ++- drivers/media/platform/s5p-fimc/fimc-mdevice.h | 15 + 22 files changed, 6502 insertions(+), 20 deletions(-) create mode 100644 Documentation/devicetree/bindings/media/exynos4-fimc-is.txt create mode 100644 drivers/media/platform/s5p-fimc/fimc-is-command.h create mode 100644 drivers/media/platform/s5p-fimc/fimc-is-errno.c create mode 100644 drivers/media/platform/s5p-fimc/fimc-is-errno.h create mode 100644 drivers/media/platform/s5p-fimc/fimc-is-i2c.c create mode 100644 drivers/media/platform/s5p-fimc/fimc-is-i2c.h create mode 100644 drivers/media/platform/s5p-fimc/fimc-is-param.c create mode 100644 drivers/media/platform/s5p-fimc/fimc-is-param.h create mode 100644 drivers/media/platform/s5p-fimc/fimc-is-regs.c create mode 100644 drivers/media/platform/s5p-fimc/fimc-is-regs.h create mode 100644 drivers/media/platform/s5p-fimc/fimc-is-sensor.c create mode 100644 drivers/media/platform/s5p-fimc/fimc-is-sensor.h create mode 100644 drivers/media/platform/s5p-fimc/fimc-is.c create mode 100644 drivers/media/platform/s5p-fimc/fimc-is.h create mode 100644 drivers/media/platform/s5p-fimc/fimc-isp-video.c create mode 100644 drivers/media/platform/s5p-fimc/fimc-isp-video.h create mode 100644 drivers/media/platform/s5p-fimc/fimc-isp.c create mode 100644 drivers/media/platform/s5p-fimc/fimc-isp.h
--
1.7.9.5
RFC PATCH 1/8 s5p-fimc: Add Exynos4x12 FIMC-IS driver
This patch adds a set of core files of the Exynos4x12 FIMC-IS V4L2 driver. This includes main functionality like allocating memory, loading the firmware, FIMC-IS register interface and host CPU <-> IS command and error code definitions.
The driver currently exposes a single subdev named FIMC-IS-ISP, which corresponds to the FIMC-IS ISP and DRC IP blocks.
The FIMC-IS-ISP subdev currently supports only a subset of user controls. For other controls we need several extensions at the V4L2 API. The supported standard controls are:
brightness, contrast, saturation, hue, sharpness, 3a_lock, exposure_time_absolute, white_balance_auto_preset, iso_sensitivity, iso_sensitivity_auto, exposure_metering_mode.
--- drivers/media/platform/s5p-fimc/fimc-is-command.h | 147 ++++ drivers/media/platform/s5p-fimc/fimc-is-errno.c | 272 ++++++ drivers/media/platform/s5p-fimc/fimc-is-errno.h | 248 ++++++ drivers/media/platform/s5p-fimc/fimc-is-regs.c | 242 +++++ drivers/media/platform/s5p-fimc/fimc-is-regs.h | 164 ++++ drivers/media/platform/s5p-fimc/fimc-is.c | 970 +++++++++++++++++++++ drivers/media/platform/s5p-fimc/fimc-is.h | 344 ++++++++ drivers/media/platform/s5p-fimc/fimc-isp.c | 791 +++++++++++++++++ drivers/media/platform/s5p-fimc/fimc-isp.h | 205 +++++ 9 files changed, 3383 insertions(+) create mode 100644 drivers/media/platform/s5p-fimc/fimc-is-command.h create mode 100644 drivers/media/platform/s5p-fimc/fimc-is-errno.c create mode 100644 drivers/media/platform/s5p-fimc/fimc-is-errno.h create mode 100644 drivers/media/platform/s5p-fimc/fimc-is-regs.c create mode 100644 drivers/media/platform/s5p-fimc/fimc-is-regs.h create mode 100644 drivers/media/platform/s5p-fimc/fimc-is.c create mode 100644 drivers/media/platform/s5p-fimc/fimc-is.h create mode 100644 drivers/media/platform/s5p-fimc/fimc-isp.c create mode 100644 drivers/media/platform/s5p-fimc/fimc-isp.h
drivers/media/platform/s5p-fimc/fimc-is-command.h new file +147 -0
@@ -0,0 +1,147 @@ +/* +* Samsung Exynos4x12 FIMC-IS (Imaging Subsystem) driver +* +* FIMC-IS command set definitions +* +* Copyright (C) 2013 Samsung Electronics Co., Ltd. +* +* Authors: Younghwan Joo <[email protected]> +* Sylwester Nawrocki <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#ifndef FIMC_IS_CMD_H_ +#define FIMC_IS_CMD_H_ + +#define FIMC_IS_COMMAND_VER 110/* FIMC-IS command set version 1.10 */ + +/* Enumeration of commands beetween the FIMC-IS and the host processor. */ + +/* HOST to FIMC-IS */ +#define FIMC_IS_HIC_PREVIEW_STILL 0x0001 +#define FIMC_IS_HIC_PREVIEW_VIDEO 0x0002 +#define FIMC_IS_HIC_CAPTURE_STILL 0x0003 +#define FIMC_IS_HIC_CAPTURE_VIDEO 0x0004 +#define FIMC_IS_HIC_STREAM_ON 0x0005 +#define FIMC_IS_HIC_STREAM_OFF 0x0006 +#define FIMC_IS_HIC_SET_PARAMETER 0x0007 +#define FIMC_IS_HIC_GET_PARAMETER 0x0008 +#define FIMC_IS_HIC_SET_TUNE 0x0009 +#define FIMC_IS_HIC_GET_STATUS 0x000b +/* Sensor part */ +#define FIMC_IS_HIC_OPEN_SENSOR 0x000c +#define FIMC_IS_HIC_CLOSE_SENSOR 0x000d +#define FIMC_IS_HIC_SIMMIAN_INIT 0x000e +#define FIMC_IS_HIC_SIMMIAN_WRITE 0x000f +#define FIMC_IS_HIC_SIMMIAN_READ 0x0010 +#define FIMC_IS_HIC_POWER_DOWN 0x0011 +#define FIMC_IS_HIC_GET_SET_FILE_ADDR 0x0012 +#define FIMC_IS_HIC_LOAD_SET_FILE 0x0013 +#define FIMC_IS_HIC_MSG_CONFIG 0x0014 +#define FIMC_IS_HIC_MSG_TEST 0x0015 +/* FIMC-IS to HOST */ +#define FIMC_IS_IHC_GET_SENSOR_NUM 0x1000 +#define FIMC_IS_IHC_SET_SHOT_MARK 0x1001 +/* parameter1: frame number */ +/* parameter2: confidence level (smile 0~100) */ +/* parameter3: confidence level (blink 0~100) */ +#define FIMC_IS_IHC_SET_FACE_MARK 0x1002 +/* parameter1: coordinate count */ +/* parameter2: coordinate buffer address */ +#define FIMC_IS_IHC_FRAME_DONE 0x1003 +/* parameter1: frame start number */ +/* parameter2: frame count */ +#define FIMC_IS_IHC_AA_DONE 0x1004 +#define FIMC_IS_IHC_NOT_READY 0x1005 + +#define FIMC_IS_REPLY_DONE 0x2000 +#define FIMC_IS_REPLY_NOT_DONE 0x2001 + +enum fimc_is_scenario { +IS_SC_PREVIEW_STILL , +IS_SC_PREVIEW_VIDEO , +IS_SC_CAPTURE_STILL , +IS_SC_CAPTURE_VIDEO , +IS_SC_MAX +}; + +enum fimc_is_sub_scenario { +IS_SC_SUB_DEFAULT , +IS_SC_SUB_PS_VTCALL , +IS_SC_SUB_CS_VTCALL , +IS_SC_SUB_PV_VTCALL , +IS_SC_SUB_CV_VTCALL , +}; + +struct fimc_is_capability { +u32 support_af; +u32 iso_gain; +u32 aperture; +u32 min_exposure; +u32 max_exposure; +u32 min_gain; +u32 max_gain; +} __packed; + +struct is_common_reg { +u32 hicmd; +u32 hic_sensorid; +u32 hic_param[4 ]; +u32 reserved1[4 ]; + +u32 ihcmd; +u32 ihc_sensorid; +u32 ihc_param[4 ]; +u32 reserved2[4 ]; + +u32 isp_sensor_id; +u32 isp_param[2 ]; +u32 reserved3[1 ]; + +u32 scc_sensor_id; +u32 scc_param[2 ]; +u32 reserved4[1 ]; + +u32 dnr_sensor_id; +u32 dnr_param[2 ]; +u32 reserved5[1 ]; + +u32 scp_sensor_id; +u32 scp_param[2 ]; +u32 reserved6[29 ]; +} __packed; + +struct is_mcuctl_reg { +u32 mcuctl; +u32 bboar; + +u32 intgr0; +u32 intcr0; +u32 intmr0; +u32 intsr0; +u32 intmsr0; + +u32 intgr1; +u32 intcr1; +u32 intmr1; +u32 intsr1; +u32 intmsr1; + +u32 intcr2; +u32 intmr2; +u32 intsr2; +u32 intmsr2; + +u32 gpoctrl; +u32 cpoenctlr; +u32 gpictlr; + +u32 pad[0xd ]; + +struct is_common_reg common; +} __packed; + +#endif /* FIMC_IS_CMD_H_ */
drivers/media/platform/s5p-fimc/fimc-is-errno.c new file +272 -0
272 lines not on this page · raw message
drivers/media/platform/s5p-fimc/fimc-is-errno.h new file +248 -0
248 lines not on this page · raw message
drivers/media/platform/s5p-fimc/fimc-is-regs.c new file +242 -0
242 lines not on this page · raw message
drivers/media/platform/s5p-fimc/fimc-is-regs.h new file +164 -0
164 lines not on this page · raw message
drivers/media/platform/s5p-fimc/fimc-is.c new file +970 -0
970 lines not on this page · raw message
drivers/media/platform/s5p-fimc/fimc-is.h new file +344 -0
344 lines not on this page · raw message
drivers/media/platform/s5p-fimc/fimc-isp.c new file +791 -0
613 lines not on this page · raw message
drivers/media/platform/s5p-fimc/fimc-isp.h new file +205 -0
205 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.7.9.5
Part of the diff is not shown here. View the raw message.
RFC PATCH 1/8 s5p-fimc: Add Exynos4x12 FIMC-IS driver
Quoted 14 lines · On Mon 11 March 2013 20:44:45 Sylwester Nawrocki wrote:
This patch adds a set of core files of the Exynos4x12 FIMC-IS V4L2 driver. This includes main functionality like allocating memory, loading the firmware, FIMC-IS register interface and host CPU <-> IS command and error code definitions.
The driver currently exposes a single subdev named FIMC-IS-ISP, which corresponds to the FIMC-IS ISP and DRC IP blocks.
The FIMC-IS-ISP subdev currently supports only a subset of user controls. For other controls we need several extensions at the V4L2 API. The supported standard controls are:
brightness, contrast, saturation, hue, sharpness, 3a_lock,exposure_time_absolute,white_balance_auto_preset,iso_sensitivity,iso_sensitivity_auto,exposure_metering_mode.
Quoted 3 lines
Signed-off-by Sylwester Nawrocki <[email protected]>Signed-off-by Kyungmin Park <[email protected]>---
<snip most of the patch>
Quoted 253 lines
drivers/media/platform/s5p-fimc/fimc-isp.c new file +253
-0+ +/* Supported manual ISO values */ +static const s64 iso_qmenu[] = { +50 ,100 ,200 ,400 ,800 , +}; + +static int __ctrl_set_iso (struct fimc_is *is,int value) +{ +unsigned int idx, iso; + +if (value ==V4L2_ISO_SENSITIVITY_AUTO ) { +__is_set_isp_iso (is,ISP_ISO_COMMAND_AUTO ,0 ); +return 0 ; + } + idx = is->isp.ctrls.iso->val; +if (idx >=ARRAY_SIZE (iso_qmenu)) +return -EINVAL ; + + iso = iso_qmenu[idx]; +__is_set_isp_iso (is,ISP_ISO_COMMAND_MANUAL , iso); +return 0 ; +} + +static int __ctrl_set_metering (struct fimc_is *is,unsigned int value) +{ +unsigned int val; + +switch (value) { +case V4L2_EXPOSURE_METERING_AVERAGE : + val =ISP_METERING_COMMAND_AVERAGE ; +break ; +case V4L2_EXPOSURE_METERING_CENTER_WEIGHTED : + val =ISP_METERING_COMMAND_CENTER ; +break ; +case V4L2_EXPOSURE_METERING_SPOT : + val =ISP_METERING_COMMAND_SPOT ; +break ; +case V4L2_EXPOSURE_METERING_MATRIX : + val =ISP_METERING_COMMAND_MATRIX ; +break ; +default : +return -EINVAL ; + }; + +__is_set_isp_metering (is,IS_METERING_CONFIG_CMD , val); +return 0 ; +} + +static int __ctrl_set_afc (struct fimc_is *is,int value) +{ +switch (value) { +case V4L2_CID_POWER_LINE_FREQUENCY_DISABLED : +__is_set_isp_afc (is,ISP_AFC_COMMAND_DISABLE ,0 ); +break ; +case V4L2_CID_POWER_LINE_FREQUENCY_50HZ : +__is_set_isp_afc (is,ISP_AFC_COMMAND_MANUAL ,50 ); +break ; +case V4L2_CID_POWER_LINE_FREQUENCY_60HZ : +__is_set_isp_afc (is,ISP_AFC_COMMAND_MANUAL ,60 ); +break ; +case V4L2_CID_POWER_LINE_FREQUENCY_AUTO : +__is_set_isp_afc (is,ISP_AFC_COMMAND_AUTO ,0 ); +break ; +default : +return -EINVAL ; + } + +return 0 ; +} + +#if 0 +static int __ctrl_set_flash_mode (struct fimc_is *is,int value) +{ +switch (value) { +case IS_FLASH_MODE_OFF : +__is_set_isp_flash (is,ISP_FLASH_COMMAND_DISABLE ,0 ); +break ; +case IS_FLASH_MODE_AUTO : +__is_set_isp_flash (is,ISP_FLASH_COMMAND_AUTO ,0 ); +break ; +case IS_FLASH_MODE_AUTO_REDEYE : +__is_set_isp_flash (is,ISP_FLASH_COMMAND_AUTO ,1 ); +break ; +case IS_FLASH_MODE_ON : +__is_set_isp_flash (is,ISP_FLASH_COMMAND_MANUALON ,0 ); +break ; +case IS_FLASH_MODE_TORCH : +__is_set_isp_flash (is,ISP_FLASH_COMMAND_TORCH ,0 ); +break ; +default : +return -EINVAL ; + } + +return 0 ; +} +#endif + +static int __ctrl_set_image_effect (struct fimc_is *is,int value) +{ +/* FIXME: */ +__is_set_isp_effect (is, value); +return 0 ; +} + +static int fimc_is_s_ctrl (struct v4l2_ctrl *ctrl) +{ +struct fimc_isp *isp =ctrl_to_fimc_isp (ctrl); +struct fimc_is *is =fimc_isp_to_is (isp); +bool set_param = true; +int ret =0 ; + +switch (ctrl->id) { +case V4L2_CID_CONTRAST : +__is_set_isp_adjust (is,ISP_ADJUST_COMMAND_MANUAL_CONTRAST , + ctrl->val); +break ; + +case V4L2_CID_SATURATION : +__is_set_isp_adjust (is,ISP_ADJUST_COMMAND_MANUAL_SATURATION , + ctrl->val); +break ; + +case V4L2_CID_SHARPNESS : +__is_set_isp_adjust (is,ISP_ADJUST_COMMAND_MANUAL_SHARPNESS , + ctrl->val); +break ; + +case V4L2_CID_EXPOSURE_ABSOLUTE : +__is_set_isp_adjust (is,ISP_ADJUST_COMMAND_MANUAL_EXPOSURE , + ctrl->val); +break ; + +case V4L2_CID_BRIGHTNESS : +__is_set_isp_adjust (is,ISP_ADJUST_COMMAND_MANUAL_BRIGHTNESS , + ctrl->val); +break ; + +case V4L2_CID_HUE : +__is_set_isp_adjust (is,ISP_ADJUST_COMMAND_MANUAL_HUE , + ctrl->val); +break ; + +case V4L2_CID_EXPOSURE_METERING : + ret =__ctrl_set_metering (is, ctrl->val); +break ; + +case V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE : + ret =__ctrl_set_white_balance (is, ctrl->val); +break ; + +case V4L2_CID_3A_LOCK : + ret =__ctrl_set_aewb_lock (is, ctrl); + set_param = false; +break ; + +case V4L2_CID_ISO_SENSITIVITY_AUTO : + ret =__ctrl_set_iso (is, ctrl->val); +break ; + +case V4L2_CID_POWER_LINE_FREQUENCY : + ret =__ctrl_set_afc (is, ctrl->val); +break ; + +case V4L2_CID_COLORFX : +__ctrl_set_image_effect (is, ctrl->val); +break ; + +default : + ret = -EINVAL ; +break ; + } + +if (ret <0 ) { +v4l2_err (&isp->subdev,"%s() failed, ctrl: %s, val: %d\n" , + __func__, ctrl->name, ctrl->val); +return ret; + } + +if (set_param &&test_bit (IS_ST_STREAM_ON , &is->state)) +return fimc_is_itf_s_param (is, true); + +return 0 ; +} + +static const struct v4l2_ctrl_ops fimc_isp_ctrl_ops = { + .s_ctrl = fimc_is_s_ctrl, +}; + +int fimc_isp_subdev_create (struct fimc_isp *isp) +{ +const struct v4l2_ctrl_ops *ops = &fimc_isp_ctrl_ops; +struct v4l2_ctrl_handler *handler = &isp->ctrls.handler; +struct v4l2_subdev *sd = &isp->subdev; +struct fimc_isp_ctrls *ctrls = &isp->ctrls; +int ret; + +mutex_init (&isp->subdev_lock); + +v4l2_subdev_init (sd, &fimc_is_subdev_ops); + sd->grp_id =GRP_ID_FIMC_IS ; + sd->flags =V4L2_SUBDEV_FL_HAS_DEVNODE ; +snprintf (sd->name,sizeof (sd->name),"FIMC-IS-ISP" ); + + isp->subdev_pads[FIMC_IS_SD_PAD_SINK ].flags =MEDIA_PAD_FL_SINK ; + isp->subdev_pads[FIMC_IS_SD_PAD_SRC_FIFO ].flags =MEDIA_PAD_FL_SOURCE ; + isp->subdev_pads[FIMC_IS_SD_PAD_SRC_DMA ].flags =MEDIA_PAD_FL_SOURCE ; + ret =media_entity_init (&sd->entity,FIMC_IS_SD_PADS_NUM , + isp->subdev_pads,0 ); +if (ret) +return ret; + +v4l2_ctrl_handler_init (handler,20 ); + + ctrls->saturation =v4l2_ctrl_new_std (handler, ops,V4L2_CID_SATURATION , +-2 ,2 ,1 ,0 ); + ctrls->brightness =v4l2_ctrl_new_std (handler, ops,V4L2_CID_BRIGHTNESS , +-4 ,4 ,1 ,0 ); + ctrls->contrast =v4l2_ctrl_new_std (handler, ops,V4L2_CID_CONTRAST , +-2 ,2 ,1 ,0 ); + ctrls->sharpness =v4l2_ctrl_new_std (handler, ops,V4L2_CID_SHARPNESS , +-2 ,2 ,1 ,0 ); + ctrls->hue =v4l2_ctrl_new_std (handler, ops,V4L2_CID_HUE , +-2 ,2 ,1 ,0 ); + + ctrls->auto_wb =v4l2_ctrl_new_std_menu (handler, ops, +V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE , +8 , ~0x14e ,V4L2_WHITE_BALANCE_AUTO ); + + ctrls->exposure =v4l2_ctrl_new_std (handler, ops, +V4L2_CID_EXPOSURE_ABSOLUTE , +-4 ,4 ,1 ,0 ); + + ctrls->exp_metering =v4l2_ctrl_new_std_menu (handler, ops, +V4L2_CID_EXPOSURE_METERING ,3 , + ~0xf ,V4L2_EXPOSURE_METERING_AVERAGE ); + +v4l2_ctrl_new_std_menu (handler, ops,V4L2_CID_POWER_LINE_FREQUENCY , +V4L2_CID_POWER_LINE_FREQUENCY_AUTO ,0 , +V4L2_CID_POWER_LINE_FREQUENCY_AUTO ); +/* ISO sensitivity */ + ctrls->auto_iso =v4l2_ctrl_new_std_menu (handler, ops, +V4L2_CID_ISO_SENSITIVITY_AUTO ,1 ,0 , +V4L2_ISO_SENSITIVITY_AUTO ); + + ctrls->iso =v4l2_ctrl_new_int_menu (handler, ops, +V4L2_CID_ISO_SENSITIVITY ,ARRAY_SIZE (iso_qmenu) -1 , +ARRAY_SIZE (iso_qmenu)/2 -1 , iso_qmenu); + + ctrls->aewb_lock =v4l2_ctrl_new_std (handler, ops, +V4L2_CID_3A_LOCK ,0 ,0x3 ,0 ,0 ); + +/* FIXME: Adjust the enabled controls mask according +to the ISP capabilities */
drivers/media/platform/s5p-fimc/fimc-isp.c line 772
Quoted 10 lines
drivers/media/platform/s5p-fimc/fimc-isp.c new file +10
-0+v4l2_ctrl_new_std_menu (handler, ops,V4L2_CID_COLORFX , +V4L2_COLORFX_ANTIQUE , +0 ,V4L2_COLORFX_NONE ); +if (handler->error) { +media_entity_cleanup (&sd->entity); +return handler->error; + } + + ctrls->auto_iso->flags |=V4L2_CTRL_FLAG_VOLATILE | +V4L2_CTRL_FLAG_UPDATE ;
Why would auto_iso be volatile? I would expect the iso to be volatile (in which case the 'false' argument below would be 'true'). Also, v4l2_ctrl_auto_cluster already sets the UPDATE flag.
Quoted 105 lines
drivers/media/platform/s5p-fimc/fimc-isp.c new file +19
-0+v4l2_ctrl_auto_cluster (2 , &ctrls->auto_iso,0 , false); + + sd->ctrl_handler = handler; + sd->internal_ops = &fimc_is_subdev_internal_ops; + sd->entity.ops = &fimc_is_subdev_media_ops; +v4l2_set_subdevdata (sd, isp); + +return 0 ; +} + +void fimc_isp_subdev_destroy (struct fimc_isp *isp) +{ +struct v4l2_subdev *sd = &isp->subdev; + +v4l2_device_unregister_subdev (sd); +media_entity_cleanup (&sd->entity); +v4l2_ctrl_handler_free (&isp->ctrls.handler); +v4l2_set_subdevdata (sd,NULL ); +}drivers/media/platform/s5p-fimc/fimc-isp.h new file +80
-0@@ -0,0 +1,205 @@ +/* +* Samsung EXYNOS4x12 FIMC-IS (Imaging Subsystem) driver +* +* Copyright (C) 2013 Samsung Electronics Co., Ltd. +* +* Authors: Sylwester Nawrocki <[email protected]> +* Younghwan Joo <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ +#ifndef FIMC_ISP_H_ +#define FIMC_ISP_H_ + +#include <asm/sizes.h> +#include <linux/io.h> +#include <linux/irqreturn.h> +#include <linux/platform_device.h> +#include <linux/sched.h> +#include <linux/spinlock.h> +#include <linux/types.h> +#include <linux/videodev2.h> + +#include <media/media-entity.h> +#include <media/videobuf2-core.h> +#include <media/v4l2-device.h> +#include <media/v4l2-mediabus.h> +#include <media/s5p_fimc.h> + +#include "fimc-core.h" + +/* TODO: revisit these constraints */ +#define FIMC_ISP_SINK_WIDTH_MIN (16 + 8) +#define FIMC_ISP_SINK_HEIGHT_MIN (12 + 8) +#define FIMC_ISP_SOURCE_WIDTH_MIN 8 +#define FIMC_ISP_SOURC_HEIGHT_MIN 8 +/* FIXME: below are random numbers... */ +#define FIMC_ISP_SINK_WIDTH_MAX (4000 - 16) +#define FIMC_ISP_SINK_HEIGHT_MAX (4000 + 12) +#define FIMC_ISP_SOURCE_WIDTH_MAX 4000 +#define FIMC_ISP_SOURC_HEIGHT_MAX 4000 + +#define FIMC_ISP_NUM_FORMATS 3 +#define FIMC_IS_REQ_BUFS_MIN 2 + +#define FIMC_IS_SD_PAD_SINK 0 +#define FIMC_IS_SD_PAD_SRC_FIFO 1 +#define FIMC_IS_SD_PAD_SRC_DMA 2 +#define FIMC_IS_SD_PADS_NUM 3 +#define FIMC_IS_MAX_PLANES 1 + +/** + * struct fimc_isp_frame - source/target frame properties + * @f_width: full pixel width + * @f_height: full pixel height + * @rect: crop/composition rectangle + */ +struct fimc_isp_frame { + u16 f_width; + u16 f_height; + struct v4l2_rect rect; +}; + +/** + * struct fimc_isp_buffer - video buffer structure + * @vb: vb2 buffer + * @list: list head for the buffers queue + * @paddr: precalculated physical address + */ +struct fimc_isp_buffer { + struct vb2_buffer vb; + struct list_head list; + dma_addr_t paddr; +}; + +struct fimc_isp_ctrls { + struct v4l2_ctrl_handler handler; + /* Internal mode selection */ + struct v4l2_ctrl *scenario;
drivers/media/platform/s5p-fimc/fimc-isp.h line 90
Quoted 10 lines
drivers/media/platform/s5p-fimc/fimc-isp.h new file +10
-0+/* Frame rate */ +struct v4l2_ctrl *fps; +/* Touch AF position */ +struct v4l2_ctrl *af_position_x; +struct v4l2_ctrl *af_position_y; +/* Auto white balance */ +struct v4l2_ctrl *auto_wb; +/* ISO sensitivity */ +struct v4l2_ctrl *auto_iso; +struct v4l2_ctrl *iso;
I suggest putting this in an anonymous struct:
struct { /* Auto ISO control cluster */
struct v4l2_ctrl *auto_iso;
struct v4l2_ctrl *iso;
};That way you visually emphasize that these belong together and that you shouldn't move them around.
Quoted 106 lines
drivers/media/platform/s5p-fimc/fimc-isp.h new file +105
-0+ +struct v4l2_ctrl *contrast; +struct v4l2_ctrl *saturation; +struct v4l2_ctrl *sharpness; +/* Auto/manual exposure */ +struct v4l2_ctrl *auto_exp; +/* Manual exposure value */ +struct v4l2_ctrl *exposure; +/* Adjust - brightness */ +struct v4l2_ctrl *brightness; +/* Adjust - hue */ +struct v4l2_ctrl *hue; +/* Exposure metering mode */ +struct v4l2_ctrl *exp_metering; +/* AFC */ +struct v4l2_ctrl *afc; +/* AE/AWB lock/unlock */ +struct v4l2_ctrl *aewb_lock; +/* AF */ +struct v4l2_ctrl *focus_mode; +/* AF status */ +struct v4l2_ctrl *af_status; +}; + +/** +* struct fimc_isp - fimc isp structure +* @pdev: pointer to FIMC-LITE platform device +* @variant: variant information for this IP +* @v4l2_dev: pointer to top the level v4l2_device +* @vfd: video device node +* @fh: v4l2 file handle +* @alloc_ctx: videobuf2 memory allocator context +* @subdev: FIMC-LITE subdev +* @vd_pad: media (sink) pad for the capture video node +* @subdev_pads: the subdev media pads +* @ctrl_handler: v4l2 control handler +* @test_pattern: test pattern controls +* @index: FIMC-LITE platform device index +* @pipeline: video capture pipeline data structure +* @slock: spinlock protecting this data structure and the hw registers +* @video_lock: mutex serializing video device and the subdev operations +* @clock: FIMC-LITE gate clock +* @regs: memory mapped io registers +* @irq_queue: interrupt handler waitqueue +* @fmt: pointer to color format description structure +* @payload: image size in bytes (w x h x bpp) +* @inp_frame: camera input frame structure +* @out_frame: DMA output frame structure +* @out_path: output data path (DMA or FIFO) +* @source_subdev_grp_id: source subdev group id +* @cac_margin_x: horizontal CAC margin in pixels +* @cac_margin_y: vertical CAC margin in pixels +* @state: driver state flags +* @pending_buf_q: pending buffers queue head +* @active_buf_q: the queue head of buffers scheduled in hardware +* @capture_vb_queue: vb2 buffers queue for ISP capture video node +* @active_buf_count: number of video buffers scheduled in hardware +* @frame_count: the captured frames counter +* @reqbufs_count: the number of buffers requested with REQBUFS ioctl +* @ref_count: driver's private reference counter +*/ +struct fimc_isp { +struct platform_device *pdev; +struct fimc_is_variant *variant; +struct v4l2_device *v4l2_dev; +struct video_device vfd; +struct v4l2_fh fh; +struct vb2_alloc_ctx *alloc_ctx; +struct v4l2_subdev subdev; +struct media_pad vd_pad; +struct media_pad subdev_pads[FIMC_IS_SD_PADS_NUM ]; +struct v4l2_mbus_framefmt subdev_fmt; +struct v4l2_ctrl *test_pattern; +struct fimc_pipeline pipeline; +struct fimc_isp_ctrls ctrls; + +u32 index; +struct mutex video_lock; +struct mutex subdev_lock; +spinlock_t slock; + +wait_queue_head_t irq_queue; + +const struct fimc_fmt *video_capture_format; +unsigned long payload[FIMC_IS_MAX_PLANES ]; +struct fimc_isp_frame inp_frame; +struct fimc_isp_frame out_frame; +enum fimc_datapath out_path; +unsigned int source_subdev_grp_id; + +unsigned int cac_margin_x; +unsigned int cac_margin_y; + +unsigned long state; +struct list_head pending_buf_q; +struct list_head active_buf_q; +struct vb2_queue capture_vb_queue; +unsigned int frame_count; +unsigned int reqbufs_count; +int ref_count; +}; + +#define ctrl_to_fimc_isp (_ctrl) \ + container_of(ctrl->handler, struct fimc_isp, ctrls.handler) +
drivers/media/platform/s5p-fimc/fimc-isp.h line 205
Quoted 10 lines
drivers/media/platform/s5p-fimc/fimc-isp.h new file +10
-0+struct fimc_is ; + +int fimc_isp_subdev_create (struct fimc_isp *isp); +void fimc_isp_subdev_destroy (struct fimc_isp *isp); +void fimc_isp_irq_handler (struct fimc_is *is); +int fimc_is_create_controls (struct fimc_isp *isp); +int fimc_is_delete_controls (struct fimc_isp *isp); +const struct fimc_fmt *fimc_isp_find_format (const u32 *pixelformat, +const u32 *mbus_code,int index); +#endif /* FIMC_ISP_H_ */
Otherwise this patch looks very clean and I really have no other comments.
Regards,
Hans
RFC PATCH 1/8 s5p-fimc: Add Exynos4x12 FIMC-IS driver
Hi Hans,
Quoted 1 line · Hans Verkuil
On Mon 11 March 2013 20:44:45 Sylwester Nawrocki wrote:
[...]
Quoted 22 lines
Quoted 22 lines
drivers/media/platform/s5p-fimc/fimc-isp.c new file +22
-0+ +/* Supported manual ISO values */ +static const s64 iso_qmenu[] = { +50 ,100 ,200 ,400 ,800 , +}; + +static int __ctrl_set_iso (struct fimc_is *is,int value) +{ +unsigned int idx, iso; + +if (value ==V4L2_ISO_SENSITIVITY_AUTO ) { +__is_set_isp_iso (is,ISP_ISO_COMMAND_AUTO ,0 ); +return 0 ; + } + idx = is->isp.ctrls.iso->val; +if (idx>=ARRAY_SIZE (iso_qmenu)) +return -EINVAL ; + + iso = iso_qmenu[idx]; +__is_set_isp_iso (is,ISP_ISO_COMMAND_MANUAL , iso); +return 0 ; +}
[...]
Quoted 71 lines
Quoted 71 lines
drivers/media/platform/s5p-fimc/fimc-isp.c new file +71
-0+int fimc_isp_subdev_create (struct fimc_isp *isp) +{ +const struct v4l2_ctrl_ops *ops =&fimc_isp_ctrl_ops; +struct v4l2_ctrl_handler *handler =&isp->ctrls.handler; +struct v4l2_subdev *sd =&isp->subdev; +struct fimc_isp_ctrls *ctrls =&isp->ctrls; +int ret; + +mutex_init (&isp->subdev_lock); + +v4l2_subdev_init (sd,&fimc_is_subdev_ops); + sd->grp_id =GRP_ID_FIMC_IS ; + sd->flags =V4L2_SUBDEV_FL_HAS_DEVNODE ; +snprintf (sd->name,sizeof (sd->name),"FIMC-IS-ISP" ); + + isp->subdev_pads[FIMC_IS_SD_PAD_SINK ].flags =MEDIA_PAD_FL_SINK ; + isp->subdev_pads[FIMC_IS_SD_PAD_SRC_FIFO ].flags =MEDIA_PAD_FL_SOURCE ; + isp->subdev_pads[FIMC_IS_SD_PAD_SRC_DMA ].flags =MEDIA_PAD_FL_SOURCE ; + ret =media_entity_init (&sd->entity,FIMC_IS_SD_PADS_NUM , + isp->subdev_pads,0 ); +if (ret) +return ret; + +v4l2_ctrl_handler_init (handler,20 ); + + ctrls->saturation =v4l2_ctrl_new_std (handler, ops,V4L2_CID_SATURATION , +-2 ,2 ,1 ,0 ); + ctrls->brightness =v4l2_ctrl_new_std (handler, ops,V4L2_CID_BRIGHTNESS , +-4 ,4 ,1 ,0 ); + ctrls->contrast =v4l2_ctrl_new_std (handler, ops,V4L2_CID_CONTRAST , +-2 ,2 ,1 ,0 ); + ctrls->sharpness =v4l2_ctrl_new_std (handler, ops,V4L2_CID_SHARPNESS , +-2 ,2 ,1 ,0 ); + ctrls->hue =v4l2_ctrl_new_std (handler, ops,V4L2_CID_HUE , +-2 ,2 ,1 ,0 ); + + ctrls->auto_wb =v4l2_ctrl_new_std_menu (handler, ops, +V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE , +8 , ~0x14e ,V4L2_WHITE_BALANCE_AUTO ); + + ctrls->exposure =v4l2_ctrl_new_std (handler, ops, +V4L2_CID_EXPOSURE_ABSOLUTE , +-4 ,4 ,1 ,0 ); + + ctrls->exp_metering =v4l2_ctrl_new_std_menu (handler, ops, +V4L2_CID_EXPOSURE_METERING ,3 , + ~0xf ,V4L2_EXPOSURE_METERING_AVERAGE ); + +v4l2_ctrl_new_std_menu (handler, ops,V4L2_CID_POWER_LINE_FREQUENCY , +V4L2_CID_POWER_LINE_FREQUENCY_AUTO ,0 , +V4L2_CID_POWER_LINE_FREQUENCY_AUTO ); +/* ISO sensitivity */ + ctrls->auto_iso =v4l2_ctrl_new_std_menu (handler, ops, +V4L2_CID_ISO_SENSITIVITY_AUTO ,1 ,0 , +V4L2_ISO_SENSITIVITY_AUTO ); + + ctrls->iso =v4l2_ctrl_new_int_menu (handler, ops, +V4L2_CID_ISO_SENSITIVITY ,ARRAY_SIZE (iso_qmenu) -1 , +ARRAY_SIZE (iso_qmenu)/2 -1 , iso_qmenu); + + ctrls->aewb_lock =v4l2_ctrl_new_std (handler, ops, +V4L2_CID_3A_LOCK ,0 ,0x3 ,0 ,0 ); + +/* FIXME: Adjust the enabled controls mask according +to the ISP capabilities */ +v4l2_ctrl_new_std_menu (handler, ops,V4L2_CID_COLORFX , +V4L2_COLORFX_ANTIQUE , +0 ,V4L2_COLORFX_NONE ); +if (handler->error) { +media_entity_cleanup (&sd->entity); +return handler->error;
Quoted 8 lines
drivers/media/platform/s5p-fimc/fimc-isp.c line 772
Quoted 4 lines
drivers/media/platform/s5p-fimc/fimc-isp.c new file +4
-0+ } + + ctrls->auto_iso->flags |=V4L2_CTRL_FLAG_VOLATILE | +V4L2_CTRL_FLAG_UPDATE ;Why would
auto_isobe volatile? I would expect the iso to be volatile (in which case the 'false' argument below would be 'true'). Also,v4l2_ctrl_auto_clusteralready sets the UPDATE flag.
Thanks for spotting this. I should have removed this flags set up since the g_volatile_ctrl op is not currently supported and as far as I know the firmware doesn't support reading actual ISO value in auto mode. I'll need to check if there are any commands available for that.
Anyway auto_iso is not supposed to have the flags set up like this and that also tells me that I need to inspect my other driver where this code originally came from. :)
Quoted 16 lines
Quoted 16 lines
drivers/media/platform/s5p-fimc/fimc-isp.c new file +9
-0+v4l2_ctrl_auto_cluster (2 ,&ctrls->auto_iso,0 , false); + + sd->ctrl_handler = handler; + sd->internal_ops =&fimc_is_subdev_internal_ops; + sd->entity.ops =&fimc_is_subdev_media_ops; +v4l2_set_subdevdata (sd, isp); + +return 0 ; +}drivers/media/platform/s5p-fimc/fimc-isp.h new file +0
-0@@ -0,0 +1,205 @@
[...]
Quoted 17 lines
Quoted 4 lines
drivers/media/platform/s5p-fimc/fimc-isp.h new file +4
-0+struct fimc_isp_ctrls { +struct v4l2_ctrl_handler handler; +/* Internal mode selection */ +struct v4l2_ctrl *scenario;drivers/media/platform/s5p-fimc/fimc-isp.h line 90
Quoted 10 lines
drivers/media/platform/s5p-fimc/fimc-isp.h new file +10
-0+/* Frame rate */ +struct v4l2_ctrl *fps; +/* Touch AF position */ +struct v4l2_ctrl *af_position_x; +struct v4l2_ctrl *af_position_y; +/* Auto white balance */ +struct v4l2_ctrl *auto_wb; +/* ISO sensitivity */ +struct v4l2_ctrl *auto_iso; +struct v4l2_ctrl *iso;I suggest putting this in an anonymous struct:
Quoted 7 lines
struct { /* Auto ISO control cluster */ struct v4l2_ctrl *auto_iso; struct v4l2_ctrl *iso; };That way you visually emphasize that these belong together and that you shouldn't move them around.
Agreed. I'll make them grouped in separate structs wherever a cluster is used.
Quoted 22 lines
Quoted 22 lines
drivers/media/platform/s5p-fimc/fimc-isp.h new file +22
-0+struct v4l2_ctrl *contrast; +struct v4l2_ctrl *saturation; +struct v4l2_ctrl *sharpness; +/* Auto/manual exposure */ +struct v4l2_ctrl *auto_exp; +/* Manual exposure value */ +struct v4l2_ctrl *exposure; +/* Adjust - brightness */ +struct v4l2_ctrl *brightness; +/* Adjust - hue */ +struct v4l2_ctrl *hue; +/* Exposure metering mode */ +struct v4l2_ctrl *exp_metering; +/* AFC */ +struct v4l2_ctrl *afc; +/* AE/AWB lock/unlock */ +struct v4l2_ctrl *aewb_lock; +/* AF */ +struct v4l2_ctrl *focus_mode; +/* AF status */ +struct v4l2_ctrl *af_status; +};
[...]
Quoted 2 lines
Otherwise this patch looks very clean and I really have no other comments.
Thanks a lot for a prompt review!
--
Regards,
Sylwester
RFC PATCH 2/8 s5p-fimc: Add FIMC-IS ISP I2C bus driver
In reply to Sylwester NawrockiThis patch adds the ISP I2C bus controller driver files.
Creating a standard I2C bus adapter, even if the driver doesn't actually communicates with the hardware and it is instead used by the ISP firmware running on the Cortex-A5, allows to use standard hardware description in the device tree. As the sensor would have actually had a standard V4L2 sub-device driver run on the host CPU.
This approach allows to adapt the driver with a relatively small effort should the Imaging Subsystem architecture change so that the I2C bus is controlled by the host CPU, rather than the internal FIMC-IS ARM CPU. The image sensor drivers can be standard I2C client driver, as in case of most existing image sensor driver.
--- drivers/media/platform/s5p-fimc/fimc-is-i2c.c | 81 +++++++++++++++++++++++++ drivers/media/platform/s5p-fimc/fimc-is-i2c.h | 15 +++++ 2 files changed, 96 insertions(+) create mode 100644 drivers/media/platform/s5p-fimc/fimc-is-i2c.c create mode 100644 drivers/media/platform/s5p-fimc/fimc-is-i2c.h
drivers/media/platform/s5p-fimc/fimc-is-i2c.c new file +81 -0
@@ -0,0 +1,81 @@ +/* +* Samsung EXYNOS4x12 FIMC-IS (Imaging Subsystem) driver +* +* Copyright (C) 2013 Samsung Electronics Co., Ltd. +* Sylwester Nawrocki <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ +#define pr_fmt (fmt) "%s:%d " fmt, __func__, __LINE__ + +#include <linux/module.h> +#include <linux/of_i2c.h> +#include <linux/platform_device.h> +#include "fimc-is-i2c.h" + +/* +* An empty algorithm is used as the actual I2C bus controller driver +* is implemented in the FIMC-IS subsystem firmware and the host CPU +* doesn't touch the hardware. +*/ +static const struct i2c_algorithm fimc_is_i2c_algorithm; + +static int fimc_is_i2c_probe (struct platform_device *pdev) +{ +struct device_node *node = pdev->dev.of_node; +struct i2c_adapter *i2c_adap; +int ret; + + i2c_adap =devm_kzalloc (&pdev->dev,sizeof (*i2c_adap),GFP_KERNEL ); + + i2c_adap->dev.of_node = node; + i2c_adap->dev.parent = &pdev->dev; +strlcpy (i2c_adap->name,"exynos4x12-is-i2c" ,sizeof (i2c_adap->name)); + i2c_adap->owner =THIS_MODULE ; + i2c_adap->algo = &fimc_is_i2c_algorithm; + i2c_adap->class =I2C_CLASS_SPD ; + + ret =i2c_add_adapter (i2c_adap); +if (ret <0 ) { +dev_err (&pdev->dev,"failed to add I2C bus %s\n" , + node->full_name); +return ret; + } +of_i2c_register_devices (i2c_adap); + +return 0 ; +} + +static int fimc_is_i2c_remove (struct platform_device *pdev) +{ +return 0 ; +} + +static const struct of_device_id fimc_is_i2c_of_match[] = { + { .compatible =FIMC_IS_I2C_COMPATIBLE }, + { }, +}; +MODULE_DEVICE_TABLE (of, fimc_is_i2c_of_match); + +static struct platform_driver fimc_is_i2c_driver = { + .probe = fimc_is_i2c_probe, + .remove = fimc_is_i2c_remove, + .driver = { + .of_match_table = fimc_is_i2c_of_match, + .name ="fimc-is-i2c" , + .owner =THIS_MODULE , + } +}; + +int fimc_is_register_i2c_driver (void ) +{ +return platform_driver_register (&fimc_is_i2c_driver); +} + +void fimc_is_unregister_i2c_driver (void ) +{ +platform_driver_unregister (&fimc_is_i2c_driver); +} +
drivers/media/platform/s5p-fimc/fimc-is-i2c.h new file +15 -0
@@ -0,0 +1,15 @@ +/* +* Samsung EXYNOS4x12 FIMC-IS (Imaging Subsystem) driver +* +* Copyright (C) 2013 Samsung Electronics Co., Ltd. +* Sylwester Nawrocki <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#define FIMC_IS_I2C_COMPATIBLE "samsung,exynos4212-i2c-isp" + +int fimc_is_register_i2c_driver (void ); +void fimc_is_unregister_i2c_driver (void );
Signature · 1 line
1.7.9.5
RFC PATCH 3/8 s5p-fimc: Add FIMC-IS parameter region definitions
In reply to Sylwester NawrockiThis patch adds ISP processing parameters interface files.
--- drivers/media/platform/s5p-fimc/fimc-is-param.c | 971 +++++++++++++++++++++ drivers/media/platform/s5p-fimc/fimc-is-param.h | 1018 +++++++++++++++++++++++ 2 files changed, 1989 insertions(+) create mode 100644 drivers/media/platform/s5p-fimc/fimc-is-param.c create mode 100644 drivers/media/platform/s5p-fimc/fimc-is-param.h
drivers/media/platform/s5p-fimc/fimc-is-param.c new file +971 -0
@@ -0,0 +1,971 @@ +/* +* Samsung EXYNOS4x12 FIMC-IS (Imaging Subsystem) driver +* +* Copyright (C) 2013 Samsung Electronics Co., Ltd. +* +* Authors: Younghwan Joo <[email protected]> +* Sylwester Nawrocki <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ +#define pr_fmt (fmt) "%s:%d " fmt, __func__, __LINE__ + +#include <linux/bug.h> +#include <linux/device.h> +#include <linux/delay.h> +#include <linux/errno.h> +#include <linux/firmware.h> +#include <linux/gpio.h> +#include <plat/gpio-cfg.h> +#include <linux/interrupt.h> +#include <linux/kernel.h> +#include <linux/list.h> +#include <linux/module.h> +#include <linux/types.h> +#include <linux/platform_device.h> +#include <linux/pm_runtime.h> +#include <linux/slab.h> +#include <linux/videodev2.h> + +#include <media/v4l2-device.h> +#include <media/v4l2-ioctl.h> +#include <media/v4l2-mem2mem.h> +#include <media/videobuf2-core.h> +#include <media/videobuf2-dma-contig.h> + +#include "fimc-is.h" +#include "fimc-is-command.h" +#include "fimc-is-errno.h" +#include "fimc-is-param.h" +#include "fimc-is-regs.h" +#include "fimc-is-sensor.h" + +static void __hw_param_copy (void *dst,void *src) +{ +memcpy (dst, src,FIMC_IS_PARAM_MAX_SIZE ); +} + +void __fimc_is_hw_update_param_global_shotmode (struct fimc_is *is) +{ +struct param_global_shotmode *dst, *src; + + dst = &is->is_p_region->parameter.global.shotmode; + src = &is->cfg_param[is->scenario_id].global.shotmode; +__hw_param_copy (dst, src); +} + +void __fimc_is_hw_update_param_sensor_framerate (struct fimc_is *is) +{ +struct param_sensor_framerate *dst, *src; + + dst = &is->is_p_region->parameter.sensor.frame_rate; + src = &is->cfg_param[is->scenario_id].sensor.frame_rate; +__hw_param_copy (dst, src); +} + +int __fimc_is_hw_update_param (struct fimc_is *is,u32 offset) +{ +struct is_param_region *par = &is->is_p_region->parameter; +struct is_config_param *cfg = &is->cfg_param[is->scenario_id]; + +switch (offset) { +case PARAM_ISP_CONTROL : +__hw_param_copy (&par->isp.control, &cfg->isp.control); +break ; + +case PARAM_ISP_OTF_INPUT : +__hw_param_copy (&par->isp.otf_input, &cfg->isp.otf_input); +break ; + +case PARAM_ISP_DMA1_INPUT : +__hw_param_copy (&par->isp.dma1_input, &cfg->isp.dma1_input); +break ; + +case PARAM_ISP_DMA2_INPUT : +__hw_param_copy (&par->isp.dma2_input, &cfg->isp.dma2_input); +break ; + +case PARAM_ISP_AA : +__hw_param_copy (&par->isp.aa, &cfg->isp.aa); +break ; + +case PARAM_ISP_FLASH : +__hw_param_copy (&par->isp.flash, &cfg->isp.flash); +break ; + +case PARAM_ISP_AWB : +__hw_param_copy (&par->isp.awb, &cfg->isp.awb); +break ; + +case PARAM_ISP_IMAGE_EFFECT : +__hw_param_copy (&par->isp.effect, &cfg->isp.effect); +break ; + +case PARAM_ISP_ISO : +__hw_param_copy (&par->isp.iso, &cfg->isp.iso); +break ; + +case PARAM_ISP_ADJUST : +__hw_param_copy (&par->isp.adjust, &cfg->isp.adjust); +break ; + +case PARAM_ISP_METERING : +__hw_param_copy (&par->isp.metering, &cfg->isp.metering); +break ; + +case PARAM_ISP_AFC : +__hw_param_copy (&par->isp.afc, &cfg->isp.afc); +break ; + +case PARAM_ISP_OTF_OUTPUT : +__hw_param_copy (&par->isp.otf_output, &cfg->isp.otf_output); +break ; + +case PARAM_ISP_DMA1_OUTPUT : +__hw_param_copy (&par->isp.dma1_output, &cfg->isp.dma1_output); +break ; + +case PARAM_ISP_DMA2_OUTPUT : +__hw_param_copy (&par->isp.dma2_output, &cfg->isp.dma2_output); +break ; + +case PARAM_DRC_CONTROL : +__hw_param_copy (&par->drc.control, &cfg->drc.control); +break ; + +case PARAM_DRC_OTF_INPUT : +__hw_param_copy (&par->drc.otf_input, &cfg->drc.otf_input); +break ; + +case PARAM_DRC_DMA_INPUT : +__hw_param_copy (&par->drc.dma_input, &cfg->drc.dma_input); +break ; + +case PARAM_DRC_OTF_OUTPUT : +__hw_param_copy (&par->drc.otf_output, &cfg->drc.otf_output); +break ; + +case PARAM_FD_CONTROL : +__hw_param_copy (&par->fd.control, &cfg->fd.control); +break ; + +case PARAM_FD_OTF_INPUT : +__hw_param_copy (&par->fd.otf_input, &cfg->fd.otf_input); +break ; + +case PARAM_FD_DMA_INPUT : +__hw_param_copy (&par->fd.dma_input, &cfg->fd.dma_input); +break ; + +case PARAM_FD_CONFIG : +__hw_param_copy (&par->fd.config, &cfg->fd.config); +break ; + +default : +return -EINVAL ; + } + +return 0 ; +} + +int __is_hw_update_params (struct fimc_is *is) +{ +unsigned long *p_index1, *p_index2; +int i, id, ret =0 ; + + id = is->scenario_id; + p_index1 = &is->cfg_param[id].p_region_index1; + p_index2 = &is->cfg_param[id].p_region_index2; + +if (test_bit (PARAM_GLOBAL_SHOTMODE , p_index1)) +__fimc_is_hw_update_param_global_shotmode (is); + +if (test_bit (PARAM_SENSOR_FRAME_RATE , p_index1)) +__fimc_is_hw_update_param_sensor_framerate (is); + +for (i =PARAM_ISP_CONTROL ; i <PARAM_DRC_CONTROL ; i++) { +if (test_bit (i, p_index1)) + ret =__fimc_is_hw_update_param (is, i); + } + +for (i =PARAM_DRC_CONTROL ; i <PARAM_SCALERC_CONTROL ; i++) { +if (test_bit (i, p_index1)) + ret =__fimc_is_hw_update_param (is, i); + } + +for (i =PARAM_FD_CONTROL ; i <=PARAM_FD_CONFIG ; i++) { +if (test_bit ((i -32 ), p_index2)) + ret =__fimc_is_hw_update_param (is, i); + } + +return ret; +} + +void __is_get_frame_size (struct fimc_is *is,struct v4l2_mbus_framefmt *mf) +{ +struct isp_param *isp; + + isp = &is->cfg_param[is->scenario_id].isp; + mf->width = isp->otf_input.width; + mf->height = isp->otf_input.height; +} + +void __is_set_frame_size (struct fimc_is *is,struct v4l2_mbus_framefmt *mf) +{ +struct isp_param *isp; +struct drc_param *drc; +struct fd_param *fd; +unsigned int mode; + + mode = is->scenario_id; + isp = &is->cfg_param[mode].isp; + drc = &is->cfg_param[mode].drc; + fd = &is->cfg_param[mode].fd; + +/* Update isp size info (OTF only) */ + isp->otf_input.width = mf->width; + isp->otf_input.height = mf->height; + isp->otf_output.width = mf->width; + isp->otf_output.height = mf->height; +/* Update drc size info (OTF only) */ + drc->otf_input.width = mf->width; + drc->otf_input.height = mf->height; + drc->otf_output.width = mf->width; + drc->otf_output.height = mf->height; +/* Update fd size info (OTF only) */ + fd->otf_input.width = mf->width; + fd->otf_input.height = mf->height; + +if (test_bit (PARAM_ISP_OTF_INPUT , + &is->cfg_param[mode].p_region_index1)) +return ; + +/* Update field */ +fimc_is_set_param_bit (is,PARAM_ISP_OTF_INPUT ); +fimc_is_inc_param_num (is); +fimc_is_set_param_bit (is,PARAM_ISP_OTF_OUTPUT ); +fimc_is_inc_param_num (is); +fimc_is_set_param_bit (is,PARAM_DRC_OTF_INPUT ); +fimc_is_inc_param_num (is); +fimc_is_set_param_bit (is,PARAM_DRC_OTF_OUTPUT ); +fimc_is_inc_param_num (is); +fimc_is_set_param_bit (is,PARAM_FD_OTF_INPUT ); +fimc_is_inc_param_num (is); +} + +int fimc_is_hw_get_sensor_max_framerate (struct fimc_is *is) +{ +switch (is->sensor->drvdata->id) { +case FIMC_IS_SENSOR_ID_S5K6A3 : +return 30 ; +default : +return 15 ; + } +} + +void __is_set_sensor (struct fimc_is *is,int fps) +{ +struct sensor_param *sensor; +struct isp_param *isp; +unsigned long *p_index, mode; + + mode = is->scenario_id; + p_index = &is->cfg_param[mode].p_region_index1; + sensor = &is->cfg_param[mode].sensor; + isp = &is->cfg_param[mode].isp; + +if (fps ==0 ) { + sensor->frame_rate.frame_rate = +fimc_is_hw_get_sensor_max_framerate (is); + isp->otf_input.frametime_min =0 ; + isp->otf_input.frametime_max =66666 ; + }else { + sensor->frame_rate.frame_rate = fps; + isp->otf_input.frametime_min =0 ; + isp->otf_input.frametime_max = (u32 )1000000 / fps; + } + +if (!test_bit (PARAM_SENSOR_FRAME_RATE , p_index)) { +fimc_is_set_param_bit (is,PARAM_SENSOR_FRAME_RATE ); +fimc_is_inc_param_num (is); + } +if (!test_bit (PARAM_ISP_OTF_INPUT , p_index)) { +fimc_is_set_param_bit (is,PARAM_ISP_OTF_INPUT ); +fimc_is_inc_param_num (is); + } +} + +void __is_set_init_isp_aa (struct fimc_is *is) +{ +struct isp_param *isp; + + isp = &is->cfg_param[is->scenario_id].isp; + + isp->aa.cmd =ISP_AA_COMMAND_START ; + isp->aa.target =ISP_AA_TARGET_AF |ISP_AA_TARGET_AE | +ISP_AA_TARGET_AWB ; + isp->aa.mode =0 ; + isp->aa.scene =0 ; + isp->aa.sleep =0 ; + isp->aa.face =0 ; + isp->aa.touch_x =0 ; + isp->aa.touch_y =0 ; + isp->aa.manual_af_setting =0 ; + isp->aa.err =ISP_AF_ERROR_NONE ; + +fimc_is_set_param_bit (is,PARAM_ISP_AA ); +fimc_is_inc_param_num (is); +} + +#define get_is_cfg (is, mode) (&(is)->cfg_param[mode]) + +void __is_set_isp_flash (struct fimc_is *is,u32 cmd,u32 redeye) +{ +struct is_config_param *cfg; +struct isp_param *isp; +unsigned int mode; + + mode = is->scenario_id; + cfg =get_is_cfg (is, mode); + + isp = &is->cfg_param[mode].isp; + isp->flash.cmd = cmd; + isp->flash.redeye = redeye; + isp->flash.err =ISP_FLASH_ERROR_NONE ; + +if (!test_bit (PARAM_ISP_FLASH , &cfg->p_region_index1)) { +fimc_is_set_param_bit (is,PARAM_ISP_FLASH ); +fimc_is_inc_param_num (is); + } +} + +void __is_set_isp_awb (struct fimc_is *is,u32 cmd,u32 val) +{ +struct isp_param *isp; +unsigned long *p_index, mode; + + mode = is->scenario_id; + p_index = &is->cfg_param[mode].p_region_index1; + isp = &is->cfg_param[mode].isp; + + isp->awb.cmd = cmd; + isp->awb.illumination = val; + isp->awb.err =ISP_AWB_ERROR_NONE ; + +if (!test_bit (PARAM_ISP_AWB , p_index)) { +fimc_is_set_param_bit (is,PARAM_ISP_AWB ); +fimc_is_inc_param_num (is); + } +} + +void __is_set_isp_effect (struct fimc_is *is,u32 cmd) +{ +struct isp_param *isp; +unsigned long *p_index, mode; + + mode = is->scenario_id; + p_index = &is->cfg_param[mode].p_region_index1; + isp = &is->cfg_param[mode].isp; + + isp->effect.cmd = cmd; + isp->effect.err =ISP_IMAGE_EFFECT_ERROR_NONE ; + +if (!test_bit (PARAM_ISP_IMAGE_EFFECT , p_index)) { +fimc_is_set_param_bit (is,PARAM_ISP_IMAGE_EFFECT ); +fimc_is_inc_param_num (is); + } +} + +void __is_set_isp_iso (struct fimc_is *is,u32 cmd,u32 val) +{ +struct isp_param *isp; +unsigned long *p_index, mode; + + mode = is->scenario_id; + p_index = &is->cfg_param[mode].p_region_index1; + isp = &is->cfg_param[mode].isp; + + isp->iso.cmd = cmd; + isp->iso.value = val; + isp->iso.err =ISP_ISO_ERROR_NONE ; + +if (!test_bit (PARAM_ISP_ISO , p_index)) { +fimc_is_set_param_bit (is,PARAM_ISP_ISO ); +fimc_is_inc_param_num (is); + } +} + +void __is_set_isp_adjust (struct fimc_is *is,u32 cmd,u32 val) +{ +unsigned int mode = is->scenario_id; +unsigned long *p_index; +struct isp_param *isp; + + p_index = &is->cfg_param[mode].p_region_index1; + isp = &is->cfg_param[mode].isp; + +switch (cmd) { +case ISP_ADJUST_COMMAND_MANUAL_CONTRAST : + isp->adjust.contrast = val; +break ; +case ISP_ADJUST_COMMAND_MANUAL_SATURATION : + isp->adjust.saturation = val; +break ; +case ISP_ADJUST_COMMAND_MANUAL_SHARPNESS : + isp->adjust.sharpness = val; +break ; +case ISP_ADJUST_COMMAND_MANUAL_EXPOSURE : + isp->adjust.exposure = val; +break ; +case ISP_ADJUST_COMMAND_MANUAL_BRIGHTNESS : + isp->adjust.brightness = val; +break ; +case ISP_ADJUST_COMMAND_MANUAL_HUE : + isp->adjust.hue = val; +break ; +case ISP_ADJUST_COMMAND_AUTO : + isp->adjust.contrast =0 ; + isp->adjust.saturation =0 ; + isp->adjust.sharpness =0 ; + isp->adjust.exposure =0 ; + isp->adjust.brightness =0 ; + isp->adjust.hue =0 ; +break ; + } + +if (!test_bit (PARAM_ISP_ADJUST , p_index)) { + isp->adjust.cmd = cmd; + isp->adjust.err =ISP_ADJUST_ERROR_NONE ; +fimc_is_set_param_bit (is,PARAM_ISP_ADJUST ); +fimc_is_inc_param_num (is); + }else { + isp->adjust.cmd |= cmd; + } +} + +void __is_set_isp_metering (struct fimc_is *is,u32 id,u32 val) +{ +struct isp_param *isp; +unsigned long *p_index, mode; + + mode = is->scenario_id; + p_index = &is->cfg_param[mode].p_region_index1; + isp = &is->cfg_param[mode].isp; + +switch (id) { +case IS_METERING_CONFIG_CMD : + isp->metering.cmd = val; +break ; +case IS_METERING_CONFIG_WIN_POS_X : + isp->metering.win_pos_x = val; +break ; +case IS_METERING_CONFIG_WIN_POS_Y : + isp->metering.win_pos_y = val; +break ; +case IS_METERING_CONFIG_WIN_WIDTH : + isp->metering.win_width = val; +break ; +case IS_METERING_CONFIG_WIN_HEIGHT : + isp->metering.win_height = val; +break ; +default : +return ; + } + +if (!test_bit (PARAM_ISP_METERING , p_index)) { + isp->metering.err =ISP_METERING_ERROR_NONE ; +fimc_is_set_param_bit (is,PARAM_ISP_METERING ); +fimc_is_inc_param_num (is); + } +} + +void __is_set_isp_afc (struct fimc_is *is,u32 cmd,u32 val) +{ +struct isp_param *isp; +unsigned long *p_index, mode; + + mode = is->scenario_id; + p_index = &is->cfg_param[mode].p_region_index1; + isp = &is->cfg_param[mode].isp; + + isp->afc.cmd = cmd; + isp->afc.manual = val; + isp->afc.err =ISP_AFC_ERROR_NONE ; + +if (!test_bit (PARAM_ISP_AFC , p_index)) { +fimc_is_set_param_bit (is,PARAM_ISP_AFC ); +fimc_is_inc_param_num (is); + } +} + +void __is_set_drc_control (struct fimc_is *is,u32 val) +{ +struct drc_param *drc; +unsigned long *p_index, mode; + + mode = is->scenario_id; + p_index = &is->cfg_param[mode].p_region_index1; + drc = &is->cfg_param[mode].drc; + + drc->control.bypass = val; + +if (!test_bit (PARAM_DRC_CONTROL , p_index)) { +fimc_is_set_param_bit (is,PARAM_DRC_CONTROL ); +fimc_is_inc_param_num (is); + } +} + +void __is_set_fd_control (struct fimc_is *is,u32 val) +{ +struct fd_param *fd; +unsigned long *p_index, mode; + + mode = is->scenario_id; + p_index = &is->cfg_param[mode].p_region_index2; + fd = &is->cfg_param[mode].fd; + + fd->control.cmd = val; + +if (!test_bit ((PARAM_FD_CONFIG -32 ), p_index)) { +fimc_is_set_param_bit (is,PARAM_FD_CONTROL ); +fimc_is_inc_param_num (is); + } +} + +void __is_set_fd_config_maxface (struct fimc_is *is,u32 val) +{ +struct fd_param *fd; +unsigned long *p_index, mode; + + mode = is->scenario_id; + p_index = &is->cfg_param[mode].p_region_index2; + fd = &is->cfg_param[mode].fd; + + fd->config.max_number = val; + +if (!test_bit ((PARAM_FD_CONFIG -32 ), p_index)) { + fd->config.cmd =FD_CONFIG_COMMAND_MAXIMUM_NUMBER ; + fd->config.err =ERROR_FD_NONE ; +fimc_is_set_param_bit (is,PARAM_FD_CONFIG ); +fimc_is_inc_param_num (is); + }else { + fd->config.cmd |=FD_CONFIG_COMMAND_MAXIMUM_NUMBER ; + } +} + +void __is_set_fd_config_rollangle (struct fimc_is *is,u32 val) +{ +struct fd_param *fd; +unsigned long *p_index, mode; + + mode = is->scenario_id; + p_index = &is->cfg_param[mode].p_region_index2; + fd = &is->cfg_param[mode].fd; + + fd->config.roll_angle = val; + +if (!test_bit ((PARAM_FD_CONFIG -32 ), p_index)) { + fd->config.cmd =FD_CONFIG_COMMAND_ROLL_ANGLE ; + fd->config.err =ERROR_FD_NONE ; +fimc_is_set_param_bit (is,PARAM_FD_CONFIG ); +fimc_is_inc_param_num (is); + }else { + fd->config.cmd |=FD_CONFIG_COMMAND_ROLL_ANGLE ; + } +} + +void __is_set_fd_config_yawangle (struct fimc_is *is,u32 val) +{ +struct fd_param *fd; +unsigned long *p_index, mode; + + mode = is->scenario_id; + p_index = &is->cfg_param[mode].p_region_index2; + fd = &is->cfg_param[mode].fd; + + fd->config.yaw_angle = val; + +if (!test_bit ((PARAM_FD_CONFIG -32 ), p_index)) { + fd->config.cmd =FD_CONFIG_COMMAND_YAW_ANGLE ; + fd->config.err =ERROR_FD_NONE ; +fimc_is_set_param_bit (is,PARAM_FD_CONFIG ); +fimc_is_inc_param_num (is); + }else { + fd->config.cmd |=FD_CONFIG_COMMAND_YAW_ANGLE ; + } +} + +void __is_set_fd_config_smilemode (struct fimc_is *is,u32 val) +{ +struct fd_param *fd; +unsigned long *p_index, mode; + + mode = is->scenario_id; + p_index = &is->cfg_param[mode].p_region_index2; + fd = &is->cfg_param[mode].fd; + + fd->config.smile_mode = val; + +if (!test_bit ((PARAM_FD_CONFIG -32 ), p_index)) { + fd->config.cmd =FD_CONFIG_COMMAND_SMILE_MODE ; + fd->config.err =ERROR_FD_NONE ; +fimc_is_set_param_bit (is,PARAM_FD_CONFIG ); +fimc_is_inc_param_num (is); + }else { + fd->config.cmd |=FD_CONFIG_COMMAND_SMILE_MODE ; + } +} + +void __is_set_fd_config_blinkmode (struct fimc_is *is,u32 val) +{ +struct fd_param *fd; +unsigned long *p_index, mode; + + mode = is->scenario_id; + p_index = &is->cfg_param[mode].p_region_index2; + fd = &is->cfg_param[mode].fd; + + fd->config.blink_mode = val; + +if (!test_bit ((PARAM_FD_CONFIG -32 ), p_index)) { + fd->config.cmd =FD_CONFIG_COMMAND_BLINK_MODE ; + fd->config.err =ERROR_FD_NONE ; +fimc_is_set_param_bit (is,PARAM_FD_CONFIG ); +fimc_is_inc_param_num (is); + }else { + fd->config.cmd |=FD_CONFIG_COMMAND_BLINK_MODE ; + } +} + +void __is_set_fd_config_eyedetect (struct fimc_is *is,u32 val) +{ +struct fd_param *fd; +unsigned long *p_index, mode; + + mode = is->scenario_id; + p_index = &is->cfg_param[mode].p_region_index2; + fd = &is->cfg_param[mode].fd; + + fd->config.eye_detect = val; + +if (!test_bit ((PARAM_FD_CONFIG -32 ), p_index)) { + fd->config.cmd =FD_CONFIG_COMMAND_EYES_DETECT ; + fd->config.err =ERROR_FD_NONE ; +fimc_is_set_param_bit (is,PARAM_FD_CONFIG ); +fimc_is_inc_param_num (is); + }else { + fd->config.cmd |=FD_CONFIG_COMMAND_EYES_DETECT ; + } +} + +void __is_set_fd_config_mouthdetect (struct fimc_is *is,u32 val) +{ +struct fd_param *fd; +unsigned long *p_index, mode; + + mode = is->scenario_id; + p_index = &is->cfg_param[mode].p_region_index2; + fd = &is->cfg_param[mode].fd; + + fd->config.mouth_detect = val; + +if (!test_bit ((PARAM_FD_CONFIG -32 ), p_index)) { + fd->config.cmd =FD_CONFIG_COMMAND_MOUTH_DETECT ; + fd->config.err =ERROR_FD_NONE ; +fimc_is_set_param_bit (is,PARAM_FD_CONFIG ); +fimc_is_inc_param_num (is); + }else { + fd->config.cmd |=FD_CONFIG_COMMAND_MOUTH_DETECT ; + } +} + +void __is_set_fd_config_orientation (struct fimc_is *is,u32 val) +{ +struct fd_param *fd; +unsigned long *p_index, mode; + + mode = is->scenario_id; + p_index = &is->cfg_param[mode].p_region_index2; + fd = &is->cfg_param[mode].fd; + + fd->config.orientation = val; + +if (!test_bit ((PARAM_FD_CONFIG -32 ), p_index)) { + fd->config.cmd =FD_CONFIG_COMMAND_ORIENTATION ; + fd->config.err =ERROR_FD_NONE ; +fimc_is_set_param_bit (is,PARAM_FD_CONFIG ); +fimc_is_inc_param_num (is); + }else { + fd->config.cmd |=FD_CONFIG_COMMAND_ORIENTATION ; + } +} + +void __is_set_fd_config_orientation_val (struct fimc_is *is,u32 val) +{ +struct fd_param *fd; +unsigned long *p_index, mode; + + mode = is->scenario_id; + p_index = &is->cfg_param[mode].p_region_index2; + fd = &is->cfg_param[mode].fd; + + fd->config.orientation_value = val; + +if (!test_bit ((PARAM_FD_CONFIG -32 ), p_index)) { + fd->config.cmd =FD_CONFIG_COMMAND_ORIENTATION_VALUE ; + fd->config.err =ERROR_FD_NONE ; +fimc_is_set_param_bit (is,PARAM_FD_CONFIG ); +fimc_is_inc_param_num (is); + }else { + fd->config.cmd |=FD_CONFIG_COMMAND_ORIENTATION_VALUE ; + } +} + +void fimc_is_set_initial_params (struct fimc_is *is) +{ +struct global_param *global; +struct sensor_param *sensor; +struct isp_param *isp; +struct drc_param *drc; +struct fd_param *fd; +unsigned long *p_index1, *p_index2; +unsigned int mode; + + mode = is->scenario_id; + global = &is->cfg_param[mode].global; + sensor = &is->cfg_param[mode].sensor; + isp = &is->cfg_param[mode].isp; + drc = &is->cfg_param[mode].drc; + fd = &is->cfg_param[mode].fd; + p_index1 = &is->cfg_param[mode].p_region_index1; + p_index2 = &is->cfg_param[mode].p_region_index2; + +/* Global */ + global->shotmode.cmd =1 ; +fimc_is_set_param_bit (is,PARAM_GLOBAL_SHOTMODE ); +fimc_is_inc_param_num (is); + +/* ISP */ + isp->control.cmd =CONTROL_COMMAND_START ; + isp->control.bypass =CONTROL_BYPASS_DISABLE ; + isp->control.err =CONTROL_ERROR_NONE ; +fimc_is_set_param_bit (is,PARAM_ISP_CONTROL ); +fimc_is_inc_param_num (is); + + isp->otf_input.cmd =OTF_INPUT_COMMAND_ENABLE ; +if (!test_bit (PARAM_ISP_OTF_INPUT , p_index1)) { + isp->otf_input.width =DEFAULT_PREVIEW_STILL_WIDTH ; + isp->otf_input.height =DEFAULT_PREVIEW_STILL_HEIGHT ; +fimc_is_set_param_bit (is,PARAM_ISP_OTF_INPUT ); +fimc_is_inc_param_num (is); + } +if (is->sensor->test_pattern) + isp->otf_input.format =OTF_INPUT_FORMAT_STRGEN_COLORBAR_BAYER ; +else + isp->otf_input.format =OTF_INPUT_FORMAT_BAYER ; + isp->otf_input.bitwidth =10 ; + isp->otf_input.order =OTF_INPUT_ORDER_BAYER_GR_BG ; + isp->otf_input.crop_offset_x =0 ; + isp->otf_input.crop_offset_y =0 ; + isp->otf_input.err =OTF_INPUT_ERROR_NONE ; + + isp->dma1_input.cmd =DMA_INPUT_COMMAND_DISABLE ; + isp->dma1_input.width =0 ; + isp->dma1_input.height =0 ; + isp->dma1_input.format =0 ; + isp->dma1_input.bitwidth =0 ; + isp->dma1_input.plane =0 ; + isp->dma1_input.order =0 ; + isp->dma1_input.buffer_number =0 ; + isp->dma1_input.width =0 ; + isp->dma1_input.err =DMA_INPUT_ERROR_NONE ; +fimc_is_set_param_bit (is,PARAM_ISP_DMA1_INPUT ); +fimc_is_inc_param_num (is); + + isp->dma2_input.cmd =DMA_INPUT_COMMAND_DISABLE ; + isp->dma2_input.width =0 ; + isp->dma2_input.height =0 ; + isp->dma2_input.format =0 ; + isp->dma2_input.bitwidth =0 ; + isp->dma2_input.plane =0 ; + isp->dma2_input.order =0 ; + isp->dma2_input.buffer_number =0 ; + isp->dma2_input.width =0 ; + isp->dma2_input.err =DMA_INPUT_ERROR_NONE ; +fimc_is_set_param_bit (is,PARAM_ISP_DMA2_INPUT ); +fimc_is_inc_param_num (is); + + isp->aa.cmd =ISP_AA_COMMAND_START ; + isp->aa.target =ISP_AA_TARGET_AE |ISP_AA_TARGET_AWB ; +fimc_is_set_param_bit (is,PARAM_ISP_AA ); +fimc_is_inc_param_num (is); + +if (!test_bit (PARAM_ISP_FLASH , p_index1)) +__is_set_isp_flash (is,ISP_FLASH_COMMAND_DISABLE , +ISP_FLASH_REDEYE_DISABLE ); + +if (!test_bit (PARAM_ISP_AWB , p_index1)) +__is_set_isp_awb (is,ISP_AWB_COMMAND_AUTO ,0 ); + +if (!test_bit (PARAM_ISP_IMAGE_EFFECT , p_index1)) +__is_set_isp_effect (is,ISP_IMAGE_EFFECT_DISABLE ); + +if (!test_bit (PARAM_ISP_ISO , p_index1)) +__is_set_isp_iso (is,ISP_ISO_COMMAND_AUTO ,0 ); + +if (!test_bit (PARAM_ISP_ADJUST , p_index1)) { +__is_set_isp_adjust (is,ISP_ADJUST_COMMAND_MANUAL_CONTRAST ,0 ); +__is_set_isp_adjust (is, +ISP_ADJUST_COMMAND_MANUAL_SATURATION ,0 ); +__is_set_isp_adjust (is,ISP_ADJUST_COMMAND_MANUAL_SHARPNESS ,0 ); +__is_set_isp_adjust (is,ISP_ADJUST_COMMAND_MANUAL_EXPOSURE ,0 ); +__is_set_isp_adjust (is, +ISP_ADJUST_COMMAND_MANUAL_BRIGHTNESS ,0 ); +__is_set_isp_adjust (is,ISP_ADJUST_COMMAND_MANUAL_HUE ,0 ); + } + +if (!test_bit (PARAM_ISP_METERING , p_index1)) { +__is_set_isp_metering (is,0 ,ISP_METERING_COMMAND_CENTER ); +__is_set_isp_metering (is,1 ,0 ); +__is_set_isp_metering (is,2 ,0 ); +__is_set_isp_metering (is,3 ,0 ); +__is_set_isp_metering (is,4 ,0 ); + } + +if (!test_bit (PARAM_ISP_AFC , p_index1)) +__is_set_isp_afc (is,ISP_AFC_COMMAND_AUTO ,0 ); + + isp->otf_output.cmd =OTF_OUTPUT_COMMAND_ENABLE ; +if (!test_bit (PARAM_ISP_OTF_OUTPUT , p_index1)) { + isp->otf_output.width =DEFAULT_PREVIEW_STILL_WIDTH ; + isp->otf_output.height =DEFAULT_PREVIEW_STILL_HEIGHT ; +fimc_is_set_param_bit (is,PARAM_ISP_OTF_OUTPUT ); +fimc_is_inc_param_num (is); + } + isp->otf_output.format =OTF_OUTPUT_FORMAT_YUV444 ; + isp->otf_output.bitwidth =12 ; + isp->otf_output.order =0 ; + isp->otf_output.err =OTF_OUTPUT_ERROR_NONE ; + +if (!test_bit (PARAM_ISP_DMA1_OUTPUT , p_index1)) { + isp->dma1_output.cmd =DMA_OUTPUT_COMMAND_DISABLE ; + isp->dma1_output.width =0 ; + isp->dma1_output.height =0 ; + isp->dma1_output.format =0 ; + isp->dma1_output.bitwidth =0 ; + isp->dma1_output.plane =0 ; + isp->dma1_output.order =0 ; + isp->dma1_output.buffer_number =0 ; + isp->dma1_output.buffer_address =0 ; + isp->dma1_output.notify_dma_done =0 ; + isp->dma1_output.dma_out_mask =0 ; + isp->dma1_output.err =DMA_OUTPUT_ERROR_NONE ; +fimc_is_set_param_bit (is,PARAM_ISP_DMA1_OUTPUT ); +fimc_is_inc_param_num (is); + } + +if (!test_bit (PARAM_ISP_DMA2_OUTPUT , p_index1)) { + isp->dma2_output.cmd =DMA_OUTPUT_COMMAND_DISABLE ; + isp->dma2_output.width =0 ; + isp->dma2_output.height =0 ; + isp->dma2_output.format =0 ; + isp->dma2_output.bitwidth =0 ; + isp->dma2_output.plane =0 ; + isp->dma2_output.order =0 ; + isp->dma2_output.buffer_number =0 ; + isp->dma2_output.buffer_address =0 ; + isp->dma2_output.notify_dma_done =0 ; + isp->dma2_output.dma_out_mask =0 ; + isp->dma2_output.err =DMA_OUTPUT_ERROR_NONE ; +fimc_is_set_param_bit (is,PARAM_ISP_DMA2_OUTPUT ); +fimc_is_inc_param_num (is); + } + +/* Sensor */ +if (!test_bit (PARAM_SENSOR_FRAME_RATE , p_index1)) { +if (!mode) +__is_set_sensor (is,0 ); + } + +/* DRC */ + drc->control.cmd =CONTROL_COMMAND_START ; +__is_set_drc_control (is,CONTROL_BYPASS_ENABLE ); + + drc->otf_input.cmd =OTF_INPUT_COMMAND_ENABLE ; +if (!test_bit (PARAM_DRC_OTF_INPUT , p_index1)) { + drc->otf_input.width =DEFAULT_PREVIEW_STILL_WIDTH ; + drc->otf_input.height =DEFAULT_PREVIEW_STILL_HEIGHT ; +fimc_is_set_param_bit (is,PARAM_DRC_OTF_INPUT ); +fimc_is_inc_param_num (is); + } + drc->otf_input.format =OTF_INPUT_FORMAT_YUV444 ; + drc->otf_input.bitwidth =12 ; + drc->otf_input.order =0 ; + drc->otf_input.err =OTF_INPUT_ERROR_NONE ; + + drc->dma_input.cmd =DMA_INPUT_COMMAND_DISABLE ; + drc->dma_input.width =0 ; + drc->dma_input.height =0 ; + drc->dma_input.format =0 ; + drc->dma_input.bitwidth =0 ; + drc->dma_input.plane =0 ; + drc->dma_input.order =0 ; + drc->dma_input.buffer_number =0 ; + drc->dma_input.width =0 ; + drc->dma_input.err =DMA_INPUT_ERROR_NONE ; +fimc_is_set_param_bit (is,PARAM_DRC_DMA_INPUT ); +fimc_is_inc_param_num (is); + + drc->otf_output.cmd =OTF_OUTPUT_COMMAND_ENABLE ; +if (!test_bit (PARAM_DRC_OTF_OUTPUT , p_index1)) { + drc->otf_output.width =DEFAULT_PREVIEW_STILL_WIDTH ; + drc->otf_output.height =DEFAULT_PREVIEW_STILL_HEIGHT ; +fimc_is_set_param_bit (is,PARAM_DRC_OTF_OUTPUT ); +fimc_is_inc_param_num (is); + } + drc->otf_output.format =OTF_OUTPUT_FORMAT_YUV444 ; + drc->otf_output.bitwidth =8 ; + drc->otf_output.order =0 ; + drc->otf_output.err =OTF_OUTPUT_ERROR_NONE ; + +/* FD */ +__is_set_fd_control (is,CONTROL_COMMAND_STOP ); + fd->control.bypass =CONTROL_BYPASS_DISABLE ; + + fd->otf_input.cmd =OTF_INPUT_COMMAND_ENABLE ; +if (!test_bit ((PARAM_FD_OTF_INPUT -32 ), p_index2)) { + fd->otf_input.width =DEFAULT_PREVIEW_STILL_WIDTH ; + fd->otf_input.height =DEFAULT_PREVIEW_STILL_HEIGHT ; +fimc_is_set_param_bit (is,PARAM_FD_OTF_INPUT ); +fimc_is_inc_param_num (is); + } + fd->otf_input.format =OTF_INPUT_FORMAT_YUV444 ; + fd->otf_input.bitwidth =8 ; + fd->otf_input.order =0 ; + fd->otf_input.err =OTF_INPUT_ERROR_NONE ; + + fd->dma_input.cmd =DMA_INPUT_COMMAND_DISABLE ; + fd->dma_input.width =0 ; + fd->dma_input.height =0 ; + fd->dma_input.format =0 ; + fd->dma_input.bitwidth =0 ; + fd->dma_input.plane =0 ; + fd->dma_input.order =0 ; + fd->dma_input.buffer_number =0 ; + fd->dma_input.width =0 ; + fd->dma_input.err =DMA_INPUT_ERROR_NONE ; +fimc_is_set_param_bit (is,PARAM_FD_DMA_INPUT ); +fimc_is_inc_param_num (is); + +__is_set_fd_config_maxface (is,5 ); +__is_set_fd_config_rollangle (is,FD_CONFIG_ROLL_ANGLE_FULL ); +__is_set_fd_config_yawangle (is,FD_CONFIG_YAW_ANGLE_45_90 ); +__is_set_fd_config_smilemode (is,FD_CONFIG_SMILE_MODE_DISABLE ); +__is_set_fd_config_blinkmode (is,FD_CONFIG_BLINK_MODE_DISABLE ); +__is_set_fd_config_eyedetect (is,FD_CONFIG_EYES_DETECT_ENABLE ); +__is_set_fd_config_mouthdetect (is,FD_CONFIG_MOUTH_DETECT_DISABLE ); +__is_set_fd_config_orientation (is,FD_CONFIG_ORIENTATION_DISABLE ); +__is_set_fd_config_orientation_val (is,0 ); +}
drivers/media/platform/s5p-fimc/fimc-is-param.h new file +1018 -0
1,018 lines not on this page · raw message
Signature · 1 line
1.7.9.5
RFC PATCH 4/8 s5p-fimc: Add common FIMC-IS image sensor driver
In reply to Sylwester NawrockiThis subdev driver currently only handles an image sensor's power supplies and reset signal. There is no any I2C communication here as it is handled by the ISP's firmware.
--- drivers/media/platform/s5p-fimc/fimc-is-sensor.c | 308 ++++++++++++++++++++++ drivers/media/platform/s5p-fimc/fimc-is-sensor.h | 80 ++++++ 2 files changed, 388 insertions(+) create mode 100644 drivers/media/platform/s5p-fimc/fimc-is-sensor.c create mode 100644 drivers/media/platform/s5p-fimc/fimc-is-sensor.h
drivers/media/platform/s5p-fimc/fimc-is-sensor.c new file +308 -0
@@ -0,0 +1,308 @@ +/* +* Samsung EXYNOS4x12 FIMC-IS (Imaging Subsystem) driver +* +* Copyright (C) 2013 Samsung Electronics Co., Ltd. +* Sylwester Nawrocki <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ +#include <linux/delay.h> +#include <linux/device.h> +#include <linux/errno.h> +#include <linux/gpio.h> +#include <linux/interrupt.h> +#include <linux/io.h> +#include <linux/irq.h> +#include <linux/kernel.h> +#include <linux/memory.h> +#include <linux/module.h> +#include <linux/of_gpio.h> +#include <linux/regulator/consumer.h> +#include <linux/slab.h> +#include <media/v4l2-subdev.h> + +#include "fimc-is.h" +#include "fimc-is-sensor.h" + +#define DRIVER_NAME "FIMC-IS-SENSOR" + +static const char *const sensor_supply_names[] = { +"svdda" , +"svddio" , +}; + +static const struct v4l2_mbus_framefmt fimc_is_sensor_formats[] = { + { + .code =V4L2_MBUS_FMT_SGRBG10_1X10 , + .colorspace =V4L2_COLORSPACE_SRGB , + .field =V4L2_FIELD_NONE , + } +}; + +static struct fimc_is_sensor *sd_to_fimc_is_sensor (struct v4l2_subdev *sd) +{ + return container_of(sd, struct fimc_is_sensor, subdev); +} + +static const struct v4l2_mbus_framefmt *find_sensor_format ( +struct v4l2_mbus_framefmt *mf) +{ +int i; + +for (i =0 ; i <ARRAY_SIZE (fimc_is_sensor_formats); i++) +if (mf->code == fimc_is_sensor_formats[i].code) +return &fimc_is_sensor_formats[i]; + +return &fimc_is_sensor_formats[0 ]; +} + +static int fimc_is_sensor_enum_mbus_code (struct v4l2_subdev *sd, +struct v4l2_subdev_fh *fh, +struct v4l2_subdev_mbus_code_enum *code) +{ +if (code->index >=ARRAY_SIZE (fimc_is_sensor_formats)) +return -EINVAL ; + + code->code = fimc_is_sensor_formats[code->index].code; +return 0 ; +} + +static void fimc_is_sensor_try_format (struct fimc_is_sensor *sensor, +struct v4l2_mbus_framefmt *mf) +{ +const struct sensor_drv_data *dd = sensor->drvdata; +const struct v4l2_mbus_framefmt *fmt; + + fmt =find_sensor_format (mf); + mf->code = fmt->code; +v4l_bound_align_image (&mf->width,16 +8 , dd->width,0 , + &mf->height,12 +8 , dd->height,0 ,0 ); +} + +static struct v4l2_mbus_framefmt *__fimc_is_sensor_get_format ( +struct fimc_is_sensor *sensor,struct v4l2_subdev_fh *fh, +u32 pad,enum v4l2_subdev_format_whence which) +{ +if (which ==V4L2_SUBDEV_FORMAT_TRY ) +return fh ?v4l2_subdev_get_try_format (fh, pad) :NULL ; + +return &sensor->format; +} + +static int fimc_is_sensor_set_fmt (struct v4l2_subdev *sd, +struct v4l2_subdev_fh *fh, +struct v4l2_subdev_format *fmt) +{ +struct fimc_is_sensor *sensor =sd_to_fimc_is_sensor (sd); +struct v4l2_mbus_framefmt *mf; + +fimc_is_sensor_try_format (sensor, &fmt->format); + + mf =__fimc_is_sensor_get_format (sensor, fh, fmt->pad, fmt->which); +if (mf) { +mutex_lock (&sensor->lock); +if (fmt->which ==V4L2_SUBDEV_FORMAT_ACTIVE ) + sensor->format = *mf; +mutex_unlock (&sensor->lock); + } +return 0 ; +} + +static int fimc_is_sensor_get_fmt (struct v4l2_subdev *sd, +struct v4l2_subdev_fh *fh, +struct v4l2_subdev_format *fmt) +{ +struct fimc_is_sensor *sensor =sd_to_fimc_is_sensor (sd); +struct v4l2_mbus_framefmt *mf; + + mf =__fimc_is_sensor_get_format (sensor, fh, fmt->pad, fmt->which); + +mutex_lock (&sensor->lock); + fmt->format = *mf; +mutex_unlock (&sensor->lock); +return 0 ; +} + +static struct v4l2_subdev_pad_ops fimc_is_sensor_pad_ops = { + .enum_mbus_code = fimc_is_sensor_enum_mbus_code, + .get_fmt = fimc_is_sensor_get_fmt, + .set_fmt = fimc_is_sensor_set_fmt, +}; + +static int fimc_is_sensor_open (struct v4l2_subdev *sd,struct v4l2_subdev_fh *fh) +{ +struct v4l2_mbus_framefmt *format =v4l2_subdev_get_try_format (fh,0 ); + + *format = fimc_is_sensor_formats[0 ]; + format->width =FIMC_IS_SENSOR_DEF_PIX_WIDTH ; + format->height =FIMC_IS_SENSOR_DEF_PIX_HEIGHT ; + +return 0 ; +} + +static const struct v4l2_subdev_internal_ops fimc_is_sensor_sd_internal_ops = { + .open = fimc_is_sensor_open, +}; + +static int fimc_is_sensor_s_power (struct v4l2_subdev *sd,int on) +{ +struct fimc_is_sensor *sensor =v4l2_get_subdevdata (sd); +int gpio = sensor->gpio_reset; +int ret; + +pr_debug ("%s:%d: on: %d\n" , __func__, __LINE__, on); + +if (on) { + ret =regulator_bulk_enable (SENSOR_NUM_SUPPLIES , + sensor->supplies); +if (gpio_is_valid (gpio)) { +gpio_set_value (gpio,1 ); +usleep_range (600 ,800 ); +gpio_set_value (gpio,0 ); +usleep_range (10000 ,11000 ); +gpio_set_value (gpio,1 ); + } + }else { +if (gpio_is_valid (gpio)) +gpio_set_value (gpio,0 ); + + ret =regulator_bulk_disable (SENSOR_NUM_SUPPLIES , + sensor->supplies); + } + +return ret; +} + +static struct v4l2_subdev_core_ops fimc_is_sensor_core_ops = { + .s_power = fimc_is_sensor_s_power, +}; + +static struct v4l2_subdev_ops fimc_is_sensor_subdev_ops = { + .core = &fimc_is_sensor_core_ops, + .pad = &fimc_is_sensor_pad_ops, +}; + +static const struct of_device_id fimc_is_sensor_of_match[]; + +static int fimc_is_sensor_probe (struct i2c_client *client, +const struct i2c_device_id *id) +{ +struct device *dev = &client->dev; +struct fimc_is_sensor *sensor; +const struct of_device_id *of_id; +struct v4l2_subdev *sd; +int gpio, i, ret; + + sensor =devm_kzalloc (dev,sizeof (*sensor),GFP_KERNEL ); +if (!sensor) +return -ENOMEM ; + +mutex_init (&sensor->lock); + sensor->gpio_reset = -EINVAL ; + + gpio =of_get_gpio_flags (dev->of_node,0 ,NULL );/* &of_flags); */ +if (gpio_is_valid (gpio)) { +/* gpio->level = !(of_flags & OF_GPIO_ACTIVE_LOW); */ + ret =gpio_request_one (gpio,GPIOF_OUT_INIT_LOW ,DRIVER_NAME ); +if (ret <0 ) +return ret; + } + sensor->gpio_reset = gpio; + +for (i =0 ; i <SENSOR_NUM_SUPPLIES ; i++) + sensor->supplies[i].supply = sensor_supply_names[i]; + + ret =devm_regulator_bulk_get (&client->dev,SENSOR_NUM_SUPPLIES , + sensor->supplies); +if (ret <0 ) + goto err_gpio; + + of_id =of_match_node (fimc_is_sensor_of_match, dev->of_node); +if (!of_id) { + ret = -ENODEV ; + goto err_reg; + } + + sensor->drvdata = of_id->data; + + sd = &sensor->subdev; +v4l2_i2c_subdev_init (sd, client, &fimc_is_sensor_subdev_ops); +snprintf (sd->name,sizeof (sd->name), sensor->drvdata->subdev_name); + sensor->subdev.flags |=V4L2_SUBDEV_FL_HAS_DEVNODE ; + + sensor->format.code = fimc_is_sensor_formats[0 ].code; + sensor->format.width =FIMC_IS_SENSOR_DEF_PIX_WIDTH ; + sensor->format.height =FIMC_IS_SENSOR_DEF_PIX_HEIGHT ; + + sensor->pad.flags =MEDIA_PAD_FL_SOURCE ; + ret =media_entity_init (&sd->entity,1 , &sensor->pad,0 ); +if (ret <0 ) + goto err_reg; + +v4l2_set_subdevdata (sd, sensor); + +return 0 ; +err_reg: +regulator_bulk_free (SENSOR_NUM_SUPPLIES , sensor->supplies); +err_gpio: +if (gpio_is_valid (sensor->gpio_reset)) +gpio_free (sensor->gpio_reset); +return ret; +} + +static int fimc_is_sensor_remove (struct i2c_client *client) +{ +struct fimc_is_sensor *sensor; + +regulator_bulk_free (SENSOR_NUM_SUPPLIES , sensor->supplies); +media_entity_cleanup (&sensor->subdev.entity); + +return 0 ; +} + +static const struct i2c_device_id fimc_is_sensor_ids[] = { + { } +}; + +static const struct sensor_drv_data s5k6a3_drvdata = { + .id =FIMC_IS_SENSOR_ID_S5K6A3 , + .subdev_name ="S5K6A3" , + .width =S5K6A3_SENSOR_WIDTH , + .height =S5K6A3_SENSOR_HEIGHT , +}; + +static const struct of_device_id fimc_is_sensor_of_match[] = { + { + .compatible ="samsung,s5k6a3" , + .data = &s5k6a3_drvdata, + }, + { } +}; +MODULE_DEVICE_TABLE (of, fimc_is_sensor_of_match); + +static struct i2c_driver fimc_is_sensor_driver = { + .driver = { + .of_match_table = fimc_is_sensor_of_match, + .name =DRIVER_NAME , + .owner =THIS_MODULE , + }, + .probe = fimc_is_sensor_probe, + .remove = fimc_is_sensor_remove, + .id_table = fimc_is_sensor_ids, +}; + +int fimc_is_register_sensor_driver (void ) +{ +return i2c_add_driver (&fimc_is_sensor_driver); +} + +void fimc_is_unregister_sensor_driver (void ) +{ +i2c_del_driver (&fimc_is_sensor_driver); +} + +MODULE_AUTHOR ("Sylwester Nawrocki <[email protected]>" ); +MODULE_DESCRIPTION ("Exynos4x12 FIMC-IS image sensor subdev driver" ); +MODULE_LICENSE ("GPL" );
drivers/media/platform/s5p-fimc/fimc-is-sensor.h new file +80 -0
80 lines not on this page · raw message
Signature · 1 line
1.7.9.5
RFC PATCH 5/8 s5p-fimc: Add ISP video capture driver stubs
In reply to Sylwester NawrockiThis patch adds a video capture node for the FIMC-IS ISP IP block and Makefile/Kconfig to actually enable the driver's compilation.
The ISP video capture driver is still a work in progress.
--- drivers/media/platform/s5p-fimc/Kconfig | 13 + drivers/media/platform/s5p-fimc/Makefile | 4 + drivers/media/platform/s5p-fimc/fimc-isp-video.c | 414 ++++++++++++++++++++++ drivers/media/platform/s5p-fimc/fimc-isp-video.h | 50 +++ 4 files changed, 481 insertions(+) create mode 100644 drivers/media/platform/s5p-fimc/fimc-isp-video.c create mode 100644 drivers/media/platform/s5p-fimc/fimc-isp-video.h
drivers/media/platform/s5p-fimc/Kconfig +13 -0
@@ -46,4 +46,17 @@ config VIDEO_EXYNOS_FIMC_LITE module will be called exynos-fimc-lite. endif +if (SOC_EXYNOS4212 || SOC_EXYNOS4412) && OF && !ARCH_MULTIPLATFORM + +config VIDEO_EXYNOS4_FIMC_IS + tristate "EXYNOS4x12 FIMC-IS (Imaging Subsystem) driver" + select VIDEOBUF2_DMA_CONTIG + help + This is a V4L2 driver for Samsung EXYNOS4x12 SoC FIMC-IS + (Imaging Subsystem). + + To compile this driver as a module, choose M here: the + module will be called exynos-fimc-is. +endif + endif # VIDEO_SAMSUNG_S5P_FIMC
drivers/media/platform/s5p-fimc/Makefile +4 -0
@@ -1,7 +1,11 @@ s5p-fimc-objs := fimc-core.o fimc-reg.o fimc-m2m.o fimc-capture.o fimc-mdevice.o exynos-fimc-lite-objs += fimc-lite-reg.o fimc-lite.o +exynos-fimc-is-objs := fimc-is.o fimc-isp.o fimc-is-sensor.o fimc-is-regs.o +exynos-fimc-is-objs += fimc-is-param.o fimc-is-errno.o fimc-is-i2c.o +exynos-fimc-is-objs += fimc-isp-video.o s5p-csis-objs := mipi-csis.o obj-$(CONFIG_VIDEO_S5P_MIPI_CSIS) += s5p-csis.o obj-$(CONFIG_VIDEO_EXYNOS_FIMC_LITE) += exynos-fimc-lite.o +obj-$(CONFIG_VIDEO_EXYNOS4_FIMC_IS) += exynos-fimc-is.o obj-$(CONFIG_VIDEO_S5P_FIMC) += s5p-fimc.o
drivers/media/platform/s5p-fimc/fimc-isp-video.c new file +414 -0
414 lines not on this page · raw message
drivers/media/platform/s5p-fimc/fimc-isp-video.h new file +50 -0
50 lines not on this page · raw message
Signature · 1 line
1.7.9.5
RFC PATCH 5/8 s5p-fimc: Add ISP video capture driver stubs
Quoted 259 lines · On Mon 11 March 2013 20:44:49 Sylwester Nawrocki wrote:
This patch adds a video capture node for the FIMC-IS ISP IP block and Makefile/Kconfig to actually enable the driver's compilation.
The ISP video capture driver is still a work in progress.
Signed-off-by Sylwester Nawrocki <[email protected]>Signed-off-by Kyungmin Park <[email protected]>--- drivers/media/platform/s5p-fimc/Kconfig | 13 + drivers/media/platform/s5p-fimc/Makefile | 4 + drivers/media/platform/s5p-fimc/fimc-isp-video.c | 414 ++++++++++++++++++++++ drivers/media/platform/s5p-fimc/fimc-isp-video.h | 50 +++ 4 files changed, 481 insertions(+) create mode 100644 drivers/media/platform/s5p-fimc/fimc-isp-video.c create mode 100644 drivers/media/platform/s5p-fimc/fimc-isp-video.hdrivers/media/platform/s5p-fimc/Kconfig +13
-0@@ -46,4 +46,17 @@ config VIDEO_EXYNOS_FIMC_LITE module will be called exynos-fimc-lite. endif +if (SOC_EXYNOS4212 || SOC_EXYNOS4412) && OF && !ARCH_MULTIPLATFORM + +config VIDEO_EXYNOS4_FIMC_IS + tristate "EXYNOS4x12 FIMC-IS (Imaging Subsystem) driver" + select VIDEOBUF2_DMA_CONTIG + help + This is a V4L2 driver for Samsung EXYNOS4x12 SoC FIMC-IS + (Imaging Subsystem). + + To compile this driver as a module, choose M here: the + module will be called exynos-fimc-is. +endif + endif # VIDEO_SAMSUNG_S5P_FIMCdrivers/media/platform/s5p-fimc/Makefile +4
-0@@ -1,7 +1,11 @@ s5p-fimc-objs := fimc-core.o fimc-reg.o fimc-m2m.o fimc-capture.o fimc-mdevice.o exynos-fimc-lite-objs += fimc-lite-reg.o fimc-lite.o +exynos-fimc-is-objs := fimc-is.o fimc-isp.o fimc-is-sensor.o fimc-is-regs.o +exynos-fimc-is-objs += fimc-is-param.o fimc-is-errno.o fimc-is-i2c.o +exynos-fimc-is-objs += fimc-isp-video.o s5p-csis-objs := mipi-csis.o obj-$(CONFIG_VIDEO_S5P_MIPI_CSIS) += s5p-csis.o obj-$(CONFIG_VIDEO_EXYNOS_FIMC_LITE) += exynos-fimc-lite.o +obj-$(CONFIG_VIDEO_EXYNOS4_FIMC_IS) += exynos-fimc-is.o obj-$(CONFIG_VIDEO_S5P_FIMC) += s5p-fimc.odrivers/media/platform/s5p-fimc/fimc-isp-video.c new file +199
-0@@ -0,0 +1,414 @@ +/* +* Samsung EXYNOS4x12 FIMC-IS (Imaging Subsystem) driver +* +* Copyright (C) 2013 Samsung Electronics Co., Ltd. +* Author: Sylwester Nawrocki <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#include <linux/device.h> +#include <linux/delay.h> +#include <linux/errno.h> +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/types.h> +#include <linux/printk.h> +#include <linux/pm_runtime.h> +#include <linux/slab.h> +#include <linux/videodev2.h> + +#include <media/v4l2-device.h> +#include <media/v4l2-ioctl.h> +#include <media/videobuf2-core.h> +#include <media/videobuf2-dma-contig.h> + +#include "fimc-mdevice.h" +#include "fimc-core.h" +#include "fimc-is.h" + +static int isp_video_capture_start_streaming (struct vb2_queue *q, +unsigned int count) +{ +/* TODO: start ISP output DMA */ +return 0 ; +} + +static int isp_video_capture_stop_streaming (struct vb2_queue *q) +{ +/* TODO: stop ISP output DMA */ +return 0 ; +} + +static int isp_video_capture_queue_setup (struct vb2_queue *vq, +const struct v4l2_format *pfmt, +unsigned int *num_buffers,unsigned int *num_planes, +unsigned int sizes[],void *allocators[]) +{ +const struct v4l2_pix_format_mplane *pixm =NULL ; +struct fimc_isp *isp = vq->drv_priv; +struct fimc_isp_frame *frame = &isp->out_frame; +const struct fimc_fmt *fmt = isp->video_capture_format; +unsigned long wh; +int i; + +if (pfmt) { + pixm = &pfmt->fmt.pix_mp; + fmt =fimc_isp_find_format (&pixm->pixelformat,NULL ,-1 ); + wh = pixm->width * pixm->height; + }else { + wh = frame->f_width * frame->f_height; + } + +if (fmt ==NULL ) +return -EINVAL ; + + *num_planes = fmt->memplanes; + +for (i =0 ; i < fmt->memplanes; i++) { +unsigned int size = (wh * fmt->depth[i]) /8 ; +if (pixm) + sizes[i] =max (size, pixm->plane_fmt[i].sizeimage); +else + sizes[i] = size; + allocators[i] = isp->alloc_ctx; + } + +return 0 ; +} + +static int isp_video_capture_buffer_prepare (struct vb2_buffer *vb) +{ +struct vb2_queue *vq = vb->vb2_queue; +struct fimc_isp *isp = vq->drv_priv; +int i; + +if (isp->video_capture_format ==NULL ) +return -EINVAL ; + +for (i =0 ; i < isp->video_capture_format->memplanes; i++) { +unsigned long size = isp->payload[i]; + +if (vb2_plane_size (vb, i) < size) { +v4l2_err (&isp->vfd, +"User buffer too small (%ld < %ld)\n" , +vb2_plane_size (vb, i), size); +return -EINVAL ; + } +vb2_set_plane_payload (vb, i, size); + } + +return 0 ; +} + +static void isp_video_capture_buffer_queue (struct vb2_buffer *vb) +{ +/* TODO: */ +} + +static void isp_video_lock (struct vb2_queue *vq) +{ +struct fimc_isp *isp =vb2_get_drv_priv (vq); +mutex_lock (&isp->video_lock); +} + +static void isp_video_unlock (struct vb2_queue *vq) +{ +struct fimc_isp *isp =vb2_get_drv_priv (vq); +mutex_unlock (&isp->video_lock); +} + +static const struct vb2_ops isp_video_capture_qops = { + .queue_setup = isp_video_capture_queue_setup, + .buf_prepare = isp_video_capture_buffer_prepare, + .buf_queue = isp_video_capture_buffer_queue, + .wait_prepare = isp_video_unlock, + .wait_finish = isp_video_lock, + .start_streaming = isp_video_capture_start_streaming, + .stop_streaming = isp_video_capture_stop_streaming, +}; + +static int isp_video_capture_open (struct file *file) +{ +struct fimc_isp *isp =video_drvdata (file); +int ret =0 ; + +if (mutex_lock_interruptible (&isp->video_lock)) +return -ERESTARTSYS ; + +/* ret = pm_runtime_get_sync(&isp->pdev->dev); */ +if (ret <0 ) + goto done; + + ret =v4l2_fh_open (file); +if (ret <0 ) + goto done; + +/* TODO: prepare video pipeline */ +done: +mutex_unlock (&isp->video_lock); +return ret; +} + +static int isp_video_capture_close (struct file *file) +{ +struct fimc_isp *isp =video_drvdata (file); +int ret =0 ; + +mutex_lock (&isp->video_lock); + +if (isp->out_path ==FIMC_IO_DMA ) { +/* TODO: stop capture, cleanup */ + } + +/* pm_runtime_put(&isp->pdev->dev); */ + +if (isp->ref_count ==0 ) +vb2_queue_release (&isp->capture_vb_queue); + + ret =v4l2_fh_release (file); + +mutex_unlock (&isp->video_lock); +return ret; +} + +static unsigned int isp_video_capture_poll (struct file *file, +struct poll_table_struct *wait) +{ +struct fimc_isp *isp =video_drvdata (file); +int ret; + +mutex_lock (&isp->video_lock); + ret =vb2_poll (&isp->capture_vb_queue, file, wait); +mutex_unlock (&isp->video_lock); +return ret; +} + +static int isp_video_capture_mmap (struct file *file,struct vm_area_struct *vma) +{ +struct fimc_isp *isp =video_drvdata (file); +int ret; + +if (mutex_lock_interruptible (&isp->video_lock)) +return -ERESTARTSYS ; + + ret =vb2_mmap (&isp->capture_vb_queue, vma); +mutex_unlock (&isp->video_lock); +
drivers/media/platform/s5p-fimc/fimc-isp-video.c line 209
Quoted 10 lines
drivers/media/platform/s5p-fimc/fimc-isp-video.c new file +10
-0+return ret; +} + +static const struct v4l2_file_operations isp_video_capture_fops = { + .owner =THIS_MODULE , + .open = isp_video_capture_open, + .release = isp_video_capture_close, + .poll = isp_video_capture_poll, + .unlocked_ioctl = video_ioctl2, + .mmap = isp_video_capture_mmap,
Can't you use the helper functions vb2_fop_open/release/poll/mmap here?
Quoted 107 lines
drivers/media/platform/s5p-fimc/fimc-isp-video.c new file +107
-0+}; + +/* +* Video node ioctl operations +*/ +static int fimc_isp_capture_querycap_capture (struct file *file,void *priv, +struct v4l2_capability *cap) +{ + +strlcpy (cap->driver,FIMC_IS_DRV_NAME ,sizeof (cap->driver)); +strlcpy (cap->card,FIMC_IS_DRV_NAME ,sizeof (cap->card)); +snprintf (cap->bus_info,sizeof (cap->bus_info), +"platform:exynos4x12-isp" ); + + cap->device_caps =V4L2_CAP_STREAMING ; + cap->capabilities = cap->device_caps |V4L2_CAP_DEVICE_CAPS ; + +return 0 ; +} + +static int fimc_isp_capture_enum_fmt_mplane (struct file *file,void *priv, +struct v4l2_fmtdesc *f) +{ +const struct fimc_fmt *fmt; + +if (f->index >=FIMC_ISP_NUM_FORMATS ) +return -EINVAL ; + + fmt =fimc_isp_find_format (NULL ,NULL , f->index); +if (WARN_ON (fmt ==NULL )) +return -EINVAL ; + +strlcpy (f->description, fmt->name,sizeof (f->description)); + f->pixelformat = fmt->fourcc; + +return 0 ; +} + +static int fimc_isp_capture_g_fmt_mplane (struct file *file,void *fh, +struct v4l2_format *f) +{ +/* TODO: */ +return 0 ; +} + +static int fimc_isp_capture_try_fmt (struct fimc_isp *isp, +struct v4l2_pix_format_mplane *pixm, +const struct fimc_fmt **ffmt) +{ +/* TODO: */ +return 0 ; +} + +static int fimc_isp_capture_try_fmt_mplane (struct file *file,void *fh, +struct v4l2_format *f) +{ +struct fimc_isp *isp =video_drvdata (file); +return fimc_isp_capture_try_fmt (isp, &f->fmt.pix_mp,NULL ); +} + +static int fimc_isp_capture_s_fmt_mplane (struct file *file,void *priv, +struct v4l2_format *f) +{ +/* TODO: */ +return 0 ; +} + +static int fimc_isp_pipeline_validate (struct fimc_isp *isp) +{ +/* TODO: */ +return 0 ; +} + +static int fimc_isp_capture_streamon (struct file *file,void *priv, +enum v4l2_buf_type type) +{ +struct fimc_isp *isp =video_drvdata (file); +struct v4l2_subdev *sensor = isp->pipeline.subdevs[IDX_SENSOR ]; +struct fimc_pipeline *p = &isp->pipeline; +int ret; + +/* TODO: check if the OTF interface is not running */ + + ret =media_entity_pipeline_start (&sensor->entity, p->m_pipeline); +if (ret <0 ) +return ret; + + ret =fimc_isp_pipeline_validate (isp); +if (ret) { +media_entity_pipeline_stop (&sensor->entity); +return ret; + } + +return vb2_streamon (&isp->capture_vb_queue, type); +} + +static int fimc_isp_capture_streamoff (struct file *file,void *priv, +enum v4l2_buf_type type) +{ +struct fimc_isp *isp =video_drvdata (file); +struct v4l2_subdev *sd = isp->pipeline.subdevs[IDX_SENSOR ]; +int ret; + + ret =vb2_streamoff (&isp->capture_vb_queue, type); +if (ret ==0 ) +media_entity_pipeline_stop (&sd->entity); +return ret;
drivers/media/platform/s5p-fimc/fimc-isp-video.c line 326
Quoted 10 lines
drivers/media/platform/s5p-fimc/fimc-isp-video.c new file +10
-0+} + +static int fimc_isp_capture_reqbufs (struct file *file,void *priv, +struct v4l2_requestbuffers *reqbufs) +{ +struct fimc_isp *isp =video_drvdata (file); +int ret; + + reqbufs->count =max_t (u32,FIMC_IS_REQ_BUFS_MIN , reqbufs->count); + ret =vb2_reqbufs (&isp->capture_vb_queue, reqbufs);
You probably want to call vb2_ioctl_reqbufs here since that does additional ownership checks that vb2_reqbufs doesn't.
The same is true for vb2_ioctl_streamon/off, BTW.
Quoted 78 lines
drivers/media/platform/s5p-fimc/fimc-isp-video.c new file +78
-0+if (!ret <0 ) + isp->reqbufs_count = reqbufs->count; + +return ret; +} + +static const struct v4l2_ioctl_ops isp_video_capture_ioctl_ops = { + .vidioc_querycap = fimc_isp_capture_querycap_capture, + .vidioc_enum_fmt_vid_cap_mplane = fimc_isp_capture_enum_fmt_mplane, + .vidioc_try_fmt_vid_cap_mplane = fimc_isp_capture_try_fmt_mplane, + .vidioc_s_fmt_vid_cap_mplane = fimc_isp_capture_s_fmt_mplane, + .vidioc_g_fmt_vid_cap_mplane = fimc_isp_capture_g_fmt_mplane, + .vidioc_reqbufs = fimc_isp_capture_reqbufs, + .vidioc_querybuf = vb2_ioctl_querybuf, + .vidioc_prepare_buf = vb2_ioctl_prepare_buf, + .vidioc_create_bufs = vb2_ioctl_create_bufs, + .vidioc_qbuf = vb2_ioctl_qbuf, + .vidioc_dqbuf = vb2_ioctl_dqbuf, + .vidioc_streamon = fimc_isp_capture_streamon, + .vidioc_streamoff = fimc_isp_capture_streamoff, +}; + +int fimc_isp_video_device_register (struct fimc_isp *isp, +struct v4l2_device *v4l2_dev) +{ +struct vb2_queue *q = &isp->capture_vb_queue; +struct video_device *vfd = &isp->vfd; +int ret; + +mutex_init (&isp->video_lock); +INIT_LIST_HEAD (&isp->pending_buf_q); +INIT_LIST_HEAD (&isp->active_buf_q); + +memset (vfd,0 ,sizeof (*vfd)); +snprintf (vfd->name,sizeof (vfd->name),"fimc-is-isp.capture" ); + + isp->video_capture_format =fimc_isp_find_format (NULL ,NULL ,0 ); + isp->out_path =FIMC_IO_DMA ; + isp->ref_count =0 ; + isp->reqbufs_count =0 ; + +memset (q,0 ,sizeof (*q)); + q->type =V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE ; + q->io_modes =VB2_MMAP ; + q->ops = &isp_video_capture_qops; + q->mem_ops = &vb2_dma_contig_memops; + q->buf_struct_size =sizeof (struct flite_buffer ); + q->drv_priv = isp; + q->timestamp_type =V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC ; + + ret =vb2_queue_init (q); +if (ret <0 ) +return ret; + + vfd->queue = q; + vfd->fops = &isp_video_capture_fops; + vfd->ioctl_ops = &isp_video_capture_ioctl_ops; + vfd->v4l2_dev = v4l2_dev; + vfd->minor =-1 ; + vfd->release = video_device_release_empty; + vfd->lock = &isp->video_lock; + + isp->vd_pad.flags =MEDIA_PAD_FL_SINK ; + ret =media_entity_init (&vfd->entity,1 , &isp->vd_pad,0 ); +if (ret <0 ) +return ret; + +video_set_drvdata (vfd, isp); + + ret =video_register_device (vfd,VFL_TYPE_GRABBER ,-1 ); +if (ret <0 ) { +media_entity_cleanup (&vfd->entity); +return ret; + } + +v4l2_info (v4l2_dev,"Registered %s as /dev/%s\n" , + vfd->name,video_device_node_name (vfd)); +
drivers/media/platform/s5p-fimc/fimc-isp-video.c line 414
Quoted 10 lines
drivers/media/platform/s5p-fimc/fimc-isp-video.c new file +10
-0+return 0 ; +} + +void fimc_isp_video_device_unregister (struct fimc_isp *isp) +{ +if (isp &&video_is_registered (&isp->vfd)) { +video_unregister_device (&isp->vfd); +media_entity_cleanup (&isp->vfd.entity); + } +}
Regards,
Hans
RFC PATCH 5/8 s5p-fimc: Add ISP video capture driver stubs
Quoted 1 line · Hans Verkuil
On Mon 11 March 2013 20:44:49 Sylwester Nawrocki wrote:
[...]
Quoted 71 lines
Quoted 71 lines
drivers/media/platform/s5p-fimc/fimc-isp-video.c new file +71
-0+static int isp_video_capture_open (struct file *file) +{ +struct fimc_isp *isp =video_drvdata (file); +int ret =0 ; + +if (mutex_lock_interruptible (&isp->video_lock)) +return -ERESTARTSYS ; + +/* ret = pm_runtime_get_sync(&isp->pdev->dev); */ +if (ret<0 ) + goto done; + + ret =v4l2_fh_open (file); +if (ret<0 ) + goto done; + +/* TODO: prepare video pipeline */ +done: +mutex_unlock (&isp->video_lock); +return ret; +} + +static int isp_video_capture_close (struct file *file) +{ +struct fimc_isp *isp =video_drvdata (file); +int ret =0 ; + +mutex_lock (&isp->video_lock); + +if (isp->out_path ==FIMC_IO_DMA ) { +/* TODO: stop capture, cleanup */ + } + +/* pm_runtime_put(&isp->pdev->dev); */ + +if (isp->ref_count ==0 ) +vb2_queue_release (&isp->capture_vb_queue); + + ret =v4l2_fh_release (file); + +mutex_unlock (&isp->video_lock); +return ret; +} + +static unsigned int isp_video_capture_poll (struct file *file, +struct poll_table_struct *wait) +{ +struct fimc_isp *isp =video_drvdata (file); +int ret; + +mutex_lock (&isp->video_lock); + ret =vb2_poll (&isp->capture_vb_queue, file, wait); +mutex_unlock (&isp->video_lock); +return ret; +} + +static int isp_video_capture_mmap (struct file *file,struct vm_area_struct *vma) +{ +struct fimc_isp *isp =video_drvdata (file); +int ret; + +if (mutex_lock_interruptible (&isp->video_lock)) +return -ERESTARTSYS ; + + ret =vb2_mmap (&isp->capture_vb_queue, vma); +mutex_unlock (&isp->video_lock); + +return ret; +} + +static const struct v4l2_file_operations isp_video_capture_fops = {
Quoted 8 lines
drivers/media/platform/s5p-fimc/fimc-isp-video.c line 209
Quoted 6 lines
drivers/media/platform/s5p-fimc/fimc-isp-video.c new file +6
-0+ .owner = THIS_MODULE, + .open = isp_video_capture_open, + .release = isp_video_capture_close, + .poll = isp_video_capture_poll, + .unlocked_ioctl = video_ioctl2, + .mmap = isp_video_capture_mmap,Can't you use the helper functions vb2_fop_open/release/poll/mmap here?
It seems vb2_fop_mmap/poll can be used directly, open(), release() are a bit more complicated as some media pipeline operations need to additionally be done within these callbacks. There is no vb2_fop_open(), and AFAICS v4l2_fh_open() is sufficient and intended as open() helper. For the next iteration I have used vb2_fop_release(), called indirectly, as it nicely simplifies things a bit.
BTW, shouldn't vb2_fop_release() also be taking the lock ? Actually it is more useful for me in current form, but the drivers that directly assign it to struct v4l2_file_operations::open might be in trouble, unless I'm missing something.
Quoted 5 lines
Quoted 5 lines
drivers/media/platform/s5p-fimc/fimc-isp-video.c new file +5
-0+}; + +/* +* Video node ioctl operations +*/
[...]
Quoted 39 lines
Quoted 39 lines
drivers/media/platform/s5p-fimc/fimc-isp-video.c new file +39
-0+static int fimc_isp_capture_streamon (struct file *file,void *priv, +enum v4l2_buf_type type) +{ +struct fimc_isp *isp =video_drvdata (file); +struct v4l2_subdev *sensor = isp->pipeline.subdevs[IDX_SENSOR ]; +struct fimc_pipeline *p =&isp->pipeline; +int ret; + +/* TODO: check if the OTF interface is not running */ + + ret =media_entity_pipeline_start (&sensor->entity, p->m_pipeline); +if (ret<0 ) +return ret; + + ret =fimc_isp_pipeline_validate (isp); +if (ret) { +media_entity_pipeline_stop (&sensor->entity); +return ret; + } + +return vb2_streamon (&isp->capture_vb_queue, type); +} + +static int fimc_isp_capture_streamoff (struct file *file,void *priv, +enum v4l2_buf_type type) +{ +struct fimc_isp *isp =video_drvdata (file); +struct v4l2_subdev *sd = isp->pipeline.subdevs[IDX_SENSOR ]; +int ret; + + ret =vb2_streamoff (&isp->capture_vb_queue, type); +if (ret ==0 ) +media_entity_pipeline_stop (&sd->entity); +return ret; +} + +static int fimc_isp_capture_reqbufs (struct file *file,void *priv, +struct v4l2_requestbuffers *reqbufs) +{
Quoted 8 lines
drivers/media/platform/s5p-fimc/fimc-isp-video.c line 326
Quoted 5 lines
drivers/media/platform/s5p-fimc/fimc-isp-video.c new file +5
-0+struct fimc_isp *isp =video_drvdata (file); +int ret; + + reqbufs->count =max_t (u32,FIMC_IS_REQ_BUFS_MIN , reqbufs->count); + ret =vb2_reqbufs (&isp->capture_vb_queue, reqbufs);You probably want to call
vb2_ioctl_reqbufshere since that does additional ownership checks thatvb2_reqbufsdoesn't.
Yes, thanks for the suggestion. That was actually helpful, previously it wasn't immediately clear to me one can still take advantage of those vb2_ioctl_* helpers, mainly have the ownership handling in the core, and have some handlers assigned directly to v4l2_ioctl_ops an some called indirectly from the driver's own callbacks, should they need something else that is done in the helpers.
I found those helpers really useful, especially in drivers that need to support several video nodes. Lots of boilerplate can be eliminated. And also vb2_ops_wait_prepare/finish are a simple and nice improvement.
Quoted 1 line
The same is true for vb2_ioctl_streamon/off, BTW.
Indeed. I have already applied all possible helpers for the next iteration.
I need to yet resolve an issue with locking order, as I previously missed that media_entity_pipeline_start/stop() also takes the graph mutex.
And currently the driver is supposed to take the graph mutex first and then the video mutex. Since the link_notify callback of the media device is called with the graph mutex already held.
The only solution I came up so far is to provide unlocked versions of media_entity_pipeline_start/stop().
Ideally using video mutex in link_notify() callback should not be needed, but there are things done there needed for backward video device compatibility.
--
Regards,
Sylwester
RFC PATCH 5/8 s5p-fimc: Add ISP video capture driver stubs
Quoted 83 lines · On Sun March 17 2013 22:03:38 Sylwester Nawrocki wrote:
Quoted 1 line · Hans Verkuil
On Mon 11 March 2013 20:44:49 Sylwester Nawrocki wrote:
[...]
Quoted 71 lines
Quoted 71 lines
drivers/media/platform/s5p-fimc/fimc-isp-video.c new file +71
-0+static int isp_video_capture_open (struct file *file) +{ +struct fimc_isp *isp =video_drvdata (file); +int ret =0 ; + +if (mutex_lock_interruptible (&isp->video_lock)) +return -ERESTARTSYS ; + +/* ret = pm_runtime_get_sync(&isp->pdev->dev); */ +if (ret<0 ) + goto done; + + ret =v4l2_fh_open (file); +if (ret<0 ) + goto done; + +/* TODO: prepare video pipeline */ +done: +mutex_unlock (&isp->video_lock); +return ret; +} + +static int isp_video_capture_close (struct file *file) +{ +struct fimc_isp *isp =video_drvdata (file); +int ret =0 ; + +mutex_lock (&isp->video_lock); + +if (isp->out_path ==FIMC_IO_DMA ) { +/* TODO: stop capture, cleanup */ + } + +/* pm_runtime_put(&isp->pdev->dev); */ + +if (isp->ref_count ==0 ) +vb2_queue_release (&isp->capture_vb_queue); + + ret =v4l2_fh_release (file); + +mutex_unlock (&isp->video_lock); +return ret; +} + +static unsigned int isp_video_capture_poll (struct file *file, +struct poll_table_struct *wait) +{ +struct fimc_isp *isp =video_drvdata (file); +int ret; + +mutex_lock (&isp->video_lock); + ret =vb2_poll (&isp->capture_vb_queue, file, wait); +mutex_unlock (&isp->video_lock); +return ret; +} + +static int isp_video_capture_mmap (struct file *file,struct vm_area_struct *vma) +{ +struct fimc_isp *isp =video_drvdata (file); +int ret; + +if (mutex_lock_interruptible (&isp->video_lock)) +return -ERESTARTSYS ; + + ret =vb2_mmap (&isp->capture_vb_queue, vma); +mutex_unlock (&isp->video_lock); + +return ret; +} + +static const struct v4l2_file_operations isp_video_capture_fops = {Quoted 8 lines
drivers/media/platform/s5p-fimc/fimc-isp-video.c line 209
Quoted 6 lines
drivers/media/platform/s5p-fimc/fimc-isp-video.c new file +6
-0+ .owner = THIS_MODULE, + .open = isp_video_capture_open, + .release = isp_video_capture_close, + .poll = isp_video_capture_poll, + .unlocked_ioctl = video_ioctl2, + .mmap = isp_video_capture_mmap,Can't you use the helper functions vb2_fop_open/release/poll/mmap here?
Quoted 4 lines
It seems vb2_fop_mmap/poll can be used directly,
open(),release()are a bit more complicated as some media pipeline operations need to additionally be done within these callbacks. There is novb2_fop_open(), and AFAICSv4l2_fh_open()is sufficient and intended asopen()helper.
That's correct. Sorry for the misinformation about the non-existant vb2_fop_open.
Quoted 7 lines
For the next iteration I have used
vb2_fop_release(), called indirectly, as it nicely simplifies things a bit.BTW, shouldn't
vb2_fop_release()also be taking the lock ? Actually it is more useful for me in current form, but the drivers that directly assign it to structv4l2_file_operations::openmight be in trouble, unless I'm missing something.
I don't see where a lock would be needed. I don't see any concurrency here. Nobody else can mess with the queue as long as they are not the owner.
Quoted 62 lines
Quoted 6 lines
Quoted 6 lines
drivers/media/platform/s5p-fimc/fimc-isp-video.c new file +5
-0+}; + +/* +* Video node ioctl operations +*/ [...]
Quoted 39 lines
Quoted 39 lines
drivers/media/platform/s5p-fimc/fimc-isp-video.c new file +39
-0+static int fimc_isp_capture_streamon (struct file *file,void *priv, +enum v4l2_buf_type type) +{ +struct fimc_isp *isp =video_drvdata (file); +struct v4l2_subdev *sensor = isp->pipeline.subdevs[IDX_SENSOR ]; +struct fimc_pipeline *p =&isp->pipeline; +int ret; + +/* TODO: check if the OTF interface is not running */ + + ret =media_entity_pipeline_start (&sensor->entity, p->m_pipeline); +if (ret<0 ) +return ret; + + ret =fimc_isp_pipeline_validate (isp); +if (ret) { +media_entity_pipeline_stop (&sensor->entity); +return ret; + } + +return vb2_streamon (&isp->capture_vb_queue, type); +} + +static int fimc_isp_capture_streamoff (struct file *file,void *priv, +enum v4l2_buf_type type) +{ +struct fimc_isp *isp =video_drvdata (file); +struct v4l2_subdev *sd = isp->pipeline.subdevs[IDX_SENSOR ]; +int ret; + + ret =vb2_streamoff (&isp->capture_vb_queue, type); +if (ret ==0 ) +media_entity_pipeline_stop (&sd->entity); +return ret; +} + +static int fimc_isp_capture_reqbufs (struct file *file,void *priv, +struct v4l2_requestbuffers *reqbufs) +{Quoted 8 lines
drivers/media/platform/s5p-fimc/fimc-isp-video.c line 326
Quoted 5 lines
drivers/media/platform/s5p-fimc/fimc-isp-video.c new file +5
-0+struct fimc_isp *isp =video_drvdata (file); +int ret; + + reqbufs->count =max_t (u32,FIMC_IS_REQ_BUFS_MIN , reqbufs->count); + ret =vb2_reqbufs (&isp->capture_vb_queue, reqbufs);You probably want to call
vb2_ioctl_reqbufshere since that does additional ownership checks thatvb2_reqbufsdoesn't.Yes, thanks for the suggestion. That was actually helpful, previously it wasn't immediately clear to me one can still take advantage of those vb2_ioctl_* helpers, mainly have the ownership handling in the core, and have some handlers assigned directly to
v4l2_ioctl_opsan some called indirectly from the driver's own callbacks, should they need something else that is done in the helpers.
Quoted 3 lines
I found those helpers really useful, especially in drivers that need to support several video nodes. Lots of boilerplate can be eliminated. And also vb2_ops_wait_prepare/finish are a simple and nice improvement.
Glad to hear!
I still think there are some more improvements that could be made with some helper functions and perhaps some more fields: most (all?) drivers need a list for their active buffers, so I really think adding a struct list to vb2_buffer and a list for active buffers + a spinlock to vb2_queue would help.
Helper functions could then be added to handle that queue and also to set the timestamp and sequence fields. I would need to think more about the details, but after using vb2 for a while I see a lot of shared code between the various drivers.
Regards,
Hans
Quoted 23 lines
Quoted 1 line
The same is true for vb2_ioctl_streamon/off, BTW.
Indeed. I have already applied all possible helpers for the next iteration.
I need to yet resolve an issue with locking order, as I previously missed that media_entity_pipeline_start/stop() also takes the graph mutex.
And currently the driver is supposed to take the graph mutex first and then the video mutex. Since the
link_notifycallback of the media device is called with the graph mutex already held.The only solution I came up so far is to provide unlocked versions of media_entity_pipeline_start/stop().
Ideally using video mutex in
link_notify()callback should not be needed, but there are things done there needed for backward video device compatibility.--
Regards,
Sylwester
RFC PATCH 6/8 fimc-is: Add Exynos4x12 FIMC-IS device tree bindings documentation
In reply to Sylwester Nawrocki--- .../devicetree/bindings/media/exynos4-fimc-is.txt | 41 ++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/exynos4-fimc-is.txt
Documentation/devicetree/bindings/media/exynos4-fimc-is.txt new file +41 -0
@@ -0,0 +1,41 @@ +Exynos4x12 SoC series Imaging Subsystem (FIMC-IS) + +The FIMC-IS is an subsystem for processing image signal from an image sensor. +The Exynos4x12 SoC series FIMC-IS V1.5 comprises of a dedicated ARM Cortex-A5 +processor, ISP, DRC and FD IP blocks and peripheral IPs such as I2C, SPI, UART +bus controllers, Multi-PWM and ADC. + +fimc-is node +------------ + +Required properties: + +- compatible : should be "samsung,exynos4212-fimc-is" for Exynos4212 and + Exynos4412 SoCs; +- reg : physical base address and size of the device memory mapped + registers; +- interrupts : should contain FIMC-IS interrupts; + +The following are the FIMC-IS peripheral device nodes and can be specified +either standalone or as fimc-is child nodes. + +pmu subnode +----------- + +Required properties: + - reg : should contain PMU physical base address of the memory mapped + registers and size, the value of size should be 0x3000. + + +i2c-isp (ISP I2C bus controller) nodes +------------------------------------------ + +Required properties: + +- compatible : should be "samsung,exynos4212-i2c-isp" for Exynos4212 and + Exynos4412 SoCs; +- reg : physical base address and size of the device memory mapped + registers; + +For the above nodes it is required to specify a pinctrl state named "default", +according to the pinctrl bindings defined in ../pinctrl/pinctrl-bindings.txt.
Signature · 1 line
1.7.9.5
RFC PATCH 7/8 s5p-fimc: Add fimc-is subdevs registration
In reply to Sylwester NawrockiThis patch allows to register FIMC-IS device represented by FIMC-IS-ISP subdev to the top level media device driver. The use_isp platform data structure field allows to select whether the fimc-is ISP subdev should be tried to be registered or not.
--- drivers/media/platform/s5p-fimc/fimc-mdevice.c | 51 ++++++++++++++++++++++-- drivers/media/platform/s5p-fimc/fimc-mdevice.h | 15 +++++++ 2 files changed, 62 insertions(+), 4 deletions(-)
drivers/media/platform/s5p-fimc/fimc-mdevice.c +47 -4
@@ -31,6 +31,7 @@#include <media/s5p_fimc.h> #include "fimc-core.h" +#include "fimc-is.h" #include "fimc-lite.h" #include "fimc-mdevice.h" #include "mipi-csis.h"
@@ -85,9 +86,11 @@ static void fimc_pipeline_prepare(struct fimc_pipeline *p,case GRP_ID_FIMC :/* No need to control FIMC subdev through subdev ops */ break ; +case GRP_ID_FIMC_IS : + p->subdevs[IDX_IS_ISP ] = sd; +break ;default : -pr_warn ("%s: Unknown subdev grp_id: %#x\n" , - __func__, sd->grp_id); +break ; } me = &sd->entity;if (me->num_pads ==1 )
@@ -291,6 +294,7 @@ static void fimc_md_unregister_sensor(struct v4l2_subdev *sd)if (!client)return ; +v4l2_device_unregister_subdev (sd);if (!client->dev.of_node) {
@@ -341,7 +345,11 @@ static int fimc_md_of_add_sensor(struct fimc_md *fmd, goto mod_put;v4l2_set_subdev_hostdata (sd, si); - sd->grp_id =GRP_ID_SENSOR ; +if (si->pdata.fimc_bus_type ==FIMC_BUS_TYPE_ISP_WRITEBACK ) + sd->grp_id =GRP_ID_FIMC_IS_SENSOR ; +else + sd->grp_id =GRP_ID_SENSOR ; + si->subdev = sd;v4l2_info (&fmd->v4l2_dev,"Registered sensor subdevice: %s (%d)\n" , sd->name, fmd->num_sensors);
@@ -360,7 +368,7 @@ static int fimc_md_parse_port_node(struct fimc_md *fmd, struct device_node *port, unsigned int index) { -struct device_node *rem, *endpoint; +struct device_node *rem, *endpoint, *np;struct fimc_source_info *pd;struct v4l2_of_endpoint bus_cfg;u32 tmp, reg =0 ;
@@ -415,6 +423,18 @@ static int fimc_md_parse_port_node(struct fimc_md *fmd,v4l2_err (&fmd->v4l2_dev,"Wrong port id (%u) at node %s\n" , reg, rem->full_name); } +/* +* For FIMC-IS handled sensors, that are placed under fimc-is-i2c +* device node, FIMC is connected to the FIMC-IS through its ISP +* Writeback input. Sensors are attached to the FIMC-LITE hostdata +* interface directly or through MIPI-CSIS, depending on the external +* media bus used. This needs to be handled in a more reliable way, +* not by just checking parent's node name. +*/ +if ((np =of_get_parent (rem)) && !of_node_cmp (np->name,"i2c-isp" )) + pd->fimc_bus_type =FIMC_BUS_TYPE_ISP_WRITEBACK ; +else + pd->fimc_bus_type = pd->sensor_bus_type; ret =fimc_md_of_add_sensor (fmd, rem, index);of_node_put (rem);
@@ -607,6 +627,22 @@ static int register_csis_entity(struct fimc_md *fmd,return ret; } +static int register_fimc_is_entity (struct fimc_md *fmd,struct fimc_is *is) +{ +struct v4l2_subdev *sd = &is->isp.subdev; +int ret; + + ret =v4l2_device_register_subdev (&fmd->v4l2_dev, sd); +if (ret) { +v4l2_err (&fmd->v4l2_dev, +"Failed to register FIMC-ISP (%d)\n" , ret); +return ret; + } + + fmd->fimc_is = is; +return 0 ; +} +static int fimc_md_register_platform_entity (struct fimc_md *fmd,struct platform_device *pdev,int plat_entity)
@@ -634,6 +670,9 @@ static int fimc_md_register_platform_entity(struct fimc_md *fmd,case IDX_CSIS : ret =register_csis_entity (fmd, pdev, drvdata);break ; +case IDX_IS_ISP : + ret =register_fimc_is_entity (fmd, drvdata); +break ;default : ret = -ENODEV ; }
@@ -697,6 +736,8 @@ static int fimc_md_register_of_platform_entities(struct fimc_md *fmd,/* If driver of any entity isn't ready try all again later. */ if (!strcmp (node->name,CSIS_OF_NODE_NAME )) plat_entity =IDX_CSIS ; +else if (!strcmp (node->name,FIMC_IS_OF_NODE_NAME )) + plat_entity =IDX_IS_ISP ;else if (!strcmp (node->name,FIMC_LITE_OF_NODE_NAME )) plat_entity =IDX_FLITE ;else if (!strcmp (node->name,FIMC_OF_NODE_NAME ))
@@ -1271,6 +1312,8 @@ static int fimc_md_probe(struct platform_device *pdev) v4l2_dev->notify = fimc_sensor_notify;strlcpy (v4l2_dev->name,"s5p-fimc-md" ,sizeof (v4l2_dev->name)); + fmd->use_isp =fimc_md_is_isp_available (dev->of_node); + ret =v4l2_device_register (dev, &fmd->v4l2_dev);if (ret <0 ) {v4l2_err (v4l2_dev,"Failed to register v4l2_device: %d\n" , ret);
drivers/media/platform/s5p-fimc/fimc-mdevice.h +15 -0
@@ -12,6 +12,7 @@#include <linux/clk.h> #include <linux/platform_device.h> #include <linux/mutex.h> +#include <linux/of.h> #include <linux/pinctrl/consumer.h> #include <media/media-device.h> #include <media/media-entity.h>
@@ -81,6 +82,8 @@ struct fimc_sensor_info {* @camclk: external sensor clock information * @fimc: array of registered fimc devices * @pmf: handle to the CAMCLK clock control FIMC helper device +* @fimc_is: fimc-is data structure +* @use_isp: set to true when FIMC-IS subsystem is used * @media_dev: top level media device * @v4l2_dev: top level v4l2_device holding up the subdevs * @pdev: platform device this media device is hooked up into
@@ -99,6 +102,8 @@ struct fimc_md {struct fimc_lite *fimc_lite[FIMC_LITE_MAX_DEVS ];struct fimc_dev *fimc[FIMC_MAX_DEVS ];struct device *pmf; +struct fimc_is *fimc_is; +bool use_isp;struct media_device media_dev;struct v4l2_device v4l2_dev;struct platform_device *pdev;
@@ -137,4 +142,14 @@ static inline void fimc_md_graph_unlock(struct fimc_dev *fimc)int fimc_md_set_camclk (struct v4l2_subdev *sd,bool on); +#ifdef CONFIG_OF +static inline bool fimc_md_is_isp_available (struct device_node *node) +{ + node =of_get_child_by_name (node,FIMC_IS_OF_NODE_NAME ); +return node ?of_device_is_available (node) : false; +} +#else +#define fimc_md_is_isp_available (node) (false) +#endif /* CONFIG_OF */ +#endif
Signature · 1 line
1.7.9.5
RFC PATCH 8/8 s5p-fimc: Create media links for the FIMC-IS entities
In reply to Sylwester NawrockiCreate disabled links from the FIMC-LITE subdevs to the FIMC-IS-ISP subdev and from FIMC-IS-ISP to all FIMC subdevs.
--- drivers/media/platform/s5p-fimc/fimc-mdevice.c | 78 +++++++++++++++++++----- 1 file changed, 62 insertions(+), 16 deletions(-)
drivers/media/platform/s5p-fimc/fimc-mdevice.c +62 -16
@@ -807,9 +807,17 @@ static int __fimc_md_create_fimc_sink_links(struct fimc_md *fmd,struct fimc_sensor_info *s_info =NULL ;struct media_entity *sink;unsigned int flags =0 ; -int ret, i; +int i, ret =0 ; -for (i =0 ; i <FIMC_MAX_DEVS ; i++) { +if (sensor) { + s_info =v4l2_get_subdev_hostdata (sensor); +/* Skip direct FIMC links in the logical FIMC-IS sensor path */ +if (s_info && s_info->pdata.fimc_bus_type == +FIMC_BUS_TYPE_ISP_WRITEBACK ) + ret =1 ; + } + +for (i =0 ; !ret && i <FIMC_MAX_DEVS ; i++) {if (!fmd->fimc[i])continue ;/*
@@ -838,7 +846,7 @@ static int __fimc_md_create_fimc_sink_links(struct fimc_md *fmd,if (flags ==0 || sensor ==NULL )continue ; - s_info =v4l2_get_subdev_hostdata (sensor); +if (!WARN_ON (s_info ==NULL )) {unsigned long irq_flags;spin_lock_irqsave (&fmd->slock, irq_flags);
@@ -851,25 +859,20 @@ static int __fimc_md_create_fimc_sink_links(struct fimc_md *fmd,if (!fmd->fimc_lite[i])continue ; -if (link_mask & (1 << (i +FIMC_MAX_DEVS ))) - flags =MEDIA_LNK_FL_ENABLED ; -else - flags =0 ; - sink = &fmd->fimc_lite[i]->subdev.entity; ret =media_entity_create_link (source, pad, sink, -FLITE_SD_PAD_SINK , flags); +FLITE_SD_PAD_SINK ,0 );if (ret)return ret;/* Notify FIMC-LITE subdev entity */ ret =media_entity_call (sink, link_setup, &sink->pads[0 ], - &source->pads[pad], flags); + &source->pads[pad],0 );if (ret)break ; -v4l2_info (&fmd->v4l2_dev,"created link [%s] %c> [%s]\n" , - source->name, flags ?'=' :'-' , sink->name); +v4l2_info (&fmd->v4l2_dev,"created link [%s] -> [%s]\n" , + source->name, sink->name); }return 0 ; }
@@ -878,26 +881,59 @@ static int __fimc_md_create_fimc_sink_links(struct fimc_md *fmd,static int __fimc_md_create_flite_source_links (struct fimc_md *fmd) {struct media_entity *source, *sink; -unsigned int flags =MEDIA_LNK_FL_ENABLED ;int i, ret =0 ;for (i =0 ; i <FIMC_LITE_MAX_DEVS ; i++) {struct fimc_lite *fimc = fmd->fimc_lite[i]; +if (fimc ==NULL )continue ; + source = &fimc->subdev.entity; sink = &fimc->vfd.entity;/* FIMC-LITE's subdev and video node */ ret =media_entity_create_link (source,FLITE_SD_PAD_SOURCE_DMA , - sink,0 , flags); + sink,0 ,0 ); +if (ret) +break ; +/* Link from FIMC-LITE to IS-ISP subdev */ + sink = &fmd->fimc_is->isp.subdev.entity; + ret =media_entity_create_link (source,FLITE_SD_PAD_SOURCE_ISP , + sink,0 ,0 );if (ret)break ; -/* TODO: create links to other entities */ }return ret; } +/* Create FIMC-IS links */ +static int __fimc_md_create_fimc_is_links (struct fimc_md *fmd) +{ +struct media_entity *source, *sink; +int i, ret; + + source = &fmd->fimc_is->isp.subdev.entity; + +for (i =0 ; i <FIMC_MAX_DEVS ; i++) { +if (fmd->fimc[i] ==NULL ) +continue ; + +/* Link from IS-ISP subdev to FIMC */ + sink = &fmd->fimc[i]->vid_cap.subdev.entity; + ret =media_entity_create_link (source,FIMC_IS_SD_PAD_SRC_FIFO , + sink,FIMC_SD_PAD_SINK_FIFO ,0 ); +if (ret) +return ret; + } + +/* Link from IS-ISP subdev to is.isp capture video node */ + sink = &fmd->fimc_is->isp.vfd.entity; + ret =media_entity_create_link (source,FIMC_IS_SD_PAD_SRC_DMA , + sink,0 ,0 ); +return ret; +} +/** * fimc_md_create_links - create default links between registered entities *
@@ -980,6 +1016,7 @@ static int fimc_md_create_links(struct fimc_md *fmd)for (i =0 ; i <CSIS_MAX_ENTITIES ; i++) {if (fmd->csis[i].sd ==NULL )continue ; + source = &fmd->csis[i].sd->entity; pad =CSIS_PAD_SOURCE ; sensor = csi_sensors[i];
@@ -994,15 +1031,24 @@ static int fimc_md_create_links(struct fimc_md *fmd)for (i =0 ; i <FIMC_MAX_DEVS ; i++) {if (!fmd->fimc[i])continue ; + source = &fmd->fimc[i]->vid_cap.subdev.entity; sink = &fmd->fimc[i]->vid_cap.vfd.entity; + ret =media_entity_create_link (source,FIMC_SD_PAD_SOURCE , sink,0 , flags);if (ret)break ; } -return __fimc_md_create_flite_source_links (fmd); + ret =__fimc_md_create_flite_source_links (fmd); +if (ret <0 ) +return ret; + +if (fmd->use_isp) + ret =__fimc_md_create_fimc_is_links (fmd); + +return ret; }/*
Signature · 1 line
1.7.9.5