From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Johannes Stezenbach <js@sig21.net>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	Platform Driver <platform-driver-x86@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	David Cohen <david.a.cohen@linux.intel.com>
Subject: Re: Cherryview wake up events
Date: Thu, 2 Feb 2017 12:31:22 +0200	[thread overview]
Message-ID: <20170202103122.GH2053@lahna.fi.intel.com> (raw)
In-Reply-To: <20170202095200.d5clhprl7rpgrf72@sig21.net>
On Thu, Feb 02, 2017 at 10:52:00AM +0100, Johannes Stezenbach wrote:
> Hi Mika,
> 
> On Tue, Jan 31, 2017 at 03:37:40PM +0100, Johannes Stezenbach wrote:
> > - Powerbutton driver seems simple enough, the only specialty
> >   of the TI dcove PB driver is the workarond for lost button
> >   press event after resume.  However, I still don't see how
> >   the PB would cause thermal event irqs on E200HA and how the
> >   PMIC driver would change it?
> 
> In ProductionKernelQuilts I found
> DC-TI-PMIC-disable-power-button-support.patch so I guess it
> might not be needed because it's probably handled by ACPI.
> 
> > I think the mfd driver would be similar to intel_soc_pmic_crc.c,
> > the dollar_cove_ti_powerbtn.c I would keep instead of merging
> > it into intel_mid_powerbtn.c.  I guess what we need is in
> > drivers/acpi/pmic/ something similar to intel_pmic_crc.c,
> > the ProductionKernelQuilts has 0001-ACPI-Adding-support-for-TI-pmic-opregion.patch.
> 
> I have preliminary versions of the mfd and opregion driver,
> while testing I found the GPIO opregion is not registered:
Cool, I take it that you started working on that ;-)
> Excerpt from DSDT:
> https://linuxtv.org/~js/e200ha/dsdt.dsl
> 
>             Device (PMI2)
>             {
>                 Name (_ADR, Zero)  // _ADR: Address
>                 Name (_HID, "INT33F5" /* TI PMIC Controller */)  // _HID: Hardware ID
>                 Name (_CID, "INT33F5" /* TI PMIC Controller */)  // _CID: Compatible ID
>                 Name (_DDN, "TI PMIC Controller")  // _DDN: DOS Device Name
>                 Name (_HRV, 0x03)  // _HRV: Hardware Revision
>                 Name (_UID, One)  // _UID: Unique ID
>                 Name (_DEP, Package (0x02)  // _DEP: Dependencies
>                 {
>                     I2C7, 
>                     GPO1
>                 })
>                 Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
>                 {
>                     Name (SBUF, ResourceTemplate ()
>                     {
>                         I2cSerialBusV2 (0x005E, ControllerInitiated, 0x000F4240,
>                             AddressingMode7Bit, "\\_SB.PCI0.I2C7",
>                             0x00, ResourceConsumer, , Exclusive,
>                             )
>                         GpioInt (Level, ActiveHigh, Shared, PullDefault, 0x0000,
>                             "\\_SB.GPO1", 0x00, ResourceConsumer, ,
>                             )
>                             {   // Pin list
>                                 0x000F
>                             }
>                     })
>                     Return (SBUF) /* \_SB_.PCI0.I2C7.PMI2._CRS.SBUF */
>                 }
> ...
>                 Name (AVBL, Zero)
>                 Name (AVBD, Zero)
>                 Name (AVBG, Zero)
>                 Method (_REG, 2, NotSerialized)  // _REG: Region Availability
>                 {
>                     If (Arg0 == 0x08)
>                     {
>                         AVBG = Arg1
>                     }
> 
>                     If (Arg0 == 0x8D)
>                     {
>                         AVBL = Arg1
>                     }
> 
>                     If (Arg0 == 0x8C)
>                     {
>                         AVBD = Arg1
>                     }
>                 }
> 
> 
> acpidbg:
>         \_SB.PCI0.I2C7.PMI2.AVBL Integer      ffff8be7b74d97a8 01 = 0000000000000001
>         \_SB.PCI0.I2C7.PMI2.AVBD Integer      ffff8be7b74d94d8 01 = 0000000000000001
>         \_SB.PCI0.I2C7.PMI2.AVBG Integer      ffff8be7b74d9be0 01 = 0000000000000000
> 
> Any idea about it?
> devm_gpiochip_add_data() in chv_gpio_probe() indirectly calls acpi_gpiochip_add()
> which should use _DEP to figure out to call _REG, right?
Actually no, we don't support all _DEP in Linux yet. But that's not the
problem though. See below.
> Also PMI2 has
> 
>                 OperationRegion (GPOP, GeneralPurposeIo, Zero, 0x0100)
>                 Field (GPOP, ByteAcc, NoLock, Preserve)
>                 {
>                     Connection (
>                         GpioIo (Exclusive, PullDefault, 0x0000, 0x0000, IoRestrictionOutputOnly,
>                             "\\_SB.PCI0.I2C7.PMI2", 0x00, ResourceConsumer, ,
>                             )
>                             {   // Pin list
>                                 0x0020
>                             }
>                     ), 
>                     GMP0,   1, 
>                     ...
>                     (repeat for many more pins)
> 
> I guess it means it uses chv_gpio pins and can't work
> if the GPIO opregion is not registered?
That is using GPIO pins of the PMI2 device - the PMIC GPIO driver, I
suppose.
So in addition to the PMIC MFD driver, you need to have a GPIO driver
for Dollar Cove (I guess the quilt patch series included that as well?).
If you look under the /sys/bus/acpi/devices/DEVICE, it should include
bunch of physical_nodeX links. Those are the subdevices of the MFD so
when the GPIO driver registers the GPIO core then automatically installs
GPIO OpRegion handler.
> FWIW, with the mfd driver, /proc/interrupts has
> 
>  180:          0          0          0          0  chv-gpio    9  TI Dollar Cove
> 
> I guess the 9 refers to the 10th pin in north_pins[] which is pin 0x000F, right?
> I boot with "dyndbg=file gpiolib* +p" and get
> 
> [  +0.012798] acpi INT33F5:00: GPIO: looking up 0 in _CRS
> [  +0.000214] intel_soc_pmic_i2c i2c-INT33F5:00: GPIO lookup for consumer intel_soc_pmic
> [  +0.000003] intel_soc_pmic_i2c i2c-INT33F5:00: using ACPI for GPIO lookup
> [  +0.000005] acpi INT33F5:00: GPIO: looking up intel_soc_pmic-gpios
> [  +0.000005] acpi INT33F5:00: GPIO: looking up intel_soc_pmic-gpio
> [  +0.000005] acpi INT33F5:00: GPIO: looking up 0 in _CRS
> [  +0.000091] cherryview-pinctrl INT33FF:01: request pin 15 (GPIO_SUS0) for INT33FF:01:406
> 
> but so far the irq never triggers.
Probably because the PMIC does not have anything to report yet. When you
add the DCOVE GPIO driver, and start receiving input events from the
button array, then you should see that interrupt count increasing. If
everything works correctly.
next prev parent reply	other threads:[~2017-02-02 10:31 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-19 11:21 Cherryview wake up events Johannes Stezenbach
2016-09-19 11:56 ` Mika Westerberg
2016-09-19 20:36   ` Johannes Stezenbach
2016-09-20  9:18     ` Mika Westerberg
2016-09-20 10:14       ` Johannes Stezenbach
2016-09-20 10:40         ` Mika Westerberg
2016-09-20 15:59           ` Johannes Stezenbach
2016-09-20 21:11             ` Johannes Stezenbach
2016-09-21  9:06               ` Mika Westerberg
2016-09-21  9:16                 ` Johannes Stezenbach
2016-09-23  8:19                   ` Mika Westerberg
2016-09-23  9:59                     ` Johannes Stezenbach
2016-10-05 12:46                     ` Johannes Stezenbach
2016-10-05 13:05                       ` Mika Westerberg
2016-12-04 18:52                         ` Johannes Stezenbach
2016-12-05 11:06                           ` Mika Westerberg
2017-01-24  9:41                             ` Johannes Stezenbach
2017-01-24 11:14                               ` Andy Shevchenko
2017-01-24 13:52                                 ` Johannes Stezenbach
2017-01-24 14:28                                   ` Andy Shevchenko
2017-01-24 19:23                                     ` Johannes Stezenbach
2017-01-25  9:29                                       ` Mika Westerberg
2017-01-26 22:56                                       ` Andy Shevchenko
2017-01-27 11:38                                         ` Johannes Stezenbach
2017-01-27 13:21                                           ` Andy Shevchenko
2017-01-27 13:30                                             ` Johannes Stezenbach
2017-01-30 20:57                                               ` Johannes Stezenbach
2017-01-30 22:05                                                 ` Andy Shevchenko
2017-01-31 14:37                                                   ` Johannes Stezenbach
2017-01-31 14:44                                                     ` Mika Westerberg
2017-02-02  9:52                                                     ` Johannes Stezenbach
2017-02-02 10:31                                                       ` Mika Westerberg [this message]
2017-02-02 11:12                                                         ` Johannes Stezenbach
2017-02-02 11:35                                                           ` Mika Westerberg
2017-02-02 12:16                                                             ` Mika Westerberg
2017-02-02 13:52                                                               ` Johannes Stezenbach
2017-02-02 14:26                                                                 ` Mika Westerberg
2017-02-02 14:31                                                                   ` Johannes Stezenbach
2017-02-02 15:02                                                                     ` Mika Westerberg
2017-02-02 15:42                                                                       ` Johannes Stezenbach
2017-02-02 15:58                                                                         ` Mika Westerberg
2017-02-02 17:32                                                                           ` Johannes Stezenbach
2017-02-03 10:00                                                                             ` Mika Westerberg
2017-02-03 13:16                                                                               ` Johannes Stezenbach
2017-02-09  9:24                                                                           ` Johannes Stezenbach
2017-02-09  9:38                                                                             ` Mika Westerberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox
  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):
  git send-email \
    --in-reply-to=20170202103122.GH2053@lahna.fi.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=david.a.cohen@linux.intel.com \
    --cc=js@sig21.net \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY
  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
  Be sure your reply has a Subject: header at the top and a blank line
  before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).