Skip to contentSkip to conversation

power: Add simple poweroff-gpio driver

DISCUSSION Dave Jones 4 participants 9 messages Dec 13, 2012 – Dec 14, 2012 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Dave Jones

author
#1 lore raw
Quoted 8 lines · Linux Kernel
Gitweb:     http://git.kernel.org/linus/;a=commit;h=96ff0f5c7efd4a2205c48a76a6a1fcd2731e6128
Commit:     96ff0f5c7efd4a2205c48a76a6a1fcd2731e6128
Parent:     f4a00139b7cbeff538e616a21f6b57249a9d3ed8
Author:     Jamie Lentin <[email protected]>
AuthorDate: Sat Nov 17 09:51:04 2012 +0100
Committer:  Jason Cooper <[email protected]>
CommitDate: Sat Nov 24 02:56:38 2012 +0000
Quoted 5 lines

power: Add simple poweroff-gpio driver

Given appropriate devicetree bindings, this driver registers a pm_power_off function to set a GPIO line high/low to power down your board.

Given this seems to be dependant on device-tree, shouldn't there be some 'depends on' in the kconfig to prevent this showing up on architectures that don't implement it ?

Quoted 5 lines
(quoted diff) +5 -0
+menuconfig POWER_RESET
+	bool "Board level reset or power off"
+	help
+	  Provides a number of drivers which either reset a complete board
+	  or shut it down, by manipulating the main power supply on the board.

Review

Quoted 10 lines
(quoted diff) +10 -0
+
+	  Say Y here to enable board reset and power off
+
+config POWER_RESET_GPIO
+	bool "GPIO power-off driver"
+	depends on OF_GPIO && POWER_RESET
+	help
+	  This driver supports turning off your board via a GPIO line.
+	  If your board needs a GPIO high/low to power down, say Y and
+	  create a binding in your devicetree.

If not, upon seeing this, I suspect many users will ask "how do I know if I need this?" given there's no mention of the sort of hardware this is useful on.

Dave

#2 lore raw
Quoted 19 lines · Dave Jones
Quoted 8 lines · Linux Kernel
Gitweb:     http://git.kernel.org/linus/;a=commit;h=96ff0f5c7efd4a2205c48a76a6a1fcd2731e6128
Commit:     96ff0f5c7efd4a2205c48a76a6a1fcd2731e6128
Parent:     f4a00139b7cbeff538e616a21f6b57249a9d3ed8
Author:     Jamie Lentin <[email protected]>
AuthorDate: Sat Nov 17 09:51:04 2012 +0100
Committer:  Jason Cooper <[email protected]>
CommitDate: Sat Nov 24 02:56:38 2012 +0000
Quoted 5 lines

power: Add simple poweroff-gpio driver

Given appropriate devicetree bindings, this driver registers a pm_power_off function to set a GPIO line high/low to power down your board.

Given this seems to be dependant on device-tree, shouldn't there be some 'depends on' in the kconfig to prevent this showing up on architectures that don't implement it ?

Quoted 11 lines

Review

Quoted 11 lines
(quoted diff) +11 -0
+menuconfig POWER_RESET
+	bool "Board level reset or power off"
+	help
+	  Provides a number of drivers which either reset a complete board
+	  or shut it down, by manipulating the main power supply on the board.
+
+	  Say Y here to enable board reset and power off
+
+config POWER_RESET_GPIO
+	bool "GPIO power-off driver"
+	depends on OF_GPIO && POWER_RESET

Hi Dave

Don't these depends on here do what you want?

Quoted 7 lines

Review

Quoted 4 lines
(quoted diff) +4 -0
+	help
+	  This driver supports turning off your board via a GPIO line.
+	  If your board needs a GPIO high/low to power down, say Y and
+	  create a binding in your devicetree.

If not, upon seeing this, I suspect many users will ask "how do I know if I need this?" given there's no mention of the sort of hardware this is useful on.

Its a generic driver. I know its useful on various Marvell kirkwood and orion5x devices. I've also heard it useful on some Tegra boards.

Are you asking i list these boards?

Thanks
Andrew

#3 lore raw
Quoted 44 lines · Andrew Lunn
Quoted 19 lines · Dave Jones
Quoted 8 lines · Linux Kernel
Gitweb:     http://git.kernel.org/linus/;a=commit;h=96ff0f5c7efd4a2205c48a76a6a1fcd2731e6128
Commit:     96ff0f5c7efd4a2205c48a76a6a1fcd2731e6128
Parent:     f4a00139b7cbeff538e616a21f6b57249a9d3ed8
Author:     Jamie Lentin <[email protected]>
AuthorDate: Sat Nov 17 09:51:04 2012 +0100
Committer:  Jason Cooper <[email protected]>
CommitDate: Sat Nov 24 02:56:38 2012 +0000
Quoted 5 lines

power: Add simple poweroff-gpio driver

Given appropriate devicetree bindings, this driver registers a pm_power_off function to set a GPIO line high/low to power down your board.

Given this seems to be dependant on device-tree, shouldn't there be some 'depends on' in the kconfig to prevent this showing up on architectures that don't implement it ?

Quoted 11 lines

Review

Quoted 11 lines
(quoted diff) +11 -0
+menuconfig POWER_RESET
+	bool "Board level reset or power off"
+	help
+	  Provides a number of drivers which either reset a complete board
+	  or shut it down, by manipulating the main power supply on the board.
+
+	  Say Y here to enable board reset and power off
+
+config POWER_RESET_GPIO
+	bool "GPIO power-off driver"
+	depends on OF_GPIO && POWER_RESET

Hi Dave

Don't these depends on here do what you want?

Quoted 7 lines

Review

Quoted 4 lines
(quoted diff) +4 -0
+	help
+	  This driver supports turning off your board via a GPIO line.
+	  If your board needs a GPIO high/low to power down, say Y and
+	  create a binding in your devicetree.

If not, upon seeing this, I suspect many users will ask "how do I know if I need this?" given there's no mention of the sort of hardware this is useful on.

Quoted 4 lines

Its a generic driver. I know its useful on various Marvell kirkwood and orion5x devices. I've also heard it useful on some Tegra boards.

Are you asking i list these boards?

Even if you did, it'd rapidly go out of date I suspect. How about turning it on it's head?

If the device tree for your board includes a gpio-poweroff node, say Y. Otherwise, say N. You can find the device tree in arch/*/boot/dts/

Quoted 4 lines

Thanks
Andrew

Signature · 1 line
Jamie Lentin
author
#4 lore raw
In reply to Andrew Lunn
Quoted 16 lines · Andrew Lunn
Quoted 4 lines

Given this seems to be dependant on device-tree, shouldn't there be some 'depends on' in the kconfig to prevent this showing up on architectures that don't implement it ?

Quoted 11 lines

Review

Quoted 11 lines
(quoted diff) +11 -0
+menuconfig POWER_RESET
+	bool "Board level reset or power off"
+	help
+	  Provides a number of drivers which either reset a complete board
+	  or shut it down, by manipulating the main power supply on the board.
+
+	  Say Y here to enable board reset and power off
+
+config POWER_RESET_GPIO
+	bool "GPIO power-off driver"
+	depends on OF_GPIO && POWER_RESET
Quoted 1 line

Don't these depends on here do what you want?

I think it needs to be on the menuconfig, rather than the child options. I don't have OF_GPIO, but I still got asked for the former.

Quoted 7 lines
Quoted 2 lines

If not, upon seeing this, I suspect many users will ask "how do I know if I need this?" given there's no mention of the sort of hardware this is useful on.

Its a generic driver. I know its useful on various Marvell kirkwood and orion5x devices. I've also heard it useful on some Tegra boards.

Are you asking i list these boards?

No, but at least mentioning the architecture might have clued me in quicker that this wasn't some now ACPI-ism when I saw it on x86.

Dave

#5 lore raw
Quoted 18 lines · Dave Jones
Quoted 16 lines · Andrew Lunn
Quoted 15 lines

Given this seems to be dependant on device-tree, shouldn't there be some 'depends on' in the kconfig to prevent this showing up on architectures that don't implement it ?

Quoted 11 lines
(quoted diff) +11 -0
+menuconfig POWER_RESET
+	bool "Board level reset or power off"
+	help
+	  Provides a number of drivers which either reset a complete board
+	  or shut it down, by manipulating the main power supply on the board.
+
+	  Say Y here to enable board reset and power off
+
+config POWER_RESET_GPIO
+	bool "GPIO power-off driver"
+	depends on OF_GPIO && POWER_RESET
Quoted 4 lines
Quoted 1 line

Don't these depends on here do what you want?

I think it needs to be on the menuconfig, rather than the child options. I don't have OF_GPIO, but I still got asked for the former.

The menuconfig enables a class of drivers (at least theoretically in the future, when more such drivers turn up), and there's no reason to believe that all of those drivers will depend on OF. So in my opinion, making POWER_RESET_GPIO depend on OF makes sense, but making POWER_RESET depend on it doesn't.

Another solution might be to remove the menuconfig, and just include the option for the individual driver.

#6 lore raw
Quoted 8 lines
Quoted 2 lines

I think it needs to be on the menuconfig, rather than the child options. I don't have OF_GPIO, but I still got asked for the former.

The menuconfig enables a class of drivers (at least theoretically in the future, when more such drivers turn up), and there's no reason to believe that all of those drivers will depend on OF. So in my opinion, making POWER_RESET_GPIO depend on OF makes sense, but making POWER_RESET depend on it doesn't.

I have another driver coming soon which will not depend on OF_GPIO. It does however depend on OF. Its for a class of boards which have a microcontroller controlling the main power supply, and sending an character over a UART port is used to turn the board power off.

There might also be some legacy drivers which could be moved here which don't depend on OF at all.

So i would prefer to keep POWER_RESET generic.

Andrew

author
#7 lore raw
Quoted 14 lines · Andrew Lunn
Quoted 8 lines
Quoted 2 lines

I think it needs to be on the menuconfig, rather than the child options. I don't have OF_GPIO, but I still got asked for the former.

The menuconfig enables a class of drivers (at least theoretically in the future, when more such drivers turn up), and there's no reason to believe that all of those drivers will depend on OF. So in my opinion, making POWER_RESET_GPIO depend on OF makes sense, but making POWER_RESET depend on it doesn't.

I have another driver coming soon which will not depend on OF_GPIO. It does however depend on OF. Its for a class of boards which have a microcontroller controlling the main power supply, and sending an character over a UART port is used to turn the board power off.

Quoted 4 lines

There might also be some legacy drivers which could be moved here which don't depend on OF at all.

So i would prefer to keep POWER_RESET generic.

Perhaps a CONFIG_ARCH_WANT_POWER_RESET option for arches that opt-in ?

Dave

#8 lore raw
In reply to Dave Jones
Quoted 8 lines
Quoted 4 lines

Its a generic driver. I know its useful on various Marvell kirkwood and orion5x devices. I've also heard it useful on some Tegra boards.

Are you asking i list these boards?

No, but at least mentioning the architecture might have clued me in quicker that this wasn't some now ACPI-ism when I saw it on x86.

Hi Dave

It is architecture independent. There are examples of ARM, AVR32, & unicore32 boards which could use this and there might be more.

Andrew

author
#9 lore raw
Quoted 6 lines · Andrew Lunn
Quoted 5 lines
Quoted 4 lines

Its a generic driver. I know its useful on various Marvell kirkwood and orion5x devices. I've also heard it useful on some Tegra boards.

Are you asking i list these boards?

Quoted 7 lines
Quoted 2 lines

No, but at least mentioning the architecture might have clued me in quicker that this wasn't some now ACPI-ism when I saw it on x86.

Hi Dave

It is architecture independent. There are examples of ARM, AVR32, & unicore32 boards which could use this and there might be more.

Right, but as I alluded to in my other mail, if those archs define ARCH_NEED_POWEROFF or similar, this won't show up on arches that don't care.

Dave