EDP: remove old system EDP framework (imx135 and ar0261 drivers)
Timo Alho [Sat, 28 Dec 2013 10:12:27 +0000 (12:12 +0200)]
Revert "drivers: media: tegra: edp support"
This reverts commit b9145b25074db3ca964b8f28eaedb36b45a0b1b4.

Revised system edp software framework has been put in place. This
patch removes the old system EDP client code from imx135 and ar0261
camera sensor drivers.

Bug 1431977

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

drivers/media/platform/tegra/ar0261.c
drivers/media/platform/tegra/imx135.c
include/media/ar0261.h
include/media/imx135.h

index 75cb9a3..869aceb 100644 (file)
@@ -23,7 +23,6 @@
 #include <linux/miscdevice.h>
 #include <linux/slab.h>
 #include <linux/uaccess.h>
-#include <linux/edp.h>
 #include <linux/regulator/consumer.h>
 #include <linux/regmap.h>
 #include <media/ar0261.h>
@@ -44,8 +43,6 @@ struct ar0261_info {
        struct ar0261_platform_data *pdata;
        struct clk *mclk;
        struct regmap *regmap;
-       struct edp_client *edpc;
-       unsigned int edp_state;
        atomic_t in_use;
        int mode;
 };
@@ -666,95 +663,6 @@ ar0261_get_gain_reg(struct ar0261_reg *regs, u16 gain)
        regs->val = gain;
 }
 
-static void ar0261_edp_lowest(struct ar0261_info *info)
-{
-       if (!info->edpc)
-               return;
-
-       info->edp_state = info->edpc->num_states - 1;
-       dev_dbg(&info->i2c_client->dev, "%s %d\n", __func__, info->edp_state);
-       if (edp_update_client_request(info->edpc, info->edp_state, NULL)) {
-               dev_err(&info->i2c_client->dev, "THIS IS NOT LIKELY HAPPEN!\n");
-               dev_err(&info->i2c_client->dev,
-                       "UNABLE TO SET LOWEST EDP STATE!\n");
-       }
-}
-
-static void ar0261_edp_throttle(unsigned int new_state, void *priv_data)
-{
-       struct ar0261_info *info = priv_data;
-
-       if (info->pdata && info->pdata->power_off)
-               info->pdata->power_off(&info->power);
-}
-
-static void ar0261_edp_register(struct ar0261_info *info)
-{
-       struct edp_manager *edp_manager;
-       struct edp_client *edpc = &info->pdata->edpc_config;
-       int ret;
-
-       info->edpc = NULL;
-       if (!edpc->num_states) {
-               dev_warn(&info->i2c_client->dev,
-                       "%s: No edp states defined.\n", __func__);
-               return;
-       }
-
-       strncpy(edpc->name, "ar0261", EDP_NAME_LEN - 1);
-       edpc->name[EDP_NAME_LEN - 1] = 0;
-       edpc->private_data = info;
-       edpc->throttle = ar0261_edp_throttle;
-
-       dev_dbg(&info->i2c_client->dev, "%s: %s, e0 = %d, p %d\n",
-               __func__, edpc->name, edpc->e0_index, edpc->priority);
-       for (ret = 0; ret < edpc->num_states; ret++)
-               dev_dbg(&info->i2c_client->dev, "e%d = %d mA",
-                       ret - edpc->e0_index, edpc->states[ret]);
-
-       edp_manager = edp_get_manager("battery");
-       if (!edp_manager) {
-               dev_err(&info->i2c_client->dev,
-                       "unable to get edp manager: battery\n");
-               return;
-       }
-
-       ret = edp_register_client(edp_manager, edpc);
-       if (ret) {
-               dev_err(&info->i2c_client->dev,
-                       "unable to register edp client\n");
-               return;
-       }
-
-       info->edpc = edpc;
-       /* set to lowest state at init */
-       ar0261_edp_lowest(info);
-}
-
-static int ar0261_edp_req(struct ar0261_info *info, unsigned new_state)
-{
-       unsigned approved;
-       int ret = 0;
-
-       if (!info->edpc)
-               return 0;
-
-       dev_dbg(&info->i2c_client->dev, "%s %d\n", __func__, new_state);
-       ret = edp_update_client_request(info->edpc, new_state, &approved);
-       if (ret) {
-               dev_err(&info->i2c_client->dev, "E state transition failed\n");
-               return ret;
-       }
-
-       if (approved > new_state) {
-               dev_err(&info->i2c_client->dev, "EDP no enough current\n");
-               return -ENODEV;
-       }
-
-       info->edp_state = approved;
-       return 0;
-}
-
 static int
 ar0261_read_reg(struct ar0261_info *info, u16 addr, u16 *val)
 {
@@ -859,14 +767,6 @@ ar0261_set_mode(struct ar0261_info *info, struct ar0261_mode *mode)
                return -EINVAL;
        }
 
-       /* request highest edp state */
-       err = ar0261_edp_req(info, 0);
-       if (err) {
-               dev_err(&info->i2c_client->dev,
-                       "%s: ERROR cannot set edp state! %d\n", __func__, err);
-               return err;
-       }
-
        /*
         * get a list of override regs for the asking frame length,
         * coarse integration time, and gain.
@@ -1236,10 +1136,9 @@ ar0261_open(struct inode *inode, struct file *file)
        if (err < 0)
                return err;
 
-       if (info->pdata && info->pdata->power_on) {
+       if (info->pdata && info->pdata->power_on)
                err = info->pdata->power_on(&info->power);
-               ar0261_edp_lowest(info);
-       } else {
+       else {
                dev_err(&info->i2c_client->dev,
                        "%s:no valid power_on function.\n", __func__);
                err = -EEXIST;
@@ -1261,7 +1160,6 @@ ar0261_release(struct inode *inode, struct file *file)
 
        if (info->pdata && info->pdata->power_off)
                info->pdata->power_off(&info->power);
-       ar0261_edp_lowest(info);
 
        ar0261_mclk_disable(info);
 
@@ -1376,8 +1274,6 @@ ar0261_probe(struct i2c_client *client,
 
        ar0261_power_get(info);
 
-       ar0261_edp_register(info);
-
        memcpy(&info->miscdev_info,
                &ar0261_device,
                sizeof(struct miscdevice));
index 996c3ee..13bb778 100644 (file)
@@ -28,7 +28,6 @@
 #include <media/imx135.h>
 #include <linux/gpio.h>
 #include <linux/module.h>
-#include <linux/edp.h>
 
 #include <linux/kernel.h>
 #include <linux/debugfs.h>
@@ -56,8 +55,6 @@ struct imx135_info {
        struct mutex                    imx135_camera_lock;
        struct dentry                   *debugdir;
        atomic_t                        in_use;
-       struct edp_client               *edpc;
-       unsigned int                    edp_state;
 };
 
 static const struct regmap_config sensor_regmap_config = {
@@ -2821,95 +2818,6 @@ static struct imx135_reg flash_strobe_mod[] = {
        {IMX135_TABLE_END, 0x00}
 };
 
-static void imx135_edp_lowest(struct imx135_info *info)
-{
-       if (!info->edpc)
-               return;
-
-       info->edp_state = info->edpc->num_states - 1;
-       dev_dbg(&info->i2c_client->dev, "%s %d\n", __func__, info->edp_state);
-       if (edp_update_client_request(info->edpc, info->edp_state, NULL)) {
-               dev_err(&info->i2c_client->dev, "THIS IS NOT LIKELY HAPPEN!\n");
-               dev_err(&info->i2c_client->dev,
-                       "UNABLE TO SET LOWEST EDP STATE!\n");
-       }
-}
-
-static void imx135_edp_throttle(unsigned int new_state, void *priv_data)
-{
-       struct imx135_info *info = priv_data;
-
-       if (info->pdata && info->pdata->power_off)
-               info->pdata->power_off(&info->power);
-}
-
-static void imx135_edp_register(struct imx135_info *info)
-{
-       struct edp_manager *edp_manager;
-       struct edp_client *edpc = &info->pdata->edpc_config;
-       int ret;
-
-       info->edpc = NULL;
-       if (!edpc->num_states) {
-               dev_warn(&info->i2c_client->dev,
-                       "%s: No edp states defined.\n", __func__);
-               return;
-       }
-
-       strncpy(edpc->name, "imx135", EDP_NAME_LEN - 1);
-       edpc->name[EDP_NAME_LEN - 1] = 0;
-       edpc->private_data = info;
-       edpc->throttle = imx135_edp_throttle;
-
-       dev_dbg(&info->i2c_client->dev, "%s: %s, e0 = %d, p %d\n",
-               __func__, edpc->name, edpc->e0_index, edpc->priority);
-       for (ret = 0; ret < edpc->num_states; ret++)
-               dev_dbg(&info->i2c_client->dev, "e%d = %d mA",
-                       ret - edpc->e0_index, edpc->states[ret]);
-
-       edp_manager = edp_get_manager("battery");
-       if (!edp_manager) {
-               dev_err(&info->i2c_client->dev,
-                       "unable to get edp manager: battery\n");
-               return;
-       }
-
-       ret = edp_register_client(edp_manager, edpc);
-       if (ret) {
-               dev_err(&info->i2c_client->dev,
-                       "unable to register edp client\n");
-               return;
-       }
-
-       info->edpc = edpc;
-       /* set to lowest state at init */
-       imx135_edp_lowest(info);
-}
-
-static int imx135_edp_req(struct imx135_info *info, unsigned new_state)
-{
-       unsigned approved;
-       int ret = 0;
-
-       if (!info->edpc)
-               return 0;
-
-       dev_dbg(&info->i2c_client->dev, "%s %d\n", __func__, new_state);
-       ret = edp_update_client_request(info->edpc, new_state, &approved);
-       if (ret) {
-               dev_err(&info->i2c_client->dev, "E state transition failed\n");
-               return ret;
-       }
-
-       if (approved > new_state) {
-               dev_err(&info->i2c_client->dev, "EDP no enough current\n");
-               return -ENODEV;
-       }
-
-       info->edp_state = approved;
-       return 0;
-}
-
 static inline void
 msleep_range(unsigned int delay_base)
 {
@@ -3109,14 +3017,6 @@ imx135_set_mode(struct imx135_info *info, struct imx135_mode *mode)
                return -EINVAL;
        }
 
-       /* request highest edp state */
-       err = imx135_edp_req(info, 0);
-       if (err) {
-               dev_err(&info->i2c_client->dev,
-                       "%s: ERROR cannot set edp state! %d\n", __func__, err);
-               return err;
-       }
-
        /* get a list of override regs for the asking frame length, */
        /* coarse integration time, and gain.                       */
        imx135_get_frame_length_regs(reg_list, mode->frame_length);
@@ -3402,7 +3302,6 @@ imx135_ioctl(struct file *file,
                if (!arg && info->pdata->power_off) {
                        info->pdata->power_off(&info->power);
                        imx135_mclk_disable(info);
-                       imx135_edp_lowest(info);
                }
                break;
        case IMX135_IOCTL_SET_MODE:
@@ -3925,8 +3824,6 @@ imx135_probe(struct i2c_client *client,
 
        imx135_power_get(info);
 
-       imx135_edp_register(info);
-
        memcpy(&info->miscdev_info,
                &imx135_device,
                sizeof(struct miscdevice));
index e1bd07e..e47e057 100644 (file)
@@ -70,7 +70,6 @@ struct ar0261_power_rail {
 
 struct ar0261_platform_data {
        const char *mclk_name; /* NULL for default default_mclk */
-       struct edp_client edpc_config;
        int (*power_on)(struct ar0261_power_rail *pw);
        int (*power_off)(struct ar0261_power_rail *pw);
 };
index c3e0fb5..082b631 100644 (file)
@@ -18,7 +18,6 @@
 #define __IMX135_H__
 
 #include <linux/ioctl.h>  /* For IOCTL macros */
-#include <linux/edp.h>
 #include <media/nvc.h>
 #include <media/nvc_image.h>
 
@@ -86,7 +85,6 @@ struct imx135_power_rail {
 struct imx135_platform_data {
        struct imx135_flash_control flash_cap;
        const char *mclk_name; /* NULL for default default_mclk */
-       struct edp_client edpc_config;
        unsigned int cam1_gpio;
        unsigned int reset_gpio;
        unsigned int af_gpio;