Skip to contentSkip to conversation

Add shuttle-wmi driver

PATCH New Herton Ronaldo Krzesinski 1 participant 2 messages Dec 15, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 Add shuttle-wmi driver

This adds a new platform driver for shuttle machines. On some desktop machines, shuttle is using laptop hardware, but without laptop keyboard. Thus, for some features like turn on/off webcam, an way is need to control the hardware. The driver uses the ACPI-WMI interface provided to export available features through sysfs and other subsystems. The driver isn't limited to desktop machines, in notebooks with similar firmware, this driver can be used too (although not necessary).

---
 .../ABI/testing/sysfs-platform-shuttle-wmi         |   72 ++
 MAINTAINERS                                        |    6 +
 drivers/platform/x86/Kconfig                       |   15 +
 drivers/platform/x86/Makefile                      |    1 +
 drivers/platform/x86/shuttle-wmi.c                 | 1297 ++++++++++++++++++++
 5 files changed, 1391 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-platform-shuttle-wmi
 create mode 100644 drivers/platform/x86/shuttle-wmi.c

changes from v2:
- address previous reviewing comments.
- create sysfs attributes dynamically, as some firmware may have different features or command numbers.
- add support for more shuttle machines.
- lightbar led for now is in debug fs, none of the machines I have report any brightness value change in supposed 0x759 address, and they don't have the lightbar, so can't test.
- I discovered that wireless presence is now detected using a bit at address 0x45a, so I'm using that to create or not a rfkill. The machines I have don't have 3g/bluetooth support, so I don't know their bits, I left a message that's printed once to help discover it if someone can test it on a machine where it has these devices.

Documentation/ABI/testing/sysfs-platform-shuttle-wmi new file +72 -0
new file mode 100644
index 0000000..06b1d69
@@ -0,0 +1,72 @@
+What:		/sys/devices/platform/shuttle_wmi/lcd_auto_adjust
+Date:		December 2010
+KernelVersion:	2.6.33
+Contact:	"Herton Ronaldo Krzesinski" <[email protected]>
+Description:
+		This is a write only option (accepts any single value, eg.
+		"echo 1 > lcd_auto_adjust") that starts LCD auto-adjust
+		function, if the machine has this function enabled. Some
+		shuttle machines have LCD attached to analog VGA connector,
+		so uses/needs auto-adjust.
+
+What:		/sys/devices/platform/shuttle_wmi/model_name
+Date:		December 2010
+KernelVersion:	2.6.33
+Contact:	"Herton Ronaldo Krzesinski" <[email protected]>
+Description:
+		This is a read only attribute which outputs a string with model
+		name of the machine. When shuttle-wmi can't determine which
+		model it is, "Unknown" is returned. Otherwise, the possible
+		models are "Shuttle MA", "Shuttle DA18IE", "Shuttle DA18IM",
+		"Shuttle X50 V2", "Positivo A14IE01", "Positivo P13",
+		"Positivo P14".
+
+What:		/sys/devices/platform/shuttle_wmi/panel_set_default
+Date:		December 2010
+KernelVersion:	2.6.33
+Contact:	"Herton Ronaldo Krzesinski" <[email protected]>
+Description:
+		This is a write only option (accepts any single value, eg.
+		"echo 1 > panel_set_default"). Probably resets panel/lcd to
+		default configuration, function not explained in shuttle wmi
+		documentation. It also starts an auto adjust and color adjust
+		cycle. The function should only work in shuttle machines with
+		LCD attached to an analog VGA connector.
+
+What:		/sys/devices/platform/shuttle_wmi/powersave
+Date:		December 2010
+KernelVersion:	2.6.33
+Contact:	"Herton Ronaldo Krzesinski" <[email protected]>
+Description:
+		Control powersave state. 1 means on, 0 means off.
+		When enabled, it basically forces the cpu to stay on powersave
+		state (only works if cpu has P-states support, it is similar to
+		powersave governor in cpufreq) when machine is only running on
+		battery. If not running on battery, this function isn't expected
+		to work, any attempt to enable this returns -EIO.
+
+What:		/sys/devices/platform/shuttle_wmi/touchpad_off
+Date:		December 2010
+KernelVersion:	2.6.33
+Contact:	"Herton Ronaldo Krzesinski" <[email protected]>
+Description:
+		Control touchpad state. 1 means off, 0 means on.
+
+What:		/sys/devices/platform/shuttle_wmi/webcam
+Date:		December 2010
+KernelVersion:	2.6.33
+Contact:	"Herton Ronaldo Krzesinski" <[email protected]>
+Description:
+		Control webcam state. 1 means on, 0 means off.
+
+What:		/sys/devices/platform/shuttle_wmi/white_balance
+Date:		December 2010
+KernelVersion:	2.6.33
+Contact:	"Herton Ronaldo Krzesinski" <[email protected]>
+Description:
+		This is a write only option (accepts any single value, eg.
+		"echo 1 > white_balance"). Probably triggers an automatic
+		white balance adjustment for lcd, function not explained in
+		shuttle	wmi documentation. It also starts an auto adjust and
+		color adjust cycle. The function should only work in shuttle
+		machines with LCD attached to an analog VGA connector.
MAINTAINERS +6 -0
index d0c63a3..6457198 100644
@@ -5375,6 +5375,12 @@ F:	drivers/serial/serial_lh7a40x.c
 F:	drivers/usb/gadget/lh7a40*
 F:	drivers/usb/host/ohci-lh7a40*
 
+SHUTTLE WMI EXTRAS DRIVER
+M:	Herton Ronaldo Krzesinski <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	drivers/platform/x86/shuttle-wmi.c
+
 SIMPLE FIRMWARE INTERFACE (SFI)
 M:	Len Brown <[email protected]>
 L:	[email protected]
drivers/platform/x86/Kconfig +15 -0
index 4c7f8b9..43ca590 100644
@@ -651,4 +651,19 @@ config XO1_RFKILL
 	  Support for enabling/disabling the WLAN interface on the OLPC XO-1
 	  laptop.
 
+config SHUTTLE_WMI
+	tristate "Shuttle WMI Extras Driver"
+	depends on ACPI_WMI
+	depends on BACKLIGHT_CLASS_DEVICE
+	depends on RFKILL
+	depends on INPUT
+	select INPUT_SPARSEKMAP
+	---help---
+	  This is a driver for the WMI interface present on some Shuttle
+	  machines. It adds controls for wireless, bluetooth and 3g radios,
+	  webcam switch, backlight controls, among others.
+
+	  If you have a Shuttle machine with ACPI-WMI interface say Y or M
+	  here.
+
 endif # X86_PLATFORM_DEVICES
drivers/platform/x86/Makefile +1 -0
index 4ec4ff8..5fb4ed6 100644
@@ -34,3 +34,4 @@ obj-$(CONFIG_INTEL_IPS)		+= intel_ips.o
 obj-$(CONFIG_GPIO_INTEL_PMIC)	+= intel_pmic_gpio.o
 obj-$(CONFIG_XO1_RFKILL)	+= xo1-rfkill.o
 obj-$(CONFIG_IBM_RTL)		+= ibm_rtl.o
+obj-$(CONFIG_SHUTTLE_WMI)	+= shuttle-wmi.o
drivers/platform/x86/shuttle-wmi.c new file +1297 -0

1,297 lines not on this page · raw message

Signature · 1 line
1.7.3.3
#1 lore raw

PATCH 2/2 ACPI video: add initial blacklist to use vendor drivers for backlight

While developing shuttle-wmi, I discovered some shuttle machines where its acpi video interface doesn't work properly. Changes to the brightness value don't reflect actual hardware changes. For these devices, a quirk is done in shuttle-wmi driver, where brightness values are then changed properly in the hardware too.

This adds a list for shuttle devices I tested which doesn't have working backlight support in acpi video, but works with workaround done in shuttle-wmi driver, so for them, add dmi blacklist to use vendor driver.

---
 drivers/acpi/video_detect.c |   56 +++++++++++++++++++++++++++++++++++-------
 1 files changed, 46 insertions(+), 10 deletions(-)
drivers/acpi/video_detect.c +46 -10
index b836761..39814d2 100644
@@ -132,6 +132,45 @@ find_video(acpi_handle handle, u32 lvl, void *context, void **rv)
 	return AE_OK;
 }
 
+static struct dmi_system_id backlight_vendor_dmi_table[] = {
+	{
+		.ident = "Positivo M13",
+		.matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "POSITIVO"),
+			DMI_MATCH(DMI_BOARD_NAME, "M13"),
+		},
+	},
+	{
+		.ident = "Positivo M14",
+		.matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "POSITIVO"),
+			DMI_MATCH(DMI_BOARD_NAME, "M14"),
+		},
+	},
+	{
+		.ident = "Positivo A14IM01",
+		.matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "POSITIVO"),
+			DMI_MATCH(DMI_BOARD_NAME, "A14IM01"),
+		},
+	},
+	{
+		.ident = "Positivo J14IM21",
+		.matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "POSITIVO"),
+			DMI_MATCH(DMI_BOARD_NAME, "J14IM21"),
+		},
+	},
+	{
+		.ident = "Positivo SINM10BZ",
+		.matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Positivo Informatica SA"),
+			DMI_MATCH(DMI_BOARD_NAME, "POS-SINM10BZ"),
+		},
+	},
+	{}
+};
+
 /*
  * Returns the video capabilities of a specific ACPI graphics device
  *
@@ -156,16 +195,13 @@ long acpi_video_get_capabilities(acpi_handle graphics_handle)
 		/* There might be boot param flags set already... */
 		acpi_video_support |= caps;
 		acpi_video_caps_checked = 1;
-		/* Add blacklists here. Be careful to use the right *DMI* bits
-		 * to still be able to override logic via boot params, e.g.:
-		 *
-		 *   if (dmi_name_in_vendors("XY")) {
-		 *	acpi_video_support |=
-		 *		ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VENDOR;
-		 *	acpi_video_support |=
-		 *		ACPI_VIDEO_BACKLIGHT_DMI_VENDOR;
-		 *}
-		 */
+		/* Add blacklists here (systems which don't work properly with
+		 * acpi video and needs a special platform driver) */
+		if (dmi_check_system(backlight_vendor_dmi_table))
+			acpi_video_support |= ACPI_VIDEO_BACKLIGHT_DMI_VENDOR;
+		/*if (dmi_check_system(output_switching_vendor_dmi_table))
+			acpi_video_support |=
+				ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VENDOR;*/
 	} else {
 		status = acpi_bus_get_device(graphics_handle, &tmp_dev);
 		if (ACPI_FAILURE(status)) {
Signature · 1 line
1.7.3.3