Samsung SCH-I545 (Verizon) source updates
/drivers/input/touchscreen/rmi_fw_update.c
blob:66c69da18039dfc57d30d628e8226eed4eff52d5 -> blob:6522ed9337ffa8745c1407369dd52081fd3add68
--- drivers/input/touchscreen/rmi_fw_update.c
+++ drivers/input/touchscreen/rmi_fw_update.c
@@ -78,12 +78,6 @@
#define MIN_SLEEP_TIME_US 50
#define MAX_SLEEP_TIME_US 100
-#define STATUS_POLLING_PERIOD_US 3000
-
-#if defined(CONFIG_MACH_JACTIVE_EUR) || defined(CONFIG_MACH_JACTIVE_ATT)
-#define FW_SUPPORT_HYNC(x) ((strncmp(x->product_id, "SY 03", 5))
-#define FW_NOT_SUPPORT_HYNC(x) ((strncmp(x->product_id, "SY 01", 5) == 0) || (strncmp(x->product_id, "S5000B", 6) == 0) || (strncmp(x->product_id, "SY 02", 5) == 0))
-#endif
static ssize_t fwu_sysfs_show_image(struct file *data_file,
struct kobject *kobj, struct bin_attribute *attributes,
@@ -210,7 +204,6 @@ struct synaptics_rmi4_fwu_handle {
char product_id[SYNAPTICS_RMI4_PRODUCT_ID_SIZE + 1];
const unsigned char *firmware_data;
const unsigned char *config_data;
- struct mutex status_mutex;
struct f34_flash_status flash_status;
struct synaptics_rmi4_fn_desc f01_fd;
struct synaptics_rmi4_fn_desc f34_fd;
@@ -404,8 +397,6 @@ static int fwu_read_f34_flash_status(voi
unsigned char status;
unsigned char command;
- mutex_lock(&(fwu->status_mutex));
-
retval = fwu->fn_ptr->read(fwu->rmi4_data,
fwu->f34_fd.data_base_addr + FLASH_STATUS_OFFSET,
&status,
@@ -414,7 +405,7 @@ static int fwu_read_f34_flash_status(voi
dev_err(&fwu->rmi4_data->i2c_client->dev,
"%s: Failed to read flash status\n",
__func__);
- goto exit;
+ return retval;
}
/* Program enabled bit not available - force bit to be set */
@@ -429,17 +420,12 @@ static int fwu_read_f34_flash_status(voi
dev_err(&fwu->rmi4_data->i2c_client->dev,
"%s: Failed to read flash command\n",
__func__);
- goto exit;
+ return retval;
}
fwu->command = command & MASK_4BIT;
- retval = 0;
-
-exit:
- mutex_unlock(&(fwu->status_mutex));
-
- return retval;
+ return 0;
}
static int fwu_write_f34_command(unsigned char cmd)
@@ -466,24 +452,14 @@ static int fwu_write_f34_command(unsigne
static int fwu_wait_for_idle(int timeout_ms)
{
int count = 0;
- int polling_period = STATUS_POLLING_PERIOD_US / MAX_SLEEP_TIME_US;
int timeout_count = ((timeout_ms * 1000) / MAX_SLEEP_TIME_US) + 1;
do {
usleep_range(MIN_SLEEP_TIME_US, MAX_SLEEP_TIME_US);
count++;
- if ((timeout_ms == WRITE_WAIT_MS) &&
- (count >= polling_period) &&
- ((count % polling_period) == 0)) {
- fwu_read_f34_flash_status();
- } else if (count == timeout_count) {
- dev_err(&fwu->rmi4_data->i2c_client->dev,
- "%s: wait usleep, in writing block [%d]\n",
- __func__, count);
-
+ if (count == timeout_count)
fwu_read_f34_flash_status();
- }
if ((fwu->command == 0x00) &&
(fwu->flash_status.status == 0x00))
@@ -961,52 +937,11 @@ static int fwu_start_reflash(bool mode,
memset(&fw_path, 0, SYNAPTICS_MAX_FW_PATH);
/* use factory test FW */
-#if defined(CONFIG_MACH_JACTIVE_EUR) || defined(CONFIG_MACH_JACTIVE_ATT)
- if (factory_fw) {
- dev_info(&fwu->rmi4_data->i2c_client->dev,
- "%s: run fw update for FACTORY FIRMWARE\n",
- __func__);
- if (FW_NOT_SUPPORT_HYNC(fwu))
- snprintf(fw_path, SYNAPTICS_MAX_FW_PATH,
- "%s", FW_IMAGE_NAME_B0_NON_HSYNC_FAC);
- else
- snprintf(fw_path, SYNAPTICS_MAX_FW_PATH,
- "%s", FW_IMAGE_NAME_B0_HSYNC_FAC);
- } else {
- /* Read firmware according to ic revision */
- if ((fwu->rmi4_data->ic_revision_of_ic >> 4) == 0xB) {
- /* Read firmware according to panel ID */
- switch (fwu->rmi4_data->panel_revision) {
- case OCTA_PANEL_REVISION_34:
- if (FW_NOT_SUPPORT_HYNC(fwu))
- snprintf(fw_path, SYNAPTICS_MAX_FW_PATH,
- "%s", FW_IMAGE_NAME_B0_NON_HSYNC);
- else
- snprintf(fw_path, SYNAPTICS_MAX_FW_PATH,
- "%s", FW_IMAGE_NAME_B0_HSYNC);
- break;
- default:
- dev_info(&fwu->rmi4_data->i2c_client->dev,
- "%s: Do not request, not matched revision and FW.\n",
- __func__);
- goto out;
- }
- } else if ((fwu->rmi4_data->ic_revision_of_ic >> 4) == 0xA) {
- dev_info(&fwu->rmi4_data->i2c_client->dev,
- "%s: Do not request, not matched revision and FW.\n",
- __func__);
- goto out;
- } else { // force update when ic_revision_of_ic is NULL
- snprintf(fw_path, SYNAPTICS_MAX_FW_PATH, "%s", FW_IMAGE_NAME_B0_HSYNC);
- printk(KERN_ERR "%s, force update when ic_revision_of_ic is NULL\n", __func__);
- mode = true;
- }
- }
-#else
if (factory_fw) {
dev_info(&fwu->rmi4_data->i2c_client->dev,
"%s: run fw update for FACTORY FIRMWARE\n",
__func__);
+
if (fwu->rmi4_data->panel_revision < OCTA_PANEL_REVISION_51)
snprintf(fw_path, SYNAPTICS_MAX_FW_PATH,
"%s", FW_IMAGE_NAME_B0_FAC);
@@ -1050,8 +985,19 @@ static int fwu_start_reflash(bool mode,
snprintf(fw_path, SYNAPTICS_MAX_FW_PATH,
"%s", FW_IMAGE_NAME_B0_43);
}
- }
+#if defined(CONFIG_MACH_JACTIVE_EUR) || defined(CONFIG_MACH_JACTIVE_ATT)
+ else // force update when ic_revision_of_ic is NULL
+ {
+ snprintf(fw_path, SYNAPTICS_MAX_FW_PATH, "%s", FW_IMAGE_NAME_B0_34);
+ printk(KERN_ERR "%s, force update when ic_revision_of_ic is NULL\n", __func__);
+ mode = true;
+ }
#endif
+ }
+/*
+ snprintf(fw_path, SYNAPTICS_MAX_FW_PATH,
+ "%s", FW_IMAGE_TEST);
+*/
dev_info(&fwu->rmi4_data->i2c_client->dev,
"%s: Requesting firmware image %s\n",
__func__, fw_path);
@@ -1666,7 +1612,6 @@ static int synaptics_rmi4_fwu_init(struc
if (retval < 0)
goto exit_free_mem;
- mutex_init(&(fwu->status_mutex));
fwu->initialized = true;
retval = sysfs_create_bin_file(&rmi4_data->input_dev->dev.kobj,