linux/drivers/counter/ti-eqep.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (C) 2019 David Lechner <[email protected]>
 *
 * Counter driver for Texas Instruments Enhanced Quadrature Encoder Pulse (eQEP)
 */

#include <linux/bitops.h>
#include <linux/clk.h>
#include <linux/counter.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/regmap.h>
#include <linux/types.h>

/* 32-bit registers */
#define QPOSCNT
#define QPOSINIT
#define QPOSMAX
#define QPOSCMP
#define QPOSILAT
#define QPOSSLAT
#define QPOSLAT
#define QUTMR
#define QUPRD

/* 16-bit registers */
#define QWDTMR
#define QWDPRD
#define QDECCTL
#define QEPCTL
#define QCAPCTL
#define QPOSCTL
#define QEINT
#define QFLG
#define QCLR
#define QFRC
#define QEPSTS
#define QCTMR
#define QCPRD
#define QCTMRLAT
#define QCPRDLAT

#define QDECCTL_QSRC_SHIFT
#define QDECCTL_QSRC
#define QDECCTL_SOEN
#define QDECCTL_SPSEL
#define QDECCTL_XCR
#define QDECCTL_SWAP
#define QDECCTL_IGATE
#define QDECCTL_QAP
#define QDECCTL_QBP
#define QDECCTL_QIP
#define QDECCTL_QSP

#define QEPCTL_FREE_SOFT
#define QEPCTL_PCRM
#define QEPCTL_SEI
#define QEPCTL_IEI
#define QEPCTL_SWI
#define QEPCTL_SEL
#define QEPCTL_IEL
#define QEPCTL_PHEN
#define QEPCTL_QCLM
#define QEPCTL_UTE
#define QEPCTL_WDE

#define QEINT_UTO
#define QEINT_IEL
#define QEINT_SEL
#define QEINT_PCM
#define QEINT_PCR
#define QEINT_PCO
#define QEINT_PCU
#define QEINT_WTO
#define QEINT_QDC
#define QEINT_PHE
#define QEINT_PCE

#define QFLG_UTO
#define QFLG_IEL
#define QFLG_SEL
#define QFLG_PCM
#define QFLG_PCR
#define QFLG_PCO
#define QFLG_PCU
#define QFLG_WTO
#define QFLG_QDC
#define QFLG_PHE
#define QFLG_PCE
#define QFLG_INT

#define QCLR_UTO
#define QCLR_IEL
#define QCLR_SEL
#define QCLR_PCM
#define QCLR_PCR
#define QCLR_PCO
#define QCLR_PCU
#define QCLR_WTO
#define QCLR_QDC
#define QCLR_PHE
#define QCLR_PCE
#define QCLR_INT

/* EQEP Inputs */
enum {};

/* Position Counter Input Modes */
enum ti_eqep_count_func {};

struct ti_eqep_cnt {};

static int ti_eqep_count_read(struct counter_device *counter,
			      struct counter_count *count, u64 *val)
{}

static int ti_eqep_count_write(struct counter_device *counter,
			       struct counter_count *count, u64 val)
{}

static int ti_eqep_function_read(struct counter_device *counter,
				 struct counter_count *count,
				 enum counter_function *function)
{}

static int ti_eqep_function_write(struct counter_device *counter,
				  struct counter_count *count,
				  enum counter_function function)
{}

static int ti_eqep_action_read(struct counter_device *counter,
			       struct counter_count *count,
			       struct counter_synapse *synapse,
			       enum counter_synapse_action *action)
{}

static int ti_eqep_events_configure(struct counter_device *counter)
{}

static int ti_eqep_watch_validate(struct counter_device *counter,
				  const struct counter_watch *watch)
{}

static const struct counter_ops ti_eqep_counter_ops =;

static int ti_eqep_position_ceiling_read(struct counter_device *counter,
					 struct counter_count *count,
					 u64 *ceiling)
{}

static int ti_eqep_position_ceiling_write(struct counter_device *counter,
					  struct counter_count *count,
					  u64 ceiling)
{}

static int ti_eqep_position_enable_read(struct counter_device *counter,
					struct counter_count *count, u8 *enable)
{}

static int ti_eqep_position_enable_write(struct counter_device *counter,
					 struct counter_count *count, u8 enable)
{}

static struct counter_comp ti_eqep_position_ext[] =;

static struct counter_signal ti_eqep_signals[] =;

static const enum counter_function ti_eqep_position_functions[] =;

static const enum counter_synapse_action ti_eqep_position_synapse_actions[] =;

static struct counter_synapse ti_eqep_position_synapses[] =;

static struct counter_count ti_eqep_counts[] =;

static irqreturn_t ti_eqep_irq_handler(int irq, void *dev_id)
{}

static const struct regmap_config ti_eqep_regmap32_config =;

static const struct regmap_config ti_eqep_regmap16_config =;

static int ti_eqep_probe(struct platform_device *pdev)
{}

static void ti_eqep_remove(struct platform_device *pdev)
{}

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

static struct platform_driver ti_eqep_driver =;
module_platform_driver();

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