static void sec_therm_polling_work(struct work_struct *work)
{
	struct sec_therm_info *info =
		container_of(work, struct sec_therm_info, polling_work.work);
	int adc;
	int temper;
#if defined(CONFIG_MACH_HLTEDCM) || defined(CONFIG_MACH_HLTEKDI) || \
	defined(CONFIG_MACH_JS01LTEDCM) || defined(CONFIG_MACH_KLTE_JPN) || \
	defined(CONFIG_MACH_KACTIVELTE_DCM)
	int temper_flash;
	int adc_flash;
#endif

	adc = sec_therm_get_adc_data(info);
	dev_info(info->dev, "%s: adc=%d\n", __func__, adc);

	if (adc < 0)
		goto out;

	temper = convert_adc_to_temper(info, adc);
	dev_info(info->dev, "%s: temper=%d\n", __func__, temper);

#if defined(CONFIG_MACH_HLTEDCM) || defined(CONFIG_MACH_HLTEKDI) || \
	defined(CONFIG_MACH_JS01LTEDCM) || defined(CONFIG_MACH_KLTE_JPN) || \
	defined(CONFIG_MACH_KACTIVELTE_DCM)
	adc_flash = sec_therm_get_adc_data_flash_led(info);
	dev_info(info->dev, "%s: adc_flash=%d\n", __func__, adc_flash);

	if (adc_flash < 0)
		goto out;

	#if defined(CONFIG_MACH_HLTEDCM) || defined(CONFIG_MACH_HLTEKDI)
	temper_flash= convert_adc_flash_to_temper(info, adc_flash);
	#else
	temper_flash= convert_adc_to_temper(info, adc_flash);
	#endif
	dev_info(info->dev, "%s: temper_flash=%d\n", __func__, temper_flash);

	/* if temperature was changed, notify to framework */
	if (info->curr_temperature != temper || info->curr_temperature_flash_led!= temper_flash) {
		info->curr_temp_adc = adc;
		info->curr_temperature = temper;

		info->curr_temp_adc_flash_led = adc_flash;
		info->curr_temperature_flash_led = temper_flash;
		notify_change_of_temperature(info);
	}
#else
	/* if temperature was changed, notify to framework */
	if (info->curr_temperature != temper) {
		info->curr_temp_adc = adc;
		info->curr_temperature = temper;
		notify_change_of_temperature(info);
	}
#endif

out:
	schedule_delayed_work(&info->polling_work,
			msecs_to_jiffies(info->pdata->polling_interval));
}
Exemplo n.º 2
0
static void sec_therm_polling_work(struct work_struct *work)
{
	struct sec_therm_info *info =
		container_of(work, struct sec_therm_info, polling_work.work);
	int adc;
	int temper;

	adc = sec_therm_get_adc_data(info);
	dev_dbg(info->dev, "%s: adc=%d\n", __func__, adc);

	if (adc < 0)
		goto out;

	temper = convert_adc_to_temper(info, adc);
	dev_dbg(info->dev, "%s: temper=%d\n", __func__, temper);

	/* if temperature was changed, notify to framework */
	if (info->curr_temperature != temper) {
		info->curr_temp_adc = adc;
		info->curr_temperature = temper;
		notify_change_of_temperature(info);
	}
out:
	schedule_delayed_work(&info->polling_work,
			msecs_to_jiffies(info->pdata->polling_interval));
}
Exemplo n.º 3
0
static ssize_t sec_therm_store_sioplevel(struct device *dev,
				   struct device_attribute *attr,
				   const char *buf, size_t n)
{
	unsigned int val;
	struct sec_therm_info *info = dev_get_drvdata(dev);

	if (sscanf(buf, "%u", &val) == 1)
		siopLevellimit = val;

	notify_change_of_temperature(info);

	return n;
}
static void sec_therm_polling_work(struct work_struct *work)
{
	struct sec_therm_info *info =
		container_of(work, struct sec_therm_info, polling_work.work);
	int adc;
	int temper;
	struct bcmpmu_adc_result adc_result;
	struct power_supply *ps;
	union power_supply_propval value;

	ps = power_supply_get_by_name("bcmpmu_charger");
	ps->get_property(ps, POWER_SUPPLY_PROP_BATT_TEMP_ADC, &value);

	adc = value.intval;
	dev_info(info->dev, "%s: PA_adc=%d\n", __func__, adc);

	if (adc < 0)
		goto out;
	sec_thermistor_bcmpmu_adc_read(bcmpmu_info, PMU_ADC_CHANN_BOM,
				PMU_ADC_REQ_SAR_MODE, &adc_result);
	adc = adc_result.raw;
	dev_info(info->dev, "%s: AP_adc=%d\n", __func__, adc);

	ps->get_property(ps, POWER_SUPPLY_PROP_TEMP, &value);
	temper = value.intval;

	dev_info(info->dev, "%s: PA_temper=%d\n", __func__, temper);

	sec_thermistor_bcmpmu_adc_read(bcmpmu_info, PMU_ADC_CHANN_BOM,
				PMU_ADC_REQ_SAR_MODE, &adc_result);

	temper = adc_result.conv;
	dev_info(info->dev, "%s: AP_temper=%d\n", __func__, temper);

	/* if temperature was changed, notify to framework */
	if (info->curr_temperature != temper) {
		info->curr_temp_adc = adc;
		info->curr_temperature = temper;
		notify_change_of_temperature(info);
	}

out:
	schedule_delayed_work(&info->polling_work,
			msecs_to_jiffies(info->pdata->polling_interval));
}