Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transformers update #51

Merged
merged 5 commits into from
Jul 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions Documentation/devicetree/bindings/mfd/asus-ec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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>;
Expand Down
13 changes: 9 additions & 4 deletions arch/arm/boot/dts/tegra20-asus-tf101.dts
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
Expand All @@ -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 {
Expand Down Expand Up @@ -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";

Expand Down
18 changes: 13 additions & 5 deletions arch/arm/boot/dts/tegra30-asus-tf300t.dts
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
};
};

Expand Down Expand Up @@ -220,6 +227,7 @@

nvidia,audio-codec = <&wm8903>;
nvidia,spkr-en-gpios = <&wm8903 2 GPIO_ACTIVE_HIGH>;
nvidia,headset;
};

memory-controller@7000f000 {
Expand Down
82 changes: 66 additions & 16 deletions arch/arm/boot/dts/tegra30-asus-transformer-common.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
Expand Down Expand Up @@ -1091,7 +1091,7 @@
i2c-parent = <&i2c2>;

embedded-controller@19 {
compatible = "asus,ec";
compatible = "asus,dock-ec", "asus,ec";
reg = <0x19>;

interrupt-parent = <&gpio>;
Expand Down Expand Up @@ -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>;

Expand All @@ -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>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please tell where from you got these names and values?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you checked it on all transformer devices?

Copy link
Contributor Author

@clamor-s clamor-s Jul 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, tf201/tf300t/tf700t both native and kexec. Furthermore, those values can be logged from downstream is /sys/

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weren't the names correct?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likely that the names were correct and N7 has incorrect names, but I'm not 100% sure.

regulator-always-on;
regulator-boot-on;
};
Expand Down Expand Up @@ -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;
Expand All @@ -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;
};

Expand All @@ -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>;
};
Expand Down Expand Up @@ -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>;
Expand All @@ -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>;
};
};
};
Expand Down
58 changes: 12 additions & 46 deletions drivers/mfd/asus-ec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 {
Expand All @@ -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",
Expand All @@ -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,
},
};
Expand Down Expand Up @@ -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);

Expand Down
5 changes: 2 additions & 3 deletions drivers/power/supply/asus-ec-battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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"))
Copy link
Member

@digetx digetx Jul 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't of_device_is_compatible() be used here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll change it after merging. The rest looks okay.

psd = &pad_battery_desc;
else
psd = &dock_battery_desc;
Expand Down
Loading