Lines Matching refs:f34

19 static int rmi_f34_write_bootloader_id(struct f34_data *f34)  in rmi_f34_write_bootloader_id()  argument
21 struct rmi_function *fn = f34->fn; in rmi_f34_write_bootloader_id()
48 static int rmi_f34_command(struct f34_data *f34, u8 command, in rmi_f34_command() argument
51 struct rmi_function *fn = f34->fn; in rmi_f34_command()
56 ret = rmi_f34_write_bootloader_id(f34); in rmi_f34_command()
61 init_completion(&f34->v5.cmd_done); in rmi_f34_command()
63 ret = rmi_read(rmi_dev, f34->v5.ctrl_address, &f34->v5.status); in rmi_f34_command()
65 dev_err(&f34->fn->dev, in rmi_f34_command()
71 f34->v5.status |= command & 0x0f; in rmi_f34_command()
73 ret = rmi_write(rmi_dev, f34->v5.ctrl_address, f34->v5.status); in rmi_f34_command()
75 dev_err(&f34->fn->dev, in rmi_f34_command()
81 if (!wait_for_completion_timeout(&f34->v5.cmd_done, in rmi_f34_command()
84 ret = rmi_read(rmi_dev, f34->v5.ctrl_address, &f34->v5.status); in rmi_f34_command()
86 dev_err(&f34->fn->dev, in rmi_f34_command()
92 if (f34->v5.status & 0x7f) { in rmi_f34_command()
93 dev_err(&f34->fn->dev, in rmi_f34_command()
95 __func__, command, f34->v5.status); in rmi_f34_command()
106 struct f34_data *f34 = dev_get_drvdata(&fn->dev); in rmi_f34_attention() local
110 if (f34->bl_version == 5) { in rmi_f34_attention()
111 ret = rmi_read(f34->fn->rmi_dev, f34->v5.ctrl_address, in rmi_f34_attention()
117 complete(&f34->v5.cmd_done); in rmi_f34_attention()
119 ret = rmi_read_block(f34->fn->rmi_dev, in rmi_f34_attention()
120 f34->fn->fd.data_base_addr + in rmi_f34_attention()
121 f34->v7.off.flash_status, in rmi_f34_attention()
127 complete(&f34->v7.cmd_done); in rmi_f34_attention()
133 static int rmi_f34_write_blocks(struct f34_data *f34, const void *data, in rmi_f34_write_blocks() argument
136 struct rmi_function *fn = f34->fn; in rmi_f34_write_blocks()
152 data, f34->v5.block_size); in rmi_f34_write_blocks()
159 ret = rmi_f34_command(f34, command, F34_IDLE_WAIT_MS, false); in rmi_f34_write_blocks()
170 data += f34->v5.block_size; in rmi_f34_write_blocks()
171 f34->update_progress += f34->v5.block_size; in rmi_f34_write_blocks()
172 f34->update_status = (f34->update_progress * 100) / in rmi_f34_write_blocks()
173 f34->update_size; in rmi_f34_write_blocks()
179 static int rmi_f34_write_firmware(struct f34_data *f34, const void *data) in rmi_f34_write_firmware() argument
181 return rmi_f34_write_blocks(f34, data, f34->v5.fw_blocks, in rmi_f34_write_firmware()
185 static int rmi_f34_write_config(struct f34_data *f34, const void *data) in rmi_f34_write_config() argument
187 return rmi_f34_write_blocks(f34, data, f34->v5.config_blocks, in rmi_f34_write_config()
191 static int rmi_f34_enable_flash(struct f34_data *f34) in rmi_f34_enable_flash() argument
193 return rmi_f34_command(f34, F34_ENABLE_FLASH_PROG, in rmi_f34_enable_flash()
197 static int rmi_f34_flash_firmware(struct f34_data *f34, in rmi_f34_flash_firmware() argument
200 struct rmi_function *fn = f34->fn; in rmi_f34_flash_firmware()
205 f34->update_progress = 0; in rmi_f34_flash_firmware()
206 f34->update_size = image_size + config_size; in rmi_f34_flash_firmware()
210 ret = rmi_f34_command(f34, F34_ERASE_ALL, in rmi_f34_flash_firmware()
217 ret = rmi_f34_write_firmware(f34, syn_fw->data); in rmi_f34_flash_firmware()
229 ret = rmi_f34_command(f34, F34_ERASE_CONFIG, in rmi_f34_flash_firmware()
237 ret = rmi_f34_write_config(f34, &syn_fw->data[image_size]); in rmi_f34_flash_firmware()
245 static int rmi_f34_update_firmware(struct f34_data *f34, in rmi_f34_update_firmware() argument
257 rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev, in rmi_f34_update_firmware()
263 rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev, in rmi_f34_update_firmware()
269 if (image_size && image_size != f34->v5.fw_blocks * f34->v5.block_size) { in rmi_f34_update_firmware()
270 dev_err(&f34->fn->dev, in rmi_f34_update_firmware()
272 image_size, f34->v5.fw_blocks * f34->v5.block_size); in rmi_f34_update_firmware()
278 config_size != f34->v5.config_blocks * f34->v5.block_size) { in rmi_f34_update_firmware()
279 dev_err(&f34->fn->dev, in rmi_f34_update_firmware()
282 f34->v5.config_blocks * f34->v5.block_size); in rmi_f34_update_firmware()
288 dev_err(&f34->fn->dev, "Bad firmware image: no config data\n"); in rmi_f34_update_firmware()
293 dev_info(&f34->fn->dev, "Firmware image OK\n"); in rmi_f34_update_firmware()
294 mutex_lock(&f34->v5.flash_mutex); in rmi_f34_update_firmware()
296 ret = rmi_f34_flash_firmware(f34, syn_fw); in rmi_f34_update_firmware()
298 mutex_unlock(&f34->v5.flash_mutex); in rmi_f34_update_firmware()
306 struct f34_data *f34 = dev_get_drvdata(&fn->dev); in rmi_f34_status() local
312 return f34->update_status; in rmi_f34_status()
321 struct f34_data *f34; in rmi_driver_bootloader_id_show() local
324 f34 = dev_get_drvdata(&fn->dev); in rmi_driver_bootloader_id_show()
326 if (f34->bl_version == 5) in rmi_driver_bootloader_id_show()
328 f34->bootloader_id[0], in rmi_driver_bootloader_id_show()
329 f34->bootloader_id[1]); in rmi_driver_bootloader_id_show()
332 f34->bootloader_id[1], in rmi_driver_bootloader_id_show()
333 f34->bootloader_id[0]); in rmi_driver_bootloader_id_show()
347 struct f34_data *f34; in rmi_driver_configuration_id_show() local
350 f34 = dev_get_drvdata(&fn->dev); in rmi_driver_configuration_id_show()
352 return scnprintf(buf, PAGE_SIZE, "%s\n", f34->configuration_id); in rmi_driver_configuration_id_show()
366 struct f34_data *f34; in rmi_firmware_update() local
374 f34 = dev_get_drvdata(&data->f34_container->dev); in rmi_firmware_update()
376 if (f34->bl_version == 7) { in rmi_firmware_update()
381 } else if (f34->bl_version != 5) { in rmi_firmware_update()
388 if (f34->bl_version == 7) in rmi_firmware_update()
389 ret = rmi_f34v7_start_reflash(f34, fw); in rmi_firmware_update()
391 ret = rmi_f34_enable_flash(f34); in rmi_firmware_update()
416 f34 = dev_get_drvdata(&data->f34_container->dev); in rmi_firmware_update()
419 if (f34->bl_version == 7) in rmi_firmware_update()
420 ret = rmi_f34v7_do_reflash(f34, fw); in rmi_firmware_update()
422 ret = rmi_f34_update_firmware(f34, fw); in rmi_firmware_update()
425 f34->update_status = ret; in rmi_firmware_update()
426 dev_err(&f34->fn->dev, in rmi_firmware_update()
429 dev_info(&f34->fn->dev, "Firmware update complete\n"); in rmi_firmware_update()
525 struct f34_data *f34; in rmi_f34_probe() local
531 f34 = devm_kzalloc(&fn->dev, sizeof(struct f34_data), GFP_KERNEL); in rmi_f34_probe()
532 if (!f34) in rmi_f34_probe()
535 f34->fn = fn; in rmi_f34_probe()
536 dev_set_drvdata(&fn->dev, f34); in rmi_f34_probe()
540 return rmi_f34v7_probe(f34); in rmi_f34_probe()
542 f34->bl_version = 5; in rmi_f34_probe()
552 snprintf(f34->bootloader_id, sizeof(f34->bootloader_id), in rmi_f34_probe()
555 mutex_init(&f34->v5.flash_mutex); in rmi_f34_probe()
556 init_completion(&f34->v5.cmd_done); in rmi_f34_probe()
558 f34->v5.block_size = get_unaligned_le16(&f34_queries[3]); in rmi_f34_probe()
559 f34->v5.fw_blocks = get_unaligned_le16(&f34_queries[5]); in rmi_f34_probe()
560 f34->v5.config_blocks = get_unaligned_le16(&f34_queries[7]); in rmi_f34_probe()
561 f34->v5.ctrl_address = fn->fd.data_base_addr + F34_BLOCK_DATA_OFFSET + in rmi_f34_probe()
562 f34->v5.block_size; in rmi_f34_probe()
566 f34->bootloader_id); in rmi_f34_probe()
568 f34->v5.block_size); in rmi_f34_probe()
570 f34->v5.fw_blocks); in rmi_f34_probe()
572 f34->v5.config_blocks); in rmi_f34_probe()
582 snprintf(f34->configuration_id, sizeof(f34->configuration_id), in rmi_f34_probe()
588 f34->configuration_id); in rmi_f34_probe()