Commit 994c340
committed
d4xx: add post-reset HWMC readiness gate and fix GVD retry logic
RSDSO-21151
After HW reset, the driver returned success to userspace ~54ms before
the firmware's HWMC subsystem was ready for commands. RS Viewer
immediately queried GVD/HWMC, hitting I2C EREMOTEIO (-121) failures
and WIP/ERR status codes for seconds, eventually crashing.
Root causes and fixes:
1) ds5_hw_reset_with_recovery: Add Step 9 HWMC readiness check.
After device type is confirmed (Step 8), send a lightweight GVD
command and poll HWMC_STATUS until completion before returning
to userspace. This blocks the caller until the FW command
processor is fully operational, preventing the race window.
2) ds5_gvd: Fix retry loop condition. The old condition
'ret && retries-- && status != 0' only retried on I2C failure.
If I2C succeeded but status was WIP (2), ret==0 caused immediate
loop exit. Changed to '(ret || status == WIP) && retries--'
to retry on both I2C errors and WIP. Increased retries from
3x10ms to 20x50ms for transient post-reset conditions.
3) ds5_gvd: Fix return value. Previously returned raw HWMC status
(positive int, e.g. 2 for WIP) on failure. V4L2 g_volatile_ctrl
interprets positive returns as success, so userspace received
garbage GVD data. Now returns -EIO on failure.
4) ds5_get_hwmc_status: Add I2C retry tolerance. The loop exited
immediately on I2C failure (!ret was false). Changed condition
to continue retrying on both I2C failures and WIP status, with
a dev_dbg trace for I2C errors.
Signed-off-by: GitHub Copilot <copilot@github.com>1 parent 4254890 commit 994c340
1 file changed
Lines changed: 84 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2177 | 2177 | | |
2178 | 2178 | | |
2179 | 2179 | | |
2180 | | - | |
| 2180 | + | |
| 2181 | + | |
| 2182 | + | |
| 2183 | + | |
| 2184 | + | |
| 2185 | + | |
2181 | 2186 | | |
2182 | 2187 | | |
2183 | 2188 | | |
| |||
2730 | 2735 | | |
2731 | 2736 | | |
2732 | 2737 | | |
| 2738 | + | |
| 2739 | + | |
| 2740 | + | |
| 2741 | + | |
| 2742 | + | |
| 2743 | + | |
| 2744 | + | |
| 2745 | + | |
| 2746 | + | |
| 2747 | + | |
| 2748 | + | |
| 2749 | + | |
| 2750 | + | |
| 2751 | + | |
| 2752 | + | |
| 2753 | + | |
| 2754 | + | |
| 2755 | + | |
| 2756 | + | |
| 2757 | + | |
| 2758 | + | |
| 2759 | + | |
| 2760 | + | |
| 2761 | + | |
| 2762 | + | |
| 2763 | + | |
| 2764 | + | |
| 2765 | + | |
| 2766 | + | |
| 2767 | + | |
| 2768 | + | |
| 2769 | + | |
| 2770 | + | |
| 2771 | + | |
| 2772 | + | |
| 2773 | + | |
| 2774 | + | |
| 2775 | + | |
| 2776 | + | |
| 2777 | + | |
| 2778 | + | |
| 2779 | + | |
| 2780 | + | |
| 2781 | + | |
| 2782 | + | |
| 2783 | + | |
| 2784 | + | |
| 2785 | + | |
| 2786 | + | |
| 2787 | + | |
| 2788 | + | |
| 2789 | + | |
| 2790 | + | |
| 2791 | + | |
| 2792 | + | |
| 2793 | + | |
| 2794 | + | |
| 2795 | + | |
| 2796 | + | |
| 2797 | + | |
| 2798 | + | |
| 2799 | + | |
| 2800 | + | |
| 2801 | + | |
| 2802 | + | |
| 2803 | + | |
| 2804 | + | |
| 2805 | + | |
| 2806 | + | |
2733 | 2807 | | |
2734 | 2808 | | |
2735 | 2809 | | |
| |||
3126 | 3200 | | |
3127 | 3201 | | |
3128 | 3202 | | |
3129 | | - | |
3130 | | - | |
| 3203 | + | |
| 3204 | + | |
3131 | 3205 | | |
3132 | 3206 | | |
3133 | 3207 | | |
3134 | 3208 | | |
3135 | 3209 | | |
3136 | | - | |
3137 | | - | |
| 3210 | + | |
| 3211 | + | |
3138 | 3212 | | |
3139 | 3213 | | |
3140 | | - | |
| 3214 | + | |
3141 | 3215 | | |
3142 | | - | |
| 3216 | + | |
3143 | 3217 | | |
3144 | | - | |
3145 | | - | |
3146 | | - | |
| 3218 | + | |
| 3219 | + | |
| 3220 | + | |
3147 | 3221 | | |
3148 | 3222 | | |
3149 | 3223 | | |
| |||
0 commit comments