Re: [PATCH V2 2/2] thermal: exynos: Use the framework for temperature emulation support

2013-02-07 Thread amit kachhap
Hi Rui,

Please merge this patch also. The 1st series of this patchset is
already accepted by you. This is just a adaptation of the earlier one
and does code cleanup.

Thanks,
Amit Daniel

On Sun, Feb 3, 2013 at 6:14 PM, Zhang Rui rui.zh...@intel.com wrote:
 On Sun, 2013-01-27 at 19:28 -0800, Amit Daniel Kachhap wrote:
 This removes the driver specific sysfs support of the temperature
 emulation and uses the newly added core thermal framework for thermal
 emulation. A platform specific handler is added to support this.

 Signed-off-by: Amit Daniel Kachhap amit.dan...@samsung.com
 Acked-by: Kukjin Kim kgene@samsung.com
 ---
 Changes in V2:
 * Added config option CONFIG_THERMAL_EMULATION instead of
  CONFIG_EXYNOS_THERMAL_EMUL

 This patchset is based on thermal maintainer next tree.
 git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux.git next

  Documentation/thermal/exynos_thermal_emulation |8 +-
  drivers/thermal/Kconfig|9 --
  drivers/thermal/exynos_thermal.c   |  158 
 ++--
  3 files changed, 67 insertions(+), 108 deletions(-)

 diff --git a/Documentation/thermal/exynos_thermal_emulation 
 b/Documentation/thermal/exynos_thermal_emulation
 index b73bbfb..36a3e79 100644
 --- a/Documentation/thermal/exynos_thermal_emulation
 +++ b/Documentation/thermal/exynos_thermal_emulation
 @@ -13,11 +13,11 @@ Thermal emulation mode supports software debug for TMU's 
 operation. User can set
  manually with software code and TMU will read current temperature from user 
 value not from
  sensor's value.

 -Enabling CONFIG_EXYNOS_THERMAL_EMUL option will make this support in 
 available.
 -When it's enabled, sysfs node will be created under
 -/sys/bus/platform/devices/'exynos device name'/ with name of 'emulation'.
 +Enabling CONFIG_THERMAL_EMULATION option will make this support available.
 +When it's enabled, sysfs node will be created as
 +/sys/devices/virtual/thermal/thermal_zone'zone id'/emul_temp.

 -The sysfs node, 'emulation', will contain value 0 for the initial state. 
 When you input any
 +The sysfs node, 'emul_node', will contain value 0 for the initial state. 
 When you input any
  temperature you want to update to sysfs node, it automatically enable 
 emulation mode and
  current temperature will be changed into it.
  (Exynos also supports user changable delay time which would be used to 
 delay of
 diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
 index e4cf7fb..2a79510 100644
 --- a/drivers/thermal/Kconfig
 +++ b/drivers/thermal/Kconfig
 @@ -109,15 +109,6 @@ config EXYNOS_THERMAL
 If you say yes here you get support for TMU (Thermal Management
 Unit) on SAMSUNG EXYNOS series of SoC.

 -config EXYNOS_THERMAL_EMUL
 - bool EXYNOS TMU emulation mode support
 - depends on EXYNOS_THERMAL
 - help
 -   Exynos 4412 and 4414 and 5 series has emulation mode on TMU.
 -   Enable this option will be make sysfs node in exynos thermal platform
 -   device directory to support emulation mode. With emulation mode sysfs
 -   node, you can manually input temperature to TMU for simulation 
 purpose.
 -
  config DB8500_THERMAL
   bool DB8500 thermal management
   depends on ARCH_U8500
 diff --git a/drivers/thermal/exynos_thermal.c 
 b/drivers/thermal/exynos_thermal.c
 index 327102a..afe9c2a 100644
 --- a/drivers/thermal/exynos_thermal.c
 +++ b/drivers/thermal/exynos_thermal.c
 @@ -99,13 +99,13 @@
  #define IDLE_INTERVAL 1
  #define MCELSIUS 1000

 -#ifdef CONFIG_EXYNOS_THERMAL_EMUL
 +#ifdef CONFIG_THERMAL_EMULATION
  #define EXYNOS_EMUL_TIME 0x57F0
  #define EXYNOS_EMUL_TIME_SHIFT   16
  #define EXYNOS_EMUL_DATA_SHIFT   8
  #define EXYNOS_EMUL_DATA_MASK0xFF
  #define EXYNOS_EMUL_ENABLE   0x1
 -#endif /* CONFIG_EXYNOS_THERMAL_EMUL */
 +#endif /* CONFIG_THERMAL_EMULATION */

  /* CPU Zone information */
  #define PANIC_ZONE  4
 @@ -143,6 +143,7 @@ structthermal_cooling_conf {
  struct thermal_sensor_conf {
   char name[SENSOR_NAME_LEN];
   int (*read_temperature)(void *data);
 + int (*write_emul_temp)(void *data, unsigned long temp);
   struct thermal_trip_point_conf trip_data;
   struct thermal_cooling_conf cooling_data;
   void *private_data;
 @@ -366,6 +367,23 @@ static int exynos_get_temp(struct thermal_zone_device 
 *thermal,
   return 0;
  }

 +/* Get temperature callback functions for thermal zone */
 +static int exynos_set_emul_temp(struct thermal_zone_device *thermal,
 + unsigned long temp)
 +{
 + void *data;
 + int ret = -EINVAL;
 +
 + if (!th_zone-sensor_conf) {
 + pr_info(Temperature sensor not initialised\n);
 + return -EINVAL;
 + }
 + data = th_zone-sensor_conf-private_data;
 + if (th_zone-sensor_conf-write_emul_temp)
 + ret = th_zone-sensor_conf-write_emul_temp(data, temp);
 + return ret;
 +}
 +

  /* Get 

Re: [PATCH V2 2/2] thermal: exynos: Use the framework for temperature emulation support

2013-02-07 Thread Zhang Rui
On Mon, 2013-02-04 at 10:14 +0800, Zhang Rui wrote:
 On Sun, 2013-01-27 at 19:28 -0800, Amit Daniel Kachhap wrote:
  This removes the driver specific sysfs support of the temperature
  emulation and uses the newly added core thermal framework for thermal
  emulation. A platform specific handler is added to support this.
  
  Signed-off-by: Amit Daniel Kachhap amit.dan...@samsung.com
  Acked-by: Kukjin Kim kgene@samsung.com
  ---
  Changes in V2:
  * Added config option CONFIG_THERMAL_EMULATION instead of
   CONFIG_EXYNOS_THERMAL_EMUL 
  
  This patchset is based on thermal maintainer next tree.
  git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux.git next 
  
   Documentation/thermal/exynos_thermal_emulation |8 +-
   drivers/thermal/Kconfig|9 --
   drivers/thermal/exynos_thermal.c   |  158 
  ++--
   3 files changed, 67 insertions(+), 108 deletions(-)
  
  diff --git a/Documentation/thermal/exynos_thermal_emulation 
  b/Documentation/thermal/exynos_thermal_emulation
  index b73bbfb..36a3e79 100644
  --- a/Documentation/thermal/exynos_thermal_emulation
  +++ b/Documentation/thermal/exynos_thermal_emulation
  @@ -13,11 +13,11 @@ Thermal emulation mode supports software debug for 
  TMU's operation. User can set
   manually with software code and TMU will read current temperature from 
  user value not from
   sensor's value.
   
  -Enabling CONFIG_EXYNOS_THERMAL_EMUL option will make this support in 
  available.
  -When it's enabled, sysfs node will be created under
  -/sys/bus/platform/devices/'exynos device name'/ with name of 'emulation'.
  +Enabling CONFIG_THERMAL_EMULATION option will make this support available.
  +When it's enabled, sysfs node will be created as
  +/sys/devices/virtual/thermal/thermal_zone'zone id'/emul_temp.
   
  -The sysfs node, 'emulation', will contain value 0 for the initial state. 
  When you input any
  +The sysfs node, 'emul_node', will contain value 0 for the initial state. 
  When you input any
   temperature you want to update to sysfs node, it automatically enable 
  emulation mode and
   current temperature will be changed into it.
   (Exynos also supports user changable delay time which would be used to 
  delay of
  diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
  index e4cf7fb..2a79510 100644
  --- a/drivers/thermal/Kconfig
  +++ b/drivers/thermal/Kconfig
  @@ -109,15 +109,6 @@ config EXYNOS_THERMAL
If you say yes here you get support for TMU (Thermal Management
Unit) on SAMSUNG EXYNOS series of SoC.
   
  -config EXYNOS_THERMAL_EMUL
  -   bool EXYNOS TMU emulation mode support
  -   depends on EXYNOS_THERMAL
  -   help
  - Exynos 4412 and 4414 and 5 series has emulation mode on TMU.
  - Enable this option will be make sysfs node in exynos thermal platform
  - device directory to support emulation mode. With emulation mode sysfs
  - node, you can manually input temperature to TMU for simulation 
  purpose.
  -
   config DB8500_THERMAL
  bool DB8500 thermal management
  depends on ARCH_U8500
  diff --git a/drivers/thermal/exynos_thermal.c 
  b/drivers/thermal/exynos_thermal.c
  index 327102a..afe9c2a 100644
  --- a/drivers/thermal/exynos_thermal.c
  +++ b/drivers/thermal/exynos_thermal.c
  @@ -99,13 +99,13 @@
   #define IDLE_INTERVAL 1
   #define MCELSIUS   1000
   
  -#ifdef CONFIG_EXYNOS_THERMAL_EMUL
  +#ifdef CONFIG_THERMAL_EMULATION
   #define EXYNOS_EMUL_TIME   0x57F0
   #define EXYNOS_EMUL_TIME_SHIFT 16
   #define EXYNOS_EMUL_DATA_SHIFT 8
   #define EXYNOS_EMUL_DATA_MASK  0xFF
   #define EXYNOS_EMUL_ENABLE 0x1
  -#endif /* CONFIG_EXYNOS_THERMAL_EMUL */
  +#endif /* CONFIG_THERMAL_EMULATION */
   
   /* CPU Zone information */
   #define PANIC_ZONE  4
  @@ -143,6 +143,7 @@ struct  thermal_cooling_conf {
   struct thermal_sensor_conf {
  char name[SENSOR_NAME_LEN];
  int (*read_temperature)(void *data);
  +   int (*write_emul_temp)(void *data, unsigned long temp);
  struct thermal_trip_point_conf trip_data;
  struct thermal_cooling_conf cooling_data;
  void *private_data;
  @@ -366,6 +367,23 @@ static int exynos_get_temp(struct thermal_zone_device 
  *thermal,
  return 0;
   }
   
  +/* Get temperature callback functions for thermal zone */
  +static int exynos_set_emul_temp(struct thermal_zone_device *thermal,
  +   unsigned long temp)
  +{
  +   void *data;
  +   int ret = -EINVAL;
  +
  +   if (!th_zone-sensor_conf) {
  +   pr_info(Temperature sensor not initialised\n);
  +   return -EINVAL;
  +   }
  +   data = th_zone-sensor_conf-private_data;
  +   if (th_zone-sensor_conf-write_emul_temp)
  +   ret = th_zone-sensor_conf-write_emul_temp(data, temp);
  +   return ret;
  +}
  +
 
   /* Get the temperature trend */
   static int exynos_get_trend(struct thermal_zone_device *thermal,
  int trip, enum 

Re: [PATCH V2 2/2] thermal: exynos: Use the framework for temperature emulation support

2013-02-07 Thread amit kachhap
On Thu, Feb 7, 2013 at 7:04 PM, Zhang Rui rui.zh...@intel.com wrote:
 On Mon, 2013-02-04 at 10:14 +0800, Zhang Rui wrote:
 On Sun, 2013-01-27 at 19:28 -0800, Amit Daniel Kachhap wrote:
  This removes the driver specific sysfs support of the temperature
  emulation and uses the newly added core thermal framework for thermal
  emulation. A platform specific handler is added to support this.
 
  Signed-off-by: Amit Daniel Kachhap amit.dan...@samsung.com
  Acked-by: Kukjin Kim kgene@samsung.com
  ---
  Changes in V2:
  * Added config option CONFIG_THERMAL_EMULATION instead of
   CONFIG_EXYNOS_THERMAL_EMUL
 
  This patchset is based on thermal maintainer next tree.
  git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux.git next
 
   Documentation/thermal/exynos_thermal_emulation |8 +-
   drivers/thermal/Kconfig|9 --
   drivers/thermal/exynos_thermal.c   |  158 
  ++--
   3 files changed, 67 insertions(+), 108 deletions(-)
 
  diff --git a/Documentation/thermal/exynos_thermal_emulation 
  b/Documentation/thermal/exynos_thermal_emulation
  index b73bbfb..36a3e79 100644
  --- a/Documentation/thermal/exynos_thermal_emulation
  +++ b/Documentation/thermal/exynos_thermal_emulation
  @@ -13,11 +13,11 @@ Thermal emulation mode supports software debug for 
  TMU's operation. User can set
   manually with software code and TMU will read current temperature from 
  user value not from
   sensor's value.
 
  -Enabling CONFIG_EXYNOS_THERMAL_EMUL option will make this support in 
  available.
  -When it's enabled, sysfs node will be created under
  -/sys/bus/platform/devices/'exynos device name'/ with name of 'emulation'.
  +Enabling CONFIG_THERMAL_EMULATION option will make this support available.
  +When it's enabled, sysfs node will be created as
  +/sys/devices/virtual/thermal/thermal_zone'zone id'/emul_temp.
 
  -The sysfs node, 'emulation', will contain value 0 for the initial state. 
  When you input any
  +The sysfs node, 'emul_node', will contain value 0 for the initial state. 
  When you input any
   temperature you want to update to sysfs node, it automatically enable 
  emulation mode and
   current temperature will be changed into it.
   (Exynos also supports user changable delay time which would be used to 
  delay of
  diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
  index e4cf7fb..2a79510 100644
  --- a/drivers/thermal/Kconfig
  +++ b/drivers/thermal/Kconfig
  @@ -109,15 +109,6 @@ config EXYNOS_THERMAL
If you say yes here you get support for TMU (Thermal Management
Unit) on SAMSUNG EXYNOS series of SoC.
 
  -config EXYNOS_THERMAL_EMUL
  -   bool EXYNOS TMU emulation mode support
  -   depends on EXYNOS_THERMAL
  -   help
  - Exynos 4412 and 4414 and 5 series has emulation mode on TMU.
  - Enable this option will be make sysfs node in exynos thermal platform
  - device directory to support emulation mode. With emulation mode sysfs
  - node, you can manually input temperature to TMU for simulation 
  purpose.
  -
   config DB8500_THERMAL
  bool DB8500 thermal management
  depends on ARCH_U8500
  diff --git a/drivers/thermal/exynos_thermal.c 
  b/drivers/thermal/exynos_thermal.c
  index 327102a..afe9c2a 100644
  --- a/drivers/thermal/exynos_thermal.c
  +++ b/drivers/thermal/exynos_thermal.c
  @@ -99,13 +99,13 @@
   #define IDLE_INTERVAL 1
   #define MCELSIUS   1000
 
  -#ifdef CONFIG_EXYNOS_THERMAL_EMUL
  +#ifdef CONFIG_THERMAL_EMULATION
   #define EXYNOS_EMUL_TIME   0x57F0
   #define EXYNOS_EMUL_TIME_SHIFT 16
   #define EXYNOS_EMUL_DATA_SHIFT 8
   #define EXYNOS_EMUL_DATA_MASK  0xFF
   #define EXYNOS_EMUL_ENABLE 0x1
  -#endif /* CONFIG_EXYNOS_THERMAL_EMUL */
  +#endif /* CONFIG_THERMAL_EMULATION */
 
   /* CPU Zone information */
   #define PANIC_ZONE  4
  @@ -143,6 +143,7 @@ struct  thermal_cooling_conf {
   struct thermal_sensor_conf {
  char name[SENSOR_NAME_LEN];
  int (*read_temperature)(void *data);
  +   int (*write_emul_temp)(void *data, unsigned long temp);
  struct thermal_trip_point_conf trip_data;
  struct thermal_cooling_conf cooling_data;
  void *private_data;
  @@ -366,6 +367,23 @@ static int exynos_get_temp(struct thermal_zone_device 
  *thermal,
  return 0;
   }
 
  +/* Get temperature callback functions for thermal zone */
  +static int exynos_set_emul_temp(struct thermal_zone_device *thermal,
  +   unsigned long temp)
  +{
  +   void *data;
  +   int ret = -EINVAL;
  +
  +   if (!th_zone-sensor_conf) {
  +   pr_info(Temperature sensor not initialised\n);
  +   return -EINVAL;
  +   }
  +   data = th_zone-sensor_conf-private_data;
  +   if (th_zone-sensor_conf-write_emul_temp)
  +   ret = th_zone-sensor_conf-write_emul_temp(data, temp);
  +   return ret;
  +}
  +

   /* Get the temperature trend */
   static int exynos_get_trend(struct thermal_zone_device 

Re: [PATCH V2 2/2] thermal: exynos: Use the framework for temperature emulation support

2013-02-03 Thread Zhang Rui
On Sun, 2013-01-27 at 19:28 -0800, Amit Daniel Kachhap wrote:
 This removes the driver specific sysfs support of the temperature
 emulation and uses the newly added core thermal framework for thermal
 emulation. A platform specific handler is added to support this.
 
 Signed-off-by: Amit Daniel Kachhap amit.dan...@samsung.com
 Acked-by: Kukjin Kim kgene@samsung.com
 ---
 Changes in V2:
 * Added config option CONFIG_THERMAL_EMULATION instead of
  CONFIG_EXYNOS_THERMAL_EMUL 
 
 This patchset is based on thermal maintainer next tree.
 git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux.git next 
 
  Documentation/thermal/exynos_thermal_emulation |8 +-
  drivers/thermal/Kconfig|9 --
  drivers/thermal/exynos_thermal.c   |  158 
 ++--
  3 files changed, 67 insertions(+), 108 deletions(-)
 
 diff --git a/Documentation/thermal/exynos_thermal_emulation 
 b/Documentation/thermal/exynos_thermal_emulation
 index b73bbfb..36a3e79 100644
 --- a/Documentation/thermal/exynos_thermal_emulation
 +++ b/Documentation/thermal/exynos_thermal_emulation
 @@ -13,11 +13,11 @@ Thermal emulation mode supports software debug for TMU's 
 operation. User can set
  manually with software code and TMU will read current temperature from user 
 value not from
  sensor's value.
  
 -Enabling CONFIG_EXYNOS_THERMAL_EMUL option will make this support in 
 available.
 -When it's enabled, sysfs node will be created under
 -/sys/bus/platform/devices/'exynos device name'/ with name of 'emulation'.
 +Enabling CONFIG_THERMAL_EMULATION option will make this support available.
 +When it's enabled, sysfs node will be created as
 +/sys/devices/virtual/thermal/thermal_zone'zone id'/emul_temp.
  
 -The sysfs node, 'emulation', will contain value 0 for the initial state. 
 When you input any
 +The sysfs node, 'emul_node', will contain value 0 for the initial state. 
 When you input any
  temperature you want to update to sysfs node, it automatically enable 
 emulation mode and
  current temperature will be changed into it.
  (Exynos also supports user changable delay time which would be used to delay 
 of
 diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
 index e4cf7fb..2a79510 100644
 --- a/drivers/thermal/Kconfig
 +++ b/drivers/thermal/Kconfig
 @@ -109,15 +109,6 @@ config EXYNOS_THERMAL
 If you say yes here you get support for TMU (Thermal Management
 Unit) on SAMSUNG EXYNOS series of SoC.
  
 -config EXYNOS_THERMAL_EMUL
 - bool EXYNOS TMU emulation mode support
 - depends on EXYNOS_THERMAL
 - help
 -   Exynos 4412 and 4414 and 5 series has emulation mode on TMU.
 -   Enable this option will be make sysfs node in exynos thermal platform
 -   device directory to support emulation mode. With emulation mode sysfs
 -   node, you can manually input temperature to TMU for simulation 
 purpose.
 -
  config DB8500_THERMAL
   bool DB8500 thermal management
   depends on ARCH_U8500
 diff --git a/drivers/thermal/exynos_thermal.c 
 b/drivers/thermal/exynos_thermal.c
 index 327102a..afe9c2a 100644
 --- a/drivers/thermal/exynos_thermal.c
 +++ b/drivers/thermal/exynos_thermal.c
 @@ -99,13 +99,13 @@
  #define IDLE_INTERVAL 1
  #define MCELSIUS 1000
  
 -#ifdef CONFIG_EXYNOS_THERMAL_EMUL
 +#ifdef CONFIG_THERMAL_EMULATION
  #define EXYNOS_EMUL_TIME 0x57F0
  #define EXYNOS_EMUL_TIME_SHIFT   16
  #define EXYNOS_EMUL_DATA_SHIFT   8
  #define EXYNOS_EMUL_DATA_MASK0xFF
  #define EXYNOS_EMUL_ENABLE   0x1
 -#endif /* CONFIG_EXYNOS_THERMAL_EMUL */
 +#endif /* CONFIG_THERMAL_EMULATION */
  
  /* CPU Zone information */
  #define PANIC_ZONE  4
 @@ -143,6 +143,7 @@ structthermal_cooling_conf {
  struct thermal_sensor_conf {
   char name[SENSOR_NAME_LEN];
   int (*read_temperature)(void *data);
 + int (*write_emul_temp)(void *data, unsigned long temp);
   struct thermal_trip_point_conf trip_data;
   struct thermal_cooling_conf cooling_data;
   void *private_data;
 @@ -366,6 +367,23 @@ static int exynos_get_temp(struct thermal_zone_device 
 *thermal,
   return 0;
  }
  
 +/* Get temperature callback functions for thermal zone */
 +static int exynos_set_emul_temp(struct thermal_zone_device *thermal,
 + unsigned long temp)
 +{
 + void *data;
 + int ret = -EINVAL;
 +
 + if (!th_zone-sensor_conf) {
 + pr_info(Temperature sensor not initialised\n);
 + return -EINVAL;
 + }
 + data = th_zone-sensor_conf-private_data;
 + if (th_zone-sensor_conf-write_emul_temp)
 + ret = th_zone-sensor_conf-write_emul_temp(data, temp);
 + return ret;
 +}
 +

  /* Get the temperature trend */
  static int exynos_get_trend(struct thermal_zone_device *thermal,
   int trip, enum thermal_trend *trend)
 @@ -382,6 +400,7 @@ static struct thermal_zone_device_ops const 
 exynos_dev_ops = {
   

[PATCH V2 2/2] thermal: exynos: Use the framework for temperature emulation support

2013-01-27 Thread Amit Daniel Kachhap
This removes the driver specific sysfs support of the temperature
emulation and uses the newly added core thermal framework for thermal
emulation. A platform specific handler is added to support this.

Signed-off-by: Amit Daniel Kachhap amit.dan...@samsung.com
Acked-by: Kukjin Kim kgene@samsung.com
---
Changes in V2:
* Added config option CONFIG_THERMAL_EMULATION instead of
 CONFIG_EXYNOS_THERMAL_EMUL 

This patchset is based on thermal maintainer next tree.
git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux.git next 

 Documentation/thermal/exynos_thermal_emulation |8 +-
 drivers/thermal/Kconfig|9 --
 drivers/thermal/exynos_thermal.c   |  158 ++--
 3 files changed, 67 insertions(+), 108 deletions(-)

diff --git a/Documentation/thermal/exynos_thermal_emulation 
b/Documentation/thermal/exynos_thermal_emulation
index b73bbfb..36a3e79 100644
--- a/Documentation/thermal/exynos_thermal_emulation
+++ b/Documentation/thermal/exynos_thermal_emulation
@@ -13,11 +13,11 @@ Thermal emulation mode supports software debug for TMU's 
operation. User can set
 manually with software code and TMU will read current temperature from user 
value not from
 sensor's value.
 
-Enabling CONFIG_EXYNOS_THERMAL_EMUL option will make this support in available.
-When it's enabled, sysfs node will be created under
-/sys/bus/platform/devices/'exynos device name'/ with name of 'emulation'.
+Enabling CONFIG_THERMAL_EMULATION option will make this support available.
+When it's enabled, sysfs node will be created as
+/sys/devices/virtual/thermal/thermal_zone'zone id'/emul_temp.
 
-The sysfs node, 'emulation', will contain value 0 for the initial state. When 
you input any
+The sysfs node, 'emul_node', will contain value 0 for the initial state. When 
you input any
 temperature you want to update to sysfs node, it automatically enable 
emulation mode and
 current temperature will be changed into it.
 (Exynos also supports user changable delay time which would be used to delay of
diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index e4cf7fb..2a79510 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -109,15 +109,6 @@ config EXYNOS_THERMAL
  If you say yes here you get support for TMU (Thermal Management
  Unit) on SAMSUNG EXYNOS series of SoC.
 
-config EXYNOS_THERMAL_EMUL
-   bool EXYNOS TMU emulation mode support
-   depends on EXYNOS_THERMAL
-   help
- Exynos 4412 and 4414 and 5 series has emulation mode on TMU.
- Enable this option will be make sysfs node in exynos thermal platform
- device directory to support emulation mode. With emulation mode sysfs
- node, you can manually input temperature to TMU for simulation 
purpose.
-
 config DB8500_THERMAL
bool DB8500 thermal management
depends on ARCH_U8500
diff --git a/drivers/thermal/exynos_thermal.c b/drivers/thermal/exynos_thermal.c
index 327102a..afe9c2a 100644
--- a/drivers/thermal/exynos_thermal.c
+++ b/drivers/thermal/exynos_thermal.c
@@ -99,13 +99,13 @@
 #define IDLE_INTERVAL 1
 #define MCELSIUS   1000
 
-#ifdef CONFIG_EXYNOS_THERMAL_EMUL
+#ifdef CONFIG_THERMAL_EMULATION
 #define EXYNOS_EMUL_TIME   0x57F0
 #define EXYNOS_EMUL_TIME_SHIFT 16
 #define EXYNOS_EMUL_DATA_SHIFT 8
 #define EXYNOS_EMUL_DATA_MASK  0xFF
 #define EXYNOS_EMUL_ENABLE 0x1
-#endif /* CONFIG_EXYNOS_THERMAL_EMUL */
+#endif /* CONFIG_THERMAL_EMULATION */
 
 /* CPU Zone information */
 #define PANIC_ZONE  4
@@ -143,6 +143,7 @@ struct  thermal_cooling_conf {
 struct thermal_sensor_conf {
char name[SENSOR_NAME_LEN];
int (*read_temperature)(void *data);
+   int (*write_emul_temp)(void *data, unsigned long temp);
struct thermal_trip_point_conf trip_data;
struct thermal_cooling_conf cooling_data;
void *private_data;
@@ -366,6 +367,23 @@ static int exynos_get_temp(struct thermal_zone_device 
*thermal,
return 0;
 }
 
+/* Get temperature callback functions for thermal zone */
+static int exynos_set_emul_temp(struct thermal_zone_device *thermal,
+   unsigned long temp)
+{
+   void *data;
+   int ret = -EINVAL;
+
+   if (!th_zone-sensor_conf) {
+   pr_info(Temperature sensor not initialised\n);
+   return -EINVAL;
+   }
+   data = th_zone-sensor_conf-private_data;
+   if (th_zone-sensor_conf-write_emul_temp)
+   ret = th_zone-sensor_conf-write_emul_temp(data, temp);
+   return ret;
+}
+
 /* Get the temperature trend */
 static int exynos_get_trend(struct thermal_zone_device *thermal,
int trip, enum thermal_trend *trend)
@@ -382,6 +400,7 @@ static struct thermal_zone_device_ops const exynos_dev_ops 
= {
.bind = exynos_bind,
.unbind = exynos_unbind,
.get_temp = exynos_get_temp,
+   .set_emul_temp =