162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (C) 2013 Samsung Electronics Co., Ltd.
462306a36Sopenharmony_ci */
562306a36Sopenharmony_ci#ifndef __CLOCKSOURCE_SAMSUNG_PWM_H
662306a36Sopenharmony_ci#define __CLOCKSOURCE_SAMSUNG_PWM_H
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#include <linux/spinlock.h>
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci#define SAMSUNG_PWM_NUM		5
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci/*
1362306a36Sopenharmony_ci * Following declaration must be in an ifdef due to this symbol being static
1462306a36Sopenharmony_ci * in pwm-samsung driver if the clocksource driver is not compiled in and the
1562306a36Sopenharmony_ci * spinlock is not shared between both drivers.
1662306a36Sopenharmony_ci */
1762306a36Sopenharmony_ci#ifdef CONFIG_CLKSRC_SAMSUNG_PWM
1862306a36Sopenharmony_ciextern spinlock_t samsung_pwm_lock;
1962306a36Sopenharmony_ci#endif
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_cistruct samsung_pwm_variant {
2262306a36Sopenharmony_ci	u8 bits;
2362306a36Sopenharmony_ci	u8 div_base;
2462306a36Sopenharmony_ci	u8 tclk_mask;
2562306a36Sopenharmony_ci	u8 output_mask;
2662306a36Sopenharmony_ci	bool has_tint_cstat;
2762306a36Sopenharmony_ci};
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_civoid samsung_pwm_clocksource_init(void __iomem *base,
3062306a36Sopenharmony_ci				  unsigned int *irqs,
3162306a36Sopenharmony_ci				  const struct samsung_pwm_variant *variant);
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci#endif /* __CLOCKSOURCE_SAMSUNG_PWM_H */
34