• Jeff LaBundy's avatar
    Input: iqs7222 - protect volatile registers · 1e4189d8
    Jeff LaBundy authored
    Select variants of silicon silently mirror part of the event mask
    register to the system setup register (0xD0), and vice versa. For
    the following sequence:
    
    1. Read registers 0xD0 onward and store their contents.
    2. Modify the contents, including event mask fields.
    3. Write registers 0xD0 onward with the modified contents.
    4. Write register 0xD0 on its own again later, using the contents
       from step 1 to populate any reserved fields.
    
    ...the event mask register (e.g. address 0xDA) has been corrupted
    by writing register 0xD0 with contents that were made stale after
    step 3.
    
    To solve this problem, read register 0xD0 once more between steps
    3 and 4. When register 0xD0 is written during step 4, the portion
    which is mirrored to the event mask register already matches what
    was written in step 3.
    
    Fixes: e505edae ("Input: add support for Azoteq IQS7222A/B/C")
    Signed-off-by: default avatarJeff LaBundy <jeff@labundy.com>
    Link: https://lore.kernel.org/r/20220626072412.475211-4-jeff@labundy.comSigned-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
    1e4189d8
iqs7222.c 58.7 KB