linux/drivers/pwm/pwm-bcm-kona.c

// SPDX-License-Identifier: GPL-2.0-only
// Copyright (C) 2014 Broadcom Corporation

#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/io.h>
#include <linux/ioport.h>
#include <linux/math64.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/pwm.h>
#include <linux/slab.h>
#include <linux/types.h>

/*
 * The Kona PWM has some unusual characteristics.  Here are the main points.
 *
 * 1) There is no disable bit and the hardware docs advise programming a zero
 *    duty to achieve output equivalent to that of a normal disable operation.
 *
 * 2) Changes to prescale, duty, period, and polarity do not take effect until
 *    a subsequent rising edge of the trigger bit.
 *
 * 3) If the smooth bit and trigger bit are both low, the output is a constant
 *    high signal.  Otherwise, the earlier waveform continues to be output.
 *
 * 4) If the smooth bit is set on the rising edge of the trigger bit, output
 *    will transition to the new settings on a period boundary (which could be
 *    seconds away).  If the smooth bit is clear, new settings will be applied
 *    as soon as possible (the hardware always has a 400ns delay).
 *
 * 5) When the external clock that feeds the PWM is disabled, output is pegged
 *    high or low depending on its state at that exact instant.
 */

#define PWM_CONTROL_OFFSET
#define PWM_CONTROL_SMOOTH_SHIFT(chan)
#define PWM_CONTROL_TYPE_SHIFT(chan)
#define PWM_CONTROL_POLARITY_SHIFT(chan)
#define PWM_CONTROL_TRIGGER_SHIFT(chan)

#define PRESCALE_OFFSET
#define PRESCALE_SHIFT(chan)
#define PRESCALE_MASK(chan)
#define PRESCALE_MIN
#define PRESCALE_MAX

#define PERIOD_COUNT_OFFSET(chan)
#define PERIOD_COUNT_MIN
#define PERIOD_COUNT_MAX

#define DUTY_CYCLE_HIGH_OFFSET(chan)
#define DUTY_CYCLE_HIGH_MIN
#define DUTY_CYCLE_HIGH_MAX

struct kona_pwmc {};

static inline struct kona_pwmc *to_kona_pwmc(struct pwm_chip *chip)
{}

/*
 * Clear trigger bit but set smooth bit to maintain old output.
 */
static void kona_pwmc_prepare_for_settings(struct kona_pwmc *kp,
	unsigned int chan)
{}

static void kona_pwmc_apply_settings(struct kona_pwmc *kp, unsigned int chan)
{}

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

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

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

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

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

static const struct pwm_ops kona_pwm_ops =;

static int kona_pwmc_probe(struct platform_device *pdev)
{}

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

static struct platform_driver kona_pwmc_driver =;
module_platform_driver();

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