Add IRQ enable
[tas2770sw-android/tas2770sw-android.git] / tas2770-regmap.c
index 196f163b897e43e2bd23c99208acb75f6702d414..c98cdc7e794bcd579f17df70c2857fe4d6d8f3f2 100644 (file)
@@ -172,7 +172,7 @@ static void irq_work_routine(struct work_struct *work)
        else
                goto reload;
 
-       dev_dbg(pTAS2770->dev, "IRQ status : 0x%x, 0x%x\n",
+       dev_info(pTAS2770->dev, "IRQ status : 0x%x, 0x%x\n",
                        nDevInt1Status, nDevInt2Status);
 
        if (((nDevInt1Status & 0x3) != 0) || ((nDevInt2Status & 0x0f) != 0)) {
@@ -409,13 +409,14 @@ static int tas2770_i2c_probe(struct i2c_client *client,
                sizeof(struct tas2770_priv), GFP_KERNEL);
        if (pTAS2770 == NULL) {
                nResult = -ENOMEM;
+               dev_info(&client->dev, "Failed to allocate i2c device\n");
                goto end;
        }
 
        pTAS2770->dev = &client->dev;
        i2c_set_clientdata(client, pTAS2770);
        dev_set_drvdata(&client->dev, pTAS2770);
-       pTAS2770->mnPowerState = TAS2770_POWER_STATE;
+       pTAS2770->mnPowerState = TAS2770_POWER_SHUTDOWN;
 
        pTAS2770->regmap = devm_regmap_init_i2c(client, &tas2770_i2c_regmap);
        if (IS_ERR(pTAS2770->regmap)) {
@@ -447,7 +448,8 @@ static int tas2770_i2c_probe(struct i2c_client *client,
                }
                gpio_direction_input(pTAS2770->mnIRQGPIO);
                pTAS2770->mnIRQ = gpio_to_irq(pTAS2770->mnIRQGPIO);
-               dev_dbg(pTAS2770->dev, "irq = %d\n", pTAS2770->mnIRQ);
+               dev_info(pTAS2770->dev, "irq = %d\n", pTAS2770->mnIRQ);
+               INIT_DELAYED_WORK(&pTAS2770->irq_work, irq_work_routine);
                nResult = request_threaded_irq(pTAS2770->mnIRQ,
                                        tas2770_irq_handler, NULL,
                                        IRQF_TRIGGER_LOW | IRQF_ONESHOT,
@@ -458,7 +460,6 @@ static int tas2770_i2c_probe(struct i2c_client *client,
                        goto free_gpio;
                }
                disable_irq_nosync(pTAS2770->mnIRQ);
-               INIT_DELAYED_WORK(&pTAS2770->irq_work, irq_work_routine);
        }
 
        pTAS2770->hw_reset = tas2770_hw_reset;