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)); }
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)); }
static ssize_t sec_therm_show_temperature(struct device *dev, struct device_attribute *attr, char *buf) { int adc; int temper; struct sec_therm_info *info = dev_get_drvdata(dev); adc = sec_therm_get_adc_data(info); temper = convert_adc_to_temper(info, adc); return sprintf(buf, "%d\n", temper); }
static ssize_t sec_therm_show_dcxo_temperature(struct device *dev, struct device_attribute *attr, char *buf) { struct sec_therm_info *info = dev_get_drvdata(dev); int adc, temp; adc = sec_therm_get_adc_data(info, DCXO_TEMP); if (adc < 0) return adc; else temp = convert_adc_to_temper(info, adc, DCXO_TEMP); return sprintf(buf, "%d\n", temp); }
static ssize_t sec_therm_show_temperature_flash_led(struct device *dev, struct device_attribute *attr, char *buf) { int adc; int temper; struct sec_therm_info *info = dev_get_drvdata(dev); adc = sec_therm_get_adc_data_flash_led(info); #if defined(CONFIG_MACH_HLTEDCM) || defined(CONFIG_MACH_HLTEKDI) temper = convert_adc_flash_to_temper(info, adc); #else temper = convert_adc_to_temper(info, adc); #endif dev_info(info->dev, "%s: adc_flash=%d\n", __func__, adc); return sprintf(buf, "%d\n", temper); }