Thermodynamics of electromechanical coupling in voltage-gated ion channels