From patchwork Wed Oct 18 18:06:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 10015149 X-Patchwork-Delegate: dvhart@infradead.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3375F60215 for ; Wed, 18 Oct 2017 18:06:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2767E29193 for ; Wed, 18 Oct 2017 18:06:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1B80E2919F; Wed, 18 Oct 2017 18:06:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9847A29193 for ; Wed, 18 Oct 2017 18:06:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750775AbdJRSGj (ORCPT ); Wed, 18 Oct 2017 14:06:39 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:51597 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750730AbdJRSGi (ORCPT ); Wed, 18 Oct 2017 14:06:38 -0400 Received: by mail-wm0-f66.google.com with SMTP id f4so11738307wme.0; Wed, 18 Oct 2017 11:06:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cA6pZI3/nmuendO5+syhMsPUq+jo9UeAzerzG8oIdIM=; b=AEPDYzhK/CgSlRvyj17ri2ZEB9kmhH2+YXSC4qIew3s6D63tLfSH2Ouy1MKFqfGMJw KRR+5rlxEYZFFSXFL+1n9nRBqhXwqxvtnz53qDbqOfe61Ali2FO1lgURpGNgydujNkN7 hbBSKv552KyTLVcvKFxw2TqAPGjzVVMD2XLxtXWNLMrOe9WInrsLVj1BkdcamErjlKgJ 4wPRTAgWG2bGH376sZny5u4oKSENbuQ7crwlR6huKexmPpS9Y95OoLqF3RYg2ISO83lO NMKvC8SvW+xVKixsvmXAMc2USJnYW/x+u0lTSSCfULacgntuVD3N+UYLSEy3SReh6Akz 7BKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cA6pZI3/nmuendO5+syhMsPUq+jo9UeAzerzG8oIdIM=; b=Jf68Nsg481JJAZo3G+nLvoFZK8jTH3ujOZDzU0GYG3c34LiyrMPYipMTegcS58WOFB rEUo21vr8qBP9X0j6y8m9hyZh7u63m7YrFA0s9u7n0EMnyiSN/0GDqy9pW0cnCXMS6dF UZ7Lsltr6xnPdDb+uiHRtEvjiZJQ+oUqhcO1f8zQiLQC6RVaZ6wsQBmjlr1nHMqU5aJ1 z7uqwEswP6Lh818bnw9qLhlxDSR/pZkfsRiOncw9T1KtCU5+zGxCfZkJjz5saWjJJnJx wuPTA2oaR3IHVDY81m0kOB6own6MMURkv/P/lyq1JGa9FMzOLCB825L2Or859Gx9//2D FnsA== X-Gm-Message-State: AMCzsaVGb+T228P7Pm2lMj1s/qFTZJPp5MZNxRk9lZizW+tjKbFsUdvO LkfRLm4e76Jj+5WHyw0zSe0= X-Google-Smtp-Source: ABhQp+Rf/rKNHvb9sT15exp+Vs7TOz3DOYBRRgN5pEVolnZfCNbBWKqnoHFDnePxkR2Y/ZGkGL1NPg== X-Received: by 10.28.74.89 with SMTP id x86mr7119263wma.57.1508349996876; Wed, 18 Oct 2017 11:06:36 -0700 (PDT) Received: from Pali-Latitude.lan (pali.kolej.mff.cuni.cz. [78.128.193.202]) by smtp.gmail.com with ESMTPSA id n89sm16071255wmi.33.2017.10.18.11.06.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Oct 2017 11:06:35 -0700 (PDT) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Matthew Garrett , Darren Hart , Andy Shevchenko , "Gabriel M. Elder" , Gabriele Mazzotta , Mario.Limonciello@dell.com Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Pali=20Roh=C3=A1r?= Subject: [PATCH v2] dell-laptop: Fix keyboard led max_brightness property for Dell Latitude E6410 Date: Wed, 18 Oct 2017 20:06:01 +0200 Message-Id: <1508349961-15051-1-git-send-email-pali.rohar@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1508083394-22823-1-git-send-email-pali.rohar@gmail.com> References: <1508083394-22823-1-git-send-email-pali.rohar@gmail.com> MIME-Version: 1.0 Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This machine reports number of keyboard backlight led levels, instead of value of the last led level index. Therefore max_brightness properly needs to be subtracted by 1 to match led max_brightness API. Signed-off-by: Pali Rohár Reported-by: Gabriel M. Elder Link: https://bugzilla.kernel.org/show_bug.cgi?id=196913 --- Changes since v1: * Update kbd_info.levels at initialization time based on quirk --- drivers/platform/x86/dell-laptop.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c index f42159f..3f9be8a 100644 --- a/drivers/platform/x86/dell-laptop.c +++ b/drivers/platform/x86/dell-laptop.c @@ -49,6 +49,7 @@ struct quirk_entry { u8 touchpad_led; + u8 kbd_led_num_of_levels_instead_of_last_index; int needs_kbd_timeouts; /* @@ -79,6 +80,10 @@ static int __init dmi_matched(const struct dmi_system_id *dmi) .kbd_timeouts = { 0, 5, 15, 60, 5 * 60, 15 * 60, -1 }, }; +static struct quirk_entry quirk_dell_latitude_e6410 = { + .kbd_led_num_of_levels_instead_of_last_index = 1, +}; + static struct platform_driver platform_driver = { .driver = { .name = "dell-laptop", @@ -280,6 +285,15 @@ static int __init dmi_matched(const struct dmi_system_id *dmi) }, .driver_data = &quirk_dell_xps13_9333, }, + { + .callback = dmi_matched, + .ident = "Dell Latitude E6410", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "Latitude E6410"), + }, + .driver_data = &quirk_dell_latitude_e6410, + }, { } }; @@ -1200,6 +1214,9 @@ static int kbd_get_info(struct kbd_info *info) units = (buffer->output[2] >> 8) & 0xFF; info->levels = (buffer->output[2] >> 16) & 0xFF; + if (quirks && quirks->kbd_led_num_of_levels_instead_of_last_index && info->levels) + info->levels--; + if (units & BIT(0)) info->seconds = (buffer->output[3] >> 0) & 0xFF; if (units & BIT(1))