@@ -2387,6 +2387,35 @@ static int ds5_hw_reset_with_recovery(struct ds5 *state)
23872387 return ret ;
23882388 }
23892389
2390+ /* 6. Wait for device type register to be populated.
2391+ * After HW reset the firmware sets status to 0xDEAD before fully
2392+ * initializing configuration registers (DS5_DEVICE_TYPE, stream DT,
2393+ * resolution, etc.). If ds5_fixed_configuration() reads device type
2394+ * as 0 it falls into the default switch case and selects D46X format
2395+ * arrays (2 depth resolutions) instead of the correct tables per SKU
2396+ * Poll until the register returns a known valid value or timeout.
2397+ */
2398+ {
2399+ u16 dev_type = 0 ;
2400+
2401+ for (retry = 0 ; retry < DS5_HW_RESET_MAX_RETRIES ; retry ++ ) {
2402+ ret = ds5_read (state , DS5_DEVICE_TYPE , & dev_type );
2403+ if (ret == 0 && dev_type != 0 ) {
2404+ dev_dbg (& state -> client -> dev ,
2405+ "%s(): Device type 0x%x ready after %d ms\n" ,
2406+ __func__ , dev_type ,
2407+ (retry + 1 ) * DS5_HW_RESET_POLL_INTERVAL_MS );
2408+ break ;
2409+ }
2410+ msleep (DS5_HW_RESET_POLL_INTERVAL_MS );
2411+ }
2412+
2413+ if (retry >= DS5_HW_RESET_MAX_RETRIES )
2414+ dev_warn (& state -> client -> dev ,
2415+ "%s(): Device type register not ready (0x%x) after %d ms, formats may be wrong\n" ,
2416+ __func__ , dev_type , DS5_HW_RESET_TIMEOUT_MS );
2417+ }
2418+
23902419 dev_info (& state -> client -> dev ,
23912420 "%s(): HW reset complete. Firmware: %d.%d.%d.%d\n" ,
23922421 __func__ ,
0 commit comments