Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp2210815imc; Tue, 12 Mar 2019 09:07:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqw5AUHv57Gn5Z9C3bDa8GrEs3m3m8WchX2HDhvCtO7GGfT65DTLxuo3GP5U3of1tuRmgP4B X-Received: by 2002:a17:902:9a98:: with SMTP id w24mr39767034plp.247.1552406825917; Tue, 12 Mar 2019 09:07:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552406825; cv=none; d=google.com; s=arc-20160816; b=m5pRJ8gBbMS7UWAhk0bQE5SjyDQTihoSTmCS1sgAbgzVGAFttvh0BiA2gkLSqlgPGq bXw/NE0NvAxchGtDorZjeFxRSFIMLkf7vxM7ZcCjr1KxXBhkiZeHbthpbgNulcs8vir9 dO6G2BF7bF9fsGuRQTx9L2iqfIbB6Fy/Gk1mtX0dNBfzmtlvPjMqR65Uea0gaFawSO1w GZgv6MFmfpfi9jR3Cbuz1WM4wcU2EWtjSmh4m7Y3Znp8hiF/LphHgfD/vxQonR5yFtnl VoK7JIfrfszNVaz3CBAHAYW78833vuzWs8nl6FrXqa2iFyvaYC9pkNJ9Ez8EM57dgsAH /y3g== 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 :in-reply-to:references:mime-version:dkim-signature; bh=JQK4P7oIuX8yYDSIeh7wV+xqkzOVF0UCQ2O/+xiRagc=; b=jdP3xYmxA/p69wAclPvlPwS7dRNrhmKjgL5JJAdq7cM6le+QHpSetxw+1OWZNCS6I4 utYyOiZycjSrpLWwBCUC9qPdYNybTpw3Ch64UbKZgqd/vsvYfMeHTW5o3CiaCsedxV6l nLJN6KYLm0a7n/+Gvmv51kw52y+HIW3C8oHSDhjJZsAOE9+2oELaNxfP6EZ1IV0WhRoJ CMOBlY0a8lT1tMo13MddTVTV5HyR3OZfxxb41G330t8qozUcOfqnggfN7Psict/B08A8 6SUdOZJ0n915JlGyrFLZF2V90xhHV19z22KB6MZ5cZV4nMvLe+ApoaH1UlioufH+pGdj /KUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=OU18r5JX; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 37si6246077plc.233.2019.03.12.09.06.49; Tue, 12 Mar 2019 09:07:05 -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=@chromium.org header.s=google header.b=OU18r5JX; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726385AbfCLQFy (ORCPT + 99 others); Tue, 12 Mar 2019 12:05:54 -0400 Received: from mail-oi1-f196.google.com ([209.85.167.196]:37261 "EHLO mail-oi1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725894AbfCLQFy (ORCPT ); Tue, 12 Mar 2019 12:05:54 -0400 Received: by mail-oi1-f196.google.com with SMTP id w66so2534028oia.4 for ; Tue, 12 Mar 2019 09:05:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=JQK4P7oIuX8yYDSIeh7wV+xqkzOVF0UCQ2O/+xiRagc=; b=OU18r5JXhhOyZeWF99RY1nql8Dapbf2BFk7+d1lRve5W6ONee9n4NW9Z3iWJQrLk3s wJghfaGTWKqXTd6116yGO6I8RMQnKgBcMZ0jTdJYJm+OqXdOp7umV+NAAwQV3tJEokGn KOsWASTxe4VCvgBbgF00tOxbCwBRlYObFqjfg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=JQK4P7oIuX8yYDSIeh7wV+xqkzOVF0UCQ2O/+xiRagc=; b=H8+sh8S4/kM0NSVNqeuhqakrrLAHKt87xofa9OcNLTVgTQxsxD360evI7bgnUW5RkI 1BbqmgvKyorT47yrLwQWO31l0KxqgniLjXmCH+j/GUB784SC4CyPv12WNIyDrw0pKLUF 2bo5j1rq9fmmfe0PF2/YCl1hEtXVQllCCNGogbQG7RTKa19SGVrSFSxNngZ4aavQo/CM 6+xpahM0eAPi9/YuFp44rbirkVFp6D/TxclsACVuPYOJTQYe/XBtaGwsxj4ktIW5A4lo yV+5yc/6jxINTOsiY2BBGaVfq0SW+oiqvWqeMSU3uyfEY6do/glawA6pvBBd1rtCdS7i 50tQ== X-Gm-Message-State: APjAAAWTnldT5296OJTLlz+gpiMP4cqkLXpFoL9+BX6N4UrHLnpCmRlq y/vbvJwRE/Jqc/r6ab2zKg0r5ueQl80= X-Received: by 2002:aca:4911:: with SMTP id w17mr2128589oia.36.1552406752925; Tue, 12 Mar 2019 09:05:52 -0700 (PDT) Received: from mail-oi1-f173.google.com (mail-oi1-f173.google.com. [209.85.167.173]) by smtp.gmail.com with ESMTPSA id o17sm1292889otl.27.2019.03.12.09.05.51 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Mar 2019 09:05:51 -0700 (PDT) Received: by mail-oi1-f173.google.com with SMTP id a15so2387005oid.5 for ; Tue, 12 Mar 2019 09:05:51 -0700 (PDT) X-Received: by 2002:aca:d803:: with SMTP id p3mr2046883oig.111.1552406749668; Tue, 12 Mar 2019 09:05:49 -0700 (PDT) MIME-Version: 1.0 References: <20190308203801.57920-1-ncrews@chromium.org> <20190308221307.GB16125@amd> In-Reply-To: <20190308221307.GB16125@amd> From: Nick Crews Date: Tue, 12 Mar 2019 10:05:38 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] platform/chrome: Add Wilco EC keyboard backlight LEDs support To: Pavel Machek Cc: Dmitry Torokhov , Enric Balletbo i Serra , Benson Leung , linux-leds@vger.kernel.org, jacek.anaszewski@gmail.com, lkml , Duncan Laurie , Daniel Erat , Guenter Roeck 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 > > > Some Wilco devices do not support a keyboard backlight. This > > > is checked in probe(), and in this case the sysfs entry will > > > not appear, and everything will behave normally. > > > > It would be even better if we did not register platform device if EC > > does not support backlight. Good point Dmitry. I would imagine this would entail exposing the keyboard_leds_exist() function. What is the best practice for doing that? I could either imagine EXPORT_SYMBOL_GPL()ing that function, but that would require making the core driver dependent upon this keyboard backlight driver in a circular dependency, so there would have to be some refactoring. The other option I see would be to add this entire driver to the core module. Just so I learn something, I don't see performance or stability concerns with adding one unused platform device, is your rationale that it would just be cleaner code? > > > > > + data->led.brightness_set = keyboard_led_set_brightness; > > > + data->led.brightness_get = keyboard_led_get_brightness; > > > > wilco_ec_mailbox() may sleep, so you need to assign it to > > led.brightness_set_blocking. Yes, thanks for the catch. > > Hmm. Seeing get method there... can the EC change the brightness > without command from kernel? No, the EC will never do that, good point. Therefore it looks like I can just remove the get_brightness() function and the core library will do the right thing. Thanks, Nick