linux/drivers/pwm/pwm-sifive.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (C) 2017-2018 SiFive
 * For SiFive's PWM IP block documentation please refer Chapter 14 of
 * Reference Manual : https://static.dev.sifive.com/FU540-C000-v1.0.pdf
 *
 * Limitations:
 * - When changing both duty cycle and period, we cannot prevent in
 *   software that the output might produce a period with mixed
 *   settings (new period length and old duty cycle).
 * - The hardware cannot generate a 100% duty cycle.
 * - The hardware generates only inverted output.
 */
#include <linux/clk.h>
#include <linux/io.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/pwm.h>
#include <linux/slab.h>
#include <linux/bitfield.h>

/* Register offsets */
#define PWM_SIFIVE_PWMCFG
#define PWM_SIFIVE_PWMCOUNT
#define PWM_SIFIVE_PWMS
#define PWM_SIFIVE_PWMCMP(i)

/* PWMCFG fields */
#define PWM_SIFIVE_PWMCFG_SCALE
#define PWM_SIFIVE_PWMCFG_STICKY
#define PWM_SIFIVE_PWMCFG_ZERO_CMP
#define PWM_SIFIVE_PWMCFG_DEGLITCH
#define PWM_SIFIVE_PWMCFG_EN_ALWAYS
#define PWM_SIFIVE_PWMCFG_EN_ONCE
#define PWM_SIFIVE_PWMCFG_CENTER
#define PWM_SIFIVE_PWMCFG_GANG
#define PWM_SIFIVE_PWMCFG_IP

#define PWM_SIFIVE_CMPWIDTH
#define PWM_SIFIVE_DEFAULT_PERIOD

struct pwm_sifive_ddata {};

static inline
struct pwm_sifive_ddata *pwm_sifive_chip_to_ddata(struct pwm_chip *chip)
{}

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

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

/* Called holding ddata->lock */
static void pwm_sifive_update_clock(struct pwm_sifive_ddata *ddata,
				    unsigned long rate)
{}

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

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

static const struct pwm_ops pwm_sifive_ops =;

static int pwm_sifive_clock_notifier(struct notifier_block *nb,
				     unsigned long event, void *data)
{}

static int pwm_sifive_probe(struct platform_device *pdev)
{}

static void pwm_sifive_remove(struct platform_device *dev)
{}

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

static struct platform_driver pwm_sifive_driver =;
module_platform_driver();

MODULE_DESCRIPTION();
MODULE_LICENSE();