Add 'qcom/opensource/audio-kernel/' from commit '0ee387dfadf349618494d6f82ec8cec796ebef70'
git-subtree-dir: qcom/opensource/audio-kernel git-subtree-mainline:99ab089c55
git-subtree-split:0ee387dfad
Change-Id: repo: https://git.codelinaro.org/clo/la/platform/vendor/qcom/opensource/audio-kernel-ar tag: AUDIO.LA.9.0.r1-07400-lanai.0
This commit is contained in:
197
qcom/opensource/audio-kernel/include/ipc/apr.h
Normal file
197
qcom/opensource/audio-kernel/include/ipc/apr.h
Normal file
@@ -0,0 +1,197 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2010-2017, 2019-2021, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
#ifndef __APR_H_
|
||||
#define __APR_H_
|
||||
|
||||
#include <linux/mutex.h>
|
||||
|
||||
enum apr_subsys_state {
|
||||
APR_SUBSYS_DOWN,
|
||||
APR_SUBSYS_UP,
|
||||
APR_SUBSYS_LOADED,
|
||||
APR_SUBSYS_UNKNOWN,
|
||||
};
|
||||
|
||||
struct apr_q6 {
|
||||
void *pil;
|
||||
atomic_t q6_state;
|
||||
atomic_t modem_state;
|
||||
struct mutex lock;
|
||||
/*
|
||||
* ToDo - Multiple client support to be added.
|
||||
* And checking for state UNKNOWN currently.
|
||||
*/
|
||||
void (*state_notify_cb)(enum apr_subsys_state state,
|
||||
void *client_handle);
|
||||
void *client_handle;
|
||||
};
|
||||
|
||||
struct apr_hdr {
|
||||
uint16_t hdr_field;
|
||||
uint16_t pkt_size;
|
||||
uint8_t src_svc;
|
||||
uint8_t src_domain;
|
||||
uint16_t src_port;
|
||||
uint8_t dest_svc;
|
||||
uint8_t dest_domain;
|
||||
uint16_t dest_port;
|
||||
uint32_t token;
|
||||
uint32_t opcode;
|
||||
};
|
||||
|
||||
#define APR_HDR_LEN(hdr_len) ((hdr_len)/4)
|
||||
#define APR_PKT_SIZE(hdr_len, payload_len) ((hdr_len) + (payload_len))
|
||||
#define APR_HDR_FIELD(msg_type, hdr_len, ver)\
|
||||
(((msg_type & 0x3) << 8) | ((hdr_len & 0xF) << 4) | (ver & 0xF))
|
||||
|
||||
#define APR_HDR_SIZE sizeof(struct apr_hdr)
|
||||
|
||||
/* Version */
|
||||
#define APR_PKT_VER 0x0
|
||||
|
||||
/* Command and Response Types */
|
||||
#define APR_MSG_TYPE_EVENT 0x0
|
||||
#define APR_MSG_TYPE_CMD_RSP 0x1
|
||||
#define APR_MSG_TYPE_SEQ_CMD 0x2
|
||||
#define APR_MSG_TYPE_NSEQ_CMD 0x3
|
||||
#define APR_MSG_TYPE_MAX 0x04
|
||||
|
||||
/* APR Basic Response Message */
|
||||
#define APR_BASIC_RSP_RESULT 0x000110E8
|
||||
#define APR_RSP_ACCEPTED 0x000100BE
|
||||
|
||||
/* Domain IDs */
|
||||
#define APR_DOMAIN_SIM 0x1
|
||||
#define APR_DOMAIN_PC 0x2
|
||||
#define APR_DOMAIN_MODEM 0x3
|
||||
#define APR_DOMAIN_ADSP 0x4
|
||||
#define APR_DOMAIN_APPS 0x5
|
||||
#define APR_DOMAIN_MAX 0x6
|
||||
|
||||
/* ADSP service IDs */
|
||||
#define APR_SVC_TEST_CLIENT 0x2
|
||||
#define APR_SVC_ADSP_CORE 0x3
|
||||
#define APR_SVC_AFE 0x4
|
||||
#define APR_SVC_VSM 0x5
|
||||
#define APR_SVC_VPM 0x6
|
||||
#define APR_SVC_ASM 0x7
|
||||
#define APR_SVC_ADM 0x8
|
||||
#define APR_SVC_ADSP_MVM 0x09
|
||||
#define APR_SVC_ADSP_CVS 0x0A
|
||||
#define APR_SVC_ADSP_CVP 0x0B
|
||||
#define APR_SVC_USM 0x0C
|
||||
#define APR_SVC_LSM 0x0D
|
||||
#define APR_SVC_VIDC 0x16
|
||||
#define APR_SVC_MAX 0x17
|
||||
|
||||
/* Modem Service IDs */
|
||||
#define APR_SVC_MVS 0x3
|
||||
#define APR_SVC_MVM 0x4
|
||||
#define APR_SVC_CVS 0x5
|
||||
#define APR_SVC_CVP 0x6
|
||||
#define APR_SVC_SRD 0x7
|
||||
|
||||
/* APR Port IDs */
|
||||
#define APR_MAX_PORTS 0x80
|
||||
|
||||
#define APR_NAME_MAX 0x40
|
||||
|
||||
#define RESET_EVENTS 0x000130D7
|
||||
|
||||
#define LPASS_RESTART_EVENT 0x1000
|
||||
#define LPASS_RESTART_READY 0x1001
|
||||
|
||||
struct apr_client_data {
|
||||
uint16_t reset_event;
|
||||
uint16_t reset_proc;
|
||||
uint16_t payload_size;
|
||||
uint16_t hdr_len;
|
||||
uint16_t msg_type;
|
||||
uint16_t src;
|
||||
uint16_t dest_svc;
|
||||
uint16_t src_port;
|
||||
uint16_t dest_port;
|
||||
uint32_t token;
|
||||
uint32_t opcode;
|
||||
void *payload;
|
||||
};
|
||||
|
||||
typedef int32_t (*apr_fn)(struct apr_client_data *data, void *priv);
|
||||
|
||||
struct apr_svc {
|
||||
uint16_t id;
|
||||
uint16_t dest_id;
|
||||
uint16_t client_id;
|
||||
uint16_t dest_domain;
|
||||
uint8_t rvd;
|
||||
uint8_t port_cnt;
|
||||
uint8_t svc_cnt;
|
||||
uint8_t need_reset;
|
||||
apr_fn port_fn[APR_MAX_PORTS];
|
||||
void *port_priv[APR_MAX_PORTS];
|
||||
apr_fn fn;
|
||||
void *priv;
|
||||
struct mutex m_lock;
|
||||
spinlock_t w_lock;
|
||||
uint8_t pkt_owner;
|
||||
#ifdef CONFIG_MSM_QDSP6_APRV2_VM
|
||||
uint16_t vm_dest_svc;
|
||||
uint32_t vm_handle;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct apr_client {
|
||||
uint8_t id;
|
||||
uint8_t svc_cnt;
|
||||
uint8_t rvd;
|
||||
struct mutex m_lock;
|
||||
struct apr_svc_ch_dev *handle;
|
||||
struct apr_svc svc[APR_SVC_MAX];
|
||||
};
|
||||
|
||||
struct apr_rx_intents {
|
||||
int num_of_intents;
|
||||
uint32_t size;
|
||||
};
|
||||
|
||||
struct apr_pkt_cfg {
|
||||
uint8_t pkt_owner;
|
||||
struct apr_rx_intents intents;
|
||||
};
|
||||
|
||||
int apr_load_adsp_image(void);
|
||||
struct apr_client *apr_get_client(int dest_id, int client_id);
|
||||
int apr_wait_for_device_up(int dest_id);
|
||||
int apr_get_svc(const char *svc_name, int dest_id, int *client_id,
|
||||
int *svc_idx, int *svc_id);
|
||||
void apr_cb_func(void *buf, int len, void *priv);
|
||||
struct apr_svc *apr_register(char *dest, char *svc_name, apr_fn svc_fn,
|
||||
uint32_t src_port, void *priv);
|
||||
inline int apr_fill_hdr(void *handle, uint32_t *buf, uint16_t src_port,
|
||||
uint16_t msg_type, uint16_t dest_port,
|
||||
uint32_t token, uint32_t opcode, uint16_t len);
|
||||
|
||||
int apr_send_pkt(void *handle, uint32_t *buf);
|
||||
int apr_deregister(void *handle);
|
||||
void subsys_notif_register(char *client_name, int domain,
|
||||
struct notifier_block *nb);
|
||||
void subsys_notif_deregister(char *client_name);
|
||||
int apr_get_dest_id(char *dest);
|
||||
uint16_t apr_get_data_src(struct apr_hdr *hdr);
|
||||
void change_q6_state(int state);
|
||||
void q6audio_dsp_not_responding(void);
|
||||
void apr_reset(void *handle);
|
||||
enum apr_subsys_state apr_get_subsys_state(void);
|
||||
enum apr_subsys_state apr_get_modem_state(void);
|
||||
void apr_set_modem_state(enum apr_subsys_state state);
|
||||
enum apr_subsys_state apr_get_q6_state(void);
|
||||
int apr_set_q6_state(enum apr_subsys_state state);
|
||||
void apr_set_subsys_state(void);
|
||||
const char *apr_get_lpass_subsys_name(void);
|
||||
uint16_t apr_get_reset_domain(uint16_t proc);
|
||||
int apr_start_rx_rt(void *handle);
|
||||
int apr_end_rx_rt(void *handle);
|
||||
void apr_register_adsp_state_cb(void *adsp_cb, void *client_handle);
|
||||
#endif
|
108
qcom/opensource/audio-kernel/include/ipc/aprv2_vm.h
Normal file
108
qcom/opensource/audio-kernel/include/ipc/aprv2_vm.h
Normal file
@@ -0,0 +1,108 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2016-2017, 2019 The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
#ifndef __APRV2_VM_H__
|
||||
#define __APRV2_VM_H__
|
||||
|
||||
#define APRV2_VM_MAX_DNS_SIZE (31)
|
||||
/* Includes NULL character. */
|
||||
#define APRV2_VM_PKT_SERVICE_ID_MASK (0x00FF)
|
||||
/* Bitmask of the service ID field. */
|
||||
|
||||
/* Packet Structure Definition */
|
||||
struct aprv2_vm_packet_t {
|
||||
uint32_t header;
|
||||
uint16_t src_addr;
|
||||
uint16_t src_port;
|
||||
uint16_t dst_addr;
|
||||
uint16_t dst_port;
|
||||
uint32_t token;
|
||||
uint32_t opcode;
|
||||
};
|
||||
|
||||
/**
|
||||
* In order to send command/event via MM HAB, the following buffer
|
||||
* format shall be followed, where the buffer is provided to the
|
||||
* HAB send API.
|
||||
* |-----cmd_id or evt_id -----| <- 32 bit, e.g. APRV2_VM_CMDID_REGISTER
|
||||
* |-----cmd payload ----------| e.g. aprv2_vm_cmd_register_t
|
||||
* | ... |
|
||||
*
|
||||
* In order to receive a command response or event ack, the following
|
||||
* buffer format shall be followed, where the buffer is provided to
|
||||
* the HAB receive API.
|
||||
* |-----cmd response ---------| e.g. aprv2_vm_cmd_register_rsp_t
|
||||
* | ... |
|
||||
*/
|
||||
|
||||
/* Registers a service with the backend APR driver. */
|
||||
#define APRV2_VM_CMDID_REGISTER (0x00000001)
|
||||
|
||||
struct aprv2_vm_cmd_register_t {
|
||||
uint32_t name_size;
|
||||
/**< The service name string size in bytes. */
|
||||
char name[APRV2_VM_MAX_DNS_SIZE];
|
||||
/**<
|
||||
* The service name string to register.
|
||||
*
|
||||
* A NULL name means the service does not have a name.
|
||||
*/
|
||||
uint16_t addr;
|
||||
/**<
|
||||
* The address to register.
|
||||
*
|
||||
* A zero value means to auto-generate a free dynamic address.
|
||||
* A non-zero value means to directly use the statically assigned address.
|
||||
*/
|
||||
};
|
||||
|
||||
struct aprv2_vm_cmd_register_rsp_t {
|
||||
int32_t status;
|
||||
/**< The status of registration. */
|
||||
uint32_t handle;
|
||||
/**< The registered service handle. */
|
||||
uint16_t addr;
|
||||
/**< The actual registered address. */
|
||||
};
|
||||
|
||||
#define APRV2_VM_CMDID_DEREGISTER (0x00000002)
|
||||
|
||||
struct aprv2_vm_cmd_deregister_t {
|
||||
uint32_t handle;
|
||||
/**< The registered service handle. */
|
||||
};
|
||||
|
||||
struct aprv2_vm_cmd_deregister_rsp_t {
|
||||
int32_t status;
|
||||
/**< The status of de-registration. */
|
||||
};
|
||||
|
||||
#define APRV2_VM_CMDID_ASYNC_SEND (0x00000003)
|
||||
|
||||
struct aprv2_vm_cmd_async_send_t {
|
||||
uint32_t handle;
|
||||
/**< The registered service handle. */
|
||||
struct aprv2_vm_packet_t pkt_header;
|
||||
/**< The packet header. */
|
||||
/* The apr packet payload follows */
|
||||
};
|
||||
|
||||
struct aprv2_vm_cmd_async_send_rsp_t {
|
||||
int32_t status;
|
||||
/**< The status of send. */
|
||||
};
|
||||
|
||||
#define APRV2_VM_EVT_RX_PKT_AVAILABLE (0x00000004)
|
||||
|
||||
struct aprv2_vm_evt_rx_pkt_available_t {
|
||||
struct aprv2_vm_packet_t pkt_header;
|
||||
/**< The packet header. */
|
||||
/* The apr packet payload follows */
|
||||
};
|
||||
|
||||
struct aprv2_vm_ack_rx_pkt_available_t {
|
||||
int32_t status;
|
||||
};
|
||||
|
||||
#endif /* __APRV2_VM_H__ */
|
288
qcom/opensource/audio-kernel/include/ipc/gpr-lite.h
Normal file
288
qcom/opensource/audio-kernel/include/ipc/gpr-lite.h
Normal file
@@ -0,0 +1,288 @@
|
||||
/* Copyright (c) 2011-2017, 2019-2021 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2018, Linaro Limited
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
* only version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __QCOM_GPR_H_
|
||||
#define __QCOM_GPR_H_
|
||||
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/device.h>
|
||||
#include "soc/audio_mod_devicetable.h"
|
||||
#include <bindings/qcom,gpr.h>
|
||||
|
||||
extern struct bus_type gprbus;
|
||||
|
||||
enum gpr_subsys_state {
|
||||
GPR_SUBSYS_DOWN,
|
||||
GPR_SUBSYS_UP,
|
||||
GPR_SUBSYS_LOADED,
|
||||
};
|
||||
|
||||
|
||||
struct gpr_q6 {
|
||||
//void *pil;
|
||||
atomic_t q6_state;
|
||||
atomic_t modem_state;
|
||||
struct mutex lock;
|
||||
};
|
||||
|
||||
|
||||
/* Version */
|
||||
#define GPR_PKT_VER 0x0
|
||||
|
||||
/*
|
||||
* Header format
|
||||
* Bits 3-0 : version
|
||||
* Bits 7-4 : header_size
|
||||
* Bits 31-8 : packet_size
|
||||
*/
|
||||
|
||||
#define GPR_PKT_INIT_PORT_V ( ( uint32_t ) 0 )
|
||||
|
||||
#define GPR_PKT_INIT_RESERVED_V ( ( uint16_t ) 0 )
|
||||
|
||||
#define GPR_PKT_INIT_DOMAIN_ID_V ( ( uint8_t ) 0 )
|
||||
|
||||
#define GPR_IDS_DOMAIN_ID_MODEM_V ( 1 ) /**< Modem domain. */
|
||||
#define GPR_IDS_DOMAIN_ID_ADSP_V ( 2 ) /**< aDSP domain. */
|
||||
#define GPR_IDS_DOMAIN_ID_APPS_V ( 3 ) /**< Application domain. */
|
||||
|
||||
/* V2.0 header size in number of 32-bit words. */
|
||||
#define GPR_PKT_HEADER_WORD_SIZE_V ( ( sizeof( struct gpr_pkt ) + 3 ) >> 2 )
|
||||
|
||||
/* V2.0 header size in number of bytes. */
|
||||
#define GPR_PKT_HEADER_BYTE_SIZE_V ( GPR_PKT_HEADER_WORD_SIZE_V << 2 )
|
||||
|
||||
/* Undefined value for where a valid GUID is expected. */
|
||||
#define GPR_UNDEFINED_ID_V ( ( uint32_t ) 0xFFFFFFFF )
|
||||
|
||||
#define GPR_PKT_INIT_CLIENT_DATA_V ( ( uint8_t ) 0 )
|
||||
|
||||
/***********************************************************/
|
||||
/** GPRv2 Packet Bitfield Macros ***/
|
||||
/***********************************************************/
|
||||
|
||||
/* Bitmask and bit shift of the version field. */
|
||||
#define GPR_PKT_VERSION_MASK ( 0x0000000F )
|
||||
#define GPR_PKT_VERSION_SHFT ( 0 )
|
||||
|
||||
/* Bitmask and bit shift of the header size field. */
|
||||
#define GPR_PKT_HEADER_SIZE_MASK ( 0x000000F0 )
|
||||
#define GPR_PKT_HEADER_SIZE_SHFT ( 4 )
|
||||
|
||||
/* Bitmask and bit shift of the reserved field.
|
||||
* Includes 4 reserved bits from client data field */
|
||||
#define GPR_PKT_RESERVED_MASK ( 0xFFF00000 )
|
||||
#define GPR_PKT_RESERVED_SHFT ( 20 )
|
||||
|
||||
/* Bitmask and bit shift of the packet size field. */
|
||||
#define GPR_PKT_PACKET_SIZE_MASK ( 0xFFFFFF00 )
|
||||
#define GPR_PKT_PACKET_SIZE_SHFT ( 8 )
|
||||
|
||||
/**********************************************************************/
|
||||
/** Packet Helper Macros ***/
|
||||
/**********************************************************************/
|
||||
|
||||
/* Gets the value of a field, including the specified mask and shift. */
|
||||
#define GPR_GET_BITMASK( mask, shift, value ) \
|
||||
( ( ( value ) & ( mask ) ) >> ( shift ) )
|
||||
|
||||
/* Sets a value in a field with a specified mask and shift. */
|
||||
#define GPR_SET_BITMASK( mask, shift, value ) \
|
||||
( ( ( value ) << ( shift ) ) & ( mask ) )
|
||||
|
||||
/* Gets the value of a field. */
|
||||
#define GPR_GET_FIELD( field, value ) \
|
||||
GPR_GET_BITMASK( ( field##_MASK ), ( field##_SHFT ), ( value ) )
|
||||
|
||||
/* Sets a value in a field. */
|
||||
#define GPR_SET_FIELD( field, value ) \
|
||||
GPR_SET_BITMASK( ( field##_MASK ), ( field##_SHFT ), ( value ) )
|
||||
|
||||
/* Returns an 8-bit aligned pointer to a base address pointer plus an
|
||||
offset, in bytes.*/
|
||||
#define GPR_PTR_END_OF( base_ptr, offset ) \
|
||||
( ( ( uint8_t* ) base_ptr ) + ( offset ) )
|
||||
|
||||
/** Given the packet header, returns the packet's current size in bytes.
|
||||
The current packet byte size is the sum of the base packet structure and
|
||||
the used portion of the payload.
|
||||
*/
|
||||
#define GPR_PKT_GET_PACKET_BYTE_SIZE( header ) \
|
||||
( GPR_GET_FIELD( GPR_PKT_PACKET_SIZE, header ) )
|
||||
|
||||
/* Given the packet header, returns the header's current size in bytes. */
|
||||
#define GPR_PKT_GET_HEADER_BYTE_SIZE( header ) \
|
||||
( GPR_GET_FIELD( GPR_PKT_HEADER_SIZE, header ) << 2 )
|
||||
|
||||
/** Given the packet header, returns the payload's current size in bytes.
|
||||
The current payload byte size is the difference between the packet size and
|
||||
the header size.
|
||||
*/
|
||||
#define GPR_PKT_GET_PAYLOAD_BYTE_SIZE( header ) \
|
||||
( GPR_PKT_GET_PACKET_BYTE_SIZE( header ) - \
|
||||
GPR_PKT_GET_HEADER_BYTE_SIZE( header ) )
|
||||
|
||||
/** Given the packet, returns a pointer to the beginning of the packet's
|
||||
payload. */
|
||||
#define GPR_PKT_GET_PAYLOAD( type, packet_ptr ) \
|
||||
( ( type* ) GPR_PTR_END_OF( packet_ptr, \
|
||||
GPR_PKT_GET_HEADER_BYTE_SIZE( \
|
||||
( ( struct gpr_hdr* ) packet_ptr )->header ) ) )
|
||||
|
||||
#define GPR_HDR_FIELD(msg_type, hdr_len, ver)\
|
||||
(((msg_type & 0x3) << 8) | ((hdr_len & 0xF) << 4) | (ver & 0xF))
|
||||
|
||||
#define GPR_HDR_SIZE sizeof(struct gpr_hdr)
|
||||
#define GPR_SEQ_CMD_HDR_FIELD GPR_HDR_FIELD(GPR_MSG_TYPE_SEQ_CMD, \
|
||||
GPR_HDR_LEN(GPR_HDR_SIZE), \
|
||||
GPR_PKT_VER)
|
||||
|
||||
/**********************************************************************/
|
||||
/** SPF GUID definitions ***/
|
||||
/**********************************************************************/
|
||||
/* An empty macro to mark non-GUIDs so that GUID script doesn't mistake
|
||||
the ID for a GUID */
|
||||
#define MM_NON_GUID(x) x
|
||||
|
||||
/* GUID owner is QTI. */
|
||||
#define MM_GUID_OWNER_QTI 0x0
|
||||
|
||||
/* GUID owner is not-QTI. */
|
||||
#define MM_GUID_OWNER_NON_QTI 0x1
|
||||
|
||||
/* Mask and Shift for Owner */
|
||||
#define MM_GUID_OWNER_MASK MM_NON_GUID(0xF0000000)
|
||||
#define MM_GUID_OWNER_SHIFT 28
|
||||
|
||||
/************************************************/
|
||||
/* GUID types ***/
|
||||
/************************************************/
|
||||
|
||||
/* Reserved */
|
||||
#define MM_GUID_TYPE_RESERVED 0x0
|
||||
|
||||
/* Control commands */
|
||||
#define MM_GUID_TYPE_CONTROL_CMD 0x1
|
||||
|
||||
/* Responses of control commands */
|
||||
#define MM_GUID_TYPE_CONTROL_CMD_RSP 0x2
|
||||
|
||||
/* Control events */
|
||||
#define MM_GUID_TYPE_CONTROL_EVENT 0x3
|
||||
|
||||
/* Data commands */
|
||||
#define MM_GUID_TYPE_DATA_CMD 0x4
|
||||
|
||||
/* Data command responses */
|
||||
#define MM_GUID_TYPE_DATA_CMD_RSP 0x5
|
||||
|
||||
/* Data events */
|
||||
#define MM_GUID_TYPE_DATA_EVENT 0x6
|
||||
|
||||
/* Module-id */
|
||||
#define MM_GUID_TYPE_MODULE_ID 0x7
|
||||
|
||||
/* Module's param & event-id */
|
||||
#define MM_GUID_TYPE_PARAM_EVENT_ID 0x8
|
||||
|
||||
/* Media format-id. */
|
||||
#define MM_GUID_TYPE_FORMAT_ID 0x9
|
||||
|
||||
/* CAPI */
|
||||
#define MM_GUID_TYPE_CAPI 0xA
|
||||
|
||||
/* MAX */
|
||||
#define MM_GUID_TYPE_MAX 0xB
|
||||
/** Rest are reserved */
|
||||
|
||||
/* Zero is an invalid ID.
|
||||
* To be used like NULL value for pointers */
|
||||
#define MM_GUID_INVALID 0
|
||||
|
||||
/* Mask and shift for GUID type */
|
||||
#define MM_GUID_TYPE_MASK MM_NON_GUID(0x0F000000)
|
||||
#define MM_GUID_TYPE_SHIFT 24
|
||||
|
||||
struct gpr_hdr {
|
||||
uint32_t header;
|
||||
uint8_t dst_domain_id;
|
||||
uint8_t src_domain_id;
|
||||
uint8_t client_data;
|
||||
uint8_t reserved;
|
||||
uint32_t src_port;
|
||||
uint32_t dst_port;
|
||||
uint32_t token;
|
||||
uint32_t opcode;
|
||||
} __packed;
|
||||
|
||||
struct gpr_pkt {
|
||||
struct gpr_hdr hdr;
|
||||
DECLARE_FLEX_ARRAY(uint8_t, payload);
|
||||
};
|
||||
|
||||
#define GPR_IBASIC_RSP_RESULT 0x02001005
|
||||
|
||||
/* Bits 0 to 15 -- Minor version, Bits 16 to 31 -- Major version */
|
||||
#define GPR_SVC_MAJOR_VERSION(v) ((v >> 16) & 0xFF)
|
||||
#define GPR_SVC_MINOR_VERSION(v) (v & 0xFF)
|
||||
|
||||
struct gpr_device {
|
||||
struct device dev;
|
||||
uint16_t svc_id;
|
||||
uint16_t domain_id;
|
||||
uint32_t version;
|
||||
char name[GPR_NAME_SIZE];
|
||||
spinlock_t lock;
|
||||
struct list_head node;
|
||||
};
|
||||
|
||||
#define to_gpr_device(d) container_of(d, struct gpr_device, dev)
|
||||
|
||||
struct gpr_driver {
|
||||
int (*probe)(struct gpr_device *sl);
|
||||
int (*remove)(struct gpr_device *sl);
|
||||
int (*callback)(struct gpr_device *a,
|
||||
void *d);
|
||||
struct device_driver driver;
|
||||
const struct gpr_device_id *id_table;
|
||||
};
|
||||
|
||||
#define to_gpr_driver(d) container_of(d, struct gpr_driver, driver)
|
||||
|
||||
/*
|
||||
* use a macro to avoid include chaining to get THIS_MODULE
|
||||
*/
|
||||
#define gpr_driver_register(drv) __gpr_driver_register(drv, THIS_MODULE)
|
||||
|
||||
int __gpr_driver_register(struct gpr_driver *drv, struct module *owner);
|
||||
void gpr_driver_unregister(struct gpr_driver *drv);
|
||||
|
||||
/**
|
||||
* module_gpr_driver() - Helper macro for registering a gprbus driver
|
||||
* @__gprbus_driver: gprbus_driver struct
|
||||
*
|
||||
* Helper macro for gprbus drivers which do not do anything special in
|
||||
* module init/exit. This eliminates a lot of boilerplate. Each module
|
||||
* may only use this macro once, and calling it replaces module_init()
|
||||
* and module_exit()
|
||||
*/
|
||||
#define module_gpr_driver(__gpr_driver) \
|
||||
module_driver(__gpr_driver, gpr_driver_register, \
|
||||
gpr_driver_unregister)
|
||||
|
||||
int gpr_send_pkt(struct gpr_device *adev, struct gpr_pkt *pkt);
|
||||
|
||||
enum gpr_subsys_state gpr_get_modem_state(void);
|
||||
enum gpr_subsys_state gpr_get_q6_state(void);
|
||||
#endif /* __QCOM_GPR_H_ */
|
Reference in New Issue
Block a user