linux/drivers/pwm/pwm-brcmstb.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Broadcom BCM7038 PWM driver
 * Author: Florian Fainelli
 *
 * Copyright (C) 2015 Broadcom Corporation
 */

#define pr_fmt(fmt)

#include <linux/clk.h>
#include <linux/export.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/pwm.h>
#include <linux/spinlock.h>

#define PWM_CTRL
#define CTRL_START
#define CTRL_OEB
#define CTRL_FORCE_HIGH
#define CTRL_OPENDRAIN
#define CTRL_CHAN_OFFS

#define PWM_CTRL2
#define CTRL2_OUT_SELECT

#define PWM_CH_SIZE

#define PWM_CWORD_MSB(ch)
#define PWM_CWORD_LSB(ch)

/* Number of bits for the CWORD value */
#define CWORD_BIT_SIZE

/*
 * Maximum control word value allowed when variable-frequency PWM is used as a
 * clock for the constant-frequency PMW.
 */
#define CONST_VAR_F_MAX
#define CONST_VAR_F_MIN

#define PWM_ON(ch)
#define PWM_ON_MIN
#define PWM_PERIOD(ch)
#define PWM_PERIOD_MIN

#define PWM_ON_PERIOD_MAX

struct brcmstb_pwm {};

static inline u32 brcmstb_pwm_readl(struct brcmstb_pwm *p,
				    unsigned int offset)
{}

static inline void brcmstb_pwm_writel(struct brcmstb_pwm *p, u32 value,
				      unsigned int offset)
{}

static inline struct brcmstb_pwm *to_brcmstb_pwm(struct pwm_chip *chip)
{}

/*
 * Fv is derived from the variable frequency output. The variable frequency
 * output is configured using this formula:
 *
 * W = cword, if cword < 2 ^ 15 else 16-bit 2's complement of cword
 *
 * Fv = W x 2 ^ -16 x 27Mhz (reference clock)
 *
 * The period is: (period + 1) / Fv and "on" time is on / (period + 1)
 *
 * The PWM core framework specifies that the "duty_ns" parameter is in fact the
 * "on" time, so this translates directly into our HW programming here.
 */
static int brcmstb_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
			      u64 duty_ns, u64 period_ns)
{}

static inline void brcmstb_pwm_enable_set(struct brcmstb_pwm *p,
					  unsigned int channel, bool enable)
{}

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

static const struct pwm_ops brcmstb_pwm_ops =;

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

static int brcmstb_pwm_probe(struct platform_device *pdev)
{}

static int brcmstb_pwm_suspend(struct device *dev)
{}

static int brcmstb_pwm_resume(struct device *dev)
{}

static DEFINE_SIMPLE_DEV_PM_OPS(brcmstb_pwm_pm_ops, brcmstb_pwm_suspend,
				brcmstb_pwm_resume);

static struct platform_driver brcmstb_pwm_driver =;
module_platform_driver();

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