static irqreturn_t tps65217_irq(int irq, void *irq_data) { struct tps65217 *tps = irq_data; unsigned int int_reg = 0, status_reg = 0;
tps65217_reg_read(tps, TPS65217_REG_INT, &int_reg); tps65217_reg_read(tps, TPS65217_REG_STATUS, &status_reg); if (status_reg) dev_dbg(tps->dev, "status now: 0x%X\n", status_reg); if (!int_reg) return IRQ_NONE; if (int_reg & TPS65217_INT_PBI) { /* Handle push button */ dev_dbg(tps->dev, "power button status change\n"); input_report_key(tps->pwr_but, KEY_POWER, status_reg & TPS65217_STATUS_PB); input_sync(tps->pwr_but); } if (int_reg & TPS65217_INT_ACI) { /* Handle AC power status change */ dev_dbg(tps->dev, "AC power status change\n"); /* Press KEY_POWER when AC not present */ input_report_key(tps->pwr_but, KEY_POWER, ~status_reg & TPS65217_STATUS_ACPWR); input_sync(tps->pwr_but); } if (int_reg & TPS65217_INT_USBI) { /* Handle USB power status change */ dev_dbg(tps->dev, "USB power status change\n"); } return IRQ_HANDLED; } Regards, John > On Apr 17, 2016, at 4:05 PM, William Hermans <yyrk...@gmail.com> wrote: > > I'll *NOT* be using a TI kernel, period. > > On Sun, Apr 17, 2016 at 4:02 PM, John Syne <john3...@gmail.com > <mailto:john3...@gmail.com>> wrote: > OK, I see the problem. The file I was looking at is different to the one you > linked to. I am using the 4.1.13-ti-r33 kernel, which means that you are > missing a patch. Build your own kernel and then look at this file again. > > Regards, > John > > > > >> On Apr 17, 2016, at 3:55 PM, William Hermans <yyrk...@gmail.com >> <mailto:yyrk...@gmail.com>> wrote: >> >> https://github.com/torvalds/linux/blob/master/drivers/mfd/tps65217.c#L164 >> <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. >> >> On Sun, Apr 17, 2016 at 3:23 PM, John Syne <john3...@gmail.com >> <mailto:john3...@gmail.com>> wrote: >> Never mind, I found it. >> >> drivers/mfd/tps65217.c line 164 >> >> Regards, >> John >> >> >> >> >>> On Apr 17, 2016, at 2:37 PM, William Hermans <yyrk...@gmail.com >>> <mailto:yyrk...@gmail.com>> wrote: >>> >>> So no one has any idea ? I'm looking for the module, that traps power >>> events, and shuts down the BBB. All I need is a file name. It's pretty hard >>> making sense of the mess that is /drivers/mfd, and the documentation does >>> not seem to be helpful either. >>> >>> Documentation/power/regulator/charger-management.txt does not exist in my >>> repo, nor in Linus' repo either. There is a similar file, but nothing >>> apparently related to our hardware. Passed that, most of the stuff int the >>> Documentation/power directory seems to be related to ACPI, which again, has >>> nothing to do with even our architecture . . . >>> >>> On Sat, Apr 16, 2016 at 9:09 PM, William Hermans <yyrk...@gmail.com >>> <mailto:yyrk...@gmail.com>> wrote: >>> So I've only found this so far. >>> https://github.com/torvalds/linux/blob/master/drivers/mfd/tps65217.c#L222-#L229 >>> >>> <https://github.com/torvalds/linux/blob/master/drivers/mfd/tps65217.c#L222-%23L229> >>> >>> Which I pretty much had already figured out this morning right after I >>> posted. Pretty much, the PMIC sees a condition, that needs attention. It >>> writes some values to registers that relate to the given condition, and >>> then sends an NMI out to the am335x processor. Where the am335x processor >>> immediately picks up that the PMIC needs attention( the whole point of an >>> NMI ), reads the register values out of the PMIC to determine what action >>> needs to be taken. Which in the case of the power button being pressed. the >>> am335x issues a shutdown now -h ( Linux ) Which looking at the code, >>> actually seems like the LKM is actually writing to the PMIC registers to do >>> this ?! >>> >>> Anyway, no idea how a power good condition is being acted on *still*. >>> Meaning, no idea how when a battery is connected, when the external power >>> somehow goes missing. How that particular shutdown is happening, and from >>> where. >>> >>> On Sat, Apr 16, 2016 at 4:32 PM, John Syne <john3...@gmail.com >>> <mailto:john3...@gmail.com>> wrote: >>> I’m not sure, but best place to look would be >>> Documentation/power/regulator/charger-management.txt. I believe the PMIC >>> issues event when AC is removed. >>> >>> Regards, >>> John >>> >>> >>> >>> >>>> On Apr 16, 2016, at 12:59 PM, William Hermans <yyrk...@gmail.com >>>> <mailto:yyrk...@gmail.com>> wrote: >>>> >>>> Also from what I've read this behavior is different between console and >>>> LXDE images. So if this is true I understand that. I do not want the >>>> behaviors that each of these images provides, but wish to customize my own. >>>> >>>> >>>> On Sat, Apr 16, 2016 at 12:55 PM, William Hermans <yyrk...@gmail.com >>>> <mailto:yyrk...@gmail.com>> wrote: >>>> When a battery is connected to a beaglebone black, how does the software >>>> know to issue a shutdown when power is no longer coming in ? More >>>> specifically I'm interested in which file / script performs this action, >>>> and what mechanism triggers this behavior. >>>> >>>> My intentions are to modify / customize what actually happens when power >>>> to the board is battery only. >>>> >>>> >>>> >>>> >>>> >>>> -- >>>> For more options, visit http://beagleboard.org/discuss >>>> <http://beagleboard.org/discuss> >>>> --- >>>> You received this message because you are subscribed to the Google Groups >>>> "BeagleBoard" group. >>>> To unsubscribe from this group and stop receiving emails from it, send an >>>> email to beagleboard+unsubscr...@googlegroups.com >>>> <mailto:beagleboard+unsubscr...@googlegroups.com>. >>>> For more options, visit https://groups.google.com/d/optout >>>> <https://groups.google.com/d/optout>. >>>> >>>> >>>> -- >>>> For more options, visit http://beagleboard.org/discuss >>>> <http://beagleboard.org/discuss> >>>> --- >>>> You received this message because you are subscribed to the Google Groups >>>> "BeagleBoard" group. >>>> To unsubscribe from this group and stop receiving emails from it, send an >>>> email to beagleboard+unsubscr...@googlegroups.com >>>> <mailto:beagleboard+unsubscr...@googlegroups.com>. >>>> For more options, visit https://groups.google.com/d/optout >>>> <https://groups.google.com/d/optout>. >>> >>> >>> -- >>> For more options, visit http://beagleboard.org/discuss >>> <http://beagleboard.org/discuss> >>> --- >>> You received this message because you are subscribed to the Google Groups >>> "BeagleBoard" group. >>> To unsubscribe from this group and stop receiving emails from it, send an >>> email to beagleboard+unsubscr...@googlegroups.com >>> <mailto:beagleboard+unsubscr...@googlegroups.com>. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/beagleboard/F27E94CA-369F-4E5D-8555-EEAD3B034C28%40gmail.com >>> >>> <https://groups.google.com/d/msgid/beagleboard/F27E94CA-369F-4E5D-8555-EEAD3B034C28%40gmail.com?utm_medium=email&utm_source=footer>. >>> >>> For more options, visit https://groups.google.com/d/optout >>> <https://groups.google.com/d/optout>. >>> >>> >>> >>> -- >>> For more options, visit http://beagleboard.org/discuss >>> <http://beagleboard.org/discuss> >>> --- >>> You received this message because you are subscribed to the Google Groups >>> "BeagleBoard" group. >>> To unsubscribe from this group and stop receiving emails from it, send an >>> email to beagleboard+unsubscr...@googlegroups.com >>> <mailto:beagleboard+unsubscr...@googlegroups.com>. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/beagleboard/CALHSORqNNeWN9uW_WDsTQC%2BNuArTq%2BtjGMVO5a%2Be-S6cyDk21w%40mail.gmail.com >>> >>> <https://groups.google.com/d/msgid/beagleboard/CALHSORqNNeWN9uW_WDsTQC%2BNuArTq%2BtjGMVO5a%2Be-S6cyDk21w%40mail.gmail.com?utm_medium=email&utm_source=footer>. >>> For more options, visit https://groups.google.com/d/optout >>> <https://groups.google.com/d/optout>. >> >> >> -- >> For more options, visit http://beagleboard.org/discuss >> <http://beagleboard.org/discuss> >> --- >> You received this message because you are subscribed to the Google Groups >> "BeagleBoard" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to beagleboard+unsubscr...@googlegroups.com >> <mailto:beagleboard+unsubscr...@googlegroups.com>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/beagleboard/D02D2BC4-66ED-434B-B7D9-66154797FDB7%40gmail.com >> >> <https://groups.google.com/d/msgid/beagleboard/D02D2BC4-66ED-434B-B7D9-66154797FDB7%40gmail.com?utm_medium=email&utm_source=footer>. >> >> For more options, visit https://groups.google.com/d/optout >> <https://groups.google.com/d/optout>. >> >> >> -- >> For more options, visit http://beagleboard.org/discuss >> <http://beagleboard.org/discuss> >> --- >> You received this message because you are subscribed to the Google Groups >> "BeagleBoard" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to beagleboard+unsubscr...@googlegroups.com >> <mailto:beagleboard+unsubscr...@googlegroups.com>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/beagleboard/CALHSORpC%3DDMupx5%2B57geCv20kHM3xO7DduTRkcbAg2f-RoXK0Q%40mail.gmail.com >> >> <https://groups.google.com/d/msgid/beagleboard/CALHSORpC%3DDMupx5%2B57geCv20kHM3xO7DduTRkcbAg2f-RoXK0Q%40mail.gmail.com?utm_medium=email&utm_source=footer>. >> For more options, visit https://groups.google.com/d/optout >> <https://groups.google.com/d/optout>. > > > -- > For more options, visit http://beagleboard.org/discuss > <http://beagleboard.org/discuss> > --- > You received this message because you are subscribed to the Google Groups > "BeagleBoard" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to beagleboard+unsubscr...@googlegroups.com > <mailto:beagleboard+unsubscr...@googlegroups.com>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/beagleboard/AF28B73F-B1CF-436A-988A-C9B0F685B39A%40gmail.com > > <https://groups.google.com/d/msgid/beagleboard/AF28B73F-B1CF-436A-988A-C9B0F685B39A%40gmail.com?utm_medium=email&utm_source=footer>. > > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. > > > -- > For more options, visit http://beagleboard.org/discuss > <http://beagleboard.org/discuss> > --- > You received this message because you are subscribed to the Google Groups > "BeagleBoard" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to beagleboard+unsubscr...@googlegroups.com > <mailto:beagleboard+unsubscr...@googlegroups.com>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/beagleboard/CALHSORq8%2Bn5s4vs_0ZUVJ0qaf-4puQWowGWYRTHfO7yi%3DM2V9g%40mail.gmail.com > > <https://groups.google.com/d/msgid/beagleboard/CALHSORq8%2Bn5s4vs_0ZUVJ0qaf-4puQWowGWYRTHfO7yi%3DM2V9g%40mail.gmail.com?utm_medium=email&utm_source=footer>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. -- For more options, visit http://beagleboard.org/discuss --- You received this message because you are subscribed to the Google Groups "BeagleBoard" group. To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/A4D69F79-DAB1-4AE9-8265-0757576F61EA%40gmail.com. For more options, visit https://groups.google.com/d/optout.