Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F178112494
D57767.1795995993.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
3 KB
Referenced Files
None
Subscribers
None
D57767.1795995993.diff
View Options
diff --git a/sys/dev/usb/video/uvideo.c b/sys/dev/usb/video/uvideo.c
--- a/sys/dev/usb/video/uvideo.c
+++ b/sys/dev/usb/video/uvideo.c
@@ -51,6 +51,13 @@
#include <dev/video/video.h>
#include "video_if.h"
+#include "opt_acpi.h"
+
+#ifdef DEV_ACPI
+#include <sys/sbuf.h>
+#include <contrib/dev/acpica/include/acpi.h>
+#include <dev/acpica/acpivar.h>
+#endif
#define USB_DEBUG_VAR uvideo_debug
#include <dev/usb/usb_debug.h>
@@ -236,6 +243,13 @@
const struct uvideo_quirk *sc_quirk;
+#ifdef DEV_ACPI
+ ACPI_HANDLE sc_acpihandle;
+ uint8_t sc_pld[ACPI_PLD_BUFFER_SIZE];
+ size_t sc_pld_len;
+ char sc_acpiname[256];
+#endif
+
void (*sc_decode_stream_header)(
struct uvideo_softc *, uint8_t *, int);
};
@@ -632,6 +646,9 @@
DRIVER_MODULE(uvideo, uhub, uvideo_driver, NULL, NULL);
MODULE_DEPEND(uvideo, usb, 1, 1, 1);
MODULE_DEPEND(uvideo, video, 1, 1, 1);
+#ifdef DEV_ACPI
+MODULE_DEPEND(uvideo, acpi, 1, 1, 1);
+#endif
MODULE_VERSION(uvideo, 1);
USB_PNP_HOST_INFO(uvideo_devs);
@@ -730,6 +747,73 @@
return (usbd_lookup_id_by_uaa(uvideo_devs, sizeof(uvideo_devs), uaa));
}
+#ifdef DEV_ACPI
+static int acpi_uvideo_info_sysctl(SYSCTL_HANDLER_ARGS)
+{
+ struct uvideo_softc *sc = oidp->oid_arg1;
+ struct sbuf sb;
+ int error;
+
+ sbuf_new_for_sysctl(&sb, NULL, 256, req);
+
+ acpi_get_pld_info(&sb, sc->sc_pld, sc->sc_pld_len);
+ error = sbuf_finish(&sb);
+ sbuf_delete(&sb);
+ return (error);
+}
+
+static void uvideo_acpi_attach(device_t dev, int port, int iface_index)
+{
+ ACPI_HANDLE ah;
+ ACPI_HANDLE devah = acpi_get_handle(dev);
+ ACPI_BUFFER buf;
+ struct uvideo_softc *sc = device_get_softc(dev);
+ ACPI_INTEGER camadr ;
+ struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(dev);
+ struct sysctl_oid_list *tree = SYSCTL_CHILDREN(device_get_sysctl_tree(dev));
+
+ /*
+ * For a function within a composite USB device, the ACPI
+ * address is the sum of the USB port number and the first
+ * interface number of the function.
+ *
+ * See "ACPI namespace hierarchy and _ADR for embedded
+ * USB devices" in the Microsoft ACPI firmware guidelines.
+ */
+ camadr = port + iface_index;
+
+ if (devah == NULL)
+ return;
+
+ if (ACPI_SUCCESS(acpi_find_child_by_adr(devah, &ah, camadr)) && ah){
+ sc->sc_acpihandle = ah;
+
+ buf.Pointer = sc->sc_acpiname;
+ buf.Length = sizeof(sc->sc_acpiname);
+ if(ACPI_SUCCESS(AcpiGetName(ah, ACPI_FULL_PATHNAME, &buf))) {
+ SYSCTL_ADD_STRING(ctx, tree, OID_AUTO, "acpi_handle",
+ CTLFLAG_RD|CTLFLAG_MPSAFE,
+ sc->sc_acpiname, buf.Length, "Camera Handle");
+ }
+
+ sc->sc_pld_len = acpi_add_pld_sysctl(ah, ctx, tree, sc->sc_pld);
+ SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "info",
+ CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE,
+ sc, 0, acpi_uvideo_info_sysctl, "A", "camera information");
+ }
+}
+
+static void uvideo_acpi_detach(device_t dev)
+{
+}
+#else
+static void uvideo_acpi_attach(device_t dev, int port, int iface_index)
+{
+}
+static void uvideo_acpi_detach(device_t dev)
+{
+}
+#endif
static int
uvideo_attach(device_t dev)
{
@@ -867,6 +951,8 @@
goto detach;
}
+ uvideo_acpi_attach(dev, uaa->port, uaa->info.bIfaceNum);
+
return (0);
detach:
@@ -899,6 +985,8 @@
mtx_destroy(&sc->sc_mtx);
+ uvideo_acpi_detach(dev);
+
return (0);
}
diff --git a/sys/modules/usb/uvideo/Makefile b/sys/modules/usb/uvideo/Makefile
--- a/sys/modules/usb/uvideo/Makefile
+++ b/sys/modules/usb/uvideo/Makefile
@@ -6,6 +6,7 @@
SRCS= opt_bus.h opt_usb.h device_if.h \
bus_if.h usb_if.h usbdevs.h \
video_if.h \
+ opt_acpi.h acpi_if.h\
uvideo.c
.include <bsd.kmod.mk>
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 29, 11:46 PM (10 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42097853
Default Alt Text
D57767.1795995993.diff (3 KB)
Attached To
Mode
D57767: uvideo: bind ACPI handle.
Attached
Detach File
Event Timeline