Re: [lm-sensors] [linux-pm] [PATCH 2/4] hwmon: exynos4: Move thermal sensor driver to driver/mfd directory

2012-03-05 Thread Amit Kachhap
On 3 March 2012 23:34, Guenter Roeck  wrote:
> On Sat, Mar 03, 2012 at 11:44:10AM -0500, Mark Brown wrote:
>> On Sat, Mar 03, 2012 at 04:36:05PM +0530, Amit Daniel Kachhap wrote:
>> > This movement is needed because the hwmon entries and corresponding
>> > sysfs interface is a duplicate of utilities already provided by
>> > driver/thermal/thermal_sys.c. The goal is to place it in mfd folder
>> > and add necessary calls to get the temperature information.
>>
>> > --- a/Documentation/hwmon/exynos4_tmu
>> > +++ /dev/null
>>
>> Moving this seems to be a failure, the device is exposing a hwmon
>> interface even if you've moved the code to mfd (though it doesn't
>> actually look like a multi-function device at all as far as I can see -
>> usually a MFD would have a bunch of unrelated functionality while this
>> has one function used by two subsystems).
>>
>> If anything it looks like the ADC driver ought to be moved into IIO with
>> either generic or Exynos specific function drivers layered on top of it
>> in hwmon and thermal making use of the values that are read.
>>
> I would agree. Or maybe move it all to thermal, since thermal devices register
> the hwmon subsystem.

Ok I agree with your suggestion of moving into thermal. Since I wanted
to separate exynos specific generic thermal implementation with the
H/W driver so that other versions of the sensor driver can easily hook
into the common part. Anyway this implementation seems possible.

Thanks for the comments
>
> Guenter
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/4] hwmon: exynos4: Move thermal sensor driver to driver/mfd directory

2012-03-05 Thread Amit Kachhap
On 3 March 2012 17:51, Sylwester Nawrocki  wrote:
> On 03/03/2012 12:06 PM, Amit Daniel Kachhap wrote:
>>
>> This movement is needed because the hwmon entries and corresponding
>> sysfs interface is a duplicate of utilities already provided by
>> driver/thermal/thermal_sys.c. The goal is to place it in mfd folder
>> and add necessary calls to get the temperature information.
>>
>> Signed-off-by: Amit Daniel Kachhap
>> Signed-off-by: Donggeun Kim
>> ---
>>  Documentation/hwmon/exynos4_tmu |   81 --
>>  Documentation/mfd/exynos4_tmu   |   81 ++
>>  drivers/hwmon/Kconfig           |   10 -
>>  drivers/hwmon/Makefile          |    1 -
>>  drivers/hwmon/exynos4_tmu.c     |  514
>> ---
>>  drivers/mfd/Kconfig             |   10 +
>>  drivers/mfd/Makefile            |    1 +
>>  drivers/mfd/exynos4_tmu.c       |  514
>> +++
>>  8 files changed, 606 insertions(+), 606 deletions(-)
>>  delete mode 100644 Documentation/hwmon/exynos4_tmu
>>  create mode 100644 Documentation/mfd/exynos4_tmu
>>  delete mode 100644 drivers/hwmon/exynos4_tmu.c
>>  create mode 100644 drivers/mfd/exynos4_tmu.c
>
>
> Please consider adding -M option to git format-patch next time, which
> would make the patch smaller and would let to see clearly what's moved
> and what has changed.

Sure , will keep it in mind.

Thanks

>
> --
> Thanks,
> Sylwester
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [lm-sensors] [linux-pm] [PATCH 2/4] hwmon: exynos4: Move thermal sensor driver to driver/mfd directory

2012-03-03 Thread Guenter Roeck
On Sat, Mar 03, 2012 at 11:44:10AM -0500, Mark Brown wrote:
> On Sat, Mar 03, 2012 at 04:36:05PM +0530, Amit Daniel Kachhap wrote:
> > This movement is needed because the hwmon entries and corresponding
> > sysfs interface is a duplicate of utilities already provided by
> > driver/thermal/thermal_sys.c. The goal is to place it in mfd folder
> > and add necessary calls to get the temperature information.
> 
> > --- a/Documentation/hwmon/exynos4_tmu
> > +++ /dev/null
> 
> Moving this seems to be a failure, the device is exposing a hwmon
> interface even if you've moved the code to mfd (though it doesn't
> actually look like a multi-function device at all as far as I can see -
> usually a MFD would have a bunch of unrelated functionality while this
> has one function used by two subsystems).
> 
> If anything it looks like the ADC driver ought to be moved into IIO with
> either generic or Exynos specific function drivers layered on top of it
> in hwmon and thermal making use of the values that are read.
> 
I would agree. Or maybe move it all to thermal, since thermal devices register
the hwmon subsystem.

Guenter
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [linux-pm] [PATCH 2/4] hwmon: exynos4: Move thermal sensor driver to driver/mfd directory

2012-03-03 Thread Mark Brown
On Sat, Mar 03, 2012 at 04:36:05PM +0530, Amit Daniel Kachhap wrote:
> This movement is needed because the hwmon entries and corresponding
> sysfs interface is a duplicate of utilities already provided by
> driver/thermal/thermal_sys.c. The goal is to place it in mfd folder
> and add necessary calls to get the temperature information.

> --- a/Documentation/hwmon/exynos4_tmu
> +++ /dev/null

Moving this seems to be a failure, the device is exposing a hwmon
interface even if you've moved the code to mfd (though it doesn't
actually look like a multi-function device at all as far as I can see -
usually a MFD would have a bunch of unrelated functionality while this
has one function used by two subsystems).

If anything it looks like the ADC driver ought to be moved into IIO with
either generic or Exynos specific function drivers layered on top of it
in hwmon and thermal making use of the values that are read.
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [lm-sensors] [PATCH 2/4] hwmon: exynos4: Move thermal sensor driver to driver/mfd directory

2012-03-03 Thread Guenter Roeck
On Sat, Mar 03, 2012 at 06:06:05AM -0500, Amit Daniel Kachhap wrote:
> This movement is needed because the hwmon entries and corresponding
> sysfs interface is a duplicate of utilities already provided by
> driver/thermal/thermal_sys.c. The goal is to place it in mfd folder
> and add necessary calls to get the temperature information.
> 
> Signed-off-by: Amit Daniel Kachhap 
> Signed-off-by: Donggeun Kim 
> ---
>  Documentation/hwmon/exynos4_tmu |   81 --
>  Documentation/mfd/exynos4_tmu   |   81 ++
>  drivers/hwmon/Kconfig   |   10 -
>  drivers/hwmon/Makefile  |1 -
>  drivers/hwmon/exynos4_tmu.c |  514 
> ---
>  drivers/mfd/Kconfig |   10 +
>  drivers/mfd/Makefile|1 +
>  drivers/mfd/exynos4_tmu.c   |  514 
> +++
>  8 files changed, 606 insertions(+), 606 deletions(-)
>  delete mode 100644 Documentation/hwmon/exynos4_tmu
>  create mode 100644 Documentation/mfd/exynos4_tmu
>  delete mode 100644 drivers/hwmon/exynos4_tmu.c
>  create mode 100644 drivers/mfd/exynos4_tmu.c
> 

You are just moving the driver from hwmon to mfd. It is still a hwmon driver
and registers itself as hwmon driver. That does not make sense. If you want it
as mfd driver, it should not register itself as hwmon driver. It might have 
sub-devices
which are thermal and/or hwmon devices in the respective trees, or it might 
just be
a thermal driver (which then registers itself as hwmon device automatically).

Guenter
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/4] hwmon: exynos4: Move thermal sensor driver to driver/mfd directory

2012-03-03 Thread Sylwester Nawrocki

On 03/03/2012 12:06 PM, Amit Daniel Kachhap wrote:

This movement is needed because the hwmon entries and corresponding
sysfs interface is a duplicate of utilities already provided by
driver/thermal/thermal_sys.c. The goal is to place it in mfd folder
and add necessary calls to get the temperature information.

Signed-off-by: Amit Daniel Kachhap
Signed-off-by: Donggeun Kim
---
  Documentation/hwmon/exynos4_tmu |   81 --
  Documentation/mfd/exynos4_tmu   |   81 ++
  drivers/hwmon/Kconfig   |   10 -
  drivers/hwmon/Makefile  |1 -
  drivers/hwmon/exynos4_tmu.c |  514 ---
  drivers/mfd/Kconfig |   10 +
  drivers/mfd/Makefile|1 +
  drivers/mfd/exynos4_tmu.c   |  514 +++
  8 files changed, 606 insertions(+), 606 deletions(-)
  delete mode 100644 Documentation/hwmon/exynos4_tmu
  create mode 100644 Documentation/mfd/exynos4_tmu
  delete mode 100644 drivers/hwmon/exynos4_tmu.c
  create mode 100644 drivers/mfd/exynos4_tmu.c


Please consider adding -M option to git format-patch next time, which
would make the patch smaller and would let to see clearly what's moved
and what has changed.

--
Thanks,
Sylwester
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/4] hwmon: exynos4: Move thermal sensor driver to driver/mfd directory

2012-03-03 Thread Amit Daniel Kachhap
This movement is needed because the hwmon entries and corresponding
sysfs interface is a duplicate of utilities already provided by
driver/thermal/thermal_sys.c. The goal is to place it in mfd folder
and add necessary calls to get the temperature information.

Signed-off-by: Amit Daniel Kachhap 
Signed-off-by: Donggeun Kim 
---
 Documentation/hwmon/exynos4_tmu |   81 --
 Documentation/mfd/exynos4_tmu   |   81 ++
 drivers/hwmon/Kconfig   |   10 -
 drivers/hwmon/Makefile  |1 -
 drivers/hwmon/exynos4_tmu.c |  514 ---
 drivers/mfd/Kconfig |   10 +
 drivers/mfd/Makefile|1 +
 drivers/mfd/exynos4_tmu.c   |  514 +++
 8 files changed, 606 insertions(+), 606 deletions(-)
 delete mode 100644 Documentation/hwmon/exynos4_tmu
 create mode 100644 Documentation/mfd/exynos4_tmu
 delete mode 100644 drivers/hwmon/exynos4_tmu.c
 create mode 100644 drivers/mfd/exynos4_tmu.c

diff --git a/Documentation/hwmon/exynos4_tmu b/Documentation/hwmon/exynos4_tmu
deleted file mode 100644
index c3c6b41..000
--- a/Documentation/hwmon/exynos4_tmu
+++ /dev/null
@@ -1,81 +0,0 @@
-Kernel driver exynos4_tmu
-=
-
-Supported chips:
-* ARM SAMSUNG EXYNOS4 series of SoC
-  Prefix: 'exynos4-tmu'
-  Datasheet: Not publicly available
-
-Authors: Donggeun Kim 
-
-Description

-
-This driver allows to read temperature inside SAMSUNG EXYNOS4 series of SoC.
-
-The chip only exposes the measured 8-bit temperature code value
-through a register.
-Temperature can be taken from the temperature code.
-There are three equations converting from temperature to temperature code.
-
-The three equations are:
-  1. Two point trimming
-   Tc = (T - 25) * (TI2 - TI1) / (85 - 25) + TI1
-
-  2. One point trimming
-   Tc = T + TI1 - 25
-
-  3. No trimming
-   Tc = T + 50
-
-  Tc: Temperature code, T: Temperature,
-  TI1: Trimming info for 25 degree Celsius (stored at TRIMINFO register)
-   Temperature code measured at 25 degree Celsius which is unchanged
-  TI2: Trimming info for 85 degree Celsius (stored at TRIMINFO register)
-   Temperature code measured at 85 degree Celsius which is unchanged
-
-TMU(Thermal Management Unit) in EXYNOS4 generates interrupt
-when temperature exceeds pre-defined levels.
-The maximum number of configurable threshold is four.
-The threshold levels are defined as follows:
-  Level_0: current temperature > trigger_level_0 + threshold
-  Level_1: current temperature > trigger_level_1 + threshold
-  Level_2: current temperature > trigger_level_2 + threshold
-  Level_3: current temperature > trigger_level_3 + threshold
-
-  The threshold and each trigger_level are set
-  through the corresponding registers.
-
-When an interrupt occurs, this driver notify user space of
-one of four threshold levels for the interrupt
-through kobject_uevent_env and sysfs_notify functions.
-Although an interrupt condition for level_0 can be set,
-it is not notified to user space through sysfs_notify function.
-
-Sysfs Interface

-name   name of the temperature sensor
-   RO
-
-temp1_inputtemperature
-   RO
-
-temp1_max  temperature for level_1 interrupt
-   RO
-
-temp1_crit temperature for level_2 interrupt
-   RO
-
-temp1_emergencytemperature for level_3 interrupt
-   RO
-
-temp1_max_alarmalarm for level_1 interrupt
-   RO
-
-temp1_crit_alarm
-   alarm for level_2 interrupt
-   RO
-
-temp1_emergency_alarm
-   alarm for level_3 interrupt
-   RO
diff --git a/Documentation/mfd/exynos4_tmu b/Documentation/mfd/exynos4_tmu
new file mode 100644
index 000..c3c6b41
--- /dev/null
+++ b/Documentation/mfd/exynos4_tmu
@@ -0,0 +1,81 @@
+Kernel driver exynos4_tmu
+=
+
+Supported chips:
+* ARM SAMSUNG EXYNOS4 series of SoC
+  Prefix: 'exynos4-tmu'
+  Datasheet: Not publicly available
+
+Authors: Donggeun Kim 
+
+Description
+---
+
+This driver allows to read temperature inside SAMSUNG EXYNOS4 series of SoC.
+
+The chip only exposes the measured 8-bit temperature code value
+through a register.
+Temperature can be taken from the temperature code.
+There are three equations converting from temperature to temperature code.
+
+The three equations are:
+  1. Two point trimming
+   Tc = (T - 25) * (TI2 - TI1) / (85 - 25) + TI1
+
+  2. One point trimming
+   Tc = T + TI1 - 25
+
+  3. No trimming
+   Tc = T + 50
+
+  Tc: Temperature code, T: Temperature,
+  TI1: Trimming info for 25 degree Celsius (stored at TRIMINFO register)
+   Temperature code measured at 25 degree Celsius which is unchanged
+  TI2: Trimming info for 85 degree Celsius (stored at TRIMINFO register)
+   Temperature code measured at 85 degree Celsius which is unchanged
+
+TMU(Thermal Management Unit) in EXYNOS4 generates