linux/drivers/input/ff-memless.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *  Force feedback support for memoryless devices
 *
 *  Copyright (c) 2006 Anssi Hannula <[email protected]>
 *  Copyright (c) 2006 Dmitry Torokhov <[email protected]>
 */

/* #define DEBUG */

#define pr_fmt(fmt)

#include <linux/slab.h>
#include <linux/input.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/spinlock.h>
#include <linux/jiffies.h>
#include <linux/fixp-arith.h>

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

/* Number of effects handled with memoryless devices */
#define FF_MEMLESS_EFFECTS

/* Envelope update interval in ms */
#define FF_ENVELOPE_INTERVAL

#define FF_EFFECT_STARTED
#define FF_EFFECT_PLAYING
#define FF_EFFECT_ABORTING

struct ml_effect_state {};

struct ml_device {};

static const struct ff_envelope *get_envelope(const struct ff_effect *effect)
{}

/*
 * Check for the next time envelope requires an update on memoryless devices
 */
static unsigned long calculate_next_time(struct ml_effect_state *state)
{}

static void ml_schedule_timer(struct ml_device *ml)
{}

/*
 * Apply an envelope to a value
 */
static int apply_envelope(struct ml_effect_state *state, int value,
			  struct ff_envelope *envelope)
{}

/*
 * Return the type the effect has to be converted into (memless devices)
 */
static int get_compatible_type(struct ff_device *ff, int effect_type)
{}

/*
 * Only left/right direction should be used (under/over 0x8000) for
 * forward/reverse motor direction (to keep calculation fast & simple).
 */
static u16 ml_calculate_direction(u16 direction, u16 force,
				  u16 new_direction, u16 new_force)
{}

#define FRAC_N
static inline s16 fixp_new16(s16 a)
{}

static inline s16 fixp_mult(s16 a, s16 b)
{}

/*
 * Combine two effects and apply gain.
 */
static void ml_combine_effects(struct ff_effect *effect,
			       struct ml_effect_state *state,
			       int gain)
{}


/*
 * Because memoryless devices have only one effect per effect type active
 * at one time we have to combine multiple effects into one
 */
static int ml_get_combo_effect(struct ml_device *ml,
			       unsigned long *effect_handled,
			       struct ff_effect *combo_effect)
{}

static void ml_play_effects(struct ml_device *ml)
{}

static void ml_effect_timer(struct timer_list *t)
{}

/*
 * Sets requested gain for FF effects. Called with dev->event_lock held.
 */
static void ml_ff_set_gain(struct input_dev *dev, u16 gain)
{}

/*
 * Start/stop specified FF effect. Called with dev->event_lock held.
 */
static int ml_ff_playback(struct input_dev *dev, int effect_id, int value)
{}

static int ml_ff_upload(struct input_dev *dev,
			struct ff_effect *effect, struct ff_effect *old)
{}

static void ml_ff_destroy(struct ff_device *ff)
{}

/**
 * input_ff_create_memless() - create memoryless force-feedback device
 * @dev: input device supporting force-feedback
 * @data: driver-specific data to be passed into @play_effect
 * @play_effect: driver-specific method for playing FF effect
 */
int input_ff_create_memless(struct input_dev *dev, void *data,
		int (*play_effect)(struct input_dev *, void *, struct ff_effect *))
{}
EXPORT_SYMBOL_GPL();