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

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

Merge "thermal: tsens: Update debug capability for Tsens"

parents 685de955 53bbee09
Loading
Loading
Loading
Loading
+18 −16
Original line number Diff line number Diff line
@@ -802,10 +802,6 @@ struct tsens_tm_device_sensor {
	int				calib_data_point2;
	uint32_t			slope_mul_tsens_factor;
	struct tsens_thrshld_state	debug_thr_state_copy;
	/* dbg_adc_code logs either the raw ADC code or temperature values in
	 * decidegC based on the controller settings.
	 */
	int				dbg_adc_code;
	u32				wa_temp1_calib_offset_factor;
	u32				wa_temp2_calib_offset_factor;
};
@@ -821,6 +817,7 @@ struct tsens_sensor_dbg_info {
	uint32_t			idx;
	unsigned long long		time_stmp[10];
	int				adccode[10];
	unsigned int			sx_status_reg[10];
};

struct tsens_mtc_sysfs {
@@ -862,6 +859,7 @@ struct tsens_tm_device {
	struct tsens_mtc_sysfs		mtcsys;
	spinlock_t			tsens_crit_lock;
	spinlock_t			tsens_upp_low_lock;
	spinlock_t			tsens_debug_lock;
	bool				crit_set;
	struct tsens_dbg_counter	crit_timestamp_last_run;
	struct tsens_dbg_counter	crit_timestamp_last_interrupt_handled;
@@ -1392,7 +1390,8 @@ static int msm_tsens_get_temp(int sensor_client_id, unsigned long *temp)
	bool last_temp_valid = false, last_temp2_valid = false;
	bool last_temp3_valid = false;
	struct tsens_tm_device *tmdev = NULL;
	uint32_t sensor_hw_num = 0;
	uint32_t sensor_hw_num = 0, idx = 0;
	unsigned long flags;

	tmdev = get_tsens_controller_for_client_id(sensor_client_id);
	if (tmdev == NULL) {
@@ -1494,7 +1493,18 @@ static int msm_tsens_get_temp(int sensor_client_id, unsigned long *temp)
		*temp = last_temp;
	}

	tmdev->sensor[sensor_hw_num].dbg_adc_code = last_temp;
	spin_lock_irqsave(&tmdev->tsens_debug_lock, flags);
	idx = tmdev->sensor_dbg_info[sensor_hw_num].idx;
	tmdev->sensor_dbg_info[sensor_hw_num].temp[idx%10] = *temp;
	tmdev->sensor_dbg_info[sensor_hw_num].time_stmp[idx%10] =
					sched_clock();
	tmdev->sensor_dbg_info[sensor_hw_num].adccode[idx%10] =
			last_temp;
	tmdev->sensor_dbg_info[sensor_hw_num].sx_status_reg[idx%10] =
			code;
	idx++;
	tmdev->sensor_dbg_info[sensor_hw_num].idx = idx;
	spin_unlock_irqrestore(&tmdev->tsens_debug_lock, flags);

	trace_tsens_read(*temp, sensor_client_id);

@@ -1506,7 +1516,6 @@ static int tsens_tz_get_temp(struct thermal_zone_device *thermal,
{
	struct tsens_tm_device_sensor *tm_sensor = thermal->devdata;
	struct tsens_tm_device *tmdev = NULL;
	uint32_t idx = 0;
	int rc = 0;

	if (!tm_sensor || !temp)
@@ -1520,15 +1529,6 @@ static int tsens_tz_get_temp(struct thermal_zone_device *thermal,
	if (rc)
		return rc;

	idx = tmdev->sensor_dbg_info[tm_sensor->sensor_hw_num].idx;
	tmdev->sensor_dbg_info[tm_sensor->sensor_hw_num].temp[idx%10] = *temp;
	tmdev->sensor_dbg_info[tm_sensor->sensor_hw_num].time_stmp[idx%10] =
					sched_clock();
	tmdev->sensor_dbg_info[tm_sensor->sensor_hw_num].adccode[idx%10] =
			tmdev->sensor[tm_sensor->sensor_hw_num].dbg_adc_code;
	idx++;
	tmdev->sensor_dbg_info[tm_sensor->sensor_hw_num].idx = idx;

	return 0;
}

@@ -5764,6 +5764,8 @@ static int tsens_tm_probe(struct platform_device *pdev)

	spin_lock_init(&tmdev->tsens_crit_lock);
	spin_lock_init(&tmdev->tsens_upp_low_lock);
	spin_lock_init(&tmdev->tsens_debug_lock);

	tmdev->is_ready = true;

	list_add_tail(&tmdev->list, &tsens_device_list);