Exemplo n.º 1
0
void diag_real_time_work_fn(struct work_struct *work)
{
	int temp_real_time = MODE_REALTIME, i;

	/* If any of the process is voting for Real time, then Diag
	   should be in real time mode irrespective of other clauses. If
	   USB is connected, check what the memory device process is
	   voting for. If it is voting for Non real time, the final mode
	   should be Non real time, real time otherwise. If USB is
	   disconncted and no process is voting for real time, the
	   resultant mode should be Non Real Time.
	*/
	if ((driver->proc_rt_vote_mask & driver->proc_active_mask) &&
					(driver->proc_active_mask != 0))
			temp_real_time = MODE_REALTIME;
	else if (driver->usb_connected)
		if ((driver->proc_rt_vote_mask & DIAG_PROC_MEMORY_DEVICE) == 0)
			temp_real_time = MODE_NONREALTIME;
		else
			temp_real_time = MODE_REALTIME;
	else
		temp_real_time = MODE_NONREALTIME;

	if (temp_real_time != driver->real_time_mode) {
		for (i = 0; i < NUM_SMD_CONTROL_CHANNELS; i++)
			diag_send_diag_mode_update_by_smd(&driver->smd_cntl[i],
							temp_real_time);
	} else {
		pr_info("diag: did not update real time mode, already in the req mode %d",
					temp_real_time);
	}
	if (driver->real_time_update_busy > 0)
		driver->real_time_update_busy--;
}
void diag_real_time_work_fn(struct work_struct *work)
{
	int temp_real_time = MODE_REALTIME, i, j;

	for (i = 0; i < DIAG_NUM_PROC; i++) {
		if (driver->proc_active_mask == 0) {
			/*
			 * There are no DCI or Memory Device processes.
			 * Diag should be in Real Time mode.
			 */
			temp_real_time = MODE_REALTIME;
		} else if (!(driver->proc_rt_vote_mask[i] &
						driver->proc_active_mask)) {
			/* No active process is voting for real time mode */
			temp_real_time = MODE_NONREALTIME;
		}
		if (temp_real_time == driver->real_time_mode[i]) {
			pr_debug("diag: did not update real time mode on proc %d, already in the req mode %d",
				i, temp_real_time);
			continue;
		}

		if (i == DIAG_LOCAL_PROC) {
			for (j = 0; j < NUM_SMD_CONTROL_CHANNELS; j++)
				diag_send_diag_mode_update_by_smd(
					&driver->smd_cntl[j], temp_real_time);
		} else {
			diag_send_diag_mode_update_remote(i - 1,
							  temp_real_time);
		}
	}

	if (driver->real_time_update_busy > 0)
		driver->real_time_update_busy--;
}
void diag_real_time_work_fn(struct work_struct *work)
{
	int temp_real_time = MODE_REALTIME, i;

	if (driver->proc_active_mask == 0) {
		/* There are no DCI or Memory Device processes. Diag should
		 * be in Real Time mode.
		 */
		temp_real_time = MODE_REALTIME;
	} else if (!(driver->proc_rt_vote_mask & driver->proc_active_mask)) {
		/* No active process is voting for real time mode */
		temp_real_time = MODE_NONREALTIME;
	}

	if (temp_real_time != driver->real_time_mode) {
		for (i = 0; i < NUM_SMD_CONTROL_CHANNELS; i++)
			diag_send_diag_mode_update_by_smd(&driver->smd_cntl[i],
							temp_real_time);
	} else {
		pr_warn("diag: did not update real time mode, already in the req mode %d",
					temp_real_time);
	}
	if (driver->real_time_update_busy > 0)
		driver->real_time_update_busy--;
}
Exemplo n.º 4
0
void diag_mask_update_fn(struct work_struct *work)
{
	struct diag_smd_info *smd_info = container_of(work,
						struct diag_smd_info,
						diag_notify_update_smd_work);
	if (!smd_info) {
		pr_err("diag: In %s, smd info is null, cannot update masks for the peripheral\n",
			__func__);
		return;
	}

	diag_send_feature_mask_update(smd_info);
	diag_send_msg_mask_update(smd_info, ALL_SSID, ALL_SSID);
	diag_send_log_mask_update(smd_info, ALL_EQUIP_ID);
	diag_send_event_mask_update(smd_info);

	if (smd_info->notify_context == SMD_EVENT_OPEN) {
		diag_send_diag_mode_update_by_smd(smd_info,
				driver->real_time_mode[DIAG_LOCAL_PROC]);
		diag_send_peripheral_buffering_mode(
				&driver->buffering_mode[smd_info->peripheral]);
	}

	smd_info->notify_context = 0;
}
Exemplo n.º 5
0
void diag_real_time_work_fn(struct work_struct *work)
{
    int temp_real_time = MODE_REALTIME, i, j;

    for (i = 0; i < DIAG_NUM_PROC; i++) {
        temp_real_time = diag_compute_real_time(i);
        if (temp_real_time == driver->real_time_mode[i]) {
            pr_debug("diag: did not update real time mode on proc %d, already in the req mode %d",
                     i, temp_real_time);
            continue;
        }

        if (i == DIAG_LOCAL_PROC) {
            for (j = 0; j < NUM_SMD_CONTROL_CHANNELS; j++)
                diag_send_diag_mode_update_by_smd(
                    &driver->smd_cntl[j], temp_real_time);
        } else {
            diag_send_diag_mode_update_remote(i - 1,
                                              temp_real_time);
        }
    }

    if (driver->real_time_update_busy > 0)
        driver->real_time_update_busy--;
}
Exemplo n.º 6
0
void diag_send_diag_mode_update(int real_time)
{
	int i;
	for (i = 0; i < NUM_SMD_CONTROL_CHANNELS; i++) {
		diag_send_diag_mode_update_by_smd(&driver->smd_cntl[i],
							real_time);
	}
}
void diag_real_time_work_fn(struct work_struct *work)
{
	int temp_real_time = MODE_REALTIME, i, j;
	uint8_t send_update = 1;

	/*
	 * If any peripheral in the local processor is in either threshold or
	 * circular buffering mode, don't send the real time mode control
	 * packet.
	 */
	for (i = 0; i < NUM_SMD_CONTROL_CHANNELS; i++) {
		if (!driver->peripheral_buffering_support[i])
			continue;
		switch (driver->buffering_mode[i].mode) {
		case DIAG_BUFFERING_MODE_THRESHOLD:
		case DIAG_BUFFERING_MODE_CIRCULAR:
			send_update = 0;
			break;
		}
	}

	mutex_lock(&driver->mode_lock);
	for (i = 0; i < DIAG_NUM_PROC; i++) {
		temp_real_time = diag_compute_real_time(i);
		if (temp_real_time == driver->real_time_mode[i]) {
			pr_debug("diag: did not update real time mode on proc %d, already in the req mode %d",
				i, temp_real_time);
			continue;
		}

		if (i == DIAG_LOCAL_PROC) {
			if (!send_update) {
				pr_debug("diag: In %s, cannot send real time mode pkt since one of the periperhal is in buffering mode\n",
					 __func__);
				break;
			}
			for (j = 0; j < NUM_SMD_CONTROL_CHANNELS; j++)
				diag_send_diag_mode_update_by_smd(
					&driver->smd_cntl[j], temp_real_time);
		} else {
			diag_send_diag_mode_update_remote(i - 1,
							   temp_real_time);
		}
	}
	mutex_unlock(&driver->mode_lock);

	if (driver->real_time_update_busy > 0)
		driver->real_time_update_busy--;
}
Exemplo n.º 8
0
void diag_real_time_work_fn(struct work_struct *work)
{
	int temp_real_time = MODE_REALTIME, i;

	if (!(driver->proc_rt_vote_mask & driver->proc_active_mask) &&
					(driver->proc_active_mask != 0))
		temp_real_time = MODE_NONREALTIME;

	if (temp_real_time != driver->real_time_mode) {
		for (i = 0; i < NUM_SMD_CONTROL_CHANNELS; i++)
			diag_send_diag_mode_update_by_smd(&driver->smd_cntl[i],
							temp_real_time);
	} else {
		pr_warn("diag: did not update real time mode, already in the req mode %d",
					temp_real_time);
	}
	if (driver->real_time_update_busy > 0)
		driver->real_time_update_busy--;
}
void diag_real_time_work_fn(struct work_struct *work)
{
	int temp_real_time = MODE_REALTIME, i;

	if (driver->proc_active_mask == 0) {
		/* There are no DCI or Memory Device processes. Diag should
		 * be in Real Time mode irrespective of USB connection
		 */
		temp_real_time = MODE_REALTIME;
	} else if (driver->proc_rt_vote_mask & driver->proc_active_mask) {
		/* Atleast one process is alive and is voting for Real Time
		 * data - Diag should be in real time mode irrespective of USB
		 * connection.
		 */
		temp_real_time = MODE_REALTIME;
	} else if (driver->usb_connected) {
		/* If USB is connected, check individual process. If Memory
		 * Device Mode is active, set the mode requested by Memory
		 * Device process. Set to realtime mode otherwise.
		 */
		if ((driver->proc_rt_vote_mask & DIAG_PROC_MEMORY_DEVICE) == 0)
			temp_real_time = MODE_NONREALTIME;
		else
			temp_real_time = MODE_REALTIME;
	} else {
		/* We come here if USB is not connected and the active
		 * processes are voting for Non realtime mode.
		 */
		temp_real_time = MODE_NONREALTIME;
	}

	if (temp_real_time != driver->real_time_mode) {
		for (i = 0; i < NUM_SMD_CONTROL_CHANNELS; i++)
			diag_send_diag_mode_update_by_smd(&driver->smd_cntl[i],
							temp_real_time);
	} else {
		pr_debug("diag: did not update real time mode, already in the req mode %d",
					temp_real_time);
	}
	if (driver->real_time_update_busy > 0)
		driver->real_time_update_busy--;
}
Exemplo n.º 10
0
void diag_mask_update_fn(struct work_struct *work)
{
    struct diag_smd_info *smd_info = container_of(work,
                                     struct diag_smd_info,
                                     diag_notify_update_smd_work);
    if (!smd_info) {
        pr_err("diag: In %s, smd info is null, cannot update masks for the peripheral\n",
               __func__);
        return;
    }

    diag_send_feature_mask_update(smd_info);
    diag_send_msg_mask_update(smd_info->ch, ALL_SSID, ALL_SSID,
                              smd_info->peripheral);
    diag_send_log_mask_update(smd_info->ch, ALL_EQUIP_ID);
    diag_send_event_mask_update(smd_info->ch, diag_event_num_bytes);

    if (smd_info->notify_context == SMD_EVENT_OPEN)
        diag_send_diag_mode_update_by_smd(smd_info, MODE_REALTIME);

    smd_info->notify_context = 0;
}
void diag_mask_update_fn(struct work_struct *work)
{
	static int smd_channel_count = 0;

	struct diag_smd_info *smd_info = container_of(work,
						struct diag_smd_info,
						diag_notify_update_smd_work);
	if (!smd_info) {
		pr_err("diag: In %s, smd info is null, cannot update masks for the peripheral\n",
			__func__);
		return;
	}

	diag_send_feature_mask_update(smd_info);
	diag_send_msg_mask_update(smd_info, ALL_SSID, ALL_SSID,
						smd_info->peripheral);
	diag_send_log_mask_update(smd_info, ALL_EQUIP_ID);
	diag_send_event_mask_update(smd_info, diag_event_num_bytes);

	if (smd_info->notify_context == SMD_EVENT_OPEN) {
		/* we have to set non-optimized before setting optimized,
		 * otherwise optimized won't work as expected.
		 */
		pr_debug("diag: %s, optimized = %d, cmd_cached = %d\n",
			__func__, optimized_logging, optimized_cmd_cached);
		diag_send_diag_mode_update_by_smd(smd_info,
						driver->real_time_mode);

		/* optimized */
		smd_channel_count++;
		if (smd_channel_count == 3)
			smd_opened = 1;
		if (optimized_logging && optimized_cmd_cached && smd_opened)
			diag_send_diag_mode_update(MODE_NONREALTIME);
	}

	smd_info->notify_context = 0;
}
int diag_send_peripheral_buffering_mode(struct diag_buffering_mode_t *params)
{
	int err = 0;
	int mode = MODE_REALTIME;
	uint8_t peripheral = 0;
	struct diag_smd_info *smd_info = NULL;

	if (!params)
		return -EIO;

	peripheral = params->peripheral;
	if (peripheral > LAST_PERIPHERAL) {
		pr_err("diag: In %s, invalid peripheral %d\n", __func__,
		       peripheral);
		return -EINVAL;
	}

	switch (params->mode) {
	case DIAG_BUFFERING_MODE_STREAMING:
		mode = MODE_REALTIME;
		break;
	case DIAG_BUFFERING_MODE_THRESHOLD:
	case DIAG_BUFFERING_MODE_CIRCULAR:
		mode = MODE_NONREALTIME;
		break;
	default:
		pr_err("diag: In %s, invalid tx mode %d\n", __func__,
		       params->mode);
		return -EINVAL;
	}

	if (!driver->peripheral_buffering_support[peripheral]) {
		pr_debug("diag: In %s, peripheral %d doesn't support buffering\n",
			 __func__, peripheral);
		return -EIO;
	}

	/*
	 * Perform sanity on watermark values. These values must be
	 * checked irrespective of the buffering mode.
	 */
	if (((params->high_wm_val > DIAG_MAX_WM_VAL) ||
	     (params->low_wm_val > DIAG_MAX_WM_VAL)) ||
	    (params->low_wm_val > params->high_wm_val) ||
	    ((params->low_wm_val == params->high_wm_val) &&
	     (params->low_wm_val != DIAG_MIN_WM_VAL))) {
		pr_err("diag: In %s, invalid watermark values, high: %d, low: %d, peripheral: %d\n",
		       __func__, params->high_wm_val, params->low_wm_val,
		       peripheral);
		return -EINVAL;
	}

	smd_info = &driver->smd_cntl[peripheral];
	mutex_lock(&driver->mode_lock);
	err = diag_send_buffering_tx_mode_pkt(smd_info, params);
	if (err) {
		pr_err("diag: In %s, unable to send buffering mode packet to peripheral %d, err: %d\n",
		       __func__, peripheral, err);
		goto fail;
	}
	err = diag_send_buffering_wm_values(smd_info, params);
	if (err) {
		pr_err("diag: In %s, unable to send buffering wm value packet to peripheral %d, err: %d\n",
		       __func__, peripheral, err);
		goto fail;
	}
	err = diag_send_diag_mode_update_by_smd(smd_info, mode);
	if (err) {
		pr_err("diag: In %s, unable to send mode update to peripheral %d, mode: %d, err: %d\n",
		       __func__, peripheral, mode, err);
		goto fail;
	}
	driver->buffering_mode[peripheral].peripheral = peripheral;
	driver->buffering_mode[peripheral].mode = params->mode;
	driver->buffering_mode[peripheral].low_wm_val = params->low_wm_val;
	driver->buffering_mode[peripheral].high_wm_val = params->high_wm_val;
fail:
	mutex_unlock(&driver->mode_lock);
	return err;
}