mainboard/google/nocturne: simplify camera power references

This change primarily moves the PowerResource up to a more common scope so
that the _PRx references are simpler. The ^ scope modifier isn't well
supported everywhere amongst OSes and drivers.  Windows 10 will BSOD
early during boot with ACPI_BIOS_ERROR (code 0x6, which means it could
not find the object referenced by a _PRx) with the way things are currently
laid out).

I've also not seen a firmware outside of coreboot that tries to reference
count _ON and _OFF. Isn't it up to the OS to deference count, and whatever
it tells ACPI is what should happen (i.e., on means on and off means off)?

Some of the _UIDs are also duplicated.  This change makes them unique.

A few cosmetic changes are made so that diffing cam0.asl against
cam1.asl has fewer extraneous differences.

Change-Id: I9c9f6c712b075450539d5b84ac5bb221b3cbb57e
Signed-off-by: Matt Delco <delco@chromium.org>
Reviewed-on: https://review.coreboot.org/27605
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Rajmohan Mani <rajmohan.mani@intel.com>
This commit is contained in:
Matt Delco 2018-07-23 09:33:28 -07:00 committed by Patrick Georgi
parent b89bd788be
commit 8928bc0d63
2 changed files with 88 additions and 123 deletions

View File

@ -15,6 +15,42 @@
Scope (\_SB.PCI0.I2C3)
{
PowerResource (FCPR, 0, 0)
{
Name (STA, 0)
Method (_ON, 0, Serialized) {
If (LEqual(STA, 0)) {
CTXS (GPIO_FCAM_RST_L)
STXS (GPIO_FCAM_PWR_EN)
STXS (GPIO_PCH_FCAM_CLK_EN)
Sleep (3)
STXS (GPIO_FCAM_RST_L)
/*
* A delay of T7 (minimum of 5 ms) + T8
* (max 5 ms + delay of coarse integration
* time value + 14 H, time for 14 horizontal
* lines) is needed to have the sensor ready
* for streaming, as soon as the power on
* sequence completes
*/
Sleep (11)
Store (1, STA)
}
}
Method (_OFF, 0, Serialized) {
If (LEqual(STA, 1)) {
CTXS (GPIO_PCH_FCAM_CLK_EN)
CTXS (GPIO_FCAM_RST_L)
CTXS (GPIO_FCAM_PWR_EN)
Store (0, STA)
}
}
Method (_STA, 0, NotSerialized) {
Return (STA)
}
}
Device (CAM0)
{
Name (_HID, "SONY319A") /* _HID: Hardware ID */
@ -34,60 +70,8 @@ Scope (\_SB.PCI0.I2C3)
)
})
Name (STA, 0)
Method (PMON, 0, Serialized) {
If (STA == 0) {
CTXS (GPIO_FCAM_RST_L)
STXS (GPIO_FCAM_PWR_EN)
STXS (GPIO_PCH_FCAM_CLK_EN)
Sleep(3)
STXS (GPIO_FCAM_RST_L)
/*
* A delay of T7 (minimum of 5 ms) + T8
* (max 5 ms + delay of coarse integration
* time value + 14 H, time for 14 horizontal
* lines) is needed to have the sensor ready
* for streaming, as soon as the power on
* sequence completes
*/
Sleep(11);
}
STA++
}
Method (PMOF, 0, Serialized) {
If (STA == 0) {
Return
}
STA--
If (STA == 0) {
CTXS (GPIO_PCH_FCAM_CLK_EN)
CTXS (GPIO_FCAM_RST_L)
CTXS (GPIO_FCAM_PWR_EN)
}
}
Name (_PR0, Package (0x01) { FCPR })
Name (_PR3, Package (0x01) { FCPR })
/* Power resource methods for Rear Camera */
PowerResource (FCPR, 0, 0) {
Method (_ON, 0, Serialized) {
PMON ()
}
Method (_OFF, 0, Serialized) {
PMOF ()
}
Method (_STA, 0, Serialized) {
If (LGreater(STA,0)) {
Return (0x1)
}
Else {
Return (0x0)
}
}
}
Name (_PR0, Package () { FCPR })
Name (_PR3, Package () { FCPR })
/* Port0 of CAM0 is connected to port0 of CIO2 device */
Name (_DSD, Package () {
@ -147,11 +131,10 @@ Scope (\_SB.PCI0.I2C3)
AddressingMode7Bit, "\\_SB.PCI0.I2C3",
0x00, ResourceConsumer, ,)
})
Name (_DEP, Package () { CAM0 })
Name (_DEP, Package() { ^^I2C3.CAM0 })
Name (_PR0, Package (0x01) { ^^I2C3.CAM0.FCPR })
Name (_PR3, Package (0x01) { ^^I2C3.CAM0.FCPR })
Name (_PR0, Package () { FCPR })
Name (_PR3, Package () { FCPR })
Name (_DSD, Package ()
{

View File

@ -15,6 +15,40 @@
Scope (\_SB.PCI0.I2C5)
{
PowerResource (RCPR, 0, 0)
{
Name (STA, 0)
Method (_ON, 0, Serialized) {
If (LEqual(STA, 0)) {
CTXS (GPIO_RCAM_RST_L)
STXS (GPIO_RCAM_PWR_EN)
STXS (GPIO_PCH_RCAM_CLK_EN)
Sleep (3)
STXS (GPIO_RCAM_RST_L)
/*
* A delay of T7 (minimum of 10 ms) + T8
* (max 1.4 ms + delay of coarse integration
* time value) is needed to have the sensor
* ready for streaming, as soon as the power
* on sequence completes
*/
Sleep (12)
Store (1, STA)
}
}
Method (_OFF, 0, Serialized) {
If (LEqual(STA, 1)) {
CTXS (GPIO_PCH_RCAM_CLK_EN)
CTXS (GPIO_RCAM_RST_L)
CTXS (GPIO_RCAM_PWR_EN)
Store (0, STA)
}
}
Method (_STA, 0, NotSerialized) {
Return (STA)
}
}
Device (CAM1)
{
@ -35,59 +69,8 @@ Scope (\_SB.PCI0.I2C5)
)
})
Name (STA, 0)
Method (PMON, 0, Serialized) {
If (STA == 0) {
CTXS(GPIO_RCAM_RST_L)
STXS(GPIO_RCAM_PWR_EN)
STXS(GPIO_PCH_RCAM_CLK_EN)
Sleep(3)
STXS(GPIO_RCAM_RST_L)
/*
* A delay of T7 (minimum of 10 ms) + T8
* (max 1.4 ms + delay of coarse integration
* time value) is needed to have the sensor
* ready for streaming, as soon as the power
* on sequence completes
*/
Sleep(12)
}
STA++
}
Method (PMOF, 0, Serialized) {
If (STA == 0) {
Return
}
STA--
If (STA == 0) {
CTXS(GPIO_PCH_RCAM_CLK_EN)
CTXS(GPIO_RCAM_RST_L)
CTXS(GPIO_RCAM_PWR_EN)
}
}
Name (_PR0, Package (0x01) { RCPR })
Name (_PR3, Package (0x01) { RCPR })
/* Power resource methods for Rear Camera */
PowerResource (RCPR, 0, 0) {
Method (_ON, 0, Serialized) {
PMON ()
}
Method (_OFF, 0, Serialized) {
PMOF ()
}
Method (_STA, 0, Serialized) {
If (LGreater(STA,0)) {
Return (0x1)
}
Else {
Return (0x0)
}
}
}
Name (_PR0, Package () { RCPR })
Name (_PR3, Package () { RCPR })
/* Port0 of CAM1 is connected to port1 of CIO2 device */
Name (_DSD, Package () {
@ -136,7 +119,7 @@ Scope (\_SB.PCI0.I2C5)
Device (VCM1)
{
Name (_HID, "PRP0001") /* _HID: Hardware ID */
Name (_UID, Zero) /* _UID: Unique ID */
Name (_UID, 3) /* _UID: Unique ID */
Name (_DDN, "AKM AF DAC") /* _DDN: DOS Device Name */
Method (_STA, 0, NotSerialized) /* _STA: Status */
@ -152,10 +135,10 @@ Scope (\_SB.PCI0.I2C5)
)
})
Name (_DEP, Package() { ^^I2C5.CAM1 })
Name (_DEP, Package() { CAM1 })
Name (_PR0, Package (0x01) { ^^I2C5.CAM1.RCPR })
Name (_PR3, Package (0x01) { ^^I2C5.CAM1.RCPR })
Name (_PR0, Package () { RCPR })
Name (_PR3, Package () { RCPR })
Name (_DSD, Package () {
ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
@ -168,7 +151,7 @@ Scope (\_SB.PCI0.I2C5)
Device (NVM1)
{
Name (_HID, "INT3499") /* _HID: Hardware ID */
Name (_UID, Zero) /* _UID: Unique ID */
Name (_UID, 1) /* _UID: Unique ID */
Name (_DDN, "M24C64S") /* _DDN: DOS Device Name */
Method (_STA, 0, NotSerialized) /* _STA: Status */
@ -182,11 +165,10 @@ Scope (\_SB.PCI0.I2C5)
AddressingMode7Bit, "\\_SB.PCI0.I2C5",
0x00, ResourceConsumer, ,)
})
Name (_DEP, Package () { CAM1 })
Name (_DEP, Package () { ^^I2C5.CAM1 })
Name (_PR0, Package (0x01) { ^^I2C5.CAM1.RCPR })
Name (_PR3, Package (0x01) { ^^I2C5.CAM1.RCPR })
Name (_PR0, Package () { RCPR })
Name (_PR3, Package () { RCPR })
Name (_DSD, Package ()
{