From fa3086f764b6be5dab803f58a5e7a1af083d92b6 Mon Sep 17 00:00:00 2001 From: Marijan Limov Date: Sat, 22 Jan 2022 01:43:05 +0100 Subject: [PATCH] beryllium: Both Tianma and EBBG work now --- beryllium/DSDT.AML | Bin 253641 -> 256839 bytes beryllium/display.asl | 43 ++++++- beryllium/graphics.asl | 3 + beryllium/panelcfg.asl | 2 +- beryllium/panelcfg2.asl | 4 +- legacy/beryllium/DSDT.aml | Bin 245389 -> 246112 bytes legacy/beryllium/DSDT.dsl | 250 ++++++++++++++++++++++++++++++++++++++ 7 files changed, 296 insertions(+), 6 deletions(-) diff --git a/beryllium/DSDT.AML b/beryllium/DSDT.AML index 02c2e0dfde7589098cbb6eef1abae0af32c74708..2c3b9939c04052e078cc4e371a2bced4ca3244ce 100644 GIT binary patch delta 875 zcmb7@L2DC16vvyL7GzT>LOnekvS-yBzZmt0ulk3BhDm|i@NhitKi_{1JN@q9pqswbWaI=a z{h`TS$B$CCNj55B%A4e(5~OP_atB|n7Fn-^*{DVK7AKwup67zruo=4$aC2f5d=8%P zf?vldFie<>6mF5bRRmN3GVu`wP1r@*CoGA!o-r3EBQC;_S_z!9~joD z8;S)56_=Dk3Md06fN@jaNaZ?6qm(EhRYFF}D#iAqxe^M5sQ;H#Qc{>^&0OVbE2MM@ zp;Yp(^xR)SrtcH%tHRq~U4GtQQ2tcvzo6-;Vga7cZCVb$Kd*-&nSiW=P#_`@o}FI= z9Or?p!)Bx4W^oBVgLGmxCW=6#HN~!Wk%>eWA8GQf% diff --git a/beryllium/display.asl b/beryllium/display.asl index 9b09f2c..bba38fd 100644 --- a/beryllium/display.asl +++ b/beryllium/display.asl @@ -1,13 +1,50 @@ // // This file contains the ACPI Extensions for Display Adapters // + +// Include primary panel specific ROM data +Include("panelcfg.asl") +Include("panelcfg2.asl") + +//Check if 0x01 on IC15 is present +//If it is, return tianma panel config +Method (PNPC, 0, NotSerialized) { + + // OperationRegion(TOP1, GenericSerialBus, 0x00, 0x100) // GenericSerialBus device at command value offset 0 + // Field(TOP1, BufferAcc, NoLock, Preserve) + // { + // Connection(I2cSerialBusV2 (0x0001, ControllerInitiated, 0x00061A80, + // AddressingMode7Bit, "\\_SB.IC15", + // 0x00, ResourceConsumer, , Exclusive, + // )), + // AccessAs(BufferAcc, AttribQuick), // Use the GenericSerialBus Read/Write Quick protocol + // FLD0, 8 // Virtual register at command value 0. + // } + // /* Create the GenericSerialBus data buffer */ + // Name(BUFF, Buffer(2){}) // Create GenericSerialBus data buffer as BUFF + // CreateByteField(BUFF, 0x00, STAT) // STAT = Status (Byte) + // /* Signal device (e.g. OFF) */ + // Store(FLD0, BUFF) // Invoke Read Quick transaction + // If(LEqual(STAT, 0x00)) // Successful? + // { + // Return(PCFA) + // } + // Else + // { + // Return(PCFB) + // } + + Return(PCFB) +} + + /// // _ROM Method - Used to retrieve proprietary ROM data for primary panel // Method (_ROM, 3, NotSerialized) { - // Include primary panel specific ROM data - Include("panelcfg.asl") + + //====================================================================================== // Based on the panel Id(Arg2), store the buffer object into Local2 @@ -17,7 +54,7 @@ Method (_ROM, 3, NotSerialized) { // All other dynamically detected panel configurations must not use this name //====================================================================================== - Local2 = PCFG + Local2 = PNPC // Ensure offset does not exceed the buffer size // otherwise return a Null terminated buffer diff --git a/beryllium/graphics.asl b/beryllium/graphics.asl index baee714..fab30f6 100644 --- a/beryllium/graphics.asl +++ b/beryllium/graphics.asl @@ -3050,6 +3050,9 @@ Device (GPU0) // //Include("displayext.asl") + + + NAME(_DOD, Package() { 0x00024321, diff --git a/beryllium/panelcfg.asl b/beryllium/panelcfg.asl index b1fd49e..8793e14 100644 --- a/beryllium/panelcfg.asl +++ b/beryllium/panelcfg.asl @@ -1,4 +1,4 @@ -Name (PCFG, Buffer(){" +Name (PCFA, Buffer(){" TIANMA_NT36672A_FHD Tianma Single DSI Video Mode Panel (1080x2246 24bpp) diff --git a/beryllium/panelcfg2.asl b/beryllium/panelcfg2.asl index ae91c7c..756ce3c 100644 --- a/beryllium/panelcfg2.asl +++ b/beryllium/panelcfg2.asl @@ -1,7 +1,7 @@ -Name (PCFG, Buffer(){" +Name (PCFB, Buffer(){" EBBG -EBBG +EBBG (possibly Tianma) 1080 28 diff --git a/legacy/beryllium/DSDT.aml b/legacy/beryllium/DSDT.aml index 72d9cb0c571879fda9d70c30e670b27eec40df2a..3b3080afa6793011b28b6391c0cadefde8594760 100644 GIT binary patch delta 570 zcmZWmPfJ@t5TD&m;=1We^A=G9f&uZ;Ly4g|RJ^=@8y~zhOY&0ErkK)CkZVqfLhMBa z@sOK%@X!?WQi@0Mo-dG__d@*yLU*E+1b1Ng&CGB9?(t*h{@}In>wf(8jsg91D#onO zclIZP2^mc2?+N?3ssSGx1p5H1Uo_i_1KB0NKoI2oemN)aItcRA?S$Z zso!m+l)?fxe@E<^^|IkB9q7VRTIos?E|qS29F=s^L{>z?@`I0|7l8EzM^U;KgNzoq zT&7kWRVrm2RzWVN#2x`7GDA&5qO_(l^$$%UqHn2HLcZSl1ODxHCIrMEyi2s)x{`$$rH|JOE GA^Q(x`g*(5c0=I9l1Mv`^>mO$T diff --git a/legacy/beryllium/DSDT.dsl b/legacy/beryllium/DSDT.dsl index c12ac1a..6e6a107 100644 --- a/legacy/beryllium/DSDT.dsl +++ b/legacy/beryllium/DSDT.dsl @@ -57721,6 +57721,33 @@ Include("cust_thermal_zones.asl") // 32 // } }) + + + OperationRegion(TOP1, GenericSerialBus, 0x00, 0x100) // GenericSerialBus device at command value offset + Field(TOP1, BufferAcc, NoLock, Preserve) + { + Connection(I2CSerialBusV2(0x5a,,100000,,"\_SB.I2C",,,,,RawDataBuffer(){1,6})), + AccessAs(BufferAcc, AttribByte), // Use the GenericSerialBus Read/Write Byte protocol + FLD0, 8, // Virtual register at command value 0. + FLD1, 8, // Virtual register at command value 1. + FLD2, 8 // Virtual register at command value 2. + } + // Create the GenericSerialBus data buffer + Name(BUFF, Buffer(3){}) + // Create GenericSerialBus data buffer as BUFF + CreateByteField(BUFF, 0x00, STAT) // STAT = Status (Byte) + CreateByteField(BUFF, 0x02, DATA) // DATA = Data (Byte) + // Read a byte of data from the device using command value 1 + Store(FLD1, BUFF) // Invoke a Read Byte transaction + If(LEqual(STAT, 0x00)) // Successful? + { + Store(0x16, DATA) // Save 0x16 into the data buffer + Store(BUFF, FLD2) // Invoke a Write Byte transaction + } + // Write the byte ‘0x16’ to the device using command value 2 + + + Return (RBUF) /* \_SB_.TSC1._CRS.RBUF */ } @@ -57980,6 +58007,229 @@ Include("cust_thermal_zones.asl") } } + Scope (\_SB.PEP0) + { + Method (FPMX, 0, NotSerialized) + { + Return (FPXC) /* \_SB_.PEP0.FPXC */ + } + + Name (FPXC, Package (0x01) + { + Package (0x04) + { + "DEVICE", + "\\_SB.FPRT", + Package (0x08) + { // beryllium uses an ic with enable pin to control power to fp, while yoga shuts and turns on a regulator + /*"DSTATE", + Zero, + Package (0x02) + { + "PMICVREGVOTE", + Package (0x06) + { + "PPP_RESOURCE_ID_LDO19_A", + One, // Voltage Regulator Type, 1 = LDO + 0x002F4D60, // Voltage (uV) + One, // Enable + 0x07, // Power Mode + Zero // Headroom + } + }, */ + + Package (0x02)//enable + { + "TLMMGPIO", + Package (0x06) + { + 94, + One, + Zero, + One, + Zero, + One + } + }, + + Package (0x02) + { + "DELAY", + Package (0x01) + { + 0x0A + } + }, + + Package (0x02) + { + "TLMMGPIO", + Package (0x06) + { + 121, // TLMM GPIO + One, // State : 1 = HIGH + Zero, // Function Select : 0 = ?? + One, // Direction : 0 = INPUT + Zero, // Pull Type : 1 = PULL_DOWN + Zero // Drive Strength : 0 = 2mA + } + }, + + Package (0x02) + { + "TLMMGPIO", + Package (0x06) + { + 37, + One, + Zero, + One, + Zero, + Zero + } + }, + + Package (0x02) + { + "DELAY", + Package (0x01) + { + One + } + }, + + Package (0x02) + { + "TLMMGPIO", + Package (0x06) + { + 121, + One, + Zero, + One, + One, + Zero + } + } + }, + + Package (0x03) + { + /*"DSTATE", + 0x03, + Package (0x02) + { + "PMICVREGVOTE", + Package (0x06) + { + "PPP_RESOURCE_ID_LDO19_A", + One, + Zero, + Zero, + Zero, + Zero + } + }*/ + + Package (0x02)//disable + { + "TLMMGPIO", + Package (0x06) + { + 94, + Zero, + Zero, + Zero, + One, + Zero + } + }, + + } + } + }) + } + + + // needs pin 94 high to get power //power enable pin + // Also seems to need VREG_S4A_1P8 (pm8998-smps4) edit:apparently that one is always on + Device (FPRT) + { + Name (_HID, "GXFP55A4") // _HID: Hardware ID + Name (_CID, "GXFP55A4") // _CID: Compatible ID + Name (_UID, "GXFP55A4") // _UID: Unique ID + Name (_DEP, Package (0x03) // _DEP: Dependencies + { + \_SB.GIO0, + \_SB.PEP0, + \_SB.TREE + }) + Method (_CRS, 0, Serialized) // _CRS: Current Resource Settings + { + Name (BBUF, ResourceTemplate () + { + GpioIo (Exclusive, PullUp, 0x0000, 0x0000, IoRestrictionNone, + "\\_SB.GIO0", 0x00, ResourceConsumer, , + ) + { // Pin list + 37 //fp_reset //originally 104/0x68 + } + GpioInt (Edge, ActiveHigh, ExclusiveAndWake, PullNone, 0x0000, + "\\_SB.GIO0", 0x00, ResourceConsumer, , + ) + { // Pin list + 121 //fp_int 0x79 //same as on yoga + } + }) + Return (BBUF) /* \_SB_.FPRT._CRS.BBUF */ + } + + Name (PGID, Buffer (0x0A) + { + "\\_SB.FPRT" + }) + Name (DBUF, Buffer (DBFL){}) + CreateByteField (DBUF, Zero, STAT) + CreateByteField (DBUF, 0x02, DVAL) + CreateField (DBUF, 0x18, 0xA0, DEID) + Method (_S1D, 0, NotSerialized) // _S1D: S1 Device State + { + Return (0x03) + } + + Method (_S2D, 0, NotSerialized) // _S2D: S2 Device State + { + Return (0x03) + } + + Method (_S3D, 0, NotSerialized) // _S3D: S3 Device State + { + Return (0x03) + } + + Method (_PS0, 0, NotSerialized) // _PS0: Power State 0 + { + DEID = Buffer (ESNL){} + DVAL = Zero + DEID = PGID /* \_SB_.FPRT.PGID */ + If (\_SB.ABD.AVBL) + { + \_SB.PEP0.FLD0 = DBUF /* \_SB_.FPRT.DBUF */ + } + } + + Method (_PS3, 0, NotSerialized) // _PS3: Power State 3 + { + DEID = Buffer (ESNL){} + DVAL = 0x03 + DEID = PGID /* \_SB_.FPRT.PGID */ + If (\_SB.ABD.AVBL) + { + \_SB.PEP0.FLD0 = DBUF /* \_SB_.FPRT.DBUF */ + } + } + } + Device (BTNS) { Name (_HID, "ACPI0011" /* Generic Buttons Device */) // _HID: Hardware ID -- 2.45.2