21
21
#include <linux/pwm.h>
22
22
#include <linux/reset.h>
23
23
#include <linux/slab.h>
24
- #include <linux/spinlock.h>
25
24
#include <linux/time.h>
26
25
27
26
#define PWM_CTRL_REG 0x0
@@ -85,7 +84,6 @@ struct sun4i_pwm_chip {
85
84
struct clk * clk ;
86
85
struct reset_control * rst ;
87
86
void __iomem * base ;
88
- spinlock_t ctrl_lock ;
89
87
const struct sun4i_pwm_data * data ;
90
88
};
91
89
@@ -258,15 +256,13 @@ static int sun4i_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
258
256
return ret ;
259
257
}
260
258
261
- spin_lock (& sun4ichip -> ctrl_lock );
262
259
ctrl = sun4i_pwm_readl (sun4ichip , PWM_CTRL_REG );
263
260
264
261
if (sun4ichip -> data -> has_direct_mod_clk_output ) {
265
262
if (bypass ) {
266
263
ctrl |= BIT_CH (PWM_BYPASS , pwm -> hwpwm );
267
264
/* We can skip other parameter */
268
265
sun4i_pwm_writel (sun4ichip , ctrl , PWM_CTRL_REG );
269
- spin_unlock (& sun4ichip -> ctrl_lock );
270
266
return 0 ;
271
267
}
272
268
@@ -297,8 +293,6 @@ static int sun4i_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
297
293
298
294
sun4i_pwm_writel (sun4ichip , ctrl , PWM_CTRL_REG );
299
295
300
- spin_unlock (& sun4ichip -> ctrl_lock );
301
-
302
296
if (state -> enabled )
303
297
return 0 ;
304
298
@@ -309,12 +303,10 @@ static int sun4i_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
309
303
else
310
304
usleep_range (delay_us , delay_us * 2 );
311
305
312
- spin_lock (& sun4ichip -> ctrl_lock );
313
306
ctrl = sun4i_pwm_readl (sun4ichip , PWM_CTRL_REG );
314
307
ctrl &= ~BIT_CH (PWM_CLK_GATING , pwm -> hwpwm );
315
308
ctrl &= ~BIT_CH (PWM_EN , pwm -> hwpwm );
316
309
sun4i_pwm_writel (sun4ichip , ctrl , PWM_CTRL_REG );
317
- spin_unlock (& sun4ichip -> ctrl_lock );
318
310
319
311
clk_disable_unprepare (sun4ichip -> clk );
320
312
@@ -456,8 +448,6 @@ static int sun4i_pwm_probe(struct platform_device *pdev)
456
448
457
449
chip -> ops = & sun4i_pwm_ops ;
458
450
459
- spin_lock_init (& sun4ichip -> ctrl_lock );
460
-
461
451
ret = pwmchip_add (chip );
462
452
if (ret < 0 ) {
463
453
dev_err (& pdev -> dev , "failed to add PWM chip: %d\n" , ret );
0 commit comments