diff --git a/Documentation/devicetree/bindings/mfd/asus-ec.yaml b/Documentation/devicetree/bindings/mfd/asus-ec.yaml index 5ab35db90daf3..bfb76fa88a063 100644 --- a/Documentation/devicetree/bindings/mfd/asus-ec.yaml +++ b/Documentation/devicetree/bindings/mfd/asus-ec.yaml @@ -17,8 +17,11 @@ maintainers: properties: compatible: - const: asus,ec - + items: + - enum: + - asus,pad-ec # Pad part of Asus Transformer + - asus,dock-ec # Dock part of Asus Transformer + - const: asus,ec reg: maxItems: 1 @@ -87,7 +90,7 @@ examples: #size-cells = <0>; embedded-controller@15 { - compatible = "asus,ec"; + compatible = "asus,pad-ec", "asus,ec"; reg = <0x15>; interrupt-parent = <&gpio>; diff --git a/arch/arm/boot/dts/tegra20-asus-tf101.dts b/arch/arm/boot/dts/tegra20-asus-tf101.dts index 9fe6a2b6a02fa..b9e5aee4d3c33 100644 --- a/arch/arm/boot/dts/tegra20-asus-tf101.dts +++ b/arch/arm/boot/dts/tegra20-asus-tf101.dts @@ -580,7 +580,7 @@ i2c-parent = <&lvds_ddc>; embedded-controller@19 { - compatible = "asus,ec"; + compatible = "asus,dock-ec", "asus,ec"; reg = <0x19>; interrupt-parent = <&gpio>; @@ -589,9 +589,7 @@ request-gpio = <&gpio TEGRA_GPIO(S, 3) GPIO_ACTIVE_LOW>; asus,dockram = <&dockram_dec>; - dock_battery: battery { - charge-full-design = <2260>; /* mAh */ - }; + monitored-battery = <&dock_battery>; }; dockram_dec: dockram@1b { @@ -889,6 +887,13 @@ }; }; + dock_battery: dock-battery { + compatible = "simple-battery"; + charge-full-design-microamp-hours = <3300000>; + energy-full-design-microwatt-hours = <24000000>; + operating-range-celsius = <0 45>; + }; + gpio-keys { compatible = "gpio-keys"; diff --git a/arch/arm/boot/dts/tegra30-asus-tf300t.dts b/arch/arm/boot/dts/tegra30-asus-tf300t.dts index 1b6e3f5d27757..6c4f03115ed09 100644 --- a/arch/arm/boot/dts/tegra30-asus-tf300t.dts +++ b/arch/arm/boot/dts/tegra30-asus-tf300t.dts @@ -118,12 +118,19 @@ micdet-cfg = <0>; micdet-delay = <100>; - gpio-cfg = <0xffffffff 0xffffffff 0 0xffffffff 0xffffffff>; - AVDD-supply = <&vdd_3v3_sys>; - CPVDD-supply = <&vdd_3v3_sys>; - DBVDD-supply = <&vdd_3v3_sys>; - DCVDD-supply = <&vdd_3v3_sys>; + gpio-cfg = < + 0xffffffff + 0xffffffff + 0x00000000 + 0xffffffff /* Interrupt, output */ + 0xffffffff /* BCLK, input, active high */ + >; + + AVDD-supply = <&vdd_1v8_vio>; + CPVDD-supply = <&vdd_1v8_vio>; + DBVDD-supply = <&vdd_1v8_vio>; + DCVDD-supply = <&vdd_1v8_vio>; }; }; @@ -220,6 +227,7 @@ nvidia,audio-codec = <&wm8903>; nvidia,spkr-en-gpios = <&wm8903 2 GPIO_ACTIVE_HIGH>; + nvidia,headset; }; memory-controller@7000f000 { diff --git a/arch/arm/boot/dts/tegra30-asus-transformer-common.dtsi b/arch/arm/boot/dts/tegra30-asus-transformer-common.dtsi index c861b4b85b1a8..ca44a8ecdff2e 100644 --- a/arch/arm/boot/dts/tegra30-asus-transformer-common.dtsi +++ b/arch/arm/boot/dts/tegra30-asus-transformer-common.dtsi @@ -1059,7 +1059,7 @@ /* Nuvoton NPCE795LA0BX embedded controller */ embedded-controller@15 { - compatible = "asus,ec"; + compatible = "asus,pad-ec", "asus,ec"; reg = <0x15>; interrupt-parent = <&gpio>; @@ -1091,7 +1091,7 @@ i2c-parent = <&i2c2>; embedded-controller@19 { - compatible = "asus,ec"; + compatible = "asus,dock-ec", "asus,ec"; reg = <0x19>; interrupt-parent = <&gpio>; @@ -1207,9 +1207,9 @@ vcc1-supply = <&vdd_5v0_bat>; vcc2-supply = <&vdd_5v0_bat>; vcc3-supply = <&vdd_1v8_vio>; - vcc4-supply = <&vdd_5v0_bat>; /* ldo5 unused by tf */ + vcc4-supply = <&vdd_5v0_bat>; vcc5-supply = <&vdd_5v0_bat>; - vcc6-supply = <&vdd2_reg>; + vcc6-supply = <&vddio_ddr>; vcc7-supply = <&vdd_5v0_bat>; vccio-supply = <&vdd_5v0_bat>; @@ -1229,10 +1229,10 @@ ti,regulator-ext-sleep-control = <8>; }; - vdd2_reg: vdd2 { + vddio_ddr: vdd2 { regulator-name = "vddio_ddr"; - regulator-min-microvolt = <600000>; - regulator-max-microvolt = <1500000>; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1200000>; regulator-always-on; regulator-boot-on; }; @@ -1261,7 +1261,7 @@ /* eMMC VDD */ vcore_emmc: ldo1 { - regulator-name = "vdd_emmc"; + regulator-name = "vdd_emmc_core"; regulator-min-microvolt = <1000000>; regulator-max-microvolt = <3300000>; regulator-always-on; @@ -1284,8 +1284,8 @@ ldo4 { regulator-name = "vdd_rtc"; - regulator-min-microvolt = <1000000>; - regulator-max-microvolt = <3300000>; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1200000>; regulator-always-on; }; @@ -1309,7 +1309,7 @@ ldo8 { regulator-name = "vdd_ddr_hs"; regulator-min-microvolt = <1000000>; - regulator-max-microvolt = <3300000>; + regulator-max-microvolt = <1000000>; regulator-always-on; ti,regulator-ext-sleep-control = <8>; }; @@ -1710,21 +1710,35 @@ }; thermal-zones { - cpu-thermal { + /* + * NCT72 has two sensors: + * + * 0: internal that monitors ambient/skin temperature + * 1: external that is connected to the CPU's diode + * + * Ideally we should use userspace thermal governor, + * but it's a much more complex solution. The "skin" + * zone exists as a simpler solution which prevents + * Transformers from getting too hot from a user's + * tactile perspective. The CPU zone is intended to + * protect silicon from damage. + */ + + skin-thermal { polling-delay-passive = <1000>; /* milliseconds */ polling-delay = <5000>; /* milliseconds */ - thermal-sensors = <&nct72 1>; + thermal-sensors = <&nct72 0>; trips { - trip0: cpu-alert0 { + trip0: skin-alert { /* throttle at 57C until temperature drops to 56.8C */ temperature = <57000>; hysteresis = <200>; type = "passive"; }; - trip1: cpu-crit { + trip1: skin-crit { /* shut down at 65C */ temperature = <65000>; hysteresis = <2000>; @@ -1739,7 +1753,43 @@ <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, - <&actmon THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + <&actmon THERMAL_NO_LIMIT + THERMAL_NO_LIMIT>; + }; + }; + }; + + cpu-thermal { + polling-delay-passive = <1000>; /* milliseconds */ + polling-delay = <5000>; /* milliseconds */ + + thermal-sensors = <&nct72 1>; + + trips { + trip2: cpu-alert { + /* throttle at 85C until temperature drops to 84.8C */ + temperature = <85000>; + hysteresis = <200>; + type = "passive"; + }; + + trip3: cpu-crit { + /* shut down at 90C */ + temperature = <90000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + + cooling-maps { + map1 { + trip = <&trip2>; + cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&actmon THERMAL_NO_LIMIT + THERMAL_NO_LIMIT>; }; }; }; diff --git a/drivers/mfd/asus-ec.c b/drivers/mfd/asus-ec.c index 654ab79db3998..f50e693e750c4 100644 --- a/drivers/mfd/asus-ec.c +++ b/drivers/mfd/asus-ec.c @@ -45,13 +45,10 @@ struct asus_ec_data { enum asus_ec_subdev_id { ID_EC_PART_BATTERY, -#define EC_PART_PAD_BATTERY BIT(ID_EC_PART_BATTERY) +#define EC_PART_BATTERY BIT(ID_EC_PART_BATTERY) - ID_EC_PART_DOCK_BATTERY, -#define EC_PART_DOCK_BATTERY BIT(ID_EC_PART_DOCK_BATTERY) - - ID_EC_PART_DOCK_BATTERY_TF701T, -#define EC_PART_DOCK_BATTERY_TF701T BIT(ID_EC_PART_DOCK_BATTERY_TF701T) + ID_EC_PART_CHARGER, +#define EC_PART_CHARGER BIT(ID_EC_PART_CHARGER) ID_EC_PART_CHARGE_LED, #define EC_PART_CHARGE_LED BIT(ID_EC_PART_CHARGE_LED) @@ -61,9 +58,6 @@ enum asus_ec_subdev_id { ID_EC_PART_EXT_KEYS, #define EC_PART_EXT_KEYS BIT(ID_EC_PART_EXT_KEYS) - - ID_EC_PART_CHARGER, -#define EC_PART_CHARGER BIT(ID_EC_PART_CHARGER) }; enum asus_ec_flag { @@ -78,36 +72,12 @@ struct asus_ec_initdata { unsigned int flags; }; -static struct asusec_pdata pad_battery_pdata = { - .is_pad = true, - .ec_addr = 0x14, -}; - -static struct asusec_pdata dock_battery_pdata = { - .is_pad = false, - .ec_addr = 0x14, -}; - -static struct asusec_pdata dock_battery_tf701t_pdata = { - .is_pad = false, - .ec_addr = 0x24, -}; - static const struct mfd_cell asus_ec_subdev[] = { [ID_EC_PART_BATTERY] = { .name = "asusec-battery", - .platform_data = &pad_battery_pdata, - .pdata_size = sizeof(pad_battery_pdata), - }, - [ID_EC_PART_DOCK_BATTERY] = { - .name = "asusec-battery", - .platform_data = &dock_battery_pdata, - .pdata_size = sizeof(dock_battery_pdata), }, - [ID_EC_PART_DOCK_BATTERY_TF701T] = { - .name = "asusec-battery", - .platform_data = &dock_battery_tf701t_pdata, - .pdata_size = sizeof(dock_battery_tf701t_pdata), + [ID_EC_PART_CHARGER] = { + .name = "asusec-charger", }, [ID_EC_PART_CHARGE_LED] = { .name = "asusec-led", @@ -118,45 +88,40 @@ static const struct mfd_cell asus_ec_subdev[] = { [ID_EC_PART_EXT_KEYS] = { .name = "asusec-keys", }, - [ID_EC_PART_CHARGER] = { - .name = "asusec-charger", - }, }; static const struct asus_ec_initdata asus_ec_model_info[] = { { /* Asus T20 Mobile Dock */ .model = "ASUS-EP101-DOCK", .name = "dock", - .components = EC_PART_DOCK_BATTERY | EC_PART_CHARGE_LED | + .components = EC_PART_BATTERY | EC_PART_CHARGE_LED | EC_PART_I8042 | EC_PART_EXT_KEYS | EC_PART_CHARGER, }, { /* Asus T30 Transformer Pad */ .model = "ASUS-TF201-PAD", .name = "pad", - .components = EC_PART_PAD_BATTERY | EC_PART_CHARGE_LED, + .components = EC_PART_BATTERY | EC_PART_CHARGE_LED, .flags = EC_FLAG_SET_MODE, }, { /* Asus T30 Mobile Dock */ .model = "ASUS-TF201-DOCK", .name = "dock", - .components = EC_PART_DOCK_BATTERY | EC_PART_CHARGE_LED | + .components = EC_PART_BATTERY | EC_PART_CHARGE_LED | EC_PART_I8042 | EC_PART_EXT_KEYS | EC_PART_CHARGER, }, { /* Asus TF500T/TF700T Mobile Dock */ .model = "ASUS-DOCK-EC21N", .name = "dock", - .components = EC_PART_DOCK_BATTERY | EC_PART_CHARGE_LED | + .components = EC_PART_BATTERY | EC_PART_CHARGE_LED | EC_PART_I8042 | EC_PART_EXT_KEYS | EC_PART_CHARGER, }, - { /* Asus T114 Transformer combined Pad/Dock */ + { /* Asus T114 Transformer Pad */ .model = "ASUS-TF701T-PAD", .name = "pad", - .components = EC_PART_PAD_BATTERY | - /* EC_PART_DOCK_BATTERY_TF701T | */ - EC_PART_CHARGE_LED, + .components = EC_PART_BATTERY | EC_PART_CHARGE_LED, .flags = EC_FLAG_SET_MODE, }, }; @@ -515,6 +480,7 @@ static int asus_ec_remove(struct i2c_client *client) struct asus_ec_data *priv = i2c_get_clientdata(client); mfd_remove_devices(&priv->self->dev); + sysfs_remove_link(&client->dev.kobj, "dockram"); sysfs_remove_group(&client->dev.kobj, &asus_ec_attr_group); diff --git a/drivers/power/supply/asus-ec-battery.c b/drivers/power/supply/asus-ec-battery.c index d39ba5634843f..6898b8fc019b7 100644 --- a/drivers/power/supply/asus-ec-battery.c +++ b/drivers/power/supply/asus-ec-battery.c @@ -222,7 +222,6 @@ static const struct power_supply_desc dock_battery_desc = { static int asusec_battery_probe(struct platform_device *pdev) { - const struct asusec_pdata *pdata = dev_get_platdata(&pdev->dev); const struct asusec_info *ec = asusec_cell_to_ec(pdev); const struct power_supply_desc *psd; struct asusec_battery_data *priv; @@ -237,14 +236,14 @@ static int asusec_battery_probe(struct platform_device *pdev) mutex_init(&priv->battery_lock); priv->ec = ec; - priv->ec_addr = pdata->ec_addr; + priv->ec_addr = 0x14; priv->batt_data_ts = jiffies - 1; priv->last_state = POWER_SUPPLY_STATUS_UNKNOWN; cfg.of_node = pdev->dev.parent->of_node; cfg.drv_data = priv; - if (pdata->is_pad) + if (!of_property_match_string(cfg.of_node, "compatible", "asus,pad-ec")) psd = &pad_battery_desc; else psd = &dock_battery_desc; diff --git a/include/linux/mfd/asus-ec.h b/include/linux/mfd/asus-ec.h index b1f81dc2c960f..bee9749a8d3c1 100644 --- a/include/linux/mfd/asus-ec.h +++ b/include/linux/mfd/asus-ec.h @@ -4,7 +4,6 @@ #include #include -#include struct i2c_client; struct workqueue_struct; @@ -22,11 +21,6 @@ struct i2c_client *devm_asus_dockram_get(struct device *parent); /* EC public API */ -struct asusec_pdata { - bool is_pad; - unsigned int ec_addr; -}; - struct asusec_info { const char *name; const char *model;