Lines Matching refs:f34
16 static int rmi_f34_write_bootloader_id(struct f34_data *f34) in rmi_f34_write_bootloader_id() argument
18 struct rmi_function *fn = f34->fn; in rmi_f34_write_bootloader_id()
45 static int rmi_f34_command(struct f34_data *f34, u8 command, in rmi_f34_command() argument
48 struct rmi_function *fn = f34->fn; in rmi_f34_command()
53 ret = rmi_f34_write_bootloader_id(f34); in rmi_f34_command()
58 init_completion(&f34->v5.cmd_done); in rmi_f34_command()
60 ret = rmi_read(rmi_dev, f34->v5.ctrl_address, &f34->v5.status); in rmi_f34_command()
62 dev_err(&f34->fn->dev, in rmi_f34_command()
68 f34->v5.status |= command & 0x0f; in rmi_f34_command()
70 ret = rmi_write(rmi_dev, f34->v5.ctrl_address, f34->v5.status); in rmi_f34_command()
72 dev_err(&f34->fn->dev, in rmi_f34_command()
78 if (!wait_for_completion_timeout(&f34->v5.cmd_done, in rmi_f34_command()
81 ret = rmi_read(rmi_dev, f34->v5.ctrl_address, &f34->v5.status); in rmi_f34_command()
83 dev_err(&f34->fn->dev, in rmi_f34_command()
89 if (f34->v5.status & 0x7f) { in rmi_f34_command()
90 dev_err(&f34->fn->dev, in rmi_f34_command()
92 __func__, command, f34->v5.status); in rmi_f34_command()
103 struct f34_data *f34 = dev_get_drvdata(&fn->dev); in rmi_f34_attention() local
107 if (f34->bl_version == 5) { in rmi_f34_attention()
108 ret = rmi_read(f34->fn->rmi_dev, f34->v5.ctrl_address, in rmi_f34_attention()
114 complete(&f34->v5.cmd_done); in rmi_f34_attention()
116 ret = rmi_read_block(f34->fn->rmi_dev, in rmi_f34_attention()
117 f34->fn->fd.data_base_addr + in rmi_f34_attention()
120 rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev, "%s: cmd: %#02x, ret: %d\n", in rmi_f34_attention()
124 complete(&f34->v7.cmd_done); in rmi_f34_attention()
130 static int rmi_f34_write_blocks(struct f34_data *f34, const void *data, in rmi_f34_write_blocks() argument
133 struct rmi_function *fn = f34->fn; in rmi_f34_write_blocks()
149 data, f34->v5.block_size); in rmi_f34_write_blocks()
156 ret = rmi_f34_command(f34, command, F34_IDLE_WAIT_MS, false); in rmi_f34_write_blocks()
167 data += f34->v5.block_size; in rmi_f34_write_blocks()
168 f34->update_progress += f34->v5.block_size; in rmi_f34_write_blocks()
169 f34->update_status = (f34->update_progress * 100) / in rmi_f34_write_blocks()
170 f34->update_size; in rmi_f34_write_blocks()
176 static int rmi_f34_write_firmware(struct f34_data *f34, const void *data) in rmi_f34_write_firmware() argument
178 return rmi_f34_write_blocks(f34, data, f34->v5.fw_blocks, in rmi_f34_write_firmware()
182 static int rmi_f34_write_config(struct f34_data *f34, const void *data) in rmi_f34_write_config() argument
184 return rmi_f34_write_blocks(f34, data, f34->v5.config_blocks, in rmi_f34_write_config()
188 static int rmi_f34_enable_flash(struct f34_data *f34) in rmi_f34_enable_flash() argument
190 return rmi_f34_command(f34, F34_ENABLE_FLASH_PROG, in rmi_f34_enable_flash()
194 static int rmi_f34_flash_firmware(struct f34_data *f34, in rmi_f34_flash_firmware() argument
197 struct rmi_function *fn = f34->fn; in rmi_f34_flash_firmware()
202 f34->update_progress = 0; in rmi_f34_flash_firmware()
203 f34->update_size = image_size + config_size; in rmi_f34_flash_firmware()
207 ret = rmi_f34_command(f34, F34_ERASE_ALL, in rmi_f34_flash_firmware()
214 ret = rmi_f34_write_firmware(f34, syn_fw->data); in rmi_f34_flash_firmware()
226 ret = rmi_f34_command(f34, F34_ERASE_CONFIG, in rmi_f34_flash_firmware()
234 ret = rmi_f34_write_config(f34, &syn_fw->data[image_size]); in rmi_f34_flash_firmware()
242 static int rmi_f34_update_firmware(struct f34_data *f34, in rmi_f34_update_firmware() argument
253 rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev, in rmi_f34_update_firmware()
259 rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev, in rmi_f34_update_firmware()
265 if (image_size && image_size != f34->v5.fw_blocks * f34->v5.block_size) { in rmi_f34_update_firmware()
266 dev_err(&f34->fn->dev, in rmi_f34_update_firmware()
268 image_size, f34->v5.fw_blocks * f34->v5.block_size); in rmi_f34_update_firmware()
273 config_size != f34->v5.config_blocks * f34->v5.block_size) { in rmi_f34_update_firmware()
274 dev_err(&f34->fn->dev, in rmi_f34_update_firmware()
277 f34->v5.config_blocks * f34->v5.block_size); in rmi_f34_update_firmware()
282 dev_err(&f34->fn->dev, "Bad firmware image: no config data\n"); in rmi_f34_update_firmware()
286 dev_info(&f34->fn->dev, "Firmware image OK\n"); in rmi_f34_update_firmware()
288 guard(mutex)(&f34->v5.flash_mutex); in rmi_f34_update_firmware()
289 return rmi_f34_flash_firmware(f34, syn_fw); in rmi_f34_update_firmware()
294 struct f34_data *f34 = dev_get_drvdata(&fn->dev); in rmi_f34_status() local
300 return f34->update_status; in rmi_f34_status()
309 struct f34_data *f34; in rmi_driver_bootloader_id_show() local
312 f34 = dev_get_drvdata(&fn->dev); in rmi_driver_bootloader_id_show()
314 if (f34->bl_version == 5) in rmi_driver_bootloader_id_show()
316 f34->bootloader_id[0], in rmi_driver_bootloader_id_show()
317 f34->bootloader_id[1]); in rmi_driver_bootloader_id_show()
320 f34->bootloader_id[1], in rmi_driver_bootloader_id_show()
321 f34->bootloader_id[0]); in rmi_driver_bootloader_id_show()
335 struct f34_data *f34; in rmi_driver_configuration_id_show() local
338 f34 = dev_get_drvdata(&fn->dev); in rmi_driver_configuration_id_show()
340 return sysfs_emit(buf, "%s\n", f34->configuration_id); in rmi_driver_configuration_id_show()
354 struct f34_data *f34; in rmi_firmware_update() local
362 f34 = dev_get_drvdata(&data->f34_container->dev); in rmi_firmware_update()
364 if (f34->bl_version >= 7) { in rmi_firmware_update()
369 } else if (f34->bl_version != 5) { in rmi_firmware_update()
376 if (f34->bl_version >= 7) in rmi_firmware_update()
377 ret = rmi_f34v7_start_reflash(f34, fw); in rmi_firmware_update()
379 ret = rmi_f34_enable_flash(f34); in rmi_firmware_update()
404 f34 = dev_get_drvdata(&data->f34_container->dev); in rmi_firmware_update()
407 if (f34->bl_version >= 7) in rmi_firmware_update()
408 ret = rmi_f34v7_do_reflash(f34, fw); in rmi_firmware_update()
410 ret = rmi_f34_update_firmware(f34, fw); in rmi_firmware_update()
413 f34->update_status = ret; in rmi_firmware_update()
414 dev_err(&f34->fn->dev, in rmi_firmware_update()
417 dev_info(&f34->fn->dev, "Firmware update complete\n"); in rmi_firmware_update()
513 struct f34_data *f34; in rmi_f34_probe() local
519 f34 = devm_kzalloc(&fn->dev, sizeof(struct f34_data), GFP_KERNEL); in rmi_f34_probe()
520 if (!f34) in rmi_f34_probe()
523 f34->fn = fn; in rmi_f34_probe()
524 dev_set_drvdata(&fn->dev, f34); in rmi_f34_probe()
528 return rmi_f34v7_probe(f34); in rmi_f34_probe()
530 f34->bl_version = 5; in rmi_f34_probe()
540 snprintf(f34->bootloader_id, sizeof(f34->bootloader_id), in rmi_f34_probe()
543 mutex_init(&f34->v5.flash_mutex); in rmi_f34_probe()
544 init_completion(&f34->v5.cmd_done); in rmi_f34_probe()
546 f34->v5.block_size = get_unaligned_le16(&f34_queries[3]); in rmi_f34_probe()
547 f34->v5.fw_blocks = get_unaligned_le16(&f34_queries[5]); in rmi_f34_probe()
548 f34->v5.config_blocks = get_unaligned_le16(&f34_queries[7]); in rmi_f34_probe()
549 f34->v5.ctrl_address = fn->fd.data_base_addr + F34_BLOCK_DATA_OFFSET + in rmi_f34_probe()
550 f34->v5.block_size; in rmi_f34_probe()
554 f34->bootloader_id); in rmi_f34_probe()
556 f34->v5.block_size); in rmi_f34_probe()
558 f34->v5.fw_blocks); in rmi_f34_probe()
560 f34->v5.config_blocks); in rmi_f34_probe()
570 snprintf(f34->configuration_id, sizeof(f34->configuration_id), in rmi_f34_probe()
576 f34->configuration_id); in rmi_f34_probe()