linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kalle Jokiniemi <kalle.jokiniemi@jolla.com>
To: dmitry.torokhov@gmail.com
Cc: linux-input@vger.kernel.org
Subject: Re: [PATCH 1/1] input: ff-memless: Allow negative attack / fade ramps
Date: Fri, 28 Aug 2015 17:04:21 +0300	[thread overview]
Message-ID: <55E06A65.3060001@jolla.com> (raw)
In-Reply-To: <1440673422-12279-2-git-send-email-kalle.jokiniemi@jolla.com>

Hi,

Please disregard this patch, the math doesn't really change with this. I 
need to dig deeper what really was the issue, as I could see the 
negative ramp not working.

- Kalle

On 27.08.2015 14:03, Kalle Jokiniemi wrote:
> Currently the ff-memless force feedback periodic effects can only
> have rising attack periods and declining fade periods. E.g. setting
> a attack ramp that starts high to lower to normal magnitude, will
> just cause the effect to rumble at high static speed for duration
> of the attack period and then abruptly lower back to normal
> magnitude instead of linearly declining the effect during attack
> phase.
>
> To fix this, a check has been added to see if the envelope_level
> of the attack or fade period is higher than default magnitude or
> vise versa, and then adjusting the difference value calculation
> accordingly.
>
> Signed-off-by: Kalle Jokiniemi <kalle.jokiniemi@jolla.com>
> ---
>   drivers/input/ff-memless.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/input/ff-memless.c b/drivers/input/ff-memless.c
> index 0723e0d..487df7e 100644
> --- a/drivers/input/ff-memless.c
> +++ b/drivers/input/ff-memless.c
> @@ -190,7 +190,10 @@ static int apply_envelope(struct ml_effect_state *state, int value,
>   	} else
>   		return value;
>
> -	difference = abs(value) - envelope_level;
> +	if (abs(value) >= envelope_level)
> +		difference = abs(value) - envelope_level;
> +	else
> +		difference = -(envelope_level - abs(value));
>
>   	pr_debug("difference = %d\n", difference);
>   	pr_debug("time_from_level = 0x%x\n", time_from_level);
>

  reply	other threads:[~2015-08-28 14:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-27 11:03 [PATCH 0/1] Allow negative attack/fade ramps Kalle Jokiniemi
2015-08-27 11:03 ` [PATCH 1/1] input: ff-memless: Allow negative attack / fade ramps Kalle Jokiniemi
2015-08-28 14:04   ` Kalle Jokiniemi [this message]
2015-08-28 14:41     ` Kalle Jokiniemi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55E06A65.3060001@jolla.com \
    --to=kalle.jokiniemi@jolla.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).