@@ -21,8 +21,7 @@ MODULE_VERSION(XPADNEO_VERSION);
2121
2222static u8 param_trigger_rumble_mode = 0 ;
2323module_param_named (trigger_rumble_mode , param_trigger_rumble_mode , byte , 0644 );
24- MODULE_PARM_DESC (trigger_rumble_mode ,
25- "(u8) Trigger rumble mode. 0: pressure, 1: directional (deprecated), 2: disable." );
24+ MODULE_PARM_DESC (trigger_rumble_mode , "(u8) Trigger rumble mode. 0: pressure, 2: disable." );
2625
2726static u8 param_rumble_attenuation [2 ];
2827module_param_array_named (rumble_attenuation , param_rumble_attenuation , byte , NULL , 0644 );
@@ -268,18 +267,10 @@ static void xpadneo_ff_worker(struct work_struct *work)
268267#define update_magnitude (m , v ) m = (v) > 0 ? max(m, v) : 0
269268static int xpadneo_ff_play (struct input_dev * dev , void * data , struct ff_effect * effect )
270269{
271- enum {
272- DIRECTION_DOWN = 0x0000UL ,
273- DIRECTION_LEFT = 0x4000UL ,
274- DIRECTION_UP = 0x8000UL ,
275- DIRECTION_RIGHT = 0xC000UL ,
276- QUARTER = DIRECTION_LEFT ,
277- };
278-
279270 unsigned long flags , ff_run_at , ff_throttle_until ;
280271 long delay_work ;
281272 int fraction_TL , fraction_TR , fraction_MAIN , percent_TRIGGERS , percent_MAIN ;
282- s32 weak , strong , direction , max_main ;
273+ s32 weak , strong , max_main ;
283274
284275 struct hid_device * hdev = input_get_drvdata (dev );
285276 struct xpadneo_devdata * xdata = hid_get_drvdata (hdev );
@@ -300,71 +291,17 @@ static int xpadneo_ff_play(struct input_dev *dev, void *data, struct ff_effect *
300291 percent_TRIGGERS = percent_TRIGGERS * percent_MAIN / 100 ;
301292
302293 switch (param_trigger_rumble_mode ) {
303- case PARAM_TRIGGER_RUMBLE_DIRECTIONAL :
304- /*
305- * scale the main rumble lineary within each half of the cirlce,
306- * so we can completely turn off the main rumble while still doing
307- * trigger rumble alone
308- */
309- direction = effect -> direction ;
310- if (direction <= DIRECTION_UP ) {
311- /* scale the main rumbling between 0x0000..0x8000 (100%..0%) */
312- fraction_MAIN = ((DIRECTION_UP - direction ) * percent_MAIN ) / DIRECTION_UP ;
313- } else {
314- /* scale the main rumbling between 0x8000..0xffff (0%..100%) */
315- fraction_MAIN = ((direction - DIRECTION_UP ) * percent_MAIN ) / DIRECTION_UP ;
316- }
317-
318- /*
319- * scale the trigger rumble lineary within each quarter:
320- * _ _
321- * LT = / \
322- * RT = _ / \ _
323- * 1 2 3 4
324- *
325- * This gives us 4 different modes of operation (with smooth transitions)
326- * to get a mostly somewhat independent control over each motor:
327- *
328- * DOWN .. LEFT .. UP .. RGHT .. DOWN
329- * left rumble = 0% .. 100% .. 100% .. 0% .. 0%
330- * right rumble = 0% .. 0% .. 100% .. 100% .. 0%
331- * main rumble = 100% .. 50% .. 0% .. 50% .. 100%
332- *
333- * For completely independent control, we'd need a sphere instead of a
334- * circle but we only have one direction. We could decouple the
335- * direction from the main rumble but that seems to be outside the spec
336- * of the rumble protocol (direction without any magnitude should do
337- * nothing).
338- */
339- if (direction <= DIRECTION_LEFT ) {
340- /* scale the left trigger between 0x0000..0x4000 (0%..100%) */
341- fraction_TL = (direction * percent_TRIGGERS ) / QUARTER ;
342- fraction_TR = 0 ;
343- } else if (direction <= DIRECTION_UP ) {
344- /* scale the right trigger between 0x4000..0x8000 (0%..100%) */
345- fraction_TL = 100 ;
346- fraction_TR = ((direction - DIRECTION_LEFT ) * percent_TRIGGERS ) / QUARTER ;
347- } else if (direction <= DIRECTION_RIGHT ) {
348- /* scale the right trigger between 0x8000..0xC000 (100%..0%) */
349- fraction_TL = 100 ;
350- fraction_TR = ((DIRECTION_RIGHT - direction ) * percent_TRIGGERS ) / QUARTER ;
351- } else {
352- /* scale the left trigger between 0xC000...0xFFFF (0..100%) */
353- fraction_TL =
354- 100 - ((direction - DIRECTION_RIGHT ) * percent_TRIGGERS ) / QUARTER ;
355- fraction_TR = 0 ;
356- }
294+ case PARAM_TRIGGER_RUMBLE_DISABLE :
295+ fraction_MAIN = percent_MAIN ;
296+ fraction_TL = 0 ;
297+ fraction_TR = 0 ;
357298 break ;
358299 case PARAM_TRIGGER_RUMBLE_PRESSURE :
300+ default :
359301 fraction_MAIN = percent_MAIN ;
360302 fraction_TL = (xdata -> last_abs_z * percent_TRIGGERS + 511 ) / 1023 ;
361303 fraction_TR = (xdata -> last_abs_rz * percent_TRIGGERS + 511 ) / 1023 ;
362304 break ;
363- default :
364- fraction_MAIN = percent_MAIN ;
365- fraction_TL = 0 ;
366- fraction_TR = 0 ;
367- break ;
368305 }
369306
370307 /*
@@ -1326,7 +1263,7 @@ static int __init xpadneo_init(void)
13261263 dbg_hid ("xpadneo:%s\n" , __func__ );
13271264
13281265 if (param_trigger_rumble_mode == 1 )
1329- pr_warn ("hid-xpadneo trigger_rumble_mode=1 is deprecated \n" );
1266+ pr_warn ("hid-xpadneo trigger_rumble_mode=1 is unknown, defaulting to 0 \n" );
13301267
13311268 xpadneo_rumble_wq = alloc_ordered_workqueue ("xpadneo/rumbled" , WQ_HIGHPRI );
13321269 if (xpadneo_rumble_wq ) {
0 commit comments