RE: [PATCH v12] USB: serial: cp210x: Add support for GPIOs on CP2108

From: Tung Pham
Date: Thu May 20 2021 - 11:12:12 EST




-----Original Message-----
From: Johan Hovold <johan@xxxxxxxxxx>
Sent: Tuesday, May 18, 2021 2:05 PM
To: Tung Pham <Tung.Pham@xxxxxxxxxx>
Cc: Pho Tran <photranvan0712@xxxxxxxxx>; gregkh@xxxxxxxxxxxxxxxxxxx; linux-usb@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; Hung Nguyen <Hung.Nguyen@xxxxxxxxxx>; Pho Tran <Pho.Tran@xxxxxxxxxx>
Subject: Re: [PATCH v12] USB: serial: cp210x: Add support for GPIOs on CP2108

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.


On Tue, May 18, 2021 at 03:18:06AM +0000, Tung Pham wrote:
> Dear Johan Hovold.
> Do you agree and approve with this path?.

> I'm still waiting for you to confirm that you have tested the patch with different pin configurations in eeprom. The first few iterations > > clearly weren't tested and I don't want to waste more time reviewing it before it's tested as I believe I mentioned in my last mail.

> Johan

-> we have tested pass the GPIO of cp2108:
Case1: all 16 GPIO are configured as GPIO function.
Case2: all 16 GPIO are configured as alternative functions (not GPIO).
Please see attached file for more detail.
Thanks.
Tung Pham.
root@ubuntu:/sys/class/gpio# ls
export gpiochip496 unexport
root@ubuntu:/sys/class/gpio# echo 496 > /sys/class/gpio/export
root@ubuntu:/sys/class/gpio# echo 497 > /sys/class/gpio/export
root@ubuntu:/sys/class/gpio# echo 498 > /sys/class/gpio/export
root@ubuntu:/sys/class/gpio# echo 499 > /sys/class/gpio/export
root@ubuntu:/sys/class/gpio# echo 500 > /sys/class/gpio/export
root@ubuntu:/sys/class/gpio# echo 501 > /sys/class/gpio/export
root@ubuntu:/sys/class/gpio# echo 502 > /sys/class/gpio/export
root@ubuntu:/sys/class/gpio# echo 503 > /sys/class/gpio/export
root@ubuntu:/sys/class/gpio# echo 504 > /sys/class/gpio/export
root@ubuntu:/sys/class/gpio# echo 505 > /sys/class/gpio/export
root@ubuntu:/sys/class/gpio# echo 506 > /sys/class/gpio/export
root@ubuntu:/sys/class/gpio# echo 507 > /sys/class/gpio/export
root@ubuntu:/sys/class/gpio# echo 508 > /sys/class/gpio/export
root@ubuntu:/sys/class/gpio# echo 509 > /sys/class/gpio/export
root@ubuntu:/sys/class/gpio# echo 510 > /sys/class/gpio/export
root@ubuntu:/sys/class/gpio# echo 511 > /sys/class/gpio/export
root@ubuntu:/sys/class/gpio# echo out > /sys/class/gpio/gpio496/direction
root@ubuntu:/sys/class/gpio# echo out > /sys/class/gpio/gpio497/direction
root@ubuntu:/sys/class/gpio# echo out > /sys/class/gpio/gpio498/direction
root@ubuntu:/sys/class/gpio# echo out > /sys/class/gpio/gpio499/direction
root@ubuntu:/sys/class/gpio# echo out > /sys/class/gpio/gpio500/direction
root@ubuntu:/sys/class/gpio# echo out > /sys/class/gpio/gpio501/direction
root@ubuntu:/sys/class/gpio# echo out > /sys/class/gpio/gpio502/direction
root@ubuntu:/sys/class/gpio# echo out > /sys/class/gpio/gpio503/direction
root@ubuntu:/sys/class/gpio# echo out > /sys/class/gpio/gpio504/direction
root@ubuntu:/sys/class/gpio# echo out > /sys/class/gpio/gpio505/direction
root@ubuntu:/sys/class/gpio# echo out > /sys/class/gpio/gpio506/direction
root@ubuntu:/sys/class/gpio# echo out > /sys/class/gpio/gpio507/direction
root@ubuntu:/sys/class/gpio# echo out > /sys/class/gpio/gpio508/direction
root@ubuntu:/sys/class/gpio# echo out > /sys/class/gpio/gpio509/direction
root@ubuntu:/sys/class/gpio# echo out > /sys/class/gpio/gpio510/direction
root@ubuntu:/sys/class/gpio# echo out > /sys/class/gpio/gpio511/direction
root@ubuntu:/sys/class/gpio# echo 1 > /sys/class/gpio/gpio496/value
root@ubuntu:/sys/class/gpio# echo 1 > /sys/class/gpio/gpio497/value
root@ubuntu:/sys/class/gpio# echo 1 > /sys/class/gpio/gpio498/value
root@ubuntu:/sys/class/gpio# echo 1 > /sys/class/gpio/gpio499/value
root@ubuntu:/sys/class/gpio# echo 1 > /sys/class/gpio/gpio500/value
root@ubuntu:/sys/class/gpio# echo 1 > /sys/class/gpio/gpio501/value
root@ubuntu:/sys/class/gpio# echo 1 > /sys/class/gpio/gpio502/value
root@ubuntu:/sys/class/gpio# echo 1 > /sys/class/gpio/gpio503/value
root@ubuntu:/sys/class/gpio# echo 1 > /sys/class/gpio/gpio504/value
root@ubuntu:/sys/class/gpio# echo 1 > /sys/class/gpio/gpio505/value
root@ubuntu:/sys/class/gpio# echo 1 > /sys/class/gpio/gpio506/value
root@ubuntu:/sys/class/gpio# echo 1 > /sys/class/gpio/gpio507/value
root@ubuntu:/sys/class/gpio# echo 1 > /sys/class/gpio/gpio508/value
root@ubuntu:/sys/class/gpio# echo 1 > /sys/class/gpio/gpio509/value
root@ubuntu:/sys/class/gpio# echo 1 > /sys/class/gpio/gpio510/value
root@ubuntu:/sys/class/gpio# echo 1 > /sys/class/gpio/gpio511/value
root@ubuntu:/sys/class/gpio# cat /sys/class/gpio/gpio496/value
1
root@ubuntu:/sys/class/gpio# cat /sys/class/gpio/gpio497/value
1
root@ubuntu:/sys/class/gpio# cat /sys/class/gpio/gpio498/value
1
root@ubuntu:/sys/class/gpio# cat /sys/class/gpio/gpio499/value
1
root@ubuntu:/sys/class/gpio# cat /sys/class/gpio/gpio500/value
1
root@ubuntu:/sys/class/gpio# cat /sys/class/gpio/gpio501/value
1
root@ubuntu:/sys/class/gpio# cat /sys/class/gpio/gpio502/value
1
root@ubuntu:/sys/class/gpio# cat /sys/class/gpio/gpio503/value
1
root@ubuntu:/sys/class/gpio# cat /sys/class/gpio/gpio504/value
1
root@ubuntu:/sys/class/gpio# cat /sys/class/gpio/gpio505/value
1
root@ubuntu:/sys/class/gpio# cat /sys/class/gpio/gpio506/value
1
root@ubuntu:/sys/class/gpio# cat /sys/class/gpio/gpio507/value
1
root@ubuntu:/sys/class/gpio# cat /sys/class/gpio/gpio508/value
1
root@ubuntu:/sys/class/gpio# cat /sys/class/gpio/gpio509/value
1
root@ubuntu:/sys/class/gpio# cat /sys/class/gpio/gpio510/value
1
root@ubuntu:/sys/class/gpio# cat /sys/class/gpio/gpio511/value
1
root@ubuntu:/sys/class/gpio# echo 0 > /sys/class/gpio/gpio496/value
root@ubuntu:/sys/class/gpio# echo 0 > /sys/class/gpio/gpio497/value
root@ubuntu:/sys/class/gpio# echo 0 > /sys/class/gpio/gpio498/value
root@ubuntu:/sys/class/gpio# echo 0 > /sys/class/gpio/gpio499/value
root@ubuntu:/sys/class/gpio# echo 0 > /sys/class/gpio/gpio500/value
root@ubuntu:/sys/class/gpio# echo 0 > /sys/class/gpio/gpio501/value
root@ubuntu:/sys/class/gpio# echo 0 > /sys/class/gpio/gpio502/value
root@ubuntu:/sys/class/gpio# echo 0 > /sys/class/gpio/gpio503/value
root@ubuntu:/sys/class/gpio# echo 0 > /sys/class/gpio/gpio504/value
root@ubuntu:/sys/class/gpio# echo 0 > /sys/class/gpio/gpio505/value
root@ubuntu:/sys/class/gpio# echo 0 > /sys/class/gpio/gpio506/value
root@ubuntu:/sys/class/gpio# echo 0 > /sys/class/gpio/gpio507/value
root@ubuntu:/sys/class/gpio# echo 0 > /sys/class/gpio/gpio508/value
root@ubuntu:/sys/class/gpio# echo 0 > /sys/class/gpio/gpio509/value
root@ubuntu:/sys/class/gpio# echo 0 > /sys/class/gpio/gpio510/value
root@ubuntu:/sys/class/gpio# echo 0 > /sys/class/gpio/gpio511/value
root@ubuntu:/sys/class/gpio# cat /sys/class/gpio/gpio496/value
0
root@ubuntu:/sys/class/gpio# cat /sys/class/gpio/gpio497/value
0
root@ubuntu:/sys/class/gpio# cat /sys/class/gpio/gpio498/value
0
root@ubuntu:/sys/class/gpio# cat /sys/class/gpio/gpio499/value
0
root@ubuntu:/sys/class/gpio# cat /sys/class/gpio/gpio500/value
0
root@ubuntu:/sys/class/gpio# cat /sys/class/gpio/gpio501/value
0
root@ubuntu:/sys/class/gpio# cat /sys/class/gpio/gpio502/value
0
root@ubuntu:/sys/class/gpio# cat /sys/class/gpio/gpio503/value
0
root@ubuntu:/sys/class/gpio# cat /sys/class/gpio/gpio504/value
0
root@ubuntu:/sys/class/gpio# cat /sys/class/gpio/gpio505/value
0
root@ubuntu:/sys/class/gpio# cat /sys/class/gpio/gpio506/value
0
root@ubuntu:/sys/class/gpio# cat /sys/class/gpio/gpio507/value
0
root@ubuntu:/sys/class/gpio# cat /sys/class/gpio/gpio508/value
0
root@ubuntu:/sys/class/gpio# cat /sys/class/gpio/gpio509/value
0
root@ubuntu:/sys/class/gpio# cat /sys/class/gpio/gpio510/value
0
root@ubuntu:/sys/class/gpio# cat /sys/class/gpio/gpio511/value
0
root@ubuntu:/sys/class/gpio# ls
export gpiochip496 unexport
root@ubuntu:/sys/class/gpio# echo 496 > /sys/class/gpio/export
bash: echo: write error: No such device
root@ubuntu:/sys/class/gpio# echo 497 > /sys/class/gpio/export
bash: echo: write error: No such device
root@ubuntu:/sys/class/gpio# echo 498 > /sys/class/gpio/export
bash: echo: write error: No such device
root@ubuntu:/sys/class/gpio# echo 499 > /sys/class/gpio/export
bash: echo: write error: No such device
root@ubuntu:/sys/class/gpio# echo 500 > /sys/class/gpio/export
bash: echo: write error: No such device
root@ubuntu:/sys/class/gpio# echo 501 > /sys/class/gpio/export
bash: echo: write error: No such device
root@ubuntu:/sys/class/gpio# echo 502 > /sys/class/gpio/export
bash: echo: write error: No such device
root@ubuntu:/sys/class/gpio# echo 503 > /sys/class/gpio/export
bash: echo: write error: No such device
root@ubuntu:/sys/class/gpio# echo 504 > /sys/class/gpio/export
bash: echo: write error: No such device
root@ubuntu:/sys/class/gpio# echo 505 > /sys/class/gpio/export
bash: echo: write error: No such device
root@ubuntu:/sys/class/gpio# echo 506 > /sys/class/gpio/export
bash: echo: write error: No such device
root@ubuntu:/sys/class/gpio# echo 507 > /sys/class/gpio/export
bash: echo: write error: No such device
root@ubuntu:/sys/class/gpio# echo 508 > /sys/class/gpio/export
bash: echo: write error: No such device
root@ubuntu:/sys/class/gpio# echo 509 > /sys/class/gpio/export
bash: echo: write error: No such device
root@ubuntu:/sys/class/gpio# echo 510 > /sys/class/gpio/export
bash: echo: write error: No such device
root@ubuntu:/sys/class/gpio# echo 511 > /sys/class/gpio/export
bash: echo: write error: No such device
root@ubuntu:/sys/class/gpio#
echo 496 > /sys/class/gpio/export
echo 497 > /sys/class/gpio/export
echo 498 > /sys/class/gpio/export
echo 499 > /sys/class/gpio/export
echo 500 > /sys/class/gpio/export
echo 501 > /sys/class/gpio/export
echo 502 > /sys/class/gpio/export
echo 503 > /sys/class/gpio/export
echo 504 > /sys/class/gpio/export
echo 505 > /sys/class/gpio/export
echo 506 > /sys/class/gpio/export
echo 507 > /sys/class/gpio/export
echo 508 > /sys/class/gpio/export
echo 509 > /sys/class/gpio/export
echo 510 > /sys/class/gpio/export
echo 511 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio496/direction
echo out > /sys/class/gpio/gpio497/direction
echo out > /sys/class/gpio/gpio498/direction
echo out > /sys/class/gpio/gpio499/direction
echo out > /sys/class/gpio/gpio500/direction
echo out > /sys/class/gpio/gpio501/direction
echo out > /sys/class/gpio/gpio502/direction
echo out > /sys/class/gpio/gpio503/direction
echo out > /sys/class/gpio/gpio504/direction
echo out > /sys/class/gpio/gpio505/direction
echo out > /sys/class/gpio/gpio506/direction
echo out > /sys/class/gpio/gpio507/direction
echo out > /sys/class/gpio/gpio508/direction
echo out > /sys/class/gpio/gpio509/direction
echo out > /sys/class/gpio/gpio510/direction
echo out > /sys/class/gpio/gpio511/direction
echo 1 > /sys/class/gpio/gpio496/value
echo 1 > /sys/class/gpio/gpio497/value
echo 1 > /sys/class/gpio/gpio498/value
echo 1 > /sys/class/gpio/gpio499/value
echo 1 > /sys/class/gpio/gpio500/value
echo 1 > /sys/class/gpio/gpio501/value
echo 1 > /sys/class/gpio/gpio502/value
echo 1 > /sys/class/gpio/gpio503/value
echo 1 > /sys/class/gpio/gpio504/value
echo 1 > /sys/class/gpio/gpio505/value
echo 1 > /sys/class/gpio/gpio506/value
echo 1 > /sys/class/gpio/gpio507/value
echo 1 > /sys/class/gpio/gpio508/value
echo 1 > /sys/class/gpio/gpio509/value
echo 1 > /sys/class/gpio/gpio510/value
echo 1 > /sys/class/gpio/gpio511/value
cat /sys/class/gpio/gpio496/value
cat /sys/class/gpio/gpio497/value
cat /sys/class/gpio/gpio498/value
cat /sys/class/gpio/gpio499/value
cat /sys/class/gpio/gpio500/value
cat /sys/class/gpio/gpio501/value
cat /sys/class/gpio/gpio502/value
cat /sys/class/gpio/gpio503/value
cat /sys/class/gpio/gpio504/value
cat /sys/class/gpio/gpio505/value
cat /sys/class/gpio/gpio506/value
cat /sys/class/gpio/gpio507/value
cat /sys/class/gpio/gpio508/value
cat /sys/class/gpio/gpio509/value
cat /sys/class/gpio/gpio510/value
cat /sys/class/gpio/gpio511/value
echo 0 > /sys/class/gpio/gpio496/value
echo 0 > /sys/class/gpio/gpio497/value
echo 0 > /sys/class/gpio/gpio498/value
echo 0 > /sys/class/gpio/gpio499/value
echo 0 > /sys/class/gpio/gpio500/value
echo 0 > /sys/class/gpio/gpio501/value
echo 0 > /sys/class/gpio/gpio502/value
echo 0 > /sys/class/gpio/gpio503/value
echo 0 > /sys/class/gpio/gpio504/value
echo 0 > /sys/class/gpio/gpio505/value
echo 0 > /sys/class/gpio/gpio506/value
echo 0 > /sys/class/gpio/gpio507/value
echo 0 > /sys/class/gpio/gpio508/value
echo 0 > /sys/class/gpio/gpio509/value
echo 0 > /sys/class/gpio/gpio510/value
echo 0 > /sys/class/gpio/gpio511/value
cat /sys/class/gpio/gpio496/value
cat /sys/class/gpio/gpio497/value
cat /sys/class/gpio/gpio498/value
cat /sys/class/gpio/gpio499/value
cat /sys/class/gpio/gpio500/value
cat /sys/class/gpio/gpio501/value
cat /sys/class/gpio/gpio502/value
cat /sys/class/gpio/gpio503/value
cat /sys/class/gpio/gpio504/value
cat /sys/class/gpio/gpio505/value
cat /sys/class/gpio/gpio506/value
cat /sys/class/gpio/gpio507/value
cat /sys/class/gpio/gpio508/value
cat /sys/class/gpio/gpio509/value
cat /sys/class/gpio/gpio510/value
cat /sys/class/gpio/gpio511/value