|
@@ -197,13 +197,16 @@ static unsigned char find_button(struct iforce *iforce, signed short button)
|
|
* Analyse the changes in an effect, and tell if we need to send an condition
|
|
* Analyse the changes in an effect, and tell if we need to send an condition
|
|
* parameter packet
|
|
* parameter packet
|
|
*/
|
|
*/
|
|
-static int need_condition_modifier(struct ff_effect *old, struct ff_effect *new)
|
|
|
|
|
|
+static int need_condition_modifier(struct iforce *iforce,
|
|
|
|
+ struct ff_effect *old,
|
|
|
|
+ struct ff_effect *new)
|
|
{
|
|
{
|
|
int ret = 0;
|
|
int ret = 0;
|
|
int i;
|
|
int i;
|
|
|
|
|
|
if (new->type != FF_SPRING && new->type != FF_FRICTION) {
|
|
if (new->type != FF_SPRING && new->type != FF_FRICTION) {
|
|
- warn("bad effect type in need_condition_modifier");
|
|
|
|
|
|
+ dev_warn(&iforce->dev->dev, "bad effect type in %s\n",
|
|
|
|
+ __func__);
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -222,10 +225,13 @@ static int need_condition_modifier(struct ff_effect *old, struct ff_effect *new)
|
|
* Analyse the changes in an effect, and tell if we need to send a magnitude
|
|
* Analyse the changes in an effect, and tell if we need to send a magnitude
|
|
* parameter packet
|
|
* parameter packet
|
|
*/
|
|
*/
|
|
-static int need_magnitude_modifier(struct ff_effect *old, struct ff_effect *effect)
|
|
|
|
|
|
+static int need_magnitude_modifier(struct iforce *iforce,
|
|
|
|
+ struct ff_effect *old,
|
|
|
|
+ struct ff_effect *effect)
|
|
{
|
|
{
|
|
if (effect->type != FF_CONSTANT) {
|
|
if (effect->type != FF_CONSTANT) {
|
|
- warn("bad effect type in need_envelope_modifier");
|
|
|
|
|
|
+ dev_warn(&iforce->dev->dev, "bad effect type in %s\n",
|
|
|
|
+ __func__);
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -236,7 +242,8 @@ static int need_magnitude_modifier(struct ff_effect *old, struct ff_effect *effe
|
|
* Analyse the changes in an effect, and tell if we need to send an envelope
|
|
* Analyse the changes in an effect, and tell if we need to send an envelope
|
|
* parameter packet
|
|
* parameter packet
|
|
*/
|
|
*/
|
|
-static int need_envelope_modifier(struct ff_effect *old, struct ff_effect *effect)
|
|
|
|
|
|
+static int need_envelope_modifier(struct iforce *iforce, struct ff_effect *old,
|
|
|
|
+ struct ff_effect *effect)
|
|
{
|
|
{
|
|
switch (effect->type) {
|
|
switch (effect->type) {
|
|
case FF_CONSTANT:
|
|
case FF_CONSTANT:
|
|
@@ -256,7 +263,8 @@ static int need_envelope_modifier(struct ff_effect *old, struct ff_effect *effec
|
|
break;
|
|
break;
|
|
|
|
|
|
default:
|
|
default:
|
|
- warn("bad effect type in need_envelope_modifier");
|
|
|
|
|
|
+ dev_warn(&iforce->dev->dev, "bad effect type in %s\n",
|
|
|
|
+ __func__);
|
|
}
|
|
}
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
@@ -266,10 +274,12 @@ static int need_envelope_modifier(struct ff_effect *old, struct ff_effect *effec
|
|
* Analyse the changes in an effect, and tell if we need to send a periodic
|
|
* Analyse the changes in an effect, and tell if we need to send a periodic
|
|
* parameter effect
|
|
* parameter effect
|
|
*/
|
|
*/
|
|
-static int need_period_modifier(struct ff_effect *old, struct ff_effect *new)
|
|
|
|
|
|
+static int need_period_modifier(struct iforce *iforce, struct ff_effect *old,
|
|
|
|
+ struct ff_effect *new)
|
|
{
|
|
{
|
|
if (new->type != FF_PERIODIC) {
|
|
if (new->type != FF_PERIODIC) {
|
|
- warn("bad effect type in need_period_modifier");
|
|
|
|
|
|
+ dev_warn(&iforce->dev->dev, "bad effect type in %s\n",
|
|
|
|
+ __func__);
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
return (old->u.periodic.period != new->u.periodic.period
|
|
return (old->u.periodic.period != new->u.periodic.period
|
|
@@ -355,7 +365,7 @@ int iforce_upload_periodic(struct iforce *iforce, struct ff_effect *effect, stru
|
|
int param2_err = 1;
|
|
int param2_err = 1;
|
|
int core_err = 0;
|
|
int core_err = 0;
|
|
|
|
|
|
- if (!old || need_period_modifier(old, effect)) {
|
|
|
|
|
|
+ if (!old || need_period_modifier(iforce, old, effect)) {
|
|
param1_err = make_period_modifier(iforce, mod1_chunk,
|
|
param1_err = make_period_modifier(iforce, mod1_chunk,
|
|
old != NULL,
|
|
old != NULL,
|
|
effect->u.periodic.magnitude, effect->u.periodic.offset,
|
|
effect->u.periodic.magnitude, effect->u.periodic.offset,
|
|
@@ -365,7 +375,7 @@ int iforce_upload_periodic(struct iforce *iforce, struct ff_effect *effect, stru
|
|
set_bit(FF_MOD1_IS_USED, core_effect->flags);
|
|
set_bit(FF_MOD1_IS_USED, core_effect->flags);
|
|
}
|
|
}
|
|
|
|
|
|
- if (!old || need_envelope_modifier(old, effect)) {
|
|
|
|
|
|
+ if (!old || need_envelope_modifier(iforce, old, effect)) {
|
|
param2_err = make_envelope_modifier(iforce, mod2_chunk,
|
|
param2_err = make_envelope_modifier(iforce, mod2_chunk,
|
|
old !=NULL,
|
|
old !=NULL,
|
|
effect->u.periodic.envelope.attack_length,
|
|
effect->u.periodic.envelope.attack_length,
|
|
@@ -425,7 +435,7 @@ int iforce_upload_constant(struct iforce *iforce, struct ff_effect *effect, stru
|
|
int param2_err = 1;
|
|
int param2_err = 1;
|
|
int core_err = 0;
|
|
int core_err = 0;
|
|
|
|
|
|
- if (!old || need_magnitude_modifier(old, effect)) {
|
|
|
|
|
|
+ if (!old || need_magnitude_modifier(iforce, old, effect)) {
|
|
param1_err = make_magnitude_modifier(iforce, mod1_chunk,
|
|
param1_err = make_magnitude_modifier(iforce, mod1_chunk,
|
|
old != NULL,
|
|
old != NULL,
|
|
effect->u.constant.level);
|
|
effect->u.constant.level);
|
|
@@ -434,7 +444,7 @@ int iforce_upload_constant(struct iforce *iforce, struct ff_effect *effect, stru
|
|
set_bit(FF_MOD1_IS_USED, core_effect->flags);
|
|
set_bit(FF_MOD1_IS_USED, core_effect->flags);
|
|
}
|
|
}
|
|
|
|
|
|
- if (!old || need_envelope_modifier(old, effect)) {
|
|
|
|
|
|
+ if (!old || need_envelope_modifier(iforce, old, effect)) {
|
|
param2_err = make_envelope_modifier(iforce, mod2_chunk,
|
|
param2_err = make_envelope_modifier(iforce, mod2_chunk,
|
|
old != NULL,
|
|
old != NULL,
|
|
effect->u.constant.envelope.attack_length,
|
|
effect->u.constant.envelope.attack_length,
|
|
@@ -487,7 +497,7 @@ int iforce_upload_condition(struct iforce *iforce, struct ff_effect *effect, str
|
|
default: return -1;
|
|
default: return -1;
|
|
}
|
|
}
|
|
|
|
|
|
- if (!old || need_condition_modifier(old, effect)) {
|
|
|
|
|
|
+ if (!old || need_condition_modifier(iforce, old, effect)) {
|
|
param_err = make_condition_modifier(iforce, mod1_chunk,
|
|
param_err = make_condition_modifier(iforce, mod1_chunk,
|
|
old != NULL,
|
|
old != NULL,
|
|
effect->u.condition[0].right_saturation,
|
|
effect->u.condition[0].right_saturation,
|