linux/drivers/pwm/pwm-imx-tpm.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright 2018-2019 NXP.
 *
 * Limitations:
 * - The TPM counter and period counter are shared between
 *   multiple channels, so all channels should use same period
 *   settings.
 * - Changes to polarity cannot be latched at the time of the
 *   next period start.
 * - Changing period and duty cycle together isn't atomic,
 *   with the wrong timing it might happen that a period is
 *   produced with old duty cycle but new period settings.
 */

#include <linux/bitfield.h>
#include <linux/bitops.h>
#include <linux/clk.h>
#include <linux/err.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/pinctrl/consumer.h>
#include <linux/platform_device.h>
#include <linux/pwm.h>
#include <linux/slab.h>

#define PWM_IMX_TPM_PARAM
#define PWM_IMX_TPM_GLOBAL
#define PWM_IMX_TPM_SC
#define PWM_IMX_TPM_CNT
#define PWM_IMX_TPM_MOD
#define PWM_IMX_TPM_CnSC(n)
#define PWM_IMX_TPM_CnV(n)

#define PWM_IMX_TPM_PARAM_CHAN

#define PWM_IMX_TPM_SC_PS
#define PWM_IMX_TPM_SC_CMOD
#define PWM_IMX_TPM_SC_CMOD_INC_EVERY_CLK
#define PWM_IMX_TPM_SC_CPWMS

#define PWM_IMX_TPM_CnSC_CHF
#define PWM_IMX_TPM_CnSC_MSB
#define PWM_IMX_TPM_CnSC_MSA

/*
 * The reference manual describes this field as two separate bits. The
 * semantic of the two bits isn't orthogonal though, so they are treated
 * together as a 2-bit field here.
 */
#define PWM_IMX_TPM_CnSC_ELS
#define PWM_IMX_TPM_CnSC_ELS_INVERSED
#define PWM_IMX_TPM_CnSC_ELS_NORMAL


#define PWM_IMX_TPM_MOD_WIDTH
#define PWM_IMX_TPM_MOD_MOD

struct imx_tpm_pwm_chip {};

struct imx_tpm_pwm_param {};

static inline struct imx_tpm_pwm_chip *
to_imx_tpm_pwm_chip(struct pwm_chip *chip)
{}

/*
 * This function determines for a given pwm_state *state that a consumer
 * might request the pwm_state *real_state that eventually is implemented
 * by the hardware and the necessary register values (in *p) to achieve
 * this.
 */
static int pwm_imx_tpm_round_state(struct pwm_chip *chip,
				   struct imx_tpm_pwm_param *p,
				   struct pwm_state *real_state,
				   const struct pwm_state *state)
{}

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

/* this function is supposed to be called with mutex hold */
static int pwm_imx_tpm_apply_hw(struct pwm_chip *chip,
				struct imx_tpm_pwm_param *p,
				struct pwm_state *state,
				struct pwm_device *pwm)
{}

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

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

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

static const struct pwm_ops imx_tpm_pwm_ops =;

static int pwm_imx_tpm_probe(struct platform_device *pdev)
{}

static int pwm_imx_tpm_suspend(struct device *dev)
{}

static int pwm_imx_tpm_resume(struct device *dev)
{}

static DEFINE_SIMPLE_DEV_PM_OPS(imx_tpm_pwm_pm,
				pwm_imx_tpm_suspend, pwm_imx_tpm_resume);

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

static struct platform_driver imx_tpm_pwm_driver =;
module_platform_driver();

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