]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
power: extcon-xlate: logging cable names for debug
authorVenkat Reddy Talla <vreddytalla@nvidia.com>
Thu, 12 Mar 2015 08:47:18 +0000 (14:17 +0530)
committermobile promotions <svcmobile_promotions@nvidia.com>
Tue, 15 Dec 2015 17:31:34 +0000 (09:31 -0800)
Add debug prints to log cable names to debug scenarios where
cable is inserted but extcon xlate driver fail to detect cable
type, set last cable in state to 0 when all the connected cables
detached from device.

Bug 1571110

Change-Id: I436c1e52f351e53788bc67b6feedf439bc3d2ee7
Signed-off-by: Venkat Reddy Talla <vreddytalla@nvidia.com>
Reviewed-on: http://git-master/r/716730
(cherry picked from commit 78d8733fb37a559ae4414e6b23f7103b0dd43a3e)
Signed-off-by: Venkat Reddy Talla <vreddytalla@nvidia.com>
Reviewed-on: http://git-master/r/839248
GVS: Gerrit_Virtual_Submit
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
drivers/extcon/extcon-cable-xlate.c

index fd3ee05371483a9e8f0a3a57b11aa6d93db07a47..847c7d543c1f9b342c4f7be8735be52b73ac5e10 100644 (file)
@@ -130,7 +130,7 @@ static int ecx_init_input_cables(struct extcon_cable_xlate *ecx)
 static int ecx_attach_cable(struct extcon_cable_xlate *ecx)
 {
        struct ecx_in_cables *in_cables;
-       int mask_state;
+       int mask_state = 0;
        int all_states = 0;
        int new_state = -1;
        int i;
@@ -181,6 +181,9 @@ static int ecx_attach_cable(struct extcon_cable_xlate *ecx)
        if (new_state < 0) {
                dev_err(ecx->dev, "Cable state 0x%04x is not defined\n",
                        all_states);
+               dev_err(ecx->dev,
+                       "Last cable in state: 0x%04x, mask state: 0x%04x\n",
+                       ecx->last_cable_in_state, mask_state);
                mutex_unlock(&ecx->cable_lock);
                return -EINVAL;
        }
@@ -192,6 +195,7 @@ static int ecx_attach_cable(struct extcon_cable_xlate *ecx)
                        dev_info(ecx->dev, "Cable%d %s is attach\n",
                                i, ecx->pdata->out_cable_names[i]);
                } else {
+                       ecx->last_cable_in_state = 0;
                        dev_info(ecx->dev, "No cable attach\n");
                }
        }