@@ -329,28 +329,24 @@ static int stm32_dcmipp_conf_csi(const struct device *dev, uint32_t dcmipp_csi_b
329
329
const struct stm32_dcmipp_config * config = dev -> config ;
330
330
struct stm32_dcmipp_data * dcmipp = dev -> data ;
331
331
DCMIPP_CSI_ConfTypeDef csiconf = { 0 };
332
- uint64_t phy_bitrate ;
333
- struct video_control ctrl = {
334
- .id = VIDEO_CID_PIXEL_RATE ,
335
- };
332
+ int64_t phy_bitrate ;
336
333
int err , i ;
337
334
338
335
csiconf .NumberOfLanes = config -> csi .nb_lanes == 2 ? DCMIPP_CSI_TWO_DATA_LANES :
339
336
DCMIPP_CSI_ONE_DATA_LANE ;
340
337
csiconf .DataLaneMapping = config -> csi .lanes [0 ] == 1 ? DCMIPP_CSI_PHYSICAL_DATA_LANES :
341
338
DCMIPP_CSI_INVERTED_DATA_LANES ;
342
339
343
- /* Get the pixel_rate from the source to guess the bitrate */
344
- err = video_get_ctrl (config -> source_dev , & ctrl );
345
- if (err < 0 ) {
346
- LOG_ERR ("Can not get source_dev pixel rate" );
347
- return err ;
340
+ /* Get link-frequency information from source */
341
+ phy_bitrate = video_get_csi_link_freq (config -> source_dev ,
342
+ video_bits_per_pixel (dcmipp -> source_fmt .pixelformat ),
343
+ config -> csi .nb_lanes );
344
+ if (phy_bitrate < 0 ) {
345
+ LOG_ERR ("Failed to retrieve source link-frequency" );
346
+ return - EIO ;
348
347
}
349
- phy_bitrate = ctrl .val64 * video_bits_per_pixel (dcmipp -> source_fmt .pixelformat ) /
350
- (2 * config -> csi .nb_lanes );
348
+
351
349
phy_bitrate /= MHZ (1 );
352
- LOG_DBG ("Sensor PixelRate = %lld, PHY Bitrate computed = %lld MHz" ,
353
- ctrl .val64 , phy_bitrate );
354
350
355
351
for (i = 0 ; i < ARRAY_SIZE (stm32_dcmipp_bitrate ); i ++ ) {
356
352
if (stm32_dcmipp_bitrate [i ].rate >= phy_bitrate ) {
0 commit comments