linux/drivers/pwm/pwm-lpc18xx-sct.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * NXP LPC18xx State Configurable Timer - Pulse Width Modulator driver
 *
 * Copyright (c) 2015 Ariel D'Alessandro <[email protected]>
 *
 * Notes
 * =====
 * NXP LPC18xx provides a State Configurable Timer (SCT) which can be configured
 * as a Pulse Width Modulator.
 *
 * SCT supports 16 outputs, 16 events and 16 registers. Each event will be
 * triggered when its related register matches the SCT counter value, and it
 * will set or clear a selected output.
 *
 * One of the events is preselected to generate the period, thus the maximum
 * number of simultaneous channels is limited to 15. Notice that period is
 * global to all the channels, thus PWM driver will refuse setting different
 * values to it, unless there's only one channel requested.
 */

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

/* LPC18xx SCT registers */
#define LPC18XX_PWM_CONFIG
#define LPC18XX_PWM_CONFIG_UNIFY
#define LPC18XX_PWM_CONFIG_NORELOAD

#define LPC18XX_PWM_CTRL
#define LPC18XX_PWM_CTRL_HALT
#define LPC18XX_PWM_BIDIR
#define LPC18XX_PWM_PRE_SHIFT
#define LPC18XX_PWM_PRE_MASK
#define LPC18XX_PWM_PRE(x)

#define LPC18XX_PWM_LIMIT

#define LPC18XX_PWM_RES_BASE
#define LPC18XX_PWM_RES_SHIFT(_ch)
#define LPC18XX_PWM_RES(_ch, _action)
#define LPC18XX_PWM_RES_MASK(_ch)

#define LPC18XX_PWM_MATCH_BASE
#define LPC18XX_PWM_MATCH(_ch)

#define LPC18XX_PWM_MATCHREL_BASE
#define LPC18XX_PWM_MATCHREL(_ch)

#define LPC18XX_PWM_EVSTATEMSK_BASE
#define LPC18XX_PWM_EVSTATEMSK(_ch)
#define LPC18XX_PWM_EVSTATEMSK_ALL

#define LPC18XX_PWM_EVCTRL_BASE
#define LPC18XX_PWM_EVCTRL(_ev)

#define LPC18XX_PWM_EVCTRL_MATCH(_ch)

#define LPC18XX_PWM_EVCTRL_COMB_SHIFT
#define LPC18XX_PWM_EVCTRL_COMB_MATCH

#define LPC18XX_PWM_OUTPUTSET_BASE
#define LPC18XX_PWM_OUTPUTSET(_ch)

#define LPC18XX_PWM_OUTPUTCL_BASE
#define LPC18XX_PWM_OUTPUTCL(_ch)

/* LPC18xx SCT unified counter */
#define LPC18XX_PWM_TIMER_MAX

/* LPC18xx SCT events */
#define LPC18XX_PWM_EVENT_PERIOD
#define LPC18XX_PWM_EVENT_MAX

#define LPC18XX_NUM_PWMS

/* SCT conflict resolution */
enum lpc18xx_pwm_res_action {};

struct lpc18xx_pwm_data {};

struct lpc18xx_pwm_chip {};

static inline struct lpc18xx_pwm_chip *
to_lpc18xx_pwm_chip(struct pwm_chip *chip)
{}

static inline void lpc18xx_pwm_writel(struct lpc18xx_pwm_chip *lpc18xx_pwm,
				      u32 reg, u32 val)
{}

static inline u32 lpc18xx_pwm_readl(struct lpc18xx_pwm_chip *lpc18xx_pwm,
				    u32 reg)
{}

static void lpc18xx_pwm_set_conflict_res(struct lpc18xx_pwm_chip *lpc18xx_pwm,
					 struct pwm_device *pwm,
					 enum lpc18xx_pwm_res_action action)
{}

static void lpc18xx_pwm_config_period(struct pwm_chip *chip, u64 period_ns)
{}

static void lpc18xx_pwm_config_duty(struct pwm_chip *chip,
				    struct pwm_device *pwm, u64 duty_ns)
{}

static int lpc18xx_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
			      int duty_ns, int period_ns)
{}

static int lpc18xx_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm, enum pwm_polarity polarity)
{}

static void lpc18xx_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm)
{}

static int lpc18xx_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm)
{}

static void lpc18xx_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm)
{}

static int lpc18xx_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
			     const struct pwm_state *state)
{}
static const struct pwm_ops lpc18xx_pwm_ops =;

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

static int lpc18xx_pwm_probe(struct platform_device *pdev)
{}

static void lpc18xx_pwm_remove(struct platform_device *pdev)
{}

static struct platform_driver lpc18xx_pwm_driver =;
module_platform_driver();

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