Re: [PATCH v6 7/7] bus: mhi: Expose DDR training data via controller sysfs

From: Kishore Batta

Date: Thu Oct 08 2026 - 02:12:29 EST



On 7/13/2026 10:38 PM, Manivannan Sadhasivam wrote:
On Mon, Jul 13, 2026 at 01:00:27PM +0530, Kishore Batta wrote:
On 7/9/2026 12:27 PM, Manivannan Sadhasivam wrote:
On Wed, Jul 01, 2026 at 04:07:41PM +0530, Kishore Batta wrote:
DDR training data captured during Sahara command mode needs to be
accessible to userspace so it can be persisted and reused on subsequent
boots. Currently, the training data is stored internally in the driver
but has no external visibility once the Sahara channel is torn down.

Expose the captured DDR training data via a read-only binary sysfs
attribute on the MHI controller device:

/sys/bus/mhi/devices/<mhi_cntrl>/ddr_training_data

The sysfs read callback serves data directly from controller scoped storage
and protects access with the controller training data lock. The attribute
lifetime is tied to the controller device via devres, allowing the data to
remain readable after Sahara channel teardown and ensuring automatic
cleanup when controller device is removed.

If this training data is RO, then what is the use of exposing it to userspace?

- Mani
The userspace component will read this from sysfs and save it to a file
named mdmddr_0x<serial_no>.mbn.

You need to mention the exact file name for the read data.

- Mani
The exact filename used by userspace is mdmddr0x<serial_no>.mbn. For example, for a device with serial number 0x12345678, userspace saves the data as mdmddr_0x12345678.mbn. The file is stored in the corresponding Sahara firmware directory. On the next boot, the driver first requests this serial number specific file and falls back to the default DDR training image if it is unavailable.