The NetBSD Project

CVS log for src/sys/dev/i2c/ihidev.c

[BACK] Up to [cvs.NetBSD.org] / src / sys / dev / i2c

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.28 / (download) - annotate - [select for diffs], Sat Feb 12 03:24:35 2022 UTC (11 months, 3 weeks ago) by riastradh
Branch: MAIN
CVS Tags: netbsd-10-base, netbsd-10, bouyer-sunxi-drm-base, bouyer-sunxi-drm, HEAD
Changes since 1.27: +21 -20 lines
Diff to previous 1.27 (colored)

sys: Fix various abuse of struct device internals.

Will help to make struct device opaque later.

Revision 1.27 / (download) - annotate - [select for diffs], Sat Jan 15 06:22:30 2022 UTC (12 months, 3 weeks ago) by skrll
Branch: MAIN
Changes since 1.26: +3 -3 lines
Diff to previous 1.26 (colored)

Trailing whitespace

Revision 1.26 / (download) - annotate - [select for diffs], Fri Jan 14 22:28:59 2022 UTC (12 months, 3 weeks ago) by riastradh
Branch: MAIN
Changes since 1.25: +6 -6 lines
Diff to previous 1.25 (colored)

ihidev(4): Prohibit closing an unopened ihidev.

Revision 1.25 / (download) - annotate - [select for diffs], Fri Jan 14 22:28:50 2022 UTC (12 months, 3 weeks ago) by riastradh
Branch: MAIN
Changes since 1.24: +3 -3 lines
Diff to previous 1.24 (colored)

ihidev(4): Avoid reference count overflow.

Revision 1.24 / (download) - annotate - [select for diffs], Fri Jan 14 22:28:23 2022 UTC (12 months, 3 weeks ago) by riastradh
Branch: MAIN
Changes since 1.23: +23 -9 lines
Diff to previous 1.23 (colored)

ihidev(4): Take the lock for ihidev_open, ihidev_close.

Need this to serialize access to sc_state, sc_refcnt.

XXX Should harmonize this with uhidev(4) and tighten assertions.

Revision 1.23 / (download) - annotate - [select for diffs], Fri Jan 14 22:26:45 2022 UTC (12 months, 3 weeks ago) by riastradh
Branch: MAIN
Changes since 1.22: +13 -2 lines
Diff to previous 1.22 (colored)

ihidev(4): Check kmem_alloc(..., KM_NOSLEEP) for failure.

Revision 1.22 / (download) - annotate - [select for diffs], Fri Jan 14 22:26:35 2022 UTC (12 months, 3 weeks ago) by riastradh
Branch: MAIN
Changes since 1.21: +3 -3 lines
Diff to previous 1.21 (colored)

ihidev(4): Allocate report buffer with KM_SLEEP.

Limited to 64k and only happens on attach anyway.  Let's not leave a
rake to trip on here.

Revision 1.21 / (download) - annotate - [select for diffs], Fri Jan 14 22:25:49 2022 UTC (12 months, 3 weeks ago) by riastradh
Branch: MAIN
Changes since 1.20: +51 -43 lines
Diff to previous 1.20 (colored)

ihidev(4): Fix locking and interrupt handler.

- Can't run iic_exec in softint because it does cv_wait, at least on
  some i2c controllers -- defer to workqueue instead.

- Fix violations of locking rules:
  . Do not take a lock at higher IPL than it is defined at!
  . Do not sleep under a lock!
  . Definitely do not sleep under a spin lock!
  In this case, sc_intr_lock was defined at IPL_VM but used at IPL_TTY,
  and i2c transactions -- possibly causing sleep for cv_wait -- were
  issued under it.

  But in this case, the interrupt handler needs only a single bit to
  mark whether the work is pending, so just use atomic_swap for that.

- Use an adaptive lock (IPL_NONE) for i2c transactions.

- Detach children, and do so before freeing anything.

Revision 1.20.2.2 / (download) - annotate - [select for diffs], Mon Aug 9 12:36:14 2021 UTC (17 months, 4 weeks ago) by thorpej
Branch: thorpej-i2c-spi-conf2
Changes since 1.20.2.1: +4 -4 lines
Diff to previous 1.20.2.1 (colored) to branchpoint 1.20 (colored) next main 1.21 (colored)

Use the same idiom to cast the ACPI_HANDLE to uint64_t as other drivers
when passing it to acpi_intr_establish().

XXX This is gross, but fixing it is outside the scope of this branch.

Revision 1.20.2.1 / (download) - annotate - [select for diffs], Mon Aug 9 00:30:09 2021 UTC (17 months, 4 weeks ago) by thorpej
Branch: thorpej-i2c-spi-conf2
Changes since 1.20: +6 -7 lines
Diff to previous 1.20 (colored)

Port over the changes from thorpej-i2c-spi-conf to thorpej-i2c-spi-conf2,
which is based on a newer HEAD revision.

Revision 1.20 / (download) - annotate - [select for diffs], Sat Aug 7 16:19:11 2021 UTC (18 months ago) by thorpej
Branch: MAIN
CVS Tags: thorpej-i2c-spi-conf2-base
Branch point for: thorpej-i2c-spi-conf2
Changes since 1.19: +6 -8 lines
Diff to previous 1.19 (colored)

Merge thorpej-cfargs2.

Revision 1.19.8.1 / (download) - annotate - [select for diffs], Wed Aug 4 18:53:26 2021 UTC (18 months ago) by thorpej
Branch: thorpej-cfargs2
Changes since 1.19: +6 -8 lines
Diff to previous 1.19 (colored) next main 1.20 (colored)

Adapt to CFARGS().

Revision 1.19.2.1 / (download) - annotate - [select for diffs], Sat May 8 15:44:12 2021 UTC (21 months ago) by thorpej
Branch: thorpej-i2c-spi-conf
Changes since 1.19: +6 -7 lines
Diff to previous 1.19 (colored) next main 1.20 (colored)

Rather than using the "cookie" from the i2c_attach_args, use the
device handle that's already associated with our device_t.

Revision 1.19 / (download) - annotate - [select for diffs], Sat Apr 24 23:36:54 2021 UTC (21 months, 2 weeks ago) by thorpej
Branch: MAIN
CVS Tags: thorpej-i2c-spi-conf-base, thorpej-futex2-base, thorpej-futex2, thorpej-cfargs2-base, cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x
Branch point for: thorpej-i2c-spi-conf, thorpej-cfargs2
Changes since 1.18: +10 -6 lines
Diff to previous 1.18 (colored)

Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
  actually needed.
- Don't be explicit about what interface attribute is attaching if
  the device only has one.  (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
  situations, making is visibly easier to see when indirect config is
  in play, and allowing for future change in semantics.  (As of now,
  this is just a wrapper around config_match(), but that is an
  implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance.  This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).

Revision 1.12.6.1 / (download) - annotate - [select for diffs], Sat Apr 3 22:28:44 2021 UTC (22 months ago) by thorpej
Branch: thorpej-futex
Changes since 1.12: +43 -11 lines
Diff to previous 1.12 (colored) next main 1.13 (colored)

Sync with HEAD.

Revision 1.18.2.2 / (download) - annotate - [select for diffs], Mon Mar 22 16:23:44 2021 UTC (22 months, 2 weeks ago) by thorpej
Branch: thorpej-cfargs
Changes since 1.18.2.1: +2 -4 lines
Diff to previous 1.18.2.1 (colored) to branchpoint 1.18 (colored) next main 1.19 (colored)

Audit CFARG_IATTR in config_found() calls, and remove it in situations
where the interface attribute is not ambiguous.

Revision 1.18.2.1 / (download) - annotate - [select for diffs], Mon Mar 22 02:01:00 2021 UTC (22 months, 2 weeks ago) by thorpej
Branch: thorpej-cfargs
Changes since 1.18: +12 -6 lines
Diff to previous 1.18 (colored)

Mechanical conversion of config_found_sm_loc() -> config_found().
CFARG_IATTR usage needs to be audited.

Revision 1.18 / (download) - annotate - [select for diffs], Wed Jan 27 02:29:48 2021 UTC (2 years ago) by thorpej
Branch: MAIN
CVS Tags: thorpej-futex-base, thorpej-cfargs-base
Branch point for: thorpej-cfargs
Changes since 1.17: +3 -3 lines
Diff to previous 1.17 (colored)

Use DEVICE_COMPAT_EOL.

Revision 1.17 / (download) - annotate - [select for diffs], Tue Jan 26 02:33:54 2021 UTC (2 years ago) by thorpej
Branch: MAIN
Changes since 1.16: +39 -9 lines
Diff to previous 1.16 (colored)

Now that the ACPI layer no longer does this for us, evaluate the _DSM
that returns the HID descriptor address at attach time.

Revision 1.16 / (download) - annotate - [select for diffs], Tue Jan 26 01:23:08 2021 UTC (2 years ago) by thorpej
Branch: MAIN
Changes since 1.15: +4 -2 lines
Diff to previous 1.15 (colored)

Don't map ACPI _HID / _CID strings to "compatible" strings from the
Device Tree bindings.  Just pass those strings in the standard
most-specific-to-least-specific order to the drivers and let them
deal.

Revision 1.15 / (download) - annotate - [select for diffs], Tue Jan 26 01:15:39 2021 UTC (2 years ago) by thorpej
Branch: MAIN
Changes since 1.14: +2 -4 lines
Diff to previous 1.14 (colored)

Back out unintended change in previous.

Revision 1.14 / (download) - annotate - [select for diffs], Mon Jan 25 13:30:20 2021 UTC (2 years ago) by thorpej
Branch: MAIN
Changes since 1.13: +5 -4 lines
Diff to previous 1.13 (colored)

Since we're using designated initialisers for compat data, we should
use a completely empty initializer for the sentinel.

Revision 1.13 / (download) - annotate - [select for diffs], Sun Jan 17 21:47:50 2021 UTC (2 years ago) by thorpej
Branch: MAIN
Changes since 1.12: +5 -4 lines
Diff to previous 1.12 (colored)

Use designated initializers and a consistent termination style in
compat_data[].

Revision 1.5.2.2 / (download) - annotate - [select for diffs], Mon Apr 13 08:04:20 2020 UTC (2 years, 9 months ago) by martin
Branch: phil-wifi
Changes since 1.5.2.1: +134 -41 lines
Diff to previous 1.5.2.1 (colored) to branchpoint 1.5 (colored) next main 1.6 (colored)

Mostly merge changes from HEAD upto 20200411

Revision 1.11.2.1 / (download) - annotate - [select for diffs], Fri Jan 17 21:47:31 2020 UTC (3 years ago) by ad
Branch: ad-namecache
Changes since 1.11: +132 -37 lines
Diff to previous 1.11 (colored) next main 1.12 (colored)

Sync with head.

Revision 1.12 / (download) - annotate - [select for diffs], Thu Jan 9 04:04:01 2020 UTC (3 years ago) by thorpej
Branch: MAIN
CVS Tags: phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406, is-mlppp-base, is-mlppp, bouyer-xenpvh-base2, bouyer-xenpvh-base1, bouyer-xenpvh-base, bouyer-xenpvh, ad-namecache-base3, ad-namecache-base2, ad-namecache-base1
Branch point for: thorpej-futex
Changes since 1.11: +132 -37 lines
Diff to previous 1.11 (colored)

Re-enable the intr / mask / softint / unmask dance now that the x86
interrupt issue is fixed.  Verified working by ryoon@ (thanks!).

Revision 1.11 / (download) - annotate - [select for diffs], Wed Dec 25 01:19:56 2019 UTC (3 years, 1 month ago) by thorpej
Branch: MAIN
CVS Tags: ad-namecache-base
Branch point for: ad-namecache
Changes since 1.10: +37 -115 lines
Diff to previous 1.10 (colored)

Revert previous until issues can be sorted out.

Revision 1.10 / (download) - annotate - [select for diffs], Sun Dec 22 16:44:35 2019 UTC (3 years, 1 month ago) by thorpej
Branch: MAIN
Changes since 1.9: +117 -39 lines
Diff to previous 1.9 (colored)

The hid-over-i2c spec specifies that compliant devices use level-sensitive
interrupts.  However, it's not safe to do i2c bus access in hard interrupt
context, and we must read the event data off the device in order to clear
the interrupt condition.

Address this by using acpi_intr_mask() to mask off the interrupt source
while a softint is pending to service the events, re-enabling it once
servicing is completed.

While here, re-factor the interrupt setup / tear-down code a bit to
eventually once day simplify supporting the FDT bindings for hid-over-i2c.

Revision 1.9 / (download) - annotate - [select for diffs], Tue Oct 1 18:00:08 2019 UTC (3 years, 4 months ago) by chs
Branch: MAIN
CVS Tags: phil-wifi-20191119
Changes since 1.8: +4 -8 lines
Diff to previous 1.8 (colored)

in many device attach paths, allocate memory with KM_SLEEP instead of KM_NOSLEEP
and remove code to handle failures that can no longer happen.

Revision 1.7.4.1 / (download) - annotate - [select for diffs], Thu Sep 26 18:56:05 2019 UTC (3 years, 4 months ago) by martin
Branch: netbsd-9
CVS Tags: netbsd-9-3-RELEASE, netbsd-9-2-RELEASE, netbsd-9-1-RELEASE, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1
Changes since 1.7: +5 -3 lines
Diff to previous 1.7 (colored) next main 1.8 (colored)

Pull up following revision(s) (requested by bouyer in ticket #244):

	sys/dev/i2c/ihidev.c: revision 1.8

Abort attach if acpi_intr_establish() fails. From K. Schreiner on
current-users@.

Revision 1.8 / (download) - annotate - [select for diffs], Thu Sep 26 08:16:26 2019 UTC (3 years, 4 months ago) by bouyer
Branch: MAIN
Changes since 1.7: +5 -3 lines
Diff to previous 1.7 (colored)

Abort attach if acpi_intr_establish() fails. From K. Schreiner on
current-users@.

Revision 1.5.2.1 / (download) - annotate - [select for diffs], Mon Jun 10 22:07:09 2019 UTC (3 years, 7 months ago) by christos
Branch: phil-wifi
Changes since 1.5: +8 -8 lines
Diff to previous 1.5 (colored)

Sync with HEAD

Revision 1.1.2.4 / (download) - annotate - [select for diffs], Mon Nov 26 01:52:31 2018 UTC (4 years, 2 months ago) by pgoyette
Branch: pgoyette-compat
CVS Tags: pgoyette-compat-merge-20190127
Changes since 1.1.2.3: +8 -8 lines
Diff to previous 1.1.2.3 (colored) to branchpoint 1.1 (colored) next main 1.2 (colored)

Sync with HEAD, resolve a couple of conflicts

Revision 1.7 / (download) - annotate - [select for diffs], Fri Nov 16 23:05:50 2018 UTC (4 years, 2 months ago) by jmcneill
Branch: MAIN
CVS Tags: phil-wifi-20190609, pgoyette-compat-20190127, pgoyette-compat-20190118, pgoyette-compat-1226, pgoyette-compat-1126, netbsd-9-base, isaki-audio2-base, isaki-audio2
Branch point for: netbsd-9
Changes since 1.6: +7 -7 lines
Diff to previous 1.6 (colored)

Use acpi_md_intr_establish/disestablish to handle device IRQs. The existing
code abused AcpiOsInstallInterruptHandler, which is meant for installing
the SCI handler.

Revision 1.6 / (download) - annotate - [select for diffs], Thu Nov 15 23:01:45 2018 UTC (4 years, 2 months ago) by jakllsch
Branch: MAIN
Changes since 1.5: +3 -3 lines
Diff to previous 1.5 (colored)

Correctly handle signed/unsigned quantities in kernel HID parser.

Should fix PR kern/53605.

Revision 1.1.2.3 / (download) - annotate - [select for diffs], Sat Jul 28 04:37:44 2018 UTC (4 years, 6 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.1.2.2: +6 -11 lines
Diff to previous 1.1.2.2 (colored) to branchpoint 1.1 (colored)

Sync with HEAD

Revision 1.5 / (download) - annotate - [select for diffs], Tue Jun 26 06:03:57 2018 UTC (4 years, 7 months ago) by thorpej
Branch: MAIN
CVS Tags: phil-wifi-base, pgoyette-compat-1020, pgoyette-compat-0930, pgoyette-compat-0906, pgoyette-compat-0728, jdolecek-ncqfixes-base, jdolecek-ncqfixes
Branch point for: phil-wifi
Changes since 1.4: +6 -11 lines
Diff to previous 1.4 (colored)

In my quest to make device_compatible_entry (and associated goo)
super-general, it turns out I also made it a little to cumbersome
to use (if my tired fingers are any indication).  So, this is a
course-correction -- one string per entry (like of_compat_data,
which it will soon replace), and remove the over-verbose macros.

Revision 1.1.2.2 / (download) - annotate - [select for diffs], Mon Jun 25 07:25:50 2018 UTC (4 years, 7 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.1.2.1: +11 -6 lines
Diff to previous 1.1.2.1 (colored) to branchpoint 1.1 (colored)

Sync with HEAD

Revision 1.4 / (download) - annotate - [select for diffs], Mon Jun 18 17:07:07 2018 UTC (4 years, 7 months ago) by thorpej
Branch: MAIN
CVS Tags: pgoyette-compat-0625
Changes since 1.3: +8 -3 lines
Diff to previous 1.3 (colored)

- Rename iic_compat_match() to iic_compatible_match() and change it
  to use the new device_compatible_match() routine.  A pointer to
  the matching device_compatible_entry is returned if a match is
  found.
- Adjust iic_use_direct_match() accordingly.
- i2c drivers now provide device_compatible_entry tables when performing
  direct-config matching.
- In the dsrtc driver, take advantage of this new capability to greatly
  simplify model selection.

(I'm coming for you next, of_compat_data...)

Revision 1.3 / (download) - annotate - [select for diffs], Sat Jun 16 21:22:13 2018 UTC (4 years, 7 months ago) by thorpej
Branch: MAIN
Changes since 1.2: +6 -6 lines
Diff to previous 1.2 (colored)

More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
  all of the logic for direct-config matching.  If it returns true,
  the driver returns the match result (which may be 0).  If it returns
  false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
  lower-indexed "compatible" device property are more-specific matches,
  and return a better match quality accordingly.

Revision 1.1.2.1 / (download) - annotate - [select for diffs], Thu Mar 22 01:44:48 2018 UTC (4 years, 10 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.1: +4 -3 lines
Diff to previous 1.1 (colored)

Synch with HEAD, resolve conflicts

Revision 1.2 / (download) - annotate - [select for diffs], Tue Mar 20 12:14:52 2018 UTC (4 years, 10 months ago) by bouyer
Branch: MAIN
CVS Tags: pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322
Changes since 1.1: +4 -3 lines
Diff to previous 1.1 (colored)

Allow registering ACPI interrupt handlers with a xname.
AcpiOsInstallInterruptHandler(), part of ACPICA API, doesn't allow passing
the xname. I extend the API with AcpiOsInstallInterruptHandler_xname()
for this purpose, and change acpi_md_OsInstallInterruptHandler() to
accept and use the xname (ia64 doens't use it).
The xname was hardcoded to "acpi SCI" in the
x86 acpi_md_OsInstallInterruptHandler(), so I make
AcpiOsInstallInterruptHandler() call
AcpiOsInstallInterruptHandler_xname with xname = "acpi SCI".

Now 'vmstat -i' shows the device's name instead of "acpi SCI" for for i2c HID
interrupts.

Proposed on tech-kern@ on Dec 29.

Revision 1.1 / (download) - annotate - [select for diffs], Sun Dec 10 17:05:54 2017 UTC (5 years, 1 month ago) by bouyer
Branch: MAIN
CVS Tags: pgoyette-compat-base, pgoyette-compat-0315
Branch point for: pgoyette-compat

Add drivers for HID over I2C devices, and a driver for I2C mices.
From OpenBSD.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb <webmaster@jp.NetBSD.org>