From owner-freebsd-drivers@freebsd.org Wed May 15 23:10:46 2019 Return-Path: Delivered-To: freebsd-drivers@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 1055215A49E5 for ; Wed, 15 May 2019 23:10:46 +0000 (UTC) (envelope-from rj@obsigna.com) Received: from projectstore.net (ec2-18-228-164-192.sa-east-1.compute.amazonaws.com [18.228.164.192]) (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 B60FD75249 for ; Wed, 15 May 2019 23:10:42 +0000 (UTC) (envelope-from rj@obsigna.com) Received: from mail.obsigna.com (unknown [179.212.183.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by projectstore.net (Postfix) with ESMTPSA id 565421E0FCD for ; Wed, 15 May 2019 20:10:30 -0300 (-03) Received: from rolf-mini.obsigna.com (rolf-mini.obsigna.com [192.168.222.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.obsigna.com (Postfix) with ESMTPSA id 5218C1350F93F for ; Wed, 15 May 2019 19:59:03 -0300 (-03) From: "Dr. Rolf Jansen" Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Subject: DMA problems Message-Id: <342E86DE-F702-4ACA-8BF4-5BD25C1F62EA@obsigna.com> Date: Wed, 15 May 2019 20:11:13 -0300 To: freebsd-drivers@freebsd.org X-Mailer: Apple Mail (2.3445.9.1) X-Rspamd-Queue-Id: B60FD75249 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; spf=pass (mx1.freebsd.org: domain of rj@obsigna.com designates 18.228.164.192 as permitted sender) smtp.mailfrom=rj@obsigna.com X-Spamd-Result: default: False [-1.47 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; NEURAL_HAM_MEDIUM(-0.98)[-0.977,0]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+a:projectstore.net]; MV_CASE(0.50)[]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-drivers@freebsd.org]; TO_DN_NONE(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-0.99)[-0.992,0]; RCVD_COUNT_THREE(0.00)[3]; DMARC_NA(0.00)[obsigna.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MX_GOOD(-0.01)[obsigna.com,mail.obsigna.com]; NEURAL_HAM_SHORT(-0.42)[-0.420,0]; FROM_NAME_HAS_TITLE(1.00)[dr]; IP_SCORE(-0.27)[asn: 16509(-1.31), country: US(-0.06)]; RECEIVED_SPAMHAUS_PBL(0.00)[9.183.212.179.zen.spamhaus.org : 127.0.0.11]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:16509, ipnet:18.228.0.0/16, country:US]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[] X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 May 2019 23:10:46 -0000 I am in the process of deploying to a computer of a customer a software = for measurement of electrical signals by the way of a data acquisition = board from National Instruments NI PCIe-6351. My development machine and the computer of the customer are running the = latest FreeBSD 12.0-RELEASE-p4. Other software installations and = settings are nearly identical. The development system consist of an ASrock B250M Pro4 motherboard, = equipped with a Core i7-7700K @ 4.2 GHz + 16 GB of RAM. The deployment machine is a Dell OptiPlex 7060 Minitower XCTO, which = employs a Core i5-8500 CPU @ 3.00GHz + 8 GB of RAM. On the dev machine, my software is running perfectly and by utilizing = DMA I can drive the ADC scan rate up to 1 Msamples/s and the DAC update = rate up to 2.8 Msamples/s. On the deployment computer, DMA seems to be = non-functional. While slow, on demand ADC sampling and DAC updating does = work like all other functions of said DAQ board seem to work OK. = However, once DMA is involved, the customer=E2=80=99s system hangs, = waiting for the DMA channels filling with measurement data which = doesn=E2=80=99t seem to happen. I am a little bit lost now. May it be that the DMA controller of the Dell OptiPlex is somehow = incompatible with FreeBSD and/or the NI DAQ board? How may I debug this issue? The DMA memory is allocated by a kernel module and the virtual and = physical addresses are informed to the user land measurement software = which in turn adjusts the NI-DAQ board respectively. Once, again, on the ASRock i7 system DMA works perfectly, on the = OptiPlex i5 DMA hangs. I got older systems having old NI PCI-6251 boards = installed on Intel D510M motherboards wit Dual Core Atom @1.6 GHz + 2 = GB of RAM. On these systems, DMA is working as well in quite a similar = way. What=E2=80=99s the problem with DMA and Dell? Any insights would be highly appreciated. Best regards Rolf= From owner-freebsd-drivers@freebsd.org Thu May 16 22:39:44 2019 Return-Path: Delivered-To: freebsd-drivers@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 348F615A9026 for ; Thu, 16 May 2019 22:39:44 +0000 (UTC) (envelope-from andrey.kosachenko@gmail.com) Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C4E0B77938 for ; Thu, 16 May 2019 22:39:42 +0000 (UTC) (envelope-from andrey.kosachenko@gmail.com) Received: by mail-lj1-x244.google.com with SMTP id d15so4544043ljc.7 for ; Thu, 16 May 2019 15:39:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-transfer-encoding; bh=+b3X4xafZnnqD0DsFmAbIBTk/um6NWlRncJXfqyfJXU=; b=R1IQjXcKwIxh39g4loDAxrJw49j6xbOcj/DcfUZkSRlzIBYBzjm1Zn2SRd87zYSPTp dy+KPHZpxRVQvYRuwQ6u999iKqapjSM62ggIOt8H0pMZ8tAuPbI3fx3niOOcUKdgd2nT XyxUCDvq6keSMkBktGWFWxHkE88N3/JnjktxxV6SAFSWdzt0J834eS0MFjHErg2Isrja VGngC2Etp30Sh0u7ZfJtKXoP95YT3xRgVAj6mvsQt+RG2rVAY08b7TeG/rujva4LXMrh uKpJAHZ0xF0MpuKwdyorZmq7uYBjCnQ3WAtNx89ueEAam5T6Y2Ph8ZSf7tGrX77NEaBz 22oQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-transfer-encoding; bh=+b3X4xafZnnqD0DsFmAbIBTk/um6NWlRncJXfqyfJXU=; b=OG9ZiVbmQG+40Kfg2vvmZr+R//UPNw7hmVLyzci6f2OeWdnRAIYV05qRZCs/O06h5B /tujYpxcpAm2uoDncR19ULIAtc3V9AK+tSxnlnZ+1yuZmk9U9qUyma8tmjnLEeQrEnmN oRFACC9uakhRJcAdl7d2Q37aPuyjILA9nqLnohCsPzz8hbRWFvKpgDisNfgJwY/3efRv Hr+qE0x7tqxtgbQZv6xzZp3kwADYfd2SeCF32er+IpdgSEYDejzZnE01UFq9p3Vjna95 jCypIK290fNt0qfkJc/U+FwPFptt3YJAlP07DX/YyrXGEy5/U+WBdqyptbOJhLbPhooR W+Iw== X-Gm-Message-State: APjAAAVUL7qfBLlgbTcPOPMBQ8s56/rha47GSJhkeaugfUeTMy4aAT9S CU3HJxVoVJES7cZ/FMgGQ2UnvpnzBFQ= X-Google-Smtp-Source: APXvYqwh1gq0TNglGuq7Y9KPpZnOCI3K3OYhv6oopwDcRji2NEe8wZI7d4fUab5vBirvqE68WWfpEw== X-Received: by 2002:a2e:96d9:: with SMTP id d25mr24585625ljj.78.1558046380351; Thu, 16 May 2019 15:39:40 -0700 (PDT) Received: from beastie.intra ([46.149.95.227]) by smtp.gmail.com with ESMTPSA id z12sm1310016lfh.72.2019.05.16.15.39.38 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 May 2019 15:39:39 -0700 (PDT) To: freebsd-drivers@freebsd.org From: Andrey Kosachenko Subject: Thinkpad t480s elantech touchpad device is not recognized: unknown touchpad firmware (firmware v.0x7f3001) Message-ID: <5f4e1f25-8c87-5fa5-1d7f-edbde63fde6e@gmail.com> Date: Fri, 17 May 2019 01:40:12 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Firefox/52.0 SeaMonkey/2.49.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: C4E0B77938 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=R1IQjXcK; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of andreykosachenko@gmail.com designates 2a00:1450:4864:20::244 as permitted sender) smtp.mailfrom=andreykosachenko@gmail.com X-Spamd-Result: default: False [-3.86 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; FREEMAIL_FROM(0.00)[gmail.com]; TO_DN_NONE(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; NEURAL_HAM_SHORT(-0.57)[-0.568,0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; TAGGED_FROM(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; URIBL_BLOCKED(0.00)[freedesktop.org.multi.uribl.com,nabble.com.multi.uribl.com]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-drivers@freebsd.org]; RCPT_COUNT_ONE(0.00)[1]; RECEIVED_SPAMHAUS_PBL(0.00)[227.95.149.46.zen.spamhaus.org : 127.0.0.11]; RCVD_TLS_LAST(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[4.4.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.5.4.1.0.0.a.2.list.dnswl.org : 127.0.5.0]; IP_SCORE(-0.28)[ip: (3.12), ipnet: 2a00:1450::/32(-2.20), asn: 15169(-2.27), country: US(-0.06)] X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 May 2019 22:39:44 -0000 Hi, Recently I've replaced my t410 with t480s model. Before ordering the device I found positive feedback in terms of FreeBSD compatibility (pages like https://wiki.freebsd.org/Laptops/Thinkpad_T480) Apparently device is equipped with newer clickpad+trackpoint device which is not recognized by 12R properly: FreeBSD beastie.intra 12.0-RELEASE-p3 FreeBSD 12.0-RELEASE-p3 #2 r347114M: Sun May 12 00:08:31 EEST 2019 root@beastie.intra:/usr/obj/usr/src/amd64.amd64/sys/BEASTIE-EVDEV amd64 Attempts to enable hw.psm.synaptics_support or(and) hw.psm.elantech_support didn't help either. Though trackpoint works just fine after enabling hw.psm.trackpoint_support instead touchpad is recognized as generic PS/2 mouse (relevant strings from dmesg) === May 11 22:39:41 beastie kernel: atkbd0: [GIANT-LOCKED] May 11 22:39:41 beastie kernel: Unknown touchpad hardware (firmware v.0x7f3001) May 11 22:39:41 beastie kernel: psm0: irq 12 on atkbdc0 May 11 22:39:41 beastie kernel: psm0: [GIANT-LOCKED] May 11 22:39:41 beastie kernel: psm0: model Generic PS/2 mouse, device ID 0 === I was pretty much happy working with the device in general and with the tuouchpad in particular (as a simple mouse). Even got accustomed to the absence of double-finger scroll capability (which I could simulate via holding mid-button+swipe on touchpad) and triple-finger-tap as a midle-button-click). The only thing that I failed to workaround was accidental palm touches which is really painful and makes keyboard usage unbearable. Eventually I tried to seek for normal solution. Lenovo site sujests for t480s devices "ELAN UltraNav Driver for Windows 10 64-bit - ThinkPad T480s (Type 20L7, 20L8)" driver. Which made me think it is elantech (not synaptics). Looking through the psm sources quickly led me to the point where a very simple modification and recompilation of the kernel helped to recognize touchpad properly. In particular: === [silent@beastie][/usr/src]svnlite diff sys/dev/atkbdc/psm.c Index: sys/dev/atkbdc/psm.c =================================================================== --- sys/dev/atkbdc/psm.c (revision 347114) +++ sys/dev/atkbdc/psm.c (working copy) @@ -6929,7 +6929,7 @@ { static const int ic2hw[] = /*IC: 0 1 2 3 4 5 6 7 8 9 a b c d e f */ - { 0, 0, 2, 0, 2, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0 }; + { 0, 0, 2, 0, 2, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }; static const int fw_sizes[][3] = { /* FW.vers MaxX MaxY */ { 0x020030, 1152, 768 }, === I.e. after that simple modification system started to recognize fw version: === [silent@beastie][/usr/src]dmesg | egrep psm psm0: irq 12 on atkbdc0 psm0: [GIANT-LOCKED] psm0: model Elantech Touchpad, device ID 0 === and all expected touchpad features (multi-tap gestures and scrolling, whatsoever) started to function properly under xorg+evdev. I'm happy with a touchpad now however trackpoint stopped to work. In particular attempt to use trackpoint causes strange flickering of the mice cursor (which lasts few fractions of the second) after which cursor jumps to the left-upper corner of the screen and it's impossible to move it (via trackpoint) anymore (though swiping touchpad surface moves cursor as expected). Also I found in Xorg.log messages emerging when a palm touches the surface of a touchpad: === [ 65.729] (EE) event3 - ETPS/2 Elantech Touchpad: kernel bug: Touch jump detected and discarded. See https://wayland.freedesktop.org/libinput/doc/1.12.6/touchpad-jumping-cursors.html for details === Additionally I found relevant topic in openbsd lists http://openbsd-archive.7691.n7.nabble.com/ThinkPad-T480s-Elantech-v4-clickpad-configuration-td342242.html. Eventually I narrow down it to the following changes: https://github.com/openbsd/src/commit/8e9e9c10431cb45d93e2c0d81f668ff9575f8015#diff-ff06b79b08490ebbfa34b15aa4ebf370 . I might be inherently wrong (due to lack of knowledge in C language and driver implementation) however it seemed to me that the similar logic the diff above reveals (besides fw detection) had already been added to psm.c from FreeBSD sources earlier. So I'm writing here for 2 purposes: 1) not sure that my modification is proper in terms of firmware version detection (so can't send patch since there is a high chance it will be rejected) 2) modification is definitely either incomplete or incorrect since it brakes trackpoint functioning. Since I possess a laptop with a device which is not supported yet, I might help to debug the issue or even dedicate some time and try to add support for a new device (just need a nudge into proper direction) Thanks in advance! -- WBR, Andrey Kosachenko