From patchwork Tue Sep 30 06:10:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Lu X-Patchwork-Id: 5000621 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B0713BEEA6 for ; Tue, 30 Sep 2014 06:10:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B93AE2016C for ; Tue, 30 Sep 2014 06:10:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CDD902015D for ; Tue, 30 Sep 2014 06:10:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752629AbaI3GKW (ORCPT ); Tue, 30 Sep 2014 02:10:22 -0400 Received: from mga01.intel.com ([192.55.52.88]:35226 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751715AbaI3GKU (ORCPT ); Tue, 30 Sep 2014 02:10:20 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 29 Sep 2014 23:10:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,625,1406617200"; d="scan'208";a="598614706" Received: from aaronlu.sh.intel.com ([10.239.37.127]) by fmsmga001.fm.intel.com with ESMTP; 29 Sep 2014 23:10:18 -0700 Message-ID: <542A4949.2020208@intel.com> Date: Tue, 30 Sep 2014 14:10:17 +0800 From: Aaron Lu MIME-Version: 1.0 To: "Rafael J. Wysocki" , ntrrgc@gmail.com CC: ACPI Devel Mailing List Subject: [PATCH] ACPI / video: check _DOD list when creating backlight device Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The _DOD method lists which video output device is currently attached so we should only care about them and ignore others. An user recently reported that there are two acpi_video interfaces appeared on his system and one of them doesn't work. From the acpidump, it is found that there are more than one video output devices that have _BCM control method but the _DOD lists only one of them. So this patch checks if the video output device is in the _DOD list and will not create backlight device if it is not in the list. Also, we consider the broken _DOD case(reflected by the video->attached_count is 0) and do not change behaviour for those broken _DOD systems. Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=84111 Reported-and-tested-by: ntrrgc@gmail.com Signed-off-by: Aaron Lu --- drivers/acpi/video.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 7285c7f9a935..807a88a0f394 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c @@ -1154,6 +1154,23 @@ acpi_video_device_bind(struct acpi_video_bus *video, } } +static bool acpi_video_device_in_dod(struct acpi_video_device *device) +{ + struct acpi_video_bus *video = device->video; + int i; + + /* If we have a broken _DOD, no need to test */ + if (!video->attached_count) + return true; + + for (i = 0; i < video->attached_count; i++) { + if (video->attached_array[i].bind_info == device) + return true; + } + + return false; +} + /* * Arg: * video : video bus device @@ -1593,6 +1610,15 @@ static void acpi_video_dev_register_backlight(struct acpi_video_device *device) static int count; char *name; + /* + * Do not create backlight device for video output + * device that is not in the enumerated list. + */ + if (!acpi_video_device_in_dod(device)) { + dev_dbg(&device->dev->dev, "not in _DOD list, ignore\n"); + return; + } + result = acpi_video_init_brightness(device); if (result) return;