@@ -1124,6 +1124,9 @@ struct imx477 {
1124
1124
/* Current mode */
1125
1125
const struct imx477_mode * mode ;
1126
1126
1127
+ /* Trigger mode */
1128
+ int trigger_mode_of ;
1129
+
1127
1130
/*
1128
1131
* Mutex for serialized access:
1129
1132
* Protect sensor module set pad format and start/stop streaming safely.
@@ -1711,7 +1714,7 @@ static int imx477_start_streaming(struct imx477 *imx477)
1711
1714
struct i2c_client * client = v4l2_get_subdevdata (& imx477 -> sd );
1712
1715
const struct imx477_reg_list * reg_list ;
1713
1716
const struct imx477_reg_list * extra_regs ;
1714
- int ret ;
1717
+ int ret , tm ;
1715
1718
1716
1719
if (!imx477 -> common_regs_written ) {
1717
1720
ret = imx477_write_regs (imx477 , mode_common_regs ,
@@ -1748,14 +1751,15 @@ static int imx477_start_streaming(struct imx477 *imx477)
1748
1751
return ret ;
1749
1752
1750
1753
/* Set vsync trigger mode: 0=standalone, 1=source, 2=sink */
1754
+ tm = (imx477 -> trigger_mode_of >= 0 ) ? imx477 -> trigger_mode_of : trigger_mode ;
1751
1755
imx477_write_reg (imx477 , IMX477_REG_MC_MODE ,
1752
- IMX477_REG_VALUE_08BIT , (trigger_mode > 0 ) ? 1 : 0 );
1756
+ IMX477_REG_VALUE_08BIT , (tm > 0 ) ? 1 : 0 );
1753
1757
imx477_write_reg (imx477 , IMX477_REG_MS_SEL ,
1754
- IMX477_REG_VALUE_08BIT , (trigger_mode <= 1 ) ? 1 : 0 );
1758
+ IMX477_REG_VALUE_08BIT , (tm <= 1 ) ? 1 : 0 );
1755
1759
imx477_write_reg (imx477 , IMX477_REG_XVS_IO_CTRL ,
1756
- IMX477_REG_VALUE_08BIT , (trigger_mode == 1 ) ? 1 : 0 );
1760
+ IMX477_REG_VALUE_08BIT , (tm == 1 ) ? 1 : 0 );
1757
1761
imx477_write_reg (imx477 , IMX477_REG_EXTOUT_EN ,
1758
- IMX477_REG_VALUE_08BIT , (trigger_mode == 1 ) ? 1 : 0 );
1762
+ IMX477_REG_VALUE_08BIT , (tm == 1 ) ? 1 : 0 );
1759
1763
1760
1764
/* set stream on register */
1761
1765
return imx477_write_reg (imx477 , IMX477_REG_MODE_SELECT ,
@@ -2187,6 +2191,7 @@ static int imx477_probe(struct i2c_client *client)
2187
2191
struct imx477 * imx477 ;
2188
2192
const struct of_device_id * match ;
2189
2193
int ret ;
2194
+ u32 tm_of ;
2190
2195
2191
2196
imx477 = devm_kzalloc (& client -> dev , sizeof (* imx477 ), GFP_KERNEL );
2192
2197
if (!imx477 )
@@ -2204,6 +2209,10 @@ static int imx477_probe(struct i2c_client *client)
2204
2209
if (imx477_check_hwcfg (dev ))
2205
2210
return - EINVAL ;
2206
2211
2212
+ /* Default the trigger mode from OF to -1, which means invalid */
2213
+ ret = of_property_read_u32 (dev -> of_node , "trigger-mode" , & tm_of );
2214
+ imx477 -> trigger_mode_of = (ret == 0 ) ? tm_of : -1 ;
2215
+
2207
2216
/* Get system clock (xclk) */
2208
2217
imx477 -> xclk = devm_clk_get (dev , NULL );
2209
2218
if (IS_ERR (imx477 -> xclk )) {
0 commit comments