linux/drivers/counter/stm32-lptimer-cnt.c

// SPDX-License-Identifier: GPL-2.0
/*
 * STM32 Low-Power Timer Encoder and Counter driver
 *
 * Copyright (C) STMicroelectronics 2017
 *
 * Author: Fabrice Gasnier <[email protected]>
 *
 * Inspired by 104-quad-8 and stm32-timer-trigger drivers.
 *
 */

#include <linux/bitfield.h>
#include <linux/counter.h>
#include <linux/mfd/stm32-lptimer.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/pinctrl/consumer.h>
#include <linux/platform_device.h>
#include <linux/types.h>

struct stm32_lptim_cnt {};

static int stm32_lptim_is_enabled(struct stm32_lptim_cnt *priv)
{}

static int stm32_lptim_set_enable_state(struct stm32_lptim_cnt *priv,
					int enable)
{}

static int stm32_lptim_setup(struct stm32_lptim_cnt *priv, int enable)
{}

/*
 * In non-quadrature mode, device counts up on active edge.
 * In quadrature mode, encoder counting scenarios are as follows:
 * +---------+----------+--------------------+--------------------+
 * | Active  | Level on |      IN1 signal    |     IN2 signal     |
 * | edge    | opposite +----------+---------+----------+---------+
 * |         | signal   |  Rising  | Falling |  Rising  | Falling |
 * +---------+----------+----------+---------+----------+---------+
 * | Rising  | High ->  |   Down   |    -    |   Up     |    -    |
 * | edge    | Low  ->  |   Up     |    -    |   Down   |    -    |
 * +---------+----------+----------+---------+----------+---------+
 * | Falling | High ->  |    -     |   Up    |    -     |   Down  |
 * | edge    | Low  ->  |    -     |   Down  |    -     |   Up    |
 * +---------+----------+----------+---------+----------+---------+
 * | Both    | High ->  |   Down   |   Up    |   Up     |   Down  |
 * | edges   | Low  ->  |   Up     |   Down  |   Down   |   Up    |
 * +---------+----------+----------+---------+----------+---------+
 */
static const enum counter_function stm32_lptim_cnt_functions[] =;

static const enum counter_synapse_action stm32_lptim_cnt_synapse_actions[] =;

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

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

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

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

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

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

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

static struct counter_comp stm32_lptim_cnt_ext[] =;

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

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

static const struct counter_ops stm32_lptim_cnt_ops =;

static struct counter_signal stm32_lptim_cnt_signals[] =;

static struct counter_synapse stm32_lptim_cnt_synapses[] =;

/* LP timer with encoder */
static struct counter_count stm32_lptim_enc_counts =;

/* LP timer without encoder (counter only) */
static struct counter_count stm32_lptim_in1_counts =;

static int stm32_lptim_cnt_probe(struct platform_device *pdev)
{}

#ifdef CONFIG_PM_SLEEP
static int stm32_lptim_cnt_suspend(struct device *dev)
{}

static int stm32_lptim_cnt_resume(struct device *dev)
{}
#endif

static SIMPLE_DEV_PM_OPS(stm32_lptim_cnt_pm_ops, stm32_lptim_cnt_suspend,
			 stm32_lptim_cnt_resume);

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

static struct platform_driver stm32_lptim_cnt_driver =;
module_platform_driver();

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