[PATCH 6.11 127/817] tools/lib/thermal: Make more generic the command encoding function