From owner-freebsd-current@freebsd.org Mon Jul 1 16:27:53 2019 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1CEC115DF43F for ; Mon, 1 Jul 2019 16:27:53 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound2m.ore.mailhop.org (outbound2m.ore.mailhop.org [54.149.155.156]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 651DB86AB1 for ; Mon, 1 Jul 2019 16:27:52 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1561998465; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=n6/OfOEa6AhCFJ9GFhyfcJdZ+cehIHtsANwxYinoNqwvK7bw8Tzx6kfr2QseKBbdpb16euPx2RA18 JQGMKCKrz/Fx8AU1YhDsbVYUzWcXNi0qoXki3i20XhmzQ5r55MHsfmp9a9vbr/E1gW3w4WJFmfMfsQ 9ce2bbMe48AN8JYNUZvYiG9hM2FmpF1c8lWC2ep1pe/Pqcv/7oa6SF9Segd/UxJt62zq1IJQ4rA+ns F0IfAhdGYEzYMV35vIpP3m3YpA7R50mYHzcaSxvm3tbzWPNqeLRhxycErEQl4+atrFXUN/ZYg3Lgg3 VYn16ndm+4snbXkrk1tJLQ48QIRStSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=8ExaAHfbZ53cCLGbs8mYIV+sUHN4aUnNM51NEtpgRaY=; b=uC4xB4tMVPHGlQdJGNRSv8eo/wBwRYvBFkBV07ABpf10EHDAq69ookcwMg759yn50B/+Lu0mkcg/O IZ2gyw5i9gjDZHxGOOwNivsvXhSyGdJ1rpPlw7fjjXOuXbaMF0CrI7vTjRKWnAnwKCP5nsHRgvc3CI SpJVljCd4qvFQbZPIM4G8ntevB21kzUG8DHknAAyXY8yiCWkDJztaStkEZWvfh4KmtcMKVihZh7tY4 bIwbmhz0ypTJV0DDa8RU9wNjjZlQ98zSWm1Q+1CbALmbxRP7vIcgthkje3RvLnSWsBR7hs05FbFOKn d+5jDUK3hSuqRMUqW53xoPw07vD9q2Q== ARC-Authentication-Results: i=1; outbound4.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:from; bh=8ExaAHfbZ53cCLGbs8mYIV+sUHN4aUnNM51NEtpgRaY=; b=SDyK9DHmOvJ/1vXyngUetK3cyFbgSL1bhp0O4l3rkN7nYAoo0ix2wVBsoOxdWdqZ9JwDgZdE5m/Lj BVwKTy0v8+OgJI2OKCi+eKSPogRTFvIQLCAlTRJmD/JyLpMGXoiQd0BrvlAClz5JMRAdtXT/ZuBgay ZkhCaYMhkywRIh7MuJ13G23WlYIPvtCG+Uj95Adbxn6qQxn3ICcgVQ2SrnTm2txXoqe/qgNjcKnu47 2Fu85vPiXud5aTODykoqnAteS/Rb6nr6P92zc4osjWk//qAdbOzswdC9MnQ1Rem+8h01Dl/LTR8T9c JRS+n5k1+tSDOukUtZPdANw3jqaDNpw== X-MHO-RoutePath: aGlwcGll X-MHO-User: 2676aacc-9c1d-11e9-939f-ed46564da17d X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound4.ore.mailhop.org (Halon) with ESMTPSA id 2676aacc-9c1d-11e9-939f-ed46564da17d; Mon, 01 Jul 2019 16:27:43 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id x61GRgSv074903; Mon, 1 Jul 2019 10:27:42 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <7e5d8a06bc2d46263262369464e9348b82263847.camel@freebsd.org> Subject: Re: i2c bit banging timeout for SCL From: Ian Lepore To: Andriy Gapon , FreeBSD Current Date: Mon, 01 Jul 2019 10:27:42 -0600 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 651DB86AB1 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-3.00 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-1.00)[-0.996,0]; ASN(0.00)[asn:16509, ipnet:54.148.0.0/15, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Jul 2019 16:27:53 -0000 On Mon, 2019-07-01 at 19:03 +0300, Andriy Gapon wrote: > iicbb driver has a hardcoded timeout that defines how long the driver waits for > SCL line to go high after the driver releases it to float. Sometimes slaves > hold the line low until they are ready to continue with the communication. > As a side note, the timeout means that the driver just goes on as if the line > became high. Maybe it should produce an error instead. > > Anyway, I would like to increase the current timeout of 100 x 10us to 1000 x > 10us. The rationale is that there are many slave devices, like sensors, that > take about 10 ms to return a result. So, I think that it makes sense to play > nice with such devices by default. > > Probably I'll add a sysctl for that parameter while I'll be there. > > Any objections? Many (perhaps most?) modern i2c slave devices are both i2c and smbus compatible, and the smbus slave timeout is 35ms, so that wouldn't be a bad default value. I don't think ignoring the error and forging ahead is a good idea. It should return an error, and perhaps it should use the bitbang bus- recovery sequence (from iic_recover_bus.c) to unwedge the slave device. -- Ian