https://github.com/torvalds/linux/blob/master/drivers/mfd/tps65217.c#L164
Nothing there at line 164, then on line 165 starts a function. Which contains the code I linked to yesterday. Which is the power push button code. Which again, is not helping . . . So let’s walk through that function. Which happens in this order . …
variable type definitions declarations.
conditional check to find device tree definition node.
test chip_id, return if failure.
attempt and test to allocate memory for the tps object.
attempt to map the tps object to the PMIC registers
mfd device add, and test device add.
attempt to read the PMIC registers, and test return code.
Here it gets a bit fuzzy however, it seems as though the code is attempting to reset the system by setting various register bits in the PMIC ?! I know all about the registers of the PMIC, or rather can find otu what is what really quick by reading the datasheet which I have right in front of me. That is not what I’m having an issue grasping. It seems to me that a shutdown in this manner would not be clean. However, it could be that setting these register bits as such may not cause an immediate power down. That is what I find unclear.
/* Set the PMIC to shutdown on PWR_EN toggle */
if (status_off) {
ret = tps65217_set_bits(tps, TPS65217_REG_STATUS,
TPS65217_STATUS_OFF, TPS65217_STATUS_OFF,
TPS65217_PROTECT_NONE);
if (ret)
dev_warn(tps->dev, “unable to set the status OFF\n”);
}
The comment above the code seems to indicate that PWR_EN is causing a shutdown based on being toggle. However, PWR_EN is NOT a button, or even a line connected to a button. From the data sheet . . .
PWR_EN
Enable input for DCDC1, 2, 3 converters and LDO1, 2, 3, 4. Pull this pin high to start the
power-up sequence.
In the schematic, PWR_EN is not connected to any button. Period. The button is connected to PB_IN.
Anyway, the rest of the code is inconsequential.