This patch removes charger type property from USB power supply class and adds
uevent notification call wherever necessary.

Summary of Changes:
power supply class cannot have Charge Type property in charger instead battery
should have Charge Type. But in battery driver we always doing FAST type of
Charging so this property is completely removed from the driver.

power_suuply_changed() function is added wherever the power supply class
properties are being changed to notify the user space.

Signed-off-by: Ramakrishna Pallala <[email protected]>
---
 drivers/power/intel_mdf_battery.c |   32 ++++++++++----------------------
 1 files changed, 10 insertions(+), 22 deletions(-)

diff --git a/drivers/power/intel_mdf_battery.c 
b/drivers/power/intel_mdf_battery.c
index d657674..72f68bc 100644
--- a/drivers/power/intel_mdf_battery.c
+++ b/drivers/power/intel_mdf_battery.c
@@ -406,7 +406,6 @@ struct msic_batt_props {
 };
 
 struct msic_charg_props {
-       unsigned int charger_type;
        unsigned int charger_present;
        unsigned int charger_health;
        unsigned int vbus_vol;
@@ -493,7 +492,6 @@ static DEVICE_ATTR(emrg_charge_enable, S_IWUGO | S_IRUGO,
  */
 static enum power_supply_property msic_usb_props[] = {
        POWER_SUPPLY_PROP_TYPE,
-       POWER_SUPPLY_PROP_CHARGE_TYPE,
        POWER_SUPPLY_PROP_PRESENT,
        POWER_SUPPLY_PROP_HEALTH,
        POWER_SUPPLY_PROP_VOLTAGE_NOW,
@@ -947,9 +945,6 @@ static int msic_usb_get_property(struct power_supply *psy,
                                mdf_read_adc_regs(MSIC_ADC_USB_VOL_IDX, mbi);
                val->intval = mbi->usb_chrg_props.vbus_vol * 1000;
                break;
-       case POWER_SUPPLY_PROP_CHARGE_TYPE:
-               val->intval = mbi->usb_chrg_props.charger_type;
-               break;
        case POWER_SUPPLY_PROP_MODEL_NAME:
                val->strval = mbi->usb_chrg_props.charger_model;
                break;
@@ -1520,13 +1515,6 @@ static int msic_batt_do_charging(struct 
msic_power_module_info *mbi,
        memcpy(mbi->usb_chrg_props.charger_model, "msic", sizeof("msic"));
        memcpy(mbi->usb_chrg_props.charger_vender, "Intel", sizeof("Intel"));
 
-       if (mbi->ch_params.vinilmt == CHRG_CURR_SDP_LOW)
-               mbi->usb_chrg_props.charger_type =
-                                       POWER_SUPPLY_CHARGE_TYPE_TRICKLE;
-       else
-               mbi->usb_chrg_props.charger_type =
-                                       POWER_SUPPLY_CHARGE_TYPE_FAST;
-
        if (mbi->ch_params.chrg_type == CHRG_CDP)
                mbi->usb.type = POWER_SUPPLY_TYPE_USB_CDP;
        else if (mbi->ch_params.chrg_type == CHRG_DCP)
@@ -1536,6 +1524,10 @@ static int msic_batt_do_charging(struct 
msic_power_module_info *mbi,
        else
                mbi->usb.type = POWER_SUPPLY_TYPE_USB;
        mutex_unlock(&mbi->usb_chrg_lock);
+
+       power_supply_changed(&mbi->batt);
+       power_supply_changed(&mbi->usb);
+
        return 0;
 }
 
@@ -1570,13 +1562,9 @@ static void msic_update_disconn_status(struct 
msic_power_module_info *mbi)
        memcpy(mbi->usb_chrg_props.charger_vender, "Unknown",
                                                        sizeof("Unknown"));
        if (event == USBCHRG_EVENT_SUSPEND) {
-               mbi->usb_chrg_props.charger_type =
-                                       POWER_SUPPLY_CHARGE_TYPE_UNKNOWN;
                mbi->usb_chrg_props.charger_present =
                                        MSIC_USB_CHARGER_PRESENT;
        } else {
-               mbi->usb_chrg_props.charger_type =
-                                       POWER_SUPPLY_CHARGE_TYPE_NONE;
                mbi->usb_chrg_props.charger_present =
                                        MSIC_USB_CHARGER_NOT_PRESENT;
                mbi->usb.type = POWER_SUPPLY_TYPE_USB;
@@ -1594,6 +1582,7 @@ static void msic_update_disconn_status(struct 
msic_power_module_info *mbi)
        mutex_unlock(&mbi->batt_lock);
 
        power_supply_changed(&mbi->batt);
+       power_supply_changed(&mbi->usb);
 }
 
 static int check_charge_full(struct msic_power_module_info *mbi, int vref)
@@ -1804,7 +1793,7 @@ static void msic_batt_temp_charging(struct work_struct 
*work)
                        mutex_unlock(&mbi->batt_lock);
 
                        is_maint_chrg = true;
-                       power_supply_set_battery_charged(&mbi->batt);
+                       power_supply_changed(&mbi->batt);
                }
        }
 
@@ -1884,7 +1873,6 @@ static void msic_batt_temp_charging(struct work_struct 
*work)
        /* Start cycle counting */
        calculate_charge_cycles(mbi, true);
        is_chrg_enbl = true;
-       power_supply_changed(&mbi->usb);
 
 lbl_sched_work:
        /* Schedule teh work after 30 Seconds */
@@ -1903,7 +1891,6 @@ static void msic_batt_disconn(struct work_struct *work)
                return;
        }
        msic_update_disconn_status(mbi);
-       power_supply_changed(&mbi->batt);
 }
 
 /**
@@ -2139,6 +2126,8 @@ static irqreturn_t msic_battery_thread_handler(int id, 
void *dev)
        /* Check if an exception occured */
        if (data[0] || (data[1] & ~(MSIC_BATT_CHR_CHRCMPLT_MASK))) {
                msic_handle_exception(mbi, data[0], data[1]);
+               power_supply_changed(&mbi->batt);
+               power_supply_changed(&mbi->usb);
                schedule_delayed_work(&mbi->chr_status_monitor,
                                        CHARGE_STATUS_DELAY_JIFFIES);
        }
@@ -2181,7 +2170,7 @@ static int check_charger_conn(struct 
msic_power_module_info *mbi)
  * SFI table has entries for the temperature limits
  * which is populated in a local structure
  */
-void sfi_table_populate(struct msic_batt_sfi_prop *sfi_table)
+static void sfi_table_populate(struct msic_batt_sfi_prop *sfi_table)
 {
 
        /* This is temporary code, will be removed
@@ -2283,7 +2272,7 @@ static void init_batt_props(struct msic_power_module_info 
*mbi)
        memcpy(mbi->batt_props.vender, sfi_table->batt_id.manufac,
                                sizeof(sfi_table->batt_id.manufac));
        memcpy(mbi->batt_props.model, sfi_table->batt_id.model,
-                                       sizeof(sfi_table->batt_id.model));
+                               sizeof(sfi_table->batt_id.model));
 
        /* read specific to determine the status */
        retval = intel_scu_ipc_ioread8(MSIC_BATT_CHR_SPWRSRCINT_ADDR, &data);
@@ -2314,7 +2303,6 @@ static void init_batt_props(struct msic_power_module_info 
*mbi)
  */
 static void init_charger_props(struct msic_power_module_info *mbi)
 {
-       mbi->usb_chrg_props.charger_type = POWER_SUPPLY_CHARGE_TYPE_UNKNOWN;
        mbi->usb_chrg_props.charger_present = MSIC_USB_CHARGER_NOT_PRESENT;
        mbi->usb_chrg_props.charger_health = POWER_SUPPLY_HEALTH_UNKNOWN;
        memcpy(mbi->usb_chrg_props.charger_model, "Unknown", sizeof("Unknown"));
-- 
1.7.2.3

Attachment: 0002-Remove-Charge-type-property-from-USB-Charger-Power-S.patch
Description: 0002-Remove-Charge-type-property-from-USB-Charger-Power-S.patch

_______________________________________________
MeeGo-kernel mailing list
[email protected]
http://lists.meego.com/listinfo/meego-kernel

Reply via email to