Lines Matching refs:msg

88 	struct ssp_msg *msg;  in ssp_create_msg()  local
90 msg = kzalloc(sizeof(*msg), GFP_KERNEL); in ssp_create_msg()
91 if (!msg) in ssp_create_msg()
99 msg->buffer = kzalloc(SSP_HEADER_SIZE_ALIGNED + len, in ssp_create_msg()
101 if (!msg->buffer) { in ssp_create_msg()
102 kfree(msg); in ssp_create_msg()
106 msg->length = len; in ssp_create_msg()
107 msg->options = opt; in ssp_create_msg()
109 memcpy(msg->buffer, &h, SSP_HEADER_SIZE); in ssp_create_msg()
111 return msg; in ssp_create_msg()
187 static int ssp_do_transfer(struct ssp_data *data, struct ssp_msg *msg, in ssp_do_transfer() argument
195 const bool use_no_irq = msg->length == 0; in ssp_do_transfer()
200 msg->done = done; in ssp_do_transfer()
208 status = spi_write(data->spi, msg->buffer, SSP_HEADER_SIZE); in ssp_do_transfer()
217 list_add_tail(&msg->list, &data->pending_list); in ssp_do_transfer()
225 list_del(&msg->list); in ssp_do_transfer()
238 list_del(&msg->list); in ssp_do_transfer()
254 struct ssp_msg *msg) in ssp_spi_sync_command() argument
256 return ssp_do_transfer(data, msg, NULL, 0); in ssp_spi_sync_command()
259 static int ssp_spi_sync(struct ssp_data *data, struct ssp_msg *msg, in ssp_spi_sync() argument
264 if (WARN_ON(!msg->length)) in ssp_spi_sync()
267 return ssp_do_transfer(data, msg, &done, timeout); in ssp_spi_sync()
342 struct ssp_msg *msg, *n; in ssp_irq_msg() local
368 list_for_each_entry_safe(msg, n, &data->pending_list, list) { in ssp_irq_msg()
369 if (msg->options == msg_options) { in ssp_irq_msg()
370 list_del(&msg->list); in ssp_irq_msg()
403 &msg->buffer[SSP_HEADER_SIZE_ALIGNED], in ssp_irq_msg()
404 msg->length); in ssp_irq_msg()
408 &msg->buffer[SSP_HEADER_SIZE_ALIGNED], in ssp_irq_msg()
409 msg->length); in ssp_irq_msg()
411 msg->options = in ssp_irq_msg()
413 msg->length = 1; in ssp_irq_msg()
415 list_add_tail(&msg->list, &data->pending_list); in ssp_irq_msg()
420 if (msg->done) in ssp_irq_msg()
421 if (!completion_done(msg->done)) in ssp_irq_msg()
422 complete(msg->done); in ssp_irq_msg()
453 struct ssp_msg *msg, *n; in ssp_clean_pending_list() local
456 list_for_each_entry_safe(msg, n, &data->pending_list, list) { in ssp_clean_pending_list()
457 list_del(&msg->list); in ssp_clean_pending_list()
459 if (msg->done) in ssp_clean_pending_list()
460 if (!completion_done(msg->done)) in ssp_clean_pending_list()
461 complete(msg->done); in ssp_clean_pending_list()
469 struct ssp_msg *msg; in ssp_command() local
471 msg = ssp_create_msg(command, 0, SSP_AP2HUB_WRITE, arg); in ssp_command()
472 if (!msg) in ssp_command()
477 ret = ssp_spi_sync_command(data, msg); in ssp_command()
478 ssp_clean_msg(msg); in ssp_command()
487 struct ssp_msg *msg; in ssp_send_instruction() local
500 msg = ssp_create_msg(inst, length + 2, SSP_AP2HUB_WRITE, 0); in ssp_send_instruction()
501 if (!msg) in ssp_send_instruction()
504 ssp_fill_buffer(msg, 0, &sensor_type, 1); in ssp_send_instruction()
505 ssp_fill_buffer(msg, 1, send_buf, length); in ssp_send_instruction()
510 ret = ssp_spi_sync(data, msg, 1000); in ssp_send_instruction()
511 ssp_clean_msg(msg); in ssp_send_instruction()
520 struct ssp_msg *msg; in ssp_get_chipid() local
522 msg = ssp_create_msg(SSP_MSG2SSP_AP_WHOAMI, 1, SSP_AP2HUB_READ, 0); in ssp_get_chipid()
523 if (!msg) in ssp_get_chipid()
526 ret = ssp_spi_sync(data, msg, 1000); in ssp_get_chipid()
528 buffer = SSP_GET_BUFFER_AT_INDEX(msg, 0); in ssp_get_chipid()
530 ssp_clean_msg(msg); in ssp_get_chipid()
538 struct ssp_msg *msg; in ssp_set_magnetic_matrix() local
540 msg = ssp_create_msg(SSP_MSG2SSP_AP_SET_MAGNETIC_STATIC_MATRIX, in ssp_set_magnetic_matrix()
543 if (!msg) in ssp_set_magnetic_matrix()
546 ssp_fill_buffer(msg, 0, data->sensorhub_info->mag_table, in ssp_set_magnetic_matrix()
549 ret = ssp_spi_sync(data, msg, 1000); in ssp_set_magnetic_matrix()
550 ssp_clean_msg(msg); in ssp_set_magnetic_matrix()
561 struct ssp_msg *msg = ssp_create_msg(SSP_MSG2SSP_AP_SENSOR_SCANNING, 4, in ssp_get_sensor_scanning_info() local
563 if (!msg) in ssp_get_sensor_scanning_info()
566 ret = ssp_spi_sync(data, msg, 1000); in ssp_get_sensor_scanning_info()
572 ssp_get_buffer(msg, 0, &result, 4); in ssp_get_sensor_scanning_info()
578 ssp_clean_msg(msg); in ssp_get_sensor_scanning_info()
587 struct ssp_msg *msg = ssp_create_msg(SSP_MSG2SSP_AP_FIRMWARE_REV, 4, in ssp_get_firmware_rev() local
589 if (!msg) in ssp_get_firmware_rev()
592 ret = ssp_spi_sync(data, msg, 1000); in ssp_get_firmware_rev()
599 ssp_get_buffer(msg, 0, &result, 4); in ssp_get_firmware_rev()
603 ssp_clean_msg(msg); in ssp_get_firmware_rev()