| .. | .. |
|---|
| 428 | 428 | struct rkisp_device *dev = stats_vdev->dev; |
|---|
| 429 | 429 | struct rkisp_buffer *buf; |
|---|
| 430 | 430 | unsigned long flags; |
|---|
| 431 | + u32 size = stats_vdev->vdev_fmt.fmt.meta.buffersize; |
|---|
| 432 | + u32 val = 0; |
|---|
| 431 | 433 | |
|---|
| 432 | 434 | spin_lock_irqsave(&stats_vdev->rd_lock, flags); |
|---|
| 433 | 435 | if (!stats_vdev->nxt_buf && !list_empty(&stats_vdev->stat)) { |
|---|
| .. | .. |
|---|
| 439 | 441 | spin_unlock_irqrestore(&stats_vdev->rd_lock, flags); |
|---|
| 440 | 442 | |
|---|
| 441 | 443 | if (stats_vdev->nxt_buf) { |
|---|
| 442 | | - rkisp_write(dev, ISP3X_MI_3A_WR_BASE, stats_vdev->nxt_buf->buff_addr[0], false); |
|---|
| 444 | + val = stats_vdev->nxt_buf->buff_addr[0]; |
|---|
| 443 | 445 | v4l2_dbg(2, rkisp_debug, &dev->v4l2_dev, |
|---|
| 444 | 446 | "%s BASE:0x%x SHD:0x%x\n", |
|---|
| 445 | | - __func__, stats_vdev->nxt_buf->buff_addr[0], |
|---|
| 447 | + __func__, val, |
|---|
| 446 | 448 | isp3_stats_read(stats_vdev, ISP3X_MI_3A_WR_BASE)); |
|---|
| 447 | 449 | if (!dev->hw_dev->is_single) { |
|---|
| 448 | 450 | stats_vdev->cur_buf = stats_vdev->nxt_buf; |
|---|
| 449 | 451 | stats_vdev->nxt_buf = NULL; |
|---|
| 450 | 452 | } |
|---|
| 451 | 453 | } else if (stats_vdev->stats_buf[0].mem_priv) { |
|---|
| 452 | | - rkisp_write(dev, ISP3X_MI_3A_WR_BASE, |
|---|
| 453 | | - stats_vdev->stats_buf[0].dma_addr, false); |
|---|
| 454 | + val = stats_vdev->stats_buf[0].dma_addr; |
|---|
| 455 | + } |
|---|
| 456 | + |
|---|
| 457 | + if (val) { |
|---|
| 458 | + rkisp_write(dev, ISP3X_MI_3A_WR_BASE, val, false); |
|---|
| 459 | + if (dev->hw_dev->unite) |
|---|
| 460 | + rkisp_next_write(dev, ISP3X_MI_3A_WR_BASE, val + size / 2, false); |
|---|
| 454 | 461 | } |
|---|
| 455 | 462 | } |
|---|
| 456 | 463 | |
|---|
| .. | .. |
|---|
| 461 | 468 | struct rkisp_isp_params_val_v32 *priv_val; |
|---|
| 462 | 469 | struct rkisp_dummy_buffer *buf; |
|---|
| 463 | 470 | int idx, buf_fd = -1; |
|---|
| 464 | | - u32 reg = 0, ctrl; |
|---|
| 471 | + u32 reg = 0, ctrl, mask; |
|---|
| 465 | 472 | |
|---|
| 466 | 473 | priv_val = (struct rkisp_isp_params_val_v32 *)dev->params_vdev.priv_val; |
|---|
| 467 | 474 | if (!priv_val->buf_info_owner && priv_val->buf_info_idx >= 0) { |
|---|
| .. | .. |
|---|
| 474 | 481 | if (priv_val->buf_info_owner == RKISP_INFO2DRR_OWNER_GAIN) { |
|---|
| 475 | 482 | reg = ISP3X_GAIN_CTRL; |
|---|
| 476 | 483 | ctrl = ISP3X_GAIN_2DDR_EN; |
|---|
| 484 | + mask = ISP3X_GAIN_2DDR_EN; |
|---|
| 477 | 485 | } else { |
|---|
| 478 | 486 | reg = ISP3X_RAWAWB_CTRL; |
|---|
| 479 | 487 | ctrl = ISP32_RAWAWB_2DDR_PATH_EN; |
|---|
| 488 | + mask = ISP32_RAWAWB_2DDR_PATH_EN | ISP32_RAWAWB_2DDR_PATH_DS; |
|---|
| 480 | 489 | } |
|---|
| 481 | 490 | |
|---|
| 482 | 491 | idx = priv_val->buf_info_idx; |
|---|
| .. | .. |
|---|
| 503 | 512 | } else if (reg == ISP3X_RAWAWB_CTRL && |
|---|
| 504 | 513 | rkisp_read(dev, reg, true) & ISP32_RAWAWB_2DDR_PATH_ERR) { |
|---|
| 505 | 514 | v4l2_warn(&dev->v4l2_dev, "rawawb2ddr path error idx:%d\n", idx); |
|---|
| 515 | + } else { |
|---|
| 516 | + u32 v0 = rkisp_read(dev, reg, false); |
|---|
| 517 | + u32 v1 = rkisp_read_reg_cache(dev, reg); |
|---|
| 518 | + |
|---|
| 519 | + if ((v0 & mask) != (v1 & mask)) |
|---|
| 520 | + rkisp_write(dev, reg, v0 | (v1 & mask), false); |
|---|
| 506 | 521 | } |
|---|
| 507 | 522 | |
|---|
| 508 | 523 | if (buf_fd == -1) |
|---|
| .. | .. |
|---|
| 533 | 548 | rkisp_stats_send_meas(struct rkisp_isp_stats_vdev *stats_vdev, |
|---|
| 534 | 549 | struct rkisp_isp_readout_work *meas_work) |
|---|
| 535 | 550 | { |
|---|
| 536 | | - unsigned int cur_frame_id = -1; |
|---|
| 551 | + struct rkisp_device *dev = stats_vdev->dev; |
|---|
| 552 | + struct rkisp_hw_dev *hw = dev->hw_dev; |
|---|
| 553 | + struct rkisp_isp_params_vdev *params_vdev = &dev->params_vdev; |
|---|
| 537 | 554 | struct rkisp_buffer *cur_buf = stats_vdev->cur_buf; |
|---|
| 538 | 555 | struct rkisp32_isp_stat_buffer *cur_stat_buf = NULL; |
|---|
| 539 | 556 | struct rkisp_stats_ops_v32 *ops = |
|---|
| 540 | 557 | (struct rkisp_stats_ops_v32 *)stats_vdev->priv_ops; |
|---|
| 541 | | - struct rkisp_isp_params_vdev *params_vdev = &stats_vdev->dev->params_vdev; |
|---|
| 542 | | - u32 size = sizeof(struct rkisp32_isp_stat_buffer); |
|---|
| 543 | | - int ret = 0; |
|---|
| 558 | + u32 size = stats_vdev->vdev_fmt.fmt.meta.buffersize; |
|---|
| 559 | + u32 cur_frame_id = meas_work->frame_id; |
|---|
| 544 | 560 | bool is_dummy = false; |
|---|
| 545 | 561 | unsigned long flags; |
|---|
| 546 | 562 | |
|---|
| .. | .. |
|---|
| 548 | 564 | if (!cur_buf && stats_vdev->stats_buf[0].mem_priv) { |
|---|
| 549 | 565 | rkisp_finish_buffer(stats_vdev->dev, &stats_vdev->stats_buf[0]); |
|---|
| 550 | 566 | cur_stat_buf = stats_vdev->stats_buf[0].vaddr; |
|---|
| 551 | | - cur_stat_buf->frame_id = -1; |
|---|
| 567 | + cur_stat_buf->frame_id = cur_frame_id; |
|---|
| 568 | + cur_stat_buf->params_id = params_vdev->cur_frame_id; |
|---|
| 552 | 569 | is_dummy = true; |
|---|
| 553 | 570 | } else if (cur_buf) { |
|---|
| 554 | 571 | cur_stat_buf = cur_buf->vaddr[0]; |
|---|
| 572 | + cur_stat_buf->frame_id = cur_frame_id; |
|---|
| 573 | + cur_stat_buf->params_id = params_vdev->cur_frame_id; |
|---|
| 555 | 574 | } |
|---|
| 556 | | - /* config buf for next frame */ |
|---|
| 557 | | - stats_vdev->cur_buf = NULL; |
|---|
| 558 | | - if (stats_vdev->nxt_buf) { |
|---|
| 559 | | - stats_vdev->cur_buf = stats_vdev->nxt_buf; |
|---|
| 560 | | - stats_vdev->nxt_buf = NULL; |
|---|
| 561 | | - } |
|---|
| 562 | | - rkisp_stats_update_buf(stats_vdev); |
|---|
| 563 | 575 | |
|---|
| 564 | | - cur_frame_id = meas_work->frame_id; |
|---|
| 576 | + /* buffer done when frame of right handle */ |
|---|
| 577 | + if (hw->unite == ISP_UNITE_ONE) { |
|---|
| 578 | + if (dev->unite_index == ISP_UNITE_LEFT) { |
|---|
| 579 | + cur_buf = NULL; |
|---|
| 580 | + is_dummy = false; |
|---|
| 581 | + } else if (cur_stat_buf) { |
|---|
| 582 | + cur_stat_buf = (void *)cur_stat_buf + size / 2; |
|---|
| 583 | + cur_stat_buf->frame_id = cur_frame_id; |
|---|
| 584 | + cur_stat_buf->params_id = params_vdev->cur_frame_id; |
|---|
| 585 | + } |
|---|
| 586 | + } |
|---|
| 587 | + |
|---|
| 588 | + if (hw->unite != ISP_UNITE_ONE || dev->unite_index == ISP_UNITE_RIGHT) { |
|---|
| 589 | + /* config buf for next frame */ |
|---|
| 590 | + stats_vdev->cur_buf = NULL; |
|---|
| 591 | + if (stats_vdev->nxt_buf) { |
|---|
| 592 | + stats_vdev->cur_buf = stats_vdev->nxt_buf; |
|---|
| 593 | + stats_vdev->nxt_buf = NULL; |
|---|
| 594 | + } |
|---|
| 595 | + rkisp_stats_update_buf(stats_vdev); |
|---|
| 596 | + } |
|---|
| 565 | 597 | } else { |
|---|
| 566 | 598 | cur_buf = NULL; |
|---|
| 567 | 599 | } |
|---|
| 568 | 600 | |
|---|
| 569 | 601 | if (meas_work->isp3a_ris & ISP3X_3A_RAWAWB) |
|---|
| 570 | | - ret |= ops->get_rawawb_meas(stats_vdev, cur_stat_buf); |
|---|
| 602 | + ops->get_rawawb_meas(stats_vdev, cur_stat_buf); |
|---|
| 571 | 603 | |
|---|
| 572 | 604 | if (meas_work->isp3a_ris & ISP3X_3A_RAWAF || |
|---|
| 573 | 605 | stats_vdev->af_meas_done_next) |
|---|
| 574 | | - ret |= ops->get_rawaf_meas(stats_vdev, cur_stat_buf); |
|---|
| 606 | + ops->get_rawaf_meas(stats_vdev, cur_stat_buf); |
|---|
| 575 | 607 | |
|---|
| 576 | 608 | if (meas_work->isp3a_ris & ISP3X_3A_RAWAE_BIG || |
|---|
| 577 | 609 | stats_vdev->ae_meas_done_next) |
|---|
| 578 | | - ret |= ops->get_rawae3_meas(stats_vdev, cur_stat_buf); |
|---|
| 610 | + ops->get_rawae3_meas(stats_vdev, cur_stat_buf); |
|---|
| 579 | 611 | |
|---|
| 580 | 612 | if (meas_work->isp3a_ris & ISP3X_3A_RAWHIST_BIG) |
|---|
| 581 | | - ret |= ops->get_rawhst3_meas(stats_vdev, cur_stat_buf); |
|---|
| 613 | + ops->get_rawhst3_meas(stats_vdev, cur_stat_buf); |
|---|
| 582 | 614 | |
|---|
| 583 | 615 | if (meas_work->isp3a_ris & ISP3X_3A_RAWAE_CH0) |
|---|
| 584 | | - ret |= ops->get_rawae0_meas(stats_vdev, cur_stat_buf); |
|---|
| 616 | + ops->get_rawae0_meas(stats_vdev, cur_stat_buf); |
|---|
| 585 | 617 | |
|---|
| 586 | 618 | if (meas_work->isp3a_ris & ISP3X_3A_RAWAE_CH1) |
|---|
| 587 | | - ret |= ops->get_rawae1_meas(stats_vdev, cur_stat_buf); |
|---|
| 619 | + ops->get_rawae1_meas(stats_vdev, cur_stat_buf); |
|---|
| 588 | 620 | |
|---|
| 589 | 621 | if (meas_work->isp3a_ris & ISP3X_3A_RAWAE_CH2) |
|---|
| 590 | | - ret |= ops->get_rawae2_meas(stats_vdev, cur_stat_buf); |
|---|
| 622 | + ops->get_rawae2_meas(stats_vdev, cur_stat_buf); |
|---|
| 591 | 623 | |
|---|
| 592 | 624 | if (meas_work->isp3a_ris & ISP3X_3A_RAWHIST_CH0) |
|---|
| 593 | | - ret |= ops->get_rawhst0_meas(stats_vdev, cur_stat_buf); |
|---|
| 625 | + ops->get_rawhst0_meas(stats_vdev, cur_stat_buf); |
|---|
| 594 | 626 | |
|---|
| 595 | 627 | if (meas_work->isp3a_ris & ISP3X_3A_RAWHIST_CH1) |
|---|
| 596 | | - ret |= ops->get_rawhst1_meas(stats_vdev, cur_stat_buf); |
|---|
| 628 | + ops->get_rawhst1_meas(stats_vdev, cur_stat_buf); |
|---|
| 597 | 629 | |
|---|
| 598 | 630 | if (meas_work->isp3a_ris & ISP3X_3A_RAWHIST_CH2) |
|---|
| 599 | | - ret |= ops->get_rawhst2_meas(stats_vdev, cur_stat_buf); |
|---|
| 631 | + ops->get_rawhst2_meas(stats_vdev, cur_stat_buf); |
|---|
| 600 | 632 | |
|---|
| 601 | 633 | if (meas_work->isp_ris & ISP3X_FRAME) { |
|---|
| 602 | | - ret |= ops->get_bls_stats(stats_vdev, cur_stat_buf); |
|---|
| 603 | | - ret |= ops->get_dhaz_stats(stats_vdev, cur_stat_buf); |
|---|
| 604 | | - ret |= ops->get_vsm_stats(stats_vdev, cur_stat_buf); |
|---|
| 634 | + ops->get_bls_stats(stats_vdev, cur_stat_buf); |
|---|
| 635 | + ops->get_dhaz_stats(stats_vdev, cur_stat_buf); |
|---|
| 636 | + ops->get_vsm_stats(stats_vdev, cur_stat_buf); |
|---|
| 605 | 637 | } |
|---|
| 606 | 638 | |
|---|
| 607 | | - if (ret || (cur_stat_buf && !cur_stat_buf->meas_type)) { |
|---|
| 639 | + if (cur_stat_buf && stats_vdev->dev->is_first_double) |
|---|
| 640 | + cur_stat_buf->meas_type |= ISP32_STAT_RTT_FST; |
|---|
| 641 | + |
|---|
| 642 | + if (is_dummy) { |
|---|
| 643 | + spin_lock_irqsave(&stats_vdev->rd_lock, flags); |
|---|
| 644 | + if (!list_empty(&stats_vdev->stat)) { |
|---|
| 645 | + cur_buf = list_first_entry(&stats_vdev->stat, struct rkisp_buffer, queue); |
|---|
| 646 | + list_del(&cur_buf->queue); |
|---|
| 647 | + } |
|---|
| 648 | + spin_unlock_irqrestore(&stats_vdev->rd_lock, flags); |
|---|
| 608 | 649 | if (cur_buf) { |
|---|
| 609 | | - spin_lock_irqsave(&stats_vdev->rd_lock, flags); |
|---|
| 610 | | - list_add_tail(&cur_buf->queue, &stats_vdev->stat); |
|---|
| 611 | | - spin_unlock_irqrestore(&stats_vdev->rd_lock, flags); |
|---|
| 612 | | - } |
|---|
| 613 | | - } else { |
|---|
| 614 | | - if (is_dummy) { |
|---|
| 615 | | - spin_lock_irqsave(&stats_vdev->rd_lock, flags); |
|---|
| 616 | | - if (!list_empty(&stats_vdev->stat)) { |
|---|
| 617 | | - cur_buf = list_first_entry(&stats_vdev->stat, struct rkisp_buffer, queue); |
|---|
| 618 | | - list_del(&cur_buf->queue); |
|---|
| 619 | | - } else { |
|---|
| 620 | | - cur_stat_buf->frame_id = cur_frame_id; |
|---|
| 621 | | - cur_stat_buf->params_id = params_vdev->cur_frame_id; |
|---|
| 622 | | - } |
|---|
| 623 | | - spin_unlock_irqrestore(&stats_vdev->rd_lock, flags); |
|---|
| 624 | | - if (cur_buf) { |
|---|
| 625 | | - memcpy(cur_buf->vaddr[0], cur_stat_buf, size); |
|---|
| 626 | | - cur_stat_buf = cur_buf->vaddr[0]; |
|---|
| 627 | | - } |
|---|
| 628 | | - } |
|---|
| 629 | | - if (cur_buf && cur_stat_buf) { |
|---|
| 630 | | - cur_stat_buf->frame_id = cur_frame_id; |
|---|
| 631 | | - cur_stat_buf->params_id = params_vdev->cur_frame_id; |
|---|
| 632 | | - cur_stat_buf->params.info2ddr.buf_fd = -1; |
|---|
| 633 | | - cur_stat_buf->params.info2ddr.owner = 0; |
|---|
| 634 | | - rkisp_stats_info2ddr(stats_vdev, cur_stat_buf); |
|---|
| 635 | | - |
|---|
| 636 | | - vb2_set_plane_payload(&cur_buf->vb.vb2_buf, 0, size); |
|---|
| 637 | | - cur_buf->vb.sequence = cur_frame_id; |
|---|
| 638 | | - cur_buf->vb.vb2_buf.timestamp = meas_work->timestamp; |
|---|
| 639 | | - vb2_buffer_done(&cur_buf->vb.vb2_buf, VB2_BUF_STATE_DONE); |
|---|
| 650 | + memcpy(cur_buf->vaddr[0], stats_vdev->stats_buf[0].vaddr, size); |
|---|
| 651 | + cur_stat_buf = cur_buf->vaddr[0]; |
|---|
| 640 | 652 | } |
|---|
| 641 | 653 | } |
|---|
| 654 | + if (cur_buf && cur_stat_buf) { |
|---|
| 655 | + cur_stat_buf->frame_id = cur_frame_id; |
|---|
| 656 | + cur_stat_buf->params_id = params_vdev->cur_frame_id; |
|---|
| 657 | + cur_stat_buf->params.info2ddr.buf_fd = -1; |
|---|
| 658 | + cur_stat_buf->params.info2ddr.owner = 0; |
|---|
| 659 | + rkisp_stats_info2ddr(stats_vdev, cur_stat_buf); |
|---|
| 660 | + |
|---|
| 661 | + vb2_set_plane_payload(&cur_buf->vb.vb2_buf, 0, size); |
|---|
| 662 | + cur_buf->vb.sequence = cur_frame_id; |
|---|
| 663 | + cur_buf->vb.vb2_buf.timestamp = meas_work->timestamp; |
|---|
| 664 | + vb2_buffer_done(&cur_buf->vb.vb2_buf, VB2_BUF_STATE_DONE); |
|---|
| 665 | + } |
|---|
| 666 | + v4l2_dbg(4, rkisp_debug, &dev->v4l2_dev, |
|---|
| 667 | + "%s id:%d seq:%d params_id:%d ris:0x%x buf:%p meas_type:0x%x\n", |
|---|
| 668 | + __func__, dev->unite_index, |
|---|
| 669 | + cur_frame_id, params_vdev->cur_frame_id, meas_work->isp3a_ris, |
|---|
| 670 | + cur_buf, !cur_stat_buf ? 0 : cur_stat_buf->meas_type); |
|---|
| 642 | 671 | } |
|---|
| 643 | 672 | |
|---|
| 644 | 673 | static int |
|---|
| .. | .. |
|---|
| 890 | 919 | rkisp_stats_send_meas_lite(struct rkisp_isp_stats_vdev *stats_vdev, |
|---|
| 891 | 920 | struct rkisp_isp_readout_work *meas_work) |
|---|
| 892 | 921 | { |
|---|
| 893 | | - struct rkisp_isp_params_vdev *params_vdev = &stats_vdev->dev->params_vdev; |
|---|
| 922 | + struct rkisp_device *dev = stats_vdev->dev; |
|---|
| 923 | + struct rkisp_isp_params_vdev *params_vdev = &dev->params_vdev; |
|---|
| 894 | 924 | unsigned int cur_frame_id = meas_work->frame_id; |
|---|
| 895 | 925 | struct rkisp_buffer *cur_buf = NULL; |
|---|
| 896 | 926 | struct rkisp32_lite_stat_buffer *cur_stat_buf = NULL; |
|---|
| 897 | 927 | u32 size = sizeof(struct rkisp32_lite_stat_buffer); |
|---|
| 898 | | - int ret = 0; |
|---|
| 899 | 928 | |
|---|
| 900 | 929 | spin_lock(&stats_vdev->rd_lock); |
|---|
| 901 | 930 | if (!list_empty(&stats_vdev->stat)) { |
|---|
| .. | .. |
|---|
| 913 | 942 | } |
|---|
| 914 | 943 | |
|---|
| 915 | 944 | if (meas_work->isp3a_ris & ISP3X_3A_RAWAWB) |
|---|
| 916 | | - ret |= rkisp_stats_get_rawawb_meas_lite(stats_vdev, cur_stat_buf); |
|---|
| 945 | + rkisp_stats_get_rawawb_meas_lite(stats_vdev, cur_stat_buf); |
|---|
| 917 | 946 | |
|---|
| 918 | 947 | if (meas_work->isp3a_ris & ISP3X_3A_RAWAF || |
|---|
| 919 | 948 | stats_vdev->af_meas_done_next) |
|---|
| 920 | | - ret |= rkisp_stats_get_rawaf_meas_lite(stats_vdev, cur_stat_buf); |
|---|
| 949 | + rkisp_stats_get_rawaf_meas_lite(stats_vdev, cur_stat_buf); |
|---|
| 921 | 950 | |
|---|
| 922 | 951 | if (meas_work->isp3a_ris & ISP3X_3A_RAWAE_BIG || |
|---|
| 923 | 952 | stats_vdev->ae_meas_done_next) |
|---|
| 924 | | - ret |= rkisp_stats_get_rawae3_meas_lite(stats_vdev, cur_stat_buf); |
|---|
| 953 | + rkisp_stats_get_rawae3_meas_lite(stats_vdev, cur_stat_buf); |
|---|
| 925 | 954 | |
|---|
| 926 | 955 | if (meas_work->isp3a_ris & ISP3X_3A_RAWHIST_BIG) |
|---|
| 927 | | - ret |= rkisp_stats_get_rawhst3_meas_lite(stats_vdev, cur_stat_buf); |
|---|
| 956 | + rkisp_stats_get_rawhst3_meas_lite(stats_vdev, cur_stat_buf); |
|---|
| 928 | 957 | |
|---|
| 929 | 958 | if (meas_work->isp3a_ris & ISP3X_3A_RAWAE_CH0) |
|---|
| 930 | | - ret |= rkisp_stats_get_rawaelite_meas_lite(stats_vdev, cur_stat_buf); |
|---|
| 959 | + rkisp_stats_get_rawaelite_meas_lite(stats_vdev, cur_stat_buf); |
|---|
| 931 | 960 | |
|---|
| 932 | 961 | if (meas_work->isp3a_ris & ISP3X_3A_RAWHIST_CH0) |
|---|
| 933 | | - ret |= rkisp_stats_get_rawhstlite_meas_lite(stats_vdev, cur_stat_buf); |
|---|
| 962 | + rkisp_stats_get_rawhstlite_meas_lite(stats_vdev, cur_stat_buf); |
|---|
| 934 | 963 | |
|---|
| 935 | 964 | if (meas_work->isp_ris & ISP3X_FRAME) { |
|---|
| 936 | | - ret |= rkisp_stats_get_bls_stats(stats_vdev, cur_stat_buf); |
|---|
| 937 | | - ret |= rkisp_stats_get_dhaz_stats(stats_vdev, cur_stat_buf); |
|---|
| 965 | + rkisp_stats_get_bls_stats(stats_vdev, cur_stat_buf); |
|---|
| 966 | + rkisp_stats_get_dhaz_stats(stats_vdev, cur_stat_buf); |
|---|
| 938 | 967 | } |
|---|
| 939 | 968 | |
|---|
| 940 | 969 | if (cur_buf) { |
|---|
| 941 | | - if (ret || !cur_stat_buf->meas_type) { |
|---|
| 942 | | - unsigned long flags; |
|---|
| 943 | | - |
|---|
| 944 | | - spin_lock_irqsave(&stats_vdev->rd_lock, flags); |
|---|
| 945 | | - list_add_tail(&cur_buf->queue, &stats_vdev->stat); |
|---|
| 946 | | - spin_unlock_irqrestore(&stats_vdev->rd_lock, flags); |
|---|
| 947 | | - } else { |
|---|
| 948 | | - rkisp_stats_info2ddr(stats_vdev, cur_stat_buf); |
|---|
| 949 | | - vb2_set_plane_payload(&cur_buf->vb.vb2_buf, 0, size); |
|---|
| 950 | | - cur_buf->vb.sequence = cur_frame_id; |
|---|
| 951 | | - cur_buf->vb.vb2_buf.timestamp = meas_work->timestamp; |
|---|
| 952 | | - vb2_buffer_done(&cur_buf->vb.vb2_buf, VB2_BUF_STATE_DONE); |
|---|
| 953 | | - } |
|---|
| 970 | + rkisp_stats_info2ddr(stats_vdev, cur_stat_buf); |
|---|
| 971 | + vb2_set_plane_payload(&cur_buf->vb.vb2_buf, 0, size); |
|---|
| 972 | + cur_buf->vb.sequence = cur_frame_id; |
|---|
| 973 | + cur_buf->vb.vb2_buf.timestamp = meas_work->timestamp; |
|---|
| 974 | + vb2_buffer_done(&cur_buf->vb.vb2_buf, VB2_BUF_STATE_DONE); |
|---|
| 954 | 975 | } |
|---|
| 976 | + v4l2_dbg(4, rkisp_debug, &dev->v4l2_dev, |
|---|
| 977 | + "%s seq:%d params_id:%d ris:0x%x buf:%p meas_type:0x%x\n", |
|---|
| 978 | + __func__, |
|---|
| 979 | + cur_frame_id, params_vdev->cur_frame_id, meas_work->isp_ris, |
|---|
| 980 | + cur_buf, !cur_stat_buf ? 0 : cur_stat_buf->meas_type); |
|---|
| 955 | 981 | } |
|---|
| 956 | 982 | |
|---|
| 957 | 983 | static void |
|---|
| .. | .. |
|---|
| 1020 | 1046 | work.frame_id = cur_frame_id; |
|---|
| 1021 | 1047 | work.isp_ris = temp_isp_ris | isp_ris; |
|---|
| 1022 | 1048 | work.isp3a_ris = temp_isp3a_ris; |
|---|
| 1023 | | - work.timestamp = ktime_get_ns(); |
|---|
| 1049 | + work.timestamp = rkisp_time_get_ns(stats_vdev->dev); |
|---|
| 1024 | 1050 | rkisp_stats_send_meas_v32(stats_vdev, &work); |
|---|
| 1025 | 1051 | } |
|---|
| 1026 | 1052 | |
|---|
| .. | .. |
|---|
| 1048 | 1074 | { |
|---|
| 1049 | 1075 | struct rkisp_device *dev = stats_vdev->dev; |
|---|
| 1050 | 1076 | u32 size = stats_vdev->vdev_fmt.fmt.meta.buffersize; |
|---|
| 1077 | + u32 div = dev->hw_dev->unite ? 2 : 1; |
|---|
| 1051 | 1078 | |
|---|
| 1052 | 1079 | if (dev->isp_sdev.in_fmt.fmt_type == FMT_YUV) |
|---|
| 1053 | 1080 | return; |
|---|
| .. | .. |
|---|
| 1059 | 1086 | else |
|---|
| 1060 | 1087 | memset(stats_vdev->stats_buf[0].vaddr, 0, size); |
|---|
| 1061 | 1088 | rkisp_stats_update_buf(stats_vdev); |
|---|
| 1062 | | - rkisp_write(dev, ISP3X_MI_DBR_WR_SIZE, size, false); |
|---|
| 1063 | | - rkisp_set_bits(dev, ISP3X_SWS_CFG, 0, ISP3X_3A_DDR_WRITE_EN, false); |
|---|
| 1089 | + rkisp_unite_write(dev, ISP3X_MI_DBR_WR_SIZE, size / div, false); |
|---|
| 1090 | + rkisp_unite_set_bits(dev, ISP3X_SWS_CFG, 0, ISP3X_3A_DDR_WRITE_EN, false); |
|---|
| 1064 | 1091 | if (stats_vdev->nxt_buf) { |
|---|
| 1065 | 1092 | stats_vdev->cur_buf = stats_vdev->nxt_buf; |
|---|
| 1066 | 1093 | stats_vdev->nxt_buf = NULL; |
|---|
| .. | .. |
|---|
| 1080 | 1107 | |
|---|
| 1081 | 1108 | void rkisp_init_stats_vdev_v32(struct rkisp_isp_stats_vdev *stats_vdev) |
|---|
| 1082 | 1109 | { |
|---|
| 1110 | + int mult = stats_vdev->dev->hw_dev->unite ? 2 : 1; |
|---|
| 1083 | 1111 | u32 size; |
|---|
| 1084 | 1112 | |
|---|
| 1085 | 1113 | stats_vdev->vdev_fmt.fmt.meta.dataformat = |
|---|
| .. | .. |
|---|
| 1087 | 1115 | if (stats_vdev->dev->isp_ver == ISP_V32) { |
|---|
| 1088 | 1116 | stats_vdev->priv_ops = &stats_ddr_ops_v32; |
|---|
| 1089 | 1117 | stats_vdev->rd_stats_from_ddr = true; |
|---|
| 1090 | | - size = sizeof(struct rkisp32_isp_stat_buffer); |
|---|
| 1118 | + size = ALIGN(sizeof(struct rkisp32_isp_stat_buffer), 16); |
|---|
| 1091 | 1119 | } else { |
|---|
| 1092 | 1120 | stats_vdev->priv_ops = NULL; |
|---|
| 1093 | 1121 | stats_vdev->rd_stats_from_ddr = false; |
|---|
| 1094 | 1122 | size = sizeof(struct rkisp32_lite_stat_buffer); |
|---|
| 1095 | 1123 | } |
|---|
| 1096 | | - stats_vdev->vdev_fmt.fmt.meta.buffersize = size; |
|---|
| 1124 | + stats_vdev->vdev_fmt.fmt.meta.buffersize = size * mult; |
|---|
| 1097 | 1125 | stats_vdev->ops = &rkisp_isp_stats_ops_tbl; |
|---|
| 1098 | 1126 | } |
|---|
| 1099 | 1127 | |
|---|