[7/7] thermal: rcar: add Device Tree support
diff mbox

Message ID 87obg5pvsd.wl%kuninori.morimoto.gx@renesas.com
State Accepted, archived
Delegated to: Zhang Rui
Headers show

Commit Message

Kuninori Morimoto Jan. 31, 2013, 9:05 a.m. UTC
Support for loading the Renesas R-Car thermal module via devicetree.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 .../devicetree/bindings/thermal/rcar-thermal.txt   |   29 ++++++++++++++++++++
 drivers/thermal/rcar_thermal.c                     |    7 +++++
 2 files changed, 36 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/thermal/rcar-thermal.txt

Comments

Zhang Rui Feb. 6, 2013, 5:37 a.m. UTC | #1
On Thu, 2013-01-31 at 01:05 -0800, Kuninori Morimoto wrote:
> Support for loading the Renesas R-Car thermal module via devicetree.
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>  .../devicetree/bindings/thermal/rcar-thermal.txt   |   29 ++++++++++++++++++++
>  drivers/thermal/rcar_thermal.c                     |    7 +++++
>  2 files changed, 36 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/thermal/rcar-thermal.txt
> 
> diff --git a/Documentation/devicetree/bindings/thermal/rcar-thermal.txt b/Documentation/devicetree/bindings/thermal/rcar-thermal.txt
> new file mode 100644
> index 0000000..28ef498
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/thermal/rcar-thermal.txt
> @@ -0,0 +1,29 @@
> +* Renesas R-Car Thermal
> +
> +Required properties:
> +- compatible		: "renesas,rcar-thermal"
> +- reg			: Address range of the thermal registers.
> +			  The 1st reg will be recognized as common register
> +			  if it has "interrupts".
> +
> +Option properties:
> +
> +- interrupts		: use interrupt
> +
> +Example (non interrupt support):
> +
> +thermal@e61f0100 {
> +	compatible = "renesas,rcar-thermal";
> +	reg = <0xe61f0100 0x38>;
> +};
> +
> +Example (interrupt support):
> +
> +thermal@e61f0000 {
> +	compatible = "renesas,rcar-thermal";
> +	reg = <0xe61f0000 0x14
> +		0xe61f0100 0x38
> +		0xe61f0200 0x38
> +		0xe61f0300 0x38>;
> +	interrupts = <0 69 4>;
> +};
> diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
> index 80aae3c..3bd8918 100644
> --- a/drivers/thermal/rcar_thermal.c
> +++ b/drivers/thermal/rcar_thermal.c
> @@ -477,9 +477,16 @@ static int rcar_thermal_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> +static const struct of_device_id rcar_thermal_dt_ids[] __devinitconst = {
> +	{ .compatible = "renesas,rcar-thermal", },
> +	{},
> +};
> +MODULE_DEVICE_TABLE(of, rcar_thermal_dt_ids);
> +
you do not need 
#ifdef CONFIG_OF
here?

thanks,
rui
>  static struct platform_driver rcar_thermal_driver = {
>  	.driver	= {
>  		.name	= "rcar_thermal",
> +		.of_match_table = rcar_thermal_dt_ids,
>  	},
>  	.probe		= rcar_thermal_probe,
>  	.remove		= rcar_thermal_remove,


--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Kuninori Morimoto Feb. 6, 2013, 8:30 a.m. UTC | #2
Hi Zhang

Thank you for checking patch

> > +static const struct of_device_id rcar_thermal_dt_ids[] __devinitconst = {
> > +	{ .compatible = "renesas,rcar-thermal", },
> > +	{},
> > +};
> > +MODULE_DEVICE_TABLE(of, rcar_thermal_dt_ids);
> > +
> you do not need 
> #ifdef CONFIG_OF
> here?

I didn't get any compile error here with/without CONFIG_OF.
Of course I can add it if you want.

Best regards
---
Kuninori Morimoto
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Zhang Rui Feb. 6, 2013, 8:36 a.m. UTC | #3
On Wed, 2013-02-06 at 00:30 -0800, Kuninori Morimoto wrote:
> Hi Zhang
> 
> Thank you for checking patch
> 
> > > +static const struct of_device_id rcar_thermal_dt_ids[] __devinitconst = {
> > > +	{ .compatible = "renesas,rcar-thermal", },
> > > +	{},
> > > +};
> > > +MODULE_DEVICE_TABLE(of, rcar_thermal_dt_ids);
> > > +
> > you do not need 
> > #ifdef CONFIG_OF
> > here?
> 
> I didn't get any compile error here with/without CONFIG_OF.
> Of course I can add it if you want.
> 
I checked some other drivers, some use #ifdef while some not.
I'm okay with this.
patch applied to thermal -next.

thanks,
rui

> Best regards
> ---
> Kuninori Morimoto


--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Kuninori Morimoto Feb. 6, 2013, 8:37 a.m. UTC | #4
Hi Zhang

> > I didn't get any compile error here with/without CONFIG_OF.
> > Of course I can add it if you want.
> > 
> I checked some other drivers, some use #ifdef while some not.
> I'm okay with this.
> patch applied to thermal -next.

Thank you for your help !

Best regards
---
Kuninori Morimoto
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/Documentation/devicetree/bindings/thermal/rcar-thermal.txt b/Documentation/devicetree/bindings/thermal/rcar-thermal.txt
new file mode 100644
index 0000000..28ef498
--- /dev/null
+++ b/Documentation/devicetree/bindings/thermal/rcar-thermal.txt
@@ -0,0 +1,29 @@ 
+* Renesas R-Car Thermal
+
+Required properties:
+- compatible		: "renesas,rcar-thermal"
+- reg			: Address range of the thermal registers.
+			  The 1st reg will be recognized as common register
+			  if it has "interrupts".
+
+Option properties:
+
+- interrupts		: use interrupt
+
+Example (non interrupt support):
+
+thermal@e61f0100 {
+	compatible = "renesas,rcar-thermal";
+	reg = <0xe61f0100 0x38>;
+};
+
+Example (interrupt support):
+
+thermal@e61f0000 {
+	compatible = "renesas,rcar-thermal";
+	reg = <0xe61f0000 0x14
+		0xe61f0100 0x38
+		0xe61f0200 0x38
+		0xe61f0300 0x38>;
+	interrupts = <0 69 4>;
+};
diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
index 80aae3c..3bd8918 100644
--- a/drivers/thermal/rcar_thermal.c
+++ b/drivers/thermal/rcar_thermal.c
@@ -477,9 +477,16 @@  static int rcar_thermal_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct of_device_id rcar_thermal_dt_ids[] __devinitconst = {
+	{ .compatible = "renesas,rcar-thermal", },
+	{},
+};
+MODULE_DEVICE_TABLE(of, rcar_thermal_dt_ids);
+
 static struct platform_driver rcar_thermal_driver = {
 	.driver	= {
 		.name	= "rcar_thermal",
+		.of_match_table = rcar_thermal_dt_ids,
 	},
 	.probe		= rcar_thermal_probe,
 	.remove		= rcar_thermal_remove,