.. | .. |
---|
94 | 94 | #define CROP_SRC_SENSOR_MASK (0x1 << 0) |
---|
95 | 95 | #define CROP_SRC_USR_MASK (0x1 << 1) |
---|
96 | 96 | |
---|
| 97 | +/* |
---|
| 98 | + * max wait time for stream stop |
---|
| 99 | + */ |
---|
| 100 | +#define RKCIF_STOP_MAX_WAIT_TIME_MS (500) |
---|
| 101 | + |
---|
| 102 | +#define RKCIF_SKIP_FRAME_MAX (16) |
---|
| 103 | + |
---|
97 | 104 | enum rkcif_workmode { |
---|
98 | 105 | RKCIF_WORKMODE_ONEFRAME = 0x00, |
---|
99 | 106 | RKCIF_WORKMODE_PINGPONG = 0x01, |
---|
.. | .. |
---|
193 | 200 | |
---|
194 | 201 | struct rkcif_tools_buffer { |
---|
195 | 202 | struct vb2_v4l2_buffer *vb; |
---|
| 203 | + struct rkisp_rx_buf *dbufs; |
---|
196 | 204 | struct list_head list; |
---|
197 | 205 | u32 frame_idx; |
---|
198 | 206 | u64 timestamp; |
---|
.. | .. |
---|
279 | 287 | unsigned int width; |
---|
280 | 288 | unsigned int height; |
---|
281 | 289 | unsigned int virtual_width; |
---|
| 290 | + unsigned int left_virtual_width; |
---|
282 | 291 | unsigned int crop_st_x; |
---|
283 | 292 | unsigned int crop_st_y; |
---|
284 | 293 | unsigned int dsi_input; |
---|
285 | 294 | struct rkmodule_lvds_cfg lvds_cfg; |
---|
| 295 | + struct rkmodule_capture_info capture_info; |
---|
286 | 296 | }; |
---|
287 | 297 | |
---|
288 | 298 | struct rkcif_vdev_node { |
---|
.. | .. |
---|
468 | 478 | u32 group; |
---|
469 | 479 | }; |
---|
470 | 480 | |
---|
| 481 | +enum rkcif_toisp_buf_update_state { |
---|
| 482 | + RKCIF_TOISP_BUF_ROTATE, |
---|
| 483 | + RKCIF_TOISP_BUF_THESAME, |
---|
| 484 | + RKCIF_TOISP_BUF_LOSS, |
---|
| 485 | +}; |
---|
| 486 | + |
---|
| 487 | +struct rkcif_toisp_buf_state { |
---|
| 488 | + enum rkcif_toisp_buf_update_state state; |
---|
| 489 | + int check_cnt; |
---|
| 490 | + bool is_early_update; |
---|
| 491 | +}; |
---|
| 492 | + |
---|
471 | 493 | /* |
---|
472 | 494 | * struct rkcif_stream - Stream states TODO |
---|
473 | 495 | * |
---|
.. | .. |
---|
526 | 548 | unsigned int cur_stream_mode; |
---|
527 | 549 | struct rkcif_rx_buffer rx_buf[RKISP_VICAP_BUF_CNT_MAX]; |
---|
528 | 550 | struct list_head rx_buf_head; |
---|
529 | | - int buf_num_toisp; |
---|
| 551 | + int total_buf_num; |
---|
| 552 | + int rx_buf_num; |
---|
530 | 553 | u64 line_int_cnt; |
---|
531 | 554 | int lack_buf_cnt; |
---|
532 | 555 | unsigned int buf_wake_up_cnt; |
---|
.. | .. |
---|
536 | 559 | int last_rx_buf_idx; |
---|
537 | 560 | int last_frame_idx; |
---|
538 | 561 | int new_fource_idx; |
---|
| 562 | + atomic_t buf_cnt; |
---|
| 563 | + struct completion stop_complete; |
---|
| 564 | + struct rkcif_toisp_buf_state toisp_buf_state; |
---|
| 565 | + u32 skip_frame; |
---|
| 566 | + u32 cur_skip_frame; |
---|
539 | 567 | bool stopping; |
---|
540 | 568 | bool crop_enable; |
---|
541 | 569 | bool crop_dyn_en; |
---|
.. | .. |
---|
552 | 580 | bool is_in_vblank; |
---|
553 | 581 | bool is_change_toisp; |
---|
554 | 582 | bool is_stop_capture; |
---|
| 583 | + bool is_wait_dma_stop; |
---|
| 584 | + bool is_single_cap; |
---|
| 585 | + bool is_wait_stop_complete; |
---|
555 | 586 | }; |
---|
556 | 587 | |
---|
557 | 588 | struct rkcif_lvds_subdev { |
---|
.. | .. |
---|
787 | 818 | u32 intstat; |
---|
788 | 819 | u32 lastline; |
---|
789 | 820 | u32 lastpixel; |
---|
| 821 | + u32 size_id0; |
---|
| 822 | + u32 size_id1; |
---|
| 823 | + u32 size_id2; |
---|
| 824 | + u32 size_id3; |
---|
| 825 | +}; |
---|
| 826 | + |
---|
| 827 | +enum rkcif_resume_user { |
---|
| 828 | + RKCIF_RESUME_CIF, |
---|
| 829 | + RKCIF_RESUME_ISP, |
---|
| 830 | +}; |
---|
| 831 | + |
---|
| 832 | +struct rkcif_sensor_work { |
---|
| 833 | + struct work_struct work; |
---|
| 834 | + int on; |
---|
790 | 835 | }; |
---|
791 | 836 | |
---|
792 | 837 | /* |
---|
.. | .. |
---|
817 | 862 | int chip_id; |
---|
818 | 863 | atomic_t stream_cnt; |
---|
819 | 864 | atomic_t power_cnt; |
---|
| 865 | + atomic_t streamoff_cnt; |
---|
820 | 866 | struct mutex stream_lock; /* lock between streams */ |
---|
821 | 867 | struct mutex scale_lock; /* lock between scale dev */ |
---|
822 | 868 | struct mutex tools_lock; /* lock between tools dev */ |
---|
.. | .. |
---|
841 | 887 | struct rkcif_work_struct reset_work; |
---|
842 | 888 | int id_use_cnt; |
---|
843 | 889 | unsigned int csi_host_idx; |
---|
| 890 | + unsigned int csi_host_idx_def; |
---|
844 | 891 | unsigned int dvp_sof_in_oneframe; |
---|
845 | 892 | unsigned int wait_line; |
---|
846 | 893 | unsigned int wait_line_bak; |
---|
.. | .. |
---|
848 | 895 | struct completion cmpl_ntf; |
---|
849 | 896 | struct csi2_dphy_hw *dphy_hw; |
---|
850 | 897 | phys_addr_t resmem_pa; |
---|
| 898 | + dma_addr_t resmem_addr; |
---|
851 | 899 | size_t resmem_size; |
---|
852 | 900 | struct rk_tb_client tb_client; |
---|
853 | 901 | bool is_start_hdr; |
---|
.. | .. |
---|
858 | 906 | bool is_thunderboot; |
---|
859 | 907 | bool is_rdbk_to_online; |
---|
860 | 908 | bool is_support_tools; |
---|
| 909 | + bool is_rtt_suspend; |
---|
| 910 | + bool sensor_state_change; |
---|
| 911 | + bool is_toisp_reset; |
---|
861 | 912 | int rdbk_debug; |
---|
862 | 913 | struct rkcif_sync_cfg sync_cfg; |
---|
863 | 914 | int sditf_cnt; |
---|
.. | .. |
---|
866 | 917 | int sensor_linetime; |
---|
867 | 918 | u32 err_state; |
---|
868 | 919 | struct rkcif_err_state_work err_state_work; |
---|
| 920 | + struct rkcif_sensor_work sensor_work; |
---|
| 921 | + int resume_mode; |
---|
| 922 | + u32 nr_buf_size; |
---|
| 923 | + u32 share_mem_size; |
---|
| 924 | + u32 thunderboot_sensor_num; |
---|
| 925 | + int sensor_state; |
---|
| 926 | + u32 intr_mask; |
---|
| 927 | + struct delayed_work work_deal_err; |
---|
869 | 928 | }; |
---|
870 | 929 | |
---|
871 | 930 | extern struct platform_driver rkcif_plat_drv; |
---|
.. | .. |
---|
883 | 942 | int rkcif_scale_start(struct rkcif_scale_vdev *scale_vdev); |
---|
884 | 943 | |
---|
885 | 944 | const struct |
---|
886 | | -cif_input_fmt *get_input_fmt(struct v4l2_subdev *sd, |
---|
| 945 | +cif_input_fmt *rkcif_get_input_fmt(struct rkcif_device *dev, |
---|
887 | 946 | struct v4l2_rect *rect, |
---|
888 | 947 | u32 pad_id, struct csi_channel_info *csi_info); |
---|
889 | 948 | |
---|
.. | .. |
---|
962 | 1021 | void rkcif_rockit_dev_deinit(void); |
---|
963 | 1022 | |
---|
964 | 1023 | void rkcif_err_print_work(struct work_struct *work); |
---|
| 1024 | +int rkcif_stream_suspend(struct rkcif_device *cif_dev, int mode); |
---|
| 1025 | +int rkcif_stream_resume(struct rkcif_device *cif_dev, int mode); |
---|
| 1026 | + |
---|
| 1027 | +static inline u64 rkcif_time_get_ns(struct rkcif_device *dev) |
---|
| 1028 | +{ |
---|
| 1029 | + if (dev->chip_id == CHIP_RV1106_CIF) |
---|
| 1030 | + return ktime_get_boottime_ns(); |
---|
| 1031 | + else |
---|
| 1032 | + return ktime_get_ns(); |
---|
| 1033 | +} |
---|
965 | 1034 | |
---|
966 | 1035 | #endif |
---|