Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Oct 2020 18:02:52 +0000 (UTC)
From:      Ian Lepore <ian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r366652 - head/sys/dev/iicbus
Message-ID:  <202010121802.09CI2qlo043786@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ian
Date: Mon Oct 12 18:02:51 2020
New Revision: 366652
URL: https://svnweb.freebsd.org/changeset/base/366652

Log:
  Bug fixes for the ads111x driver... make configurable gain and sample rate
  hints work on per-channel basis as documented, rather than chip-wide.  Also,
  when configured via hints, return BUS_PROBE_NOWILDCARD on successful hints
  match, so that the hints don't bogusly match other types of i2c chips.

Modified:
  head/sys/dev/iicbus/ads111x.c

Modified: head/sys/dev/iicbus/ads111x.c
==============================================================================
--- head/sys/dev/iicbus/ads111x.c	Mon Oct 12 17:43:38 2020	(r366651)
+++ head/sys/dev/iicbus/ads111x.c	Mon Oct 12 18:02:51 2020	(r366652)
@@ -456,12 +456,15 @@ ads111x_add_channels(struct ads111x_softc *sc)
 	name = device_get_name(sc->dev);
 	unit = device_get_unit(sc->dev);
 	for (chan = 0; chan < sc->chipinfo->numchan; ++chan) {
+		char resname[16];
 		found = false;
 		gainidx = DEFAULT_GAINIDX;
 		rateidx = DEFAULT_RATEIDX;
-		if (resource_int_value(name, unit, "gain_index", &gainidx) == 0)
+		snprintf(resname, sizeof(resname), "%d.gain_index", chan);
+		if (resource_int_value(name, unit, resname, &gainidx) == 0)
 			found = true;
-		if (resource_int_value(name, unit, "rate_index", &gainidx) == 0)
+		snprintf(resname, sizeof(resname), "%d.rate_index", chan);
+		if (resource_int_value(name, unit, resname, &rateidx) == 0)
 			found = true;
 		if (found) {
 			ads111x_setup_channel(sc, chan, gainidx, rateidx);
@@ -522,7 +525,11 @@ ads111x_probe(device_t dev)
 	info = ads111x_find_chipinfo(dev);
 	if (info != NULL) {
 		device_set_desc(dev, info->name);
+#ifdef FDT
 		return (BUS_PROBE_DEFAULT);
+#else
+		return (BUS_PROBE_NOWILDCARD);
+#endif
 	}
 
 	return (ENXIO);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202010121802.09CI2qlo043786>