#include <linux/irq.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <linux/dma-mapping.h>
#include <linux/dmaengine.h>
#include <linux/slimbus.h>
#include <linux/delay.h>
#include <linux/pm_runtime.h>
#include <linux/mutex.h>
#include <linux/notifier.h>
#include <linux/remoteproc/qcom_rproc.h>
#include <linux/of.h>
#include <linux/io.h>
#include <linux/soc/qcom/qmi.h>
#include <linux/soc/qcom/pdr.h>
#include <net/sock.h>
#include "slimbus.h"
#define NGD_CFG …
#define NGD_CFG_ENABLE …
#define NGD_CFG_RX_MSGQ_EN …
#define NGD_CFG_TX_MSGQ_EN …
#define NGD_STATUS …
#define NGD_LADDR …
#define NGD_RX_MSGQ_CFG …
#define NGD_INT_EN …
#define NGD_INT_RECFG_DONE …
#define NGD_INT_TX_NACKED_2 …
#define NGD_INT_MSG_BUF_CONTE …
#define NGD_INT_MSG_TX_INVAL …
#define NGD_INT_IE_VE_CHG …
#define NGD_INT_DEV_ERR …
#define NGD_INT_RX_MSG_RCVD …
#define NGD_INT_TX_MSG_SENT …
#define NGD_INT_STAT …
#define NGD_INT_CLR …
#define DEF_NGD_INT_MASK …
#define SLIMBUS_QMI_SVC_ID …
#define SLIMBUS_QMI_SVC_V1 …
#define SLIMBUS_QMI_INS_ID …
#define SLIMBUS_QMI_SELECT_INSTANCE_REQ_V01 …
#define SLIMBUS_QMI_SELECT_INSTANCE_RESP_V01 …
#define SLIMBUS_QMI_POWER_REQ_V01 …
#define SLIMBUS_QMI_POWER_RESP_V01 …
#define SLIMBUS_QMI_CHECK_FRAMER_STATUS_REQ …
#define SLIMBUS_QMI_CHECK_FRAMER_STATUS_RESP …
#define SLIMBUS_QMI_POWER_REQ_MAX_MSG_LEN …
#define SLIMBUS_QMI_POWER_RESP_MAX_MSG_LEN …
#define SLIMBUS_QMI_SELECT_INSTANCE_REQ_MAX_MSG_LEN …
#define SLIMBUS_QMI_SELECT_INSTANCE_RESP_MAX_MSG_LEN …
#define SLIMBUS_QMI_CHECK_FRAMER_STAT_RESP_MAX_MSG_LEN …
#define SLIMBUS_QMI_RESP_TOUT …
#define SLIM_USR_MC_GENERIC_ACK …
#define SLIM_USR_MC_MASTER_CAPABILITY …
#define SLIM_USR_MC_REPORT_SATELLITE …
#define SLIM_USR_MC_ADDR_QUERY …
#define SLIM_USR_MC_ADDR_REPLY …
#define SLIM_USR_MC_DEFINE_CHAN …
#define SLIM_USR_MC_DEF_ACT_CHAN …
#define SLIM_USR_MC_CHAN_CTRL …
#define SLIM_USR_MC_RECONFIG_NOW …
#define SLIM_USR_MC_REQ_BW …
#define SLIM_USR_MC_CONNECT_SRC …
#define SLIM_USR_MC_CONNECT_SINK …
#define SLIM_USR_MC_DISCONNECT_PORT …
#define SLIM_USR_MC_REPEAT_CHANGE_VALUE …
#define SLIM_RX_MSGQ_TIMEOUT_VAL …
#define SLIM_LA_MGR …
#define SLIM_ROOT_FREQ …
#define LADDR_RETRY …
#define SLIM_MSGQ_BUF_LEN …
#define QCOM_SLIM_NGD_DESC_NUM …
#define SLIM_MSG_ASM_FIRST_WORD(l, mt, mc, dt, ad) …
#define INIT_MX_RETRIES …
#define DEF_RETRY_MS …
#define SAT_MAGIC_LSB …
#define SAT_MAGIC_MSB …
#define SAT_MSG_VER …
#define SAT_MSG_PROT …
#define to_ngd(d) …
struct ngd_reg_offset_data { … };
static const struct ngd_reg_offset_data ngd_v1_5_offset_info = …;
enum qcom_slim_ngd_state { … };
struct qcom_slim_ngd_qmi { … };
struct qcom_slim_ngd_ctrl;
struct qcom_slim_ngd;
struct qcom_slim_ngd_dma_desc { … };
struct qcom_slim_ngd { … };
struct qcom_slim_ngd_ctrl { … };
enum slimbus_mode_enum_type_v01 { … };
enum slimbus_pm_enum_type_v01 { … };
enum slimbus_resp_enum_type_v01 { … };
struct slimbus_select_inst_req_msg_v01 { … };
struct slimbus_select_inst_resp_msg_v01 { … };
struct slimbus_power_req_msg_v01 { … };
struct slimbus_power_resp_msg_v01 { … };
static const struct qmi_elem_info slimbus_select_inst_req_msg_v01_ei[] = …;
static const struct qmi_elem_info slimbus_select_inst_resp_msg_v01_ei[] = …;
static const struct qmi_elem_info slimbus_power_req_msg_v01_ei[] = …;
static const struct qmi_elem_info slimbus_power_resp_msg_v01_ei[] = …;
static int qcom_slim_qmi_send_select_inst_req(struct qcom_slim_ngd_ctrl *ctrl,
struct slimbus_select_inst_req_msg_v01 *req)
{ … }
static void qcom_slim_qmi_power_resp_cb(struct qmi_handle *handle,
struct sockaddr_qrtr *sq,
struct qmi_txn *txn, const void *data)
{ … }
static int qcom_slim_qmi_send_power_request(struct qcom_slim_ngd_ctrl *ctrl,
struct slimbus_power_req_msg_v01 *req)
{ … }
static const struct qmi_msg_handler qcom_slim_qmi_msg_handlers[] = …;
static int qcom_slim_qmi_init(struct qcom_slim_ngd_ctrl *ctrl,
bool apps_is_master)
{ … }
static void qcom_slim_qmi_exit(struct qcom_slim_ngd_ctrl *ctrl)
{ … }
static int qcom_slim_qmi_power_request(struct qcom_slim_ngd_ctrl *ctrl,
bool active)
{ … }
static u32 *qcom_slim_ngd_tx_msg_get(struct qcom_slim_ngd_ctrl *ctrl, int len,
struct completion *comp)
{ … }
static void qcom_slim_ngd_tx_msg_dma_cb(void *args)
{ … }
static int qcom_slim_ngd_tx_msg_post(struct qcom_slim_ngd_ctrl *ctrl,
void *buf, int len)
{ … }
static void qcom_slim_ngd_rx(struct qcom_slim_ngd_ctrl *ctrl, u8 *buf)
{ … }
static void qcom_slim_ngd_rx_msgq_cb(void *args)
{ … }
static int qcom_slim_ngd_post_rx_msgq(struct qcom_slim_ngd_ctrl *ctrl)
{ … }
static int qcom_slim_ngd_init_rx_msgq(struct qcom_slim_ngd_ctrl *ctrl)
{ … }
static int qcom_slim_ngd_init_tx_msgq(struct qcom_slim_ngd_ctrl *ctrl)
{ … }
static int qcom_slim_ngd_init_dma(struct qcom_slim_ngd_ctrl *ctrl)
{ … }
static irqreturn_t qcom_slim_ngd_interrupt(int irq, void *d)
{ … }
static int qcom_slim_ngd_xfer_msg(struct slim_controller *sctrl,
struct slim_msg_txn *txn)
{ … }
static int qcom_slim_ngd_xfer_msg_sync(struct slim_controller *ctrl,
struct slim_msg_txn *txn)
{ … }
static int qcom_slim_calc_coef(struct slim_stream_runtime *rt, int *exp)
{ … }
static int qcom_slim_ngd_enable_stream(struct slim_stream_runtime *rt)
{ … }
static int qcom_slim_ngd_get_laddr(struct slim_controller *ctrl,
struct slim_eaddr *ea, u8 *laddr)
{ … }
static int qcom_slim_ngd_exit_dma(struct qcom_slim_ngd_ctrl *ctrl)
{ … }
static void qcom_slim_ngd_setup(struct qcom_slim_ngd_ctrl *ctrl)
{ … }
static int qcom_slim_ngd_power_up(struct qcom_slim_ngd_ctrl *ctrl)
{ … }
static void qcom_slim_ngd_notify_slaves(struct qcom_slim_ngd_ctrl *ctrl)
{ … }
static void qcom_slim_ngd_master_worker(struct work_struct *work)
{ … }
static int qcom_slim_ngd_update_device_status(struct device *dev, void *null)
{ … }
static int qcom_slim_ngd_runtime_resume(struct device *dev)
{ … }
static int qcom_slim_ngd_enable(struct qcom_slim_ngd_ctrl *ctrl, bool enable)
{ … }
static int qcom_slim_ngd_qmi_new_server(struct qmi_handle *hdl,
struct qmi_service *service)
{ … }
static void qcom_slim_ngd_qmi_del_server(struct qmi_handle *hdl,
struct qmi_service *service)
{ … }
static const struct qmi_ops qcom_slim_ngd_qmi_svc_event_ops = …;
static int qcom_slim_ngd_qmi_svc_event_init(struct qcom_slim_ngd_ctrl *ctrl)
{ … }
static void qcom_slim_ngd_qmi_svc_event_deinit(struct qcom_slim_ngd_qmi *qmi)
{ … }
static struct platform_driver qcom_slim_ngd_driver;
#define QCOM_SLIM_NGD_DRV_NAME …
static const struct of_device_id qcom_slim_ngd_dt_match[] = …;
MODULE_DEVICE_TABLE(of, qcom_slim_ngd_dt_match);
static void qcom_slim_ngd_down(struct qcom_slim_ngd_ctrl *ctrl)
{ … }
static void qcom_slim_ngd_up_worker(struct work_struct *work)
{ … }
static int qcom_slim_ngd_ssr_pdr_notify(struct qcom_slim_ngd_ctrl *ctrl,
unsigned long action)
{ … }
static int qcom_slim_ngd_ssr_notify(struct notifier_block *nb,
unsigned long action,
void *data)
{ … }
static void slim_pd_status(int state, char *svc_path, void *priv)
{ … }
static int of_qcom_slim_ngd_register(struct device *parent,
struct qcom_slim_ngd_ctrl *ctrl)
{ … }
static int qcom_slim_ngd_probe(struct platform_device *pdev)
{ … }
static int qcom_slim_ngd_ctrl_probe(struct platform_device *pdev)
{ … }
static void qcom_slim_ngd_ctrl_remove(struct platform_device *pdev)
{ … }
static void qcom_slim_ngd_remove(struct platform_device *pdev)
{ … }
static int __maybe_unused qcom_slim_ngd_runtime_idle(struct device *dev)
{ … }
static int __maybe_unused qcom_slim_ngd_runtime_suspend(struct device *dev)
{ … }
static const struct dev_pm_ops qcom_slim_ngd_dev_pm_ops = …;
static struct platform_driver qcom_slim_ngd_ctrl_driver = …;
static struct platform_driver qcom_slim_ngd_driver = …;
module_platform_driver(…) …;
MODULE_LICENSE(…) …;
MODULE_DESCRIPTION(…) …;