[PATCH 6.1 084/772] tools/lib/thermal: Make more generic the command encoding function