static int omap_set_temp_thresh(struct thermal_dev *tdev, int min, int max)
{
	struct platform_device *pdev = to_platform_device(tdev->dev);
	struct scm *scm_ptr = platform_get_drvdata(pdev);
	int ret, t_cold, t_hot, thresh_val, hot, cold;
	int id = tdev->sen_id;
	struct omap4460plus_temp_sensor_registers *tsr;

	tsr = scm_ptr->registers[id];
	t_cold = temp_to_adc_conversion(min, scm_ptr, id);
	t_hot = temp_to_adc_conversion(max, scm_ptr, id);

	thresh_val = omap4plus_scm_readl(scm_ptr, tsr->bgap_threshold);
	hot = (thresh_val & tsr->threshold_thot_mask) >>
		__ffs(tsr->threshold_thot_mask);
	cold = (thresh_val & tsr->threshold_tcold_mask) >>
			__ffs(tsr->threshold_tcold_mask);

	if (t_hot < cold) {
		ret = omap4460plus_scm_set_temp_max_hyst(scm_ptr, id, min);
		ret = omap4460plus_scm_set_temp_max(scm_ptr, id, max);
	} else {
		ret = omap4460plus_scm_set_temp_max(scm_ptr, id, max);
		ret = omap4460plus_scm_set_temp_max_hyst(scm_ptr, id, min);
	}

	return ret;
}
static ssize_t set_temp_max(struct device *dev,
			    struct device_attribute *devattr,
			    const char *buf, size_t count)
{
	struct temp_sensor_hwmon *tsh = dev_get_drvdata(dev);
	struct platform_device *pdev = container_of(dev,
						struct platform_device, dev);
	int id = pdev->id, ret;
	long val;

	if (strict_strtol(buf, 10, &val))
		return -EINVAL;
	ret = omap4460plus_scm_set_temp_max(tsh->scm_ptr, id, val);
	if (ret < 0)
		return ret;

	return count;
}