From patchwork Thu Nov 2 20:25:24 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: 10039287 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 56E206032D for ; Thu, 2 Nov 2017 20:25:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 49D9C293D5 for ; Thu, 2 Nov 2017 20:25:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3EA2C293DA; Thu, 2 Nov 2017 20:25:46 +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 D06E5293D5 for ; Thu, 2 Nov 2017 20:25:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964833AbdKBUZp (ORCPT ); Thu, 2 Nov 2017 16:25:45 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:54261 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932241AbdKBUZn (ORCPT ); Thu, 2 Nov 2017 16:25:43 -0400 Received: by mail-wm0-f66.google.com with SMTP id r196so1329843wmf.2; Thu, 02 Nov 2017 13:25:43 -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=m0wYFZd+9gqKkxTaewUsqaB4WPiuQwGPjBrbOoF990o=; b=qAkB09yb5QPM8X+sEW9sAAb/Q/sd7kb+GI3wYgKqEGWbGjAVqVsQjyQdSIMFopQjpa irFLa6kLoATq1HaQHc2CgpTF16UK5qOMDnnnhrAIA9OUV66fXkjOYM5D+v0K0vBQ9dSW lOkbzcWMj6tI3YQ8wooVNhCIBLB9eumkw83VaV948m91J7mQgzZdfvdAIVv5a08qNn7r ynERWhsa1+9+k3bgBup93mFNNfCu/i7EJmAhoUFWM7Jh9onYCsJkYilblQDK4O9YaREN 6jsa9eBE9HvxSwQSUNr2TaFJc4A3wvtVIEyrR8tD/tGfwMFQR2k9dwmf+WT9j/QkxtMG LJAg== 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=m0wYFZd+9gqKkxTaewUsqaB4WPiuQwGPjBrbOoF990o=; b=hbRdRLZhZaErufQxxnFhyJ41uWngsr11G76aKrguw9CHZmrcYQvOeDWl0XxYRYfIkQ 76KsIdRGd+Uc6Ytz5iILGMwvLotMYsrpQdQO3s9ib9y3tzHpmNCIlC0fvR7zo5v593u8 rorrzyq33A9R6OH+G7racUdGQ0nNNz5mAEpvAHEtAKc3fK5LmVOVG2ldH95ltd+lZuo7 CLhZBp8OH4FpRaoaEE3Ee02kwQ3bF0UMG3icjfkxtVXs8cSM9eYba5fsxeikMts5vHv0 Sm+Oo7P1q1TMOri5ph5Z8PrcWUxtd5qZawfHrgdbhibCbqNUVzUicWzldGOttSQ8ged/ krEg== X-Gm-Message-State: AMCzsaUK3RD4C2+G4OOp2OM7p3kICdJO/lLh7g1eNS6a7CM8PNNUrPp7 YalWFU4DoiBwafSvnSqSmpNw4/kz X-Google-Smtp-Source: ABhQp+T3VUWb9gbZYkJrtA9DA9dBfjUqcVktfrmadGj6XVKzubpZKNULrptwroFTFN7+C/ZtzISyXg== X-Received: by 10.28.64.198 with SMTP id n189mr2487132wma.0.1509654342670; Thu, 02 Nov 2017 13:25:42 -0700 (PDT) Received: from Pali-Latitude.lan (pali.kolej.mff.cuni.cz. [78.128.193.202]) by smtp.gmail.com with ESMTPSA id v23sm308931wmh.8.2017.11.02.13.25.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Nov 2017 13:25:41 -0700 (PDT) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Darren Hart , Matthew Garrett , 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 v3] dell-laptop: Fix keyboard led max_brightness property for Dell Latitude E6410 Date: Thu, 2 Nov 2017 21:25:24 +0100 Message-Id: <1509654324-709-1-git-send-email-pali.rohar@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1508349961-15051-1-git-send-email-pali.rohar@gmail.com> References: <1508349961-15051-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 v2: * Rename quirk entry to kbd_led_levels_off_1 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..7424e53 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_levels_off_1; 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_levels_off_1 = 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_levels_off_1 && info->levels) + info->levels--; + if (units & BIT(0)) info->seconds = (buffer->output[3] >> 0) & 0xFF; if (units & BIT(1))