@@ -129,6 +129,23 @@ static int anx7625_reg_write(struct anx7625_data *ctx,
129
129
return ret ;
130
130
}
131
131
132
+ static int anx7625_reg_block_write (struct anx7625_data * ctx ,
133
+ struct i2c_client * client ,
134
+ u8 reg_addr , u8 len , u8 * buf )
135
+ {
136
+ int ret ;
137
+ struct device * dev = & client -> dev ;
138
+
139
+ i2c_access_workaround (ctx , client );
140
+
141
+ ret = i2c_smbus_write_i2c_block_data (client , reg_addr , len , buf );
142
+ if (ret < 0 )
143
+ dev_err (dev , "write i2c block failed id=%x\n:%x" ,
144
+ client -> addr , reg_addr );
145
+
146
+ return ret ;
147
+ }
148
+
132
149
static int anx7625_write_or (struct anx7625_data * ctx ,
133
150
struct i2c_client * client ,
134
151
u8 offset , u8 mask )
@@ -214,8 +231,8 @@ static int wait_aux_op_finish(struct anx7625_data *ctx)
214
231
return 0 ;
215
232
}
216
233
217
- static int anx7625_aux_dpcd_read (struct anx7625_data * ctx ,
218
- u32 address , u8 len , u8 * buf )
234
+ static int anx7625_aux_dpcd_trans (struct anx7625_data * ctx , u8 op ,
235
+ u32 address , u8 len , u8 * buf )
219
236
{
220
237
struct device * dev = & ctx -> client -> dev ;
221
238
int ret ;
@@ -231,8 +248,7 @@ static int anx7625_aux_dpcd_read(struct anx7625_data *ctx,
231
248
addrm = (address >> 8 ) & 0xFF ;
232
249
addrh = (address >> 16 ) & 0xFF ;
233
250
234
- cmd = DPCD_CMD (len , DPCD_READ );
235
- cmd = ((len - 1 ) << 4 ) | 0x09 ;
251
+ cmd = DPCD_CMD (len , op );
236
252
237
253
/* Set command and length */
238
254
ret = anx7625_reg_write (ctx , ctx -> i2c .rx_p0_client ,
@@ -246,6 +262,9 @@ static int anx7625_aux_dpcd_read(struct anx7625_data *ctx,
246
262
ret |= anx7625_reg_write (ctx , ctx -> i2c .rx_p0_client ,
247
263
AP_AUX_ADDR_19_16 , addrh );
248
264
265
+ if (op == DP_AUX_NATIVE_WRITE )
266
+ ret |= anx7625_reg_block_write (ctx , ctx -> i2c .rx_p0_client ,
267
+ AP_AUX_BUFF_START , len , buf );
249
268
/* Enable aux access */
250
269
ret |= anx7625_write_or (ctx , ctx -> i2c .rx_p0_client ,
251
270
AP_AUX_CTRL_STATUS , AP_AUX_CTRL_OP_EN );
@@ -255,14 +274,17 @@ static int anx7625_aux_dpcd_read(struct anx7625_data *ctx,
255
274
return - EIO ;
256
275
}
257
276
258
- usleep_range (2000 , 2100 );
259
-
260
277
ret = wait_aux_op_finish (ctx );
261
278
if (ret ) {
262
279
dev_err (dev , "aux IO error: wait aux op finish.\n" );
263
280
return ret ;
264
281
}
265
282
283
+ /* Write done */
284
+ if (op == DP_AUX_NATIVE_WRITE )
285
+ return 0 ;
286
+
287
+ /* Read done, read out dpcd data */
266
288
ret = anx7625_reg_block_read (ctx , ctx -> i2c .rx_p0_client ,
267
289
AP_AUX_BUFF_START , len , buf );
268
290
if (ret < 0 ) {
@@ -845,7 +867,7 @@ static int anx7625_hdcp_enable(struct anx7625_data *ctx)
845
867
}
846
868
847
869
/* Read downstream capability */
848
- anx7625_aux_dpcd_read (ctx , 0x68028 , 1 , & bcap );
870
+ anx7625_aux_dpcd_trans (ctx , DP_AUX_NATIVE_READ , 0x68028 , 1 , & bcap );
849
871
if (!(bcap & 0x01 )) {
850
872
pr_warn ("downstream not support HDCP 1.4, cap(%x).\n" , bcap );
851
873
return 0 ;
@@ -918,6 +940,7 @@ static void anx7625_dp_stop(struct anx7625_data *ctx)
918
940
{
919
941
struct device * dev = & ctx -> client -> dev ;
920
942
int ret ;
943
+ u8 data ;
921
944
922
945
DRM_DEV_DEBUG_DRIVER (dev , "stop dp output\n" );
923
946
@@ -929,6 +952,11 @@ static void anx7625_dp_stop(struct anx7625_data *ctx)
929
952
ret |= anx7625_write_and (ctx , ctx -> i2c .tx_p2_client , 0x08 , 0x7f );
930
953
931
954
ret |= anx7625_video_mute_control (ctx , 1 );
955
+
956
+ dev_dbg (dev , "notify downstream enter into standby\n" );
957
+ /* Downstream monitor enter into standby mode */
958
+ data = 2 ;
959
+ ret |= anx7625_aux_dpcd_trans (ctx , DP_AUX_NATIVE_WRITE , 0x000600 , 1 , & data );
932
960
if (ret < 0 )
933
961
DRM_DEV_ERROR (dev , "IO error : mute video fail\n" );
934
962
0 commit comments