Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Feb 2015 07:34:33 +0000 (UTC)
From:      Justin Hibbits <jhibbits@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r278945 - head/sys/powerpc/powermac
Message-ID:  <201502180734.t1I7YXrY010710@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhibbits
Date: Wed Feb 18 07:34:32 2015
New Revision: 278945
URL: https://svnweb.freebsd.org/changeset/base/278945

Log:
  Match the right backlight driver.
  
  Some ATI-based PowerBooks use the string 'mnca' in the backlight controller
  device tree entry, so account for this and don't use nVidia when it's not an
  nVidia device.
  
  MFC after:	3 weeks

Modified:
  head/sys/powerpc/powermac/atibl.c
  head/sys/powerpc/powermac/nvbl.c

Modified: head/sys/powerpc/powermac/atibl.c
==============================================================================
--- head/sys/powerpc/powermac/atibl.c	Wed Feb 18 06:55:11 2015	(r278944)
+++ head/sys/powerpc/powermac/atibl.c	Wed Feb 18 07:34:32 2015	(r278945)
@@ -38,6 +38,11 @@ __FBSDID("$FreeBSD$");
 #include <machine/bus.h>
 
 #include <dev/ofw/openfirm.h>
+#include <dev/pci/pcivar.h>
+
+#ifndef PCI_VENDOR_ID_ATI
+#define PCI_VENDOR_ID_ATI 0x1002
+#endif
 
 /* From the xf86-video-ati driver's radeon_reg.h */
 #define RADEON_LVDS_GEN_CNTL         0x02d0
@@ -121,7 +126,9 @@ atibl_probe(device_t dev)
 	if (OF_getprop(handle, "backlight-control", &control, sizeof(control)) < 0)
 		return (ENXIO);
 
-	if (strcmp(control, "ati") != 0)
+	if (strcmp(control, "ati") != 0 &&
+	    (strcmp(control, "mnca") != 0 ||
+	    pci_get_vendor(device_get_parent(dev)) != 0x1002))
 		return (ENXIO);
 
 	device_set_desc(dev, "PowerBook backlight for ATI graphics");

Modified: head/sys/powerpc/powermac/nvbl.c
==============================================================================
--- head/sys/powerpc/powermac/nvbl.c	Wed Feb 18 06:55:11 2015	(r278944)
+++ head/sys/powerpc/powermac/nvbl.c	Wed Feb 18 07:34:32 2015	(r278945)
@@ -38,6 +38,9 @@ __FBSDID("$FreeBSD$");
 #include <machine/bus.h>
 
 #include <dev/ofw/openfirm.h>
+#include <dev/pci/pcivar.h>
+
+#define PCI_VENDOR_ID_NVIDIA	0x10de
 
 #define NVIDIA_BRIGHT_MIN     (0x0ec)
 #define NVIDIA_BRIGHT_MAX     (0x538)
@@ -102,7 +105,8 @@ nvbl_probe(device_t dev)
 	if (OF_getprop(handle, "backlight-control", &control, sizeof(control)) < 0)
 		return (ENXIO);
 
-	if (strcmp(control, "mnca") != 0)
+	if ((strcmp(control, "mnca") != 0) ||
+	    pci_get_vendor(device_get_parent(dev)) != PCI_VENDOR_ID_NVIDIA)
 		return (ENXIO);
 
 	device_set_desc(dev, "PowerBook backlight for nVidia graphics");



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201502180734.t1I7YXrY010710>