forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrcar_fdp1.c
2457 lines (2009 loc) · 65.5 KB
/
rcar_fdp1.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// SPDX-License-Identifier: GPL-2.0+
/*
* Renesas R-Car Fine Display Processor
*
* Video format converter and frame deinterlacer device.
*
* Author: Kieran Bingham, <[email protected]>
* Copyright (c) 2016 Renesas Electronics Corporation.
*
* This code is developed and inspired from the vim2m, rcar_jpu,
* m2m-deinterlace, and vsp1 drivers.
*/
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/dma-mapping.h>
#include <linux/fs.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/timer.h>
#include <media/rcar-fcp.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-event.h>
#include <media/v4l2-ioctl.h>
#include <media/v4l2-mem2mem.h>
#include <media/videobuf2-dma-contig.h>
static unsigned int debug;
module_param(debug, uint, 0644);
MODULE_PARM_DESC(debug, "activate debug info");
/* Minimum and maximum frame width/height */
#define FDP1_MIN_W 80U
#define FDP1_MIN_H 80U
#define FDP1_MAX_W 3840U
#define FDP1_MAX_H 2160U
#define FDP1_MAX_PLANES 3U
#define FDP1_MAX_STRIDE 8190U
/* Flags that indicate a format can be used for capture/output */
#define FDP1_CAPTURE BIT(0)
#define FDP1_OUTPUT BIT(1)
#define DRIVER_NAME "rcar_fdp1"
/* Number of Job's to have available on the processing queue */
#define FDP1_NUMBER_JOBS 8
#define dprintk(fdp1, fmt, arg...) \
v4l2_dbg(1, debug, &fdp1->v4l2_dev, "%s: " fmt, __func__, ## arg)
/*
* FDP1 registers and bits
*/
/* FDP1 start register - Imm */
#define FD1_CTL_CMD 0x0000
#define FD1_CTL_CMD_STRCMD BIT(0)
/* Sync generator register - Imm */
#define FD1_CTL_SGCMD 0x0004
#define FD1_CTL_SGCMD_SGEN BIT(0)
/* Register set end register - Imm */
#define FD1_CTL_REGEND 0x0008
#define FD1_CTL_REGEND_REGEND BIT(0)
/* Channel activation register - Vupdt */
#define FD1_CTL_CHACT 0x000c
#define FD1_CTL_CHACT_SMW BIT(9)
#define FD1_CTL_CHACT_WR BIT(8)
#define FD1_CTL_CHACT_SMR BIT(3)
#define FD1_CTL_CHACT_RD2 BIT(2)
#define FD1_CTL_CHACT_RD1 BIT(1)
#define FD1_CTL_CHACT_RD0 BIT(0)
/* Operation Mode Register - Vupdt */
#define FD1_CTL_OPMODE 0x0010
#define FD1_CTL_OPMODE_PRG BIT(4)
#define FD1_CTL_OPMODE_VIMD_INTERRUPT (0 << 0)
#define FD1_CTL_OPMODE_VIMD_BESTEFFORT (1 << 0)
#define FD1_CTL_OPMODE_VIMD_NOINTERRUPT (2 << 0)
#define FD1_CTL_VPERIOD 0x0014
#define FD1_CTL_CLKCTRL 0x0018
#define FD1_CTL_CLKCTRL_CSTP_N BIT(0)
/* Software reset register */
#define FD1_CTL_SRESET 0x001c
#define FD1_CTL_SRESET_SRST BIT(0)
/* Control status register (V-update-status) */
#define FD1_CTL_STATUS 0x0024
#define FD1_CTL_STATUS_VINT_CNT_MASK GENMASK(31, 16)
#define FD1_CTL_STATUS_VINT_CNT_SHIFT 16
#define FD1_CTL_STATUS_SGREGSET BIT(10)
#define FD1_CTL_STATUS_SGVERR BIT(9)
#define FD1_CTL_STATUS_SGFREND BIT(8)
#define FD1_CTL_STATUS_BSY BIT(0)
#define FD1_CTL_VCYCLE_STAT 0x0028
/* Interrupt enable register */
#define FD1_CTL_IRQENB 0x0038
/* Interrupt status register */
#define FD1_CTL_IRQSTA 0x003c
/* Interrupt control register */
#define FD1_CTL_IRQFSET 0x0040
/* Common IRQ Bit settings */
#define FD1_CTL_IRQ_VERE BIT(16)
#define FD1_CTL_IRQ_VINTE BIT(4)
#define FD1_CTL_IRQ_FREE BIT(0)
#define FD1_CTL_IRQ_MASK (FD1_CTL_IRQ_VERE | \
FD1_CTL_IRQ_VINTE | \
FD1_CTL_IRQ_FREE)
/* RPF */
#define FD1_RPF_SIZE 0x0060
#define FD1_RPF_SIZE_MASK GENMASK(12, 0)
#define FD1_RPF_SIZE_H_SHIFT 16
#define FD1_RPF_SIZE_V_SHIFT 0
#define FD1_RPF_FORMAT 0x0064
#define FD1_RPF_FORMAT_CIPM BIT(16)
#define FD1_RPF_FORMAT_RSPYCS BIT(13)
#define FD1_RPF_FORMAT_RSPUVS BIT(12)
#define FD1_RPF_FORMAT_CF BIT(8)
#define FD1_RPF_PSTRIDE 0x0068
#define FD1_RPF_PSTRIDE_Y_SHIFT 16
#define FD1_RPF_PSTRIDE_C_SHIFT 0
/* RPF0 Source Component Y Address register */
#define FD1_RPF0_ADDR_Y 0x006c
/* RPF1 Current Picture Registers */
#define FD1_RPF1_ADDR_Y 0x0078
#define FD1_RPF1_ADDR_C0 0x007c
#define FD1_RPF1_ADDR_C1 0x0080
/* RPF2 next picture register */
#define FD1_RPF2_ADDR_Y 0x0084
#define FD1_RPF_SMSK_ADDR 0x0090
#define FD1_RPF_SWAP 0x0094
/* WPF */
#define FD1_WPF_FORMAT 0x00c0
#define FD1_WPF_FORMAT_PDV_SHIFT 24
#define FD1_WPF_FORMAT_FCNL BIT(20)
#define FD1_WPF_FORMAT_WSPYCS BIT(15)
#define FD1_WPF_FORMAT_WSPUVS BIT(14)
#define FD1_WPF_FORMAT_WRTM_601_16 (0 << 9)
#define FD1_WPF_FORMAT_WRTM_601_0 (1 << 9)
#define FD1_WPF_FORMAT_WRTM_709_16 (2 << 9)
#define FD1_WPF_FORMAT_CSC BIT(8)
#define FD1_WPF_RNDCTL 0x00c4
#define FD1_WPF_RNDCTL_CBRM BIT(28)
#define FD1_WPF_RNDCTL_CLMD_NOCLIP (0 << 12)
#define FD1_WPF_RNDCTL_CLMD_CLIP_16_235 (1 << 12)
#define FD1_WPF_RNDCTL_CLMD_CLIP_1_254 (2 << 12)
#define FD1_WPF_PSTRIDE 0x00c8
#define FD1_WPF_PSTRIDE_Y_SHIFT 16
#define FD1_WPF_PSTRIDE_C_SHIFT 0
/* WPF Destination picture */
#define FD1_WPF_ADDR_Y 0x00cc
#define FD1_WPF_ADDR_C0 0x00d0
#define FD1_WPF_ADDR_C1 0x00d4
#define FD1_WPF_SWAP 0x00d8
#define FD1_WPF_SWAP_OSWAP_SHIFT 0
#define FD1_WPF_SWAP_SSWAP_SHIFT 4
/* WPF/RPF Common */
#define FD1_RWPF_SWAP_BYTE BIT(0)
#define FD1_RWPF_SWAP_WORD BIT(1)
#define FD1_RWPF_SWAP_LWRD BIT(2)
#define FD1_RWPF_SWAP_LLWD BIT(3)
/* IPC */
#define FD1_IPC_MODE 0x0100
#define FD1_IPC_MODE_DLI BIT(8)
#define FD1_IPC_MODE_DIM_ADAPT2D3D (0 << 0)
#define FD1_IPC_MODE_DIM_FIXED2D (1 << 0)
#define FD1_IPC_MODE_DIM_FIXED3D (2 << 0)
#define FD1_IPC_MODE_DIM_PREVFIELD (3 << 0)
#define FD1_IPC_MODE_DIM_NEXTFIELD (4 << 0)
#define FD1_IPC_SMSK_THRESH 0x0104
#define FD1_IPC_SMSK_THRESH_CONST 0x00010002
#define FD1_IPC_COMB_DET 0x0108
#define FD1_IPC_COMB_DET_CONST 0x00200040
#define FD1_IPC_MOTDEC 0x010c
#define FD1_IPC_MOTDEC_CONST 0x00008020
/* DLI registers */
#define FD1_IPC_DLI_BLEND 0x0120
#define FD1_IPC_DLI_BLEND_CONST 0x0080ff02
#define FD1_IPC_DLI_HGAIN 0x0124
#define FD1_IPC_DLI_HGAIN_CONST 0x001000ff
#define FD1_IPC_DLI_SPRS 0x0128
#define FD1_IPC_DLI_SPRS_CONST 0x009004ff
#define FD1_IPC_DLI_ANGLE 0x012c
#define FD1_IPC_DLI_ANGLE_CONST 0x0004080c
#define FD1_IPC_DLI_ISOPIX0 0x0130
#define FD1_IPC_DLI_ISOPIX0_CONST 0xff10ff10
#define FD1_IPC_DLI_ISOPIX1 0x0134
#define FD1_IPC_DLI_ISOPIX1_CONST 0x0000ff10
/* Sensor registers */
#define FD1_IPC_SENSOR_TH0 0x0140
#define FD1_IPC_SENSOR_TH0_CONST 0x20208080
#define FD1_IPC_SENSOR_TH1 0x0144
#define FD1_IPC_SENSOR_TH1_CONST 0
#define FD1_IPC_SENSOR_CTL0 0x0170
#define FD1_IPC_SENSOR_CTL0_CONST 0x00002201
#define FD1_IPC_SENSOR_CTL1 0x0174
#define FD1_IPC_SENSOR_CTL1_CONST 0
#define FD1_IPC_SENSOR_CTL2 0x0178
#define FD1_IPC_SENSOR_CTL2_X_SHIFT 16
#define FD1_IPC_SENSOR_CTL2_Y_SHIFT 0
#define FD1_IPC_SENSOR_CTL3 0x017c
#define FD1_IPC_SENSOR_CTL3_0_SHIFT 16
#define FD1_IPC_SENSOR_CTL3_1_SHIFT 0
/* Line memory pixel number register */
#define FD1_IPC_LMEM 0x01e0
#define FD1_IPC_LMEM_LINEAR 1024
#define FD1_IPC_LMEM_TILE 960
/* Internal Data (HW Version) */
#define FD1_IP_INTDATA 0x0800
#define FD1_IP_H3_ES1 0x02010101
#define FD1_IP_M3W 0x02010202
#define FD1_IP_H3 0x02010203
#define FD1_IP_M3N 0x02010204
#define FD1_IP_E3 0x02010205
/* LUTs */
#define FD1_LUT_DIF_ADJ 0x1000
#define FD1_LUT_SAD_ADJ 0x1400
#define FD1_LUT_BLD_GAIN 0x1800
#define FD1_LUT_DIF_GAIN 0x1c00
#define FD1_LUT_MDET 0x2000
/**
* struct fdp1_fmt - The FDP1 internal format data
* @fourcc: the fourcc code, to match the V4L2 API
* @bpp: bits per pixel per plane
* @num_planes: number of planes
* @hsub: horizontal subsampling factor
* @vsub: vertical subsampling factor
* @fmt: 7-bit format code for the fdp1 hardware
* @swap_yc: the Y and C components are swapped (Y comes before C)
* @swap_uv: the U and V components are swapped (V comes before U)
* @swap: swap register control
* @types: types of queue this format is applicable to
*/
struct fdp1_fmt {
u32 fourcc;
u8 bpp[3];
u8 num_planes;
u8 hsub;
u8 vsub;
u8 fmt;
bool swap_yc;
bool swap_uv;
u8 swap;
u8 types;
};
static const struct fdp1_fmt fdp1_formats[] = {
/* RGB formats are only supported by the Write Pixel Formatter */
{ V4L2_PIX_FMT_RGB332, { 8, 0, 0 }, 1, 1, 1, 0x00, false, false,
FD1_RWPF_SWAP_LLWD | FD1_RWPF_SWAP_LWRD |
FD1_RWPF_SWAP_WORD | FD1_RWPF_SWAP_BYTE,
FDP1_CAPTURE },
{ V4L2_PIX_FMT_XRGB444, { 16, 0, 0 }, 1, 1, 1, 0x01, false, false,
FD1_RWPF_SWAP_LLWD | FD1_RWPF_SWAP_LWRD |
FD1_RWPF_SWAP_WORD,
FDP1_CAPTURE },
{ V4L2_PIX_FMT_XRGB555, { 16, 0, 0 }, 1, 1, 1, 0x04, false, false,
FD1_RWPF_SWAP_LLWD | FD1_RWPF_SWAP_LWRD |
FD1_RWPF_SWAP_WORD,
FDP1_CAPTURE },
{ V4L2_PIX_FMT_RGB565, { 16, 0, 0 }, 1, 1, 1, 0x06, false, false,
FD1_RWPF_SWAP_LLWD | FD1_RWPF_SWAP_LWRD |
FD1_RWPF_SWAP_WORD,
FDP1_CAPTURE },
{ V4L2_PIX_FMT_ABGR32, { 32, 0, 0 }, 1, 1, 1, 0x13, false, false,
FD1_RWPF_SWAP_LLWD | FD1_RWPF_SWAP_LWRD,
FDP1_CAPTURE },
{ V4L2_PIX_FMT_XBGR32, { 32, 0, 0 }, 1, 1, 1, 0x13, false, false,
FD1_RWPF_SWAP_LLWD | FD1_RWPF_SWAP_LWRD,
FDP1_CAPTURE },
{ V4L2_PIX_FMT_ARGB32, { 32, 0, 0 }, 1, 1, 1, 0x13, false, false,
FD1_RWPF_SWAP_LLWD | FD1_RWPF_SWAP_LWRD |
FD1_RWPF_SWAP_WORD | FD1_RWPF_SWAP_BYTE,
FDP1_CAPTURE },
{ V4L2_PIX_FMT_XRGB32, { 32, 0, 0 }, 1, 1, 1, 0x13, false, false,
FD1_RWPF_SWAP_LLWD | FD1_RWPF_SWAP_LWRD |
FD1_RWPF_SWAP_WORD | FD1_RWPF_SWAP_BYTE,
FDP1_CAPTURE },
{ V4L2_PIX_FMT_RGB24, { 24, 0, 0 }, 1, 1, 1, 0x15, false, false,
FD1_RWPF_SWAP_LLWD | FD1_RWPF_SWAP_LWRD |
FD1_RWPF_SWAP_WORD | FD1_RWPF_SWAP_BYTE,
FDP1_CAPTURE },
{ V4L2_PIX_FMT_BGR24, { 24, 0, 0 }, 1, 1, 1, 0x18, false, false,
FD1_RWPF_SWAP_LLWD | FD1_RWPF_SWAP_LWRD |
FD1_RWPF_SWAP_WORD | FD1_RWPF_SWAP_BYTE,
FDP1_CAPTURE },
{ V4L2_PIX_FMT_ARGB444, { 16, 0, 0 }, 1, 1, 1, 0x19, false, false,
FD1_RWPF_SWAP_LLWD | FD1_RWPF_SWAP_LWRD |
FD1_RWPF_SWAP_WORD,
FDP1_CAPTURE },
{ V4L2_PIX_FMT_ARGB555, { 16, 0, 0 }, 1, 1, 1, 0x1b, false, false,
FD1_RWPF_SWAP_LLWD | FD1_RWPF_SWAP_LWRD |
FD1_RWPF_SWAP_WORD,
FDP1_CAPTURE },
/* YUV Formats are supported by Read and Write Pixel Formatters */
{ V4L2_PIX_FMT_NV16M, { 8, 16, 0 }, 2, 2, 1, 0x41, false, false,
FD1_RWPF_SWAP_LLWD | FD1_RWPF_SWAP_LWRD |
FD1_RWPF_SWAP_WORD | FD1_RWPF_SWAP_BYTE,
FDP1_CAPTURE | FDP1_OUTPUT },
{ V4L2_PIX_FMT_NV61M, { 8, 16, 0 }, 2, 2, 1, 0x41, false, true,
FD1_RWPF_SWAP_LLWD | FD1_RWPF_SWAP_LWRD |
FD1_RWPF_SWAP_WORD | FD1_RWPF_SWAP_BYTE,
FDP1_CAPTURE | FDP1_OUTPUT },
{ V4L2_PIX_FMT_NV12M, { 8, 16, 0 }, 2, 2, 2, 0x42, false, false,
FD1_RWPF_SWAP_LLWD | FD1_RWPF_SWAP_LWRD |
FD1_RWPF_SWAP_WORD | FD1_RWPF_SWAP_BYTE,
FDP1_CAPTURE | FDP1_OUTPUT },
{ V4L2_PIX_FMT_NV21M, { 8, 16, 0 }, 2, 2, 2, 0x42, false, true,
FD1_RWPF_SWAP_LLWD | FD1_RWPF_SWAP_LWRD |
FD1_RWPF_SWAP_WORD | FD1_RWPF_SWAP_BYTE,
FDP1_CAPTURE | FDP1_OUTPUT },
{ V4L2_PIX_FMT_UYVY, { 16, 0, 0 }, 1, 2, 1, 0x47, false, false,
FD1_RWPF_SWAP_LLWD | FD1_RWPF_SWAP_LWRD |
FD1_RWPF_SWAP_WORD | FD1_RWPF_SWAP_BYTE,
FDP1_CAPTURE | FDP1_OUTPUT },
{ V4L2_PIX_FMT_VYUY, { 16, 0, 0 }, 1, 2, 1, 0x47, false, true,
FD1_RWPF_SWAP_LLWD | FD1_RWPF_SWAP_LWRD |
FD1_RWPF_SWAP_WORD | FD1_RWPF_SWAP_BYTE,
FDP1_CAPTURE | FDP1_OUTPUT },
{ V4L2_PIX_FMT_YUYV, { 16, 0, 0 }, 1, 2, 1, 0x47, true, false,
FD1_RWPF_SWAP_LLWD | FD1_RWPF_SWAP_LWRD |
FD1_RWPF_SWAP_WORD | FD1_RWPF_SWAP_BYTE,
FDP1_CAPTURE | FDP1_OUTPUT },
{ V4L2_PIX_FMT_YVYU, { 16, 0, 0 }, 1, 2, 1, 0x47, true, true,
FD1_RWPF_SWAP_LLWD | FD1_RWPF_SWAP_LWRD |
FD1_RWPF_SWAP_WORD | FD1_RWPF_SWAP_BYTE,
FDP1_CAPTURE | FDP1_OUTPUT },
{ V4L2_PIX_FMT_YUV444M, { 8, 8, 8 }, 3, 1, 1, 0x4a, false, false,
FD1_RWPF_SWAP_LLWD | FD1_RWPF_SWAP_LWRD |
FD1_RWPF_SWAP_WORD | FD1_RWPF_SWAP_BYTE,
FDP1_CAPTURE | FDP1_OUTPUT },
{ V4L2_PIX_FMT_YVU444M, { 8, 8, 8 }, 3, 1, 1, 0x4a, false, true,
FD1_RWPF_SWAP_LLWD | FD1_RWPF_SWAP_LWRD |
FD1_RWPF_SWAP_WORD | FD1_RWPF_SWAP_BYTE,
FDP1_CAPTURE | FDP1_OUTPUT },
{ V4L2_PIX_FMT_YUV422M, { 8, 8, 8 }, 3, 2, 1, 0x4b, false, false,
FD1_RWPF_SWAP_LLWD | FD1_RWPF_SWAP_LWRD |
FD1_RWPF_SWAP_WORD | FD1_RWPF_SWAP_BYTE,
FDP1_CAPTURE | FDP1_OUTPUT },
{ V4L2_PIX_FMT_YVU422M, { 8, 8, 8 }, 3, 2, 1, 0x4b, false, true,
FD1_RWPF_SWAP_LLWD | FD1_RWPF_SWAP_LWRD |
FD1_RWPF_SWAP_WORD | FD1_RWPF_SWAP_BYTE,
FDP1_CAPTURE | FDP1_OUTPUT },
{ V4L2_PIX_FMT_YUV420M, { 8, 8, 8 }, 3, 2, 2, 0x4c, false, false,
FD1_RWPF_SWAP_LLWD | FD1_RWPF_SWAP_LWRD |
FD1_RWPF_SWAP_WORD | FD1_RWPF_SWAP_BYTE,
FDP1_CAPTURE | FDP1_OUTPUT },
{ V4L2_PIX_FMT_YVU420M, { 8, 8, 8 }, 3, 2, 2, 0x4c, false, true,
FD1_RWPF_SWAP_LLWD | FD1_RWPF_SWAP_LWRD |
FD1_RWPF_SWAP_WORD | FD1_RWPF_SWAP_BYTE,
FDP1_CAPTURE | FDP1_OUTPUT },
};
static int fdp1_fmt_is_rgb(const struct fdp1_fmt *fmt)
{
return fmt->fmt <= 0x1b; /* Last RGB code */
}
/*
* FDP1 Lookup tables range from 0...255 only
*
* Each table must be less than 256 entries, and all tables
* are padded out to 256 entries by duplicating the last value.
*/
static const u8 fdp1_diff_adj[] = {
0x00, 0x24, 0x43, 0x5e, 0x76, 0x8c, 0x9e, 0xaf,
0xbd, 0xc9, 0xd4, 0xdd, 0xe4, 0xea, 0xef, 0xf3,
0xf6, 0xf9, 0xfb, 0xfc, 0xfd, 0xfe, 0xfe, 0xff,
};
static const u8 fdp1_sad_adj[] = {
0x00, 0x24, 0x43, 0x5e, 0x76, 0x8c, 0x9e, 0xaf,
0xbd, 0xc9, 0xd4, 0xdd, 0xe4, 0xea, 0xef, 0xf3,
0xf6, 0xf9, 0xfb, 0xfc, 0xfd, 0xfe, 0xfe, 0xff,
};
static const u8 fdp1_bld_gain[] = {
0x80,
};
static const u8 fdp1_dif_gain[] = {
0x80,
};
static const u8 fdp1_mdet[] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
};
/* Per-queue, driver-specific private data */
struct fdp1_q_data {
const struct fdp1_fmt *fmt;
struct v4l2_pix_format_mplane format;
unsigned int vsize;
unsigned int stride_y;
unsigned int stride_c;
};
static const struct fdp1_fmt *fdp1_find_format(u32 pixelformat)
{
const struct fdp1_fmt *fmt;
unsigned int i;
for (i = 0; i < ARRAY_SIZE(fdp1_formats); i++) {
fmt = &fdp1_formats[i];
if (fmt->fourcc == pixelformat)
return fmt;
}
return NULL;
}
enum fdp1_deint_mode {
FDP1_PROGRESSIVE = 0, /* Must be zero when !deinterlacing */
FDP1_ADAPT2D3D,
FDP1_FIXED2D,
FDP1_FIXED3D,
FDP1_PREVFIELD,
FDP1_NEXTFIELD,
};
#define FDP1_DEINT_MODE_USES_NEXT(mode) \
(mode == FDP1_ADAPT2D3D || \
mode == FDP1_FIXED3D || \
mode == FDP1_NEXTFIELD)
#define FDP1_DEINT_MODE_USES_PREV(mode) \
(mode == FDP1_ADAPT2D3D || \
mode == FDP1_FIXED3D || \
mode == FDP1_PREVFIELD)
/*
* FDP1 operates on potentially 3 fields, which are tracked
* from the VB buffers using this context structure.
* Will always be a field or a full frame, never two fields.
*/
struct fdp1_field_buffer {
struct vb2_v4l2_buffer *vb;
dma_addr_t addrs[3];
/* Should be NONE:TOP:BOTTOM only */
enum v4l2_field field;
/* Flag to indicate this is the last field in the vb */
bool last_field;
/* Buffer queue lists */
struct list_head list;
};
struct fdp1_buffer {
struct v4l2_m2m_buffer m2m_buf;
struct fdp1_field_buffer fields[2];
unsigned int num_fields;
};
static inline struct fdp1_buffer *to_fdp1_buffer(struct vb2_v4l2_buffer *vb)
{
return container_of(vb, struct fdp1_buffer, m2m_buf.vb);
}
struct fdp1_job {
struct fdp1_field_buffer *previous;
struct fdp1_field_buffer *active;
struct fdp1_field_buffer *next;
struct fdp1_field_buffer *dst;
/* A job can only be on one list at a time */
struct list_head list;
};
struct fdp1_dev {
struct v4l2_device v4l2_dev;
struct video_device vfd;
struct mutex dev_mutex;
spinlock_t irqlock;
spinlock_t device_process_lock;
void __iomem *regs;
unsigned int irq;
struct device *dev;
/* Job Queues */
struct fdp1_job jobs[FDP1_NUMBER_JOBS];
struct list_head free_job_list;
struct list_head queued_job_list;
struct list_head hw_job_list;
unsigned int clk_rate;
struct rcar_fcp_device *fcp;
struct v4l2_m2m_dev *m2m_dev;
};
struct fdp1_ctx {
struct v4l2_fh fh;
struct fdp1_dev *fdp1;
struct v4l2_ctrl_handler hdl;
unsigned int sequence;
/* Processed buffers in this transaction */
u8 num_processed;
/* Transaction length (i.e. how many buffers per transaction) */
u32 translen;
/* Abort requested by m2m */
int aborting;
/* Deinterlace processing mode */
enum fdp1_deint_mode deint_mode;
/*
* Adaptive 2D/3D mode uses a shared mask
* This is allocated at streamon, if the ADAPT2D3D mode
* is requested
*/
unsigned int smsk_size;
dma_addr_t smsk_addr[2];
void *smsk_cpu;
/* Capture pipeline, can specify an alpha value
* for supported formats. 0-255 only
*/
unsigned char alpha;
/* Source and destination queue data */
struct fdp1_q_data out_q; /* HW Source */
struct fdp1_q_data cap_q; /* HW Destination */
/*
* Field Queues
* Interlaced fields are used on 3 occasions, and tracked in this list.
*
* V4L2 Buffers are tracked inside the fdp1_buffer
* and released when the last 'field' completes
*/
struct list_head fields_queue;
unsigned int buffers_queued;
/*
* For de-interlacing we need to track our previous buffer
* while preparing our job lists.
*/
struct fdp1_field_buffer *previous;
};
static inline struct fdp1_ctx *fh_to_ctx(struct v4l2_fh *fh)
{
return container_of(fh, struct fdp1_ctx, fh);
}
static struct fdp1_q_data *get_q_data(struct fdp1_ctx *ctx,
enum v4l2_buf_type type)
{
if (V4L2_TYPE_IS_OUTPUT(type))
return &ctx->out_q;
else
return &ctx->cap_q;
}
/*
* list_remove_job: Take the first item off the specified job list
*
* Returns: pointer to a job, or NULL if the list is empty.
*/
static struct fdp1_job *list_remove_job(struct fdp1_dev *fdp1,
struct list_head *list)
{
struct fdp1_job *job;
unsigned long flags;
spin_lock_irqsave(&fdp1->irqlock, flags);
job = list_first_entry_or_null(list, struct fdp1_job, list);
if (job)
list_del(&job->list);
spin_unlock_irqrestore(&fdp1->irqlock, flags);
return job;
}
/*
* list_add_job: Add a job to the specified job list
*
* Returns: void - always succeeds
*/
static void list_add_job(struct fdp1_dev *fdp1,
struct list_head *list,
struct fdp1_job *job)
{
unsigned long flags;
spin_lock_irqsave(&fdp1->irqlock, flags);
list_add_tail(&job->list, list);
spin_unlock_irqrestore(&fdp1->irqlock, flags);
}
static struct fdp1_job *fdp1_job_alloc(struct fdp1_dev *fdp1)
{
return list_remove_job(fdp1, &fdp1->free_job_list);
}
static void fdp1_job_free(struct fdp1_dev *fdp1, struct fdp1_job *job)
{
/* Ensure that all residue from previous jobs is gone */
memset(job, 0, sizeof(struct fdp1_job));
list_add_job(fdp1, &fdp1->free_job_list, job);
}
static void queue_job(struct fdp1_dev *fdp1, struct fdp1_job *job)
{
list_add_job(fdp1, &fdp1->queued_job_list, job);
}
static struct fdp1_job *get_queued_job(struct fdp1_dev *fdp1)
{
return list_remove_job(fdp1, &fdp1->queued_job_list);
}
static void queue_hw_job(struct fdp1_dev *fdp1, struct fdp1_job *job)
{
list_add_job(fdp1, &fdp1->hw_job_list, job);
}
static struct fdp1_job *get_hw_queued_job(struct fdp1_dev *fdp1)
{
return list_remove_job(fdp1, &fdp1->hw_job_list);
}
/*
* Buffer lists handling
*/
static void fdp1_field_complete(struct fdp1_ctx *ctx,
struct fdp1_field_buffer *fbuf)
{
/* job->previous may be on the first field */
if (!fbuf)
return;
if (fbuf->last_field)
v4l2_m2m_buf_done(fbuf->vb, VB2_BUF_STATE_DONE);
}
static void fdp1_queue_field(struct fdp1_ctx *ctx,
struct fdp1_field_buffer *fbuf)
{
unsigned long flags;
spin_lock_irqsave(&ctx->fdp1->irqlock, flags);
list_add_tail(&fbuf->list, &ctx->fields_queue);
spin_unlock_irqrestore(&ctx->fdp1->irqlock, flags);
ctx->buffers_queued++;
}
static struct fdp1_field_buffer *fdp1_dequeue_field(struct fdp1_ctx *ctx)
{
struct fdp1_field_buffer *fbuf;
unsigned long flags;
ctx->buffers_queued--;
spin_lock_irqsave(&ctx->fdp1->irqlock, flags);
fbuf = list_first_entry_or_null(&ctx->fields_queue,
struct fdp1_field_buffer, list);
if (fbuf)
list_del(&fbuf->list);
spin_unlock_irqrestore(&ctx->fdp1->irqlock, flags);
return fbuf;
}
/*
* Return the next field in the queue - or NULL,
* without removing the item from the list
*/
static struct fdp1_field_buffer *fdp1_peek_queued_field(struct fdp1_ctx *ctx)
{
struct fdp1_field_buffer *fbuf;
unsigned long flags;
spin_lock_irqsave(&ctx->fdp1->irqlock, flags);
fbuf = list_first_entry_or_null(&ctx->fields_queue,
struct fdp1_field_buffer, list);
spin_unlock_irqrestore(&ctx->fdp1->irqlock, flags);
return fbuf;
}
static u32 fdp1_read(struct fdp1_dev *fdp1, unsigned int reg)
{
u32 value = ioread32(fdp1->regs + reg);
if (debug >= 2)
dprintk(fdp1, "Read 0x%08x from 0x%04x\n", value, reg);
return value;
}
static void fdp1_write(struct fdp1_dev *fdp1, u32 val, unsigned int reg)
{
if (debug >= 2)
dprintk(fdp1, "Write 0x%08x to 0x%04x\n", val, reg);
iowrite32(val, fdp1->regs + reg);
}
/* IPC registers are to be programmed with constant values */
static void fdp1_set_ipc_dli(struct fdp1_ctx *ctx)
{
struct fdp1_dev *fdp1 = ctx->fdp1;
fdp1_write(fdp1, FD1_IPC_SMSK_THRESH_CONST, FD1_IPC_SMSK_THRESH);
fdp1_write(fdp1, FD1_IPC_COMB_DET_CONST, FD1_IPC_COMB_DET);
fdp1_write(fdp1, FD1_IPC_MOTDEC_CONST, FD1_IPC_MOTDEC);
fdp1_write(fdp1, FD1_IPC_DLI_BLEND_CONST, FD1_IPC_DLI_BLEND);
fdp1_write(fdp1, FD1_IPC_DLI_HGAIN_CONST, FD1_IPC_DLI_HGAIN);
fdp1_write(fdp1, FD1_IPC_DLI_SPRS_CONST, FD1_IPC_DLI_SPRS);
fdp1_write(fdp1, FD1_IPC_DLI_ANGLE_CONST, FD1_IPC_DLI_ANGLE);
fdp1_write(fdp1, FD1_IPC_DLI_ISOPIX0_CONST, FD1_IPC_DLI_ISOPIX0);
fdp1_write(fdp1, FD1_IPC_DLI_ISOPIX1_CONST, FD1_IPC_DLI_ISOPIX1);
}
static void fdp1_set_ipc_sensor(struct fdp1_ctx *ctx)
{
struct fdp1_dev *fdp1 = ctx->fdp1;
struct fdp1_q_data *src_q_data = &ctx->out_q;
unsigned int x0, x1;
unsigned int hsize = src_q_data->format.width;
unsigned int vsize = src_q_data->format.height;
x0 = hsize / 3;
x1 = 2 * hsize / 3;
fdp1_write(fdp1, FD1_IPC_SENSOR_TH0_CONST, FD1_IPC_SENSOR_TH0);
fdp1_write(fdp1, FD1_IPC_SENSOR_TH1_CONST, FD1_IPC_SENSOR_TH1);
fdp1_write(fdp1, FD1_IPC_SENSOR_CTL0_CONST, FD1_IPC_SENSOR_CTL0);
fdp1_write(fdp1, FD1_IPC_SENSOR_CTL1_CONST, FD1_IPC_SENSOR_CTL1);
fdp1_write(fdp1, ((hsize - 1) << FD1_IPC_SENSOR_CTL2_X_SHIFT) |
((vsize - 1) << FD1_IPC_SENSOR_CTL2_Y_SHIFT),
FD1_IPC_SENSOR_CTL2);
fdp1_write(fdp1, (x0 << FD1_IPC_SENSOR_CTL3_0_SHIFT) |
(x1 << FD1_IPC_SENSOR_CTL3_1_SHIFT),
FD1_IPC_SENSOR_CTL3);
}
/*
* fdp1_write_lut: Write a padded LUT to the hw
*
* FDP1 uses constant data for de-interlacing processing,
* with large tables. These hardware tables are all 256 bytes
* long, however they often contain repeated data at the end.
*
* The last byte of the table is written to all remaining entries.
*/
static void fdp1_write_lut(struct fdp1_dev *fdp1, const u8 *lut,
unsigned int len, unsigned int base)
{
unsigned int i;
u8 pad;
/* Tables larger than the hw are clipped */
len = min(len, 256u);
for (i = 0; i < len; i++)
fdp1_write(fdp1, lut[i], base + (i*4));
/* Tables are padded with the last entry */
pad = lut[i-1];
for (; i < 256; i++)
fdp1_write(fdp1, pad, base + (i*4));
}
static void fdp1_set_lut(struct fdp1_dev *fdp1)
{
fdp1_write_lut(fdp1, fdp1_diff_adj, ARRAY_SIZE(fdp1_diff_adj),
FD1_LUT_DIF_ADJ);
fdp1_write_lut(fdp1, fdp1_sad_adj, ARRAY_SIZE(fdp1_sad_adj),
FD1_LUT_SAD_ADJ);
fdp1_write_lut(fdp1, fdp1_bld_gain, ARRAY_SIZE(fdp1_bld_gain),
FD1_LUT_BLD_GAIN);
fdp1_write_lut(fdp1, fdp1_dif_gain, ARRAY_SIZE(fdp1_dif_gain),
FD1_LUT_DIF_GAIN);
fdp1_write_lut(fdp1, fdp1_mdet, ARRAY_SIZE(fdp1_mdet),
FD1_LUT_MDET);
}
static void fdp1_configure_rpf(struct fdp1_ctx *ctx,
struct fdp1_job *job)
{
struct fdp1_dev *fdp1 = ctx->fdp1;
u32 picture_size;
u32 pstride;
u32 format;
u32 smsk_addr;
struct fdp1_q_data *q_data = &ctx->out_q;
/* Picture size is common to Source and Destination frames */
picture_size = (q_data->format.width << FD1_RPF_SIZE_H_SHIFT)
| (q_data->vsize << FD1_RPF_SIZE_V_SHIFT);
/* Strides */
pstride = q_data->stride_y << FD1_RPF_PSTRIDE_Y_SHIFT;
if (q_data->format.num_planes > 1)
pstride |= q_data->stride_c << FD1_RPF_PSTRIDE_C_SHIFT;
/* Format control */
format = q_data->fmt->fmt;
if (q_data->fmt->swap_yc)
format |= FD1_RPF_FORMAT_RSPYCS;
if (q_data->fmt->swap_uv)
format |= FD1_RPF_FORMAT_RSPUVS;
if (job->active->field == V4L2_FIELD_BOTTOM) {
format |= FD1_RPF_FORMAT_CF; /* Set for Bottom field */
smsk_addr = ctx->smsk_addr[0];
} else {
smsk_addr = ctx->smsk_addr[1];
}
/* Deint mode is non-zero when deinterlacing */
if (ctx->deint_mode)
format |= FD1_RPF_FORMAT_CIPM;
fdp1_write(fdp1, format, FD1_RPF_FORMAT);
fdp1_write(fdp1, q_data->fmt->swap, FD1_RPF_SWAP);
fdp1_write(fdp1, picture_size, FD1_RPF_SIZE);
fdp1_write(fdp1, pstride, FD1_RPF_PSTRIDE);
fdp1_write(fdp1, smsk_addr, FD1_RPF_SMSK_ADDR);
/* Previous Field Channel (CH0) */
if (job->previous)
fdp1_write(fdp1, job->previous->addrs[0], FD1_RPF0_ADDR_Y);
/* Current Field Channel (CH1) */
fdp1_write(fdp1, job->active->addrs[0], FD1_RPF1_ADDR_Y);
fdp1_write(fdp1, job->active->addrs[1], FD1_RPF1_ADDR_C0);
fdp1_write(fdp1, job->active->addrs[2], FD1_RPF1_ADDR_C1);
/* Next Field Channel (CH2) */
if (job->next)
fdp1_write(fdp1, job->next->addrs[0], FD1_RPF2_ADDR_Y);
}
static void fdp1_configure_wpf(struct fdp1_ctx *ctx,
struct fdp1_job *job)
{
struct fdp1_dev *fdp1 = ctx->fdp1;
struct fdp1_q_data *src_q_data = &ctx->out_q;
struct fdp1_q_data *q_data = &ctx->cap_q;
u32 pstride;
u32 format;
u32 swap;
u32 rndctl;
pstride = q_data->format.plane_fmt[0].bytesperline
<< FD1_WPF_PSTRIDE_Y_SHIFT;
if (q_data->format.num_planes > 1)
pstride |= q_data->format.plane_fmt[1].bytesperline
<< FD1_WPF_PSTRIDE_C_SHIFT;
format = q_data->fmt->fmt; /* Output Format Code */
if (q_data->fmt->swap_yc)
format |= FD1_WPF_FORMAT_WSPYCS;
if (q_data->fmt->swap_uv)
format |= FD1_WPF_FORMAT_WSPUVS;
if (fdp1_fmt_is_rgb(q_data->fmt)) {
/* Enable Colour Space conversion */
format |= FD1_WPF_FORMAT_CSC;
/* Set WRTM */
if (src_q_data->format.ycbcr_enc == V4L2_YCBCR_ENC_709)
format |= FD1_WPF_FORMAT_WRTM_709_16;
else if (src_q_data->format.quantization ==
V4L2_QUANTIZATION_FULL_RANGE)
format |= FD1_WPF_FORMAT_WRTM_601_0;
else
format |= FD1_WPF_FORMAT_WRTM_601_16;
}
/* Set an alpha value into the Pad Value */
format |= ctx->alpha << FD1_WPF_FORMAT_PDV_SHIFT;
/* Determine picture rounding and clipping */
rndctl = FD1_WPF_RNDCTL_CBRM; /* Rounding Off */
rndctl |= FD1_WPF_RNDCTL_CLMD_NOCLIP;
/* WPF Swap needs both ISWAP and OSWAP setting */
swap = q_data->fmt->swap << FD1_WPF_SWAP_OSWAP_SHIFT;
swap |= src_q_data->fmt->swap << FD1_WPF_SWAP_SSWAP_SHIFT;
fdp1_write(fdp1, format, FD1_WPF_FORMAT);
fdp1_write(fdp1, rndctl, FD1_WPF_RNDCTL);
fdp1_write(fdp1, swap, FD1_WPF_SWAP);
fdp1_write(fdp1, pstride, FD1_WPF_PSTRIDE);
fdp1_write(fdp1, job->dst->addrs[0], FD1_WPF_ADDR_Y);
fdp1_write(fdp1, job->dst->addrs[1], FD1_WPF_ADDR_C0);
fdp1_write(fdp1, job->dst->addrs[2], FD1_WPF_ADDR_C1);
}
static void fdp1_configure_deint_mode(struct fdp1_ctx *ctx,
struct fdp1_job *job)