#define TCON_INVERT(chan) (1 << (4 * (chan) + 2))
#define TCON_AUTORELOAD(chan) (1 << (4 * (chan) + 3))
+DEFINE_SPINLOCK(samsung_pwm_lock);
+EXPORT_SYMBOL(samsung_pwm_lock);
+
struct samsung_timer_source {
unsigned int event_id;
unsigned int source_id;
if (channel >= 2)
shift = TCFG0_PRESCALER1_SHIFT;
- spin_lock_irqsave(&pwm->slock, flags);
+ spin_lock_irqsave(&samsung_pwm_lock, flags);
reg = readl(pwm->base + REG_TCFG0);
reg &= ~(TCFG0_PRESCALER_MASK << shift);
reg |= (prescale - 1) << shift;
writel(reg, pwm->base + REG_TCFG0);
- spin_unlock_irqrestore(&pwm->slock, flags);
+ spin_unlock_irqrestore(&samsung_pwm_lock, flags);
}
static void samsung_timer_set_divisor(struct samsung_pwm *pwm,
bits = (fls(divisor) - 1) - pwm->variant.div_base;
- spin_lock_irqsave(&pwm->slock, flags);
+ spin_lock_irqsave(&samsung_pwm_lock, flags);
reg = readl(pwm->base + REG_TCFG1);
reg &= ~(TCFG1_MUX_MASK << shift);
reg |= bits << shift;
writel(reg, pwm->base + REG_TCFG1);
- spin_unlock_irqrestore(&pwm->slock, flags);
+ spin_unlock_irqrestore(&samsung_pwm_lock, flags);
}
static void samsung_time_stop(unsigned int channel)
if (channel > 0)
++channel;
- spin_lock_irqsave(&pwm->slock, flags);
+ spin_lock_irqsave(&samsung_pwm_lock, flags);
tcon = __raw_readl(pwm->base + REG_TCON);
tcon &= ~TCON_START(channel);
__raw_writel(tcon, pwm->base + REG_TCON);
- spin_unlock_irqrestore(&pwm->slock, flags);
+ spin_unlock_irqrestore(&samsung_pwm_lock, flags);
}
static void samsung_time_setup(unsigned int channel, unsigned long tcnt)
if (tcon_chan > 0)
++tcon_chan;
- spin_lock_irqsave(&pwm->slock, flags);
+ spin_lock_irqsave(&samsung_pwm_lock, flags);
tcon = __raw_readl(pwm->base + REG_TCON);
__raw_writel(tcnt, pwm->base + REG_TCMPB(channel));
__raw_writel(tcon, pwm->base + REG_TCON);
- spin_unlock_irqrestore(&pwm->slock, flags);
+ spin_unlock_irqrestore(&samsung_pwm_lock, flags);
}
static void samsung_time_start(unsigned int channel, bool periodic)
if (channel > 0)
++channel;
- spin_lock_irqsave(&pwm->slock, flags);
+ spin_lock_irqsave(&samsung_pwm_lock, flags);
tcon = __raw_readl(pwm->base + REG_TCON);
__raw_writel(tcon, pwm->base + REG_TCON);
- spin_unlock_irqrestore(&pwm->slock, flags);
+ spin_unlock_irqrestore(&samsung_pwm_lock, flags);
}
static int samsung_set_next_event(unsigned long cycles,
return;
}
memcpy(&pwm->variant, variant, sizeof(pwm->variant));
- spin_lock_init(&pwm->slock);
for (i = 0; i < SAMSUNG_PWM_NUM; ++i)
pwm->irq[i] = irq_of_parse_and_map(np, i);