This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM3352: Exposing PMIC power button to userspace

Part Number: AM3352
Other Parts Discussed in Thread: TPS65217

Tool/software: Linux

Hi

I am running on a custom board based on the beagle bone black.

I have upgraded to the latest SDK (4.1.0.6)  and am trying to make use of the tps65217 power button 

I have entered a device node as per the documentation:

&tps {
	tps65217-pwrbutton {
		compatible = "ti,tps65217-pwrbutton";
		interrupts = <2>;
	};
};

There appear to be a few nodes created:

/sys/devices/platform/ocp/44e0b000.i2c/i2c-0/0-0024/tps65217-pwrbutton
/sys/firmware/devicetree/base/ocp/i2c@44e0b000/tps@24/tps65217-pwrbutton
/sys/bus/platform/devices/tps65217-pwrbutton

But there is nothing mentioned in /proc/interrupts

root@elle-board:~# cat /proc/interrupts 
CPU0 
16: 115418 INTC 68 Level gp_timer
20: 563 INTC 12 Level 49000000.edma_ccint
22: 0 INTC 14 Level 49000000.edma_ccerrint
26: 0 INTC 96 Level 44e07000.gpio
59: 44 INTC 98 Level 4804c000.gpio
76: 15 4804c000.gpio 16 Edge rotary-encoder
77: 13 4804c000.gpio 17 Edge rotary-encoder
78: 16 4804c000.gpio 18 Edge button0
92: 0 INTC 32 Level 481ac000.gpio
125: 0 INTC 62 Level 481ae000.gpio
140: 0 481ae000.gpio 14 Edge 48060000.mmc cd
158: 2969 INTC 72 Level 44e09000.serial
162: 206 INTC 70 Level 44e0b000.i2c
163: 0 INTC 71 Level 4802a000.i2c
164: 1979 INTC 64 Level mmc0
165: 11 INTC 28 Level mmc1
176: 207506 INTC 36 Level tilcdc
182: 1974 INTC 18 Level musb-hdrc.0
183: 1779 INTC 17 Level 47400000.dma-controller
Err: 0

nor is there an event node created in /dev/input

I have tried defining the node inside the i2c definition also as:

&i2c0 {
	status = "okay";
	clock-frequency = <400000>;

	tps: tps@24 {
		reg = <0x24>;
		status= "okay";

		backlight {
			status= "okay";
			isel = <2>;  /* 1 - ISET1, 2 ISET2 */
			fdim = <100>; /* TPS65217_BL_FDIM_100HZ */
			default-brightness = <50>;
		};

		tps65217-pwrbutton {
					status = "okay";
					compatible = "ti,tps65217-pwrbutton";
					interrupts = <2>;
				};
	};
};

it makes no difference

I reckon there's something obvious I have missed; any clues would be gratefully received.

Thanks for the help.
Best regards,
Richard

  • The software team have been notified. They will respond here.
  • Hi Richard,

    I think your DTS entry is correct and enough, it is aligned with the below txt file:

    www.kernel.org/.../tps65218-pwrbutton.txt

    Can you share what you have in /proc/interrupts before adding that entry in DTS and after that? Note that this interrupt is NMI.

    You can also debug the below two files, check if power button interrupt is init and enabled properly:

    linux-kernel/drivers/input/misc/tps65218-pwrbutton.c
    linux-kernel/drivers/mfd/tps65217.c

    Regards,
    Pavel
  • Hi Pavel

    I had neglected to add the necessary driver to the kernel config
    - I had originally thought it was added functionality to the TPS65217 driver itself not a new driver
    - after finding the correct driver in menuconfig I find this listed in /proc/interrupts and there is a /dev/input/eventX node

    I notice that it has entered as /dev/input/event0 moving my previous nodes
    - is there a way to determine which event node is which (there is no "by-id" directory)

    Thanks for the help

    All the best,
    Richard
  • Richard,

    Richard McAleer said:
    - is there a way to determine which event node is which (there is no "by-id" directory)

    You can determine through the "by-path" directory and/or through /proc/bus/input/devices, see below example of what I have on AM335x StarterKit:

    root@am335x-evm:/dev/input# ls -al
    drwxr-xr-x    3 root     root           160 Mar 29 20:53 .
    drwxr-xr-x   12 root     root         13300 Mar 29 20:53 ..
    drwxr-xr-x    2 root     root            80 Mar 29 20:53 by-path
    crw-rw----    1 root     input      13,  64 Mar 29 20:53 event0
    crw-rw----    1 root     input      13,  65 Mar 29 20:53 event1
    crw-rw----    1 root     input      13,  63 Mar 29 20:53 mice
    crw-rw----    1 root     input      13,  32 Mar 29 20:53 mouse0
    lrwxrwxrwx    1 root     root             6 Mar 29 20:53 touchscreen0 -> event1
    root@am335x-evm:/dev/input# cd by-path/
    root@am335x-evm:/dev/input/by-path# ls -al
    drwxr-xr-x    2 root     root            80 Mar 29 20:53 .
    drwxr-xr-x    3 root     root           160 Mar 29 20:53 ..
    lrwxrwxrwx    1 root     root             9 Mar 29 20:53 platform-TI-am335x-tsc-event -> ../event1
    lrwxrwxrwx    1 root     root             9 Mar 29 20:53 platform-gpio_buttons@0-event -> ../event0
    root@am335x-evm:/dev/input/by-path# cat /proc/bus/input/devices
    I: Bus=0019 Vendor=0001 Product=0001 Version=0100
    N: Name="gpio_buttons@0"
    P: Phys=gpio-keys/input0
    S: Sysfs=/devices/platform/gpio_buttons@0/input/input0
    U: Uniq=
    H: Handlers=event0
    B: PROP=0
    B: EV=3
    B: KEY=f 0 0 0 0 0 0 0 0

    I: Bus=0000 Vendor=0000 Product=0000 Version=0000
    N: Name="ti-tsc"
    P: Phys=
    S: Sysfs=/devices/platform/ocp/44e0d000.tscadc/TI-am335x-tsc/input/input1
    U: Uniq=
    H: Handlers=mouse0 event1
    B: PROP=0
    B: EV=b
    B: KEY=400 0 0 0 0 0 0 0 0 0 0
    B: ABS=1000003


    Regards,
    Pavel