Commit 0abd7412 authored by Nicolas Saenz Julienne's avatar Nicolas Saenz Julienne Committed by Greg Kroah-Hartman
Browse files

staging: vchi: Use enum vchiq_bulk_mode instead of vchi's transmission flags



vchi has a set of transfer flags which almost map 1:1 to vchiq's own
transfer modes. For the sake of simplicity let's use the later and
delete vchi's.

Signed-off-by: default avatarNicolas Saenz Julienne <nsaenzjulienne@suse.de>
Link: https://lore.kernel.org/r/20200629150945.10720-20-nsaenzjulienne@suse.de


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a24ac57e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -348,7 +348,7 @@ int bcm2835_audio_write(struct bcm2835_alsa_stream *alsa_stream,
		/* Send the message to the videocore */
		status = vchi_bulk_queue_transmit(instance->service,
						  src, count,
						  VCHI_FLAGS_BLOCK_UNTIL_DATA_READ,
						  VCHIQ_BULK_MODE_BLOCKING,
						  NULL);
	} else {
		while (count > 0) {
+1 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm-indirect.h>
#include "interface/vchiq_arm/vchiq_if.h"
#include "interface/vchi/vchi.h"

#define MAX_SUBSTREAMS   (8)
+2 −2
Original line number Diff line number Diff line
@@ -105,14 +105,14 @@ extern int32_t vchi_held_msg_release(struct vchi_held_msg *message);
extern int32_t vchi_bulk_queue_receive(struct vchi_service *service,
				       void *data_dst,
				       uint32_t data_size,
				       enum vchi_flags flags,
				       enum vchiq_bulk_mode mode,
				       void *transfer_handle);

// Routine to queue up data ready for transfer to the other (once they have signalled they are ready)
extern int32_t vchi_bulk_queue_transmit(struct vchi_service *service,
					const void *data_src,
					uint32_t data_size,
					enum vchi_flags flags,
				        enum vchiq_bulk_mode mode,
					void *transfer_handle);

/******************************************************************************
+0 −9
Original line number Diff line number Diff line
@@ -4,15 +4,6 @@
#ifndef VCHI_COMMON_H_
#define VCHI_COMMON_H_

//flags used when sending messages (must be bitmapped)
enum vchi_flags {
	VCHI_FLAGS_NONE                      = 0x0,
	VCHI_FLAGS_BLOCK_UNTIL_OP_COMPLETE   = 0x1,   // waits for message to be received, or sent (NB. not the same as being seen on other side)
	VCHI_FLAGS_CALLBACK_WHEN_OP_COMPLETE = 0x2,   // run a callback when message sent
	VCHI_FLAGS_BLOCK_UNTIL_QUEUED        = 0x4,   // return once the transfer is in a queue ready to go
	VCHI_FLAGS_BLOCK_UNTIL_DATA_READ     = 0x10,
};

//callback reasons when an event occurs on a service
enum vchi_callback_reason {
	/*
+3 −41
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@
#include <linux/module.h>
#include <linux/types.h>

#include "vchiq_if.h"
#include "../vchi/vchi.h"
#include "vchiq.h"
#include "vchiq_core.h"
@@ -57,30 +58,11 @@ EXPORT_SYMBOL(vchi_queue_kernel_message);
 *
 ***********************************************************/
int32_t vchi_bulk_queue_receive(struct vchi_service *service, void *data_dst,
				uint32_t data_size, enum vchi_flags flags,
				uint32_t data_size, enum vchiq_bulk_mode mode,
				void *bulk_handle)
{
	enum vchiq_bulk_mode mode;
	enum vchiq_status status;

	switch ((int)flags) {
	case VCHI_FLAGS_CALLBACK_WHEN_OP_COMPLETE
		| VCHI_FLAGS_BLOCK_UNTIL_QUEUED:
		WARN_ON(!service->callback);
		mode = VCHIQ_BULK_MODE_CALLBACK;
		break;
	case VCHI_FLAGS_BLOCK_UNTIL_OP_COMPLETE:
		mode = VCHIQ_BULK_MODE_BLOCKING;
		break;
	case VCHI_FLAGS_BLOCK_UNTIL_QUEUED:
	case VCHI_FLAGS_NONE:
		mode = VCHIQ_BULK_MODE_NOCALLBACK;
		break;
	default:
		WARN(1, "unsupported message\n");
		return VCHIQ_ERROR;
	}

	while (1) {
		status = vchiq_bulk_receive(service->handle, data_dst,
			data_size, bulk_handle, mode);
@@ -116,31 +98,11 @@ EXPORT_SYMBOL(vchi_bulk_queue_receive);
int32_t vchi_bulk_queue_transmit(struct vchi_service *service,
				 const void *data_src,
				 uint32_t data_size,
				 enum vchi_flags flags,
				 enum vchiq_bulk_mode mode,
				 void *bulk_handle)
{
	enum vchiq_bulk_mode mode;
	enum vchiq_status status;

	switch ((int)flags) {
	case VCHI_FLAGS_CALLBACK_WHEN_OP_COMPLETE
		| VCHI_FLAGS_BLOCK_UNTIL_QUEUED:
		WARN_ON(!service->callback);
		mode = VCHIQ_BULK_MODE_CALLBACK;
		break;
	case VCHI_FLAGS_BLOCK_UNTIL_DATA_READ:
	case VCHI_FLAGS_BLOCK_UNTIL_OP_COMPLETE:
		mode = VCHIQ_BULK_MODE_BLOCKING;
		break;
	case VCHI_FLAGS_BLOCK_UNTIL_QUEUED:
	case VCHI_FLAGS_NONE:
		mode = VCHIQ_BULK_MODE_NOCALLBACK;
		break;
	default:
		WARN(1, "unsupported message\n");
		return VCHIQ_ERROR;
	}

	while (1) {
		status = vchiq_bulk_transmit(service->handle, data_src,
			data_size, bulk_handle, mode);
Loading