From patchwork Thu Oct 29 14:18:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Abbott X-Patchwork-Id: 317449 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABFD5C2D0A3 for ; Thu, 29 Oct 2020 14:27:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3961520EDD for ; Thu, 29 Oct 2020 14:27:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mev.co.uk header.i=@mev.co.uk header.b="TnSe+gwX" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726943AbgJ2O1A (ORCPT ); Thu, 29 Oct 2020 10:27:00 -0400 Received: from smtp90.ord1d.emailsrvr.com ([184.106.54.90]:56888 "EHLO smtp90.ord1d.emailsrvr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726226AbgJ2O04 (ORCPT ); Thu, 29 Oct 2020 10:26:56 -0400 X-Greylist: delayed 487 seconds by postgrey-1.27 at vger.kernel.org; Thu, 29 Oct 2020 10:26:56 EDT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20190130-41we5z8j; t=1603981129; bh=mYsxx+QSILFlqHhrRbOlc2ZeNLNa6JOiFrqgEJl3E10=; h=From:To:Subject:Date:From; b=TnSe+gwX7iMej6a0gZffW9dtVPvh9JWEwkqYOn1R5eoBcthtzxHQ3Jv+ifFAjrV5F wVcYIFsvp8SDLi2RfPFps08ePIEyoRD+3CuKeAMacNoE4ilp5kJNbKz6qbeXQ0LH0l Pyk5vB7x0M1HVR+fn4HPfs6SIUDDxY4p8CONKfT8= X-Auth-ID: abbotti@mev.co.uk Received: by smtp12.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id 2C4D0E011C; Thu, 29 Oct 2020 10:18:48 -0400 (EDT) From: Ian Abbott To: devel@driverdev.osuosl.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten , stable@vger.kernel.org Subject: [PATCH] staging: comedi: cb_pcidas: reinstate delay removed from trimpot setting Date: Thu, 29 Oct 2020 14:18:33 +0000 Message-Id: <20201029141833.126856-1-abbotti@mev.co.uk> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-Classification-ID: 20d96882-c44b-4751-ab0b-b588f69c1147-1-1 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org Commit eddd2a4c675c ("staging: comedi: cb_pcidas: refactor write_calibration_bitstream()") inadvertently removed one of the `udelay(1)` calls when writing to the calibration register in `cb_pcidas_calib_write()`. Reinstate the delay. It may seem strange that the delay is placed before the register write, but this function is called in a loop so the extra delay can make a difference. This _might_ solve reported issues reading analog inputs on a PCIe-DAS1602/16 card where the analog input values "were scaled in a strange way that didn't make sense". On the same hardware running a system with a 3.13 kernel, and then a system with a 4.4 kernel, but with the same application software, the system with the 3.13 kernel was fine, but the one with the 4.4 kernel exhibited the problem. Of the 90 changes to the driver between those kernel versions, this change looked like the most likely culprit. Fixes: eddd2a4c675c ("staging: comedi: cb_pcidas: refactor write_calibration_bitstream()") Cc: Signed-off-by: Ian Abbott --- drivers/staging/comedi/drivers/cb_pcidas.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index 48ec2ee953dc..4f2ac39aa619 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -529,6 +529,7 @@ static void cb_pcidas_calib_write(struct comedi_device *dev, if (trimpot) { /* select trimpot */ calib_bits |= PCIDAS_CALIB_TRIM_SEL; + udelay(1); outw(calib_bits, devpriv->pcibar1 + PCIDAS_CALIB_REG); }