Re: [PATCH v4 2/4] thermal: add brcmstb AVS TMON driver

2017-09-26 Thread Markus Mayer
On 25 September 2017 at 23:17, Zhang, Rui  wrote:
> Hi, Florian,
>
>> -Original Message-
>> From: Florian Fainelli [mailto:f.faine...@gmail.com]
>> Sent: Tuesday, September 26, 2017 12:14 PM
>> To: Zhang, Rui ; Rafal Milecki 
>> Cc: Markus Mayer ; Eduardo Valentin
>> ; Rob Herring ; Mark Rutland
>> ; Doug Berger ; Brian
>> Norris ; Gregory Fong
>> ; Russell King ; Catalin
>> Marinas ; Will Deacon ;
>> Arnd Bergmann ; Olof Johansson ;
>> Broadcom Kernel List ; Power
>> Management List ; Device Tree List
>> ; ARM Kernel List > ker...@lists.infradead.org>; Linux Kernel Mailing List > ker...@vger.kernel.org>; Markus Mayer 
>> Subject: Re: [PATCH v4 2/4] thermal: add brcmstb AVS TMON driver
>> Importance: High
>>
>> On 09/25/2017 08:02 PM, Zhang, Rui wrote:
>> > Hi, Florian,
>> >
>> > This patch set was dropped in the last minute because of this
>> > discussion https://patchwork.kernel.org/patch/9936325/
>> > as I don’t want to rebase the patch before sending the pull request.
>>
>> Ah, you wanted to squash that patch into the initial submission?
>>
>> >
>> > I don’t think we can make it for 4.14.
>> > Eduardo will be back and pick the soc patches for 4.15.
>>
>> I assume you would want to get that particular patch squashed into a clean
>> submission targeting 4.15 now, right?
>>
> Yes. As the patch in this thread has not been in upstream yet, I'd prefer the
> fix/cleanup meld into the original patch before sending upstream.

I sent out v5 a few minutes ago. See https://lkml.org/lkml/2017/9/26/746.

Regards,
-Markus

> Thanks,
> Rui
>
>> Thanks
>>
>> >
>> > Thanks,
>> > rui
>> >
>> >
>> >
>> > -Original Message-
>> > From: Florian Fainelli [mailto:f.faine...@gmail.com]
>> > Sent: Monday, September 25, 2017 5:11 AM
>> > To: Zhang, Rui ; Rafał Miłecki 
>> > Cc: Markus Mayer ; Eduardo Valentin
>> > ; Rob Herring ; Mark
>> Rutland
>> > ; Doug Berger ; Brian
>> Norris
>> > ; Gregory Fong
>> ;
>> > Russell King ; Catalin Marinas
>> > ; Will Deacon ; Arnd
>> > Bergmann ; Olof Johansson ;
>> Broadcom
>> > Kernel List ; Power
>> Management
>> > List ; Device Tree List
>> > ; ARM Kernel List
>> > ; Linux Kernel Mailing List
>> > ; Markus Mayer 
>> > Subject: Re: [PATCH v4 2/4] thermal: add brcmstb AVS TMON driver
>> > Importance: High
>> >
>> > Le 08/14/17 à 23:48, Zhang Rui a écrit :
>> >> On Tue, 2017-08-15 at 08:42 +0200, Rafał Miłecki wrote:
>> >>> On 2017-08-15 08:08, Zhang Rui wrote:
>> >>>>
>> >>>>>
>> >>>>> diff --git a/drivers/thermal/broadcom/Kconfig
>> >>>>> b/drivers/thermal/broadcom/Kconfig
>> >>>>> index 42c098e..c106a15 100644
>> >>>>> --- a/drivers/thermal/broadcom/Kconfig
>> >>>>> +++ b/drivers/thermal/broadcom/Kconfig
>> >>>>> @@ -6,6 +6,13 @@ config BCM2835_THERMAL
>> >>>>> help
>> >>>>>   Support for thermal sensors on Broadcom bcm2835 SoCs.
>> >>>>>
>> >>>>> +config BRCMSTB_THERMAL
>> >>>>> +   tristate "Broadcom STB AVS TMON thermal driver"
>> >>>>> +   depends on ARCH_BRCMSTB || COMPILE_TEST
>> >>>>> +   help
>> >>>>> + Enable this driver if you have a Broadcom STB SoC and
>> >>>>> would like
>> >>>>> + thermal framework support.
>> >>>>> +
>> >>>> I don't understand why I got the following checkpatch warning
>> >>>>
>> >>>> WARNING: please write a paragraph that describes the config symbol
>> >>>> fully
>> >>>> #73: FILE: drivers/thermal/broadcom/Kconfig:9:
>> >>>> +config BRCMSTB_THERMAL
>> >>>>
>> >>>> I didn't see this for other Kconfig changes.
>> >>> It's because your help message is only 2 lines long (instead of 3).
>> >>>
>> >>> Some (many?) maintainers aren't pedantic about that, a common sense
>> >>> should be applied ;)
>> >>
>> >> thanks for explaining.
>> >> Patch 1 and 2 queued for next merge window.
>> >
>> > Humm, I don't see this driver in your latest 4.14 pull request to Linus, so
>> what happened here exactly? Can we expect this driver to be submitted for
>> 4.14 or we just happened to have missed this window now?
>> > --
>> > Florian
>> >
>>
>> --
>> Florian


RE: [PATCH v4 2/4] thermal: add brcmstb AVS TMON driver

2017-09-25 Thread Zhang, Rui
Hi, Florian,

> -Original Message-
> From: Florian Fainelli [mailto:f.faine...@gmail.com]
> Sent: Tuesday, September 26, 2017 12:14 PM
> To: Zhang, Rui ; Rafal Milecki 
> Cc: Markus Mayer ; Eduardo Valentin
> ; Rob Herring ; Mark Rutland
> ; Doug Berger ; Brian
> Norris ; Gregory Fong
> ; Russell King ; Catalin
> Marinas ; Will Deacon ;
> Arnd Bergmann ; Olof Johansson ;
> Broadcom Kernel List ; Power
> Management List ; Device Tree List
> ; ARM Kernel List  ker...@lists.infradead.org>; Linux Kernel Mailing List  ker...@vger.kernel.org>; Markus Mayer 
> Subject: Re: [PATCH v4 2/4] thermal: add brcmstb AVS TMON driver
> Importance: High
> 
> On 09/25/2017 08:02 PM, Zhang, Rui wrote:
> > Hi, Florian,
> >
> > This patch set was dropped in the last minute because of this
> > discussion https://patchwork.kernel.org/patch/9936325/
> > as I don’t want to rebase the patch before sending the pull request.
> 
> Ah, you wanted to squash that patch into the initial submission?
> 
> >
> > I don’t think we can make it for 4.14.
> > Eduardo will be back and pick the soc patches for 4.15.
> 
> I assume you would want to get that particular patch squashed into a clean
> submission targeting 4.15 now, right?
> 
Yes. As the patch in this thread has not been in upstream yet, I'd prefer the
fix/cleanup meld into the original patch before sending upstream.

Thanks,
Rui

> Thanks
> 
> >
> > Thanks,
> > rui
> >
> >
> >
> > -Original Message-
> > From: Florian Fainelli [mailto:f.faine...@gmail.com]
> > Sent: Monday, September 25, 2017 5:11 AM
> > To: Zhang, Rui ; Rafał Miłecki 
> > Cc: Markus Mayer ; Eduardo Valentin
> > ; Rob Herring ; Mark
> Rutland
> > ; Doug Berger ; Brian
> Norris
> > ; Gregory Fong
> ;
> > Russell King ; Catalin Marinas
> > ; Will Deacon ; Arnd
> > Bergmann ; Olof Johansson ;
> Broadcom
> > Kernel List ; Power
> Management
> > List ; Device Tree List
> > ; ARM Kernel List
> > ; Linux Kernel Mailing List
> > ; Markus Mayer 
> > Subject: Re: [PATCH v4 2/4] thermal: add brcmstb AVS TMON driver
> > Importance: High
> >
> > Le 08/14/17 à 23:48, Zhang Rui a écrit :
> >> On Tue, 2017-08-15 at 08:42 +0200, Rafał Miłecki wrote:
> >>> On 2017-08-15 08:08, Zhang Rui wrote:
> >>>>
> >>>>>
> >>>>> diff --git a/drivers/thermal/broadcom/Kconfig
> >>>>> b/drivers/thermal/broadcom/Kconfig
> >>>>> index 42c098e..c106a15 100644
> >>>>> --- a/drivers/thermal/broadcom/Kconfig
> >>>>> +++ b/drivers/thermal/broadcom/Kconfig
> >>>>> @@ -6,6 +6,13 @@ config BCM2835_THERMAL
> >>>>>     help
> >>>>>       Support for thermal sensors on Broadcom bcm2835 SoCs.
> >>>>>
> >>>>> +config BRCMSTB_THERMAL
> >>>>> +   tristate "Broadcom STB AVS TMON thermal driver"
> >>>>> +   depends on ARCH_BRCMSTB || COMPILE_TEST
> >>>>> +   help
> >>>>> +     Enable this driver if you have a Broadcom STB SoC and
> >>>>> would like
> >>>>> +     thermal framework support.
> >>>>> +
> >>>> I don't understand why I got the following checkpatch warning
> >>>>
> >>>> WARNING: please write a paragraph that describes the config symbol
> >>>> fully
> >>>> #73: FILE: drivers/thermal/broadcom/Kconfig:9:
> >>>> +config BRCMSTB_THERMAL
> >>>>
> >>>> I didn't see this for other Kconfig changes.
> >>> It's because your help message is only 2 lines long (instead of 3).
> >>>
> >>> Some (many?) maintainers aren't pedantic about that, a common sense
> >>> should be applied ;)
> >>
> >> thanks for explaining.
> >> Patch 1 and 2 queued for next merge window.
> >
> > Humm, I don't see this driver in your latest 4.14 pull request to Linus, so
> what happened here exactly? Can we expect this driver to be submitted for
> 4.14 or we just happened to have missed this window now?
> > --
> > Florian
> >
> 
> --
> Florian


Re: [PATCH v4 2/4] thermal: add brcmstb AVS TMON driver

2017-09-25 Thread Florian Fainelli
On 09/25/2017 08:02 PM, Zhang, Rui wrote:
> Hi, Florian,
> 
> This patch set was dropped in the last minute because of this discussion
> https://patchwork.kernel.org/patch/9936325/
> as I don’t want to rebase the patch before sending the pull request.

Ah, you wanted to squash that patch into the initial submission?

> 
> I don’t think we can make it for 4.14.
> Eduardo will be back and pick the soc patches for 4.15.

I assume you would want to get that particular patch squashed into a
clean submission targeting 4.15 now, right?

Thanks

> 
> Thanks,
> rui
> 
> 
> 
> -Original Message-
> From: Florian Fainelli [mailto:f.faine...@gmail.com] 
> Sent: Monday, September 25, 2017 5:11 AM
> To: Zhang, Rui ; Rafał Miłecki 
> Cc: Markus Mayer ; Eduardo Valentin ; 
> Rob Herring ; Mark Rutland ; Doug 
> Berger ; Brian Norris ; 
> Gregory Fong ; Russell King ; 
> Catalin Marinas ; Will Deacon ; 
> Arnd Bergmann ; Olof Johansson ; Broadcom 
> Kernel List ; Power Management List 
> ; Device Tree List ; 
> ARM Kernel List ; Linux Kernel Mailing 
> List ; Markus Mayer 
> Subject: Re: [PATCH v4 2/4] thermal: add brcmstb AVS TMON driver
> Importance: High
> 
> Le 08/14/17 à 23:48, Zhang Rui a écrit :
>> On Tue, 2017-08-15 at 08:42 +0200, Rafał Miłecki wrote:
>>> On 2017-08-15 08:08, Zhang Rui wrote:
>>>>
>>>>>
>>>>> diff --git a/drivers/thermal/broadcom/Kconfig
>>>>> b/drivers/thermal/broadcom/Kconfig
>>>>> index 42c098e..c106a15 100644
>>>>> --- a/drivers/thermal/broadcom/Kconfig
>>>>> +++ b/drivers/thermal/broadcom/Kconfig
>>>>> @@ -6,6 +6,13 @@ config BCM2835_THERMAL
>>>>>   help
>>>>>     Support for thermal sensors on Broadcom bcm2835 SoCs.
>>>>>  
>>>>> +config BRCMSTB_THERMAL
>>>>> + tristate "Broadcom STB AVS TMON thermal driver"
>>>>> + depends on ARCH_BRCMSTB || COMPILE_TEST
>>>>> + help
>>>>> +   Enable this driver if you have a Broadcom STB SoC and
>>>>> would like
>>>>> +   thermal framework support.
>>>>> +
>>>> I don't understand why I got the following checkpatch warning
>>>>
>>>> WARNING: please write a paragraph that describes the config symbol 
>>>> fully
>>>> #73: FILE: drivers/thermal/broadcom/Kconfig:9:
>>>> +config BRCMSTB_THERMAL
>>>>
>>>> I didn't see this for other Kconfig changes.
>>> It's because your help message is only 2 lines long (instead of 3).
>>>
>>> Some (many?) maintainers aren't pedantic about that, a common sense 
>>> should be applied ;)
>>
>> thanks for explaining.
>> Patch 1 and 2 queued for next merge window.
> 
> Humm, I don't see this driver in your latest 4.14 pull request to Linus, so 
> what happened here exactly? Can we expect this driver to be submitted for 
> 4.14 or we just happened to have missed this window now?
> --
> Florian
> 

-- 
Florian


RE: [PATCH v4 2/4] thermal: add brcmstb AVS TMON driver

2017-09-25 Thread Zhang, Rui
Hi, Florian,

This patch set was dropped in the last minute because of this discussion
https://patchwork.kernel.org/patch/9936325/
as I don’t want to rebase the patch before sending the pull request.

I don’t think we can make it for 4.14.
Eduardo will be back and pick the soc patches for 4.15.

Thanks,
rui



-Original Message-
From: Florian Fainelli [mailto:f.faine...@gmail.com] 
Sent: Monday, September 25, 2017 5:11 AM
To: Zhang, Rui ; Rafał Miłecki 
Cc: Markus Mayer ; Eduardo Valentin ; Rob 
Herring ; Mark Rutland ; Doug Berger 
; Brian Norris ; Gregory Fong 
; Russell King ; Catalin Marinas 
; Will Deacon ; Arnd Bergmann 
; Olof Johansson ; Broadcom Kernel List 
; Power Management List 
; Device Tree List ; ARM 
Kernel List ; Linux Kernel Mailing List 
; Markus Mayer 
Subject: Re: [PATCH v4 2/4] thermal: add brcmstb AVS TMON driver
Importance: High

Le 08/14/17 à 23:48, Zhang Rui a écrit :
> On Tue, 2017-08-15 at 08:42 +0200, Rafał Miłecki wrote:
>> On 2017-08-15 08:08, Zhang Rui wrote:
>>>
>>>>
>>>> diff --git a/drivers/thermal/broadcom/Kconfig
>>>> b/drivers/thermal/broadcom/Kconfig
>>>> index 42c098e..c106a15 100644
>>>> --- a/drivers/thermal/broadcom/Kconfig
>>>> +++ b/drivers/thermal/broadcom/Kconfig
>>>> @@ -6,6 +6,13 @@ config BCM2835_THERMAL
>>>>    help
>>>>      Support for thermal sensors on Broadcom bcm2835 SoCs.
>>>>  
>>>> +config BRCMSTB_THERMAL
>>>> +  tristate "Broadcom STB AVS TMON thermal driver"
>>>> +  depends on ARCH_BRCMSTB || COMPILE_TEST
>>>> +  help
>>>> +    Enable this driver if you have a Broadcom STB SoC and
>>>> would like
>>>> +    thermal framework support.
>>>> +
>>> I don't understand why I got the following checkpatch warning
>>>
>>> WARNING: please write a paragraph that describes the config symbol 
>>> fully
>>> #73: FILE: drivers/thermal/broadcom/Kconfig:9:
>>> +config BRCMSTB_THERMAL
>>>
>>> I didn't see this for other Kconfig changes.
>> It's because your help message is only 2 lines long (instead of 3).
>>
>> Some (many?) maintainers aren't pedantic about that, a common sense 
>> should be applied ;)
> 
> thanks for explaining.
> Patch 1 and 2 queued for next merge window.

Humm, I don't see this driver in your latest 4.14 pull request to Linus, so 
what happened here exactly? Can we expect this driver to be submitted for 4.14 
or we just happened to have missed this window now?
--
Florian


Re: [PATCH v4 2/4] thermal: add brcmstb AVS TMON driver

2017-09-24 Thread Florian Fainelli
Le 08/14/17 à 23:48, Zhang Rui a écrit :
> On Tue, 2017-08-15 at 08:42 +0200, Rafał Miłecki wrote:
>> On 2017-08-15 08:08, Zhang Rui wrote:
>>>

 diff --git a/drivers/thermal/broadcom/Kconfig
 b/drivers/thermal/broadcom/Kconfig
 index 42c098e..c106a15 100644
 --- a/drivers/thermal/broadcom/Kconfig
 +++ b/drivers/thermal/broadcom/Kconfig
 @@ -6,6 +6,13 @@ config BCM2835_THERMAL
    help
      Support for thermal sensors on Broadcom bcm2835 SoCs.
  
 +config BRCMSTB_THERMAL
 +  tristate "Broadcom STB AVS TMON thermal driver"
 +  depends on ARCH_BRCMSTB || COMPILE_TEST
 +  help
 +    Enable this driver if you have a Broadcom STB SoC and
 would like
 +    thermal framework support.
 +
>>> I don't understand why I got the following checkpatch warning
>>>
>>> WARNING: please write a paragraph that describes the config symbol
>>> fully
>>> #73: FILE: drivers/thermal/broadcom/Kconfig:9:
>>> +config BRCMSTB_THERMAL
>>>
>>> I didn't see this for other Kconfig changes.
>> It's because your help message is only 2 lines long (instead of 3).
>>
>> Some (many?) maintainers aren't pedantic about that, a common sense 
>> should
>> be applied ;)
> 
> thanks for explaining.
> Patch 1 and 2 queued for next merge window.

Humm, I don't see this driver in your latest 4.14 pull request to Linus,
so what happened here exactly? Can we expect this driver to be submitted
for 4.14 or we just happened to have missed this window now?
-- 
Florian


Re: [PATCH v4 2/4] thermal: add brcmstb AVS TMON driver

2017-08-14 Thread Zhang Rui
On Tue, 2017-08-15 at 08:42 +0200, Rafał Miłecki wrote:
> On 2017-08-15 08:08, Zhang Rui wrote:
> > 
> > > 
> > > diff --git a/drivers/thermal/broadcom/Kconfig
> > > b/drivers/thermal/broadcom/Kconfig
> > > index 42c098e..c106a15 100644
> > > --- a/drivers/thermal/broadcom/Kconfig
> > > +++ b/drivers/thermal/broadcom/Kconfig
> > > @@ -6,6 +6,13 @@ config BCM2835_THERMAL
> > >   help
> > >     Support for thermal sensors on Broadcom bcm2835 SoCs.
> > >  
> > > +config BRCMSTB_THERMAL
> > > + tristate "Broadcom STB AVS TMON thermal driver"
> > > + depends on ARCH_BRCMSTB || COMPILE_TEST
> > > + help
> > > +   Enable this driver if you have a Broadcom STB SoC and
> > > would like
> > > +   thermal framework support.
> > > +
> > I don't understand why I got the following checkpatch warning
> > 
> > WARNING: please write a paragraph that describes the config symbol
> > fully
> > #73: FILE: drivers/thermal/broadcom/Kconfig:9:
> > +config BRCMSTB_THERMAL
> > 
> > I didn't see this for other Kconfig changes.
> It's because your help message is only 2 lines long (instead of 3).
> 
> Some (many?) maintainers aren't pedantic about that, a common sense 
> should
> be applied ;)

thanks for explaining.
Patch 1 and 2 queued for next merge window.

-rui


Re: [PATCH v4 2/4] thermal: add brcmstb AVS TMON driver

2017-08-14 Thread Rafał Miłecki

On 2017-08-15 08:08, Zhang Rui wrote:

diff --git a/drivers/thermal/broadcom/Kconfig
b/drivers/thermal/broadcom/Kconfig
index 42c098e..c106a15 100644
--- a/drivers/thermal/broadcom/Kconfig
+++ b/drivers/thermal/broadcom/Kconfig
@@ -6,6 +6,13 @@ config BCM2835_THERMAL
    help
      Support for thermal sensors on Broadcom bcm2835 SoCs.
 
+config BRCMSTB_THERMAL
+   tristate "Broadcom STB AVS TMON thermal driver"
+   depends on ARCH_BRCMSTB || COMPILE_TEST
+   help
+     Enable this driver if you have a Broadcom STB SoC and
would like
+     thermal framework support.
+


I don't understand why I got the following checkpatch warning

WARNING: please write a paragraph that describes the config symbol
fully
#73: FILE: drivers/thermal/broadcom/Kconfig:9:
+config BRCMSTB_THERMAL

I didn't see this for other Kconfig changes.


It's because your help message is only 2 lines long (instead of 3).

Some (many?) maintainers aren't pedantic about that, a common sense 
should

be applied ;)


Re: [PATCH v4 2/4] thermal: add brcmstb AVS TMON driver

2017-08-14 Thread Zhang Rui
On Wed, 2017-08-09 at 15:02 -0700, Markus Mayer wrote:
> From: Brian Norris 
> 
> The AVS TMON core provides temperature readings, a pair of
> configurable
> high- and low-temperature threshold interrupts, and an emergency
> over-temperature chip reset. The driver utilizes the first two to
> provide temperature readings and high-temperature notifications to
> applications. The over-temperature reset is not exposed to
> applications; this reset threshold is critical to the system and
> should
> be set with care within the bootloader.
> 
> Applications may choose to utilize the notification mechanism, the
> temperature reading mechanism (e.g., through polling), or both.
> 
> Signed-off-by: Brian Norris 
> Signed-off-by: Doug Berger 
> Signed-off-by: Markus Mayer 
> ---
>  drivers/thermal/Kconfig|   2 +-
>  drivers/thermal/broadcom/Kconfig   |   7 +
>  drivers/thermal/broadcom/Makefile  |   1 +
>  drivers/thermal/broadcom/brcmstb_thermal.c | 386
> +
>  4 files changed, 395 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/thermal/broadcom/brcmstb_thermal.c
> 
> diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
> index b5b5fac..396ad6b 100644
> --- a/drivers/thermal/Kconfig
> +++ b/drivers/thermal/Kconfig
> @@ -408,7 +408,7 @@ config MTK_THERMAL
>     controller present in Mediatek SoCs
>  
>  menu "Broadcom thermal drivers"
> -depends on ARCH_BCM || COMPILE_TEST
> +depends on ARCH_BCM || ARCH_BRCMSTB || COMPILE_TEST
>  source "drivers/thermal/broadcom/Kconfig"
>  endmenu
>  
> diff --git a/drivers/thermal/broadcom/Kconfig
> b/drivers/thermal/broadcom/Kconfig
> index 42c098e..c106a15 100644
> --- a/drivers/thermal/broadcom/Kconfig
> +++ b/drivers/thermal/broadcom/Kconfig
> @@ -6,6 +6,13 @@ config BCM2835_THERMAL
>   help
>     Support for thermal sensors on Broadcom bcm2835 SoCs.
>  
> +config BRCMSTB_THERMAL
> + tristate "Broadcom STB AVS TMON thermal driver"
> + depends on ARCH_BRCMSTB || COMPILE_TEST
> + help
> +   Enable this driver if you have a Broadcom STB SoC and
> would like
> +   thermal framework support.
> +

I don't understand why I got the following checkpatch warning

WARNING: please write a paragraph that describes the config symbol
fully
#73: FILE: drivers/thermal/broadcom/Kconfig:9:
+config BRCMSTB_THERMAL

I didn't see this for other Kconfig changes.

thanks,
rui

>  config BCM_NS_THERMAL
>   tristate "Northstar thermal driver"
>   depends on ARCH_BCM_IPROC || COMPILE_TEST
> diff --git a/drivers/thermal/broadcom/Makefile
> b/drivers/thermal/broadcom/Makefile
> index c6f62e4..fae10ec 100644
> --- a/drivers/thermal/broadcom/Makefile
> +++ b/drivers/thermal/broadcom/Makefile
> @@ -1,2 +1,3 @@
>  obj-$(CONFIG_BCM2835_THERMAL)+= bcm2835_thermal.o
> +obj-$(CONFIG_BRCMSTB_THERMAL)+= brcmstb_thermal.o
>  obj-$(CONFIG_BCM_NS_THERMAL) += ns-thermal.o
> diff --git a/drivers/thermal/broadcom/brcmstb_thermal.c
> b/drivers/thermal/broadcom/brcmstb_thermal.c
> new file mode 100644
> index 000..87b8e7a
> --- /dev/null
> +++ b/drivers/thermal/broadcom/brcmstb_thermal.c
> @@ -0,0 +1,386 @@
> +/*
> + * Broadcom STB AVS TMON thermal sensor driver
> + *
> + * Copyright (c) 2015-2017 Broadcom
> + *
> + * This software is licensed under the terms of the GNU General
> Public
> + * License version 2, as published by the Free Software Foundation,
> and
> + * may be copied, distributed, and modified under those terms.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + */
> +
> +#define DRV_NAME "brcmstb_thermal"
> +
> +#define pr_fmt(fmt)  DRV_NAME ": " fmt
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#define AVS_TMON_STATUS  0x00
> + #define AVS_TMON_STATUS_valid_msk   BIT(11)
> + #define AVS_TMON_STATUS_data_mskGENMASK(10, 1)
> + #define AVS_TMON_STATUS_data_shift  1
> +
> +#define AVS_TMON_EN_OVERTEMP_RESET   0x04
> + #define AVS_TMON_EN_OVERTEMP_RESET_msk  BIT(0)
> +
> +#define AVS_TMON_RESET_THRESH0x08
> + #define AVS_TMON_RESET_THRESH_msk   GENMASK(10, 1)
> + #define AVS_TMON_RESET_THRESH_shift 1
> +
> +#define AVS_TMON_INT_IDLE_TIME   0x10
> +
> +#define AVS_TMON_EN_TEMP_INT_SRCS0x14
> + #define AVS_TMON_EN_TEMP_INT_SRCS_high  BIT(1)
> + #define AVS_TMON_EN_TEMP_INT_SRCS_low   BIT(0)
> +
> +#define AVS_TMON_INT_THRESH  0x18
> + #define AVS_TMON_INT_THRESH_high_mskGENMASK(26, 17)
> + #define AVS_TMON_INT_THRESH_high_shift  17
> + #define AVS_TMON_INT_THRESH_low_msk GENMASK(10, 1)
> + #define AVS_TMON_INT_THRESH_low_shift   1
>

[PATCH v4 2/4] thermal: add brcmstb AVS TMON driver

2017-08-09 Thread Markus Mayer
From: Brian Norris 

The AVS TMON core provides temperature readings, a pair of configurable
high- and low-temperature threshold interrupts, and an emergency
over-temperature chip reset. The driver utilizes the first two to
provide temperature readings and high-temperature notifications to
applications. The over-temperature reset is not exposed to
applications; this reset threshold is critical to the system and should
be set with care within the bootloader.

Applications may choose to utilize the notification mechanism, the
temperature reading mechanism (e.g., through polling), or both.

Signed-off-by: Brian Norris 
Signed-off-by: Doug Berger 
Signed-off-by: Markus Mayer 
---
 drivers/thermal/Kconfig|   2 +-
 drivers/thermal/broadcom/Kconfig   |   7 +
 drivers/thermal/broadcom/Makefile  |   1 +
 drivers/thermal/broadcom/brcmstb_thermal.c | 386 +
 4 files changed, 395 insertions(+), 1 deletion(-)
 create mode 100644 drivers/thermal/broadcom/brcmstb_thermal.c

diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index b5b5fac..396ad6b 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -408,7 +408,7 @@ config MTK_THERMAL
  controller present in Mediatek SoCs
 
 menu "Broadcom thermal drivers"
-depends on ARCH_BCM || COMPILE_TEST
+depends on ARCH_BCM || ARCH_BRCMSTB || COMPILE_TEST
 source "drivers/thermal/broadcom/Kconfig"
 endmenu
 
diff --git a/drivers/thermal/broadcom/Kconfig b/drivers/thermal/broadcom/Kconfig
index 42c098e..c106a15 100644
--- a/drivers/thermal/broadcom/Kconfig
+++ b/drivers/thermal/broadcom/Kconfig
@@ -6,6 +6,13 @@ config BCM2835_THERMAL
help
  Support for thermal sensors on Broadcom bcm2835 SoCs.
 
+config BRCMSTB_THERMAL
+   tristate "Broadcom STB AVS TMON thermal driver"
+   depends on ARCH_BRCMSTB || COMPILE_TEST
+   help
+ Enable this driver if you have a Broadcom STB SoC and would like
+ thermal framework support.
+
 config BCM_NS_THERMAL
tristate "Northstar thermal driver"
depends on ARCH_BCM_IPROC || COMPILE_TEST
diff --git a/drivers/thermal/broadcom/Makefile 
b/drivers/thermal/broadcom/Makefile
index c6f62e4..fae10ec 100644
--- a/drivers/thermal/broadcom/Makefile
+++ b/drivers/thermal/broadcom/Makefile
@@ -1,2 +1,3 @@
 obj-$(CONFIG_BCM2835_THERMAL)  += bcm2835_thermal.o
+obj-$(CONFIG_BRCMSTB_THERMAL)  += brcmstb_thermal.o
 obj-$(CONFIG_BCM_NS_THERMAL)   += ns-thermal.o
diff --git a/drivers/thermal/broadcom/brcmstb_thermal.c 
b/drivers/thermal/broadcom/brcmstb_thermal.c
new file mode 100644
index 000..87b8e7a
--- /dev/null
+++ b/drivers/thermal/broadcom/brcmstb_thermal.c
@@ -0,0 +1,386 @@
+/*
+ * Broadcom STB AVS TMON thermal sensor driver
+ *
+ * Copyright (c) 2015-2017 Broadcom
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#define DRV_NAME   "brcmstb_thermal"
+
+#define pr_fmt(fmt)DRV_NAME ": " fmt
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define AVS_TMON_STATUS0x00
+ #define AVS_TMON_STATUS_valid_msk BIT(11)
+ #define AVS_TMON_STATUS_data_msk  GENMASK(10, 1)
+ #define AVS_TMON_STATUS_data_shift1
+
+#define AVS_TMON_EN_OVERTEMP_RESET 0x04
+ #define AVS_TMON_EN_OVERTEMP_RESET_mskBIT(0)
+
+#define AVS_TMON_RESET_THRESH  0x08
+ #define AVS_TMON_RESET_THRESH_msk GENMASK(10, 1)
+ #define AVS_TMON_RESET_THRESH_shift   1
+
+#define AVS_TMON_INT_IDLE_TIME 0x10
+
+#define AVS_TMON_EN_TEMP_INT_SRCS  0x14
+ #define AVS_TMON_EN_TEMP_INT_SRCS_highBIT(1)
+ #define AVS_TMON_EN_TEMP_INT_SRCS_low BIT(0)
+
+#define AVS_TMON_INT_THRESH0x18
+ #define AVS_TMON_INT_THRESH_high_msk  GENMASK(26, 17)
+ #define AVS_TMON_INT_THRESH_high_shift17
+ #define AVS_TMON_INT_THRESH_low_msk   GENMASK(10, 1)
+ #define AVS_TMON_INT_THRESH_low_shift 1
+
+#define AVS_TMON_TEMP_INT_CODE 0x1c
+#define AVS_TMON_TP_TEST_ENABLE0x20
+
+/* Default coefficients */
+#define AVS_TMON_TEMP_SLOPE-487
+#define AVS_TMON_TEMP_OFFSET   410040
+
+/* HW related temperature constants */
+#define AVS_TMON_TEMP_MAX  0x3ff
+#define AVS_TMON_TEMP_MIN  -88161
+#define AVS_TMON_TEMP_MASK AVS_TMON_TEMP_MAX
+
+enum avs_tmon_trip_type {
+   TMON_TRIP_TYPE_LOW = 0,
+   TMON_TRIP_TYPE_HIGH,
+   TMON_TRIP_TYPE_RESET,
+   TMON_TRIP_TYPE_MAX,
+};
+
+struct a