@@ -29,6 +29,22 @@ static int trigger_mode;
2929module_param (trigger_mode , int , 0644 );
3030MODULE_PARM_DESC (trigger_mode , "Set vsync trigger mode: 1=source, 2=sink" );
3131
32+ static int fstrobe_enable ;
33+ module_param (fstrobe_enable , int , 0644 );
34+ MODULE_PARM_DESC (fstrobe_enable , "Enable fstrobe signal" );
35+
36+ static int fstrobe_cont_trig ;
37+ module_param (fstrobe_cont_trig , int , 0644 );
38+ MODULE_PARM_DESC (fstrobe_cont_trig , "Configure fstrobe to be one-shot (0) or continuous (1)" );
39+
40+ static int fstrobe_width = 1 ;
41+ module_param (fstrobe_width , int , 0644 );
42+ MODULE_PARM_DESC (fstrobe_width , "Set fstrobe pulse width in units of INCK" );
43+
44+ static int fstrobe_delay ;
45+ module_param (fstrobe_delay , int , 0644 );
46+ MODULE_PARM_DESC (fstrobe_delay , "Set fstrobe delay from end all lines starting to expose and the start of the strobe pulse" );
47+
3248#define IMX477_REG_VALUE_08BIT 1
3349#define IMX477_REG_VALUE_16BIT 2
3450
@@ -1706,6 +1722,8 @@ static int imx477_start_streaming(struct imx477 *imx477)
17061722 struct i2c_client * client = v4l2_get_subdevdata (& imx477 -> sd );
17071723 const struct imx477_reg_list * reg_list ;
17081724 const struct imx477_reg_list * extra_regs ;
1725+ unsigned int fst_width ;
1726+ unsigned int fst_mult ;
17091727 int ret ;
17101728
17111729 if (!imx477 -> common_regs_written ) {
@@ -1733,6 +1751,29 @@ static int imx477_start_streaming(struct imx477 *imx477)
17331751 return ret ;
17341752 }
17351753
1754+ fst_width = max ((unsigned int )fstrobe_width , 1U );
1755+ fst_mult = 1 ;
1756+
1757+ while (fst_width / fst_mult > 0xffff && fst_mult < 255 )
1758+ fst_mult ++ ;
1759+
1760+ fst_width /= fst_mult ;
1761+
1762+ // FLASH_MD_RS
1763+ imx477_write_reg (imx477 , 0x0c1A , IMX477_REG_VALUE_08BIT ,
1764+ ((fstrobe_cont_trig ? 1 : 0 ) << 0 ) | (1 << 1 ));
1765+ // FLASH_STRB_WIDTH
1766+ imx477_write_reg (imx477 , 0x0c18 , IMX477_REG_VALUE_16BIT , fst_width );
1767+ // FLASH_STRB_WIDTH adjust
1768+ imx477_write_reg (imx477 , 0x0c12 , IMX477_REG_VALUE_08BIT , fst_mult );
1769+ // FLASH_STRB_START_POINT
1770+ imx477_write_reg (imx477 , 0x0c14 , IMX477_REG_VALUE_16BIT , fstrobe_delay );
1771+ // FLASH_STRB_DLY_RS
1772+ imx477_write_reg (imx477 , 0x0c16 , IMX477_REG_VALUE_16BIT , 0 );
1773+ // FLASH_TRIG_RS
1774+ imx477_write_reg (imx477 , 0x0c1B , IMX477_REG_VALUE_08BIT ,
1775+ fstrobe_enable ? 1 : 0 );
1776+
17361777 /* Set on-sensor DPC. */
17371778 imx477_write_reg (imx477 , 0x0b05 , IMX477_REG_VALUE_08BIT , !!dpc_enable );
17381779 imx477_write_reg (imx477 , 0x0b06 , IMX477_REG_VALUE_08BIT , !!dpc_enable );
0 commit comments