Repository navigation
ASoC: SOF: implement polling mode on snd_hdac_bus_get_response and force polling mode on CFL/CNL - #963
Conversation
|
@bardliao can't we add this polling to the snd_hdac_bus_get_response() and use the chip = bus_to_azx(bus) accessor? |
|
The patch is OK to me. And I have the same suggestion as Pierre that it is better to change the generic function. My suggestion is to add polling_mode flag in hdac_bus. and code like: |
Yes, it is also my concern. Actually I am thinking if we should implement the full function of polling_mode, i.e. switch to polling mode if it is timed out, or just add a workaround for some platforms. |
Thanks @libinyang it should be a easier way to implement polling mode in snd_hdac_bus_get_response() |
Except that it's not conceptually clean. The polling is a controller capability, not something related to the bus. The bus has no concept of polling. |
|
@plbossart Actually it is not controller capability, I think. Every hardware can do the polling. No special HW support is needed. And polling is the behavior of controller to poll codec. So it's more like bus related feature. I'm not sure why the community will put the flag in the controller. From my viewpoint, it should be put in bus.
|
|
@libinyang @bardliao @plbossart According to Realtek, this latency issues was observed on SKL at first many years ago, so the legacy-HDA driver introduced this fix. And this fix also helps SOF, verified by |
@libinyang please dont top post when you reply to comments. Always post under(like this one). |
@ranj063 Good tips. Thanks. I never realize it. |
|
Hi @bardliao so are we missing RIRB interrupts here? I am wondering if the same issue existed with SST driver or SOF specific, and if there is anything wrong in our suspend/resume routines. |
@keyonjie Yes, I think so.
I think it is a HW related issue. Please see #963 (comment) |
@plbossart I think the polling_mode here is polling the rirb status by SW. So it's not about HW capability. However, the intent of this PR is to add a workaround for some specific platforms. In the point of view, it seems make more sense to add the polling_mode in a chip struct. That's the concept of option 1.
@libinyang As you said, the polling mode is not a capability of bus either. Can we say it is a behavior of bus? I doubt it very much. |
|
The definition of polling is an active loop to access a register/mmio. |
|
Bus is not a HW device here in the driver. The bus means the connection of controller and chip. If you look into the struct hdac_bus, you will find it defines void __iomem *ppcap, *spbcap, *mlcap and other registers. And what's more, you will find in struct hdac_bus, it defines: struct hdac_rb corb, struct hdac_rb rirb. So if we are polling the corb and rirb, it is reasonable to put the flag in struct hdac_bus. However, it will not impact on the feature implementation to put the flag in bus or chip. @bardliao when you submit the patch to community, please kindly cc me. |
ae273c5 to
0c6bada
Compare
|
Since the change will not only inside SOF, so ask for comment from alsa-dev first |
libinyang
left a comment
There was a problem hiding this comment.
patch seems OK to me. Only 2 comments:
- chip->poll_count++ seems to be good as bus->poll_count++
- not sure if we can merge the 2 get_response functions into 1?
Sounds good
I don't know if it's worth doing that. And we still use struct azx in the function. eg. |
ac749b3 to
90686cb
Compare
| @@ -375,6 +375,7 @@ enum { | |||
|
|
|||
There was a problem hiding this comment.
fix typos/grammar in commit message.
We observed the same issue as reported by commit....
|
|
||
| /* Workaround for a communication error on CFL (bko#199007) */ | ||
| if (IS_CFL(pci)) | ||
| /* Workaround for a communication error on CFL and CNL (bko#199007) */ |
There was a problem hiding this comment.
Workaround for a communication error on CFL (bko#199007) and CNL
| /* Workaround for a communication error on CFL and CNL (bko#199007) */ | ||
| if (IS_CFL(pci) || IS_CNL(pci)) | ||
| chip->polling_mode = 1; | ||
|
|
There was a problem hiding this comment.
you should move this first in a separate patch to allow for bisects.
| for (loopcounter = 0;; loopcounter++) { | ||
| spin_lock_irq(&bus->reg_lock); | ||
| if (bus->polling_mode) | ||
| snd_hdac_bus_update_rirb(bus); |
There was a problem hiding this comment.
should be separate patch to mirror the functionality in the legacy code.
| #endif | ||
| sof_hda_bus_init(bus, &pci->dev, ext_ops); | ||
|
|
||
| /* Workaround for a communication error on CFL and CNL (bko#199007) */ |
There was a problem hiding this comment.
Workaround for a communication error on CFL (bko#199007) and CNL
|
Use separate get_response is OK to me. So the PR is OK to me now. |
We observed the same issue as reported by commit a8d7bde ("ALSA: hda - Force polling mode on CFL for fixing codec communication") We don't have a better solution. So apply the same workaround to CNL. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
We will move the polling_mode flag from struct azx to struct hdac_bus, and the flag should be assigned after bus init. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
polling mode is a useful function in the get_response function. Move polling_mode flag from struct azx to struct hdac_bus so people can implement polling mode in their own get_response function without adding a polling_mode flag in their local chip structure. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Polling mode is useful if a machine somehow missed an expected IRQ. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
There is a workaround in legacy HDA codec for too long time respone with CFL machine. We need the same workaround on SOF driver. The same issue is also seen on CNL machine. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
90686cb to
ab71b50
Compare
plbossart
left a comment
There was a problem hiding this comment.
will merge blindly since it's already upstream
@KailangYang found that sometimes we will get a long latency response on WHL and we can set
polling_mode as a workaround on legacy HDA driver.
#900 (comment)
The workaround is already used on CFL. if (IS_CFL(pci))
However, there is no polling_mode on snd_hdac_bus_get_response.
We can move polling_mode flag from struct azx to struct hdac_bus and implement polling_mode on
snd_hdac_bus_get_response(). Then force polling mode on CFL and CNL.Fix #953