/* If the handler is non-null, the handler will be called after every period of this PWM channel. If the handler is null, this channel won't generate an IRQ.  */
int pwm_channel_handler(struct pwm_channel *ch, void(*handler)(struct pwm_channel *ch))
/* If the handler is non-null, the handler will be called after every period of this PWM channel. If the handler is null, this channel won't generate an IRQ.  */
int pwm_channel_handler(struct pwm_channel *ch, void(*handler)(struct pwm_channel *ch))
{
	unsigned long	flags;
	int		t;
	spin_lock_irqsave(&pwm->lock, flags);
	t = pwmcheck(ch);
	if (t >= 0) {
		pwm->handler[t] = handler;
		pwm_writel(pwm, handler ? PWM_IER : PWM_IDR, 1 << t);
		t = 0;
	}
	spin_unlock_irqrestore(&pwm->lock, flags);
	return t;
}