#include <linux/bitfield.h>
#include <linux/clk.h>
#include <linux/limits.h>
#include <linux/mfd/rz-mtu3.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/pwm.h>
#include <linux/time.h>
#define RZ_MTU3_MAX_PWM_CHANNELS …
#define RZ_MTU3_MAX_HW_CHANNELS …
struct rz_mtu3_channel_io_map { … };
struct rz_mtu3_pwm_channel { … };
struct rz_mtu3_pwm_chip { … };
static const struct rz_mtu3_channel_io_map channel_map[] = …;
static inline struct rz_mtu3_pwm_chip *to_rz_mtu3_pwm_chip(struct pwm_chip *chip)
{ … }
static void rz_mtu3_pwm_read_tgr_registers(struct rz_mtu3_pwm_channel *priv,
u16 reg_pv_offset, u16 *pv_val,
u16 reg_dc_offset, u16 *dc_val)
{ … }
static void rz_mtu3_pwm_write_tgr_registers(struct rz_mtu3_pwm_channel *priv,
u16 reg_pv_offset, u16 pv_val,
u16 reg_dc_offset, u16 dc_val)
{ … }
static u8 rz_mtu3_pwm_calculate_prescale(struct rz_mtu3_pwm_chip *rz_mtu3,
u64 period_cycles)
{ … }
static struct rz_mtu3_pwm_channel *
rz_mtu3_get_channel(struct rz_mtu3_pwm_chip *rz_mtu3_pwm, u32 hwpwm)
{ … }
static bool rz_mtu3_pwm_is_ch_enabled(struct rz_mtu3_pwm_chip *rz_mtu3_pwm,
u32 hwpwm)
{ … }
static int rz_mtu3_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm)
{ … }
static void rz_mtu3_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm)
{ … }
static int rz_mtu3_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
{ … }
static void rz_mtu3_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm)
{ … }
static int rz_mtu3_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
struct pwm_state *state)
{ … }
static u16 rz_mtu3_pwm_calculate_pv_or_dc(u64 period_or_duty_cycle, u8 prescale)
{ … }
static int rz_mtu3_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
const struct pwm_state *state)
{ … }
static int rz_mtu3_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
const struct pwm_state *state)
{ … }
static const struct pwm_ops rz_mtu3_pwm_ops = …;
static int rz_mtu3_pwm_pm_runtime_suspend(struct device *dev)
{ … }
static int rz_mtu3_pwm_pm_runtime_resume(struct device *dev)
{ … }
static DEFINE_RUNTIME_DEV_PM_OPS(rz_mtu3_pwm_pm_ops,
rz_mtu3_pwm_pm_runtime_suspend,
rz_mtu3_pwm_pm_runtime_resume, NULL);
static void rz_mtu3_pwm_pm_disable(void *data)
{ … }
static int rz_mtu3_pwm_probe(struct platform_device *pdev)
{ … }
static struct platform_driver rz_mtu3_pwm_driver = …;
module_platform_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_ALIAS(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;