| .. | .. |
|---|
| 146 | 146 | struct rkisp_buffer *params_buf = to_rkisp_buffer(vbuf); |
|---|
| 147 | 147 | struct vb2_queue *vq = vb->vb2_queue; |
|---|
| 148 | 148 | struct rkisp_isp_params_vdev *params_vdev = vq->drv_priv; |
|---|
| 149 | + struct rkisp_device *dev = params_vdev->dev; |
|---|
| 149 | 150 | void *first_param; |
|---|
| 150 | 151 | unsigned long flags; |
|---|
| 151 | 152 | unsigned int cur_frame_id = -1; |
|---|
| 152 | 153 | |
|---|
| 153 | | - cur_frame_id = atomic_read(¶ms_vdev->dev->isp_sdev.frm_sync_seq) - 1; |
|---|
| 154 | + cur_frame_id = atomic_read(&dev->isp_sdev.frm_sync_seq) - 1; |
|---|
| 154 | 155 | if (params_vdev->first_params) { |
|---|
| 155 | 156 | first_param = vb2_plane_vaddr(vb, 0); |
|---|
| 156 | 157 | params_vdev->ops->save_first_param(params_vdev, first_param); |
|---|
| .. | .. |
|---|
| 159 | 160 | vb2_buffer_done(¶ms_buf->vb.vb2_buf, VB2_BUF_STATE_DONE); |
|---|
| 160 | 161 | params_vdev->first_params = false; |
|---|
| 161 | 162 | wake_up(¶ms_vdev->dev->sync_onoff); |
|---|
| 162 | | - if (params_vdev->dev->is_first_double) { |
|---|
| 163 | | - dev_info(params_vdev->dev->dev, "first params for fast\n"); |
|---|
| 164 | | - params_vdev->dev->is_first_double = false; |
|---|
| 165 | | - rkisp_trigger_read_back(params_vdev->dev, false, false, false); |
|---|
| 163 | + if (dev->is_first_double) { |
|---|
| 164 | + dev_info(dev->dev, "first params for fast\n"); |
|---|
| 165 | + dev->is_first_double = false; |
|---|
| 166 | + dev->sw_rd_cnt = 0; |
|---|
| 167 | + if (dev->hw_dev->unite == ISP_UNITE_ONE) { |
|---|
| 168 | + dev->unite_index = ISP_UNITE_LEFT; |
|---|
| 169 | + dev->sw_rd_cnt += dev->hw_dev->is_multi_overflow ? 3 : 1; |
|---|
| 170 | + } |
|---|
| 171 | + params_vdev->rdbk_times = dev->sw_rd_cnt + 1; |
|---|
| 172 | + rkisp_trigger_read_back(dev, false, false, false); |
|---|
| 166 | 173 | } |
|---|
| 167 | | - dev_info(params_vdev->dev->dev, "first params buf queue\n"); |
|---|
| 174 | + dev_info(dev->dev, "first params buf queue\n"); |
|---|
| 168 | 175 | return; |
|---|
| 169 | 176 | } |
|---|
| 170 | 177 | |
|---|
| 171 | | - if (params_vdev->dev->procfs.mode & |
|---|
| 178 | + if (dev->procfs.mode & |
|---|
| 172 | 179 | (RKISP_PROCFS_FIL_AIQ | RKISP_PROCFS_FIL_SW)) { |
|---|
| 173 | 180 | vb2_buffer_done(¶ms_buf->vb.vb2_buf, VB2_BUF_STATE_DONE); |
|---|
| 174 | 181 | return; |
|---|
| .. | .. |
|---|
| 178 | 185 | spin_lock_irqsave(¶ms_vdev->config_lock, flags); |
|---|
| 179 | 186 | list_add_tail(¶ms_buf->queue, ¶ms_vdev->params); |
|---|
| 180 | 187 | spin_unlock_irqrestore(¶ms_vdev->config_lock, flags); |
|---|
| 188 | + |
|---|
| 189 | + if (params_vdev->dev->is_first_double) { |
|---|
| 190 | + struct isp32_isp_params_cfg *params = params_buf->vaddr[0]; |
|---|
| 191 | + struct rkisp_buffer *buf; |
|---|
| 192 | + |
|---|
| 193 | + if (!(params->module_cfg_update & ISP32_MODULE_RTT_FST)) |
|---|
| 194 | + return; |
|---|
| 195 | + spin_lock_irqsave(¶ms_vdev->config_lock, flags); |
|---|
| 196 | + while (!list_empty(¶ms_vdev->params)) { |
|---|
| 197 | + buf = list_first_entry(¶ms_vdev->params, |
|---|
| 198 | + struct rkisp_buffer, queue); |
|---|
| 199 | + if (buf == params_buf) |
|---|
| 200 | + break; |
|---|
| 201 | + list_del(&buf->queue); |
|---|
| 202 | + vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE); |
|---|
| 203 | + } |
|---|
| 204 | + spin_unlock_irqrestore(¶ms_vdev->config_lock, flags); |
|---|
| 205 | + dev_info(params_vdev->dev->dev, |
|---|
| 206 | + "first params:%d for rtt resume\n", params->frame_id); |
|---|
| 207 | + params_vdev->dev->is_first_double = false; |
|---|
| 208 | + rkisp_trigger_read_back(params_vdev->dev, false, false, false); |
|---|
| 209 | + } |
|---|
| 181 | 210 | } |
|---|
| 182 | 211 | |
|---|
| 183 | 212 | static void rkisp_params_vb2_stop_streaming(struct vb2_queue *vq) |
|---|
| .. | .. |
|---|
| 186 | 215 | struct rkisp_device *dev = params_vdev->dev; |
|---|
| 187 | 216 | struct rkisp_buffer *buf; |
|---|
| 188 | 217 | unsigned long flags; |
|---|
| 189 | | - int i; |
|---|
| 190 | 218 | |
|---|
| 191 | 219 | /* stop params input firstly */ |
|---|
| 192 | 220 | spin_lock_irqsave(¶ms_vdev->config_lock, flags); |
|---|
| 193 | 221 | params_vdev->streamon = false; |
|---|
| 194 | 222 | wake_up(&dev->sync_onoff); |
|---|
| 195 | | - spin_unlock_irqrestore(¶ms_vdev->config_lock, flags); |
|---|
| 196 | | - |
|---|
| 197 | | - for (i = 0; i < RKISP_ISP_PARAMS_REQ_BUFS_MAX; i++) { |
|---|
| 198 | | - spin_lock_irqsave(¶ms_vdev->config_lock, flags); |
|---|
| 199 | | - if (!list_empty(¶ms_vdev->params)) { |
|---|
| 200 | | - buf = list_first_entry(¶ms_vdev->params, |
|---|
| 201 | | - struct rkisp_buffer, queue); |
|---|
| 202 | | - list_del(&buf->queue); |
|---|
| 203 | | - spin_unlock_irqrestore(¶ms_vdev->config_lock, |
|---|
| 204 | | - flags); |
|---|
| 205 | | - } else { |
|---|
| 206 | | - spin_unlock_irqrestore(¶ms_vdev->config_lock, |
|---|
| 207 | | - flags); |
|---|
| 208 | | - break; |
|---|
| 209 | | - } |
|---|
| 210 | | - |
|---|
| 211 | | - if (buf) |
|---|
| 212 | | - vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR); |
|---|
| 213 | | - buf = NULL; |
|---|
| 223 | + while (!list_empty(¶ms_vdev->params)) { |
|---|
| 224 | + buf = list_first_entry(¶ms_vdev->params, |
|---|
| 225 | + struct rkisp_buffer, queue); |
|---|
| 226 | + list_del(&buf->queue); |
|---|
| 227 | + vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR); |
|---|
| 214 | 228 | } |
|---|
| 215 | | - |
|---|
| 216 | 229 | if (params_vdev->cur_buf) { |
|---|
| 217 | 230 | buf = params_vdev->cur_buf; |
|---|
| 218 | 231 | vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR); |
|---|
| 219 | 232 | params_vdev->cur_buf = NULL; |
|---|
| 220 | 233 | } |
|---|
| 234 | + spin_unlock_irqrestore(¶ms_vdev->config_lock, flags); |
|---|
| 221 | 235 | |
|---|
| 222 | 236 | if (dev->is_pre_on) { |
|---|
| 223 | 237 | params_vdev->first_cfg_params = true; |
|---|
| .. | .. |
|---|
| 284 | 298 | return ret; |
|---|
| 285 | 299 | } |
|---|
| 286 | 300 | |
|---|
| 301 | +static __poll_t rkisp_params_fop_poll(struct file *file, poll_table *wait) |
|---|
| 302 | +{ |
|---|
| 303 | + struct video_device *vdev = video_devdata(file); |
|---|
| 304 | + |
|---|
| 305 | + /* buf done or subscribe event */ |
|---|
| 306 | + if (vdev->queue->owner == file->private_data) |
|---|
| 307 | + return vb2_fop_poll(file, wait); |
|---|
| 308 | + else |
|---|
| 309 | + return v4l2_ctrl_poll(file, wait); |
|---|
| 310 | +} |
|---|
| 311 | + |
|---|
| 287 | 312 | struct v4l2_file_operations rkisp_params_fops = { |
|---|
| 288 | 313 | .mmap = vb2_fop_mmap, |
|---|
| 289 | 314 | .unlocked_ioctl = video_ioctl2, |
|---|
| 290 | | - .poll = vb2_fop_poll, |
|---|
| 315 | + .poll = rkisp_params_fop_poll, |
|---|
| 291 | 316 | .open = rkisp_params_fh_open, |
|---|
| 292 | 317 | .release = rkisp_params_fop_release |
|---|
| 293 | 318 | }; |
|---|
| .. | .. |
|---|
| 352 | 377 | params_vdev->ops->param_cfg(params_vdev, frame_id, RKISP_PARAMS_IMD); |
|---|
| 353 | 378 | } |
|---|
| 354 | 379 | |
|---|
| 355 | | -void rkisp_params_cfgsram(struct rkisp_isp_params_vdev *params_vdev) |
|---|
| 380 | +void rkisp_params_cfgsram(struct rkisp_isp_params_vdev *params_vdev, bool is_check) |
|---|
| 356 | 381 | { |
|---|
| 357 | | - if (params_vdev->dev->procfs.mode & RKISP_PROCFS_FIL_SW) |
|---|
| 358 | | - return; |
|---|
| 382 | + if (is_check) { |
|---|
| 383 | + if (params_vdev->dev->procfs.mode & RKISP_PROCFS_FIL_SW) |
|---|
| 384 | + return; |
|---|
| 359 | 385 | |
|---|
| 360 | | - /* multi device to switch sram config */ |
|---|
| 361 | | - if (params_vdev->dev->hw_dev->is_single) |
|---|
| 362 | | - return; |
|---|
| 363 | | - |
|---|
| 386 | + /* multi device to switch sram config */ |
|---|
| 387 | + if (params_vdev->dev->hw_dev->is_single) |
|---|
| 388 | + return; |
|---|
| 389 | + } |
|---|
| 364 | 390 | if (params_vdev->ops->param_cfgsram) |
|---|
| 365 | 391 | params_vdev->ops->param_cfgsram(params_vdev); |
|---|
| 366 | 392 | } |
|---|
| .. | .. |
|---|
| 395 | 421 | stream->out_isp_fmt.fmt_type == FMT_RGB) |
|---|
| 396 | 422 | rkisp_unite_set_bits(dev, ISP3X_MI_WR_CTRL, mask, |
|---|
| 397 | 423 | quantization == V4L2_QUANTIZATION_FULL_RANGE ? |
|---|
| 398 | | - mask : 0, |
|---|
| 399 | | - false, dev->hw_dev->is_unite); |
|---|
| 424 | + mask : 0, false); |
|---|
| 400 | 425 | dev->isp_sdev.quantization = quantization; |
|---|
| 401 | 426 | } |
|---|
| 402 | 427 | } |
|---|
| .. | .. |
|---|
| 440 | 465 | params_vdev->ops->stream_stop(params_vdev); |
|---|
| 441 | 466 | if (params_vdev->ops->fop_release) |
|---|
| 442 | 467 | params_vdev->ops->fop_release(params_vdev); |
|---|
| 468 | + params_vdev->first_cfg_params = false; |
|---|
| 443 | 469 | } |
|---|
| 444 | 470 | |
|---|
| 445 | 471 | bool rkisp_params_check_bigmode(struct rkisp_isp_params_vdev *params_vdev) |
|---|