#include <linux/bitops.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/io.h>
#include <linux/jiffies.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/pwm.h>
#include <linux/reset.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/time.h>
#define PWM_CTRL_REG …
#define PWM_CH_PRD_BASE …
#define PWM_CH_PRD_OFFSET …
#define PWM_CH_PRD(ch) …
#define PWMCH_OFFSET …
#define PWM_PRESCAL_MASK …
#define PWM_PRESCAL_OFF …
#define PWM_EN …
#define PWM_ACT_STATE …
#define PWM_CLK_GATING …
#define PWM_MODE …
#define PWM_PULSE …
#define PWM_BYPASS …
#define PWM_RDY_BASE …
#define PWM_RDY_OFFSET …
#define PWM_RDY(ch) …
#define PWM_PRD(prd) …
#define PWM_PRD_MASK …
#define PWM_DTY_MASK …
#define PWM_REG_PRD(reg) …
#define PWM_REG_DTY(reg) …
#define PWM_REG_PRESCAL(reg, chan) …
#define BIT_CH(bit, chan) …
static const u32 prescaler_table[] = …;
struct sun4i_pwm_data { … };
struct sun4i_pwm_chip { … };
static inline struct sun4i_pwm_chip *to_sun4i_pwm_chip(struct pwm_chip *chip)
{ … }
static inline u32 sun4i_pwm_readl(struct sun4i_pwm_chip *sun4ichip,
unsigned long offset)
{ … }
static inline void sun4i_pwm_writel(struct sun4i_pwm_chip *sun4ichip,
u32 val, unsigned long offset)
{ … }
static int sun4i_pwm_get_state(struct pwm_chip *chip,
struct pwm_device *pwm,
struct pwm_state *state)
{ … }
static int sun4i_pwm_calculate(struct sun4i_pwm_chip *sun4ichip,
const struct pwm_state *state,
u32 *dty, u32 *prd, unsigned int *prsclr,
bool *bypass)
{ … }
static int sun4i_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
const struct pwm_state *state)
{ … }
static const struct pwm_ops sun4i_pwm_ops = …;
static const struct sun4i_pwm_data sun4i_pwm_dual_nobypass = …;
static const struct sun4i_pwm_data sun4i_pwm_dual_bypass = …;
static const struct sun4i_pwm_data sun4i_pwm_single_bypass = …;
static const struct sun4i_pwm_data sun50i_a64_pwm_data = …;
static const struct sun4i_pwm_data sun50i_h6_pwm_data = …;
static const struct of_device_id sun4i_pwm_dt_ids[] = …;
MODULE_DEVICE_TABLE(of, sun4i_pwm_dt_ids);
static int sun4i_pwm_probe(struct platform_device *pdev)
{ … }
static void sun4i_pwm_remove(struct platform_device *pdev)
{ … }
static struct platform_driver sun4i_pwm_driver = …;
module_platform_driver(…) …;
MODULE_ALIAS(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;