From patchwork Wed Aug 1 13:49:00 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Tettamanti X-Patchwork-Id: 1264331 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 5FC33DF215 for ; Wed, 1 Aug 2012 13:49:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753473Ab2HANtI (ORCPT ); Wed, 1 Aug 2012 09:49:08 -0400 Received: from mail-wg0-f44.google.com ([74.125.82.44]:38053 "EHLO mail-wg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752681Ab2HANtH (ORCPT ); Wed, 1 Aug 2012 09:49:07 -0400 Received: by wgbdr13 with SMTP id dr13so6941308wgb.1 for ; Wed, 01 Aug 2012 06:49:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=aMdjAHXAKhlYJXatKCLyu/8rPmzS7XDupAZW2J003Yc=; b=TBRoeAWU86jmP5B9013bTcQeL2WEcuVe6O76XEQ7ucpvenJXnGTAewa5MFUGdI+3k6 zb6MjzrqZP6sHmQIuiQiaU4dJeOs+AkNNuW1+QvEueq4x2sqBZbAdZ9bFKK2Zz5w0O/P +6KlHWCVtwdjSsqSWHCbQPLgUi5/2QJeSyxO4UKe4Hfsf4vpvyAvK7OdkVze1ZaYMdC4 SXUh8chGxnx1MACb4PhJsAFuHSAJuTbtPjhEzmE5WsW33dGJF6qWeDJlxPXkLMBdy/9T nMcAblkFY7hISr4PYFOGeGzOJlhDvYB67R3I64PmdnIhmCJstetxd9M+WeDIwnlfyhEX SFmg== Received: by 10.180.78.99 with SMTP id a3mr12102513wix.15.1343828945541; Wed, 01 Aug 2012 06:49:05 -0700 (PDT) Received: from growl (seco.como.polimi.it. [131.175.57.192]) by mx.google.com with ESMTPS id w7sm28001184wiz.0.2012.08.01.06.49.04 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 01 Aug 2012 06:49:04 -0700 (PDT) Date: Wed, 1 Aug 2012 15:49:00 +0200 From: Luca Tettamanti To: Alex Deucher Cc: airlied@gmail.com, dri-devel@lists.freedesktop.org, Alex Deucher , joeyli , linux-acpi@vger.kernel.org, Zhang Rui , Len Brown Subject: [PATCH/RFC] drm/radeon: ACPI: veto the keypress on ATIF events Message-ID: <20120801134900.GA7909@growl> References: <20120728145626.GA6304@growl> <20120729130644.GA12378@growl> <20120730202449.GA5600@growl> <20120731200520.GA5425@growl> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org AMD ACPI interface may overload the standard event ACPI_VIDEO_NOTIFY_PROBE (0x81) to signal AMD-specific events. In such cases we don't want to send the keypress (KEY_SWITCHVIDEOMODE) to the userspace because the user did not press the mode switch key (the spurious keypress confuses the DE which usually changes the display configuration and messes up a dual-screen setup). This patch gives the radeon driver the chance to examine the event and block the keypress if the event is an "AMD event". Signed-off-by: Luca Tettamanti Acked-by: Alex Deucher Tested-by: Lee, Chun-Yi --- Any comment from ACPI front? drivers/acpi/video.c | 10 ++++++++-- drivers/gpu/drm/radeon/radeon_acpi.c | 7 ++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 1e0a9e1..a8592c4 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c @@ -1457,7 +1457,12 @@ static void acpi_video_bus_notify(struct acpi_device *device, u32 event) acpi_video_device_enumerate(video); acpi_video_device_rebind(video); acpi_bus_generate_proc_event(device, event, 0); - keycode = KEY_SWITCHVIDEOMODE; + /* This event is also overloaded by AMD ACPI interface, don't + * send the key press if the event has been handled elsewhere + * (e.g. radeon DRM driver). + */ + if (!acpi_notifier_call_chain(device, event, 0)) + keycode = KEY_SWITCHVIDEOMODE; break; case ACPI_VIDEO_NOTIFY_CYCLE: /* Cycle Display output hotkey pressed. */ @@ -1479,7 +1484,8 @@ static void acpi_video_bus_notify(struct acpi_device *device, u32 event) break; } - if (event != ACPI_VIDEO_NOTIFY_SWITCH) + if (event != ACPI_VIDEO_NOTIFY_SWITCH && + event != ACPI_VIDEO_NOTIFY_PROBE) acpi_notifier_call_chain(device, event, 0); if (keycode) { diff --git a/drivers/gpu/drm/radeon/radeon_acpi.c b/drivers/gpu/drm/radeon/radeon_acpi.c index 96de08d..ee0d29e 100644 --- a/drivers/gpu/drm/radeon/radeon_acpi.c +++ b/drivers/gpu/drm/radeon/radeon_acpi.c @@ -273,7 +273,12 @@ int radeon_atif_handler(struct radeon_device *rdev, } /* TODO: check other events */ - return NOTIFY_OK; + /* We've handled the event, stop the notifier chain. The ACPI interface + * overloads ACPI_VIDEO_NOTIFY_PROBE, we don't want to send that to + * userspace if the event was generated only to signal a SBIOS + * request. + */ + return NOTIFY_BAD; } /* Call all ACPI methods here */