20
20
#include <media/v4l2-fwnode.h>
21
21
#include <media/v4l2-mediabus.h>
22
22
23
+ /*
24
+ * Parameter to adjust Quad Bayer re-mosaic broken line correction
25
+ * strength, used in full-resolution mode only. Set zero to disable.
26
+ */
27
+ static int qbc_adjust = 2 ;
28
+ module_param (qbc_adjust , int , 0644 );
29
+ MODULE_PARM_DESC (qbc_adjust , "Quad Bayer broken line correction strength [0,2-5]" );
30
+
23
31
#define IMX708_REG_VALUE_08BIT 1
24
32
#define IMX708_REG_VALUE_16BIT 2
25
33
99
107
100
108
/* HDR exposure ratio (long:med == med:short) */
101
109
#define IMX708_HDR_EXPOSURE_RATIO 4
102
- #define IMX708_REG_MID_EXPOSURE 0x3116
103
- #define IMX708_REG_SHT_EXPOSURE 0x0224
110
+ #define IMX708_REG_MID_EXPOSURE 0x3116
111
+ #define IMX708_REG_SHT_EXPOSURE 0x0224
104
112
#define IMX708_REG_MID_ANALOG_GAIN 0x3118
105
113
#define IMX708_REG_SHT_ANALOG_GAIN 0x0216
106
114
115
+ /* QBC Re-mosaic broken line correction registers */
116
+ #define IMX708_LPF_INTENSITY_EN 0xC428
117
+ #define IMX708_LPF_INTENSITY_ENABLED 0x00
118
+ #define IMX708_LPF_INTENSITY_DISABLED 0x01
119
+ #define IMX708_LPF_INTENSITY 0xC429
120
+
107
121
/*
108
122
* Metadata buffer holds a variety of data, all sent with the same VC/DT (0x12).
109
123
* It comprises two scanlines (of up to 5760 bytes each, for 4608 pixels)
@@ -171,6 +185,9 @@ struct imx708_mode {
171
185
172
186
/* HDR flag, used for checking if the current mode is HDR */
173
187
bool hdr ;
188
+
189
+ /* Quad Bayer Re-mosaic flag */
190
+ bool remosaic ;
174
191
};
175
192
176
193
/* Default PDAF pixel correction gains */
@@ -363,8 +380,6 @@ static const struct imx708_reg mode_4608x2592_regs[] = {
363
380
{0x341f , 0x20 },
364
381
{0x3420 , 0x00 },
365
382
{0x3421 , 0xd8 },
366
- {0xC428 , 0x00 },
367
- {0xC429 , 0x04 },
368
383
{0x3366 , 0x00 },
369
384
{0x3367 , 0x00 },
370
385
{0x3368 , 0x00 },
@@ -677,7 +692,8 @@ static const struct imx708_mode supported_modes_10bit_no_hdr[] = {
677
692
.pixel_rate = 595200000 ,
678
693
.exposure_lines_min = 8 ,
679
694
.exposure_lines_step = 1 ,
680
- .hdr = false
695
+ .hdr = false,
696
+ .remosaic = true
681
697
},
682
698
{
683
699
/* regular 2x2 binned. */
@@ -699,7 +715,8 @@ static const struct imx708_mode supported_modes_10bit_no_hdr[] = {
699
715
.pixel_rate = 585600000 ,
700
716
.exposure_lines_min = 4 ,
701
717
.exposure_lines_step = 2 ,
702
- .hdr = false
718
+ .hdr = false,
719
+ .remosaic = false
703
720
},
704
721
{
705
722
/* 2x2 binned and cropped for 720p. */
@@ -721,7 +738,8 @@ static const struct imx708_mode supported_modes_10bit_no_hdr[] = {
721
738
.pixel_rate = 566400000 ,
722
739
.exposure_lines_min = 4 ,
723
740
.exposure_lines_step = 2 ,
724
- .hdr = false
741
+ .hdr = false,
742
+ .remosaic = false
725
743
},
726
744
};
727
745
@@ -746,7 +764,8 @@ static const struct imx708_mode supported_modes_10bit_hdr[] = {
746
764
.pixel_rate = 777600000 ,
747
765
.exposure_lines_min = 8 * IMX708_HDR_EXPOSURE_RATIO * IMX708_HDR_EXPOSURE_RATIO ,
748
766
.exposure_lines_step = 2 * IMX708_HDR_EXPOSURE_RATIO * IMX708_HDR_EXPOSURE_RATIO ,
749
- .hdr = true
767
+ .hdr = true,
768
+ .remosaic = false
750
769
}
751
770
};
752
771
@@ -1515,6 +1534,21 @@ static int imx708_start_streaming(struct imx708 *imx708)
1515
1534
return ret ;
1516
1535
}
1517
1536
1537
+ /* Quad Bayer re-mosaic adjustments (for full-resolution mode only) */
1538
+ if (imx708 -> mode -> remosaic && qbc_adjust > 0 ) {
1539
+ imx708_write_reg (imx708 , IMX708_LPF_INTENSITY ,
1540
+ IMX708_REG_VALUE_08BIT , qbc_adjust );
1541
+ imx708_write_reg (imx708 ,
1542
+ IMX708_LPF_INTENSITY_EN ,
1543
+ IMX708_REG_VALUE_08BIT ,
1544
+ IMX708_LPF_INTENSITY_ENABLED );
1545
+ } else {
1546
+ imx708_write_reg (imx708 ,
1547
+ IMX708_LPF_INTENSITY_EN ,
1548
+ IMX708_REG_VALUE_08BIT ,
1549
+ IMX708_LPF_INTENSITY_DISABLED );
1550
+ }
1551
+
1518
1552
/* Apply customized values from user */
1519
1553
ret = __v4l2_ctrl_handler_setup (imx708 -> sd .ctrl_handler );
1520
1554
if (ret )
0 commit comments