Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp389810imm; Mon, 4 Jun 2018 20:19:14 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIzPmmIw5je3n4Jvr9Shab1vC5GKg+PbvtzSlgzPDX1UzrylWe+0/lbTp+XjjMDqHM6mkFF X-Received: by 2002:aa7:8386:: with SMTP id u6-v6mr23745981pfm.253.1528168754045; Mon, 04 Jun 2018 20:19:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528168754; cv=none; d=google.com; s=arc-20160816; b=I6Kx4ARRQV5vELMsPxVv9YZMYEfFQmWfjMIy0ulSLUj2PCsqpfMuhrZ0cDKzKvi/iu sGAdqbpP8yMXNBPvXXgDQ2PxZ1JBWnHnhXR+s9Cz6Gt/ijvNJgXDqkfBnWoWCfC1p+cB ckNFcqKDXRi68riJaJ4O1i/yq6f+L2s3O3xr7W7ICQkcIbr6r8kRuBuG/Pc49k1QdE2H CbYy4SOcqEqtIhYuJceduFPMKSuiavl6x/jvCdVvE7m5/Vs39EG4qiRxHx+WTUp9L1Qa btyR6ykylTaEM5TeyzXgbV/qoEo79QSs1bNtHucC/LKIEX299XIgYNu25d80z7sfTOeR WB0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=J3AJAfI3JTFgJ4NpJJ+/QhP57PtSc1QHv8jFZrm79Us=; b=fsPqNyBGcZvaFYNfgLXYWNR27ST4adl/fTRJEinvzpiNflm1kWEsEUc8V2sd2J3WA0 ZNnGj6qXfgYY406BaQuV6jqyavejAoaQ+Ja8TqQq8/whCxYctmL4cCuIeHqnUF+YuhkU hUpA1HYYIec71SaZsGZQfwcTu9OIcGFN5+OiCyMBOoMeqgVt9o0Ybu0xZEk1Cdklf3kA IPmccOVkjuc7P06i8ZfCibq4EBO+sV/eSg4izB7vaSFC17FIkfwxBBj8fnNN8B/wM/Iq ZSGOoxZkVS+MCwZdjdviWPjIhQngJFfkKIJ6QuW1HR7l4gSx1M8dQSYdbSHsqIIyCvIS hwSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@endlessm-com.20150623.gappssmtp.com header.s=20150623 header.b=cD5rnVEi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t19-v6si46554931plo.287.2018.06.04.20.18.59; Mon, 04 Jun 2018 20:19:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@endlessm-com.20150623.gappssmtp.com header.s=20150623 header.b=cD5rnVEi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751356AbeFEDSf (ORCPT + 99 others); Mon, 4 Jun 2018 23:18:35 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:34222 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751232AbeFEDSe (ORCPT ); Mon, 4 Jun 2018 23:18:34 -0400 Received: by mail-wm0-f66.google.com with SMTP id q4-v6so17085297wmq.1 for ; Mon, 04 Jun 2018 20:18:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=endlessm-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=J3AJAfI3JTFgJ4NpJJ+/QhP57PtSc1QHv8jFZrm79Us=; b=cD5rnVEiKSxSWSNclHrccEvc5+M1xu3JDzZpcI/7Q3XEbVrahPuSBURcB9otZpNkGv 2en/16MZ62P4c6xfvLfre31pqaPrynTrIBFyDwQcd3gzuG1N1aFW7kAOUXARChNNBQqv vYtWVhlv8WUW0tVAxcbbq3ciG1AoNUyq0AUcLV16hvHn6bXIakGeS3eC2U1vpHkA0w8E CXOVpaTWPq8Ot38RMYERY5+AZCOgzpD1+oCdazU6tey6O0wivRhZ5z/1oXFFOjWnUi2X E3fn49B/vngMWqWsYkr5Gnosbd/xlQn92Hs2GYn/4GPt4nDL1AYA1YgKDkGnmx6OyATC nUBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=J3AJAfI3JTFgJ4NpJJ+/QhP57PtSc1QHv8jFZrm79Us=; b=lJP3+4uMH5rBLyudIZySQCmPFd9tm73SXfgeHzOCkJFtH4O8gNmuz0hrDOtujeJ46F npvegmk7FJh60/wG2zzlw9egc2t+gH4MW8/BlQasHngsnPvtivEzIjbf4Q10yPKQylr2 27PGBKaAZBxq/gvwtNTrEdO88F8uLwZpkQpIh0KYsZQxVWbvdeJVx0xFJ/lUYz9WVKAu T2q/6PUJb1zAgCFLbSZ+4TLbrEw3TZEFmDzC8XJ5xaaX1c+SSTxUt9ovAmqMv/GtJaM7 9bhWwXbSs9n+RWgETOfNKqkOrjse+K7lAsO0oi1CHq7xuALpTh4FHoR4dDPZFCg4Yd5k bZ3w== X-Gm-Message-State: ALKqPwfFreE0tNnB8jjOwzyI/AynooXGEm//6LziQSiRzWxpmsk1jbdD RQ52auU3fH5rJxIK+A3oRyi7yrdD9p6obtjlL+lcwQ== X-Received: by 2002:a50:cc4a:: with SMTP id n10-v6mr26336076edi.171.1528168712923; Mon, 04 Jun 2018 20:18:32 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a50:90d3:0:0:0:0:0 with HTTP; Mon, 4 Jun 2018 20:18:32 -0700 (PDT) In-Reply-To: <20180605023124.GE47042@localhost.localdomain> References: <20180604123238.82200-1-chiu@endlessm.com> <20180605023124.GE47042@localhost.localdomain> From: Chris Chiu Date: Tue, 5 Jun 2018 11:18:32 +0800 Message-ID: Subject: Re: [PATCH 1/2] platform/x86: asus-wmi: Call new led hw_changed API on kbd brightness change To: Darren Hart Cc: Hans de Goede , Daniel Drake , Corentin Chary , Andy Shevchenko , Linux Kernel , Platform Driver , acpi4asus-user , Linux Upstreaming Team , Bastien Nocera , Benjamin Berg Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 5, 2018 at 10:31 AM, Darren Hart wrote: > On Mon, Jun 04, 2018 at 04:23:04PM +0200, Hans de Goede wrote: >> Hi, >> >> On 04-06-18 15:51, Daniel Drake wrote: >> > On Mon, Jun 4, 2018 at 7:22 AM, Hans de Goede wrote: >> > > Is this really a case of the hardware itself processing the >> > > keypress and then changing the brightness *itself* ? >> > > >> > > From the "[PATCH 2/2] platform/x86: asus-wmi: Add keyboard backlight >> > > toggle support" patch I get the impression that the driver is >> > > modifying the brightness from within the kernel rather then the >> > > keyboard controller are ACPI embeddec-controller doing it itself. >> > > >> > > If that is the case then the right fix is for the driver to stop >> > > mucking with the brighness itself, it should simply report the >> > > right keyboard events and export a led interface and then userspace >> > > will do the right thing (and be able to offer flexible policies >> > > to the user). >> > >> > Before this modification, the driver reports the brightness keypresses >> > to userspace and then userspace can respond by changing the brightness >> > level, as you describe. >> > >> > You are right in that the hardware doesn't change the brightness >> > directly itself, which is the normal usage of LED_BRIGHT_HW_CHANGED. >> > >> > However this approach was suggested by Benjamin Berg and Bastien >> > Nocera in the thread: Re: [PATCH v2] platform/x86: asus-wmi: Add >> > keyboard backlight toggle support >> > https://marc.info/?l=linux-kernel&m=152639169210655&w=2 >> > >> > The issue is that we need to support a new "keyboard backlight >> > brightness cycle" key (in the patch that follows this one) which >> > doesn't fit into any definitions of keys recognised by the kernel and >> > likewise there's no userspace code to handle it. >> > >> > If preferred we could leave the standard brightness keys behaving as >> > they are (input events) and make the new special key type directly >> > handled by the kernel? >> >> I'm sorry that Benjamin and Bastien steered you in this direction, >> IMHO none of it should be handled in the kernel. >> >> Anytime any sort of input is directly responded to by the kernel >> it is a huge PITA to deal with from userspace. The kernel will have >> a simplistic implementation which almost always is wrong. >> >> Benjamin, remember the pain we went through with rfkill hotkey >> presses being handled in the kernel ? >> >> And then there is the whole acpi_video.brightness_switch_enabled >> debacle, which is an option which defaults to true which causes >> the kernel to handle LCD brightness key presses, which all distros >> have been patching to default to off for ages. >> >> To give a concrete example, we may want to implement software >> dimming / auto-off of the kbd backlight when the no keys are >> touched for x seconds. This would seriously get in the way of that. >> >> So sorry, but NACK to this series. > > So if instead of modifying the LED value, the kernel platform drivers > converted the TOGGLE into a cycle even by converting to an UP event > based on awareness of the plaform specific max value and the read > current value, leaving userspace to act on the TOGGLE/UP events - would > that be preferable? > > Something like: > > if (code == TOGGLE && ledval < ledmax) > code = UP; > > sparse_keymap_report_event(..., code, ...) > > } > -- > Darren Hart > VMware Open Source Technology Center That's what I was trying to do in [PATCH v2] platform/x86: asus-wmi: Add keyboard backlight toggle support. However, that brought another problem discussed in the thread. https://marc.info/?l=linux-kernel&m=152639169210655&w=2 So I moved the brightness change in the driver without passing to userspace. Per Hans, seems there're some other concerns and I also wonder if the TOGGLE event happens in ASUS HID (asus-hid.c) which also convert and pass the keycode to userspace but no TOGGLE key support yet What should we do then?