Skip to content

Commit

Permalink
asus-ec: partially revert battery changes
Browse files Browse the repository at this point in the history
Signed-off-by: Svyatoslav Ryhel <[email protected]>
  • Loading branch information
clamor-s authored and digetx committed Jul 13, 2021
1 parent c7c6c15 commit f4ef35e
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 61 deletions.
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
2 changes: 1 addition & 1 deletion 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 Down
4 changes: 2 additions & 2 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
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"))
psd = &pad_battery_desc;
else
psd = &dock_battery_desc;
Expand Down
6 changes: 0 additions & 6 deletions include/linux/mfd/asus-ec.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#include <linux/notifier.h>
#include <linux/platform_device.h>
#include <linux/types.h>

struct i2c_client;
struct workqueue_struct;
Expand All @@ -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;
Expand Down

0 comments on commit f4ef35e

Please sign in to comment.