1/* SPDX-License-Identifier: GPL-2.0-only
2 *
3 * Copyright (C) 2020-21 Intel Corporation.
4 */
5
6#ifndef IOSM_IPC_PORT_H
7#define IOSM_IPC_PORT_H
8
9#include <linux/wwan.h>
10
11#include "iosm_ipc_imem_ops.h"
12
13/**
14 * struct iosm_cdev - State of the char driver layer.
15 * @iosm_port:		Pointer of type wwan_port
16 * @ipc_imem:		imem instance
17 * @dev:		Pointer to device struct
18 * @pcie:		PCIe component
19 * @port_type:		WWAN port type
20 * @channel:		Channel instance
21 * @chl_id:		Channel Identifier
22 */
23struct iosm_cdev {
24	struct wwan_port *iosm_port;
25	struct iosm_imem *ipc_imem;
26	struct device *dev;
27	struct iosm_pcie *pcie;
28	enum wwan_port_type port_type;
29	struct ipc_mem_channel *channel;
30	enum ipc_channel_id chl_id;
31};
32
33/**
34 * ipc_port_init - Allocate IPC port & register to wwan subsystem for AT/MBIM
35 *		   communication.
36 * @ipc_imem:		Pointer to iosm_imem structure
37 * @ipc_port_cfg:	IPC Port Config
38 *
39 * Returns: 0 on success & NULL on failure
40 */
41struct iosm_cdev *ipc_port_init(struct iosm_imem *ipc_imem,
42				struct ipc_chnl_cfg ipc_port_cfg);
43
44/**
45 * ipc_port_deinit - Free IPC port & unregister port with wwan subsystem.
46 * @ipc_port:	Array of pointer to the ipc port data-struct
47 */
48void ipc_port_deinit(struct iosm_cdev *ipc_port[]);
49
50#endif
51