Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp4246788pxb; Sat, 6 Nov 2021 09:47:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0QYx1pOkuXGi3czJn6siQh2TRv+WS2f1pY/DCkc2pfGQ6jci1hVsGq5rvavElEen7YOI5 X-Received: by 2002:a05:6e02:1c46:: with SMTP id d6mr47311112ilg.79.1636217278623; Sat, 06 Nov 2021 09:47:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636217278; cv=none; d=google.com; s=arc-20160816; b=jbsBUItvJ/zEEdFBp66lDIx9I3+GtT7XnRHoc+GfrKIssdo+ER8CS3IQbtmkHF93Cg Of0ySZbwCndIElb1EgXzRnceqX/gNjZC5wQC7FfQS6KjfLXa6BZgsO5uOVB6ry3eseH9 Uf/Blxyyu75KlUXGLACQKWGpCMeLka1Z9JFkEEsfw8n0M9Z4jxzYlG3Z6SG3+dkXv5MS Qw/LTX9/ivw4hs/dquDLKA2i9wSYstMDDTr+89fHz7RAgz1DvV1YcH0/3KKLa9xzZ+ri cRxYnnfZdbqkYpBlHQdjqfdJbhlKD9qBB6sbJTpp78PG1Ph4+vs9fOunXDwwToVyTNSh p1nA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:message-id:date:to:cc:from:subject :references:in-reply-to:content-transfer-encoding:mime-version :dkim-signature; bh=CmENM+uyA4pAVR6dx72p11VDJesffbGXYxgWeYVpzkE=; b=mYS8cwT6ni8kwqDMRalXo1R9H1fK5I8p1LgHxV2xhLNKQUgpnZ7MuT35iAr6UzlJek vgH/ywZ+FzWVpa0iMy7C+e6EtnFjf0tvIYAz4oKFCW7GOxKY9Rr+rpG7E8ToJqIS7zVA 6qtDZdlWO1McocARzSoQ5xr9YIpvTuZBimrSGKjE1p2qANf89wyfQfZQM1iowIXb7Rar tleM6PircM+Kg1G2Lyt0U2Xz7dWeqezR7egTmq1XOJ58UvhK6R3xWptPMtNwyDBAIkyR mKuCZbCs8HFwHEDoZ6blHCDqH7G0NY0+8F7JDj8M2FFBQTMrdbBikBUxSZcNXxkvuTeH MThg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=aX4+ukRe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n4si25262169jaj.90.2021.11.06.09.47.46; Sat, 06 Nov 2021 09:47:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=aX4+ukRe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232251AbhKFKQA (ORCPT + 99 others); Sat, 6 Nov 2021 06:16:00 -0400 Received: from perceval.ideasonboard.com ([213.167.242.64]:43306 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229645AbhKFKP7 (ORCPT ); Sat, 6 Nov 2021 06:15:59 -0400 Received: from pendragon.ideasonboard.com (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 7025D18FC; Sat, 6 Nov 2021 11:13:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1636193597; bh=pWHsN85WQE04ifv7GnoCEhAUNAYLGxlr6rj0B8T8H+Y=; h=In-Reply-To:References:Subject:From:Cc:To:Date:From; b=aX4+ukReNH2TvvALnKExXBbdCMgB8yR1AJiq7A/sxMEfOveQ2jO8BnW0cjnX1lNA6 YM3GRHxa7o19KNhFPjlsOKVD/90R/XIsrLUysuPSdIZatON9TPKvHv8OOkl603p7vT RU+/tqlEUZKA6c8WlQKDkH722qzUabhtNbIjcFQ0= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: References: <20211105103508.4153491-1-kieran.bingham+renesas@ideasonboard.com> <20211105170037.GA65511@nixie71> Subject: Re: [PATCH v2] Input: add 'safe' user switch codes From: Kieran Bingham Cc: linux-input@vger.kernel.org, Geert Uytterhoeven , linux-renesas-soc@vger.kernel.org, Max Gurtovoy , Hans de Goede , Wu Hao , Bjorn Helgaas , Dan Williams , Dave Ertman , Maximilian Luz , Stephan Gerhold , Xu Yilun , open list To: Dmitry Torokhov , Jeff LaBundy Date: Sat, 06 Nov 2021 10:13:15 +0000 Message-ID: <163619359511.3601475.3667763097540792609@Monstersaurus> User-Agent: alot/0.9.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Dmitry, Jeff, Thanks for looking into this, Quoting Dmitry Torokhov (2021-11-05 23:04:23) > Hi Jeff, Kieran, >=20 > On Fri, Nov 05, 2021 at 12:00:37PM -0500, Jeff LaBundy wrote: > > Hi Kieran, > >=20 > > On Fri, Nov 05, 2021 at 10:35:07AM +0000, Kieran Bingham wrote: > > > All existing SW input codes define an action which can be interpreted= by > > > a user environment to adapt to the condition of the switch. > > >=20 > > > For example, switches to define the audio mute, will prevent audio > > > playback, and switches to indicate lid and covers being closed may > > > disable displays. > > >=20 > > > Many evaluation platforms provide switches which can be connected to = the > > > input system but associating these to an action incorrectly could > > > provide inconsistent end user experiences due to unmarked switch > > > positions. > > >=20 > > > Define two custom user defined switches allowing hardware descriptions > > > to be created whereby the position of the switch is not interpreted as > > > any standard condition that will affect a user experience. > > >=20 > > > This allows wiring up custom generic switches in a way that will allow > > > them to be read and processed, without incurring undesired or otherwi= se > > > undocumented (by the hardware) 'default' behaviours. > > >=20 > > > Signed-off-by: Kieran Bingham > > > --- > > >=20 > > > Sigh, a compile test might have at least saved the buildbots the trou= ble > > > of notifying me I also need to update the INPUT_DEVICE_ID_SW_MAX. But > > > even so - I'm really looking for a discussion on the best ways to > > > describe a non-defined switch in device tree. > > >=20 > > > Here's a compiling v2 ;-) But the real questions are : > > >=20 > > > - Should an existing feature switch be used for generic switches? > > > - Should we even have a 'user' defined switch? > > > - If we add user switches, how many? > > >=20 > >=20 > > This is merely my opinion, but if a hardware switch does not have a def= ined > > purpose, it does not seem necessary to represent it with an input devic= e. >=20 > Yes, exactly. For input core we are trying to avoid generic events with > no defined meaning. That's understandable, particularly as I could then ponder - how do we even define generic switches, and how many ;-) I wanted to discuss it because otherwise these switches will be defined in DT as buttons. And they are not buttons... > What are these switches? GPIOs? Maybe it would be better to use GPIO > layer to test the state for them? They are physical slide switches on the board. But they have no defined purpose by the hardware designer. The purpose would be defined by the end user, as otherwise they are generic test switches. These have been previously handled as gpio-key buttons, for instance key-1 to key-4 at [0] are actually four slides switches.=20 [0] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/comm= it/?id=3De3414b8c45afa5cdfb1ffd10f5334da3458c4aa5 What I'm trying to determine/promote is that they are not push buttons, and shouldn't be described as such. I have posted [1] to add support for these switches, but I am limited to chosing 'functions' which will have an impact on the system... [1] https://lore.kernel.org/all/20211025130457.935122-1-kieran.bingham+rene= sas@ideasonboard.com/ Presently in [1] I have chosen SW_LID and SW_DOCK as very arbitrary functions for the switches. But my concern is that in doing so, the SW_LID position could for instance suggest to a window environment or power management system that the lid is closed, and the system should be suspended (of course depending upon configurations). That would mean that the board would now be potentially always heading into a suspend after power up which would not be at all clear from the switch. I believe a 'switch' is the correct way to define this hardware, so that both positions can be determined, and read, and events generated on state change - but that there shouldn't be any artificially imposed side effects from the description. If the answer is "no we can't have generic switches" then so be it, but it feels wrong to further propogate the definition of these test switches as keys. -- Regards Kieran