Browse Source

thermal: ti-soc-thermal: use standard GPIO DT bindings

This change updates the ti-soc-thermal driver to use
standard GPIO DT bindings to read the GPIO number associated
to thermal shutdown IRQ, in case the device features it.

Previously, the code was using a specific DT bindings.
As now OMAP supports the standard way to model GPIOs,
there is no point in having a ti specific binding.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Grant Likely <grant.likely@linaro.org>
Cc: Rob Herring <rob.herring@calxeda.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: devicetree-discuss@lists.ozlabs.org
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Eduardo Valentin 12 years ago
parent
commit
57d1617137

+ 5 - 4
Documentation/devicetree/bindings/thermal/ti_soc_thermal.txt

@@ -17,8 +17,9 @@ Required properties:
 - interrupts : this entry should indicate which interrupt line
 - interrupts : this entry should indicate which interrupt line
 the talert signal is routed to;
 the talert signal is routed to;
 Specific:
 Specific:
-- ti,tshut-gpio : this entry should be used to inform which GPIO
-line the tshut signal is routed to;
+- gpios : this entry should be used to inform which GPIO
+line the tshut signal is routed to. The informed GPIO will
+be treated as an IRQ;
 - regs : this entry must also be specified and it is specific
 - regs : this entry must also be specified and it is specific
 to each bandgap version, because the mapping may change from
 to each bandgap version, because the mapping may change from
 soc to soc, apart of depending on available features.
 soc to soc, apart of depending on available features.
@@ -37,7 +38,7 @@ bandgap {
 		0x4a002378 0x18>;
 		0x4a002378 0x18>;
 	compatible = "ti,omap4460-bandgap";
 	compatible = "ti,omap4460-bandgap";
 	interrupts = <0 126 4>; /* talert */
 	interrupts = <0 126 4>; /* talert */
-	ti,tshut-gpio = <86>;
+	gpios = <&gpio3 22 0>; /* tshut */
 };
 };
 
 
 OMAP4470:
 OMAP4470:
@@ -47,7 +48,7 @@ bandgap {
 		0x4a002378 0x18>;
 		0x4a002378 0x18>;
 	compatible = "ti,omap4470-bandgap";
 	compatible = "ti,omap4470-bandgap";
 	interrupts = <0 126 4>; /* talert */
 	interrupts = <0 126 4>; /* talert */
-	ti,tshut-gpio = <86>;
+	gpios = <&gpio3 22 0>; /* tshut */
 };
 };
 
 
 OMAP5430:
 OMAP5430:

+ 2 - 6
drivers/thermal/ti-soc-thermal/ti-bandgap.c

@@ -38,6 +38,7 @@
 #include <linux/of_device.h>
 #include <linux/of_device.h>
 #include <linux/of_platform.h>
 #include <linux/of_platform.h>
 #include <linux/of_irq.h>
 #include <linux/of_irq.h>
+#include <linux/of_gpio.h>
 #include <linux/io.h>
 #include <linux/io.h>
 
 
 #include "ti-bandgap.h"
 #include "ti-bandgap.h"
@@ -1129,7 +1130,6 @@ static struct ti_bandgap *ti_bandgap_build(struct platform_device *pdev)
 	const struct of_device_id *of_id;
 	const struct of_device_id *of_id;
 	struct ti_bandgap *bgp;
 	struct ti_bandgap *bgp;
 	struct resource *res;
 	struct resource *res;
-	u32 prop;
 	int i;
 	int i;
 
 
 	/* just for the sake */
 	/* just for the sake */
@@ -1173,11 +1173,7 @@ static struct ti_bandgap *ti_bandgap_build(struct platform_device *pdev)
 	} while (res);
 	} while (res);
 
 
 	if (TI_BANDGAP_HAS(bgp, TSHUT)) {
 	if (TI_BANDGAP_HAS(bgp, TSHUT)) {
-		if (of_property_read_u32(node, "ti,tshut-gpio", &prop) < 0) {
-			dev_err(&pdev->dev, "missing tshut gpio in device tree\n");
-			return ERR_PTR(-EINVAL);
-		}
-		bgp->tshut_gpio = prop;
+		bgp->tshut_gpio = of_get_gpio(node, 0);
 		if (!gpio_is_valid(bgp->tshut_gpio)) {
 		if (!gpio_is_valid(bgp->tshut_gpio)) {
 			dev_err(&pdev->dev, "invalid gpio for tshut (%d)\n",
 			dev_err(&pdev->dev, "invalid gpio for tshut (%d)\n",
 				bgp->tshut_gpio);
 				bgp->tshut_gpio);