Page MenuHomeFreeBSD

ig4. Various improvements
ClosedPublic

Authored by wulf on Oct 14 2019, 1:13 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 7, 10:57 AM
Unknown Object (File)
Feb 23 2024, 12:25 PM
Unknown Object (File)
Feb 5 2024, 10:52 AM
Unknown Object (File)
Jan 16 2024, 8:24 AM
Unknown Object (File)
Dec 19 2023, 9:36 PM
Unknown Object (File)
Dec 13 2023, 3:53 PM
Unknown Object (File)
Dec 3 2023, 8:10 PM
Unknown Object (File)
Dec 3 2023, 2:39 PM
Subscribers

Details

Summary

It is set of ig4 improvements which were done during HID over I2C driver development:

  • Main polling loop is converted to use INTR register rather than STA to make better interrupt utilization
  • ig4 interrupts are masked out permanently to avoid interrupt storms and for code simplification (internal driver's RX FIFO is dropped now)
  • Error handling: INTR_STAT and TX_ABORT registers are checked for error conditions now.
  • Suspend/resume support
  • Polling mode support. The driver can work at cold boot, in DDB and be called from interrupt handlers. Polling mode can be enabled through issuing of iicbus_request_bus() with IIC_NOWAIT flag set
  • burst mode for data reads: DATA_CMD register reads and writes are performed in TX/RX FIFO-sized bursts to increase I2C bus utilization. That reduces read time from 60us to 30us per byte when read data is fit in to RX FIFO buffer in FAST speed mode.
  • data writes utilizes mtx_sleep() instead of doing busy loops while waiting for free space in TX FIFO
  • Timing registers are set based on controller model and ACPI data
  • CannonLake support
  • Interrupt handler converted to be filter based

The are some other minor changes as well. They can be found here https://github.com/wulf7/freebsd/commits/ig4 being split on per-change basis.

Previous versions have got some testing: PR/240339, PR/240485

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

Generally I like this. I'm unsure of DEV_ACPI stuff is proper...

sys/dev/ichiic/ig4_iic.c
97

Is there some way that these can be calculated rather than being magic numbers? Here and below...

199

Why do you need to track this and not set it to the same value? Seems like a good place for a comment.

746

Meta note: we need to fix this...

1104

Unfunctional is not a word. Dysfunctional is what you want.

This revision is now accepted and ready to land.Oct 14 2019, 1:43 AM
wulf edited the summary of this revision. (Show Details)
  • Clock registers values are calculated based on I2C protocol timing constraints and IC parameters taken from LPSS driver. Latter are still kind of magic numbers, but they are physical parameters at least.
  • Interrupt handler is filter based now.
This revision now requires review to proceed.Oct 27 2019, 10:58 PM
wulf added inline comments.
sys/dev/ichiic/ig4_iic.c
97

Clock registers values are now calculated based on I2C protocol timing constraints and IC parameters taken from LPSS driver. Latter are still kind of magic numbers, but they are physical parameters at least.

199

It is just microoptimization inherited from DragonflyBSD change. This part can be done in slightly better way, without tracking for the same value, but at a cost of source diverging.

746

Recently, r352338 extended IIC error codes with POSIX values.
So this note is not relevant to *THIS* driver anymore, as it returns extended IIC error codes now.

1104

Fixed. Thanks.

This revision was not accepted when it landed; it landed in state Needs Review.Nov 3 2019, 8:40 PM
This revision was automatically updated to reflect the committed changes.
wulf marked 4 inline comments as done.