linux/drivers/pwm/pwm-sti.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * PWM device driver for ST SoCs
 *
 * Copyright (C) 2013-2016 STMicroelectronics (R&D) Limited
 *
 * Author: Ajit Pal Singh <[email protected]>
 *         Lee Jones <[email protected]>
 */

#include <linux/clk.h>
#include <linux/interrupt.h>
#include <linux/math64.h>
#include <linux/mfd/syscon.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/pwm.h>
#include <linux/regmap.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/time.h>
#include <linux/wait.h>

#define PWM_OUT_VAL(x)
#define PWM_CPT_VAL(x)
#define PWM_CPT_EDGE(x)

#define STI_PWM_CTRL
#define STI_INT_EN
#define STI_INT_STA
#define PWM_INT_ACK
#define PWM_PRESCALE_LOW_MASK
#define PWM_PRESCALE_HIGH_MASK
#define PWM_CPT_EDGE_MASK
#define PWM_INT_ACK_MASK

#define STI_MAX_CPT_DEVS
#define CPT_DC_MAX

/* Regfield IDs */
enum {};

/*
 * Each capture input can be programmed to detect rising-edge, falling-edge,
 * either edge or neither egde.
 */
enum sti_cpt_edge {};

struct sti_cpt_ddata {};

struct sti_pwm_chip {};

static const struct reg_field sti_pwm_regfields[MAX_REGFIELDS] =;

static inline struct sti_pwm_chip *to_sti_pwmchip(struct pwm_chip *chip)
{}

/*
 * Calculate the prescaler value corresponding to the period.
 */
static int sti_pwm_get_prescale(struct sti_pwm_chip *pc, unsigned long period,
				unsigned int *prescale)
{}

/*
 * For STiH4xx PWM IP, the PWM period is fixed to 256 local clock cycles. The
 * only way to change the period (apart from changing the PWM input clock) is
 * to change the PWM clock prescaler.
 *
 * The prescaler is of 8 bits, so 256 prescaler values and hence 256 possible
 * period values are supported (for a particular clock rate). The requested
 * period will be applied only if it matches one of these 256 values.
 */
static int sti_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
			  int duty_ns, int period_ns)
{}

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

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

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

static int sti_pwm_capture(struct pwm_chip *chip, struct pwm_device *pwm,
			   struct pwm_capture *result, unsigned long timeout)
{}

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

static const struct pwm_ops sti_pwm_ops =;

static irqreturn_t sti_pwm_interrupt(int irq, void *data)
{}

static int sti_pwm_probe_regmap(struct sti_pwm_chip *pc)
{}

static const struct regmap_config sti_pwm_regmap_config =;

static int sti_pwm_probe(struct platform_device *pdev)
{}

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

static struct platform_driver sti_pwm_driver =;
module_platform_driver();

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