Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp358441imm; Mon, 4 Jun 2018 19:32:10 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKI6lhyQ82qRsOjfy+z7f8e04GrnKq96HB7Wg2a6+iIO8x8tgbCzL9IV3GvVhXp/nVpbVq4 X-Received: by 2002:a17:902:9307:: with SMTP id bc7-v6mr4772295plb.292.1528165930124; Mon, 04 Jun 2018 19:32:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528165930; cv=none; d=google.com; s=arc-20160816; b=JMVMCQbFwz5E3MZozfeFDlR+ApZS91a6f/sBvnwKSz6HU/YyNn3G+5DVPAxs2gG674 I4Ba4bYdTqDAV847jN+3aGk8yAsP1wD5nfPtv0+CmTeGgBRZpfhm2hz+5K7gffAxFqLa 4XL4r+Cck02UlpAzz2ZyWgu2GDeUX279JLb/YAI073GM0zjqPedkZTv2b1/xwRFB4WgY NIWECMxCiqZIRv8I2QvJb4p5kzkIgIKdkKkHhP8DpwgI29cLzwv2qQa3l1AfYJMeYkKg 06Uj4oqixNxzTdnhlUMa9LSabOBY7lfs0QuzGkawG4tjI/h/0aX2Akhfih68a7ld2Rli sFWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=fzfBihROV6+9ZgOLDfcMfOnUa+f9w36GzWejcrfIiZk=; b=h2F4S+/skRa3J3ymDEEbskuFyMwDS71AVgDcN89uFfe1PSE2fRezgkJLyY9403JSuj bQvtQdj5ZX0YY1L7QTDIwoN9jBOXAWGzZ1S2BeuCSSWpsZjmwMKXVsJHwKrDpKN2I+Pt deSVWW8vOB1St1/tbniBlzYmvFJx/eO/TwkxXhV0FCEsnnmFu9NtlnMJ3q8yoHvBRERZ wwZw9+gunZN7NrUcqB2TRZdGYzGqwK1rFIm+V2v3pNhdobc35koip9Zuye2vcA714ccD ng7gpeoxgkXbf5vad/dNyeNziEBfexN/sw9v8/dX5fWLJzYERziDPfUzgmgoGC1lm5Ph Csvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=kLFFiBsB; 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 w68-v6si48247122pfb.325.2018.06.04.19.31.55; Mon, 04 Jun 2018 19:32:10 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=kLFFiBsB; 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 S1751502AbeFECb3 (ORCPT + 99 others); Mon, 4 Jun 2018 22:31:29 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:46854 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751409AbeFECb2 (ORCPT ); Mon, 4 Jun 2018 22:31:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=fzfBihROV6+9ZgOLDfcMfOnUa+f9w36GzWejcrfIiZk=; b=kLFFiBsB90QZHsPiceAZCVVoH F8XydCgo/l+feVNCedm8OHP05eAY24D1lIux1TMVfuTEA09MUXkT6V74tX8COdUgFJFN+bfCA6Jz0 2rYxZPaItY9sfV3go/OM+vd0rI61VdY0IIgsnQktGP7J80HTPx1/3nOvRFiT2JaYMdXoFoh87AUbe bk5cg/ptsqb0HfsYNn8PR2L7cV4hf5ty/5EGVLGXI71K4SXMikSEOdhmY6AVVfdBJxRjb6697nPxC r+f6fu8ciEWTfv3HcWOJxQzWnITUYHOiLI7c5jz943CMDTjco3I6nAXwT9P6pShZRxD/pZ0Az7J8L snUpGoP3g==; Received: from dvhart by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fQ1kr-00050E-Th; Tue, 05 Jun 2018 02:31:25 +0000 Date: Mon, 4 Jun 2018 19:31:24 -0700 From: Darren Hart To: Hans de Goede Cc: Daniel Drake , Chris Chiu , Corentin Chary , Andy Shevchenko , Linux Kernel , Platform Driver , acpi4asus-user , Linux Upstreaming Team , Bastien Nocera , Benjamin Berg Subject: Re: [PATCH 1/2] platform/x86: asus-wmi: Call new led hw_changed API on kbd brightness change Message-ID: <20180605023124.GE47042@localhost.localdomain> References: <20180604123238.82200-1-chiu@endlessm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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