Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3421438pxf; Mon, 29 Mar 2021 01:34:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxRGpjBK0lLPOdqHjDiR12xPKSna7dzwsFbMwzVhsdbZecti65GFAZp0oonKpM6qPSYH+xk X-Received: by 2002:a17:906:5450:: with SMTP id d16mr27546024ejp.274.1617006881435; Mon, 29 Mar 2021 01:34:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617006881; cv=none; d=google.com; s=arc-20160816; b=woD1Ys7Qc6r+HhAZx3lDIlfP7jBPAE9ubOvstcysesYoN42ETOZG+8fSp2KGrzaRrK eLmFNRbpmjfsJoTBgnnNDsKb4VjhtfjHoK1MkknZWagVeKVI4q+XsDQ+xVP9pBCV3f4P VlI9N7KMkFxX25FVTFk6THkjOF/8fVsf6dVZnzGo9omexDXA43wvNHDGB22MrrOMLpK7 VeUV6UDIVcOwkTLmv1jidYtXQfznrC6cQoTu8k9Wf/zxN0txqyh3Ra5gp4Qg5TXiZsWE zymz915jd/QvUmDuYrrSiAlViVnwiBA8G/y3Xo1fvVGvILCXlHoVJppGQt3wpJiAsjFk 72ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Xld1oKpGs0JZtww41KERhmXl/7bk5856e05ATYApsG8=; b=uE/OUs7HjOai5Zk9aA2zlhPe5u/Uqw51c9wXvN0MO0ncyjJgcInFX7VMFTQ5M5VUGw DoorKjJAaiCam+MAFXFD6d8llN+uSY3S3PTBG6fC1XxoksRKUiy2G4FQxeVClsUd+kIw knGUEhmYCiHgw2zvmYM23BSLvwrVLovxw6F9FooNpNyRUuEkudp57zonNC2qATrXWIsK WNqLklBlRpSJLAqDwzqz6FiFtlyxTj36JgsKkRERJlSGJn1fhuZa8u/5wOWwbbPHcyjT /GoErjwpz20vs77SYDDCSTTJ309b0KpwJeEOBRncYV2NXw5nis/3s/iKiNn0onBJoU/C 6Mxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1bTzvET3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m26si12627860edr.603.2021.03.29.01.34.19; Mon, 29 Mar 2021 01:34:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1bTzvET3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234750AbhC2Idf (ORCPT + 99 others); Mon, 29 Mar 2021 04:33:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:37830 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233014AbhC2IUw (ORCPT ); Mon, 29 Mar 2021 04:20:52 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6CE4061964; Mon, 29 Mar 2021 08:20:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1617006051; bh=P/OFSjQAwsXIXLJPAKu1SZ6A04vfJzoRTPx4IfTHktY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1bTzvET3x0cjIBT/5llmH8y/1Fvjqk6xSJvA0GjYmJ+BPRnuMcwxUFvTu7JHJNVxC sOO05nV2nKwgnxbSaNPg8oPVvcdqWN0w+tW9i6nH/oalAYjqW32nFYa8lW4Pbt/GwP jV+BDzktgguVcfB3dq6A4jZ0+2ednnwI50lHvcjo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede Subject: [PATCH 5.10 066/221] platform/x86: intel-vbtn: Stop reporting SW_DOCK events Date: Mon, 29 Mar 2021 09:56:37 +0200 Message-Id: <20210329075631.385559835@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210329075629.172032742@linuxfoundation.org> References: <20210329075629.172032742@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hans de Goede commit 538d2dd0b9920334e6596977a664e9e7bac73703 upstream. Stop reporting SW_DOCK events because this breaks suspend-on-lid-close. SW_DOCK should only be reported for docking stations, but all the DSDTs in my DSDT collection which use the intel-vbtn code, always seem to use this for 2-in-1s / convertibles and set SW_DOCK=1 when in laptop-mode (in tandem with setting SW_TABLET_MODE=0). This causes userspace to think the laptop is docked to a port-replicator and to disable suspend-on-lid-close, which is undesirable. Map the dock events to KEY_IGNORE to avoid this broken SW_DOCK reporting. Note this may theoretically cause us to stop reporting SW_DOCK on some device where the 0xCA and 0xCB intel-vbtn events are actually used for reporting docking to a classic docking-station / port-replicator but I'm not aware of any such devices. Also the most important thing is that we only report SW_DOCK when it reliably reports being docked to a classic docking-station without any false positives, which clearly is not the case here. If there is a chance of reporting false positives then it is better to not report SW_DOCK at all. Cc: stable@vger.kernel.org Signed-off-by: Hans de Goede Link: https://lore.kernel.org/r/20210321163513.72328-1-hdegoede@redhat.com Signed-off-by: Greg Kroah-Hartman --- drivers/platform/x86/intel-vbtn.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) --- a/drivers/platform/x86/intel-vbtn.c +++ b/drivers/platform/x86/intel-vbtn.c @@ -47,8 +47,16 @@ static const struct key_entry intel_vbtn }; static const struct key_entry intel_vbtn_switchmap[] = { - { KE_SW, 0xCA, { .sw = { SW_DOCK, 1 } } }, /* Docked */ - { KE_SW, 0xCB, { .sw = { SW_DOCK, 0 } } }, /* Undocked */ + /* + * SW_DOCK should only be reported for docking stations, but DSDTs using the + * intel-vbtn code, always seem to use this for 2-in-1s / convertibles and set + * SW_DOCK=1 when in laptop-mode (in tandem with setting SW_TABLET_MODE=0). + * This causes userspace to think the laptop is docked to a port-replicator + * and to disable suspend-on-lid-close, which is undesirable. + * Map the dock events to KEY_IGNORE to avoid this broken SW_DOCK reporting. + */ + { KE_IGNORE, 0xCA, { .sw = { SW_DOCK, 1 } } }, /* Docked */ + { KE_IGNORE, 0xCB, { .sw = { SW_DOCK, 0 } } }, /* Undocked */ { KE_SW, 0xCC, { .sw = { SW_TABLET_MODE, 1 } } }, /* Tablet */ { KE_SW, 0xCD, { .sw = { SW_TABLET_MODE, 0 } } }, /* Laptop */ };