forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 072de836f53be56a70cecf70b43ae43b7ce17376
kernel/drivers/media/platform/rockchip/cif/dev.h
....@@ -17,6 +17,8 @@
1717 #include <media/v4l2-mc.h>
1818 #include <linux/workqueue.h>
1919 #include <linux/rk-camera-module.h>
20
+#include <linux/rkcif-config.h>
21
+#include <linux/soc/rockchip/rockchip_thunderboot_service.h>
2022
2123 #include "regs.h"
2224 #include "version.h"
....@@ -24,6 +26,10 @@
2426 #include "mipi-csi2.h"
2527 #include "hw.h"
2628 #include "subdev-itf.h"
29
+
30
+#if IS_ENABLED(CONFIG_CPU_RV1106)
31
+#include <linux/soc/rockchip/rk_sdmmc.h>
32
+#endif
2733
2834 #define CIF_DRIVER_NAME "rkcif"
2935 #define CIF_VIDEODEVICE_NAME "stream_cif"
....@@ -46,6 +52,9 @@
4652 #define CIF_DVP_ID2_VDEV_NAME CIF_VIDEODEVICE_NAME "_dvp_id2"
4753 #define CIF_DVP_ID3_VDEV_NAME CIF_VIDEODEVICE_NAME "_dvp_id3"
4854
55
+#define RKCIF_PLANE_Y 0
56
+#define RKCIF_PLANE_CBCR 1
57
+
4958 /*
5059 * RK1808 support 5 channel inputs simultaneously:
5160 * dvp + 4 mipi virtual channels;
....@@ -61,8 +70,6 @@
6170 #define RKCIF_MAX_STREAM_DVP 4
6271 #define RKCIF_STREAM_DVP 4
6372
64
-#define RKCIF_MAX_DEV 8
65
-
6673 #define RKCIF_MAX_SENSOR 2
6774 #define RKCIF_MAX_CSI_CHANNEL 4
6875 #define RKCIF_MAX_PIPELINE 4
....@@ -71,10 +78,12 @@
7178 #define RKCIF_DEFAULT_HEIGHT 480
7279 #define RKCIF_FS_DETECTED_NUM 2
7380
81
+#define RKCIF_MAX_INTERVAL_NS 5000000
7482 /*
7583 * for HDR mode sync buf
7684 */
7785 #define RDBK_MAX 3
86
+#define RDBK_TOISP_MAX 2
7887 #define RDBK_L 0
7988 #define RDBK_M 1
8089 #define RDBK_S 2
....@@ -91,6 +100,15 @@
91100 RKCIF_WORKMODE_LINELOOP = 0x02
92101 };
93102
103
+enum rkcif_stream_mode {
104
+ RKCIF_STREAM_MODE_NONE = 0x0,
105
+ RKCIF_STREAM_MODE_CAPTURE = 0x01,
106
+ RKCIF_STREAM_MODE_TOISP = 0x02,
107
+ RKCIF_STREAM_MODE_TOSCALE = 0x04,
108
+ RKCIF_STREAM_MODE_TOISP_RDBK = 0x08,
109
+ RKCIF_STREAM_MODE_ROCKIT = 0x10
110
+};
111
+
94112 enum rkcif_yuvaddr_state {
95113 RKCIF_YUV_ADDR_STATE_UPDATE = 0x0,
96114 RKCIF_YUV_ADDR_STATE_INIT = 0x1
....@@ -103,18 +121,17 @@
103121 RKCIF_STATE_RESET_IN_STREAMING,
104122 };
105123
106
-enum host_type_t {
107
- RK_CSI_RXHOST,
108
- RK_DSI_RXHOST
109
-};
110
-
111124 enum rkcif_lvds_pad {
112125 RKCIF_LVDS_PAD_SINK = 0x0,
113126 RKCIF_LVDS_PAD_SRC_ID0,
114127 RKCIF_LVDS_PAD_SRC_ID1,
115128 RKCIF_LVDS_PAD_SRC_ID2,
116129 RKCIF_LVDS_PAD_SRC_ID3,
117
- RKCIF_LVDS_PAD_MAX
130
+ RKCIF_LVDS_PAD_SCL_ID0,
131
+ RKCIF_LVDS_PAD_SCL_ID1,
132
+ RKCIF_LVDS_PAD_SCL_ID2,
133
+ RKCIF_LVDS_PAD_SCL_ID3,
134
+ RKCIF_LVDS_PAD_MAX,
118135 };
119136
120137 enum rkcif_lvds_state {
....@@ -170,12 +187,17 @@
170187 u32 buff_addr[VIDEO_MAX_PLANES];
171188 void *vaddr[VIDEO_MAX_PLANES];
172189 };
190
+ struct dma_buf *dbuf;
191
+ u64 fe_timestamp;
173192 };
174193
175
-struct rkcif_dummy_buffer {
176
- void *vaddr;
177
- dma_addr_t dma_addr;
178
- u32 size;
194
+struct rkcif_tools_buffer {
195
+ struct vb2_v4l2_buffer *vb;
196
+ struct rkisp_rx_buf *dbufs;
197
+ struct list_head list;
198
+ u32 frame_idx;
199
+ u64 timestamp;
200
+ int use_cnt;
179201 };
180202
181203 extern int rkcif_debug;
....@@ -250,16 +272,20 @@
250272 unsigned char enable; /* capture enable */
251273 unsigned char vc;
252274 unsigned char data_type;
275
+ unsigned char data_bit;
253276 unsigned char crop_en;
254277 unsigned char cmd_mode_en;
255278 unsigned char fmt_val;
279
+ unsigned char csi_fmt_val;
256280 unsigned int width;
257281 unsigned int height;
258282 unsigned int virtual_width;
283
+ unsigned int left_virtual_width;
259284 unsigned int crop_st_x;
260285 unsigned int crop_st_y;
261286 unsigned int dsi_input;
262287 struct rkmodule_lvds_cfg lvds_cfg;
288
+ struct rkmodule_capture_info capture_info;
263289 };
264290
265291 struct rkcif_vdev_node {
....@@ -326,12 +352,28 @@
326352 struct rkcif_irq_stats {
327353 u64 csi_overflow_cnt;
328354 u64 csi_bwidth_lack_cnt;
355
+ u64 csi_size_err_cnt;
329356 u64 dvp_bus_err_cnt;
330357 u64 dvp_overflow_cnt;
331358 u64 dvp_line_err_cnt;
332359 u64 dvp_pix_err_cnt;
333
- u64 all_frm_end_cnt;
360
+ u64 dvp_size_err_cnt;
361
+ u64 dvp_bwidth_lack_cnt;
362
+ u64 frm_end_cnt[RKCIF_MAX_STREAM_MIPI];
363
+ u64 not_active_buf_cnt[RKCIF_MAX_STREAM_MIPI];
364
+ u64 trig_simult_cnt[RKCIF_MAX_STREAM_MIPI];
334365 u64 all_err_cnt;
366
+};
367
+
368
+/*
369
+ * the detecting mode of cif reset timer
370
+ * related with dts property:rockchip,cif-monitor
371
+ */
372
+enum rkcif_monitor_mode {
373
+ RKCIF_MONITOR_MODE_IDLE = 0x0,
374
+ RKCIF_MONITOR_MODE_CONTINUE,
375
+ RKCIF_MONITOR_MODE_TRIGGER,
376
+ RKCIF_MONITOR_MODE_HOTPLUG,
335377 };
336378
337379 /*
....@@ -348,23 +390,85 @@
348390 };
349391
350392 struct rkcif_timer {
393
+ struct timer_list timer;
394
+ spinlock_t timer_lock;
351395 spinlock_t csi2_err_lock;
352
- unsigned int last_buf_wakeup_cnt[RKCIF_MAX_CSI_CHANNEL];
396
+ unsigned long cycle;
397
+ /* unit: us */
398
+ unsigned long line_end_cycle;
399
+ unsigned int run_cnt;
400
+ unsigned int max_run_cnt;
401
+ unsigned int stop_index_of_run_cnt;
402
+ unsigned int last_buf_wakeup_cnt[RKCIF_MAX_STREAM_MIPI];
353403 unsigned long csi2_err_cnt_even;
354404 unsigned long csi2_err_cnt_odd;
405
+ unsigned int csi2_err_ref_cnt;
355406 unsigned int csi2_err_fs_fe_cnt;
356407 unsigned int csi2_err_fs_fe_detect_cnt;
408
+ unsigned int frm_num_of_monitor_cycle;
409
+ unsigned int triggered_frame_num;
410
+ unsigned int vts;
411
+ unsigned int raw_height;
412
+ /* unit: ms */
413
+ unsigned int err_time_interval;
357414 unsigned int csi2_err_triggered_cnt;
358415 unsigned int notifer_called_cnt;
416
+ unsigned long frame_end_cycle_us;
359417 u64 csi2_first_err_timestamp;
360418 bool is_triggered;
361419 bool is_buf_stop_update;
420
+ bool is_running;
362421 bool is_csi2_err_occurred;
422
+ bool has_been_init;
423
+ bool is_ctrl_by_user;
424
+ enum rkcif_monitor_mode monitor_mode;
425
+ enum rkmodule_reset_src reset_src;
363426 };
364427
365428 struct rkcif_extend_info {
366429 struct v4l2_pix_format_mplane pixm;
367430 bool is_extended;
431
+};
432
+
433
+enum rkcif_capture_mode {
434
+ RKCIF_TO_DDR = 0,
435
+ RKCIF_TO_ISP_DDR,
436
+ RKCIF_TO_ISP_DMA,
437
+};
438
+
439
+/*
440
+ * list: used for buf rotation
441
+ * list_free: only used to release buf asynchronously
442
+ */
443
+struct rkcif_rx_buffer {
444
+ int buf_idx;
445
+ struct list_head list;
446
+ struct list_head list_free;
447
+ struct rkisp_rx_buf dbufs;
448
+ struct rkcif_dummy_buffer dummy;
449
+ struct rkisp_thunderboot_shmem shmem;
450
+ u64 fe_timestamp;
451
+};
452
+
453
+enum rkcif_dma_en_mode {
454
+ RKCIF_DMAEN_BY_VICAP = 0x1,
455
+ RKCIF_DMAEN_BY_ISP = 0x2,
456
+ RKCIF_DMAEN_BY_VICAP_TO_ISP = 0x4,
457
+ RKCIF_DMAEN_BY_ISP_TO_VICAP = 0x8,
458
+ RKCIF_DMAEN_BY_ROCKIT = 0x10,
459
+};
460
+
461
+struct rkcif_skip_info {
462
+ u8 cap_m;
463
+ u8 skip_n;
464
+ bool skip_en;
465
+ bool skip_to_en;
466
+ bool skip_to_dis;
467
+};
468
+
469
+struct rkcif_sync_cfg {
470
+ u32 type;
471
+ u32 group;
368472 };
369473
370474 /*
....@@ -394,6 +498,11 @@
394498 struct list_head buf_head;
395499 struct rkcif_buffer *curr_buf;
396500 struct rkcif_buffer *next_buf;
501
+ struct rkcif_rx_buffer *curr_buf_toisp;
502
+ struct rkcif_rx_buffer *next_buf_toisp;
503
+ struct list_head rockit_buf_head;
504
+ struct rkcif_buffer *curr_buf_rockit;
505
+ struct rkcif_buffer *next_buf_rockit;
397506
398507 spinlock_t vbq_lock; /* vfd lock */
399508 spinlock_t fps_lock;
....@@ -408,9 +517,29 @@
408517 struct rkcif_extend_info extend_line;
409518 struct rkcif_readout_stats readout;
410519 unsigned int fs_cnt_in_single_frame;
520
+ unsigned int capture_mode;
521
+ struct rkcif_scale_vdev *scale_vdev;
522
+ struct rkcif_tools_vdev *tools_vdev;
523
+ int dma_en;
524
+ int to_en_dma;
525
+ int to_stop_dma;
526
+ int buf_owner;
527
+ int buf_replace_cnt;
528
+ struct list_head rx_buf_head_vicap;
529
+ unsigned int cur_stream_mode;
530
+ struct rkcif_rx_buffer rx_buf[RKISP_VICAP_BUF_CNT_MAX];
531
+ struct list_head rx_buf_head;
532
+ int total_buf_num;
411533 u64 line_int_cnt;
412
- int vc;
413
- u64 streamon_timestamp;
534
+ int lack_buf_cnt;
535
+ unsigned int buf_wake_up_cnt;
536
+ struct rkcif_skip_info skip_info;
537
+ struct tasklet_struct vb_done_tasklet;
538
+ struct list_head vb_done_list;
539
+ int last_rx_buf_idx;
540
+ int last_frame_idx;
541
+ int new_fource_idx;
542
+ atomic_t buf_cnt;
414543 bool stopping;
415544 bool crop_enable;
416545 bool crop_dyn_en;
....@@ -422,6 +551,12 @@
422551 bool is_can_stop;
423552 bool is_buf_active;
424553 bool is_high_align;
554
+ bool to_en_scale;
555
+ bool is_finish_stop_dma;
556
+ bool is_in_vblank;
557
+ bool is_change_toisp;
558
+ bool is_stop_capture;
559
+ bool is_wait_dma_stop;
425560 };
426561
427562 struct rkcif_lvds_subdev {
....@@ -473,6 +608,192 @@
473608 return &vnode->buf_queue;
474609 }
475610
611
+#define SCALE_DRIVER_NAME "rkcif_scale"
612
+
613
+#define RKCIF_SCALE_CH0 0
614
+#define RKCIF_SCALE_CH1 1
615
+#define RKCIF_SCALE_CH2 2
616
+#define RKCIF_SCALE_CH3 3
617
+#define RKCIF_MAX_SCALE_CH 4
618
+
619
+#define CIF_SCALE_CH0_VDEV_NAME CIF_DRIVER_NAME "_scale_ch0"
620
+#define CIF_SCALE_CH1_VDEV_NAME CIF_DRIVER_NAME "_scale_ch1"
621
+#define CIF_SCALE_CH2_VDEV_NAME CIF_DRIVER_NAME "_scale_ch2"
622
+#define CIF_SCALE_CH3_VDEV_NAME CIF_DRIVER_NAME "_scale_ch3"
623
+
624
+#define RKCIF_SCALE_ENUM_SIZE_MAX 3
625
+#define RKCIF_MAX_SDITF 4
626
+
627
+enum scale_ch_sw {
628
+ SCALE_MIPI0_ID0,
629
+ SCALE_MIPI0_ID1,
630
+ SCALE_MIPI0_ID2,
631
+ SCALE_MIPI0_ID3,
632
+ SCALE_MIPI1_ID0,
633
+ SCALE_MIPI1_ID1,
634
+ SCALE_MIPI1_ID2,
635
+ SCALE_MIPI1_ID3,
636
+ SCALE_MIPI2_ID0,
637
+ SCALE_MIPI2_ID1,
638
+ SCALE_MIPI2_ID2,
639
+ SCALE_MIPI2_ID3,
640
+ SCALE_MIPI3_ID0,
641
+ SCALE_MIPI3_ID1,
642
+ SCALE_MIPI3_ID2,
643
+ SCALE_MIPI3_ID3,
644
+ SCALE_MIPI4_ID0,
645
+ SCALE_MIPI4_ID1,
646
+ SCALE_MIPI4_ID2,
647
+ SCALE_MIPI4_ID3,
648
+ SCALE_MIPI5_ID0,
649
+ SCALE_MIPI5_ID1,
650
+ SCALE_MIPI5_ID2,
651
+ SCALE_MIPI5_ID3,
652
+ SCALE_DVP,
653
+ SCALE_CH_MAX,
654
+};
655
+
656
+enum scale_mode {
657
+ SCALE_8TIMES,
658
+ SCALE_16TIMES,
659
+ SCALE_32TIMES,
660
+};
661
+
662
+struct rkcif_scale_ch_info {
663
+ u32 width;
664
+ u32 height;
665
+ u32 vir_width;
666
+};
667
+
668
+struct rkcif_scale_src_res {
669
+ u32 width;
670
+ u32 height;
671
+};
672
+
673
+/*
674
+ * struct rkcif_scale_vdev - CIF Capture device
675
+ *
676
+ * @irq_lock: buffer queue lock
677
+ * @stat: stats buffer list
678
+ * @readout_wq: workqueue for statistics information read
679
+ */
680
+struct rkcif_scale_vdev {
681
+ unsigned int ch:3;
682
+ struct rkcif_device *cifdev;
683
+ struct rkcif_vdev_node vnode;
684
+ struct rkcif_stream *stream;
685
+ struct list_head buf_head;
686
+ spinlock_t vbq_lock; /* vfd lock */
687
+ wait_queue_head_t wq_stopped;
688
+ struct v4l2_pix_format_mplane pixm;
689
+ const struct cif_output_fmt *scale_out_fmt;
690
+ struct rkcif_scale_ch_info ch_info;
691
+ struct rkcif_scale_src_res src_res;
692
+ struct rkcif_buffer *curr_buf;
693
+ struct rkcif_buffer *next_buf;
694
+ struct bayer_blc blc;
695
+ enum rkcif_state state;
696
+ unsigned int ch_src;
697
+ unsigned int scale_mode;
698
+ int frame_phase;
699
+ unsigned int frame_idx;
700
+ bool stopping;
701
+};
702
+
703
+static inline
704
+struct rkcif_scale_vdev *to_rkcif_scale_vdev(struct rkcif_vdev_node *vnode)
705
+{
706
+ return container_of(vnode, struct rkcif_scale_vdev, vnode);
707
+}
708
+
709
+void rkcif_init_scale_vdev(struct rkcif_device *cif_dev, u32 ch);
710
+int rkcif_register_scale_vdevs(struct rkcif_device *cif_dev,
711
+ int stream_num,
712
+ bool is_multi_input);
713
+void rkcif_unregister_scale_vdevs(struct rkcif_device *cif_dev,
714
+ int stream_num);
715
+
716
+#define TOOLS_DRIVER_NAME "rkcif_tools"
717
+
718
+#define RKCIF_TOOLS_CH0 0
719
+#define RKCIF_TOOLS_CH1 1
720
+#define RKCIF_TOOLS_CH2 2
721
+#define RKCIF_MAX_TOOLS_CH 3
722
+
723
+#define CIF_TOOLS_CH0_VDEV_NAME CIF_DRIVER_NAME "_tools_id0"
724
+#define CIF_TOOLS_CH1_VDEV_NAME CIF_DRIVER_NAME "_tools_id1"
725
+#define CIF_TOOLS_CH2_VDEV_NAME CIF_DRIVER_NAME "_tools_id2"
726
+
727
+/*
728
+ * struct rkcif_tools_vdev - CIF Capture device
729
+ *
730
+ * @irq_lock: buffer queue lock
731
+ * @stat: stats buffer list
732
+ * @readout_wq: workqueue for statistics information read
733
+ */
734
+struct rkcif_tools_vdev {
735
+ unsigned int ch:3;
736
+ struct rkcif_device *cifdev;
737
+ struct rkcif_vdev_node vnode;
738
+ struct rkcif_stream *stream;
739
+ struct list_head buf_head;
740
+ struct list_head buf_done_head;
741
+ struct list_head src_buf_head;
742
+ spinlock_t vbq_lock; /* vfd lock */
743
+ wait_queue_head_t wq_stopped;
744
+ struct v4l2_pix_format_mplane pixm;
745
+ const struct cif_output_fmt *tools_out_fmt;
746
+ struct rkcif_buffer *curr_buf;
747
+ struct work_struct work;
748
+ enum rkcif_state state;
749
+ int frame_phase;
750
+ unsigned int frame_idx;
751
+ bool stopping;
752
+};
753
+
754
+static inline
755
+struct rkcif_tools_vdev *to_rkcif_tools_vdev(struct rkcif_vdev_node *vnode)
756
+{
757
+ return container_of(vnode, struct rkcif_tools_vdev, vnode);
758
+}
759
+
760
+void rkcif_init_tools_vdev(struct rkcif_device *cif_dev, u32 ch);
761
+int rkcif_register_tools_vdevs(struct rkcif_device *cif_dev,
762
+ int stream_num,
763
+ bool is_multi_input);
764
+void rkcif_unregister_tools_vdevs(struct rkcif_device *cif_dev,
765
+ int stream_num);
766
+
767
+enum rkcif_err_state {
768
+ RKCIF_ERR_ID0_NOT_BUF = 0x1,
769
+ RKCIF_ERR_ID1_NOT_BUF = 0x2,
770
+ RKCIF_ERR_ID2_NOT_BUF = 0x4,
771
+ RKCIF_ERR_ID3_NOT_BUF = 0x8,
772
+ RKCIF_ERR_ID0_TRIG_SIMULT = 0x10,
773
+ RKCIF_ERR_ID1_TRIG_SIMULT = 0x20,
774
+ RKCIF_ERR_ID2_TRIG_SIMULT = 0x40,
775
+ RKCIF_ERR_ID3_TRIG_SIMULT = 0x80,
776
+ RKCIF_ERR_SIZE = 0x100,
777
+ RKCIF_ERR_OVERFLOW = 0x200,
778
+ RKCIF_ERR_BANDWIDTH_LACK = 0x400,
779
+ RKCIF_ERR_BUS = 0X800,
780
+ RKCIF_ERR_ID0_MULTI_FS = 0x1000,
781
+ RKCIF_ERR_ID1_MULTI_FS = 0x2000,
782
+ RKCIF_ERR_ID2_MULTI_FS = 0x4000,
783
+ RKCIF_ERR_ID3_MULTI_FS = 0x8000,
784
+ RKCIF_ERR_PIXEL = 0x10000,
785
+ RKCIF_ERR_LINE = 0x20000,
786
+};
787
+
788
+struct rkcif_err_state_work {
789
+ struct work_struct work;
790
+ u64 last_timestamp;
791
+ u32 err_state;
792
+ u32 intstat;
793
+ u32 lastline;
794
+ u32 lastpixel;
795
+};
796
+
476797 /*
477798 * struct rkcif_device - ISP platform device
478799 * @base_addr: base register address
....@@ -492,18 +813,23 @@
492813 struct rkcif_sensor_info terminal_sensor;
493814
494815 struct rkcif_stream stream[RKCIF_MULTI_STREAMS_NUM];
816
+ struct rkcif_scale_vdev scale_vdev[RKCIF_MULTI_STREAMS_NUM];
817
+ struct rkcif_tools_vdev tools_vdev[RKCIF_MAX_TOOLS_CH];
495818 struct rkcif_pipeline pipe;
496819
497820 struct csi_channel_info channels[RKCIF_MAX_CSI_CHANNEL];
498821 int num_channels;
499822 int chip_id;
500823 atomic_t stream_cnt;
501
- atomic_t fh_cnt;
824
+ atomic_t power_cnt;
502825 struct mutex stream_lock; /* lock between streams */
826
+ struct mutex scale_lock; /* lock between scale dev */
827
+ struct mutex tools_lock; /* lock between tools dev */
503828 enum rkcif_workmode workmode;
504829 bool can_be_reset;
505
- struct rkcif_hdr hdr;
830
+ struct rkmodule_hdr_cfg hdr;
506831 struct rkcif_buffer *rdbk_buf[RDBK_MAX];
832
+ struct rkcif_rx_buffer *rdbk_rx_buf[RDBK_MAX];
507833 struct rkcif_luma_vdev luma_vdev;
508834 struct rkcif_lvds_subdev lvds_subdev;
509835 struct rkcif_dvp_sof_subdev dvp_sof_subdev;
....@@ -511,24 +837,61 @@
511837 irqreturn_t (*isr_hdl)(int irq, struct rkcif_device *cif_dev);
512838 int inf_id;
513839
514
- struct sditf_priv *sditf;
840
+ struct sditf_priv *sditf[RKCIF_MAX_SDITF];
515841 struct proc_dir_entry *proc_dir;
516842 struct rkcif_irq_stats irq_stats;
517843 spinlock_t hdr_lock; /* lock for hdr buf sync */
844
+ spinlock_t buffree_lock;
518845 struct rkcif_timer reset_watchdog_timer;
519
- struct notifier_block reset_notifier; /* reset for mipi csi crc err */
520846 struct rkcif_work_struct reset_work;
847
+ int id_use_cnt;
848
+ unsigned int csi_host_idx;
849
+ unsigned int csi_host_idx_def;
521850 unsigned int dvp_sof_in_oneframe;
522851 unsigned int wait_line;
523852 unsigned int wait_line_bak;
524853 unsigned int wait_line_cache;
525
- struct rkcif_dummy_buffer dummy_buf;
854
+ struct completion cmpl_ntf;
855
+ struct csi2_dphy_hw *dphy_hw;
856
+ phys_addr_t resmem_pa;
857
+ size_t resmem_size;
858
+ struct rk_tb_client tb_client;
526859 bool is_start_hdr;
860
+ bool reset_work_cancel;
527861 bool iommu_en;
528862 bool is_use_dummybuf;
863
+ bool is_notifier_isp;
864
+ bool is_thunderboot;
865
+ bool is_rdbk_to_online;
866
+ bool is_support_tools;
867
+ int rdbk_debug;
868
+ struct rkcif_sync_cfg sync_cfg;
869
+ int sditf_cnt;
870
+ u32 early_line;
871
+ int isp_runtime_max;
872
+ int sensor_linetime;
873
+ u32 err_state;
874
+ struct rkcif_err_state_work err_state_work;
529875 };
530876
531877 extern struct platform_driver rkcif_plat_drv;
878
+void rkcif_set_fps(struct rkcif_stream *stream, struct rkcif_fps *fps);
879
+int rkcif_do_start_stream(struct rkcif_stream *stream,
880
+ enum rkcif_stream_mode mode);
881
+void rkcif_do_stop_stream(struct rkcif_stream *stream,
882
+ enum rkcif_stream_mode mode);
883
+void rkcif_irq_handle_scale(struct rkcif_device *cif_dev,
884
+ unsigned int intstat_glb);
885
+void rkcif_buf_queue(struct vb2_buffer *vb);
886
+
887
+void rkcif_vb_done_tasklet(struct rkcif_stream *stream, struct rkcif_buffer *buf);
888
+
889
+int rkcif_scale_start(struct rkcif_scale_vdev *scale_vdev);
890
+
891
+const struct
892
+cif_input_fmt *rkcif_get_input_fmt(struct rkcif_device *dev,
893
+ struct v4l2_rect *rect,
894
+ u32 pad_id, struct csi_channel_info *csi_info);
532895
533896 void rkcif_write_register(struct rkcif_device *dev,
534897 enum cif_reg_index index, u32 val);
....@@ -551,14 +914,14 @@
551914 void rkcif_set_default_fmt(struct rkcif_device *cif_dev);
552915 void rkcif_irq_oneframe(struct rkcif_device *cif_dev);
553916 void rkcif_irq_pingpong(struct rkcif_device *cif_dev);
554
-void rkcif_soft_reset(struct rkcif_device *cif_dev,
555
- bool is_rst_iommu);
917
+void rkcif_irq_pingpong_v1(struct rkcif_device *cif_dev);
918
+unsigned int rkcif_irq_global(struct rkcif_device *cif_dev);
919
+void rkcif_irq_handle_toisp(struct rkcif_device *cif_dev, unsigned int intstat_glb);
556920 int rkcif_register_lvds_subdev(struct rkcif_device *dev);
557921 void rkcif_unregister_lvds_subdev(struct rkcif_device *dev);
558922 int rkcif_register_dvp_sof_subdev(struct rkcif_device *dev);
559923 void rkcif_unregister_dvp_sof_subdev(struct rkcif_device *dev);
560924 void rkcif_irq_lite_lvds(struct rkcif_device *cif_dev);
561
-u32 rkcif_get_sof(struct rkcif_device *cif_dev);
562925 int rkcif_plat_init(struct rkcif_device *cif_dev, struct device_node *node, int inf_id);
563926 int rkcif_plat_uninit(struct rkcif_device *cif_dev);
564927 int rkcif_attach_hw(struct rkcif_device *cif_dev);
....@@ -569,6 +932,41 @@
569932 enum rkcif_clk_edge edge);
570933 void rkcif_enable_dvp_clk_dual_edge(struct rkcif_device *dev, bool on);
571934 void rkcif_reset_work(struct work_struct *work);
572
-void rkcif_monitor_reset_event(struct rkcif_hw *hw);
935
+
936
+void rkcif_vb_done_oneframe(struct rkcif_stream *stream,
937
+ struct vb2_v4l2_buffer *vb_done);
938
+
939
+int rkcif_init_rx_buf(struct rkcif_stream *stream, int buf_num);
940
+void rkcif_free_rx_buf(struct rkcif_stream *stream, int buf_num);
941
+
942
+int rkcif_set_fmt(struct rkcif_stream *stream,
943
+ struct v4l2_pix_format_mplane *pixm,
944
+ bool try);
945
+void rkcif_enable_dma_capture(struct rkcif_stream *stream, bool is_only_enable);
946
+
947
+void rkcif_do_soft_reset(struct rkcif_device *dev);
948
+
949
+u32 rkcif_mbus_pixelcode_to_v4l2(u32 pixelcode);
950
+
951
+void rkcif_config_dvp_pin(struct rkcif_device *dev, bool on);
952
+
953
+s32 rkcif_get_sensor_vblank_def(struct rkcif_device *dev);
954
+s32 rkcif_get_sensor_vblank(struct rkcif_device *dev);
955
+int rkcif_get_linetime(struct rkcif_stream *stream);
956
+
957
+void rkcif_assign_check_buffer_update_toisp(struct rkcif_stream *stream);
958
+
959
+struct rkcif_rx_buffer *to_cif_rx_buf(struct rkisp_rx_buf *dbufs);
960
+
961
+int rkcif_clr_unready_dev(void);
962
+
963
+const struct
964
+cif_output_fmt *rkcif_find_output_fmt(struct rkcif_stream *stream, u32 pixelfmt);
965
+/* Rockit */
966
+int rkcif_rockit_buf_done(struct rkcif_stream *stream, struct rkcif_buffer *buf);
967
+void rkcif_rockit_dev_init(struct rkcif_device *dev);
968
+void rkcif_rockit_dev_deinit(void);
969
+
970
+void rkcif_err_print_work(struct work_struct *work);
573971
574972 #endif