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

Commit 52569265 authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "thermal: tsens: Add MTC support for SDM439"

parents a8cf392b 76a1ea55
Loading
Loading
Loading
Loading
+17 −2
Original line number Diff line number Diff line
@@ -191,17 +191,32 @@ static struct device_attribute tsens_mtc_dev_attr[] = {
	__ATTR(zonehist, 0644, zonehist_show, zonehist_store),
};

static struct device_attribute tsens_mtc_dev_attr_V14[] = {
	__ATTR(zonemask, 0644, zonemask_show, zonemask_store),
	__ATTR(zonelog, 0644, zonelog_show, zonelog_store),
};

static int tsens_dbg_mtc_data(struct tsens_device *data,
					u32 id, u32 dbg_type, int *val)
{
	int result = 0, i;
	struct tsens_device *tmdev = NULL;
	struct device_attribute *attr_ptr = NULL;
	u32 ver_major, ver_minor, num_elem;

	attr_ptr = tsens_mtc_dev_attr;
	tmdev = data;
	ver_major = tmdev->ctrl_data->ver_major;
	ver_minor = tmdev->ctrl_data->ver_minor;

	if (ver_major == 1 && ver_minor == 4) {
		attr_ptr = tsens_mtc_dev_attr_V14;
		num_elem = ARRAY_SIZE(tsens_mtc_dev_attr_V14);
	} else {
		attr_ptr = tsens_mtc_dev_attr;
		num_elem = ARRAY_SIZE(tsens_mtc_dev_attr);
	}

	for (i = 0; i < ARRAY_SIZE(tsens_mtc_dev_attr); i++) {
	for (i = 0; i < num_elem; i++) {
		result = device_create_file(&tmdev->pdev->dev, &attr_ptr[i]);
		if (result < 0)
			goto error;
+18 −3
Original line number Diff line number Diff line
@@ -76,6 +76,7 @@ int tsens_set_mtc_zone_sw_mask(unsigned int zone, unsigned int th1_enable,
	unsigned int reg_cntl;
	void __iomem *sensor_addr;
	struct tsens_device *tmdev = NULL;
	u32 ver_major, ver_minor;

	if (zone > TSENS_NUM_MTC_ZONES_SUPPORT)
		return -EINVAL;
@@ -86,8 +87,16 @@ int tsens_set_mtc_zone_sw_mask(unsigned int zone, unsigned int th1_enable,
		return -EPROBE_DEFER;
	}

	ver_major = tmdev->ctrl_data->ver_major;
	ver_minor = tmdev->ctrl_data->ver_minor;

	if (ver_major == 1 && ver_minor == 4) {
		sensor_addr = TSENS_TM_MTC_ZONE0_SW_MASK_ADDR_V14
			(tmdev->tsens_tm_addr);
	} else {
		sensor_addr = TSENS_TM_MTC_ZONE0_SW_MASK_ADDR
			(tmdev->tsens_tm_addr);
	}

	if (th1_enable && th2_enable)
		writel_relaxed(TSENS_MTC_IN_EFFECT,
@@ -120,6 +129,7 @@ int tsens_get_mtc_zone_log(unsigned int zone, void *zone_log)
	int *zlog = (int *)zone_log;
	void __iomem *sensor_addr;
	struct tsens_device *tmdev = NULL;
	u32 ver_major, ver_minor;

	if (zone > TSENS_NUM_MTC_ZONES_SUPPORT)
		return -EINVAL;
@@ -130,8 +140,13 @@ int tsens_get_mtc_zone_log(unsigned int zone, void *zone_log)
		return -EPROBE_DEFER;
	}

	sensor_addr = TSENS_TM_MTC_ZONE0_LOG(tmdev->tsens_tm_addr);
	ver_major = tmdev->ctrl_data->ver_major;
	ver_minor = tmdev->ctrl_data->ver_minor;

	if (ver_major == 1 && ver_minor == 4)
		sensor_addr = TSENS_TM_MTC_ZONE0_LOG_V14(tmdev->tsens_tm_addr);
	else
		sensor_addr = TSENS_TM_MTC_ZONE0_LOG(tmdev->tsens_tm_addr);
	reg_cntl = readl_relaxed((sensor_addr +
				(zone * TSENS_SN_ADDR_OFFSET)));
	is_valid = (reg_cntl & TSENS_LOGS_VALID_MASK)
+3 −0
Original line number Diff line number Diff line
@@ -15,6 +15,9 @@
#define TSENS_TM_MTC_ZONE0_SW_MASK_ADDR(n)      ((n) + 0x140)
#define TSENS_TM_MTC_ZONE0_LOG(n)               ((n) + 0x150)
#define TSENS_TM_MTC_ZONE0_HISTORY(n)           ((n) + 0x160)
#define TSENS_TM_MTC_ZONE0_SW_MASK_ADDR_V14(n)  ((n) + 0xC0)
#define TSENS_TM_MTC_ZONE0_LOG_V14(n)           ((n) + 0xD0)

#define TSENS_SN_ADDR_OFFSET             0x4
#define TSENS_RESET_HISTORY_MASK        0x4
#define TSENS_ZONEMASK_PARAMS           3
+4 −0
Original line number Diff line number Diff line
@@ -494,6 +494,8 @@ const struct tsens_data data_tsens14xx = {
	.ops = &ops_tsens1xxx,
	.valid_status_check = true,
	.mtc = true,
	.ver_major = 1,
	.ver_minor = 4,
};

static const struct tsens_ops ops_tsens1xxx_405 = {
@@ -510,4 +512,6 @@ const struct tsens_data data_tsens14xx_405 = {
	.ops = &ops_tsens1xxx_405,
	.valid_status_check = true,
	.mtc = true,
	.ver_major = 1,
	.ver_minor = 4,
};