| .. | .. |
|---|
| 461 | 461 | }; |
|---|
| 462 | 462 | |
|---|
| 463 | 463 | wnd_num_idx = arg->wnd_num; |
|---|
| 464 | + if (wnd_num_idx >= ARRAY_SIZE(hist_wnd_num)) { |
|---|
| 465 | + wnd_num_idx = ARRAY_SIZE(hist_wnd_num) - 1; |
|---|
| 466 | + dev_err(params_vdev->dev->dev, |
|---|
| 467 | + "%s invalid wnd_num:%d, set to %d\n", |
|---|
| 468 | + __func__, arg->wnd_num, wnd_num_idx); |
|---|
| 469 | + } |
|---|
| 464 | 470 | for (i = 0; i < ISP2X_SIHIST_WIN_NUM; i++) { |
|---|
| 465 | 471 | /* avoid to override the old enable value */ |
|---|
| 466 | 472 | hist_ctrl = rkisp_ioread32(params_vdev, ISP_HIST_HIST_CTRL + i * 0x10); |
|---|
| .. | .. |
|---|
| 536 | 542 | { |
|---|
| 537 | 543 | int i, j; |
|---|
| 538 | 544 | unsigned int sram_addr; |
|---|
| 539 | | - unsigned int data; |
|---|
| 545 | + unsigned int data = rkisp_ioread32(params_vdev, ISP_LSC_CTRL); |
|---|
| 540 | 546 | |
|---|
| 541 | | - if (is_check && |
|---|
| 542 | | - !(rkisp_ioread32(params_vdev, ISP_LSC_CTRL) & ISP_LSC_EN)) |
|---|
| 547 | + if (is_check && (data & ISP_LSC_LUT_EN || !(data & ISP_LSC_EN))) |
|---|
| 543 | 548 | return; |
|---|
| 544 | 549 | |
|---|
| 545 | 550 | /* CIF_ISP_LSC_TABLE_ADDRESS_153 = ( 17 * 18 ) >> 1 */ |
|---|
| .. | .. |
|---|
| 679 | 684 | * readback mode lsc lut AHB config to sram, once for single device, |
|---|
| 680 | 685 | * need record to switch for multi-device. |
|---|
| 681 | 686 | */ |
|---|
| 682 | | - if (!IS_HDR_RDBK(dev->rd_mode)) |
|---|
| 687 | + if (!IS_HDR_RDBK(dev->rd_mode)) { |
|---|
| 683 | 688 | isp_lsc_matrix_cfg_ddr(params_vdev, arg); |
|---|
| 684 | | - else if (dev->hw_dev->is_single) |
|---|
| 685 | | - isp_lsc_matrix_cfg_sram(params_vdev, arg, false); |
|---|
| 686 | | - else |
|---|
| 689 | + } else { |
|---|
| 687 | 690 | params_rec->others.lsc_cfg = *arg; |
|---|
| 691 | + if (dev->hw_dev->is_single) |
|---|
| 692 | + isp_lsc_matrix_cfg_sram(params_vdev, arg, false); |
|---|
| 693 | + } |
|---|
| 688 | 694 | |
|---|
| 689 | 695 | for (i = 0; i < 4; i++) { |
|---|
| 690 | 696 | /* program x size tables */ |
|---|
| .. | .. |
|---|
| 1758 | 1764 | ISP2X_REG_WR_MASK); |
|---|
| 1759 | 1765 | |
|---|
| 1760 | 1766 | wnd_num_idx = arg->wnd_num; |
|---|
| 1767 | + if (wnd_num_idx >= ARRAY_SIZE(ae_wnd_num)) { |
|---|
| 1768 | + wnd_num_idx = ARRAY_SIZE(ae_wnd_num) - 1; |
|---|
| 1769 | + dev_err(params_vdev->dev->dev, |
|---|
| 1770 | + "%s invalid wnd_num:%d, set to %d\n", |
|---|
| 1771 | + __func__, arg->wnd_num, wnd_num_idx); |
|---|
| 1772 | + } |
|---|
| 1761 | 1773 | value |= ISP2X_RAWAEBIG_WNDNUM_SET(wnd_num_idx); |
|---|
| 1762 | 1774 | |
|---|
| 1763 | 1775 | if (arg->subwin_en[0]) |
|---|
| .. | .. |
|---|
| 2831 | 2843 | return; |
|---|
| 2832 | 2844 | |
|---|
| 2833 | 2845 | wnd_num_idx = arg->wnd_num; |
|---|
| 2846 | + if (wnd_num_idx >= ARRAY_SIZE(hist_wnd_num)) { |
|---|
| 2847 | + wnd_num_idx = ARRAY_SIZE(hist_wnd_num) - 1; |
|---|
| 2848 | + dev_err(params_vdev->dev->dev, |
|---|
| 2849 | + "%s invalid wnd_num:%d, set to %d\n", |
|---|
| 2850 | + __func__, arg->wnd_num, wnd_num_idx); |
|---|
| 2851 | + } |
|---|
| 2834 | 2852 | memset(weight15x15, 0, sizeof(weight15x15)); |
|---|
| 2835 | 2853 | for (i = 0; i < hist_wnd_num[wnd_num_idx]; i++) { |
|---|
| 2836 | 2854 | for (j = 0; j < hist_wnd_num[wnd_num_idx]; j++) { |
|---|
| .. | .. |
|---|
| 2879 | 2897 | } |
|---|
| 2880 | 2898 | |
|---|
| 2881 | 2899 | wnd_num_idx = arg->wnd_num; |
|---|
| 2900 | + if (wnd_num_idx >= ARRAY_SIZE(hist_wnd_num)) { |
|---|
| 2901 | + wnd_num_idx = ARRAY_SIZE(hist_wnd_num) - 1; |
|---|
| 2902 | + dev_err(params_vdev->dev->dev, |
|---|
| 2903 | + "%s invalid wnd_num:%d, set to %d\n", |
|---|
| 2904 | + __func__, arg->wnd_num, wnd_num_idx); |
|---|
| 2905 | + } |
|---|
| 2882 | 2906 | /* avoid to override the old enable value */ |
|---|
| 2883 | 2907 | hist_ctrl = rkisp_ioread32(params_vdev, addr + ISP_RAWHIST_BIG_CTRL); |
|---|
| 2884 | 2908 | hist_ctrl &= ISP2X_RAWHSTBIG_CTRL_EN_MASK; |
|---|
| .. | .. |
|---|
| 2910 | 2934 | |
|---|
| 2911 | 2935 | if (dev->hw_dev->is_single) |
|---|
| 2912 | 2936 | isp_rawhstbig_cfg_sram(params_vdev, arg, blk_no, false); |
|---|
| 2913 | | - else |
|---|
| 2914 | | - *arg_rec = *arg; |
|---|
| 2937 | + *arg_rec = *arg; |
|---|
| 2915 | 2938 | } |
|---|
| 2916 | 2939 | |
|---|
| 2917 | 2940 | static void |
|---|