[PATCH 6.6 103/676] tools/lib/thermal: Make more generic the command encoding function