Lines Matching +full:fimc +full:- +full:is
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Samsung EXYNOS4x12 FIMC-IS (Imaging Subsystem) driver
5 * Copyright (C) 2012 - 2013 Samsung Electronics Co., Ltd.
12 #include "fimc-is.h"
13 #include "fimc-is-command.h"
14 #include "fimc-is-regs.h"
15 #include "fimc-is-sensor.h"
17 void fimc_is_fw_clear_irq1(struct fimc_is *is, unsigned int nr) in fimc_is_fw_clear_irq1() argument
19 mcuctl_write(1UL << nr, is, MCUCTL_REG_INTCR1); in fimc_is_fw_clear_irq1()
22 void fimc_is_fw_clear_irq2(struct fimc_is *is) in fimc_is_fw_clear_irq2() argument
24 u32 cfg = mcuctl_read(is, MCUCTL_REG_INTSR2); in fimc_is_fw_clear_irq2()
25 mcuctl_write(cfg, is, MCUCTL_REG_INTCR2); in fimc_is_fw_clear_irq2()
28 void fimc_is_hw_set_intgr0_gd0(struct fimc_is *is) in fimc_is_hw_set_intgr0_gd0() argument
30 mcuctl_write(INTGR0_INTGD(0), is, MCUCTL_REG_INTGR0); in fimc_is_hw_set_intgr0_gd0()
33 int fimc_is_hw_wait_intmsr0_intmsd0(struct fimc_is *is) in fimc_is_hw_wait_intmsr0_intmsd0() argument
39 cfg = mcuctl_read(is, MCUCTL_REG_INTMSR0); in fimc_is_hw_wait_intmsr0_intmsd0()
42 if (--timeout == 0) { in fimc_is_hw_wait_intmsr0_intmsd0()
43 dev_warn(&is->pdev->dev, "%s timeout\n", in fimc_is_hw_wait_intmsr0_intmsd0()
45 return -ETIMEDOUT; in fimc_is_hw_wait_intmsr0_intmsd0()
53 int fimc_is_hw_set_param(struct fimc_is *is) in fimc_is_hw_set_param() argument
55 struct chain_config *config = &is->config[is->config_index]; in fimc_is_hw_set_param()
56 unsigned int param_count = __get_pending_param_count(is); in fimc_is_hw_set_param()
58 fimc_is_hw_wait_intmsr0_intmsd0(is); in fimc_is_hw_set_param()
60 mcuctl_write(HIC_SET_PARAMETER, is, MCUCTL_REG_ISSR(0)); in fimc_is_hw_set_param()
61 mcuctl_write(is->sensor_index, is, MCUCTL_REG_ISSR(1)); in fimc_is_hw_set_param()
62 mcuctl_write(is->config_index, is, MCUCTL_REG_ISSR(2)); in fimc_is_hw_set_param()
64 mcuctl_write(param_count, is, MCUCTL_REG_ISSR(3)); in fimc_is_hw_set_param()
65 mcuctl_write(config->p_region_index[0], is, MCUCTL_REG_ISSR(4)); in fimc_is_hw_set_param()
66 mcuctl_write(config->p_region_index[1], is, MCUCTL_REG_ISSR(5)); in fimc_is_hw_set_param()
68 fimc_is_hw_set_intgr0_gd0(is); in fimc_is_hw_set_param()
72 static int __maybe_unused fimc_is_hw_set_tune(struct fimc_is *is) in fimc_is_hw_set_tune() argument
74 fimc_is_hw_wait_intmsr0_intmsd0(is); in fimc_is_hw_set_tune()
76 mcuctl_write(HIC_SET_TUNE, is, MCUCTL_REG_ISSR(0)); in fimc_is_hw_set_tune()
77 mcuctl_write(is->sensor_index, is, MCUCTL_REG_ISSR(1)); in fimc_is_hw_set_tune()
78 mcuctl_write(is->h2i_cmd.entry_id, is, MCUCTL_REG_ISSR(2)); in fimc_is_hw_set_tune()
80 fimc_is_hw_set_intgr0_gd0(is); in fimc_is_hw_set_tune()
86 int fimc_is_hw_get_params(struct fimc_is *is, unsigned int num_args) in fimc_is_hw_get_params() argument
91 return -EINVAL; in fimc_is_hw_get_params()
93 is->i2h_cmd.num_args = num_args; in fimc_is_hw_get_params()
97 is->i2h_cmd.args[i] = mcuctl_read(is, in fimc_is_hw_get_params()
100 is->i2h_cmd.args[i] = 0; in fimc_is_hw_get_params()
105 void fimc_is_hw_set_isp_buf_mask(struct fimc_is *is, unsigned int mask) in fimc_is_hw_set_isp_buf_mask() argument
108 dev_err(&is->pdev->dev, "%s(): not enough buffers (mask %#x)\n", in fimc_is_hw_set_isp_buf_mask()
113 if (mcuctl_read(is, MCUCTL_REG_ISSR(23)) != 0) in fimc_is_hw_set_isp_buf_mask()
114 dev_dbg(&is->pdev->dev, "non-zero DMA buffer mask\n"); in fimc_is_hw_set_isp_buf_mask()
116 mcuctl_write(mask, is, MCUCTL_REG_ISSR(23)); in fimc_is_hw_set_isp_buf_mask()
119 void fimc_is_hw_set_sensor_num(struct fimc_is *is) in fimc_is_hw_set_sensor_num() argument
121 pr_debug("setting sensor index to: %d\n", is->sensor_index); in fimc_is_hw_set_sensor_num()
123 mcuctl_write(IH_REPLY_DONE, is, MCUCTL_REG_ISSR(0)); in fimc_is_hw_set_sensor_num()
124 mcuctl_write(is->sensor_index, is, MCUCTL_REG_ISSR(1)); in fimc_is_hw_set_sensor_num()
125 mcuctl_write(IHC_GET_SENSOR_NUM, is, MCUCTL_REG_ISSR(2)); in fimc_is_hw_set_sensor_num()
126 mcuctl_write(FIMC_IS_SENSORS_NUM, is, MCUCTL_REG_ISSR(3)); in fimc_is_hw_set_sensor_num()
129 void fimc_is_hw_close_sensor(struct fimc_is *is, unsigned int index) in fimc_is_hw_close_sensor() argument
131 if (is->sensor_index != index) in fimc_is_hw_close_sensor()
134 fimc_is_hw_wait_intmsr0_intmsd0(is); in fimc_is_hw_close_sensor()
135 mcuctl_write(HIC_CLOSE_SENSOR, is, MCUCTL_REG_ISSR(0)); in fimc_is_hw_close_sensor()
136 mcuctl_write(is->sensor_index, is, MCUCTL_REG_ISSR(1)); in fimc_is_hw_close_sensor()
137 mcuctl_write(is->sensor_index, is, MCUCTL_REG_ISSR(2)); in fimc_is_hw_close_sensor()
138 fimc_is_hw_set_intgr0_gd0(is); in fimc_is_hw_close_sensor()
141 void fimc_is_hw_get_setfile_addr(struct fimc_is *is) in fimc_is_hw_get_setfile_addr() argument
143 fimc_is_hw_wait_intmsr0_intmsd0(is); in fimc_is_hw_get_setfile_addr()
144 mcuctl_write(HIC_GET_SET_FILE_ADDR, is, MCUCTL_REG_ISSR(0)); in fimc_is_hw_get_setfile_addr()
145 mcuctl_write(is->sensor_index, is, MCUCTL_REG_ISSR(1)); in fimc_is_hw_get_setfile_addr()
146 fimc_is_hw_set_intgr0_gd0(is); in fimc_is_hw_get_setfile_addr()
149 void fimc_is_hw_load_setfile(struct fimc_is *is) in fimc_is_hw_load_setfile() argument
151 fimc_is_hw_wait_intmsr0_intmsd0(is); in fimc_is_hw_load_setfile()
152 mcuctl_write(HIC_LOAD_SET_FILE, is, MCUCTL_REG_ISSR(0)); in fimc_is_hw_load_setfile()
153 mcuctl_write(is->sensor_index, is, MCUCTL_REG_ISSR(1)); in fimc_is_hw_load_setfile()
154 fimc_is_hw_set_intgr0_gd0(is); in fimc_is_hw_load_setfile()
157 int fimc_is_hw_change_mode(struct fimc_is *is) in fimc_is_hw_change_mode() argument
164 if (WARN_ON(is->config_index >= ARRAY_SIZE(cmd))) in fimc_is_hw_change_mode()
165 return -EINVAL; in fimc_is_hw_change_mode()
167 mcuctl_write(cmd[is->config_index], is, MCUCTL_REG_ISSR(0)); in fimc_is_hw_change_mode()
168 mcuctl_write(is->sensor_index, is, MCUCTL_REG_ISSR(1)); in fimc_is_hw_change_mode()
169 mcuctl_write(is->setfile.sub_index, is, MCUCTL_REG_ISSR(2)); in fimc_is_hw_change_mode()
170 fimc_is_hw_set_intgr0_gd0(is); in fimc_is_hw_change_mode()
174 void fimc_is_hw_stream_on(struct fimc_is *is) in fimc_is_hw_stream_on() argument
176 fimc_is_hw_wait_intmsr0_intmsd0(is); in fimc_is_hw_stream_on()
177 mcuctl_write(HIC_STREAM_ON, is, MCUCTL_REG_ISSR(0)); in fimc_is_hw_stream_on()
178 mcuctl_write(is->sensor_index, is, MCUCTL_REG_ISSR(1)); in fimc_is_hw_stream_on()
179 mcuctl_write(0, is, MCUCTL_REG_ISSR(2)); in fimc_is_hw_stream_on()
180 fimc_is_hw_set_intgr0_gd0(is); in fimc_is_hw_stream_on()
183 void fimc_is_hw_stream_off(struct fimc_is *is) in fimc_is_hw_stream_off() argument
185 fimc_is_hw_wait_intmsr0_intmsd0(is); in fimc_is_hw_stream_off()
186 mcuctl_write(HIC_STREAM_OFF, is, MCUCTL_REG_ISSR(0)); in fimc_is_hw_stream_off()
187 mcuctl_write(is->sensor_index, is, MCUCTL_REG_ISSR(1)); in fimc_is_hw_stream_off()
188 fimc_is_hw_set_intgr0_gd0(is); in fimc_is_hw_stream_off()
191 void fimc_is_hw_subip_power_off(struct fimc_is *is) in fimc_is_hw_subip_power_off() argument
193 fimc_is_hw_wait_intmsr0_intmsd0(is); in fimc_is_hw_subip_power_off()
194 mcuctl_write(HIC_POWER_DOWN, is, MCUCTL_REG_ISSR(0)); in fimc_is_hw_subip_power_off()
195 mcuctl_write(is->sensor_index, is, MCUCTL_REG_ISSR(1)); in fimc_is_hw_subip_power_off()
196 fimc_is_hw_set_intgr0_gd0(is); in fimc_is_hw_subip_power_off()
199 int fimc_is_itf_s_param(struct fimc_is *is, bool update) in fimc_is_itf_s_param() argument
204 __is_hw_update_params(is); in fimc_is_itf_s_param()
208 clear_bit(IS_ST_BLOCK_CMD_CLEARED, &is->state); in fimc_is_itf_s_param()
209 fimc_is_hw_set_param(is); in fimc_is_itf_s_param()
210 ret = fimc_is_wait_event(is, IS_ST_BLOCK_CMD_CLEARED, 1, in fimc_is_itf_s_param()
213 dev_err(&is->pdev->dev, "%s() timeout\n", __func__); in fimc_is_itf_s_param()
218 int fimc_is_itf_mode_change(struct fimc_is *is) in fimc_is_itf_mode_change() argument
222 clear_bit(IS_ST_CHANGE_MODE, &is->state); in fimc_is_itf_mode_change()
223 fimc_is_hw_change_mode(is); in fimc_is_itf_mode_change()
224 ret = fimc_is_wait_event(is, IS_ST_CHANGE_MODE, 1, in fimc_is_itf_mode_change()
227 dev_err(&is->pdev->dev, "%s(): mode change (%d) timeout\n", in fimc_is_itf_mode_change()
228 __func__, is->config_index); in fimc_is_itf_mode_change()