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 TPS65217 PB_IN in user space

Part Number: AM3352
Other Parts Discussed in Thread: TPS65217

Tool/software: Linux

Hi 

I am working on a board based on the BeagleBoneBlack

It is using the same PMIC the TPS65217 and including the  "tps65217.dtsi" used in the EVM source.

I have also made use of the backlight driver on this by declaring in my dst the following:

&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>;
		};
	};
};

I now need to expose the PB_IN of this chip as the design intends to use short presses of it for user interaction

What is the recommended way to expose this line to user space?

  • do I need to poll the i2c manually?
  • is it possible to define a GPIO on the I2C bus? equivalent to the backlight above?
  • is the state of this pin available from a node within the PMIC management already on the filesystem?

I already have a bunch of GPIO switches and a rotary encoder that I am already running a "poll and switch" on so being able to incorporate it in to that mechanism would be my preference

Thanks for any suggestions

All the best,

Richard

  • I've notified the design team. Feedback will be posted here.

    Best Regards,
    Yordan
  • Hi Richard,

    Are your routing the nINT pin from the PMIC to AM335x?  The PMIC INT register (0x02) can be programmed to assert the nINT signal when you press the PB, which would provide the stimulus query the PMIC STATUS register (0x10).

    Let me check on what would be required on the device tree side, and what we might have in /sys/kernel/debug available to query (question would be what keeps these values fresh).

    Regards,
    Mike

  • Richard,

    So far it's looking fairly promising.

    I'm using the latest version of the Processor SDK on the BeagleBone Black.

    You will find the PMIC register values by cat'ing /sys/kernel/debug/regmap/0-0024/registers

    Stock out of the box, if I press and hold the PB, bit 0 of the STATUS register is asserted when I cat the above regmap file, so this tells me we are responding to the nINT from the PMIC by default.

    Need to see what features of regmap can be used to generate an event to avoid polling - my gut feeling is polling the regmap directly will not work well, and will result is missing button press events.

    Regards,
    Mike
  • Thanks Mike,

    it certainly sounds like a good start

    - but as you say being able to map an interrupt (or generate a count) would be a more reliable way of picking up the presses

    Thanks for the help 

    All the best,

    Richard

  • Richard,

    I'm going to close this since we have not had an opportunty to talk further on this topic, but wanted to let you know newer kernels do support mapping the TPS65217 push button interrupt to the kernel, and can be configured in the DTS.

    This patch [1] is the first in a series that added power button irq capability. It was mainlined in Linux kernel 4.9, which maps to version 4.xx of the TI Processor SDK. If regmap functionality did not require any enhancements, it might be possible to backport this patch series to your kernel, but I have not done a full investigation to see if there would be any pitfalls.

    [1] patchwork.ozlabs.org/.../
  • Thanks Michael

    If it needs this to be able to work it would probably best if we tried to adopt the most up to date kernel rather than backporting features.

    I'll look to attempt this shortly.

    Thanks for the help.

    Best regards,

    Richard