cypress: cyttsp_sar_mmi: fix interrupt problems

-Prevent the reset line from going into HiZ mode.  HiZ
mode results in the chip getting stuck in reset on
this chipset.

-Disable interrupts when a device tries to flash.

-Fix system crash on removal of the module due to
the wrong IRQ getting freed.

Change-Id: I1a0bcd32b570507703d6847a7372251ec0272b5f
Signed-off-by: Ryan Lattrel <ryanl@motorola.com>
Reviewed-on: https://gerrit.mot.com/1104822
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Konstantin Makariev <kmakariev@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
Ryan Lattrel 2017-12-15 10:12:15 -06:00
commit c090df6a23
2 changed files with 18 additions and 10 deletions

View file

@ -1098,7 +1098,7 @@ unsigned char VerifyFlash(struct hssp_data *d)
rowAddress = FLASH_ROW_BYTE_SIZE_HEX_FILE * rowCount;
/* Extract 128-byte row from the hex-file from address:
“rowCount” into buffer - “rowData”. */
"rowCount" into buffer - "rowData". */
HEX_ReadRowData(&d->inf, rowCount, &rowData[0]);
/* Read row from chip */
@ -1258,7 +1258,7 @@ unsigned char VerifyProtectionSettings(struct hssp_data *d)
rowProtectionFlashData[i + 3] = (protectionData >> 24) & 0xFF;
}
/* Compare hex and silicon’s data */
/* Compare hex and silicon's data */
for (i = 0; i < rowProtectionByteSize; i++) {
if (rowProtectionData[i] != rowProtectionFlashData[i]) {
@ -1283,7 +1283,7 @@ unsigned char VerifyProtectionSettings(struct hssp_data *d)
else if (chipProtectionData_Chip == CHIP_PROT_OPEN)
chipProtectionData_Chip = CHIP_PROT_VIRGIN;
/* Compare hex’s and silicon’s chip protection data */
/* Compare hex's and silicon's chip protection data */
if (chipProtectionData_Chip != chipProtectionData_Hex) {
/* Set the verification error bit for Flash protection data
mismatch and return failure */
@ -1397,9 +1397,6 @@ void ExitProgrammingMode(void)
SetXresLow();
DelayHundredUs();
SetXresHigh();
/* Make XRES High-Z after generating the reset pulse */
SetXresHizInput();
}
/* [] END OF FILE */

View file

@ -851,6 +851,12 @@ static void capsense_update_work(struct work_struct *w)
{
struct cycapsense_ctrl_data *data =
container_of(w, struct cycapsense_ctrl_data, work);
struct i2c_client *client = to_i2c_client(data->dev);
if(data->cmd == HSSP_CMD_NONE)
return;
disable_irq(client->irq);
switch (data->cmd) {
case HSSP_CMD_RESET:
@ -864,6 +870,8 @@ static void capsense_update_work(struct work_struct *w)
break;
}
data->cmd = HSSP_CMD_NONE;
enable_irq(client->irq);
}
int cycapsense_reset(void)
@ -1152,7 +1160,7 @@ static int cyttsp_sar_probe(struct i2c_client *client,
error = cyttsp_sar_parse_dt(&client->dev, pdata);
if (error)
return error;
client->irq = pdata->irq_gpio;
client->irq = gpio_to_irq(pdata->irq_gpio);
cyttsp_reg_setup_init(client);
@ -1220,13 +1228,13 @@ static int cyttsp_sar_probe(struct i2c_client *client,
}
error = request_threaded_irq(gpio_to_irq(client->irq), NULL, cyttsp_sar_interrupt,
error = request_threaded_irq(client->irq, NULL, cyttsp_sar_interrupt,
IRQF_TRIGGER_FALLING | IRQF_ONESHOT, client->dev.driver->name, data);
dev_err(&client->dev, "registering irq %d\n", gpio_to_irq(client->irq));
dev_err(&client->dev, "registering irq %d\n", client->irq);
if (error) {
dev_err(&client->dev, "Error %d registering irq %d\n", error, gpio_to_irq(client->irq));
dev_err(&client->dev, "Error %d registering irq %d\n", error, client->irq);
goto err_unreg_input;
}
@ -1315,6 +1323,7 @@ static int cyttsp_sar_remove(struct i2c_client *client)
free_irq(client->irq, data);
for (i = 0; i < 4; i++) {
input_unregister_device(data->input_dev[i]);
sensors_classdev_unregister(&sensors_capsensor_cdev[i]);
}
if (gpio_is_valid(pdata->irq_gpio))
gpio_free(pdata->irq_gpio);
@ -1325,6 +1334,8 @@ static int cyttsp_sar_remove(struct i2c_client *client)
if (data->regulator_vddio)
regulator_disable(data->regulator_vddio);
class_unregister(&capsense_class);
kfree(data);
data = NULL;