18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (C) 2013 Samsung Electronics Co., Ltd.
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci#ifndef __CLOCKSOURCE_SAMSUNG_PWM_H
68c2ecf20Sopenharmony_ci#define __CLOCKSOURCE_SAMSUNG_PWM_H
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#include <linux/spinlock.h>
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#define SAMSUNG_PWM_NUM		5
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci/*
138c2ecf20Sopenharmony_ci * Following declaration must be in an ifdef due to this symbol being static
148c2ecf20Sopenharmony_ci * in pwm-samsung driver if the clocksource driver is not compiled in and the
158c2ecf20Sopenharmony_ci * spinlock is not shared between both drivers.
168c2ecf20Sopenharmony_ci */
178c2ecf20Sopenharmony_ci#ifdef CONFIG_CLKSRC_SAMSUNG_PWM
188c2ecf20Sopenharmony_ciextern spinlock_t samsung_pwm_lock;
198c2ecf20Sopenharmony_ci#endif
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_cistruct samsung_pwm_variant {
228c2ecf20Sopenharmony_ci	u8 bits;
238c2ecf20Sopenharmony_ci	u8 div_base;
248c2ecf20Sopenharmony_ci	u8 tclk_mask;
258c2ecf20Sopenharmony_ci	u8 output_mask;
268c2ecf20Sopenharmony_ci	bool has_tint_cstat;
278c2ecf20Sopenharmony_ci};
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_civoid samsung_pwm_clocksource_init(void __iomem *base,
308c2ecf20Sopenharmony_ci		unsigned int *irqs, struct samsung_pwm_variant *variant);
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci#endif /* __CLOCKSOURCE_SAMSUNG_PWM_H */
33