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

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

Merge "msm: lmh_lite: check intensity value before enabling interrupt"

parents e1a17caa aba49717
Loading
Loading
Loading
Loading
+25 −4
Original line number Diff line number Diff line
@@ -111,7 +111,10 @@ static int lmh_read(struct lmh_sensor_ops *ops, long *val)
	struct lmh_sensor_data *lmh_sensor = container_of(ops,
		       struct lmh_sensor_data, ops);

	mutex_lock(&lmh_sensor_read);
	*val = lmh_sensor->last_read_value;
	mutex_unlock(&lmh_sensor_read);

	return 0;
}

@@ -183,6 +186,7 @@ enable_exit:
static int lmh_reset(struct lmh_sensor_ops *ops)
{
	int ret = 0;
	struct lmh_sensor_data *lmh_iter_sensor = NULL;
	struct lmh_sensor_data *lmh_sensor = container_of(ops,
		       struct lmh_sensor_data, ops);

@@ -202,8 +206,25 @@ static int lmh_reset(struct lmh_sensor_ops *ops)
		goto reset_exit;
	}

	if (!lmh_data->intr_status_val) {
		/* Scan through the sensor list and abort the interrupt
		 * enable if any of the sensor is still throttling */
		list_for_each_entry(lmh_iter_sensor, &lmh_sensor_list,
			list_ptr) {
			if (lmh_iter_sensor->last_read_value) {
				pr_debug("Sensor:[%s] retrigger interrupt\n",
					lmh_iter_sensor->sensor_name);
				lmh_data->intr_status_val
					|= BIT(lmh_iter_sensor->sensor_sw_id);
				lmh_iter_sensor->state = LMH_ISR_POLLING;
				lmh_iter_sensor->ops.interrupt_notify(
					&lmh_iter_sensor->ops,
					lmh_iter_sensor->last_read_value);
			}
		}
		if (!lmh_data->intr_status_val)
			lmh_data->intr_state = LMH_ISR_MONITOR;
	}

reset_exit:
	up_write(&lmh_sensor_access);
@@ -232,6 +253,8 @@ static void lmh_read_and_update(struct lmh_driver_data *lmh_dat)


	mutex_lock(&lmh_sensor_read);
	list_for_each_entry(lmh_sensor, &lmh_sensor_list, list_ptr)
		lmh_sensor->last_read_value = 0;
	payload.count = 0;
	desc_arg.args[0] = cmd_buf.addr = SCM_BUFFER_PHYS(&payload);
	desc_arg.args[1] = cmd_buf.size
@@ -254,8 +277,6 @@ static void lmh_read_and_update(struct lmh_driver_data *lmh_dat)
		goto read_exit;
	}

	list_for_each_entry(lmh_sensor, &lmh_sensor_list, list_ptr)
		lmh_sensor->last_read_value = 0;
	for (idx = 0; idx < payload.count; idx++) {
		list_for_each_entry(lmh_sensor, &lmh_sensor_list, list_ptr) {