ARM: Kirkwood: enable GPIO fan alarm support for 2Big Network v2
PATCH 1/1 ARM: Kirkwood: enable GPIO fan alarm support for 2Big Network v2
On the LaCie 2Big Network v2 (net2big_v2) board, the fan alarm is not wired to the I2C fan controller but to a separe GPIO. This GPIO can be controlled by using the gpio-fan driver.
This patch adds the gpio-fan alarm description in the net2big_v2 DTS.
--- arch/arm/boot/dts/kirkwood-net2big.dts | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm/boot/dts/kirkwood-net2big.dts +5 -0
@@ -27,6 +27,11 @@ device_type = "memory"; reg = <0x00000000 0x10000000>; }; + + gpio_fan { + compatible = "gpio-fan"; + alarm-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>; + }; }; ®ulators {
Signature · 1 line
2.1.1
PATCH 1/1 ARM: Kirkwood: enable GPIO fan alarm support for 2Big Network v2
Quoted 18 lines · Simon Guinot
On the LaCie 2Big Network v2 (
net2big_v2) board, the fan alarm is not wired to the I2C fan controller but to a separe GPIO. This GPIO can be controlled by using the gpio-fan driver.This patch adds the gpio-fan alarm description in the
net2big_v2DTS.Signed-off-by Simon Guinot <[email protected]>--- arch/arm/boot/dts/kirkwood-net2big.dts | 5 +++++ 1 file changed, 5 insertions(+)arch/arm/boot/dts/kirkwood-net2big.dts +0
-0@@ -27,6 +27,11 @@ device_type = "memory";
arch/arm/boot/dts/kirkwood-net2big.dts line 37
Quoted 10 lines
arch/arm/boot/dts/kirkwood-net2big.dts +5
-0reg = <0x00000000 0x10000000>; }; + + gpio_fan { + compatible = "gpio-fan"; + alarm-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>; + }; }; ®ulators {
Again, wrong solution, and conceptually wrong as well from a dt perspective.
The alarm signal should be handled by the g762 driver, and the alarm-gpios property should be added to the g762 description.
Guenter
PATCH 1/1 ARM: Kirkwood: enable GPIO fan alarm support for 2Big Network v2
Quoted 27 lines · Guenter Roeck
Quoted 26 lines · Simon Guinot
On the LaCie 2Big Network v2 (
net2big_v2) board, the fan alarm is not wired to the I2C fan controller but to a separe GPIO. This GPIO can be controlled by using the gpio-fan driver.This patch adds the gpio-fan alarm description in the
net2big_v2DTS.Signed-off-by Simon Guinot <[email protected]>--- arch/arm/boot/dts/kirkwood-net2big.dts | 5 +++++ 1 file changed, 5 insertions(+)arch/arm/boot/dts/kirkwood-net2big.dts +5
-0@@ -27,6 +27,11 @@ device_type = "memory"; reg = <0x00000000 0x10000000>; }; + + gpio_fan { + compatible = "gpio-fan"; + alarm-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>; + }; };
Quoted 6 lines
arch/arm/boot/dts/kirkwood-net2big.dts line 37
Quoted 2 lines
arch/arm/boot/dts/kirkwood-net2big.dts +0
-0®ulators {Again, wrong solution, and conceptually wrong as well from a dt perspective.
The alarm signal should be handled by the g762 driver, and the alarm-gpios property should be added to the g762 description.
OK. Then you think it would be better to add support for alarm GPIOs support in the g762. The problem is that we should have to find a generic way to do that. After all, we could want the very same modification for a bunch of fan drivers.
Simon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150223/f288e6ea/attachment.sig>
PATCH 1/1 ARM: Kirkwood: enable GPIO fan alarm support for 2Big Network v2
Quoted 32 lines · Simon Guinot
Quoted 31 lines · Guenter Roeck
Quoted 18 lines · Simon Guinot
On the LaCie 2Big Network v2 (
net2big_v2) board, the fan alarm is not wired to the I2C fan controller but to a separe GPIO. This GPIO can be controlled by using the gpio-fan driver.This patch adds the gpio-fan alarm description in the
net2big_v2DTS.Signed-off-by Simon Guinot <[email protected]>--- arch/arm/boot/dts/kirkwood-net2big.dts | 5 +++++ 1 file changed, 5 insertions(+)arch/arm/boot/dts/kirkwood-net2big.dts +0
-0@@ -27,6 +27,11 @@ device_type = "memory";arch/arm/boot/dts/kirkwood-net2big.dts line 37
Quoted 10 lines
arch/arm/boot/dts/kirkwood-net2big.dts +5
-0reg = <0x00000000 0x10000000>; }; + + gpio_fan { + compatible = "gpio-fan"; + alarm-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>; + }; }; ®ulators {Again, wrong solution, and conceptually wrong as well from a dt perspective.
Quoted 8 lines
Quoted 2 lines
The alarm signal should be handled by the g762 driver, and the alarm-gpios property should be added to the g762 description.
OK. Then you think it would be better to add support for alarm GPIOs support in the g762. The problem is that we should have to find a generic way to do that. After all, we could want the very same modification for a bunch of fan drivers.
Can't help it. After all, the interrupt handling logic is different for each chip, and there are non-DT systems out there.
The g762 property should probably be something like
g762 at 3e {
compatible = "gmt,g762";
reg = <0x3e>;
clocks = <&g762_clk>;
interrupt-parent = <&gpio0>;
interrupts = <25 GPIO_ACTIVE_LOW>;
};struct i2c_client has an irq field, and as far as I can see it is filled in automatically from the dt node. So all the driver should have to do is to implement an interrupt handler.
Guenter
PATCH 1/1 ARM: Kirkwood: enable GPIO fan alarm support for 2Big Network v2
Quoted 54 lines · Guenter Roeck
Quoted 32 lines · Simon Guinot
Quoted 31 lines · Guenter Roeck
Quoted 18 lines · Simon Guinot
On the LaCie 2Big Network v2 (
net2big_v2) board, the fan alarm is not wired to the I2C fan controller but to a separe GPIO. This GPIO can be controlled by using the gpio-fan driver.This patch adds the gpio-fan alarm description in the
net2big_v2DTS.Signed-off-by Simon Guinot <[email protected]>--- arch/arm/boot/dts/kirkwood-net2big.dts | 5 +++++ 1 file changed, 5 insertions(+)arch/arm/boot/dts/kirkwood-net2big.dts +0
-0@@ -27,6 +27,11 @@ device_type = "memory";arch/arm/boot/dts/kirkwood-net2big.dts line 37
Quoted 10 lines
arch/arm/boot/dts/kirkwood-net2big.dts +5
-0reg = <0x00000000 0x10000000>; }; + + gpio_fan { + compatible = "gpio-fan"; + alarm-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>; + }; }; ®ulators {Again, wrong solution, and conceptually wrong as well from a dt perspective.
Quoted 8 lines
Quoted 2 lines
The alarm signal should be handled by the g762 driver, and the alarm-gpios property should be added to the g762 description.
OK. Then you think it would be better to add support for alarm GPIOs support in the g762. The problem is that we should have to find a generic way to do that. After all, we could want the very same modification for a bunch of fan drivers.
Can't help it. After all, the interrupt handling logic is different for each chip, and there are non-DT systems out there.
The g762 property should probably be something like
g762 at 3e { compatible = "gmt,g762"; reg = <0x3e>; clocks = <&g762_clk>; interrupt-parent = <&gpio0>; interrupts = <25 GPIO_ACTIVE_LOW>; };
Quoted 3 lines
struct
i2c_clienthas an irq field, and as far as I can see it is filled in automatically from the dt node. So all the driver should have to do is to implement an interrupt handler.
Is that OK to pass a GPIO line through the "interrupts" property ? Moreover it seems to me that g763 controller (compatible) supports alert interrupts through SMBus. Then maybe we should save the "interrupts" property for this signal ?
Don't you think it would be more explicit to have a separate DT property (such as "gpio-alarm") and also a dedicated field in the g762 platform data structure ?
Simon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150225/f63ba965/attachment.sig>
PATCH 1/1 ARM: Kirkwood: enable GPIO fan alarm support for 2Big Network v2
Quoted 55 lines · Simon Guinot
Quoted 54 lines · Guenter Roeck
Quoted 32 lines · Simon Guinot
Quoted 31 lines · Guenter Roeck
Quoted 18 lines · Simon Guinot
On the LaCie 2Big Network v2 (
net2big_v2) board, the fan alarm is not wired to the I2C fan controller but to a separe GPIO. This GPIO can be controlled by using the gpio-fan driver.This patch adds the gpio-fan alarm description in the
net2big_v2DTS.Signed-off-by Simon Guinot <[email protected]>--- arch/arm/boot/dts/kirkwood-net2big.dts | 5 +++++ 1 file changed, 5 insertions(+)arch/arm/boot/dts/kirkwood-net2big.dts +0
-0@@ -27,6 +27,11 @@ device_type = "memory";arch/arm/boot/dts/kirkwood-net2big.dts line 37
Quoted 10 lines
arch/arm/boot/dts/kirkwood-net2big.dts +5
-0reg = <0x00000000 0x10000000>; }; + + gpio_fan { + compatible = "gpio-fan"; + alarm-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>; + }; }; ®ulators {Again, wrong solution, and conceptually wrong as well from a dt perspective.
Quoted 8 lines
Quoted 2 lines
The alarm signal should be handled by the g762 driver, and the alarm-gpios property should be added to the g762 description.
OK. Then you think it would be better to add support for alarm GPIOs support in the g762. The problem is that we should have to find a generic way to do that. After all, we could want the very same modification for a bunch of fan drivers.
Can't help it. After all, the interrupt handling logic is different for each chip, and there are non-DT systems out there.
The g762 property should probably be something like
g762 at 3e { compatible = "gmt,g762"; reg = <0x3e>; clocks = <&g762_clk>; interrupt-parent = <&gpio0>; interrupts = <25 GPIO_ACTIVE_LOW>; };
Quoted 5 lines
Quoted 3 lines
struct
i2c_clienthas an irq field, and as far as I can see it is filled in automatically from the dt node. So all the driver should have to do is to implement an interrupt handler.Is that OK to pass a GPIO line through the "interrupts" property ?
Why not ? That is how it is supposed to be used. The driver neither needs to know nor should know that its interrupt line is connected to a gpio pin.
Quoted 4 lines
Moreover it seems to me that g763 controller (compatible) supports alert interrupts through SMBus. Then maybe we should save the "interrupts" property for this signal ?
You lost me there. The SMBus alert signal is shared among multiple chips. If a system supports it, it should be connected to the alert interrupt handler (in i2c-smbus.c), which would handle it and pass it to a driver's alert function.
Quoted 4 lines
Don't you think it would be more explicit to have a separate DT property (such as "gpio-alarm") and also a dedicated field in the g762 platform data structure ?
No. It would add an unnecessary dependency on gpio (or, rather, gpio driven interrupts) to the g762 driver, and it would limit its usability.
Guenter
PATCH 1/1 ARM: Kirkwood: enable GPIO fan alarm support for 2Big Network v2
Quoted 56 lines · Guenter Roeck
Quoted 55 lines · Simon Guinot
Quoted 54 lines · Guenter Roeck
Quoted 32 lines · Simon Guinot
Quoted 31 lines · Guenter Roeck
Quoted 18 lines · Simon Guinot
On the LaCie 2Big Network v2 (
net2big_v2) board, the fan alarm is not wired to the I2C fan controller but to a separe GPIO. This GPIO can be controlled by using the gpio-fan driver.This patch adds the gpio-fan alarm description in the
net2big_v2DTS.Signed-off-by Simon Guinot <[email protected]>--- arch/arm/boot/dts/kirkwood-net2big.dts | 5 +++++ 1 file changed, 5 insertions(+)arch/arm/boot/dts/kirkwood-net2big.dts +0
-0@@ -27,6 +27,11 @@ device_type = "memory";arch/arm/boot/dts/kirkwood-net2big.dts line 37
Quoted 10 lines
arch/arm/boot/dts/kirkwood-net2big.dts +5
-0reg = <0x00000000 0x10000000>; }; + + gpio_fan { + compatible = "gpio-fan"; + alarm-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>; + }; }; ®ulators {Again, wrong solution, and conceptually wrong as well from a dt perspective.
Quoted 8 lines
Quoted 2 lines
The alarm signal should be handled by the g762 driver, and the alarm-gpios property should be added to the g762 description.
OK. Then you think it would be better to add support for alarm GPIOs support in the g762. The problem is that we should have to find a generic way to do that. After all, we could want the very same modification for a bunch of fan drivers.
Can't help it. After all, the interrupt handling logic is different for each chip, and there are non-DT systems out there.
The g762 property should probably be something like
g762 at 3e { compatible = "gmt,g762"; reg = <0x3e>; clocks = <&g762_clk>; interrupt-parent = <&gpio0>; interrupts = <25 GPIO_ACTIVE_LOW>; };
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
struct
i2c_clienthas an irq field, and as far as I can see it is filled in automatically from the dt node. So all the driver should have to do is to implement an interrupt handler.Is that OK to pass a GPIO line through the "interrupts" property ?
Why not ? That is how it is supposed to be used. The driver neither needs to know nor should know that its interrupt line is connected to a gpio pin.
Well, I think we are interested in both the interrupt signal _and_ the GPIO value. We need to display the later through the sysfs fan1_alarm file.
Using the irq field from struct i2c_client is quite handy but the GPIO polarity information is lost...
That's why I think we should probably use a dedicated property.
Quoted 8 lines
Quoted 5 lines
Moreover it seems to me that g763 controller (compatible) supports alert interrupts through SMBus. Then maybe we should save the "interrupts" property for this signal ?
You lost me there. The SMBus alert signal is shared among multiple chips. If a system supports it, it should be connected to the alert interrupt handler (in
i2c-smbus.c), which would handle it and pass it to a driver's alert function.
It was a question. I was not knowing the proper way for a driver to connect with this interrupt. Thanks for the explanation.
Quoted 8 lines
Quoted 5 lines
Don't you think it would be more explicit to have a separate DT property (such as "gpio-alarm") and also a dedicated field in the g762 platform data structure ?
No. It would add an unnecessary dependency on gpio (or, rather, gpio driven interrupts) to the g762 driver, and it would limit its usability.
Considering we will have to read this GPIO, then we will have this dependency.
Simon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150225/bcc20b7c/attachment.sig>
PATCH 1/1 ARM: Kirkwood: enable GPIO fan alarm support for 2Big Network v2
Quoted 93 lines · Simon Guinot
Quoted 56 lines · Guenter Roeck
Quoted 55 lines · Simon Guinot
Quoted 54 lines · Guenter Roeck
Quoted 32 lines · Simon Guinot
Quoted 31 lines · Guenter Roeck
Quoted 18 lines · Simon Guinot
On the LaCie 2Big Network v2 (
net2big_v2) board, the fan alarm is not wired to the I2C fan controller but to a separe GPIO. This GPIO can be controlled by using the gpio-fan driver.This patch adds the gpio-fan alarm description in the
net2big_v2DTS.Signed-off-by Simon Guinot <[email protected]>--- arch/arm/boot/dts/kirkwood-net2big.dts | 5 +++++ 1 file changed, 5 insertions(+)arch/arm/boot/dts/kirkwood-net2big.dts +0
-0@@ -27,6 +27,11 @@ device_type = "memory";arch/arm/boot/dts/kirkwood-net2big.dts line 37
Quoted 10 lines
arch/arm/boot/dts/kirkwood-net2big.dts +5
-0reg = <0x00000000 0x10000000>; }; + + gpio_fan { + compatible = "gpio-fan"; + alarm-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>; + }; }; ®ulators {Again, wrong solution, and conceptually wrong as well from a dt perspective.
Quoted 8 lines
Quoted 2 lines
The alarm signal should be handled by the g762 driver, and the alarm-gpios property should be added to the g762 description.
OK. Then you think it would be better to add support for alarm GPIOs support in the g762. The problem is that we should have to find a generic way to do that. After all, we could want the very same modification for a bunch of fan drivers.
Can't help it. After all, the interrupt handling logic is different for each chip, and there are non-DT systems out there.
The g762 property should probably be something like
g762 at 3e { compatible = "gmt,g762"; reg = <0x3e>; clocks = <&g762_clk>; interrupt-parent = <&gpio0>; interrupts = <25 GPIO_ACTIVE_LOW>; };Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
struct
i2c_clienthas an irq field, and as far as I can see it is filled in automatically from the dt node. So all the driver should have to do is to implement an interrupt handler.Is that OK to pass a GPIO line through the "interrupts" property ?
Why not ? That is how it is supposed to be used. The driver neither needs to know nor should know that its interrupt line is connected to a gpio pin.
Well, I think we are interested in both the interrupt signal _and_ the GPIO value. We need to display the later through the sysfs
fan1_alarmfile.Using the irq field from struct
i2c_clientis quite handy but the GPIO polarity information is lost...That's why I think we should probably use a dedicated property.
Quoted 8 lines
Quoted 5 lines
Moreover it seems to me that g763 controller (compatible) supports alert interrupts through SMBus. Then maybe we should save the "interrupts" property for this signal ?
You lost me there. The SMBus alert signal is shared among multiple chips. If a system supports it, it should be connected to the alert interrupt handler (in
i2c-smbus.c), which would handle it and pass it to a driver's alert function.It was a question. I was not knowing the proper way for a driver to connect with this interrupt. Thanks for the explanation.
Quoted 6 lines
Quoted 5 lines
Don't you think it would be more explicit to have a separate DT property (such as "gpio-alarm") and also a dedicated field in the g762 platform data structure ?
Quoted 6 lines
Quoted 2 lines
No. It would add an unnecessary dependency on gpio (or, rather, gpio driven interrupts) to the g762 driver, and it would limit its usability.
Considering we will have to read this GPIO, then we will have this dependency.
You are right, in the sense that the alarm isn't really generated by the fan controller, while I assumed that it was. Given that, I am ok with the implementation in the gpio-fan driver.
Guenter
PATCH 1/1 ARM: Kirkwood: enable GPIO fan alarm support for 2Big Network v2
In reply to Simon GuinotHello.
Quoted 16 lines · Simon Guinot
On the LaCie 2Big Network v2 (
net2big_v2) board, the fan alarm is not wired to the I2C fan controller but to a separe GPIO. This GPIO can be controlled by using the gpio-fan driver.This patch adds the gpio-fan alarm description in the
net2big_v2DTS.Signed-off-by Simon Guinot <[email protected]>--- arch/arm/boot/dts/kirkwood-net2big.dts | 5 +++++ 1 file changed, 5 insertions(+)arch/arm/boot/dts/kirkwood-net2big.dts +0
-0
arch/arm/boot/dts/kirkwood-net2big.dts line 31
Quoted 5 lines
arch/arm/boot/dts/kirkwood-net2big.dts +2
-0@@ -27,6 +27,11 @@ device_type = "memory"; reg = <0x00000000 0x10000000>; }; + + gpio_fan {
The ePAPR standard says that node name should be generic, so "fan" would
fit better here...
arch/arm/boot/dts/kirkwood-net2big.dts line 35
Quoted 4 lines
arch/arm/boot/dts/kirkwood-net2big.dts +3
-0+ compatible = "gpio-fan"; + alarm-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>; + }; };
WBR, Sergei