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

Commit 9fe359e4 authored by David Collins's avatar David Collins
Browse files

spmi: add spmi controller simulator



Add an SPMI controller simulator which can be used to simulate
PMICs before they are physically available.

Change-Id: I607dcc51c8fc755878c0da0d112345f03ed47205
Signed-off-by: default avatarDavid Collins <collinsd@codeaurora.org>
parent dc8ec7ba
Loading
Loading
Loading
Loading
+87 −0
Original line number Diff line number Diff line
SPMI Controller Simulator

The SPMI Controller Simulator simulates an SPMI bus with PMIC devices attached
to it.

See spmi.txt for the generic SPMI controller binding requirements for child
nodes.

Supported Properties:

- compatible
	Usage:      required
	Value type: <string>
	Definition: Must be "qcom,spmi-sim".

- reg
	Usage:      required
	Value type: <prop-encoded-array>
	Definition: List of SPMI address and size pairs.  These addresses are
		    the ones to be simulated.

- #address-cells
	Usage:      required
	Value type: <u32>
	Definition: Must be 2.

- #size-cells
	Usage:      required
	Value type: <u32>
	Definition: Must be 0.

- interrupt-controller
	Usage:      required
	Value type: boolean
	Definition: Boolean indicating that the SPMI Controller Simulator is an
		    interrupt controller.

- #interrupt-cells
	Usage:      required
	Value type: <u32>
	Definition: Must be 4.
		    Interrupts are specified as a 4-tuple:
			Cell 1: Slave ID for the requested interrupt (0-15)
			Cell 2: Peripheral ID for requested interrupt (0-255)
			Cell 3: The requested peripheral interrupt (0-7)
			Cell 4: Interrupt flags indicating level-sense
				information, as defined in:
				dt-bindings/interrupt-controller/irq.h

- qcom,reg-defaults
	Usage:      optional
	Value type: <prop-encoded-array>
	Definition: List of SPMI address and value pairs.  These define the
		    default values read back from the simulated registers.  The
		    values must be between 0 and 255.

Simulated PMIC Device Supported Properties:

- qcom,spmi-sim
	Usage:      required
	Value type: <phandle>
	Definition: phandle of the spmi-sim bus device that the simulated PMIC
		    device should be used with.

Example:

spmi_sim: spmi-sim {
	compatible = "qcom,spmi-sim";
	reg = <0x00000 0x20000>,
	      <0x40000 0x20000>;
	#address-cells = <2>;
	#size-cells = <0>;
	interrupt-controller;
	#interrupt-cells = <4>;

	qcom,reg-defaults =
		<0x00104 0x51>,
		<0x00105 0x14>,
		<0x40104 0x51>,
		<0x40105 0x18>;
};

pm855-sim {
	compatible = "qcom,pm855-sim";
	qcom,spmi-sim = <&spmi_sim>;
	qcom,sid-offset = <0>;
};
+2 −0
Original line number Diff line number Diff line
@@ -34,4 +34,6 @@ config SPMI_MSM_PMIC_ARB_DEBUG
	  Inc. (QTI) MSM family processors.  This feature is available on chips
	  with PMIC arbiter version 5 and above.

source "drivers/spmi/simulator/Kconfig"

endif
+1 −0
Original line number Diff line number Diff line
@@ -5,3 +5,4 @@ obj-$(CONFIG_SPMI) += spmi.o

obj-$(CONFIG_SPMI_MSM_PMIC_ARB)	+= spmi-pmic-arb.o
obj-$(CONFIG_SPMI_MSM_PMIC_ARB_DEBUG)	+= spmi-pmic-arb-debug.o
obj-y	+= simulator/
+14 −0
Original line number Diff line number Diff line
#
# SPMI Simulator driver configuration
#
menuconfig SPMI_SIMULATOR
	tristate "SPMI Controller Simulator"
	help
	  The SPMI Controller Simulator provides a means to simulate registers
	  within the SPMI address space.  Each register can be read and written.
	  Additionally, callback functions can be defined per register by
	  other drivers which simulate the behavior of PMIC peripherals.

if SPMI_SIMULATOR

endif
+4 −0
Original line number Diff line number Diff line
#
# Makefile for kernel SPMI Simulator.
#
obj-$(CONFIG_SPMI_SIMULATOR)	+= spmi-sim.o
Loading