Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp5850701ybn; Sun, 29 Sep 2019 07:04:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqw5umkYufaV38EiEvAjuVh5FbiJ9nURC/HayzRjx5j9uXnWNyTECg5b59V5imdGRYbSsL84 X-Received: by 2002:a05:6402:1a45:: with SMTP id bf5mr14406888edb.275.1569765863406; Sun, 29 Sep 2019 07:04:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569765863; cv=none; d=google.com; s=arc-20160816; b=fn7ENBNR77h4DCxbACHALYAiG7QuDZhwXBKFYjCYtClGjpG44u6N8rlitA4POzCjXx uz1vpCX09Xb6u/9tERfH6HCmpbGZlkhZsh8wxUQ5acQrAgRYKQs83lm4hrLvMQdlr54i VKYHPVv2cX7tY70vquBmEbvgSKh3VBWk5OqLxdIdyk860T7NId240ehhuCjkAKNGbID+ ADn4h+wGl40Rkma+jL4FlAWswvbVk1qFTQ3EtEXRpZ4wiGk0bUTpA7/kV+mrGY88cYSF /wz4M8Ny+hS+nr2tOu8VjU2dpOlJq6fEBn5Th9aY8i2s0eM8i8r6ZtKfpdeR4SKUIWLC HsFg== 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=fJev7K23Ckz1Mh049tKxGSJsWooVykwiFBTTvNcXUsA=; b=dRL4cp/Zvm37xHC71ERHJeH/NfEaJ6NZrlZLFwcxFvfvRCj50isxxa4tSJRuBkezuP 71xY8DOHiIw3QLK8oS+ZaT/Aone5X51CL+UVvgIVeEszcGu8+itg64orJss0FjxdvHVF zwQHwjtfAU+qFg+zr4DscqKDJMWyCPyYC6g7tdTcX5oZTqqw6zRdZSmQ2gFk5IsvrkE7 g9sL2VagPlA8bxykvsnMgHKY8033UsnEcrBGXaiHVuiTPCd0HEh2Wqv2g7rc6MDh/cig Hv4RzJ19cTTNDtaIRvdrsOxqxspN7BWjhe8JiIsKASwJE0fgopJIimaJGb21sd1zXA3D NJaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=giVT078E; 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 me9si5587165ejb.280.2019.09.29.07.03.55; Sun, 29 Sep 2019 07:04:23 -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=giVT078E; 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 S1730228AbfI2OCa (ORCPT + 99 others); Sun, 29 Sep 2019 10:02:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:45178 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730220AbfI2OC2 (ORCPT ); Sun, 29 Sep 2019 10:02:28 -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 92F362082F; Sun, 29 Sep 2019 14:02:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569765748; bh=LNhH+DAAmF6IDi+AxFJ4GguOaZjC2sVTm/JMgj4MUzI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=giVT078EOSZMBUuXL1O29XJzBN18Y9lzaHmQ9dcDTpdlUkdr8TyhQ+I4LNnnW2Me2 7Z/z3hNkQEpNhPrkvbEburaXLkSiX+KrSOy2Wn3vIC05F4zbbwjHtQqQYng2AEA4X6 V/Tv7bCIE1uBYelnYXTSSG15UoYdDjV7Zoq7uC3A= 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 5.2 38/45] ACPI: video: Add new hw_changes_brightness quirk, set it on PB Easynote MZ35 Date: Sun, 29 Sep 2019 15:56:06 +0200 Message-Id: <20190929135033.030560273@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190929135024.387033930@linuxfoundation.org> References: <20190929135024.387033930@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 9489ffc064117..4f325e47519f5 100644 --- a/drivers/acpi/acpi_video.c +++ b/drivers/acpi/acpi_video.c @@ -60,6 +60,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. @@ -405,6 +411,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 @@ -529,6 +543,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"), + }, + }, {} }; @@ -1612,6 +1641,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