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

Commit df8e3c86 authored by Sagar Dharia's avatar Sagar Dharia Committed by Gerrit - the friendly Code Review server
Browse files

slimbus: Provide framer-booted notification to slimbus device drivers



When slimbus resets (due to bus reset sequence, or after it shuts down
and comes up), framer boots up and starts clocking the bus.
Devices on the bus may be in undefined state at that time. Callback
is provided to slimbus device drivers so that controller can report
framer-booted notification so that drivers can take necessary action
to put devices in reset state so that they can acquire sync, report
present, and be operational.

Change-Id: I6068063ef32c91a67c246f9ee727b4724c11f5f2
Signed-off-by: default avatarSagar Dharia <sdharia@codeaurora.org>
parent d2056c0d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1047,6 +1047,7 @@ static void ngd_laddr_lookup(struct work_struct *work)
	struct slim_controller *ctrl = &dev->ctrl;
	struct slim_device *sbdev;
	int i;
	slim_framer_booted(ctrl);
	mutex_lock(&ctrl->m_ctrl);
	list_for_each_entry(sbdev, &ctrl->devs, dev_list) {
		int ret = 0;
+30 −0
Original line number Diff line number Diff line
@@ -637,6 +637,36 @@ void slim_report_absent(struct slim_device *sbdev)
}
EXPORT_SYMBOL(slim_report_absent);

/*
 * slim_framer_booted: This function is called by controller after the active
 * framer has booted (using Bus Reset sequence, or after it has shutdown and has
 * come back up). Components, devices on the bus may be in undefined state,
 * and this function triggers their drivers to do the needful
 * to bring them back in Reset state so that they can acquire sync, report
 * present and be operational again.
 */
void slim_framer_booted(struct slim_controller *ctrl)
{
	struct slim_device *sbdev;
	struct list_head *pos, *next;
	if (!ctrl)
		return;
	mutex_lock(&ctrl->m_ctrl);
	list_for_each_safe(pos, next, &ctrl->devs) {
		struct slim_driver *sbdrv;
		sbdev = list_entry(pos, struct slim_device, dev_list);
		mutex_unlock(&ctrl->m_ctrl);
		if (sbdev && sbdev->dev.driver) {
			sbdrv = to_slim_driver(sbdev->dev.driver);
			if (sbdrv->reset_device)
				sbdrv->reset_device(sbdev);
		}
		mutex_lock(&ctrl->m_ctrl);
	}
	mutex_unlock(&ctrl->m_ctrl);
}
EXPORT_SYMBOL(slim_framer_booted);

/*
 * slim_msg_response: Deliver Message response received from a device to the
 *	framework.
+15 −0
Original line number Diff line number Diff line
@@ -586,6 +586,9 @@ struct slim_controller {
 * @device_down: This callback is called when device reports absent, or the
 *		bus goes down. Device will report present when bus is up and
 *		device_up callback will be called again when that happens
 * @reset_device: This callback is called after framer is booted.
 *		Driver should do the needful to reset the device,
 *		so that device acquires sync and be operational.
 * @driver: Slimbus device drivers should initialize name and owner field of
 *	this structure
 * @id_table: List of slimbus devices supported by this driver
@@ -600,6 +603,8 @@ struct slim_driver {
	int				(*device_up)(struct slim_device *sldev);
	int				(*device_down)
						(struct slim_device *sldev);
	int				(*reset_device)
						(struct slim_device *sldev);

	struct device_driver		driver;
	const struct slim_device_id	*id_table;
@@ -1035,6 +1040,16 @@ extern int slim_assign_laddr(struct slim_controller *ctrl, const u8 *e_addr,
 */
void slim_report_absent(struct slim_device *sbdev);

/*
 * slim_framer_booted: This function is called by controller after the active
 * framer has booted (using Bus Reset sequence, or after it has shutdown and has
 * come back up). Components, devices on the bus may be in undefined state,
 * and this function triggers their drivers to do the needful
 * to bring them back in Reset state so that they can acquire sync, report
 * present and be operational again.
 */
void slim_framer_booted(struct slim_controller *ctrl);

/*
 * slim_msg_response: Deliver Message response received from a device to the
 *	framework.