Commit Graph

30 Commits

Author SHA1 Message Date
thorpej
067d2463e3 Remove the i2c "size" locator and corresponding property / attach arg.
It was a hack meant only for EEPROMs, which have another way to specify
size in the config directive ("flag" paramter), as well as a better way
to detect size based on "compatible" string.
2018-06-26 06:34:55 +00:00
thorpej
7b7b75dcdf Encode the size information in the compat data. 2018-06-26 06:21:23 +00:00
thorpej
feee3a19f4 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.
2018-06-26 06:03:57 +00:00
thorpej
4f9e5a443e - 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...)
2018-06-18 17:07:07 +00:00
thorpej
aa41e9922c 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.
2018-06-16 21:22:13 +00:00
riastradh
82b8caba92 Kill some more extern struct cfdriver declarations.
Down with externs in .c!
2017-10-28 04:53:54 +00:00
jmcneill
db9ad7f83e match atmel,24c16 2017-10-21 03:17:09 +00:00
jakllsch
db16b934ab Iterate over ia_ncompat array properly. 2016-09-10 13:16:12 +00:00
jakllsch
ad1d683e6a Also check the compatibles table when the size is below zero.
Fixes an aprint_error() on Jetson TK1.
2016-07-23 18:02:10 +00:00
jmcneill
b4b3fcc73d Support direct config. 2015-12-13 17:15:06 +00:00
phx
cfbd5b3eaf Direct config: Only match via the list of compatible hardware when we have
such a list available (ia_ncompat > 0). Otherwise fall back to matching
the device name with ia_name.
2015-09-27 13:02:21 +00:00
jmcneill
987ded3f77 Many I2C drivers hold spin locks between iic_acquire_bus / iic_release_bus.
Avoid sleeping while owning the I2C bus.
2015-05-10 22:54:06 +00:00
dholland
f9228f4225 Add d_discard to all struct cdevsw instances I could find.
All have been set to "nodiscard"; some should get a real implementation.
2014-07-25 08:10:31 +00:00
dholland
a68f9396b6 Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
2014-03-16 05:20:22 +00:00
jdc
71885a597a Add "i2c-at34c02" AT34C02 EEPROM. This is compatible with the AT24C02
EEPROM, apart from software write protection (not supported in our driver).
2013-10-25 14:32:10 +00:00
jdc
2b2120bf58 Allow the EEPROM size to be specified in the kernel configuration by
using flags.
Add the flags values, and configuration examples to the manual page.
2013-10-25 14:23:15 +00:00
soren
c5606116b4 Allow i2c addr wildcard matching. Use with care! 2013-08-07 19:38:45 +00:00
jdc
4e17786137 Handle direct configuration if ia->ia_name is set, using iic_compat_match().
If ia->ia_name is set, display the name on attach.
Display the size (if known) on attach.
Move the iic_acquire_bus() and iic_release_bus() calls inside the read and
write loops, to avoid holding the bus for the full duration of the read or
write.
2013-02-08 15:14:11 +00:00
tsutsui
ec3c45aecf Replace device_lookup() with device_lookup_private() to get softc
after device_t/softc split.  PR kern/38885 from Jonathan A. Kollasch.
2008-06-08 03:49:26 +00:00
xtraeme
9fbdf1594f device_t/softc split and other related cosmetic changes. 2008-05-04 15:26:29 +00:00
cegger
0e50a9464d use aprint_*_dev and device_xname 2008-04-06 20:25:59 +00:00
lukem
3290dbb81a use __KERNEL_RCSID() 2007-12-11 05:38:12 +00:00
ad
a2a3828545 machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h 2007-10-19 11:59:34 +00:00
imp
d6b291ee71 Update a few comments based on newer members of the at24xx family.
Add support for the 128kbit, 256kbit and 512kbit parts.  Note issues
with the 1024kbit and larger parts, but don't add support for them at
this time.  I've not updated with the explosion of part numbers in
this family.
2007-01-12 08:47:43 +00:00
cube
eb54877e1f Complete initialiser of the cdevsw structure. 2007-01-10 18:53:31 +00:00
thorpej
8fc3572573 Use device_private(). 2006-03-29 06:41:24 +00:00
abs
97ca1ffebb Update some missed _close() and _open() functions from 'struct proc *p'
to 'struct lwp *l'.
2005-12-13 20:55:46 +00:00
christos
95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
christos
29f176cc88 PR/24746: Jared Momose: The _write routine in the at24cxx eeprom driver has
a =/== bug.
2004-03-11 15:11:53 +00:00
thorpej
2652188cc4 New generic I2C framework. Supports bit-bang and "intelligent" I2C
interface controllers (of varying intelligence levels).

Contributed by Wasabi Systems, Inc.  Primarily written by Steve Woodford,
with some modification by me.
2003-09-30 00:35:30 +00:00