Skip to contentSkip to conversation

Platform: x86: chromeos_laptop - Add support for Chromebook Pixel

PATCH In review Benson Leung 2 participants 8 messages Feb 21, 2013 x86 platform drivers

lore
Share & tools
lore
#0 lore raw

cover Platform: x86: chromeos_laptop - Add support for Chromebook Pixel

The following patch series will add support for the isl light sensor, atmel mxt touchpad, and atmel mxt touchscreen on the Chromebook Pixel.

[PATCH 1/6] Platform: x86: chromeos_laptop - add i915 gmbuses to [PATCH 2/6] Platform: x86: chromeos_laptop - Add a more general [PATCH 3/6] Platform: x86: chromeos_laptop - Add isl light sensor for [PATCH 4/6] Platform: x86: chromeos_laptop - Add support for probing [PATCH 5/6] Platform: x86: chromeos_laptop - Add Pixel Trackpad [PATCH 6/6] Platform: x86: chromeos_laptop - Add Pixel Touchscreen

This should be merged after the patch adding the HP Pavilion 14.
Platform: x86: chromeos_laptop - Add HP Pavilion 14

#1 lore raw

PATCH 1/6 Platform: x86: chromeos_laptop - add i915 gmbuses to adapter names

Add the two other i2c buses (vga and panel) from i915. Chromebook Pixel has input and light sensor devices on these busses.

---
 drivers/platform/x86/chromeos_laptop.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/platform/x86/chromeos_laptop.c +4 -0
index bc6599c..d223592 100644
@@ -34,11 +34,15 @@ static struct i2c_client *tp;
 
 const char *i2c_adapter_names[] = {
 	"SMBus I801 adapter",
+	"i915 gmbus vga",
+	"i915 gmbus panel",
 };
 
 /* Keep this enum consistent with i2c_adapter_names */
 enum i2c_adapter_type {
 	I2C_ADAPTER_SMBUS = 0,
+	I2C_ADAPTER_VGADDC,
+	I2C_ADAPTER_PANEL,
 };
 
 static struct i2c_board_info __initdata cyapa_device = {
Signature · 1 line
1.8.1.3
#2 lore raw

Re: [PATCH 1/6] Platform: x86: chromeos_laptop - add i915 gmbuses to adapter names

Quoted 2 lines · Benson Leung

Add the two other i2c buses (vga and panel) from i915. Chromebook Pixel has input and light sensor devices on these busses.

This is after you put the HDMI encoder on the system i2c bus on the CR-48? Whatever they're putting in the food there must be good. I'll queue these.

Signature · 1 line
Matthew Garrett | [email protected]
#3 lore raw

PATCH 2/6 Platform: x86: chromeos_laptop - Add a more general add_i2c_device

In reply to Benson Leung

This will allow us to assign devices to buses by the type enum.

---
 drivers/platform/x86/chromeos_laptop.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/platform/x86/chromeos_laptop.c +11 -3
index d223592..d585548 100644
@@ -148,16 +148,24 @@ static int __init find_i2c_adapter_num(enum i2c_adapter_type type)
  * info->addr.
  * Returns NULL if no device found.
  */
-static struct i2c_client __init *add_smbus_device(const char *name,
-						  struct i2c_board_info *info)
+static __init struct i2c_client *add_i2c_device(const char *name,
+						enum i2c_adapter_type type,
+						struct i2c_board_info *info)
 {
 	const unsigned short addr_list[] = { info->addr, I2C_CLIENT_END };
 	return __add_probed_i2c_device(name,
-				       find_i2c_adapter_num(I2C_ADAPTER_SMBUS),
+				       find_i2c_adapter_num(type),
 				       info,
 				       addr_list);
 }
 
+
+static struct i2c_client __init *add_smbus_device(const char *name,
+						  struct i2c_board_info *info)
+{
+	return add_i2c_device(name, I2C_ADAPTER_SMBUS, info);
+}
+
 static int __init setup_cyapa_smbus_tp(const struct dmi_system_id *id)
 {
 	/* add cyapa touchpad on smbus */
Signature · 1 line
1.8.1.3
#4 lore raw

PATCH 3/6 Platform: x86: chromeos_laptop - Add isl light sensor for Pixel

In reply to Benson Leung

The Chromebook Pixel uses an isl29023 ambient light sensor on the PANEL GMBus.

---
 drivers/platform/x86/chromeos_laptop.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
drivers/platform/x86/chromeos_laptop.c +16 -0
index d585548..3e405d7 100644
@@ -180,6 +180,14 @@ static int __init setup_isl29018_als(const struct dmi_system_id *id)
 	return 0;
 }
 
+static int __init setup_isl29023_als(const struct dmi_system_id *id)
+{
+	/* add isl29023 light sensor on Panel GMBus */
+	als = add_i2c_device("lightsensor", I2C_ADAPTER_PANEL,
+			     &isl_als_device);
+	return 0;
+}
+
 static int __init setup_tsl2583_als(const struct dmi_system_id *id)
 {
 	/* add tsl2583 light sensor on smbus */
@@ -212,6 +220,14 @@ static struct dmi_system_id __initdata chromeos_laptop_dmi_table[] = {
 		.callback = setup_isl29018_als,
 	},
 	{
+		.ident = "Chromebook Pixel - Light Sensor",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Link"),
+		},
+		.callback = setup_isl29023_als,
+	},
+	{
 		.ident = "Acer C7 Chromebook - Touchpad",
 		.matches = {
 			DMI_MATCH(DMI_PRODUCT_NAME, "Parrot"),
Signature · 1 line
1.8.1.3
#5 lore raw

PATCH 4/6 Platform: x86: chromeos_laptop - Add support for probing devices

In reply to Benson Leung

This will allow support for devices that may appear at more than one i2c address at boot time. The specific example is the atmel_mxt touch devices, which may appear at a different address if it comes up in bootloader mode.

---
 drivers/platform/x86/chromeos_laptop.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
drivers/platform/x86/chromeos_laptop.c +20 -0
index 3e405d7..f3a292b 100644
@@ -144,6 +144,26 @@ static int __init find_i2c_adapter_num(enum i2c_adapter_type type)
 }
 
 /*
+ * Takes a list of addresses in addrs as such :
+ * { addr1, ... , addrn, I2C_CLIENT_END };
+ * add_probed_i2c_device will use i2c_new_probed_device
+ * and probe for devices at all of the addresses listed.
+ * Returns NULL if no devices found.
+ * See Documentation/i2c/instantiating-devices for more information.
+ */
+static __init struct i2c_client *add_probed_i2c_device(
+		const char *name,
+		enum i2c_adapter_type type,
+		struct i2c_board_info *info,
+		const unsigned short *addrs)
+{
+	return __add_probed_i2c_device(name,
+				       find_i2c_adapter_num(type),
+				       info,
+				       addrs);
+}
+
+/*
  * Probes for a device at a single address, the one provided by
  * info->addr.
  * Returns NULL if no device found.
Signature · 1 line
1.8.1.3
#6 lore raw

PATCH 5/6 Platform: x86: chromeos_laptop - Add Pixel Trackpad

In reply to Benson Leung

Instantiate the atmel mxt224s trackpad on this system. The trackpad may appear at two possible addresses:
0x4b in operational mode.
0x25 in bootloader mode.

---
 drivers/platform/x86/chromeos_laptop.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
drivers/platform/x86/chromeos_laptop.c +29 -0
index f3a292b..febedc0 100644
@@ -25,6 +25,8 @@
 #include <linux/i2c.h>
 #include <linux/module.h>
 
+#define ATMEL_TP_I2C_ADDR	0x4b
+#define ATMEL_TP_I2C_BL_ADDR	0x25
 #define CYAPA_TP_I2C_ADDR	0x67
 #define ISL_ALS_I2C_ADDR	0x44
 #define TAOS_ALS_I2C_ADDR	0x29
@@ -62,6 +64,12 @@ static struct i2c_board_info __initdata tsl2563_als_device = {
 	I2C_BOARD_INFO("tsl2563", TAOS_ALS_I2C_ADDR),
 };
 
+static struct i2c_board_info __initdata atmel_224s_tp_device = {
+	I2C_BOARD_INFO("atmel_mxt_tp", ATMEL_TP_I2C_ADDR),
+	.platform_data = NULL,
+	.flags		= I2C_CLIENT_WAKE,
+};
+
 static struct i2c_client __init *__add_probed_i2c_device(
 		const char *name,
 		int bus,
@@ -193,6 +201,19 @@ static int __init setup_cyapa_smbus_tp(const struct dmi_system_id *id)
 	return 0;
 }
 
+static int __init setup_atmel_224s_tp(const struct dmi_system_id *id)
+{
+	const unsigned short addr_list[] = { ATMEL_TP_I2C_BL_ADDR,
+					     ATMEL_TP_I2C_ADDR,
+					     I2C_CLIENT_END };
+
+	/* add atmel mxt touchpad on VGA DDC GMBus */
+	tp = add_probed_i2c_device("trackpad", I2C_ADAPTER_VGADDC,
+				   &atmel_224s_tp_device, addr_list);
+	return 0;
+}
+
+
 static int __init setup_isl29018_als(const struct dmi_system_id *id)
 {
 	/* add isl29018 light sensor */
@@ -232,6 +253,14 @@ static struct dmi_system_id __initdata chromeos_laptop_dmi_table[] = {
 		.callback = setup_cyapa_smbus_tp,
 	},
 	{
+		.ident = "Chromebook Pixel - Touchpad",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Link"),
+		},
+		.callback = setup_atmel_224s_tp,
+	},
+	{
 		.ident = "Samsung Series 5 550 - Light Sensor",
 		.matches = {
 			DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG"),
Signature · 1 line
1.8.1.3
#7 lore raw

PATCH 6/6 Platform: x86: chromeos_laptop - Add Pixel Touchscreen

In reply to Benson Leung

From: Yufeng Shen <[email protected]>

Instantiate the atmel mxt1664s touchscreen on this system. The touchscreen may appear at two possible addresses:
0x4a in operational mode.
0x26 in bootloader mode.

---
 drivers/platform/x86/chromeos_laptop.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
drivers/platform/x86/chromeos_laptop.c +31 -0
index febedc0..93d6680 100644
@@ -27,12 +27,15 @@
 
 #define ATMEL_TP_I2C_ADDR	0x4b
 #define ATMEL_TP_I2C_BL_ADDR	0x25
+#define ATMEL_TS_I2C_ADDR	0x4a
+#define ATMEL_TS_I2C_BL_ADDR	0x26
 #define CYAPA_TP_I2C_ADDR	0x67
 #define ISL_ALS_I2C_ADDR	0x44
 #define TAOS_ALS_I2C_ADDR	0x29
 
 static struct i2c_client *als;
 static struct i2c_client *tp;
+static struct i2c_client *ts;
 
 const char *i2c_adapter_names[] = {
 	"SMBus I801 adapter",
@@ -70,6 +73,12 @@ static struct i2c_board_info __initdata atmel_224s_tp_device = {
 	.flags		= I2C_CLIENT_WAKE,
 };
 
+static struct i2c_board_info __initdata atmel_1664s_device = {
+	I2C_BOARD_INFO("atmel_mxt_ts", ATMEL_TS_I2C_ADDR),
+	.platform_data = NULL,
+	.flags		= I2C_CLIENT_WAKE,
+};
+
 static struct i2c_client __init *__add_probed_i2c_device(
 		const char *name,
 		int bus,
@@ -213,6 +222,18 @@ static int __init setup_atmel_224s_tp(const struct dmi_system_id *id)
 	return 0;
 }
 
+static int __init setup_atmel_1664s_ts(const struct dmi_system_id *id)
+{
+	const unsigned short addr_list[] = { ATMEL_TS_I2C_BL_ADDR,
+					     ATMEL_TS_I2C_ADDR,
+					     I2C_CLIENT_END };
+
+	/* add atmel mxt touch device on PANEL GMBus */
+	ts = add_probed_i2c_device("touchscreen", I2C_ADAPTER_PANEL,
+				   &atmel_1664s_device, addr_list);
+	return 0;
+}
+
 
 static int __init setup_isl29018_als(const struct dmi_system_id *id)
 {
@@ -253,6 +274,14 @@ static struct dmi_system_id __initdata chromeos_laptop_dmi_table[] = {
 		.callback = setup_cyapa_smbus_tp,
 	},
 	{
+		.ident = "Chromebook Pixel - Touchscreen",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Link"),
+		},
+		.callback = setup_atmel_1664s_ts,
+	},
+	{
 		.ident = "Chromebook Pixel - Touchpad",
 		.matches = {
 			DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"),
@@ -330,6 +359,8 @@ static void __exit chromeos_laptop_exit(void)
 		i2c_unregister_device(als);
 	if (tp)
 		i2c_unregister_device(tp);
+	if (ts)
+		i2c_unregister_device(ts);
 }
 
 module_init(chromeos_laptop_init);
Signature · 1 line
1.8.1.3