linux/drivers/pwm/pwm-sunplus.c

// SPDX-License-Identifier: GPL-2.0
/*
 * PWM device driver for SUNPLUS SP7021 SoC
 *
 * Links:
 *   Reference Manual:
 *   https://sunplus-tibbo.atlassian.net/wiki/spaces/doc/overview
 *
 *   Reference Manual(PWM module):
 *   https://sunplus.atlassian.net/wiki/spaces/doc/pages/461144198/12.+Pulse+Width+Modulation+PWM
 *
 * Limitations:
 * - Only supports normal polarity.
 * - It output low when PWM channel disabled.
 * - When the parameters change, current running period will not be completed
 *     and run new settings immediately.
 * - In .apply() PWM output need to write register FREQ and DUTY. When first write FREQ
 *     done and not yet write DUTY, it has short timing gap use new FREQ and old DUTY.
 *
 * Author: Hammer Hsieh <[email protected]>
 */
#include <linux/bitfield.h>
#include <linux/clk.h>
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/pwm.h>

#define SP7021_PWM_MODE0
#define SP7021_PWM_MODE0_PWMEN(ch)
#define SP7021_PWM_MODE0_BYPASS(ch)
#define SP7021_PWM_MODE1
#define SP7021_PWM_MODE1_CNT_EN(ch)
#define SP7021_PWM_FREQ(ch)
#define SP7021_PWM_FREQ_MAX
#define SP7021_PWM_DUTY(ch)
#define SP7021_PWM_DUTY_DD_SEL(ch)
#define SP7021_PWM_DUTY_MAX
#define SP7021_PWM_DUTY_MASK
#define SP7021_PWM_FREQ_SCALER
#define SP7021_PWM_NUM

struct sunplus_pwm {};

static inline struct sunplus_pwm *to_sunplus_pwm(struct pwm_chip *chip)
{}

static int sunplus_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
			     const struct pwm_state *state)
{}

static int sunplus_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
				 struct pwm_state *state)
{}

static const struct pwm_ops sunplus_pwm_ops =;

static void sunplus_pwm_clk_release(void *data)
{}

static int sunplus_pwm_probe(struct platform_device *pdev)
{}

static const struct of_device_id sunplus_pwm_of_match[] =;
MODULE_DEVICE_TABLE(of, sunplus_pwm_of_match);

static struct platform_driver sunplus_pwm_driver =;
module_platform_driver();

MODULE_DESCRIPTION();
MODULE_AUTHOR();
MODULE_LICENSE();