/* The channel is completely shut down (counter and IRQ disabled), and made available for re-use. Returns zero, or negative errno.  */
int pwm_channel_free(struct pwm_channel *ch)
/* The channel is completely shut down (counter and IRQ disabled), and made available for re-use. Returns zero, or negative errno.  */
int pwm_channel_free(struct pwm_channel *ch)
{
	unsigned long	flags;
	int		t;
	spin_lock_irqsave(&pwm->lock, flags);
	t = pwmcheck(ch);
	if (t >= 0) {
		pwm->channel[t] = NULL;
		pwm->handler[t] = NULL;
		pwm_writel(pwm, PWM_DIS, 1 << t);
		pwm_writel(pwm, PWM_IDR, 1 << t);
		clk_disable(pwm->clk);
		t = 0;
	}
	spin_unlock_irqrestore(&pwm->lock, flags);
	return t;
}