pwm: Add pwm_get_polarity() helper function