{
switch (eff->type) {
case FF_CONSTANT:
- return priv->memless_mode;
+ return priv->memless_constant;
case FF_PERIODIC:
return priv->memless_periodic;
case FF_RAMP:
eff->repeat = value;
if (value > 0) {
- if (priv->control_timing && ffpl_process_memless(priv, &eff->active))
+ if (ffpl_process_memless(priv, &eff->latest))
ffpl_calculate_trip_times(eff, now);
else
eff->start_at = now; /* Start the effect right away and let the device deal with the timing */
eff->change = FFPL_TO_UPDATE;
eff->trigger = FFPL_TRIG_UPDATE;
}
- } else
+ } else {
eff->change = FFPL_TO_UPLOAD;
+ eff->trigger = FFPL_TRIG_NOW;
+ }
spin_unlock_irq(&dev->event_lock);
klgd_unlock_plugins_sched(self->plugins_lock);
eff->trigger = FFPL_TRIG_RECALC;
break;
}
- if (eff->latest.replay.length && priv->control_timing && ffpl_process_memless(priv, &eff->latest))
+ if (eff->latest.replay.length && ffpl_process_memless(priv, &eff->latest))
eff->trigger = FFPL_TRIG_STOP;
else
eff->trigger = FFPL_TRIG_NONE;
case FFPL_TRIG_RECALC:
if (ffpl_needs_recalculation(priv, &eff->active, eff->start_at, eff->stop_at, now))
break;
- if (eff->active.replay.length && priv->control_timing && ffpl_process_memless(priv, &eff->active)) {
+ if (eff->active.replay.length && ffpl_process_memless(priv, &eff->active)) {
eff->trigger = FFPL_TRIG_STOP;
break;
}
eff->trigger = FFPL_TRIG_NONE;
break;
case FFPL_TRIG_STOP:
- if (eff->repeat > 0 && priv->control_timing && ffpl_process_memless(priv, &eff->active)) {
+ if (eff->repeat > 0 && ffpl_process_memless(priv, &eff->active)) {
eff->trigger = FFPL_TRIG_RESTART;
break;
}
priv->has_owr_to_srt = true;
printk("KLGDFF: Using REPLACE STARTED\n");
}
- if (FFPL_MEMLESS_MODE & flags) {
- priv->memless_mode = true;
- priv->control_timing = true;
+
+ if ((FFPL_MEMLESS_CONSTANT | FFPL_MEMLESS_PERIODIC | FFPL_MEMLESS_RAMP) & flags) {
+ if (!test_bit(FF_CONSTANT - FF_EFFECT_MIN, &priv->supported_effects)) {
+ printk(KERN_ERR "The driver asked for memless mode but the device does not support FF_CONSTANT\n");
+ ret = -EINVAL;
+ goto err_out2;
+ }
}
- if (FFPL_MEMLESS_PERIODIC & flags) {
- priv->memless_mode = true;
+
+ if (FFPL_MEMLESS_CONSTANT & flags)
+ priv->memless_constant = true;
+ if (FFPL_MEMLESS_PERIODIC & flags)
priv->memless_periodic = true;
- priv->control_timing = true;
- }
- if (FFPL_MEMLESS_RAMP & flags) {
- priv->memless_mode = true;
+ if (FFPL_MEMLESS_RAMP & flags)
priv->memless_ramp = true;
- priv->control_timing = true;
- }
- if (FFPL_CONTROL_TIMING & flags)
- priv->control_timing = true;
+
if (FFPL_HAS_NATIVE_GAIN & flags) {
priv->has_native_gain = true;
printk(KERN_NOTICE "KLGDFF: Using HAS_NATIVE_GAIN\n");
#define FFPL_REPLACE_UPLOADED BIT(4) /* Device can accept a new effect to UPLOADED state without the need to explicitly stop and erase the previously uploaded effect beforehand */
#define FFPL_REPLACE_STARTED BIT(5) /* Device can accept a new effect to STARTED state without the need to explicitly stop and erase the previously uploaded effect beforehand */
-#define FFPL_MEMLESS_MODE BIT(6) /* Device cannot process effects by itself and required KLGD-FF to do all calculations for it. */
+#define FFPL_MEMLESS_CONSTANT BIT(6) /* Device cannot process FF_CONSTANT by itself and requires KLGD-FF to calculate overall force.
+ Device must support FF_CONSTANT for this to work. */
#define FFPL_MEMLESS_PERIODIC BIT(7) /* Device cannot process FF_PERIODIC by itself and requires KLGD-FF to calculate the overall force.
- Device must support FF_CONSTANT for this to work.
- This flag implies FFPL_MEMLESS_MODE */
+ Device must support FF_CONSTANT for this to work. */
#define FFPL_MEMLESS_RAMP BIT(8) /* Device cannot process FF_RAMP by itself and requires KLGD-FF to calculate the overall force.
- Device must support FF_CONSTANT for this to work.
- This flag implies FFPL_MEMLESS_MODE */
-#define FFPL_CONTROL_TIMING BIT(9) /* Device cannot handle effects with finite duration, delays and repeated effects. Let KLGD-FF take care
- of starting, stopping and restarting effects at appropriate times.
- FFPL_MEMLESS_MODE implies this flag. */
+ Device must support FF_CONSTANT for this to work. */
#define FFPL_HAS_NATIVE_GAIN BIT(15) /* Device can adjust the gain by itself */
#define FFPL_HAS_AUTOCENTER BIT(16) /* Device supports autocentering */
input_set_abs_params(dev, ABS_Y, -0x7fff, 0x7fff, 0, 0);
ret = ffpl_init_plugin(&ff_plugin, dev, EFFECT_COUNT, ffbits,
- FFPL_HAS_EMP_TO_SRT | FFPL_REPLACE_STARTED | FFPL_HAS_AUTOCENTER | FFPL_MEMLESS_MODE,
+ FFPL_HAS_EMP_TO_SRT | FFPL_REPLACE_STARTED | FFPL_HAS_AUTOCENTER | FFPL_MEMLESS_RAMP,
klgdff_control, &test_user);
if (ret) {
printk(KERN_ERR "KLGDFF-TD: Cannot init plugin\n");