blob: 6d53e52f64977cfa2c4a5f3862f851bc21ce5df5 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Minkyu Kang87649982009-10-01 17:20:01 +09002/*
3 * Copyright (C) 2009 Samsung Electronics
4 * Kyungmin Park <kyungmin.park@samsung.com>
5 * Minkyu Kang <mk7.kang@samsung.com>
Minkyu Kang87649982009-10-01 17:20:01 +09006 */
7
8#ifndef __ASM_ARM_ARCH_PWM_H_
9#define __ASM_ARM_ARCH_PWM_H_
10
Donghwa Lee85f5df22011-03-07 21:11:42 +000011#define PRESCALER_0 (8 - 1) /* prescaler of timer 0, 1 */
12#define PRESCALER_1 (16 - 1) /* prescaler of timer 2, 3, 4 */
13
14/* Divider MUX */
15#define MUX_DIV_1 0 /* 1/1 period */
16#define MUX_DIV_2 1 /* 1/2 period */
17#define MUX_DIV_4 2 /* 1/4 period */
18#define MUX_DIV_8 3 /* 1/8 period */
19#define MUX_DIV_16 4 /* 1/16 period */
20
21#define MUX_DIV_SHIFT(x) (x * 4)
22
Donghwa Lee85f5df22011-03-07 21:11:42 +000023#define TCON_OFFSET(x) ((x + 1) * (!!x) << 2)
24
25#define TCON_START(x) (1 << TCON_OFFSET(x))
26#define TCON_UPDATE(x) (1 << (TCON_OFFSET(x) + 1))
27#define TCON_INVERTER(x) (1 << (TCON_OFFSET(x) + 2))
28#define TCON_AUTO_RELOAD(x) (1 << (TCON_OFFSET(x) + 3))
Minkyu Kangda0bff82011-03-10 20:05:58 +090029#define TCON4_AUTO_RELOAD (1 << 22)
Donghwa Lee85f5df22011-03-07 21:11:42 +000030
Minkyu Kang87649982009-10-01 17:20:01 +090031#ifndef __ASSEMBLY__
Minkyu Kang2917c0a2010-08-19 20:41:50 +090032struct s5p_timer {
Minkyu Kangc6cb1842009-10-15 11:19:15 +090033 unsigned int tcfg0;
34 unsigned int tcfg1;
35 unsigned int tcon;
36 unsigned int tcntb0;
37 unsigned int tcmpb0;
38 unsigned int tcnto0;
39 unsigned int tcntb1;
40 unsigned int tcmpb1;
41 unsigned int tcnto1;
42 unsigned int tcntb2;
43 unsigned int tcmpb2;
44 unsigned int tcnto2;
45 unsigned int tcntb3;
46 unsigned int res1;
47 unsigned int tcnto3;
48 unsigned int tcntb4;
49 unsigned int tcnto4;
50 unsigned int tintcstat;
Minkyu Kang87649982009-10-01 17:20:01 +090051};
Tom Rini66faa432022-12-04 10:03:26 -050052
53int s5p_pwm_init (int pwm_id, int div, int invert);
54int s5p_pwm_config (int pwm_id, int duty_ns, int period_ns);
55int s5p_pwm_enable (int pwm_id);
56void s5p_pwm_disable (int pwm_id);
Minkyu Kang87649982009-10-01 17:20:01 +090057#endif /* __ASSEMBLY__ */
58
59#endif