[PATCH 6.12 081/826] tools/lib/thermal: Make more generic the command encoding function