linux/drivers/counter/ti-ecap-capture.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * ECAP Capture driver
 *
 * Copyright (C) 2022 Julien Panis <[email protected]>
 */

#include <linux/atomic.h>
#include <linux/clk.h>
#include <linux/counter.h>
#include <linux/err.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/mutex.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/regmap.h>

#define ECAP_DRV_NAME

/* ECAP event IDs */
#define ECAP_CEVT1
#define ECAP_CEVT2
#define ECAP_CEVT3
#define ECAP_CEVT4
#define ECAP_CNTOVF

#define ECAP_CEVT_LAST
#define ECAP_NB_CEVT

#define ECAP_EVT_LAST
#define ECAP_NB_EVT

/* Registers */
#define ECAP_TSCNT_REG

#define ECAP_CAP_REG(i)

#define ECAP_ECCTL_REG
#define ECAP_CAPPOL_BIT(i)
#define ECAP_EV_MODE_MASK
#define ECAP_CAPLDEN_BIT
#define ECAP_CONT_ONESHT_BIT
#define ECAP_STOPVALUE_MASK
#define ECAP_TSCNTSTP_BIT
#define ECAP_SYNCO_DIS_MASK
#define ECAP_CAP_APWM_BIT
#define ECAP_ECCTL_EN_MASK
#define ECAP_ECCTL_CFG_MASK

#define ECAP_ECINT_EN_FLG_REG
#define ECAP_EVT_EN_MASK
#define ECAP_EVT_FLG_BIT(i)

#define ECAP_ECINT_CLR_FRC_REG
#define ECAP_INT_CLR_BIT
#define ECAP_EVT_CLR_BIT(i)
#define ECAP_EVT_CLR_MASK

#define ECAP_PID_REG

/* ECAP signals */
#define ECAP_CLOCK_SIG
#define ECAP_INPUT_SIG

static const struct regmap_config ecap_cnt_regmap_config =;

/**
 * struct ecap_cnt_dev - device private data structure
 * @enabled: device state
 * @lock:    synchronization lock to prevent I/O race conditions
 * @clk:     device clock
 * @regmap:  device register map
 * @nb_ovf:  number of overflows since capture start
 * @pm_ctx:  device context for PM operations
 * @pm_ctx.ev_mode:   event mode bits
 * @pm_ctx.time_cntr: timestamp counter value
 */
struct ecap_cnt_dev {};

static u8 ecap_cnt_capture_get_evmode(struct counter_device *counter)
{}

static void ecap_cnt_capture_set_evmode(struct counter_device *counter, u8 ev_mode)
{}

static void ecap_cnt_capture_enable(struct counter_device *counter)
{}

static void ecap_cnt_capture_disable(struct counter_device *counter)
{}

static u32 ecap_cnt_count_get_val(struct counter_device *counter, unsigned int reg)
{}

static void ecap_cnt_count_set_val(struct counter_device *counter, unsigned int reg, u32 val)
{}

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

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

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

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

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

static int ecap_cnt_clk_get_freq(struct counter_device *counter,
				 struct counter_signal *signal, u64 *freq)
{}

static int ecap_cnt_pol_read(struct counter_device *counter,
			     struct counter_signal *signal,
			     size_t idx, enum counter_signal_polarity *pol)
{}

static int ecap_cnt_pol_write(struct counter_device *counter,
			      struct counter_signal *signal,
			      size_t idx, enum counter_signal_polarity pol)
{}

static int ecap_cnt_cap_read(struct counter_device *counter,
			     struct counter_count *count,
			     size_t idx, u64 *cap)
{}

static int ecap_cnt_cap_write(struct counter_device *counter,
			      struct counter_count *count,
			      size_t idx, u64 cap)
{}

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

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

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

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

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

static const struct counter_ops ecap_cnt_ops =;

static const enum counter_function ecap_cnt_functions[] =;

static const enum counter_synapse_action ecap_cnt_clock_actions[] =;

static const enum counter_synapse_action ecap_cnt_input_actions[] =;

static struct counter_comp ecap_cnt_clock_ext[] =;

static const enum counter_signal_polarity ecap_cnt_pol_avail[] =;

static DEFINE_COUNTER_AVAILABLE(ecap_cnt_pol_available, ecap_cnt_pol_avail);
static DEFINE_COUNTER_ARRAY_POLARITY(ecap_cnt_pol_array, ecap_cnt_pol_available, ECAP_NB_CEVT);

static struct counter_comp ecap_cnt_signal_ext[] =;

static struct counter_signal ecap_cnt_signals[] =;

static struct counter_synapse ecap_cnt_synapses[] =;

static DEFINE_COUNTER_ARRAY_CAPTURE(ecap_cnt_cap_array, ECAP_NB_CEVT);

static struct counter_comp ecap_cnt_count_ext[] =;

static struct counter_count ecap_cnt_counts[] =;

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

static void ecap_cnt_pm_disable(void *dev)
{}

static int ecap_cnt_probe(struct platform_device *pdev)
{}

static void ecap_cnt_remove(struct platform_device *pdev)
{}

static int ecap_cnt_suspend(struct device *dev)
{}

static int ecap_cnt_resume(struct device *dev)
{}

static DEFINE_SIMPLE_DEV_PM_OPS(ecap_cnt_pm_ops, ecap_cnt_suspend, ecap_cnt_resume);

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

static struct platform_driver ecap_cnt_driver =;
module_platform_driver();

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