linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Miroslav Bendík" <miroslav@wisdomtech.sk>
To: Hans de Goede <hdegoede@redhat.com>,
	"Limonciello, Mario" <Mario.Limonciello@amd.com>,
	Wolfram Sang <wsa@kernel.org>,
	Benjamin Tissoires <btissoir@redhat.com>,
	Andrea Ippolito <andrea.ippo@gmail.com>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Alex Hung <alex.hung@canonical.com>,
	Linux I2C <linux-i2c@vger.kernel.org>,
	"open list:HID CORE LAYER" <linux-input@vger.kernel.org>,
	Platform Driver <platform-driver-x86@vger.kernel.org>,
	"Shah, Nehal-bakulchandra" <Nehal-bakulchandra.Shah@amd.com>
Subject: Re: Touchpad stickiness on AMD laptops (was Dell Inspiron/XPS)
Date: Sun, 23 Jan 2022 18:25:37 +0100	[thread overview]
Message-ID: <cb4e9d68-78b0-583d-fa15-a841b0606785@wisdomtech.sk> (raw)
In-Reply-To: <cf3c89a5-f242-2c1f-f636-fd3241b18ff1@redhat.com>


Dňa 17. 1. 2022 o 10:08 Hans de Goede napísal(a):
> Hi,
>
> On 1/17/22 09:39, Miroslav Bendík wrote:
>>> [AMD Official Use Only]
>>>
>>>> Now i am trying to change ASF registers instead of SMBus registers.
>>>> I have tried to enable interrupts and set listen address, but it don't
>>>> work or
>>>> i can't recognize the difference between interrupts generated by
>>>> transfers and
>>>> interrupts generated from slave.
>>> Try reading the value of SFx0A ASFStatus bit 5 (it's write to clear if it's an interrupt).
>>>
>>>> outb_p(0x02, 0x15 + piix4_smba); // SlaveIntrListenEn
>>>> outb_p(0x2c << 1 | 0x01, 0x09 + piix4_smba); // ListenAdr | ListenAdrEn
>>> ASFx04 SlaveAddress instead of  ASFx09 ListenAdr
>>> ?
>>>
>>>
>> Little bit more informations:
>>
>> Interrupts are generated only if ASFx09 ListenAdr is:
>>
>> (0x08 << 1) | 0x01
>> (0x10 << 1) | 0x01
>>
>> and touchpad is initialized with synaptics_intertouch=1
>>
>> There is maybe small correlation between frequency and touch, but i am
>> not 100% sure.
> I know very litlle about this, but I believe that when using
> host-notify that after receiving the host-notify you are supposed to
> do an I2C read from the SMBus Alert Response Address (ARA, 0x0c) to find
> out the source of the notify (since multiple devices on the bus may
> be notify capable). I guess that the controller may not do that itself
> and that as long as you have not done it the touchpad may keep repeating
> the notify.
>
> But as said I know very little about this, so take this with a big
> grain of salt :)  I guess you may want to read up a bit on how this
> is supposed to work at the bus level. I believe that the SMBUS spec
> is public.
>
> Regards,
>
> Hans
>
>
>
>
>> There are no register changed in interrupt handler except of
>> ASFx13 DataBankSel. I can't determine if interrupt is generated from
>> transfer, or from external event.
>>
>> ASF should be system for remote management. It should have access to
>> SMBus and data / command registers are identical, this means, that SMBus
>> should work (except block transfers).
>>
>> If ASF just mirrors SMBus, then question is, why i can't access to
>> touchpad using SMBus? One strange thing is, that i2cdetect on standard
>> SMbus (0xb00), port 0 returns:
>>
>>       0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
>> 00:                         -- -- -- -- -- -- -- --
>> 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
>> 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
>> 30: -- -- -- -- -- -- 36 37 -- -- -- -- -- -- -- --
>> 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
>> 50: 50 -- -- -- -- -- -- -- 58 -- -- -- -- -- -- --
>> 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
>> 70: -- -- -- -- -- -- -- --
>>
>> Address 0x58 is exactly 0x2c (synaptics) moved 1 bit left, but i2c-piix4
>> correctly moves address.
>>
Hello,
i have no response from 0x0c (ARA). It returns -6 (ENXIO).

Exact call is:

i2c_smbus_xfer(piix4_aux_adapter, 0x0c, 0x00, I2C_SMBUS_READ, 0x00, 
I2C_SMBUS_BYTE, &data)

I hava played with ARP (address 0x61), but alweays without response (-6).

I have tried to read event status from ASF. Exact command is 0000 0001b
and subcommand 0001 0010b from ASF reference documentation. I have
enabled automatic PEC appending. I have tried to manually calculate PEC
too. To calculate PEC i have called i2c_smbus_pec with data {0xaa/b,
0x01, 0x03, 0x12, 0x10, 0x00} and then set PEC byte register, but every
call ends wih -6 (no response from device).

ASF sensor address should be 0x55 is (from register ASFx0F SensorAdr
- 0xaa shifted 1 bit right).

Exact code:

outb_p(0x20, SMBHSTCNT); // Automatically append PEC

data.block[0] = 0x03; // size
data.block[1] = 0x12; // subcommand
data.block[2] = 0x10; // version
data.block[3] = 0x00; // reserved
status = i2c_smbus_xfer(piix4_aux_adapter, 0x55, 0x00, I2C_SMBUS_WRITE, 
0x01, I2C_SMBUS_BLOCK_DATA, &data);

Interrupts are always generated after transactions. Following conditions
are necessary to generate interrupts spontaneously:

- SlaveIntrListenEn of ASFx15 SlaveEn bit set
- ListenAdr of ASFx09 set to 0x08 or 0x10
- ListenAdrEn of ASFx09 bit set
- psmouse loaded with synaptics_intertouch=1

Only ASFx13 DataBankSel is modified externally. Value is always 0x8?.
I have tried to check Databank?Full and if it set i am calling
i2c_handle_smbus_host_notify and cleaning bit. Sometimes it responds to
cursor move action, sometimes not. Sampling rate varies.

I don't know if this interrupt is host notify. It has some corellation,
but it may be something like bus error or event buffer full. I don't
know.

Here is video demonstration:

https://youtu.be/9pjxyiWA1a8

Before loading psmouse with synaptics_intertouch there are no
interrupts. After unloading, there are again no interrupts.

In ASF documentation is description of ASF_ALRT field of ASF!
description table, but my bios contains only ASFT record of MNVS
OperationRegion. I don't know if i should access this, or something
else.


  reply	other threads:[~2022-01-23 17:25 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAGhUXvBw4rzCQrqttyyS=Psxmhppk79c6fDoxPbV91jE7fO_9A@mail.gmail.com>
2021-08-27  6:57 ` Touchpad stickiness on Dell Inspiron/XPS Andrea Ippolito
2021-09-23  8:47   ` Andrea Ippolito
2021-09-23  9:00     ` Hans de Goede
2021-09-23  9:06       ` Andrea Ippolito
2022-01-06 13:14       ` Wolfram Sang
2022-01-11 10:34         ` Touchpad stickiness on AMD laptops (was Dell Inspiron/XPS) Hans de Goede
2022-01-11 11:13           ` Benjamin Tissoires
2022-01-11 23:15             ` Limonciello, Mario
2022-01-12  8:33               ` Wolfram Sang
2022-01-12 12:21                 ` Miroslav Bendík
2022-01-12 22:54                   ` Limonciello, Mario
2022-01-15  9:39                     ` Miroslav Bendík
2022-01-15 13:46                       ` Limonciello, Mario
2022-01-15 18:10                         ` Miroslav Bendík
2022-01-17  8:39                         ` Miroslav Bendík
2022-01-17  9:08                           ` Hans de Goede
2022-01-23 17:25                             ` Miroslav Bendík [this message]
2022-01-12 12:31                 ` Hans de Goede
2022-01-30 13:14               ` Miroslav Bendík
2022-02-06 18:13               ` Miroslav Bendík

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cb4e9d68-78b0-583d-fa15-a841b0606785@wisdomtech.sk \
    --to=miroslav@wisdomtech.sk \
    --cc=Mario.Limonciello@amd.com \
    --cc=Nehal-bakulchandra.Shah@amd.com \
    --cc=alex.hung@canonical.com \
    --cc=andrea.ippo@gmail.com \
    --cc=btissoir@redhat.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=wsa@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).