Adding GPS support for Encore 2

Need help with C, C++, perl, python, etc?

Adding GPS support for Encore 2

Postby dpeterson3 » 2017-04-05 19:56

I'm not sure where this really belongs as it involves some programming and some hardware, so mods please move it if it fits better elsewhere.

I'm attempting to add support for a Broadcom 4752 GNSS chip which is built into my tablet. The tablet is running debian sid with a custom 4.10 kernel with a patch for a bug for c-state problems with the intel atom chips. I plan to use this thread as a means to document what I have accomplished and as a means to get input from others on their thoughts on how to proceed.

Background information
The GPS device works under windows 8.1 and windows 10. As the link above says, the device uses wifi, cell towers, and satellites to get its location. It will work without an
internet connection. I was able to test this under windows. Android has a driver for this particular chip. I could not find the source code, only a binary blob. I was able to find it at this link https://techtablets.com/wpfb-file/x98-air-3g-c8j7-android4-4-4-v2-00-official-rar/. Again, it is only a binary blob. I could not find the source, and have not been able to go through the file to find out who made it yet.

My ACPI lists a GPS. The relevant portion is
Code: Select all
Device (URT2)
        {
            Name (_ADR, Zero)  // _ADR: Address
            Name (_HID, "80860F0A" /* Intel Atom UART Controller */)  // _HID: Hardware ID
            Name (_CID, "80860F0A" /* Intel Atom UART Controller */)  // _CID: Compatible ID
            Name (_DDN, "Intel(R) HS-UART Controller #2 - 80860F0C")  // _DDN: DOS Device Name
            Name (_UID, 0x02)  // _UID: Unique ID
            Name (_DEP, Package (0x01)  // _DEP: Dependencies
            {
                PEPD
            })
            Name (RBUF, ResourceTemplate ()
            {
                Memory32Fixed (ReadWrite,
                    0x00000000,         // Address Base
                    0x00001000,         // Address Length
                    _Y16)
                Interrupt (ResourceConsumer, Level, ActiveLow, Exclusive, ,, )
                {
                    0x00000028,
                }
                FixedDMA (0x0004, 0x0004, Width32bit, )
                FixedDMA (0x0005, 0x0005, Width32bit, )
            })
            Method (_HRV, 0, NotSerialized)  // _HRV: Hardware Revision
            {
                Return (SOCS) /* \SOCS */
            }

            Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
            {
                CreateDWordField (RBUF, \_SB.URT2._Y16._BAS, B0BA)  // _BAS: Base Address
                CreateDWordField (RBUF, \_SB.URT2._Y16._LEN, B0LN)  // _LEN: Length
                B0BA = U20A /* \U20A */
                B0LN = U20L /* \U20L */
                Return (RBUF) /* \_SB_.URT2.RBUF */
            }

            Method (_STA, 0, NotSerialized)  // _STA: Status
            {
                If ((U20A == Zero) || (L14D == One))
                {
                    Return (Zero)
                }

                Return (0x0F)
            }

            Method (_PS3, 0, NotSerialized)  // _PS3: Power State 3
            {
                PSAT |= 0x03
                Local0 = PSAT /* \_SB_.URT2.PSAT */
            }

            Method (_PS0, 0, NotSerialized)  // _PS0: Power State 0
            {
                PSAT &= 0xFFFFFFFC
                Local0 = PSAT /* \_SB_.URT2.PSAT */
            }

            OperationRegion (KEYS, SystemMemory, U21A, 0x0100)
            Field (KEYS, DWordAcc, NoLock, WriteAsZeros)
            {
                Offset (0x84),
                PSAT,   32
            }

            Device (GPS0)
            {
                Name (_HID, "TOS4752")  // _HID: Hardware ID
                Name (_HRV, 0x0A00)  // _HRV: Hardware Revision
                Method (_STA, 0, NotSerialized)  // _STA: Status
                {
                    If (BTOI & One)
                    {
                        If (SKUI == Zero)
                        {
                            Return (0x0F)
                        }
                        Else
                        {
                            Return (Zero)
                        }
                    }

                    Return (0x0F)
                }

                Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
                {
                    Name (UBUF, ResourceTemplate ()
                    {
                        UartSerialBusV2 (0x0001C200, DataBitsEight, StopBitsOne,
                            0xFC, LittleEndian, ParityTypeNone, FlowControlHardware,
                            0x0020, 0x0020, "\\_SB.URT2",
                            0x00, ResourceConsumer, , Exclusive,
                            )
                        GpioIo (Exclusive, PullDefault, 0x0000, 0x0000, IoRestrictionOutputOnly,
                            "\\_SB.GPO0", 0x00, ResourceConsumer, ,
                            )
                            {   // Pin list
                                0x0036
                            }
                    })
                    Return (UBUF) /* \_SB_.URT2.GPS0._CRS.UBUF */
                }
            }
        }


From this, it appears the gps is connected to UART 2, with serial parameters 115200 baud, 8N1. It is also connected to GPIO pin 0x0036=54. I would assume that this means that the this pin is probably the enable/disable line so that the GPS can be turned off to conserve power. Pin 54 appears on the third GPIO controller, and the kernel reports pin addresses start at 410. I tried using the following to enable the pin
Code: Select all
echo "464" > /sys/class/gpio/export

and saw that the pin was already output. Then
Code: Select all
echo "1" > /sys/class/gpio/gpio464/value

Then, I opened cutecom and tried /dev/ttyS1 and /dev/ttyS2 with the parameters in the ACPI file, but I get no output, even if I try sending something. I know ttyS1 and ttyS2 are my physical serial ports from hwinfo. I am also almost certain this chip talks over serial because windows lists a broadcom serial over UART bus emulator which has the same address in device manager as the physical com port. Does anyone have any thoughts on how I can enable this GPS. I just want to get it to send data at this point. I don't care if its good. Perhaps I need to enable it through GPIO and send some sort of initialize string or firmware? I have not found a good way to capture serial in windows since realterm made spy mode paid for.

EDIT: More info
I missed in the HWINFO files these lines
Code: Select all
  P: /devices/platform/80860F0A:01/TOS4752:00
  E: DEVPATH=/devices/platform/80860F0A:01/TOS4752:00
  E: ID_VENDOR_FROM_DATABASE=Toshiba Corporation
  E: MODALIAS=acpi:TOS4752:
  E: SUBSYSTEM=platform
  E: USEC_INITIALIZED=20443037
 
  P: /devices/platform/80860F0A:01/tty/ttyS2
  N: ttyS2
  E: DEVNAME=/dev/ttyS2
  E: DEVPATH=/devices/platform/80860F0A:01/tty/ttyS2
  E: ID_MM_CANDIDATE=1
  E: MAJOR=4
  E: MINOR=66
  E: SUBSYSTEM=tty
  E: TAGS=:systemd:
  E: USEC_INITIALIZED=20458604

which seems to suggest that the GPS is on ttyS2.
dpeterson3
 
Posts: 52
Joined: 2008-06-25 14:58

Re: Adding GPS support for Encore 2

Postby OldBob » 2017-04-16 18:19

It looks like there's work for that going on here:
https://github.com/Asus-T100/kernel/com ... 665fd86135

Perhaps you could collaborate with them?
User avatar
OldBob
 
Posts: 11
Joined: 2017-04-11 18:39
Location: Canada


Return to Programming

Who is online

Users browsing this forum: No registered users and 6 guests

fashionable