linux/drivers/pwm/pwm-pxa.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * drivers/pwm/pwm-pxa.c
 *
 * simple driver for PWM (Pulse Width Modulator) controller
 *
 * 2008-02-13	initial version
 *		eric miao <[email protected]>
 *
 * Links to reference manuals for some of the supported PWM chips can be found
 * in Documentation/arch/arm/marvell.rst.
 *
 * Limitations:
 * - When PWM is stopped, the current PWM period stops abruptly at the next
 *   input clock (PWMCR_SD is set) and the output is driven to inactive.
 */

#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/err.h>
#include <linux/clk.h>
#include <linux/io.h>
#include <linux/pwm.h>
#include <linux/of.h>

#include <asm/div64.h>

#define HAS_SECONDARY_PWM

static const struct platform_device_id pwm_id_table[] =;
MODULE_DEVICE_TABLE(platform, pwm_id_table);

/* PWM registers and bits definitions */
#define PWMCR
#define PWMDCR
#define PWMPCR

#define PWMCR_SD
#define PWMDCR_FD

struct pxa_pwm_chip {};

static inline struct pxa_pwm_chip *to_pxa_pwm_chip(struct pwm_chip *chip)
{}

/*
 * period_ns = 10^9 * (PRESCALE + 1) * (PV + 1) / PWM_CLK_RATE
 * duty_ns   = 10^9 * (PRESCALE + 1) * DC / PWM_CLK_RATE
 */
static int pxa_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
			  u64 duty_ns, u64 period_ns)
{}

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

static const struct pwm_ops pxa_pwm_ops =;

#ifdef CONFIG_OF
/*
 * Device tree users must create one device instance for each PWM channel.
 * Hence we dispense with the HAS_SECONDARY_PWM and "tell" the original driver
 * code that this is a single channel pxa25x-pwm.  Currently all devices are
 * supported identically.
 */
static const struct of_device_id pwm_of_match[] =;
MODULE_DEVICE_TABLE(of, pwm_of_match);
#else
#define pwm_of_match
#endif

static int pwm_probe(struct platform_device *pdev)
{}

static struct platform_driver pwm_driver =;

module_platform_driver();

MODULE_DESCRIPTION();
MODULE_LICENSE();