• Orlando Chamberlain's avatar
    platform/x86: apple-gmux: support MMIO gmux on T2 Macs · 0c18184d
    Orlando Chamberlain authored
    In some newer dual gpu MacBooks, the T2 Coprocessor functions as the
    gmux, and the Intel side can interract with this new gmux type through
    MMIO. Add support for these gmux controllers to the apple-gmux driver.
    
    We start using the GMSP(0) acpi method on these gmux's when clearing
    interrupts, as this prevents a flood of status=0 interrupts that can't
    be cleared. It's unknown if this helps or hinders older gmux types, so
    it isn't enabled for those.
    
    Interestingly, the ACPI table only allocates 8 bytes for GMUX, but we
    actually need 16, and as such we request 16 with request_mem_region.
    
    Reading and writing from ports:
        16 bytes from 0xfe0b0200 are used. 0x0 to 0x4 are where data
        to read appears, and where data to write goes. Writing to 0xe
        sets the gmux port being accessed, and writing to 0xf sends commands.
    
        These commands are 0x40 & data_length for write, and data_length for
        read, where data_length is 1, 2 or 4. Once byte base+0xf is 0, the
        command is done.
    
    Issues:
        As with other retina models, we can't switch DDC lines so
        switching at runtime doesn't work if the inactive gpu driver
        already disabled eDP due to it not being connected when that
        driver loaded.
    
        Additionally, turning on the dgpu back on on the MacBookPro16,1 does
        not work.
    Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
    Signed-off-by: default avatarOrlando Chamberlain <orlandoch.dev@gmail.com>
    Link: https://lore.kernel.org/r/20230303112842.3094-4-orlandoch.dev@gmail.comSigned-off-by: default avatarHans de Goede <hdegoede@redhat.com>
    0c18184d
apple-gmux.c 29.2 KB