All of lore.kernel.org
 help / color / mirror / Atom feed
* About new gpio API in linux/gpio.h adopted by kernel 4.8
@ 2018-09-06  7:29 Wang, Kuiying
  2018-09-06 12:47 ` Andrew Geissler
  0 siblings, 1 reply; 4+ messages in thread
From: Wang, Kuiying @ 2018-09-06  7:29 UTC (permalink / raw)
  To: Brad Bishop, geissonator
  Cc: kunyi731, Mihm, James, Tanous, Ed, Li, Yong B, Feist, James, Jia,
	Chunhui, venture, openbmc, Xu, Qiang, Yang, Cheng C, chunhui.jia,
	Nguyen, Hai V

Hi Brad/Andrew,
I found the new gpio API adopted by kernel 4.8, is not fully ready, all the lines are "unnamed".
If that we cannot switch to it now. 
Or there is special kernel based configuration I have to do?

root@wolfpass:/tmp# ./gpiodetect
gpiochip0 [SGPIOA] (8 lines)
gpiochip1 [SGPIOB] (8 lines)
gpiochip10 [1e780000.gpio] (232 lines)
gpiochip2 [SGPIOC] (8 lines)
gpiochip3 [SGPIOD] (8 lines)
gpiochip4 [SGPIOE] (8 lines)
gpiochip5 [SGPIOF] (8 lines)
gpiochip6 [SGPIOG] (8 lines)
gpiochip7 [SGPIOH] (8 lines)
gpiochip8 [SGPIOI] (8 lines)
gpiochip9 [SGPIOJ] (8 lines)
root@wolfpass:/tmp# ./gpioinfo /dev/gpiochip1
gpiochip1 - 8 lines:
        line   0:      unnamed       unused  output  active-high
        line   1:      unnamed       unused  output  active-high
        line   2:      unnamed       unused  output  active-high
        line   3:      unnamed       unused  output  active-high
        line   4:      unnamed       unused  output  active-high
        line   5:      unnamed       unused  output  active-high
        line   6:      unnamed       unused  output  active-high
        line   7:      unnamed       unused  output  active-high
root@wolfpass:/tmp# ./gpioinfo /dev/gpiochip10
gpiochip10 - 232 lines:
        line   0:      unnamed       unused   input  active-high
        line   1:      unnamed       unused   input  active-high
        line   2:      unnamed       unused   input  active-high
        line   3:      unnamed       unused   input  active-high
        line   4:      unnamed       unused   input  active-high
        line   5:      unnamed       unused   input  active-high
        line   6:      unnamed       unused   input  active-high
        line   7:      unnamed       unused   input  active-high
        line   8:      unnamed       unused   input  active-high
        line   9:      unnamed       unused   input  active-high
        line  10:      unnamed       unused   input  active-high
        line  11:      unnamed       unused   input  active-high
        line  12:      unnamed       unused   input  active-high
        line  13:      unnamed       unused   input  active-high
        line  14:      unnamed       unused   input  active-high
        line  15:      unnamed       unused   input  active-high
        line  16:      unnamed       unused   input  active-high
root@wolfpass:/tmp# ./gpioget /dev/gpiochip10 219
./gpioget: error reading GPIO values: Device or resource busy

Thanks,
Kuiying.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: About new gpio API in linux/gpio.h adopted by kernel 4.8
  2018-09-06  7:29 About new gpio API in linux/gpio.h adopted by kernel 4.8 Wang, Kuiying
@ 2018-09-06 12:47 ` Andrew Geissler
  2018-09-06 13:29   ` Andrew Jeffery
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Geissler @ 2018-09-06 12:47 UTC (permalink / raw)
  To: kuiying.wang
  Cc: Brad Bishop, Andrew Geissler, chunhui.jia, kunyi731, james.mihm,
	ed.tanous, james.feist, chunhui.jia, Patrick Venture,
	OpenBMC Maillist, yong.b.li, cheng.c.yang, qiang.xu,
	hai.v.nguyen, Andrew Jeffery, Joel Stanley

Hey Kuiying, this seems like more of a 4.18 kernel question for
Joel/AndrewJ. Put them on cc.
On Thu, Sep 6, 2018 at 2:30 AM Wang, Kuiying <kuiying.wang@intel.com> wrote:
>
> Hi Brad/Andrew,
> I found the new gpio API adopted by kernel 4.8, is not fully ready, all the lines are "unnamed".
> If that we cannot switch to it now.
> Or there is special kernel based configuration I have to do?
>
> root@wolfpass:/tmp# ./gpiodetect
> gpiochip0 [SGPIOA] (8 lines)
> gpiochip1 [SGPIOB] (8 lines)
> gpiochip10 [1e780000.gpio] (232 lines)
> gpiochip2 [SGPIOC] (8 lines)
> gpiochip3 [SGPIOD] (8 lines)
> gpiochip4 [SGPIOE] (8 lines)
> gpiochip5 [SGPIOF] (8 lines)
> gpiochip6 [SGPIOG] (8 lines)
> gpiochip7 [SGPIOH] (8 lines)
> gpiochip8 [SGPIOI] (8 lines)
> gpiochip9 [SGPIOJ] (8 lines)
> root@wolfpass:/tmp# ./gpioinfo /dev/gpiochip1
> gpiochip1 - 8 lines:
>         line   0:      unnamed       unused  output  active-high
>         line   1:      unnamed       unused  output  active-high
>         line   2:      unnamed       unused  output  active-high
>         line   3:      unnamed       unused  output  active-high
>         line   4:      unnamed       unused  output  active-high
>         line   5:      unnamed       unused  output  active-high
>         line   6:      unnamed       unused  output  active-high
>         line   7:      unnamed       unused  output  active-high
> root@wolfpass:/tmp# ./gpioinfo /dev/gpiochip10
> gpiochip10 - 232 lines:
>         line   0:      unnamed       unused   input  active-high
>         line   1:      unnamed       unused   input  active-high
>         line   2:      unnamed       unused   input  active-high
>         line   3:      unnamed       unused   input  active-high
>         line   4:      unnamed       unused   input  active-high
>         line   5:      unnamed       unused   input  active-high
>         line   6:      unnamed       unused   input  active-high
>         line   7:      unnamed       unused   input  active-high
>         line   8:      unnamed       unused   input  active-high
>         line   9:      unnamed       unused   input  active-high
>         line  10:      unnamed       unused   input  active-high
>         line  11:      unnamed       unused   input  active-high
>         line  12:      unnamed       unused   input  active-high
>         line  13:      unnamed       unused   input  active-high
>         line  14:      unnamed       unused   input  active-high
>         line  15:      unnamed       unused   input  active-high
>         line  16:      unnamed       unused   input  active-high
> root@wolfpass:/tmp# ./gpioget /dev/gpiochip10 219
> ./gpioget: error reading GPIO values: Device or resource busy
>
> Thanks,
> Kuiying.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: About new gpio API in linux/gpio.h adopted by kernel 4.8
  2018-09-06 12:47 ` Andrew Geissler
@ 2018-09-06 13:29   ` Andrew Jeffery
  2018-09-07 10:10     ` Wang, Kuiying
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Jeffery @ 2018-09-06 13:29 UTC (permalink / raw)
  To: Andrew Geissler, kuiying.wang
  Cc: Brad Bishop, Andrew Geissler, chunhui.jia, kunyi731, james.mihm,
	ed.tanous, james.feist, chunhui.jia, Patrick Venture,
	OpenBMC Maillist, yong.b.li, cheng.c.yang, qiang.xu,
	hai.v.nguyen, Joel Stanley

On Thu, 6 Sep 2018, at 22:17, Andrew Geissler wrote:
> Hey Kuiying, this seems like more of a 4.18 kernel question for
> Joel/AndrewJ. Put them on cc.
> On Thu, Sep 6, 2018 at 2:30 AM Wang, Kuiying <kuiying.wang@intel.com> wrote:
> >
> > Hi Brad/Andrew,
> > I found the new gpio API adopted by kernel 4.8, is not fully ready, all the lines are "unnamed".

I expect this is because no-one has given them an name in your devicetree. For example, here's some output from a system I have handy:

root@witherspoon:/tmp# gpioinfo /dev/gpiochip3
gpiochip3 - 16 lines:
        line   0: "PS_SMBUS_RESET_N" unused input active-high 
        line   1: "APSS_RESET_N" unused input active-high 
        line   2: "GPU0_TH_OVERT_N_BUFF" unused input active-high 
        line   3: "GPU1_TH_OVERT_N_BUFF" unused input active-high 
        line   4: "GPU2_TH_OVERT_N_BUFF" unused input active-high 
        line   5: "GPU3_TH_OVERT_N_BUFF" unused input active-high 
        line   6: "GPU4_TH_OVERT_N_BUFF" unused input active-high 
        line   7: "GPU5_TH_OVERT_N_BUFF" unused input active-high 
        line   8: "GPU0_PWR_GOOD_BUFF" unused input active-high 
        line   9: "GPU1_PWR_GOOD_BUFF" unused input active-high 
        line  10: "GPU2_PWR_GOOD_BUFF" unused input active-high 
        line  11: "GPU3_PWR_GOOD_BUFF" unused input active-high 
        line  12: "GPU4_PWR_GOOD_BUFF" unused input active-high 
        line  13: "GPU5_PWR_GOOD_BUFF" unused input active-high 
        line  14: "12V_BREAKER_FLT_N" unused input active-high 
        line  15: "THROTTLE_UNLATCHED_N" unused input active-high

Which corresponds to:

https://github.com/openbmc/linux/blob/dev-4.18/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts#L501

> > If that we cannot switch to it now.
> > Or there is special kernel based configuration I have to do?
> >
> > root@wolfpass:/tmp# ./gpiodetect
> > gpiochip0 [SGPIOA] (8 lines)
> > gpiochip1 [SGPIOB] (8 lines)
> > gpiochip10 [1e780000.gpio] (232 lines)
> > gpiochip2 [SGPIOC] (8 lines)
> > gpiochip3 [SGPIOD] (8 lines)
> > gpiochip4 [SGPIOE] (8 lines)
> > gpiochip5 [SGPIOF] (8 lines)
> > gpiochip6 [SGPIOG] (8 lines)
> > gpiochip7 [SGPIOH] (8 lines)
> > gpiochip8 [SGPIOI] (8 lines)
> > gpiochip9 [SGPIOJ] (8 lines)
> > root@wolfpass:/tmp# ./gpioinfo /dev/gpiochip1
> > gpiochip1 - 8 lines:
> >         line   0:      unnamed       unused  output  active-high
> >         line   1:      unnamed       unused  output  active-high
> >         line   2:      unnamed       unused  output  active-high
> >         line   3:      unnamed       unused  output  active-high
> >         line   4:      unnamed       unused  output  active-high
> >         line   5:      unnamed       unused  output  active-high
> >         line   6:      unnamed       unused  output  active-high
> >         line   7:      unnamed       unused  output  active-high
> > root@wolfpass:/tmp# ./gpioinfo /dev/gpiochip10
> > gpiochip10 - 232 lines:
> >         line   0:      unnamed       unused   input  active-high
> >         line   1:      unnamed       unused   input  active-high
> >         line   2:      unnamed       unused   input  active-high
> >         line   3:      unnamed       unused   input  active-high
> >         line   4:      unnamed       unused   input  active-high
> >         line   5:      unnamed       unused   input  active-high
> >         line   6:      unnamed       unused   input  active-high
> >         line   7:      unnamed       unused   input  active-high
> >         line   8:      unnamed       unused   input  active-high
> >         line   9:      unnamed       unused   input  active-high
> >         line  10:      unnamed       unused   input  active-high
> >         line  11:      unnamed       unused   input  active-high
> >         line  12:      unnamed       unused   input  active-high
> >         line  13:      unnamed       unused   input  active-high
> >         line  14:      unnamed       unused   input  active-high
> >         line  15:      unnamed       unused   input  active-high
> >         line  16:      unnamed       unused   input  active-high
> > root@wolfpass:/tmp# ./gpioget /dev/gpiochip10 219
> > ./gpioget: error reading GPIO values: Device or resource busy
> >

This all works fine for me. Busy is because the GPIO has been exported through some other means, for example the sysfs interface:

root@witherspoon:/tmp# ls /sys/class/gpio
export       gpio305      gpio347      gpio417      gpiochip238  gpiochip280
gpio281      gpio306      gpio353      gpiochip222  gpiochip254  unexport
root@witherspoon:/tmp# gpioget /dev/gpiochip0 $((305 - 280))
gpioget: error reading GPIO values: Device or resource busy

Hope that helps.

Andrew

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: About new gpio API in linux/gpio.h adopted by kernel 4.8
  2018-09-06 13:29   ` Andrew Jeffery
@ 2018-09-07 10:10     ` Wang, Kuiying
  0 siblings, 0 replies; 4+ messages in thread
From: Wang, Kuiying @ 2018-09-07 10:10 UTC (permalink / raw)
  To: Andrew Jeffery, Andrew Geissler
  Cc: Brad Bishop, Andrew Geissler, chunhui.jia, kunyi731, Mihm, James,
	Tanous, Ed, Feist, James, Jia, Chunhui, Patrick Venture,
	OpenBMC Maillist, Li, Yong B, Yang, Cheng C, Xu, Qiang, Nguyen,
	Hai V, Joel Stanley

Yes, you are right. There is no configuration for gpio-line-names property for aspeed g5.
I plan to upstream a patch for aspeed g5 as following:

commit 9dfd72ff5f628d7aaa10728756ce42bd5f768d4f (HEAD -> dev-4.18)
Author: Kuiying Wang <kuiying.wang@intel.com>
Date:   Fri Sep 7 18:01:41 2018 +0800

    Define the gpio-line-names property for aspeed-g5

    Based on aspeed AST-2500 Datasheet spec, there are 232 gpios.
    So defines the gpio line name from "A0" to "AC7".

    Signed-off-by: Kuiying Wang <kuiying.wang@intel.com>

diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi
index d92f047907de..6d664f4f1621 100644
--- a/arch/arm/boot/dts/aspeed-g5.dtsi
+++ b/arch/arm/boot/dts/aspeed-g5.dtsi
@@ -265,6 +265,36 @@
                                gpio-ranges = <&pinctrl 0 0 220>;
                                clocks = <&syscon ASPEED_CLK_APB>;
                                interrupt-controller;
+                   gpio-line-names = "A0","A1","A2","A3","A4","A5","A6","A7",
+                                   "B0","B1","B2","B3","B4","B5","B6","B7",
+                                   "C0","C1","C2","C3","C4","C5","C6","C7",
+                                   "D0","D1","D2","D3","D4","D5","D6","D7",
+                                   "E0","E1","E2","E3","E4","E5","E6","E7",
+                                   "F0","F1","F2","F3","F4","F5","F6","F7",
+                                   "G0","G1","G2","G3","G4","G5","G6","G7",
+                                   "H0","H1","H2","H3","H4","H5","H6","H7",
+                                   "I0","I1","I2","I3","I4","I5","I6","I7",
+                                   "J0","J1","J2","J3","J4","J5","J6","J7",
+                                   "K0","E1","E2","E3","E4","E5","E6","E7",
+                                   "L0","L1","L2","L3","L4","L5","L6","L7",
+                                   "M0","M1","M2","M3","M4","M5","M6","M7",
+                                   "N0","N1","N2","N3","N4","N5","N6","N7",
+                                   "O0","O1","O2","O3","O4","O5","O6","O7",
+                                   "P0","P1","P2","P3","P4","P5","P6","P7",
+                                   "Q0","Q1","Q2","Q3","Q4","Q5","Q6","Q7",
+                                   "R0","R1","R2","R3","R4","R5","R6","R7",
+                                   "S0","S1","S2","S3","S4","S5","S6","S7",
+                                   "T0","T1","T2","T3","T4","T5","T6","T7",
+                                   "U0","U1","U2","U3","U4","U5","U6","U7",
+                                   "V0","V1","V2","V3","V4","V5","V6","V7",
+                                   "W0","W1","W2","W3","W4","W5","W6","W7",
+                                   "X0","X1","X2","X3","X4","X5","X6","X7",
+                                   "Y0","Y1","Y2","Y3","Y4","Y5","Y6","Y7",
+                                   "Z0","Z1","Z2","Z3","Z4","Z5","Z6","Z7",
+                                   "AA0","AA1","AA2","AA3","AA4","AA5","AA6","AA7",
+                                   "AB0","AB1","AB2","AB3","AB4","AB5","AB6","AB7",
+                                   "AC0","AC1","AC2","AC3","AC4","AC5","AC6","AC7"
+                   ;
                        };

Do you all agree on this?
If no what's your suggestion?

Thanks,
Kuiying.


-----Original Message-----
From: Andrew Jeffery [mailto:andrew@aj.id.au] 
Sent: Thursday, September 06, 2018 9:30 PM
To: Andrew Geissler <geissonator@gmail.com>; Wang, Kuiying <kuiying.wang@intel.com>
Cc: Brad Bishop <bradleyb@fuzziesquirrel.com>; Andrew Geissler <geissonator@yahoo.com>; chunhui.jia@linux.intel.com; kunyi731@gmail.com; Mihm, James <james.mihm@intel.com>; Tanous, Ed <ed.tanous@intel.com>; Feist, James <james.feist@intel.com>; Jia, Chunhui <chunhui.jia@intel.com>; Patrick Venture <venture@google.com>; OpenBMC Maillist <openbmc@lists.ozlabs.org>; Li, Yong B <yong.b.li@intel.com>; Yang, Cheng C <cheng.c.yang@intel.com>; Xu, Qiang <qiang.xu@intel.com>; Nguyen, Hai V <hai.v.nguyen@intel.com>; Joel Stanley <joel@jms.id.au>
Subject: Re: About new gpio API in linux/gpio.h adopted by kernel 4.8

On Thu, 6 Sep 2018, at 22:17, Andrew Geissler wrote:
> Hey Kuiying, this seems like more of a 4.18 kernel question for 
> Joel/AndrewJ. Put them on cc.
> On Thu, Sep 6, 2018 at 2:30 AM Wang, Kuiying <kuiying.wang@intel.com> wrote:
> >
> > Hi Brad/Andrew,
> > I found the new gpio API adopted by kernel 4.8, is not fully ready, all the lines are "unnamed".

I expect this is because no-one has given them an name in your devicetree. For example, here's some output from a system I have handy:

root@witherspoon:/tmp# gpioinfo /dev/gpiochip3
gpiochip3 - 16 lines:
        line   0: "PS_SMBUS_RESET_N" unused input active-high 
        line   1: "APSS_RESET_N" unused input active-high 
        line   2: "GPU0_TH_OVERT_N_BUFF" unused input active-high 
        line   3: "GPU1_TH_OVERT_N_BUFF" unused input active-high 
        line   4: "GPU2_TH_OVERT_N_BUFF" unused input active-high 
        line   5: "GPU3_TH_OVERT_N_BUFF" unused input active-high 
        line   6: "GPU4_TH_OVERT_N_BUFF" unused input active-high 
        line   7: "GPU5_TH_OVERT_N_BUFF" unused input active-high 
        line   8: "GPU0_PWR_GOOD_BUFF" unused input active-high 
        line   9: "GPU1_PWR_GOOD_BUFF" unused input active-high 
        line  10: "GPU2_PWR_GOOD_BUFF" unused input active-high 
        line  11: "GPU3_PWR_GOOD_BUFF" unused input active-high 
        line  12: "GPU4_PWR_GOOD_BUFF" unused input active-high 
        line  13: "GPU5_PWR_GOOD_BUFF" unused input active-high 
        line  14: "12V_BREAKER_FLT_N" unused input active-high 
        line  15: "THROTTLE_UNLATCHED_N" unused input active-high

Which corresponds to:

https://github.com/openbmc/linux/blob/dev-4.18/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts#L501

> > If that we cannot switch to it now.
> > Or there is special kernel based configuration I have to do?
> >
> > root@wolfpass:/tmp# ./gpiodetect
> > gpiochip0 [SGPIOA] (8 lines)
> > gpiochip1 [SGPIOB] (8 lines)
> > gpiochip10 [1e780000.gpio] (232 lines)
> > gpiochip2 [SGPIOC] (8 lines)
> > gpiochip3 [SGPIOD] (8 lines)
> > gpiochip4 [SGPIOE] (8 lines)
> > gpiochip5 [SGPIOF] (8 lines)
> > gpiochip6 [SGPIOG] (8 lines)
> > gpiochip7 [SGPIOH] (8 lines)
> > gpiochip8 [SGPIOI] (8 lines)
> > gpiochip9 [SGPIOJ] (8 lines)
> > root@wolfpass:/tmp# ./gpioinfo /dev/gpiochip1
> > gpiochip1 - 8 lines:
> >         line   0:      unnamed       unused  output  active-high
> >         line   1:      unnamed       unused  output  active-high
> >         line   2:      unnamed       unused  output  active-high
> >         line   3:      unnamed       unused  output  active-high
> >         line   4:      unnamed       unused  output  active-high
> >         line   5:      unnamed       unused  output  active-high
> >         line   6:      unnamed       unused  output  active-high
> >         line   7:      unnamed       unused  output  active-high
> > root@wolfpass:/tmp# ./gpioinfo /dev/gpiochip10
> > gpiochip10 - 232 lines:
> >         line   0:      unnamed       unused   input  active-high
> >         line   1:      unnamed       unused   input  active-high
> >         line   2:      unnamed       unused   input  active-high
> >         line   3:      unnamed       unused   input  active-high
> >         line   4:      unnamed       unused   input  active-high
> >         line   5:      unnamed       unused   input  active-high
> >         line   6:      unnamed       unused   input  active-high
> >         line   7:      unnamed       unused   input  active-high
> >         line   8:      unnamed       unused   input  active-high
> >         line   9:      unnamed       unused   input  active-high
> >         line  10:      unnamed       unused   input  active-high
> >         line  11:      unnamed       unused   input  active-high
> >         line  12:      unnamed       unused   input  active-high
> >         line  13:      unnamed       unused   input  active-high
> >         line  14:      unnamed       unused   input  active-high
> >         line  15:      unnamed       unused   input  active-high
> >         line  16:      unnamed       unused   input  active-high
> > root@wolfpass:/tmp# ./gpioget /dev/gpiochip10 219
> > ./gpioget: error reading GPIO values: Device or resource busy
> >

This all works fine for me. Busy is because the GPIO has been exported through some other means, for example the sysfs interface:

root@witherspoon:/tmp# ls /sys/class/gpio
export       gpio305      gpio347      gpio417      gpiochip238  gpiochip280
gpio281      gpio306      gpio353      gpiochip222  gpiochip254  unexport
root@witherspoon:/tmp# gpioget /dev/gpiochip0 $((305 - 280))
gpioget: error reading GPIO values: Device or resource busy

Hope that helps.

Andrew

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-09-07 10:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-06  7:29 About new gpio API in linux/gpio.h adopted by kernel 4.8 Wang, Kuiying
2018-09-06 12:47 ` Andrew Geissler
2018-09-06 13:29   ` Andrew Jeffery
2018-09-07 10:10     ` Wang, Kuiying

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.