• Marek Vasut's avatar
    Input: ili210x - add ili251x firmware update support · c6ac8f0b
    Marek Vasut authored
    The ili251x firmware can be updated, this is used when switching between
    different modes of operation of the touch surface, e.g. glove operation.
    This patch implements the firmware update mechanism triggered by a write
    into an sysfs attribute.
    
    The firmware itself is distributed as an intel hex file with non-standard
    types. The first two lines are of type 0xad, which indicates the start of
    DataFlash payload, that is always at address 0xf000 on the ili251x, so it
    can be dropped, and 0xac which indicates the position of firmware info in
    the Application payload, that is always at address 0x2020 on the ili251x
    and we do not care. The rest of the firmware is data of type 0x00, and we
    care about that. To convert the firmware hex file into something usable
    by the kernel, remove the first two lines and then use ihex2fw:
    
     $ tail -n +3 input.hex > temp.hex
     $ ./tools/firmware/ihex2fw temp.hex firmware/ilitek/ili251x.bin
    
    To trigger the firmware update, place firmware file ilitek/ili251x.bin
    into /lib/firmware/, write into firmware_update sysfs attribute and wait
    about 30-40 seconds. The firmware update is slow. Afterward, verify the
    firmware_version and mode sysfs attributes to check whether the firmware
    got updated and the controller switched back to application (AP) mode by
    reading out 'mode' attribute in sysfs.
    
    Note that the content of firmware_version, e.g. 0600.0005.abcd.aa04 can
    be matched to the content of the firmware hex file. The first four bytes,
    0x06 0x00 0x00 0x05 can be found at ^:102030 00 05000006, the next four
    bytes 0xab 0xcd 0xaa 0x04 at ^:10F000 00 nnnnnnnn ABCDAA04.
    
    Note that the protocol differs considerably between the ili2xxx devices,
    this patch therefore implements this functionality only for ili251x that
    I can test.
    Signed-off-by: default avatarMarek Vasut <marex@denx.de>
    Link: https://lore.kernel.org/r/20210831202506.181927-3-marex@denx.deSigned-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
    c6ac8f0b
Kconfig 37 KB