haptic: max77665: remove old system EDP framework
Timo Alho [Tue, 31 Dec 2013 12:47:05 +0000 (14:47 +0200)]
Revised system edp software framework has been put in place. This
patch removes old system edp client code from max77665 haptic driver.

Bug 1431977

Change-Id: Ieafb0bf0c3bf8e295cb68072458e2edbc8f96c90
Signed-off-by: Timo Alho <talho@nvidia.com>
Reviewed-on: http://git-master/r/351033
Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com>

drivers/input/misc/max77665_haptic.c
include/linux/input/max77665-haptic.h

index e5854f4..9236290 100644 (file)
@@ -33,7 +33,6 @@
 #include <linux/mfd/max77665.h>
 #include <linux/input/max77665-haptic.h>
 #include <linux/regulator/consumer.h>
-#include <linux/edp.h>
 
 struct max77665_haptic {
        struct device *dev;
@@ -61,8 +60,6 @@ struct max77665_haptic {
        int feedback_duty_cycle;
        int motor_startup_val;
        int scf_val;
-
-       struct edp_client *haptic_edp_client;
 };
 
 static int max77665_haptic_set_duty_cycle(struct max77665_haptic *chip)
@@ -217,21 +214,10 @@ static void max77665_haptic_enable(struct max77665_haptic *chip, bool enable)
        }
 }
 
-static void max77665_haptic_throttle(unsigned int new_state, void *priv_data)
-{
-       struct max77665_haptic *chip = priv_data;
-
-       if (!chip)
-               return;
-
-       max77665_haptic_enable(chip, false);
-}
-
 static void max77665_haptic_play_effect_work(struct work_struct *work)
 {
        struct max77665_haptic *chip =
                container_of(work, struct max77665_haptic, work);
-       unsigned int approved;
        int ret;
 
        if (chip->level) {
@@ -241,26 +227,8 @@ static void max77665_haptic_play_effect_work(struct work_struct *work)
                        return;
                }
 
-               if (chip->haptic_edp_client) {
-                       ret = edp_update_client_request(chip->haptic_edp_client,
-                                       MAX77665_HAPTIC_EDP_HIGH, &approved);
-                       if (ret || approved != MAX77665_HAPTIC_EDP_HIGH) {
-                               dev_err(chip->dev,
-                                       "E state transition failed\n");
-                               return;
-                       }
-               }
                max77665_haptic_enable(chip, true);
        } else {
-               if (chip->haptic_edp_client) {
-                       ret = edp_update_client_request(chip->haptic_edp_client,
-                                       MAX77665_HAPTIC_EDP_LOW, NULL);
-                       if (ret) {
-                               dev_err(chip->dev,
-                                       "E state transition failed\n");
-                               return;
-                       }
-               }
                max77665_haptic_enable(chip, false);
        }
 }
@@ -378,7 +346,6 @@ static int max77665_haptic_probe(struct platform_device *pdev)
        struct max77665_haptic_platform_data *haptic_pdata =
                                        pdev->dev.platform_data;
        struct max77665_haptic *chip;
-       struct edp_manager *battery_manager = NULL;
        struct input_dev *input_dev;
        int ret;
 
@@ -441,49 +408,6 @@ static int max77665_haptic_probe(struct platform_device *pdev)
                goto err_regulator;
        }
 
-       if (haptic_pdata->edp_states == NULL)
-               goto register_input;
-
-       chip->haptic_edp_client = devm_kzalloc(&pdev->dev,
-                               sizeof(struct edp_client), GFP_KERNEL);
-       if (IS_ERR_OR_NULL(chip->haptic_edp_client)) {
-               dev_err(&pdev->dev, "could not allocate edp client\n");
-               goto register_input;
-       }
-
-       chip->haptic_edp_client->name[EDP_NAME_LEN - 1] = '\0';
-       strncpy(chip->haptic_edp_client->name, "vibrator", EDP_NAME_LEN - 1);
-       chip->haptic_edp_client->states = haptic_pdata->edp_states;
-       chip->haptic_edp_client->num_states = MAX77665_HAPTIC_EDP_NUM_STATES;
-       chip->haptic_edp_client->e0_index = MAX77665_HAPTIC_EDP_LOW;
-       chip->haptic_edp_client->priority = EDP_MAX_PRIO + 2;
-       chip->haptic_edp_client->throttle = max77665_haptic_throttle;
-       chip->haptic_edp_client->private_data = chip;
-
-       battery_manager = edp_get_manager("battery");
-       if (!battery_manager) {
-               dev_err(&pdev->dev, "unable to get edp manager\n");
-       } else {
-               ret = edp_register_client(battery_manager,
-                                       chip->haptic_edp_client);
-               if (ret) {
-                       dev_err(&pdev->dev, "unable to register edp client\n");
-               } else {
-                       ret = edp_update_client_request(chip->haptic_edp_client,
-                               MAX77665_HAPTIC_EDP_LOW, NULL);
-                       if (ret) {
-                               dev_err(&pdev->dev,
-                                       "unable to set E0 EDP state\n");
-                               edp_unregister_client(chip->haptic_edp_client);
-                       } else {
-                               goto register_input;
-                       }
-               }
-       }
-
-       devm_kfree(&pdev->dev, chip->haptic_edp_client);
-       chip->haptic_edp_client = NULL;
-
 register_input:
        dev_set_drvdata(&pdev->dev, chip);
        input_dev->name = "max77665-haptic";
@@ -552,19 +476,8 @@ static int max77665_haptic_remove(struct platform_device *pdev)
 
 static int max77665_haptic_suspend(struct device *dev)
 {
-       struct platform_device *pdev = to_platform_device(dev);
        struct max77665_haptic *chip = platform_get_drvdata(pdev);
-       int ret;
 
-       if (chip->haptic_edp_client) {
-               ret = edp_update_client_request(chip->haptic_edp_client,
-                               MAX77665_HAPTIC_EDP_LOW, NULL);
-               if (ret) {
-                       dev_err(chip->dev,
-                               "E state transition failed\n");
-                       return ret;
-               }
-       }
        max77665_haptic_enable(chip, false);
 
        return 0;
index 043ca18..783cd79 100644 (file)
@@ -89,12 +89,6 @@ enum max77665_haptic_continous_mode {
        MAX77665_CONT_MODE,
 };
 
-enum max77665_haptic_edp_states {
-       MAX77665_HAPTIC_EDP_HIGH,
-       MAX77665_HAPTIC_EDP_LOW,
-       MAX77665_HAPTIC_EDP_NUM_STATES,
-};
-
 struct max77665_haptic_platform_data {
        int pwm_channel_id;
        int pwm_period;
@@ -111,8 +105,6 @@ struct max77665_haptic_platform_data {
        int feedback_duty_cycle;
        int motor_startup_val;
        int scf_val;
-
-       unsigned int edp_states[MAX77665_HAPTIC_EDP_NUM_STATES];
 };
 
 #endif