2020-06-29 19:03:30

by Bhaumik Bhatt

[permalink] [raw]
Subject: [PATCH v4 0/9] Introduce features and debugfs/sysfs entries for MHI

Introduce independent bus and device voting mechanism for clients and save
hardware information from BHI.
Allow reading and modifying some MHI variables for debug, test, and
informational purposes using debugfs.
Read values for device specific hardware information to be used by OEMs in
factory testing such as serial number and PK hash using sysfs.

This set of patches was tested on arm64 and x86.

v4:
-Removed bus: mhi: core: Introduce independent voting mechanism patch
-Removed bus vote function from debugfs due to independent voting removal
-Added helper resume APIs to aid consolidation of spread out code
-Added a clean-up patch and a missing host resume in voting API

v3:
-Add patch to check for pending packets in suspend as a dependency for the
independent voting mechanism introduction
-Include register dump entry for debugfs to dump MHI, BHI, and BHIe registers
-Update commit message for the debugfs patch
-Updated Documentation/ABI with the required info for sysfs
-Updated debugfs patch to include a new KConfig entry and dependencies
-Updated reviewed-by for some patches

v2:
-Added a new debugfs.c file for specific debugfs entries and code
-Updated commit text and addressed some comments for voting change
-Made sure sysfs is only used for serial number and OEM PK hash usage

Bhaumik Bhatt (9):
bus: mhi: core: Remove double occurrence for mhi_ctrl_ev_task()
declaration
bus: mhi: core: Abort suspends due to outgoing pending packets
bus: mhi: core: Use helper API to trigger a non-blocking host resume
bus: mhi: core: Trigger a host resume when device vote is requested
bus: mhi: core: Use generic name field for an MHI device
bus: mhi: core: Introduce helper function to check device state
bus: mhi: core: Introduce debugfs entries and counters for MHI
bus: mhi: core: Read and save device hardware information from BHI
bus: mhi: core: Introduce sysfs entries for MHI

Documentation/ABI/stable/sysfs-bus-mhi | 25 ++
MAINTAINERS | 1 +
drivers/bus/mhi/Kconfig | 8 +
drivers/bus/mhi/core/Makefile | 5 +-
drivers/bus/mhi/core/boot.c | 17 +-
drivers/bus/mhi/core/debugfs.c | 444 +++++++++++++++++++++++++++++++++
drivers/bus/mhi/core/init.c | 65 ++++-
drivers/bus/mhi/core/internal.h | 38 ++-
drivers/bus/mhi/core/main.c | 27 +-
drivers/bus/mhi/core/pm.c | 19 +-
include/linux/mhi.h | 18 +-
11 files changed, 633 insertions(+), 34 deletions(-)
create mode 100644 Documentation/ABI/stable/sysfs-bus-mhi
create mode 100644 drivers/bus/mhi/core/debugfs.c

--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


2020-06-29 21:37:12

by Bhaumik Bhatt

[permalink] [raw]
Subject: [PATCH v4 6/9] bus: mhi: core: Introduce helper function to check device state

Introduce a helper function to determine whether the device is in a
powered ON state and resides in one of the active MHI states. This will
allow for some use cases where access can be pre-determined.

Signed-off-by: Bhaumik Bhatt <[email protected]>
Reviewed-by: Jeffrey Hugo <[email protected]>
---
drivers/bus/mhi/core/internal.h | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/drivers/bus/mhi/core/internal.h b/drivers/bus/mhi/core/internal.h
index cb32eaf..997c6e9 100644
--- a/drivers/bus/mhi/core/internal.h
+++ b/drivers/bus/mhi/core/internal.h
@@ -598,6 +598,11 @@ int mhi_queue_state_transition(struct mhi_controller *mhi_cntrl,
int __mhi_device_get_sync(struct mhi_controller *mhi_cntrl);
int mhi_send_cmd(struct mhi_controller *mhi_cntrl, struct mhi_chan *mhi_chan,
enum mhi_cmd_type cmd);
+static inline bool mhi_is_active(struct mhi_controller *mhi_cntrl)
+{
+ return (mhi_cntrl->dev_state >= MHI_STATE_M0 &&
+ mhi_cntrl->dev_state <= MHI_STATE_M3_FAST);
+}

static inline void mhi_trigger_resume(struct mhi_controller *mhi_cntrl,
bool hard_wakeup)
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

2020-07-04 15:14:23

by Manivannan Sadhasivam

[permalink] [raw]
Subject: Re: [PATCH v4 6/9] bus: mhi: core: Introduce helper function to check device state

On Mon, Jun 29, 2020 at 09:39:39AM -0700, Bhaumik Bhatt wrote:
> Introduce a helper function to determine whether the device is in a
> powered ON state and resides in one of the active MHI states. This will
> allow for some use cases where access can be pre-determined.
>
> Signed-off-by: Bhaumik Bhatt <[email protected]>
> Reviewed-by: Jeffrey Hugo <[email protected]>

Reviewed-by: Manivannan Sadhasivam <[email protected]>

Thanks,
Mani

> ---
> drivers/bus/mhi/core/internal.h | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/bus/mhi/core/internal.h b/drivers/bus/mhi/core/internal.h
> index cb32eaf..997c6e9 100644
> --- a/drivers/bus/mhi/core/internal.h
> +++ b/drivers/bus/mhi/core/internal.h
> @@ -598,6 +598,11 @@ int mhi_queue_state_transition(struct mhi_controller *mhi_cntrl,
> int __mhi_device_get_sync(struct mhi_controller *mhi_cntrl);
> int mhi_send_cmd(struct mhi_controller *mhi_cntrl, struct mhi_chan *mhi_chan,
> enum mhi_cmd_type cmd);
> +static inline bool mhi_is_active(struct mhi_controller *mhi_cntrl)
> +{
> + return (mhi_cntrl->dev_state >= MHI_STATE_M0 &&
> + mhi_cntrl->dev_state <= MHI_STATE_M3_FAST);
> +}
>
> static inline void mhi_trigger_resume(struct mhi_controller *mhi_cntrl,
> bool hard_wakeup)
> --
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
>