Re: [PATCH v3 19/33] docs: pcmcia: convert docs to ReST and rename to *.rst

2019-06-09 Thread Dominik Brodowski
On Sat, Jun 08, 2019 at 11:27:09PM -0300, Mauro Carvalho Chehab wrote:
> Convert the pcmcia docs to ReST format. Most of the changes here
> are trivial.
> 
> The conversion is actually:
>   - add blank lines and identation in order to identify paragraphs;
>   - fix tables markups;
>   - add some lists markups;
>   - mark literal blocks;
>   - adjust title markups.
> 
> At its new index.rst, let's add a :orphan: while this is not linked to
> the main index.rst file, in order to avoid build warnings.
> 
> Signed-off-by: Mauro Carvalho Chehab 

Acked-by: Dominik Brodowski 

Thanks,
Dominik


Re: [PATCH v3 12/33] docs: ide: convert docs to ReST and rename to *.rst

2019-06-09 Thread Geert Uytterhoeven
On Sun, Jun 9, 2019 at 4:27 AM Mauro Carvalho Chehab
 wrote:
> The conversion is actually:
>   - add blank lines and identation in order to identify paragraphs;
>   - fix tables markups;
>   - add some lists markups;
>   - mark literal blocks;
>   - adjust title markups.
>
> At its new index.rst, let's add a :orphan: while this is not linked to
> the main index.rst file, in order to avoid build warnings.
>
> Signed-off-by: Mauro Carvalho Chehab 

>  arch/m68k/q40/README  |   2 +-

Acked-by: Geert Uytterhoeven 

Gr{oetje,eeting}s,

Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Re: [PATCH v3 00/33] Convert files to ReST - part 1

2019-06-09 Thread Heiko Carstens
On Sat, Jun 08, 2019 at 11:26:50PM -0300, Mauro Carvalho Chehab wrote:
> This is the first part of a series I wrote sometime ago where I manually
> convert lots of files to be properly parsed by Sphinx as ReST files.
> 
> As it touches on lot of stuff, this series is based on today's docs-next
> + linux-next, at tag next-20190607.
> 
> I have right now about 85 patches with this undergoing work. That's
> because I opted to do ~1 patch per converted directory.
> 
> That sounds too much to be send on a single round. So, I'm opting to split
> it on 3 parts. Those patches should probably be good to be merged
> either by subsystem maintainers or via the docs tree.
> 
> I opted to mark new files not included yet to the main index.rst (directly or
> indirectly ) with the :orphan: tag, in order to avoid adding warnings to the
> build system. This should be removed after we find a "home" for all
> the converted files within the new document tree arrangement.
> 
> Both this series and  the next parts are on my devel git tree,
> at:
> 
>   
> https://git.linuxtv.org/mchehab/experimental.git/log/?h=convert_rst_renames_v4
> 
> The final output in html (after all patches I currently have, including 
> the upcoming series) can be seen at:
> 
>   https://www.infradead.org/~mchehab/rst_conversion/

Will there be a web page (e.g. kernel.org), which contains always the
latest upstream version?

>   docs: Debugging390.txt: convert table to ascii artwork
>   docs: s390: convert docs to ReST and rename to *.rst
>   s390: include/asm/debug.h add kerneldoc markups

I can pick these up for s390. Or do you want to send the whole series
in one go upstream?



Re: [PATCH v3 15/20] docs: move protection-keys.rst to the core-api book

2019-06-09 Thread Geert Uytterhoeven
Hi Mauro,

On Fri, Jun 7, 2019 at 9:38 PM Mauro Carvalho Chehab
 wrote:
> This document is used by multiple architectures:

Indeed it is...

>
> $ echo $(git grep -l  pkey_mprotect arch|cut -d'/' -f 2|sort|uniq)
> alpha arm arm64 ia64 m68k microblaze mips parisc powerpc s390 sh 
> sparc x86 xtensa

... but not because we now have a unified space for new syscall numbers ;-)

$ git grep -w ARCH_HAS_PKEYS -- "*Kconf*"
arch/powerpc/Kconfig:   select ARCH_HAS_PKEYS
arch/x86/Kconfig:   select ARCH_HAS_PKEYS
mm/Kconfig:config ARCH_HAS_PKEYS

I.e. limited to x86 and powerpc.

Gr{oetje,eeting}s,

Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Re: [PATCH v3 00/33] Convert files to ReST - part 1

2019-06-09 Thread Markus Heiser



Am 09.06.19 um 11:16 schrieb Heiko Carstens:

Will there be a web page (e.g. kernel.org), which contains always the
latest upstream version?


You are looking for the HTML docs on kernel.org?

  https://www.kernel.org/doc/html/latest/

-- Markus --


Re: [PATCH v3 22/33] docs: pps.txt: convert to ReST and rename to pps.rst

2019-06-09 Thread Rodolfo Giometti
On 09/06/2019 04:27, Mauro Carvalho Chehab wrote:
> This file is already in a good shape: just its title and
> adding some literal block markups is needed for it to be
> part of the document.
> 
> While it has a small chapter with sysfs stuff, most of
> the document is focused on driver development.
> 
> As it describes a kernel API, move it to the driver-api
> directory.
> 
> In order to avoid conflicts, let's add an :orphan: tag
> to it, to be removed when added to the driver-api book.
> 
> Signed-off-by: Mauro Carvalho Chehab 

Acked-by: Rodolfo Giometti 

-- 
GNU/Linux Solutions  e-mail: giome...@enneenne.com
Linux Device Driver  giome...@linux.it
Embedded Systems phone:  +39 349 2432127
UNIX programming skype:  rodolfo.giometti


Re: [PATCH v3 00/33] Convert files to ReST - part 1

2019-06-09 Thread Heiko Carstens
On Sun, Jun 09, 2019 at 11:22:36AM +0200, Markus Heiser wrote:
> 
> Am 09.06.19 um 11:16 schrieb Heiko Carstens:
> >Will there be a web page (e.g. kernel.org), which contains always the
> >latest upstream version?
> 
> You are looking for the HTML docs on kernel.org?
> 
>   https://www.kernel.org/doc/html/latest/

Yes, thanks!



Re: [PATCH v3 00/33] Convert files to ReST - part 1

2019-06-09 Thread Mauro Carvalho Chehab
Em Sun, 9 Jun 2019 11:16:43 +0200
Heiko Carstens  escreveu:

> On Sat, Jun 08, 2019 at 11:26:50PM -0300, Mauro Carvalho Chehab wrote:
> > This is the first part of a series I wrote sometime ago where I manually
> > convert lots of files to be properly parsed by Sphinx as ReST files.
> > 
> > As it touches on lot of stuff, this series is based on today's docs-next
> > + linux-next, at tag next-20190607.
> > 
> > I have right now about 85 patches with this undergoing work. That's
> > because I opted to do ~1 patch per converted directory.
> > 
> > That sounds too much to be send on a single round. So, I'm opting to split
> > it on 3 parts. Those patches should probably be good to be merged
> > either by subsystem maintainers or via the docs tree.
> > 
> > I opted to mark new files not included yet to the main index.rst (directly 
> > or
> > indirectly ) with the :orphan: tag, in order to avoid adding warnings to the
> > build system. This should be removed after we find a "home" for all
> > the converted files within the new document tree arrangement.
> > 
> > Both this series and  the next parts are on my devel git tree,
> > at:
> > 
> > 
> > https://git.linuxtv.org/mchehab/experimental.git/log/?h=convert_rst_renames_v4
> > 
> > The final output in html (after all patches I currently have, including 
> > the upcoming series) can be seen at:
> > 
> > https://www.infradead.org/~mchehab/rst_conversion/  
> 
> Will there be a web page (e.g. kernel.org), which contains always the
> latest upstream version?

Yes:

https://www.kernel.org/doc/html/latest/

I guess this one is based on Linus tree.

Jon also maintains a version at:

https://static.lwn.net/kerneldoc/

I guess that one is based on docs-next branch from the Docs tree.

Btw, if you want to build it for yourself, you could use:

make htmldocs

If your system doesn't have all dependencies, it will give the
hints about how to install them.

> 
> >   docs: Debugging390.txt: convert table to ascii artwork
> >   docs: s390: convert docs to ReST and rename to *.rst
> >   s390: include/asm/debug.h add kerneldoc markups  
> 
> I can pick these up for s390. Or do you want to send the whole series
> in one go upstream?

Yeah, feel free to pick them via the s390 tree.

Regards,
Mauro

Thanks,
Mauro


Thanks,
Mauro


Re: [PATCH v3 23/33] docs: ptp.txt: convert to ReST and move to driver-api

2019-06-09 Thread Richard Cochran
On Sat, Jun 08, 2019 at 11:27:13PM -0300, Mauro Carvalho Chehab wrote:
> The conversion is trivial: just adjust title markups.
> 
> In order to avoid conflicts, let's add an :orphan: tag
> to it, to be removed when this file gets added to the
> driver-api book.

Acked-by: Richard Cochran 


Re: [PATCH v3 30/33] docs: watchdog: convert docs to ReST and rename to *.rst

2019-06-09 Thread Guenter Roeck
On Sat, Jun 08, 2019 at 11:27:20PM -0300, Mauro Carvalho Chehab wrote:
> Convert those documents and prepare them to be part of the kernel
> API book, as most of the stuff there are related to the
> Kernel interfaces.
> 
> Still, in the future, it would make sense to split the docs,
> as some of the stuff is clearly focused on sysadmin tasks.
> 
> The conversion is actually:
>   - add blank lines and identation in order to identify paragraphs;
>   - fix tables markups;
>   - add some lists markups;
>   - mark literal blocks;
>   - adjust title markups.
> 
> At its new index.rst, let's add a :orphan: while this is not linked to
> the main index.rst file, in order to avoid build warnings.
> 
> Cc: Mauro Carvalho Chehab , 
> linux-ker...@vger.kernel.org, Jonathan Corbet 
> Signed-off-by: Mauro Carvalho Chehab 

Reviewed-by: Guenter Roeck 

> ---
>  .../admin-guide/kernel-parameters.txt |   2 +-
>  Documentation/kernel-per-CPU-kthreads.txt |   2 +-
>  txt => convert_drivers_to_kernel_api.rst} | 109 +--
>  .../watchdog/{hpwdt.txt => hpwdt.rst} |  25 +-
>  Documentation/watchdog/index.rst  |  25 +
>  .../watchdog/{mlx-wdt.txt => mlx-wdt.rst} |  24 +-
>  .../{pcwd-watchdog.txt => pcwd-watchdog.rst}  |  13 +-
>  .../{watchdog-api.txt => watchdog-api.rst}|  76 +-
>  ...kernel-api.txt => watchdog-kernel-api.rst} |  91 ++-
>  ...parameters.txt => watchdog-parameters.rst} | 672 +-
>  .../{watchdog-pm.txt => watchdog-pm.rst}  |   3 +
>  Documentation/watchdog/{wdt.txt => wdt.rst}   |  31 +-
>  MAINTAINERS   |   2 +-
>  drivers/watchdog/Kconfig  |   6 +-
>  drivers/watchdog/smsc37b787_wdt.c |   2 +-
>  15 files changed, 767 insertions(+), 316 deletions(-)
>  rename Documentation/watchdog/{convert_drivers_to_kernel_api.txt => 
> convert_drivers_to_kernel_api.rst} (75%)
>  rename Documentation/watchdog/{hpwdt.txt => hpwdt.rst} (79%)
>  create mode 100644 Documentation/watchdog/index.rst
>  rename Documentation/watchdog/{mlx-wdt.txt => mlx-wdt.rst} (78%)
>  rename Documentation/watchdog/{pcwd-watchdog.txt => pcwd-watchdog.rst} (89%)
>  rename Documentation/watchdog/{watchdog-api.txt => watchdog-api.rst} (80%)
>  rename Documentation/watchdog/{watchdog-kernel-api.txt => 
> watchdog-kernel-api.rst} (90%)
>  rename Documentation/watchdog/{watchdog-parameters.txt => 
> watchdog-parameters.rst} (42%)
>  rename Documentation/watchdog/{watchdog-pm.txt => watchdog-pm.rst} (92%)
>  rename Documentation/watchdog/{wdt.txt => wdt.rst} (68%)
> 
> diff --git a/Documentation/admin-guide/kernel-parameters.txt 
> b/Documentation/admin-guide/kernel-parameters.txt
> index 0092a453f7dc..3d072ca532bb 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -5182,7 +5182,7 @@
>   Default: 3 = cyan.
>  
>   watchdog timers [HW,WDT] For information on watchdog timers,
> - see Documentation/watchdog/watchdog-parameters.txt
> + see Documentation/watchdog/watchdog-parameters.rst
>   or other driver-specific files in the
>   Documentation/watchdog/ directory.
>  
> diff --git a/Documentation/kernel-per-CPU-kthreads.txt 
> b/Documentation/kernel-per-CPU-kthreads.txt
> index 23b0c8b20cd1..5623b9916411 100644
> --- a/Documentation/kernel-per-CPU-kthreads.txt
> +++ b/Documentation/kernel-per-CPU-kthreads.txt
> @@ -348,7 +348,7 @@ To reduce its OS jitter, do at least one of the following:
>  2.   Boot with "nosoftlockup=0", which will also prevent these kthreads
>   from being created.  Other related watchdog and softlockup boot
>   parameters may be found in 
> Documentation/admin-guide/kernel-parameters.rst
> - and Documentation/watchdog/watchdog-parameters.txt.
> + and Documentation/watchdog/watchdog-parameters.rst.
>  3.   Echo a zero to /proc/sys/kernel/watchdog to disable the
>   watchdog timer.
>  4.   Echo a large number of /proc/sys/kernel/watchdog_thresh in
> diff --git a/Documentation/watchdog/convert_drivers_to_kernel_api.txt 
> b/Documentation/watchdog/convert_drivers_to_kernel_api.rst
> similarity index 75%
> rename from Documentation/watchdog/convert_drivers_to_kernel_api.txt
> rename to Documentation/watchdog/convert_drivers_to_kernel_api.rst
> index 9fffb2958d13..dd934cc08e40 100644
> --- a/Documentation/watchdog/convert_drivers_to_kernel_api.txt
> +++ b/Documentation/watchdog/convert_drivers_to_kernel_api.rst
> @@ -1,6 +1,8 @@
> +=
>  Converting old watchdog drivers to the watchdog framework
> +=
> +
>  by Wolfram Sang 
> -=
>  
>  Before the watchdog framework came into the kernel, every driver had to
>  implement the API on its own. Now, as the framework fac

Re: [PATCH v3 07/33] docs: cpu-freq: convert docs to ReST and rename to *.rst

2019-06-09 Thread Rafael J. Wysocki
On Sun, Jun 9, 2019 at 4:30 AM Mauro Carvalho Chehab
 wrote:
>
> The conversion is actually:
>   - add blank lines and identation in order to identify paragraphs;
>   - fix tables markups;
>   - add some lists markups;
>   - mark literal blocks;
>   - adjust title markups.
>
> At its new index.rst, let's add a :orphan: while this is not linked to
> the main index.rst file, in order to avoid build warnings.
>
> Signed-off-by: Mauro Carvalho Chehab 

I have said "no" to this already twice.

How many times do I still need to repeat that?

There already is some cpufreq documentation under admin-guide in the
.rst format and the rest is obsolete.  It is going to be replaced with
something new and more up to date.

The API docs need to go under driver-api and conversions like this
don't help.  Indeed, they are counter-prodictive in my view.

DIsappointed,
Rafael


Re: [PATCH v3 07/33] docs: cpu-freq: convert docs to ReST and rename to *.rst

2019-06-09 Thread Mauro Carvalho Chehab
Em Sun, 9 Jun 2019 23:38:32 +0200
"Rafael J. Wysocki"  escreveu:

> On Sun, Jun 9, 2019 at 4:30 AM Mauro Carvalho Chehab
>  wrote:
> >
> > The conversion is actually:
> >   - add blank lines and identation in order to identify paragraphs;
> >   - fix tables markups;
> >   - add some lists markups;
> >   - mark literal blocks;
> >   - adjust title markups.
> >
> > At its new index.rst, let's add a :orphan: while this is not linked to
> > the main index.rst file, in order to avoid build warnings.
> >
> > Signed-off-by: Mauro Carvalho Chehab   
> 
> I have said "no" to this already twice.

I'm really sorry, I forgot to drop it. It is gone now from:

https://git.linuxtv.org/mchehab/experimental.git/log/?h=convert_rst_renames_v4.1&ofs=50

Thanks,
Mauro


Re: [PATCH] docs: filesystems: vfs: Render method descriptions

2019-06-09 Thread Tobin C. Harding
On Thu, Jun 06, 2019 at 09:46:28AM -0600, Jonathan Corbet wrote:
> On Tue,  4 Jun 2019 10:26:56 +1000
> "Tobin C. Harding"  wrote:
> 
> > Currently vfs.rst does not render well into HTML the method descriptions
> > for VFS data structures.  We can improve the HTML output by putting the
> > description string on a new line following the method name.
> > 
> > Suggested-by: Jonathan Corbet 
> > Signed-off-by: Tobin C. Harding 
> > ---
> > 
> > Jon,
> > 
> > As discussed on LKML; this patch applies on top of the series
> > 
> > [PATCH v4 0/9] docs: Convert VFS doc to RST
> > 
> > If it does not apply cleanly to your branch please feel free to ask me
> > to fix it.
> 
> There was one merge conflict, but nothing too serious.  I've applied it,
> and things look a lot better - thanks!

Awesome, cheers mate.

Tobin


[PATCH V14 4/5] defconfig: arm64: add i.MX system controller thermal support

2019-06-09 Thread Anson . Huang
From: Anson Huang 

This patch enables CONFIG_IMX_SC_THERMAL as module.

Signed-off-by: Anson Huang 
---
No change.
---
 arch/arm64/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index b3d6eb8..323e772 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -414,6 +414,7 @@ CONFIG_THERMAL_GOV_POWER_ALLOCATOR=y
 CONFIG_CPU_THERMAL=y
 CONFIG_THERMAL_EMULATION=y
 CONFIG_QORIQ_THERMAL=m
+CONFIG_IMX_SC_THERMAL=m
 CONFIG_ROCKCHIP_THERMAL=m
 CONFIG_RCAR_THERMAL=y
 CONFIG_RCAR_GEN3_THERMAL=y
-- 
2.7.4



[PATCH V14 1/5] dt-bindings: fsl: scu: add thermal binding

2019-06-09 Thread Anson . Huang
From: Anson Huang 

NXP i.MX8QXP is an ARMv8 SoC with a Cortex-M4 core inside as
system controller, the system controller is in charge of system
power, clock and thermal sensors etc. management, Linux kernel
has to communicate with system controller via MU (message unit)
IPC to get temperature from thermal sensors, this patch adds
binding doc for i.MX system controller thermal driver.

Signed-off-by: Anson Huang 
Reviewed-by: Rob Herring 
---
No change.
---
 .../devicetree/bindings/arm/freescale/fsl,scu.txt| 16 
 1 file changed, 16 insertions(+)

diff --git a/Documentation/devicetree/bindings/arm/freescale/fsl,scu.txt 
b/Documentation/devicetree/bindings/arm/freescale/fsl,scu.txt
index a575e42..fc3844e 100644
--- a/Documentation/devicetree/bindings/arm/freescale/fsl,scu.txt
+++ b/Documentation/devicetree/bindings/arm/freescale/fsl,scu.txt
@@ -155,6 +155,17 @@ Required properties:
 Optional properties:
 - timeout-sec: contains the watchdog timeout in seconds.
 
+Thermal bindings based on SCU Message Protocol
+
+
+Required properties:
+- compatible:  Should be :
+ "fsl,imx8qxp-sc-thermal"
+   followed by "fsl,imx-sc-thermal";
+
+- #thermal-sensor-cells:   See 
Documentation/devicetree/bindings/thermal/thermal.txt
+   for a description.
+
 Example (imx8qxp):
 -
 aliases {
@@ -222,6 +233,11 @@ firmware {
compatible = "fsl,imx8qxp-sc-wdt", "fsl,imx-sc-wdt";
timeout-sec = <60>;
};
+
+   tsens: thermal-sensor {
+   compatible = "fsl,imx8qxp-sc-thermal", 
"fsl,imx-sc-thermal";
+   #thermal-sensor-cells = <1>;
+   };
};
 };
 
-- 
2.7.4



[PATCH V14 2/5] thermal: of-thermal: add API for getting sensor ID from DT

2019-06-09 Thread Anson . Huang
From: Anson Huang 

On some platforms like i.MX8QXP, the thermal driver needs a
real HW sensor ID from DT thermal zone, the HW sensor ID is
used to get temperature from SCU firmware, and the virtual
sensor ID starting from 0 to N is NOT used at all, this patch
adds new API thermal_zone_of_get_sensor_id() to provide the
feature of getting sensor ID from DT thermal zone's node.

Signed-off-by: Anson Huang 
---
Changes since V13:
- add new API into the thermal API doc.
---
 Documentation/thermal/sysfs-api.txt |  8 +
 drivers/thermal/of-thermal.c| 66 -
 include/linux/thermal.h | 10 ++
 3 files changed, 68 insertions(+), 16 deletions(-)

diff --git a/Documentation/thermal/sysfs-api.txt 
b/Documentation/thermal/sysfs-api.txt
index c3fa500..8d7f1b1 100644
--- a/Documentation/thermal/sysfs-api.txt
+++ b/Documentation/thermal/sysfs-api.txt
@@ -159,6 +159,14 @@ temperature) and throttle appropriate devices.
for the thermal zone device, which might be useful for platform
drivers for temperature calculations.
 
+1.1.9 int thermal_zone_of_get_sensor_id(struct device_node *tz_np,
+   struct device_node *sensor_np,
+   u32 *id)
+
+   This interface is used to get the sensor id from thermal sensor's
+   phandle argument, it might be necessary for some platforms which
+   have specific sensor ID rather than virtual ID from 0 - N.
+
 1.2 thermal cooling device interface
 1.2.1 struct thermal_cooling_device *thermal_cooling_device_register(char 
*name,
void *devdata, struct thermal_cooling_device_ops *)
diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c
index dc5093b..a53792b 100644
--- a/drivers/thermal/of-thermal.c
+++ b/drivers/thermal/of-thermal.c
@@ -449,6 +449,54 @@ thermal_zone_of_add_sensor(struct device_node *zone,
 }
 
 /**
+ * thermal_zone_of_get_sensor_id - get sensor ID from a DT thermal zone
+ * @tz_np: a valid thermal zone device node.
+ * @sensor_np: a sensor node of a valid sensor device.
+ * @id: a sensor ID pointer will be passed back.
+ *
+ * This function will get sensor ID from a given thermal zone node, use
+ * "thermal-sensors" as list name, and get sensor ID from first phandle's
+ * argument.
+ *
+ * Return: 0 on success, proper error code otherwise.
+ */
+
+int thermal_zone_of_get_sensor_id(struct device_node *tz_np,
+ struct device_node *sensor_np,
+ u32 *id)
+{
+   struct of_phandle_args sensor_specs;
+   int ret;
+
+   ret = of_parse_phandle_with_args(tz_np,
+"thermal-sensors",
+"#thermal-sensor-cells",
+0,
+&sensor_specs);
+   if (ret)
+   return ret;
+
+   if (sensor_specs.np != sensor_np) {
+   of_node_put(sensor_specs.np);
+   return -ENODEV;
+   }
+
+   if (sensor_specs.args_count >= 1) {
+   *id = sensor_specs.args[0];
+   WARN(sensor_specs.args_count > 1,
+"%pOFn: too many cells in sensor specifier %d\n",
+sensor_specs.np, sensor_specs.args_count);
+   } else {
+   *id = 0;
+   }
+
+   of_node_put(sensor_specs.np);
+
+   return 0;
+}
+EXPORT_SYMBOL_GPL(thermal_zone_of_get_sensor_id);
+
+/**
  * thermal_zone_of_sensor_register - registers a sensor to a DT thermal zone
  * @dev: a valid struct device pointer of a sensor device. Must contain
  *   a valid .of_node, for the sensor node.
@@ -499,36 +547,22 @@ thermal_zone_of_sensor_register(struct device *dev, int 
sensor_id, void *data,
sensor_np = of_node_get(dev->of_node);
 
for_each_available_child_of_node(np, child) {
-   struct of_phandle_args sensor_specs;
int ret, id;
 
/* For now, thermal framework supports only 1 sensor per zone */
-   ret = of_parse_phandle_with_args(child, "thermal-sensors",
-"#thermal-sensor-cells",
-0, &sensor_specs);
+   ret = thermal_zone_of_get_sensor_id(child, sensor_np, &id);
if (ret)
continue;
 
-   if (sensor_specs.args_count >= 1) {
-   id = sensor_specs.args[0];
-   WARN(sensor_specs.args_count > 1,
-"%pOFn: too many cells in sensor specifier %d\n",
-sensor_specs.np, sensor_specs.args_count);
-   } else {
-   id = 0;
-   }
-
-   if (sensor_specs.np == sensor_np && id == sensor_id) {
+   if (id == sensor_id) {
tzd = thermal_zone_of_add_sensor(child, sensor_np

[PATCH V14 5/5] arm64: dts: imx: add i.MX8QXP thermal support

2019-06-09 Thread Anson . Huang
From: Anson Huang 

Add i.MX8QXP CPU thermal zone support.

Signed-off-by: Anson Huang 
---
No change.
---
 arch/arm64/boot/dts/freescale/imx8qxp.dtsi | 37 ++
 1 file changed, 37 insertions(+)

diff --git a/arch/arm64/boot/dts/freescale/imx8qxp.dtsi 
b/arch/arm64/boot/dts/freescale/imx8qxp.dtsi
index b2cb818..12044be 100644
--- a/arch/arm64/boot/dts/freescale/imx8qxp.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8qxp.dtsi
@@ -10,6 +10,7 @@
 #include 
 #include 
 #include 
+#include 
 
 / {
interrupt-parent = <&gic>;
@@ -168,6 +169,11 @@
compatible = "fsl,imx8qxp-sc-wdt", "fsl,imx-sc-wdt";
timeout-sec = <60>;
};
+
+   tsens: thermal-sensor {
+   compatible = "fsl,imx8qxp-sc-thermal", 
"fsl,imx-sc-thermal";
+   #thermal-sensor-cells = <1>;
+   };
};
 
timer {
@@ -536,4 +542,35 @@
power-domains = <&pd IMX_SC_R_GPIO_7>;
};
};
+
+   thermal_zones: thermal-zones {
+   cpu-thermal0 {
+   polling-delay-passive = <250>;
+   polling-delay = <2000>;
+   thermal-sensors = <&tsens IMX_SC_R_SYSTEM>;
+   trips {
+   cpu_alert0: trip0 {
+   temperature = <107000>;
+   hysteresis = <2000>;
+   type = "passive";
+   };
+   cpu_crit0: trip1 {
+   temperature = <127000>;
+   hysteresis = <2000>;
+   type = "critical";
+   };
+   };
+   cooling-maps {
+   map0 {
+   trip = <&cpu_alert0>;
+   cooling-device =
+   <&A35_0 THERMAL_NO_LIMIT 
THERMAL_NO_LIMIT>,
+   <&A35_1 THERMAL_NO_LIMIT 
THERMAL_NO_LIMIT>,
+   <&A35_2 THERMAL_NO_LIMIT 
THERMAL_NO_LIMIT>,
+   <&A35_3 THERMAL_NO_LIMIT 
THERMAL_NO_LIMIT>;
+
+   };
+   };
+   };
+   };
 };
-- 
2.7.4



[PATCH V14 3/5] thermal: imx_sc: add i.MX system controller thermal support

2019-06-09 Thread Anson . Huang
From: Anson Huang 

i.MX8QXP is an ARMv8 SoC which has a Cortex-M4 system controller
inside, the system controller is in charge of controlling power,
clock and thermal sensors etc..

This patch adds i.MX system controller thermal driver support,
Linux kernel has to communicate with system controller via MU
(message unit) IPC to get each thermal sensor's temperature,
it supports multiple sensors which are passed from device tree,
please see the binding doc for details.

Signed-off-by: Anson Huang 
---
No change.
---
 drivers/thermal/Kconfig  |  11 +++
 drivers/thermal/Makefile |   1 +
 drivers/thermal/imx_sc_thermal.c | 142 +++
 3 files changed, 154 insertions(+)
 create mode 100644 drivers/thermal/imx_sc_thermal.c

diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index 9966364..454cbe5 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -233,6 +233,17 @@ config IMX_THERMAL
  cpufreq is used as the cooling device to throttle CPUs when the
  passive trip is crossed.
 
+config IMX_SC_THERMAL
+   tristate "Temperature sensor driver for NXP i.MX SoCs with System 
Controller"
+   depends on ARCH_MXC && IMX_SCU
+   depends on OF
+   help
+ Support for Temperature Monitor (TEMPMON) found on NXP i.MX SoCs with
+ system controller inside, Linux kernel has to communicate with system
+ controller via MU (message unit) IPC to get temperature from thermal
+ sensor. It supports one critical trip point and one
+ passive trip point for each thermal sensor.
+
 config MAX77620_THERMAL
tristate "Temperature sensor driver for Maxim MAX77620 PMIC"
depends on MFD_MAX77620
diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile
index 74a37c7..717a1ba 100644
--- a/drivers/thermal/Makefile
+++ b/drivers/thermal/Makefile
@@ -41,6 +41,7 @@ obj-$(CONFIG_DB8500_THERMAL)  += db8500_thermal.o
 obj-$(CONFIG_ARMADA_THERMAL)   += armada_thermal.o
 obj-$(CONFIG_TANGO_THERMAL)+= tango_thermal.o
 obj-$(CONFIG_IMX_THERMAL)  += imx_thermal.o
+obj-$(CONFIG_IMX_SC_THERMAL)   += imx_sc_thermal.o
 obj-$(CONFIG_MAX77620_THERMAL) += max77620_thermal.o
 obj-$(CONFIG_QORIQ_THERMAL)+= qoriq_thermal.o
 obj-$(CONFIG_DA9062_THERMAL)   += da9062-thermal.o
diff --git a/drivers/thermal/imx_sc_thermal.c b/drivers/thermal/imx_sc_thermal.c
new file mode 100644
index 000..d406ecb
--- /dev/null
+++ b/drivers/thermal/imx_sc_thermal.c
@@ -0,0 +1,142 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2018-2019 NXP.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "thermal_core.h"
+
+#define IMX_SC_MISC_FUNC_GET_TEMP  13
+
+static struct imx_sc_ipc *thermal_ipc_handle;
+
+struct imx_sc_sensor {
+   struct thermal_zone_device *tzd;
+   u32 resource_id;
+};
+
+struct req_get_temp {
+   u16 resource_id;
+   u8 type;
+} __packed;
+
+struct resp_get_temp {
+   u16 celsius;
+   u8 tenths;
+} __packed;
+
+struct imx_sc_msg_misc_get_temp {
+   struct imx_sc_rpc_msg hdr;
+   union {
+   struct req_get_temp req;
+   struct resp_get_temp resp;
+   } data;
+};
+
+static int imx_sc_thermal_get_temp(void *data, int *temp)
+{
+   struct imx_sc_msg_misc_get_temp msg;
+   struct imx_sc_rpc_msg *hdr = &msg.hdr;
+   struct imx_sc_sensor *sensor = data;
+   int ret;
+
+   msg.data.req.resource_id = sensor->resource_id;
+   msg.data.req.type = IMX_SC_C_TEMP;
+
+   hdr->ver = IMX_SC_RPC_VERSION;
+   hdr->svc = IMX_SC_RPC_SVC_MISC;
+   hdr->func = IMX_SC_MISC_FUNC_GET_TEMP;
+   hdr->size = 2;
+
+   ret = imx_scu_call_rpc(thermal_ipc_handle, &msg, true);
+   if (ret) {
+   dev_err(&sensor->tzd->device, "read temp sensor %d failed, ret 
%d\n",
+   sensor->resource_id, ret);
+   return ret;
+   }
+
+   *temp = msg.data.resp.celsius * 1000 + msg.data.resp.tenths * 100;
+
+   return 0;
+}
+
+static const struct thermal_zone_of_device_ops imx_sc_thermal_ops = {
+   .get_temp = imx_sc_thermal_get_temp,
+};
+
+static int imx_sc_thermal_probe(struct platform_device *pdev)
+{
+   struct device_node *np, *child, *sensor_np;
+   struct imx_sc_sensor *sensor;
+   int ret;
+
+   ret = imx_scu_get_handle(&thermal_ipc_handle);
+   if (ret)
+   return ret;
+
+   np = of_find_node_by_name(NULL, "thermal-zones");
+   if (!np)
+   return -ENODEV;
+
+   sensor_np = of_node_get(pdev->dev.of_node);
+
+   for_each_available_child_of_node(np, child) {
+   sensor = devm_kzalloc(&pdev->dev, sizeof(*sensor), GFP_KERNEL);
+   if (!sensor) {
+   of_node_put(sensor_np);
+   return -ENOMEM;
+   }
+
+   ret = thermal_zone_of_get_sensor_id(ch

Re: [PATCH v3 08/20] docs: zh_CN: avoid duplicate citation references

2019-06-09 Thread Alex Shi
Acked!

Thanks!
Alex

On 2019/6/8 2:54 上午, Mauro Carvalho Chehab wrote:
> Documentation/process/programming-language.rst:44: WARNING: duplicate 
> citation n2049, other instance in 
> Documentation/translations/zh_CN/process/programming-language.rst
> 
> Signed-off-by: Mauro Carvalho Chehab