From owner-freebsd-mobile@FreeBSD.ORG  Fri Oct 19 18:47:55 2012
Return-Path: <owner-freebsd-mobile@FreeBSD.ORG>
Delivered-To: mobile@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
 by hub.freebsd.org (Postfix) with ESMTP id 7B52C4B7;
 Fri, 19 Oct 2012 18:47:55 +0000 (UTC)
 (envelope-from nox@jelal.kn-bremen.de)
Received: from smtp.kn-bremen.de (gelbbaer.kn-bremen.de [78.46.108.116])
 by mx1.freebsd.org (Postfix) with ESMTP id 0F9128FC0A;
 Fri, 19 Oct 2012 18:47:54 +0000 (UTC)
Received: by smtp.kn-bremen.de (Postfix, from userid 10)
 id D7A261E00107; Fri, 19 Oct 2012 20:47:46 +0200 (CEST)
Received: from triton8.kn-bremen.de (noident@localhost [127.0.0.1])
 by triton8.kn-bremen.de (8.14.4/8.14.4) with ESMTP id q9JIkHk8045126;
 Fri, 19 Oct 2012 20:46:17 +0200 (CEST)
 (envelope-from nox@triton8.kn-bremen.de)
Received: (from nox@localhost)
 by triton8.kn-bremen.de (8.14.4/8.14.3/Submit) id q9JIkHJI045125;
 Fri, 19 Oct 2012 20:46:17 +0200 (CEST) (envelope-from nox)
From: Juergen Lock <nox@jelal.kn-bremen.de>
Date: Fri, 19 Oct 2012 20:46:17 +0200
To: John Baldwin <jhb@freebsd.org>
Subject: Re: Dell acpi_video patch
Message-ID: <20121019184617.GA45092@triton8.kn-bremen.de>
References: <20121005215316.GA38707@triton8.kn-bremen.de>
 <201210180859.14457.jhb@freebsd.org>
 <20121018195723.GA10042@triton8.kn-bremen.de>
 <201210191114.10340.jhb@freebsd.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <201210191114.10340.jhb@freebsd.org>
User-Agent: Mutt/1.5.21 (2010-09-15)
Cc: avilla@freebsd.org, freebsd-acpi@freebsd.org,
 Juergen Lock <nox@jelal.kn-bremen.de>, mobile@freebsd.org
X-BeenThere: freebsd-mobile@freebsd.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Mobile computing with FreeBSD <freebsd-mobile.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/options/freebsd-mobile>,
 <mailto:freebsd-mobile-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-mobile>
List-Post: <mailto:freebsd-mobile@freebsd.org>
List-Help: <mailto:freebsd-mobile-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-mobile>,
 <mailto:freebsd-mobile-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 19 Oct 2012 18:47:56 -0000

On Fri, Oct 19, 2012 at 11:14:10AM -0400, John Baldwin wrote:
> On Thursday, October 18, 2012 3:57:23 pm Juergen Lock wrote:
> > On Thu, Oct 18, 2012 at 08:59:14AM -0400, John Baldwin wrote:
> > > On Friday, October 12, 2012 12:33:49 pm Juergen Lock wrote:
> > > > On Fri, Oct 12, 2012 at 10:06:17AM -0400, John Baldwin wrote:
> > > > > On Friday, October 05, 2012 5:53:16 pm Juergen Lock wrote:
> > > > > > Hi!
> > > > > > 
> > > > > >  I finally took a closer look why acpi_video found nothing on my
> > > > > > Dell laptop (Precision M4500), and came up with this patch:
> > > > > > 
> > > > > > --- sys/dev/acpica/acpi_video.c.orig
> > > > > > +++ sys/dev/acpica/acpi_video.c
> > > > > > @@ -906,7 +906,7 @@ vid_enum_outputs_subr(ACPI_HANDLE handle
> > > > > >  
> > > > > >  	for (i = 0; i < argset->dod_pkg->Package.Count; i++) {
> > > > > >  		if (acpi_PkgInt32(argset->dod_pkg, i, &val) == 0 &&
> > > > > > -		    (val & DOD_DEVID_MASK_FULL) == adr) {
> > > > > > +		    (val & (DOD_DEVID_MASK_FULL | 0x80000000)) == adr) {
> > > > > >  			argset->callback(handle, val, argset->context);
> > > > > >  			argset->count++;
> > > > > >  		}
> > > > > > 
> > > > > > which gives me:
> > > > > 
> > > > > I think this is correct, but in we need to do more to properly handle that 
> > > > > flag (DOD_DEVID_SCHEME_STD).  Specifically, we shouldn't trust any bits in the 
> > > > > device ID unless that bit is set (except for the special case of 
> > > > > DOD_DEVID_LCD) as per my reading of the _DOD description in the ACPI 3.0b 
> > > > > spec.  I think this larger patch will do that while also fixing your case:
> > > >
> > > > Thank you, yes that still works for me the same as my original patch:
> > > 
> > > Can you please test this updated patch as well: 
> 
> Sorry, one more request.  I think I want to commit just your fix separately,
> but I have a slightly different version of it.  Can you just double check
> this version:
> 
> Index: acpi_video.c
> ===================================================================
> --- acpi_video.c	(revision 241688)
> +++ acpi_video.c	(working copy)
> @@ -906,7 +906,8 @@ vid_enum_outputs_subr(ACPI_HANDLE handle, UINT32 l
>  
>  	for (i = 0; i < argset->dod_pkg->Package.Count; i++) {
>  		if (acpi_PkgInt32(argset->dod_pkg, i, &val) == 0 &&
> -		    (val & DOD_DEVID_MASK_FULL) == adr) {
> +		    (val & DOD_DEVID_MASK_FULL) ==
> +		    (adr & DOD_DEVID_MASK_FULL)) {
>  			argset->callback(handle, val, argset->context);
>  			argset->count++;
>  		}
> 
> -- 
> John Baldwin

Yup that still works the same:

% sysctl hw.acpi.video
hw.acpi.video.crt0.active: 0
hw.acpi.video.lcd0.active: 0
hw.acpi.video.lcd0.brightness: 100
hw.acpi.video.lcd0.fullpower: 100
hw.acpi.video.lcd0.economy: 46
hw.acpi.video.lcd0.levels: 100 46 0 6 13 20 26 33 40 46 53 60 66 73 80 86 93 100
hw.acpi.video.ext0.active: 0
hw.acpi.video.ext1.active: 0
hw.acpi.video.ext2.active: 0
hw.acpi.video.ext3.active: 0
% 

 Thanx, :)
	Juergen