From: Marek Szyprowski Date: Thu, 6 Aug 2015 13:21:55 +0000 (+0200) Subject: fimc-is: Remove unused code X-Git-Tag: accepted/tizen/unified/20190330.030053~312 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=db5cc61cd6d506e956e45c54b187816acfb3203f;p=platform%2Fkernel%2Flinux-exynos.git fimc-is: Remove unused code - remove unused sensor driver code - remove dead code for non-Exynos5433 SoCs - remove USE_OWN_FAULT_HANDLER support - remove ENABLE_CLOCK_GATE support - remove ENABLE_DVFS support - remove completely dead code - remove unused conditional code - remove pm qos support - remove ncp6335b support (unused) Change-Id: Ibf4ca12f72642da12082f0d1bccd37b9eda04962 Signed-off-by: Marek Szyprowski --- diff --git a/drivers/media/platform/exynos/fimc-is/Kconfig b/drivers/media/platform/exynos/fimc-is/Kconfig index 2c2bd68..13ce508 100644 --- a/drivers/media/platform/exynos/fimc-is/Kconfig +++ b/drivers/media/platform/exynos/fimc-is/Kconfig @@ -48,135 +48,15 @@ config USE_VENDER_FEATURE default n help Enable to use the vender. -config CAMERA_SENSOR_8B1 - bool "Use 8B1 camera sensor" - depends on VIDEO_EXYNOS_FIMC_IS - default n - help - Use 8B1 camera sensor. -config CAMERA_SENSOR_6D1 - bool "Use 6D1 camera sensor" - depends on VIDEO_EXYNOS_FIMC_IS - default n - help - Use 6D1 camera sensor. -config CAMERA_SENSOR_8B1_OBJ - bool "Use 8B1 camera sensor" - depends on VIDEO_EXYNOS_FIMC_IS - default n - help - Use to build 8B1 camera sensor. config CAMERA_SENSOR_6D1_OBJ bool "Use 6D1 camera sensor" depends on VIDEO_EXYNOS_FIMC_IS default n help Use to build 6D1 camera sensor. -config CAMERA_SENSOR_6B2_OBJ - bool "Use 6B2 camera sensor" - depends on VIDEO_EXYNOS_FIMC_IS - default n - help - Use to build 6B2 camera sensor. -config CAMERA_SENSOR_6A3_OBJ - bool "Use 6A3 camera sensor" - depends on VIDEO_EXYNOS_FIMC_IS - default n - help - Use to build 6A3 camera sensor. -config CAMERA_SENSOR_IMX135_OBJ - bool "Use IMX135 camera sensor" - depends on VIDEO_EXYNOS_FIMC_IS - default n - help - Use to build IMX135 camera sensor. -config CAMERA_SENSOR_IMX134_OBJ - bool "Use IMX134 camera sensor" - depends on VIDEO_EXYNOS_FIMC_IS - default n - help - Use to build IMX134 camera sensor. -config CAMERA_SENSOR_3L2_OBJ - bool "Use 3L2 camera sensor" - depends on VIDEO_EXYNOS_FIMC_IS - default n - help - Use to build 3L2 camera sensor. -config CAMERA_SENSOR_2P2_OBJ - bool "Use 2P2 camera sensor" - depends on VIDEO_EXYNOS_FIMC_IS - default n - help - Use to build 2P2 camera sensor. -config CAMERA_SENSOR_2P2_12M_OBJ - bool "Use 2P2_12M camera sensor" - depends on VIDEO_EXYNOS_FIMC_IS - default n - help - Use to build 2P2_12M camera sensor. -config CAMERA_SENSOR_2P3_OBJ - bool "Use 2P3 camera sensor" - depends on VIDEO_EXYNOS_FIMC_IS - default n - help - Use to build 2P3 camera sensor. -config CAMERA_SENSOR_3H5_OBJ - bool "Use 3H5 camera sensor" - depends on VIDEO_EXYNOS_FIMC_IS - default n - help - Use to build 3H5 camera sensor. -config CAMERA_SENSOR_3H7_OBJ - bool "Use 3H7 camera sensor" - depends on VIDEO_EXYNOS_FIMC_IS - default n - help - Use to build 3H7 camera sensor. -config CAMERA_SENSOR_3H7_SUNNY_OBJ - bool "Use 3H7_SUNNY camera sensor" - depends on VIDEO_EXYNOS_FIMC_IS - default n - help - Use to build 3H7_SUNNY camera sensor. -config CAMERA_SENSOR_4E5_OBJ - bool "Use 4E5 camera sensor" - depends on VIDEO_EXYNOS_FIMC_IS - default n - help - Use to build 4E5 camera sensor. -config CAMERA_SENSOR_IMX175_OBJ - bool "Use IMX175 camera sensor" - depends on VIDEO_EXYNOS_FIMC_IS - default n - help - Use to build IMX175 camera sensor. -config CAMERA_SENSOR_IMX219_OBJ - bool "Use IMX219 camera sensor" - depends on VIDEO_EXYNOS_FIMC_IS - default n - help - Use to build IMX219 camera sensor. config CAMERA_SENSOR_IMX240_OBJ bool "Use IMX240 camera sensor" depends on VIDEO_EXYNOS_FIMC_IS default n help Use to build IMX240 camera sensor. -config CAMERA_SENSOR_4H5_OBJ - bool "Use 4H5 camera sensor" - depends on VIDEO_EXYNOS_FIMC_IS - default n - help - Use to build 4H5 camera sensor. -config CAMERA_SENSOR_SR261_OBJ - bool "Use SR261 camera sensor" - depends on VIDEO_EXYNOS_FIMC_IS - default n - help - Use to build SR261 camera sensor. -config CAMERA_SENSOR_TEMP - bool "camera sensor temp" - depends on VIDEO_EXYNOS_FIMC_IS - default n - help - Use to build camera sensor temp. diff --git a/drivers/media/platform/exynos/fimc-is/Makefile b/drivers/media/platform/exynos/fimc-is/Makefile index f2ab2a3..a4767f8 100644 --- a/drivers/media/platform/exynos/fimc-is/Makefile +++ b/drivers/media/platform/exynos/fimc-is/Makefile @@ -21,9 +21,7 @@ fimc-is-objs := fimc-is-core.o \ fimc-is-device-ischain.o \ fimc-is-interface.o \ fimc-is-time.o \ - fimc-is-dvfs.o \ - fimc-is-dt.o \ - fimc-is-clk-gate.o + fimc-is-dt.o obj-$(CONFIG_USE_VENDER_FEATURE) := fimc-is-spi.o \ fimc-is-sec-define.o \ @@ -31,7 +29,6 @@ obj-$(CONFIG_USE_VENDER_FEATURE) := fimc-is-spi.o \ obj-$(CONFIG_COMPANION_USE) += fimc-is-companion.o \ fimc-is-fan53555.o \ - fimc-is-ncp6335b.o \ fimc-is-companion-dt.o \ fimc-is-device-companion.o \ fimc-is-video-companion.o @@ -46,21 +43,5 @@ obj-$(CONFIG_AF_HOST_CONTROL) += fimc-is-device-af.o obj-$(CONFIG_CAMERA_EEPROM_SUPPORT_REAR) += fimc-is-device-eeprom.o obj-$(CONFIG_CAMERA_EEPROM_SUPPORT_FRONT) += fimc-is-device-eeprom.o -obj-$(CONFIG_CAMERA_SENSOR_6B2_OBJ) += sensor/fimc-is-device-6b2.o -obj-$(CONFIG_CAMERA_SENSOR_8B1_OBJ) += sensor/fimc-is-device-8b1.o obj-$(CONFIG_CAMERA_SENSOR_6D1_OBJ) += sensor/fimc-is-device-6d1.o -obj-$(CONFIG_CAMERA_SENSOR_IMX134_OBJ) += sensor/fimc-is-device-imx134.o -obj-$(CONFIG_CAMERA_SENSOR_IMX135_OBJ) += sensor/fimc-is-device-imx135.o -obj-$(CONFIG_CAMERA_SENSOR_3L2_OBJ) += sensor/fimc-is-device-3l2.o -obj-$(CONFIG_CAMERA_SENSOR_2P2_OBJ) += sensor/fimc-is-device-2p2.o -obj-$(CONFIG_CAMERA_SENSOR_2P2_12M_OBJ) += sensor/fimc-is-device-2p2_12m.o -obj-$(CONFIG_CAMERA_SENSOR_2P3_OBJ) += sensor/fimc-is-device-2p3.o -obj-$(CONFIG_CAMERA_SENSOR_3H5_OBJ) += sensor/fimc-is-device-3h5.o -obj-$(CONFIG_CAMERA_SENSOR_3H7_OBJ) += sensor/fimc-is-device-3h7.o -obj-$(CONFIG_CAMERA_SENSOR_3H7_SUNNY_OBJ) += sensor/fimc-is-device-3h7_sunny.o -obj-$(CONFIG_CAMERA_SENSOR_4E5_OBJ) += sensor/fimc-is-device-4e5.o -obj-$(CONFIG_CAMERA_SENSOR_6A3_OBJ) += sensor/fimc-is-device-6a3.o -obj-$(CONFIG_CAMERA_SENSOR_IMX175_OBJ) += sensor/fimc-is-device-imx175.o obj-$(CONFIG_CAMERA_SENSOR_IMX240_OBJ) += sensor/fimc-is-device-imx240.o -obj-$(CONFIG_CAMERA_SENSOR_IMX219_OBJ) += sensor/fimc-is-device-imx219.o -obj-$(CONFIG_CAMERA_SENSOR_4H5_OBJ) += sensor/fimc-is-device-4h5.o \ No newline at end of file diff --git a/drivers/media/platform/exynos/fimc-is/exynos-fimc-is-sensor.h b/drivers/media/platform/exynos/fimc-is/exynos-fimc-is-sensor.h index 2e1ffda..85b1515 100644 --- a/drivers/media/platform/exynos/fimc-is/exynos-fimc-is-sensor.h +++ b/drivers/media/platform/exynos/fimc-is/exynos-fimc-is-sensor.h @@ -241,7 +241,6 @@ struct exynos_sensor_pin { int voltage; }; -#ifdef CONFIG_USE_VENDER_FEATURE #define SET_PIN(p, id1, id2, n, _pin, _value, _name, _time, _act) \ (p)->pin_ctrls[id1][id2][n].pin = _pin; \ (p)->pin_ctrls[id1][id2][n].delay = _time; \ @@ -249,13 +248,6 @@ struct exynos_sensor_pin { (p)->pin_ctrls[id1][id2][n].name = _name; \ (p)->pin_ctrls[id1][id2][n].act = _act; \ (p)->pin_ctrls[id1][id2][n].voltage = 0; -#else -#define SET_PIN(d, s, c, i, p , v, n, a) \ - (d)->pin_ctrls[s][c][i].pin = p; \ - (d)->pin_ctrls[s][c][i].value = v; \ - (d)->pin_ctrls[s][c][i].name = n; \ - (d)->pin_ctrls[s][c][i].act = a; -#endif /* * struct exynos_platform_fimc_is_sensor - platform data for exynos_sensor driver @@ -282,9 +274,7 @@ struct exynos_platform_fimc_is_sensor { u32 is_softlanding; u32 sensor_id; bool companion_use_pmic; -#ifdef CONFIG_OIS_USE int pin_ois_en; -#endif struct pinctrl *pinctrl; }; diff --git a/drivers/media/platform/exynos/fimc-is/exynos-fimc-is.h b/drivers/media/platform/exynos/fimc-is/exynos-fimc-is.h index 3d095df..064842c 100644 --- a/drivers/media/platform/exynos/fimc-is/exynos-fimc-is.h +++ b/drivers/media/platform/exynos/fimc-is/exynos-fimc-is.h @@ -15,9 +15,6 @@ #define FIMC_IS_DECLARE_QOS_ENUM(__TYPE) enum FIMC_IS_DVFS_ ## __TYPE ## _LV_IDX #include -#if defined(CONFIG_ARCH_EXYNOS4) -#include -#endif #define FIMC_IS_DEV_NAME "exynos-fimc-is" #include @@ -164,44 +161,6 @@ struct exynos_fimc_is_subip_info { struct exynos_fimc_is_subip_ext _pwm; }; -/* - * struct exynos_fimc_is_clk_gate_group - * This struct is for host clock gating. - * It decsribes register, masking bit info and other control for each group. - * If you uses host clock gating, You must define this struct in exynos_fimc_is_clk_gate_info. - */ -struct exynos_fimc_is_clk_gate_group { - u32 mask_clk_on_org; /* masking value in clk on */ - u32 mask_clk_on_mod; /* masking value in clk on */ - u32 mask_clk_off_self_org; /* masking value in clk off(not depend) original */ - u32 mask_clk_off_self_mod; /* masking value in clk off(not depend) final */ - u32 mask_clk_off_depend; /* masking value in clk off(depend on other grp) */ - u32 mask_cond_for_depend; /* masking group having dependancy for other */ -}; - -/* - * struct exynos_fimc_is_clk_gate_info - * This struct is for host clock gating. - * It has exynos_fimc_is_clk_gate_group to control each group's clk gating. - * And it has function pointer to include user scenario masking - */ -struct exynos_fimc_is_clk_gate_info { - const char *gate_str[FIMC_IS_CLK_GATE_MAX]; /* register adr for gating */ - struct exynos_fimc_is_clk_gate_group groups[FIMC_IS_GRP_MAX]; - /* You must set this function pointer (on/off) */ - int (*clk_on_off)(u32 clk_gate_id, bool is_on); - /* - * if there are specific scenarios for clock gating, - * You can define user function. - * user_scenario_id will be in - */ - int (*user_clk_gate)(u32 group_id, - bool is_on, - u32 user_scenario_id, - unsigned long msk_state, - struct exynos_fimc_is_clk_gate_info *gate_info); -}; - /** * struct exynos_platform_fimc_is - camera host interface platform data * @@ -218,25 +177,10 @@ struct exynos_platform_fimc_is { int (*print_cfg)(struct platform_device *pdev, u32 channel); int (*print_pwr)(struct platform_device *pdev); - /* These fields are to return qos value for dvfs scenario */ - u32 *int_qos_table; - u32 *mif_qos_table; - u32 *i2c_qos_table; - int (*get_int_qos)(int scenario_id); - int (*get_mif_qos)(int scenario_id); - int (*get_i2c_qos)(int scenario_id); - u32 dvfs_data[FIMC_IS_SN_END][FIMC_IS_DVFS_END]; - - /* For host clock gating */ - struct exynos_fimc_is_clk_gate_info *gate_info; -#ifdef CONFIG_COMPANION_USE u32 companion_spi_channel; bool use_two_spi_line; -#endif u32 use_sensor_dynamic_voltage_mode; -#ifdef CONFIG_OIS_USE bool use_ois; -#endif /* CONFIG_OIS_USE */ bool use_ois_hsi2c; bool use_module_check; }; @@ -247,8 +191,6 @@ extern void exynos_fimc_is_set_platdata(struct exynos_platform_fimc_is *pd); int fimc_is_set_parent_dt(struct platform_device *pdev, const char *child, const char *parent); -struct clk *fimc_is_get_parent_dt(struct platform_device *pdev, - const char *child); int fimc_is_set_rate_dt(struct platform_device *pdev, const char *conid, unsigned int rate); unsigned int fimc_is_get_rate_dt(struct platform_device *pdev, @@ -259,32 +201,13 @@ void fimc_is_disable_dt(struct platform_device *pdev, const char *conid); /* platform specific clock functions */ -#if defined(CONFIG_ARCH_EXYNOS4) -/* exynos 4 */ -extern int exynos4_fimc_is_cfg_clk(struct platform_device *pdev); -extern int exynos4_fimc_is_clk_on(struct platform_device *pdev); -extern int exynos4_fimc_is_clk_off(struct platform_device *pdev); -extern int exynos4_fimc_is_sensor_clock_on(struct platform_device *pdev, u32 source); -extern int exynos4_fimc_is_sensor_clock_off(struct platform_device *pdev, u32 source); -extern int exynos4_fimc_is_sensor_power_on(struct platform_device *pdev, int sensor_id); -extern int exynos4_fimc_is_sensor_power_off(struct platform_device *pdev, int sensor_id); -extern int exynos4_fimc_is_print_cfg(struct platform_device *pdev, u32 channel); -extern int exynos4_fimc_is_cfg_gpio(struct platform_device *pdev, int channel, bool flag_on); -#else /* exynos 4 */ /* exynos 5 */ extern int exynos_fimc_is_cfg_clk(struct platform_device *pdev); extern int exynos_fimc_is_cfg_cam_clk(struct platform_device *pdev); extern int exynos_fimc_is_clk_on(struct platform_device *pdev); extern int exynos_fimc_is_clk_off(struct platform_device *pdev); extern int exynos_fimc_is_print_clk(struct platform_device *pdev); -extern int exynos_fimc_is_set_user_clk_gate(u32 group_id, bool is_on, u32 user_scenario_id, - unsigned long msk_state, - struct exynos_fimc_is_clk_gate_info *gate_info); -extern int exynos_fimc_is_clk_gate(u32 clk_gate_id, bool is_on); -extern int exynos_fimc_is_sensor_power_on(struct platform_device *pdev, int sensor_id); -extern int exynos_fimc_is_sensor_power_off(struct platform_device *pdev, int sensor_id); extern int exynos_fimc_is_print_cfg(struct platform_device *pdev, u32 channel); extern int exynos_fimc_is_print_pwr(struct platform_device *pdev); -#endif /* exynos 5*/ #endif /* EXYNOS_FIMC_IS_H_ */ diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-clk-gate.c b/drivers/media/platform/exynos/fimc-is/fimc-is-clk-gate.c deleted file mode 100644 index 47b1b71..0000000 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-clk-gate.c +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Samsung Exynos SoC series FIMC-IS driver - * - * exynos fimc-is core functions - * - * Copyright (c) 2013 Samsung Electronics Co., Ltd - * - * 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 "fimc-is-clk-gate.h" - -int fimc_is_clk_gate_init(struct fimc_is_core *core) -{ - struct fimc_is_clk_gate_ctrl *gate_ctrl; - - pr_info("%s\n", __func__); - - if (!core) { - err("core is NULL\n"); - return -EINVAL; - } - - gate_ctrl = &core->resourcemgr.clk_gate_ctrl; - memset(gate_ctrl, 0x0, sizeof(struct fimc_is_clk_gate_ctrl)); - - /* init spin_lock for clock gating */ - spin_lock_init(&gate_ctrl->lock); - core->resourcemgr.clk_gate_ctrl.gate_info = core->pdata->gate_info; - - /* ISSR53 is clock gating debugging region. - * High means clock on state. - * To prevent telling A5 wrong clock off state, - * clock on state should be set before clock off is set. - */ - writel(0xFFFFFFFF, core->ischain[0].interface->regs + ISSR53); - - return 0; -} - -int fimc_is_clk_gate_lock_set(struct fimc_is_core *core, u32 instance, u32 is_start) -{ - spin_lock(&core->resourcemgr.clk_gate_ctrl.lock); - core->resourcemgr.clk_gate_ctrl.msk_lock_by_ischain[instance] = is_start; - spin_unlock(&core->resourcemgr.clk_gate_ctrl.lock); - return 0; -} - -#if 0 -/* This function may be used when clk_enable api will be faster than now */ -int fimc_is_clk_gate_reg_set(struct fimc_is_core *core, - bool is_on, const char* gate_str, u32 clk_gate_id, - struct exynos_fimc_is_clk_gate_info *gate_info) -{ - struct platform_device *pdev = core->pdev; - if (is_on) { - if (gate_info->clk_on(pdev, gate_str) < 0) { - pr_err("%s: could not enable %s\n", __func__, gate_str); - return -EINVAL; - } - } else { - if (gate_info->clk_off(pdev, gate_str) < 0) { - pr_err("%s: could not disable %s\n", __func__, gate_str); - return -EINVAL; - } - } - return 0; -} -#endif - -int fimc_is_wrap_clk_gate_set(struct fimc_is_core *core, - int msk_group_id, bool is_on) -{ - int i; - - for (i = 0; i < FIMC_IS_GRP_MAX; i++) { - if (msk_group_id & (1 << i)) - fimc_is_clk_gate_set(core, i, is_on, true, false); - } - - return 0; -} - -inline bool fimc_is_group_otf(struct fimc_is_device_ischain *device, int group_id) -{ - struct fimc_is_group *group; - - switch (group_id) { - case GROUP_ID_3A0: - case GROUP_ID_3A1: - group = &device->group_3aa; - break; - case GROUP_ID_ISP: - group = &device->group_isp; - break; - case GROUP_ID_DIS: - group = &device->group_dis; - break; - default: - group = NULL; - pr_err("%s unresolved group id %d", __func__, group_id); - return false; - } - - if (test_bit(FIMC_IS_GROUP_OTF_INPUT, &group->state)) - return true; - else - return false; -} - -int fimc_is_clk_gate_set(struct fimc_is_core *core, - int group_id, bool is_on, bool skip_set_state, bool user_scenario) -{ - int ret = 0; - int cfg = 0; - int i; - struct fimc_is_clk_gate_ctrl *gate_ctrl; - struct exynos_fimc_is_clk_gate_info *gate_info; - u32 mask_on, mask_off, mask_cond_depend; - - gate_ctrl = &core->resourcemgr.clk_gate_ctrl; - gate_info = gate_ctrl->gate_info; - - pr_debug("%s in\n", __func__); - spin_lock(&gate_ctrl->lock); - - /* Set State */ - if (is_on) { - if (skip_set_state == false) { - (gate_ctrl->chk_on_off_cnt[group_id])++; /* for debuging */ - (gate_ctrl->msk_cnt[group_id])++; - set_bit(group_id, &gate_ctrl->msk_state); - } - gate_info->groups[group_id].mask_clk_on_mod = - gate_info->groups[group_id].mask_clk_on_org; - } else { - (gate_ctrl->chk_on_off_cnt[group_id])--; /* for debuging */ - (gate_ctrl->msk_cnt[group_id])--; - if ((gate_ctrl->msk_cnt[group_id]) < 0) { - pr_warn("%s msk_cnt[%d] is lower than zero !!\n", __func__, group_id); - (gate_ctrl->msk_cnt[group_id]) = 0; - } - if ((gate_ctrl->msk_cnt[group_id]) == 0) - clear_bit(group_id, &gate_ctrl->msk_state); - /* if there's some processing group shot, don't clock off */ - if (test_bit(group_id, &gate_ctrl->msk_state)) - goto exit; - gate_info->groups[group_id].mask_clk_off_self_mod = - gate_info->groups[group_id].mask_clk_off_self_org; - } - - /* Don't off!! when other instance opening/closing */ - if (is_on == false) { - for (i = 0; i < FIMC_IS_MAX_NODES; i++) { - if ((!test_bit(FIMC_IS_ISCHAIN_REPROCESSING, &core->ischain[i].state)) && - (gate_ctrl->msk_lock_by_ischain[i])) { - pr_info("%s lock(on) due to instance(%d)\n", __func__, i); - goto exit; - } - /* don't off! if there is at least this group that is OTF */ - if (fimc_is_group_otf(&core->ischain[i], group_id)) { - pr_debug("%s don't off!! this instance(%d) group(%d) is OTF\n", - __func__, i, group_id); - goto exit; - } - } - } - - /* Check user scenario */ - if (user_scenario && gate_info->user_clk_gate) { - if (fimc_is_set_user_clk_gate(group_id, - core, - is_on, - gate_ctrl->msk_state, - gate_info) < 0) { - pr_debug("%s user scenario is skip!! [%d] !!\n", __func__, group_id); - goto exit; - } - } - - /* Get the region for clock gating debug */ - cfg = readl(core->ischain[0].interface->regs + ISSR53); - - /* Get Mask of self-on/off */ - if (is_on) - mask_on = gate_info->groups[group_id].mask_clk_on_mod; - else - mask_off = gate_info->groups[group_id].mask_clk_off_self_mod; - - /* Clock on */ - if (is_on && ((gate_ctrl->msk_clk_on_off_state) != mask_on)) { - cfg |= (mask_on << 16); /* shortly before clock on */ - writel(cfg, core->ischain[0].interface->regs + ISSR53); - - ret = gate_info->clk_on_off(mask_on, is_on); - gate_ctrl->msk_clk_on_off_state |= mask_on; - - cfg |= (mask_on); /* after clock on */ - writel(cfg, core->ischain[0].interface->regs + ISSR53); - } - - /* Clock off and check dependancy (it's for only clock-off) */ - if (is_on == false) { - mask_cond_depend = gate_info->groups[group_id].mask_cond_for_depend; - /* check dependancy */ - if (mask_cond_depend > 0 && - (mask_cond_depend & (gate_ctrl->msk_state))) { - mask_off |= gate_info->groups[group_id].mask_clk_off_depend; - } - /* clock off */ - if (((gate_ctrl->msk_clk_on_off_state) & mask_off) > 0) { - cfg &= ~(mask_off << 16); /* shortly before clock off */ - writel(cfg, core->ischain[0].interface->regs + ISSR53); - - ret = gate_info->clk_on_off(mask_off, is_on); - gate_ctrl->msk_clk_on_off_state &= ~(mask_off); - - cfg &= ~(mask_off); /* after clock off */ - writel(cfg, core->ischain[0].interface->regs + ISSR53); - } - } -exit: - spin_unlock(&gate_ctrl->lock); - pr_debug("%s out\n", __func__); - - return ret; -} - -int fimc_is_set_user_clk_gate(u32 group_id, - struct fimc_is_core *core, - bool is_on, - unsigned long msk_state, - struct exynos_fimc_is_clk_gate_info *gate_info) -{ - u32 user_scenario_id = 0; - - /* deside what user scenario is */ -#if defined(ENABLE_FULL_BYPASS) - if (group_id == GROUP_ID_ISP) - user_scenario_id = CLK_GATE_FULL_BYPASS_SN; -#else - if (group_id == GROUP_ID_ISP) - user_scenario_id = CLK_GATE_NOT_FULL_BYPASS_SN; - -#endif - if (group_id == GROUP_ID_ISP && - test_bit(FIMC_IS_SUBDEV_START, - &core->ischain[0].dis.state)) - user_scenario_id = CLK_GATE_DIS_SN; - - if (gate_info->user_clk_gate(group_id, - is_on, - user_scenario_id, - msk_state, - gate_info) < 0) { - pr_err("%s user_clk_gate failed(%d) !!\n", __func__, group_id); - } - - return 0; -} - diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-clk-gate.h b/drivers/media/platform/exynos/fimc-is/fimc-is-clk-gate.h deleted file mode 100644 index 79b9de6..0000000 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-clk-gate.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Samsung Exynos5 SoC series FIMC-IS driver - * - * - * Copyright (c) 2011 Samsung Electronics Co., Ltd - * - * 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_CLK_GATE_H -#define FIMC_IS_CLK_GATE_H - -#include -#include -#include -#include - -#include "fimc-is-time.h" -#include "fimc-is-core.h" -#include "fimc-is-param.h" -#include "fimc-is-cmd.h" -#include "fimc-is-regs.h" -#include "fimc-is-err.h" -#include "fimc-is-video.h" -#include "fimc-is-groupmgr.h" -#include "fimc-is-device-ischain.h" - -int fimc_is_clk_gate_init(struct fimc_is_core *core); -int fimc_is_clk_gate_lock_set(struct fimc_is_core *core, u32 instance, u32 is_start); -int fimc_is_clk_gate_reg_set(struct fimc_is_core *core, - bool is_on, const char* gate_str, u32 clk_gate_id, - struct exynos_fimc_is_clk_gate_info *gate_info); -/* For several groups */ -int fimc_is_wrap_clk_gate_set(struct fimc_is_core *core, - int msk_group_id, bool is_on); -/* For only single group */ -int fimc_is_clk_gate_set(struct fimc_is_core *core, - int group_id, bool is_on, bool skip_set_state, bool user_scenario); - -int fimc_is_set_user_clk_gate(u32 group_id, - struct fimc_is_core *core, - bool is_on, - unsigned long msk_state, - struct exynos_fimc_is_clk_gate_info *gate_info); - -#endif diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-companion-dt.c b/drivers/media/platform/exynos/fimc-is/fimc-is-companion-dt.c index 34ab6d5..4756e18 100644 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-companion-dt.c +++ b/drivers/media/platform/exynos/fimc-is/fimc-is-companion-dt.c @@ -14,14 +14,11 @@ #include "exynos-fimc-is-sensor.h" #include "exynos-fimc-is.h" #include "media/exynos_mc.h" -#ifdef CONFIG_OF #include -#endif #include "fimc-is-dt.h" #include "fimc-is-companion-dt.h" -#ifdef CONFIG_OF int fimc_is_sensor_parse_dt_with_companion(struct platform_device *pdev) { int ret = 0; @@ -219,5 +216,4 @@ p_err: kfree(pdata); return ret; } -#endif diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-companion.c b/drivers/media/platform/exynos/fimc-is/fimc-is-companion.c index 691d0af..c6d05b5 100644 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-companion.c +++ b/drivers/media/platform/exynos/fimc-is/fimc-is-companion.c @@ -55,7 +55,6 @@ static u16 companion_ver; static u32 concord_fw_size; char companion_crc[10]; -#if 1 static int fimc_is_comp_spi_read(struct spi_device *spi, void *buf, u16 rx_addr, size_t size) { @@ -92,7 +91,6 @@ static int fimc_is_comp_spi_read(struct spi_device *spi, } else return 0; } -#endif static int fimc_is_comp_spi_single_write(struct spi_device *spi, u16 addr, u16 data) { @@ -172,38 +170,7 @@ p_err: return ret; } -#if 0 -static int fimc_is_comp_i2c_read(struct i2c_client *client, u16 addr, u16 *data) -{ - int err; - u8 rxbuf[2], txbuf[2]; - struct i2c_msg msg[2]; - - rxbuf[0] = (addr & 0xff00) >> 8; - rxbuf[1] = (addr & 0xff); - - msg[0].addr = client->addr; - msg[0].flags = 0; - msg[0].len = 2; - msg[0].buf = rxbuf; - - msg[1].addr = client->addr; - msg[1].flags = I2C_M_RD; - msg[1].len = 2; - msg[1].buf = txbuf; - - err = i2c_transfer(client->adapter, msg, 2); - if (unlikely(err != 2)) { - pr_err("%s: register read fail\n", __func__); - return -EIO; - } - - *data = ((txbuf[0] << 8) | txbuf[1]); - return 0; -} -#endif -#ifndef USE_SPI static int fimc_is_comp_i2c_write(struct i2c_client *client ,u16 addr, u16 data) { int retries = I2C_RETRY_COUNT; @@ -221,9 +188,6 @@ static int fimc_is_comp_i2c_write(struct i2c_client *client ,u16 addr, u16 data) buf[2] = data >> 8; buf[3] = data & 0xff; -#if 0 - pr_info("%s : W(0x%02X%02X%02X%02X)\n",__func__, buf[0], buf[1], buf[2], buf[3]); -#endif do { ret = i2c_transfer(client->adapter, &msg, 1); @@ -247,18 +211,10 @@ static int fimc_is_comp_i2c_write(struct i2c_client *client ,u16 addr, u16 data) return 0; } -#endif static int fimc_is_comp_single_write(struct fimc_is_core *core , u16 addr, u16 data) { int ret = 0; -#ifdef USE_SPI - struct spi_device *spi = core->spi1; - ret = fimc_is_comp_spi_single_write(spi, addr, data); - if (ret) { - err("spi_single_write() fail"); - } -#else struct i2c_client *client = core->client0; fimc_is_s_int_comb_isp(core, true, INTMR2_INTMCIS22); /* interrupt on */ ret = fimc_is_comp_i2c_write(client, addr, data); @@ -266,7 +222,6 @@ static int fimc_is_comp_single_write(struct fimc_is_core *core , u16 addr, u16 d err("i2c write fail"); } fimc_is_s_int_comb_isp(core, false, INTMR2_INTMCIS22); /* interrupt off */ -#endif return ret; } @@ -274,23 +229,12 @@ static int fimc_is_comp_single_write(struct fimc_is_core *core , u16 addr, u16 d static int fimc_is_comp_single_read(struct fimc_is_core *core , u16 addr, u16 *data, size_t size) { int ret = 0; -//#ifdef USE_SPI -#if 1 struct spi_device *spi = core->spi1; ret = fimc_is_comp_spi_read(spi, (void *)data, addr, size); if (ret) { err("spi_single_read() fail"); } *data = *data << 8 | *data >> 8; -#else - struct i2c_client *client = core->client0; - fimc_is_s_int_comb_isp(core, true, INTMR2_INTMCIS22); /* I2C0 interrupt on */ - ret = fimc_is_comp_i2c_read(client, addr, data); - if (ret) { - err("i2c read fail"); - } - fimc_is_s_int_comb_isp(core, false, INTMR2_INTMCIS22); /* I2C0 interrupt off */ -#endif return ret; } @@ -741,67 +685,6 @@ static int fimc_is_comp_load_cal(struct fimc_is_core *core, char *name) return ret; } -#if 0 -static int fimc_is_comp_read_i2c_cal(struct fimc_is_core *core, u32 addr) -{ - int ret = 0; - u32 i,data_size = 0; - u16 data1, data2; - u8 read_data[2]; - - struct fimc_is_from_info *sysfs_finfo; - - fimc_is_sec_get_sysfs_finfo(&sysfs_finfo); - - fimc_is_s_int_comb_isp(core, true, INTMR2_INTMCIS22); /* interrupt on */ - if (addr == sysfs_finfo->lsc_i0_gain_addr) { - data_size = FIMC_IS_COMPANION_LSC_I0_SIZE; - data1 = 0x0EF8; - } else if (addr == sysfs_finfo->lsc_j0_gain_addr) { - data_size = FIMC_IS_COMPANION_LSC_J0_SIZE; - data1 = 0x0EFA; - } else if (addr == sysfs_finfo->lsc_a_gain_addr) { - data_size = FIMC_IS_COMPANION_LSC_A_SIZE; - data1 = 0x0F00; - } else if (addr == sysfs_finfo->lsc_k4_gain_addr) { - data_size = FIMC_IS_COMPANION_LSC_K4_SIZE; - data1 = 0x0F04; - } else if (addr == sysfs_finfo->lsc_scale_gain_addr) { - data_size = FIMC_IS_COMPANION_LSC_SCALE_SIZE; - data1 = 0x0F08; - } else if (addr == sysfs_finfo->wcoefficient1_addr) { - data_size = FIMC_IS_COMPANION_WCOEF1_SIZE; - data1 = 0x1420; - } else { - err("wrong companion cal data addr\n"); - return -EINVAL; - } - pr_info("===Camera: I2C read cal data, addr [0x%04x], size(%d)\n", addr,data_size); - ret = fimc_is_comp_i2c_write(core->client0, 0x642C, 0x4000); - if (ret) { - err("fimc_is_comp_load_i2c_cal() i2c write fail"); - } - ret = fimc_is_comp_i2c_write(core->client0, 0x642E, data1); - if (ret) { - err("fimc_is_comp_load_i2c_cal() i2c write fail"); - } - - for (i = 0; i < data_size; i += 2) { - fimc_is_comp_spi_read(core->spi1, (void *)read_data, data1, 2); - data2 = read_data[0] << 8 | read_data[1] << 0; -// pr_info("===Camera: I2C read addr[0x%04x],data[0x%04x]\n", data1,data2); - if (ret) { - err("fimc_is_comp_i2c_setf_write() fail"); - break; - } - data1 += 2; - } - - fimc_is_s_int_comb_isp(core, false, INTMR2_INTMCIS22); /* interrupt off */ - - return ret; -} -#endif static int fimc_is_comp_load_i2c_cal(struct fimc_is_core *core, u32 addr) { @@ -981,14 +864,6 @@ int fimc_is_power_binning(struct fimc_is_core *core) } /*read BIN_INFO 0x5000 500C*/ -#if 0 - ret = fimc_is_comp_single_write(core, 0x602C, 0x5000); - if (ret) - err("fimc_is_comp_i2c_setf_write() fail"); - ret = fimc_is_comp_single_write(core, 0x602E, 0x500C); - if (ret) - err("fimc_is_comp_i2c_setf_write() fail"); -#endif ret = read_data_from_file(FIMC_IS_ISP_CV, buf, 1, &pos); if(ret > 0) { @@ -1079,12 +954,6 @@ int fimc_is_comp_is_valid(struct fimc_is_core *core) read_addr = 0x0; fimc_is_comp_single_read(core, read_addr, &companion_id, 2); pr_info("Companion vaildation: 0x%04x\n", companion_id); -#if 0 -#if defined(CONFIG_SOC_EXYNOS5430) - if (companion_id != COMP_MAGIC_NUMBER) - ret = -EINVAL; -#endif -#endif exit: return ret; } @@ -1092,9 +961,6 @@ exit: int fimc_is_comp_read_ver(struct fimc_is_core *core) { int ret = 0; -#if 0 - u16 read_addr; -#endif if (!core->spi1) { pr_info("spi1 device is not available"); @@ -1102,13 +968,8 @@ int fimc_is_comp_read_ver(struct fimc_is_core *core) } /* check validation(Read data must be 0x73C1) */ -#if 0 - read_addr = 0x02; - fimc_is_comp_single_read(core, read_addr, &companion_ver, 2); -#else companion_ver = 0x00B0; pr_info("Default Companion Version is 0x00B0(EVT1)\n"); -#endif if (companion_ver == 0x00A0) { pr_info("Companion version: 0x%04x\n", companion_ver); @@ -1207,22 +1068,6 @@ retry: } usleep_range(1000, 1000); } -#if 0 - if (fimc_is_comp_is_compare_ver(core) >= FROM_VERSION_V004) { - ret = fimc_is_comp_load_i2c_cal(core, sysfs_finfo->af_inf_addr); - if (ret) { - err("fimc_is_comp_load_binary(0x%04x) fail", sysfs_finfo->af_inf_addr); - goto p_err; - } - usleep_range(1000, 1000); - ret = fimc_is_comp_load_i2c_cal(core, sysfs_finfo->af_macro_addr); - if (ret) { - err("fimc_is_comp_load_binary(0x%04x) fail", sysfs_finfo->af_macro_addr); - goto p_err; - } - usleep_range(1000, 1000); - } -#endif if (fimc_is_comp_is_compare_ver(core) >= FROM_VERSION_V004) { if (companion_lsc_isvalid) { ret = fimc_is_comp_load_cal(core, COMP_LSC); diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-config.h b/drivers/media/platform/exynos/fimc-is/fimc-is-config.h index 1e83b21..a2e8ff8 100644 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-config.h +++ b/drivers/media/platform/exynos/fimc-is/fimc-is-config.h @@ -19,129 +19,25 @@ /* #define ENABLE_VDIS */ /* #define ENABLE_TDNR */ #define ENABLE_FD -#define ENABLE_CLOCK_GATE -/* #define HAS_FW_CLOCK_GATE */ /* #define ENABLE_CACHE */ #define ENABLE_FULL_BYPASS #define ENABLE_FAST_SHOT -#define USE_OWN_FAULT_HANDLER /* #define ENABLE_MIF_400 */ #define ENABLE_DTP #define USE_ION_ALLOC -#define CSI_VERSION_0000_0000 0x0 -#define CSI_VERSION_0310_0100 0x03100100 - -#define FIMC_IS_VERSION_000 0x0 -#define FIMC_IS_VERSION_250 0x250 - -#if defined(CONFIG_PM_DEVFREQ) -#define ENABLE_DVFS #define START_DVFS_LEVEL FIMC_IS_SN_MAX -#endif -#if defined(CONFIG_SOC_EXYNOS5430) -#undef ENABLE_SETFILE #define SUPPORTED_IS_CMD_VER 132 #define TARGET_SPI_CH_FOR_PERI 0 -#define FIMC_IS_CSI_VERSION CSI_VERSION_0000_0000 -#define FIMC_IS_VERSION FIMC_IS_VERSION_000 -#define HAS_FW_CLOCK_GATE - -#elif defined(CONFIG_SOC_EXYNOS5433) -#define SUPPORTED_IS_CMD_VER 132 -#define TARGET_SPI_CH_FOR_PERI 0 -#define FIMC_IS_CSI_VERSION CSI_VERSION_0000_0000 -#define FIMC_IS_VERSION FIMC_IS_VERSION_000 -#define HAS_FW_CLOCK_GATE #define MAX_ZOOM_LEVEL 8 -#elif defined(CONFIG_SOC_EXYNOS5422) -#undef ENABLE_SETFILE -#define SUPPORTED_IS_CMD_VER 132 -#define TARGET_SPI_CH_FOR_PERI 0 -#define FIMC_IS_CSI_VERSION CSI_VERSION_0000_0000 -#define FIMC_IS_VERSION FIMC_IS_VERSION_000 - -#elif defined(CONFIG_SOC_EXYNOS5260) -#undef ENABLE_SETFILE -#undef ENABLE_DRC -#undef ENABLE_FULL_BYPASS -#define SUPPORTED_EARLY_BUF_DONE -#define SUPPORTED_IS_CMD_VER 131 -#define TARGET_SPI_CH_FOR_PERI 1 -#define FIMC_IS_CSI_VERSION CSI_VERSION_0310_0100 -#define FIMC_IS_VERSION FIMC_IS_VERSION_000 -#define SCALER_PARALLEL_MODE - -#elif defined(CONFIG_SOC_EXYNOS4415) -#undef ENABLE_SETFILE -#undef ENABLE_DRC -#define SUPPORTED_IS_CMD_VER 132 -#define TARGET_SPI_CH_FOR_PERI 1 -#define FIMC_IS_CSI_VERSION CSI_VERSION_0310_0100 -#define FIMC_IS_VERSION FIMC_IS_VERSION_250 - -#elif defined(CONFIG_SOC_EXYNOS3470) -#undef ENABLE_SETFILE -#undef ENABLE_DRC -#undef ENABLE_FULL_BYPASS -#define SUPPORTED_EARLY_BUF_DONE -#define ENABLE_IFLAG -#define SUPPORTED_IS_CMD_VER 131 -#define TARGET_SPI_CH_FOR_PERI 1 -#define FIMC_IS_CSI_VERSION CSI_VERSION_0000_0000 -#define FIMC_IS_VERSION FIMC_IS_VERSION_000 -#define SCALER_PARALLEL_MODE - -#elif defined(CONFIG_SOC_EXYNOS3472) -#undef ENABLE_SETFILE -#undef ENABLE_DRC -#undef ENABLE_DVFS -#undef ENABLE_FULL_BYPASS -#define ENABLE_IFLAG -#define SUPPORTED_IS_CMD_VER 131 -#define TARGET_SPI_CH_FOR_PERI 1 -#define FIMC_IS_CSI_VERSION CSI_VERSION_0310_0100 -#define FIMC_IS_VERSION FIMC_IS_VERSION_000 - -#else -#error fimc-is driver can NOT support this platform - -#endif #if !defined(MAX_ZOOM_LEVEL) /* default max zoom lv is 4 */ #define MAX_ZOOM_LEVEL 4 #endif -/* notifier for MIF throttling */ -#if defined(CONFIG_ARM_EXYNOS5433_BUS_DEVFREQ) && defined(CONFIG_CPU_THERMAL_IPA) -#define EXYNOS_MIF_ADD_NOTIFIER(nb) \ - exynos_mif_add_notifier(nb) -#else -#define EXYNOS_MIF_ADD_NOTIFIER(nb) -#endif - -#if defined(CONFIG_ARM_EXYNOS4415_BUS_DEVFREQ) -#define CONFIG_FIMC_IS_BUS_DEVFREQ -#endif -#if defined(CONFIG_ARM_EXYNOS5260_BUS_DEVFREQ) -#define CONFIG_FIMC_IS_BUS_DEVFREQ -#endif -#if defined(CONFIG_ARM_EXYNOS3470_BUS_DEVFREQ) -#define CONFIG_FIMC_IS_BUS_DEVFREQ -#endif -#if defined(CONFIG_ARM_EXYNOS5422_BUS_DEVFREQ) -#define CONFIG_FIMC_IS_BUS_DEVFREQ -#endif -#if defined(CONFIG_ARM_EXYNOS5430_BUS_DEVFREQ) -#define CONFIG_FIMC_IS_BUS_DEVFREQ -#endif -#if defined(CONFIG_ARM_EXYNOS5433_BUS_DEVFREQ) -#define CONFIG_FIMC_IS_BUS_DEVFREQ -#endif - /* * ----------------------------------------------------------------------------- * Debug Message Configuration @@ -178,16 +74,8 @@ /* * driver version extension */ -#ifdef ENABLE_CLOCK_GATE #define get_drv_clock_gate() 0x1 -#else -#define get_drv_clock_gate() 0x0 -#endif -#ifdef ENABLE_DVFS #define get_drv_dvfs() 0x2 -#else -#define get_drv_dvfs() 0x0 -#endif #define GET_3AA_ID(video) ((video->id < 14) ? 0 : 1) #define GET_3AAC_ID(video) ((video->id < FIMC_IS_VIDEO_3A1_NUM) ? 0 : 1) diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-core.c b/drivers/media/platform/exynos/fimc-is/fimc-is-core.c index e01672c..ac8daa4 100644 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-core.c +++ b/drivers/media/platform/exynos/fimc-is/fimc-is-core.c @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include @@ -38,10 +37,8 @@ #include #include -#ifdef CONFIG_OF #include #include -#endif #include "fimc-is-core.h" #include "fimc-is-param.h" @@ -51,48 +48,13 @@ #include "fimc-is-framemgr.h" #include "fimc-is-dt.h" #include "fimc-is-resourcemgr.h" -#include "fimc-is-clk-gate.h" -#include "fimc-is-dvfs.h" #include "fimc-is-fan53555.h" -#include "fimc-is-ncp6335b.h" - -#include "sensor/fimc-is-device-2p2.h" -#include "sensor/fimc-is-device-3h5.h" -#include "sensor/fimc-is-device-3h7.h" -#include "sensor/fimc-is-device-3h7_sunny.h" -#include "sensor/fimc-is-device-3l2.h" -#include "sensor/fimc-is-device-4e5.h" -#include "sensor/fimc-is-device-6a3.h" -#include "sensor/fimc-is-device-6b2.h" -#include "sensor/fimc-is-device-8b1.h" + #include "sensor/fimc-is-device-6d1.h" -#include "sensor/fimc-is-device-imx134.h" -#include "sensor/fimc-is-device-imx135.h" -#include "sensor/fimc-is-device-imx175.h" #include "sensor/fimc-is-device-imx240.h" -#include "sensor/fimc-is-device-imx219.h" -#include "sensor/fimc-is-device-4h5.h" -#include "sensor/fimc-is-device-3l2.h" -#include "sensor/fimc-is-device-2p2.h" -#include "sensor/fimc-is-device-2p2_12m.h" -#include "sensor/fimc-is-device-2p3.h" -#ifdef CONFIG_USE_VENDER_FEATURE #include "fimc-is-sec-define.h" -#ifdef CONFIG_OIS_USE #include "fimc-is-device-ois.h" -#endif -#endif -#ifdef CONFIG_AF_HOST_CONTROL #include "fimc-is-device-af.h" -#endif - -#ifdef USE_OWN_FAULT_HANDLER -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)) -#include -#else -#include -#endif -#endif #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)) #define PM_QOS_CAM_THROUGHPUT PM_QOS_RESERVED @@ -101,39 +63,24 @@ struct fimc_is_from_info *sysfs_finfo = NULL; struct fimc_is_from_info *sysfs_pinfo = NULL; -#ifdef CONFIG_USE_VENDER_FEATURE struct class *camera_class = NULL; struct device *camera_front_dev; struct device *camera_rear_dev; -#ifdef CONFIG_OIS_USE struct device *camera_ois_dev; -#endif -#endif struct device *fimc_is_dev = NULL; struct fimc_is_core *sysfs_core; -#ifdef CONFIG_USE_VENDER_FEATURE extern bool crc32_fw_check; extern bool crc32_check; extern bool crc32_check_factory; extern bool fw_version_crc_check; extern bool is_latest_cam_module; extern bool is_final_cam_module; -#if defined(CONFIG_SOC_EXYNOS5433) extern bool is_right_prj_name; -#endif -#ifdef CONFIG_COMPANION_USE extern bool crc32_c1_fw_check; extern bool crc32_c1_check; extern bool crc32_c1_check_factory; -#endif /* CONFIG_COMPANION_USE */ -#endif - -extern struct pm_qos_request exynos_isp_qos_int; -extern struct pm_qos_request exynos_isp_qos_mem; -extern struct pm_qos_request exynos_isp_qos_cam; -extern struct pm_qos_request exynos_isp_qos_disp; extern int fimc_is_3a0_video_probe(void *data); extern int fimc_is_3a1_video_probe(void *data); @@ -263,45 +210,6 @@ exit: return ret; } -#if defined(CONFIG_ARM_EXYNOS5433_BUS_DEVFREQ) && defined(CONFIG_CPU_THERMAL_IPA) -static int fimc_is_mif_throttling_notifier(struct notifier_block *nb, - unsigned long val, void *v) -{ - struct fimc_is_core *core = NULL; - struct fimc_is_device_sensor *device = NULL; - int i; - - core = (struct fimc_is_core *)dev_get_drvdata(fimc_is_dev); - if (!core) { - err("core is null"); - goto exit; - } - - for (i = 0; i < FIMC_IS_MAX_NODES; i++) { - if (test_bit(FIMC_IS_SENSOR_OPEN, &core->sensor[i].state)) { - device = &core->sensor[i]; - break; - } - } - - if (device && !test_bit(FIMC_IS_SENSOR_FRONT_DTP_STOP, &device->state)) - /* Set DTP */ - set_bit(FIMC_IS_MIF_THROTTLING_STOP, &device->force_stop); - else - err("any sensor is not opened"); - -exit: - err("MIF: cause of mif_throttling, mif_qos is [%lu]!!!\n", val); - - return NOTIFY_OK; -} - -static struct notifier_block exynos_fimc_is_mif_throttling_nb = { - .notifier_call = fimc_is_mif_throttling_notifier, -}; -#endif - -#ifdef CONFIG_USE_VENDER_FEATURE static ssize_t camera_front_sensorid_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -422,10 +330,8 @@ int read_from_firmware_version(void) { char fw_name[100]; char setf_name[100]; -#ifdef CONFIG_COMPANION_USE char master_setf_name[100]; char mode_setf_name[100]; -#endif struct device *is_dev = &sysfs_core->ischain[0].pdev->dev; fimc_is_sec_get_sysfs_pinfo(&pinfo); @@ -433,7 +339,6 @@ int read_from_firmware_version(void) if (!finfo->is_caldata_read) { if (finfo->bin_start_addr != 0x80000) { - //fimc_is_sec_set_camid(CAMERA_DUAL_FRONT); #if defined(CONFIG_PM_RUNTIME) pr_debug("pm_runtime_suspended = %d\n", pm_runtime_suspended(is_dev)); @@ -443,14 +348,8 @@ int read_from_firmware_version(void) printk(KERN_INFO "%s - fimc_is runtime resume complete\n", __func__); #endif -#if defined(CONFIG_CAMERA_EEPROM_SUPPORT_REAR) - fimc_is_sec_fw_sel_eeprom(is_dev, fw_name, setf_name, SENSOR_POSITION_REAR, false); -#else fimc_is_sec_fw_sel(sysfs_core, is_dev, fw_name, setf_name, false); -#endif -#ifdef CONFIG_COMPANION_USE fimc_is_sec_concord_fw_sel(sysfs_core, is_dev, fw_name, master_setf_name, mode_setf_name); -#endif #if defined(CONFIG_PM_RUNTIME) pm_runtime_put_sync(is_dev); pr_debug("pm_runtime_suspended = %d\n", @@ -486,17 +385,11 @@ static ssize_t camera_rear_camfw_show(struct device *dev, read_from_firmware_version(); -#if defined(CONFIG_CAMERA_EEPROM_SUPPORT_REAR) - loaded_fw = pinfo->header_ver; -#else fimc_is_sec_get_loaded_fw(&loaded_fw); -#endif if(fw_version_crc_check) { if (crc32_fw_check && crc32_check_factory -#ifdef CONFIG_COMPANION_USE && crc32_c1_fw_check && crc32_c1_check_factory -#endif ) { return sprintf(buf, "%s %s\n", finfo->header_ver, loaded_fw); } else { @@ -505,26 +398,18 @@ static ssize_t camera_rear_camfw_show(struct device *dev, strcat(command_ack, "FW"); if (!crc32_check_factory) strcat(command_ack, "CD"); -#ifdef CONFIG_COMPANION_USE if (!crc32_c1_fw_check) strcat(command_ack, "FW1"); if (!crc32_c1_check_factory) strcat(command_ack, "CD1"); -#endif if (finfo->header_ver[3] != 'L') strcat(command_ack, "_Q"); return sprintf(buf, "%s %s\n", finfo->header_ver, command_ack); } } else { strcpy(command_ack, "NG_"); -#if defined(CONFIG_CAMERA_EEPROM_SUPPORT_REAR) - strcat(command_ack, "CD"); -#else strcat(command_ack, "FWCD"); -#endif -#ifdef CONFIG_COMPANION_USE strcat(command_ack, "FW1CD1"); -#endif return sprintf(buf, "%s %s\n", finfo->header_ver, command_ack); } } @@ -537,17 +422,11 @@ static ssize_t camera_rear_camfw_full_show(struct device *dev, read_from_firmware_version(); -#if defined(CONFIG_CAMERA_EEPROM_SUPPORT_REAR) - loaded_fw = pinfo->header_ver; -#else fimc_is_sec_get_loaded_fw(&loaded_fw); -#endif if(fw_version_crc_check) { if (crc32_fw_check && crc32_check_factory -#ifdef CONFIG_COMPANION_USE && crc32_c1_fw_check && crc32_c1_check_factory -#endif ) { return sprintf(buf, "%s %s %s\n", finfo->header_ver, pinfo->header_ver, loaded_fw); } else { @@ -556,26 +435,18 @@ static ssize_t camera_rear_camfw_full_show(struct device *dev, strcat(command_ack, "FW"); if (!crc32_check_factory) strcat(command_ack, "CD"); -#ifdef CONFIG_COMPANION_USE if (!crc32_c1_fw_check) strcat(command_ack, "FW1"); if (!crc32_c1_check_factory) strcat(command_ack, "CD1"); -#endif if (finfo->header_ver[3] != 'L') strcat(command_ack, "_Q"); return sprintf(buf, "%s %s %s\n", finfo->header_ver, pinfo->header_ver, command_ack); } } else { strcpy(command_ack, "NG_"); -#if defined(CONFIG_CAMERA_EEPROM_SUPPORT_REAR) - strcat(command_ack, "CD"); -#else strcat(command_ack, "FWCD"); -#endif -#ifdef CONFIG_COMPANION_USE strcat(command_ack, "FW1CD1"); -#endif return sprintf(buf, "%s %s %s\n", finfo->header_ver, pinfo->header_ver, command_ack); } } @@ -587,14 +458,10 @@ static ssize_t camera_rear_checkfw_user_show(struct device *dev, if(fw_version_crc_check) { if (crc32_fw_check && crc32_check_factory -#ifdef CONFIG_COMPANION_USE && crc32_c1_fw_check && crc32_c1_check_factory -#endif ) { if (!is_latest_cam_module -#if defined(CONFIG_SOC_EXYNOS5433) || !is_right_prj_name -#endif ) { return sprintf(buf, "%s\n", "NG"); } else { @@ -615,14 +482,10 @@ static ssize_t camera_rear_checkfw_factory_show(struct device *dev, if(fw_version_crc_check) { if (crc32_fw_check && crc32_check_factory -#ifdef CONFIG_COMPANION_USE && crc32_c1_fw_check && crc32_c1_check_factory -#endif ) { if (!is_final_cam_module -#if defined(CONFIG_SOC_EXYNOS5433) || !is_right_prj_name -#endif ) { return sprintf(buf, "%s\n", "NG"); } else { @@ -636,7 +499,6 @@ static ssize_t camera_rear_checkfw_factory_show(struct device *dev, } } -#ifdef CONFIG_COMPANION_USE static ssize_t camera_rear_companionfw_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -660,7 +522,6 @@ static ssize_t camera_rear_companionfw_full_show(struct device *dev, return sprintf(buf, "%s %s %s\n", finfo->concord_header_ver, pinfo->concord_header_ver, loaded_c1_fw); } -#endif static ssize_t camera_rear_camfw_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) @@ -680,9 +541,7 @@ static ssize_t camera_rear_calcheck_show(struct device *dev, struct device_attribute *attr, char *buf) { char rear_sensor[10] = {0, }; -#ifdef CONFIG_COMPANION_USE char rear_companion[10] = {0, }; -#endif read_from_firmware_version(); @@ -691,19 +550,14 @@ static ssize_t camera_rear_calcheck_show(struct device *dev, else strcpy(rear_sensor, "Abnormal"); -#ifdef CONFIG_COMPANION_USE if (crc32_c1_check_factory) strcpy(rear_companion, "Normal"); else strcpy(rear_companion, "Abnormal"); return sprintf(buf, "%s %s %s\n", rear_sensor, rear_companion, "Null"); -#else - return sprintf(buf, "%s %s\n", rear_sensor, "Null"); -#endif } -#ifdef CONFIG_COMPANION_USE static ssize_t camera_isp_core_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -715,9 +569,7 @@ static ssize_t camera_isp_core_show(struct device *dev, sel = fimc_is_power_binning(sysfs_core); return sprintf(buf, "%s\n", sysfs_core->companion_dcdc.get_vout_str(sel)); } -#endif -#ifdef CONFIG_OIS_USE static ssize_t camera_ois_power_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) @@ -856,15 +708,7 @@ static ssize_t camera_ois_diff_show(struct device *dev, static ssize_t camera_ois_fw_update_show(struct device *dev, struct device_attribute *attr, char *buf) { -#ifdef CONFIG_OIS_FW_UPDATE_THREAD_USE fimc_is_ois_init_thread(sysfs_core); -#else - fimc_is_ois_gpio_on(sysfs_core->companion); - msleep(150); - - fimc_is_ois_fw_update(sysfs_core); - fimc_is_ois_gpio_off(sysfs_core->companion); -#endif return sprintf(buf, "%s\n", "Ois update done."); } @@ -885,7 +729,6 @@ static ssize_t camera_ois_exif_show(struct device *dev, return sprintf(buf, "%s %s %s %d %d", ois_minfo->header_ver, ois_pinfo->header_ver, ois_uinfo->header_ver, ois_exif->error_data, ois_exif->status_data); } -#endif static DEVICE_ATTR(rear_camtype, S_IRUGO, camera_rear_camtype_show, NULL); @@ -893,23 +736,18 @@ static DEVICE_ATTR(rear_camfw, S_IRUGO, camera_rear_camfw_show, camera_rear_camfw_write); static DEVICE_ATTR(rear_camfw_full, S_IRUGO, camera_rear_camfw_full_show, NULL); -#ifdef CONFIG_COMPANION_USE static DEVICE_ATTR(rear_companionfw, S_IRUGO, camera_rear_companionfw_show, NULL); static DEVICE_ATTR(rear_companionfw_full, S_IRUGO, camera_rear_companionfw_full_show, NULL); -#endif static DEVICE_ATTR(rear_calcheck, S_IRUGO, camera_rear_calcheck_show, NULL); static DEVICE_ATTR(rear_checkfw_user, S_IRUGO, camera_rear_checkfw_user_show, NULL); static DEVICE_ATTR(rear_checkfw_factory, S_IRUGO, camera_rear_checkfw_factory_show, NULL); -#ifdef CONFIG_COMPANION_USE static DEVICE_ATTR(isp_core, S_IRUGO, camera_isp_core_show, NULL); -#endif -#ifdef CONFIG_OIS_USE static DEVICE_ATTR(selftest, S_IRUGO, camera_ois_selftest_show, NULL); static DEVICE_ATTR(ois_power, S_IWUSR, @@ -924,8 +762,6 @@ static DEVICE_ATTR(fw_update, S_IRUGO, camera_ois_fw_update_show, NULL); static DEVICE_ATTR(ois_exif, S_IRUGO, camera_ois_exif_show, NULL); -#endif -#endif /* CONFIG_USE_VENDER_FEATURE */ static int fimc_is_suspend(struct device *dev) { @@ -939,255 +775,6 @@ static int fimc_is_resume(struct device *dev) return 0; } -#ifdef USE_OWN_FAULT_HANDLER -static void fimc_is_print_minfo(struct fimc_is_minfo *minfo) -{ - if (minfo) { - err("dvaddr : 0x%08x, size : %d", minfo->dvaddr, minfo->size); - err("dvaddr_debug : 0x%08x, dvaddr_region : 0x%08x", minfo->dvaddr_debug, minfo->dvaddr_region); - err("dvaddr_shared : 0x%08x, dvaddr_odc : 0x%08x", minfo->dvaddr_shared, minfo->dvaddr_odc); - err("dvaddr_dis : 0x%08x, dvaddr_3dnr : 0x%08x", minfo->dvaddr_dis, minfo->dvaddr_3dnr); - } else { - err("core->minfo is NULL"); - } -} - -static void __fimc_is_fault_handler(struct device *dev) -{ - u32 i, j, k; - struct fimc_is_core *core; - struct fimc_is_device_sensor *sensor; - struct fimc_is_device_ischain *ischain; - struct fimc_is_framemgr *framemgr; - - core = dev_get_drvdata(dev); - if (core) { - - fimc_is_print_minfo(&core->minfo); - fimc_is_hw_logdump(&core->interface); - /* dump FW page table 1nd(~16KB), 2nd(16KB~32KB) */ - fimc_is_hw_memdump(&core->interface, - core->minfo.kvaddr + 0x010F8000 /* TTB_BASE ~ 32KB */, - core->minfo.kvaddr + 0x010F8000 + 0x8000); - - /* REAR SENSOR */ - sensor = &core->sensor[0]; - if (test_bit(FIMC_IS_SENSOR_OPEN, &sensor->state)) { - framemgr = &sensor->vctx->q_dst->framemgr; - for (i = 0; i < FRAMEMGR_MAX_REQUEST; ++i) { - pr_err("LITE0 BUF[%d][0] = %X, 0x%08X, 0x%08X\n", i, - (u32)framemgr->frame[i].memory, - framemgr->frame[i].dvaddr_buffer[0], - framemgr->frame[i].kvaddr_buffer[0]); - } - } - - /* FRONT SENSOR */ - sensor = &core->sensor[1]; - if (test_bit(FIMC_IS_SENSOR_OPEN, &sensor->state)) { - framemgr = &sensor->vctx->q_dst->framemgr; - for (i = 0; i < FRAMEMGR_MAX_REQUEST; ++i) { - pr_err("LITE1 BUF[%d][0] = %X, 0x%08X. 0x%08X\n", i, - (u32)framemgr->frame[i].memory, - framemgr->frame[i].dvaddr_buffer[0], - framemgr->frame[i].kvaddr_buffer[0]); - } - } - - /* ISCHAIN */ - for (i = 0; i < FIMC_IS_MAX_NODES; i++) { - if (test_bit(FIMC_IS_ISCHAIN_OPEN, &(core->ischain[i].state))) { - ischain = &core->ischain[i]; - /* 3AA */ - if (test_bit(FIMC_IS_SUBDEV_START, &ischain->group_3aa.leader.state)) { - framemgr = &ischain->group_3aa.leader.vctx->q_src->framemgr; - for (j = 0; j < framemgr->frame_cnt; ++j) { - for (k = 0; k < framemgr->frame[j].planes; k++) { - pr_err("[3AA:%d] BUF[%d][%d] = %X, 0x%08X, 0x%08X\n", - i, j, k, - (u32)framemgr->frame[j].memory, - framemgr->frame[j].dvaddr_buffer[k], - framemgr->frame[j].kvaddr_buffer[k]); - } - } - } - /* 3AAC */ - if (test_bit(FIMC_IS_SUBDEV_START, &ischain->taac.state)) { - framemgr = &ischain->taac.leader->vctx->q_dst->framemgr; - for (j = 0; j < framemgr->frame_cnt; ++j) { - for (k = 0; k < framemgr->frame[j].planes; k++) { - pr_err("[3AAC:%d] BUF[%d][%d] = %X, 0x%08X, 0x%08X\n", - i, j, k, - (u32)framemgr->frame[j].memory, - framemgr->frame[j].dvaddr_buffer[k], - framemgr->frame[j].kvaddr_buffer[k]); - } - } - } - /* 3AAP */ - if (test_bit(FIMC_IS_SUBDEV_START, &ischain->taap.state)) { - framemgr = &ischain->taap.leader->vctx->q_dst->framemgr; - for (j = 0; j < framemgr->frame_cnt; ++j) { - for (k = 0; k < framemgr->frame[j].planes; k++) { - pr_err("[3AAP:%d] BUF[%d][%d] = %X, 0x%08X, 0x%08X\n", - i, j, k, - (u32)framemgr->frame[j].memory, - framemgr->frame[j].dvaddr_buffer[k], - framemgr->frame[j].kvaddr_buffer[k]); - } - } - } - /* ISP */ - if (test_bit(FIMC_IS_SUBDEV_START, &ischain->group_isp.leader.state)) { - framemgr = &ischain->group_isp.leader.vctx->q_src->framemgr; - for (j = 0; j < framemgr->frame_cnt; ++j) { - for (k = 0; k < framemgr->frame[j].planes; k++) { - pr_err("[ISP:%d] BUF[%d][%d] = %X, 0x%08X, 0x%08X\n", - i, j, k, - (u32)framemgr->frame[j].memory, - framemgr->frame[j].dvaddr_buffer[k], - framemgr->frame[j].kvaddr_buffer[k]); - } - } - } - /* SCC */ - if (test_bit(FIMC_IS_SUBDEV_START, &ischain->scc.state)) { - framemgr = &ischain->scc.vctx->q_dst->framemgr; - for (j = 0; j < framemgr->frame_cnt; ++j) { - for (k = 0; k < framemgr->frame[j].planes; k++) { - pr_err("[SCC:%d] BUF[%d][%d] = %X, 0x%08X, 0x%08X\n", - i, j, k, - (u32)framemgr->frame[j].memory, - framemgr->frame[j].dvaddr_buffer[k], - framemgr->frame[j].kvaddr_buffer[k]); - } - } - } - /* VDC */ - if (test_bit(FIMC_IS_SUBDEV_START, &ischain->dis.state)) { - framemgr = &ischain->dis.vctx->q_dst->framemgr; - for (j = 0; j < framemgr->frame_cnt; ++j) { - for (k = 0; k < framemgr->frame[j].planes; k++) { - pr_err("[VDC:%d] BUF[%d][%d] = %X, 0x%08X, 0x%08X\n", - i, j, k, - (u32)framemgr->frame[j].memory, - framemgr->frame[j].dvaddr_buffer[k], - framemgr->frame[j].kvaddr_buffer[k]); - } - } - } - /* VDO */ - if (test_bit(FIMC_IS_SUBDEV_START, &ischain->group_dis.leader.state)) { - framemgr = &ischain->group_dis.leader.vctx->q_src->framemgr; - for (j = 0; j < framemgr->frame_cnt; ++j) { - for (k = 0; k < framemgr->frame[j].planes; k++) { - pr_err("[VDO:%d] BUF[%d][%d] = %X, 0x%08X, 0x%08X\n", - i, j, k, - (u32)framemgr->frame[j].memory, - framemgr->frame[j].dvaddr_buffer[k], - framemgr->frame[j].kvaddr_buffer[k]); - } - } - } - /* SCP */ - if (test_bit(FIMC_IS_SUBDEV_START, &ischain->scp.state)) { - framemgr = &ischain->scp.vctx->q_dst->framemgr; - for (j = 0; j < framemgr->frame_cnt; ++j) { - for (k = 0; k < framemgr->frame[j].planes; k++) { - pr_err("[SCP:%d] BUF[%d][%d] = %X, 0x%08X, 0x%08X\n", - i, j, k, - (u32)framemgr->frame[j].memory, - framemgr->frame[j].dvaddr_buffer[k], - framemgr->frame[j].kvaddr_buffer[k]); - } - } - } - } - } - } else { - pr_err("failed to get core\n"); - } -} - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0)) -#define SECT_ORDER 20 -#define LPAGE_ORDER 16 -#define SPAGE_ORDER 12 - -#define lv1ent_page(sent) ((*(sent) & 3) == 1) - -#define lv1ent_offset(iova) ((iova) >> SECT_ORDER) -#define lv2ent_offset(iova) (((iova) & 0xFF000) >> SPAGE_ORDER) -#define lv2table_base(sent) (*(sent) & 0xFFFFFC00) - -static unsigned long *section_entry(unsigned long *pgtable, unsigned long iova) -{ - return pgtable + lv1ent_offset(iova); -} - -static unsigned long *page_entry(unsigned long *sent, unsigned long iova) -{ - return (unsigned long *)__va(lv2table_base(sent)) + lv2ent_offset(iova); -} - -static char *sysmmu_fault_name[SYSMMU_FAULTS_NUM] = { - "PAGE FAULT", - "AR MULTI-HIT FAULT", - "AW MULTI-HIT FAULT", - "BUS ERROR", - "AR SECURITY PROTECTION FAULT", - "AR ACCESS PROTECTION FAULT", - "AW SECURITY PROTECTION FAULT", - "AW ACCESS PROTECTION FAULT", - "UNKNOWN FAULT" -}; - -static int fimc_is_fault_handler(struct device *dev, const char *mmuname, - enum exynos_sysmmu_inttype itype, - unsigned long pgtable_base, - unsigned long fault_addr) -{ - unsigned long *ent; - - if ((itype >= SYSMMU_FAULTS_NUM) || (itype < SYSMMU_PAGEFAULT)) - itype = SYSMMU_FAULT_UNKNOWN; - - pr_err("%s occured at 0x%lx by '%s'(Page table base: 0x%lx)\n", - sysmmu_fault_name[itype], fault_addr, mmuname, pgtable_base); - - ent = section_entry(__va(pgtable_base), fault_addr); - pr_err("\tLv1 entry: 0x%lx\n", *ent); - - if (lv1ent_page(ent)) { - ent = page_entry(ent, fault_addr); - pr_err("\t Lv2 entry: 0x%lx\n", *ent); - } - - __fimc_is_fault_handler(dev); - - pr_err("Generating Kernel OOPS... because it is unrecoverable.\n"); - - BUG(); - - return 0; -} -#else -static int fimc_is_fault_handler(struct iommu_domain *domain, - struct device *dev, - unsigned long fault_addr, - int fault_flag, - void *token) -{ - pr_err("\n"); - pr_err("Device virtual(0x%X) is invalid access\n", (u32)fault_addr); - - __fimc_is_fault_handler(dev); - - return -EINVAL; -} -#endif -#endif /* USE_OWN_FAULT_HANDLER */ - static ssize_t show_clk_gate_mode(struct device *dev, struct device_attribute *attr, char *buf) { @@ -1198,19 +785,6 @@ static ssize_t store_clk_gate_mode(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { -#ifdef HAS_FW_CLOCK_GATE - switch (buf[0]) { - case '0': - sysfs_debug.clk_gate_mode = CLOCK_GATE_MODE_HOST; - break; - case '1': - sysfs_debug.clk_gate_mode = CLOCK_GATE_MODE_FW; - break; - default: - pr_debug("%s: %c\n", __func__, buf[0]); - break; - } -#endif return count; } @@ -1224,21 +798,6 @@ static ssize_t store_en_clk_gate(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { -#ifdef ENABLE_CLOCK_GATE - switch (buf[0]) { - case '0': - sysfs_debug.en_clk_gate = false; - sysfs_debug.clk_gate_mode = CLOCK_GATE_MODE_HOST; - break; - case '1': - sysfs_debug.en_clk_gate = true; - sysfs_debug.clk_gate_mode = CLOCK_GATE_MODE_HOST; - break; - default: - pr_debug("%s: %c\n", __func__, buf[0]); - break; - } -#endif return count; } @@ -1252,38 +811,6 @@ static ssize_t store_en_dvfs(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { -#ifdef ENABLE_DVFS - struct fimc_is_core *core = - (struct fimc_is_core *)platform_get_drvdata(to_platform_device(dev)); - struct fimc_is_resourcemgr *resourcemgr; - int i; - - BUG_ON(!core); - - resourcemgr = &core->resourcemgr; - - switch (buf[0]) { - case '0': - sysfs_debug.en_dvfs = false; - /* update dvfs lever to max */ - mutex_lock(&resourcemgr->dvfs_ctrl.lock); - for (i = 0; i < FIMC_IS_MAX_NODES; i++) { - if (test_bit(FIMC_IS_ISCHAIN_OPEN, &((core->ischain[i]).state))) - fimc_is_set_dvfs(&(core->ischain[i]), FIMC_IS_SN_MAX); - } - fimc_is_dvfs_init(resourcemgr); - resourcemgr->dvfs_ctrl.static_ctrl->cur_scenario_id = FIMC_IS_SN_MAX; - mutex_unlock(&resourcemgr->dvfs_ctrl.lock); - break; - case '1': - /* It can not re-define static scenario */ - sysfs_debug.en_dvfs = true; - break; - default: - pr_debug("%s: %c\n", __func__, buf[0]); - break; - } -#endif return count; } @@ -1314,10 +841,8 @@ static int fimc_is_probe(struct platform_device *pdev) pdata = dev_get_platdata(&pdev->dev); if (!pdata) { -#ifdef CONFIG_OF pdata = fimc_is_parse_dt(&pdev->dev); if (IS_ERR(pdata)) -#endif return PTR_ERR(pdata); } @@ -1335,18 +860,12 @@ static int fimc_is_probe(struct platform_device *pdev) return ret; } -#ifdef CONFIG_COMPANION_USE core->companion_spi_channel = pdata->companion_spi_channel; core->use_two_spi_line = pdata->use_two_spi_line; -#endif -#ifdef CONFIG_USE_VENDER_FEATURE core->use_sensor_dynamic_voltage_mode = pdata->use_sensor_dynamic_voltage_mode; -#ifdef CONFIG_OIS_USE core->use_ois = pdata->use_ois; -#endif /* CONFIG_OIS_USE */ core->use_ois_hsi2c = pdata->use_ois_hsi2c; core->use_module_check = pdata->use_module_check; -#endif #ifdef USE_ION_ALLOC core->fimc_ion_client = ion_client_create(ion_exynos, "fimc-is"); @@ -1409,22 +928,6 @@ static int fimc_is_probe(struct platform_device *pdev) /* group initialization */ fimc_is_groupmgr_probe(&core->groupmgr); -#if defined(CONFIG_CAMERA_SENSOR_6B2_OBJ) - ret = sensor_6b2_probe(NULL, NULL); - if (ret) { - err("sensor_6b2_probe is fail(%d)", ret); - goto p_err3; - } -#endif - -#if defined(CONFIG_CAMERA_SENSOR_8B1_OBJ) - ret = sensor_8b1_probe(NULL, NULL); - if (ret) { - err("sensor_8b1_probe is fail(%d)", ret); - goto p_err3; - } -#endif - #if defined(CONFIG_CAMERA_SENSOR_6D1_OBJ) ret = sensor_6d1_probe(NULL, NULL); if (ret) { @@ -1433,102 +936,6 @@ static int fimc_is_probe(struct platform_device *pdev) } #endif -#if defined(CONFIG_CAMERA_SENSOR_6A3_OBJ) - ret = sensor_6a3_probe(NULL, NULL); - if (ret) { - err("sensor_6a3_probe is fail(%d)", ret); - goto p_err3; - } -#endif - -#if defined(CONFIG_CAMERA_SENSOR_IMX134_OBJ) - ret = sensor_imx134_probe(NULL, NULL); - if (ret) { - err("sensor_imx134_probe is fail(%d)", ret); - goto p_err3; - } -#endif - -#if defined(CONFIG_CAMERA_SENSOR_IMX135_OBJ) - ret = sensor_imx135_probe(NULL, NULL); - if (ret) { - err("sensor_imx135_probe is fail(%d)", ret); - goto p_err3; - } -#endif - -#if defined(CONFIG_CAMERA_SENSOR_3L2_OBJ) - ret = sensor_3l2_probe(NULL, NULL); - if (ret) { - err("sensor_3l2_probe is fail(%d)", ret); - goto p_err3; - } -#endif - -#if defined(CONFIG_CAMERA_SENSOR_2P2_OBJ) - ret = sensor_2p2_probe(NULL, NULL); - if (ret) { - err("sensor_2p2_probe is fail(%d)", ret); - goto p_err3; - } -#endif - -#if defined(CONFIG_CAMERA_SENSOR_2P2_12M_OBJ) - ret = sensor_2p2_12m_probe(NULL, NULL); - if (ret) { - err("sensor_2p2_12m_probe is fail(%d)", ret); - goto p_err3; - } -#endif - -#if defined(CONFIG_CAMERA_SENSOR_2P3_OBJ) - ret = sensor_2p3_probe(NULL, NULL); - if (ret) { - err("sensor_2p3_probe is fail(%d)", ret); - goto p_err3; - } -#endif - -#if defined(CONFIG_CAMERA_SENSOR_3H5_OBJ) - ret = sensor_3h5_probe(NULL, NULL); - if (ret) { - err("sensor_3h5_probe is fail(%d)", ret); - goto p_err3; - } -#endif - -#if defined(CONFIG_CAMERA_SENSOR_3H7_OBJ) - ret = sensor_3h7_probe(NULL, NULL); - if (ret) { - err("sensor_3h7_probe is fail(%d)", ret); - goto p_err3; - } -#endif - -#if defined(CONFIG_CAMERA_SENSOR_3H7_SUNNY_OBJ) - ret = sensor_3h7_sunny_probe(NULL, NULL); - if (ret) { - err("sensor_3h7_sunny_probe is fail(%d)", ret); - goto p_err3; - } -#endif - -#if defined(CONFIG_CAMERA_SENSOR_4E5_OBJ) - ret = sensor_4e5_probe(NULL, NULL); - if (ret) { - err("sensor_4e5_probe is fail(%d)", ret); - goto p_err3; - } -#endif - -#if defined(CONFIG_CAMERA_SENSOR_IMX175_OBJ) - ret = sensor_imx175_probe(NULL, NULL); - if (ret) { - err("sensor_imx175_probe is fail(%d)", ret); - goto p_err3; - } -#endif - #if defined(CONFIG_CAMERA_SENSOR_IMX240_OBJ) ret = sensor_imx240_probe(NULL, NULL); if (ret) { @@ -1537,22 +944,6 @@ static int fimc_is_probe(struct platform_device *pdev) } #endif -#if defined(CONFIG_CAMERA_SENSOR_IMX219_OBJ) - ret = sensor_imx219_probe(NULL, NULL); - if (ret) { - err("sensor_imx219_probe is fail(%d)", ret); - goto p_err3; - } -#endif - -#if defined(CONFIG_CAMERA_SENSOR_4H5_OBJ) - ret = sensor_4h5_probe(NULL, NULL); - if (ret) { - err("sensor_4h5_probe is fail(%d)", ret); - goto p_err3; - } -#endif - /* device entity - ischain0 */ fimc_is_ischain_probe(&core->ischain[0], &core->interface, @@ -1633,19 +1024,15 @@ static int fimc_is_probe(struct platform_device *pdev) } -#if defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) #if defined(CONFIG_VIDEOBUF2_ION) if (core->mem.alloc_ctx) vb2_ion_attach_iommu(core->mem.alloc_ctx); #endif -#endif - EXYNOS_MIF_ADD_NOTIFIER(&exynos_fimc_is_mif_throttling_nb); #if defined(CONFIG_PM_RUNTIME) pm_runtime_enable(&pdev->dev); #endif -#ifdef CONFIG_USE_VENDER_FEATURE if (camera_class == NULL) { camera_class = class_create(THIS_MODULE, "camera"); if (IS_ERR(camera_class)) { @@ -1719,7 +1106,6 @@ static int fimc_is_probe(struct platform_device *pdev) "failed to create rear device file, %s\n", dev_attr_rear_checkfw_factory.attr.name); } -#ifdef CONFIG_COMPANION_USE if (device_create_file(camera_rear_dev, &dev_attr_rear_companionfw) < 0) { printk(KERN_ERR @@ -1732,32 +1118,26 @@ static int fimc_is_probe(struct platform_device *pdev) "failed to create rear device file, %s\n", dev_attr_rear_companionfw_full.attr.name); } -#endif if (device_create_file(camera_rear_dev, &dev_attr_rear_calcheck) < 0) { printk(KERN_ERR "failed to create rear device file, %s\n", dev_attr_rear_calcheck.attr.name); } -#ifdef CONFIG_COMPANION_USE if (device_create_file(camera_rear_dev, &dev_attr_isp_core) < 0) { printk(KERN_ERR "failed to create rear device file, %s\n", dev_attr_isp_core.attr.name); } -#endif -#ifdef CONFIG_OIS_USE if (device_create_file(camera_rear_dev, &dev_attr_fw_update) < 0) { printk(KERN_ERR "failed to create rear device file, %s\n", dev_attr_fw_update.attr.name); } -#endif } -#ifdef CONFIG_OIS_USE camera_ois_dev = device_create(camera_class, NULL, 2, NULL, "ois"); if (IS_ERR(camera_ois_dev)) { printk(KERN_ERR "failed to create ois device!\n"); @@ -1799,54 +1179,28 @@ static int fimc_is_probe(struct platform_device *pdev) dev_attr_ois_exif.attr.name); } } -#endif sysfs_core = core; -#endif - -#ifdef USE_OWN_FAULT_HANDLER -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0)) - exynos_sysmmu_set_fault_handler(fimc_is_dev, fimc_is_fault_handler); -#else - iovmm_set_fault_handler(fimc_is_dev, fimc_is_fault_handler, NULL); -#endif -#endif dbg("%s : fimc_is_front_%d probe success\n", __func__, pdev->id); /* set sysfs for debuging */ sysfs_debug.en_clk_gate = 0; sysfs_debug.en_dvfs = 1; -#ifdef ENABLE_CLOCK_GATE + sysfs_debug.en_clk_gate = 1; -#ifdef HAS_FW_CLOCK_GATE sysfs_debug.clk_gate_mode = CLOCK_GATE_MODE_FW; -#else - sysfs_debug.clk_gate_mode = CLOCK_GATE_MODE_HOST; -#endif -#endif + ret = sysfs_create_group(&core->pdev->dev.kobj, &fimc_is_debug_attr_group); -#ifdef ENABLE_DVFS - { - struct fimc_is_resourcemgr *resourcemgr; - resourcemgr = &core->resourcemgr; - /* dvfs controller init */ - ret = fimc_is_dvfs_init(resourcemgr); - if (ret) - err("%s: fimc_is_dvfs_init failed!\n", __func__); - } -#endif info("%s:end\n", __func__); return 0; -#ifdef CONFIG_USE_VENDER_FEATURE p_err5: #if defined(CONFIG_PM_RUNTIME) __pm_runtime_disable(&pdev->dev, false); #endif -#endif /* CONFIG_USE_VENDER_FEATURE */ p_err4: v4l2_device_unregister(&core->v4l2_dev); p_err3: @@ -1875,20 +1229,13 @@ static int fimc_is_remove(struct platform_device *pdev) device_remove_file(camera_rear_dev, &dev_attr_rear_camfw_full); device_remove_file(camera_rear_dev, &dev_attr_rear_checkfw_user); device_remove_file(camera_rear_dev, &dev_attr_rear_checkfw_factory); -#ifdef CONFIG_COMPANION_USE device_remove_file(camera_rear_dev, &dev_attr_rear_companionfw); device_remove_file(camera_rear_dev, &dev_attr_rear_companionfw_full); -#endif device_remove_file(camera_rear_dev, &dev_attr_rear_calcheck); -#ifdef CONFIG_COMPANION_USE device_remove_file(camera_rear_dev, &dev_attr_isp_core); -#endif -#ifdef CONFIG_OIS_USE device_remove_file(camera_ois_dev, &dev_attr_fw_update); -#endif } -#ifdef CONFIG_OIS_USE if (camera_ois_dev) { device_remove_file(camera_ois_dev, &dev_attr_selftest); device_remove_file(camera_ois_dev, &dev_attr_ois_power); @@ -1897,7 +1244,6 @@ static int fimc_is_remove(struct platform_device *pdev) device_remove_file(camera_ois_dev, &dev_attr_ois_diff); device_remove_file(camera_ois_dev, &dev_attr_ois_exif); } -#endif if (camera_class) { if (camera_front_dev) @@ -1906,10 +1252,8 @@ static int fimc_is_remove(struct platform_device *pdev) if (camera_rear_dev) device_destroy(camera_class, camera_rear_dev->devt); -#ifdef CONFIG_OIS_USE if (camera_ois_dev) device_destroy(camera_class, camera_ois_dev->devt); -#endif } class_destroy(camera_class); @@ -1924,8 +1268,6 @@ static const struct dev_pm_ops fimc_is_pm_ops = { .runtime_resume = fimc_is_runtime_resume, }; -#ifdef CONFIG_USE_VENDER_FEATURE -#if defined(CONFIG_COMPANION_USE) static int fimc_is_i2c0_probe(struct i2c_client *client, const struct i2c_device_id *id) { @@ -1962,13 +1304,11 @@ static int fimc_is_i2c0_remove(struct i2c_client *client) return 0; } -#ifdef CONFIG_OF static struct of_device_id fimc_is_i2c0_dt_ids[] = { { .compatible = "samsung,fimc_is_i2c0",}, {}, }; MODULE_DEVICE_TABLE(of, fimc_is_i2c0_dt_ids); -#endif static const struct i2c_device_id fimc_is_i2c0_id[] = { {"fimc_is_i2c0", 0}, @@ -1980,18 +1320,14 @@ static struct i2c_driver fimc_is_i2c0_driver = { .driver = { .name = "fimc_is_i2c0", .owner = THIS_MODULE, -#ifdef CONFIG_OF .of_match_table = fimc_is_i2c0_dt_ids, -#endif }, .probe = fimc_is_i2c0_probe, .remove = fimc_is_i2c0_remove, .id_table = fimc_is_i2c0_id, }; module_i2c_driver(fimc_is_i2c0_driver); -#endif -#if defined(CONFIG_OF) && defined(CONFIG_COMPANION_USE) static int of_fimc_is_spi_dt(struct device *dev, struct fimc_is_spi_gpio *spi_gpio, struct fimc_is_core *core) { struct device_node *np; @@ -2031,10 +1367,7 @@ static int of_fimc_is_spi_dt(struct device *dev, struct fimc_is_spi_gpio *spi_gp return 0; } -#endif -#endif -#ifdef CONFIG_OF static int fimc_is_spi_probe(struct spi_device *spi) { int ret = 0; @@ -2063,13 +1396,11 @@ static int fimc_is_spi_probe(struct spi_device *spi) if (!strncmp(spi->modalias, "fimc_is_spi1", 12)) { core->spi1 = spi; -#ifdef CONFIG_COMPANION_USE ret = of_fimc_is_spi_dt(&spi->dev,&core->spi_gpio, core); if (ret) { pr_err("[%s] of_fimc_is_spi_dt parse dt failed\n", __func__); return ret; } -#endif } exit: @@ -2081,16 +1412,11 @@ static int fimc_is_spi_remove(struct spi_device *spi) return 0; } -#if defined(CONFIG_USE_VENDER_FEATURE) && defined(CONFIG_COMPANION_USE) static int fimc_is_fan53555_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct fimc_is_core *core; int ret = 0; -#ifdef CONFIG_SOC_EXYNOS5422 - struct regulator *regulator = NULL; - const char power_name[] = "CAM_IO_1.8V_AP"; -#endif struct device_node *np; int gpio_comp_en; @@ -2132,24 +1458,6 @@ static int fimc_is_fan53555_probe(struct i2c_client *client, core->companion_dcdc.get_vout_str = fan53555_get_vout_str; core->companion_dcdc.set_vout = fan53555_set_vsel0_vout; -#ifdef CONFIG_SOC_EXYNOS5422 - regulator = regulator_get(NULL, power_name); - if (IS_ERR(regulator)) { - pr_err("%s : regulator_get(%s) fail\n", __func__, power_name); - return PTR_ERR(regulator); - } - - if (regulator_is_enabled(regulator)) { - pr_info("%s regulator is already enabled\n", power_name); - } else { - ret = regulator_enable(regulator); - if (unlikely(ret)) { - pr_err("%s : regulator_enable(%s) fail\n", __func__, power_name); - goto err; - } - } - usleep_range(1000, 1000); -#endif ret = i2c_smbus_write_byte_data(client, REG_VSEL0, VSEL0_INIT_VAL); if (ret < 0) { @@ -2168,14 +1476,6 @@ static int fimc_is_fan53555_probe(struct i2c_client *client, } pr_err("[%s::%d]fan53555 [Read :: %x ,%x]\n\n", __func__, __LINE__, ret,VSEL0_INIT_VAL); -#ifdef CONFIG_SOC_EXYNOS5422 - ret = regulator_disable(regulator); - if (unlikely(ret)) { - pr_err("%s: regulator_disable(%s) fail\n", __func__, power_name); - goto err; - } - regulator_put(regulator); -#endif gpio_direction_output(gpio_comp_en,0); gpio_free(gpio_comp_en); @@ -2187,15 +1487,6 @@ err: gpio_direction_output(gpio_comp_en, 0); gpio_free(gpio_comp_en); -#ifdef CONFIG_SOC_EXYNOS5422 - if (!IS_ERR_OR_NULL(regulator)) { - ret = regulator_disable(regulator); - if (unlikely(ret)) { - pr_err("%s: regulator_disable(%s) fail\n", __func__, power_name); - } - regulator_put(regulator); - } -#endif return ret; } @@ -2204,81 +1495,6 @@ static int fimc_is_fan53555_remove(struct i2c_client *client) return 0; } -static int fimc_is_ncp6335b_probe(struct i2c_client *client, - const struct i2c_device_id *id) -{ - struct fimc_is_core *core; - int ret = 0; - - struct device_node *np; - int gpio_comp_en; - - BUG_ON(!fimc_is_dev); - - pr_info("%s start\n",__func__); - - core = (struct fimc_is_core *)dev_get_drvdata(fimc_is_dev); - if (!core) { - pr_err("core device is not yet probed"); - return -EPROBE_DEFER; - } - - np = of_find_compatible_node(NULL, NULL, "samsung,fimc_is_ncp6335b"); - if(np == NULL) { - pr_err("compatible: fail to read, fan_parse_dt\n"); - return -ENODEV; - } - - gpio_comp_en = of_get_named_gpio(np, "comp_en", 0); - if (!gpio_is_valid(gpio_comp_en)) - pr_err("failed to get comp en gpio\n"); - - ret = gpio_request(gpio_comp_en,"COMP_EN"); - if (ret < 0 ) - pr_err("gpio_request_error(%d)\n",ret); - - gpio_direction_output(gpio_comp_en,1); - - if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { - pr_err("%s: SMBUS Byte Data not Supported\n", __func__); - ret = -EIO; - goto err; - } - - core->companion_dcdc.client = client; - core->companion_dcdc.type = DCDC_VENDOR_NCP6335B; - core->companion_dcdc.get_vout_val = ncp6335b_get_vout_val; - core->companion_dcdc.get_vout_str = ncp6335b_get_vout_str; - core->companion_dcdc.set_vout = ncp6335b_set_voltage; - - ret = ncp6335b_set_voltage(client, 0xC0); - if (ret < 0) { - pr_err("%s: error, fail to set voltage\n", __func__); - goto err; - } - - ret = ncp6335b_read_voltage(client); - if (ret < 0) { - pr_err("%s: error, fail to read voltage\n", __func__); - goto err; - } - - pr_info("%s %s: ncp6335b probed\n", - dev_driver_string(&client->dev), dev_name(&client->dev)); - -err: - gpio_direction_output(gpio_comp_en,0); - gpio_free(gpio_comp_en); - - return ret; -} - -static int fimc_is_ncp6335b_remove(struct i2c_client *client) -{ - return 0; -} -#endif - static const struct of_device_id exynos_fimc_is_match[] = { { .compatible = "samsung,exynos5-fimc-is", @@ -2319,7 +1535,6 @@ static struct spi_driver fimc_is_spi1_driver = { module_spi_driver(fimc_is_spi1_driver); -#ifdef CONFIG_COMPANION_USE static struct of_device_id fan53555_dt_ids[] = { { .compatible = "samsung,fimc_is_fan53555",}, {}, @@ -2344,31 +1559,6 @@ static struct i2c_driver fan53555_driver = { }; module_i2c_driver(fan53555_driver); -static struct of_device_id ncp6335b_dt_ids[] = { - { .compatible = "samsung,fimc_is_ncp6335b",}, - {}, -}; -MODULE_DEVICE_TABLE(of, ncp6335b_dt_ids); - -static const struct i2c_device_id ncp6335b_id[] = { - {"fimc_is_ncp6335b", 0}, - {} -}; -MODULE_DEVICE_TABLE(i2c, ncp6335b_id); - -static struct i2c_driver ncp6335b_driver = { - .driver = { - .name = "fimc_is_ncp6335b", - .owner = THIS_MODULE, - .of_match_table = ncp6335b_dt_ids, - }, - .probe = fimc_is_ncp6335b_probe, - .remove = fimc_is_ncp6335b_remove, - .id_table = ncp6335b_id, -}; -module_i2c_driver(ncp6335b_driver); -#endif - static struct platform_driver fimc_is_driver = { .probe = fimc_is_probe, .remove = fimc_is_remove, @@ -2381,32 +1571,6 @@ static struct platform_driver fimc_is_driver = { }; module_platform_driver(fimc_is_driver); -#else -static struct platform_driver fimc_is_driver = { - .probe = fimc_is_probe, - .remove = __devexit_p(fimc_is_remove), - .driver = { - .name = FIMC_IS_DRV_NAME, - .owner = THIS_MODULE, - .pm = &fimc_is_pm_ops, - } -}; - -static int __init fimc_is_init(void) -{ - int ret = platform_driver_register(&fimc_is_driver); - if (ret) - err("platform_driver_register failed: %d\n", ret); - return ret; -} - -static void __exit fimc_is_exit(void) -{ - platform_driver_unregister(&fimc_is_driver); -} -module_init(fimc_is_init); -module_exit(fimc_is_exit); -#endif MODULE_AUTHOR("Jiyoung Shin"); MODULE_DESCRIPTION("Exynos FIMC_IS2 driver"); diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-core.h b/drivers/media/platform/exynos/fimc-is/fimc-is-core.h index 543983f..3130545 100644 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-core.h +++ b/drivers/media/platform/exynos/fimc-is/fimc-is-core.h @@ -34,16 +34,10 @@ #elif defined(CONFIG_VIDEOBUF2_ION) #include #endif -#ifdef CONFIG_COMPANION_USE #include #include #include #include "fimc-is-companion.h" -#ifdef CONFIG_SOC_EXYNOS5422 -#include -#include -#endif -#endif #include "fimc-is-param.h" #include "fimc-is-interface.h" @@ -124,26 +118,6 @@ #define GATE_IP_ODC (0) #define GATE_IP_DIS (1) #define GATE_IP_DNR (2) -#if defined(CONFIG_SOC_EXYNOS5422) -#define DVFS_L0 (600000) -#define DVFS_L1 (500000) -#define DVFS_L1_1 (480000) -#define DVFS_L1_2 (460000) -#define DVFS_L1_3 (440000) - -#define DVFS_MIF_L0 (825000) -#define DVFS_MIF_L1 (728000) -#define DVFS_MIF_L2 (633000) -#define DVFS_MIF_L3 (543000) -#define DVFS_MIF_L4 (413000) -#define DVFS_MIF_L5 (275000) - -#define I2C_L0 (108000000) -#define I2C_L1 (36000000) -#define I2C_L1_1 (54000000) -#define I2C_L2 (21600000) -#define DVFS_SKIP_FRAME_NUM (5) -#elif defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) #define DVFS_L0 (600000) #define DVFS_L1 (500000) #define DVFS_L1_1 (480000) @@ -162,14 +136,6 @@ #define I2C_L1_1 (54000000) #define I2C_L2 (21600000) #define DVFS_SKIP_FRAME_NUM (5) -#elif defined(CONFIG_SOC_EXYNOS3470) || defined(CONFIG_SOC_EXYNOS3472) ||defined(CONFIG_SOC_EXYNOS5260) || defined(CONFIG_SOC_EXYNOS4415) -#define DVFS_L0 (266000) -#define DVFS_MIF_L0 (400000) -#define I2C_L0 (108000000) -#define I2C_L1 (36000000) -#define I2C_L1_1 (54000000) -#define I2C_L2 (21600000) -#endif #define I2C_RETRY_COUNT 5 @@ -247,14 +213,12 @@ struct fimc_is_sysfs_debug { unsigned int clk_gate_mode; }; -#ifdef CONFIG_COMPANION_USE struct fimc_is_spi_gpio { char *spi_sclk; char *spi_ssn; char *spi_miso; char *spi_mois; }; -#endif struct fimc_is_core { struct platform_device *pdev; @@ -297,31 +261,21 @@ struct fimc_is_core { struct spi_device *spi0; struct spi_device *spi1; -#if defined(CONFIG_COMPANION_USE) struct i2c_client *client0; -#endif -#if defined(CONFIG_OIS_USE) struct i2c_client *client1; -#endif -#ifdef CONFIG_AF_HOST_CONTROL struct i2c_client *client2; -#endif struct i2c_client *eeprom_client0; struct i2c_client *eeprom_client1; -#ifdef CONFIG_COMPANION_USE struct dcdc_power companion_dcdc; struct fimc_is_spi_gpio spi_gpio; u32 companion_spi_channel; bool use_two_spi_line; -#endif u32 use_sensor_dynamic_voltage_mode; struct mutex spi_lock; -#ifdef CONFIG_OIS_USE bool use_ois; int pin_ois_en; bool ois_ver_read; -#endif /* CONFIG_OIS_USE */ bool use_ois_hsi2c; bool use_module_check; #ifdef USE_ION_ALLOC diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-device-af.c b/drivers/media/platform/exynos/fimc-is/fimc-is-device-af.c index 91ed4b9..367e3b1 100644 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-device-af.c +++ b/drivers/media/platform/exynos/fimc-is/fimc-is-device-af.c @@ -80,35 +80,6 @@ static void fimc_is_af_i2c_config(struct i2c_client *client, bool onoff) } } -int fimc_is_af_i2c_read(struct i2c_client *client, u16 addr, u16 *data) -{ - int err; - u8 rxbuf[2], txbuf[2]; - struct i2c_msg msg[2]; - - txbuf[0] = (addr & 0xff00) >> 8; - txbuf[1] = (addr & 0xff); - - msg[0].addr = client->addr; - msg[0].flags = 0; - msg[0].len = 2; - msg[0].buf = txbuf; - - msg[1].addr = client->addr; - msg[1].flags = I2C_M_RD; - msg[1].len = 2; - msg[1].buf = rxbuf; - - err = i2c_transfer(client->adapter, msg, 2); - if (unlikely(err != 2)) { - err("%s: register read fail err = %d\n", __func__, err); - return -EIO; - } - - *data = ((rxbuf[0] << 8) | rxbuf[1]); - return 0; -} - int fimc_is_af_i2c_write(struct i2c_client *client ,u16 addr, u16 data) { int retries = I2C_RETRY_COUNT; @@ -126,9 +97,6 @@ int fimc_is_af_i2c_write(struct i2c_client *client ,u16 addr, u16 data) buf[2] = data >> 8; buf[3] = data & 0xff; -#if 0 - pr_info("%s : W(0x%02X%02X%02X%02X)\n",__func__, buf[0], buf[1], buf[2], buf[3]); -#endif do { ret = i2c_transfer(client->adapter, &msg, 1); @@ -203,9 +171,7 @@ int fimc_is_af_ldo_enable(char *name, bool on) int fimc_is_af_power(struct fimc_is_device_af *af_device, bool onoff) { int ret = 0; -#ifdef CONFIG_OIS_USE int pin_ois_en = af_device->core->pin_ois_en; -#endif /*CAM_AF_2.8V_AP*/ ret = fimc_is_af_ldo_enable("CAM_AF_2.8V_AP", onoff); @@ -214,7 +180,6 @@ int fimc_is_af_power(struct fimc_is_device_af *af_device, bool onoff) return -EINVAL; } -#ifdef CONFIG_OIS_USE /* OIS_VDD_2.8V */ if (gpio_is_valid(pin_ois_en)) { if (onoff) { @@ -231,7 +196,6 @@ int fimc_is_af_power(struct fimc_is_device_af *af_device, bool onoff) err("failed to power control OIS_VM_2.8V, onoff = %d", onoff); return -EINVAL; } -#endif /*CAM_IO_1.8V_AP*/ ret = fimc_is_af_ldo_enable("CAM_IO_1.8V_AP", onoff); @@ -377,18 +341,14 @@ int16_t fimc_is_af_move_lens(struct fimc_is_core *core) return ret; } -#ifdef CONFIG_SENSORS_SSP_BBD extern int remove_af_noise_register(struct remove_af_noise *af_cam); extern void remove_af_noise_unregister(struct remove_af_noise *af_cam); -#endif static int fimc_is_af_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct fimc_is_device_af *device; struct fimc_is_core *core; -#ifdef CONFIG_SENSORS_SSP_BBD int ret; -#endif if (fimc_is_dev == NULL) { warn("fimc_is_dev is not yet probed"); @@ -418,11 +378,9 @@ static int fimc_is_af_probe(struct i2c_client *client, af_sensor_interface.af_pdata = device; af_sensor_interface.af_func = &fimc_is_af_enable; -#ifdef CONFIG_SENSORS_SSP_BBD ret = remove_af_noise_register(&af_sensor_interface); if (ret) err("reduce_af_noise_register failed: %d\n", ret); -#endif i2c_set_clientdata(client, device); return 0; @@ -430,9 +388,7 @@ static int fimc_is_af_probe(struct i2c_client *client, static int fimc_is_af_remove(struct i2c_client *client) { -#ifdef CONFIG_SENSORS_SSP_BBD remove_af_noise_unregister(&af_sensor_interface); -#endif return 0; } @@ -442,20 +398,16 @@ static const struct i2c_device_id af_id[] = { }; MODULE_DEVICE_TABLE(i2c, af_id); -#ifdef CONFIG_OF static struct of_device_id af_dt_ids[] = { { .compatible = "samsung,af",}, {}, }; -#endif static struct i2c_driver af_i2c_driver = { .driver = { .name = FIMC_IS_AF_DEV_NAME, .owner = THIS_MODULE, -#ifdef CONFIG_OF .of_match_table = af_dt_ids, -#endif }, .probe = fimc_is_af_probe, .remove = fimc_is_af_remove, diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-device-af.h b/drivers/media/platform/exynos/fimc-is/fimc-is-device-af.h index 9cd2e17..47108ef 100644 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-device-af.h +++ b/drivers/media/platform/exynos/fimc-is/fimc-is-device-af.h @@ -24,7 +24,6 @@ struct remove_af_noise { int16_t (*af_func)(void *, bool); }; -int fimc_is_af_i2c_read(struct i2c_client *client, u16 addr, u16 *data); int fimc_is_af_i2c_write(struct i2c_client *client ,u16 addr, u16 data); int16_t fimc_is_af_enable(void *device, bool onoff); int16_t fimc_is_af_move_lens(struct fimc_is_core *core); diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-device-companion.c b/drivers/media/platform/exynos/fimc-is/fimc-is-device-companion.c index eeac2eb..553d289 100644 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-device-companion.c +++ b/drivers/media/platform/exynos/fimc-is/fimc-is-device-companion.c @@ -40,12 +40,8 @@ #include "fimc-is-dt.h" #include "fimc-is-device-companion.h" #include "fimc-is-sec-define.h" -#if defined(CONFIG_OIS_USE) #include "fimc-is-device-ois.h" -#endif -#ifdef CONFIG_COMPANION_USE #include "fimc-is-companion-dt.h" -#endif extern int fimc_is_comp_video_probe(void *data); int fimc_is_companion_wait(struct fimc_is_device_companion *device) @@ -231,10 +227,8 @@ static int fimc_is_companion_gpio_on(struct fimc_is_device_companion *device) { int ret = 0; struct exynos_platform_fimc_is_sensor *pdata; -#if defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) struct fimc_is_from_info *sysfs_finfo; struct exynos_sensor_pin (*pin_ctrls)[2][GPIO_CTRL_MAX]; -#endif struct fimc_is_core *core; BUG_ON(!device); @@ -242,9 +236,7 @@ static int fimc_is_companion_gpio_on(struct fimc_is_device_companion *device) BUG_ON(!device->pdata); pdata = device->pdata; -#if defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) pin_ctrls = pdata->pin_ctrls; -#endif core = (struct fimc_is_core *)dev_get_drvdata(fimc_is_dev); if (test_bit(FIMC_IS_COMPANION_GPIO_ON, &device->state)) { @@ -260,7 +252,6 @@ static int fimc_is_companion_gpio_on(struct fimc_is_device_companion *device) core->running_rear_camera = true; -#if defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) if(core->use_sensor_dynamic_voltage_mode) { fimc_is_sec_get_sysfs_finfo(&sysfs_finfo); if (pin_ctrls[pdata->scenario][GPIO_SCENARIO_ON][0].name != NULL && @@ -273,7 +264,6 @@ static int fimc_is_companion_gpio_on(struct fimc_is_device_companion *device) } } -#if defined(CONFIG_SOC_EXYNOS5433) if (pin_ctrls[pdata->scenario][GPIO_SCENARIO_ON][1].name != NULL && !strcmp(pin_ctrls[pdata->scenario][GPIO_SCENARIO_ON][1].name, "CAM_SEN_CORE_1.2V_AP")) { if (sysfs_finfo->header_ver[1] == '1' && sysfs_finfo->header_ver[2] == '6' && sysfs_finfo->header_ver[4] == 'S') { @@ -283,9 +273,7 @@ static int fimc_is_companion_gpio_on(struct fimc_is_device_companion *device) pin_ctrls[pdata->scenario][GPIO_SCENARIO_ON][1].voltage = 1200000; } } -#endif } -#endif ret = pdata->gpio_cfg(device->pdev, pdata->scenario, GPIO_SCENARIO_ON); if (ret) { @@ -346,10 +334,8 @@ int fimc_is_companion_open(struct fimc_is_device_companion *device) static char companion_fw_name[100]; static char master_setf_name[100]; static char mode_setf_name[100]; -#if !defined(CONFIG_CAMERA_EEPROM_SUPPORT_REAR) static char fw_name[100]; static char setf_name[100]; -#endif BUG_ON(!device); @@ -369,13 +355,11 @@ int fimc_is_companion_open(struct fimc_is_device_companion *device) #else fimc_is_companion_runtime_resume(&device->pdev->dev); #endif -#if !defined(CONFIG_CAMERA_EEPROM_SUPPORT_REAR) ret = fimc_is_sec_fw_sel(core, &device->pdev->dev, fw_name, setf_name, false); if (ret < 0) { err("failed to select firmware (%d)", ret); goto p_err_pm; } -#endif ret = fimc_is_sec_concord_fw_sel(core, &device->pdev->dev, companion_fw_name, master_setf_name, mode_setf_name); /* TODO: loading firmware */ @@ -427,7 +411,6 @@ int fimc_is_companion_open(struct fimc_is_device_companion *device) device->companion_status = FIMC_IS_COMPANION_OPENDONE; fimc_is_companion_wakeup(device); -#if defined(CONFIG_OIS_USE) if(core->use_ois) { if (!core->use_ois_hsi2c) { pin_config_set(FIMC_IS_SPI_PINNAME, "gpc2-2", @@ -449,7 +432,6 @@ int fimc_is_companion_open(struct fimc_is_device_companion *device) PINCFG_PACK(PINCFG_TYPE_FUNC, 2)); } } -#endif info("[COMP:D] %s(%d)status(%d)\n", __func__, ret, device->companion_status); return ret; @@ -469,9 +451,7 @@ p_err: int fimc_is_companion_close(struct fimc_is_device_companion *device) { int ret = 0; -#if defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) u32 timeout; -#endif struct fimc_is_core *core = (struct fimc_is_core *)dev_get_drvdata(fimc_is_dev); if (!core) { err("core is NULL"); @@ -488,7 +468,6 @@ int fimc_is_companion_close(struct fimc_is_device_companion *device) #if defined(CONFIG_PM_RUNTIME) pm_runtime_put_sync(&device->pdev->dev); -#if defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) if (core != NULL && !test_bit(FIMC_IS_ISCHAIN_POWER_ON, &core->state)) { warn("only companion device closing after open.."); timeout = 2000; @@ -502,7 +481,6 @@ int fimc_is_companion_close(struct fimc_is_device_companion *device) err("CAM1 power down failed(CAM1:0x%08x, A5:0x%08x)\n", readl(PMUREG_CAM1_STATUS), readl(PMUREG_ISP_ARM_STATUS)); } -#endif #else fimc_is_companion_runtime_suspend(&device->pdev->dev); #endif /* CONFIG_PM_RUNTIME */ @@ -548,13 +526,11 @@ static int fimc_is_companion_probe(struct platform_device *pdev) device->companion_status = FIMC_IS_COMPANION_IDLE; -#ifdef CONFIG_OF ret = fimc_is_companion_parse_dt(pdev); if (ret) { err("parsing device tree is fail(%d)", ret); goto p_err; } -#endif pdata = dev_get_platdata(&pdev->dev); if (!pdata) { @@ -570,9 +546,7 @@ static int fimc_is_companion_probe(struct platform_device *pdev) platform_set_drvdata(pdev, device); device_init_wakeup(&pdev->dev, true); core->companion = device; -#ifdef CONFIG_OIS_USE core->pin_ois_en = device->pdata->pin_ois_en; -#endif /* init state */ clear_bit(FIMC_IS_COMPANION_OPEN, &device->state); @@ -637,19 +611,15 @@ int fimc_is_companion_runtime_suspend(struct device *dev) int ret = 0; struct platform_device *pdev = to_platform_device(dev); struct fimc_is_device_companion *device; -#ifdef CONFIG_AF_HOST_CONTROL struct fimc_is_core *core; -#endif info("%s\n", __func__); -#ifdef CONFIG_AF_HOST_CONTROL core = (struct fimc_is_core *)dev_get_drvdata(fimc_is_dev); if (!core) { err("core is NULL"); return -EINVAL; } -#endif device = (struct fimc_is_device_companion *)platform_get_drvdata(pdev); if (!device) { err("device is NULL"); @@ -689,7 +659,6 @@ int fimc_is_companion_runtime_resume(struct device *dev) int ret = 0; struct platform_device *pdev = to_platform_device(dev); struct fimc_is_device_companion *device; -#ifdef CONFIG_AF_HOST_CONTROL struct fimc_is_core *core; core = (struct fimc_is_core *)dev_get_drvdata(fimc_is_dev); @@ -697,7 +666,6 @@ int fimc_is_companion_runtime_resume(struct device *dev) err("core is NULL"); return -EINVAL; } -#endif device = (struct fimc_is_device_companion *)platform_get_drvdata(pdev); if (!device) { err("device is NULL"); @@ -736,7 +704,6 @@ static const struct dev_pm_ops fimc_is_companion_pm_ops = { .runtime_resume = fimc_is_companion_runtime_resume, }; -#ifdef CONFIG_OF static const struct of_device_id exynos_fimc_is_companion_match[] = { { .compatible = "samsung,exynos5-fimc-is-companion", @@ -757,45 +724,6 @@ static struct platform_driver fimc_is_companion_driver = { }; module_platform_driver(fimc_is_companion_driver); -#else -static struct platform_device_id fimc_is_companion_driver_ids[] = { - { - .name = FIMC_IS_COMPANION_DEV_NAME, - .driver_data = 0, - }, - {}, -}; -MODULE_DEVICE_TABLE(platform, fimc_is_companion_driver_ids); - -static struct platform_driver fimc_is_companion_driver = { - .probe = fimc_is_companion_probe, - .remove = __devexit_p(fimc_is_companion_remove), - .id_table = fimc_is_companion_driver_ids, - .driver = { - .name = FIMC_IS_COMPANION_DEV_NAME, - .owner = THIS_MODULE, - .pm = &fimc_is_companion_pm_ops, - } -}; - -static int __init fimc_is_companion_init(void) -{ - int ret = 0; - - ret = platform_driver_register(&fimc_is_companion_driver); - if (ret) - err("platform_driver_register failed: %d\n", ret); - - return ret; -} - -static void __exit fimc_is_companion_exit(void) -{ - platform_driver_unregister(&fimc_is_companion_driver); -} -module_init(fimc_is_companion_init); -module_exit(fimc_is_companion_exit); -#endif MODULE_AUTHOR("Wooki Min"); MODULE_DESCRIPTION("Exynos FIMC_IS_COMPANION driver"); diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-device-csi.c b/drivers/media/platform/exynos/fimc-is/fimc-is-device-csi.c index 1bbbbfe..2084c56 100644 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-device-csi.c +++ b/drivers/media/platform/exynos/fimc-is/fimc-is-device-csi.c @@ -27,13 +27,11 @@ #include "fimc-is-device-csi.h" #include "fimc-is-device-sensor.h" -#if (FIMC_IS_CSI_VERSION == CSI_VERSION_0000_0000) extern void s5pcsis_enable_interrupts(unsigned long __iomem *base_reg, struct fimc_is_image *image, bool on); extern void s5pcsis_set_hsync_settle(unsigned long __iomem *base_reg, int settle); extern void s5pcsis_set_params(unsigned long __iomem *base_reg, struct fimc_is_image *image, u32 lanes); extern void s5pcsis_reset(unsigned long __iomem *base_reg); extern void s5pcsis_system_enable(unsigned long __iomem *base_reg, int on, u32 lanes); -#endif static u32 get_hsync_settle(struct fimc_is_sensor_cfg *cfg, const u32 cfgs, u32 width, u32 height, u32 framerate) @@ -85,31 +83,6 @@ static u32 get_hsync_settle(struct fimc_is_sensor_cfg *cfg, return settle; } -#if (FIMC_IS_CSI_VERSION == CSI_VERSION_0310_0100) -static u32 get_vci_channel(struct fimc_is_vci *vci, - const u32 vcis, u32 pixelformat) -{ - u32 i; - u32 index = vcis; - - BUG_ON(!vci); - - for (i = 0; i < vcis; i++) { - if (vci[i].pixelformat == pixelformat) { - index = i; - break; - } - } - - if (index == vcis) { - err("invalid vc setting(foramt : %d)", pixelformat); - BUG(); - } - - return index; -} -#endif - int fimc_is_csi_open(struct v4l2_subdev *subdev) { int ret = 0; @@ -228,49 +201,12 @@ static int csi_stream_on(struct fimc_is_device_csi *csi) settle, csi->lanes); -#if (FIMC_IS_CSI_VERSION == CSI_VERSION_0000_0000) s5pcsis_reset(base_reg); s5pcsis_set_hsync_settle(base_reg, settle); s5pcsis_set_params(base_reg, &csi->image, csi->lanes); /* lane total count = csi->lanes + 1 (CSI_DATA_LANES_1 is 0) */ s5pcsis_system_enable(base_reg, true, (csi->lanes + 1)); s5pcsis_enable_interrupts(base_reg, &csi->image, true); -#else - csi_hw_reset(base_reg); - csi_hw_s_settle(base_reg, settle); - csi_hw_s_control(base_reg, csi->image.format.pixelformat, csi->mode, csi->lanes); - if (csi->mode == CSI_MODE_CH0_ONLY) { - csi_hw_s_config(base_reg, - CSI_VIRTUAL_CH_0, - CSI_VIRTUAL_CH_0, - csi->image.format.pixelformat, - csi->image.window.width, - csi->image.window.height); - } else { - u32 index = get_vci_channel(csi->vci, csi->vcis, csi->image.format.pixelformat); - csi_hw_s_config(base_reg, - CSI_VIRTUAL_CH_0, - csi->vci[index].vc_map[CSI_VIRTUAL_CH_0], - csi->image.format.pixelformat, - csi->image.window.width, - csi->image.window.height); - csi_hw_s_config(base_reg, - CSI_VIRTUAL_CH_1, - csi->vci[index].vc_map[CSI_VIRTUAL_CH_1], - csi->image.format.pixelformat, - csi->image.window.width, - csi->image.window.height); - csi_hw_s_config(base_reg, - CSI_VIRTUAL_CH_2, - csi->vci[index].vc_map[CSI_VIRTUAL_CH_2], - csi->image.format.pixelformat, - csi->image.window.width, - csi->image.window.height); - } - - csi_hw_s_interrupt(base_reg, true); - csi_hw_enable(base_reg); -#endif return ret; } @@ -284,14 +220,9 @@ static int csi_stream_off(struct fimc_is_device_csi *csi) base_reg = csi->base_reg; -#if (FIMC_IS_CSI_VERSION == CSI_VERSION_0000_0000) s5pcsis_enable_interrupts(base_reg, &csi->image, false); /* lane total count = csi->lanes + 1 (CSI_DATA_LANES_1 is 0) */ s5pcsis_system_enable(base_reg, false, (csi->lanes + 1)); -#else - csi_hw_s_interrupt(base_reg, false); - csi_hw_disable(base_reg); -#endif return ret; } diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-device-eeprom.c b/drivers/media/platform/exynos/fimc-is/fimc-is-device-eeprom.c deleted file mode 100644 index 368a84d..0000000 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-device-eeprom.c +++ /dev/null @@ -1,138 +0,0 @@ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "fimc-is-core.h" -#include "fimc-is-device-sensor.h" -#include "fimc-is-resourcemgr.h" -#include "fimc-is-hw.h" - -#define DRIVER_NAME "fimc_is_eeprom_i2c" -#define DRIVER_NAME_REAR "rear-eeprom-i2c" -#define DRIVER_NAME_FRONT "front-eeprom-i2c" -#define REAR_DATA 0 -#define FRONT_DATA 1 - - -/* - * Samsung Exynos5 SoC series FIMC-IS driver - * - * exynos5 fimc-is core functions - * - * Copyright (c) 2011 Samsung Electronics Co., Ltd - * - * 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. - */ - -int sensor_eeprom_probe(struct i2c_client *client, - const struct i2c_device_id *id) -{ - struct fimc_is_core *core; - static bool probe_retried = false; - - if (!fimc_is_dev) - goto probe_defer; - - core = (struct fimc_is_core *)dev_get_drvdata(fimc_is_dev); - if (!core) - goto probe_defer; - - if (id->driver_data == REAR_DATA) { - core->eeprom_client0 = client; - } else if (id->driver_data == FRONT_DATA) { - core->eeprom_client1 = client; - } else { - err("rear eeprom device is failed!"); - } - - pr_info("%s %s[%ld]: fimc_is_sensor_eeprom probed!\n", - dev_driver_string(&client->dev), dev_name(&client->dev), id->driver_data); - - return 0; - -probe_defer: - if (probe_retried) { - err("probe has already been retried!!"); - } - - probe_retried = true; - err("core device is not yet probed"); - return -EPROBE_DEFER; - -} - -static int sensor_eeprom_remove(struct i2c_client *client) -{ - int ret = 0; - return ret; -} - -#ifdef CONFIG_OF -static const struct of_device_id exynos_fimc_is_sensor_eeprom_match[] = { - { - .compatible = "samsung,rear-eeprom-i2c", .data = (void *)REAR_DATA - }, - { - .compatible = "samsung,front-eeprom-i2c", .data = (void *)FRONT_DATA - }, - {}, -}; -#endif - -static const struct i2c_device_id sensor_eeprom_idt[] = { - { DRIVER_NAME_REAR, REAR_DATA }, - { DRIVER_NAME_FRONT, FRONT_DATA }, -}; - -static struct i2c_driver sensor_eeprom_driver = { - .driver = { - .name = DRIVER_NAME, - .owner = THIS_MODULE, -#ifdef CONFIG_OF - .of_match_table = exynos_fimc_is_sensor_eeprom_match -#endif - }, - .probe = sensor_eeprom_probe, - .remove = sensor_eeprom_remove, - .id_table = sensor_eeprom_idt -}; - -static int __init sensor_eeprom_load(void) -{ - return i2c_add_driver(&sensor_eeprom_driver); -} - -static void __exit sensor_eeprom_unload(void) -{ - i2c_del_driver(&sensor_eeprom_driver); -} - -module_init(sensor_eeprom_load); -module_exit(sensor_eeprom_unload); - -MODULE_AUTHOR("Kyoungho Yun"); -MODULE_DESCRIPTION("Camera eeprom driver"); -MODULE_LICENSE("GPL v2"); - - diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-device-flite.c b/drivers/media/platform/exynos/fimc-is/fimc-is-device-flite.c index 7ed2d16..25cbe16 100644 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-device-flite.c +++ b/drivers/media/platform/exynos/fimc-is/fimc-is-device-flite.c @@ -729,11 +729,6 @@ int flite_hw_get_status2(unsigned long __iomem *base_reg) return status; } -void flite_hw_set_status1(unsigned long __iomem *base_reg, u32 val) -{ - writel(val, base_reg + TO_WORD_OFFSET(FLITE_REG_CISTATUS)); -} - int flite_hw_get_status1(unsigned long __iomem *base_reg) { u32 status = 0; @@ -788,11 +783,6 @@ void flite_hw_set_unuse_buffer(unsigned long __iomem *base_reg, u32 number) writel(buffer, base_reg + TO_WORD_OFFSET(FLITE_REG_CIFCNTSEQ)); } -u32 flite_hw_get_buffer_seq(unsigned long __iomem *base_reg) -{ - return readl(base_reg + TO_WORD_OFFSET(FLITE_REG_CIFCNTSEQ)); -} - void flite_hw_set_mux(unsigned long __iomem *base_reg, u32 csi_ch, u32 flite_ch) { u32 cfg; @@ -1332,32 +1322,6 @@ static irqreturn_t fimc_is_flite_isr(int irq, void *data) flite->instance); goto clear_status; /* HACK: Disable dead code because of Prevent Issue */ -#if 0 -#ifdef DBG_FLITEISR - printk(KERN_CONT "<"); -#endif - /* frame start interrupt */ - flite->sw_checker = EXPECT_FRAME_END; - if (flite->sw_trigger) - flite->sw_trigger = FLITE_A_SLOT_VALID; - else - flite->sw_trigger = FLITE_B_SLOT_VALID; - flite->tasklet_param_str = flite->sw_trigger; - atomic_inc(&flite->fcount); - notify_fcount(flite); - if (flite->buf_done_mode == FLITE_BUF_DONE_EARLY) - flite->early_work_skip = true; - tasklet_schedule(&flite->tasklet_flite_str); -#ifdef DBG_FLITEISR - printk(KERN_CONT ">"); -#endif - /* frame end interrupt */ - flite->sw_checker = EXPECT_FRAME_START; - flite->tasklet_param_end = flite->sw_trigger; - if (flite->buf_done_mode == FLITE_BUF_DONE_EARLY) - tasklet_schedule(&flite->tasklet_flite_early_end); - tasklet_schedule(&flite->tasklet_flite_end); -#endif } } else if (status == (2 << 4)) { /* W/A: Skip start tasklet at interrupt lost case */ diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-device-ischain.c b/drivers/media/platform/exynos/fimc-is/fimc-is-device-ischain.c index 2483bc6..98a6cee 100644 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-device-ischain.c +++ b/drivers/media/platform/exynos/fimc-is/fimc-is-device-ischain.c @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include @@ -42,9 +41,6 @@ #include #include #include -#if defined(CONFIG_SOC_EXYNOS3470) -#include -#endif #include "fimc-is-time.h" #include "fimc-is-core.h" @@ -56,33 +52,11 @@ #include "fimc-is-groupmgr.h" #include "fimc-is-device-ischain.h" #include "fimc-is-companion.h" -#include "fimc-is-clk-gate.h" -#include "fimc-is-dvfs.h" #include "fimc-is-device-companion.h" #include #include -#ifdef CONFIG_USE_VENDER_FEATURE #include "fimc-is-sec-define.h" -#else -#define SDCARD_FW -#define FIMC_IS_SETFILE_SDCARD_PATH "/data/" -#define FIMC_IS_FW "fimc_is_fw2.bin" -#define FIMC_IS_FW_SDCARD "/data/fimc_is_fw2.bin" - -#define FIMC_IS_FW_BASE_MASK ((1 << 26) - 1) -#define FIMC_IS_VERSION_SIZE 42 -#define FIMC_IS_SETFILE_VER_OFFSET 0x40 -#define FIMC_IS_SETFILE_VER_SIZE 52 - -#define FIMC_IS_CAL_SDCARD "/data/cal_data.bin" -#define FIMC_IS_CAL_SDCARD_FRONT "/data/cal_data_front.bin" -#define FIMC_IS_MAX_FW_SIZE (2048 * 1024) -#define FIMC_IS_CAL_START_ADDR (0x013D0000) -#define FIMC_IS_CAL_START_ADDR_FRONT (0x013E0000) -#define FIMC_IS_CAL_RETRY_CNT (2) -#define FIMC_IS_FW_RETRY_CNT (2) -#endif /* Default setting values */ #define DEFAULT_PREVIEW_STILL_WIDTH (1280) /* sensor margin : 16 */ @@ -111,11 +85,7 @@ static struct dentry *debugfs_file; static char fw_name[100]; //static char setf_name[100]; -#if defined(CONFIG_CAMERA_EEPROM_SUPPORT_REAR) -#define FIMC_IS_MAX_CAL_SIZE (8 * 1024) -#else #define FIMC_IS_MAX_CAL_SIZE (64 * 1024) -#endif #define FIMC_IS_MAX_CAL_SIZE_FRONT (8 * 1024) #define FIMC_IS_DEFAULT_CAL_SIZE (20 * 1024) @@ -125,12 +95,8 @@ extern bool crc32_check_front; extern bool crc32_header_check_front; static int cam_id; -#ifdef CONFIG_USE_VENDER_FEATURE extern bool is_dumped_fw_loading_needed; extern char fw_core_version; -#else -bool is_dumped_fw_loading_needed = false; -#endif static int isfw_debug_open(struct inode *inode, struct file *file) { @@ -793,16 +759,6 @@ static void fimc_is_ischain_version(struct fimc_is_device_ischain *this, char *n info("%s version : %s\n", name, version_str); } -void fimc_is_ischain_savefirm(struct fimc_is_device_ischain *this) -{ -#ifdef DEBUG_DUMP_FIRMWARE - loff_t pos; - - write_data_to_file("/data/firmware.bin", (char *)this->imemory.kvaddr, - (size_t)FIMC_IS_A5_MEM_SIZE, &pos); -#endif -} - static int fimc_is_ischain_loadfirm(struct fimc_is_device_ischain *device) { int ret = 0; @@ -830,7 +786,6 @@ static int fimc_is_ischain_loadfirm(struct fimc_is_device_ischain *device) set_fs(KERNEL_DS); fp = filp_open(FIMC_IS_FW_SDCARD, O_RDONLY, 0); if (IS_ERR_OR_NULL(fp)) { -#ifdef CONFIG_USE_VENDER_FEATURE if (is_dumped_fw_loading_needed && device->pdev->id == SENSOR_POSITION_REAR) { snprintf(fw_path, sizeof(fw_path), "%s%s", @@ -843,7 +798,6 @@ static int fimc_is_ischain_loadfirm(struct fimc_is_device_ischain *device) goto out; } } else -#endif goto request_fw; } @@ -1063,7 +1017,6 @@ static int fimc_is_ischain_loadsetf(struct fimc_is_device_ischain *device, FIMC_IS_SETFILE_SDCARD_PATH, setfile_name); fp = filp_open(setfile_path, O_RDONLY, 0); if (IS_ERR_OR_NULL(fp)) { -#ifdef CONFIG_USE_VENDER_FEATURE if (is_dumped_fw_loading_needed && device->pdev->id == SENSOR_POSITION_REAR) { memset(setfile_path, 0x00, sizeof(setfile_path)); @@ -1077,7 +1030,6 @@ static int fimc_is_ischain_loadsetf(struct fimc_is_device_ischain *device, goto out; } } else -#endif goto request_fw; } @@ -1205,95 +1157,16 @@ out: return ret; } -#if defined(CONFIG_CAMERA_EEPROM_SUPPORT_REAR) || defined(CONFIG_CAMERA_EEPROM_SUPPORT_FRONT) -static int fimc_is_ischain_loadcalb_eeprom(struct fimc_is_device_ischain *device, - struct fimc_is_module_enum *active_sensor, int id) - { - int ret = 0; -#ifdef CONFIG_USE_VENDER_FEATURE - char *cal_ptr; - char *cal_buf = NULL; - u32 start_addr = 0; - int cal_size = 0; - struct fimc_is_from_info *finfo; - - mdbgd_ischain("%s\n", device, __func__); - -#if defined(CONFIG_CAMERA_EEPROM_SUPPORT_FRONT) - if (id == SENSOR_POSITION_FRONT) { - start_addr = FIMC_IS_CAL_START_ADDR_FRONT; - cal_size = FIMC_IS_MAX_CAL_SIZE_FRONT; - fimc_is_sec_get_sysfs_finfo_front(&finfo); - fimc_is_sec_get_front_cal_buf(&cal_buf); - } else -#endif - { - start_addr = FIMC_IS_CAL_START_ADDR; - cal_size = FIMC_IS_MAX_CAL_SIZE; - fimc_is_sec_get_sysfs_finfo(&finfo); - fimc_is_sec_get_cal_buf(&cal_buf); - } - - cal_ptr = (char *)(device->imemory.kvaddr + start_addr); - - info("CAL DATA : MAP ver : %c%c%c%c\n", cal_buf[0x30], cal_buf[0x31], - cal_buf[0x32], cal_buf[0x33]); - /* CRC check */ - if (id == SENSOR_POSITION_FRONT) { - if (crc32_check_front == true) { - memcpy((void *)(cal_ptr) ,(void *)cal_buf, cal_size); - info("Front Camera : the dumped Cal. data was applied successfully.\n"); - } else { - if (crc32_header_check_front == true) { - pr_err("Front Camera : CRC32 error but only header section is no problem.\n"); - memset((void *)(cal_ptr + 0x1000), 0xFF, cal_size - 0x1000); - } else { - pr_err("Front Camera : CRC32 error for all section.\n"); - memset((void *)(cal_ptr), 0xFF, cal_size); - ret = -EIO; - } - } - } else { - if (crc32_check == true) { - memcpy((void *)(cal_ptr) ,(void *)cal_buf, cal_size); - info("Rear Camera : the dumped Cal. data was applied successfully.\n"); - } else { - if (crc32_header_check == true) { - pr_err("Rear Camera : CRC32 error but only header section is no problem.\n"); - memset((void *)(cal_ptr + 0x1000), 0xFF, cal_size - 0x1000); - } else { - pr_err("Rear Camera : CRC32 error for all section.\n"); - memset((void *)(cal_ptr), 0xFF, cal_size); - ret = -EIO; - } - } - } - - fimc_is_ischain_cache_flush(device, start_addr, cal_size); - if (ret) - mwarn("calibration loading is fail", device); - else - mwarn("calibration loading is success", device); - -#endif - return ret; - } -#endif - -#if !defined(CONFIG_CAMERA_EEPROM_SUPPORT_REAR) static int fimc_is_ischain_loadcalb(struct fimc_is_device_ischain *device, struct fimc_is_module_enum *active_sensor) { int ret = 0; -#ifdef CONFIG_USE_VENDER_FEATURE char *cal_ptr; struct fimc_is_from_info *sysfs_finfo; char *cal_buf; -#ifdef CONFIG_COMPANION_USE struct fimc_is_core *core = (struct fimc_is_core *)platform_get_drvdata(device->pdev); -#endif mdbgd_ischain("%s\n", device, __func__); cal_ptr = (char *)(device->imemory.kvaddr + FIMC_IS_CAL_START_ADDR); @@ -1306,17 +1179,12 @@ static int fimc_is_ischain_loadcalb(struct fimc_is_device_ischain *device, /* CRC check */ if (crc32_check == true) { -#ifdef CONFIG_COMPANION_USE if (fimc_is_comp_is_compare_ver(core) >= FROM_VERSION_V004) { memcpy((void *)(cal_ptr) ,(void *)cal_buf, FIMC_IS_MAX_CAL_SIZE); info("Camera : the dumped Cal. data was applied successfully.\n"); } else { info("Camera : Did not load dumped Cal. Sensor version is lower than V004.\n"); } -#else - memcpy((void *)(cal_ptr) ,(void *)cal_buf, FIMC_IS_MAX_CAL_SIZE); - info("Camera : the dumped Cal. data was applied successfully.\n"); -#endif } else { if (crc32_header_check == true) { pr_err("Camera : CRC32 error but only header section is no problem.\n"); @@ -1334,10 +1202,8 @@ static int fimc_is_ischain_loadcalb(struct fimc_is_device_ischain *device, mwarn("calibration loading is fail", device); else mwarn("calibration loading is success", device); -#endif return ret; } -#endif static void fimc_is_ischain_forcedown(struct fimc_is_device_ischain *this, bool on) { @@ -1354,21 +1220,6 @@ static void fimc_is_ischain_forcedown(struct fimc_is_device_ischain *this, } } -#if !defined(CONFIG_SOC_EXYNOS4415) -void tdnr_s3d_pixel_async_sw_reset(struct fimc_is_device_ischain *this) -{ - u32 cfg = readl(SYSREG_GSCBLK_CFG1); - /* S3D pixel async sw reset */ - cfg &= ~(1 << 25); - writel(cfg, SYSREG_GSCBLK_CFG1); - - cfg = readl(SYSREG_ISPBLK_CFG); - /* 3DNR pixel async sw reset */ - cfg &= ~(1 << 5); - writel(cfg, SYSREG_ISPBLK_CFG); -} -#endif - static void fimc_is_a5_power(struct device *dev, int power_flags) { u32 timeout; @@ -1378,13 +1229,8 @@ static void fimc_is_a5_power(struct device *dev, int power_flags) /* option */ if (power_flags) { -#if defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) /* A5 enable[15] */ writel((1 << 15), PMUREG_ISP_ARM_OPTION); -#else - /* STANDBY WFI[16] & A5 enable[15] */ - writel((1 << 16 | 1 << 15), PMUREG_ISP_ARM_OPTION); -#endif } /* status */ @@ -1399,9 +1245,7 @@ static void fimc_is_a5_power(struct device *dev, int power_flags) int fimc_is_ischain_power(struct fimc_is_device_ischain *device, int on) { -#ifdef CONFIG_ARM_TRUSTZONE int i; -#endif int ret = 0; u32 debug; #if defined(CONFIG_PM_RUNTIME) @@ -1430,37 +1274,10 @@ int fimc_is_ischain_power(struct fimc_is_device_ischain *device, int on) info("%s(%d) - fimc_is runtime resume complete\n", __func__, on); #endif -#if defined(CONFIG_CAMERA_EEPROM_SUPPORT_FRONT) - if (core->id == SENSOR_POSITION_FRONT) { - fimc_is_sec_get_sysfs_finfo(&sysfs_finfo); - if (!sysfs_finfo->is_caldata_read) { -#if defined(CONFIG_CAMERA_EEPROM_SUPPORT_REAR) - ret = fimc_is_sec_fw_sel_eeprom(dev, fw_name, setf_name, SENSOR_POSITION_REAR, true); -#else - ret = fimc_is_sec_fw_sel(core, dev, fw_name, setf_name, true); -#endif - } else { - snprintf(fw_name, sizeof(fw_name), "%s", sysfs_finfo->load_fw_name); - } - fimc_is_sec_get_sysfs_finfo_front(&sysfs_finfo); - if (!sysfs_finfo->is_caldata_read) { - ret = fimc_is_sec_fw_sel_eeprom(dev, fw_name, setf_name, SENSOR_POSITION_FRONT, false); - if (ret < 0) { - err("failed to select firmware (%d)", ret); - clear_bit(FIMC_IS_ISCHAIN_LOADED, &device->state); - goto p_err_pm; - } - } - } else -#endif { fimc_is_sec_get_sysfs_finfo(&sysfs_finfo); if (!sysfs_finfo->is_caldata_read) { -#if defined(CONFIG_CAMERA_EEPROM_SUPPORT_REAR) - ret = fimc_is_sec_fw_sel_eeprom(dev, fw_name, setf_name, SENSOR_POSITION_REAR, false); -#else ret = fimc_is_sec_fw_sel(core, dev, fw_name, setf_name, false); -#endif if (ret < 0) { err("failed to select firmware (%d)", ret); clear_bit(FIMC_IS_ISCHAIN_LOADED, &device->state); @@ -1471,14 +1288,12 @@ int fimc_is_ischain_power(struct fimc_is_device_ischain *device, int on) } } -#ifdef CONFIG_COMPANION_USE // ret = fimc_is_sec_concord_fw_sel(core, dev, device->pdata, companion_fw_name, master_setf_name, mode_setf_name); /*if (ret < 0) { err("failed to select companion firmware (%d)", ret); clear_bit(FIMC_IS_ISCHAIN_LOADED, &device->state); goto exit; }*/ -#endif /* 3. Load IS firmware */ ret = fimc_is_ischain_loadfirm(device); if (ret) { @@ -1489,9 +1304,6 @@ int fimc_is_ischain_power(struct fimc_is_device_ischain *device, int on) } set_bit(FIMC_IS_ISCHAIN_LOADED, &device->state); -#if defined(CONFIG_SOC_EXYNOS5422) - tdnr_s3d_pixel_async_sw_reset(device); -#endif /* defined(CONFIG_SOC_EXYNOS5422) */ /* 4. A5 start address setting */ mdbgd_ischain("imemory.base(dvaddr) : 0x%08x\n", device, device->imemory.dvaddr); mdbgd_ischain("imemory.base(kvaddr) : 0x%08X\n", device, device->imemory.kvaddr); @@ -1507,7 +1319,6 @@ int fimc_is_ischain_power(struct fimc_is_device_ischain *device, int on) if(device->imemory.dvaddr != val) err("dvaddr : %x , BBOAR : %x", device->imemory.dvaddr,val); -#ifdef CONFIG_ARM_TRUSTZONE exynos_smc(SMC_CMD_REG, SMC_REG_ID_SFR_W(PA_FIMC_IS_GIC_C + 0x4), 0x000000FF, 0); for (i = 0; i < 3; i++) exynos_smc(SMC_CMD_REG, SMC_REG_ID_SFR_W(PA_FIMC_IS_GIC_D + 0x80 + (i * 4)), 0xFFFFFFFF, 0); @@ -1518,7 +1329,6 @@ int fimc_is_ischain_power(struct fimc_is_device_ischain *device, int on) info("%s : PA_FIMC_IS_GIC_C : 0x%08x\n", __func__, debug); if (debug == 0x00) merr("secure configuration is fail[0x131E0004:%08X]", device, debug); -#endif /* To guarantee FW restart */ if (__raw_readl(PMUREG_ISP_ARM_STATUS) & 0x1) { @@ -2162,9 +1972,6 @@ int fimc_is_itf_stream_on(struct fimc_is_device_ischain *device) { int ret = 0; u32 retry = 10000; -#ifdef ENABLE_DVFS - int scenario_id; -#endif struct fimc_is_group *group_3aa, *group_isp; struct fimc_is_resourcemgr *resourcemgr; @@ -2201,23 +2008,6 @@ int fimc_is_itf_stream_on(struct fimc_is_device_ischain *device) else pr_err("[ISC:D:%d] stream on NOT ready\n", device->instance); -#ifdef ENABLE_DVFS - mutex_lock(&resourcemgr->dvfs_ctrl.lock); - if ((!pm_qos_request_active(&device->user_qos)) && - (sysfs_debug.en_dvfs)) { - /* try to find dynamic scenario to apply */ - scenario_id = fimc_is_dvfs_sel_scenario(FIMC_IS_STATIC_SN, device, NULL); - if (scenario_id >= 0) { - struct fimc_is_dvfs_scenario_ctrl *static_ctrl = - resourcemgr->dvfs_ctrl.static_ctrl; - info("[ISC:D:%d] static scenario(%d)-[%s]\n", - device->instance, scenario_id, - static_ctrl->scenarios[static_ctrl->cur_scenario_idx].scenario_nm); - fimc_is_set_dvfs(device, scenario_id); - } - } - mutex_unlock(&resourcemgr->dvfs_ctrl.lock); -#endif ret = fimc_is_hw_stream_on(device->interface, device->instance); if (ret) { merr("fimc_is_hw_stream_on is fail(%d)", device, ret); @@ -2255,21 +2045,8 @@ int fimc_is_itf_process_stop(struct fimc_is_device_ischain *device, { int ret = 0; -#ifdef ENABLE_CLOCK_GATE - struct fimc_is_core *core = (struct fimc_is_core *)device->interface->core; - if (sysfs_debug.en_clk_gate && - sysfs_debug.clk_gate_mode == CLOCK_GATE_MODE_HOST) { - fimc_is_clk_gate_lock_set(core, device->instance, true); - fimc_is_wrap_clk_gate_set(core, (1 << GROUP_ID_MAX) - 1, true); - } -#endif ret = fimc_is_hw_process_off(device->interface, device->instance, group, 0); -#ifdef ENABLE_CLOCK_GATE - if (sysfs_debug.en_clk_gate && - sysfs_debug.clk_gate_mode == CLOCK_GATE_MODE_HOST) - fimc_is_clk_gate_lock_set(core, device->instance, false); -#endif return ret; } @@ -2278,28 +2055,14 @@ int fimc_is_itf_force_stop(struct fimc_is_device_ischain *device, { int ret = 0; -#ifdef ENABLE_CLOCK_GATE - struct fimc_is_core *core = (struct fimc_is_core *)device->interface->core; -#endif /* if there's only one group of isp, send group id by 3a0 */ if ((group & GROUP_ID(GROUP_ID_ISP)) && GET_FIMC_IS_NUM_OF_SUBIP2(device, 3a0) == 0 && GET_FIMC_IS_NUM_OF_SUBIP2(device, 3a1) == 0) group = GROUP_ID(GROUP_ID_3A0); -#ifdef ENABLE_CLOCK_GATE - if (sysfs_debug.en_clk_gate && - sysfs_debug.clk_gate_mode == CLOCK_GATE_MODE_HOST) { - fimc_is_clk_gate_lock_set(core, device->instance, true); - fimc_is_wrap_clk_gate_set(core, (1 << GROUP_ID_MAX) - 1, true); - } -#endif ret = fimc_is_hw_process_off(device->interface, device->instance, group, 1); -#ifdef ENABLE_CLOCK_GATE - if (sysfs_debug.en_clk_gate && - sysfs_debug.clk_gate_mode == CLOCK_GATE_MODE_HOST) - fimc_is_clk_gate_lock_set(core, device->instance, false); -#endif + return ret; } @@ -2329,9 +2092,6 @@ static int fimc_is_itf_init_process_stop(struct fimc_is_device_ischain *device) int ret = 0; u32 group = 0; -#ifdef ENABLE_CLOCK_GATE - struct fimc_is_core *core = (struct fimc_is_core *)device->interface->core; -#endif group |= GROUP_ID(device->group_3aa.id); group |= GROUP_ID(device->group_isp.id); @@ -2340,21 +2100,8 @@ static int fimc_is_itf_init_process_stop(struct fimc_is_device_ischain *device) GET_FIMC_IS_NUM_OF_SUBIP2(device, 3a0) == 0 && GET_FIMC_IS_NUM_OF_SUBIP2(device, 3a1) == 0) group = GROUP_ID(GROUP_ID_3A0); -#ifdef ENABLE_CLOCK_GATE - if (sysfs_debug.en_clk_gate && - sysfs_debug.clk_gate_mode == CLOCK_GATE_MODE_HOST) { - fimc_is_clk_gate_lock_set(core, device->instance, true); - fimc_is_wrap_clk_gate_set(core, (1 << GROUP_ID_MAX) - 1, true); - - } -#endif ret = fimc_is_hw_process_off(device->interface, device->instance, (group & GROUP_ID_PARM_MASK), 0); -#ifdef ENABLE_CLOCK_GATE - if (sysfs_debug.en_clk_gate && - sysfs_debug.clk_gate_mode == CLOCK_GATE_MODE_HOST) - fimc_is_clk_gate_lock_set(core, device->instance, false); -#endif return ret; } @@ -2480,21 +2227,7 @@ int fimc_is_itf_g_capability(struct fimc_is_device_ischain *this) int fimc_is_itf_power_down(struct fimc_is_interface *interface) { int ret = 0; -#ifdef ENABLE_CLOCK_GATE - /* HACK */ - struct fimc_is_core *core = (struct fimc_is_core *)interface->core; - if (sysfs_debug.en_clk_gate && - sysfs_debug.clk_gate_mode == CLOCK_GATE_MODE_HOST) { - fimc_is_clk_gate_lock_set(core, 0, true); - fimc_is_wrap_clk_gate_set(core, (1 << GROUP_ID_MAX) - 1, true); - } -#endif ret = fimc_is_hw_power_down(interface, 0); -#ifdef ENABLE_CLOCK_GATE - if (sysfs_debug.en_clk_gate && - sysfs_debug.clk_gate_mode == CLOCK_GATE_MODE_HOST) - fimc_is_clk_gate_lock_set(core, 0, false); -#endif return ret; } @@ -2525,9 +2258,6 @@ static int fimc_is_itf_grp_shot(struct fimc_is_device_ischain *device, { int ret = 0; u32 group_id = 0; -#ifdef ENABLE_CLOCK_GATE - struct fimc_is_core *core = (struct fimc_is_core *)device->interface->core; -#endif BUG_ON(!device); BUG_ON(!group); BUG_ON(!frame); @@ -2565,13 +2295,6 @@ static int fimc_is_itf_grp_shot(struct fimc_is_device_ischain *device, #endif #endif -#ifdef ENABLE_CLOCK_GATE - /* HACK */ - /* dynamic clock on */ - if (sysfs_debug.en_clk_gate && - sysfs_debug.clk_gate_mode == CLOCK_GATE_MODE_HOST) - fimc_is_clk_gate_set(core, group->id, true, false, true); -#endif group_id = GROUP_ID(group->id); /* if there's only one group of isp, send group id by 3a0 */ @@ -2725,9 +2448,6 @@ int fimc_is_ischain_open(struct fimc_is_device_ischain *device, { int ret = 0; struct fimc_is_ishcain_mem *imemory; -#ifdef ENABLE_CLOCK_GATE - struct fimc_is_core *core; -#endif BUG_ON(!device); BUG_ON(!device->groupmgr); BUG_ON(!vctx); @@ -2839,14 +2559,6 @@ int fimc_is_ischain_open(struct fimc_is_device_ischain *device, set_bit(FIMC_IS_ISCHAIN_OPEN, &device->state); -#ifdef ENABLE_CLOCK_GATE - if (sysfs_debug.en_clk_gate && - sysfs_debug.clk_gate_mode == CLOCK_GATE_MODE_HOST) { - core = (struct fimc_is_core *)device->interface->core; - fimc_is_clk_gate_lock_set(core, device->instance, true); - fimc_is_wrap_clk_gate_set(core, (1 << GROUP_ID_MAX) - 1, true); - } -#endif p_err: info("[ISC:D:%d] %s(%d)\n", device->instance, __func__, ret); return ret; @@ -2862,9 +2574,7 @@ int fimc_is_ischain_close(struct fimc_is_device_ischain *device, struct fimc_is_subdev *leader; struct fimc_is_queue *queue; struct fimc_is_core *core; -#ifdef CONFIG_COMPANION_USE struct fimc_is_spi_gpio *spi_gpio; -#endif BUG_ON(!device); groupmgr = device->groupmgr; @@ -2873,9 +2583,7 @@ int fimc_is_ischain_close(struct fimc_is_device_ischain *device, queue = GET_SRC_QUEUE(vctx); core = (struct fimc_is_core *)device->interface->core; refcount = atomic_read(&vctx->video->refcount); -#ifdef CONFIG_COMPANION_USE spi_gpio = &core->spi_gpio; -#endif if (refcount < 0) { merr("invalid ischain refcount", device); ret = -ENODEV; @@ -2888,14 +2596,6 @@ int fimc_is_ischain_close(struct fimc_is_device_ischain *device, goto exit; } -#ifdef ENABLE_CLOCK_GATE - core = (struct fimc_is_core *)device->interface->core; - if (sysfs_debug.en_clk_gate && - sysfs_debug.clk_gate_mode == CLOCK_GATE_MODE_HOST) { - fimc_is_clk_gate_lock_set(core, device->instance, true); - fimc_is_wrap_clk_gate_set(core, (1 << GROUP_ID_MAX) - 1, true); - } -#endif /* 1. Stop all request */ ret = fimc_is_ischain_isp_stop(device, leader, queue); if (ret) @@ -2931,15 +2631,8 @@ int fimc_is_ischain_close(struct fimc_is_device_ischain *device, clear_bit(FIMC_IS_ISCHAIN_OPEN_SENSOR, &device->state); clear_bit(FIMC_IS_ISCHAIN_OPEN, &device->state); -#ifdef CONFIG_COMPANION_USE fimc_is_set_spi_config(spi_gpio, FIMC_IS_SPI_OUTPUT, true); -#endif -#ifdef ENABLE_CLOCK_GATE - if (sysfs_debug.en_clk_gate && - sysfs_debug.clk_gate_mode == CLOCK_GATE_MODE_HOST) - fimc_is_clk_gate_lock_set(core, device->instance, false); -#endif exit: pr_info("[ISC:D:%d] %s(%d)\n", device->instance, __func__, ret); return ret; @@ -2954,12 +2647,10 @@ static int fimc_is_ischain_init(struct fimc_is_device_ischain *device, int ret = 0; struct fimc_is_module_enum *module; struct fimc_is_device_sensor *sensor; -#ifdef CONFIG_COMPANION_USE struct fimc_is_core *core = (struct fimc_is_core *)platform_get_drvdata(device->pdev); /* Workaround for Host to use ISP-SPI. Will be removed later.*/ // struct fimc_is_spi_gpio *spi_gpio = &core->spi_gpio; -#endif BUG_ON(!device); BUG_ON(!device->sensor); @@ -2995,28 +2686,15 @@ static int fimc_is_ischain_init(struct fimc_is_device_ischain *device, if(sensor->instance == 0) { /* Load calibration data from sensor */ module->ext.sensor_con.cal_address = FIMC_IS_CAL_START_ADDR; -#if defined(CONFIG_CAMERA_EEPROM_SUPPORT_REAR) - ret = fimc_is_ischain_loadcalb_eeprom(device, NULL, SENSOR_POSITION_REAR); -#else ret = fimc_is_ischain_loadcalb(device, NULL); -#endif if (ret) { err("loadcalb fail, load default caldata\n"); } } else { -#if defined(CONFIG_CAMERA_EEPROM_SUPPORT_FRONT) - module->ext.sensor_con.cal_address = FIMC_IS_CAL_START_ADDR_FRONT; - ret = fimc_is_ischain_loadcalb_eeprom(device, NULL, SENSOR_POSITION_FRONT); - if (ret) { - err("loadcalb fail, load default caldata\n"); - } -#else module->ext.sensor_con.cal_address = 0; -#endif } } -#ifdef CONFIG_COMPANION_USE if(core->companion->companion_status != FIMC_IS_COMPANION_IDLE) { pr_info("[ISC:D:%d] fimc_is_companion_wait wait(%d)\n", device->instance,core->companion->companion_status); fimc_is_companion_wait(core->companion); @@ -3025,54 +2703,6 @@ static int fimc_is_ischain_init(struct fimc_is_device_ischain *device, fimc_is_s_int_comb_isp(core, false, INTMR2_INTMCIS22); -#if 0 - /* FW loading of peripheral device */ - if ((module->position == SENSOR_POSITION_REAR) - && !test_bit(FIMC_IS_ISCHAIN_REPROCESSING, &device->state)) { - // Workaround for Host to use ISP-SPI. Will be removed later. - /* set pin output for Host to use SPI*/ - pin_config_set(FIMC_IS_SPI_PINNAME, spi_gpio->spi_ssn, - PINCFG_PACK(PINCFG_TYPE_FUNC, FUNC_OUTPUT)); - - fimc_is_set_spi_config(spi_gpio, FIMC_IS_SPI_FUNC, false); - - if (fimc_is_comp_is_valid(core) == 0) { - fimc_is_power_binning(core); - ret = fimc_is_comp_loadfirm(core); - if (ret) { - err("fimc_is_comp_loadfirm() fail"); - goto p_err; - } - ret = fimc_is_comp_loadcal(core); - if (ret) { - err("fimc_is_comp_loadcal() fail"); - } - ret = fimc_is_comp_loadsetf(core); - if (ret) { - err("fimc_is_comp_loadsetf() fail"); - goto p_err; - } - } else { - module->ext.companion_con.product_name - = COMPANION_NAME_NOTHING; - } - // Workaround for Host to use ISP-SPI. Will be removed later. - /* Set SPI pins to low before changing pin function */ - pin_config_set(FIMC_IS_SPI_PINNAME, spi_gpio->spi_sclk, - PINCFG_PACK(PINCFG_TYPE_DAT, 0)); - pin_config_set(FIMC_IS_SPI_PINNAME, spi_gpio->spi_ssn, - PINCFG_PACK(PINCFG_TYPE_DAT, 0)); - pin_config_set(FIMC_IS_SPI_PINNAME, spi_gpio->spi_miso, - PINCFG_PACK(PINCFG_TYPE_DAT, 0)); - pin_config_set(FIMC_IS_SPI_PINNAME, spi_gpio->spi_mois, - PINCFG_PACK(PINCFG_TYPE_DAT, 0)); - - /* Set pin function for A5 to use SPI */ - pin_config_set(FIMC_IS_SPI_PINNAME, spi_gpio->spi_ssn, - PINCFG_PACK(PINCFG_TYPE_FUNC, 2)); - } -#endif -#endif ret = fimc_is_itf_enum(device); if (ret) { @@ -6882,14 +6512,6 @@ p_err: return ret; } -int fimc_is_ischain_vdo_s_format(struct fimc_is_device_ischain *this, - u32 width, u32 height) -{ - int ret = 0; - - return ret; -} - int fimc_is_ischain_vdo_buffer_queue(struct fimc_is_device_ischain *device, struct fimc_is_queue *queue, u32 index) @@ -6957,27 +6579,6 @@ int fimc_is_ischain_g_capability(struct fimc_is_device_ischain *this, return ret; } -int fimc_is_ischain_print_status(struct fimc_is_device_ischain *device) -{ - int ret = 0; - struct fimc_is_video_ctx *vctx; - struct fimc_is_subdev *isp; - struct fimc_is_framemgr *framemgr; - struct fimc_is_interface *itf; - - isp = &device->group_isp.leader; - vctx = isp->vctx; - framemgr = GET_SRC_FRAMEMGR(vctx); - itf = device->interface; - - fimc_is_frame_print_free_list(framemgr); - fimc_is_frame_print_request_list(framemgr); - fimc_is_frame_print_process_list(framemgr); - fimc_is_frame_print_complete_list(framemgr); - - return ret; -} - int fimc_is_ischain_3aa_callback(struct fimc_is_device_ischain *device, struct fimc_is_frame *check_frame) { @@ -7560,98 +7161,3 @@ p_err: return ret; } - -int fimc_is_ischain_camctl(struct fimc_is_device_ischain *this, - struct fimc_is_frame *frame, - u32 fcount) -{ - int ret = 0; -#ifdef ENABLE_SENSOR_DRIVER - struct fimc_is_interface *itf; - struct camera2_uctl *applied_ctl; - - struct camera2_sensor_ctl *isp_sensor_ctl; - struct camera2_lens_ctl *isp_lens_ctl; - struct camera2_flash_ctl *isp_flash_ctl; - - u32 index; - -#ifdef DBG_STREAMING - mdbgd_ischain("%s()\n", device, __func__); -#endif - - itf = this->interface; - isp_sensor_ctl = &itf->isp_peri_ctl.sensorUd.ctl; - isp_lens_ctl = &itf->isp_peri_ctl.lensUd.ctl; - isp_flash_ctl = &itf->isp_peri_ctl.flashUd.ctl; - - /*lens*/ - index = (fcount + 0) & SENSOR_MAX_CTL_MASK; - applied_ctl = &this->peri_ctls[index]; - applied_ctl->lensUd.ctl.focusDistance = isp_lens_ctl->focusDistance; - - /*sensor*/ - index = (fcount + 1) & SENSOR_MAX_CTL_MASK; - applied_ctl = &this->peri_ctls[index]; - applied_ctl->sensorUd.ctl.exposureTime = isp_sensor_ctl->exposureTime; - applied_ctl->sensorUd.ctl.frameDuration = isp_sensor_ctl->frameDuration; - applied_ctl->sensorUd.ctl.sensitivity = isp_sensor_ctl->sensitivity; - - /*flash*/ - index = (fcount + 0) & SENSOR_MAX_CTL_MASK; - applied_ctl = &this->peri_ctls[index]; - applied_ctl->flashUd.ctl.flashMode = isp_flash_ctl->flashMode; - applied_ctl->flashUd.ctl.firingPower = isp_flash_ctl->firingPower; - applied_ctl->flashUd.ctl.firingTime = isp_flash_ctl->firingTime; -#endif - return ret; -} - -int fimc_is_ischain_tag(struct fimc_is_device_ischain *ischain, - struct fimc_is_frame *frame) -{ - int ret = 0; -#ifdef ENABLE_SENSOR_DRIVER - struct camera2_uctl *applied_ctl; - struct timeval curtime; - u32 fcount; - - fcount = frame->fcount; - applied_ctl = &ischain->peri_ctls[fcount & SENSOR_MAX_CTL_MASK]; - - do_gettimeofday(&curtime); - - /* Request */ - frame->shot->dm.request.frameCount = fcount; - - /* Lens */ - frame->shot->dm.lens.focusDistance = - applied_ctl->lensUd.ctl.focusDistance; - - /* Sensor */ - frame->shot->dm.sensor.exposureTime = - applied_ctl->sensorUd.ctl.exposureTime; - frame->shot->dm.sensor.sensitivity = - applied_ctl->sensorUd.ctl.sensitivity; - frame->shot->dm.sensor.frameDuration = - applied_ctl->sensorUd.ctl.frameDuration; - frame->shot->dm.sensor.timeStamp = - (uint64_t)curtime.tv_sec*1000000 + curtime.tv_usec; - - /* Flash */ - frame->shot->dm.flash.flashMode = - applied_ctl->flashUd.ctl.flashMode; - frame->shot->dm.flash.firingPower = - applied_ctl->flashUd.ctl.firingPower; - frame->shot->dm.flash.firingTime = - applied_ctl->flashUd.ctl.firingTime; -#else - struct timespec curtime; - - do_posix_clock_monotonic_gettime(&curtime); - - frame->shot->dm.request.frameCount = frame->fcount; - frame->shot->dm.sensor.timeStamp = fimc_is_get_timestamp(); -#endif - return ret; -} diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-device-ischain.h b/drivers/media/platform/exynos/fimc-is/fimc-is-device-ischain.h index 9c0f281..0af407b 100644 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-device-ischain.h +++ b/drivers/media/platform/exynos/fimc-is/fimc-is-device-ischain.h @@ -12,8 +12,6 @@ #ifndef FIMC_IS_DEVICE_ISCHAIN_H #define FIMC_IS_DEVICE_ISCHAIN_H -#include - #include "fimc-is-mem.h" #include "fimc-is-subdev-ctrl.h" #include "fimc-is-groupmgr.h" @@ -43,13 +41,8 @@ #define FIMC_IS_CRANGE_FULL 0 #define FIMC_IS_CRANGE_LIMITED 1 -#if defined(CONFIG_SOC_EXYNOS5422) -#define FIMC_IS_SPI_PINNAME "14000000.pinctrl" -#endif -#if defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) #define FIMC_IS_SPI_PINNAME "14cc0000.pinctrl" -#endif #define FIMC_IS_SPI_OUTPUT 1 #define FIMC_IS_SPI_FUNC 2 @@ -68,12 +61,10 @@ enum fimc_is_camera_device { CAMERA_SINGLE_FRONT, }; -#ifdef CONFIG_COMPANION_USE enum fimc_is_companion_sensor { COMPANION_SENSOR_2P2 = 1, COMPANION_SENSOR_IMX240 = 2, }; -#endif struct fimc_is_from_info { u32 bin_start_addr; @@ -86,7 +77,6 @@ struct fimc_is_from_info { u32 shading_end_addr; u32 setfile_start_addr; u32 setfile_end_addr; -#ifdef CONFIG_COMPANION_USE u32 concord_master_setfile_start_addr; u32 concord_master_setfile_end_addr; u32 concord_mode_setfile_start_addr; @@ -137,7 +127,6 @@ struct fimc_is_from_info { char load_c1_mastersetf_name[50]; char load_c1_modesetf_name[50]; int sensor_id; -#endif char header_ver[12]; char cal_map_ver[4]; char setfile_ver[7]; @@ -150,12 +139,10 @@ struct fimc_is_from_info { bool is_caldata_read; }; -#ifdef CONFIG_OIS_USE struct fimc_is_ois_info { char header_ver[7]; char load_fw_name[50]; }; -#endif struct fimc_is_ishcain_mem { /* buffer base */ @@ -277,7 +264,6 @@ struct fimc_is_device_ischain { u32 private_data; struct fimc_is_device_sensor *sensor; - struct pm_qos_request user_qos; }; /*global function*/ @@ -298,7 +284,6 @@ int fimc_is_ischain_init_wrap(struct fimc_is_device_ischain *device, u32 input); int fimc_is_ischain_g_capability(struct fimc_is_device_ischain *this, u32 user_ptr); -int fimc_is_ischain_print_status(struct fimc_is_device_ischain *this); void fimc_is_ischain_meta_invalid(struct fimc_is_frame *frame); /* 3AA subdev */ @@ -366,8 +351,6 @@ int fimc_is_ischain_vdo_start(struct fimc_is_device_ischain *device, int fimc_is_ischain_vdo_stop(struct fimc_is_device_ischain *device, struct fimc_is_subdev *leader, struct fimc_is_queue *queue); -int fimc_is_ischain_vdo_s_format(struct fimc_is_device_ischain *this, - u32 width, u32 height); int fimc_is_ischain_vdo_buffer_queue(struct fimc_is_device_ischain *device, struct fimc_is_queue *queue, u32 index); @@ -381,11 +364,6 @@ int fimc_is_ischain_isp_callback(struct fimc_is_device_ischain *device, struct fimc_is_frame *frame); int fimc_is_ischain_dis_callback(struct fimc_is_device_ischain *device, struct fimc_is_frame *frame); -int fimc_is_ischain_camctl(struct fimc_is_device_ischain *this, - struct fimc_is_frame *frame, - u32 fcount); -int fimc_is_ischain_tag(struct fimc_is_device_ischain *ischain, - struct fimc_is_frame *frame); int fimc_is_itf_stream_on(struct fimc_is_device_ischain *this); int fimc_is_itf_stream_off(struct fimc_is_device_ischain *this); @@ -407,7 +385,6 @@ extern const struct fimc_is_queue_ops fimc_is_ischain_sub_ops; int fimc_is_itf_power_down(struct fimc_is_interface *interface); int fimc_is_ischain_power(struct fimc_is_device_ischain *this, int on); -void fimc_is_ischain_savefirm(struct fimc_is_device_ischain *this); #define IS_ISCHAIN_OTF(device) \ (test_bit(FIMC_IS_GROUP_OTF_INPUT, &(device)->group_3aa.state)) diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-device-ois.c b/drivers/media/platform/exynos/fimc-is/fimc-is-device-ois.c index 7dd1eec..619e849 100644 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-device-ois.c +++ b/drivers/media/platform/exynos/fimc-is/fimc-is-device-ois.c @@ -30,9 +30,7 @@ #include #include "exynos-fimc-is-sensor.h" #include -#ifdef CONFIG_OIS_FW_UPDATE_THREAD_USE #include -#endif #include "fimc-is-core.h" #include "fimc-is-interface.h" @@ -40,9 +38,7 @@ #include "fimc-is-device-ischain.h" #include "fimc-is-dt.h" #include "fimc-is-device-ois.h" -#ifdef CONFIG_AF_HOST_CONTROL #include "fimc-is-device-af.h" -#endif #define FIMC_IS_OIS_SDCARD_PATH "/data/media/0/" #define FIMC_IS_OIS_DEV_NAME "exynos-fimc-is-ois" @@ -69,9 +65,7 @@ static struct fimc_is_ois_info ois_uinfo; static struct fimc_is_ois_exif ois_exif_data; static bool fw_sdcard; static bool not_crc_bin; -#ifdef CONFIG_OIS_FW_UPDATE_THREAD_USE static struct task_struct *ois_ts; -#endif static void fimc_is_ois_i2c_config(struct i2c_client *client, bool onoff) { @@ -158,9 +152,6 @@ int fimc_is_ois_i2c_write(struct i2c_client *client ,u16 addr, u8 data) buf[1] = addr & 0xff; buf[2] = data; -#if 0 - pr_info("%s : W(0x%02X%02X %02X)\n",__func__, buf[0], buf[1], buf[2]); -#endif do { ret = i2c_transfer(client->adapter, &msg, 1); @@ -203,9 +194,6 @@ int fimc_is_ois_i2c_write_multi(struct i2c_client *client ,u16 addr, u8 *data, s for (i = 0; i < size - 2; i++) { buf[i + 2] = *(data + i); } -#if 0 - pr_info("OISLOG %s : W(0x%02X%02X%02X)\n", __func__, buf[0], buf[1], buf[2]); -#endif do { ret = i2c_transfer(client->adapter, &msg, 1); if (likely(ret == 1)) @@ -312,31 +300,6 @@ p_err: return ret; } -void fimc_is_ois_enable(struct fimc_is_core *core) -{ - int ret = 0; - - pr_info("%s : E\n", __FUNCTION__); - if (core->use_ois_hsi2c) { - fimc_is_ois_i2c_config(core->client1, true); - } - - ret = fimc_is_ois_i2c_write(core->client1, 0x02, 0x00); - if (ret) { - err("i2c write fail\n"); - } - - ret = fimc_is_ois_i2c_write(core->client1, 0x00, 0x01); - if (ret) { - err("i2c write fail\n"); - } - - if (core->use_ois_hsi2c) { - fimc_is_ois_i2c_config(core->client1, false); - } - pr_info("%s : X\n", __FUNCTION__); -} - int fimc_is_ois_sine_mode(struct fimc_is_core *core, int mode) { int ret = 0; @@ -587,10 +550,8 @@ bool fimc_is_ois_diff_test(struct fimc_is_core *core, int *x_diff, int *y_diff) fimc_is_ois_i2c_config(core->client1, true); } -#ifdef CONFIG_AF_HOST_CONTROL fimc_is_af_move_lens(core); msleep(30); -#endif ret = fimc_is_ois_i2c_read_multi(core->client1, 0x021A, read_x, 2); ret |= fimc_is_ois_i2c_read_multi(core->client1, 0x021C, read_y, 2); if (ret) { @@ -659,27 +620,6 @@ bool fimc_is_ois_diff_test(struct fimc_is_core *core, int *x_diff, int *y_diff) err("i2c write fail\n"); } -#if 0 - ret = fimc_is_ois_i2c_write(core->client1, 0x0012, 0x01); - if (ret) { - err("i2c write fail\n"); - } - - retries = 30; - do { //polarity check - ret = fimc_is_ois_i2c_read(core->client1, 0x0012, &val); - if (ret != 0) { - break; - } - msleep(100); - if (--retries < 0) { - err("Polarity check is not done or not [read_val_0x0012::0x%04x]\n", val); - break; - } - } while (val); - fimc_is_ois_i2c_read(core->client1, 0x0200, &val); - err("OIS[read_val_0x0200::0x%04x]\n", val); -#endif retries = 120; do { @@ -1390,7 +1330,6 @@ p_err: return; } -#ifdef CONFIG_OIS_FW_UPDATE_THREAD_USE int fimc_is_ois_thread(void *data) { struct fimc_is_core *core = data; @@ -1413,7 +1352,6 @@ void fimc_is_ois_init_thread(struct fimc_is_core *core) return; } -#endif /* CONFIG_OIS_FW_UPDATE_THREAD_USE */ static int fimc_is_ois_probe(struct i2c_client *client, const struct i2c_device_id *id) @@ -1493,12 +1431,10 @@ static int fimc_is_ois_probe(struct i2c_client *client, static int fimc_is_ois_remove(struct i2c_client *client) { -#ifdef CONFIG_OIS_FW_UPDATE_THREAD_USE if (ois_ts) { kthread_stop(ois_ts); ois_ts = NULL; } -#endif return 0; } @@ -1509,20 +1445,16 @@ static const struct i2c_device_id ois_id[] = { }; MODULE_DEVICE_TABLE(i2c, ois_id); -#ifdef CONFIG_OF static struct of_device_id ois_dt_ids[] = { { .compatible = "rumba,ois",}, {}, }; -#endif static struct i2c_driver ois_i2c_driver = { .driver = { .name = FIMC_IS_OIS_DEV_NAME, .owner = THIS_MODULE, -#ifdef CONFIG_OF .of_match_table = ois_dt_ids, -#endif }, .probe = fimc_is_ois_probe, .remove = fimc_is_ois_remove, diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-device-ois.h b/drivers/media/platform/exynos/fimc-is/fimc-is-device-ois.h index b5785c4..d79ab14 100644 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-device-ois.h +++ b/drivers/media/platform/exynos/fimc-is/fimc-is-device-ois.h @@ -31,7 +31,6 @@ struct fimc_is_ois_exif { int fimc_is_ois_i2c_read(struct i2c_client *client, u16 addr, u8 *data); int fimc_is_ois_i2c_write(struct i2c_client *client ,u16 addr, u8 data); -void fimc_is_ois_enable(struct fimc_is_core *core); void fimc_is_ois_offset_test(struct fimc_is_core *core, long *raw_data_x, long *raw_data_y); int fimc_is_ois_self_test(struct fimc_is_core *core); int fimc_is_ois_gpio_on(struct fimc_is_device_companion *device); @@ -44,9 +43,7 @@ int fimc_is_ois_get_user_version(struct fimc_is_ois_info **uinfo); void fimc_is_ois_get_offset_data(struct fimc_is_core *core, long *raw_data_x, long *raw_data_y); void fimc_is_ois_check_fw(struct fimc_is_core *core); bool fimc_is_ois_diff_test(struct fimc_is_core *core, int *x_diff, int *y_diff); -#ifdef CONFIG_OIS_FW_UPDATE_THREAD_USE void fimc_is_ois_init_thread(struct fimc_is_core *core); -#endif bool fimc_is_ois_read_userdata(struct fimc_is_core *core); void fimc_is_ois_exif_data(struct fimc_is_core *core); int fimc_is_ois_get_exif_data(struct fimc_is_ois_exif **exif_info); diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-device-sensor.c b/drivers/media/platform/exynos/fimc-is/fimc-is-device-sensor.c index d4ec99e..021a9ca 100644 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-device-sensor.c +++ b/drivers/media/platform/exynos/fimc-is/fimc-is-device-sensor.c @@ -43,15 +43,9 @@ #include "fimc-is-err.h" #include "fimc-is-video.h" #include "fimc-is-dt.h" -#include "fimc-is-dvfs.h" -#include "sensor/fimc-is-device-6b2.h" -#include "sensor/fimc-is-device-imx134.h" -#include "sensor/fimc-is-device-imx135.h" #include "fimc-is-device-sensor.h" -#ifdef CONFIG_COMPANION_USE #include "fimc-is-companion-dt.h" -#endif extern struct device *camera_front_dev; extern struct device *camera_rear_dev; @@ -59,9 +53,6 @@ int fimc_is_sensor_runtime_resume(struct device *dev); int fimc_is_sensor_runtime_suspend(struct device *dev); extern int fimc_is_sen_video_probe(void *data); -struct pm_qos_request exynos_sensor_qos_cam; -struct pm_qos_request exynos_sensor_qos_int; -struct pm_qos_request exynos_sensor_qos_mem; extern u32 __iomem *notify_fcount_sen0; extern u32 __iomem *notify_fcount_sen1; @@ -73,92 +64,6 @@ u32 notify_fcount_dummy; #define BINNING(x, y) roundup((x) * 1000 / (y), 250) -int fimc_is_sensor_read8(struct i2c_client *client, - u16 addr, u8 *val) -{ - int ret = 0; - struct i2c_msg msg[2]; - u8 wbuf[2]; - - if (!client->adapter) { - err("Could not find adapter!\n"); - ret = -ENODEV; - goto p_err; - } - - /* 1. I2C operation for writing. */ - msg[0].addr = client->addr; - msg[0].flags = 0; /* write : 0, read : 1 */ - msg[0].len = 2; - msg[0].buf = wbuf; - /* TODO : consider other size of buffer */ - wbuf[0] = (addr & 0xFF00) >> 8; - wbuf[1] = (addr & 0xFF); - - /* 2. I2C operation for reading data. */ - msg[1].addr = client->addr; - msg[1].flags = I2C_M_RD; - msg[1].len = 1; - msg[1].buf = val; - - ret = i2c_transfer(client->adapter, msg, 2); - if (ret < 0) { - err("i2c treansfer fail"); - goto p_err; - } - -#ifdef PRINT_I2CCMD - info("I2CR08(%d) [0x%04X] : 0x%04X\n", client->addr, addr, *val); -#endif - -p_err: - return ret; -} - -int fimc_is_sensor_read16(struct i2c_client *client, - u16 addr, u16 *val) -{ - int ret = 0; - struct i2c_msg msg[2]; - u8 wbuf[2], rbuf[2]; - - if (!client->adapter) { - err("Could not find adapter!\n"); - ret = -ENODEV; - goto p_err; - } - - /* 1. I2C operation for writing. */ - msg[0].addr = client->addr; - msg[0].flags = 0; /* write : 0, read : 1 */ - msg[0].len = 2; - msg[0].buf = wbuf; - /* TODO : consider other size of buffer */ - wbuf[0] = (addr & 0xFF00) >> 8; - wbuf[1] = (addr & 0xFF); - - /* 2. I2C operation for reading data. */ - msg[1].addr = client->addr; - msg[1].flags = I2C_M_RD; - msg[1].len = 2; - msg[1].buf = rbuf; - - ret = i2c_transfer(client->adapter, msg, 2); - if (ret < 0) { - err("i2c treansfer fail"); - goto p_err; - } - - *val = ((rbuf[0] << 8) | rbuf[1]); - -#ifdef PRINT_I2CCMD - info("I2CR16(%d) [0x%04X] : 0x%04X\n", client->addr, addr, *val); -#endif - -p_err: - return ret; -} - int fimc_is_sensor_write(struct i2c_client *client, u8 *buf, u32 size) { @@ -216,143 +121,6 @@ p_err: return ret; } -int fimc_is_sensor_write16(struct i2c_client *client, - u16 addr, u16 val) -{ - int ret = 0; - struct i2c_msg msg[1]; - u8 wbuf[4]; - - if (!client->adapter) { - err("Could not find adapter!\n"); - ret = -ENODEV; - goto p_err; - } - - msg->addr = client->addr; - msg->flags = 0; - msg->len = 4; - msg->buf = wbuf; - wbuf[0] = (addr & 0xFF00) >> 8; - wbuf[1] = (addr & 0xFF); - wbuf[2] = (val & 0xFF00) >> 8; - wbuf[3] = (val & 0xFF); - - ret = i2c_transfer(client->adapter, msg, 1); - if (ret < 0) { - err("i2c treansfer fail(%d)", ret); - goto p_err; - } - -#ifdef PRINT_I2CCMD - info("I2CW16(%d) [0x%04X] : 0x%04X\n", client->addr, addr, val); -#endif - -p_err: - return ret; -} - -#if defined(CONFIG_PM_DEVFREQ) -inline static void fimc_is_sensor_set_qos_init(struct fimc_is_device_sensor *device, bool on) -{ - int cam_qos = 0; - int int_qos = 0; - int mif_qos = 0; - struct fimc_is_core *core = - (struct fimc_is_core *)dev_get_drvdata(fimc_is_dev); - - cam_qos = fimc_is_get_qos(core, FIMC_IS_DVFS_CAM, START_DVFS_LEVEL); -#if 0 /* For vision of L_version */ - int_qos = fimc_is_get_qos(core, FIMC_IS_DVFS_INT, START_DVFS_LEVEL); -#endif - if (on) { - /* DEVFREQ lock */ - if (cam_qos > 0) { - if (device->request_cam_qos == false) { - pm_qos_add_request(&exynos_sensor_qos_cam, PM_QOS_CAM_THROUGHPUT, cam_qos); - device->request_cam_qos = true; - } else { - err("Adding sensor cam_qos is not allowed"); - } - } - - if (int_qos > 0) { - if (device->request_int_qos == false) { - pm_qos_add_request(&exynos_sensor_qos_int, PM_QOS_DEVICE_THROUGHPUT, int_qos); - device->request_int_qos = true; - } else { - err("Adding sensor int_qos is not allowed"); - } - } - - if (mif_qos > 0) { - if (device->request_mif_qos == false) { - pm_qos_add_request(&exynos_sensor_qos_mem, PM_QOS_BUS_THROUGHPUT, mif_qos); - device->request_mif_qos = true; - } else { - err("Adding sensor mif_qos is not allowed"); - } - } - minfo("[SEN:D] %s: QoS LOCK [INT(%d), MIF(%d), CAM(%d)]\n", device, - __func__, int_qos, mif_qos, cam_qos); - } else { - /* DEVFREQ unlock */ - if (cam_qos > 0) { - if (device->request_cam_qos == true) { - pm_qos_remove_request(&exynos_sensor_qos_cam); - device->request_cam_qos = false; - } else { - err("Removing sensor cam_qos is not allowed"); - } - } - - if (int_qos > 0) { - if (device->request_int_qos == true) { - pm_qos_remove_request(&exynos_sensor_qos_int); - device->request_int_qos = false; - } else { - err("Removing sensor int_qos is not allowed"); - } - } - - if (mif_qos > 0) { - if (device->request_mif_qos == true) { - pm_qos_remove_request(&exynos_sensor_qos_mem); - device->request_mif_qos = false; - } else { - err("Removing sensor mif_qos is not allowed"); - } - } - minfo("[SEN:D] %s: QoS UNLOCK\n", device, __func__); - } -} - -inline static void fimc_is_sensor_set_qos_update(struct fimc_is_device_sensor *device, u32 scenario) -{ - int cam_qos = 0; - int int_qos = 0; - int mif_qos = 0; - struct fimc_is_core *core = - (struct fimc_is_core *)dev_get_drvdata(fimc_is_dev); - - /* HACK: This is considerated only front camera vision scenario. */ - if (scenario == SENSOR_SCENARIO_VISION) { - cam_qos = fimc_is_get_qos(core, FIMC_IS_DVFS_CAM, FIMC_IS_SN_FRONT_PREVIEW); - int_qos = fimc_is_get_qos(core, FIMC_IS_DVFS_INT, FIMC_IS_SN_FRONT_PREVIEW); - } - - /* DEVFREQ update */ - if (cam_qos > 0) - pm_qos_update_request(&exynos_sensor_qos_cam, cam_qos); - if (int_qos > 0) - pm_qos_update_request(&exynos_sensor_qos_int, int_qos); - if (mif_qos > 0) - pm_qos_update_request(&exynos_sensor_qos_mem, mif_qos); - - minfo("[SEN:D] %s: QoS UPDATE(%d) [INT(%d), MIF(%d), CAM(%d)]\n", device, - __func__, scenario, int_qos, mif_qos, cam_qos); -} -#endif static int get_sensor_mode(struct fimc_is_sensor_cfg *cfg, u32 cfgs, u32 width, u32 height, u32 framerate) @@ -788,39 +556,6 @@ static void fimc_is_sensor_control(struct work_struct *data) * HAL can't send meta data for vision * We accepted vision control by s_ctrl */ -#if 0 - struct v4l2_subdev *subdev_module; - struct fimc_is_module_enum *module; - struct camera2_sensor_ctl *rsensor_ctl; - struct camera2_sensor_ctl *csensor_ctl; - struct fimc_is_device_sensor *device; - - device = container_of(data, struct fimc_is_device_sensor, control_work); - subdev_module = device->subdev_module; - if (!subdev_module) { - err("subdev_module is NULL"); - return; - } - - module = v4l2_get_subdevdata(subdev_module); - rsensor_ctl = &device->control_frame->shot->ctl.sensor; - csensor_ctl = &device->sensor_ctl; - - if (rsensor_ctl->exposureTime != csensor_ctl->exposureTime) { - CALL_MOPS(module, s_exposure, subdev_module, rsensor_ctl->exposureTime); - csensor_ctl->exposureTime = rsensor_ctl->exposureTime; - } - - if (rsensor_ctl->frameDuration != csensor_ctl->frameDuration) { - CALL_MOPS(module, s_duration, subdev_module, rsensor_ctl->frameDuration); - csensor_ctl->frameDuration = rsensor_ctl->frameDuration; - } - - if (rsensor_ctl->sensitivity != csensor_ctl->sensitivity) { - CALL_MOPS(module, s_again, subdev_module, rsensor_ctl->sensitivity); - csensor_ctl->sensitivity = rsensor_ctl->sensitivity; - } -#endif } static int fimc_is_sensor_notify_by_fstr(struct fimc_is_device_sensor *device, void *arg) @@ -1024,21 +759,11 @@ static int fimc_is_sensor_probe(struct platform_device *pdev) return -EINVAL; } -#ifdef CONFIG_OF -#ifdef CONFIG_COMPANION_USE ret = fimc_is_sensor_parse_dt_with_companion(pdev); if (ret) { err("parsing device tree is fail(%d)", ret); goto p_err; } -#else - ret = fimc_is_sensor_parse_dt(pdev); - if (ret) { - err("parsing device tree is fail(%d)", ret); - goto p_err; - } -#endif /* CONFIG_COMPANION_USE */ -#endif /* CONFIG_OF */ pdata = dev_get_platdata(&pdev->dev); if (!pdata) { @@ -1088,12 +813,10 @@ static int fimc_is_sensor_probe(struct platform_device *pdev) goto p_err; } -#if defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) #if defined(CONFIG_VIDEOBUF2_ION) if (device->mem.alloc_ctx) vb2_ion_attach_iommu(device->mem.alloc_ctx); #endif -#endif #if defined(CONFIG_PM_RUNTIME) pm_runtime_enable(&pdev->dev); @@ -1178,9 +901,6 @@ int fimc_is_sensor_open(struct fimc_is_device_sensor *device, device->exposure_time = 0; device->frame_duration = 0; device->force_stop = 0; - device->request_cam_qos = 0; - device->request_int_qos = 0; - device->request_mif_qos = 0; memset(&device->sensor_ctl, 0, sizeof(struct camera2_sensor_ctl)); memset(&device->lens_ctl, 0, sizeof(struct camera2_lens_ctl)); memset(&device->flash_ctl, 0, sizeof(struct camera2_flash_ctl)); @@ -1317,9 +1037,7 @@ int fimc_is_sensor_s_input(struct fimc_is_device_sensor *device, struct v4l2_subdev *subdev_flite; struct fimc_is_module_enum *module = NULL; u32 sensor_ch, actuator_ch; -#if defined(CONFIG_OIS_USE) u32 ois_ch, ois_addr; -#endif u32 sensor_addr, actuator_addr; u32 i = 0; @@ -1377,7 +1095,6 @@ int fimc_is_sensor_s_input(struct fimc_is_device_sensor *device, module->ext.actuator_con.peri_setting.i2c.slave_address = actuator_addr; } -#if defined(CONFIG_OIS_USE) if (module->ext.ois_con.peri_type == SE_I2C) { ois_ch = device->pdata->i2c_ch & OIS_I2C_CH_MASK; ois_ch >>= OIS_I2C_CH_SHIFT; @@ -1386,7 +1103,6 @@ int fimc_is_sensor_s_input(struct fimc_is_device_sensor *device, module->ext.ois_con.peri_setting.i2c.channel = ois_ch; module->ext.ois_con.peri_setting.i2c.slave_address = ois_addr; } -#endif /* send csi chennel to FW */ module->ext.sensor_con.csi_ch = device->pdata->csi_ch; @@ -1395,14 +1111,12 @@ int fimc_is_sensor_s_input(struct fimc_is_device_sensor *device, module->ext.flash_con.peri_setting.gpio.first_gpio_port_no = device->pdata->flash_first_gpio; module->ext.flash_con.peri_setting.gpio.second_gpio_port_no = device->pdata->flash_second_gpio; -#ifdef CONFIG_COMPANION_USE /* Data Type For Comapnion: * Companion use user defined data type. */ if (module->ext.companion_con.product_name && module->ext.companion_con.product_name != COMPANION_NAME_NOTHING) device->image.format.field = V4L2_FIELD_INTERLACED; -#endif subdev_csi = device->subdev_csi; subdev_flite = device->subdev_flite; @@ -1433,11 +1147,6 @@ int fimc_is_sensor_s_input(struct fimc_is_device_sensor *device, device->subdev_module = subdev_module; } -#if defined(CONFIG_PM_DEVFREQ) - /* DEVFREQ set */ - if (test_bit(FIMC_IS_SENSOR_DRIVING, &device->state)) - fimc_is_sensor_set_qos_init(device, true); -#endif /* configuration clock control */ ret = fimc_is_sensor_iclk_on(device); @@ -1446,10 +1155,6 @@ int fimc_is_sensor_s_input(struct fimc_is_device_sensor *device, goto p_err; } -#if defined(CONFIG_PM_DEVFREQ) - if (test_bit(FIMC_IS_SENSOR_DRIVING, &device->state)) - fimc_is_sensor_set_qos_update(device, device->pdata->scenario); -#endif /* Sensor power on */ ret = fimc_is_sensor_gpio_on(device); @@ -2249,12 +1954,6 @@ int fimc_is_sensor_runtime_suspend(struct device *dev) return -EINVAL; } -#if !(defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433)) -#if defined(CONFIG_VIDEOBUF2_ION) - if (device->mem.alloc_ctx) - vb2_ion_detach_iommu(device->mem.alloc_ctx); -#endif -#endif subdev_csi = device->subdev_csi; if (!subdev_csi) @@ -2282,11 +1981,6 @@ int fimc_is_sensor_runtime_suspend(struct device *dev) if (ret) mwarn("v4l2_csi_call(s_power) is fail(%d)", device, ret); -#if defined(CONFIG_PM_DEVFREQ) - /* DEVFREQ set */ - if (test_bit(FIMC_IS_SENSOR_DRIVING, &device->state)) - fimc_is_sensor_set_qos_init(device, false); -#endif info("[SEN:D:%d] %s(%d)\n", device->instance, __func__, ret); return 0; @@ -2312,25 +2006,6 @@ int fimc_is_sensor_runtime_resume(struct device *dev) goto p_err; } -/* HACK */ -/* at xyref 4415, when runtime_suspend operating, isp0 power is off thoroughly - so it needs to power on operation at sensor_runtime_resume operation */ -#if defined(CONFOG_SOC_EXYNOS4415) && !defined(CONFIG_PM_RUNTIME) - { - u32 val; - /* ISP0 */ - /* 1. set feedback mode */ - val = __raw_readl(PMUREG_ISP0_OPTION); - val = (val & ~(0x3<< 0)) | (0x2 << 0); - __raw_writel(val, PMUREG_ISP0_OPTION); - - /* 2. power on isp0 */ - val = __raw_readl(PMUREG_ISP0_CONFIGURATION); - val = (val & ~(0x7 << 0)) | (0x7 << 0); - __raw_writel(val, PMUREG_ISP0_CONFIGURATION); - } -#endif - /* 1. Enable MIPI */ ret = v4l2_subdev_call(subdev_csi, core, s_power, 1); if (ret) { @@ -2345,13 +2020,6 @@ int fimc_is_sensor_runtime_resume(struct device *dev) goto p_err; } -#if !(defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433)) -#if defined(CONFIG_VIDEOBUF2_ION) - if (device->mem.alloc_ctx) - vb2_ion_attach_iommu(device->mem.alloc_ctx); - pr_debug("FIMC_IS runtime resume - ion attach complete\n"); -#endif -#endif p_err: info("[SEN:D:%d] %s(%d)\n", device->instance, __func__, ret); @@ -2365,7 +2033,6 @@ static const struct dev_pm_ops fimc_is_sensor_pm_ops = { .runtime_resume = fimc_is_sensor_runtime_resume, }; -#ifdef CONFIG_OF static const struct of_device_id exynos_fimc_is_sensor_match[] = { { .compatible = "samsung,exynos5-fimc-is-sensor", @@ -2386,45 +2053,6 @@ static struct platform_driver fimc_is_sensor_driver = { }; module_platform_driver(fimc_is_sensor_driver); -#else -static struct platform_device_id fimc_is_sensor_driver_ids[] = { - { - .name = FIMC_IS_SENSOR_DEV_NAME, - .driver_data = 0, - }, - {}, -}; -MODULE_DEVICE_TABLE(platform, fimc_is_sensor_driver_ids); - -static struct platform_driver fimc_is_sensor_driver = { - .probe = fimc_is_sensor_probe, - .remove = __devexit_p(fimc_is_sensor_remove), - .id_table = fimc_is_sensor_driver_ids, - .driver = { - .name = FIMC_IS_SENSOR_DEV_NAME, - .owner = THIS_MODULE, - .pm = &fimc_is_sensor_pm_ops, - } -}; - -static int __init fimc_is_sensor_init(void) -{ - int ret = 0; - - ret = platform_driver_register(&fimc_is_sensor_driver); - if (ret) - err("platform_driver_register failed: %d\n", ret); - - return ret; -} - -static void __exit fimc_is_sensor_exit(void) -{ - platform_driver_unregister(&fimc_is_sensor_driver); -} -module_init(fimc_is_sensor_init); -module_exit(fimc_is_sensor_exit); -#endif MODULE_AUTHOR("Gilyeon lim"); MODULE_DESCRIPTION("Exynos FIMC_IS_SENSOR driver"); diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-device-sensor.h b/drivers/media/platform/exynos/fimc-is/fimc-is-device-sensor.h index d4a0ed5..4fbce0a 100644 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-device-sensor.h +++ b/drivers/media/platform/exynos/fimc-is/fimc-is-device-sensor.h @@ -189,11 +189,6 @@ struct fimc_is_device_sensor { struct exynos_platform_fimc_is_sensor *pdata; void *private_data; - - /* DVFS state */ - bool request_cam_qos; - bool request_int_qos; - bool request_mif_qos; }; int fimc_is_sensor_open(struct fimc_is_device_sensor *device, @@ -246,16 +241,10 @@ int fimc_is_sensor_g_module(struct fimc_is_device_sensor *device, int fimc_is_sensor_gpio_off_softlanding(struct fimc_is_device_sensor *device); /* sensor driver */ -int fimc_is_sensor_read8(struct i2c_client *client, - u16 addr, u8 *val); -int fimc_is_sensor_read16(struct i2c_client *client, - u16 addr, u16 *val); int fimc_is_sensor_write(struct i2c_client *client, u8 *buf, u32 size); int fimc_is_sensor_write8(struct i2c_client *client, u16 addr, u8 val); -int fimc_is_sensor_write16(struct i2c_client *client, - u16 addr, u16 val); #define CALL_MOPS(s, op, args...) (((s)->ops->op) ? ((s)->ops->op(args)) : 0) diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-dt.c b/drivers/media/platform/exynos/fimc-is/fimc-is-dt.c index 2b8deac..129f757 100644 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-dt.c +++ b/drivers/media/platform/exynos/fimc-is/fimc-is-dt.c @@ -14,15 +14,12 @@ #include "exynos-fimc-is-sensor.h" #include "exynos-fimc-is.h" #include -#ifdef CONFIG_OF #include #include -#endif #include "fimc-is-core.h" #include "fimc-is-dt.h" -#ifdef CONFIG_OF int get_pin_lookup_state(struct device *dev, struct exynos_platform_fimc_is_sensor *pdata) { @@ -59,192 +56,6 @@ p_err: return ret; } -static int parse_gate_info(struct exynos_platform_fimc_is *pdata, struct device_node *np) -{ - int ret = 0; - struct device_node *group_np = NULL; - struct device_node *gate_info_np; - struct property *prop; - struct property *prop2; - const __be32 *p; - const char *s; - u32 i = 0, u = 0; - struct exynos_fimc_is_clk_gate_info *gate_info; - - /* get subip of fimc-is info */ - gate_info = kzalloc(sizeof(struct exynos_fimc_is_clk_gate_info), GFP_KERNEL); - if (!gate_info) { - printk(KERN_ERR "%s: no memory for fimc_is gate_info\n", __func__); - return -EINVAL; - } - - s = NULL; - /* get gate register info */ - prop2 = of_find_property(np, "clk_gate_strs", NULL); - of_property_for_each_u32(np, "clk_gate_enums", prop, p, u) { - printk(KERN_INFO "int value: %d\n", u); - s = of_prop_next_string(prop2, s); - if (s != NULL) { - printk(KERN_INFO "String value: %d-%s\n", u, s); - gate_info->gate_str[u] = s; - } - } - - /* gate info */ - gate_info_np = of_find_node_by_name(np, "clk_gate_ctrl"); - if (!gate_info_np) { - printk(KERN_ERR "%s: can't find fimc_is clk_gate_ctrl node\n", __func__); - ret = -ENOENT; - goto p_err; - } - i = 0; - while ((group_np = of_get_next_child(gate_info_np, group_np))) { - struct exynos_fimc_is_clk_gate_group *group = - &gate_info->groups[i]; - of_property_for_each_u32(group_np, "mask_clk_on_org", prop, p, u) { - printk(KERN_INFO "(%d) int1 value: %d\n", i, u); - group->mask_clk_on_org |= (1 << u); - } - of_property_for_each_u32(group_np, "mask_clk_off_self_org", prop, p, u) { - printk(KERN_INFO "(%d) int2 value: %d\n", i, u); - group->mask_clk_off_self_org |= (1 << u); - } - of_property_for_each_u32(group_np, "mask_clk_off_depend", prop, p, u) { - printk(KERN_INFO "(%d) int3 value: %d\n", i, u); - group->mask_clk_off_depend |= (1 << u); - } - of_property_for_each_u32(group_np, "mask_cond_for_depend", prop, p, u) { - printk(KERN_INFO "(%d) int4 value: %d\n", i, u); - group->mask_cond_for_depend |= (1 << u); - } - i++; - printk(KERN_INFO "(%d) [0x%x , 0x%x, 0x%x, 0x%x\n", i, - group->mask_clk_on_org, - group->mask_clk_off_self_org, - group->mask_clk_off_depend, - group->mask_cond_for_depend - ); - } - - pdata->gate_info = gate_info; - pdata->gate_info->user_clk_gate = exynos_fimc_is_set_user_clk_gate; - pdata->gate_info->clk_on_off = exynos_fimc_is_clk_gate; - - return 0; -p_err: - kfree(gate_info); - return ret; -} - -static int parse_dvfs_data(struct exynos_platform_fimc_is *pdata, struct device_node *np) -{ - u32 temp; - char *pprop; - - memset(pdata->dvfs_data, 0, sizeof(pdata->dvfs_data)); - DT_READ_U32(np, "default_int", pdata->dvfs_data[FIMC_IS_SN_DEFAULT][FIMC_IS_DVFS_INT]); - DT_READ_U32(np, "default_cam", pdata->dvfs_data[FIMC_IS_SN_DEFAULT][FIMC_IS_DVFS_CAM]); - DT_READ_U32(np, "default_mif", pdata->dvfs_data[FIMC_IS_SN_DEFAULT][FIMC_IS_DVFS_MIF]); - DT_READ_U32(np, "default_i2c", pdata->dvfs_data[FIMC_IS_SN_DEFAULT][FIMC_IS_DVFS_I2C]); - DT_READ_U32(np, "front_preview_int", pdata->dvfs_data[FIMC_IS_SN_FRONT_PREVIEW][FIMC_IS_DVFS_INT]); - DT_READ_U32(np, "front_preview_cam", pdata->dvfs_data[FIMC_IS_SN_FRONT_PREVIEW][FIMC_IS_DVFS_CAM]); - DT_READ_U32(np, "front_preview_mif", pdata->dvfs_data[FIMC_IS_SN_FRONT_PREVIEW][FIMC_IS_DVFS_MIF]); - DT_READ_U32(np, "front_preview_i2c", pdata->dvfs_data[FIMC_IS_SN_FRONT_PREVIEW][FIMC_IS_DVFS_I2C]); - DT_READ_U32(np, "front_capture_int", pdata->dvfs_data[FIMC_IS_SN_FRONT_CAPTURE][FIMC_IS_DVFS_INT]); - DT_READ_U32(np, "front_capture_cam", pdata->dvfs_data[FIMC_IS_SN_FRONT_CAPTURE][FIMC_IS_DVFS_CAM]); - DT_READ_U32(np, "front_capture_mif", pdata->dvfs_data[FIMC_IS_SN_FRONT_CAPTURE][FIMC_IS_DVFS_MIF]); - DT_READ_U32(np, "front_capture_i2c", pdata->dvfs_data[FIMC_IS_SN_FRONT_CAPTURE][FIMC_IS_DVFS_I2C]); - DT_READ_U32(np, "front_camcording_int", pdata->dvfs_data[FIMC_IS_SN_FRONT_CAMCORDING][FIMC_IS_DVFS_INT]); - DT_READ_U32(np, "front_camcording_cam", pdata->dvfs_data[FIMC_IS_SN_FRONT_CAMCORDING][FIMC_IS_DVFS_CAM]); - DT_READ_U32(np, "front_camcording_mif", pdata->dvfs_data[FIMC_IS_SN_FRONT_CAMCORDING][FIMC_IS_DVFS_MIF]); - DT_READ_U32(np, "front_camcording_i2c", pdata->dvfs_data[FIMC_IS_SN_FRONT_CAMCORDING][FIMC_IS_DVFS_I2C]); - DT_READ_U32(np, "front_vt1_int", pdata->dvfs_data[FIMC_IS_SN_FRONT_VT1][FIMC_IS_DVFS_INT]); - DT_READ_U32(np, "front_vt1_cam", pdata->dvfs_data[FIMC_IS_SN_FRONT_VT1][FIMC_IS_DVFS_CAM]); - DT_READ_U32(np, "front_vt1_mif", pdata->dvfs_data[FIMC_IS_SN_FRONT_VT1][FIMC_IS_DVFS_MIF]); - DT_READ_U32(np, "front_vt1_i2c", pdata->dvfs_data[FIMC_IS_SN_FRONT_VT1][FIMC_IS_DVFS_I2C]); - DT_READ_U32(np, "front_vt2_int", pdata->dvfs_data[FIMC_IS_SN_FRONT_VT2][FIMC_IS_DVFS_INT]); - DT_READ_U32(np, "front_vt2_cam", pdata->dvfs_data[FIMC_IS_SN_FRONT_VT2][FIMC_IS_DVFS_CAM]); - DT_READ_U32(np, "front_vt2_mif", pdata->dvfs_data[FIMC_IS_SN_FRONT_VT2][FIMC_IS_DVFS_MIF]); - DT_READ_U32(np, "front_vt2_i2c", pdata->dvfs_data[FIMC_IS_SN_FRONT_VT2][FIMC_IS_DVFS_I2C]); - DT_READ_U32(np, "rear_preview_fhd_bns_off_int", pdata->dvfs_data[FIMC_IS_SN_REAR_PREVIEW_FHD_BNS_OFF][FIMC_IS_DVFS_INT]); - DT_READ_U32(np, "rear_preview_fhd_bns_off_cam", pdata->dvfs_data[FIMC_IS_SN_REAR_PREVIEW_FHD_BNS_OFF][FIMC_IS_DVFS_CAM]); - DT_READ_U32(np, "rear_preview_fhd_bns_off_mif", pdata->dvfs_data[FIMC_IS_SN_REAR_PREVIEW_FHD_BNS_OFF][FIMC_IS_DVFS_MIF]); - DT_READ_U32(np, "rear_preview_fhd_bns_off_i2c", pdata->dvfs_data[FIMC_IS_SN_REAR_PREVIEW_FHD_BNS_OFF][FIMC_IS_DVFS_I2C]); - DT_READ_U32(np, "rear_preview_fhd_int", pdata->dvfs_data[FIMC_IS_SN_REAR_PREVIEW_FHD][FIMC_IS_DVFS_INT]); - DT_READ_U32(np, "rear_preview_fhd_cam", pdata->dvfs_data[FIMC_IS_SN_REAR_PREVIEW_FHD][FIMC_IS_DVFS_CAM]); - DT_READ_U32(np, "rear_preview_fhd_mif", pdata->dvfs_data[FIMC_IS_SN_REAR_PREVIEW_FHD][FIMC_IS_DVFS_MIF]); - DT_READ_U32(np, "rear_preview_fhd_i2c", pdata->dvfs_data[FIMC_IS_SN_REAR_PREVIEW_FHD][FIMC_IS_DVFS_I2C]); - /* if there's no FHD preview(with BNS off) dvfa data, set value of FHD recording data */ - if (!(pdata->dvfs_data[FIMC_IS_SN_REAR_PREVIEW_FHD_BNS_OFF][FIMC_IS_DVFS_MIF])) { - pdata->dvfs_data[FIMC_IS_SN_REAR_PREVIEW_FHD_BNS_OFF][FIMC_IS_DVFS_INT] = pdata->dvfs_data[FIMC_IS_SN_REAR_PREVIEW_FHD][FIMC_IS_DVFS_INT]; - pdata->dvfs_data[FIMC_IS_SN_REAR_PREVIEW_FHD_BNS_OFF][FIMC_IS_DVFS_CAM] = pdata->dvfs_data[FIMC_IS_SN_REAR_PREVIEW_FHD][FIMC_IS_DVFS_CAM]; - pdata->dvfs_data[FIMC_IS_SN_REAR_PREVIEW_FHD_BNS_OFF][FIMC_IS_DVFS_MIF] = pdata->dvfs_data[FIMC_IS_SN_REAR_PREVIEW_FHD][FIMC_IS_DVFS_MIF]; - pdata->dvfs_data[FIMC_IS_SN_REAR_PREVIEW_FHD_BNS_OFF][FIMC_IS_DVFS_I2C] = pdata->dvfs_data[FIMC_IS_SN_REAR_PREVIEW_FHD][FIMC_IS_DVFS_I2C]; - } - DT_READ_U32(np, "rear_preview_whd_int", pdata->dvfs_data[FIMC_IS_SN_REAR_PREVIEW_WHD][FIMC_IS_DVFS_INT]); - DT_READ_U32(np, "rear_preview_whd_cam", pdata->dvfs_data[FIMC_IS_SN_REAR_PREVIEW_WHD][FIMC_IS_DVFS_CAM]); - DT_READ_U32(np, "rear_preview_whd_mif", pdata->dvfs_data[FIMC_IS_SN_REAR_PREVIEW_WHD][FIMC_IS_DVFS_MIF]); - DT_READ_U32(np, "rear_preview_whd_i2c", pdata->dvfs_data[FIMC_IS_SN_REAR_PREVIEW_WHD][FIMC_IS_DVFS_I2C]); - DT_READ_U32(np, "rear_preview_uhd_int", pdata->dvfs_data[FIMC_IS_SN_REAR_PREVIEW_UHD][FIMC_IS_DVFS_INT]); - DT_READ_U32(np, "rear_preview_uhd_cam", pdata->dvfs_data[FIMC_IS_SN_REAR_PREVIEW_UHD][FIMC_IS_DVFS_CAM]); - DT_READ_U32(np, "rear_preview_uhd_mif", pdata->dvfs_data[FIMC_IS_SN_REAR_PREVIEW_UHD][FIMC_IS_DVFS_MIF]); - DT_READ_U32(np, "rear_preview_uhd_i2c", pdata->dvfs_data[FIMC_IS_SN_REAR_PREVIEW_UHD][FIMC_IS_DVFS_I2C]); - DT_READ_U32(np, "rear_capture_int", pdata->dvfs_data[FIMC_IS_SN_REAR_CAPTURE][FIMC_IS_DVFS_INT]); - DT_READ_U32(np, "rear_capture_cam", pdata->dvfs_data[FIMC_IS_SN_REAR_CAPTURE][FIMC_IS_DVFS_CAM]); - DT_READ_U32(np, "rear_capture_mif", pdata->dvfs_data[FIMC_IS_SN_REAR_CAPTURE][FIMC_IS_DVFS_MIF]); - DT_READ_U32(np, "rear_capture_i2c", pdata->dvfs_data[FIMC_IS_SN_REAR_CAPTURE][FIMC_IS_DVFS_I2C]); - - DT_READ_U32(np, "rear_camcording_fhd_bns_off_int", pdata->dvfs_data[FIMC_IS_SN_REAR_CAMCORDING_FHD_BNS_OFF][FIMC_IS_DVFS_INT]); - DT_READ_U32(np, "rear_camcording_fhd_bns_off_cam", pdata->dvfs_data[FIMC_IS_SN_REAR_CAMCORDING_FHD_BNS_OFF][FIMC_IS_DVFS_CAM]); - DT_READ_U32(np, "rear_camcording_fhd_bns_off_mif", pdata->dvfs_data[FIMC_IS_SN_REAR_CAMCORDING_FHD_BNS_OFF][FIMC_IS_DVFS_MIF]); - DT_READ_U32(np, "rear_camcording_fhd_bns_off_i2c", pdata->dvfs_data[FIMC_IS_SN_REAR_CAMCORDING_FHD_BNS_OFF][FIMC_IS_DVFS_I2C]); - DT_READ_U32(np, "rear_camcording_fhd_int", pdata->dvfs_data[FIMC_IS_SN_REAR_CAMCORDING_FHD][FIMC_IS_DVFS_INT]); - DT_READ_U32(np, "rear_camcording_fhd_cam", pdata->dvfs_data[FIMC_IS_SN_REAR_CAMCORDING_FHD][FIMC_IS_DVFS_CAM]); - DT_READ_U32(np, "rear_camcording_fhd_mif", pdata->dvfs_data[FIMC_IS_SN_REAR_CAMCORDING_FHD][FIMC_IS_DVFS_MIF]); - DT_READ_U32(np, "rear_camcording_fhd_i2c", pdata->dvfs_data[FIMC_IS_SN_REAR_CAMCORDING_FHD][FIMC_IS_DVFS_I2C]); - DT_READ_U32(np, "rear_camcording_whd_int", pdata->dvfs_data[FIMC_IS_SN_REAR_CAMCORDING_WHD][FIMC_IS_DVFS_INT]); - DT_READ_U32(np, "rear_camcording_whd_cam", pdata->dvfs_data[FIMC_IS_SN_REAR_CAMCORDING_WHD][FIMC_IS_DVFS_CAM]); - DT_READ_U32(np, "rear_camcording_whd_mif", pdata->dvfs_data[FIMC_IS_SN_REAR_CAMCORDING_WHD][FIMC_IS_DVFS_MIF]); - DT_READ_U32(np, "rear_camcording_whd_i2c", pdata->dvfs_data[FIMC_IS_SN_REAR_CAMCORDING_WHD][FIMC_IS_DVFS_I2C]); - DT_READ_U32(np, "rear_camcording_uhd_int", pdata->dvfs_data[FIMC_IS_SN_REAR_CAMCORDING_UHD][FIMC_IS_DVFS_INT]); - DT_READ_U32(np, "rear_camcording_uhd_cam", pdata->dvfs_data[FIMC_IS_SN_REAR_CAMCORDING_UHD][FIMC_IS_DVFS_CAM]); - DT_READ_U32(np, "rear_camcording_uhd_mif", pdata->dvfs_data[FIMC_IS_SN_REAR_CAMCORDING_UHD][FIMC_IS_DVFS_MIF]); - DT_READ_U32(np, "rear_camcording_uhd_i2c", pdata->dvfs_data[FIMC_IS_SN_REAR_CAMCORDING_UHD][FIMC_IS_DVFS_I2C]); - /* if there's no FHD recording(with BNS off) dvfa data, set value of FHD recording data */ - if (!(pdata->dvfs_data[FIMC_IS_SN_REAR_CAMCORDING_FHD_BNS_OFF][FIMC_IS_DVFS_MIF])) { - pdata->dvfs_data[FIMC_IS_SN_REAR_CAMCORDING_FHD_BNS_OFF][FIMC_IS_DVFS_INT] = pdata->dvfs_data[FIMC_IS_SN_REAR_CAMCORDING_FHD][FIMC_IS_DVFS_INT]; - pdata->dvfs_data[FIMC_IS_SN_REAR_CAMCORDING_FHD_BNS_OFF][FIMC_IS_DVFS_CAM] = pdata->dvfs_data[FIMC_IS_SN_REAR_CAMCORDING_FHD][FIMC_IS_DVFS_CAM]; - pdata->dvfs_data[FIMC_IS_SN_REAR_CAMCORDING_FHD_BNS_OFF][FIMC_IS_DVFS_MIF] = pdata->dvfs_data[FIMC_IS_SN_REAR_CAMCORDING_FHD][FIMC_IS_DVFS_MIF]; - pdata->dvfs_data[FIMC_IS_SN_REAR_CAMCORDING_FHD_BNS_OFF][FIMC_IS_DVFS_I2C] = pdata->dvfs_data[FIMC_IS_SN_REAR_CAMCORDING_FHD][FIMC_IS_DVFS_I2C]; - } - DT_READ_U32(np, "dual_preview_int", pdata->dvfs_data[FIMC_IS_SN_DUAL_PREVIEW][FIMC_IS_DVFS_INT]); - DT_READ_U32(np, "dual_preview_cam", pdata->dvfs_data[FIMC_IS_SN_DUAL_PREVIEW][FIMC_IS_DVFS_CAM]); - DT_READ_U32(np, "dual_preview_mif", pdata->dvfs_data[FIMC_IS_SN_DUAL_PREVIEW][FIMC_IS_DVFS_MIF]); - DT_READ_U32(np, "dual_preview_i2c", pdata->dvfs_data[FIMC_IS_SN_DUAL_PREVIEW][FIMC_IS_DVFS_I2C]); - DT_READ_U32(np, "dual_capture_int", pdata->dvfs_data[FIMC_IS_SN_DUAL_CAPTURE][FIMC_IS_DVFS_INT]); - DT_READ_U32(np, "dual_capture_cam", pdata->dvfs_data[FIMC_IS_SN_DUAL_CAPTURE][FIMC_IS_DVFS_CAM]); - DT_READ_U32(np, "dual_capture_mif", pdata->dvfs_data[FIMC_IS_SN_DUAL_CAPTURE][FIMC_IS_DVFS_MIF]); - DT_READ_U32(np, "dual_capture_i2c", pdata->dvfs_data[FIMC_IS_SN_DUAL_CAPTURE][FIMC_IS_DVFS_I2C]); - DT_READ_U32(np, "dual_camcording_int", pdata->dvfs_data[FIMC_IS_SN_DUAL_CAMCORDING][FIMC_IS_DVFS_INT]); - DT_READ_U32(np, "dual_camcording_cam", pdata->dvfs_data[FIMC_IS_SN_DUAL_CAMCORDING][FIMC_IS_DVFS_CAM]); - DT_READ_U32(np, "dual_camcording_mif", pdata->dvfs_data[FIMC_IS_SN_DUAL_CAMCORDING][FIMC_IS_DVFS_MIF]); - DT_READ_U32(np, "dual_camcording_i2c", pdata->dvfs_data[FIMC_IS_SN_DUAL_CAMCORDING][FIMC_IS_DVFS_I2C]); - DT_READ_U32(np, "high_speed_fps_int", pdata->dvfs_data[FIMC_IS_SN_HIGH_SPEED_FPS][FIMC_IS_DVFS_INT]); - DT_READ_U32(np, "high_speed_fps_cam", pdata->dvfs_data[FIMC_IS_SN_HIGH_SPEED_FPS][FIMC_IS_DVFS_CAM]); - DT_READ_U32(np, "high_speed_fps_mif", pdata->dvfs_data[FIMC_IS_SN_HIGH_SPEED_FPS][FIMC_IS_DVFS_MIF]); - DT_READ_U32(np, "high_speed_fps_i2c", pdata->dvfs_data[FIMC_IS_SN_HIGH_SPEED_FPS][FIMC_IS_DVFS_I2C]); - DT_READ_U32(np, "dis_enable_int", pdata->dvfs_data[FIMC_IS_SN_DIS_ENABLE][FIMC_IS_DVFS_INT]); - DT_READ_U32(np, "dis_enable_cam", pdata->dvfs_data[FIMC_IS_SN_DIS_ENABLE][FIMC_IS_DVFS_CAM]); - DT_READ_U32(np, "dis_enable_mif", pdata->dvfs_data[FIMC_IS_SN_DIS_ENABLE][FIMC_IS_DVFS_MIF]); - DT_READ_U32(np, "dis_enable_i2c", pdata->dvfs_data[FIMC_IS_SN_DIS_ENABLE][FIMC_IS_DVFS_I2C]); - DT_READ_U32(np, "max_int", pdata->dvfs_data[FIMC_IS_SN_MAX][FIMC_IS_DVFS_INT]); - DT_READ_U32(np, "max_cam", pdata->dvfs_data[FIMC_IS_SN_MAX][FIMC_IS_DVFS_CAM]); - DT_READ_U32(np, "max_mif", pdata->dvfs_data[FIMC_IS_SN_MAX][FIMC_IS_DVFS_MIF]); - DT_READ_U32(np, "max_i2c", pdata->dvfs_data[FIMC_IS_SN_MAX][FIMC_IS_DVFS_I2C]); - - return 0; -} - static int parse_subip_info(struct exynos_platform_fimc_is *pdata, struct device_node *np) { u32 temp; @@ -390,11 +201,8 @@ struct exynos_platform_fimc_is *fimc_is_parse_dt(struct device *dev) void *ret = NULL; struct exynos_platform_fimc_is *pdata; struct device_node *subip_info_np; - struct device_node *dvfs_np; struct device_node *np = dev->of_node; -#if defined CONFIG_COMPANION_USE || defined CONFIG_USE_VENDER_FEATURE int retVal = 0; -#endif if (!np) return ERR_PTR(-ENOENT); @@ -414,26 +222,21 @@ struct exynos_platform_fimc_is *fimc_is_parse_dt(struct device *dev) dev->platform_data = pdata; -#ifdef CONFIG_COMPANION_USE retVal = of_property_read_u32(np, "companion_spi_channel", &pdata->companion_spi_channel); if (retVal) { err("spi_channel read is fail(%d)", retVal); } pdata->use_two_spi_line = of_property_read_bool(np, "use_two_spi_line"); -#endif -#ifdef CONFIG_USE_VENDER_FEATURE retVal = of_property_read_u32(np, "use_sensor_dynamic_voltage_mode", &pdata->use_sensor_dynamic_voltage_mode); if (retVal) { err("use_sensor_dynamic_voltage_mode read is fail(%d)", retVal); pdata->use_sensor_dynamic_voltage_mode = 0; } -#ifdef CONFIG_OIS_USE pdata->use_ois = of_property_read_bool(np, "use_ois"); if (!pdata->use_ois) { err("use_ois not use(%d)", pdata->use_ois); } -#endif /* CONFIG_OIS_USE */ pdata->use_ois_hsi2c = of_property_read_bool(np, "use_ois_hsi2c"); if (!pdata->use_ois_hsi2c) { err("use_ois_hsi2c not use(%d)", pdata->use_ois_hsi2c); @@ -443,7 +246,6 @@ struct exynos_platform_fimc_is *fimc_is_parse_dt(struct device *dev) if (!pdata->use_module_check) { err("use_module_check not use(%d)", pdata->use_module_check); } -#endif subip_info_np = of_find_node_by_name(np, "subip_info"); if (!subip_info_np) { printk(KERN_ERR "%s: can't find fimc_is subip_info node\n", __func__); @@ -452,17 +254,6 @@ struct exynos_platform_fimc_is *fimc_is_parse_dt(struct device *dev) } parse_subip_info(pdata, subip_info_np); - if (parse_gate_info(pdata, np) < 0) - printk(KERN_ERR "%s: can't parse clock gate info node\n", __func__); - - dvfs_np = of_find_node_by_name(np, "fimc_is_dvfs"); - if (!dvfs_np) { - printk(KERN_ERR "%s: can't find fimc_is_dvfs node\n", __func__); - ret = ERR_PTR(-ENOENT); - goto p_err; - } - parse_dvfs_data(pdata, dvfs_np); - return pdata; p_err: kfree(pdata); @@ -589,9 +380,3 @@ p_err: kfree(pdata); return ret; } -#else -struct exynos_platform_fimc_is *fimc_is_parse_dt(struct device *dev) -{ - return ERR_PTR(-EINVAL); -} -#endif diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-dvfs.c b/drivers/media/platform/exynos/fimc-is/fimc-is-dvfs.c deleted file mode 100644 index 48ef921..0000000 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-dvfs.c +++ /dev/null @@ -1,762 +0,0 @@ -/* - * Samsung Exynos5 SoC series FIMC-IS driver - * - * exynos5 fimc-is core functions - * - * Copyright (c) 2011 Samsung Electronics Co., Ltd - * - * 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 -#include "fimc-is-core.h" -#include "fimc-is-dvfs.h" - -extern struct pm_qos_request exynos_isp_qos_cpu_min; -extern struct pm_qos_request exynos_isp_qos_cpu_max; -extern struct pm_qos_request exynos_isp_qos_int; -extern struct pm_qos_request exynos_isp_qos_mem; -extern struct pm_qos_request exynos_isp_qos_cam; -extern struct pm_qos_request exynos_isp_qos_disp; - -DECLARE_DVFS_CHK_FUNC(FIMC_IS_SN_DUAL_CAPTURE); -DECLARE_DVFS_CHK_FUNC(FIMC_IS_SN_DUAL_CAMCORDING); -DECLARE_DVFS_CHK_FUNC(FIMC_IS_SN_DUAL_PREVIEW); -DECLARE_DVFS_CHK_FUNC(FIMC_IS_SN_HIGH_SPEED_FPS); -DECLARE_DVFS_CHK_FUNC(FIMC_IS_SN_REAR_CAMCORDING_FHD_BNS_OFF); -DECLARE_DVFS_CHK_FUNC(FIMC_IS_SN_REAR_CAMCORDING_FHD); -DECLARE_DVFS_CHK_FUNC(FIMC_IS_SN_REAR_CAMCORDING_WHD); -DECLARE_DVFS_CHK_FUNC(FIMC_IS_SN_REAR_CAMCORDING_UHD); -DECLARE_DVFS_CHK_FUNC(FIMC_IS_SN_REAR_PREVIEW_FHD_BNS_OFF); -DECLARE_DVFS_CHK_FUNC(FIMC_IS_SN_REAR_PREVIEW_FHD); -DECLARE_DVFS_CHK_FUNC(FIMC_IS_SN_REAR_PREVIEW_WHD); -DECLARE_DVFS_CHK_FUNC(FIMC_IS_SN_REAR_PREVIEW_UHD); -DECLARE_DVFS_CHK_FUNC(FIMC_IS_SN_FRONT_VT1); -DECLARE_DVFS_CHK_FUNC(FIMC_IS_SN_FRONT_VT2); -DECLARE_DVFS_CHK_FUNC(FIMC_IS_SN_FRONT_PREVIEW); -DECLARE_DVFS_CHK_FUNC(FIMC_IS_SN_REAR_CAPTURE); -DECLARE_DVFS_CHK_FUNC(FIMC_IS_SN_DIS_ENABLE); - -#if defined(ENABLE_DVFS) -/* - * Static Scenario Set - * You should describe static scenario by priorities of scenario. - * And you should name array 'static_scenarios' - */ -static struct fimc_is_dvfs_scenario static_scenarios[] = { - { - .scenario_id = FIMC_IS_SN_DUAL_CAMCORDING, - .scenario_nm = DVFS_SN_STR(FIMC_IS_SN_DUAL_CAMCORDING), - .check_func = GET_DVFS_CHK_FUNC(FIMC_IS_SN_DUAL_CAMCORDING), - }, { - .scenario_id = FIMC_IS_SN_DUAL_PREVIEW, - .scenario_nm = DVFS_SN_STR(FIMC_IS_SN_DUAL_PREVIEW), - .check_func = GET_DVFS_CHK_FUNC(FIMC_IS_SN_DUAL_PREVIEW), - }, { - .scenario_id = FIMC_IS_SN_HIGH_SPEED_FPS, - .scenario_nm = DVFS_SN_STR(FIMC_IS_SN_HIGH_SPEED_FPS), - .check_func = GET_DVFS_CHK_FUNC(FIMC_IS_SN_HIGH_SPEED_FPS), - }, { - .scenario_id = FIMC_IS_SN_REAR_CAMCORDING_FHD_BNS_OFF, - .scenario_nm = DVFS_SN_STR(FIMC_IS_SN_REAR_CAMCORDING_FHD_BNS_OFF), - .check_func = GET_DVFS_CHK_FUNC(FIMC_IS_SN_REAR_CAMCORDING_FHD_BNS_OFF), - }, { - .scenario_id = FIMC_IS_SN_REAR_CAMCORDING_FHD, - .scenario_nm = DVFS_SN_STR(FIMC_IS_SN_REAR_CAMCORDING_FHD), - .check_func = GET_DVFS_CHK_FUNC(FIMC_IS_SN_REAR_CAMCORDING_FHD), - }, { - .scenario_id = FIMC_IS_SN_REAR_CAMCORDING_WHD, - .scenario_nm = DVFS_SN_STR(FIMC_IS_SN_REAR_CAMCORDING_WHD), - .check_func = GET_DVFS_CHK_FUNC(FIMC_IS_SN_REAR_CAMCORDING_WHD), - }, { - .scenario_id = FIMC_IS_SN_REAR_CAMCORDING_UHD, - .scenario_nm = DVFS_SN_STR(FIMC_IS_SN_REAR_CAMCORDING_UHD), - .check_func = GET_DVFS_CHK_FUNC(FIMC_IS_SN_REAR_CAMCORDING_UHD), - }, { - .scenario_id = FIMC_IS_SN_REAR_PREVIEW_FHD_BNS_OFF, - .scenario_nm = DVFS_SN_STR(FIMC_IS_SN_REAR_PREVIEW_FHD_BNS_OFF), - .check_func = GET_DVFS_CHK_FUNC(FIMC_IS_SN_REAR_PREVIEW_FHD_BNS_OFF), - }, { - .scenario_id = FIMC_IS_SN_REAR_PREVIEW_FHD, - .scenario_nm = DVFS_SN_STR(FIMC_IS_SN_REAR_PREVIEW_FHD), - .check_func = GET_DVFS_CHK_FUNC(FIMC_IS_SN_REAR_PREVIEW_FHD), - }, { - .scenario_id = FIMC_IS_SN_REAR_PREVIEW_WHD, - .scenario_nm = DVFS_SN_STR(FIMC_IS_SN_REAR_PREVIEW_WHD), - .check_func = GET_DVFS_CHK_FUNC(FIMC_IS_SN_REAR_PREVIEW_WHD), - }, { - .scenario_id = FIMC_IS_SN_REAR_PREVIEW_UHD, - .scenario_nm = DVFS_SN_STR(FIMC_IS_SN_REAR_PREVIEW_UHD), - .check_func = GET_DVFS_CHK_FUNC(FIMC_IS_SN_REAR_PREVIEW_UHD), - }, { - .scenario_id = FIMC_IS_SN_FRONT_VT1, - .scenario_nm = DVFS_SN_STR(FIMC_IS_SN_FRONT_VT1), - .check_func = GET_DVFS_CHK_FUNC(FIMC_IS_SN_FRONT_VT1), - }, { - .scenario_id = FIMC_IS_SN_FRONT_VT2, - .scenario_nm = DVFS_SN_STR(FIMC_IS_SN_FRONT_VT2), - .check_func = GET_DVFS_CHK_FUNC(FIMC_IS_SN_FRONT_VT2), - }, { - .scenario_id = FIMC_IS_SN_FRONT_PREVIEW, - .scenario_nm = DVFS_SN_STR(FIMC_IS_SN_FRONT_PREVIEW), - .check_func = GET_DVFS_CHK_FUNC(FIMC_IS_SN_FRONT_PREVIEW), - }, -}; - -/* - * Dynamic Scenario Set - * You should describe static scenario by priorities of scenario. - * And you should name array 'dynamic_scenarios' - */ -static struct fimc_is_dvfs_scenario dynamic_scenarios[] = { - { - .scenario_id = FIMC_IS_SN_DUAL_CAPTURE, - .scenario_nm = DVFS_SN_STR(FIMC_IS_SN_DUAL_CAPTURE), - .keep_frame_tick = KEEP_FRAME_TICK_DEFAULT, - .check_func = GET_DVFS_CHK_FUNC(FIMC_IS_SN_DUAL_CAPTURE), - }, - { - .scenario_id = FIMC_IS_SN_REAR_CAPTURE, - .scenario_nm = DVFS_SN_STR(FIMC_IS_SN_REAR_CAPTURE), - .keep_frame_tick = KEEP_FRAME_TICK_DEFAULT, - .check_func = GET_DVFS_CHK_FUNC(FIMC_IS_SN_REAR_CAPTURE), - }, - { - .scenario_id = FIMC_IS_SN_DIS_ENABLE, - .scenario_nm = DVFS_SN_STR(FIMC_IS_SN_DIS_ENABLE), - .keep_frame_tick = KEEP_FRAME_TICK_DEFAULT, - .check_func = GET_DVFS_CHK_FUNC(FIMC_IS_SN_DIS_ENABLE), - }, -}; -#else -/* - * Default Scenario can not be seleted, this declaration is for static variable. - */ -static struct fimc_is_dvfs_scenario static_scenarios[] = { - { - .scenario_id = FIMC_IS_SN_DEFAULT, - .scenario_nm = NULL, - .keep_frame_tick = 0, - .check_func = NULL, - }, -}; -static struct fimc_is_dvfs_scenario dynamic_scenarios[] = { - { - .scenario_id = FIMC_IS_SN_DEFAULT, - .scenario_nm = NULL, - .keep_frame_tick = 0, - .check_func = NULL, - }, -}; -#endif - -static inline int fimc_is_get_open_sensor_cnt(struct fimc_is_core *core) -{ - int i, sensor_cnt = 0; - - for (i = 0; i < FIMC_IS_MAX_NODES; i++) - if (test_bit(FIMC_IS_SENSOR_OPEN, &(core->sensor[i].state))) - sensor_cnt++; - - return sensor_cnt; -} - -static inline u32 fimc_is_chk_req(struct fimc_is_frame *frame, enum fimc_is_video_dev_num vid) -{ - int i; - struct camera2_node *node; - u32 ret = 0; - - if (frame == NULL) - return ret; - - for (i = 0; i < CAPTURE_NODE_MAX; i++) { - node = &frame->shot_ext->node_group.capture[i]; - if (node->vid == vid) { - ret = node->request; - break; - } - } - - return ret; -} - -/* dual capture */ -DECLARE_DVFS_CHK_FUNC(FIMC_IS_SN_DUAL_CAPTURE) -{ - struct fimc_is_core *core; - int sensor_cnt = 0; - core = (struct fimc_is_core *)device->interface->core; - sensor_cnt = fimc_is_get_open_sensor_cnt(core); - - if ((sensor_cnt >= 2) && - (test_bit(FIMC_IS_ISCHAIN_REPROCESSING, &device->state))) - return 1; - else - return 0; -} - -/* dual camcording */ -DECLARE_DVFS_CHK_FUNC(FIMC_IS_SN_DUAL_CAMCORDING) -{ - struct fimc_is_core *core; - int sensor_cnt = 0; - core = (struct fimc_is_core *)device->interface->core; - sensor_cnt = fimc_is_get_open_sensor_cnt(core); - - if ((sensor_cnt >= 2) && - ((device->setfile & FIMC_IS_SETFILE_MASK) \ - == ISS_SUB_SCENARIO_DUAL_VIDEO)) - return 1; - else - return 0; -} - -/* dual preview */ -DECLARE_DVFS_CHK_FUNC(FIMC_IS_SN_DUAL_PREVIEW) -{ - struct fimc_is_core *core; - int sensor_cnt = 0; - core = (struct fimc_is_core *)device->interface->core; - sensor_cnt = fimc_is_get_open_sensor_cnt(core); - - if ((sensor_cnt >= 2) && - ((device->setfile & FIMC_IS_SETFILE_MASK) \ - != ISS_SUB_SCENARIO_DUAL_VIDEO)) - return 1; - else - return 0; -} - -/* high speed fps */ -DECLARE_DVFS_CHK_FUNC(FIMC_IS_SN_HIGH_SPEED_FPS) -{ - if ((device->sensor->pdev->id == SENSOR_POSITION_REAR) && - (fimc_is_sensor_g_framerate(device->sensor) > 30)) - return 1; - else - return 0; -} - -/* rear camcording FHD with BNS off */ -DECLARE_DVFS_CHK_FUNC(FIMC_IS_SN_REAR_CAMCORDING_FHD_BNS_OFF) -{ - u32 mask = (device->setfile & FIMC_IS_SETFILE_MASK); - bool setfile_flag = (mask == ISS_SUB_SCENARIO_VIDEO) || - (mask == ISS_SUB_SCENARIO_VIDEO_WDR); - - if ((device->sensor->pdev->id == SENSOR_POSITION_REAR) && - (fimc_is_sensor_g_framerate(device->sensor) <= 30) && - (device->chain3_width * device->chain3_height <= SIZE_FHD) && - (fimc_is_sensor_g_bns_ratio(device->sensor) <= 1000) && - setfile_flag) - return 1; - else - return 0; -} - -/* rear camcording FHD*/ -DECLARE_DVFS_CHK_FUNC(FIMC_IS_SN_REAR_CAMCORDING_FHD) -{ - u32 mask = (device->setfile & FIMC_IS_SETFILE_MASK); - bool setfile_flag = (mask == ISS_SUB_SCENARIO_VIDEO) || - (mask == ISS_SUB_SCENARIO_VIDEO_WDR); - - if ((device->sensor->pdev->id == SENSOR_POSITION_REAR) && - (fimc_is_sensor_g_framerate(device->sensor) <= 30) && - (device->chain3_width * device->chain3_height <= SIZE_FHD) && - (fimc_is_sensor_g_bns_ratio(device->sensor) > 1000) && - setfile_flag) - return 1; - else - return 0; -} - -/* rear camcording WHD*/ -DECLARE_DVFS_CHK_FUNC(FIMC_IS_SN_REAR_CAMCORDING_WHD) -{ - u32 mask = (device->setfile & FIMC_IS_SETFILE_MASK); - bool setfile_flag = (mask == ISS_SUB_SCENARIO_VIDEO) || - (mask == ISS_SUB_SCENARIO_VIDEO_WDR); - - if ((device->sensor->pdev->id == SENSOR_POSITION_REAR) && - (fimc_is_sensor_g_framerate(device->sensor) <= 30) && - (device->chain3_width * device->chain3_height > SIZE_FHD) && - (device->chain3_width * device->chain3_height <= SIZE_WHD) && - setfile_flag) - return 1; - else - return 0; -} - -/* rear camcording UHD*/ -DECLARE_DVFS_CHK_FUNC(FIMC_IS_SN_REAR_CAMCORDING_UHD) -{ - u32 mask = (device->setfile & FIMC_IS_SETFILE_MASK); - bool setfile_flag = (mask == ISS_SUB_SCENARIO_UHD_30FPS) || - (mask == ISS_SUB_SCENARIO_UHD_30FPS_WDR); - - if ((device->sensor->pdev->id == SENSOR_POSITION_REAR) && - (fimc_is_sensor_g_framerate(device->sensor) <= 30) && - (device->chain3_width * device->chain3_height > SIZE_WHD) && - (device->chain3_width * device->chain3_height <= SIZE_UHD) && - setfile_flag) - return 1; - else - return 0; -} - -/* rear preview FHD with BNS off */ -DECLARE_DVFS_CHK_FUNC(FIMC_IS_SN_REAR_PREVIEW_FHD_BNS_OFF) -{ - if ((device->sensor->pdev->id == SENSOR_POSITION_REAR) && - (fimc_is_sensor_g_framerate(device->sensor) <= 30) && - (device->chain3_width * device->chain3_height <= SIZE_FHD) && - (fimc_is_sensor_g_bns_ratio(device->sensor) <= 1000) && - ((device->setfile & FIMC_IS_SETFILE_MASK) \ - != ISS_SUB_SCENARIO_VIDEO)) - - return 1; - else - return 0; -} - -/* rear preview FHD */ -DECLARE_DVFS_CHK_FUNC(FIMC_IS_SN_REAR_PREVIEW_FHD) -{ - if ((device->sensor->pdev->id == SENSOR_POSITION_REAR) && - (fimc_is_sensor_g_framerate(device->sensor) <= 30) && - (device->chain3_width * device->chain3_height <= SIZE_FHD) && - (fimc_is_sensor_g_bns_ratio(device->sensor) > 1000) && - ((device->setfile & FIMC_IS_SETFILE_MASK) \ - != ISS_SUB_SCENARIO_VIDEO)) - - return 1; - else - return 0; -} - -/* rear preview WHD */ -DECLARE_DVFS_CHK_FUNC(FIMC_IS_SN_REAR_PREVIEW_WHD) -{ - if ((device->sensor->pdev->id == SENSOR_POSITION_REAR) && - (fimc_is_sensor_g_framerate(device->sensor) <= 30) && - (device->chain3_width * device->chain3_height > SIZE_FHD) && - (device->chain3_width * device->chain3_height <= SIZE_WHD) && - ((device->setfile & FIMC_IS_SETFILE_MASK) \ - != ISS_SUB_SCENARIO_VIDEO)) - return 1; - else - return 0; -} - -/* rear preview UHD */ -DECLARE_DVFS_CHK_FUNC(FIMC_IS_SN_REAR_PREVIEW_UHD) -{ - if ((device->sensor->pdev->id == SENSOR_POSITION_REAR) && - (fimc_is_sensor_g_framerate(device->sensor) <= 30) && - (device->chain3_width * device->chain3_height > SIZE_WHD) && - ((device->setfile & FIMC_IS_SETFILE_MASK) \ - != ISS_SUB_SCENARIO_VIDEO)) - return 1; - else - return 0; -} - -/* front vt1 */ -DECLARE_DVFS_CHK_FUNC(FIMC_IS_SN_FRONT_VT1) -{ - if ((device->sensor->pdev->id == SENSOR_POSITION_FRONT) && - ((device->setfile & FIMC_IS_SETFILE_MASK) \ - == ISS_SUB_SCENARIO_FRONT_VT1)) - return 1; - else - return 0; -} - -/* front vt2 */ -DECLARE_DVFS_CHK_FUNC(FIMC_IS_SN_FRONT_VT2) -{ - if ((device->sensor->pdev->id == SENSOR_POSITION_FRONT) && - ((device->setfile & FIMC_IS_SETFILE_MASK) \ - == ISS_SUB_SCENARIO_FRONT_VT2)) - return 1; - else - return 0; -} - -/* front preview */ -DECLARE_DVFS_CHK_FUNC(FIMC_IS_SN_FRONT_PREVIEW) -{ - if ((device->sensor->pdev->id == SENSOR_POSITION_FRONT) && - !(((device->setfile & FIMC_IS_SETFILE_MASK) \ - == ISS_SUB_SCENARIO_FRONT_VT1) || - ((device->setfile & FIMC_IS_SETFILE_MASK) \ - == ISS_SUB_SCENARIO_FRONT_VT2))) - return 1; - else - return 0; -} - -/* rear capture */ -DECLARE_DVFS_CHK_FUNC(FIMC_IS_SN_REAR_CAPTURE) -{ - if ((device->sensor->pdev->id == SENSOR_POSITION_REAR) && - ((test_bit(FIMC_IS_ISCHAIN_REPROCESSING, &device->state)) || - fimc_is_chk_req(frame, FIMC_IS_VIDEO_SCC_NUM))) - return 1; - else - return 0; -} - -/* dis */ -DECLARE_DVFS_CHK_FUNC(FIMC_IS_SN_DIS_ENABLE) -{ - if (test_bit(FIMC_IS_SUBDEV_START, &device->dis.state)) - return 1; - else - return 0; -} - -static int fimc_is_set_pwm(struct fimc_is_device_ischain *device, u32 pwm_qos) -{ - int ret = 0; - u32 base_addr; - void __iomem *addr; - - base_addr = GET_FIMC_IS_ADDR_OF_SUBIP2(device, pwm); - - if (base_addr) { - addr = ioremap(base_addr + FIMC_IS_PWM_TCNTB0, SZ_4); - writel(pwm_qos, addr); - dbg("PWM SFR Read(%08X), pwm_qos(%08X)\n", readl(addr), pwm_qos); - iounmap(addr); - } - - return ret; -} - -int fimc_is_dvfs_init(struct fimc_is_resourcemgr *resourcemgr) -{ - int i; - pr_info("%s\n", __func__); - - BUG_ON(!resourcemgr); - - resourcemgr->dvfs_ctrl.cur_cpu_min_qos = 0; - resourcemgr->dvfs_ctrl.cur_cpu_max_qos = 0; - resourcemgr->dvfs_ctrl.cur_int_qos = 0; - resourcemgr->dvfs_ctrl.cur_mif_qos = 0; - resourcemgr->dvfs_ctrl.cur_cam_qos = 0; - resourcemgr->dvfs_ctrl.cur_i2c_qos = 0; - resourcemgr->dvfs_ctrl.cur_disp_qos = 0; - - /* init spin_lock for clock gating */ - mutex_init(&resourcemgr->dvfs_ctrl.lock); - - if (!(resourcemgr->dvfs_ctrl.static_ctrl)) - resourcemgr->dvfs_ctrl.static_ctrl = - kzalloc(sizeof(struct fimc_is_dvfs_scenario_ctrl), GFP_KERNEL); - if (!(resourcemgr->dvfs_ctrl.dynamic_ctrl)) - resourcemgr->dvfs_ctrl.dynamic_ctrl = - kzalloc(sizeof(struct fimc_is_dvfs_scenario_ctrl), GFP_KERNEL); - - if (!resourcemgr->dvfs_ctrl.static_ctrl || !resourcemgr->dvfs_ctrl.dynamic_ctrl) { - err("dvfs_ctrl alloc is failed!!\n"); - return -ENOMEM; - } - - /* set priority by order */ - for (i = 0; i < ARRAY_SIZE(static_scenarios); i++) - static_scenarios[i].priority = i; - for (i = 0; i < ARRAY_SIZE(dynamic_scenarios); i++) - dynamic_scenarios[i].priority = i; - - resourcemgr->dvfs_ctrl.static_ctrl->cur_scenario_id = -1; - resourcemgr->dvfs_ctrl.static_ctrl->cur_scenario_idx = -1; - resourcemgr->dvfs_ctrl.static_ctrl->scenarios = static_scenarios; - if (static_scenarios[0].scenario_id == FIMC_IS_SN_DEFAULT) - resourcemgr->dvfs_ctrl.static_ctrl->scenario_cnt = 0; - else - resourcemgr->dvfs_ctrl.static_ctrl->scenario_cnt = ARRAY_SIZE(static_scenarios); - - resourcemgr->dvfs_ctrl.dynamic_ctrl->cur_scenario_id = -1; - resourcemgr->dvfs_ctrl.dynamic_ctrl->cur_scenario_idx = -1; - resourcemgr->dvfs_ctrl.dynamic_ctrl->cur_frame_tick = -1; - resourcemgr->dvfs_ctrl.dynamic_ctrl->scenarios = dynamic_scenarios; - if (static_scenarios[0].scenario_id == FIMC_IS_SN_DEFAULT) - resourcemgr->dvfs_ctrl.dynamic_ctrl->scenario_cnt = 0; - else - resourcemgr->dvfs_ctrl.dynamic_ctrl->scenario_cnt = ARRAY_SIZE(dynamic_scenarios); - - return 0; -} - -int fimc_is_dvfs_sel_scenario(u32 type, struct fimc_is_device_ischain *device, struct fimc_is_frame *frame) -{ - struct fimc_is_dvfs_ctrl *dvfs_ctrl; - struct fimc_is_dvfs_scenario_ctrl *static_ctrl, *dynamic_ctrl; - struct fimc_is_dvfs_scenario *scenarios; - struct fimc_is_dvfs_scenario *cur_scenario; - struct fimc_is_resourcemgr *resourcemgr; - int i, scenario_id, scenario_cnt; - - if (device == NULL) { - err("device is NULL\n"); - return -EINVAL; - } - - resourcemgr = device->resourcemgr; - dvfs_ctrl = &(resourcemgr->dvfs_ctrl); - static_ctrl = dvfs_ctrl->static_ctrl; - dynamic_ctrl = dvfs_ctrl->dynamic_ctrl; - - if (type == FIMC_IS_DYNAMIC_SN) { - /* dynamic scenario */ - if (!dynamic_ctrl) { - err("dynamic_dvfs_ctrl is NULL\n"); - return -EINVAL; - } - - if (dynamic_ctrl->scenario_cnt == 0) { - pr_debug("dynamic_scenario's count is jero\n"); - return -EINVAL; - } - - scenarios = dynamic_ctrl->scenarios; - scenario_cnt = dynamic_ctrl->scenario_cnt; - - if (dynamic_ctrl->cur_frame_tick >= 0) { - (dynamic_ctrl->cur_frame_tick)--; - /* - * when cur_frame_tick is lower than 0, clear current scenario. - * This means that current frame tick to keep dynamic scenario - * was expired. - */ - if (dynamic_ctrl->cur_frame_tick < 0) { - dynamic_ctrl->cur_scenario_id = -1; - dynamic_ctrl->cur_scenario_idx = -1; - } - } - } else { - /* static scenario */ - if (!static_ctrl) { - err("static_dvfs_ctrl is NULL\n"); - return -EINVAL; - } - - if (static_ctrl->scenario_cnt == 0) { - pr_debug("static_scenario's count is jero\n"); - return -EINVAL; - } - - scenarios = static_ctrl->scenarios; - scenario_cnt = static_ctrl->scenario_cnt; - } - - for (i = 0; i < scenario_cnt; i++) { - if (!scenarios[i].check_func) { - warn("check_func[%d] is NULL\n", i); - continue; - } - - if ((scenarios[i].check_func(device, frame)) > 0) { - scenario_id = scenarios[i].scenario_id; - - if (type == FIMC_IS_DYNAMIC_SN) { - cur_scenario = &scenarios[dynamic_ctrl->cur_scenario_idx]; - - /* - * if condition 1 or 2 is true - * condition 1 : There's no dynamic scenario applied. - * condition 2 : Finded scenario's prority was higher than current - */ - if ((dynamic_ctrl->cur_scenario_id <= 0) || - (scenarios[i].priority < (cur_scenario->priority))) { - dynamic_ctrl->cur_scenario_id = scenarios[i].scenario_id; - dynamic_ctrl->cur_scenario_idx = i; - dynamic_ctrl->cur_frame_tick = scenarios[i].keep_frame_tick; - } else { - /* if finded scenario is same */ - if (scenarios[i].priority == (cur_scenario->priority)) - dynamic_ctrl->cur_frame_tick = scenarios[i].keep_frame_tick; - return -EAGAIN; - } - } else { - static_ctrl->cur_scenario_id = scenario_id; - static_ctrl->cur_scenario_idx = i; - static_ctrl->cur_frame_tick = scenarios[i].keep_frame_tick; - } - - return scenario_id; - } - } - - if (type == FIMC_IS_DYNAMIC_SN) - return -EAGAIN; - - { - struct fimc_is_core *core; - int sensor_cnt = 0; - core = (struct fimc_is_core *)device->interface->core; - sensor_cnt = fimc_is_get_open_sensor_cnt(core); - - warn("couldn't find static dvfs scenario [sensor:(%d/%d)/fps:%d/setfile:%d/scp size:(%d/%d)]\n", - sensor_cnt, - device->sensor->pdev->id, - fimc_is_sensor_g_framerate(device->sensor), - (device->setfile & FIMC_IS_SETFILE_MASK), - device->chain3_width, - device->chain3_height); - } - - static_ctrl->cur_scenario_id = FIMC_IS_SN_DEFAULT; - static_ctrl->cur_scenario_idx = -1; - static_ctrl->cur_frame_tick = -1; - - return FIMC_IS_SN_DEFAULT; -} - -int fimc_is_get_qos(struct fimc_is_core *core, u32 type, u32 scenario_id) -{ - struct exynos_platform_fimc_is *pdata = NULL; - int qos = 0; - - pdata = core->pdata; - if (pdata == NULL) { - err("pdata is NULL\n"); - return -EINVAL; - } - - if (!pdata->get_int_qos || !pdata->get_mif_qos) - goto struct_qos; - - switch (type) { - case FIMC_IS_DVFS_INT: - qos = pdata->get_int_qos(scenario_id); - break; - case FIMC_IS_DVFS_MIF: - qos = pdata->get_mif_qos(scenario_id); - break; - case FIMC_IS_DVFS_I2C: - if (pdata->get_i2c_qos) - qos = pdata->get_i2c_qos(scenario_id); - break; - } - goto exit; - -struct_qos: - if (max(0, (int)type) >= FIMC_IS_DVFS_END) { - err("Cannot find DVFS value"); - return -EINVAL; - } - - qos = pdata->dvfs_data[scenario_id][type]; - -exit: - return qos; -} - -int fimc_is_set_dvfs(struct fimc_is_device_ischain *device, u32 scenario_id) -{ - int ret = 0; - int cpu_min_qos, cpu_max_qos, int_qos, mif_qos, i2c_qos, cam_qos, disp_qos, pwm_qos = 0; - int refcount; - struct fimc_is_core *core; - struct fimc_is_resourcemgr *resourcemgr; - struct fimc_is_dvfs_ctrl *dvfs_ctrl; - - if (device == NULL) { - err("device is NULL\n"); - return -EINVAL; - } - - core = (struct fimc_is_core *)device->interface->core; - resourcemgr = device->resourcemgr; - dvfs_ctrl = &(resourcemgr->dvfs_ctrl); - - refcount = atomic_read(&core->video_isp.refcount); - if (refcount < 0) { - err("invalid ischain refcount"); - goto exit; - } - - cpu_min_qos = fimc_is_get_qos(core, FIMC_IS_DVFS_CPU_MIN, scenario_id); - cpu_max_qos = fimc_is_get_qos(core, FIMC_IS_DVFS_CPU_MAX, scenario_id); - int_qos = fimc_is_get_qos(core, FIMC_IS_DVFS_INT, scenario_id); - mif_qos = fimc_is_get_qos(core, FIMC_IS_DVFS_MIF, scenario_id); - i2c_qos = fimc_is_get_qos(core, FIMC_IS_DVFS_I2C, scenario_id); - cam_qos = fimc_is_get_qos(core, FIMC_IS_DVFS_CAM, scenario_id); - disp_qos = fimc_is_get_qos(core, FIMC_IS_DVFS_DISP, scenario_id); - pwm_qos = fimc_is_get_qos(core, FIMC_IS_DVFS_PWM, scenario_id); - - if ((int_qos < 0) || (mif_qos < 0) || (i2c_qos < 0) - || (cam_qos < 0) || (disp_qos < 0) || (pwm_qos < 0)) { - err("getting qos value is failed!!\n"); - return -EINVAL; - } - - if (dvfs_ctrl->cur_cpu_min_qos != cpu_min_qos) { - pm_qos_update_request(&exynos_isp_qos_cpu_min, cpu_min_qos); - dvfs_ctrl->cur_cpu_min_qos = cpu_min_qos; - } - - if (dvfs_ctrl->cur_cpu_max_qos != cpu_max_qos) { - pm_qos_update_request(&exynos_isp_qos_cpu_max, cpu_max_qos); - dvfs_ctrl->cur_cpu_max_qos = cpu_max_qos; - } - - /* check current qos */ - if (int_qos && dvfs_ctrl->cur_int_qos != int_qos) { - if (i2c_qos) { - ret = fimc_is_itf_i2c_lock(device, i2c_qos, true); - if (ret) { - err("fimc_is_itf_i2_clock fail\n"); - goto exit; - } - } - - if (pwm_qos) { - fimc_is_set_pwm(device, pwm_qos); - if (ret) { - err("fimc_is_set_pwm fail\n"); - goto exit; - } - } - - pm_qos_update_request(&exynos_isp_qos_int, int_qos); - dvfs_ctrl->cur_int_qos = int_qos; - - if (i2c_qos) { - /* i2c unlock */ - ret = fimc_is_itf_i2c_lock(device, i2c_qos, false); - if (ret) { - err("fimc_is_itf_i2c_unlock fail\n"); - goto exit; - } - } - } - - if (mif_qos && dvfs_ctrl->cur_mif_qos != mif_qos) { - pm_qos_update_request(&exynos_isp_qos_mem, mif_qos); - dvfs_ctrl->cur_mif_qos = mif_qos; - } - - if (cam_qos && dvfs_ctrl->cur_cam_qos != cam_qos) { - pm_qos_update_request(&exynos_isp_qos_cam, cam_qos); - dvfs_ctrl->cur_cam_qos = cam_qos; - } - - if (disp_qos && dvfs_ctrl->cur_disp_qos != disp_qos) { - pm_qos_update_request(&exynos_isp_qos_disp, disp_qos); - dvfs_ctrl->cur_disp_qos = disp_qos; - } - - dbg("[RSC:%d]: New QoS [INT(%d), MIF(%d), CAM(%d), DISP(%d), I2C(%d), PWM(%d) CPU(%d/%d)]\n", - device->instance, int_qos, mif_qos, - cam_qos, disp_qos, i2c_qos, pwm_qos, cpu_min_qos, cpu_max_qos); -exit: - return ret; -} diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-dvfs.h b/drivers/media/platform/exynos/fimc-is/fimc-is-dvfs.h deleted file mode 100644 index 6ffd9e4..0000000 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-dvfs.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Samsung Exynos5 SoC series FIMC-IS driver - * - * - * Copyright (c) 2011 Samsung Electronics Co., Ltd - * - * 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_DVFS_H -#define FIMC_IS_DVFS_H - -#include -#include -#include -#include - -#include "fimc-is-time.h" -#include "fimc-is-param.h" -#include "fimc-is-cmd.h" -#include "fimc-is-regs.h" -#include "fimc-is-err.h" -#include "fimc-is-video.h" -#include "fimc-is-groupmgr.h" -#include "fimc-is-device-ischain.h" - -#define KEEP_FRAME_TICK_DEFAULT (5) -#define DVFS_SN_STR(__SCENARIO) #__SCENARIO -#define GET_DVFS_CHK_FUNC(__SCENARIO) check_ ## __SCENARIO -#define DECLARE_DVFS_CHK_FUNC(__SCENARIO) \ - int check_ ## __SCENARIO \ - (struct fimc_is_device_ischain *device, struct fimc_is_frame *frame, ...) - -#define SIZE_FHD (1920 * 1080) -#define SIZE_WHD (2560 * 1440) -#define SIZE_UHD (3840 * 2160) - -enum FIMC_IS_DVFS_SCENARIO_TYPE { - FIMC_IS_STATIC_SN, - FIMC_IS_DYNAMIC_SN, -}; - -struct fimc_is_dvfs_scenario { - u32 scenario_id; /* scenario_id */ - char *scenario_nm; /* string of scenario_id */ - int priority; /* priority for dynamic scenario */ - int keep_frame_tick; /* keep qos lock during specific frames when dynamic scenario */ - - /* function pointer to check a scenario */ - int (*check_func)(struct fimc_is_device_ischain *device, - struct fimc_is_frame *frame, ...); -}; - -struct fimc_is_dvfs_scenario_ctrl { - int cur_scenario_id; /* selected scenario idx */ - int cur_frame_tick; /* remained frame tick to keep qos lock in dynamic scenario */ - int scenario_cnt; /* total scenario count */ - int cur_scenario_idx; /* selected scenario idx for scenarios */ - struct fimc_is_dvfs_scenario *scenarios; -}; - -int fimc_is_dvfs_init(struct fimc_is_resourcemgr *resourcemgr); -int fimc_is_dvfs_sel_scenario(u32 type, struct fimc_is_device_ischain *device, struct fimc_is_frame *frame); -int fimc_is_get_qos(struct fimc_is_core *core, u32 type, u32 scenario_id); -int fimc_is_set_dvfs(struct fimc_is_device_ischain *device, u32 scenario_id); -#endif diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-fan53555.c b/drivers/media/platform/exynos/fimc-is/fimc-is-fan53555.c index 7f76409..c06f40b 100644 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-fan53555.c +++ b/drivers/media/platform/exynos/fimc-is/fimc-is-fan53555.c @@ -61,31 +61,6 @@ int fan53555_get_vout_val(int sel) return vout; } -int fan53555_enable_vsel0(struct i2c_client *client, int on_off) -{ - int ret; - - ret = i2c_smbus_read_byte_data(client, REG_VSEL0); - if(ret < 0){ - pr_err("%s: read error = %d , try again", __func__, ret); - ret = i2c_smbus_read_byte_data(client, REG_VSEL0); - if (ret < 0) - pr_err("%s: read 2nd error = %d", __func__, ret); - } - - ret &= (~VSEL0_BUCK_EN0); - ret |= (on_off << VSEL0_BUCK_EN0_SHIFT); - - ret = i2c_smbus_write_byte_data(client, REG_VSEL0, (BYTE)ret); - if (ret < 0){ - pr_err("%s: write error = %d , try again", __func__, ret); - ret = i2c_smbus_write_byte_data(client, REG_VSEL0, (BYTE)ret); - if (ret < 0) - pr_err("%s: write 2nd error = %d", __func__, ret); - } - return ret; -} - /** * fan53555_set_vsel0_vout: set dcdc vout with i2c register value. */ diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-fan53555.h b/drivers/media/platform/exynos/fimc-is/fimc-is-fan53555.h index 24e5f91..deb9029 100644 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-fan53555.h +++ b/drivers/media/platform/exynos/fimc-is/fimc-is-fan53555.h @@ -104,7 +104,6 @@ struct fan53555_vout { int fan53555_get_vout_val(int sel); const char *fan53555_get_vout_str(int sel); -int fan53555_enable_vsel0(struct i2c_client *client, int on_off); int fan53555_set_vsel0_vout(struct i2c_client *client, int vout); diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-framemgr.c b/drivers/media/platform/exynos/fimc-is/fimc-is-framemgr.c index ccb74e5..f59f352 100644 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-framemgr.c +++ b/drivers/media/platform/exynos/fimc-is/fimc-is-framemgr.c @@ -65,41 +65,6 @@ int fimc_is_frame_s_free_shot(struct fimc_is_framemgr *this, return ret; } - -int fimc_is_frame_g_free_shot(struct fimc_is_framemgr *this, - struct fimc_is_frame **item) -{ - int ret = 0; - - if (item) { - if (this->frame_fre_cnt) { - *item = container_of(this->frame_free_head.next, - struct fimc_is_frame, list); - list_del(&(*item)->list); - this->frame_fre_cnt--; - - (*item)->state = FIMC_IS_FRAME_STATE_INVALID; - } else { - *item = NULL; - } - } else { - ret = -EFAULT; - err("item is null ptr\n"); - } - - return ret; -} - -void fimc_is_frame_free_head(struct fimc_is_framemgr *this, - struct fimc_is_frame **item) -{ - if (this->frame_fre_cnt) - *item = container_of(this->frame_free_head.next, - struct fimc_is_frame, list); - else - *item = NULL; -} - void fimc_is_frame_print_free_list(struct fimc_is_framemgr *this) { struct list_head *temp; @@ -140,30 +105,6 @@ int fimc_is_frame_s_request_shot(struct fimc_is_framemgr *this, return ret; } -int fimc_is_frame_g_request_shot(struct fimc_is_framemgr *this, - struct fimc_is_frame **item) -{ - int ret = 0; - - if (item) { - if (this->frame_req_cnt) { - *item = container_of(this->frame_request_head.next, - struct fimc_is_frame, list); - list_del(&(*item)->list); - this->frame_req_cnt--; - - (*item)->state = FIMC_IS_FRAME_STATE_INVALID; - } else { - *item = NULL; - } - } else { - ret = -EFAULT; - err("item is null ptr\n"); - } - - return ret; -} - void fimc_is_frame_request_head(struct fimc_is_framemgr *this, struct fimc_is_frame **item) { @@ -215,30 +156,6 @@ int fimc_is_frame_s_process_shot(struct fimc_is_framemgr *this, return ret; } -int fimc_is_frame_g_process_shot(struct fimc_is_framemgr *this, - struct fimc_is_frame **item) -{ - int ret = 0; - - if (item) { - if (this->frame_pro_cnt) { - *item = container_of(this->frame_process_head.next, - struct fimc_is_frame, list); - list_del(&(*item)->list); - this->frame_pro_cnt--; - - (*item)->state = FIMC_IS_FRAME_STATE_INVALID; - } else { - *item = NULL; - } - } else { - ret = -EFAULT; - err("item is null ptr\n"); - } - - return ret; -} - void fimc_is_frame_process_head(struct fimc_is_framemgr *this, struct fimc_is_frame **item) { @@ -291,30 +208,6 @@ int fimc_is_frame_s_complete_shot(struct fimc_is_framemgr *this, } -int fimc_is_frame_g_complete_shot(struct fimc_is_framemgr *this, - struct fimc_is_frame **item) -{ - int ret = 0; - - if (item) { - if (this->frame_com_cnt) { - *item = container_of(this->frame_complete_head.next, - struct fimc_is_frame, list); - list_del(&(*item)->list); - this->frame_com_cnt--; - - (*item)->state = FIMC_IS_FRAME_STATE_INVALID; - } else { - *item = NULL; - } - } else { - ret = -EFAULT; - err("item is null ptr\n"); - } - - return ret; -} - void fimc_is_frame_complete_head(struct fimc_is_framemgr *this, struct fimc_is_frame **item) { @@ -464,26 +357,6 @@ exit: return ret; } -int fimc_is_frame_trans_fre_to_com(struct fimc_is_framemgr *this, - struct fimc_is_frame *item) -{ - int ret = 0; - - if (!this->frame_fre_cnt) { - err("shot free count is zero\n"); - ret = -EFAULT; - goto exit; - } - - list_del(&item->list); - this->frame_fre_cnt--; - - fimc_is_frame_s_complete_shot(this, item); - -exit: - return ret; -} - int fimc_is_frame_trans_com_to_fre(struct fimc_is_framemgr *this, struct fimc_is_frame *item) { diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-framemgr.h b/drivers/media/platform/exynos/fimc-is/fimc-is-framemgr.h index 7b373ca..d04c2412 100644 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-framemgr.h +++ b/drivers/media/platform/exynos/fimc-is/fimc-is-framemgr.h @@ -186,40 +186,28 @@ void fimc_is_frame_print_all(struct fimc_is_framemgr *this); int fimc_is_frame_s_free_shot(struct fimc_is_framemgr *this, struct fimc_is_frame *frame); -int fimc_is_frame_g_free_shot(struct fimc_is_framemgr *this, - struct fimc_is_frame **frame); -void fimc_is_frame_free_head(struct fimc_is_framemgr *this, - struct fimc_is_frame **frame); void fimc_is_frame_print_free_list(struct fimc_is_framemgr *this); int fimc_is_frame_s_request_shot(struct fimc_is_framemgr *this, struct fimc_is_frame *frame); -int fimc_is_frame_g_request_shot(struct fimc_is_framemgr *this, - struct fimc_is_frame **frame); void fimc_is_frame_request_head(struct fimc_is_framemgr *this, struct fimc_is_frame **frame); void fimc_is_frame_print_request_list(struct fimc_is_framemgr *this); int fimc_is_frame_s_process_shot(struct fimc_is_framemgr *this, struct fimc_is_frame *frame); -int fimc_is_frame_g_process_shot(struct fimc_is_framemgr *this, - struct fimc_is_frame **frame); void fimc_is_frame_process_head(struct fimc_is_framemgr *this, struct fimc_is_frame **frame); void fimc_is_frame_print_process_list(struct fimc_is_framemgr *this); int fimc_is_frame_s_complete_shot(struct fimc_is_framemgr *this, struct fimc_is_frame *frame); -int fimc_is_frame_g_complete_shot(struct fimc_is_framemgr *this, - struct fimc_is_frame **frame); void fimc_is_frame_complete_head(struct fimc_is_framemgr *this, struct fimc_is_frame **frame); void fimc_is_frame_print_complete_list(struct fimc_is_framemgr *this); int fimc_is_frame_trans_fre_to_req(struct fimc_is_framemgr *this, struct fimc_is_frame *frame); -int fimc_is_frame_trans_fre_to_com(struct fimc_is_framemgr *this, - struct fimc_is_frame *frame); int fimc_is_frame_trans_req_to_pro(struct fimc_is_framemgr *this, struct fimc_is_frame *frame); int fimc_is_frame_trans_req_to_com(struct fimc_is_framemgr *this, diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-groupmgr.c b/drivers/media/platform/exynos/fimc-is/fimc-is-groupmgr.c index 7223243..23b06fd 100644 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-groupmgr.c +++ b/drivers/media/platform/exynos/fimc-is/fimc-is-groupmgr.c @@ -40,7 +40,6 @@ #include "fimc-is-framemgr.h" #include "fimc-is-groupmgr.h" #include "fimc-is-cmd.h" -#include "fimc-is-dvfs.h" /* sysfs variable for debug */ extern struct fimc_is_sysfs_debug sysfs_debug; @@ -230,37 +229,6 @@ exit: return ret; } -int fimc_is_gframe_cancel(struct fimc_is_groupmgr *groupmgr, - struct fimc_is_group *group, u32 target_fcount) -{ - int ret = -EINVAL; - struct fimc_is_group_framemgr *gframemgr; - struct fimc_is_group_frame *gframe, *temp; - - BUG_ON(!groupmgr); - BUG_ON(!group); - BUG_ON(group->instance >= FIMC_IS_MAX_NODES); - - gframemgr = &groupmgr->framemgr[group->instance]; - - spin_lock_irq(&gframemgr->frame_slock); - - list_for_each_entry_safe(gframe, temp, &group->frame_group_head, list) { - if (gframe->fcount == target_fcount) { - list_del(&gframe->list); - group->frame_group_cnt--; - mwarn("gframe%d is cancelled", group, target_fcount); - fimc_is_gframe_s_free(gframemgr, gframe); - ret = 0; - break; - } - } - - spin_unlock_irq(&gframemgr->frame_slock); - - return ret; -} - void * fimc_is_gframe_rewind(struct fimc_is_groupmgr *groupmgr, struct fimc_is_group *group, u32 target_fcount) { @@ -487,14 +455,7 @@ static void fimc_is_group_cancel(struct fimc_is_group *group, framemgr_x_barrier_irqr(sub_framemgr, 0, flags); } } -#ifdef CONFIG_USE_VENDER_FEATURE /* Flash Mode Control */ -#ifdef CONFIG_LEDS_LM3560 -extern int lm3560_reg_update_export(u8 reg, u8 mask, u8 data); -#endif -#ifdef CONFIG_LEDS_SKY81296 -extern int sky81296_torch_ctrl(int state); -#endif static void fimc_is_group_set_torch(struct fimc_is_group *group, struct fimc_is_frame *ldr_frame) @@ -506,25 +467,12 @@ static void fimc_is_group_set_torch(struct fimc_is_group *group, group->aeflashMode = ldr_frame->shot->ctl.aa.aeflashMode; switch (group->aeflashMode) { case AA_FLASHMODE_ON_ALWAYS: /*TORCH mode*/ -#ifdef CONFIG_LEDS_LM3560 - lm3560_reg_update_export(0xE0, 0xFF, 0xEF); -#elif defined(CONFIG_LEDS_SKY81296) - sky81296_torch_ctrl(1); -#endif break; case AA_FLASHMODE_START: /*Pre flash mode*/ -#ifdef CONFIG_LEDS_LM3560 - lm3560_reg_update_export(0xE0, 0xFF, 0xEF); -#elif defined(CONFIG_LEDS_SKY81296) - sky81296_torch_ctrl(1); -#endif break; case AA_FLASHMODE_CAPTURE: /*Main flash mode*/ break; case AA_FLASHMODE_OFF: /*OFF mode*/ -#ifdef CONFIG_LEDS_SKY81296 - sky81296_torch_ctrl(0); -#endif break; default: break; @@ -532,7 +480,6 @@ static void fimc_is_group_set_torch(struct fimc_is_group *group, } return; } -#endif #ifdef DEBUG_AA static void fimc_is_group_debug_aa_shot(struct fimc_is_group *group, @@ -1528,9 +1475,6 @@ int fimc_is_group_start(struct fimc_is_groupmgr *groupmgr, int async_step = 0; bool try_sdown = false; bool try_rdown = false; -#ifdef ENABLE_DVFS - int scenario_id; -#endif BUG_ON(!groupmgr); BUG_ON(!group); @@ -1807,36 +1751,9 @@ int fimc_is_group_start(struct fimc_is_groupmgr *groupmgr, #ifdef DEBUG_AA fimc_is_group_debug_aa_shot(group, ldr_frame); #endif -#ifdef CONFIG_USE_VENDER_FEATURE /* Flash Mode Control */ fimc_is_group_set_torch(group, ldr_frame); -#endif -#ifdef ENABLE_DVFS - mutex_lock(&resourcemgr->dvfs_ctrl.lock); - if ((!pm_qos_request_active(&device->user_qos)) && - (sysfs_debug.en_dvfs)) { - /* try to find dynamic scenario to apply */ - scenario_id = fimc_is_dvfs_sel_scenario(FIMC_IS_DYNAMIC_SN, device, ldr_frame); - - if (scenario_id > 0) { - struct fimc_is_dvfs_scenario_ctrl *dynamic_ctrl = resourcemgr->dvfs_ctrl.dynamic_ctrl; - info("GRP:%d dynamic scenario(%d)-[%s]\n", - group->id, scenario_id, - dynamic_ctrl->scenarios[dynamic_ctrl->cur_scenario_idx].scenario_nm); - fimc_is_set_dvfs(device, scenario_id); - } - - if ((scenario_id < 0) && (resourcemgr->dvfs_ctrl.dynamic_ctrl->cur_frame_tick == 0)) { - struct fimc_is_dvfs_scenario_ctrl *static_ctrl = resourcemgr->dvfs_ctrl.static_ctrl; - info("GRP:%d restore scenario(%d)-[%s]\n", - group->id, static_ctrl->cur_scenario_id, - static_ctrl->scenarios[static_ctrl->cur_scenario_idx].scenario_nm); - fimc_is_set_dvfs(device, static_ctrl->cur_scenario_id); - } - } - mutex_unlock(&resourcemgr->dvfs_ctrl.lock); -#endif PROGRAM_COUNT(6); ret = group->start_callback(group->device, ldr_frame); diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-groupmgr.h b/drivers/media/platform/exynos/fimc-is/fimc-is-groupmgr.h index edf41d3..9879e6e 100644 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-groupmgr.h +++ b/drivers/media/platform/exynos/fimc-is/fimc-is-groupmgr.h @@ -167,9 +167,6 @@ int fimc_is_group_done(struct fimc_is_groupmgr *groupmgr, struct fimc_is_frame *ldr_frame, u32 done_state); -int fimc_is_gframe_cancel(struct fimc_is_groupmgr *groupmgr, - struct fimc_is_group *group, u32 target_fcount); - #define PROGRAM_COUNT(count) (group->pcount = count) #define GET_GROUP_FRAMEMGR(group) \ diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-hw-csi.c b/drivers/media/platform/exynos/fimc-is/fimc-is-hw-csi.c index 18e5ed8..f884654 100644 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-hw-csi.c +++ b/drivers/media/platform/exynos/fimc-is/fimc-is-hw-csi.c @@ -25,22 +25,6 @@ #include "fimc-is-regs.h" #include "fimc-is-hw.h" -#if (FIMC_IS_CSI_VERSION == CSI_VERSION_0310_0100) -#define CSI_REG_CTRL (0x00) -#define CSI_REG_DPHYCTRL (0x04) -#define CSI_REG_INTMSK (0x10) -#define CSI_REG_INTSRC (0x14) -#define CSI_REG_CONFIG0 (0x08) -#define CSI_REG_CONFIG1 (0x40) -#define CSI_REG_CONFIG2 (0x50) -#define CSI_REG_CONFIG3 (0x60) -#define CSI_REG_RESOL0 (0x2c) -#define CSI_REG_RESOL1 (0x44) -#define CSI_REG_RESOL2 (0x54) -#define CSI_REG_RESOL3 (0x64) -#define CSI_REG_DPHYCTRL0 (0x20) -#define CSI_REG_DPHYCTRL1 (0x24) -#else /* CSIS global control */ #define S5PCSIS_CTRL (0x00) #define S5PCSIS_CTRL_DPDN_SWAP_CLOCK_DEFAULT (0 << 31) @@ -58,12 +42,8 @@ /* D-PHY control */ #define S5PCSIS_DPHYCTRL (0x04) #define S5PCSIS_DPHYCTRL_DPHY_ON(lanes) ((~(0x1f << (lanes + 1))) & 0x1f) -#if defined(CONFIG_SOC_EXYNOS5260) -#define S5PCSIS_DPHYCTRL_HSS_MASK (0x1f << 27) -#else #define S5PCSIS_DPHYCTRL_HSS_MASK (0xff << 24) #define S5PCSIS_DPHYCTRL_CLKSETTLEMASK (0x3 << 22) -#endif /* Configuration */ #define S5PCSIS_CONFIG (0x08) @@ -85,11 +65,7 @@ /* Interrupt mask. */ #define S5PCSIS_INTMSK (0x10) -#if defined(CONFIG_SOC_EXYNOS5260) -#define S5PCSIS_INTMSK_EN_ALL (0xfc00103f) -#else #define S5PCSIS_INTMSK_EN_ALL (0xf1101117) -#endif #define S5PCSIS_INTMSK_EVEN_BEFORE (1 << 31) #define S5PCSIS_INTMSK_EVEN_AFTER (1 << 30) #define S5PCSIS_INTMSK_ODD_BEFORE (1 << 29) @@ -142,270 +118,6 @@ #define S5PCSIS_RESOL (0x2c) #define CSIS_MAX_PIX_WIDTH (0xffff) #define CSIS_MAX_PIX_HEIGHT (0xffff) -#endif - -#if (FIMC_IS_CSI_VERSION == CSI_VERSION_0310_0100) - -int csi_hw_reset(unsigned long __iomem *base_reg) -{ - int ret = 0; - u32 retry = 10; - u32 val; - - val = readl(base_reg + TO_WORD_OFFSET(CSI_REG_CTRL)); - writel(val | (1 << 4), base_reg + TO_WORD_OFFSET(CSI_REG_CTRL)); - - while (--retry) { - udelay(10); - val = readl(base_reg + TO_WORD_OFFSET(CSI_REG_CTRL)); - if (!(val & (1 << 4))) - break; - } - - if (!retry) { - err("reset is fail(%d)", retry); - ret = -EINVAL; - goto p_err; - } - -p_err: - return ret; -} - -int csi_hw_s_settle(unsigned long __iomem *base_reg, - u32 settle) -{ - u32 val = readl(base_reg + TO_WORD_OFFSET(CSI_REG_DPHYCTRL)); - val = (val & ~(0xFF << 24)) | (settle << 24); - writel(val, base_reg + TO_WORD_OFFSET(CSI_REG_DPHYCTRL)); - - return 0; -} - -int csi_hw_s_dphyctrl0(unsigned long __iomem *base_reg, - u32 ctrl) -{ - u32 val = readl(base_reg + TO_WORD_OFFSET(CSI_REG_DPHYCTRL0)); - val = (val & ~(0xFFFFFFFF << 0)) | (ctrl << 0); - writel(val, base_reg + TO_WORD_OFFSET(CSI_REG_DPHYCTRL0)); - - return 0; -} - -int csi_hw_s_dphyctrl1(unsigned long __iomem *base_reg, - u32 ctrl) -{ - u32 val = readl(base_reg + TO_WORD_OFFSET(CSI_REG_DPHYCTRL1)); - val = (val & ~(0xFFFFFFFF << 0)) | (ctrl << 0); - writel(val, base_reg + TO_WORD_OFFSET(CSI_REG_DPHYCTRL1)); - - return 0; -} - -int csi_hw_s_control(unsigned long __iomem *base_reg, - u32 pixelformat, u32 mode, u32 lanes) -{ - int ret = 0; - u32 val; - - val = readl(base_reg + TO_WORD_OFFSET(CSI_REG_CTRL)); - val = (val & ~(0x3 << 2)) | (lanes << 2); - val = (val & ~(0x3 << 22)) | (mode << 22); - - /* all channel use extclk for wrapper clock source */ - val |= (0xF << 8); - - switch (pixelformat) { - case V4L2_PIX_FMT_SBGGR8: - case V4L2_PIX_FMT_SGBRG8: - case V4L2_PIX_FMT_SGRBG8: - case V4L2_PIX_FMT_SRGGB8: - case V4L2_PIX_FMT_SBGGR10: - case V4L2_PIX_FMT_SGBRG10: - case V4L2_PIX_FMT_SGRBG10: - case V4L2_PIX_FMT_SRGGB10: - case V4L2_PIX_FMT_SBGGR12: - case V4L2_PIX_FMT_SGBRG12: - case V4L2_PIX_FMT_SGRBG12: - case V4L2_PIX_FMT_SRGGB12: - case V4L2_PIX_FMT_SBGGR16: - case V4L2_PIX_FMT_JPEG: - /* output width of CH0 is not 32 bits(normal output) */ - val &= ~(1 << 20); - break; - case V4L2_PIX_FMT_YVU420: - case V4L2_PIX_FMT_NV21: - case V4L2_PIX_FMT_YUYV: - /* output width of CH0 is 32 bits(32bit align) */ - val |= (1 << 20); - break; - default: - err("unsupported format(%X)", pixelformat); - ret = -EINVAL; - goto p_err; - break; - } - - writel(val, base_reg + TO_WORD_OFFSET(CSI_REG_CTRL)); - -p_err: - return ret; -} - -int csi_hw_s_config(unsigned long __iomem *base_reg, - u32 vc_src, u32 vc_dst, u32 pixelformat, u32 width, u32 height) -{ - int ret = 0; - u32 val, format; - - switch (pixelformat) { - case V4L2_PIX_FMT_SBGGR8: - case V4L2_PIX_FMT_SGBRG8: - case V4L2_PIX_FMT_SGRBG8: - case V4L2_PIX_FMT_SRGGB8: - format = HW_FORMAT_RAW8; - break; - case V4L2_PIX_FMT_SBGGR10: - case V4L2_PIX_FMT_SGBRG10: - case V4L2_PIX_FMT_SGRBG10: - case V4L2_PIX_FMT_SRGGB10: - format = HW_FORMAT_RAW10; - break; - case V4L2_PIX_FMT_SBGGR12: - case V4L2_PIX_FMT_SGBRG12: - case V4L2_PIX_FMT_SGRBG12: - case V4L2_PIX_FMT_SRGGB12: - format = HW_FORMAT_RAW10; - /* HACK : format = HW_FORMAT_RAW12; */ - break; - case V4L2_PIX_FMT_SBGGR16: - format = HW_FORMAT_RAW10; - /* HACK : format = HW_FORMAT_RAW12; */ - break; - case V4L2_PIX_FMT_YVU420: - case V4L2_PIX_FMT_NV21: - format = HW_FORMAT_YUV420_8BIT; - break; - case V4L2_PIX_FMT_YUYV: - format = HW_FORMAT_YUV422_8BIT; - break; - case V4L2_PIX_FMT_JPEG: - format = HW_FORMAT_USER; - break; - default: - err("unsupported format(%X)", pixelformat); - ret = -EINVAL; - goto p_err; - break; - } - - switch (vc_src) { - case CSI_VIRTUAL_CH_0: - val = readl(base_reg + TO_WORD_OFFSET(CSI_REG_CONFIG0)); - val = (val & ~(0x3 << 0)) | (vc_dst << 0); - val = (val & ~(0x3f << 2)) | (format << 2); - writel(val, base_reg + TO_WORD_OFFSET(CSI_REG_CONFIG0)); - - val = (width << 16) | (height << 0); - writel(val, base_reg + TO_WORD_OFFSET(CSI_REG_RESOL0)); - break; - case CSI_VIRTUAL_CH_1: - val = readl(base_reg + TO_WORD_OFFSET(CSI_REG_CONFIG1)); - val = (val & ~(0x3 << 0)) | (vc_dst << 0); - val = (val & ~(0x3f << 2)) | (format << 2); - writel(val, base_reg + TO_WORD_OFFSET(CSI_REG_CONFIG1)); - - val = (width << 16) | (height << 0); - writel(val, base_reg + TO_WORD_OFFSET(CSI_REG_RESOL1)); - break; - case CSI_VIRTUAL_CH_2: - val = readl(base_reg + TO_WORD_OFFSET(CSI_REG_CONFIG2)); - val = (val & ~(0x3 << 0)) | (vc_dst << 0); - val = (val & ~(0x3f << 2)) | (format << 2); - writel(val, base_reg + TO_WORD_OFFSET(CSI_REG_CONFIG2)); - - val = (width << 16) | (height << 0); - writel(val, base_reg + TO_WORD_OFFSET(CSI_REG_RESOL2)); - break; - case CSI_VIRTUAL_CH_3: - val = readl(base_reg + TO_WORD_OFFSET(CSI_REG_CONFIG3)); - val = (val & ~(0x3 << 0)) | (vc_dst << 0); - val = (val & ~(0x3f << 2)) | (format << 2); - writel(val, base_reg + TO_WORD_OFFSET(CSI_REG_CONFIG3)); - - val = (width << 16) | (height << 0); - writel(val, base_reg + TO_WORD_OFFSET(CSI_REG_RESOL3)); - break; - default: - err("invalid channel(%d)", vc_src); - ret = -EINVAL; - goto p_err; - break; - } - -p_err: - return ret; -} - -int csi_hw_s_interrupt(unsigned long __iomem *base_reg, bool on) -{ - u32 val = readl(base_reg + TO_WORD_OFFSET(CSI_REG_INTMSK)); - val = on ? (val | 0xFFF1FFF7) : (val & ~0xFFF1FFF7); - writel(val, base_reg + TO_WORD_OFFSET(CSI_REG_INTMSK)); - - return 0; -} - -int csi_hw_g_interrupt(unsigned long __iomem *base_reg) -{ - u32 val; - - val = readl(base_reg + TO_WORD_OFFSET(CSI_REG_INTSRC)); - writel(val, base_reg + TO_WORD_OFFSET(CSI_REG_INTSRC)); - - return val; -} - -int csi_hw_enable(unsigned long __iomem *base_reg) -{ - u32 val; - - /* update shadow */ - val = readl(base_reg + TO_WORD_OFFSET(CSI_REG_CTRL)); - val |= (0xF << 16); - writel(val, base_reg + TO_WORD_OFFSET(CSI_REG_CTRL)); - - /* DPHY on */ - val = readl(base_reg + TO_WORD_OFFSET(CSI_REG_DPHYCTRL)); - val |= (0x1f << 0); - writel(val, base_reg + TO_WORD_OFFSET(CSI_REG_DPHYCTRL)); - - /* csi enable */ - val = readl(base_reg + TO_WORD_OFFSET(CSI_REG_CTRL)); - val |= (0x1 << 0); - writel(val, base_reg + TO_WORD_OFFSET(CSI_REG_CTRL)); - - return 0; -} - -int csi_hw_disable(unsigned long __iomem *base_reg) -{ - u32 val; - - /* DPHY on */ - val = readl(base_reg + TO_WORD_OFFSET(CSI_REG_DPHYCTRL)); - val &= ~(0x1f << 0); - writel(val, base_reg + TO_WORD_OFFSET(CSI_REG_DPHYCTRL)); - - /* csi enable */ - val = readl(base_reg + TO_WORD_OFFSET(CSI_REG_CTRL)); - val &= ~(0x1 << 0); - writel(val, base_reg + TO_WORD_OFFSET(CSI_REG_CTRL)); - - return 0; -} - -#else void s5pcsis_enable_interrupts(unsigned long __iomem *base_reg, struct fimc_is_image *image, bool on) @@ -425,12 +137,7 @@ void s5pcsis_enable_interrupts(unsigned long __iomem *base_reg, } } -#if defined(CONFIG_SOC_EXYNOS5260) - /* FIXME: hard coded, only for rhea */ - writel(0xFFF01037, base_reg + TO_WORD_OFFSET(S5PCSIS_INTMSK)); -#else writel(val, base_reg + TO_WORD_OFFSET(S5PCSIS_INTMSK)); -#endif } void s5pcsis_reset(unsigned long __iomem *base_reg) @@ -447,33 +154,21 @@ void s5pcsis_system_enable(unsigned long __iomem *base_reg, int on, u32 lanes) val = readl(base_reg + TO_WORD_OFFSET(S5PCSIS_CTRL)); -#if defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) || defined(CONFIG_SOC_EXYNOS5422) val |= S5PCSIS_CTRL_WCLK_EXTCLK; -#endif if (on) { val |= S5PCSIS_CTRL_ENABLE; val |= S5PCSIS_CTRL_WCLK_EXTCLK; } else val &= ~S5PCSIS_CTRL_ENABLE; -#if defined(CONFIG_SOC_EXYNOS5260) - /* FIXME: hard coded, only for rhea */ - writel(0x0000010D, base_reg + TO_WORD_OFFSET(S5PCSIS_CTRL)); -#else writel(val, base_reg + TO_WORD_OFFSET(S5PCSIS_CTRL)); -#endif val = readl(base_reg + TO_WORD_OFFSET(S5PCSIS_DPHYCTRL)); if (on) val |= S5PCSIS_DPHYCTRL_DPHY_ON(lanes); else val &= ~S5PCSIS_DPHYCTRL_DPHY_ON(lanes); -#if defined(CONFIG_SOC_EXYNOS5260) - /* FIXME: hard coded, only for rhea */ - writel(0x0E00001F, base_reg + TO_WORD_OFFSET(S5PCSIS_DPHYCTRL)); -#else writel(val, base_reg + TO_WORD_OFFSET(S5PCSIS_DPHYCTRL)); -#endif } /* Called with the state.lock mutex held */ @@ -492,9 +187,7 @@ static void __s5pcsis_set_format(unsigned long __iomem *base_reg, else val = (val & ~S5PCSIS_CFG_FMT_MASK) | S5PCSIS_CFG_FMT_RAW10; -#if defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) || defined(CONFIG_SOC_EXYNOS5422) val |= S5PCSIS_CFG_END_INTERVAL(1); -#endif writel(val, base_reg + TO_WORD_OFFSET(S5PCSIS_CONFIG)); /* Pixel resolution */ @@ -517,12 +210,7 @@ void s5pcsis_set_hsync_settle(unsigned long __iomem *base_reg, u32 settle) val = (val & ~S5PCSIS_DPHYCTRL_HSS_MASK) | (settle << 24); -#if defined(CONFIG_SOC_EXYNOS5260) - /* FIXME: hard coded, only for rhea */ - writel(0x0E00001F, base_reg + TO_WORD_OFFSET(S5PCSIS_DPHYCTRL)); -#else writel(val, base_reg + TO_WORD_OFFSET(S5PCSIS_DPHYCTRL)); -#endif } void s5pcsis_set_params(unsigned long __iomem *base_reg, @@ -530,9 +218,6 @@ void s5pcsis_set_params(unsigned long __iomem *base_reg, { u32 val; -#if defined(CONFIG_SOC_EXYNOS3470) - writel(0x000000AC, base_reg + TO_WORD_OFFSET(S5PCSIS_CONFIG)); /* only for carmen */ -#endif __s5pcsis_set_format(base_reg, image); val = readl(base_reg + TO_WORD_OFFSET(S5PCSIS_CTRL)); @@ -556,4 +241,3 @@ void s5pcsis_set_params(unsigned long __iomem *base_reg, val = readl(base_reg + TO_WORD_OFFSET(S5PCSIS_CTRL)); writel(val | S5PCSIS_CTRL_UPDATE_SHADOW(0), base_reg + TO_WORD_OFFSET(S5PCSIS_CTRL)); } -#endif diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-hw-ischain.c b/drivers/media/platform/exynos/fimc-is/fimc-is-hw-ischain.c index b438537..953e652 100644 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-hw-ischain.c +++ b/drivers/media/platform/exynos/fimc-is/fimc-is-hw-ischain.c @@ -26,294 +26,7 @@ #include "fimc-is-type.h" #include "fimc-is-regs.h" #include "fimc-is-core.h" -#include "fimc-is-dvfs.h" -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)) -#define PM_QOS_CAM_THROUGHPUT PM_QOS_RESERVED -#endif -extern struct pm_qos_request exynos_isp_qos_cpu_min; -extern struct pm_qos_request exynos_isp_qos_cpu_max; -extern struct pm_qos_request exynos_isp_qos_int; -extern struct pm_qos_request exynos_isp_qos_mem; -extern struct pm_qos_request exynos_isp_qos_cam; -extern struct pm_qos_request exynos_isp_qos_disp; -#if defined(CONFIG_SOC_EXYNOS5422) || defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) -extern struct pm_qos_request max_cpu_qos; -#endif - -#if defined(CONFIG_ARGOS) -extern void argos_block_enable(char *req_name, bool set); -#endif - -#if defined(CONFIG_PM_DEVFREQ) -inline static void fimc_is_set_qos_init(struct fimc_is_core *core, bool on) -{ - int cpu_min_qos, cpu_max_qos, int_qos, mif_qos, cam_qos, disp_qos; - - cpu_min_qos = fimc_is_get_qos(core, FIMC_IS_DVFS_CPU_MIN, START_DVFS_LEVEL); - cpu_max_qos = fimc_is_get_qos(core, FIMC_IS_DVFS_CPU_MAX, START_DVFS_LEVEL); - int_qos = fimc_is_get_qos(core, FIMC_IS_DVFS_INT, START_DVFS_LEVEL); - mif_qos = fimc_is_get_qos(core, FIMC_IS_DVFS_MIF, START_DVFS_LEVEL); - cam_qos = fimc_is_get_qos(core, FIMC_IS_DVFS_CAM, START_DVFS_LEVEL); - disp_qos = fimc_is_get_qos(core, FIMC_IS_DVFS_DISP, START_DVFS_LEVEL); - - core->resourcemgr.dvfs_ctrl.cur_cpu_min_qos = cpu_min_qos; - core->resourcemgr.dvfs_ctrl.cur_cpu_max_qos = cpu_max_qos; - core->resourcemgr.dvfs_ctrl.cur_int_qos = int_qos; - core->resourcemgr.dvfs_ctrl.cur_mif_qos = mif_qos; - core->resourcemgr.dvfs_ctrl.cur_cam_qos = cam_qos; - core->resourcemgr.dvfs_ctrl.cur_disp_qos = disp_qos; - - if (on) { - /* DEVFREQ lock */ - if (cpu_min_qos > 0) - pm_qos_add_request(&exynos_isp_qos_cpu_min, PM_QOS_CPU_FREQ_MIN, cpu_min_qos); - if (cpu_max_qos > 0) - pm_qos_add_request(&exynos_isp_qos_cpu_max, PM_QOS_CPU_FREQ_MAX, cpu_max_qos); - if (int_qos > 0) - pm_qos_add_request(&exynos_isp_qos_int, PM_QOS_DEVICE_THROUGHPUT, int_qos); - if (mif_qos > 0) - pm_qos_add_request(&exynos_isp_qos_mem, PM_QOS_BUS_THROUGHPUT, mif_qos); - if (cam_qos > 0) - pm_qos_add_request(&exynos_isp_qos_cam, PM_QOS_CAM_THROUGHPUT, cam_qos); - if (disp_qos > 0) - pm_qos_add_request(&exynos_isp_qos_disp, PM_QOS_DISPLAY_THROUGHPUT, disp_qos); - - pr_info("[RSC] %s: QoS LOCK [INT(%d), MIF(%d), CAM(%d), DISP(%d) CPU(%d/%d)]\n", - __func__, int_qos, mif_qos, cam_qos, disp_qos, cpu_min_qos, cpu_max_qos); - } else { - /* DEVFREQ unlock */ - if (cpu_min_qos > 0) - pm_qos_remove_request(&exynos_isp_qos_cpu_min); - if (cpu_max_qos > 0) - pm_qos_remove_request(&exynos_isp_qos_cpu_max); - if (int_qos > 0) - pm_qos_remove_request(&exynos_isp_qos_int); - if (mif_qos > 0) - pm_qos_remove_request(&exynos_isp_qos_mem); - if (cam_qos > 0) - pm_qos_remove_request(&exynos_isp_qos_cam); - if (disp_qos > 0) - pm_qos_remove_request(&exynos_isp_qos_disp); - - pr_info("[RSC] %s: QoS UNLOCK\n", __func__); - } -} -#endif - - -#if (FIMC_IS_VERSION == FIMC_IS_VERSION_250) -int fimc_is_runtime_suspend_post(struct device *dev) -{ - int ret = 0; - u32 timeout; - - timeout = 1000; - while ((readl(PMUREG_ISP0_STATUS) & 0x1) && timeout) { - timeout--; - usleep_range(1000, 1000); - } - if (timeout == 0) - err("ISP0 power down failed(0x%08x)\n", readl(PMUREG_ISP0_STATUS)); - - timeout = 1000; - while ((readl(PMUREG_ISP1_STATUS) & 0x1) && timeout) { - timeout--; - usleep_range(1000, 1000); - } - if (timeout == 0) - err("ISP0 power down failed(0x%08x)\n", readl(PMUREG_ISP1_STATUS)); - - return ret; -} - -int fimc_is_runtime_suspend(struct device *dev) -{ -#ifndef CONFIG_PM_RUNTIME - int ret = 0; - u32 val; -#endif - struct platform_device *pdev = to_platform_device(dev); - struct fimc_is_core *core = (struct fimc_is_core *)platform_get_drvdata(pdev); - - BUG_ON(!core); - BUG_ON(!core->pdata); - BUG_ON(!core->pdata->clk_off); - - info("FIMC_IS runtime suspend in\n"); - -#if defined(CONFIG_VIDEOBUF2_ION) - if (core->mem.alloc_ctx) - vb2_ion_detach_iommu(core->mem.alloc_ctx); -#endif - -#if defined(CONFIG_FIMC_IS_BUS_DEVFREQ) - exynos5_update_media_layers(TYPE_FIMC_LITE, false); -#endif - -#ifndef CONFIG_PM_RUNTIME - /* ISP1 */ - /* 1. set internal clock reset */ - val = __raw_readl(PMUREG_CMU_RESET_ISP1_SYS_PWR); - val = (val & ~(0x1 << 0)) | (0x0 << 0); - __raw_writel(val, PMUREG_CMU_RESET_ISP1_SYS_PWR); - - /* 2. change to OSCCLK */ - ret = core->pdata->clk_off(pdev); - if (ret) - warn("clk_off is fail(%d)", ret); - - /* 3. set feedback mode */ - val = __raw_readl(PMUREG_ISP1_OPTION); - val = (val & ~(0x3 << 0)) | (0x2 << 0); - __raw_writel(val, PMUREG_ISP1_OPTION); - - /* 4. power off */ - val = __raw_readl(PMUREG_ISP1_CONFIGURATION); - val = (val & ~(0x7 << 0)) | (0x0 << 0); - __raw_writel(val, PMUREG_ISP1_CONFIGURATION); - - /* ISP0 */ - /* 1. set internal clock reset */ - val = __raw_readl(PMUREG_CMU_RESET_ISP0_SYS_PWR); - val = (val & ~(0x1 << 0)) | (0x0 << 0); - __raw_writel(val, PMUREG_CMU_RESET_ISP0_SYS_PWR); - - /* 2. set standbywfi a5 */ - val = __raw_readl(PMUREG_CENTRAL_SEQ_OPTION); - val = (val & ~(0x1 << 18)) | (0x1 << 18); - __raw_writel(val, PMUREG_CENTRAL_SEQ_OPTION); - - /* 3. stop a5 */ - __raw_writel(0x00010000, PMUREG_ISP_ARM_OPTION); - - /* 4. reset a5 */ - val = __raw_readl(PMUREG_ISP_ARM_SYS_PWR_REG); - val = (val & ~(0x1 << 0)) | (0x1 << 0); - __raw_writel(val, PMUREG_ISP_ARM_SYS_PWR_REG); - - /* 5. change to OSCCLK */ - - /* 6. set feedback mode */ - val = __raw_readl(PMUREG_ISP0_OPTION); - val = (val & ~(0x3 << 0)) | (0x2 << 0); - __raw_writel(val, PMUREG_ISP0_OPTION); - - /* 7. power off */ - val = __raw_readl(PMUREG_ISP0_CONFIGURATION); - val = (val & ~(0x7 << 0)) | (0x0 << 0); - __raw_writel(val, PMUREG_ISP0_CONFIGURATION); - - /* 8. a5 power off */ - val = __raw_readl(PMUREG_ISP_ARM_CONFIGURATION); - val = (val & ~(0x1 << 0)) | (0x0 << 0); - __raw_writel(val, PMUREG_ISP_ARM_CONFIGURATION); -#endif - -#if defined(CONFIG_PM_DEVFREQ) - /* DEVFREQ release */ - fimc_is_set_qos_init(core, false); -#endif - -#ifdef CONFIG_PM_RUNTIME - if (CALL_POPS(core, clk_off, pdev) < 0) - warn("clk_off is fail\n"); -#endif - - info("FIMC_IS runtime suspend out\n"); - pm_relax(dev); - return 0; -} - -int fimc_is_runtime_resume(struct device *dev) -{ - int ret = 0; - u32 val; - - struct platform_device *pdev = to_platform_device(dev); - struct fimc_is_core *core = (struct fimc_is_core *)platform_get_drvdata(pdev); - - BUG_ON(!core); - BUG_ON(!core->pdata); - BUG_ON(!core->pdata->clk_cfg); - BUG_ON(!core->pdata->clk_on); - - info("FIMC_IS runtime resume in\n"); - - val = __raw_readl(PMUREG_ISP0_STATUS); - if((val & 0x7) != 0x7){ - err("FIMC_IS runtime resume ISP0 : %d Power down\n",val); - BUG(); - } - - val = __raw_readl(PMUREG_ISP1_STATUS); - if((val & 0x7) != 0x7){ - err("FIMC_IS runtime resume ISP1 : %d Power down\n",val); - BUG(); - } - -#ifndef CONFIG_PM_RUNTIME - /* ISP0 */ - /* 1. set feedback mode */ - val = __raw_readl(PMUREG_ISP0_OPTION); - val = (val & ~(0x3<< 0)) | (0x2 << 0); - __raw_writel(val, PMUREG_ISP0_OPTION); - - /* 2. power on isp0 */ - val = __raw_readl(PMUREG_ISP0_CONFIGURATION); - val = (val & ~(0x7 << 0)) | (0x7 << 0); - __raw_writel(val, PMUREG_ISP0_CONFIGURATION); - - /* ISP1 */ - /* 3. set feedback mode */ - val = __raw_readl(PMUREG_ISP1_OPTION); - val = (val & ~(0x3<< 0)) | (0x2 << 0); - __raw_writel(val, PMUREG_ISP1_OPTION); - - /* 4. power on isp1 */ - val = __raw_readl(PMUREG_ISP1_CONFIGURATION); - val = (val & ~(0x7 << 0)) | (0x7 << 0); - __raw_writel(val, PMUREG_ISP1_CONFIGURATION); -#endif - - ret = core->pdata->clk_cfg(pdev); - if (ret) { - err("clk_cfg is fail(%d)", ret); - goto p_err; - } - - /* HACK: DVFS lock sequence is change. - * DVFS level should be locked after power on. - */ -#if defined(CONFIG_PM_DEVFREQ) - /* DEVFREQ set */ - fimc_is_set_qos_init(core, true); -#endif - - /* Clock on */ - ret = core->pdata->clk_on(pdev); - if (ret) { - err("clk_on is fail(%d)", ret); - goto p_err; - } - -#if defined(CONFIG_VIDEOBUF2_ION) - if (core->mem.alloc_ctx) - vb2_ion_attach_iommu(core->mem.alloc_ctx); -#endif - -#if defined(CONFIG_FIMC_IS_BUS_DEVFREQ) - exynos5_update_media_layers(TYPE_FIMC_LITE, true); -#endif - - pm_stay_awake(dev); - -p_err: - info("FIMC-IS runtime resume out\n"); - return ret; -} - -#else int fimc_is_runtime_suspend_post(struct device *dev) { int ret = 0; @@ -328,7 +41,6 @@ int fimc_is_runtime_suspend_post(struct device *dev) err("ISP power down failed(0x%08x)\n", readl(PMUREG_ISP_STATUS)); -#if defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) timeout = 1000; while ((readl(PMUREG_CAM0_STATUS) & 0x1) && timeout) { timeout--; @@ -346,10 +58,7 @@ int fimc_is_runtime_suspend_post(struct device *dev) if (timeout == 0) err("CAM1 power down failed(CAM1:0x%08x, A5:0x%08x)\n", readl(PMUREG_CAM1_STATUS), readl(PMUREG_ISP_ARM_STATUS)); -#endif /* defined(CONFIG_SOC_EXYNOS5430) */ -#if defined(CONFIG_SOC_EXYNOS5422) -#endif /* defined(CONFIG_SOC_EXYNOS5422) */ return ret; } @@ -366,42 +75,6 @@ int fimc_is_runtime_suspend(struct device *dev) pr_info("FIMC_IS runtime suspend in\n"); -#if !(defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433)) -#if defined(CONFIG_VIDEOBUF2_ION) - if (core->mem.alloc_ctx) - vb2_ion_detach_iommu(core->mem.alloc_ctx); -#endif -#endif - -#if defined(CONFIG_PM_DEVFREQ) - /* DEVFREQ set */ - fimc_is_set_qos_init(core, false); -#endif - -#if defined(CONFIG_ARGOS) - argos_block_enable("EMMC", false); -#endif - -#if defined(CONFIG_SOC_EXYNOS5422) || defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) - /* EGL Release */ - pm_qos_update_request(&max_cpu_qos, PM_QOS_CPU_FREQ_MAX_DEFAULT_VALUE); - pm_qos_remove_request(&max_cpu_qos); -#endif /* CONFIG_SOC_EXYNOS5422 */ - -#if defined(CONFIG_FIMC_IS_BUS_DEVFREQ) - /* BTS */ -#if defined(CONFIG_SOC_EXYNOS5260) - bts_initialize("spd-flite-a", false); - bts_initialize("spd-flite-b", false); -#elif defined(CONFIG_SOC_EXYNOS3470) - bts_initialize("pd-cam", false); -#else - bts_initialize("pd-fimclite", false); -#endif - /* media layer */ - exynos5_update_media_layers(TYPE_FIMC_LITE, false); -#endif /* CONFIG_FIMC_IS_BUS_DEVFREQ */ - if (CALL_POPS(core, clk_off, pdev) < 0) warn("clk_off is fail\n"); @@ -421,25 +94,9 @@ int fimc_is_runtime_resume(struct device *dev) pm_stay_awake(dev); pr_info("FIMC_IS runtime resume in\n"); -#if defined(CONFIG_ARGOS) - argos_block_enable("EMMC", true); -#endif - -#if defined(CONFIG_SOC_EXYNOS5422) || defined(CONFIG_SOC_EXYNOS5430) - /* EGL Lock */ - pm_qos_add_request(&max_cpu_qos, PM_QOS_CPU_FREQ_MAX, 1600000); -#elif defined(CONFIG_SOC_EXYNOS5433) - /* EGL Lock */ - pm_qos_add_request(&max_cpu_qos, PM_QOS_CPU_FREQ_MAX, 1700000); -#endif /* CONFIG_SOC_EXYNOS5422 */ - /* HACK: DVFS lock sequence is change. * DVFS level should be locked after power on. */ -#if defined(CONFIG_PM_DEVFREQ) - /* DEVFREQ set */ - fimc_is_set_qos_init(core, true); -#endif /* Low clock setting */ if (CALL_POPS(core, clk_cfg, core->pdev) < 0) { @@ -454,26 +111,7 @@ int fimc_is_runtime_resume(struct device *dev) ret = -EINVAL; goto p_err; } -#if !(defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433)) -#if defined(CONFIG_VIDEOBUF2_ION) - if (core->mem.alloc_ctx) - vb2_ion_attach_iommu(core->mem.alloc_ctx); -#endif -#endif -#if defined(CONFIG_FIMC_IS_BUS_DEVFREQ) - /* BTS */ -#if defined(CONFIG_SOC_EXYNOS5260) - bts_initialize("spd-flite-a", true); - bts_initialize("spd-flite-b", true); -#elif defined(CONFIG_SOC_EXYNOS3470) - bts_initialize("pd-cam", true); -#else - bts_initialize("pd-fimclite", true); -#endif - /* media layer */ - exynos5_update_media_layers(TYPE_FIMC_LITE, true); -#endif /* CONFIG_FIMC_IS_BUS_DEVFREQ */ pr_info("FIMC-IS runtime resume out\n"); @@ -483,4 +121,3 @@ p_err: pm_relax(dev); return ret; } -#endif diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-hw.h b/drivers/media/platform/exynos/fimc-is/fimc-is-hw.h index 8a75671..9d57727 100644 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-hw.h +++ b/drivers/media/platform/exynos/fimc-is/fimc-is-hw.h @@ -60,4 +60,4 @@ int csi_hw_disable(unsigned long __iomem *base_reg); int fimc_is_runtime_suspend_post(struct device *dev); int fimc_is_runtime_suspend(struct device *dev); int fimc_is_runtime_resume(struct device *dev); -#endif \ No newline at end of file +#endif diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-interface.c b/drivers/media/platform/exynos/fimc-is/fimc-is-interface.c index e7ad6a8..7e15382 100644 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-interface.c +++ b/drivers/media/platform/exynos/fimc-is/fimc-is-interface.c @@ -20,7 +20,6 @@ #include "fimc-is-groupmgr.h" #include "fimc-is-interface.h" -#include "fimc-is-clk-gate.h" u32 __iomem *notify_fcount_sen0; u32 __iomem *notify_fcount_sen1; @@ -37,19 +36,6 @@ u32 __iomem *last_fcount1; extern struct fimc_is_sysfs_debug sysfs_debug; -/* func to register error report callback */ -int fimc_is_set_err_report_vendor(struct fimc_is_interface *itf, - void *err_report_data, - int (*err_report_vendor)(void *data, u32 err_report_type)) -{ - if (itf) { - itf->err_report_data = err_report_data; - itf->err_report_vendor = err_report_vendor; - } - - return 0; -} - /* main func to handle error report */ static int fimc_is_err_report_handler(struct fimc_is_interface *itf, struct fimc_is_msg *msg) { @@ -175,32 +161,6 @@ static int set_free_work(struct fimc_is_work_list *this, return ret; } -static int get_free_work(struct fimc_is_work_list *this, - struct fimc_is_work **work) -{ - int ret = 0; - unsigned long flags; - - if (work) { - spin_lock_irqsave(&this->slock_free, flags); - - if (this->work_free_cnt) { - *work = container_of(this->work_free_head.next, - struct fimc_is_work, list); - list_del(&(*work)->list); - this->work_free_cnt--; - } else - *work = NULL; - - spin_unlock_irqrestore(&this->slock_free, flags); - } else { - ret = -EFAULT; - err("item is null ptr"); - } - - return ret; -} - static int get_free_work_irq(struct fimc_is_work_list *this, struct fimc_is_work **work) { @@ -1044,23 +1004,7 @@ static void wq_func_general(struct work_struct *data) break; case HIC_SET_CAM_CONTROL: /* this code will be used latter */ -#if 0 - dbg_interface("camctrl done\n"); - get_req_work(&itf->nblk_cam_ctrl , &nblk_work); - if (nblk_work) { - nblk_work->msg.command = ISR_DONE; - set_free_work(&itf->nblk_cam_ctrl, - nblk_work); - } else { - err("nblk camctrl request is empty"); - print_fre_work_list( - &itf->nblk_cam_ctrl); - print_req_work_list( - &itf->nblk_cam_ctrl); - } -#else err("camctrl is not acceptable\n"); -#endif break; default: err("unknown done is invokded\n"); @@ -2012,12 +1956,6 @@ static void wq_func_shot(struct work_struct *data) merr("group(%d) req flag is not clear all(%X)", device, group->id, (u32)frame->req_flag); -#ifdef ENABLE_CLOCK_GATE - /* dynamic clock off */ - if (sysfs_debug.en_clk_gate && - sysfs_debug.clk_gate_mode == CLOCK_GATE_MODE_HOST) - fimc_is_clk_gate_set(core, group->id, false, false, true); -#endif wq_func_group(groupmgr, group, grp_framemgr, frame, vctx, status1, status2, fcount); } else { @@ -2027,12 +1965,6 @@ static void wq_func_shot(struct work_struct *data) } framemgr_x_barrier_irqr(grp_framemgr, FMGR_IDX_7, flags); -#ifdef ENABLE_CLOCK_GATE - if (fcount == 1 && - sysfs_debug.en_clk_gate && - sysfs_debug.clk_gate_mode == CLOCK_GATE_MODE_HOST) - fimc_is_clk_gate_lock_set(core, instance, false); -#endif remain: set_free_work(work_list, work); get_req_work(work_list, &work); @@ -3177,37 +3109,3 @@ int fimc_is_hw_shot_nblk(struct fimc_is_interface *this, return ret; } - -int fimc_is_hw_s_camctrl_nblk(struct fimc_is_interface *this, - u32 instance, u32 address, u32 fcount) -{ - int ret = 0; - struct fimc_is_work *work; - struct fimc_is_msg *msg; - - dbg_interface("cam_ctrl_nblk(%d)\n", instance); - - get_free_work(&this->nblk_cam_ctrl, &work); - - if (work) { - work->fcount = fcount; - msg = &work->msg; - msg->id = 0; - msg->command = HIC_SET_CAM_CONTROL; - msg->instance = instance; - msg->group = 0; - msg->parameter1 = address; - msg->parameter2 = fcount; - msg->parameter3 = 0; - msg->parameter4 = 0; - - ret = fimc_is_set_cmd_nblk(this, work); - } else { - err("g_free_nblk return NULL"); - print_fre_work_list(&this->nblk_cam_ctrl); - print_req_work_list(&this->nblk_cam_ctrl); - ret = 1; - } - - return ret; -} diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-interface.h b/drivers/media/platform/exynos/fimc-is/fimc-is-interface.h index 4c814dd..e3cc4be 100644 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-interface.h +++ b/drivers/media/platform/exynos/fimc-is/fimc-is-interface.h @@ -219,12 +219,5 @@ int fimc_is_hw_sensor_mode(struct fimc_is_interface *this, int fimc_is_hw_shot_nblk(struct fimc_is_interface *this, u32 instance, u32 group, u32 bayer, u32 shot, u32 fcount, u32 rcount); -int fimc_is_hw_s_camctrl_nblk(struct fimc_is_interface *this, - u32 instance, u32 address, u32 fcount); - -/* func to register error report callback */ -int fimc_is_set_err_report_vendor(struct fimc_is_interface *itf, - void *err_report_data, - int (*err_report_vendor)(void *data, u32 err_report_type)); #endif diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-ncp6335b.c b/drivers/media/platform/exynos/fimc-is/fimc-is-ncp6335b.c deleted file mode 100644 index 015ba00..0000000 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-ncp6335b.c +++ /dev/null @@ -1,112 +0,0 @@ -#include -#include -#include -#include - -#include "fimc-is-ncp6335b.h" - -/** - * NCP6335B Vout Tables - */ -static const struct ncp6335b_vout vout_tables[] = { - {0, NCP6335B_VOUT_1P000, "1.000"}, /* defualt voltage */ - {1, NCP6335B_VOUT_0P875, "0.875"}, - {2, NCP6335B_VOUT_0P900, "0.900"}, - {3, NCP6335B_VOUT_0P925, "0.925"}, - {4, NCP6335B_VOUT_0P950, "0.950"}, - {5, NCP6335B_VOUT_0P975, "0.975"}, - {6, NCP6335B_VOUT_1P000, "1.000"}, -}; - -/** - * ncp6335b_get_vout_val: get i2c register value to set vout of dcdc regulator. - */ -int ncp6335b_get_vout_val(int sel) -{ - int i, vout = vout_tables[0].val; - - if (sel < 0) - pr_err("%s: error, invalid sel %d\n", __func__, sel); - - for (i = 0; ARRAY_SIZE(vout_tables); i++) { - if (vout_tables[i].sel == sel) { - return vout_tables[i].val; - } - } - - pr_err("%s: warning, default voltage selected. sel %d\n", __func__, sel); - - return vout; -} - -/** - * ncp6335b_get_vout_name: get voltage name of vout as string. - */ -const char *ncp6335b_get_vout_str(int sel) -{ - const char *vout = vout_tables[0].vout; - int i; - - if (sel < 0) - pr_err("%s: error, invalid sel %d\n", __func__, sel); - - for (i = 0; ARRAY_SIZE(vout_tables); i++) { - if (vout_tables[i].sel == sel) { - return vout_tables[i].vout; - } - } - - pr_err("%s: warning, default voltage selected. sel %d\n", __func__, sel); - - return vout; -} - -/** - * ncp6335b_set_voltage: set dcdc vout with i2c register value. - */ -int ncp6335b_set_voltage(struct i2c_client *client, int vout) -{ - int ret = i2c_smbus_write_byte_data(client, 0x14, 0x00); - if (ret < 0) - pr_err("[%s::%d] Write Error [%d]\n", __func__, __LINE__, ret); - - ret = i2c_smbus_write_byte_data(client, 0x10, vout); /* 1.05V -> 1V (0xC0) */ - if (ret < 0) - pr_err("[%s::%d] Write Error [%d]. vout 0x%X\n", __func__, __LINE__, ret, vout); - - ret = i2c_smbus_write_byte_data(client, 0x11, vout); /* 1.05V -> 1V (0xC0) */ - if (ret < 0) - pr_err("[%s::%d] Write Error [%d]. vout 0x%X\n", __func__, __LINE__, ret, vout); - - /*pr_info("%s: vout 0x%X\n", __func__, vout);*/ - - return ret; -} - -int ncp6335b_read_voltage(struct i2c_client *client) -{ - int ret; - - ret = i2c_smbus_read_byte_data(client, 0x3); - if (ret < 0) - pr_err("[%s::%d]Read Error [%d]\n", __func__, __LINE__, ret); - pr_err("[%s::%d]NCP6335B PID[%x]\n", __func__, __LINE__, ret); - - ret = i2c_smbus_read_byte_data(client, 0x10); - if (ret < 0) - pr_err("[%s::%d]Read Error [%d]\n", __func__, __LINE__, ret); - pr_err("[%s::%d]NCP6335B [0x10 Read :: %x]\n", __func__, __LINE__, ret); - - ret = i2c_smbus_read_byte_data(client, 0x11); - if (ret < 0) - pr_err("[%s::%d]Read Error [%d]\n", __func__, __LINE__, ret); - pr_err("[%s::%d]NCP6335B [0x11 Read :: %x]\n", __func__, __LINE__, ret); - - ret = i2c_smbus_read_byte_data(client, 0x14); - if (ret < 0) - pr_err("[%s::%d]Read Error [%d]\n", __func__, __LINE__, ret); - pr_err("[%s::%d]NCP6335B [0x14 Read :: %x]\n", __func__, __LINE__, ret); - - return ret; -} - diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-ncp6335b.h b/drivers/media/platform/exynos/fimc-is/fimc-is-ncp6335b.h deleted file mode 100644 index eeab7d6..0000000 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-ncp6335b.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Samsung Exynos5 SoC series FIMC-IS driver - * - * exynos5 fimc-is core functions - * - * Copyright (c) 2011 Samsung Electronics Co., Ltd - * - * 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 -#include -#include "fimc-is-core.h" - -enum{ - NCP6335B_VOUT_0P875 = 0xAC, - NCP6335B_VOUT_0P900 = 0xB0, - NCP6335B_VOUT_0P925 = 0xB4, - NCP6335B_VOUT_0P950 = 0xB8, - NCP6335B_VOUT_0P975 = 0xBC, - NCP6335B_VOUT_1P000 = 0xC0, -}; - -struct ncp6335b_vout { - int sel; /* selector, unique value for vout entry and indepedant to dcdc vendor */ - int val; /* dcdc-specific value for vout register */ - char vout[7]; /* voltage level string */ -}; - -int ncp6335b_get_vout_val(int sel); -const char *ncp6335b_get_vout_str(int sel); -int ncp6335b_set_voltage(struct i2c_client *client, int vout); -int ncp6335b_read_voltage(struct i2c_client *client); - diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-param.h b/drivers/media/platform/exynos/fimc-is/fimc-is-param.h index 2ccf086..541fec2 100644 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-param.h +++ b/drivers/media/platform/exynos/fimc-is/fimc-is-param.h @@ -1348,12 +1348,10 @@ struct is_face_marker { u32 blink_level; }; -#if defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) || defined(CONFIG_SOC_EXYNOS5422) || defined(CONFIG_SOC_EXYNOS4415) struct is_debug_region { u32 frame_count; u32 reserved[PARAMETER_MAX_MEMBER-1]; }; -#endif #define MAX_FRAME_COUNT 8 #define MAX_FRAME_COUNT_PREVIEW 4 @@ -1367,9 +1365,7 @@ struct is_region { struct is_tune_region tune; struct is_frame_header header[MAX_FRAME_COUNT]; struct is_face_marker face[MAX_FACE_COUNT]; -#if defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) || defined(CONFIG_SOC_EXYNOS5422) || defined(CONFIG_SOC_EXYNOS4415) struct is_debug_region debug; -#endif u32 shared[MAX_SHARED_COUNT]; }; diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-regs.h b/drivers/media/platform/exynos/fimc-is/fimc-is-regs.h index c15485a..90888c6 100644 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-regs.h +++ b/drivers/media/platform/exynos/fimc-is/fimc-is-regs.h @@ -340,39 +340,6 @@ #define ISSR63 (MCUCTL+0x17c) /* PMU for FIMC-IS*/ -#if defined(CONFIG_SOC_EXYNOS4415) -#define PMUREG_CMU_RESET_ISP0_SYS_PWR (S5P_VA_PMU + 0x1594) -#define PMUREG_ISP0_CONFIGURATION (S5P_VA_PMU + 0x40A0) -#define PMUREG_ISP0_STATUS (S5P_VA_PMU + 0x40A4) -#define PMUREG_ISP0_OPTION (S5P_VA_PMU + 0x40A8) - -#define PMUREG_CMU_RESET_ISP1_SYS_PWR (S5P_VA_PMU + 0x159C) -#define PMUREG_ISP1_CONFIGURATION (S5P_VA_PMU + 0x40E0) -#define PMUREG_ISP1_STATUS (S5P_VA_PMU + 0x40E4) -#define PMUREG_ISP1_OPTION (S5P_VA_PMU + 0x40E8) - -#define PMUREG_CENTRAL_SEQ_OPTION (S5P_VA_PMU + 0x0208) -#define PMUREG_ISP_ARM_SYS_PWR_REG (S5P_VA_PMU + 0x1050) -#define PMUREG_ISP_ARM_CONFIGURATION (S5P_VA_PMU + 0x2280) -#define PMUREG_ISP_ARM_STATUS (S5P_VA_PMU + 0x2284) -#define PMUREG_ISP_ARM_OPTION (S5P_VA_PMU + 0x2288) - -#define PMUREG_ISP_LOW_POWER_OFF (S5P_VA_PMU + 0x0004) - -#define PMUREG_ISP0_STATUS (S5P_VA_PMU + 0x40A4) -#define PMUREG_ISP1_STATUS (S5P_VA_PMU + 0x40E4) - -#define MIPICSI0_REG_BASE (S5P_VA_MIPICSI0) /* phy : 0x120C_0000 */ -#define MIPICSI1_REG_BASE (S5P_VA_MIPICSI1) /* phy : 0x120D_0000 */ -#define MIPICSI2_REG_BASE 0 - -#define FIMCLITE0_REG_BASE (S5P_VA_FIMCLITE0) /* phy : 0x120A0000 */ -#define FIMCLITE1_REG_BASE (S5P_VA_FIMCLITE1) /* phy : 0x120B0000 */ -#define FIMCLITE2_REG_BASE (S5P_VA_FIMCLITE2) /* phy : 0x122A0000 */ - -#define PA_FIMC_IS_GIC_C (0x121E0000) -#define PA_FIMC_IS_GIC_D (0x121F0000) -#else #define MIPICSI0_REG_BASE (S5P_VA_MIPICSI0) #define MIPICSI1_REG_BASE (S5P_VA_MIPICSI1) #define MIPICSI2_REG_BASE (S5P_VA_MIPICSI2) @@ -381,55 +348,22 @@ #define FIMCLITE1_REG_BASE (S5P_VA_FIMCLITE1) #define FIMCLITE2_REG_BASE (S5P_VA_FIMCLITE2) -#if defined(CONFIG_SOC_EXYNOS3470) -#define PMUREG_ISP_ARM_CONFIGURATION (S5P_VA_PMU + 0x2280) -#define PMUREG_ISP_ARM_STATUS (S5P_VA_PMU + 0x2284) -#define PMUREG_ISP_ARM_OPTION (S5P_VA_PMU + 0x2288) -#define PMUREG_ISP_LOW_POWER_OFF (S5P_VA_PMU + 0x0004) -#define PMUREG_ISP_CONFIGURATION (S5P_VA_PMU + 0x3CA0) -#define PMUREG_ISP_STATUS (S5P_VA_PMU + 0x3CA4) -#define PMUREG_ISP_ARM_SYS_PWR_REG (S5P_VA_PMU + 0x1050) -#elif defined(CONFIG_SOC_EXYNOS5422) -#define PMUREG_ISP_ARM_CONFIGURATION (S5P_VA_PMU + 0x2480) -#define PMUREG_ISP_ARM_STATUS (S5P_VA_PMU + 0x2484) -#define PMUREG_ISP_ARM_OPTION (S5P_VA_PMU + 0x2488) -#define PMUREG_ISP_LOW_POWER_OFF (S5P_VA_PMU + 0x0004) -#define PMUREG_ISP_CONFIGURATION (S5P_VA_PMU + 0x4020) -#define PMUREG_ISP_STATUS (S5P_VA_PMU + 0x4024) -#define PMUREG_CMU_RESET_ISP_SYS_PWR_REG (S5P_VA_PMU + 0x1584) -#define PMUREG_CMU_SYSCLK_ISP_SYS_PWR_REG (S5P_VA_PMU + 0x14C4) -#define PMUREG_ISP_ARM_SYS_PWR_REG (S5P_VA_PMU + 0x1090) -#define PMUREG_CAM_CONFIGURATION (S5P_VA_PMU + 0x5100) -#define PMUREG_CAM_STATUS (S5P_VA_PMU + 0x5104) -#else #define PMUREG_ISP_ARM_CONFIGURATION (S5P_VA_PMU + 0x2580) #define PMUREG_ISP_ARM_STATUS (S5P_VA_PMU + 0x2584) #define PMUREG_ISP_ARM_OPTION (S5P_VA_PMU + 0x2588) #define PMUREG_ISP_LOW_POWER_OFF (S5P_VA_PMU + 0x0004) #define PMUREG_ISP_CONFIGURATION (S5P_VA_PMU + 0x4140) #define PMUREG_ISP_STATUS (S5P_VA_PMU + 0x4144) -#endif -#if defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) #define PMUREG_CAM0_STATUS (S5P_VA_PMU + 0x4024) #define PMUREG_CAM1_STATUS (S5P_VA_PMU + 0x40A4) -#endif #define SYSREG_GSCBLK_CFG1 (S3C_VA_SYS + 0x0224) #define SYSREG_ISPBLK_CFG (S3C_VA_SYS + 0x022C) /* GIC for FIMC-IS*/ -#if defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) #define PA_FIMC_IS_GIC_C (0x141E0000) #define PA_FIMC_IS_GIC_D (0x141F0000) -#elif defined(CONFIG_SOC_EXYNOS3470) -#define PA_FIMC_IS_GIC_C (0x121E0000) -#define PA_FIMC_IS_GIC_D (0x121F0000) -#else -#define PA_FIMC_IS_GIC_C (0x131E0000) -#define PA_FIMC_IS_GIC_D (0x131F0000) -#endif -#endif /* PWM for FIMC-IS*/ #define FIMC_IS_PWM_TCNTB0 (0xC) diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-resourcemgr.c b/drivers/media/platform/exynos/fimc-is/fimc-is-resourcemgr.c index ad2518f..a5f58f2 100644 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-resourcemgr.c +++ b/drivers/media/platform/exynos/fimc-is/fimc-is-resourcemgr.c @@ -21,20 +21,8 @@ #include "fimc-is-resourcemgr.h" #include "fimc-is-core.h" -#include "fimc-is-dvfs.h" -#include "fimc-is-clk-gate.h" #include "fimc-is-hw.h" -struct pm_qos_request exynos_isp_qos_cpu_min; -struct pm_qos_request exynos_isp_qos_cpu_max; -struct pm_qos_request exynos_isp_qos_int; -struct pm_qos_request exynos_isp_qos_mem; -struct pm_qos_request exynos_isp_qos_cam; -struct pm_qos_request exynos_isp_qos_disp; -#if defined(CONFIG_SOC_EXYNOS5422) || defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) -struct pm_qos_request max_cpu_qos; -#endif - extern struct fimc_is_sysfs_debug sysfs_debug; int fimc_is_resource_probe(struct fimc_is_resourcemgr *resourcemgr, @@ -52,12 +40,6 @@ int fimc_is_resource_probe(struct fimc_is_resourcemgr *resourcemgr, atomic_set(&resourcemgr->resource_sensor1.rsccount, 0); atomic_set(&resourcemgr->resource_ischain.rsccount, 0); -#ifdef ENABLE_DVFS - /* dvfs controller init */ - ret = fimc_is_dvfs_init(resourcemgr); - if (ret) - err("%s: fimc_is_dvfs_init failed!\n", __func__); -#endif info("%s\n", __func__); return ret; @@ -85,14 +67,6 @@ int fimc_is_resource_get(struct fimc_is_resourcemgr *resourcemgr, u32 rsc_type) } if (rsccount == 0) { -#ifdef ENABLE_DVFS - /* dvfs controller init */ - ret = fimc_is_dvfs_init(resourcemgr); - if (ret) { - err("%s: fimc_is_dvfs_init failed!\n", __func__); - goto p_err; - } -#endif } if (atomic_read(&resource->rsccount) == 0) { @@ -119,11 +93,6 @@ int fimc_is_resource_get(struct fimc_is_resourcemgr *resourcemgr, u32 rsc_type) /* W/A for a lower version MCUCTL */ fimc_is_interface_reset(&core->interface); -#ifdef ENABLE_CLOCK_GATE - if (sysfs_debug.en_clk_gate && - sysfs_debug.clk_gate_mode == CLOCK_GATE_MODE_HOST) - fimc_is_clk_gate_init(core); -#endif break; default: err("[RSC] resource type(%d) is invalid", rsc_type); diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-resourcemgr.h b/drivers/media/platform/exynos/fimc-is/fimc-is-resourcemgr.h index 51c9e98..7dbf63f 100644 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-resourcemgr.h +++ b/drivers/media/platform/exynos/fimc-is/fimc-is-resourcemgr.h @@ -20,26 +20,11 @@ #define RESOURCE_TYPE_ISCHAIN 2 #define RESOURCE_TYPE_MAX 3 -struct fimc_is_dvfs_ctrl { - struct mutex lock; - int cur_cpu_min_qos; - int cur_cpu_max_qos; - int cur_int_qos; - int cur_mif_qos; - int cur_cam_qos; - int cur_i2c_qos; - int cur_disp_qos; - - struct fimc_is_dvfs_scenario_ctrl *static_ctrl; - struct fimc_is_dvfs_scenario_ctrl *dynamic_ctrl; -}; - struct fimc_is_clk_gate_ctrl { spinlock_t lock; unsigned long msk_state; int msk_cnt[GROUP_ID_MAX]; u32 msk_lock_by_ischain[FIMC_IS_MAX_NODES]; - struct exynos_fimc_is_clk_gate_info *gate_info; u32 msk_clk_on_off_state; /* on/off(1/0) state per ip */ /* * For check that there's too long clock-on period. @@ -63,7 +48,6 @@ struct fimc_is_resourcemgr { struct fimc_is_resource resource_sensor1; struct fimc_is_resource resource_ischain; - struct fimc_is_dvfs_ctrl dvfs_ctrl; struct fimc_is_clk_gate_ctrl clk_gate_ctrl; void *private_data; diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-sec-define.c b/drivers/media/platform/exynos/fimc-is/fimc-is-sec-define.c index 4e52cf0..b50bb2e 100644 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-sec-define.c +++ b/drivers/media/platform/exynos/fimc-is/fimc-is-sec-define.c @@ -1,9 +1,6 @@ #include "fimc-is-sec-define.h" #include -#if defined(CONFIG_CAMERA_EEPROM_SUPPORT_REAR) || defined(CONFIG_CAMERA_EEPROM_SUPPORT_FRONT) -#include -#endif bool crc32_fw_check = true; bool crc32_check = true; @@ -15,22 +12,14 @@ bool crc32_check_factory_front = true; bool fw_version_crc_check = true; bool is_latest_cam_module = false; bool is_final_cam_module = false; -#if defined(CONFIG_SOC_EXYNOS5433) bool is_right_prj_name = true; -#endif -#ifdef CONFIG_COMPANION_USE bool crc32_c1_fw_check = true; bool crc32_c1_check = true; bool crc32_c1_check_factory = true; bool companion_lsc_isvalid = false; bool companion_coef_isvalid = false; -#endif u8 cal_map_version[4] = {0,}; -#if defined(CONFIG_CAMERA_EEPROM_SUPPORT_REAR) -#define FIMC_IS_MAX_CAL_SIZE (8 * 1024) -#else #define FIMC_IS_MAX_CAL_SIZE (64 * 1024) -#endif #define FIMC_IS_MAX_CAL_SIZE_FRONT (8 * 1024) #define FIMC_IS_DEFAULT_CAL_SIZE (20 * 1024) @@ -53,11 +42,6 @@ char fw_core_version; //struct device *camera_rear_dev; /*sys/class/camera/rear*/ static struct fimc_is_from_info sysfs_finfo; static struct fimc_is_from_info sysfs_pinfo; -#if defined(CONFIG_CAMERA_EEPROM_SUPPORT_FRONT) -static struct fimc_is_from_info sysfs_finfo_front; -static struct fimc_is_from_info sysfs_pinfo_front; -static char cal_buf_front[FIMC_IS_MAX_CAL_SIZE_FRONT]; -#endif static char cal_buf[FIMC_IS_MAX_CAL_SIZE]; char loaded_fw[12] = {0, }; @@ -83,25 +67,6 @@ int fimc_is_sec_get_sysfs_pinfo(struct fimc_is_from_info **pinfo) return 0; } -#if defined(CONFIG_CAMERA_EEPROM_SUPPORT_FRONT) -int fimc_is_sec_get_sysfs_finfo_front(struct fimc_is_from_info **finfo) -{ - *finfo = &sysfs_finfo_front; - return 0; -} - -int fimc_is_sec_get_sysfs_pinfo_front(struct fimc_is_from_info **pinfo) -{ - *pinfo = &sysfs_pinfo_front; - return 0; -} - -int fimc_is_sec_get_front_cal_buf(char **buf) -{ - *buf = &cal_buf_front[0]; - return 0; -} -#endif int fimc_is_sec_get_cal_buf(char **buf) { @@ -121,67 +86,6 @@ int fimc_is_sec_get_loaded_c1_fw(char **buf) return 0; } -int fimc_is_sec_set_camid(int id) -{ - cam_id = id; - return 0; -} - -int fimc_is_sec_get_camid(void) -{ - return cam_id; -} - -int fimc_is_sec_get_camid_from_hal(char *fw_name, char *setf_name) -{ -#if 0 - char buf[1]; - loff_t pos = 0; - int pixelSize; - - read_data_from_file("/data/CameraID.txt", buf, 1, &pos); - if (buf[0] == '0') - cam_id = CAMERA_SINGLE_REAR; - else if (buf[0] == '1') - cam_id = CAMERA_SINGLE_FRONT; - else if (buf[0] == '2') - cam_id = CAMERA_DUAL_REAR; - else if (buf[0] == '3') - cam_id = CAMERA_DUAL_FRONT; - - if (fimc_is_sec_fw_module_compare(sysfs_finfo.header_ver, FW_3L2)) { - snprintf(fw_name, sizeof(FIMC_IS_FW_3L2), "%s", FIMC_IS_FW_3L2); - snprintf(setf_name, sizeof(FIMC_IS_3L2_SETF), "%s", FIMC_IS_3L2_SETF); - } else if (fimc_is_sec_fw_module_compare(sysfs_finfo.header_ver, FW_IMX135)) { - snprintf(fw_name, sizeof(FIMC_IS_FW), "%s", FIMC_IS_FW); - snprintf(setf_name, sizeof(FIMC_IS_IMX135_SETF), "%s", FIMC_IS_IMX135_SETF); - } else if (fimc_is_sec_fw_module_compare(sysfs_finfo.header_ver, FW_IMX134)) { - snprintf(fw_name, sizeof(FIMC_IS_FW_IMX134), "%s", FIMC_IS_FW_IMX134); - snprintf(setf_name, sizeof(FIMC_IS_IMX134_SETF), "%s", FIMC_IS_IMX134_SETF); - } else { - pixelSize = fimc_is_sec_get_pixel_size(sysfs_finfo.header_ver); - if (pixelSize == 13) { - snprintf(fw_name, sizeof(FIMC_IS_FW), "%s", FIMC_IS_FW); - snprintf(setf_name, sizeof(FIMC_IS_IMX135_SETF), "%s", FIMC_IS_IMX135_SETF); - } else if (pixelSize == 8) { - snprintf(fw_name, sizeof(FIMC_IS_FW_IMX134), "%s", FIMC_IS_FW_IMX134); - snprintf(setf_name, sizeof(FIMC_IS_IMX134_SETF), "%s", FIMC_IS_IMX134_SETF); - } else { - snprintf(fw_name, sizeof(FIMC_IS_FW), "%s", FIMC_IS_FW); - snprintf(setf_name, sizeof(FIMC_IS_IMX135_SETF), "%s", FIMC_IS_IMX135_SETF); - } - } - - if (cam_id == CAMERA_SINGLE_FRONT || - cam_id == CAMERA_DUAL_FRONT) { - snprintf(setf_name, sizeof(FIMC_IS_6B2_SETF), "%s", FIMC_IS_6B2_SETF); - } -#else - pr_err("%s: waring, you're calling the disabled func!\n\n", __func__); -#endif - return 0; -} - int fimc_is_sec_fw_revision(char *fw_ver) { int revision = 0; @@ -222,26 +126,14 @@ bool fimc_is_sec_check_cal_crc32(char *buf, int id) crc32_temp = true; -#ifdef CONFIG_COMPANION_USE crc32_c1_check = true; -#endif /* Header data */ check_base = 0; checksum = 0; -#if defined(CONFIG_CAMERA_EEPROM_SUPPORT_FRONT) - if (id == SENSOR_POSITION_FRONT) { - finfo = &sysfs_finfo_front; - checksum_base = ((check_base & 0xffffff00) + 0xfc) / 4; - } else -#endif { finfo = &sysfs_finfo; -#if defined(CONFIG_CAMERA_EEPROM_SUPPORT_REAR) - checksum_base = ((check_base & 0xffffff00) + 0xfc) / 4; -#else checksum_base = ((check_base & 0xfffff000) + 0xffc) / 4; -#endif } checksum = getCRC((u16 *)&buf32[check_base], HEADER_CRC32_LEN, NULL, NULL); @@ -261,17 +153,8 @@ bool fimc_is_sec_check_cal_crc32(char *buf, int id) checksum = 0; check_length = (finfo->oem_end_addr - finfo->oem_start_addr + 1) / 2; -#if defined(CONFIG_CAMERA_EEPROM_SUPPORT_FRONT) - if (id == SENSOR_POSITION_FRONT) { - checksum_base = ((finfo->oem_end_addr & 0xffffff00) + 0xfc) / 4; - } else -#endif { -#if defined(CONFIG_CAMERA_EEPROM_SUPPORT_REAR) - checksum_base = ((finfo->oem_end_addr & 0xffffff00) + 0xfc) / 4; -#else checksum_base = ((finfo->oem_end_addr & 0xfffff000) + 0xffc) / 4; -#endif } checksum = getCRC((u16 *)&buf32[check_base], @@ -289,17 +172,8 @@ bool fimc_is_sec_check_cal_crc32(char *buf, int id) checksum = 0; check_length = (finfo->awb_end_addr - finfo->awb_start_addr + 1) / 2; -#if defined(CONFIG_CAMERA_EEPROM_SUPPORT_FRONT) - if (id == SENSOR_POSITION_FRONT) { - checksum_base = ((finfo->awb_end_addr & 0xffffff00) + 0xfc) / 4; - } else -#endif { -#if defined(CONFIG_CAMERA_EEPROM_SUPPORT_REAR) - checksum_base = ((finfo->awb_end_addr & 0xffffff00) + 0xfc) / 4; -#else checksum_base = ((finfo->awb_end_addr & 0xfffff000) + 0xffc) / 4; -#endif } checksum = getCRC((u16 *)&buf32[check_base], @@ -317,17 +191,8 @@ bool fimc_is_sec_check_cal_crc32(char *buf, int id) checksum = 0; check_length = (finfo->shading_end_addr - finfo->shading_start_addr + 1) / 2; -#if defined(CONFIG_CAMERA_EEPROM_SUPPORT_FRONT) - if (id == SENSOR_POSITION_FRONT) { - checksum_base = 0x1ffc / 4; - } else -#endif { -#if defined(CONFIG_CAMERA_EEPROM_SUPPORT_REAR) - checksum_base = 0x1ffc / 4; -#else checksum_base = ((finfo->shading_end_addr & 0xfffff000) + 0xffc) / 4; -#endif } checksum = getCRC((u16 *)&buf32[check_base], @@ -340,7 +205,6 @@ bool fimc_is_sec_check_cal_crc32(char *buf, int id) err("Camera: Shading checksum address has error(0x%08X)", checksum_base * 4); } -#ifdef CONFIG_COMPANION_USE /* pdaf cal */ check_base = finfo->pdaf_cal_start_addr / 4; checksum = 0; @@ -372,78 +236,13 @@ bool fimc_is_sec_check_cal_crc32(char *buf, int id) } else if (checksum_base > 0x80000 || checksum_base < 0) { err("Camera: concord cal checksum address has error(0x%08X)", checksum_base * 4); } -#endif - -#if defined(CONFIG_CAMERA_EEPROM_SUPPORT_FRONT) - if (id == SENSOR_POSITION_FRONT) { - crc32_check_front = crc32_temp; - crc32_header_check_front = crc32_header_temp; - return crc32_check_front; - } else -#endif + { crc32_check = crc32_temp; crc32_header_check = crc32_header_temp; -#ifdef CONFIG_COMPANION_USE return crc32_check && crc32_c1_check; -#else - return crc32_check; -#endif - } -} - -bool fimc_is_sec_check_fw_crc32(char *buf) -{ - u32 *buf32 = NULL; - u32 checksum; - - buf32 = (u32 *)buf; - - pr_info("Camera: Start checking CRC32 FW\n\n"); - - crc32_fw_check = true; - - checksum = 0; - - checksum = getCRC((u16 *)&buf32[0], - (sysfs_finfo.setfile_end_addr - sysfs_finfo.bin_start_addr + 1)/2, NULL, NULL); - if (checksum != buf32[(0x3FFFFC - 0x80000)/4]) { - err("Camera: CRC32 error at the binary section (0x%08X != 0x%08X)", - checksum, buf32[(0x3FFFFC - 0x80000)/4]); - crc32_fw_check = false; - } - - pr_info("Camera: End checking CRC32 FW\n\n"); - - return crc32_fw_check; -} - -#ifdef CONFIG_COMPANION_USE -bool fimc_is_sec_check_companion_fw_crc32(char *buf) -{ - u32 *buf32 = NULL; - u32 checksum; - - buf32 = (u32 *)buf; - - pr_info("Camera: Start checking CRC32 Companion FW\n\n"); - - crc32_c1_fw_check = true; - - checksum = 0; - - checksum = getCRC((u16 *)&buf32[0], (sysfs_finfo.concord_mode_setfile_end_addr - sysfs_finfo.concord_bin_start_addr + 1)/2, NULL, NULL); - if (checksum != buf32[(0x6AFFC - 0x2B000)/4]) { - err("Camera: CRC32 error at the binary section (0x%08X != 0x%08X)", - checksum, buf32[(0x6AFFC - 0x2B000)/4]); - crc32_c1_fw_check = false; } - - pr_info("Camera: End checking CRC32 Companion FW\n\n"); - - return crc32_c1_fw_check; } -#endif ssize_t write_data_to_file(char *name, char *buf, size_t count, loff_t *pos) { @@ -510,538 +309,7 @@ ssize_t read_data_from_file(char *name, char *buf, size_t count, loff_t *pos) return count; } -void fimc_is_sec_make_crc32_table(u32 *table, u32 id) -{ - u32 i, j, k; - - for (i = 0; i < 256; ++i) { - k = i; - for (j = 0; j < 8; ++j) { - if (k & 1) - k = (k >> 1) ^ id; - else - k >>= 1; - } - table[i] = k; - } -} - -#if 0 /* unused */ -static void fimc_is_read_sensor_version(void) -{ - int ret; - char buf[0x50]; - - memset(buf, 0x0, 0x50); - - printk(KERN_INFO "+++ %s\n", __func__); - - ret = fimc_is_spi_read(buf, 0x0, 0x50); - - printk(KERN_INFO "--- %s\n", __func__); - - if (ret) { - err("fimc_is_spi_read - can't read sensor version\n"); - } - - err("Manufacturer ID(0x40): 0x%02x\n", buf[0x40]); - err("Pixel Number(0x41): 0x%02x\n", buf[0x41]); -} - -static void fimc_is_read_sensor_version2(void) -{ - char *buf; - char *cal_data; - u32 cur; - u32 count = SETFILE_SIZE/READ_SIZE; - u32 extra = SETFILE_SIZE%READ_SIZE; - - printk(KERN_ERR "%s\n\n\n\n", __func__); - - - buf = (char *)kmalloc(READ_SIZE, GFP_KERNEL); - cal_data = (char *)kmalloc(SETFILE_SIZE, GFP_KERNEL); - - memset(buf, 0x0, READ_SIZE); - memset(cal_data, 0x0, SETFILE_SIZE); - - - for (cur = 0; cur < SETFILE_SIZE; cur += READ_SIZE) { - fimc_is_spi_read(buf, cur, READ_SIZE); - memcpy(cal_data+cur, buf, READ_SIZE); - memset(buf, 0x0, READ_SIZE); - } - - if (extra != 0) { - fimc_is_spi_read(buf, cur, extra); - memcpy(cal_data+cur, buf, extra); - memset(buf, 0x0, extra); - } - - pr_info("Manufacturer ID(0x40): 0x%02x\n", cal_data[0x40]); - pr_info("Pixel Number(0x41): 0x%02x\n", cal_data[0x41]); - - - pr_info("Manufacturer ID(0x4FE7): 0x%02x\n", cal_data[0x4FE7]); - pr_info("Pixel Number(0x4FE8): 0x%02x\n", cal_data[0x4FE8]); - pr_info("Manufacturer ID(0x4FE9): 0x%02x\n", cal_data[0x4FE9]); - pr_info("Pixel Number(0x4FEA): 0x%02x\n", cal_data[0x4FEA]); - - kfree(buf); - kfree(cal_data); - -} - -static int fimc_is_get_cal_data(void) -{ - int err = 0; - struct file *fp = NULL; - mm_segment_t old_fs; - long ret = 0; - u8 mem0 = 0, mem1 = 0; - u32 CRC = 0; - u32 DataCRC = 0; - u32 IntOriginalCRC = 0; - u32 crc_index = 0; - int retryCnt = 2; - u32 header_crc32 = 0x1000; - u32 oem_crc32 = 0x2000; - u32 awb_crc32 = 0x3000; - u32 shading_crc32 = 0x6000; - u32 shading_header = 0x22C0; - - char *cal_data; - - crc32_check = true; - printk(KERN_INFO "%s\n\n\n\n", __func__); - printk(KERN_INFO "+++ %s\n", __func__); - - fimc_is_spi_read(cal_map_version, 0x60, 0x4); - printk(KERN_INFO "cal_map_version = %.4s\n", cal_map_version); - - if (cal_map_version[3] == '5') { - shading_crc32 = 0x6000; - shading_header = 0x22C0; - } else if (cal_map_version[3] == '6') { - shading_crc32 = 0x4000; - shading_header = 0x920; - } else { - shading_crc32 = 0x5000; - shading_header = 0x22C0; - } - - /* Make CRC Table */ - fimc_is_sec_make_crc32_table((u32 *)&crc_table, 0xEDB88320); - - - retry: - cal_data = (char *)kmalloc(SETFILE_SIZE, GFP_KERNEL); - - memset(cal_data, 0x0, SETFILE_SIZE); - - mem0 = 0, mem1 = 0; - CRC = 0; - DataCRC = 0; - IntOriginalCRC = 0; - crc_index = 0; - - fimc_is_spi_read(cal_data, 0, SETFILE_SIZE); - - CRC = ~CRC; - for (crc_index = 0; crc_index < (0x80)/2; crc_index++) { - /*low byte*/ - mem0 = (unsigned char)(cal_data[crc_index*2] & 0x00ff); - /*high byte*/ - mem1 = (unsigned char)((cal_data[crc_index*2+1]) & 0x00ff); - CRC = crc_table[(CRC ^ (mem0)) & 0xFF] ^ (CRC >> 8); - CRC = crc_table[(CRC ^ (mem1)) & 0xFF] ^ (CRC >> 8); - } - CRC = ~CRC; - - - DataCRC = (CRC&0x000000ff)<<24; - DataCRC += (CRC&0x0000ff00)<<8; - DataCRC += (CRC&0x00ff0000)>>8; - DataCRC += (CRC&0xff000000)>>24; - printk(KERN_INFO "made HEADER CSC value by S/W = 0x%x\n", DataCRC); - - IntOriginalCRC = (cal_data[header_crc32-4]&0x00ff)<<24; - IntOriginalCRC += (cal_data[header_crc32-3]&0x00ff)<<16; - IntOriginalCRC += (cal_data[header_crc32-2]&0x00ff)<<8; - IntOriginalCRC += (cal_data[header_crc32-1]&0x00ff); - printk(KERN_INFO "Original HEADER CRC Int = 0x%x\n", IntOriginalCRC); - - if (IntOriginalCRC != DataCRC) - crc32_check = false; - - CRC = 0; - CRC = ~CRC; - for (crc_index = 0; crc_index < (0xC0)/2; crc_index++) { - /*low byte*/ - mem0 = (unsigned char)(cal_data[0x1000 + crc_index*2] & 0x00ff); - /*high byte*/ - mem1 = (unsigned char)((cal_data[0x1000 + crc_index*2+1]) & 0x00ff); - CRC = crc_table[(CRC ^ (mem0)) & 0xFF] ^ (CRC >> 8); - CRC = crc_table[(CRC ^ (mem1)) & 0xFF] ^ (CRC >> 8); - } - CRC = ~CRC; - - - DataCRC = (CRC&0x000000ff)<<24; - DataCRC += (CRC&0x0000ff00)<<8; - DataCRC += (CRC&0x00ff0000)>>8; - DataCRC += (CRC&0xff000000)>>24; - printk(KERN_INFO "made OEM CSC value by S/W = 0x%x\n", DataCRC); - - IntOriginalCRC = (cal_data[oem_crc32-4]&0x00ff)<<24; - IntOriginalCRC += (cal_data[oem_crc32-3]&0x00ff)<<16; - IntOriginalCRC += (cal_data[oem_crc32-2]&0x00ff)<<8; - IntOriginalCRC += (cal_data[oem_crc32-1]&0x00ff); - printk(KERN_INFO "Original OEM CRC Int = 0x%x\n", IntOriginalCRC); - - if (IntOriginalCRC != DataCRC) - crc32_check = false; - - - CRC = 0; - CRC = ~CRC; - for (crc_index = 0; crc_index < (0x20)/2; crc_index++) { - /*low byte*/ - mem0 = (unsigned char)(cal_data[0x2000 + crc_index*2] & 0x00ff); - /*high byte*/ - mem1 = (unsigned char)((cal_data[0x2000 + crc_index*2+1]) & 0x00ff); - CRC = crc_table[(CRC ^ (mem0)) & 0xFF] ^ (CRC >> 8); - CRC = crc_table[(CRC ^ (mem1)) & 0xFF] ^ (CRC >> 8); - } - CRC = ~CRC; - - - DataCRC = (CRC&0x000000ff)<<24; - DataCRC += (CRC&0x0000ff00)<<8; - DataCRC += (CRC&0x00ff0000)>>8; - DataCRC += (CRC&0xff000000)>>24; - printk(KERN_INFO "made AWB CSC value by S/W = 0x%x\n", DataCRC); - - IntOriginalCRC = (cal_data[awb_crc32-4]&0x00ff)<<24; - IntOriginalCRC += (cal_data[awb_crc32-3]&0x00ff)<<16; - IntOriginalCRC += (cal_data[awb_crc32-2]&0x00ff)<<8; - IntOriginalCRC += (cal_data[awb_crc32-1]&0x00ff); - printk(KERN_INFO "Original AWB CRC Int = 0x%x\n", IntOriginalCRC); - - if (IntOriginalCRC != DataCRC) - crc32_check = false; - - - CRC = 0; - CRC = ~CRC; - for (crc_index = 0; crc_index < (shading_header)/2; crc_index++) { - - /*low byte*/ - mem0 = (unsigned char)(cal_data[0x3000 + crc_index*2] & 0x00ff); - /*high byte*/ - mem1 = (unsigned char)((cal_data[0x3000 + crc_index*2+1]) & 0x00ff); - CRC = crc_table[(CRC ^ (mem0)) & 0xFF] ^ (CRC >> 8); - CRC = crc_table[(CRC ^ (mem1)) & 0xFF] ^ (CRC >> 8); - } - CRC = ~CRC; - - - DataCRC = (CRC&0x000000ff)<<24; - DataCRC += (CRC&0x0000ff00)<<8; - DataCRC += (CRC&0x00ff0000)>>8; - DataCRC += (CRC&0xff000000)>>24; - printk(KERN_INFO "made SHADING CSC value by S/W = 0x%x\n", DataCRC); - - IntOriginalCRC = (cal_data[shading_crc32-4]&0x00ff)<<24; - IntOriginalCRC += (cal_data[shading_crc32-3]&0x00ff)<<16; - IntOriginalCRC += (cal_data[shading_crc32-2]&0x00ff)<<8; - IntOriginalCRC += (cal_data[shading_crc32-1]&0x00ff); - printk(KERN_INFO "Original SHADING CRC Int = 0x%x\n", IntOriginalCRC); - - if (IntOriginalCRC != DataCRC) - crc32_check = false; - - - old_fs = get_fs(); - set_fs(KERNEL_DS); - - if (crc32_check == true) { - printk(KERN_INFO "make cal_data.bin~~~~ \n"); - fp = filp_open(FIMC_IS_CAL_SDCARD, O_WRONLY|O_CREAT|O_TRUNC, 0644); - if (IS_ERR(fp) || fp == NULL) { - printk(KERN_INFO "failed to open %s, err %ld\n", - FIMC_IS_CAL_SDCARD, PTR_ERR(fp)); - err = -EINVAL; - goto out; - } - - ret = vfs_write(fp, (char __user *)cal_data, - SETFILE_SIZE, &fp->f_pos); - - } else { - if (retryCnt > 0) { - set_fs(old_fs); - retryCnt--; - goto retry; - } - } - -/* - { - fp = filp_open(FIMC_IS_CAL_SDCARD, O_WRONLY|O_CREAT|O_TRUNC, 0644); - if (IS_ERR(fp) || fp == NULL) { - printk(KERN_INFO "failed to open %s, err %ld\n", - FIMC_IS_CAL_SDCARD, PTR_ERR(fp)); - err = -EINVAL; - goto out; - } - - ret = vfs_write(fp, (char __user *)cal_data, - SETFILE_SIZE, &fp->f_pos); - - } -*/ - - if (fp != NULL) - filp_close(fp, current->files); - - out: - set_fs(old_fs); - kfree(cal_data); - return err; - -} - -#endif - -#if defined(CONFIG_CAMERA_EEPROM_SUPPORT_REAR) || defined(CONFIG_CAMERA_EEPROM_SUPPORT_FRONT) -int fimc_is_i2c_read(struct i2c_client *client, void *buf, u32 addr, size_t size) -{ - const u32 addr_size = 2, max_retry = 5; - u8 addr_buf[addr_size]; - int retries = max_retry; - int ret = 0; - - if (!client) { - pr_info("%s: client is null\n", __func__); - return -ENODEV; - } - - /* pr_info("%s %s: fimc_is_i2c_read\n", - dev_driver_string(&client->dev), dev_name(&client->dev));*/ - - /* Send addr */ - addr_buf[0] = ((u16)addr) >> 8; - addr_buf[1] = (u8)addr; - - for (retries = max_retry; retries > 0; retries--) { - ret = i2c_master_send(client, addr_buf, addr_size); - if (likely(addr_size == ret)) - break; - - pr_info("%s: i2c_master_send failed(%d), try %d\n", __func__, ret, retries); - usleep_range(1000, 1000); - } - - if (unlikely(ret <= 0)) { - pr_err("%s: error %d, fail to write 0x%04X\n", __func__, ret, addr); - return ret ? ret : -ETIMEDOUT; - } - - /* Receive data */ - for (retries = max_retry; retries > 0; retries--) { - ret = i2c_master_recv(client, buf, size); - if (likely(ret == size)) - break; - - pr_info("%s: i2c_master_recv failed(%d), try %d\n", __func__, ret, retries); - usleep_range(1000, 1000); - } - - if (unlikely(ret <= 0)) { - pr_err("%s: error %d, fail to read 0x%04X\n", __func__, ret, addr); - return ret ? ret : -ETIMEDOUT; - } - - return 0; -} - -int fimc_is_i2c_write(struct i2c_client *client, void *buf, u32 addr, size_t size) -{ - pr_info("%s: do nothing\n", __func__); - return 0; -} - -int fimc_is_sec_read_eeprom_header(struct device *dev) -{ - int ret = 0; - struct fimc_is_core *core = dev_get_drvdata(dev); - u8 header_version[12] = {0, }; - struct i2c_client *client; - client = core->eeprom_client0; - - ret = fimc_is_i2c_read(client, header_version, 0x20, 0x0B); - if (unlikely(ret)) { - err("failed to fimc_is_i2c_read for header version (%d)\n", ret); - ret = -EINVAL; - } - - memcpy(sysfs_finfo.header_ver, header_version, 11); - sysfs_finfo.header_ver[11] = '\0'; - - return ret; -} - -int fimc_is_sec_readcal_eeprom(struct device *dev, int id) -{ - int ret = 0; - char *buf = NULL; - int retry = FIMC_IS_CAL_RETRY_CNT; - struct fimc_is_core *core = dev_get_drvdata(dev); - struct fimc_is_from_info *finfo = NULL; - int cal_size = 0; - struct i2c_client *client = NULL; - -#if defined(CONFIG_CAMERA_EEPROM_SUPPORT_FRONT) - if (id == SENSOR_POSITION_FRONT) { - finfo = &sysfs_finfo_front; - fimc_is_sec_get_front_cal_buf(&buf); - cal_size = FIMC_IS_MAX_CAL_SIZE_FRONT; - client = core->eeprom_client1; - } else -#endif - { - finfo = &sysfs_finfo; - fimc_is_sec_get_cal_buf(&buf); - cal_size = FIMC_IS_MAX_CAL_SIZE; - client = core->eeprom_client0; - } - - ret = fimc_is_i2c_read(client, cal_map_version, 0x30, 0x4); - if (unlikely(ret)) { - err("failed to fimc_is_i2c_read (%d)\n", ret); - ret = -EINVAL; - goto exit; - } - printk(KERN_INFO "Camera: Cal map_version = %c%c%c%c\n", cal_map_version[0], - cal_map_version[1], cal_map_version[2], cal_map_version[3]); - -crc_retry: - - /* read cal data */ - pr_info("Camera: I2C read cal data\n\n"); - fimc_is_i2c_read(client, buf, 0x0, cal_size); - - finfo->oem_start_addr = *((u32 *)&buf[0x0]); - finfo->oem_end_addr = *((u32 *)&buf[0x04]); - pr_info("OEM start = 0x%08x, end = 0x%08x\n", - (finfo->oem_start_addr), (finfo->oem_end_addr)); - finfo->awb_start_addr = *((u32 *)&buf[0x08]); - finfo->awb_end_addr = *((u32 *)&buf[0x0C]); - pr_info("AWB start = 0x%08x, end = 0x%08x\n", - (finfo->awb_start_addr), (finfo->awb_end_addr)); - finfo->shading_start_addr = *((u32 *)&buf[0x10]); - finfo->shading_end_addr = *((u32 *)&buf[0x14]); - if (finfo->shading_end_addr > 0x1fff) { - err("Shading end_addr has error!! 0x%08x", finfo->shading_end_addr); - finfo->setfile_end_addr = 0x1fff; - } - pr_info("Shading start = 0x%08x, end = 0x%08x\n", - (finfo->shading_start_addr), (finfo->shading_end_addr)); - - /* HEARDER Data : Module/Manufacturer Information */ - memcpy(finfo->header_ver, &buf[0x20], 11); - finfo->header_ver[11] = '\0'; - /* HEARDER Data : Cal Map Version */ - memcpy(finfo->cal_map_ver, &buf[0x30], 4); - - memcpy(finfo->project_name, &buf[0x38], 8); - finfo->project_name[8] = '\0'; - - /* OEM Data : Module/Manufacturer Information */ - memcpy(finfo->oem_ver, &buf[0x150], 11); - finfo->oem_ver[11] = '\0'; - - /* AWB Data : Module/Manufacturer Information */ - memcpy(finfo->awb_ver, &buf[0x220], 11); - finfo->awb_ver[11] = '\0'; - /* SHADING Data : Module/Manufacturer Information */ - memcpy(finfo->shading_ver, &buf[0x1CE0], 11); - finfo->shading_ver[11] = '\0'; - - /* debug info dump */ -#if defined(EEPROM_DEBUG) - pr_info("++++ EEPROM data info\n"); - pr_info("1. Header info\n"); - pr_info("Module info : %s\n", finfo->header_ver); - pr_info(" ID : %c\n", finfo->header_ver[0]); - pr_info(" Pixel num : %c%c\n", finfo->header_ver[1], - finfo->header_ver[2]); - pr_info(" ISP ID : %c\n", finfo->header_ver[3]); - pr_info(" Sensor Maker : %c\n", finfo->header_ver[4]); - pr_info(" Module ver : %c\n", finfo->header_ver[6]); - pr_info(" Year : %c\n", finfo->header_ver[7]); - pr_info(" Month : %c\n", finfo->header_ver[8]); - pr_info(" Release num : %c%c\n", finfo->header_ver[9], - finfo->header_ver[10]); - pr_info("project_name : %s\n", finfo->project_name); - pr_info("Cal data map ver : %s\n", finfo->cal_map_ver); - pr_info("2. OEM info\n"); - pr_info("Module info : %s\n", finfo->oem_ver); - pr_info("3. AWB info\n"); - pr_info("Module info : %s\n", finfo->awb_ver); - pr_info("4. Shading info\n"); - pr_info("Module info : %s\n", finfo->shading_ver); - pr_info("---- EEPROM data info\n"); -#endif - - /* CRC check */ - if (id == SENSOR_POSITION_FRONT) { - ret = fimc_is_sec_check_cal_crc32(buf, SENSOR_POSITION_FRONT); - } else { - ret = fimc_is_sec_check_cal_crc32(buf, SENSOR_POSITION_REAR); - } - if (!ret && (retry > 0)) { - retry--; - goto crc_retry; - } - -#if defined(CONFIG_CAMERA_EEPROM_SUPPORT_REAR) || defined(CONFIG_CAMERA_EEPROM_SUPPORT_FRONT) - if (id == SENSOR_POSITION_FRONT) { - if (finfo->header_ver[3] == 'L') { - crc32_check_factory_front = crc32_check_front; - } else { - crc32_check_factory_front = false; - } - } else -#endif - { - if (finfo->header_ver[3] == 'L') { - crc32_check_factory = crc32_check; - } else { - crc32_check_factory = false; - } - - if (finfo->project_name[6] == 'C' && finfo->header_ver[0] == 'E' && finfo->header_ver[1] == '0' && - finfo->header_ver[2] == '8') { - pr_info("This camera module use IMX134+EEPROM - project_name: %c-%c\n" - , finfo->project_name[6], finfo->project_name[7]); - - if (!core->use_module_check) { - is_right_prj_name = true; - is_latest_cam_module = true; - is_final_cam_module = true; - } - } - } - -exit: - return ret; -} -#endif - -#if !defined(CONFIG_CAMERA_EEPROM_SUPPORT_REAR) extern int fimc_is_spi_reset_by_core(struct spi_device *spi, void *buf, u32 rx_addr, size_t size); extern int fimc_is_spi_read_by_core(struct spi_device *spi, void *buf, u32 rx_addr, size_t size); extern int fimc_is_spi_read_module_id(struct spi_device *spi, void *buf, u16 rx_addr, size_t size); @@ -1131,7 +399,6 @@ crc_retry: sysfs_finfo.setfile_start_addr = *((u32 *)&cal_buf[40]); sysfs_finfo.setfile_end_addr = *((u32 *)&cal_buf[44]); }*/ -#ifdef CONFIG_COMPANION_USE sysfs_finfo.concord_cal_start_addr = *((u32 *)&cal_buf[40]); sysfs_finfo.concord_cal_end_addr = 0xF23F;//*((u32 *)&cal_buf[44]); pr_info("concord cal start = 0x%08x, end = 0x%08x\n", @@ -1213,7 +480,6 @@ crc_retry: sysfs_finfo.coef4_crc_addr = 0xF226; sysfs_finfo.coef5_crc_addr = 0xF22A; sysfs_finfo.coef6_crc_addr = 0xF22E; -#endif if (sysfs_finfo.setfile_end_addr < 0x8000 || sysfs_finfo.setfile_end_addr > 0x3fffff) { err("setfile end_addr has error!! 0x%08x", sysfs_finfo.setfile_end_addr); @@ -1240,13 +506,10 @@ crc_retry: fw_core_version = sysfs_finfo.header_ver[0]; /* debug info dump */ //#if defined(FROM_DEBUG) -#if 1 pr_err("++++ FROM data info\n"); pr_err("1. Header info\n"); pr_err("Module info : %s\n", sysfs_finfo.header_ver); -#ifdef CONFIG_COMPANION_USE pr_err("Companion version info : %s\n", sysfs_finfo.concord_header_ver); -#endif pr_err(" ID : %c\n", sysfs_finfo.header_ver[0]); pr_err(" Pixel num : %c%c\n", sysfs_finfo.header_ver[1], sysfs_finfo.header_ver[2]); @@ -1267,10 +530,8 @@ crc_retry: pr_err("4. Shading info\n"); pr_err("Module info : %s\n", sysfs_finfo.shading_ver); pr_err("---- FROM data info\n"); -#endif /* CRC check */ -#ifdef CONFIG_COMPANION_USE if (fimc_is_comp_is_compare_ver(core) >= FROM_VERSION_V004) { if (!fimc_is_sec_check_cal_crc32(cal_buf, SENSOR_POSITION_REAR) && (retry > 0)) { retry--; @@ -1281,26 +542,15 @@ crc_retry: crc32_check = false; crc32_c1_check = false; } -#else - if (!fimc_is_sec_check_cal_crc32(cal_buf, SENSOR_POSITION_REAR) && (retry > 0)) { - retry--; - goto crc_retry; - } -#endif if (sysfs_finfo.header_ver[3] == 'L') { crc32_check_factory = crc32_check; -#ifdef CONFIG_COMPANION_USE crc32_c1_check_factory = crc32_c1_check; -#endif } else { crc32_check_factory = false; -#ifdef CONFIG_COMPANION_USE crc32_c1_check_factory = false; -#endif } -#ifdef CONFIG_COMPANION_USE if (fimc_is_comp_is_compare_ver(core) >= FROM_VERSION_V004) { if (crc32_check && crc32_c1_check) { /* If FROM LSC value is not valid, loading default lsc data */ @@ -1322,7 +572,6 @@ crc_retry: companion_lsc_isvalid = true; companion_coef_isvalid = true; } -#endif if (!core->use_module_check) { is_latest_cam_module = true; @@ -1344,7 +593,6 @@ crc_retry: is_final_cam_module = true; } -#if defined(CONFIG_SOC_EXYNOS5433) if (sysfs_finfo.project_name[6] != 'T' && sysfs_finfo.header_ver[0] == 'H' && sysfs_finfo.header_ver[1] == '1' && sysfs_finfo.header_ver[2] == '6') { pr_info("FROM has abnormal project name : %c-%c\n", sysfs_finfo.project_name[6], sysfs_finfo.project_name[7]); @@ -1352,7 +600,6 @@ crc_retry: } else { is_right_prj_name = true; } -#endif old_fs = get_fs(); set_fs(KERNEL_DS); @@ -1386,308 +633,6 @@ exit: return ret; } -int fimc_is_sec_readfw(struct fimc_is_core *core) -{ - int ret = 0; - char *buf = NULL; - loff_t pos = 0; - char fw_path[100]; - char setfile_path[100]; - char setf_name[50]; - int retry = FIMC_IS_FW_RETRY_CNT; - int pixelSize; -#ifdef USE_ION_ALLOC - struct ion_handle *handle = NULL; -#endif - - pr_info("Camera: FW, Setfile need to be dumped\n"); -#ifdef USE_ION_ALLOC - handle = ion_alloc(core->fimc_ion_client, (size_t)FIMC_IS_MAX_FW_SIZE, 0, - EXYNOS_ION_HEAP_SYSTEM_MASK, 0); - if (IS_ERR_OR_NULL(handle)) { - err("(%s):failed to ioc_alloc\n",__func__); - ret = -ENOMEM; - goto exit; - } - - buf = (char *)ion_map_kernel(core->fimc_ion_client, handle); - if (IS_ERR_OR_NULL(buf)) { - err("(%s)fail to ion_map_kernle\n",__func__); - ret = -ENOMEM; - goto exit; - } -#else - buf = vmalloc(FIMC_IS_MAX_FW_SIZE); - if (!buf) { - err("vmalloc fail"); - ret = -ENOMEM; - goto exit; - } -#endif - crc_retry: - - /* read fw data */ - pr_info("Camera: Start SPI read fw data\n\n"); - ret = fimc_is_spi_read_by_core(core->spi0, buf, 0x80000, FIMC_IS_MAX_FW_SIZE); - if (ret < 0) { - err("failed to fimc_is_spi_read (%d)\n", ret); - ret = -EINVAL; - goto exit; - } - pr_info("Camera: End SPI read fw data\n\n"); - - /* CRC check */ - if (!fimc_is_sec_check_fw_crc32(buf) && (retry > 0)) { - retry--; - goto crc_retry; - } else if (!retry) { - ret = -EINVAL; - goto exit; - } - - snprintf(fw_path, sizeof(fw_path), "%s%s", FIMC_IS_FW_DUMP_PATH, FIMC_IS_FW); - if (write_data_to_file(fw_path, buf, - sysfs_finfo.bin_end_addr - sysfs_finfo.bin_start_addr + 1, &pos) < 0) { - ret = -EIO; - goto exit; - } - - pr_info("Camera: FW Data has dumped successfully\n"); - - if (sysfs_finfo.header_ver[FW_SENSOR_MAKER] == FW_SENSOR_MAKER_SLSI) { - snprintf(setf_name, sizeof(setf_name), "%s", FIMC_IS_2P2_SETF); - } else if (sysfs_finfo.header_ver[FW_SENSOR_MAKER] == FW_SENSOR_MAKER_SONY) { - pixelSize = fimc_is_sec_get_pixel_size(sysfs_finfo.header_ver); - if (pixelSize == 13) { - snprintf(setf_name, sizeof(setf_name), "%s", FIMC_IS_IMX135_SETF); - } else if (pixelSize == 8) { - snprintf(setf_name, sizeof(setf_name), "%s", FIMC_IS_IMX134_SETF); - } else { - snprintf(setf_name, sizeof(setf_name), "%s", FIMC_IS_IMX135_SETF); - } - } else { - snprintf(setf_name, sizeof(setf_name), "%s", FIMC_IS_2P2_SETF); - } - - snprintf(setfile_path, sizeof(setfile_path), "%s%s", FIMC_IS_FW_DUMP_PATH, setf_name); - pos = 0; - - if (write_data_to_file(setfile_path, - buf+(sysfs_finfo.setfile_start_addr - sysfs_finfo.bin_start_addr), - sysfs_finfo.setfile_end_addr - sysfs_finfo.setfile_start_addr + 1, &pos) < 0) { - ret = -EIO; - goto exit; - } - - pr_info("Camera: Setfile has dumped successfully\n"); - pr_info("Camera: FW, Setfile were dumped successfully\n"); - -exit: -#ifdef USE_ION_ALLOC - if (!IS_ERR_OR_NULL(buf)) { - ion_unmap_kernel(core->fimc_ion_client, handle); - } - - if (!IS_ERR_OR_NULL(handle)) { - ion_free(core->fimc_ion_client, handle); - } -#else - if (buf) { - vfree(buf); - } -#endif - return ret; -} -#endif - -#ifdef CONFIG_COMPANION_USE -int fimc_is_sec_read_companion_fw(struct fimc_is_core *core) -{ - int ret = 0; - char *buf = NULL; - loff_t pos = 0; - char fw_path[100]; - char master_setfile_path[100]; - char mode_setfile_path[100]; - char master_setf_name[50]; - char mode_setf_name[50]; - int retry = FIMC_IS_FW_RETRY_CNT; -#ifdef USE_ION_ALLOC - struct ion_handle *handle = NULL; -#endif - - pr_info("Camera: Companion FW, Setfile need to be dumped\n"); -#ifdef USE_ION_ALLOC - handle = ion_alloc(core->fimc_ion_client, (size_t)FIMC_IS_MAX_COMPANION_FW_SIZE, 0, - EXYNOS_ION_HEAP_SYSTEM_MASK, 0); - if (IS_ERR_OR_NULL(handle)) { - err("(%s)failed to ioc_alloc\n",__func__); - ret = -ENOMEM; - goto exit; - } - - buf = (char *)ion_map_kernel(core->fimc_ion_client, handle); - if (IS_ERR_OR_NULL(buf)) { - err("(%s)fail to ion_map_kernle\n",__func__); - ret = -ENOMEM; - goto exit; - } -#else - buf = vmalloc(FIMC_IS_MAX_COMPANION_FW_SIZE); - if (!buf) { - err("vmalloc fail"); - ret = -ENOMEM; - goto exit; - } -#endif - crc_retry: - - /* read companion fw data */ - pr_info("Camera: Start SPI read companion fw data\n\n"); - ret = fimc_is_spi_read_by_core(core->spi0, buf, 0x2B000, FIMC_IS_MAX_COMPANION_FW_SIZE); - if (ret < 0) { - err("failed to fimc_is_spi_read (%d)\n", ret); - ret = -EINVAL; - goto exit; - } - pr_info("Camera: End SPI read companion fw data\n\n"); - - /* CRC check */ - if (!fimc_is_sec_check_companion_fw_crc32(buf) && (retry > 0)) { - retry--; - goto crc_retry; - } else if (!retry) { - ret = -EINVAL; - goto exit; - } - - if (sysfs_finfo.concord_header_ver[9] == 0) { - snprintf(fw_path, sizeof(fw_path), "%s%s", - FIMC_IS_FW_DUMP_PATH, FIMC_IS_FW_COMPANION_EVT0); - } else if (sysfs_finfo.concord_header_ver[9] == 10) { - snprintf(fw_path, sizeof(fw_path), "%s%s", - FIMC_IS_FW_DUMP_PATH, FIMC_IS_FW_COMPANION_EVT1); - } - - if (write_data_to_file(fw_path, buf, - sysfs_finfo.concord_bin_end_addr - sysfs_finfo.concord_bin_start_addr + 1, &pos) < 0) { - ret = -EIO; - goto exit; - } - - pr_info("Camera: Companion FW Data has dumped successfully\n"); - - if (sysfs_finfo.concord_header_ver[FW_SENSOR_MAKER] == FW_SENSOR_MAKER_SLSI) { - snprintf(master_setf_name, sizeof(master_setf_name), "%s", FIMC_IS_COMPANION_MASTER_SETF); - snprintf(mode_setf_name, sizeof(mode_setf_name), "%s", FIMC_IS_COMPANION_MODE_SETF); - } else { - snprintf(master_setf_name, sizeof(master_setf_name), "%s", FIMC_IS_COMPANION_MASTER_SETF); - snprintf(mode_setf_name, sizeof(mode_setf_name), "%s", FIMC_IS_COMPANION_MODE_SETF); - } - - snprintf(master_setfile_path, sizeof(master_setfile_path), "%s%s", FIMC_IS_FW_DUMP_PATH, master_setf_name); - snprintf(mode_setfile_path, sizeof(mode_setfile_path), "%s%s", FIMC_IS_FW_DUMP_PATH, mode_setf_name); - pos = 0; - - if (write_data_to_file(master_setfile_path, - buf + sysfs_finfo.concord_master_setfile_start_addr, - sysfs_finfo.concord_master_setfile_end_addr - sysfs_finfo.concord_master_setfile_start_addr + 1, &pos) < 0) { - ret = -EIO; - goto exit; - } - pos = 0; - if (write_data_to_file(mode_setfile_path, - buf + sysfs_finfo.concord_mode_setfile_start_addr, - sysfs_finfo.concord_mode_setfile_end_addr - sysfs_finfo.concord_mode_setfile_start_addr + 1, &pos) < 0) { - ret = -EIO; - goto exit; - } - - pr_info("Camera: Companion Setfile has dumped successfully\n"); - pr_info("Camera: Companion FW, Setfile were dumped successfully\n"); - -exit: -#ifdef USE_ION_ALLOC - if (!IS_ERR_OR_NULL(buf)) { - ion_unmap_kernel(core->fimc_ion_client, handle); - } - - if (!IS_ERR_OR_NULL(handle)) { - ion_free(core->fimc_ion_client, handle); - } -#else - if (buf) { - vfree(buf); - } -#endif - - return ret; -} -#endif - -#if 0 -int fimc_is_sec_gpio_enable(struct exynos_platform_fimc_is *pdata, char *name, bool on) -{ - struct gpio_set *gpio; - int ret = 0; - int i = 0; - - for (i = 0; i < FIMC_IS_MAX_GPIO_NUM; i++) { - gpio = &pdata->gpio_info->cfg[i]; - if (strcmp(gpio->name, name) == 0) - break; - else - continue; - } - - if (i == FIMC_IS_MAX_GPIO_NUM) { - pr_err("GPIO %s is not found!!\n", name); - ret = -EINVAL; - goto exit; - } - - ret = gpio_request(gpio->pin, gpio->name); - if (ret) { - pr_err("Request GPIO error(%s)\n", gpio->name); - goto exit; - } - - if (on) { - switch (gpio->act) { - case GPIO_PULL_NONE: - s3c_gpio_cfgpin(gpio->pin, gpio->value); - s3c_gpio_setpull(gpio->pin, S3C_GPIO_PULL_NONE); - break; - case GPIO_OUTPUT: - s3c_gpio_cfgpin(gpio->pin, S3C_GPIO_OUTPUT); - s3c_gpio_setpull(gpio->pin, S3C_GPIO_PULL_NONE); - gpio_set_value(gpio->pin, gpio->value); - break; - case GPIO_INPUT: - s3c_gpio_cfgpin(gpio->pin, S3C_GPIO_INPUT); - s3c_gpio_setpull(gpio->pin, S3C_GPIO_PULL_NONE); - gpio_set_value(gpio->pin, gpio->value); - break; - case GPIO_RESET: - s3c_gpio_setpull(gpio->pin, S3C_GPIO_PULL_NONE); - gpio_direction_output(gpio->pin, 0); - gpio_direction_output(gpio->pin, 1); - break; - default: - pr_err("unknown act for gpio\n"); - break; - } - } else { - s3c_gpio_cfgpin(gpio->pin, S3C_GPIO_INPUT); - s3c_gpio_setpull(gpio->pin, S3C_GPIO_PULL_DOWN); - } - - gpio_free(gpio->pin); - -exit: - return ret; -} -#endif int fimc_is_sec_get_pixel_size(char *header_ver) { @@ -1895,164 +840,11 @@ int fimc_is_sec_fw_find(struct fimc_is_core *core, char *fw_name, char *setf_nam return 0; } -#if defined(CONFIG_CAMERA_EEPROM_SUPPORT_REAR) || defined(CONFIG_CAMERA_EEPROM_SUPPORT_FRONT) -int fimc_is_sec_fw_sel_eeprom(struct device *dev, - char *fw_name, char *setf_name, int id, bool headerOnly) -{ - int ret = 0; - char fw_path[100]; - char phone_fw_version[12] = {0, }; - - struct file *fp = NULL; - mm_segment_t old_fs; - long fsize, nread; - u8 *fw_buf = NULL; - bool is_ldo_enabled = false; - struct platform_device *pdev = to_platform_device(dev); - struct fimc_is_core *core = (struct fimc_is_core *)platform_get_drvdata(pdev); - struct exynos_platform_fimc_is_sensor *pdata; - struct fimc_is_device_sensor *sensor_device = &core->sensor[0]; - - BUG_ON(!sensor_device); - BUG_ON(!sensor_device->pdata); - BUG_ON(!sensor_device->pdata->sensor_id); - - pdata = sensor_device->pdata; - - /* Use mutex for i2c read */ - mutex_lock(&core->spi_lock); - -#if defined(CONFIG_CAMERA_EEPROM_SUPPORT_FRONT) - if (id == SENSOR_POSITION_FRONT) { - if (!sysfs_finfo_front.is_caldata_read || force_caldata_dump) { - if (force_caldata_dump) - pr_info("forced caldata dump!!\n"); - - if (!fimc_is_sec_ldo_enabled(dev, "VT_CAM_1.8V")) { - ret = fimc_is_sec_ldo_enable(dev, "VT_CAM_1.8V", true); - if (ret) { - pr_err("fimc_is_sec_fw_sel_eeprom: error, failed to cam_io(on)"); - goto exit; - } - - is_ldo_enabled = true; - } - - pr_info("Camera: read cal data from Front EEPROM\n"); - if ((fimc_is_sec_readcal_eeprom(dev, SENSOR_POSITION_FRONT) != -EIO) && - crc32_header_check_front) { - sysfs_finfo_front.is_caldata_read = true; - } - } - goto exit; - } else -#endif - { - if (!sysfs_finfo.is_caldata_read || force_caldata_dump) { - is_dumped_fw_loading_needed = false; - if (force_caldata_dump) - pr_info("forced caldata dump!!\n"); - - if (!fimc_is_sec_ldo_enabled(dev, "CAM_IO_1.8V_AP")) { - ret = fimc_is_sec_ldo_enable(dev, "CAM_IO_1.8V_AP", true); - if (ret) { - pr_err("fimc_is_sec_fw_sel_eeprom: error, failed to cam_io(on)"); - goto exit; - } - - is_ldo_enabled = true; - } - - pr_info("Camera: read cal data from Rear EEPROM\n"); - if (headerOnly) { -#if defined(CONFIG_CAMERA_EEPROM_SUPPORT_REAR) - fimc_is_sec_read_eeprom_header(dev); -#endif - } else { - if ((fimc_is_sec_readcal_eeprom(dev, SENSOR_POSITION_REAR) != -EIO) && - crc32_header_check) { - sysfs_finfo.is_caldata_read = true; - } - } - } - } - - fimc_is_sec_fw_find(core, fw_name, setf_name); - if (headerOnly) { - goto exit; - } - - snprintf(fw_path, sizeof(fw_path), "%s%s", FIMC_IS_FW_PATH, fw_name); - - old_fs = get_fs(); - set_fs(KERNEL_DS); - - fp = filp_open(fw_path, O_RDONLY, 0); - if (IS_ERR(fp)) { - pr_err("Camera: Failed open phone firmware\n"); - ret = -EIO; - fp = NULL; - goto read_phone_fw_exit; - } - - fsize = fp->f_path.dentry->d_inode->i_size; - pr_info("start, file path %s, size %ld Bytes\n", - fw_path, fsize); - fw_buf = vmalloc(fsize); - if (!fw_buf) { - pr_err("failed to allocate memory\n"); - ret = -ENOMEM; - goto read_phone_fw_exit; - } - nread = vfs_read(fp, (char __user *)fw_buf, fsize, &fp->f_pos); - if (nread != fsize) { - pr_err("failed to read firmware file, %ld Bytes\n", nread); - ret = -EIO; - goto read_phone_fw_exit; - } - - strncpy(phone_fw_version, fw_buf + nread - 11, 11); - strncpy(sysfs_pinfo.header_ver, fw_buf + nread - 11, 11); - pr_info("Camera: phone fw version: %s\n", phone_fw_version); -read_phone_fw_exit: - if (fw_buf) { - vfree(fw_buf); - fw_buf = NULL; - } - if (fp) { - filp_close(fp, current->files); - fp = NULL; - } - - set_fs(old_fs); - -exit: - if (is_ldo_enabled) { -#if defined(CONFIG_CAMERA_EEPROM_SUPPORT_FRONT) - if (id == SENSOR_POSITION_FRONT) { - ret = fimc_is_sec_ldo_enable(dev, "VT_CAM_1.8V", false); - } else -#endif - { - ret = fimc_is_sec_ldo_enable(dev, "CAM_IO_1.8V_AP", false); - } - if (ret) - pr_err("fimc_is_sec_fw_sel_eeprom: error, failed to cam_io(off)"); - } - - mutex_unlock(&core->spi_lock); - - return ret; -} -#endif - -#if !defined(CONFIG_CAMERA_EEPROM_SUPPORT_REAR) int fimc_is_sec_fw_sel(struct fimc_is_core *core, struct device *dev, char *fw_name, char *setf_name, bool headerOnly) { int ret = 0; -#if 1 char fw_path[100]; char dump_fw_path[100]; char dump_fw_version[12] = {0, }; @@ -2067,10 +859,7 @@ int fimc_is_sec_fw_sel(struct fimc_is_core *core, struct device *dev, u8 *fw_buf = NULL; bool is_dump_existed = false; bool is_dump_needed = true; -#endif -#ifdef CONFIG_COMPANION_USE struct fimc_is_spi_gpio *spi_gpio = &core->spi_gpio; -#endif bool is_ldo_enabled = false; struct exynos_platform_fimc_is_sensor *pdata; struct fimc_is_device_sensor *sensor_device = &core->sensor[0]; @@ -2098,9 +887,7 @@ int fimc_is_sec_fw_sel(struct fimc_is_core *core, struct device *dev, is_ldo_enabled = true; } pr_info("read cal data from FROM\n"); -#ifdef CONFIG_COMPANION_USE fimc_is_set_spi_config(spi_gpio, FIMC_IS_SPI_FUNC, false); -#endif if (headerOnly) { fimc_is_sec_read_from_header(dev); @@ -2111,9 +898,7 @@ int fimc_is_sec_fw_sel(struct fimc_is_core *core, struct device *dev, } } -#ifdef CONFIG_COMPANION_USE fimc_is_set_spi_config(spi_gpio, FIMC_IS_SPI_OUTPUT, false); -#endif /*select AF actuator*/ if (!crc32_header_check) { pr_info("Camera : CRC32 error for all section.\n"); @@ -2135,7 +920,6 @@ int fimc_is_sec_fw_sel(struct fimc_is_core *core, struct device *dev, snprintf(fw_path, sizeof(fw_path), "%s%s", FIMC_IS_FW_PATH, fw_name); -#if 1 snprintf(dump_fw_path, sizeof(dump_fw_path), "%s%s", FIMC_IS_FW_DUMP_PATH, fw_name); pr_info("Camera: f-rom fw version: %s\n", sysfs_finfo.header_ver); @@ -2185,7 +969,6 @@ read_phone_fw: if (ret < 0) goto exit; -#endif old_fs = get_fs(); set_fs(KERNEL_DS); @@ -2267,27 +1050,6 @@ read_phone_fw_exit: is_dumped_fw_loading_needed = false; } } -#if 0 - if (sysfs_finfo.header_ver[0] == 'O') { - /* hack: gumi module using phone fw */ - is_dumped_fw_loading_needed = false; - is_dump_needed = false; - } else if (sysfs_finfo.header_ver[FW_ISP_COMPANY] != FW_ISP_COMPANY_LSI) { - ret = -EINVAL; - goto exit; - } - - if (is_dump_needed) { - ret = fimc_is_sec_readfw(core); - if (ret < 0) { - if (!crc32_fw_check) { - is_dumped_fw_loading_needed = false; - ret = 0; - } else - goto exit; - } - } -#endif if (is_dump_needed && is_dumped_fw_loading_needed) { strncpy(loaded_fw, sysfs_finfo.header_ver, 11); } else if (!is_dump_needed && is_dumped_fw_loading_needed) { @@ -2320,9 +1082,7 @@ exit: return ret; } -#endif -#ifdef CONFIG_COMPANION_USE void fimc_is_set_spi_config(struct fimc_is_spi_gpio *spi_gpio, int func, bool ssn) { pin_config_set(FIMC_IS_SPI_PINNAME, spi_gpio->spi_sclk, PINCFG_PACK(PINCFG_TYPE_FUNC, func)); @@ -2595,18 +1355,6 @@ read_phone_fw_exit: is_dumped_c1_fw_loading_needed = false; } } -#if 0 - if (is_dump_needed) { - ret = fimc_is_sec_read_companion_fw(core); - if (ret < 0) { - if (!crc32_c1_fw_check) { - is_dumped_c1_fw_loading_needed = false; - ret = 0; - } else - goto exit; - } - } -#endif if (is_dump_needed && is_dumped_c1_fw_loading_needed) { strncpy(loaded_companion_fw, sysfs_finfo.concord_header_ver, 11); } else if (!is_dump_needed && is_dumped_c1_fw_loading_needed) { @@ -2623,4 +1371,3 @@ read_phone_fw_exit: exit: return ret; } -#endif diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-sec-define.h b/drivers/media/platform/exynos/fimc-is/fimc-is-sec-define.h index a9a170c..6f8fb65 100644 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-sec-define.h +++ b/drivers/media/platform/exynos/fimc-is/fimc-is-sec-define.h @@ -137,20 +137,12 @@ #define FIMC_IS_CAL_SDCARD "/data/cal_data.bin" #define FIMC_IS_CAL_SDCARD_FRONT "/data/cal_data_front.bin" -#if defined(CONFIG_CAMERA_EEPROM_SUPPORT_REAR) -#define FIMC_IS_MAX_FW_SIZE (8 * 1024) -#define HEADER_CRC32_LEN (80 / 2) -#define OEM_CRC32_LEN (64 / 2) -#define AWB_CRC32_LEN (32 / 2) -#define SHADING_CRC32_LEN (6623 / 2) -#else /*#define FIMC_IS_MAX_CAL_SIZE (20 * 1024)*/ #define FIMC_IS_MAX_FW_SIZE (2048 * 1024) #define HEADER_CRC32_LEN (224 / 2) #define OEM_CRC32_LEN (192 / 2) #define AWB_CRC32_LEN (32 / 2) #define SHADING_CRC32_LEN (2336 / 2) -#endif #define FIMC_IS_MAX_COMPANION_FW_SIZE (120 * 1024) #define FIMC_IS_CAL_START_ADDR (0x013D0000) @@ -178,41 +170,23 @@ ssize_t read_data_from_file(char *name, char *buf, size_t count, loff_t *pos); int fimc_is_sec_get_sysfs_finfo(struct fimc_is_from_info **finfo); int fimc_is_sec_get_sysfs_pinfo(struct fimc_is_from_info **pinfo); -#if defined(CONFIG_CAMERA_EEPROM_SUPPORT_FRONT) -int fimc_is_sec_get_sysfs_finfo_front(struct fimc_is_from_info **finfo); -int fimc_is_sec_get_sysfs_pinfo_front(struct fimc_is_from_info **pinfo); -int fimc_is_sec_get_front_cal_buf(char **buf); -#endif int fimc_is_sec_get_cal_buf(char **buf); int fimc_is_sec_get_loaded_fw(char **buf); int fimc_is_sec_get_loaded_c1_fw(char **buf); -int fimc_is_sec_get_camid_from_hal(char *fw_name, char *setf_name); -int fimc_is_sec_get_camid(void); -int fimc_is_sec_set_camid(int id); int fimc_is_sec_get_pixel_size(char *header_ver); int fimc_is_sec_fw_find(struct fimc_is_core *core, char *fw_name, char *setf_name); -int fimc_is_sec_readfw(struct fimc_is_core *core); -#if defined(CONFIG_CAMERA_EEPROM_SUPPORT_REAR) || defined(CONFIG_CAMERA_EEPROM_SUPPORT_FRONT) -int fimc_is_sec_fw_sel_eeprom(struct device *dev, char *fw_name, char *setf_name, int id, bool headerOnly); -#endif -#if !defined(CONFIG_CAMERA_EEPROM_SUPPORT_REAR) int fimc_is_sec_readcal(struct fimc_is_core *core); int fimc_is_sec_fw_sel(struct fimc_is_core *core, struct device *dev, char *fw_name, char *setf_name, bool headerOnly); -#endif -#ifdef CONFIG_COMPANION_USE int fimc_is_sec_concord_fw_sel(struct fimc_is_core *core, struct device *dev, char *fw_name, char *master_setf_name, char *mode_setf_name); -#endif int fimc_is_sec_fw_revision(char *fw_ver); int fimc_is_sec_fw_revision(char *fw_ver); bool fimc_is_sec_fw_module_compare(char *fw_ver1, char *fw_ver2); -bool fimc_is_sec_check_fw_crc32(char *buf); bool fimc_is_sec_check_cal_crc32(char *buf, int id); -void fimc_is_sec_make_crc32_table(u32 *table, u32 id); int fimc_is_sec_gpio_enable(struct exynos_platform_fimc_is *pdata, char *name, bool on); int fimc_is_sec_core_voltage_select(struct device *dev, char *header_ver); @@ -220,7 +194,5 @@ int fimc_is_sec_ldo_enable(struct device *dev, char *name, bool on); int fimc_is_spi_reset_by_core(struct spi_device *spi, void *buf, u32 rx_addr, size_t size); int fimc_is_spi_read_by_core(struct spi_device *spi, void *buf, u32 rx_addr, size_t size); -#ifdef CONFIG_COMPANION_USE void fimc_is_set_spi_config(struct fimc_is_spi_gpio *spi_gpio, int func, bool ssn); -#endif #endif /* FIMC_IS_SEC_DEFINE_H */ diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-video-companion.c b/drivers/media/platform/exynos/fimc-is/fimc-is-video-companion.c index c3da8b7..acb1af8 100644 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-video-companion.c +++ b/drivers/media/platform/exynos/fimc-is/fimc-is-video-companion.c @@ -75,9 +75,7 @@ p_err: return ret; } -#ifdef CONFIG_OIS_USE extern int fimc_is_ois_sine_mode(struct fimc_is_core *core, int mode); -#endif static int fimc_is_comp_video_s_ctrl(struct file *file, void *priv, struct v4l2_control *ctrl) @@ -98,7 +96,6 @@ static int fimc_is_comp_video_s_ctrl(struct file *file, void *priv, } switch (ctrl->id) { -#ifdef CONFIG_OIS_USE case V4L2_CID_CAMERA_OIS_SINE_MODE: if (fimc_is_ois_sine_mode(device->private_data, ctrl->value)) { err("failed to set ois sine mode : %d\n - %d", @@ -106,7 +103,6 @@ static int fimc_is_comp_video_s_ctrl(struct file *file, void *priv, ret = -EINVAL; } break; -#endif default: info("unsupported ioctl(%d, sine id = %d)\n", ctrl->id, V4L2_CID_CAMERA_OIS_SINE_MODE); diff --git a/drivers/media/platform/exynos/fimc-is/fimc-is-video-isp.c b/drivers/media/platform/exynos/fimc-is/fimc-is-video-isp.c index 2dea151..bea5dec 100644 --- a/drivers/media/platform/exynos/fimc-is/fimc-is-video-isp.c +++ b/drivers/media/platform/exynos/fimc-is/fimc-is-video-isp.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include "fimc-is-core.h" @@ -166,9 +165,6 @@ static int fimc_is_isp_video_close(struct file *file) goto p_err; } - if (pm_qos_request_active(&device->user_qos)) - pm_qos_remove_request(&device->user_qos); - fimc_is_ischain_close(device, vctx); fimc_is_video_close(vctx); @@ -504,10 +500,7 @@ static int fimc_is_isp_video_s_ctrl(struct file *file, void *priv, video = vctx->video; core = container_of(video, struct fimc_is_core, video_isp); - if (core->resourcemgr.dvfs_ctrl.cur_int_qos == DVFS_L0) - i2c_clk = I2C_L0; - else - i2c_clk = I2C_L1; + i2c_clk = I2C_L0; switch (ctrl->id) { case V4L2_CID_IS_DEBUG_DUMP: @@ -538,8 +531,6 @@ static int fimc_is_isp_video_s_ctrl(struct file *file, void *priv, err("fimc_is_itf_i2_clock fail\n"); break; } - pm_qos_add_request(&device->user_qos, PM_QOS_DEVICE_THROUGHPUT, - ctrl->value); ret = fimc_is_itf_i2c_lock(device, I2C_L0, false); if (ret) { err("fimc_is_itf_i2c_unlock fail\n"); @@ -553,7 +544,6 @@ static int fimc_is_isp_video_s_ctrl(struct file *file, void *priv, err("fimc_is_itf_i2_clock fail\n"); break; } - pm_qos_remove_request(&device->user_qos); ret = fimc_is_itf_i2c_lock(device, i2c_clk, false); if (ret) { err("fimc_is_itf_i2c_unlock fail\n"); diff --git a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-2p2.c b/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-2p2.c deleted file mode 100644 index aa062f0..0000000 --- a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-2p2.c +++ /dev/null @@ -1,309 +0,0 @@ -/* - * Samsung Exynos5 SoC series Sensor driver - * - * - * Copyright (c) 2011 Samsung Electronics Co., Ltd - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef CONFIG_OF -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include - -#include "../fimc-is-core.h" -#include "../fimc-is-device-sensor.h" -#include "../fimc-is-resourcemgr.h" -#include "../fimc-is-hw.h" -#include "fimc-is-device-2p2.h" - -#define SENSOR_NAME "S5K2P2" - -static struct fimc_is_sensor_cfg config_2p2[] = { - /* 5328x3000@30fps */ - FIMC_IS_SENSOR_CFG(5328, 3000, 30, 30, 0), - /* 5328x3000@24fps */ - FIMC_IS_SENSOR_CFG(5328, 3000, 24, 30, 1), - /* 4000X3000@30fps */ - FIMC_IS_SENSOR_CFG(4000, 3000, 30, 23, 2), - /* 4000X3000@24fps */ - FIMC_IS_SENSOR_CFG(4000, 3000, 24, 23, 3), - /* 3008X3000@30fps */ - FIMC_IS_SENSOR_CFG(3008, 3000, 30, 19, 4), - /* 3008X3000@30fps */ - FIMC_IS_SENSOR_CFG(3008, 3000, 24, 19, 5), - /* 2664X1500@60fps */ - FIMC_IS_SENSOR_CFG(2664, 1500, 60, 19, 6), - /* 1328X748@120fps */ - FIMC_IS_SENSOR_CFG(1328, 748, 120, 13, 7), - /* 824X496@300fps */ - FIMC_IS_SENSOR_CFG(824, 496, 300, 13, 8), -}; - -static int sensor_2p2_init(struct v4l2_subdev *subdev, u32 val) -{ - int ret = 0; - struct fimc_is_module_enum *module; - - BUG_ON(!subdev); - - module = (struct fimc_is_module_enum *)v4l2_get_subdevdata(subdev); - - pr_info("[MOD:D:%d] %s(%d)\n", module->id, __func__, val); - - return ret; -} - -static const struct v4l2_subdev_core_ops core_ops = { - .init = sensor_2p2_init -}; - -static const struct v4l2_subdev_ops subdev_ops = { - .core = &core_ops -}; - -#ifdef CONFIG_OF -#ifdef CONFIG_COMPANION_USE -static int sensor_2p2_power_setpin(struct device *dev) -{ - struct exynos_platform_fimc_is_sensor *pdata; - struct device_node *dnode; - int gpio_comp_en = 0, gpio_comp_rst = 0; - int gpio_none = 0; - int gpio_reset = 0; - int gpios_cam_en = -EINVAL; - - BUG_ON(!dev); - BUG_ON(!dev->platform_data); - - dnode = dev->of_node; - pdata = dev->platform_data; - - gpio_comp_en = of_get_named_gpio(dnode, "gpios_comp_en", 0); - if (!gpio_is_valid(gpio_comp_en)) { - dev_err(dev, "failed to get main comp en gpio\n"); - } else { - gpio_request_one(gpio_comp_en, GPIOF_OUT_INIT_LOW, "CAM_GPIO_OUTPUT_LOW"); - gpio_free(gpio_comp_en); - } - - gpio_comp_rst = of_get_named_gpio(dnode, "gpios_comp_reset", 0); - if (!gpio_is_valid(gpio_comp_rst)) { - dev_err(dev, "failed to get main comp reset gpio\n"); - } else { - gpio_request_one(gpio_comp_rst, GPIOF_OUT_INIT_LOW, "CAM_GPIO_OUTPUT_LOW"); - gpio_free(gpio_comp_rst); - } - - gpio_reset = of_get_named_gpio(dnode, "gpio_reset", 0); - if (!gpio_is_valid(gpio_reset)) { - dev_err(dev, "failed to get PIN_RESET\n"); - return -EINVAL; - } else { - gpio_request_one(gpio_reset, GPIOF_OUT_INIT_LOW, "CAM_GPIO_OUTPUT_LOW"); - gpio_free(gpio_reset); - } - - gpios_cam_en = of_get_named_gpio(dnode, "gpios_cam_en", 0); - if (!gpio_is_valid(gpios_cam_en)) { - dev_err(dev, "failed to get main/front cam en gpio\n"); - } else { - gpio_request_one(gpios_cam_en, GPIOF_OUT_INIT_LOW, "CAM_GPIO_OUTPUT_LOW"); - gpio_free(gpios_cam_en); - } - - /* COMPANION - POWER ON */ - if (gpio_is_valid(gpios_cam_en)) { - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 0, gpios_cam_en, 0, NULL, 0, PIN_OUTPUT_HIGH); - } else { - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 0, gpio_none, 0, "CAM_SEN_A2.8V_AP", 0, PIN_REGULATOR_ON); - } - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 1, gpio_none, 0, "CAM_SEN_CORE_1.2V_AP", 0, PIN_REGULATOR_ON); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 2, gpio_none, 0, "CAM_AF_2.8V_AP", 2000, PIN_REGULATOR_ON); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 3, gpio_none, 0, "CAM_IO_1.8V_AP", 0, PIN_REGULATOR_ON); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 4, gpio_none, 0, "VDDA_1.8V_COMP", 0, PIN_REGULATOR_ON); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 5, gpio_comp_en, 0, NULL, 150, PIN_OUTPUT_HIGH); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 6, gpio_comp_rst, 0, NULL, 0, PIN_OUTPUT_HIGH); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 7, gpio_none, 0, "ch", 0, PIN_FUNCTION); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 8, gpio_reset, 0, NULL, 0, PIN_OUTPUT_HIGH); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 9, gpio_none, 0, "af", 0, PIN_FUNCTION); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 10, gpio_none, 0, NULL, 0, PIN_END); - - /* COMPANION - POWER OFF */ - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 0, gpio_none, 0, "CAM_AF_2.8V_AP", 2000, PIN_REGULATOR_OFF); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 1, gpio_none, 0, "off", 0, PIN_FUNCTION); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 2, gpio_reset, 0, NULL, 0, PIN_OUTPUT_LOW); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 3, gpio_comp_rst, 0, NULL, 0, PIN_OUTPUT_LOW); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 4, gpio_comp_en, 0, NULL, 0, PIN_OUTPUT_LOW); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 5, gpio_none, 0, "VDDA_1.8V_COMP", 0, PIN_REGULATOR_OFF); - if (gpio_is_valid(gpios_cam_en)) { - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 6, gpios_cam_en, 0, NULL, 0, PIN_OUTPUT_LOW); - } else { - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 6, gpio_none, 0, "CAM_SEN_A2.8V_AP", 0, PIN_REGULATOR_OFF); - } - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 7, gpio_none, 0, "CAM_SEN_CORE_1.2V_AP", 0, PIN_REGULATOR_OFF); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 8, gpio_none, 0, "CAM_IO_1.8V_AP", 0, PIN_REGULATOR_OFF); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 9, gpio_none, 0, NULL, 0, PIN_END); - - return 0; -} -#else -static int sensor_2p2_power_setpin(struct device *dev) -{ - return 0; -} -#endif /* CONFIG_COMPANION_USE */ -#endif /* CONFIG_OF */ - -int sensor_2p2_probe(struct i2c_client *client, - const struct i2c_device_id *id) -{ - int ret = 0; - struct fimc_is_core *core; - struct v4l2_subdev *subdev_module; - struct fimc_is_module_enum *module; - struct fimc_is_device_sensor *device; - struct sensor_open_extended *ext; - - BUG_ON(!fimc_is_dev); - - core = (struct fimc_is_core *)dev_get_drvdata(fimc_is_dev); - if (!core) { - err("core device is not yet probed"); - return -EPROBE_DEFER; - } - - device = &core->sensor[SENSOR_2P2_INSTANCE]; - - subdev_module = kzalloc(sizeof(struct v4l2_subdev), GFP_KERNEL); - if (!subdev_module) { - err("subdev_module is NULL"); - ret = -ENOMEM; - goto p_err; - } - - module = &device->module_enum[atomic_read(&core->resourcemgr.rsccount_module)]; - atomic_inc(&core->resourcemgr.rsccount_module); - module->id = SENSOR_NAME_S5K2P2; - module->subdev = subdev_module; - module->device = SENSOR_2P2_INSTANCE; - module->client = client; - module->active_width = 5312; - module->active_height = 2990; - module->pixel_width = module->active_width + 16; - module->pixel_height = module->active_height + 10; - module->max_framerate = 300; - module->position = SENSOR_POSITION_REAR; - module->mode = CSI_MODE_CH0_ONLY; - module->lanes = CSI_DATA_LANES_4; - module->sensor_maker = "SLSI"; - module->sensor_name = "S5K2P2"; - module->setfile_name = "setfile_2p2.bin"; - module->cfgs = ARRAY_SIZE(config_2p2); - module->cfg = config_2p2; - module->ops = NULL; - module->private_data = NULL; -#ifdef CONFIG_OF - module->power_setpin = sensor_2p2_power_setpin; -#endif - ext = &module->ext; - ext->mipi_lane_num = module->lanes; - ext->I2CSclk = I2C_L0; - - ext->sensor_con.product_name = SENSOR_NAME_S5K2P2; - ext->sensor_con.peri_type = SE_I2C; - ext->sensor_con.peri_setting.i2c.channel = SENSOR_CONTROL_I2C0; - ext->sensor_con.peri_setting.i2c.slave_address = 0x5A; - ext->sensor_con.peri_setting.i2c.speed = 400000; - - ext->actuator_con.product_name = ACTUATOR_NAME_AK7345; - ext->actuator_con.peri_type = SE_I2C; - ext->actuator_con.peri_setting.i2c.channel = SENSOR_CONTROL_I2C1; - ext->actuator_con.peri_setting.i2c.slave_address = 0x5A; - ext->actuator_con.peri_setting.i2c.speed = 400000; - -#ifdef CONFIG_LEDS_MAX77804 - ext->flash_con.product_name = FLADRV_NAME_MAX77693; -#endif -#if defined(CONFIG_LEDS_LM3560) || !defined(CONFIG_USE_VENDER_FEATURE) - ext->flash_con.product_name = FLADRV_NAME_LM3560; -#endif -#ifdef CONFIG_LEDS_SKY81296 - ext->flash_con.product_name = FLADRV_NAME_SKY81296; -#endif - ext->flash_con.peri_type = SE_GPIO; -#ifdef CONFIG_USE_VENDER_FEATURE - ext->flash_con.peri_setting.gpio.first_gpio_port_no = 1; - ext->flash_con.peri_setting.gpio.second_gpio_port_no = 2; -#else - ext->flash_con.peri_setting.gpio.first_gpio_port_no = 2; - ext->flash_con.peri_setting.gpio.second_gpio_port_no = 3; -#endif - - ext->from_con.product_name = FROMDRV_NAME_NOTHING; - -#ifdef CONFIG_COMPANION_USE - ext->companion_con.product_name = COMPANION_NAME_73C1; - ext->companion_con.peri_info0.valid = true; - ext->companion_con.peri_info0.peri_type = SE_SPI; - ext->companion_con.peri_info0.peri_setting.spi.channel = (int) core->companion_spi_channel; - ext->companion_con.peri_info1.valid = true; - ext->companion_con.peri_info1.peri_type = SE_I2C; - ext->companion_con.peri_info1.peri_setting.i2c.channel = 0; - ext->companion_con.peri_info1.peri_setting.i2c.slave_address = 0x7A; - ext->companion_con.peri_info1.peri_setting.i2c.speed = 400000; - ext->companion_con.peri_info2.valid = true; - ext->companion_con.peri_info2.peri_type = SE_FIMC_LITE; - ext->companion_con.peri_info2.peri_setting.fimc_lite.channel = FLITE_ID_D; -#else - ext->companion_con.product_name = COMPANION_NAME_NOTHING; -#endif - -#if defined(CONFIG_OIS_USE) - ext->ois_con.product_name = OIS_NAME_IDG2030; - ext->ois_con.peri_type = SE_I2C; - ext->ois_con.peri_setting.i2c.channel = SENSOR_CONTROL_I2C1; - ext->ois_con.peri_setting.i2c.slave_address = 0x48; - ext->ois_con.peri_setting.i2c.speed = 400000; -#else - ext->ois_con.product_name = OIS_NAME_NOTHING; - ext->ois_con.peri_type = SE_NULL; -#endif - - if (client) - v4l2_i2c_subdev_init(subdev_module, client, &subdev_ops); - else - v4l2_subdev_init(subdev_module, &subdev_ops); - - v4l2_set_subdevdata(subdev_module, module); - v4l2_set_subdev_hostdata(subdev_module, device); - snprintf(subdev_module->name, V4L2_SUBDEV_NAME_SIZE, "sensor-subdev.%d", module->id); - -p_err: - info("%s(%d)\n", __func__, ret); - return ret; -} diff --git a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-2p2.h b/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-2p2.h deleted file mode 100644 index f4820cc..0000000 --- a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-2p2.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Samsung Exynos5 SoC series Sensor driver - * - * - * Copyright (c) 2011 Samsung Electronics Co., Ltd - * - * 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_DEVICE_2P2_H -#define FIMC_IS_DEVICE_2P2_H - -#define SENSOR_2P2_INSTANCE 0 -#define SENSOR_2P2_NAME SENSOR_NAME_S5K2P2 - -int sensor_2p2_probe(struct i2c_client *client, - const struct i2c_device_id *id); - -#endif diff --git a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-2p2_12m.c b/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-2p2_12m.c deleted file mode 100644 index 979f05a..0000000 --- a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-2p2_12m.c +++ /dev/null @@ -1,346 +0,0 @@ -/* - * Samsung Exynos5 SoC series Sensor driver - * - * - * Copyright (c) 2011 Samsung Electronics Co., Ltd - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef CONFIG_OF -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include - -#include "../fimc-is-core.h" -#include "../fimc-is-device-sensor.h" -#include "../fimc-is-resourcemgr.h" -#include "../fimc-is-hw.h" -#include "fimc-is-device-2p2_12m.h" - -#define SENSOR_NAME "S5K2P2_12M" - -static struct fimc_is_sensor_cfg config_2p2_12m[] = { - /* 4624x2604@30fps */ - FIMC_IS_SENSOR_CFG(4624, 2604, 30, 22, 0), - /* 4624x2604@24fps */ - FIMC_IS_SENSOR_CFG(4624, 2604, 24, 21, 1), - /* 3472X2604@30fps */ - FIMC_IS_SENSOR_CFG(3472, 2604, 30, 17, 2), - /* 3472X2604@24fps */ - FIMC_IS_SENSOR_CFG(3472, 2604, 24, 17, 3), - /* 2608X2604@30fps */ - FIMC_IS_SENSOR_CFG(2608, 2604, 30, 17, 4), - /* 2608X2604@24fps */ - FIMC_IS_SENSOR_CFG(2608, 2604, 24, 17, 5), - /* 2312X1300@60fps */ - FIMC_IS_SENSOR_CFG(2312, 1300, 60, 13, 6), - /* 2312X1300@30fps */ - FIMC_IS_SENSOR_CFG(2312, 1300, 30, 13, 7), - /* 1156X650@120fps */ - FIMC_IS_SENSOR_CFG(1156, 650, 120, 13, 8), -}; - -static int sensor_2p2_12m_init(struct v4l2_subdev *subdev, u32 val) -{ - int ret = 0; - struct fimc_is_module_enum *module; - - BUG_ON(!subdev); - - module = (struct fimc_is_module_enum *)v4l2_get_subdevdata(subdev); - - pr_info("[MOD:D:%d] %s(%d)\n", module->id, __func__, val); - - return ret; -} - -static const struct v4l2_subdev_core_ops core_ops = { - .init = sensor_2p2_12m_init -}; - -static const struct v4l2_subdev_ops subdev_ops = { - .core = &core_ops -}; - -#ifdef CONFIG_OF -#ifdef CONFIG_COMPANION_USE -static int sensor_2p2_12m_power_setpin(struct device *dev) -{ - struct exynos_platform_fimc_is_sensor *pdata; - struct device_node *dnode; - int gpio_comp_en = 0, gpio_comp_rst = 0; - int gpio_none = 0; - int gpio_reset = 0; - int gpios_cam_en = -EINVAL; -#ifdef CONFIG_OIS_USE - int gpios_ois_en = 0; -#endif - BUG_ON(!dev); - BUG_ON(!dev->platform_data); - - dnode = dev->of_node; - pdata = dev->platform_data; - - gpio_comp_en = of_get_named_gpio(dnode, "gpios_comp_en", 0); - if (!gpio_is_valid(gpio_comp_en)) { - dev_err(dev, "failed to get main comp en gpio\n"); - } else { - gpio_request_one(gpio_comp_en, GPIOF_OUT_INIT_LOW, "CAM_GPIO_OUTPUT_LOW"); - gpio_free(gpio_comp_en); - } - - gpio_comp_rst = of_get_named_gpio(dnode, "gpios_comp_reset", 0); - if (!gpio_is_valid(gpio_comp_rst)) { - dev_err(dev, "failed to get main comp reset gpio\n"); - } else { - gpio_request_one(gpio_comp_rst, GPIOF_OUT_INIT_LOW, "CAM_GPIO_OUTPUT_LOW"); - gpio_free(gpio_comp_rst); - } - - gpio_reset = of_get_named_gpio(dnode, "gpio_reset", 0); - if (!gpio_is_valid(gpio_reset)) { - dev_err(dev, "failed to get PIN_RESET\n"); - return -EINVAL; - } else { - gpio_request_one(gpio_reset, GPIOF_OUT_INIT_LOW, "CAM_GPIO_OUTPUT_LOW"); - gpio_free(gpio_reset); - } - - if (of_get_property(dnode, "gpios_cam_en", NULL)) { - gpios_cam_en = of_get_named_gpio(dnode, "gpios_cam_en", 0); - if (!gpio_is_valid(gpios_cam_en)) { - dev_err(dev, "failed to get main cam en gpio\n"); - } else { - gpio_request_one(gpios_cam_en, GPIOF_OUT_INIT_LOW, "CAM_GPIO_OUTPUT_LOW"); - gpio_free(gpios_cam_en); - } - } - -#ifdef CONFIG_OIS_USE - gpios_ois_en = of_get_named_gpio(dnode, "gpios_ois_en", 0); - pdata->pin_ois_en = gpios_ois_en; - if (!gpio_is_valid(gpios_ois_en)) { - dev_err(dev, "failed to get ois en gpio\n"); - } else { - gpio_request_one(gpios_ois_en, GPIOF_OUT_INIT_LOW, "CAM_GPIO_OUTPUT_LOW"); - gpio_free(gpios_ois_en); - } -#endif - - if (gpio_is_valid(gpios_cam_en)) { - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 0, gpios_cam_en, 0, NULL, 0, PIN_OUTPUT_HIGH); - } else { - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 0, gpio_none, 0, "CAM_SEN_A2.8V_AP", 0, PIN_REGULATOR_ON); - } - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 1, gpio_none, 0, "CAM_SEN_CORE_1.2V_AP", 0, PIN_REGULATOR_ON); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 2, gpio_none, 0, "CAM_AF_2.8V_AP", 2000, PIN_REGULATOR_ON); -#ifdef CONFIG_OIS_USE - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 3, gpios_ois_en, 0, NULL, 0, PIN_OUTPUT_HIGH); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 4, gpio_none, 0, "OIS_VM_2.8V", 0, PIN_REGULATOR_ON); -#endif - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 5, gpio_none, 0, "CAM_IO_1.8V_AP", 0, PIN_REGULATOR_ON); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 6, gpio_none, 0, "VDDA_1.8V_COMP", 0, PIN_REGULATOR_ON); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 7, gpio_comp_en, 0, NULL, 150, PIN_OUTPUT_HIGH); - if (pdata->companion_use_pmic) { - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 8, gpio_none, 0, "VDD_MIPI_1.0V_COMP", 0, PIN_REGULATOR_ON); - } - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 9, gpio_comp_rst, 0, NULL, 0, PIN_OUTPUT_HIGH); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 10, gpio_none, 0, "ch", 0, PIN_FUNCTION); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 11, gpio_none, 0, "af", 0, PIN_FUNCTION); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 12, gpio_reset, 0, NULL, 0, PIN_OUTPUT_HIGH); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 13, gpio_none, 0, NULL, 0, PIN_END); - - /* BACK CAMERA - POWER OFF */ - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 0, gpio_none, 0, "CAM_AF_2.8V_AP", 2000, PIN_REGULATOR_OFF); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 1, gpio_none, 0, "off", 0, PIN_FUNCTION); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 2, gpio_reset, 0, NULL, 0, PIN_OUTPUT_LOW); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 3, gpio_comp_rst, 0, NULL, 0, PIN_OUTPUT_LOW); - if (pdata->companion_use_pmic) { - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 4, gpio_none, 0, "VDD_MIPI_1.0V_COMP", 0, PIN_REGULATOR_OFF); - } - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 5, gpio_comp_en, 0, NULL, 0, PIN_OUTPUT_LOW); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 6, gpio_none, 0, "VDDA_1.8V_COMP", 0, PIN_REGULATOR_OFF); - if (gpio_is_valid(gpios_cam_en)) { - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 7, gpios_cam_en, 0, NULL, 0, PIN_OUTPUT_LOW); - } else { - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 7, gpio_none, 0, "CAM_SEN_A2.8V_AP", 0, PIN_REGULATOR_OFF); - } - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 8, gpio_none, 0, "CAM_SEN_CORE_1.2V_AP", 0, PIN_REGULATOR_OFF); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 9, gpio_none, 0, "CAM_IO_1.8V_AP", 0, PIN_REGULATOR_OFF); -#ifdef CONFIG_OIS_USE - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 10, gpios_ois_en, 0, NULL, 0, PIN_OUTPUT_LOW); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 11, gpio_none, 0, "OIS_VM_2.8V", 0, PIN_REGULATOR_OFF); -#endif - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 12, gpio_none, 0, NULL, 0, PIN_END); - -#ifdef CONFIG_OIS_USE - /* OIS_FACTORY - POWER ON */ - SET_PIN(pdata, SENSOR_SCENARIO_OIS_FACTORY, GPIO_SCENARIO_ON, 0, gpio_none, 0, "CAM_AF_2.8V_AP", 2000, PIN_REGULATOR_ON); - SET_PIN(pdata, SENSOR_SCENARIO_OIS_FACTORY, GPIO_SCENARIO_ON, 1, gpios_ois_en, 0, NULL, 0, PIN_OUTPUT_HIGH); - SET_PIN(pdata, SENSOR_SCENARIO_OIS_FACTORY, GPIO_SCENARIO_ON, 2, gpio_none, 0, "OIS_VM_2.8V", 0, PIN_REGULATOR_ON); - SET_PIN(pdata, SENSOR_SCENARIO_OIS_FACTORY, GPIO_SCENARIO_ON, 3, gpio_none, 0, "CAM_IO_1.8V_AP", 0, PIN_REGULATOR_ON); - SET_PIN(pdata, SENSOR_SCENARIO_OIS_FACTORY, GPIO_SCENARIO_ON, 4, gpio_reset, 0, NULL, 0, PIN_OUTPUT_HIGH); - SET_PIN(pdata, SENSOR_SCENARIO_OIS_FACTORY, GPIO_SCENARIO_ON, 5, gpio_none, 0, NULL, 0, PIN_END); - - /* OIS_FACTORY - POWER OFF */ - SET_PIN(pdata, SENSOR_SCENARIO_OIS_FACTORY, GPIO_SCENARIO_OFF, 0, gpio_none, 0, "CAM_AF_2.8V_AP", 2000, PIN_REGULATOR_OFF); - SET_PIN(pdata, SENSOR_SCENARIO_OIS_FACTORY, GPIO_SCENARIO_OFF, 1, gpio_reset, 0, NULL, 0, PIN_OUTPUT_LOW); - SET_PIN(pdata, SENSOR_SCENARIO_OIS_FACTORY, GPIO_SCENARIO_OFF, 2, gpio_none, 0, "CAM_IO_1.8V_AP", 0, PIN_REGULATOR_OFF); - SET_PIN(pdata, SENSOR_SCENARIO_OIS_FACTORY, GPIO_SCENARIO_OFF, 3, gpios_ois_en, 0, NULL, 0, PIN_OUTPUT_LOW); - SET_PIN(pdata, SENSOR_SCENARIO_OIS_FACTORY, GPIO_SCENARIO_OFF, 4, gpio_none, 0, "OIS_VM_2.8V", 0, PIN_REGULATOR_OFF); - SET_PIN(pdata, SENSOR_SCENARIO_OIS_FACTORY, GPIO_SCENARIO_OFF, 5, gpio_none, 0, NULL, 0, PIN_END); -#endif - - return 0; -} -#else -static int sensor_2p2_12m_power_setpin(struct device *dev) -{ - return 0; -} -#endif /* CONFIG_COMPANION_USE */ -#endif /* CONFIG_OF */ - - -int sensor_2p2_12m_probe(struct i2c_client *client, - const struct i2c_device_id *id) -{ - int ret = 0; - struct fimc_is_core *core; - struct v4l2_subdev *subdev_module; - struct fimc_is_module_enum *module; - struct fimc_is_device_sensor *device; - struct sensor_open_extended *ext; - - BUG_ON(!fimc_is_dev); - - core = (struct fimc_is_core *)dev_get_drvdata(fimc_is_dev); - if (!core) { - err("core device is not yet probed"); - return -EPROBE_DEFER; - } - - device = &core->sensor[SENSOR_2P2_12M_INSTANCE]; - - subdev_module = kzalloc(sizeof(struct v4l2_subdev), GFP_KERNEL); - if (!subdev_module) { - err("subdev_module is NULL"); - ret = -ENOMEM; - goto p_err; - } - - module = &device->module_enum[atomic_read(&core->resourcemgr.rsccount_module)]; - atomic_inc(&core->resourcemgr.rsccount_module); - module->id = SENSOR_NAME_S5K2P2_12M; - module->subdev = subdev_module; - module->device = SENSOR_2P2_12M_INSTANCE; - module->client = client; - module->active_width = 4608; - module->active_height = 2594; - module->pixel_width = module->active_width + 16; - module->pixel_height = module->active_height + 10; - module->max_framerate = 300; - module->position = SENSOR_POSITION_REAR; - module->mode = CSI_MODE_CH0_ONLY; - module->lanes = CSI_DATA_LANES_4; - module->sensor_maker = "SLSI"; - module->sensor_name = "S5K2P2"; - module->setfile_name = "setfile_2p2_12m.bin"; - module->cfgs = ARRAY_SIZE(config_2p2_12m); - module->cfg = config_2p2_12m; - module->ops = NULL; - module->private_data = NULL; -#ifdef CONFIG_OF - module->power_setpin = sensor_2p2_12m_power_setpin; -#endif - ext = &module->ext; - ext->mipi_lane_num = module->lanes; - ext->I2CSclk = I2C_L0; - - ext->sensor_con.product_name = SENSOR_NAME_S5K2P2_12M; - ext->sensor_con.peri_type = SE_I2C; - ext->sensor_con.peri_setting.i2c.channel = SENSOR_CONTROL_I2C0; - ext->sensor_con.peri_setting.i2c.slave_address = 0x5A; - ext->sensor_con.peri_setting.i2c.speed = 400000; - - ext->actuator_con.product_name = ACTUATOR_NAME_AK7345; - ext->actuator_con.peri_type = SE_I2C; - ext->actuator_con.peri_setting.i2c.channel = SENSOR_CONTROL_I2C1; - ext->actuator_con.peri_setting.i2c.slave_address = 0x5A; - ext->actuator_con.peri_setting.i2c.speed = 400000; - -#ifdef CONFIG_LEDS_MAX77804 - ext->flash_con.product_name = FLADRV_NAME_MAX77693; -#endif -#if defined(CONFIG_LEDS_LM3560) || !defined(CONFIG_USE_VENDER_FEATURE) - ext->flash_con.product_name = FLADRV_NAME_LM3560; -#endif -#ifdef CONFIG_LEDS_SKY81296 - ext->flash_con.product_name = FLADRV_NAME_SKY81296; -#endif - ext->flash_con.peri_type = SE_GPIO; -#ifdef CONFIG_USE_VENDER_FEATURE - ext->flash_con.peri_setting.gpio.first_gpio_port_no = 1; - ext->flash_con.peri_setting.gpio.second_gpio_port_no = 2; -#else - ext->flash_con.peri_setting.gpio.first_gpio_port_no = 2; - ext->flash_con.peri_setting.gpio.second_gpio_port_no = 3; -#endif - - ext->from_con.product_name = FROMDRV_NAME_NOTHING; - -#ifdef CONFIG_COMPANION_USE - ext->companion_con.product_name = COMPANION_NAME_73C1; - ext->companion_con.peri_info0.valid = true; - ext->companion_con.peri_info0.peri_type = SE_SPI; - ext->companion_con.peri_info0.peri_setting.spi.channel = (int) core->companion_spi_channel; - ext->companion_con.peri_info1.valid = true; - ext->companion_con.peri_info1.peri_type = SE_I2C; - ext->companion_con.peri_info1.peri_setting.i2c.channel = 0; - ext->companion_con.peri_info1.peri_setting.i2c.slave_address = 0x7A; - ext->companion_con.peri_info1.peri_setting.i2c.speed = 400000; - ext->companion_con.peri_info2.valid = true; - ext->companion_con.peri_info2.peri_type = SE_FIMC_LITE; - ext->companion_con.peri_info2.peri_setting.fimc_lite.channel = FLITE_ID_D; -#else - ext->companion_con.product_name = COMPANION_NAME_NOTHING; -#endif - - if (client) { - v4l2_i2c_subdev_init(subdev_module, client, &subdev_ops); - } else { - v4l2_subdev_init(subdev_module, &subdev_ops); - } - - v4l2_set_subdevdata(subdev_module, module); - v4l2_set_subdev_hostdata(subdev_module, device); - snprintf(subdev_module->name, V4L2_SUBDEV_NAME_SIZE, "sensor-subdev.%d", module->id); - -p_err: - info("%s(%d)\n", __func__, ret); - return ret; -} diff --git a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-2p2_12m.h b/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-2p2_12m.h deleted file mode 100644 index d28ca8d..0000000 --- a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-2p2_12m.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Samsung Exynos5 SoC series Sensor driver - * - * - * Copyright (c) 2011 Samsung Electronics Co., Ltd - * - * 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_DEVICE_2P2_12M_H -#define FIMC_IS_DEVICE_2P2_12M_H - -#define SENSOR_2P2_12M_INSTANCE 0 -#define SENSOR_2P2_12M_NAME SENSOR_NAME_S5K2P2_12M - -int sensor_2p2_12m_probe(struct i2c_client *client, - const struct i2c_device_id *id); - -#endif diff --git a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-2p3.c b/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-2p3.c deleted file mode 100644 index ed22f2f..0000000 --- a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-2p3.c +++ /dev/null @@ -1,280 +0,0 @@ -/* - * Samsung Exynos5 SoC series Sensor driver - * - * - * Copyright (c) 2011 Samsung Electronics Co., Ltd - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef CONFIG_OF -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include - -#include "../fimc-is-core.h" -#include "../fimc-is-device-sensor.h" -#include "../fimc-is-resourcemgr.h" -#include "../fimc-is-hw.h" -#include "fimc-is-device-2p3.h" - -#define SENSOR_NAME "S5K2P3" - -static struct fimc_is_sensor_cfg config_2p3[] = { - /* 5328x3000@30fps */ - FIMC_IS_SENSOR_CFG(5328, 3000, 30, 30, 0), - /* 5328x3000@24fps */ - FIMC_IS_SENSOR_CFG(5328, 3000, 24, 24, 1), - /* 4000X3000@30fps */ - FIMC_IS_SENSOR_CFG(4000, 3000, 30, 23, 2), - /* 4000X3000@24fps */ - FIMC_IS_SENSOR_CFG(4000, 3000, 24, 19, 3), - /* 3008X3000@30fps */ - FIMC_IS_SENSOR_CFG(3008, 3000, 30, 19, 4), - /* 3008X3000@30fps */ - FIMC_IS_SENSOR_CFG(3008, 3000, 24, 14, 5), - /* 2664X1500@60fps */ - FIMC_IS_SENSOR_CFG(2664, 1500, 60, 19, 6), - /* 1328X748@120fps */ - FIMC_IS_SENSOR_CFG(1328, 748, 120, 13, 7), - /* 824X496@300fps */ -/* FIMC_IS_SENSOR_CFG(824, 496, 300, 13, 8), TODO: Temporary Disabled. */ -}; - -static int sensor_2p3_init(struct v4l2_subdev *subdev, u32 val) -{ - int ret = 0; - struct fimc_is_module_enum *module; - - BUG_ON(!subdev); - - module = (struct fimc_is_module_enum *)v4l2_get_subdevdata(subdev); - - pr_info("[MOD:D:%d] %s(%d)\n", module->id, __func__, val); - - return ret; -} - -static const struct v4l2_subdev_core_ops core_ops = { - .init = sensor_2p3_init -}; - -static const struct v4l2_subdev_ops subdev_ops = { - .core = &core_ops -}; - -#ifdef CONFIG_OF -static int sensor_2p3_power_setpin(struct device *dev) -{ - struct exynos_platform_fimc_is_sensor *pdata; - struct device_node *dnode; - int gpio_none = 0; - int gpio_reset = 0; - int gpios_cam_en = -EINVAL; - - BUG_ON(!dev); - BUG_ON(!dev->platform_data); - - dnode = dev->of_node; - pdata = dev->platform_data; - - gpio_reset = of_get_named_gpio(dnode, "gpio_reset", 0); - if (!gpio_is_valid(gpio_reset)) { - dev_err(dev, "failed to get PIN_RESET\n"); - return -EINVAL; - } else { - gpio_request_one(gpio_reset, GPIOF_OUT_INIT_LOW, "CAM_GPIO_OUTPUT_LOW"); - gpio_free(gpio_reset); - } - - gpios_cam_en = of_get_named_gpio(dnode, "gpios_cam_en", 0); - if (!gpio_is_valid(gpios_cam_en)) { - dev_err(dev, "failed to get main/front cam en gpio\n"); - } else { - gpio_request_one(gpios_cam_en, GPIOF_OUT_INIT_LOW, "CAM_GPIO_OUTPUT_LOW"); - gpio_free(gpios_cam_en); - } - - /* POWER ON */ - if (gpio_is_valid(gpios_cam_en)) { - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 0, gpios_cam_en, 0, NULL, 0, PIN_OUTPUT_HIGH); - } else { - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 0, gpio_none, 0, "CAM_SEN_A2.8V_AP", 0, PIN_REGULATOR_ON); - } - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 1, gpio_none, 0, "CAM_SEN_CORE_1.2V_AP", 0, PIN_REGULATOR_ON); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 2, gpio_none, 0, "CAM_AF_2.8V_AP", 2000, PIN_REGULATOR_ON); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 3, gpio_none, 0, "CAM_IO_1.8V_AP", 0, PIN_REGULATOR_ON); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 7, gpio_none, 0, "ch", 0, PIN_FUNCTION); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 8, gpio_reset, 0, NULL, 0, PIN_OUTPUT_HIGH); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 9, gpio_none, 0, "af", 0, PIN_FUNCTION); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 10, gpio_none, 0, NULL, 0, PIN_END); - - /* POWER OFF */ - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 0, gpio_none, 0, "CAM_AF_2.8V_AP", 2000, PIN_REGULATOR_OFF); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 1, gpio_none, 0, "off", 0, PIN_FUNCTION); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 2, gpio_reset, 0, NULL, 0, PIN_OUTPUT_LOW); - if (gpio_is_valid(gpios_cam_en)) { - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 6, gpios_cam_en, 0, NULL, 0, PIN_OUTPUT_LOW); - } else { - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 6, gpio_none, 0, "CAM_SEN_A2.8V_AP", 0, PIN_REGULATOR_OFF); - } - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 7, gpio_none, 0, "CAM_SEN_CORE_1.2V_AP", 0, PIN_REGULATOR_OFF); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 8, gpio_none, 0, "CAM_IO_1.8V_AP", 0, PIN_REGULATOR_OFF); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 9, gpio_none, 0, NULL, 0, PIN_END); - - return 0; -} -#endif /* CONFIG_OF */ - -int sensor_2p3_probe(struct i2c_client *client, - const struct i2c_device_id *id) -{ - int ret = 0; - struct fimc_is_core *core; - struct v4l2_subdev *subdev_module; - struct fimc_is_module_enum *module; - struct fimc_is_device_sensor *device; - struct sensor_open_extended *ext; - - BUG_ON(!fimc_is_dev); - - core = (struct fimc_is_core *)dev_get_drvdata(fimc_is_dev); - if (!core) { - err("core device is not yet probed"); - return -EPROBE_DEFER; - } - - device = &core->sensor[SENSOR_2P3_INSTANCE]; - - subdev_module = kzalloc(sizeof(struct v4l2_subdev), GFP_KERNEL); - if (!subdev_module) { - err("subdev_module is NULL"); - ret = -ENOMEM; - goto p_err; - } - - module = &device->module_enum[atomic_read(&core->resourcemgr.rsccount_module)]; - atomic_inc(&core->resourcemgr.rsccount_module); - module->id = SENSOR_NAME_S5K2P3; - module->subdev = subdev_module; - module->device = SENSOR_2P3_INSTANCE; - module->client = client; - module->active_width = 5312; - module->active_height = 2990; - module->pixel_width = module->active_width + 16; - module->pixel_height = module->active_height + 10; - module->max_framerate = 300; - module->position = SENSOR_POSITION_REAR; - module->mode = CSI_MODE_CH0_ONLY; - module->lanes = CSI_DATA_LANES_4; - module->sensor_maker = "SLSI"; - module->sensor_name = "S5K2P3"; - module->setfile_name = "setfile_2p3.bin"; - module->cfgs = ARRAY_SIZE(config_2p3); - module->cfg = config_2p3; - module->ops = NULL; - module->private_data = NULL; -#ifdef CONFIG_OF - module->power_setpin = sensor_2p3_power_setpin; -#endif - - ext = &module->ext; - ext->mipi_lane_num = module->lanes; - ext->I2CSclk = I2C_L0; - - ext->sensor_con.product_name = SENSOR_NAME_S5K2P3; - ext->sensor_con.peri_type = SE_I2C; - ext->sensor_con.peri_setting.i2c.channel = SENSOR_CONTROL_I2C0; - ext->sensor_con.peri_setting.i2c.slave_address = 0x20; - ext->sensor_con.peri_setting.i2c.speed = 400000; - - ext->actuator_con.product_name = ACTUATOR_NAME_AK7345; - ext->actuator_con.peri_type = SE_I2C; - ext->actuator_con.peri_setting.i2c.channel = SENSOR_CONTROL_I2C1; - ext->actuator_con.peri_setting.i2c.slave_address = 0x20; - ext->actuator_con.peri_setting.i2c.speed = 400000; - -#ifdef CONFIG_LEDS_MAX77804 - ext->flash_con.product_name = FLADRV_NAME_MAX77693; -#endif -#if defined(CONFIG_LEDS_LM3560) || !defined(CONFIG_USE_VENDER_FEATURE) - ext->flash_con.product_name = FLADRV_NAME_LM3560; -#endif -#ifdef CONFIG_LEDS_SKY81296 - ext->flash_con.product_name = FLADRV_NAME_SKY81296; -#endif - ext->flash_con.peri_type = SE_GPIO; -#ifdef CONFIG_USE_VENDER_FEATURE - ext->flash_con.peri_setting.gpio.first_gpio_port_no = 1; - ext->flash_con.peri_setting.gpio.second_gpio_port_no = 2; -#else - ext->flash_con.peri_setting.gpio.first_gpio_port_no = 2; - ext->flash_con.peri_setting.gpio.second_gpio_port_no = 3; -#endif - - ext->from_con.product_name = FROMDRV_NAME_NOTHING; - -#ifdef CONFIG_COMPANION_USE - ext->companion_con.product_name = COMPANION_NAME_73C1; - ext->companion_con.peri_info0.valid = true; - ext->companion_con.peri_info0.peri_type = SE_SPI; - ext->companion_con.peri_info0.peri_setting.spi.channel = (int) core->companion_spi_channel; - ext->companion_con.peri_info1.valid = true; - ext->companion_con.peri_info1.peri_type = SE_I2C; - ext->companion_con.peri_info1.peri_setting.i2c.channel = 0; - ext->companion_con.peri_info1.peri_setting.i2c.slave_address = 0x7A; - ext->companion_con.peri_info1.peri_setting.i2c.speed = 400000; - ext->companion_con.peri_info2.valid = true; - ext->companion_con.peri_info2.peri_type = SE_FIMC_LITE; - ext->companion_con.peri_info2.peri_setting.fimc_lite.channel = FLITE_ID_D; -#else - ext->companion_con.product_name = COMPANION_NAME_NOTHING; -#endif - -#if defined(CONFIG_OIS_USE) - ext->ois_con.product_name = OIS_NAME_IDG2030; - ext->ois_con.peri_type = SE_I2C; - ext->ois_con.peri_setting.i2c.channel = SENSOR_CONTROL_I2C1; - ext->ois_con.peri_setting.i2c.slave_address = 0x48; - ext->ois_con.peri_setting.i2c.speed = 400000; -#else - ext->ois_con.product_name = OIS_NAME_NOTHING; - ext->ois_con.peri_type = SE_NULL; -#endif - - if (client) - v4l2_i2c_subdev_init(subdev_module, client, &subdev_ops); - else - v4l2_subdev_init(subdev_module, &subdev_ops); - - v4l2_set_subdevdata(subdev_module, module); - v4l2_set_subdev_hostdata(subdev_module, device); - snprintf(subdev_module->name, V4L2_SUBDEV_NAME_SIZE, "sensor-subdev.%d", module->id); - -p_err: - info("%s(%d)\n", __func__, ret); - return ret; -} diff --git a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-2p3.h b/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-2p3.h deleted file mode 100644 index 7e3791d..0000000 --- a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-2p3.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Samsung Exynos5 SoC series Sensor driver - * - * - * Copyright (c) 2011 Samsung Electronics Co., Ltd - * - * 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_DEVICE_2P3_H -#define FIMC_IS_DEVICE_2P3_H - -#define SENSOR_2P3_INSTANCE 0 -#define SENSOR_2P3_NAME SENSOR_NAME_S5K2P3 - -int sensor_2p3_probe(struct i2c_client *client, - const struct i2c_device_id *id); - -#endif diff --git a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-3h5.c b/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-3h5.c deleted file mode 100644 index 8676a22..0000000 --- a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-3h5.c +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Samsung Exynos5 SoC series Sensor driver - * - * - * Copyright (c) 2011 Samsung Electronics Co., Ltd - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "../fimc-is-core.h" -#include "../fimc-is-device-sensor.h" -#include "../fimc-is-resourcemgr.h" -#include "../fimc-is-hw.h" -#include "fimc-is-device-3h5.h" - -#define SENSOR_NAME "S5K3H5" - -static struct fimc_is_sensor_cfg config_3h5[] = { - /* 3264x2448@30fps */ - FIMC_IS_SENSOR_CFG(3264, 2448, 30, 15, 0), -}; - -static int sensor_3h5_init(struct v4l2_subdev *subdev, u32 val) -{ - int ret = 0; - struct fimc_is_module_enum *module; - - BUG_ON(!subdev); - - module = (struct fimc_is_module_enum *)v4l2_get_subdevdata(subdev); - - pr_info("[MOD:D:%d] %s(%d)\n", module->id, __func__, val); - - return ret; -} - -static const struct v4l2_subdev_core_ops core_ops = { - .init = sensor_3h5_init -}; - -static const struct v4l2_subdev_ops subdev_ops = { - .core = &core_ops -}; - -int sensor_3h5_probe(struct i2c_client *client, - const struct i2c_device_id *id) -{ - int ret = 0; - struct fimc_is_core *core; - struct v4l2_subdev *subdev_module; - struct fimc_is_module_enum *module; - struct fimc_is_device_sensor *device; - struct sensor_open_extended *ext; - - BUG_ON(!fimc_is_dev); - - core = (struct fimc_is_core *)dev_get_drvdata(fimc_is_dev); - if (!core) { - err("core device is not yet probed"); - return -EPROBE_DEFER; - } - - device = &core->sensor[SENSOR_S5K3H5_INSTANCE]; - - subdev_module = kzalloc(sizeof(struct v4l2_subdev), GFP_KERNEL); - if (!subdev_module) { - err("subdev_module is NULL"); - ret = -ENOMEM; - goto p_err; - } - - module = &device->module_enum[atomic_read(&core->resourcemgr.rsccount_module)]; - atomic_inc(&core->resourcemgr.rsccount_module); - module->id = SENSOR_NAME_S5K3H5; - module->subdev = subdev_module; - module->device = SENSOR_S5K3H5_INSTANCE; - module->client = client; - module->active_width = 3248; - module->active_height = 2438; - module->pixel_width = module->active_width + 16; - module->pixel_height = module->active_height + 10; - module->max_framerate = 30; - module->position = SENSOR_POSITION_REAR; - module->mode = CSI_MODE_CH0_ONLY; - module->lanes = CSI_DATA_LANES_4; - module->sensor_maker = "SLSI"; - module->sensor_name = "S5K3H5"; - module->setfile_name = "setfile_3h5.bin"; - module->cfgs = ARRAY_SIZE(config_3h5); - module->cfg = config_3h5; - module->ops = NULL; - module->private_data = NULL; - - ext = &module->ext; - ext->mipi_lane_num = module->lanes; - ext->I2CSclk = I2C_L0; - - ext->sensor_con.product_name = 0; - ext->sensor_con.peri_type = SE_I2C; - ext->sensor_con.peri_setting.i2c.channel = SENSOR_CONTROL_I2C0; - ext->sensor_con.peri_setting.i2c.slave_address = 0x5A; - ext->sensor_con.peri_setting.i2c.speed = 400000; - - ext->actuator_con.product_name = ACTUATOR_NAME_HYBRIDVCA; - ext->actuator_con.peri_type = SE_I2C; - ext->actuator_con.peri_setting.i2c.channel = SENSOR_CONTROL_I2C0; - - ext->flash_con.product_name = FLADRV_NAME_AAT1290A; /* == FLADRV_NAME_AAT1274 */ - ext->flash_con.peri_type = SE_GPIO; - ext->flash_con.peri_setting.gpio.first_gpio_port_no = 6; - ext->flash_con.peri_setting.gpio.second_gpio_port_no = 8; - - ext->from_con.product_name = FROMDRV_NAME_NOTHING; - - ext->companion_con.product_name = COMPANION_NAME_NOTHING; - - if (client) - v4l2_i2c_subdev_init(subdev_module, client, &subdev_ops); - else - v4l2_subdev_init(subdev_module, &subdev_ops); - - v4l2_set_subdevdata(subdev_module, module); - v4l2_set_subdev_hostdata(subdev_module, device); - snprintf(subdev_module->name, V4L2_SUBDEV_NAME_SIZE, "sensor-subdev.%d", module->id); - -p_err: - info("%s(%d)\n", __func__, ret); - return ret; -} diff --git a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-3h5.h b/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-3h5.h deleted file mode 100644 index 644e149..0000000 --- a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-3h5.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Samsung Exynos5 SoC series Sensor driver - * - * - * Copyright (c) 2011 Samsung Electronics Co., Ltd - * - * 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_DEVICE_3H5_H -#define FIMC_IS_DEVICE_3H5_H - -#define SENSOR_S5K3H5_INSTANCE 0 -#define SENSOR_S5K3H5_NAME SENSOR_NAME_S5K3H5 - -int sensor_3h5_probe(struct i2c_client *client, - const struct i2c_device_id *id); - -#endif diff --git a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-3h7.c b/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-3h7.c deleted file mode 100644 index b4bfd2f..0000000 --- a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-3h7.c +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Samsung Exynos5 SoC series Sensor driver - * - * - * Copyright (c) 2011 Samsung Electronics Co., Ltd - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "../fimc-is-core.h" -#include "../fimc-is-device-sensor.h" -#include "../fimc-is-resourcemgr.h" -#include "../fimc-is-hw.h" -#include "fimc-is-device-3h7.h" - -#define SENSOR_NAME "S5K3H7" - -static struct fimc_is_sensor_cfg config_3h7[] = { - /* 3280x2458@30fps */ - FIMC_IS_SENSOR_CFG(3280, 2458, 30, 15, 0), -}; - -static int sensor_3h7_init(struct v4l2_subdev *subdev, u32 val) -{ - int ret = 0; - struct fimc_is_module_enum *module; - - BUG_ON(!subdev); - - module = (struct fimc_is_module_enum *)v4l2_get_subdevdata(subdev); - - pr_info("[MOD:D:%d] %s(%d)\n", module->id, __func__, val); - - return ret; -} - -static const struct v4l2_subdev_core_ops core_ops = { - .init = sensor_3h7_init -}; - -static const struct v4l2_subdev_ops subdev_ops = { - .core = &core_ops -}; - -int sensor_3h7_probe(struct i2c_client *client, - const struct i2c_device_id *id) -{ - int ret = 0; - struct fimc_is_core *core; - struct v4l2_subdev *subdev_module; - struct fimc_is_module_enum *module; - struct fimc_is_device_sensor *device; - struct sensor_open_extended *ext; - - BUG_ON(!fimc_is_dev); - - core = (struct fimc_is_core *)dev_get_drvdata(fimc_is_dev); - if (!core) { - err("core device is not yet probed"); - return -EPROBE_DEFER; - } - - device = &core->sensor[SENSOR_S5K3H7_INSTANCE]; - - subdev_module = kzalloc(sizeof(struct v4l2_subdev), GFP_KERNEL); - if (!subdev_module) { - err("subdev_module is NULL"); - ret = -ENOMEM; - goto p_err; - } - - module = &device->module_enum[atomic_read(&core->resourcemgr.rsccount_module)]; - atomic_inc(&core->resourcemgr.rsccount_module); - module->id = SENSOR_NAME_S5K3H7; - module->subdev = subdev_module; - module->device = SENSOR_S5K3H7_INSTANCE; - module->client = client; - module->active_width = 3248; - module->active_height = 2438; - module->pixel_width = module->active_width + 16; - module->pixel_height = module->active_height + 10; - module->max_framerate = 30; - module->position = SENSOR_POSITION_REAR; - module->mode = CSI_MODE_CH0_ONLY; - module->lanes = CSI_DATA_LANES_4; - module->sensor_maker = "SLSI"; - module->sensor_name = "S5K3H7"; - module->setfile_name = "setfile_3h7.bin"; - module->cfgs = ARRAY_SIZE(config_3h7); - module->cfg = config_3h7; - module->ops = NULL; - module->private_data = NULL; - - ext = &module->ext; - ext->mipi_lane_num = module->lanes; - ext->I2CSclk = I2C_L0; - - ext->sensor_con.product_name = 0; - ext->sensor_con.peri_type = SE_I2C; - ext->sensor_con.peri_setting.i2c.channel = SENSOR_CONTROL_I2C0; - ext->sensor_con.peri_setting.i2c.slave_address = 0x20; - ext->sensor_con.peri_setting.i2c.speed = 400000; - - ext->actuator_con.product_name = ACTUATOR_NAME_AK7343; - ext->actuator_con.peri_type = SE_I2C; - ext->actuator_con.peri_setting.i2c.channel = SENSOR_CONTROL_I2C0; - - ext->flash_con.product_name = FLADRV_NAME_KTD267; - ext->flash_con.peri_type = SE_GPIO; - ext->flash_con.peri_setting.gpio.first_gpio_port_no = 17; - ext->flash_con.peri_setting.gpio.second_gpio_port_no = 16; - - ext->from_con.product_name = FROMDRV_NAME_NOTHING; - - ext->companion_con.product_name = COMPANION_NAME_NOTHING; - - if (client) - v4l2_i2c_subdev_init(subdev_module, client, &subdev_ops); - else - v4l2_subdev_init(subdev_module, &subdev_ops); - - v4l2_set_subdevdata(subdev_module, module); - v4l2_set_subdev_hostdata(subdev_module, device); - snprintf(subdev_module->name, V4L2_SUBDEV_NAME_SIZE, "sensor-subdev.%d", module->id); - -p_err: - info("%s(%d)\n", __func__, ret); - return ret; -} diff --git a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-3h7.h b/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-3h7.h deleted file mode 100644 index d2a13f3..0000000 --- a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-3h7.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Samsung Exynos5 SoC series Sensor driver - * - * - * Copyright (c) 2011 Samsung Electronics Co., Ltd - * - * 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_DEVICE_3H7_H -#define FIMC_IS_DEVICE_3H7_H - -#define SENSOR_S5K3H7_INSTANCE 0 -#define SENSOR_S5K3H7_NAME SENSOR_NAME_S5K3H7 - -int sensor_3h7_probe(struct i2c_client *client, - const struct i2c_device_id *id); - -#endif diff --git a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-3h7_sunny.c b/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-3h7_sunny.c deleted file mode 100644 index 52f6f88..0000000 --- a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-3h7_sunny.c +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Samsung Exynos5 SoC series Sensor driver - * - * - * Copyright (c) 2011 Samsung Electronics Co., Ltd - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "../fimc-is-core.h" -#include "../fimc-is-device-sensor.h" -#include "../fimc-is-resourcemgr.h" -#include "../fimc-is-hw.h" -#include "fimc-is-device-3h7_sunny.h" - -#define SENSOR_NAME "S5K3H7_SUNNY" - -static struct fimc_is_sensor_cfg config_3h7_sunny[] = { - /* 3264x2448@30fps */ - FIMC_IS_SENSOR_CFG(3264, 2448, 30, 15, 0), -}; - -static int sensor_3h7_sunny_init(struct v4l2_subdev *subdev, u32 val) -{ - int ret = 0; - struct fimc_is_module_enum *module; - - BUG_ON(!subdev); - - module = (struct fimc_is_module_enum *)v4l2_get_subdevdata(subdev); - - pr_info("[MOD:D:%d] %s(%d)\n", module->id, __func__, val); - - return ret; -} - -static const struct v4l2_subdev_core_ops core_ops = { - .init = sensor_3h7_sunny_init -}; - -static const struct v4l2_subdev_ops subdev_ops = { - .core = &core_ops -}; - -int sensor_3h7_sunny_probe(struct i2c_client *client, - const struct i2c_device_id *id) -{ - int ret = 0; - struct fimc_is_core *core; - struct v4l2_subdev *subdev_module; - struct fimc_is_module_enum *module; - struct fimc_is_device_sensor *device; - struct sensor_open_extended *ext; - - BUG_ON(!fimc_is_dev); - - core = (struct fimc_is_core *)dev_get_drvdata(fimc_is_dev); - if (!core) { - err("core device is not yet probed"); - return -EPROBE_DEFER; - } - - device = &core->sensor[SENSOR_S5K3H7_SUNNY_INSTANCE]; - - subdev_module = kzalloc(sizeof(struct v4l2_subdev), GFP_KERNEL); - if (!subdev_module) { - err("subdev_module is NULL"); - ret = -ENOMEM; - goto p_err; - } - - module = &device->module_enum[atomic_read(&core->resourcemgr.rsccount_module)]; - atomic_inc(&core->resourcemgr.rsccount_module); - module->id = SENSOR_NAME_S5K3H7_SUNNY; - module->subdev = subdev_module; - module->device = SENSOR_S5K3H7_SUNNY_INSTANCE; - module->client = client; - module->active_width = 3248; - module->active_height = 2438; - module->pixel_width = module->active_width + 16; - module->pixel_height = module->active_height + 10; - module->max_framerate = 30; - module->position = SENSOR_POSITION_REAR; - module->mode = CSI_MODE_CH0_ONLY; - module->lanes = CSI_DATA_LANES_4; - module->sensor_maker = "SLSI"; - module->sensor_name = "S5K3H7"; - module->setfile_name = "setfile_3h7_sunny.bin"; - module->cfgs = ARRAY_SIZE(config_3h7_sunny); - module->cfg = config_3h7_sunny; - module->ops = NULL; - module->private_data = NULL; - - ext = &module->ext; - ext->mipi_lane_num = module->lanes; - ext->I2CSclk = I2C_L0; - - ext->sensor_con.product_name = 0; - ext->sensor_con.peri_type = SE_I2C; - ext->sensor_con.peri_setting.i2c.channel = SENSOR_CONTROL_I2C0; - ext->sensor_con.peri_setting.i2c.slave_address = 0x20; - ext->sensor_con.peri_setting.i2c.speed = 400000; - - ext->actuator_con.product_name = ACTUATOR_NAME_DWXXXX; - ext->actuator_con.peri_type = SE_I2C; - ext->actuator_con.peri_setting.i2c.channel = SENSOR_CONTROL_I2C0; - ext->actuator_con.peri_setting.i2c.slave_address = 0x20; - ext->actuator_con.peri_setting.i2c.speed = 400000; - -#if defined(CONFIG_EXYNOS5260_XYREF_REV0) - ext->flash_con.product_name = FLADRV_NAME_NOTHING; -#else - ext->flash_con.product_name = FLADRV_NAME_AS3643; -#endif - ext->flash_con.peri_type = SE_I2C; - ext->flash_con.peri_setting.gpio.first_gpio_port_no = 5; -#if defined(CONFIG_MACH_XYREF4415) - ext->flash_con.peri_setting.gpio.second_gpio_port_no = 6; -#else - ext->flash_con.peri_setting.gpio.second_gpio_port_no = 8; -#endif - - ext->from_con.product_name = FROMDRV_NAME_NOTHING; - - ext->companion_con.product_name = COMPANION_NAME_NOTHING; - - if (client) - v4l2_i2c_subdev_init(subdev_module, client, &subdev_ops); - else - v4l2_subdev_init(subdev_module, &subdev_ops); - - v4l2_set_subdevdata(subdev_module, module); - v4l2_set_subdev_hostdata(subdev_module, device); - snprintf(subdev_module->name, V4L2_SUBDEV_NAME_SIZE, "sensor-subdev.%d", module->id); - -p_err: - info("%s(%d)\n", __func__, ret); - return ret; -} diff --git a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-3h7_sunny.h b/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-3h7_sunny.h deleted file mode 100644 index 3e0d1c4..0000000 --- a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-3h7_sunny.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Samsung Exynos5 SoC series Sensor driver - * - * - * Copyright (c) 2011 Samsung Electronics Co., Ltd - * - * 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_DEVICE_3H7_SUNNY_H -#define FIMC_IS_DEVICE_3H7_SYNNY_H - -#define SENSOR_S5K3H7_SUNNY_INSTANCE 0 -#define SENSOR_S5K3H7_SUNNY_NAME SENSOR_NAME_S5K3H7_SUNNY - -int sensor_3h7_sunny_probe(struct i2c_client *client, - const struct i2c_device_id *id); - -#endif diff --git a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-3l2.c b/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-3l2.c deleted file mode 100644 index 21c5d04..0000000 --- a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-3l2.c +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Samsung Exynos5 SoC series Sensor driver - * - * - * Copyright (c) 2011 Samsung Electronics Co., Ltd - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "../fimc-is-core.h" -#include "../fimc-is-device-sensor.h" -#include "../fimc-is-resourcemgr.h" -#include "../fimc-is-hw.h" -#include "fimc-is-device-3l2.h" - -#define SENSOR_NAME "S5K3L2" - -static struct fimc_is_sensor_cfg config_3l2[] = { - /* 4144x3106@30fps */ - FIMC_IS_SENSOR_CFG(4144, 3106, 30, 25, 0), - /* 4144x2332@30fps */ - FIMC_IS_SENSOR_CFG(4144, 2332, 30, 25, 1), - /* 2072x1554@24fps */ - FIMC_IS_SENSOR_CFG(2072, 1554, 24, 25, 2), - /* 2072x1166@24fps */ - FIMC_IS_SENSOR_CFG(2072, 1166, 24, 25, 3), - /* 1040x584@120fps */ - FIMC_IS_SENSOR_CFG(1040, 584, 120, 17, 4), - /* 2072x1166@60fps */ - FIMC_IS_SENSOR_CFG(2072, 1166, 60, 19, 5), -}; - -static int sensor_3l2_init(struct v4l2_subdev *subdev, u32 val) -{ - int ret = 0; - struct fimc_is_module_enum *module; - - BUG_ON(!subdev); - - module = (struct fimc_is_module_enum *)v4l2_get_subdevdata(subdev); - - pr_info("[MOD:D:%d] %s(%d)\n", module->id, __func__, val); - - return ret; -} - -static const struct v4l2_subdev_core_ops core_ops = { - .init = sensor_3l2_init -}; - -static const struct v4l2_subdev_ops subdev_ops = { - .core = &core_ops -}; - -int sensor_3l2_probe(struct i2c_client *client, - const struct i2c_device_id *id) -{ - int ret = 0; - struct fimc_is_core *core; - struct v4l2_subdev *subdev_module; - struct fimc_is_module_enum *module; - struct fimc_is_device_sensor *device; - struct sensor_open_extended *ext; - - BUG_ON(!fimc_is_dev); - - core = (struct fimc_is_core *)dev_get_drvdata(fimc_is_dev); - if (!core) { - err("core device is not yet probed"); - return -EPROBE_DEFER; - } - - device = &core->sensor[SENSOR_S5K3L2_INSTANCE]; - - subdev_module = kzalloc(sizeof(struct v4l2_subdev), GFP_KERNEL); - if (!subdev_module) { - err("subdev_module is NULL"); - ret = -ENOMEM; - goto p_err; - } - - module = &device->module_enum[atomic_read(&core->resourcemgr.rsccount_module)]; - atomic_inc(&core->resourcemgr.rsccount_module); - module->id = SENSOR_NAME_S5K3L2; - module->subdev = subdev_module; - module->device = SENSOR_S5K3L2_INSTANCE; - module->client = client; - module->active_width = 4128; - module->active_height = 3096; - module->pixel_width = module->active_width + 16; - module->pixel_height = module->active_height + 10; - module->max_framerate = 120; - module->position = SENSOR_POSITION_REAR; - module->mode = CSI_MODE_CH0_ONLY; - module->lanes = CSI_DATA_LANES_4; - module->sensor_maker = "SLSI"; - module->sensor_name = "S5K3L2"; - module->setfile_name = "setfile_3l2.bin"; - module->cfgs = ARRAY_SIZE(config_3l2); - module->cfg = config_3l2; - module->ops = NULL; - module->private_data = NULL; - - ext = &module->ext; - ext->mipi_lane_num = module->lanes; - ext->I2CSclk = I2C_L0; - - ext->sensor_con.product_name = SENSOR_NAME_S5K3L2; - ext->sensor_con.peri_type = SE_I2C; - ext->sensor_con.peri_setting.i2c.channel = SENSOR_CONTROL_I2C0; - ext->sensor_con.peri_setting.i2c.slave_address = 0x20; - ext->sensor_con.peri_setting.i2c.speed = 400000; - - ext->actuator_con.product_name = ACTUATOR_NAME_DWXXXX; - ext->actuator_con.peri_type = SE_I2C; - ext->actuator_con.peri_setting.i2c.channel = SENSOR_CONTROL_I2C0; - ext->actuator_con.peri_setting.i2c.slave_address = 0x20; - ext->actuator_con.peri_setting.i2c.speed = 400000; - - ext->flash_con.product_name = FLADRV_NAME_AS3643; - ext->flash_con.peri_type = SE_I2C; - ext->flash_con.peri_setting.gpio.first_gpio_port_no = 2; - ext->flash_con.peri_setting.gpio.second_gpio_port_no = 3; - - ext->from_con.product_name = FROMDRV_NAME_NOTHING; - - ext->companion_con.product_name = COMPANION_NAME_NOTHING; - - if (client) - v4l2_i2c_subdev_init(subdev_module, client, &subdev_ops); - else - v4l2_subdev_init(subdev_module, &subdev_ops); - - v4l2_set_subdevdata(subdev_module, module); - v4l2_set_subdev_hostdata(subdev_module, device); - snprintf(subdev_module->name, V4L2_SUBDEV_NAME_SIZE, "sensor-subdev.%d", module->id); - -p_err: - info("%s(%d)\n", __func__, ret); - return ret; -} diff --git a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-3l2.h b/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-3l2.h deleted file mode 100644 index 816dbdd..0000000 --- a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-3l2.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Samsung Exynos5 SoC series Sensor driver - * - * - * Copyright (c) 2011 Samsung Electronics Co., Ltd - * - * 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_DEVICE_3L2_H -#define FIMC_IS_DEVICE_3L2_H - -#define SENSOR_S5K3L2_INSTANCE 0 -#define SENSOR_S5K3L2_NAME SENSOR_NAME_S5K3L2 - -int sensor_3l2_probe(struct i2c_client *client, - const struct i2c_device_id *id); - -#endif diff --git a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-4e5.c b/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-4e5.c deleted file mode 100644 index 25b4443..0000000 --- a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-4e5.c +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Samsung Exynos5 SoC series Sensor driver - * - * - * Copyright (c) 2011 Samsung Electronics Co., Ltd - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "../fimc-is-core.h" -#include "../fimc-is-device-sensor.h" -#include "../fimc-is-resourcemgr.h" -#include "../fimc-is-hw.h" -#include "fimc-is-device-4e5.h" - -#define SENSOR_NAME "S5K4E5" - -static int sensor_4e5_init(struct v4l2_subdev *subdev, u32 val) -{ - int ret = 0; - struct fimc_is_module_enum *module; - - BUG_ON(!subdev); - - module = (struct fimc_is_module_enum *)v4l2_get_subdevdata(subdev); - - pr_info("[MOD:D:%d] %s(%d)\n", module->id, __func__, val); - - return ret; -} - -static const struct v4l2_subdev_core_ops core_ops = { - .init = sensor_4e5_init -}; - -static const struct v4l2_subdev_ops subdev_ops = { - .core = &core_ops -}; - -int sensor_4e5_probe(struct i2c_client *client, - const struct i2c_device_id *id) -{ - int ret = 0; - struct fimc_is_core *core; - struct v4l2_subdev *subdev_module; - struct fimc_is_module_enum *module; - struct fimc_is_device_sensor *device; - struct sensor_open_extended *ext; - - BUG_ON(!fimc_is_dev); - - core = (struct fimc_is_core *)dev_get_drvdata(fimc_is_dev); - if (!core) { - err("core device is not yet probed"); - return -EPROBE_DEFER; - } - - device = &core->sensor[SENSOR_S5K4E5_INSTANCE]; - - subdev_module = kzalloc(sizeof(struct v4l2_subdev), GFP_KERNEL); - if (!subdev_module) { - err("subdev_module is NULL"); - ret = -ENOMEM; - goto p_err; - } - - module = &device->module_enum[atomic_read(&core->resourcemgr.rsccount_module)]; - atomic_inc(&core->resourcemgr.rsccount_module); - module->id = SENSOR_NAME_S5K4E5; - module->subdev = subdev_module; - module->device = SENSOR_S5K4E5_INSTANCE; - module->client = client; - module->pixel_width = 2560 + 16; - module->pixel_height = 1920 + 10; - module->active_width = 2560; - module->active_height = 1920; - module->max_framerate = 30; - module->position = SENSOR_POSITION_REAR; - module->mode = CSI_MODE_CH0_ONLY; - module->lanes = CSI_DATA_LANES_4; - module->sensor_maker = "SLSI"; - module->sensor_name = "S5K4E5"; - module->setfile_name = "setfile_4e5.bin"; - module->cfgs = 0; - module->cfg = NULL; - module->ops = NULL; - module->private_data = NULL; - - ext = &module->ext; - ext->mipi_lane_num = module->lanes; - ext->I2CSclk = I2C_L0; - - ext->sensor_con.product_name = 0; - - ext->actuator_con.product_name = ACTUATOR_NAME_DWXXXX; - ext->actuator_con.peri_type = SE_I2C; - ext->actuator_con.peri_setting.i2c.channel = SENSOR_CONTROL_I2C1; - - ext->flash_con.product_name = FLADRV_NAME_KTD267; - ext->flash_con.peri_type = SE_GPIO; - ext->flash_con.peri_setting.gpio.first_gpio_port_no = 17; - ext->flash_con.peri_setting.gpio.second_gpio_port_no = 16; - - ext->from_con.product_name = FROMDRV_NAME_NOTHING; - - ext->companion_con.product_name = COMPANION_NAME_NOTHING; - - if (client) - v4l2_i2c_subdev_init(subdev_module, client, &subdev_ops); - else - v4l2_subdev_init(subdev_module, &subdev_ops); - - v4l2_set_subdevdata(subdev_module, module); - v4l2_set_subdev_hostdata(subdev_module, device); - snprintf(subdev_module->name, V4L2_SUBDEV_NAME_SIZE, "sensor-subdev.%d", module->id); - -p_err: - info("%s(%d)\n", __func__, ret); - return ret; -} diff --git a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-4e5.h b/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-4e5.h deleted file mode 100644 index 4d41ed0..0000000 --- a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-4e5.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Samsung Exynos5 SoC series Sensor driver - * - * - * Copyright (c) 2011 Samsung Electronics Co., Ltd - * - * 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_DEVICE_4E5_H -#define FIMC_IS_DEVICE_4E5_H - -#define SENSOR_S5K4E5_INSTANCE 0 -#define SENSOR_S5K4E5_NAME SENSOR_NAME_S5K4E5 - -int sensor_4e5_probe(struct i2c_client *client, - const struct i2c_device_id *id); - -#endif diff --git a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-4h5.c b/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-4h5.c deleted file mode 100644 index b12063b..0000000 --- a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-4h5.c +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Samsung Exynos5 SoC series Sensor driver - * - * - * Copyright (c) 2011 Samsung Electronics Co., Ltd - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "../fimc-is-core.h" -#include "../fimc-is-device-sensor.h" -#include "../fimc-is-hw.h" -#include "fimc-is-device-4h5.h" - -#define SENSOR_NAME "S5K4H5" - -static struct fimc_is_sensor_cfg config_4h5[] = { - /* 3280x2458@30fps */ - FIMC_IS_SENSOR_CFG(3280, 2458, 30, 14, 0), - /* 3280x1846@30fps */ - FIMC_IS_SENSOR_CFG(3280, 1846, 30, 11, 1), - /* 1640x924@60fps */ - FIMC_IS_SENSOR_CFG(1640, 924, 60, 14, 2), - /* 816x460@120fps */ - FIMC_IS_SENSOR_CFG(816, 460, 120, 14, 3), -}; - -static int sensor_4h5_init(struct v4l2_subdev *subdev, u32 val) -{ - int ret = 0; - struct fimc_is_module_enum *module; - - BUG_ON(!subdev); - - module = (struct fimc_is_module_enum *)v4l2_get_subdevdata(subdev); - - pr_info("[MOD:D:%d] %s(%d)\n", module->id, __func__, val); - - return ret; -} - -static const struct v4l2_subdev_core_ops core_ops = { - .init = sensor_4h5_init -}; - -static const struct v4l2_subdev_ops subdev_ops = { - .core = &core_ops -}; - -int sensor_4h5_probe(struct i2c_client *client, - const struct i2c_device_id *id) -{ - int ret = 0; - struct fimc_is_core *core; - struct v4l2_subdev *subdev_module; - struct fimc_is_module_enum *module; - struct fimc_is_device_sensor *device; - struct sensor_open_extended *ext; - - BUG_ON(!fimc_is_dev); - - core = (struct fimc_is_core *)dev_get_drvdata(fimc_is_dev); - if (!core) { - err("core device is not yet probed"); - return -EPROBE_DEFER; - } - - device = &core->sensor[SENSOR_S5K4H5_INSTANCE]; - - subdev_module = kzalloc(sizeof(struct v4l2_subdev), GFP_KERNEL); - if (!subdev_module) { - err("subdev_module is NULL"); - ret = -ENOMEM; - goto p_err; - } - - module = &device->module_enum[atomic_read(&core->resourcemgr.rsccount_module)]; - atomic_inc(&core->resourcemgr.rsccount_module); - module->id = SENSOR_NAME_S5K4H5; - module->subdev = subdev_module; - module->device = SENSOR_S5K4H5_INSTANCE; - module->ops = NULL; - module->client = client; - module->active_width = 3264; - module->active_height = 2448; - module->pixel_width = module->active_width + 16; - module->pixel_height = module->active_height + 10; - module->max_framerate = 120; - module->position = SENSOR_POSITION_REAR; - module->mode = CSI_MODE_CH0_ONLY; - module->lanes = CSI_DATA_LANES_4; - module->sensor_maker = "SLSI"; - module->sensor_name = "S5K4H5"; - module->setfile_name = "setfile_4h5.bin"; - module->cfgs = ARRAY_SIZE(config_4h5); - module->cfg = config_4h5; - module->ops = NULL; - module->private_data = NULL; - - ext = &module->ext; - ext->mipi_lane_num = module->lanes; - ext->I2CSclk = I2C_L0; - - ext->sensor_con.product_name = 0; - ext->sensor_con.peri_type = SE_I2C; - ext->sensor_con.peri_setting.i2c.channel = SENSOR_CONTROL_I2C0; - ext->sensor_con.peri_setting.i2c.slave_address = 0x6E; - ext->sensor_con.peri_setting.i2c.speed = 400000; - - ext->actuator_con.product_name = ACTUATOR_NAME_DW9804; - ext->actuator_con.peri_type = SE_I2C; - ext->actuator_con.peri_setting.i2c.channel - = SENSOR_CONTROL_I2C0; - - ext->flash_con.product_name = FLADRV_NAME_RT5033; - ext->flash_con.peri_type = SE_GPIO; - ext->flash_con.peri_setting.gpio.first_gpio_port_no = 8; - ext->flash_con.peri_setting.gpio.second_gpio_port_no = 6; - - /* ext->from_con.product_name = FROMDRV_NAME_W25Q80BW; */ - ext->from_con.product_name = FROMDRV_NAME_NOTHING; - ext->mclk = 0; - ext->mipi_lane_num = 0; - ext->mipi_speed = 0; - ext->fast_open_sensor = 0; - ext->self_calibration_mode = 0; - ext->I2CSclk = I2C_L0; - - ext->companion_con.product_name = COMPANION_NAME_NOTHING; - - if (client) - v4l2_i2c_subdev_init(subdev_module, client, &subdev_ops); - else - v4l2_subdev_init(subdev_module, &subdev_ops); - - v4l2_set_subdevdata(subdev_module, module); - v4l2_set_subdev_hostdata(subdev_module, device); - snprintf(subdev_module->name, V4L2_SUBDEV_NAME_SIZE, "sensor-subdev.%d", module->id); - -p_err: - info("%s(%d)\n", __func__, ret); - return ret; -} diff --git a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-4h5.h b/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-4h5.h deleted file mode 100644 index 24079215..0000000 --- a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-4h5.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Samsung Exynos5 SoC series Sensor driver - * - * - * Copyright (c) 2011 Samsung Electronics Co., Ltd - * - * 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_DEVICE_S5K4H5_H -#define FIMC_IS_DEVICE_S5K4H5_H - -#define SENSOR_S5K4H5_INSTANCE 0 -#define SENSOR_S5K4H5_NAME SENSOR_NAME_S5K4H5 - -int sensor_4h5_probe(struct i2c_client *client, - const struct i2c_device_id *id); - -#endif diff --git a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-6a3.c b/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-6a3.c deleted file mode 100644 index 5693f86..0000000 --- a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-6a3.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Samsung Exynos5 SoC series Sensor driver - * - * - * Copyright (c) 2011 Samsung Electronics Co., Ltd - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "../fimc-is-core.h" -#include "../fimc-is-device-sensor.h" -#include "../fimc-is-resourcemgr.h" -#include "../fimc-is-hw.h" -#include "fimc-is-device-6a3.h" - -#define SENSOR_NAME "S5K6A3" - -static struct fimc_is_sensor_cfg config_6a3[] = { - /* 1412x796@30fps */ - FIMC_IS_SENSOR_CFG(1412, 796, 30, 16, 0), -}; - -static int sensor_6a3_init(struct v4l2_subdev *subdev, u32 val) -{ - int ret = 0; - struct fimc_is_module_enum *module; - - BUG_ON(!subdev); - - module = (struct fimc_is_module_enum *)v4l2_get_subdevdata(subdev); - - pr_info("[MOD:D:%d] %s(%d)\n", module->id, __func__, val); - - return ret; -} - -static const struct v4l2_subdev_core_ops core_ops = { - .init = sensor_6a3_init -}; - -static const struct v4l2_subdev_ops subdev_ops = { - .core = &core_ops -}; - -int sensor_6a3_probe(struct i2c_client *client, - const struct i2c_device_id *id) -{ - int ret = 0; - int enum_idx = 0; - struct fimc_is_core *core; - struct v4l2_subdev *subdev_module; - struct fimc_is_module_enum *module; - struct fimc_is_device_sensor *device; - struct sensor_open_extended *ext; - - BUG_ON(!fimc_is_dev); - - core = (struct fimc_is_core *)dev_get_drvdata(fimc_is_dev); - if (!core) { - err("core device is not yet probed"); - return -EPROBE_DEFER; - } - - device = &core->sensor[SENSOR_S5K6A3_INSTANCE]; - - subdev_module = kzalloc(sizeof(struct v4l2_subdev), GFP_KERNEL); - if (!subdev_module) { - err("subdev_module is NULL"); - ret = -ENOMEM; - goto p_err; - } - - enum_idx = atomic_read(&core->resourcemgr.rsccount_module); - module = &device->module_enum[enum_idx]; - atomic_inc(&core->resourcemgr.rsccount_module); - module->id = SENSOR_S5K6A3_NAME; - module->subdev = subdev_module; - module->device = SENSOR_S5K6A3_INSTANCE; - module->client = client; - module->active_width = 1392; - module->active_height = 1402; - module->pixel_width = module->active_width + 16; - module->pixel_height = module->active_height + 10; - module->max_framerate = 30; - module->position = SENSOR_POSITION_FRONT; - module->mode = CSI_MODE_CH0_ONLY; - module->lanes = CSI_DATA_LANES_1; - module->sensor_maker = "SLSI"; - module->sensor_name = "S5K6A3"; - module->setfile_name = "setfile_6a3.bin"; - module->cfgs = ARRAY_SIZE(config_6a3); - module->cfg = config_6a3; - module->ops = NULL; - module->private_data = NULL; - - ext = &module->ext; - ext->mipi_lane_num = module->lanes; - ext->I2CSclk = I2C_L0; - ext->mipi_settle_line = 18; - - ext->sensor_con.product_name = SENSOR_S5K6A3_NAME; - ext->sensor_con.peri_type = SE_I2C; - ext->sensor_con.peri_setting.i2c.channel = SENSOR_CONTROL_I2C1; - ext->sensor_con.peri_setting.i2c.slave_address = 0x20; - ext->sensor_con.peri_setting.i2c.speed = 400000; - - ext->from_con.product_name = FROMDRV_NAME_NOTHING; - - ext->companion_con.product_name = COMPANION_NAME_NOTHING; - - if (client) - v4l2_i2c_subdev_init(subdev_module, client, &subdev_ops); - else - v4l2_subdev_init(subdev_module, &subdev_ops); - - v4l2_set_subdevdata(subdev_module, module); - v4l2_set_subdev_hostdata(subdev_module, device); - snprintf(subdev_module->name, V4L2_SUBDEV_NAME_SIZE, "sensor-subdev.%d", module->id); - -p_err: - info("%s(%d)\n", __func__, ret); - return ret; -} diff --git a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-6a3.h b/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-6a3.h deleted file mode 100644 index bebfd88..0000000 --- a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-6a3.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Samsung Exynos5 SoC series Sensor driver - * - * - * Copyright (c) 2011 Samsung Electronics Co., Ltd - * - * 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_DEVICE_6A3_H -#define FIMC_IS_DEVICE_6A3_H - -#define SENSOR_S5K6A3_INSTANCE 1 -#define SENSOR_S5K6A3_NAME SENSOR_NAME_S5K6A3 - -int sensor_6a3_probe(struct i2c_client *client, - const struct i2c_device_id *id); - -#endif diff --git a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-6b2.c b/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-6b2.c deleted file mode 100644 index 6db6c49..0000000 --- a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-6b2.c +++ /dev/null @@ -1,785 +0,0 @@ -/* - * Samsung Exynos5 SoC series Sensor driver - * - * - * Copyright (c) 2011 Samsung Electronics Co., Ltd - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef CONFIG_OF -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include - -#include "../fimc-is-core.h" -#include "../fimc-is-device-sensor.h" -#include "../fimc-is-resourcemgr.h" -#include "../fimc-is-hw.h" -#include "fimc-is-device-6b2.h" - -#define SENSOR_NAME "S5K6B2" -#define DEFAULT_SENSOR_WIDTH 184 -#define DEFAULT_SENSOR_HEIGHT 104 -#define SENSOR_MEMSIZE DEFAULT_SENSOR_WIDTH * DEFAULT_SENSOR_HEIGHT - -#define SENSOR_REG_VIS_DURATION_MSB (0x6026) -#define SENSOR_REG_VIS_DURATION_LSB (0x6027) -#define SENSOR_REG_VIS_FRAME_LENGTH_LINE_ALV_MSB (0x4340) -#define SENSOR_REG_VIS_FRAME_LENGTH_LINE_ALV_LSB (0x4341) -#define SENSOR_REG_VIS_LINE_LENGTH_PCLK_ALV_MSB (0x4342) -#define SENSOR_REG_VIS_LINE_LENGTH_PCLK_ALV_LSB (0x4343) -#define SENSOR_REG_VIS_GAIN_RED (0x6029) -#define SENSOR_REG_VIS_GAIN_GREEN (0x602A) -#define SENSOR_REG_VIS_AE_TARGET (0x600A) -#define SENSOR_REG_VIS_AE_SPEED (0x5034) -#define SENSOR_REG_VIS_AE_NUMBER_OF_PIXEL_MSB (0x5030) -#define SENSOR_REG_VIS_AE_NUMBER_OF_PIXEL_LSB (0x5031) -#define SENSOR_REG_VIS_AE_WINDOW_WEIGHT_1x1_2 (0x6000) -#define SENSOR_REG_VIS_AE_WINDOW_WEIGHT_1x3_4 (0x6001) -#define SENSOR_REG_VIS_AE_WINDOW_WEIGHT_2x1_2 (0x6002) -#define SENSOR_REG_VIS_AE_WINDOW_WEIGHT_2x3_4 (0x6003) -#define SENSOR_REG_VIS_AE_WINDOW_WEIGHT_3x1_2 (0x6004) -#define SENSOR_REG_VIS_AE_WINDOW_WEIGHT_3x3_4 (0x6005) -#define SENSOR_REG_VIS_AE_WINDOW_WEIGHT_4x1_2 (0x6006) -#define SENSOR_REG_VIS_AE_WINDOW_WEIGHT_4x3_4 (0x6007) -#define SENSOR_REG_VIS_AE_MANUAL_EXP_MSB (0x5039) -#define SENSOR_REG_VIS_AE_MANUAL_EXP_LSB (0x503A) -#define SENSOR_REG_VIS_AE_MANUAL_ANG_MSB (0x503B) -#define SENSOR_REG_VIS_AE_MANUAL_ANG_LSB (0x503C) -#define SENSOR_REG_VIS_BIT_CONVERTING_MSB (0x602B) -#define SENSOR_REG_VIS_BIT_CONVERTING_LSB (0x7203) -#define SENSOR_REG_VIS_AE_OFF (0x5000) - -static struct fimc_is_sensor_cfg config_6b2[] = { - /* 1936x1090@30fps */ - FIMC_IS_SENSOR_CFG(1936, 1090, 30, 16, 0), - /* 1936x1090@24fps */ - FIMC_IS_SENSOR_CFG(1936, 1090, 24, 13, 1), - /* 1296x730@30fps */ - FIMC_IS_SENSOR_CFG(1296, 730, 30, 13, 2), -}; - -static int sensor_6b2_open(struct v4l2_subdev *sd, - struct v4l2_subdev_fh *fh) -{ - pr_info("%s\n", __func__); - return 0; -} -static int sensor_6b2_close(struct v4l2_subdev *sd, - struct v4l2_subdev_fh *fh) -{ - pr_info("%s\n", __func__); - return 0; -} -static int sensor_6b2_registered(struct v4l2_subdev *sd) -{ - pr_info("%s\n", __func__); - return 0; -} - -static void sensor_6b2_unregistered(struct v4l2_subdev *sd) -{ - pr_info("%s\n", __func__); -} - -static const struct v4l2_subdev_internal_ops internal_ops = { - .open = sensor_6b2_open, - .close = sensor_6b2_close, - .registered = sensor_6b2_registered, - .unregistered = sensor_6b2_unregistered, -}; - -static int sensor_6b2_init(struct v4l2_subdev *subdev, u32 val) -{ - int ret = 0; - struct fimc_is_module_enum *module; - struct fimc_is_module_6b2 *module_6b2; - struct i2c_client *client; - - BUG_ON(!subdev); - - module = (struct fimc_is_module_enum *)v4l2_get_subdevdata(subdev); - module_6b2 = module->private_data; - client = module->client; - - module_6b2->system_clock = 146 * 1000 * 1000; - module_6b2->line_length_pck = 146 * 1000 * 1000; - - pr_info("%s\n", __func__); - /* sensor init */ - /* 8 bit mode */ - fimc_is_sensor_write8(client, 0x7203, 0x40); - fimc_is_sensor_write8(client, 0x602B, 0x02); - fimc_is_sensor_write8(client, 0x702A, 0x3D); - fimc_is_sensor_write8(client, 0x702B, 0xB0); - fimc_is_sensor_write8(client, 0x7030, 0x0E); - fimc_is_sensor_write8(client, 0x7031, 0x2F); - - /* Analog Tuning */ - fimc_is_sensor_write8(client, 0x7067, 0x00); - fimc_is_sensor_write8(client, 0x7073, 0xFF); - fimc_is_sensor_write8(client, 0x7074, 0x22); - - /* Dark Tuning */ - fimc_is_sensor_write8(client, 0x7042, 0x1F); - fimc_is_sensor_write8(client, 0x7403, 0xC0); - fimc_is_sensor_write8(client, 0x7245, 0x04); - fimc_is_sensor_write8(client, 0x7205, 0xA1); - - /* Remove Dark Band */ - fimc_is_sensor_write8(client, 0x7430, 0x07); - fimc_is_sensor_write8(client, 0x705C, 0x7E); - - /* Remove Sun spot */ - fimc_is_sensor_write8(client, 0x702C, 0x3C); - fimc_is_sensor_write8(client, 0x7075, 0x3D); - - /* Remove CFPN */ - fimc_is_sensor_write8(client, 0x7066, 0x0C); - - /* AE setting */ - fimc_is_sensor_write8(client, 0x6000, 0x44); - fimc_is_sensor_write8(client, 0x6001, 0x44); - fimc_is_sensor_write8(client, 0x6002, 0x44); - fimc_is_sensor_write8(client, 0x6003, 0x44); - fimc_is_sensor_write8(client, 0x6004, 0x44); - fimc_is_sensor_write8(client, 0x6005, 0x44); - fimc_is_sensor_write8(client, 0x6006, 0x44); - fimc_is_sensor_write8(client, 0x6007, 0x44); - - /* AE target */ - fimc_is_sensor_write8(client, 0x600A, 0xB4); - - /* speed */ - fimc_is_sensor_write8(client, 0x5034, 0x00); - - /* Cintc_min */ - fimc_is_sensor_write8(client, 0x5017, 0x01); - - /* Number of pixel */ - fimc_is_sensor_write8(client, 0x5030, 0x4A); - fimc_is_sensor_write8(client, 0x5031, 0xC0); - - /* G + R Setting */ - /* Vision Senser Data = 0.5*Gr + 0.5*R */ - fimc_is_sensor_write8(client, 0x6029, 0x02); - fimc_is_sensor_write8(client, 0x602A, 0x02); - - /* For Analog Gain 16x */ - fimc_is_sensor_write8(client, 0x7018, 0xCF); - fimc_is_sensor_write8(client, 0x7019, 0xDB); - fimc_is_sensor_write8(client, 0x702A, 0x8D); - fimc_is_sensor_write8(client, 0x702B, 0x60); - fimc_is_sensor_write8(client, 0x5035, 0x02); - - /* BIT_RATE_MBPS_alv */ - fimc_is_sensor_write8(client, 0x7351, 0x02); - fimc_is_sensor_write8(client, 0x7352, 0x48); - fimc_is_sensor_write8(client, 0x7353, 0x00); - fimc_is_sensor_write8(client, 0x7354, 0x00); - - fimc_is_sensor_write8(client, 0x7339, 0x03); - - /* Analog gain */ - fimc_is_sensor_write8(client, 0x4204, 0x00); - fimc_is_sensor_write8(client, 0x4205, 0x32); - - /* frame rate - default 10fps*/ - fimc_is_sensor_write8(client, SENSOR_REG_VIS_DURATION_MSB, 0x00); - fimc_is_sensor_write8(client, SENSOR_REG_VIS_DURATION_LSB, 0x6A); - - pr_info("[MOD:D:%d] %s(%d)\n", module->id, __func__, val); - - return ret; -} - -static const struct v4l2_subdev_core_ops core_ops = { - .init = sensor_6b2_init -}; - -static int sensor_6b2_s_stream(struct v4l2_subdev *subdev, int enable) -{ - int ret = 0; - struct fimc_is_module_enum *sensor; - - pr_info("%s\n", __func__); - - sensor = (struct fimc_is_module_enum *)v4l2_get_subdevdata(subdev); - if (!sensor) { - err("sensor is NULL"); - ret = -EINVAL; - goto p_err; - } - - if (enable) { - ret = CALL_MOPS(sensor, stream_on, subdev); - if (ret) { - err("s_duration is fail(%d)", ret); - goto p_err; - } - } else { - ret = CALL_MOPS(sensor, stream_off, subdev); - if (ret) { - err("s_duration is fail(%d)", ret); - goto p_err; - } - } - -p_err: - return 0; -} - -static int sensor_6b2_s_param(struct v4l2_subdev *subdev, struct v4l2_streamparm *param) -{ - int ret = 0; - struct fimc_is_module_enum *sensor; - struct v4l2_captureparm *cp; - struct v4l2_fract *tpf; - u64 duration; - - BUG_ON(!subdev); - BUG_ON(!param); - - pr_info("%s\n", __func__); - - cp = ¶m->parm.capture; - tpf = &cp->timeperframe; - - if (!tpf->denominator) { - err("denominator is 0"); - ret = -EINVAL; - goto p_err; - } - - if (!tpf->numerator) { - err("numerator is 0"); - ret = -EINVAL; - goto p_err; - } - - duration = (u64)(tpf->numerator * 1000 * 1000 * 1000) / - (u64)(tpf->denominator); - - sensor = (struct fimc_is_module_enum *)v4l2_get_subdevdata(subdev); - if (!sensor) { - err("sensor is NULL"); - ret = -EINVAL; - goto p_err; - } - - ret = CALL_MOPS(sensor, s_duration, subdev, duration); - if (ret) { - err("s_duration is fail(%d)", ret); - goto p_err; - } - -p_err: - return ret; -} - -static int sensor_6b2_s_format(struct v4l2_subdev *subdev, struct v4l2_mbus_framefmt *fmt) -{ - /* TODO */ - return 0; -} - -static const struct v4l2_subdev_video_ops video_ops = { - .s_stream = sensor_6b2_s_stream, - .s_parm = sensor_6b2_s_param, - .s_mbus_fmt = sensor_6b2_s_format -}; - -static const struct v4l2_subdev_ops subdev_ops = { - .core = &core_ops, - .video = &video_ops -}; - -int sensor_6b2_stream_on(struct v4l2_subdev *subdev) -{ - int ret = 0; - struct fimc_is_module_enum *sensor; - struct i2c_client *client; - - BUG_ON(!subdev); - - sensor = (struct fimc_is_module_enum *)v4l2_get_subdevdata(subdev); - if (unlikely(!sensor)) { - err("sensor is NULL"); - ret = -EINVAL; - goto p_err; - } - - client = sensor->client; - if (unlikely(!client)) { - err("client is NULL"); - ret = -EINVAL; - goto p_err; - } - - ret = fimc_is_sensor_write8(client, 0x4100, 1); - if (ret < 0) { - err("fimc_is_sensor_write8 is fail(%d)", ret); - goto p_err; - } - -p_err: - return ret; -} - -int sensor_6b2_stream_off(struct v4l2_subdev *subdev) -{ - int ret = 0; - struct fimc_is_module_enum *sensor; - struct i2c_client *client; - - BUG_ON(!subdev); - - sensor = (struct fimc_is_module_enum *)v4l2_get_subdevdata(subdev); - if (unlikely(!sensor)) { - err("sensor is NULL"); - ret = -EINVAL; - goto p_err; - } - - client = sensor->client; - if (unlikely(!client)) { - err("client is NULL"); - ret = -EINVAL; - goto p_err; - } - - ret = fimc_is_sensor_write8(client, 0x4100, 0); - if (ret < 0) { - err("fimc_is_sensor_write8 is fail(%d)", ret); - goto p_err; - } - -p_err: - return ret; -} - -/* - * @ brief - * frame duration time - * @ unit - * nano second - * @ remarks - */ -int sensor_6b2_s_duration(struct v4l2_subdev *subdev, u64 duration) -{ - int ret = 0; - u8 value[2]; - u32 framerate, result; - struct fimc_is_module_enum *sensor; - struct i2c_client *client; - - BUG_ON(!subdev); - - pr_info("%s\n", __func__); - - sensor = (struct fimc_is_module_enum *)v4l2_get_subdevdata(subdev); - if (unlikely(!sensor)) { - err("sensor is NULL"); - ret = -EINVAL; - goto p_err; - } - - client = sensor->client; - if (unlikely(!client)) { - err("client is NULL"); - ret = -EINVAL; - goto p_err; - } - - framerate = 1000 * 1000 * 1000 / (u32)duration; - result = 1060 / framerate; - value[0] = result & 0xFF; - value[1] = (result >> 8) & 0xFF; - - fimc_is_sensor_write8(client, SENSOR_REG_VIS_DURATION_MSB, value[1]); - fimc_is_sensor_write8(client, SENSOR_REG_VIS_DURATION_LSB, value[0]); - -p_err: - return ret; -} - -int sensor_6b2_g_min_duration(struct v4l2_subdev *subdev) -{ - int ret = 0; - return ret; -} - -int sensor_6b2_g_max_duration(struct v4l2_subdev *subdev) -{ - int ret = 0; - return ret; -} - -int sensor_6b2_s_exposure(struct v4l2_subdev *subdev, u64 exposure) -{ - int ret = 0; - u8 value; - struct fimc_is_module_enum *sensor; - struct i2c_client *client; - - BUG_ON(!subdev); - - pr_info("%s(%d)\n", __func__, (u32)exposure); - - sensor = (struct fimc_is_module_enum *)v4l2_get_subdevdata(subdev); - if (unlikely(!sensor)) { - err("sensor is NULL"); - ret = -EINVAL; - goto p_err; - } - - client = sensor->client; - if (unlikely(!client)) { - err("client is NULL"); - ret = -EINVAL; - goto p_err; - } - - value = exposure & 0xFF; - - fimc_is_sensor_write8(client, SENSOR_REG_VIS_AE_TARGET, value); - -p_err: - return ret; -} - -int sensor_6b2_g_min_exposure(struct v4l2_subdev *subdev) -{ - int ret = 0; - return ret; -} - -int sensor_6b2_g_max_exposure(struct v4l2_subdev *subdev) -{ - int ret = 0; - return ret; -} - -int sensor_6b2_s_again(struct v4l2_subdev *subdev, u64 sensitivity) -{ - int ret = 0; - - pr_info("%s\n", __func__); - - return ret; -} - -int sensor_6b2_g_min_again(struct v4l2_subdev *subdev) -{ - int ret = 0; - return ret; -} - -int sensor_6b2_g_max_again(struct v4l2_subdev *subdev) -{ - int ret = 0; - return ret; -} - -int sensor_6b2_s_dgain(struct v4l2_subdev *subdev) -{ - int ret = 0; - return ret; -} - -int sensor_6b2_g_min_dgain(struct v4l2_subdev *subdev) -{ - int ret = 0; - return ret; -} - -int sensor_6b2_g_max_dgain(struct v4l2_subdev *subdev) -{ - int ret = 0; - return ret; -} - -struct fimc_is_sensor_ops module_6b2_ops = { - .stream_on = sensor_6b2_stream_on, - .stream_off = sensor_6b2_stream_off, - .s_duration = sensor_6b2_s_duration, - .g_min_duration = sensor_6b2_g_min_duration, - .g_max_duration = sensor_6b2_g_max_duration, - .s_exposure = sensor_6b2_s_exposure, - .g_min_exposure = sensor_6b2_g_min_exposure, - .g_max_exposure = sensor_6b2_g_max_exposure, - .s_again = sensor_6b2_s_again, - .g_min_again = sensor_6b2_g_min_again, - .g_max_again = sensor_6b2_g_max_again, - .s_dgain = sensor_6b2_s_dgain, - .g_min_dgain = sensor_6b2_g_min_dgain, - .g_max_dgain = sensor_6b2_g_max_dgain -}; - -#ifdef CONFIG_OF -static int sensor_6b2_power_setpin(struct device *dev) -{ - struct exynos_platform_fimc_is_sensor *pdata; - struct device_node *dnode; - int gpio_none = 0; - int gpio_reset = 0, gpio_standby = 0; - int gpios_cam_en = 0; - - BUG_ON(!dev); - BUG_ON(!dev->platform_data); - - dnode = dev->of_node; - pdata = dev->platform_data; - - gpio_reset = of_get_named_gpio(dnode, "gpio_reset", 0); - if (!gpio_is_valid(gpio_reset)) { - err("failed to get PIN_RESET"); - return -EINVAL; - } else { - gpio_request_one(gpio_reset, GPIOF_OUT_INIT_LOW, "CAM_GPIO_OUTPUT_LOW"); - gpio_free(gpio_reset); - } - - gpios_cam_en = of_get_named_gpio(dnode, "gpios_cam_en", 0); - if (!gpio_is_valid(gpios_cam_en)) { - err("failed to get front cam en gpio"); - } else { - gpio_request_one(gpios_cam_en, GPIOF_OUT_INIT_LOW, "CAM_GPIO_OUTPUT_LOW"); - gpio_free(gpios_cam_en); - } - - gpio_standby = of_get_named_gpio(dnode, "gpio_standby", 0); - if (!gpio_is_valid(gpio_standby)) { - err("failed to get gpio_standby"); - } else { - gpio_request_one(gpio_standby, GPIOF_OUT_INIT_LOW, "CAM_GPIO_OUTPUT_LOW"); - gpio_free(gpio_standby); - } - - /* FRONT CAMERA - POWER ON */ - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 0, gpio_standby, 0, NULL, 0, PIN_OUTPUT_LOW); - if (gpio_is_valid(gpios_cam_en)) { - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 1, gpios_cam_en, 0, NULL, 0, PIN_OUTPUT_HIGH); - } else { - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 1, gpio_none, 0, "VT_CAM_2.8V", 0, PIN_REGULATOR_ON); - } - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 2, gpio_none, 0, "VT_CAM_1.8V", 0, PIN_REGULATOR_ON); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 3, gpio_none, 0, "VT_CAM_1.2V", 1000, PIN_REGULATOR_ON); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 4, gpio_reset, 0, NULL, 0, PIN_OUTPUT_HIGH); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 5, gpio_none, 0, "ch", 0, PIN_FUNCTION); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 6, gpio_none, 0, NULL, 0, PIN_END); - - /* FRONT CAMERA - POWER OFF */ - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 0, gpio_standby, 0, NULL, 0, PIN_OUTPUT_LOW); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 1, gpio_none, 0, "off", 0, PIN_FUNCTION); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 2, gpio_reset, 0, NULL, 0, PIN_OUTPUT_LOW); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 3, gpio_none, 0, "VT_CAM_1.2V", 0, PIN_REGULATOR_OFF); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 4, gpio_none, 0, "VT_CAM_1.8V", 0, PIN_REGULATOR_OFF); - if (gpio_is_valid(gpios_cam_en)) { - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 5, gpios_cam_en, 0, NULL, 0, PIN_OUTPUT_LOW); - } else { - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 5, gpio_none, 0, "VT_CAM_2.8V", 0, PIN_REGULATOR_OFF); - } - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 6, gpio_none, 0, NULL, 0, PIN_END); - - /* VISION CAMERA - POWER ON */ - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_ON, 0, gpio_reset, 0, NULL, 0, PIN_OUTPUT_LOW); - if (gpio_is_valid(gpios_cam_en)) { - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_ON, 1, gpios_cam_en, 0, NULL, 0, PIN_OUTPUT_HIGH); - } else { - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_ON, 1, gpio_none, 0, "VT_CAM_2.8V", 0, PIN_REGULATOR_ON); - } - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_ON, 2, gpio_none, 0, "VT_CAM_1.8V", 0, PIN_REGULATOR_ON); - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_ON, 3, gpio_none, 0, "VT_CAM_1.2V", 1000, PIN_REGULATOR_ON); - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_ON, 4, gpio_standby, 0, NULL, 0, PIN_OUTPUT_HIGH); - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_ON, 5, gpio_none, 0, "ch", 0, PIN_FUNCTION); - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_ON, 6, gpio_none, 0, NULL, 0, PIN_END); - - /* VISION CAMERA - POWER OFF */ - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_OFF, 0, gpio_reset, 0, NULL, 0, PIN_OUTPUT_LOW); - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_OFF, 1, gpio_none, 0, "off", 0, PIN_FUNCTION); - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_OFF, 2, gpio_standby, 0, NULL, 0, PIN_OUTPUT_LOW); - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_OFF, 3, gpio_none, 0, "VT_CAM_1.2V", 0, PIN_REGULATOR_OFF); - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_OFF, 4, gpio_none, 0, "VT_CAM_1.8V", 0, PIN_REGULATOR_OFF); - if (gpio_is_valid(gpios_cam_en)) { - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_OFF, 5, gpios_cam_en, 0, NULL, 0, PIN_OUTPUT_LOW); - } else { - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_OFF, 5, gpio_none, 0, "VT_CAM_2.8V", 0, PIN_REGULATOR_OFF); - } - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_OFF, 6, gpio_none, 0, NULL, 0, PIN_END); - - return 0; -} -#endif - -int sensor_6b2_probe(struct i2c_client *client, - const struct i2c_device_id *id) -{ - int ret = 0; - struct fimc_is_core *core; - struct v4l2_subdev *subdev_module; - struct fimc_is_module_enum *module; - struct fimc_is_device_sensor *device; - struct sensor_open_extended *ext; - static bool probe_retried = false; - - if (!fimc_is_dev) - goto probe_defer; - - core = (struct fimc_is_core *)dev_get_drvdata(fimc_is_dev); - if (!core) { - err("core device is not yet probed"); - return -EPROBE_DEFER; - } - - device = &core->sensor[SENSOR_S5K6B2_INSTANCE]; - - subdev_module = kzalloc(sizeof(struct v4l2_subdev), GFP_KERNEL); - if (!subdev_module) { - err("subdev_module is NULL"); - ret = -ENOMEM; - goto p_err; - } - - /* S5K6B2 */ - module = &device->module_enum[atomic_read(&core->resourcemgr.rsccount_module)]; - atomic_inc(&core->resourcemgr.rsccount_module); - module->id = SENSOR_S5K6B2_NAME; - module->subdev = subdev_module; - module->device = SENSOR_S5K6B2_INSTANCE; - module->ops = &module_6b2_ops; - module->client = client; - module->active_width = 1920; - module->active_height = 1080; - module->pixel_width = module->active_width + 16; - module->pixel_height = module->active_height + 10; - module->max_framerate = 30; - module->position = SENSOR_POSITION_FRONT; - module->mode = CSI_MODE_CH0_ONLY; - module->lanes = CSI_DATA_LANES_1; - module->sensor_maker = "SLSI"; - module->sensor_name = "S5K6B2"; - module->setfile_name = "setfile_6b2.bin"; - module->cfgs = ARRAY_SIZE(config_6b2); - module->cfg = config_6b2; - module->private_data = kzalloc(sizeof(struct fimc_is_module_6b2), GFP_KERNEL); - if (!module->private_data) { - err("private_data is NULL"); - ret = -ENOMEM; - kfree(subdev_module); - goto p_err; - } -#ifdef CONFIG_OF - module->power_setpin = sensor_6b2_power_setpin; -#endif - ext = &module->ext; - ext->mipi_lane_num = module->lanes; - ext->I2CSclk = I2C_L0; - ext->sensor_con.product_name = SENSOR_NAME_S5K6B2; - ext->sensor_con.peri_type = SE_I2C; - ext->sensor_con.peri_setting.i2c.channel = SENSOR_CONTROL_I2C1; - ext->sensor_con.peri_setting.i2c.slave_address = 0; - ext->sensor_con.peri_setting.i2c.speed = 400000; - - ext->from_con.product_name = FROMDRV_NAME_NOTHING; - - ext->companion_con.product_name = COMPANION_NAME_NOTHING; - - if (client) { - v4l2_i2c_subdev_init(subdev_module, client, &subdev_ops); - subdev_module->internal_ops = &internal_ops; - } else { - v4l2_subdev_init(subdev_module, &subdev_ops); - } - - v4l2_set_subdevdata(subdev_module, module); - v4l2_set_subdev_hostdata(subdev_module, device); - snprintf(subdev_module->name, V4L2_SUBDEV_NAME_SIZE, "sensor-subdev.%d", module->id); - -p_err: - info("%s(%d)\n", __func__, ret); - return ret; - -probe_defer: - if (probe_retried) { - err("probe has already been retried!!"); - BUG(); - } - - probe_retried = true; - err("core device is not yet probed"); - return -EPROBE_DEFER; -} - -static int sensor_6b2_remove(struct i2c_client *client) -{ - int ret = 0; - return ret; -} - -#ifdef CONFIG_OF -static const struct of_device_id exynos_fimc_is_sensor_6b2_match[] = { - { - .compatible = "samsung,exynos5-fimc-is-sensor-6b2", - }, - {}, -}; -#endif - -static const struct i2c_device_id sensor_6b2_idt[] = { - { SENSOR_NAME, 0 }, -}; - -static struct i2c_driver sensor_6b2_driver = { - .driver = { - .name = SENSOR_NAME, - .owner = THIS_MODULE, -#ifdef CONFIG_OF - .of_match_table = exynos_fimc_is_sensor_6b2_match -#endif - }, - .probe = sensor_6b2_probe, - .remove = sensor_6b2_remove, - .id_table = sensor_6b2_idt -}; - -static int __init sensor_6b2_load(void) -{ - return i2c_add_driver(&sensor_6b2_driver); -} - -static void __exit sensor_6b2_unload(void) -{ - i2c_del_driver(&sensor_6b2_driver); -} - -module_init(sensor_6b2_load); -module_exit(sensor_6b2_unload); - -MODULE_AUTHOR("Gilyeon lim"); -MODULE_DESCRIPTION("Sensor 6B2 driver"); -MODULE_LICENSE("GPL v2"); diff --git a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-6b2.h b/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-6b2.h deleted file mode 100644 index 284f08a..0000000 --- a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-6b2.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Samsung Exynos5 SoC series Sensor driver - * - * - * Copyright (c) 2011 Samsung Electronics Co., Ltd - * - * 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_DEVICE_6B2_H -#define FIMC_IS_DEVICE_6B2_H - -#define SENSOR_S5K6B2_INSTANCE 1 -#define SENSOR_S5K6B2_NAME SENSOR_NAME_S5K6B2 - -struct fimc_is_module_6b2 { - u16 vis_duration; - u16 frame_length_line; - u32 line_length_pck; - u32 system_clock; -}; - -int sensor_6b2_probe(struct i2c_client *client, - const struct i2c_device_id *id); - -#endif diff --git a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-6d1.c b/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-6d1.c index c8e2e6e..d8385b3 100644 --- a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-6d1.c +++ b/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-6d1.c @@ -23,9 +23,7 @@ #include #include #include -#ifdef CONFIG_OF #include -#endif #include #include #include @@ -213,24 +211,6 @@ static struct fimc_is_sensor_cfg config_6d1[] = { FIMC_IS_SENSOR_CFG(2576, 1456, 30, 14, 0), /* 2576x1456@24fps */ FIMC_IS_SENSOR_CFG(2576, 1456, 24, 14, 1), -#if 0 - /* 1924x1082@30fps */ - FIMC_IS_SENSOR_CFG(1924, 1082, 30, 16, 1), - /* 1444x1082@30fps */ - FIMC_IS_SENSOR_CFG(1444, 1082, 30, 16, 2), - /* 1084x1082@30fps */ - FIMC_IS_SENSOR_CFG(1084, 1082, 30, 16, 3), - /* 964x542@30fps */ - FIMC_IS_SENSOR_CFG(964, 542, 30, 16, 4), - /* 724x542@30fps */ - FIMC_IS_SENSOR_CFG(724, 542, 30, 16, 5), - /* 544x542@30fps */ - FIMC_IS_SENSOR_CFG(544, 542, 30, 16, 6), - /* 320x180@10fps : only for vision(settle) */ - FIMC_IS_SENSOR_CFG(320, 180, 10, 4, 6), - /* 1936x1090@24fps */ - FIMC_IS_SENSOR_CFG(1936, 1090, 24, 13, 7), -#endif }; static int sensor_6d1_open(struct v4l2_subdev *sd, @@ -615,7 +595,6 @@ struct fimc_is_sensor_ops module_6d1_ops = { .g_max_dgain = sensor_6d1_g_max_dgain }; -#ifdef CONFIG_OF static int sensor_6d1_power_setpin(struct device *dev) { int gpio_none = 0, gpio_reset = 0, gpio_standby = 0; @@ -692,7 +671,6 @@ static int sensor_6d1_power_setpin(struct device *dev) return 0; } -#endif int sensor_6d1_probe(struct i2c_client *client, const struct i2c_device_id *id) @@ -751,9 +729,7 @@ int sensor_6d1_probe(struct i2c_client *client, kfree(subdev_module); goto p_err; } -#ifdef CONFIG_OF module->power_setpin = sensor_6d1_power_setpin; -#endif ext = &module->ext; ext->mipi_lane_num = module->lanes; ext->I2CSclk = I2C_L0; @@ -799,14 +775,12 @@ static int sensor_6d1_remove(struct i2c_client *client) return ret; } -#ifdef CONFIG_OF static const struct of_device_id exynos_fimc_is_sensor_6d1_match[] = { { .compatible = "samsung,exynos5-fimc-is-sensor-6d1", }, {}, }; -#endif static const struct i2c_device_id sensor_6d1_idt[] = { { SENSOR_NAME, 0 }, @@ -816,9 +790,7 @@ static struct i2c_driver sensor_6d1_driver = { .driver = { .name = SENSOR_NAME, .owner = THIS_MODULE, -#ifdef CONFIG_OF .of_match_table = exynos_fimc_is_sensor_6d1_match -#endif }, .probe = sensor_6d1_probe, .remove = sensor_6d1_remove, diff --git a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-8b1.c b/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-8b1.c deleted file mode 100644 index 936bf4c..0000000 --- a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-8b1.c +++ /dev/null @@ -1,850 +0,0 @@ -/* - * Samsung Exynos5 SoC series Sensor driver - * - * - * Copyright (c) 2011 Samsung Electronics Co., Ltd - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef CONFIG_OF -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include - -#include "../fimc-is-core.h" -#include "../fimc-is-device-sensor.h" -#include "../fimc-is-resourcemgr.h" -#include "../fimc-is-hw.h" -#include "fimc-is-device-8b1.h" - -#define SENSOR_NAME "S5K8B1" -#define DEFAULT_SENSOR_WIDTH 184 -#define DEFAULT_SENSOR_HEIGHT 104 -#define SENSOR_MEMSIZE DEFAULT_SENSOR_WIDTH * DEFAULT_SENSOR_HEIGHT - -#define SENSOR_REG_VIS_DURATION_MSB (0x6026) -#define SENSOR_REG_VIS_DURATION_LSB (0x6027) -#define SENSOR_REG_VIS_FRAME_LENGTH_LINE_ALV_MSB (0x4340) -#define SENSOR_REG_VIS_FRAME_LENGTH_LINE_ALV_LSB (0x4341) -#define SENSOR_REG_VIS_LINE_LENGTH_PCLK_ALV_MSB (0x4342) -#define SENSOR_REG_VIS_LINE_LENGTH_PCLK_ALV_LSB (0x4343) -#define SENSOR_REG_VIS_GAIN_RED (0x6029) -#define SENSOR_REG_VIS_GAIN_GREEN (0x602A) -#define SENSOR_REG_VIS_AE_TARGET (0x600A) -#define SENSOR_REG_VIS_AE_SPEED (0x5034) -#define SENSOR_REG_VIS_AE_NUMBER_OF_PIXEL_MSB (0x5030) -#define SENSOR_REG_VIS_AE_NUMBER_OF_PIXEL_LSB (0x5031) -#define SENSOR_REG_VIS_AE_WINDOW_WEIGHT_1x1_2 (0x6000) -#define SENSOR_REG_VIS_AE_WINDOW_WEIGHT_1x3_4 (0x6001) -#define SENSOR_REG_VIS_AE_WINDOW_WEIGHT_2x1_2 (0x6002) -#define SENSOR_REG_VIS_AE_WINDOW_WEIGHT_2x3_4 (0x6003) -#define SENSOR_REG_VIS_AE_WINDOW_WEIGHT_3x1_2 (0x6004) -#define SENSOR_REG_VIS_AE_WINDOW_WEIGHT_3x3_4 (0x6005) -#define SENSOR_REG_VIS_AE_WINDOW_WEIGHT_4x1_2 (0x6006) -#define SENSOR_REG_VIS_AE_WINDOW_WEIGHT_4x3_4 (0x6007) -#define SENSOR_REG_VIS_AE_MANUAL_EXP_MSB (0x5039) -#define SENSOR_REG_VIS_AE_MANUAL_EXP_LSB (0x503A) -#define SENSOR_REG_VIS_AE_MANUAL_ANG_MSB (0x503B) -#define SENSOR_REG_VIS_AE_MANUAL_ANG_LSB (0x503C) -#define SENSOR_REG_VIS_BIT_CONVERTING_MSB (0x602B) -#define SENSOR_REG_VIS_BIT_CONVERTING_LSB (0x7203) -#define SENSOR_REG_VIS_AE_OFF (0x5000) - -static struct fimc_is_sensor_cfg config_8b1[] = { - /* 1936x1090@30fps */ - FIMC_IS_SENSOR_CFG(1936, 1090, 30, 16, 0), - /* 1924x1082@30fps */ - FIMC_IS_SENSOR_CFG(1924, 1082, 30, 16, 1), - /* 1444x1082@30fps */ - FIMC_IS_SENSOR_CFG(1444, 1082, 30, 16, 2), - /* 1084x1082@30fps */ - FIMC_IS_SENSOR_CFG(1084, 1082, 30, 16, 3), - /* 964x542@30fps */ - FIMC_IS_SENSOR_CFG(964, 542, 30, 16, 4), - /* 724x542@30fps */ - FIMC_IS_SENSOR_CFG(724, 542, 30, 16, 5), - /* 544x542@30fps */ - FIMC_IS_SENSOR_CFG(544, 542, 30, 16, 6), - /* 320x180@10fps : only for vision(settle) */ - FIMC_IS_SENSOR_CFG(320, 180, 10, 4, 6), - /* 1936x1090@24fps */ - FIMC_IS_SENSOR_CFG(1936, 1090, 24, 13, 7), -}; - -static int sensor_8b1_open(struct v4l2_subdev *sd, - struct v4l2_subdev_fh *fh) -{ - pr_info("%s\n", __func__); - return 0; -} -static int sensor_8b1_close(struct v4l2_subdev *sd, - struct v4l2_subdev_fh *fh) -{ - pr_info("%s\n", __func__); - return 0; -} -static int sensor_8b1_registered(struct v4l2_subdev *sd) -{ - pr_info("%s\n", __func__); - return 0; -} - -static void sensor_8b1_unregistered(struct v4l2_subdev *sd) -{ - pr_info("%s\n", __func__); -} - -static const struct v4l2_subdev_internal_ops internal_ops = { - .open = sensor_8b1_open, - .close = sensor_8b1_close, - .registered = sensor_8b1_registered, - .unregistered = sensor_8b1_unregistered, -}; - -static int sensor_8b1_init(struct v4l2_subdev *subdev, u32 val) -{ - int ret = 0; - struct fimc_is_module_enum *module; - struct fimc_is_module_8b1 *module_8b1; - struct i2c_client *client; - - BUG_ON(!subdev); - - module = (struct fimc_is_module_enum *)v4l2_get_subdevdata(subdev); - module_8b1 = module->private_data; - client = module->client; - - module_8b1->system_clock = 146 * 1000 * 1000; - module_8b1->line_length_pck = 146 * 1000 * 1000; - - pr_info("%s\n", __func__); - /* sensor init */ - fimc_is_sensor_write8(client, 0x4200, 0x01); - fimc_is_sensor_write8(client, 0x4201, 0x24); - fimc_is_sensor_write8(client, 0x4305, 0x06); - fimc_is_sensor_write8(client, 0x4307, 0xC0); - fimc_is_sensor_write8(client, 0x4342, 0x03); - - fimc_is_sensor_write8(client, 0x4343, 0x90); - fimc_is_sensor_write8(client, 0x4345, 0x08); - fimc_is_sensor_write8(client, 0x4347, 0x08); - fimc_is_sensor_write8(client, 0x4348, 0x07); - fimc_is_sensor_write8(client, 0x4349, 0x83); /* 10 */ - - fimc_is_sensor_write8(client, 0x434A, 0x04); - fimc_is_sensor_write8(client, 0x434B, 0x3A); - fimc_is_sensor_write8(client, 0x434C, 0x01); - fimc_is_sensor_write8(client, 0x434D, 0x40); - fimc_is_sensor_write8(client, 0x434E, 0x00); - - fimc_is_sensor_write8(client, 0x434F, 0xB4); - fimc_is_sensor_write8(client, 0x4381, 0x01); - fimc_is_sensor_write8(client, 0x4383, 0x05); - fimc_is_sensor_write8(client, 0x4385, 0x06); - fimc_is_sensor_write8(client, 0x4387, 0x06); /* 20 */ - - fimc_is_sensor_write8(client, 0x5004, 0x01); - fimc_is_sensor_write8(client, 0x5005, 0x1E); -#ifdef VISION_30FPS - fimc_is_sensor_write8(client, 0x5014, 0x05); - fimc_is_sensor_write8(client, 0x5015, 0x73); -#else - fimc_is_sensor_write8(client, 0x5014, 0x13); - fimc_is_sensor_write8(client, 0x5015, 0x33); -#endif - fimc_is_sensor_write8(client, 0x5016, 0x00); - - fimc_is_sensor_write8(client, 0x5017, 0x02); - fimc_is_sensor_write8(client, 0x5030, 0x0E); - fimc_is_sensor_write8(client, 0x5031, 0x10); - fimc_is_sensor_write8(client, 0x5034, 0x00); - fimc_is_sensor_write8(client, 0x5035, 0x02); /* 30 */ - - fimc_is_sensor_write8(client, 0x5036, 0x00); - fimc_is_sensor_write8(client, 0x5037, 0x04); - fimc_is_sensor_write8(client, 0x5038, 0xC0); - fimc_is_sensor_write8(client, 0x503D, 0x20); - fimc_is_sensor_write8(client, 0x503E, 0x70); - - fimc_is_sensor_write8(client, 0x503F, 0x02); - fimc_is_sensor_write8(client, 0x600A, 0x3A); - fimc_is_sensor_write8(client, 0x600E, 0x05); - fimc_is_sensor_write8(client, 0x6014, 0x27); - fimc_is_sensor_write8(client, 0x6015, 0x1D); /* 40 */ - - fimc_is_sensor_write8(client, 0x6018, 0x01); - fimc_is_sensor_write8(client, 0x6026, 0x00); -#ifdef VISION_30FPS - fimc_is_sensor_write8(client, 0x6027, 0x1B); -#else - fimc_is_sensor_write8(client, 0x6027, 0x52); -#endif - fimc_is_sensor_write8(client, 0x6029, 0x08); - fimc_is_sensor_write8(client, 0x602A, 0x08); - - fimc_is_sensor_write8(client, 0x602B, 0x00); - fimc_is_sensor_write8(client, 0x602c, 0x00); - fimc_is_sensor_write8(client, 0x6032, 0x63); - fimc_is_sensor_write8(client, 0x6033, 0x94); - fimc_is_sensor_write8(client, 0x7007, 0x18); /* 50 */ - - fimc_is_sensor_write8(client, 0x7015, 0x28); - fimc_is_sensor_write8(client, 0x7016, 0x2C); - fimc_is_sensor_write8(client, 0x7027, 0x14); - fimc_is_sensor_write8(client, 0x7028, 0x3C); - fimc_is_sensor_write8(client, 0x7029, 0x02); - - fimc_is_sensor_write8(client, 0x702A, 0x02); - fimc_is_sensor_write8(client, 0x703A, 0x04); - fimc_is_sensor_write8(client, 0x703B, 0x36); - fimc_is_sensor_write8(client, 0x7042, 0x04); - fimc_is_sensor_write8(client, 0x7043, 0x36); /* 60 */ - - fimc_is_sensor_write8(client, 0x7058, 0x6F); - fimc_is_sensor_write8(client, 0x705A, 0x01); - fimc_is_sensor_write8(client, 0x705C, 0x40); - fimc_is_sensor_write8(client, 0x7060, 0x07); - fimc_is_sensor_write8(client, 0x7061, 0x40); - - fimc_is_sensor_write8(client, 0x7064, 0x43); - fimc_is_sensor_write8(client, 0x706D, 0x77); - fimc_is_sensor_write8(client, 0x706E, 0xFA); - fimc_is_sensor_write8(client, 0x7070, 0x0A); - fimc_is_sensor_write8(client, 0x7073, 0x04); /* 70 */ - - fimc_is_sensor_write8(client, 0x7087, 0x00); - fimc_is_sensor_write8(client, 0x7090, 0x01); - fimc_is_sensor_write8(client, 0x7115, 0x01); - fimc_is_sensor_write8(client, 0x7209, 0xF5); - fimc_is_sensor_write8(client, 0x720B, 0xF5); - - fimc_is_sensor_write8(client, 0x7245, 0xC4); - fimc_is_sensor_write8(client, 0x7301, 0x02); - fimc_is_sensor_write8(client, 0x7306, 0x02); - fimc_is_sensor_write8(client, 0x7339, 0x03); - fimc_is_sensor_write8(client, 0x7351, 0x00); /* 80 */ - - fimc_is_sensor_write8(client, 0x7352, 0xC0); - fimc_is_sensor_write8(client, 0x7405, 0x28); - fimc_is_sensor_write8(client, 0x7406, 0x28); - fimc_is_sensor_write8(client, 0x7407, 0xC0); - fimc_is_sensor_write8(client, 0x740C, 0x60); - - fimc_is_sensor_write8(client, 0x740D, 0x00); - fimc_is_sensor_write8(client, 0x7436, 0x03); - fimc_is_sensor_write8(client, 0x7437, 0x03); - fimc_is_sensor_write8(client, 0x7454, 0x01); - fimc_is_sensor_write8(client, 0x7460, 0x00); /* 90 */ - - fimc_is_sensor_write8(client, 0x7461, 0x01); - fimc_is_sensor_write8(client, 0x7462, 0x68); - fimc_is_sensor_write8(client, 0x7463, 0x1E); - fimc_is_sensor_write8(client, 0x7464, 0x03); - fimc_is_sensor_write8(client, 0x7465, 0x4B); - - fimc_is_sensor_write8(client, 0x7467, 0x20); - fimc_is_sensor_write8(client, 0x7468, 0x20); - fimc_is_sensor_write8(client, 0x7469, 0x20); - fimc_is_sensor_write8(client, 0x746A, 0x20); - fimc_is_sensor_write8(client, 0x746B, 0x20); /* 100 */ - - fimc_is_sensor_write8(client, 0x746C, 0x20); - fimc_is_sensor_write8(client, 0x746D, 0x02); - fimc_is_sensor_write8(client, 0x746E, 0x80); - fimc_is_sensor_write8(client, 0x746F, 0x01); - fimc_is_sensor_write8(client, 0x4100, 0x01); - - pr_info("[MOD:D:%d] %s(%d)\n", module->id, __func__, val); - - return ret; -} - -static const struct v4l2_subdev_core_ops core_ops = { - .init = sensor_8b1_init -}; - -static int sensor_8b1_s_stream(struct v4l2_subdev *subdev, int enable) -{ - int ret = 0; - struct fimc_is_module_enum *sensor; - - pr_info("%s\n", __func__); - - sensor = (struct fimc_is_module_enum *)v4l2_get_subdevdata(subdev); - if (!sensor) { - err("sensor is NULL"); - ret = -EINVAL; - goto p_err; - } - - if (enable) { - ret = CALL_MOPS(sensor, stream_on, subdev); - if (ret) { - err("s_duration is fail(%d)", ret); - goto p_err; - } - } else { - ret = CALL_MOPS(sensor, stream_off, subdev); - if (ret) { - err("s_duration is fail(%d)", ret); - goto p_err; - } - } - -p_err: - return 0; -} - -static int sensor_8b1_s_param(struct v4l2_subdev *subdev, struct v4l2_streamparm *param) -{ - int ret = 0; - struct fimc_is_module_enum *sensor; - struct v4l2_captureparm *cp; - struct v4l2_fract *tpf; - u64 duration; - - BUG_ON(!subdev); - BUG_ON(!param); - - pr_info("%s\n", __func__); - - cp = ¶m->parm.capture; - tpf = &cp->timeperframe; - - if (!tpf->denominator) { - err("denominator is 0"); - ret = -EINVAL; - goto p_err; - } - - if (!tpf->numerator) { - err("numerator is 0"); - ret = -EINVAL; - goto p_err; - } - - duration = (u64)(tpf->numerator * 1000 * 1000 * 1000) / - (u64)(tpf->denominator); - - sensor = (struct fimc_is_module_enum *)v4l2_get_subdevdata(subdev); - if (!sensor) { - err("sensor is NULL"); - ret = -EINVAL; - goto p_err; - } - - ret = CALL_MOPS(sensor, s_duration, subdev, duration); - if (ret) { - err("s_duration is fail(%d)", ret); - goto p_err; - } - -p_err: - return ret; -} - -static int sensor_8b1_s_format(struct v4l2_subdev *subdev, struct v4l2_mbus_framefmt *fmt) -{ - /* TODO */ - return 0; -} - -static const struct v4l2_subdev_video_ops video_ops = { - .s_stream = sensor_8b1_s_stream, - .s_parm = sensor_8b1_s_param, - .s_mbus_fmt = sensor_8b1_s_format -}; - -static const struct v4l2_subdev_ops subdev_ops = { - .core = &core_ops, - .video = &video_ops -}; - -int sensor_8b1_stream_on(struct v4l2_subdev *subdev) -{ - int ret = 0; - struct fimc_is_module_enum *sensor; - struct i2c_client *client; - - BUG_ON(!subdev); - - sensor = (struct fimc_is_module_enum *)v4l2_get_subdevdata(subdev); - if (unlikely(!sensor)) { - err("sensor is NULL"); - ret = -EINVAL; - goto p_err; - } - - client = sensor->client; - if (unlikely(!client)) { - err("client is NULL"); - ret = -EINVAL; - goto p_err; - } - - ret = fimc_is_sensor_write8(client, 0x4100, 1); - if (ret < 0) { - err("fimc_is_sensor_write8 is fail(%d)", ret); - goto p_err; - } - -p_err: - return ret; -} - -int sensor_8b1_stream_off(struct v4l2_subdev *subdev) -{ - int ret = 0; - struct fimc_is_module_enum *sensor; - struct i2c_client *client; - - BUG_ON(!subdev); - - sensor = (struct fimc_is_module_enum *)v4l2_get_subdevdata(subdev); - if (unlikely(!sensor)) { - err("sensor is NULL"); - ret = -EINVAL; - goto p_err; - } - - client = sensor->client; - if (unlikely(!client)) { - err("client is NULL"); - ret = -EINVAL; - goto p_err; - } - - ret = fimc_is_sensor_write8(client, 0x4100, 0); - if (ret < 0) { - err("fimc_is_sensor_write8 is fail(%d)", ret); - goto p_err; - } - -p_err: - return ret; -} - -/* - * @ brief - * frame duration time - * @ unit - * nano second - * @ remarks - */ -int sensor_8b1_s_duration(struct v4l2_subdev *subdev, u64 duration) -{ - int ret = 0; - u8 value[2]; - struct fimc_is_module_enum *sensor; - struct i2c_client *client; - - BUG_ON(!subdev); - - pr_info("%s\n", __func__); - - sensor = (struct fimc_is_module_enum *)v4l2_get_subdevdata(subdev); - if (unlikely(!sensor)) { - err("sensor is NULL"); - ret = -EINVAL; - goto p_err; - } - - client = sensor->client; - if (unlikely(!client)) { - err("client is NULL"); - ret = -EINVAL; - goto p_err; - } - - /* - * forcely set 10fps for 8b1, - */ - value[0] = 0x52; - value[1] = 0x0; - - fimc_is_sensor_write8(client, SENSOR_REG_VIS_DURATION_MSB, value[1]); - fimc_is_sensor_write8(client, SENSOR_REG_VIS_DURATION_LSB, value[0]); - -p_err: - return ret; -} - -int sensor_8b1_g_min_duration(struct v4l2_subdev *subdev) -{ - int ret = 0; - return ret; -} - -int sensor_8b1_g_max_duration(struct v4l2_subdev *subdev) -{ - int ret = 0; - return ret; -} - -int sensor_8b1_s_exposure(struct v4l2_subdev *subdev, u64 exposure) -{ - int ret = 0; - u8 value; - struct fimc_is_module_enum *sensor; - struct i2c_client *client; - - BUG_ON(!subdev); - - pr_info("%s(%d)\n", __func__, (u32)exposure); - - sensor = (struct fimc_is_module_enum *)v4l2_get_subdevdata(subdev); - if (unlikely(!sensor)) { - err("sensor is NULL"); - ret = -EINVAL; - goto p_err; - } - - client = sensor->client; - if (unlikely(!client)) { - err("client is NULL"); - ret = -EINVAL; - goto p_err; - } - - value = exposure & 0xFF; - - fimc_is_sensor_write8(client, SENSOR_REG_VIS_AE_TARGET, value); - -p_err: - return ret; -} - -int sensor_8b1_g_min_exposure(struct v4l2_subdev *subdev) -{ - int ret = 0; - return ret; -} - -int sensor_8b1_g_max_exposure(struct v4l2_subdev *subdev) -{ - int ret = 0; - return ret; -} - -int sensor_8b1_s_again(struct v4l2_subdev *subdev, u64 sensitivity) -{ - int ret = 0; - - pr_info("%s\n", __func__); - - return ret; -} - -int sensor_8b1_g_min_again(struct v4l2_subdev *subdev) -{ - int ret = 0; - return ret; -} - -int sensor_8b1_g_max_again(struct v4l2_subdev *subdev) -{ - int ret = 0; - return ret; -} - -int sensor_8b1_s_dgain(struct v4l2_subdev *subdev) -{ - int ret = 0; - return ret; -} - -int sensor_8b1_g_min_dgain(struct v4l2_subdev *subdev) -{ - int ret = 0; - return ret; -} - -int sensor_8b1_g_max_dgain(struct v4l2_subdev *subdev) -{ - int ret = 0; - return ret; -} - -struct fimc_is_sensor_ops module_8b1_ops = { - .stream_on = sensor_8b1_stream_on, - .stream_off = sensor_8b1_stream_off, - .s_duration = sensor_8b1_s_duration, - .g_min_duration = sensor_8b1_g_min_duration, - .g_max_duration = sensor_8b1_g_max_duration, - .s_exposure = sensor_8b1_s_exposure, - .g_min_exposure = sensor_8b1_g_min_exposure, - .g_max_exposure = sensor_8b1_g_max_exposure, - .s_again = sensor_8b1_s_again, - .g_min_again = sensor_8b1_g_min_again, - .g_max_again = sensor_8b1_g_max_again, - .s_dgain = sensor_8b1_s_dgain, - .g_min_dgain = sensor_8b1_g_min_dgain, - .g_max_dgain = sensor_8b1_g_max_dgain -}; - -#ifdef CONFIG_OF -static int sensor_8b1_power_setpin(struct device *dev) -{ - int gpio_none = 0, gpio_reset = 0, gpio_standby = 0; - struct exynos_platform_fimc_is_sensor *pdata; - struct device_node *dnode; - int gpios_cam_en = 0; - - BUG_ON(!dev); - BUG_ON(!dev->platform_data); - - dnode = dev->of_node; - pdata = dev->platform_data; - - gpio_reset = of_get_named_gpio(dnode, "gpio_reset", 0); - if (!gpio_is_valid(gpio_reset)) { - dev_err(dev, "failed to get PIN_RESET\n"); - return -EINVAL; - } else { - gpio_request_one(gpio_reset, GPIOF_OUT_INIT_LOW, "CAM_GPIO_OUTPUT_LOW"); - gpio_free(gpio_reset); - } - - gpios_cam_en = of_get_named_gpio(dnode, "gpios_cam_en", 0); - if (!gpio_is_valid(gpios_cam_en)) { - dev_err(dev, "failed to get main/front cam en gpio\n"); - } else { - gpio_request_one(gpios_cam_en, GPIOF_OUT_INIT_LOW, "CAM_GPIO_OUTPUT_LOW"); - gpio_free(gpios_cam_en); - } - - gpio_standby = of_get_named_gpio(dnode, "gpio_standby", 0); - if (!gpio_is_valid(gpio_standby)) { - dev_err(dev, "failed to get gpio_standby\n"); - } else { - gpio_request_one(gpio_standby, GPIOF_OUT_INIT_LOW, "CAM_GPIO_OUTPUT_LOW"); - gpio_free(gpio_standby); - } - - /* FRONT CAMERA - POWER ON */ - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 0, gpio_standby, 0, NULL, 0, PIN_OUTPUT_LOW); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 1, gpio_none, 0, "VT_CAM_1.8V", 0, PIN_REGULATOR_ON); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 2, gpio_none, 0, "VT_CAM_2.8V", 0, PIN_REGULATOR_ON); - if (gpio_is_valid(gpios_cam_en)) { - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 3, gpios_cam_en, 0, NULL, 1000, PIN_OUTPUT_HIGH); - } else { - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 3, gpio_none, 0, "VT_CAM_1.2V", 1000, PIN_REGULATOR_ON); - } - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 4, gpio_reset, 0, NULL, 0, PIN_OUTPUT_HIGH); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 5, gpio_none, 0, "ch", 0, PIN_FUNCTION); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 6, gpio_none, 0, NULL, 0, PIN_END); - - /* FRONT CAMERA - POWER OFF */ - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 0, gpio_standby, 0, NULL, 0, PIN_OUTPUT_LOW); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 1, gpio_none, 0, "off", 0, PIN_FUNCTION); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 2, gpio_reset, 0, NULL, 0, PIN_OUTPUT_LOW); - if (gpio_is_valid(gpios_cam_en)) { - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 3, gpios_cam_en, 0, NULL, 0, PIN_OUTPUT_LOW); - } else { - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 3, gpio_none, 0, "VT_CAM_1.2V", 0, PIN_REGULATOR_OFF); - } - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 4, gpio_none, 0, "VT_CAM_2.8V", 0, PIN_REGULATOR_OFF); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 5, gpio_none, 0, "VT_CAM_1.8V", 0, PIN_REGULATOR_OFF); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 6, gpio_none, 0, NULL, 0, PIN_END); - - /* VISION CAMERA - POWER ON */ - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_ON, 0, gpio_reset, 0, NULL, 0, PIN_OUTPUT_LOW); - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_ON, 1, gpio_none, 0, "VT_CAM_1.8V", 0, PIN_REGULATOR_ON); - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_ON, 2, gpio_none, 0, "VT_CAM_2.8V", 0, PIN_REGULATOR_ON); - if (gpio_is_valid(gpios_cam_en)) { - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_ON, 3, gpios_cam_en, 0, NULL, 1000, PIN_OUTPUT_HIGH); - } else { - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_ON, 3, gpio_none, 0, "VT_CAM_1.2V", 1000, PIN_REGULATOR_ON); - } - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_ON, 4, gpio_standby, 0, NULL, 0, PIN_OUTPUT_HIGH); - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_ON, 5, gpio_none, 0, "ch", 0, PIN_FUNCTION); - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_ON, 6, gpio_none, 0, NULL, 0, PIN_END); - - /* VISION CAMERA - POWER OFF */ - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_OFF, 0, gpio_reset, 0, NULL, 0, PIN_OUTPUT_LOW); - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_OFF, 1, gpio_none, 0, "off", 0, PIN_FUNCTION); - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_OFF, 2, gpio_standby, 0, NULL, 0, PIN_OUTPUT_LOW); - if (gpio_is_valid(gpios_cam_en)) { - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_OFF, 3, gpios_cam_en, 0, NULL, 0, PIN_OUTPUT_LOW); - } else { - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_OFF, 3, gpio_none, 0, "VT_CAM_1.2V", 0, PIN_REGULATOR_OFF); - } - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_OFF, 4, gpio_none, 0, "VT_CAM_2.8V", 0, PIN_REGULATOR_OFF); - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_OFF, 5, gpio_none, 0, "VT_CAM_1.8V", 0, PIN_REGULATOR_OFF); - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_OFF, 6, gpio_none, 0, NULL, 0, PIN_END); - - return 0; -} -#endif /* CONFIG_OF */ - -int sensor_8b1_probe(struct i2c_client *client, - const struct i2c_device_id *id) -{ - int ret = 0; - struct fimc_is_core *core; - struct v4l2_subdev *subdev_module; - struct fimc_is_module_enum *module; - struct fimc_is_device_sensor *device; - struct sensor_open_extended *ext; - static bool probe_retried = false; - - if (!fimc_is_dev) - goto probe_defer; - - core = (struct fimc_is_core *)dev_get_drvdata(fimc_is_dev); - if (!core) { - err("core device is not yet probed"); - return -EPROBE_DEFER; - } - - device = &core->sensor[SENSOR_S5K8B1_INSTANCE]; - - subdev_module = kzalloc(sizeof(struct v4l2_subdev), GFP_KERNEL); - if (!subdev_module) { - err("subdev_module is NULL"); - ret = -ENOMEM; - goto p_err; - } - - /* S5K8B1 */ - module = &device->module_enum[atomic_read(&core->resourcemgr.rsccount_module)]; - atomic_inc(&core->resourcemgr.rsccount_module); - module->id = SENSOR_S5K8B1_NAME; - module->subdev = subdev_module; - module->device = SENSOR_S5K8B1_INSTANCE; - module->ops = &module_8b1_ops; - module->client = client; - module->active_width = 1920; - module->active_height = 1080; - module->pixel_width = module->active_width + 16; - module->pixel_height = module->active_height + 10; - module->max_framerate = 30; - module->position = SENSOR_POSITION_FRONT; - module->mode = CSI_MODE_CH0_ONLY; - module->lanes = CSI_DATA_LANES_1; - module->sensor_maker = "SLSI"; - module->sensor_name = "S5K8B1"; - module->setfile_name = "setfile_8b1.bin"; - module->cfgs = ARRAY_SIZE(config_8b1); - module->cfg = config_8b1; - module->private_data = kzalloc(sizeof(struct fimc_is_module_8b1), GFP_KERNEL); - if (!module->private_data) { - err("private_data is NULL"); - ret = -ENOMEM; - kfree(subdev_module); - goto p_err; - } -#ifdef CONFIG_OF - module->power_setpin = sensor_8b1_power_setpin; -#endif - ext = &module->ext; - ext->mipi_lane_num = module->lanes; - ext->I2CSclk = I2C_L0; - ext->sensor_con.product_name = SENSOR_NAME_S5K8B1; - ext->sensor_con.peri_type = SE_I2C; - ext->sensor_con.peri_setting.i2c.channel = SENSOR_CONTROL_I2C1; - ext->sensor_con.peri_setting.i2c.slave_address = 0; - ext->sensor_con.peri_setting.i2c.speed = 400000; - - ext->from_con.product_name = FROMDRV_NAME_NOTHING; - - ext->companion_con.product_name = COMPANION_NAME_NOTHING; - - if (client) { - v4l2_i2c_subdev_init(subdev_module, client, &subdev_ops); - subdev_module->internal_ops = &internal_ops; - } else { - v4l2_subdev_init(subdev_module, &subdev_ops); - } - - v4l2_set_subdevdata(subdev_module, module); - v4l2_set_subdev_hostdata(subdev_module, device); - snprintf(subdev_module->name, V4L2_SUBDEV_NAME_SIZE, "sensor-subdev.%d", module->id); - -p_err: - info("%s(%d)\n", __func__, ret); - return ret; - -probe_defer: - if (probe_retried) { - err("probe has already been retried!!"); - BUG(); - } - - probe_retried = true; - err("core device is not yet probed"); - return -EPROBE_DEFER; -} - -static int sensor_8b1_remove(struct i2c_client *client) -{ - int ret = 0; - return ret; -} - -#ifdef CONFIG_OF -static const struct of_device_id exynos_fimc_is_sensor_8b1_match[] = { - { - .compatible = "samsung,exynos5-fimc-is-sensor-8b1", - }, - {}, -}; -#endif - -static const struct i2c_device_id sensor_8b1_idt[] = { - { SENSOR_NAME, 0 }, -}; - -static struct i2c_driver sensor_8b1_driver = { - .driver = { - .name = SENSOR_NAME, - .owner = THIS_MODULE, -#ifdef CONFIG_OF - .of_match_table = exynos_fimc_is_sensor_8b1_match -#endif - }, - .probe = sensor_8b1_probe, - .remove = sensor_8b1_remove, - .id_table = sensor_8b1_idt -}; - -static int __init sensor_8b1_load(void) -{ - return i2c_add_driver(&sensor_8b1_driver); -} - -static void __exit sensor_8b1_unload(void) -{ - i2c_del_driver(&sensor_8b1_driver); -} - -module_init(sensor_8b1_load); -module_exit(sensor_8b1_unload); - -MODULE_AUTHOR("Gilyeon lim"); -MODULE_DESCRIPTION("Sensor 8B1 driver"); -MODULE_LICENSE("GPL v2"); diff --git a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-8b1.h b/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-8b1.h deleted file mode 100644 index b6a76e4..0000000 --- a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-8b1.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Samsung Exynos5 SoC series Sensor driver - * - * - * Copyright (c) 2011 Samsung Electronics Co., Ltd - * - * 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_DEVICE_8B1_H -#define FIMC_IS_DEVICE_8B1_H - -#define SENSOR_S5K8B1_INSTANCE 1 -#define SENSOR_S5K8B1_NAME SENSOR_NAME_S5K8B1 - -struct fimc_is_module_8b1 { - u16 vis_duration; - u16 frame_length_line; - u32 line_length_pck; - u32 system_clock; -}; - -int sensor_8b1_probe(struct i2c_client *client, - const struct i2c_device_id *id); - -#endif diff --git a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-imx134.c b/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-imx134.c deleted file mode 100644 index af121b3..0000000 --- a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-imx134.c +++ /dev/null @@ -1,265 +0,0 @@ -/* - * Samsung Exynos5 SoC series Sensor driver - * - * - * Copyright (c) 2011 Samsung Electronics Co., Ltd - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef CONFIG_OF -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include - -#include "../fimc-is-core.h" -#include "../fimc-is-device-sensor.h" -#include "../fimc-is-resourcemgr.h" -#include "fimc-is-device-imx134.h" - - -#include -#include "../fimc-is-hw.h" - - - -#define SENSOR_NAME "IMX134" - -static struct fimc_is_sensor_cfg config_imx134[] = { - /* 3280X2458@30fps */ - FIMC_IS_SENSOR_CFG(3280, 2458, 30, 15, 0), - /* 3280X1846@30fps */ - FIMC_IS_SENSOR_CFG(3280, 1846, 30, 11, 1), - /* 3280X2458@24fps */ - FIMC_IS_SENSOR_CFG(3280, 2458, 24, 12, 2), - /* 3280X1846@24fps */ - FIMC_IS_SENSOR_CFG(3280, 1846, 24, 9, 3), - /* 1936X1450@24fps */ - FIMC_IS_SENSOR_CFG(1936, 1450, 24, 12, 4), - /* 1936X1090@24fps */ - FIMC_IS_SENSOR_CFG(1936, 1090, 24, 9, 5), - /* 816X460@120fps */ - FIMC_IS_SENSOR_CFG(816, 460, 120, 7, 6), - /* 1640X924@60fps */ - FIMC_IS_SENSOR_CFG(1640, 924, 60, 6, 7), -}; - - -static int sensor_imx134_init(struct v4l2_subdev *subdev, u32 val) -{ - int ret = 0; - struct fimc_is_module_enum *module; - - BUG_ON(!subdev); - - module = (struct fimc_is_module_enum *)v4l2_get_subdevdata(subdev); - - pr_info("[MOD:D:%d] %s(%d)\n", module->id, __func__, val); - - return ret; -} - -static const struct v4l2_subdev_core_ops core_ops = { - .init = sensor_imx134_init -}; - -static const struct v4l2_subdev_ops subdev_ops = { - .core = &core_ops -}; - -#ifdef CONFIG_OF -#ifdef CONFIG_COMPANION_USE -static int sensor_imx134_power_setpin(struct device *dev) -{ - return 0; -} -#else -static int sensor_imx134_power_setpin(struct device *dev) -{ - struct exynos_platform_fimc_is_sensor *pdata; - struct device_node *dnode; - int gpio_none = 0; - int gpio_reset = 0, gpios_cam_en = 0; - - BUG_ON(!dev); - BUG_ON(!dev->platform_data); - - dnode = dev->of_node; - pdata = dev->platform_data; - - gpio_reset = of_get_named_gpio(dnode, "gpio_reset", 0); - if (!gpio_is_valid(gpio_reset)) { - err("failed to get PIN_RESET"); - return -EINVAL; - } else { - gpio_request_one(gpio_reset, GPIOF_OUT_INIT_LOW, "CAM_GPIO_OUTPUT_LOW"); - gpio_free(gpio_reset); - } - - gpios_cam_en = of_get_named_gpio(dnode, "gpios_cam_en", 0); - if (!gpio_is_valid(gpios_cam_en)) { - err("failed to get main cam en gpio"); - } else { - gpio_request_one(gpios_cam_en, GPIOF_OUT_INIT_LOW, "CAM_GPIO_OUTPUT_LOW"); - gpio_free(gpios_cam_en); - } - - /* BACK CAMERA - POWER ON */ - if (gpio_is_valid(gpios_cam_en)) { - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 0, gpios_cam_en, 0, NULL, 0, PIN_OUTPUT_HIGH); - } else { - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 0, gpio_none, 0, "CAM_SEN_A2.8V_AP", 0, PIN_REGULATOR_ON); - } - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 1, gpio_none, 0, "CAM_SEN_CORE_1.2V_AP", 0, PIN_REGULATOR_ON); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 2, gpio_none, 0, "CAM_AF_2.8V_AP", 2000, PIN_REGULATOR_ON); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 3, gpio_none, 0, "CAM_IO_1.8V_AP", 2000, PIN_REGULATOR_ON); - - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 4, gpio_none, 0, "ch", 0, PIN_FUNCTION); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 5, gpio_reset, 0, NULL, 0, PIN_OUTPUT_HIGH); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 6, gpio_none, 0, "af", 0, PIN_FUNCTION); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 7, gpio_none, 0, NULL, 0, PIN_END); - - /* BACK CAMERA - POWER OFF */ - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 0, gpio_none, 0, "CAM_AF_2.8V_AP", 2000, PIN_REGULATOR_OFF); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 1, gpio_none, 0, "off", 0, PIN_FUNCTION); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 2, gpio_reset, 0, NULL, 0, PIN_OUTPUT_LOW); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 3, gpio_none, 0, "CAM_IO_1.8V_AP", 0, PIN_REGULATOR_OFF); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 4, gpio_none, 0, "CAM_SEN_CORE_1.2V_AP", 0, PIN_REGULATOR_OFF); - if (gpio_is_valid(gpios_cam_en)) { - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 5, gpios_cam_en, 0, NULL, 0, PIN_OUTPUT_LOW); - } else { - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 5, gpio_none, 0, "CAM_SEN_A2.8V_AP", 0, PIN_REGULATOR_OFF); - } - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 6, gpio_none, 0, NULL, 0, PIN_END); - - return 0; -} -#endif /* CONFIG_COMPANION_USE */ -#endif /* CONFIG_OF */ - -int sensor_imx134_probe(struct i2c_client *client, - const struct i2c_device_id *id) -{ - int ret = 0; - struct fimc_is_core *core; - struct v4l2_subdev *subdev_module; - struct fimc_is_module_enum *module; - struct fimc_is_device_sensor *device; - struct sensor_open_extended *ext; - - BUG_ON(!fimc_is_dev); - - core = (struct fimc_is_core *)dev_get_drvdata(fimc_is_dev); - if (!core) { - info("core device is not yet probed"); - return -EPROBE_DEFER; - } - - device = &core->sensor[SENSOR_IMX134_INSTANCE]; - - subdev_module = kzalloc(sizeof(struct v4l2_subdev), GFP_KERNEL); - if (!subdev_module) { - info("subdev_module is NULL"); - ret = -ENOMEM; - goto p_err; - } - - module = &device->module_enum[atomic_read(&core->resourcemgr.rsccount_module)]; - atomic_inc(&core->resourcemgr.rsccount_module); - module->id = SENSOR_NAME_IMX134; - module->subdev = subdev_module; - module->device = SENSOR_IMX134_INSTANCE; - module->ops = NULL; - module->client = client; - module->active_width = 3264; - module->active_height = 2448; - module->pixel_width = module->active_width + 16; - module->pixel_height = module->active_height + 10; - module->max_framerate = 300; - module->position = SENSOR_POSITION_REAR; - module->mode = CSI_MODE_CH0_ONLY; - module->lanes = CSI_DATA_LANES_4; - module->sensor_maker = "SONY"; - module->sensor_name = "IMX134"; - module->setfile_name = "setfile_imx134.bin"; - module->cfgs = ARRAY_SIZE(config_imx134); - module->cfg = config_imx134; - module->ops = NULL; - module->private_data = NULL; -#ifdef CONFIG_OF - module->power_setpin = sensor_imx134_power_setpin; -#endif - - ext = &module->ext; - ext->mipi_lane_num = module->lanes; - ext->I2CSclk = I2C_L0; - - ext->sensor_con.product_name = SENSOR_NAME_IMX134; - ext->sensor_con.peri_type = SE_I2C; - ext->sensor_con.peri_setting.i2c.channel = SENSOR_CONTROL_I2C0; - ext->sensor_con.peri_setting.i2c.slave_address = 0x34; - ext->sensor_con.peri_setting.i2c.speed = 400000; - - ext->actuator_con.product_name = ACTUATOR_NAME_AK7345;//ACTUATOR_NAME_NOTHING; - ext->actuator_con.peri_type = SE_I2C; - ext->actuator_con.peri_setting.i2c.channel = SENSOR_CONTROL_I2C1; - ext->actuator_con.peri_setting.i2c.slave_address = 0x34; - ext->actuator_con.peri_setting.i2c.speed = 400000; - -#ifdef CONFIG_LEDS_MAX77804 - ext->flash_con.product_name = FLADRV_NAME_MAX77693; -#endif -#ifdef CONFIG_LEDS_LM3560 - ext->flash_con.product_name = FLADRV_NAME_LM3560; -#endif -#ifdef CONFIG_LEDS_SKY81296 - ext->flash_con.product_name = FLADRV_NAME_SKY81296; -#endif -#ifdef CONFIG_LEDS_KTD2692 - ext->flash_con.product_name = FLADRV_NAME_KTD2692; -#endif - ext->flash_con.peri_type = SE_GPIO; - ext->flash_con.peri_setting.gpio.first_gpio_port_no = 1; - ext->flash_con.peri_setting.gpio.second_gpio_port_no = 2; - - ext->from_con.product_name = FROMDRV_NAME_NOTHING; - - ext->companion_con.product_name = COMPANION_NAME_NOTHING; - - if (client) - v4l2_i2c_subdev_init(subdev_module, client, &subdev_ops); - else - v4l2_subdev_init(subdev_module, &subdev_ops); - - v4l2_set_subdevdata(subdev_module, module); - v4l2_set_subdev_hostdata(subdev_module, device); - snprintf(subdev_module->name, V4L2_SUBDEV_NAME_SIZE, "sensor-subdev.%d", module->id); - -p_err: - info("%s(%d)\n", __func__, ret); - return ret; -} - diff --git a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-imx134.h b/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-imx134.h deleted file mode 100644 index e189c18..0000000 --- a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-imx134.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Samsung Exynos5 SoC series Sensor driver - * - * - * Copyright (c) 2011 Samsung Electronics Co., Ltd - * - * 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_DEVICE_IMX134_H -#define FIMC_IS_DEVICE_IMX134_H - -#define SENSOR_IMX134_INSTANCE 0 -#define SENSOR_IMX134_NAME SENSOR_NAME_IMX134 - -int sensor_imx134_probe(struct i2c_client *client, - const struct i2c_device_id *id); - -#endif - diff --git a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-imx135.c b/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-imx135.c deleted file mode 100644 index 53dccf5..0000000 --- a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-imx135.c +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Samsung Exynos5 SoC series Sensor driver - * - * - * Copyright (c) 2011 Samsung Electronics Co., Ltd - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "../fimc-is-core.h" -#include "../fimc-is-device-sensor.h" -#include "../fimc-is-resourcemgr.h" -#include "../fimc-is-hw.h" -#include "fimc-is-device-imx135.h" - -#define SENSOR_NAME "IMX135" - -static struct fimc_is_sensor_cfg config_imx135[] = { - /* 4144x3106@30fps */ - FIMC_IS_SENSOR_CFG(4144, 3106, 30, 23, 0), - /* 4144x2332@30fps */ - FIMC_IS_SENSOR_CFG(4144, 2332, 30, 18, 1), - /* 1936x1450@24fps */ - FIMC_IS_SENSOR_CFG(1936, 1450, 24, 9, 2), - /* 1936x1090@24fps */ - FIMC_IS_SENSOR_CFG(1936, 1090, 24, 7, 3), - /* 1024x576@120fps */ - FIMC_IS_SENSOR_CFG(1024, 576, 120, 9, 4), - /* 2072x1166@60fps */ - FIMC_IS_SENSOR_CFG(2072, 1166, 60, 18, 5), -}; - -static int sensor_imx135_init(struct v4l2_subdev *subdev, u32 val) -{ - int ret = 0; - struct fimc_is_module_enum *module; - - BUG_ON(!subdev); - - module = (struct fimc_is_module_enum *)v4l2_get_subdevdata(subdev); - - pr_info("[MOD:D:%d] %s(%d)\n", module->id, __func__, val); - - return ret; -} - -static const struct v4l2_subdev_core_ops core_ops = { - .init = sensor_imx135_init -}; - -static const struct v4l2_subdev_ops subdev_ops = { - .core = &core_ops -}; - -int sensor_imx135_probe(struct i2c_client *client, - const struct i2c_device_id *id) -{ - int ret = 0; - struct fimc_is_core *core; - struct v4l2_subdev *subdev_module; - struct fimc_is_module_enum *module; - struct fimc_is_device_sensor *device; - struct sensor_open_extended *ext; - - BUG_ON(!fimc_is_dev); - - core = (struct fimc_is_core *)dev_get_drvdata(fimc_is_dev); - if (!core) { - err("core device is not yet probed"); - return -EPROBE_DEFER; - } - - device = &core->sensor[SENSOR_IMX135_INSTANCE]; - - subdev_module = kzalloc(sizeof(struct v4l2_subdev), GFP_KERNEL); - if (!subdev_module) { - err("subdev_module is NULL"); - ret = -ENOMEM; - goto p_err; - } - - module = &device->module_enum[atomic_read(&core->resourcemgr.rsccount_module)]; - atomic_inc(&core->resourcemgr.rsccount_module); - module->id = SENSOR_NAME_IMX135; - module->subdev = subdev_module; - module->device = SENSOR_IMX135_INSTANCE; - module->ops = NULL; - module->client = client; - module->active_width = 4128; - module->active_height = 3096; - module->pixel_width = module->active_width + 16; - module->pixel_height = module->active_height + 10; - module->max_framerate = 120; - module->sensor_maker = "SONY"; - module->sensor_name = "IMX135"; - module->setfile_name = "setfile_imx135.bin"; - module->cfgs = ARRAY_SIZE(config_imx135); - module->cfg = config_imx135; - module->private_data = NULL; - module->lanes = CSI_DATA_LANES_4; - - ext = &module->ext; - memset(ext, 0x0, sizeof(struct sensor_open_extended)); - ext->mipi_lane_num = 4; - ext->sensor_con.product_name = 0; - ext->sensor_con.peri_type = SE_I2C; - //ext->sensor_con.peri_setting.i2c.channel = sensor_info->i2c_channel; - //ext->sensor_con.peri_setting.i2c.slave_address = sensor_info->sensor_slave_address; - ext->sensor_con.peri_setting.i2c.speed = 400000; - - ext->actuator_con.product_name = ACTUATOR_NAME_AK7345; - ext->actuator_con.peri_type = SE_I2C; - //ext->actuator_con.peri_setting.i2c.channel = sensor_info->actuator_i2c; - - //ext->flash_con.product_name = sensor_info->flash_id; - ext->flash_con.peri_type = SE_GPIO; - //ext->flash_con.peri_setting.gpio.first_gpio_port_no = sensor_info->flash_first_gpio; - //ext->flash_con.peri_setting.gpio.second_gpio_port_no = sensor_info->flash_second_gpio; - - ext->from_con.product_name = FROMDRV_NAME_NOTHING; - ext->mclk = 0; - ext->mipi_lane_num = 0; - ext->mipi_speed = 0; - ext->fast_open_sensor = 0; - ext->self_calibration_mode = 0; - ext->I2CSclk = I2C_L0; - - ext->companion_con.product_name = COMPANION_NAME_NOTHING; - - if (client) - v4l2_i2c_subdev_init(subdev_module, client, &subdev_ops); - else - v4l2_subdev_init(subdev_module, &subdev_ops); - - v4l2_set_subdevdata(subdev_module, module); - v4l2_set_subdev_hostdata(subdev_module, device); - snprintf(subdev_module->name, V4L2_SUBDEV_NAME_SIZE, "sensor-subdev.%d", module->id); - -p_err: - info("%s(%d)\n", __func__, ret); - return ret; -} diff --git a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-imx135.h b/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-imx135.h deleted file mode 100644 index 6051f4d..0000000 --- a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-imx135.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Samsung Exynos5 SoC series Sensor driver - * - * - * Copyright (c) 2011 Samsung Electronics Co., Ltd - * - * 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_DEVICE_IMX135_H -#define FIMC_IS_DEVICE_IMX135_H - -#define SENSOR_IMX135_INSTANCE 0 -#define SENSOR_IMX135_NAME SENSOR_NAME_IMX135 - -int sensor_imx135_probe(struct i2c_client *client, - const struct i2c_device_id *id); - -#endif diff --git a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-imx175.c b/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-imx175.c deleted file mode 100644 index 3e64e62..0000000 --- a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-imx175.c +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Samsung Exynos5 SoC series Sensor driver - * - * - * Copyright (c) 2011 Samsung Electronics Co., Ltd - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "../fimc-is-core.h" -#include "../fimc-is-device-sensor.h" -#include "../fimc-is-resourcemgr.h" -#include "../fimc-is-hw.h" -#include "fimc-is-device-imx175.h" - -#define SENSOR_NAME "IMX175" - -static struct fimc_is_sensor_cfg config_imx175[] = { - /* 3280X2458@30fps */ - FIMC_IS_SENSOR_CFG(3280, 2458, 30, 14, 0), - /* 3280X1846@30fps */ - FIMC_IS_SENSOR_CFG(3280, 1846, 30, 11, 1), - /* 3280X2458@24fps */ - FIMC_IS_SENSOR_CFG(3280, 2458, 24, 11, 2), - /* 3280X1846@24fps */ - FIMC_IS_SENSOR_CFG(3280, 1846, 24, 8, 3), - /* 1640X924@60fps */ - FIMC_IS_SENSOR_CFG(1640, 924, 60, 11, 4), - /* 816X460@120fps */ - FIMC_IS_SENSOR_CFG(816, 460, 120, 11, 5), -}; - -static int sensor_imx175_init(struct v4l2_subdev *subdev, u32 val) -{ - int ret = 0; - struct fimc_is_module_enum *module; - - BUG_ON(!subdev); - - module = (struct fimc_is_module_enum *)v4l2_get_subdevdata(subdev); - - pr_info("[MOD:D:%d] %s(%d)\n", module->id, __func__, val); - - return ret; -} - -static const struct v4l2_subdev_core_ops core_ops = { - .init = sensor_imx175_init -}; - -static const struct v4l2_subdev_ops subdev_ops = { - .core = &core_ops -}; - -int sensor_imx175_probe(struct i2c_client *client, - const struct i2c_device_id *id) -{ - int ret = 0; - struct fimc_is_core *core; - struct v4l2_subdev *subdev_module; - struct fimc_is_module_enum *module; - struct fimc_is_device_sensor *device; - struct sensor_open_extended *ext; - - BUG_ON(!fimc_is_dev); - - core = (struct fimc_is_core *)dev_get_drvdata(fimc_is_dev); - if (!core) { - err("core device is not yet probed"); - return -EPROBE_DEFER; - } - - device = &core->sensor[SENSOR_IMX175_INSTANCE]; - - subdev_module = kzalloc(sizeof(struct v4l2_subdev), GFP_KERNEL); - if (!subdev_module) { - err("subdev_module is NULL"); - ret = -ENOMEM; - goto p_err; - } - - module = &device->module_enum[atomic_read(&core->resourcemgr.rsccount_module)]; - atomic_inc(&core->resourcemgr.rsccount_module); - module->id = SENSOR_NAME_IMX175; - module->subdev = subdev_module; - module->device = SENSOR_IMX175_INSTANCE; - module->ops = NULL; - module->client = client; - module->active_width = 3264; - module->active_height = 2448; - module->pixel_width = module->active_width + 16; - module->pixel_height = module->active_height + 10; - module->max_framerate = 120; - module->mode = CSI_MODE_CH0_ONLY; - module->lanes = CSI_DATA_LANES_4; - module->sensor_maker = "SONY"; - module->sensor_name = "IMX175"; - module->setfile_name = "setfile_imx175.bin"; - module->cfgs = ARRAY_SIZE(config_imx175); - module->cfg = config_imx175; - module->ops = NULL; - module->private_data = NULL; - - ext = &module->ext; - ext->mipi_lane_num = 4; - ext->I2CSclk = I2C_L0; - - ext->sensor_con.product_name = 0; - ext->sensor_con.peri_type = SE_I2C; - ext->sensor_con.peri_setting.i2c.channel = SENSOR_CONTROL_I2C0; - ext->sensor_con.peri_setting.i2c.slave_address = 0x18; - ext->sensor_con.peri_setting.i2c.speed = 400000; - - ext->actuator_con.product_name = ACTUATOR_NAME_AK7343; - ext->actuator_con.peri_type = SE_I2C; - ext->actuator_con.peri_setting.i2c.channel - = SENSOR_CONTROL_I2C0; - ext->actuator_con.peri_setting.i2c.slave_address = 0x18; - - ext->flash_con.product_name = FLADRV_NAME_MAX77693; - ext->flash_con.peri_type = SE_GPIO; - ext->flash_con.peri_setting.gpio.first_gpio_port_no = 0; - ext->flash_con.peri_setting.gpio.second_gpio_port_no = 1; - - /* ext->from_con.product_name = FROMDRV_NAME_W25Q80BW; */ - ext->from_con.product_name = FROMDRV_NAME_NOTHING; - ext->mclk = 0; - ext->mipi_lane_num = 0; - ext->mipi_speed = 0; - ext->fast_open_sensor = 0; - ext->self_calibration_mode = 0; - ext->I2CSclk = I2C_L0; - - ext->companion_con.product_name = COMPANION_NAME_NOTHING; - - if (client) - v4l2_i2c_subdev_init(subdev_module, client, &subdev_ops); - else - v4l2_subdev_init(subdev_module, &subdev_ops); - - v4l2_set_subdevdata(subdev_module, module); - v4l2_set_subdev_hostdata(subdev_module, device); - snprintf(subdev_module->name, V4L2_SUBDEV_NAME_SIZE, "sensor-subdev.%d", module->id); - -p_err: - info("%s(%d)\n", __func__, ret); - return ret; -} diff --git a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-imx175.h b/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-imx175.h deleted file mode 100644 index 2e04dcf..0000000 --- a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-imx175.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Samsung Exynos5 SoC series Sensor driver - * - * - * Copyright (c) 2011 Samsung Electronics Co., Ltd - * - * 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_DEVICE_IMX175_H -#define FIMC_IS_DEVICE_IMX175_H - -#define SENSOR_IMX175_INSTANCE 0 -#define SENSOR_IMX175_NAME SENSOR_NAME_IMX175 - -int sensor_imx175_probe(struct i2c_client *client, - const struct i2c_device_id *id); - -#endif diff --git a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-imx219.c b/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-imx219.c deleted file mode 100644 index e630244..0000000 --- a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-imx219.c +++ /dev/null @@ -1,829 +0,0 @@ -/* - * Samsung Exynos5 SoC series Sensor driver - * - * - * Copyright (c) 2011 Samsung Electronics Co., Ltd - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef CONFIG_OF -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include - -#include "../fimc-is-core.h" -#include "../fimc-is-device-sensor.h" -#include "../fimc-is-resourcemgr.h" -#include "../fimc-is-hw.h" -#include "fimc-is-device-imx219.h" - -#define SENSOR_NAME "IMX219" -#define DEFAULT_SENSOR_WIDTH 184 -#define DEFAULT_SENSOR_HEIGHT 104 -#define SENSOR_MEMSIZE DEFAULT_SENSOR_WIDTH * DEFAULT_SENSOR_HEIGHT - -#define SENSOR_REG_VIS_DURATION_MSB (0x6026) -#define SENSOR_REG_VIS_DURATION_LSB (0x6027) -#define SENSOR_REG_VIS_FRAME_LENGTH_LINE_ALV_MSB (0x4340) -#define SENSOR_REG_VIS_FRAME_LENGTH_LINE_ALV_LSB (0x4341) -#define SENSOR_REG_VIS_LINE_LENGTH_PCLK_ALV_MSB (0x4342) -#define SENSOR_REG_VIS_LINE_LENGTH_PCLK_ALV_LSB (0x4343) -#define SENSOR_REG_VIS_GAIN_RED (0x6029) -#define SENSOR_REG_VIS_GAIN_GREEN (0x602A) -#define SENSOR_REG_VIS_AE_TARGET (0x600A) -#define SENSOR_REG_VIS_AE_SPEED (0x5034) -#define SENSOR_REG_VIS_AE_NUMBER_OF_PIXEL_MSB (0x5030) -#define SENSOR_REG_VIS_AE_NUMBER_OF_PIXEL_LSB (0x5031) -#define SENSOR_REG_VIS_AE_WINDOW_WEIGHT_1x1_2 (0x6000) -#define SENSOR_REG_VIS_AE_WINDOW_WEIGHT_1x3_4 (0x6001) -#define SENSOR_REG_VIS_AE_WINDOW_WEIGHT_2x1_2 (0x6002) -#define SENSOR_REG_VIS_AE_WINDOW_WEIGHT_2x3_4 (0x6003) -#define SENSOR_REG_VIS_AE_WINDOW_WEIGHT_3x1_2 (0x6004) -#define SENSOR_REG_VIS_AE_WINDOW_WEIGHT_3x3_4 (0x6005) -#define SENSOR_REG_VIS_AE_WINDOW_WEIGHT_4x1_2 (0x6006) -#define SENSOR_REG_VIS_AE_WINDOW_WEIGHT_4x3_4 (0x6007) -#define SENSOR_REG_VIS_AE_MANUAL_EXP_MSB (0x5039) -#define SENSOR_REG_VIS_AE_MANUAL_EXP_LSB (0x503A) -#define SENSOR_REG_VIS_AE_MANUAL_ANG_MSB (0x503B) -#define SENSOR_REG_VIS_AE_MANUAL_ANG_LSB (0x503C) -#define SENSOR_REG_VIS_BIT_CONVERTING_MSB (0x602B) -#define SENSOR_REG_VIS_BIT_CONVERTING_LSB (0x7203) -#define SENSOR_REG_VIS_AE_OFF (0x5000) - -static u16 setfile_vision_imx219[][2] = { - {0x4200, 0x02}, - {0x4201, 0xAE}, - {0x4301, 0x04}, - {0x4309, 0x04}, - {0x4345, 0x08}, - {0x4347, 0x08}, - {0x4348, 0x0A}, - {0x4349, 0x01}, - {0x434A, 0x05}, - {0x434B, 0xA0}, - {0x434C, 0x01}, - {0x434D, 0x40}, - {0x434E, 0x00}, - {0x434F, 0xB4}, - {0x4381, 0x01}, - {0x4383, 0x07}, - {0x4385, 0x08}, - {0x4387, 0x08}, - {0x5004, 0x01}, - {0x5005, 0x1E}, - {0x5014, 0x11}, - {0x5015, 0x9E}, - {0x5016, 0x00}, - {0x5017, 0x02}, - {0x5030, 0x1C}, - {0x5031, 0x20}, - {0x5034, 0x00}, - {0x5035, 0x02}, - {0x5036, 0x00}, - {0x5037, 0x06}, - {0x5038, 0xC0}, - {0x5039, 0x00}, - {0x503A, 0x00}, - {0x503B, 0x00}, - {0x503C, 0x00}, - {0x503D, 0x20}, - {0x503E, 0x70}, - {0x503F, 0x02}, - {0x600A, 0x2A}, - {0x600E, 0x05}, - {0x6014, 0x27}, - {0x6015, 0x1D}, - {0x6018, 0x01}, - {0x6026, 0x00}, - {0x6027, 0x68}, - {0x6029, 0x08}, - {0x602A, 0x08}, - {0x602B, 0x00}, - {0x602C, 0x00}, - {0x7008, 0x00}, - {0x7009, 0x10}, - {0x700A, 0x00}, - {0x700B, 0x10}, - {0x7014, 0x2B}, - {0x7015, 0x91}, - {0x7016, 0x82}, - {0x701B, 0x16}, - {0x701D, 0x0B}, - {0x701F, 0x0B}, - {0x7026, 0x1A}, - {0x7027, 0x46}, - {0x7029, 0x14}, - {0x702A, 0x02}, - {0x7038, 0x01}, - {0x7039, 0x14}, - {0x703A, 0x32}, - {0x703B, 0x22}, - {0x7040, 0x01}, - {0x7041, 0x14}, - {0x7042, 0x32}, - {0x7043, 0x22}, - {0x7050, 0x0A}, - {0x7051, 0xA8}, - {0x7052, 0x35}, - {0x7053, 0x54}, - {0x7054, 0x00}, - {0x7055, 0x00}, - {0x7056, 0x00}, - {0x7057, 0x00}, - {0x705E, 0x0E}, - {0x705F, 0x10}, - {0x7060, 0x01}, - {0x7064, 0x05}, - {0x7065, 0x3C}, - {0x7066, 0x00}, - {0x7067, 0x00}, - {0x7068, 0x4A}, - {0x706C, 0x01}, - {0x7077, 0x88}, - {0x7078, 0x88}, - {0x7082, 0x90}, - {0x7091, 0x05}, - {0x7098, 0x00}, - {0x7112, 0x01}, - {0x720A, 0x06}, - {0x720B, 0x80}, - {0x7245, 0xC1}, - {0x7301, 0x01}, - {0x7305, 0x13}, - {0x7306, 0x01}, - {0x7323, 0x01}, - {0x7339, 0x07}, - {0x7351, 0x01}, - {0x7352, 0x24}, - {0x7405, 0x28}, - {0x7406, 0x28}, - {0x7407, 0xC0}, - {0x7454, 0x01}, - {0x7460, 0x01}, - {0x7461, 0x20}, - {0x7462, 0xC0}, - {0x7463, 0x1E}, - {0x7464, 0x02}, - {0x7465, 0x4B}, - {0x7467, 0x20}, - {0x7468, 0x20}, - {0x7469, 0x20}, - {0x746A, 0x20}, - {0x746B, 0x20}, - {0x746C, 0x20}, - {0x746D, 0x09}, - {0x746E, 0xFF}, - {0x746F, 0x01}, - {0x7472, 0x00}, - {0x7473, 0x02}, - {0x7474, 0xC1}, - {0x7475, 0x00}, - {0x7476, 0x00}, - {0x7477, 0x00}, - {0x7478, 0x00}, - {0x4100, 0x01}, -}; - -static struct fimc_is_sensor_cfg config_imx219[] = { - /* 3280X2458@20fps */ - FIMC_IS_SENSOR_CFG(3280, 2458, 20, 19, 0), - /* 3280X1846@20fps */ - FIMC_IS_SENSOR_CFG(3280, 1846, 20, 15, 1), - /* 1640X1228@24fps */ - FIMC_IS_SENSOR_CFG(1640, 1228, 24, 12, 2), - /* 3280X1846@24fps */ - FIMC_IS_SENSOR_CFG(3280, 1846, 24, 17, 3), -}; - -static int sensor_imx219_open(struct v4l2_subdev *sd, - struct v4l2_subdev_fh *fh) -{ - pr_info("%s\n", __func__); - return 0; -} -static int sensor_imx219_close(struct v4l2_subdev *sd, - struct v4l2_subdev_fh *fh) -{ - pr_info("%s\n", __func__); - return 0; -} -static int sensor_imx219_registered(struct v4l2_subdev *sd) -{ - pr_info("%s\n", __func__); - return 0; -} - -static void sensor_imx219_unregistered(struct v4l2_subdev *sd) -{ - pr_info("%s\n", __func__); -} - -static const struct v4l2_subdev_internal_ops internal_ops = { - .open = sensor_imx219_open, - .close = sensor_imx219_close, - .registered = sensor_imx219_registered, - .unregistered = sensor_imx219_unregistered, -}; - -static int sensor_imx219_init(struct v4l2_subdev *subdev, u32 val) -{ - int i, ret = 0; - struct fimc_is_module_enum *module; - struct fimc_is_module_imx219 *module_imx219; - struct i2c_client *client; - - BUG_ON(!subdev); - - module = (struct fimc_is_module_enum *)v4l2_get_subdevdata(subdev); - module_imx219 = module->private_data; - client = module->client; - - module_imx219->system_clock = 146 * 1000 * 1000; - module_imx219->line_length_pck = 146 * 1000 * 1000; - - pr_info("%s\n", __func__); - - /* sensor init */ - for (i = 0; i < ARRAY_SIZE(setfile_vision_imx219); i++) { - fimc_is_sensor_write8(client, setfile_vision_imx219[i][0], - (u8)setfile_vision_imx219[i][1]); - } - - pr_info("[MOD:D:%d] %s(%d)\n", module->id, __func__, val); - - return ret; -} - -static const struct v4l2_subdev_core_ops core_ops = { - .init = sensor_imx219_init -}; - -static int sensor_imx219_s_stream(struct v4l2_subdev *subdev, int enable) -{ - int ret = 0; - struct fimc_is_module_enum *sensor; - - pr_info("%s\n", __func__); - - sensor = (struct fimc_is_module_enum *)v4l2_get_subdevdata(subdev); - if (!sensor) { - err("sensor is NULL"); - ret = -EINVAL; - goto p_err; - } - - if (enable) { - ret = CALL_MOPS(sensor, stream_on, subdev); - if (ret < 0) { - err("s_duration is fail(%d)", ret); - goto p_err; - } - } else { - ret = CALL_MOPS(sensor, stream_off, subdev); - if (ret < 0) { - err("s_duration is fail(%d)", ret); - goto p_err; - } - } - -p_err: - return 0; -} - -static int sensor_imx219_s_param(struct v4l2_subdev *subdev, struct v4l2_streamparm *param) -{ - int ret = 0; - struct fimc_is_module_enum *sensor; - struct v4l2_captureparm *cp; - struct v4l2_fract *tpf; - u64 duration; - - BUG_ON(!subdev); - BUG_ON(!param); - - pr_info("%s\n", __func__); - - cp = ¶m->parm.capture; - tpf = &cp->timeperframe; - - if (!tpf->denominator) { - err("denominator is 0"); - ret = -EINVAL; - goto p_err; - } - - if (!tpf->numerator) { - err("numerator is 0"); - ret = -EINVAL; - goto p_err; - } - - duration = (u64)(tpf->numerator * 1000 * 1000 * 1000) / - (u64)(tpf->denominator); - - sensor = (struct fimc_is_module_enum *)v4l2_get_subdevdata(subdev); - if (!sensor) { - err("sensor is NULL"); - ret = -EINVAL; - goto p_err; - } - - ret = CALL_MOPS(sensor, s_duration, subdev, duration); - if (ret) { - err("s_duration is fail(%d)", ret); - goto p_err; - } - -p_err: - return ret; -} - -static int sensor_imx219_s_format(struct v4l2_subdev *subdev, struct v4l2_mbus_framefmt *fmt) -{ - /* TODO */ - return 0; -} - -static const struct v4l2_subdev_video_ops video_ops = { - .s_stream = sensor_imx219_s_stream, - .s_parm = sensor_imx219_s_param, - .s_mbus_fmt = sensor_imx219_s_format -}; - -static const struct v4l2_subdev_ops subdev_ops = { - .core = &core_ops, - .video = &video_ops -}; - -int sensor_imx219_stream_on(struct v4l2_subdev *subdev) -{ - int ret = 0; - struct fimc_is_module_enum *sensor; - struct i2c_client *client; - - BUG_ON(!subdev); - - sensor = (struct fimc_is_module_enum *)v4l2_get_subdevdata(subdev); - if (unlikely(!sensor)) { - err("sensor is NULL"); - ret = -EINVAL; - goto p_err; - } - - client = sensor->client; - if (unlikely(!client)) { - err("client is NULL"); - ret = -EINVAL; - goto p_err; - } - - ret = fimc_is_sensor_write8(client, 0x4100, 1); - if (ret < 0) { - err("fimc_is_sensor_write8 is fail(%d)", ret); - goto p_err; - } - -p_err: - return ret; -} - -int sensor_imx219_stream_off(struct v4l2_subdev *subdev) -{ - int ret = 0; - struct fimc_is_module_enum *sensor; - struct i2c_client *client; - - BUG_ON(!subdev); - - sensor = (struct fimc_is_module_enum *)v4l2_get_subdevdata(subdev); - if (unlikely(!sensor)) { - err("sensor is NULL"); - ret = -EINVAL; - goto p_err; - } - - client = sensor->client; - if (unlikely(!client)) { - err("client is NULL"); - ret = -EINVAL; - goto p_err; - } - - ret = fimc_is_sensor_write8(client, 0x4100, 0); - if (ret < 0) { - err("fimc_is_sensor_write8 is fail(%d)", ret); - goto p_err; - } - -p_err: - return ret; -} - -/* - * @ brief - * frame duration time - * @ unit - * nano second - * @ remarks - */ -int sensor_imx219_s_duration(struct v4l2_subdev *subdev, u64 duration) -{ - int ret = 0; - u8 value[2]; - struct fimc_is_module_enum *sensor; - struct i2c_client *client; - - BUG_ON(!subdev); - - pr_info("%s\n", __func__); - - sensor = (struct fimc_is_module_enum *)v4l2_get_subdevdata(subdev); - if (unlikely(!sensor)) { - err("sensor is NULL"); - ret = -EINVAL; - goto p_err; - } - - client = sensor->client; - if (unlikely(!client)) { - err("client is NULL"); - ret = -EINVAL; - goto p_err; - } - - /* - * forcely set 10fps for IMX219, - */ - value[0] = 0x52; - value[1] = 0x0; - - fimc_is_sensor_write8(client, SENSOR_REG_VIS_DURATION_MSB, value[1]); - fimc_is_sensor_write8(client, SENSOR_REG_VIS_DURATION_LSB, value[0]); - -p_err: - return ret; -} - -int sensor_imx219_g_min_duration(struct v4l2_subdev *subdev) -{ - int ret = 0; - return ret; -} - -int sensor_imx219_g_max_duration(struct v4l2_subdev *subdev) -{ - int ret = 0; - return ret; -} - -int sensor_imx219_s_exposure(struct v4l2_subdev *subdev, u64 exposure) -{ - int ret = 0; - u8 value; - struct fimc_is_module_enum *sensor; - struct i2c_client *client; - - BUG_ON(!subdev); - - pr_info("%s(%d)\n", __func__, (u32)exposure); - - sensor = (struct fimc_is_module_enum *)v4l2_get_subdevdata(subdev); - if (unlikely(!sensor)) { - err("sensor is NULL"); - ret = -EINVAL; - goto p_err; - } - - client = sensor->client; - if (unlikely(!client)) { - err("client is NULL"); - ret = -EINVAL; - goto p_err; - } - - value = exposure & 0xFF; - - fimc_is_sensor_write8(client, SENSOR_REG_VIS_AE_TARGET, value); - -p_err: - return ret; -} - -int sensor_imx219_g_min_exposure(struct v4l2_subdev *subdev) -{ - int ret = 0; - return ret; -} - -int sensor_imx219_g_max_exposure(struct v4l2_subdev *subdev) -{ - int ret = 0; - return ret; -} - -int sensor_imx219_s_again(struct v4l2_subdev *subdev, u64 sensitivity) -{ - int ret = 0; - - pr_info("%s\n", __func__); - - return ret; -} - -int sensor_imx219_g_min_again(struct v4l2_subdev *subdev) -{ - int ret = 0; - return ret; -} - -int sensor_imx219_g_max_again(struct v4l2_subdev *subdev) -{ - int ret = 0; - return ret; -} - -int sensor_imx219_s_dgain(struct v4l2_subdev *subdev) -{ - int ret = 0; - return ret; -} - -int sensor_imx219_g_min_dgain(struct v4l2_subdev *subdev) -{ - int ret = 0; - return ret; -} - -int sensor_imx219_g_max_dgain(struct v4l2_subdev *subdev) -{ - int ret = 0; - return ret; -} - -struct fimc_is_sensor_ops module_imx219_ops = { - .stream_on = sensor_imx219_stream_on, - .stream_off = sensor_imx219_stream_off, - .s_duration = sensor_imx219_s_duration, - .g_min_duration = sensor_imx219_g_min_duration, - .g_max_duration = sensor_imx219_g_max_duration, - .s_exposure = sensor_imx219_s_exposure, - .g_min_exposure = sensor_imx219_g_min_exposure, - .g_max_exposure = sensor_imx219_g_max_exposure, - .s_again = sensor_imx219_s_again, - .g_min_again = sensor_imx219_g_min_again, - .g_max_again = sensor_imx219_g_max_again, - .s_dgain = sensor_imx219_s_dgain, - .g_min_dgain = sensor_imx219_g_min_dgain, - .g_max_dgain = sensor_imx219_g_max_dgain -}; - -#ifdef CONFIG_OF -static int sensor_imx219_power_setpin(struct device *dev) -{ - int gpio_none = 0, gpio_reset = 0, gpio_standby = 0; - struct exynos_platform_fimc_is_sensor *pdata; - struct device_node *dnode; - struct pinctrl *pinctrl_ch = NULL; - - BUG_ON(!dev); - BUG_ON(!dev->platform_data); - - dnode = dev->of_node; - pdata = dev->platform_data; - - gpio_reset = of_get_named_gpio(dnode, "gpio_reset", 0); - if (!gpio_is_valid(gpio_reset)) { - dev_err(dev, "failed to get PIN_RESET\n"); - return -EINVAL; - } else { - gpio_request_one(gpio_reset, GPIOF_OUT_INIT_LOW, "CAM_GPIO_OUTPUT_LOW"); - gpio_free(gpio_reset); - } - - gpio_standby = of_get_named_gpio(dnode, "gpio_standby", 0); - if (!gpio_is_valid(gpio_standby)) { - dev_err(dev, "failed to get gpio_standby\n"); - } else { - gpio_request_one(gpio_standby, GPIOF_OUT_INIT_LOW, "CAM_GPIO_OUTPUT_LOW"); - gpio_free(gpio_standby); - } - - /* initial - i2c off */ - pinctrl_ch = devm_pinctrl_get_select(dev, "off1"); - if (IS_ERR_OR_NULL(pinctrl_ch)) { - pr_err("%s: cam %s pins are not configured\n", __func__, "off1"); - } else { - devm_pinctrl_put(pinctrl_ch); - } - - /* FRONT CAMERA - POWER ON */ - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 0, gpio_standby, 0, NULL, 0, PIN_OUTPUT_LOW); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 1, gpio_none, 0, "VT_CAM_1.8V", 0, PIN_REGULATOR_ON); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 2, gpio_none, 0, "VT_CAM_2.8V", 0, PIN_REGULATOR_ON); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 3, gpio_none, 0, "VT_CAM_1.2V", 1000, PIN_REGULATOR_ON); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 4, gpio_reset, 0, NULL, 0, PIN_OUTPUT_HIGH); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 5, gpio_none, 0, "ch", 0, PIN_FUNCTION); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 6, gpio_none, 0, NULL, 0, PIN_END); - - /* FRONT CAMERA - POWER OFF */ - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 0, gpio_standby, 0, NULL, 0, PIN_OUTPUT_LOW); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 1, gpio_none, 0, "off", 0, PIN_FUNCTION); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 2, gpio_reset, 0, NULL, 0, PIN_OUTPUT_LOW); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 3, gpio_none, 0, "VT_CAM_1.2V", 0, PIN_REGULATOR_OFF); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 4, gpio_none, 0, "VT_CAM_2.8V", 0, PIN_REGULATOR_OFF); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 5, gpio_none, 0, "VT_CAM_1.8V", 0, PIN_REGULATOR_OFF); - SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 6, gpio_none, 0, NULL, 0, PIN_END); - - /* VISION CAMERA - POWER ON */ - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_ON, 0, gpio_reset, 0, NULL, 0, PIN_OUTPUT_LOW); - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_ON, 1, gpio_none, 0, "VT_CAM_1.8V", 0, PIN_REGULATOR_ON); - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_ON, 2, gpio_none, 0, "VT_CAM_2.8V", 0, PIN_REGULATOR_ON); - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_ON, 3, gpio_none, 0, "VT_CAM_1.2V", 1000, PIN_REGULATOR_ON); - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_ON, 4, gpio_standby, 0, NULL, 0, PIN_OUTPUT_HIGH); - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_ON, 5, gpio_none, 0, "ch", 0, PIN_FUNCTION); - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_ON, 6, gpio_none, 0, NULL, 0, PIN_END); - - /* VISION CAMERA - POWER OFF */ - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_OFF, 0, gpio_reset, 0, NULL, 0, PIN_OUTPUT_LOW); - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_OFF, 1, gpio_none, 0, "off", 0, PIN_FUNCTION); - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_OFF, 2, gpio_standby, 0, NULL, 0, PIN_OUTPUT_LOW); - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_OFF, 3, gpio_none, 0, "VT_CAM_1.2V", 0, PIN_REGULATOR_OFF); - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_OFF, 4, gpio_none, 0, "VT_CAM_2.8V", 0, PIN_REGULATOR_OFF); - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_OFF, 5, gpio_none, 0, "VT_CAM_1.8V", 0, PIN_REGULATOR_OFF); - SET_PIN(pdata, SENSOR_SCENARIO_VISION, GPIO_SCENARIO_OFF, 6, gpio_none, 0, NULL, 0, PIN_END); - - return 0; -} -#endif - -int sensor_imx219_probe(struct i2c_client *client, - const struct i2c_device_id *id) -{ - int ret = 0; - struct fimc_is_core *core; - struct v4l2_subdev *subdev_module; - struct fimc_is_module_enum *module; - struct fimc_is_device_sensor *device; - struct sensor_open_extended *ext; - static bool probe_retried = false; - - if (!fimc_is_dev) - goto probe_defer; - - core = (struct fimc_is_core *)dev_get_drvdata(fimc_is_dev); - if (!core) { - err("core device is not yet probed"); - return -EPROBE_DEFER; - } - - device = &core->sensor[SENSOR_IMX219_INSTANCE]; - - subdev_module = kzalloc(sizeof(struct v4l2_subdev), GFP_KERNEL); - if (!subdev_module) { - err("subdev_module is NULL"); - ret = -ENOMEM; - goto p_err; - } - - /* IMX219 */ - module = &device->module_enum[atomic_read(&core->resourcemgr.rsccount_module)]; - atomic_inc(&core->resourcemgr.rsccount_module); - module->id = SENSOR_IMX219_NAME; - module->subdev = subdev_module; - module->device = SENSOR_IMX219_INSTANCE; - module->ops = &module_imx219_ops; - module->client = client; - module->active_width = 3264; - module->active_height = 2448; - module->pixel_width = module->active_width + 16; - module->pixel_height = module->active_height + 10; - module->max_framerate = 24; - module->position = SENSOR_POSITION_FRONT; - module->mode = CSI_MODE_CH0_ONLY; - module->lanes = CSI_DATA_LANES_2; - module->sensor_maker = "SONY"; - module->sensor_name = "IMX219"; - module->setfile_name = "setfile_imx219.bin"; - module->cfgs = ARRAY_SIZE(config_imx219); - module->cfg = config_imx219; - module->private_data = kzalloc(sizeof(struct fimc_is_module_imx219), GFP_KERNEL); - if (!module->private_data) { - err("private_data is NULL"); - ret = -ENOMEM; - kfree(subdev_module); - goto p_err; - } -#ifdef CONFIG_OF - module->power_setpin = sensor_imx219_power_setpin; -#endif - ext = &module->ext; - ext->mipi_lane_num = module->lanes; - ext->I2CSclk = I2C_L0; - ext->sensor_con.product_name = SENSOR_NAME_IMX219; - ext->sensor_con.peri_type = SE_I2C; - ext->sensor_con.peri_setting.i2c.channel = SENSOR_CONTROL_I2C1; - ext->sensor_con.peri_setting.i2c.slave_address = 0x34; - ext->sensor_con.peri_setting.i2c.speed = 400000; - - ext->from_con.product_name = FROMDRV_NAME_NOTHING; - - ext->companion_con.product_name = COMPANION_NAME_NOTHING; - - if (client) { - v4l2_i2c_subdev_init(subdev_module, client, &subdev_ops); - subdev_module->internal_ops = &internal_ops; - } else { - v4l2_subdev_init(subdev_module, &subdev_ops); - } - - v4l2_set_subdevdata(subdev_module, module); - v4l2_set_subdev_hostdata(subdev_module, device); - snprintf(subdev_module->name, V4L2_SUBDEV_NAME_SIZE, "sensor-subdev.%d", module->id); - -p_err: - info("%s(%d)\n", __func__, ret); - return ret; - -probe_defer: - if (probe_retried) { - err("probe has already been retried!!"); - BUG(); - } - - probe_retried = true; - err("core device is not yet probed"); - return -EPROBE_DEFER; -} - -static int sensor_imx219_remove(struct i2c_client *client) -{ - int ret = 0; - return ret; -} - -#ifdef CONFIG_OF -static const struct of_device_id exynos_fimc_is_sensor_imx219_match[] = { - { - .compatible = "samsung,exynos5-fimc-is-sensor-imx219", - }, - {}, -}; -#endif - -static const struct i2c_device_id sensor_imx219_idt[] = { - { SENSOR_NAME, 0 }, -}; - -static struct i2c_driver sensor_imx219_driver = { - .driver = { - .name = SENSOR_NAME, - .owner = THIS_MODULE, -#ifdef CONFIG_OF - .of_match_table = exynos_fimc_is_sensor_imx219_match -#endif - }, - .probe = sensor_imx219_probe, - .remove = sensor_imx219_remove, - .id_table = sensor_imx219_idt -}; - -static int __init sensor_imx219_load(void) -{ - return i2c_add_driver(&sensor_imx219_driver); -} - -static void __exit sensor_imx219_unload(void) -{ - i2c_del_driver(&sensor_imx219_driver); -} - -module_init(sensor_imx219_load); -module_exit(sensor_imx219_unload); - -MODULE_AUTHOR("Gilyeon lim"); -MODULE_DESCRIPTION("Sensor IMX219 driver"); -MODULE_LICENSE("GPL v2"); diff --git a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-imx219.h b/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-imx219.h deleted file mode 100644 index 6772939..0000000 --- a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-imx219.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Samsung Exynos5 SoC series Sensor driver - * - * - * Copyright (c) 2011 Samsung Electronics Co., Ltd - * - * 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_DEVICE_IMX219_H -#define FIMC_IS_DEVICE_IMX219_H - -#define SENSOR_IMX219_INSTANCE 1 -#define SENSOR_IMX219_NAME SENSOR_NAME_IMX219 - -struct fimc_is_module_imx219 { - u16 vis_duration; - u16 frame_length_line; - u32 line_length_pck; - u32 system_clock; -}; - -int sensor_imx219_probe(struct i2c_client *client, - const struct i2c_device_id *id); - -#endif diff --git a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-imx240.c b/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-imx240.c index f457223..5871726 100644 --- a/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-imx240.c +++ b/drivers/media/platform/exynos/fimc-is/sensor/fimc-is-device-imx240.c @@ -23,9 +23,7 @@ #include #include #include -#ifdef CONFIG_OF #include -#endif #include #include #include @@ -88,8 +86,6 @@ static const struct v4l2_subdev_ops subdev_ops = { .core = &core_ops }; -#ifdef CONFIG_OF -#ifdef CONFIG_COMPANION_USE static int sensor_imx240_power_setpin(struct device *dev) { struct exynos_platform_fimc_is_sensor *pdata; @@ -98,9 +94,7 @@ static int sensor_imx240_power_setpin(struct device *dev) int gpio_none = 0; int gpio_reset = 0; int gpios_cam_en = -EINVAL; -#ifdef CONFIG_OIS_USE int gpios_ois_en = 0; -#endif BUG_ON(!dev); BUG_ON(!dev->platform_data); @@ -142,7 +136,6 @@ static int sensor_imx240_power_setpin(struct device *dev) } } -#ifdef CONFIG_OIS_USE gpios_ois_en = of_get_named_gpio(dnode, "gpios_ois_en", 0); pdata->pin_ois_en = gpios_ois_en; if (!gpio_is_valid(gpios_ois_en)) { @@ -151,7 +144,6 @@ static int sensor_imx240_power_setpin(struct device *dev) gpio_request_one(gpios_ois_en, GPIOF_OUT_INIT_LOW, "CAM_GPIO_OUTPUT_LOW"); gpio_free(gpios_ois_en); } -#endif if (gpio_is_valid(gpios_cam_en)) { SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 0, gpios_cam_en, 0, NULL, 0, PIN_OUTPUT_HIGH); @@ -160,10 +152,8 @@ static int sensor_imx240_power_setpin(struct device *dev) } SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 1, gpio_none, 0, "CAM_SEN_CORE_1.2V_AP", 0, PIN_REGULATOR_ON); SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 2, gpio_none, 0, "CAM_AF_2.8V_AP", 2000, PIN_REGULATOR_ON); -#ifdef CONFIG_OIS_USE SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 3, gpios_ois_en, 0, NULL, 0, PIN_OUTPUT_HIGH); SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 4, gpio_none, 0, "OIS_VM_2.8V", 0, PIN_REGULATOR_ON); -#endif SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 5, gpio_none, 0, "CAM_IO_1.8V_AP", 0, PIN_REGULATOR_ON); SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 6, gpio_none, 0, "VDDA_1.8V_COMP", 0, PIN_REGULATOR_ON); SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_ON, 7, gpio_comp_en, 0, NULL, 150, PIN_OUTPUT_HIGH); @@ -193,13 +183,10 @@ static int sensor_imx240_power_setpin(struct device *dev) } SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 8, gpio_none, 0, "CAM_SEN_CORE_1.2V_AP", 0, PIN_REGULATOR_OFF); SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 9, gpio_none, 0, "CAM_IO_1.8V_AP", 0, PIN_REGULATOR_OFF); -#ifdef CONFIG_OIS_USE SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 10, gpios_ois_en, 0, NULL, 0, PIN_OUTPUT_LOW); SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 11, gpio_none, 0, "OIS_VM_2.8V", 0, PIN_REGULATOR_OFF); -#endif SET_PIN(pdata, SENSOR_SCENARIO_NORMAL, GPIO_SCENARIO_OFF, 12, gpio_none, 0, NULL, 0, PIN_END); -#ifdef CONFIG_OIS_USE /* OIS_FACTORY - POWER ON */ SET_PIN(pdata, SENSOR_SCENARIO_OIS_FACTORY, GPIO_SCENARIO_ON, 0, gpio_none, 0, "CAM_AF_2.8V_AP", 2000, PIN_REGULATOR_ON); SET_PIN(pdata, SENSOR_SCENARIO_OIS_FACTORY, GPIO_SCENARIO_ON, 1, gpios_ois_en, 0, NULL, 0, PIN_OUTPUT_HIGH); @@ -215,17 +202,9 @@ static int sensor_imx240_power_setpin(struct device *dev) SET_PIN(pdata, SENSOR_SCENARIO_OIS_FACTORY, GPIO_SCENARIO_OFF, 3, gpios_ois_en, 0, NULL, 0, PIN_OUTPUT_LOW); SET_PIN(pdata, SENSOR_SCENARIO_OIS_FACTORY, GPIO_SCENARIO_OFF, 4, gpio_none, 0, "OIS_VM_2.8V", 0, PIN_REGULATOR_OFF); SET_PIN(pdata, SENSOR_SCENARIO_OIS_FACTORY, GPIO_SCENARIO_OFF, 5, gpio_none, 0, NULL, 0, PIN_END); -#endif return 0; } -#else -static int sensor_imx240_power_setpin(struct device *dev) -{ - return 0; -} -#endif /* CONFIG_COMPANION_USE */ -#endif /* CONFIG_OF */ int sensor_imx240_probe(struct i2c_client *client, const struct i2c_device_id *id) @@ -275,9 +254,7 @@ int sensor_imx240_probe(struct i2c_client *client, module->cfg = config_imx240; module->ops = NULL; module->private_data = NULL; -#ifdef CONFIG_OF module->power_setpin = sensor_imx240_power_setpin; -#endif ext = &module->ext; ext->mipi_lane_num = module->lanes; @@ -313,7 +290,6 @@ int sensor_imx240_probe(struct i2c_client *client, ext->from_con.product_name = FROMDRV_NAME_NOTHING; -#ifdef CONFIG_COMPANION_USE ext->companion_con.product_name = COMPANION_NAME_73C1; ext->companion_con.peri_info0.valid = true; ext->companion_con.peri_info0.peri_type = SE_SPI; @@ -326,20 +302,12 @@ int sensor_imx240_probe(struct i2c_client *client, ext->companion_con.peri_info2.valid = true; ext->companion_con.peri_info2.peri_type = SE_FIMC_LITE; ext->companion_con.peri_info2.peri_setting.fimc_lite.channel = FLITE_ID_D; -#else - ext->companion_con.product_name = COMPANION_NAME_NOTHING; -#endif -#if defined(CONFIG_OIS_USE) ext->ois_con.product_name = OIS_NAME_IDG2030; ext->ois_con.peri_type = SE_I2C; ext->ois_con.peri_setting.i2c.channel = SENSOR_CONTROL_I2C1; ext->ois_con.peri_setting.i2c.slave_address = 0x48; ext->ois_con.peri_setting.i2c.speed = 400000; -#else - ext->ois_con.product_name = OIS_NAME_NOTHING; - ext->ois_con.peri_type = SE_NULL; -#endif if (client) v4l2_i2c_subdev_init(subdev_module, client, &subdev_ops); diff --git a/drivers/media/platform/exynos/fimc-is/setup-fimc-is-companion.c b/drivers/media/platform/exynos/fimc-is/setup-fimc-is-companion.c index c0b9f99..994e6d2 100644 --- a/drivers/media/platform/exynos/fimc-is/setup-fimc-is-companion.c +++ b/drivers/media/platform/exynos/fimc-is/setup-fimc-is-companion.c @@ -27,105 +27,11 @@ #include #include #include -#ifdef CONFIG_OF #include -#endif -#if defined(CONFIG_SOC_EXYNOS5422) -#include -#elif defined(CONFIG_SOC_EXYNOS5430) -#include -#elif defined(CONFIG_SOC_EXYNOS5433) -#include -#endif #include "exynos-fimc-is.h" #include "exynos-fimc-is-sensor.h" -#if defined(CONFIG_SOC_EXYNOS5422) -int exynos5422_fimc_is_companion_iclk_cfg(struct platform_device *pdev, - u32 scenario, - u32 channel) -{ - int ret = 0; - - pr_info("clk_cfg:(ch%d),scenario(%d)\n", channel, scenario); - - /* SCLK_SPI0_ISP */ - fimc_is_set_parent_dt(pdev, "mout_spi0_isp", "mout_spll_ctrl"); - fimc_is_set_rate_dt(pdev, "dout_spi0_isp", 200 * 1000000); - fimc_is_set_rate_dt(pdev, "dout_spi0_isp_pre", 100 * 1000000); - /* SCLK_SPI1_ISP */ - fimc_is_set_parent_dt(pdev, "mout_spi1_isp", "mout_spll_ctrl"); - fimc_is_set_rate_dt(pdev, "dout_spi1_isp", 200 * 1000000); - fimc_is_set_rate_dt(pdev, "dout_spi1_isp_pre", 100 * 1000000); - - /* I2C */ - /* CMU TOP */ - /* 333_432_ISP */ - fimc_is_set_parent_dt(pdev, "mout_aclk_333_432_isp", "mout_ipll_ctrl"); - fimc_is_set_rate_dt(pdev, "dout_aclk_333_432_isp", (432 * 1000000)); - fimc_is_set_parent_dt(pdev, "mout_aclk_333_432_isp_sw", "dout_aclk_333_432_isp"); - fimc_is_set_parent_dt(pdev, "mout_aclk_333_432_isp_user", "mout_aclk_333_432_isp_sw"); - - /* CMU ISP */ - /* ACLK_DIV0 */ - fimc_is_set_rate_dt(pdev, "dout_ispdiv0", (216 * 1000000)); - /* ACLK_DIV1 */ - fimc_is_set_rate_dt(pdev, "dout_ispdiv1", (108 * 1000000)); - /* ACLK_DIV2 */ - fimc_is_set_rate_dt(pdev, "dout_ispdiv2", (54 * 1000000)); - - return ret; -} - -int exynos5422_fimc_is_companion_iclk_on(struct platform_device *pdev, - u32 scenario, - u32 channel) -{ - return 0; -} - -int exynos5422_fimc_is_companion_iclk_off(struct platform_device *pdev, - u32 scenario, - u32 channel) -{ - return 0; -} - -int exynos5422_fimc_is_companion_mclk_on(struct platform_device *pdev, - u32 scenario, - u32 channel) -{ - u32 frequency; - char div_name[30]; - char sclk_name[30]; - - pr_info("%s:ch(%d)\n", __func__, channel); - - snprintf(div_name, sizeof(div_name), "dout_isp_sensor%d", channel); - snprintf(sclk_name, sizeof(sclk_name), "sclk_isp_sensor%d", channel); - - fimc_is_set_parent_dt(pdev, "mout_isp_sensor", "fin_pll"); - fimc_is_set_rate_dt(pdev, div_name, (24 * 1000000)); - fimc_is_enable_dt(pdev, sclk_name); - frequency = fimc_is_get_rate_dt(pdev, div_name); - - pr_info("%s(%d, mclk : %d)\n", __func__, channel, frequency); - - return 0; -} - -int exynos5422_fimc_is_companion_mclk_off(struct platform_device *pdev, - u32 scenario, - u32 channel) -{ - pr_debug("%s\n", __func__); - - fimc_is_disable_dt(pdev, "sclk_isp_sensor0"); - - return 0; -} -#elif defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) int exynos5430_fimc_is_companion_iclk_div_max(struct platform_device *pdev) { /* SCLK */ @@ -151,13 +57,6 @@ int exynos5430_fimc_is_companion_iclk_cfg(struct platform_device *pdev, fimc_is_set_rate_dt(pdev, "dout_sclk_isp_spi0_a", 200 * 1000000); fimc_is_set_rate_dt(pdev, "dout_sclk_isp_spi0_b", 100 * 1000000); fimc_is_set_parent_dt(pdev, "mout_sclk_isp_spi0_user", "sclk_isp_spi0_top"); -#if 0 - /* SCLK_SPI1_ISP */ - fimc_is_set_parent_dt(pdev, "mout_sclk_isp_spi1", "mout_bus_pll_user"); - fimc_is_set_rate_dt(pdev, "dout_sclk_isp_spi1_a", 275 * 1000000); - fimc_is_set_rate_dt(pdev, "dout_sclk_isp_spi1_b", 46 * 1000000); - fimc_is_set_parent_dt(pdev, "mout_sclk_isp_spi1_user", "sclk_isp_spi1_top"); -#endif /* I2C */ /* CMU TOP */ @@ -230,18 +129,13 @@ int exynos5430_fimc_is_companion_mclk_off(struct platform_device *pdev, return 0; } -#endif /* Wrapper functions */ int exynos_fimc_is_companion_iclk_cfg(struct platform_device *pdev, u32 scenario, u32 channel) { -#if defined(CONFIG_SOC_EXYNOS5422) - exynos5422_fimc_is_companion_iclk_cfg(pdev, scenario, channel); -#elif defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) exynos5430_fimc_is_companion_iclk_cfg(pdev, scenario, channel); -#endif return 0; } @@ -249,11 +143,7 @@ int exynos_fimc_is_companion_iclk_on(struct platform_device *pdev, u32 scenario, u32 channel) { -#if defined(CONFIG_SOC_EXYNOS5422) - exynos5422_fimc_is_companion_iclk_on(pdev, scenario, channel); -#elif defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) exynos5430_fimc_is_companion_iclk_on(pdev, scenario, channel); -#endif return 0; } @@ -261,11 +151,7 @@ int exynos_fimc_is_companion_iclk_off(struct platform_device *pdev, u32 scenario, u32 channel) { -#if defined(CONFIG_SOC_EXYNOS5422) - exynos5422_fimc_is_companion_iclk_off(pdev, scenario, channel); -#elif defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) exynos5430_fimc_is_companion_iclk_off(pdev, scenario, channel); -#endif return 0; } @@ -273,11 +159,7 @@ int exynos_fimc_is_companion_mclk_on(struct platform_device *pdev, u32 scenario, u32 channel) { -#if defined(CONFIG_SOC_EXYNOS5422) - exynos5422_fimc_is_companion_mclk_on(pdev, scenario, channel); -#elif defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) exynos5430_fimc_is_companion_mclk_on(pdev, scenario, channel); -#endif return 0; } @@ -285,10 +167,6 @@ int exynos_fimc_is_companion_mclk_off(struct platform_device *pdev, u32 scenario, u32 channel) { -#if defined(CONFIG_SOC_EXYNOS5422) - exynos5422_fimc_is_companion_mclk_off(pdev, scenario, channel); -#elif defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) exynos5430_fimc_is_companion_mclk_off(pdev, scenario, channel); -#endif return 0; } diff --git a/drivers/media/platform/exynos/fimc-is/setup-fimc-is-sensor.c b/drivers/media/platform/exynos/fimc-is/setup-fimc-is-sensor.c index d425a1f..5232695 100644 --- a/drivers/media/platform/exynos/fimc-is/setup-fimc-is-sensor.c +++ b/drivers/media/platform/exynos/fimc-is/setup-fimc-is-sensor.c @@ -27,16 +27,8 @@ #include #include #include -#ifdef CONFIG_OF #include -#endif -#if defined(CONFIG_SOC_EXYNOS5422) -#include -#elif defined(CONFIG_SOC_EXYNOS5430) -#include -#elif defined(CONFIG_SOC_EXYNOS5433) #include -#endif #include "exynos-fimc-is.h" #include "exynos-fimc-is-sensor.h" @@ -212,140 +204,6 @@ p_err: } -#if defined(CONFIG_SOC_EXYNOS5422) -int exynos5422_fimc_is_sensor_iclk_cfg(struct platform_device *pdev, - u32 scenario, - u32 channel) -{ - int ret = 0; - - pr_info("clk_cfg:(ch%d),scenario(%d)\n", channel, scenario); - - switch (channel) { - case 0: - /* MIPI-CSIS0 */ - fimc_is_set_parent_dt(pdev, "mout_gscl_wrap_a", "mout_mpll_ctrl"); - fimc_is_set_rate_dt(pdev, "dout_gscl_wrap_a", (532 * 1000000)); - fimc_is_get_rate_dt(pdev, "dout_gscl_wrap_a"); - break; - case 1: - /* FL1_550_CAM */ - fimc_is_set_parent_dt(pdev, "mout_aclk_fl1_550_cam", "mout_mpll_ctrl"); - fimc_is_set_rate_dt(pdev, "dout_aclk_fl1_550_cam", (76 * 1000000)); - fimc_is_set_parent_dt(pdev, "mout_aclk_fl1_550_cam_sw", "dout_aclk_fl1_550_cam"); - fimc_is_set_parent_dt(pdev, "mout_aclk_fl1_550_cam_user", "mout_aclk_fl1_550_cam_sw"); - fimc_is_set_rate_dt(pdev, "dout2_cam_blk_550", (38 * 1000000)); - - /* MIPI-CSIS1 */ - fimc_is_set_parent_dt(pdev, "mout_gscl_wrap_b", "mout_mpll_ctrl"); - fimc_is_set_rate_dt(pdev, "dout_gscl_wrap_b", (76 * 1000000)); - fimc_is_get_rate_dt(pdev, "dout_gscl_wrap_b"); - break; - default: - pr_err("channel is invalid(%d)\n", channel); - break; - } - - return ret; -} - -int exynos5422_fimc_is_sensor_iclk_on(struct platform_device *pdev, - u32 scenario, - u32 channel) -{ - return 0; -} - -int exynos5422_fimc_is_sensor_iclk_off(struct platform_device *pdev, - u32 scenario, - u32 channel) -{ - return 0; -} - -int exynos5422_fimc_is_sensor_mclk_on(struct platform_device *pdev, - u32 scenario, - u32 channel) -{ - u32 frequency; - char div_name[30]; - char sclk_name[30]; - - pr_info("%s:ch(%d)\n", __func__, channel); - - snprintf(div_name, sizeof(div_name), "dout_isp_sensor%d", channel); - snprintf(sclk_name, sizeof(sclk_name), "sclk_isp_sensor%d", channel); - - fimc_is_set_parent_dt(pdev, "mout_isp_sensor", "fin_pll"); - fimc_is_set_rate_dt(pdev, div_name, (24 * 1000000)); - fimc_is_enable_dt(pdev, sclk_name); - frequency = fimc_is_get_rate_dt(pdev, div_name); - - switch (channel) { - case SENSOR_CONTROL_I2C0: - fimc_is_enable_dt(pdev, "sclk_gscl_wrap_a"); - fimc_is_enable_dt(pdev, "clk_camif_top_fimcl0"); - fimc_is_enable_dt(pdev, "clk_camif_top_fimcl3"); - fimc_is_enable_dt(pdev, "gscl_fimc_lite0"); - fimc_is_enable_dt(pdev, "gscl_fimc_lite3"); - fimc_is_enable_dt(pdev, "clk_gscl_wrap_a"); - break; - case SENSOR_CONTROL_I2C1: - case SENSOR_CONTROL_I2C2: - fimc_is_enable_dt(pdev, "sclk_gscl_wrap_b"); - fimc_is_enable_dt(pdev, "clk_camif_top_fimcl1"); - fimc_is_enable_dt(pdev, "gscl_fimc_lite1"); - fimc_is_enable_dt(pdev, "clk_gscl_wrap_b"); - break; - default: - pr_err("channel is invalid(%d)\n", channel); - break; - } - - fimc_is_enable_dt(pdev, "clk_camif_top_csis0"); - fimc_is_enable_dt(pdev, "clk_xiu_si_gscl_cam"); - fimc_is_enable_dt(pdev, "clk_noc_p_rstop_fimcl"); - - pr_info("%s(%d, mclk : %d)\n", __func__, channel, frequency); - - return 0; -} - -int exynos5422_fimc_is_sensor_mclk_off(struct platform_device *pdev, - u32 scenario, - u32 channel) -{ - char sclk_name[30]; - - pr_debug("%s\n", __func__); - - snprintf(sclk_name, sizeof(sclk_name), "sclk_isp_sensor%d", channel); - - fimc_is_disable_dt(pdev, sclk_name); - - switch (channel) { - case SENSOR_CONTROL_I2C0: - fimc_is_disable_dt(pdev, "sclk_gscl_wrap_a"); - fimc_is_disable_dt(pdev, "clk_camif_top_fimcl0"); - fimc_is_disable_dt(pdev, "clk_camif_top_fimcl3"); - fimc_is_disable_dt(pdev, "gscl_fimc_lite0"); - fimc_is_disable_dt(pdev, "gscl_fimc_lite3"); - fimc_is_disable_dt(pdev, "clk_gscl_wrap_a"); - break; - case SENSOR_CONTROL_I2C2: - fimc_is_disable_dt(pdev, "sclk_gscl_wrap_b"); - fimc_is_disable_dt(pdev, "clk_camif_top_fimcl1"); - fimc_is_disable_dt(pdev, "gscl_fimc_lite1"); - fimc_is_disable_dt(pdev, "clk_gscl_wrap_b"); - break; - default: - pr_err("channel is invalid(%d)\n", channel); - break; - } - - return 0; -} -#elif defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) int exynos5430_fimc_is_sensor_iclk_cfg(struct platform_device *pdev, u32 scenario, u32 channel) @@ -608,18 +466,13 @@ int exynos5430_fimc_is_sensor_mclk_off(struct platform_device *pdev, return 0; } -#endif /* Wrapper functions */ int exynos_fimc_is_sensor_iclk_cfg(struct platform_device *pdev, u32 scenario, u32 channel) { -#if defined(CONFIG_SOC_EXYNOS5422) - exynos5422_fimc_is_sensor_iclk_cfg(pdev, scenario, channel); -#elif defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) exynos5430_fimc_is_sensor_iclk_cfg(pdev, scenario, channel); -#endif return 0; } @@ -627,11 +480,7 @@ int exynos_fimc_is_sensor_iclk_on(struct platform_device *pdev, u32 scenario, u32 channel) { -#if defined(CONFIG_SOC_EXYNOS5422) - exynos5422_fimc_is_sensor_iclk_on(pdev, scenario, channel); -#elif defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) exynos5430_fimc_is_sensor_iclk_on(pdev, scenario, channel); -#endif return 0; } @@ -639,11 +488,7 @@ int exynos_fimc_is_sensor_iclk_off(struct platform_device *pdev, u32 scenario, u32 channel) { -#if defined(CONFIG_SOC_EXYNOS5422) - exynos5422_fimc_is_sensor_iclk_off(pdev, scenario, channel); -#elif defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) exynos5430_fimc_is_sensor_iclk_off(pdev, scenario, channel); -#endif return 0; } @@ -651,11 +496,7 @@ int exynos_fimc_is_sensor_mclk_on(struct platform_device *pdev, u32 scenario, u32 channel) { -#if defined(CONFIG_SOC_EXYNOS5422) - exynos5422_fimc_is_sensor_mclk_on(pdev, scenario, channel); -#elif defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) exynos5430_fimc_is_sensor_mclk_on(pdev, scenario, channel); -#endif return 0; } @@ -663,10 +504,6 @@ int exynos_fimc_is_sensor_mclk_off(struct platform_device *pdev, u32 scenario, u32 channel) { -#if defined(CONFIG_SOC_EXYNOS5422) - exynos5422_fimc_is_sensor_mclk_off(pdev, scenario, channel); -#elif defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) exynos5430_fimc_is_sensor_mclk_off(pdev, scenario, channel); -#endif return 0; } diff --git a/drivers/media/platform/exynos/fimc-is/setup-fimc-is.c b/drivers/media/platform/exynos/fimc-is/setup-fimc-is.c index fdc8861..bb3613f 100644 --- a/drivers/media/platform/exynos/fimc-is/setup-fimc-is.c +++ b/drivers/media/platform/exynos/fimc-is/setup-fimc-is.c @@ -28,16 +28,7 @@ #include #include #include "exynos-fimc-is.h" -#ifdef CONFIG_OF #include -#endif -#if defined(CONFIG_SOC_EXYNOS5422) -#include -#elif defined(CONFIG_SOC_EXYNOS5430) -#include -#elif defined(CONFIG_SOC_EXYNOS5433) -#include -#endif struct platform_device; /* don't need the contents */ @@ -73,21 +64,6 @@ int fimc_is_set_parent_dt(struct platform_device *pdev, return clk_set_parent(c, p); } -/* utility function to get parent with DT */ -struct clk *fimc_is_get_parent_dt(struct platform_device *pdev, - const char *child) -{ - struct clk *c; - - c = clk_get(&pdev->dev, child); - if (IS_ERR(c)) { - pr_err("%s: could not lookup clock : %s\n", __func__, child); - return NULL; - } - - return clk_get_parent(c); -} - /* utility function to set rate with DT */ int fimc_is_set_rate_dt(struct platform_device *pdev, const char *conid, unsigned int rate) @@ -154,452 +130,6 @@ void fimc_is_disable_dt(struct platform_device *pdev, clk_unprepare(target); } -#if defined(CONFIG_SOC_EXYNOS5422) -int exynos5422_fimc_is_clk_gate(u32 clk_gate_id, bool is_on) -{ - int cfg = 0; - u32 value = 0; - - if (clk_gate_id == 0) - return 0; - - /* CAM block */ - /* 3AA 0*/ - if (clk_gate_id & (1 << FIMC_IS_GATE_3AA0_IP)) { - value |= ((1 << 31) | (1 << 27)); - cfg = readl(EXYNOS5_CLK_GATE_IP_CAM); - if (is_on) - writel(cfg | value, EXYNOS5_CLK_GATE_IP_CAM); - else - writel(cfg & ~(value), EXYNOS5_CLK_GATE_IP_CAM); - pr_debug("%s :1 [%s] gate(%d) (0x%x) * (0x%x)\n", __func__, - is_on ? "ON" : "OFF", - clk_gate_id, - cfg, - value); - } - - /* 3AA 1*/ - value = 0; - if (clk_gate_id & (1 << FIMC_IS_GATE_3AA1_IP)) { - value |= ((1 << 9) | (1 << 4)); - cfg = readl(EXYNOS5_CLK_GATE_IP_GSCL0); - if (is_on) - writel(cfg | value, EXYNOS5_CLK_GATE_IP_GSCL0); - else - writel(cfg & ~(value), EXYNOS5_CLK_GATE_IP_GSCL0); - pr_debug("%s :1 [%s] gate(%d) (0x%x) * (0x%x)\n", __func__, - is_on ? "ON" : "OFF", - clk_gate_id, - cfg, - value); - } - - /* ISP block */ - value = 0; - if (clk_gate_id & (1 << FIMC_IS_GATE_ISP_IP)) - value |= (1 << 0); - if (clk_gate_id & (1 << FIMC_IS_GATE_DRC_IP)) - value |= (1 << 1); - if (clk_gate_id & (1 << FIMC_IS_GATE_FD_IP)) - value |= (1 << 2); - if (clk_gate_id & (1 << FIMC_IS_GATE_SCC_IP)) - value |= (1 << 3); - if (clk_gate_id & (1 << FIMC_IS_GATE_SCP_IP)) - value |= (1 << 4); - if (value > 0) { - cfg = readl(EXYNOS5_CLK_GATE_IP_ISP0); - if (is_on) - writel(cfg | value, EXYNOS5_CLK_GATE_IP_ISP0); - else - writel(cfg & ~(value), EXYNOS5_CLK_GATE_IP_ISP0); - pr_debug("%s :1 [%s] gate(%d) (0x%x) * (0x%x)\n", __func__, - is_on ? "ON" : "OFF", - clk_gate_id, - cfg, - value); - } - - value = 0; - if (clk_gate_id & (1 << FIMC_IS_GATE_3DNR_IP)) - value |= (1 << 2); - if (value > 0) { - cfg = readl(EXYNOS5_CLK_GATE_IP_ISP1); - if (is_on) - writel(cfg | value, EXYNOS5_CLK_GATE_IP_ISP1); - else - writel(cfg & ~(value), EXYNOS5_CLK_GATE_IP_ISP1); - pr_debug("%s :1 [%s] gate(%d) (0x%x) * (0x%x)\n", __func__, - is_on ? "ON" : "OFF", - clk_gate_id, - cfg, - value); - } - -/* - pr_info("%s : [%s] gate(%d) (0x%x)\n", __func__, - is_on ? "ON" : "OFF", - clk_gate_id, - cfg); -*/ - return 0; -} - -int exynos5422_cfg_clk_div_max(struct platform_device *pdev) -{ - pr_info("%s\n", __func__); - /* CMU TOP */ - /* 333_432_ISP0 */ - fimc_is_set_rate_dt(pdev, "dout_aclk_333_432_isp0", 1); - /* 333_432_ISP */ - fimc_is_set_rate_dt(pdev, "dout_aclk_333_432_isp", 1); - /* 400_ISP */ - fimc_is_set_rate_dt(pdev, "dout_aclk_400_isp", 1); - /* 266_ISP */ - fimc_is_set_rate_dt(pdev, "dout_aclk_266_isp", 1); - - /* 333_432_GSCL */ - fimc_is_set_rate_dt(pdev, "dout_aclk_333_432_gscl", 1); - /* 432_CAM */ - fimc_is_set_rate_dt(pdev, "dout_aclk_432_cam", 1); - /* FL1_550_CAM */ - fimc_is_set_rate_dt(pdev, "dout_aclk_fl1_550_cam", 1); - /* 550_CAM */ - fimc_is_set_rate_dt(pdev, "dout_aclk_550_cam", 1); - - return 0; -} - -int exynos5422_cfg_clk_sclk(struct platform_device *pdev) -{ - pr_info("%s\n", __func__); -#ifndef CONFIG_COMPANION_USE - /* SCLK_SPI0_ISP */ - fimc_is_set_parent_dt(pdev, "mout_spi0_isp", "mout_spll_ctrl"); - fimc_is_set_rate_dt(pdev, "dout_spi0_isp", 200 * 1000000); - fimc_is_set_rate_dt(pdev, "dout_spi0_isp_pre", 100 * 1000000); - /* SCLK_SPI1_ISP */ - fimc_is_set_parent_dt(pdev, "mout_spi1_isp", "mout_spll_ctrl"); - fimc_is_set_rate_dt(pdev, "dout_spi1_isp", 200 * 1000000); - fimc_is_set_rate_dt(pdev, "dout_spi1_isp_pre", 100 * 1000000); -#endif - /* SCLK_UART_ISP */ - fimc_is_set_parent_dt(pdev, "mout_uart_isp", "fin_pll"); - fimc_is_set_rate_dt(pdev, "dout_uart_isp", (24* 1000000)); - /* SCLK_PWM_ISP */ - fimc_is_set_parent_dt(pdev, "mout_pwm_isp", "fin_pll"); - fimc_is_set_rate_dt(pdev, "dout_pwm_isp", (2 * 1000000)); - - return 0; -} - -int exynos5422_cfg_clk_cam(struct platform_device *pdev) -{ - pr_info("%s\n", __func__); - /* CMU TOP */ - /* 333_432_GSCL */ - fimc_is_set_parent_dt(pdev, "mout_aclk_333_432_gscl", "mout_ipll_ctrl"); - fimc_is_set_rate_dt(pdev, "dout_aclk_333_432_gscl", (432 * 1000000)); - fimc_is_set_parent_dt(pdev, "mout_aclk_333_432_gscl_sw", "dout_aclk_333_432_gscl"); - fimc_is_set_parent_dt(pdev, "mout_aclk_333_432_gscl_user", "mout_aclk_333_432_gscl_sw"); - /* 432_CAM */ - fimc_is_set_parent_dt(pdev, "mout_aclk_432_cam", "mout_ipll_ctrl"); - fimc_is_set_rate_dt(pdev, "dout_aclk_432_cam", (432 * 1000000)); - fimc_is_set_parent_dt(pdev, "mout_aclk_432_cam_sw", "dout_aclk_432_cam"); - fimc_is_set_parent_dt(pdev, "mout_aclk_432_cam_user", "mout_aclk_432_cam_sw"); - /* 550_CAM */ - fimc_is_set_parent_dt(pdev, "mout_aclk_550_cam", "mout_mpll_ctrl"); - fimc_is_set_rate_dt(pdev, "dout_aclk_550_cam", (532 * 1000000)); - fimc_is_set_parent_dt(pdev, "mout_aclk_550_cam_sw", "dout_aclk_550_cam"); - fimc_is_set_parent_dt(pdev, "mout_aclk_550_cam_user", "mout_aclk_550_cam_sw"); - - /* CMU CAM */ - /* CLKDIV2_GSCL_BLK_333 */ - fimc_is_set_rate_dt(pdev, "dout2_gscl_blk_333", (217 * 1000000)); - /* CLKDIV2_CAM_BLK_432 */ - fimc_is_set_rate_dt(pdev, "dout2_cam_blk_432", (217 * 1000000)); - - return 0; -} - -int exynos5422_cfg_clk_isp(struct platform_device *pdev) -{ - - /* CMU TOP */ - /* 333_432_ISP0 */ - fimc_is_set_parent_dt(pdev, "mout_aclk_333_432_isp0", "mout_ipll_ctrl"); - fimc_is_set_rate_dt(pdev, "dout_aclk_333_432_isp0", (432 * 1000000)); - fimc_is_set_parent_dt(pdev, "mout_aclk_333_432_isp0_sw", "dout_aclk_333_432_isp0"); - fimc_is_set_parent_dt(pdev, "mout_aclk_333_432_isp0_user", "mout_aclk_333_432_isp0_sw"); - /* 333_432_ISP */ - fimc_is_set_parent_dt(pdev, "mout_aclk_333_432_isp", "mout_ipll_ctrl"); - fimc_is_set_rate_dt(pdev, "dout_aclk_333_432_isp", (432 * 1000000)); - fimc_is_set_parent_dt(pdev, "mout_aclk_333_432_isp_sw", "dout_aclk_333_432_isp"); - fimc_is_set_parent_dt(pdev, "mout_aclk_333_432_isp_user", "mout_aclk_333_432_isp_sw"); - /* 400_ISP */ - fimc_is_set_parent_dt(pdev, "mout_aclk_400_isp", "mout_mpll_ctrl"); - fimc_is_set_rate_dt(pdev, "dout_aclk_400_isp", (532 * 1000000)); - fimc_is_set_parent_dt(pdev, "mout_aclk_400_isp_sw", "dout_aclk_400_isp"); - fimc_is_set_parent_dt(pdev, "mout_aclk_400_isp_user", "mout_aclk_400_isp_sw"); - /* 266_ISP */ - fimc_is_set_parent_dt(pdev, "mout_aclk_266_isp", "mout_ipll_ctrl"); - fimc_is_set_rate_dt(pdev, "dout_aclk_266_isp", (432 * 1000000)); - fimc_is_set_parent_dt(pdev, "mout_aclk_266_isp_sw", "dout_aclk_266_isp"); - fimc_is_set_parent_dt(pdev, "mout_aclk_266_isp_user", "mout_aclk_266_isp_sw"); - - /* CMU ISP */ - /* ACLK_MCUISP_DIV0 */ - fimc_is_set_rate_dt(pdev, "dout_mcuispdiv0", (267 * 1000000)); - /* ACLK_MCUISP_DIV1 */ - fimc_is_set_rate_dt(pdev, "dout_mcuispdiv1", (134 * 1000000)); - /* ACLK_DIV0 */ - fimc_is_set_rate_dt(pdev, "dout_ispdiv0", (216 * 1000000)); - /* ACLK_DIV1 */ - fimc_is_set_rate_dt(pdev, "dout_ispdiv1", (108 * 1000000)); - /* ACLK_DIV2 */ - fimc_is_set_rate_dt(pdev, "dout_ispdiv2", (54 * 1000000)); - - return 0; -} - -int exynos5422_fimc_is_print_clk(struct platform_device *pdev) -{ - pr_debug("%s\n", __func__); - - fimc_is_get_rate_dt(pdev, "mout_aclk_550_cam_user"); - fimc_is_get_rate_dt(pdev, "mout_aclk_fl1_550_cam_user"); - fimc_is_get_rate_dt(pdev, "mout_aclk_432_cam_user"); - fimc_is_get_rate_dt(pdev, "mout_aclk_333_432_gscl_user"); - fimc_is_get_rate_dt(pdev, "mout_aclk_333_432_isp0_user"); - fimc_is_get_rate_dt(pdev, "mout_aclk_333_432_isp_user"); - fimc_is_get_rate_dt(pdev, "mout_aclk_400_isp_user"); - fimc_is_get_rate_dt(pdev, "mout_aclk_266_isp_user"); - - fimc_is_get_rate_dt(pdev, "dout_mcuispdiv0"); - fimc_is_get_rate_dt(pdev, "dout_mcuispdiv1"); - fimc_is_get_rate_dt(pdev, "dout_ispdiv0"); - fimc_is_get_rate_dt(pdev, "dout_ispdiv1"); - fimc_is_get_rate_dt(pdev, "dout_ispdiv2"); - - fimc_is_get_rate_dt(pdev, "dout2_gscl_blk_333"); - fimc_is_get_rate_dt(pdev, "dout2_cam_blk_432"); - fimc_is_get_rate_dt(pdev, "dout2_cam_blk_550"); - - fimc_is_get_rate_dt(pdev, "dout_pwm_isp"); - fimc_is_get_rate_dt(pdev, "dout_uart_isp"); - fimc_is_get_rate_dt(pdev, "dout_spi0_isp_pre"); - fimc_is_get_rate_dt(pdev, "dout_spi1_isp_pre"); - - /* CMU_TOP_DUMP */ - pr_info("EXYNOS5_CLK_SRC_TOP0(0x%08X)\n", readl(EXYNOS5_CLK_SRC_TOP0)); - pr_info("EXYNOS5_CLK_SRC_TOP1(0x%08X)\n", readl(EXYNOS5_CLK_SRC_TOP1)); - pr_info("EXYNOS5_CLK_SRC_TOP3(0x%08X)\n", readl(EXYNOS5_CLK_SRC_TOP3)); - pr_info("EXYNOS5_CLK_SRC_TOP4(0x%08X)\n", readl(EXYNOS5_CLK_SRC_TOP4)); - pr_info("EXYNOS5_CLK_SRC_TOP8(0x%08X)\n", readl(EXYNOS5_CLK_SRC_TOP8)); - pr_info("EXYNOS5_CLK_SRC_TOP9(0x%08X)\n", readl(EXYNOS5_CLK_SRC_TOP9)); - pr_info("EXYNOS5_CLK_SRC_TOP11(0x%08X)\n", readl(EXYNOS5_CLK_SRC_TOP11)); - pr_info("EXYNOS5_CLK_SRC_TOP13(0x%08X)\n", readl(EXYNOS5_CLK_SRC_TOP13)); - - pr_info("EXYNOS5_CLK_DIV_TOP0(0x%08X)\n", readl(EXYNOS5_CLK_DIV_TOP0)); - pr_info("EXYNOS5_CLK_DIV_TOP1(0x%08X)\n", readl(EXYNOS5_CLK_DIV_TOP1)); - pr_info("EXYNOS5_CLK_DIV_TOP8(0x%08X)\n", readl(EXYNOS5_CLK_DIV_TOP8)); - - return 0; -} - -int exynos5422_fimc_is_cfg_clk(struct platform_device *pdev) -{ - pr_info("%s\n", __func__); - - /* initialize Clocks */ - exynos5422_cfg_clk_sclk(pdev); - exynos5422_cfg_clk_cam(pdev); - exynos5422_cfg_clk_isp(pdev); - - return 0; -} - -int exynos5422_fimc_is_clk_on(struct platform_device *pdev) -{ - pr_debug("%s\n", __func__); - - fimc_is_enable_dt(pdev, "sclk_uart_isp"); - fimc_is_enable_dt(pdev, "sclk_pwm_isp"); - fimc_is_enable_dt(pdev, "sclk_spi0_isp"); - - fimc_is_enable_dt(pdev, "clk_3aa"); - fimc_is_enable_dt(pdev, "clk_camif_top_3aa"); - fimc_is_enable_dt(pdev, "clk_3aa_2"); - fimc_is_enable_dt(pdev, "clk_camif_top_3aa0"); - - return 0; -} - -int exynos5422_fimc_is_clk_off(struct platform_device *pdev) -{ - pr_debug("%s\n", __func__); - - exynos5422_cfg_clk_div_max(pdev); - fimc_is_disable_dt(pdev, "sclk_uart_isp"); - fimc_is_disable_dt(pdev, "sclk_pwm_isp"); - fimc_is_disable_dt(pdev, "sclk_spi0_isp"); - - fimc_is_disable_dt(pdev, "clk_3aa"); - fimc_is_disable_dt(pdev, "clk_camif_top_3aa"); - fimc_is_disable_dt(pdev, "clk_3aa_2"); - fimc_is_disable_dt(pdev, "clk_camif_top_3aa0"); - - return 0; -} - -/* sequence is important, don't change order */ -int exynos5422_fimc_is_sensor_power_on(struct platform_device *pdev, int sensor_id) -{ - pr_debug("%s\n", __func__); - - return 0; -} - -/* sequence is important, don't change order */ -int exynos5422_fimc_is_sensor_power_off(struct platform_device *pdev, int sensor_id) -{ - pr_debug("%s\n", __func__); - - return 0; -} - -int exynos5422_fimc_is_print_pwr(struct platform_device *pdev) -{ - pr_debug("%s\n", __func__); - - pr_info("ISP power state(0x%08x)\n", readl(EXYNOS5422_ISP_STATUS)); - pr_info("CAM power state(0x%08x)\n", readl(EXYNOS5422_CAM_STATUS)); - pr_info("CA5 power state(0x%08x)\n", readl(EXYNOS5422_ISP_ARM_STATUS)); - - return 0; -} - -int exynos5422_fimc_is_set_user_clk_gate(u32 group_id, - bool is_on, - u32 user_scenario_id, - unsigned long msk_state, - struct exynos_fimc_is_clk_gate_info *gate_info) { - /* if you want to skip clock on/off, let this func return -1 */ - int ret = -1; - - switch (user_scenario_id) { - case CLK_GATE_FULL_BYPASS_SN: - if (is_on == true) - gate_info->groups[group_id].mask_clk_on_mod &= - ~((1 << FIMC_IS_GATE_DIS_IP) | - (1 << FIMC_IS_GATE_3DNR_IP)); - else - gate_info->groups[group_id].mask_clk_off_self_mod |= - ((1 << FIMC_IS_GATE_DIS_IP) | - (1 << FIMC_IS_GATE_3DNR_IP)); - ret = 0; - break; - case CLK_GATE_DIS_SN: - if (is_on == true) - gate_info->groups[group_id].mask_clk_on_mod |= - ((1 << FIMC_IS_GATE_DIS_IP) | - (1 << FIMC_IS_GATE_3DNR_IP)); - else - gate_info->groups[group_id].mask_clk_off_self_mod |= - ((1 << FIMC_IS_GATE_DIS_IP) | - (1 << FIMC_IS_GATE_3DNR_IP)); - ret = 0; - break; - default: - ret = 0; - break; - } - - return ret; -} -#elif defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) -int exynos5430_fimc_is_clk_gate(u32 clk_gate_id, bool is_on) -{ - int cfg = 0; - u32 value = 0; - - if (clk_gate_id == 0) - return 0; - - /* CAM00 */ - if (clk_gate_id & (1 << FIMC_IS_GATE_3AA1_IP)) - value |= (1 << 4); - if (clk_gate_id & (1 << FIMC_IS_GATE_3AA0_IP)) - value |= (1 << 3); - - if (value > 0) { - cfg = readl(EXYNOS5430_ENABLE_IP_CAM00); - if (is_on) - writel(cfg | value, EXYNOS5430_ENABLE_IP_CAM00); - else - writel(cfg & ~(value), EXYNOS5430_ENABLE_IP_CAM00); - pr_debug("%s :1 [%s] gate(%d) (0x%x) * (0x%x)\n", __func__, - is_on ? "ON" : "OFF", - clk_gate_id, - cfg, - value); - } - - - /* ISP 0 */ - value = 0; - if (clk_gate_id & (1 << FIMC_IS_GATE_ISP_IP)) - value |= (1 << 0); - if (clk_gate_id & (1 << FIMC_IS_GATE_DRC_IP)) - value |= (1 << 1); - if (clk_gate_id & (1 << FIMC_IS_GATE_SCC_IP)) - value |= (1 << 2); - if (clk_gate_id & (1 << FIMC_IS_GATE_DIS_IP)) - value |= (1 << 3); - if (clk_gate_id & (1 << FIMC_IS_GATE_3DNR_IP)) - value |= (1 << 4); - if (clk_gate_id & (1 << FIMC_IS_GATE_SCP_IP)) - value |= (1 << 5); - - if (value > 0) { - cfg = readl(EXYNOS5430_ENABLE_IP_ISP0); - if (is_on) - writel(cfg | value, EXYNOS5430_ENABLE_IP_ISP0); - else - writel(cfg & ~(value), EXYNOS5430_ENABLE_IP_ISP0); - pr_debug("%s :2 [%s] gate(%d) (0x%x) * (0x%x)\n", __func__, - is_on ? "ON" : "OFF", - clk_gate_id, - cfg, - value); - } - - /* CAM 10 */ - value = 0; - if (clk_gate_id & (1 << FIMC_IS_GATE_FD_IP)) - value |= (1 << 3); - - if (value > 0) { - cfg = readl(EXYNOS5430_ENABLE_IP_CAM10); - if (is_on) - writel(cfg | value, EXYNOS5430_ENABLE_IP_CAM10); - else - writel(cfg & ~(value), EXYNOS5430_ENABLE_IP_CAM10); - pr_debug("%s :3 [%s] gate(%d) (0x%x) * (0x%x)\n", __func__, - is_on ? "ON" : "OFF", - clk_gate_id, - cfg, - value); - } -/* - pr_info("%s : [%s] gate(%d) (0x%x)\n", __func__, - is_on ? "ON" : "OFF", - clk_gate_id, - cfg); -*/ - return 0; -} - static int exynos5430_cfg_clk_isp_pll_on(struct platform_device *pdev) { pr_info("%s\n", __func__); @@ -623,17 +153,6 @@ static int exynos5430_cfg_clk_isp_pll_off(struct platform_device *pdev) int exynos5430_cfg_clk_div_max(struct platform_device *pdev) { /* SCLK */ -#ifndef CONFIG_COMPANION_USE - /* SCLK_SPI0 */ - fimc_is_set_parent_dt(pdev, "mout_sclk_isp_spi0", "oscclk"); - fimc_is_set_rate_dt(pdev, "dout_sclk_isp_spi0_a", 1); - fimc_is_set_parent_dt(pdev, "mout_sclk_isp_spi0_user", "oscclk"); - - /* SCLK_SPI1 */ - fimc_is_set_parent_dt(pdev, "mout_sclk_isp_spi1", "oscclk"); - fimc_is_set_rate_dt(pdev, "dout_sclk_isp_spi1_a", 1); - fimc_is_set_parent_dt(pdev, "mout_sclk_isp_spi1_user", "oscclk"); -#endif /* SCLK_UART */ fimc_is_set_parent_dt(pdev, "mout_sclk_isp_uart", "oscclk"); @@ -650,14 +169,6 @@ int exynos5430_cfg_clk_div_max(struct platform_device *pdev) int exynos5430_cfg_clk_sclk(struct platform_device *pdev) { -#ifndef CONFIG_COMPANION_USE - /* SCLK_SPI0 */ - fimc_is_set_parent_dt(pdev, "mout_sclk_isp_spi0", "mout_bus_pll_user"); - fimc_is_set_rate_dt(pdev, "dout_sclk_isp_spi0_a", 275 * 1000000); - fimc_is_set_rate_dt(pdev, "dout_sclk_isp_spi0_b", 46 * 1000000); - fimc_is_set_parent_dt(pdev, "mout_sclk_isp_spi0_user", "sclk_isp_spi0_top"); - -#endif /* SCLK_SPI1 */ fimc_is_set_parent_dt(pdev, "mout_sclk_isp_spi1", "mout_bus_pll_user"); fimc_is_set_rate_dt(pdev, "dout_sclk_isp_spi1_a", 275 * 1000000); @@ -887,190 +398,6 @@ int exynos5430_fimc_is_print_clk(struct platform_device *pdev) { pr_debug("%s\n", __func__); - /* SCLK */ - /* SCLK_SPI0 */ - fimc_is_get_rate_dt(pdev, "sclk_isp_spi0_top"); - fimc_is_get_rate_dt(pdev, "sclk_isp_spi0"); - /* SCLK_SPI1 */ - fimc_is_get_rate_dt(pdev, "sclk_isp_spi1_top"); - fimc_is_get_rate_dt(pdev, "sclk_isp_spi1"); - /* SCLK_UART */ - fimc_is_get_rate_dt(pdev, "sclk_isp_uart_top"); - fimc_is_get_rate_dt(pdev, "sclk_isp_uart"); - - /* CAM0 */ - /* CMU_TOP */ - fimc_is_get_rate_dt(pdev, "aclk_cam0_552"); - fimc_is_get_rate_dt(pdev, "aclk_cam0_400"); - fimc_is_get_rate_dt(pdev, "aclk_cam0_333"); - /* LITE A */ - fimc_is_get_rate_dt(pdev, "dout_aclk_lite_a"); - fimc_is_get_rate_dt(pdev, "dout_pclk_lite_a"); - /* LITE B */ - fimc_is_get_rate_dt(pdev, "dout_aclk_lite_b"); - fimc_is_get_rate_dt(pdev, "dout_pclk_lite_b"); - /* LITE D */ - fimc_is_get_rate_dt(pdev, "dout_aclk_lite_d"); - fimc_is_get_rate_dt(pdev, "dout_pclk_lite_d"); - /* LITE C PIXELASYNC */ - fimc_is_get_rate_dt(pdev, "dout_sclk_pixelasync_lite_c_init"); - fimc_is_get_rate_dt(pdev, "dout_pclk_pixelasync_lite_c"); - fimc_is_get_rate_dt(pdev, "dout_sclk_pixelasync_lite_c"); - /* 3AA 0 */ - fimc_is_get_rate_dt(pdev, "dout_aclk_3aa0"); - fimc_is_get_rate_dt(pdev, "dout_pclk_3aa0"); - /* 3AA 0 */ - fimc_is_get_rate_dt(pdev, "dout_aclk_3aa1"); - fimc_is_get_rate_dt(pdev, "dout_pclk_3aa1"); - /* CSI 0 */ - fimc_is_get_rate_dt(pdev, "dout_aclk_csis0"); - /* CSI 1 */ - fimc_is_get_rate_dt(pdev, "dout_aclk_csis1"); - /* CAM0 400 */ - fimc_is_get_rate_dt(pdev, "dout_aclk_cam0_400"); - fimc_is_get_rate_dt(pdev, "dout_aclk_cam0_200"); - fimc_is_get_rate_dt(pdev, "dout_pclk_cam0_50"); - - /* CAM1 */ - /* CMU_TOP */ - fimc_is_get_rate_dt(pdev, "aclk_cam1_552"); - fimc_is_get_rate_dt(pdev, "aclk_cam1_400"); - fimc_is_get_rate_dt(pdev, "aclk_cam1_333"); - /* C-A5 */ - fimc_is_get_rate_dt(pdev, "dout_atclk_cam1"); - fimc_is_get_rate_dt(pdev, "dout_pclk_dbg_cam1"); - /* LITE A */ - fimc_is_get_rate_dt(pdev, "dout_aclk_lite_c"); - fimc_is_get_rate_dt(pdev, "dout_pclk_lite_c"); - /* FD */ - fimc_is_get_rate_dt(pdev, "dout_aclk_fd"); - fimc_is_get_rate_dt(pdev, "dout_pclk_fd"); - /* CSI 2 */ - fimc_is_get_rate_dt(pdev, "dout_aclk_csis2_a"); - /* MPWM */ - fimc_is_get_rate_dt(pdev, "dout_pclk_cam1_166"); - fimc_is_get_rate_dt(pdev, "dout_pclk_cam1_83"); - fimc_is_get_rate_dt(pdev, "dout_sclk_isp_mpwm"); - - /* ISP */ - /* CMU_TOP */ - fimc_is_get_rate_dt(pdev, "aclk_isp_400"); - fimc_is_get_rate_dt(pdev, "aclk_isp_dis_400"); - /* ISP */ - fimc_is_get_rate_dt(pdev, "dout_aclk_isp_c_200"); - fimc_is_get_rate_dt(pdev, "dout_aclk_isp_d_200"); - fimc_is_get_rate_dt(pdev, "dout_pclk_isp"); - /* DIS */ - fimc_is_get_rate_dt(pdev, "dout_pclk_isp_dis"); - - /* CMU_TOP_DUMP */ - pr_info("EXYNOS5430_SRC_SEL_TOP1(0x%08X)\n", readl(EXYNOS5430_SRC_SEL_TOP1)); - pr_info("EXYNOS5430_SRC_SEL_TOP2(0x%08X)\n", readl(EXYNOS5430_SRC_SEL_TOP2)); - pr_info("EXYNOS5430_SRC_SEL_TOP_CAM1(0x%08X)\n", readl(EXYNOS5430_SRC_SEL_TOP_CAM1)); - pr_info("EXYNOS5430_SRC_ENABLE_TOP0(0x%08X)\n", readl(EXYNOS5430_SRC_ENABLE_TOP0)); - pr_info("EXYNOS5430_SRC_ENABLE_TOP1(0x%08X)\n", readl(EXYNOS5430_SRC_ENABLE_TOP1)); - pr_info("EXYNOS5430_SRC_ENABLE_TOP2(0x%08X)\n", readl(EXYNOS5430_SRC_ENABLE_TOP2)); - pr_info("EXYNOS5430_SRC_ENABLE_TOP3(0x%08X)\n", readl(EXYNOS5430_SRC_ENABLE_TOP3)); - pr_info("EXYNOS5430_SRC_ENABLE_TOP_CAM1(0x%08X)\n", readl(EXYNOS5430_SRC_ENABLE_TOP_CAM1)); - pr_info("EXYNOS5430_DIV_TOP0(0x%08X)\n", readl(EXYNOS5430_DIV_TOP0)); - pr_info("EXYNOS5430_DIV_TOP_CAM10(0x%08X)\n", readl(EXYNOS5430_DIV_TOP_CAM10)); - pr_info("EXYNOS5430_DIV_TOP_CAM11(0x%08X)\n", readl(EXYNOS5430_DIV_TOP_CAM11)); - pr_info("EXYNOS5430_ENABLE_SCLK_TOP_CAM1(0x%08X)\n", readl(EXYNOS5430_ENABLE_SCLK_TOP_CAM1)); - pr_info("EXYNOS5430_ENABLE_IP_TOP(0x%08X)\n", readl(EXYNOS5430_ENABLE_IP_TOP)); - /* CMU_CAM0_DUMP */ - pr_info("EXYNOS5430_SRC_SEL_CAM00(0x%08X)\n", readl(EXYNOS5430_SRC_SEL_CAM00)); - pr_info("EXYNOS5430_SRC_SEL_CAM01(0x%08X)\n", readl(EXYNOS5430_SRC_SEL_CAM01)); - pr_info("EXYNOS5430_SRC_SEL_CAM02(0x%08X)\n", readl(EXYNOS5430_SRC_SEL_CAM02)); - pr_info("EXYNOS5430_SRC_SEL_CAM03(0x%08X)\n", readl(EXYNOS5430_SRC_SEL_CAM03)); - pr_info("EXYNOS5430_SRC_SEL_CAM04(0x%08X)\n", readl(EXYNOS5430_SRC_SEL_CAM04)); - pr_info("EXYNOS5430_SRC_ENABLE_CAM00(0x%08X)\n", readl(EXYNOS5430_SRC_ENABLE_CAM00)); - pr_info("EXYNOS5430_SRC_ENABLE_CAM01(0x%08X)\n", readl(EXYNOS5430_SRC_ENABLE_CAM01)); - pr_info("EXYNOS5430_SRC_ENABLE_CAM02(0x%08X)\n", readl(EXYNOS5430_SRC_ENABLE_CAM02)); - pr_info("EXYNOS5430_SRC_ENABLE_CAM03(0x%08X)\n", readl(EXYNOS5430_SRC_ENABLE_CAM03)); - pr_info("EXYNOS5430_SRC_ENABLE_CAM04(0x%08X)\n", readl(EXYNOS5430_SRC_ENABLE_CAM04)); - pr_info("EXYNOS5430_SRC_STAT_CAM00(0x%08X)\n", readl(EXYNOS5430_SRC_STAT_CAM00)); - pr_info("EXYNOS5430_SRC_STAT_CAM01(0x%08X)\n", readl(EXYNOS5430_SRC_STAT_CAM01)); - pr_info("EXYNOS5430_SRC_STAT_CAM02(0x%08X)\n", readl(EXYNOS5430_SRC_STAT_CAM02)); - pr_info("EXYNOS5430_SRC_STAT_CAM03(0x%08X)\n", readl(EXYNOS5430_SRC_STAT_CAM03)); - pr_info("EXYNOS5430_SRC_STAT_CAM04(0x%08X)\n", readl(EXYNOS5430_SRC_STAT_CAM04)); - pr_info("EXYNOS5430_SRC_IGNORE_CAM01(0x%08X)\n", readl(EXYNOS5430_SRC_IGNORE_CAM01)); - pr_info("EXYNOS5430_DIV_CAM00(0x%08X)\n", readl(EXYNOS5430_DIV_CAM00)); - pr_info("EXYNOS5430_DIV_CAM01(0x%08X)\n", readl(EXYNOS5430_DIV_CAM01)); - pr_info("EXYNOS5430_DIV_CAM02(0x%08X)\n", readl(EXYNOS5430_DIV_CAM02)); - pr_info("EXYNOS5430_DIV_CAM03(0x%08X)\n", readl(EXYNOS5430_DIV_CAM03)); - pr_info("EXYNOS5430_DIV_STAT_CAM00(0x%08X)\n", readl(EXYNOS5430_DIV_STAT_CAM00)); - pr_info("EXYNOS5430_DIV_STAT_CAM01(0x%08X)\n", readl(EXYNOS5430_DIV_STAT_CAM01)); - pr_info("EXYNOS5430_DIV_STAT_CAM02(0x%08X)\n", readl(EXYNOS5430_DIV_STAT_CAM02)); - pr_info("EXYNOS5430_DIV_STAT_CAM03(0x%08X)\n", readl(EXYNOS5430_DIV_STAT_CAM03)); - pr_info("EXYNOS5430_ENABLE_IP_CAM00(0x%08X)\n", readl(EXYNOS5430_ENABLE_IP_CAM00)); - pr_info("EXYNOS5430_ENABLE_IP_CAM01(0x%08X)\n", readl(EXYNOS5430_ENABLE_IP_CAM01)); - pr_info("EXYNOS5430_ENABLE_IP_CAM02(0x%08X)\n", readl(EXYNOS5430_ENABLE_IP_CAM02)); - pr_info("EXYNOS5430_ENABLE_IP_CAM03(0x%08X)\n", readl(EXYNOS5430_ENABLE_IP_CAM03)); - /* CMU_CAM1_DUMP */ - pr_info("EXYNOS5430_SRC_SEL_CAM10(0x%08X)\n", readl(EXYNOS5430_SRC_SEL_CAM10)); - pr_info("EXYNOS5430_SRC_SEL_CAM11(0x%08X)\n", readl(EXYNOS5430_SRC_SEL_CAM11)); - pr_info("EXYNOS5430_SRC_SEL_CAM12(0x%08X)\n", readl(EXYNOS5430_SRC_SEL_CAM12)); - pr_info("EXYNOS5430_SRC_ENABLE_CAM10(0x%08X)\n", readl(EXYNOS5430_SRC_ENABLE_CAM10)); - pr_info("EXYNOS5430_SRC_ENABLE_CAM11(0x%08X)\n", readl(EXYNOS5430_SRC_ENABLE_CAM11)); - pr_info("EXYNOS5430_SRC_ENABLE_CAM12(0x%08X)\n", readl(EXYNOS5430_SRC_ENABLE_CAM12)); - pr_info("EXYNOS5430_SRC_STAT_CAM10(0x%08X)\n", readl(EXYNOS5430_SRC_STAT_CAM10)); - pr_info("EXYNOS5430_SRC_STAT_CAM11(0x%08X)\n", readl(EXYNOS5430_SRC_STAT_CAM11)); - pr_info("EXYNOS5430_SRC_STAT_CAM12(0x%08X)\n", readl(EXYNOS5430_SRC_STAT_CAM12)); - pr_info("EXYNOS5430_SRC_IGNORE_CAM11(0x%08X)\n", readl(EXYNOS5430_SRC_IGNORE_CAM11)); - pr_info("EXYNOS5430_DIV_CAM10(0x%08X)\n", readl(EXYNOS5430_DIV_CAM10)); - pr_info("EXYNOS5430_DIV_CAM11(0x%08X)\n", readl(EXYNOS5430_DIV_CAM11)); - pr_info("EXYNOS5430_DIV_STAT_CAM10(0x%08X)\n", readl(EXYNOS5430_DIV_STAT_CAM10)); - pr_info("EXYNOS5430_DIV_STAT_CAM11(0x%08X)\n", readl(EXYNOS5430_DIV_STAT_CAM11)); - pr_info("EXYNOS5430_ENABLE_SCLK_CAM1(0x%08X)\n", readl(EXYNOS5430_ENABLE_SCLK_CAM1)); - pr_info("EXYNOS5430_ENABLE_IP_CAM10(0x%08X)\n", readl(EXYNOS5430_ENABLE_IP_CAM10)); - pr_info("EXYNOS5430_ENABLE_IP_CAM11(0x%08X)\n", readl(EXYNOS5430_ENABLE_IP_CAM11)); - pr_info("EXYNOS5430_ENABLE_IP_CAM12(0x%08X)\n", readl(EXYNOS5430_ENABLE_IP_CAM12)); - /* CMU_ISP_DUMP */ - pr_info("EXYNOS5430_SRC_SEL_ISP(0x%08X)\n", readl(EXYNOS5430_SRC_SEL_ISP)); - pr_info("EXYNOS5430_SRC_ENABLE_ISP(0x%08X)\n", readl(EXYNOS5430_SRC_ENABLE_ISP)); - pr_info("EXYNOS5430_SRC_STAT_ISP(0x%08X)\n", readl(EXYNOS5430_SRC_STAT_ISP)); - pr_info("EXYNOS5430_DIV_ISP(0x%08X)\n", readl(EXYNOS5430_DIV_ISP)); - pr_info("EXYNOS5430_DIV_STAT_ISP(0x%08X)\n", readl(EXYNOS5430_DIV_STAT_ISP)); - pr_info("EXYNOS5430_ENABLE_ACLK_ISP0(0x%08X)\n", readl(EXYNOS5430_ENABLE_ACLK_ISP0)); - pr_info("EXYNOS5430_ENABLE_ACLK_ISP1(0x%08X)\n", readl(EXYNOS5430_ENABLE_ACLK_ISP1)); - pr_info("EXYNOS5430_ENABLE_ACLK_ISP2(0x%08X)\n", readl(EXYNOS5430_ENABLE_ACLK_ISP2)); - pr_info("EXYNOS5430_ENABLE_PCLK_ISP(0x%08X)\n", readl(EXYNOS5430_ENABLE_PCLK_ISP)); - pr_info("EXYNOS5430_ENABLE_SCLK_ISP(0x%08X)\n", readl(EXYNOS5430_ENABLE_SCLK_ISP)); - pr_info("EXYNOS5430_ENABLE_IP_ISP0(0x%08X)\n", readl(EXYNOS5430_ENABLE_IP_ISP0)); - pr_info("EXYNOS5430_ENABLE_IP_ISP1(0x%08X)\n", readl(EXYNOS5430_ENABLE_IP_ISP1)); - pr_info("EXYNOS5430_ENABLE_IP_ISP2(0x%08X)\n", readl(EXYNOS5430_ENABLE_IP_ISP2)); - pr_info("EXYNOS5430_ENABLE_IP_ISP3(0x%08X)\n", readl(EXYNOS5430_ENABLE_IP_ISP3)); - /* CMU_ENABLE_DUMP */ - pr_info("EXYNOS5430_ENABLE_SCLK_TOP_CAM1(0x%08X)\n", readl(EXYNOS5430_ENABLE_SCLK_TOP_CAM1)); - pr_info("EXYNOS5430_ENABLE_IP_TOP(0x%08X)\n", readl(EXYNOS5430_ENABLE_IP_TOP)); - pr_info("EXYNOS5430_ENABLE_IP_CAM00(0x%08X)\n", readl(EXYNOS5430_ENABLE_IP_CAM00)); - pr_info("EXYNOS5430_ENABLE_IP_CAM01(0x%08X)\n", readl(EXYNOS5430_ENABLE_IP_CAM01)); - pr_info("EXYNOS5430_ENABLE_IP_CAM02(0x%08X)\n", readl(EXYNOS5430_ENABLE_IP_CAM02)); - pr_info("EXYNOS5430_ENABLE_IP_CAM03(0x%08X)\n", readl(EXYNOS5430_ENABLE_IP_CAM03)); - pr_info("EXYNOS5430_ENABLE_IP_CAM10(0x%08X)\n", readl(EXYNOS5430_ENABLE_IP_CAM10)); - pr_info("EXYNOS5430_ENABLE_IP_CAM11(0x%08X)\n", readl(EXYNOS5430_ENABLE_IP_CAM11)); - pr_info("EXYNOS5430_ENABLE_IP_CAM12(0x%08X)\n", readl(EXYNOS5430_ENABLE_IP_CAM12)); - pr_info("EXYNOS5430_ENABLE_IP_ISP0(0x%08X)\n", readl(EXYNOS5430_ENABLE_IP_ISP0)); - pr_info("EXYNOS5430_ENABLE_IP_ISP1(0x%08X)\n", readl(EXYNOS5430_ENABLE_IP_ISP1)); - pr_info("EXYNOS5430_ENABLE_IP_ISP2(0x%08X)\n", readl(EXYNOS5430_ENABLE_IP_ISP2)); - pr_info("EXYNOS5430_ENABLE_IP_ISP3(0x%08X)\n", readl(EXYNOS5430_ENABLE_IP_ISP3)); - - return 0; -} - -/* sequence is important, don't change order */ -int exynos5430_fimc_is_sensor_power_on(struct platform_device *pdev, int sensor_id) -{ - pr_debug("%s\n", __func__); - - return 0; -} - -/* sequence is important, don't change order */ -int exynos5430_fimc_is_sensor_power_off(struct platform_device *pdev, int sensor_id) -{ - pr_debug("%s\n", __func__); - return 0; } @@ -1078,156 +405,44 @@ int exynos5430_fimc_is_print_pwr(struct platform_device *pdev) { pr_debug("%s\n", __func__); - pr_info("ISP power state(0x%08x)\n", readl(EXYNOS5430_ISP_STATUS)); - pr_info("CAM0 power state(0x%08x)\n", readl(EXYNOS5430_CAM0_STATUS)); - pr_info("CAM1 power state(0x%08x)\n", readl(EXYNOS5430_CAM1_STATUS)); - pr_info("CA5 power state(0x%08x)\n", readl(EXYNOS5430_A5IS_STATUS)); - return 0; } -int exynos5430_fimc_is_set_user_clk_gate(u32 group_id, - bool is_on, - u32 user_scenario_id, - unsigned long msk_state, - struct exynos_fimc_is_clk_gate_info *gate_info) { - /* if you want to skip clock on/off, let this func return -1 */ - int ret = -1; - - switch (user_scenario_id) { - case CLK_GATE_NOT_FULL_BYPASS_SN: - if (is_on == true) - gate_info->groups[group_id].mask_clk_on_mod &= - ~((1 << FIMC_IS_GATE_DIS_IP) | - (1 << FIMC_IS_GATE_3DNR_IP)); - else - gate_info->groups[group_id].mask_clk_on_mod |= - ((1 << FIMC_IS_GATE_DIS_IP) | - (1 << FIMC_IS_GATE_3DNR_IP)); - ret = 0; - break; - case CLK_GATE_DIS_SN: - if (is_on == true) - gate_info->groups[group_id].mask_clk_on_mod |= - ((1 << FIMC_IS_GATE_DIS_IP) | - (1 << FIMC_IS_GATE_3DNR_IP)); - else - gate_info->groups[group_id].mask_clk_on_mod &= - ~((1 << FIMC_IS_GATE_DIS_IP) | - (1 << FIMC_IS_GATE_3DNR_IP)); - ret = 0; - break; - default: - ret = 0; - break; - } - - return ret; -} -#endif /* Wrapper functions */ int exynos_fimc_is_cfg_clk(struct platform_device *pdev) { -#if defined(CONFIG_SOC_EXYNOS5422) - exynos5422_fimc_is_cfg_clk(pdev); -#elif defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) exynos5430_fimc_is_cfg_clk(pdev); -#endif return 0; } int exynos_fimc_is_cfg_cam_clk(struct platform_device *pdev) { -#if defined(CONFIG_SOC_EXYNOS5422) - exynos5422_cfg_clk_sclk(pdev); - exynos5422_cfg_clk_cam(pdev); -#elif defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) exynos5430_cfg_clk_sclk(pdev); exynos5430_cfg_clk_cam1_spi(pdev); -#endif return 0; } int exynos_fimc_is_clk_on(struct platform_device *pdev) { -#if defined(CONFIG_SOC_EXYNOS5422) - exynos5422_fimc_is_clk_on(pdev); -#elif defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) exynos5430_fimc_is_clk_on(pdev); -#endif return 0; } int exynos_fimc_is_clk_off(struct platform_device *pdev) { -#if defined(CONFIG_SOC_EXYNOS5422) - exynos5422_fimc_is_clk_off(pdev); -#elif defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) exynos5430_fimc_is_clk_off(pdev); -#endif return 0; } int exynos_fimc_is_print_clk(struct platform_device *pdev) { -#if defined(CONFIG_SOC_EXYNOS5422) - exynos5422_fimc_is_print_clk(pdev); -#elif defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) exynos5430_fimc_is_print_clk(pdev); -#endif - return 0; -} - -int exynos_fimc_is_set_user_clk_gate(u32 group_id, bool is_on, - u32 user_scenario_id, - unsigned long msk_state, - struct exynos_fimc_is_clk_gate_info *gate_info) -{ -#if defined(CONFIG_SOC_EXYNOS5422) - exynos5422_fimc_is_set_user_clk_gate(group_id, is_on, user_scenario_id, msk_state, gate_info); -#elif defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) - exynos5430_fimc_is_set_user_clk_gate(group_id, is_on, user_scenario_id, msk_state, gate_info); -#endif - return 0; -} - -int exynos_fimc_is_clk_gate(u32 clk_gate_id, bool is_on) -{ -#if defined(CONFIG_SOC_EXYNOS5422) - exynos5422_fimc_is_clk_gate(clk_gate_id, is_on); -#elif defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) - exynos5430_fimc_is_clk_gate(clk_gate_id, is_on); -#endif - return 0; -} - -int exynos_fimc_is_sensor_power_on(struct platform_device *pdev, int sensor_id) -{ -#if defined(CONFIG_SOC_EXYNOS5422) - exynos5422_fimc_is_sensor_power_on(pdev, sensor_id); -#elif defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) - exynos5430_fimc_is_sensor_power_on(pdev, sensor_id); -#endif - return 0; -} - -int exynos_fimc_is_sensor_power_off(struct platform_device *pdev, int sensor_id) -{ -#if defined(CONFIG_SOC_EXYNOS5422) - exynos5422_fimc_is_sensor_power_off(pdev, sensor_id); -#elif defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) - exynos5430_fimc_is_sensor_power_off(pdev, sensor_id); -#endif return 0; } int exynos_fimc_is_print_pwr(struct platform_device *pdev) { -#if defined(CONFIG_SOC_EXYNOS5422) - exynos5422_fimc_is_print_pwr(pdev); -#elif defined(CONFIG_SOC_EXYNOS5430) || defined(CONFIG_SOC_EXYNOS5433) exynos5430_fimc_is_print_pwr(pdev); -#endif return 0; }