Received: by 2002:a05:6358:16cd:b0:dc:6189:e246 with SMTP id r13csp3112281rwl; Sat, 5 Nov 2022 17:34:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7oI6L5Hnin9dA6WDVXsVM+XZSqa0NZYUm1KxqYcKvOfjDZckJv7HSb3kMyVMXwKqkY2Ak1 X-Received: by 2002:a05:6402:f8e:b0:461:8b1c:eb0c with SMTP id eh14-20020a0564020f8e00b004618b1ceb0cmr44220086edb.20.1667694865879; Sat, 05 Nov 2022 17:34:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667694865; cv=none; d=google.com; s=arc-20160816; b=GLeBLR9gWpkWqIb8r/nLaGIZ3gQ7SaW+2BVYrVXJOHYfsZ+IBdxCHQiJRBmcE3Ym6+ oMR8LnthFKoNylj6KLBSbqGZKYYc/gaKM2VxA7giETfyW7VtByun5+izX4zyL+zVfXxK afIuvrNJr37owAX2UuCWyBa8Axu82ThJedvFAgeH/RDRToIWHesrzJxGPZD0OfOwiMGW 556Jz/SGHJtictN+sX/GE/+6GEp3wSMP8LxfNdpIzaJL7LOz2zrTEMT4h4PgeDZxoPsh U+3r3ffDzIHpqNndv2+WWEbmBr6lWnatUXueN5xKxdB3ew1qtj3MGUcpGn4aUo4CMfVA y3Gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:cc:to:subject:from:date :dkim-signature; bh=TQiKfRULmK1hj+zlGpiThAJN9Uxdpi3uc4dM1+9bipo=; b=YMbSej7wxSLNy3diTgyKJCsK0d53MTdAwvwEvfrDMICPvz0MGBv33JHp7lpNRMTgrb mj6KlYvdlO7KrzNi/craT/8Wh9QbxMV6ndAPSD1OLvNhKZieDPnVgVZJ80N5cKNNUpEH 8hwxw6rQ+BArApMiy46y9mSHJR1WhEKS1+3XjkRWiwpiIeOLn+NTQ5/Ki1+xKY5os+SQ K2uGgNhMWC3gxrQQeKpYkIzkAUX2rWLnEwqZOxF96pMOj1/2pR7wHELHt1WFHt9pwtjf QsC9hlok0qVLW5ifBgP55pJEXLG8+eFfDrnrFk9xkYC5YhHZm5VOHUTw7SIxXog3jURi HUzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=iqSAaf0a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f18-20020a056402355200b004593fb0c125si4990154edd.103.2022.11.05.17.33.56; Sat, 05 Nov 2022 17:34:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=iqSAaf0a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229493AbiKEXjp (ORCPT + 98 others); Sat, 5 Nov 2022 19:39:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229551AbiKEXjn (ORCPT ); Sat, 5 Nov 2022 19:39:43 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 039FC11812; Sat, 5 Nov 2022 16:39:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1667691581; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TQiKfRULmK1hj+zlGpiThAJN9Uxdpi3uc4dM1+9bipo=; b=iqSAaf0aowSzmeyVPxe2oKONAr15pthW+n6zNr12B1OYjg/FDoi+Pvne5AWc+6sEPRkIdC a0ZTs3440jYB1w1+uvsKiHBSTz11jPvpPc7nmRz5QGLcE+y4OybG/ghmNUMpe7EAhp4HBP GgoO42T5bxdjQDEF4QphI/w9VoVPCF4= Date: Sat, 05 Nov 2022 23:39:32 +0000 From: Paul Cercueil Subject: Re: [RFC PATCH 0/2] Input: adc-joystick: add detachable devices support To: Siarhei Volkau Cc: Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Artur Rojek , linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Message-Id: In-Reply-To: <20221031190159.1341027-1-lis8215@gmail.com> References: <20221031190159.1341027-1-lis8215@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Siarhei, Le lun. 31 oct. 2022 =E0 22:01:57 +0300, Siarhei Volkau=20 a =E9crit : > For detachable or lock-able joysticks the ADC lanes might > be biased to GND or AVDD when the joystick is detached/locked. >=20 > One such kind of joystick is found in the Ritmix RZX-50 handheld. > The joystick is non-detachable, although ADC lane biased to power > supply when the "Hold" switch is activated. But the RZX-50 has no joystick... Or is the d-pad actually wired to the ADC instead of GPIOs? > To avoid reporting old/broken measurements valid-range is introduced. > When measured value is outside valid-range the driver reports > safe center position for corresponding axis. First of all, you already have a "valid range", it is called=20 "abs-range"; no need for a new one. Then, the driver has no business doing events filtering. Notice that=20 when you activate the "hold" button and your joystick values go way=20 off-range, you still get input events in userspace: that's because the=20 kernel is not responsible for enforcing the deadzone, the userspace is. In your case, you need to update your userspace applications/libraries=20 so that when the joystick values are way off-range, the assumed=20 position is the center. Cheers, -Paul