Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 05176182 authored by Nadine Toledano's avatar Nadine Toledano
Browse files

msm: mhi: add MHI state machine



The Modem Host Interface (MHI) device driver supports
clients to send control and data packets such as
IP data packets, control messages and Diagnostic
data between the Host and the device. It follows the
MHI specification to transfer data.

MHI State Machine is a module in MHI device driver,
which is responsible for MHI state management and exposes
API to enable state transition of MHI client.

Change-Id: I46bcf1860ca6d6259a3a758424507bc535890cfd
Signed-off-by: default avatarNadine Toledano <nadinet@codeaurora.org>
parent 783bbd7d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -3,3 +3,4 @@ obj-y += mhi_mmio.o
obj-y += mhi.o
obj-y += mhi_ring.o
obj-y += mhi_uci.o
obj-y += mhi_sm.o
+1307 −0

File added.

Preview size limit exceeded, changes collapsed.

+51 −0
Original line number Diff line number Diff line
/* Copyright (c) 2015, The Linux Foundation. All rights reserved.
 *
 * 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 MHI_SM_H
#define MHI_SM_H

#include "mhi.h"
#include <linux/slab.h>
#include <linux/msm_ep_pcie.h>


/**
 * enum mhi_dev_event - MHI state change events
 * @MHI_DEV_EVENT_CTRL_TRIG: CTRL register change event.
 *				Not supported,for future use
 * @MHI_DEV_EVENT_M0_STATE: M0 state change event
 * @MHI_DEV_EVENT_M1_STATE: M1 state change event. Not supported, for future use
 * @MHI_DEV_EVENT_M2_STATE: M2 state change event. Not supported, for future use
 * @MHI_DEV_EVENT_M3_STATE: M0 state change event
 * @MHI_DEV_EVENT_HW_ACC_WAKEUP: pendding data on IPA, initiate Host wakeup
 * @MHI_DEV_EVENT_CORE_WAKEUP: MHI core initiate Host wakup
 */
enum mhi_dev_event {
	MHI_DEV_EVENT_CTRL_TRIG,
	MHI_DEV_EVENT_M0_STATE,
	MHI_DEV_EVENT_M1_STATE,
	MHI_DEV_EVENT_M2_STATE,
	MHI_DEV_EVENT_M3_STATE,
	MHI_DEV_EVENT_HW_ACC_WAKEUP,
	MHI_DEV_EVENT_CORE_WAKEUP,
	MHI_DEV_EVENT_MAX
};

int mhi_dev_sm_init(struct mhi_dev *dev);
int mhi_dev_sm_set_ready(void);
int mhi_dev_notify_sm_event(enum mhi_dev_event event);
int mhi_dev_sm_get_mhi_state(enum mhi_dev_state *state);
int mhi_dev_sm_syserr(void);
void mhi_dev_sm_pcie_handler(struct ep_pcie_notify *notify);

#endif /* MHI_SM_H */