Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 12e7fdd9 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "input: qti-haptics: Add VMAX per effect setting"

parents a792a470 e3f000e4
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -130,6 +130,15 @@ waveforms/effects:
		 [5:1]: waveform amplitude
		 [0]: reserved.

- qcom,wf-vmax-mv
  Usage:      optional
  Value type: <u32>
  Definition: Specifies the maximum allowed output voltage in millivolts
		for this effect. Value specified here will be rounded
		off to the closest multiple of 116 mV. Allowed values:
		0 to 3596. If this is not specified, the value defined in
		"qcom,vmax-mv" will be applied.

- qcom,wf-play-rate-us
  Usage:      optional
  Value type: <u32>
+14 −4
Original line number Diff line number Diff line
@@ -175,6 +175,7 @@ struct qti_hap_effect {
	u8			*pattern;
	int			pattern_length;
	u16			play_rate_us;
	u16			vmax_mv;
	u8			wf_repeat_n;
	u8			wf_s_repeat_n;
	u8			brake[HAP_BRAKE_PATTERN_MAX];
@@ -829,10 +830,6 @@ static int qti_haptics_upload_effect(struct input_dev *dev,
			goto disable_vdd;
		}

		level = effect->u.periodic.magnitude;
		tmp = level * config->vmax_mv;
		play->vmax_mv = tmp / 0x7fff;

		if (copy_from_user(data, effect->u.periodic.custom_data,
					sizeof(s16) * CUSTOM_DATA_LEN)) {
			rc = -EFAULT;
@@ -851,6 +848,10 @@ static int qti_haptics_upload_effect(struct input_dev *dev,
			goto disable_vdd;
		}

		level = effect->u.periodic.magnitude;
		tmp = level * chip->predefined[i].vmax_mv;
		play->vmax_mv = tmp / 0x7fff;

		dev_dbg(chip->dev, "upload effect %d, vmax_mv=%d\n",
				chip->predefined[i].id, play->vmax_mv);
		rc = qti_haptics_load_predefined_effect(chip, i);
@@ -1253,6 +1254,15 @@ static int qti_haptics_parse_dt(struct qti_hap_chip *chip)
			return rc;
		}

		effect->vmax_mv = config->vmax_mv;
		rc = of_property_read_u32(child_node, "qcom,wf-vmax-mv", &tmp);
		if (rc < 0)
			dev_dbg(chip->dev, "Read qcom,wf-vmax-mv failed, rc=%d\n",
					rc);
		else
			effect->vmax_mv = (tmp > HAP_VMAX_MV_MAX) ?
				HAP_VMAX_MV_MAX : tmp;

		rc = of_property_count_elems_of_size(child_node,
				"qcom,wf-pattern", sizeof(u8));
		if (rc < 0) {