Skip to contentSkip to conversation

PCF857x and 16-bit GPIO expanders

DISCUSSION Felipe Balbi 6 participants 12 messages Sep 17, 2013 – Sep 19, 2013 1 message not in the archive GPIO

lore
Share & tools
lore
#0 lore raw

Hi,

has anyone ever successfully using gpio-pcf857x.c driver with 16-bit gpio expanders ? We're having some issues here where toggling the last gpio pin (gpio 15) on a PCF8575 device causes platform to hang and I can't come up with any explanation of why would it hang...

Any hints ?

cheers

Signature · 1 line
balbi
#1 lore raw
Quoted 4 lines · Felipe Balbi

has anyone ever successfully using gpio-pcf857x.c driver with 16-bit gpio expanders ? We're having some issues here where toggling the last gpio pin (gpio 15) on a PCF8575 device causes platform to hang and I can't come up with any explanation of why would it hang...

Bouncing the question to George, Laurent and Kuninori...

Yours,
Linus Walleij

#2 lore raw
Quoted 7 lines · On Wednesday 18 September 2013 13:16:27 Linus Walleij wrote:
Quoted 4 lines · Felipe Balbi

has anyone ever successfully using gpio-pcf857x.c driver with 16-bit gpio expanders ? We're having some issues here where toggling the last gpio pin (gpio 15) on a PCF8575 device causes platform to hang and I can't come up with any explanation of why would it hang...

Bouncing the question to George, Laurent and Kuninori...

I've got a board with a PCF8575 chip, but it uses I/Os 8 to 14 only as far as I know.

I can try toggling I/O 15, but that will need to wait until next week as I'm currently travelling without access to the hardware.

Signature · 3 lines
Regards,

Laurent Pinchart
#3 lore raw

Hi,

Quoted 7 lines · Laurent Pinchart
Quoted 6 lines · On Wednesday 18 September 2013 13:16:27 Linus Walleij wrote:
Quoted 4 lines · Felipe Balbi

has anyone ever successfully using gpio-pcf857x.c driver with 16-bit gpio expanders ? We're having some issues here where toggling the last gpio pin (gpio 15) on a PCF8575 device causes platform to hang and I can't come up with any explanation of why would it hang...

Quoted 7 lines
Quoted 1 line

Bouncing the question to George, Laurent and Kuninori...

I've got a board with a PCF8575 chip, but it uses I/Os 8 to 14 only as far as I know.

I can try toggling I/O 15, but that will need to wait until next week as I'm currently travelling without access to the hardware.

alright, that'd help me a lot :-) Just want to make sure if we're having a board issue, or PCF8575 is a bit screwy ;-)

Thanks

Signature · 1 line
balbi
#4 lore raw
Quoted 9 lines · Felipe Balbi

Hi,

Quoted 6 lines · Laurent Pinchart
Quoted 5 lines · On Wednesday 18 September 2013 13:16:27 Linus Walleij wrote:
Quoted 4 lines · Felipe Balbi

has anyone ever successfully using gpio-pcf857x.c driver with 16-bit gpio expanders ? We're having some issues here where toggling the last gpio pin (gpio 15) on a PCF8575 device causes platform to hang and I can't come up with any explanation of why would it hang...

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Bouncing the question to George, Laurent and Kuninori...

I've got a board with a PCF8575 chip, but it uses I/Os 8 to 14 only as far as I know.

I can try toggling I/O 15, but that will need to wait until next week as I'm currently travelling without access to the hardware.

alright, that'd help me a lot :-) Just want to make sure if we're having a board issue, or PCF8575 is a bit screwy ;-)

Is it on dra7x-evm if so which pcf device (i2c address)? The pins i were interested were only 1 and 2 I never tried pin 15.

Just tried toggling through sysfs and it works for me.

Quoted 3 lines

Thanks

Signature · 1 line
-George
#5 lore raw
Quoted 14 lines · George Cherian
Quoted 13 lines · Felipe Balbi

Hi,

Quoted 10 lines · Laurent Pinchart
Quoted 6 lines · On Wednesday 18 September 2013 13:16:27 Linus Walleij wrote:
Quoted 4 lines · Felipe Balbi

has anyone ever successfully using gpio-pcf857x.c driver with 16-bit gpio expanders ? We're having some issues here where toggling the last gpio pin (gpio 15) on a PCF8575 device causes platform to hang and I can't come up with any explanation of why would it hang...

Bouncing the question to George, Laurent and Kuninori...

I've got a board with a PCF8575 chip, but it uses I/Os 8 to 14 only as far as I know.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

I can try toggling I/O 15, but that will need to wait until next week as I'm currently travelling without access to the hardware.

alright, that'd help me a lot :-) Just want to make sure if we're having a board issue, or PCF8575 is a bit screwy ;-)

Is it on dra7x-evm if so which pcf device (i2c address)? The pins i were interested were only 1 and 2 I never tried pin 15.

Just tried toggling through sysfs and it works for me.

When I look at the data sheet for PCF8575[1] Page 7, Figure 4 Write mode (output)
I see the data writes are of the order:
I2c 1's byte: address
I2c 2'nd byte:P[7-0]
I2c 3rd byte:P[17-10]
Note: bits 8,9 are missing not supported.

Now [2] claims that it does support PCF8575, however when I look at line 143[3]

	unsigned	bit = 1 << offset;
[snip]
	if (value)
		gpio->out |= bit;
	else
		gpio->out &= ~bit;

There is no handling for the skip needed for bits 8 and 9.. Seems to me like a driver bug.

[1] http://www.ti.com/lit/ds/symlink/pcf8575.pdf
[2]
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/gpio/gpio-pcf857x.c
[3]
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/gpio/gpio-pcf857x.c#n143

Signature · 2 lines
Regards,
Nishanth Menon
#6 lore raw
Quoted 22 lines · Nishanth Menon
Quoted 21 lines · George Cherian
Quoted 9 lines · Felipe Balbi

Hi,

Quoted 6 lines · Laurent Pinchart
Quoted 5 lines · On Wednesday 18 September 2013 13:16:27 Linus Walleij wrote:
Quoted 4 lines · Felipe Balbi

has anyone ever successfully using gpio-pcf857x.c driver with 16-bit gpio expanders ? We're having some issues here where toggling the last gpio pin (gpio 15) on a PCF8575 device causes platform to hang and I can't come up with any explanation of why would it hang...

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Bouncing the question to George, Laurent and Kuninori...

I've got a board with a PCF8575 chip, but it uses I/Os 8 to 14 only as far as I know.

I can try toggling I/O 15, but that will need to wait until next week as I'm currently travelling without access to the hardware.

alright, that'd help me a lot :-) Just want to make sure if we're having a board issue, or PCF8575 is a bit screwy ;-)

Is it on dra7x-evm if so which pcf device (i2c address)? The pins i were interested were only 1 and 2 I never tried pin 15.

Quoted 7 lines
Quoted 1 line

Just tried toggling through sysfs and it works for me.

When I look at the data sheet for PCF8575[1] Page 7, Figure 4 Write mode (output)
I see the data writes are of the order:
I2c 1's byte: address
I2c 2'nd byte:P[7-0]
I2c 3rd byte:P[17-10]

I read it as an octal numbering.

Quoted 1 line

Note: bits 8,9 are missing not supported.

In octal there is no 8 and 9

Quoted 10 lines

Now [2] claims that it does support PCF8575, however when I look at line 143[3]

	unsigned	bit = 1 << offset;
[snip]
	if (value)
		gpio->out |= bit;
	else
		gpio->out &= ~bit;
Quoted 2 lines

There is no handling for the skip needed for bits 8 and 9.. Seems to me like a driver bug.

In which case there is no driver bug

Quoted 5 lines

[1] http://www.ti.com/lit/ds/symlink/pcf8575.pdf
[2]
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/gpio/gpio-pcf857x.c
[3]
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/gpio/gpio-pcf857x.c#n143

Signature · 1 line
-George
#7 lore raw
Quoted 31 lines · George Cherian
Quoted 22 lines · Nishanth Menon
Quoted 21 lines · George Cherian
Quoted 9 lines · Felipe Balbi

Hi,

Quoted 6 lines · Laurent Pinchart
Quoted 5 lines · On Wednesday 18 September 2013 13:16:27 Linus Walleij wrote:
Quoted 4 lines · Felipe Balbi

has anyone ever successfully using gpio-pcf857x.c driver with 16-bit gpio expanders ? We're having some issues here where toggling the last gpio pin (gpio 15) on a PCF8575 device causes platform to hang and I can't come up with any explanation of why would it hang...

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Bouncing the question to George, Laurent and Kuninori...

I've got a board with a PCF8575 chip, but it uses I/Os 8 to 14 only as far as I know.

I can try toggling I/O 15, but that will need to wait until next week as I'm currently travelling without access to the hardware.

alright, that'd help me a lot :-) Just want to make sure if we're having a board issue, or PCF8575 is a bit screwy ;-)

Is it on dra7x-evm if so which pcf device (i2c address)? The pins i were interested were only 1 and 2 I never tried pin 15.

Quoted 7 lines
Quoted 1 line

Just tried toggling through sysfs and it works for me.

When I look at the data sheet for PCF8575[1] Page 7, Figure 4 Write mode (output)
I see the data writes are of the order:
I2c 1's byte: address
I2c 2'nd byte:P[7-0]
I2c 3rd byte:P[17-10]

Quoted 4 lines

I read it as an octal numbering.

Quoted 1 line

Note: bits 8,9 are missing not supported.

In octal there is no 8 and 9

Where is octal coming into play here? P8 and 9 does not exist as per the data sheet -> look at the pinout on page 1[1] ->P00-P17 this is exactly what is described on page 2[1]:
"The number of data bytes that can be sent successively is not limited After every two bytes, the previous data is overwritten. When the PCF8575 receives the pairs of data bytes, the first byte is referred to as P07 – P00 and the second byte as P17 – P10. The third byte is referred to as P07 – P00, the fourth byte as P17 – P10, and so on"

For someone reading schematics and setting up the P15, if the person uses gpios = <&PCF8575 15 OF_GPIO_HIGH>; this will result in offset = 15, and as a result 0x80 will be send in byte 3, which from h/w point of view is P13 which could be controlling something weird!

Quoted 10 lines
Quoted 10 lines

Now [2] claims that it does support PCF8575, however when I look at line 143[3]

	unsigned	bit = 1 << offset;
[snip]
	if (value)
		gpio->out |= bit;
	else
		gpio->out &= ~bit;
Quoted 4 lines
Quoted 2 lines

There is no handling for the skip needed for bits 8 and 9.. Seems to me like a driver bug.

In which case there is no driver bug

It probably needs clarification:

Depends on how the definition is done - to hit exact P15 in definition and to set P15, should I provide 17 as gpio number? That does not match what the h/w description is in the data sheet!

Quoted 7 lines
Quoted 5 lines

[1] http://www.ti.com/lit/ds/symlink/pcf8575.pdf
[2]
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/gpio/gpio-pcf857x.c
[3]
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/gpio/gpio-pcf857x.c#n143

Signature · 6 lines
Regards,
Nishanth Menon
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#8 lore raw

Hi,

Quoted 47 lines · Nishanth Menon
Quoted 31 lines · George Cherian
Quoted 22 lines · Nishanth Menon
Quoted 21 lines · George Cherian
Quoted 9 lines · Felipe Balbi

Hi,

Quoted 6 lines · Laurent Pinchart
Quoted 5 lines · On Wednesday 18 September 2013 13:16:27 Linus Walleij wrote:
Quoted 4 lines · Felipe Balbi

has anyone ever successfully using gpio-pcf857x.c driver with 16-bit gpio expanders ? We're having some issues here where toggling the last gpio pin (gpio 15) on a PCF8575 device causes platform to hang and I can't come up with any explanation of why would it hang...

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Bouncing the question to George, Laurent and Kuninori...

I've got a board with a PCF8575 chip, but it uses I/Os 8 to 14 only as far as I know.

I can try toggling I/O 15, but that will need to wait until next week as I'm currently travelling without access to the hardware.

alright, that'd help me a lot :-) Just want to make sure if we're having a board issue, or PCF8575 is a bit screwy ;-)

Is it on dra7x-evm if so which pcf device (i2c address)? The pins i were interested were only 1 and 2 I never tried pin 15.

Quoted 7 lines
Quoted 1 line

Just tried toggling through sysfs and it works for me.

When I look at the data sheet for PCF8575[1] Page 7, Figure 4 Write mode (output)
I see the data writes are of the order:
I2c 1's byte: address
I2c 2'nd byte:P[7-0]
I2c 3rd byte:P[17-10]

Quoted 4 lines

I read it as an octal numbering.

Quoted 1 line

Note: bits 8,9 are missing not supported.

In octal there is no 8 and 9

Where is octal coming into play here? P8 and 9 does not exist as per the data sheet -> look at the pinout on page 1[1] ->P00-P17 this is exactly what is described on page 2[1]:
"The number of data bytes that can be sent successively is not limited After every two bytes, the previous data is overwritten. When the PCF8575 receives the pairs of data bytes, the first byte is referred to as P07 – P00 and the second byte as P17 – P10. The third byte is referred to as P07 – P00, the fourth byte as P17 – P10, and so on"

Quoted 4 lines

For someone reading schematics and setting up the P15, if the person uses gpios = <&PCF8575 15 OF_GPIO_HIGH>; this will result in offset = 15, and as a result 0x80 will be send in byte 3, which from h/w point of view is P13 which could be controlling something weird!

you missed one detail only. I said GPIO15, not P15 :-) GPIO15 on that device is P17 ;-)

Signature · 1 line
balbi
#9 lore raw
In reply to George Cherian
Quoted 24 lines · George Cherian
Quoted 23 lines · Nishanth Menon
Quoted 22 lines · George Cherian
Quoted 9 lines · Felipe Balbi

Hi,

Quoted 6 lines · Laurent Pinchart
Quoted 5 lines · On Wednesday 18 September 2013 13:16:27 Linus Walleij wrote:
Quoted 4 lines · Felipe Balbi

has anyone ever successfully using gpio-pcf857x.c driver with 16-bit gpio expanders ? We're having some issues here where toggling the last gpio pin (gpio 15) on a PCF8575 device causes platform to hang and I can't come up with any explanation of why would it hang...

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Bouncing the question to George, Laurent and Kuninori...

I've got a board with a PCF8575 chip, but it uses I/Os 8 to 14 only as far as I know.

I can try toggling I/O 15, but that will need to wait until next week as I'm currently travelling without access to the hardware.

alright, that'd help me a lot :-) Just want to make sure if we're having a board issue, or PCF8575 is a bit screwy ;-)

Is it on dra7x-evm if so which pcf device (i2c address)? The pins i were interested were only 1 and 2 I never tried pin 15.

Just tried toggling through sysfs and it works for me.

Quoted 8 lines
Quoted 6 lines

When I look at the data sheet for PCF8575[1] Page 7, Figure 4 Write mode (output)
I see the data writes are of the order:
I2c 1's byte: address
I2c 2'nd byte:P[7-0]
I2c 3rd byte:P[17-10]

I read it as an octal numbering.

Kind of ... looking at the pinout, you have pins:-

P00...P07
P10...P17

So that's Port 0, bits 0..7, and Port 1, bits 0..7.

Mark J.

#10 lore raw
In reply to George Cherian

Hi,

Quoted 11 lines · George Cherian
Quoted 10 lines · Felipe Balbi

Hi,

Quoted 7 lines · Laurent Pinchart
Quoted 6 lines · On Wednesday 18 September 2013 13:16:27 Linus Walleij wrote:
Quoted 4 lines · Felipe Balbi

has anyone ever successfully using gpio-pcf857x.c driver with 16-bit gpio expanders ? We're having some issues here where toggling the last gpio pin (gpio 15) on a PCF8575 device causes platform to hang and I can't come up with any explanation of why would it hang...

Bouncing the question to George, Laurent and Kuninori...

Quoted 8 lines
Quoted 7 lines
Quoted 5 lines

I've got a board with a PCF8575 chip, but it uses I/Os 8 to 14 only as far as I know.

I can try toggling I/O 15, but that will need to wait until next week as I'm currently travelling without access to the hardware.

alright, that'd help me a lot :-) Just want to make sure if we're having a board issue, or PCF8575 is a bit screwy ;-)

Is it on dra7x-evm if so which pcf device (i2c address)?

0x21 IIRC, it's pin 15 on that goes to a discrete mux. I want to toggle the mux ;-)

Signature · 1 line
balbi

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

#12 lore raw

Hi,

Quoted 31 lines · George Cherian
Quoted 17 lines · Felipe Balbi

Hi,

Quoted 14 lines · George Cherian
Quoted 13 lines · Felipe Balbi

Hi,

Quoted 10 lines · Laurent Pinchart
Quoted 6 lines · On Wednesday 18 September 2013 13:16:27 Linus Walleij wrote:
Quoted 4 lines · Felipe Balbi

has anyone ever successfully using gpio-pcf857x.c driver with 16-bit gpio expanders ? We're having some issues here where toggling the last gpio pin (gpio 15) on a PCF8575 device causes platform to hang and I can't come up with any explanation of why would it hang...

Bouncing the question to George, Laurent and Kuninori...

I've got a board with a PCF8575 chip, but it uses I/Os 8 to 14 only as far as I know.

Quoted 8 lines
Quoted 5 lines
Quoted 4 lines
Quoted 2 lines

I can try toggling I/O 15, but that will need to wait until next week as I'm currently travelling without access to the hardware.

alright, that'd help me a lot :-) Just want to make sure if we're having a board issue, or PCF8575 is a bit screwy ;-)

Is it on dra7x-evm if so which pcf device (i2c address)?

0x21 IIRC, it's pin 15 on that goes to a discrete mux. I want to toggle the mux ;-)

I am able to toggle the same via sysfs(pcf8575 @ 0x21gpio15(p17)) and it does not hang the board.
I am using Rev D1 board.

Log :-

Quoted 15 lines
# cat /sys/kernel/debug/gpio
.
...
 GPIOs 480-495, i2c/0-0021, pcf8575, can sleep:
 gpio-481 (id_gpio             ) in  hi
 gpio-482 (id_gpio             ) in  hi
 gpio-495 (sysfs               ) out hi
# echo 0 > /sys/class/gpio/gpio495/value
# cat /sys/kernel/debug/gpio
.
...
GPIOs 480-495, i2c/0-0021, pcf8575, can sleep:
 gpio-481 (id_gpio             ) in  hi
 gpio-482 (id_gpio             ) in  hi
 gpio-495 (sysfs               ) out lo

weird... I'll debug here and see if I can still reproduce with v3.12-rc1. Thanks anyway :-)

cheers

Signature · 1 line
balbi