Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp5847030ybn; Sun, 29 Sep 2019 07:01:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqw+FPvIidOczTpLvIwUJlRexpmlJabkdaZ0OW9HIxiWZEcU4SmyT3PRNSDw7fchdwunU4LK X-Received: by 2002:a50:b545:: with SMTP id z5mr14845486edd.203.1569765675844; Sun, 29 Sep 2019 07:01:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569765675; cv=none; d=google.com; s=arc-20160816; b=N7O5Fcknc6gZ2fORAdyiqUSa2o5Zwc/j+zNsTjrt4edLI72vETr9KkIxiNtoBtoxIU vjuraQNv9PsUyQm/zZThK2izTtFKUq0QqLoOZWnBdNdkYr5B8vCQRrH0IQytvCukzDM0 UkWJUWiUmeWX560Na0yDEMU7PgWh5W8sXG9cLgTkaMjroaBuOSysIF9N3nmF1xFulryT PE5wbY/l0mvRjbllcyiAthSSldBwIidi4APwy45tidytwe79olh58gqd0Ec5/se5q6Cn izXCLdu1mf03RnOWzc7zhhSckdaJSf6YKeVVg06vyIwZfZhlrk2ZgoT7kflYxl7UMxI4 9YIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=T9pVYLfOPZ8mgbZltpma+erh1UbqGgkgY3ds5urVh+w=; b=WPI3OBDyjmWUB/85sb/bGLcFmhbWU+sVdpxJWtsQcHw6m6+TzU7ZrIbts52s4OGxak X1u9atEzuOk2ZEBOGpeVL+SegrInk1K0uFQie9ujHvwEzaUfNEwP+Mk5aRR1c/XfqJ41 KO6kqi4LySWyVGHqfmBLr3H/+pNp8Bq3RbwEjkUQ2qBpDyl1D9O99SAOF5DWkubeuGfW wPZvyKXkhlTILb03ywBJZKw0M9TeWuc2akWrj1qY4ysbSegvOuOBRqy29S9ePIEtvsaX ZUXVDnznFWtKKUzHVrXBlGDUjtNprtCDfhD81hJ4dp1W2/qGG+F4/k3JczKqKLub4kBd dBgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="LYP/TEzd"; 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 n6si5486966eju.100.2019.09.29.07.00.51; Sun, 29 Sep 2019 07:01:15 -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=@kernel.org header.s=default header.b="LYP/TEzd"; 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 S1729549AbfI2OAE (ORCPT + 99 others); Sun, 29 Sep 2019 10:00:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:41542 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729845AbfI2OAB (ORCPT ); Sun, 29 Sep 2019 10:00:01 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9D8B02082F; Sun, 29 Sep 2019 13:59:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569765600; bh=n2ZPc5mWVXvVlYy8in4aeJCAQhA1LUx8eA4rG19ZCVo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LYP/TEzdcIl4o1ry+BwDUk3CryEhgvMBoihPkQonZeulzcHEPLtmgoOdXA9hIMo7K Px4OAeWhvuyDh+iCl6Tv0Caa1wtNaCTvCNq5I12pmM9gJXOFFWLcrA7inXb3t7eOhJ 7eV5NHwVibsz2O8+qhaT4qFv3BLGBPeearMFRpPw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Kacper=20Piwi=C5=84ski?= , Hans de Goede , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 4.19 57/63] ACPI: video: Add new hw_changes_brightness quirk, set it on PB Easynote MZ35 Date: Sun, 29 Sep 2019 15:54:30 +0200 Message-Id: <20190929135040.889718199@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190929135031.382429403@linuxfoundation.org> References: <20190929135031.382429403@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hans de Goede [ Upstream commit 4f7f96453b462b3de0fa18d18fe983960bb5ee7f ] Some machines change the brightness themselves when a brightness hotkey gets pressed, despite us telling them not to. This causes the brightness to go two steps up / down when the hotkey is pressed. This is esp. a problem on older machines with only a few brightness levels. This commit adds a new hw_changes_brightness quirk which makes acpi_video_device_notify() only call backlight_force_update(..., BACKLIGHT_UPDATE_HOTKEY) and not do anything else, notifying userspace that the brightness was changed and leaving it at that fixing the dual step problem. BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=204077 Reported-by: Kacper Piwiński Tested-by: Kacper Piwiński Signed-off-by: Hans de Goede Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/acpi/acpi_video.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c index d73afb562ad95..1a23e7aa74df7 100644 --- a/drivers/acpi/acpi_video.c +++ b/drivers/acpi/acpi_video.c @@ -73,6 +73,12 @@ module_param(report_key_events, int, 0644); MODULE_PARM_DESC(report_key_events, "0: none, 1: output changes, 2: brightness changes, 3: all"); +static int hw_changes_brightness = -1; +module_param(hw_changes_brightness, int, 0644); +MODULE_PARM_DESC(hw_changes_brightness, + "Set this to 1 on buggy hw which changes the brightness itself when " + "a hotkey is pressed: -1: auto, 0: normal 1: hw-changes-brightness"); + /* * Whether the struct acpi_video_device_attrib::device_id_scheme bit should be * assumed even if not actually set. @@ -418,6 +424,14 @@ static int video_set_report_key_events(const struct dmi_system_id *id) return 0; } +static int video_hw_changes_brightness( + const struct dmi_system_id *d) +{ + if (hw_changes_brightness == -1) + hw_changes_brightness = 1; + return 0; +} + static const struct dmi_system_id video_dmi_table[] = { /* * Broken _BQC workaround http://bugzilla.kernel.org/show_bug.cgi?id=13121 @@ -542,6 +556,21 @@ static const struct dmi_system_id video_dmi_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "Vostro V131"), }, }, + /* + * Some machines change the brightness themselves when a brightness + * hotkey gets pressed, despite us telling them not to. In this case + * acpi_video_device_notify() should only call backlight_force_update( + * BACKLIGHT_UPDATE_HOTKEY) and not do anything else. + */ + { + /* https://bugzilla.kernel.org/show_bug.cgi?id=204077 */ + .callback = video_hw_changes_brightness, + .ident = "Packard Bell EasyNote MZ35", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Packard Bell"), + DMI_MATCH(DMI_PRODUCT_NAME, "EasyNote MZ35"), + }, + }, {} }; @@ -1625,6 +1654,14 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data) bus = video_device->video; input = bus->input; + if (hw_changes_brightness > 0) { + if (video_device->backlight) + backlight_force_update(video_device->backlight, + BACKLIGHT_UPDATE_HOTKEY); + acpi_notifier_call_chain(device, event, 0); + return; + } + switch (event) { case ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS: /* Cycle brightness */ brightness_switch_event(video_device, event); -- 2.20.1