SlideShare a Scribd company logo
Vinod Koul, Sanyog Kale
Intel Corp
MIPI SoundWire® Linux Subsystem:
An introduction to Protocol and
Linux Subsystem
©	2017	MIPI	Alliance,	Inc.
Agenda
• MIPI	SoundWire®	Basics
• Linux	Subsystem
• SoundWire	Linux	Bus
• SoundWire	Master
• SoundWire	Slave
2
Intel	Corp
©	2017	MIPI	Alliance,	Inc.
SoundWire®	PHY
• Support	one	of	1.2	or	1.8	V
• Clock	up	to	12.288MHz
• Dual	data	rate
• Modified	NRZI	encoding
– Logic	0:	physical	signal	inverted	from	value	in	preceding	bitSlot
– Logic	1:	no	change	in	physical	signal,	level	maintained	by	bus-keeper
• TDM
– Each	device	‘owns’	bit	slot
• Data
– PCM
– PDM
– Bulk	Transfers
• Bulk	Register	Access	(BRA)
• Bulk	Transfer	Protocol	(BTP)
3
Intel	Corp
©	2017	MIPI	Alliance,	Inc.
Device	Types
• Master
– Provides	Clock	and	Sync	pattern	on	data	line
– Bus	management,	bit	allocation
• Slave
– Audio	peripheral	(MIC,	Codec,	Amps)
– 1	to	11	Slaves	connected,	Multi-drop	bus
– In	band	Interrupt,	System	wake
• Monitor
– Test	equipment,	in	snoop	analyze	mode
– Temporarily	take	over	bus,	issue	Read/Write	commands
4
Intel	Corp
©	2017	MIPI	Alliance,	Inc.
SoundWire®	Topologies
5
Intel	Corp
©	2017	MIPI	Alliance,	Inc.
SoundWire®	Topologies
6
Intel	Corp
©	2017	MIPI	Alliance,	Inc.
SoundWire®	Topologies
7
Intel	Corp
©	2017	MIPI	Alliance,	Inc.
Enumeration
• Register	DevId 0-5,	48-bit	unique	value
– ManufacturerID,	PartID
– Class	(not	defined	yet)
– SoundWire	spec	version
– UniqueID
• Slave	reports	present	on	Dev	Num 0
• Master	reads	DevId 0-5
• Assigns	Dev	Num X	(1..11)
• Slave	reports	present	on	Dev	Num X
8
Intel	Corp
©	2017	MIPI	Alliance,	Inc.
SoundWire®	DisCo℠	
• MIPI	Discovery	and	Configuration	(DisCo℠)	mechanism
• MIPI	adopted	Spec
• Optional,	but	values	mandatory	for	Software
• Implemented	as	ACPI	_DSD	methods
• Describes	SoundWire	Master	properties	and	Slave	properties
9
Intel	Corp
©	2017	MIPI	Alliance,	Inc.
SoundWire®	Linux	Subsystem
10
Intel	Corp
SoundWire	Master
SoundWire	Bus
SoundWire	SlaveSoundWire	Slave SoundWire	Slave
SoundWire	Regmap
©	2017	MIPI	Alliance,	Inc.
SoundWire®	Device	Model
11
Intel	Corp
SoundWire	
Master	0
SoundWire	Bus
SoundWire	
Slave	0
SoundWire	
Slave	1
Device:	sdw-master0
Bus	Type:	SoundWire
Driver:	SoundWire	Master	Driver
Device:	sdw:m<>p<>
Parent	Device:	int-sdw.0
Bus	Type:	SoundWire
Driver:	SoundWire	Slave	Driver
Device:	sdw:m<>p<>
Parent	Device:	int-sdw.0
Bus	Type:	SoundWire
Driver:	SoundWire	Slave	Driver
©	2017	MIPI	Alliance,	Inc.
SoundWire®	Linux	Bus
• The	Bus	is	instantiated	by:
– int sdw_add_bus_master(struct sdw_bus *bus);
– Master	allocates	sdw_bus structres
– Initialized	by	invoking	this	API
• Similarly	exit	is	performed	by:
– void	sdw_delete_bus_master(struct sdw_bus
*bus);
12
Intel	Corp
struct	sdw_bus	{
								struct	device	*dev;
								bool	acpi_enabled;
								unsigned	int	link_id;
								struct	list_head	slaves;
								bool	assigned[SDW_MAX_DEVICES	+	1];
								struct	mutex	bus_lock;
								struct	mutex	msg_lock;
								const	struct	sdw_bus_ops	*bus_ops;
								const	struct	sdw_master_ops	*ops;
								const	struct	sdw_master_port_ops	*port_ops;
								struct	sdw_bus_params	params;
								struct	sdw_master_prop	prop;
								struct	sdw_master_sysfs	*sysfs;
								struct	sdw_defer	defer_msg;
								enum	sdw_bus_ops_impl	impl;
								unsigned	int	clk_stop_timeout;
};
©	2017	MIPI	Alliance,	Inc.
IO
• Slaves	typically	have	Audio	function
• Need	IO	access	for	implementation	defined	registers
– Support	read/write	along	with	‘n’	consecutive	read/write
13
Intel	Corp
int	sdw_read(struct	sdw_slave	*slave,	u32	addr);
int	sdw_write(struct	sdw_slave	*slave,	u32	addr,	u8	value);
int	sdw_nread(struct	sdw_slave	*slave,	u32	addr,	size_t	count,	u8	*val);
int	sdw_nwrite(struct	sdw_slave	*slave,	u32	addr,	size_t	count,	u8	*val);
©	2017	MIPI	Alliance,	Inc.
SoundWire®	Enumeration
• SoundWire	protocol	enumerable	but	not	discoverable
• Slaves	maybe	powered	off	on	boot
– Protocol	enumeration	doesn’t	work	then
• Implementation	(ACPI/DT)	based
– Create	SoundWire	Slaves	based	on	firmware	description
– Mark	Slaves	PRESENT	when	they	show	up
14
Intel	Corp
©	2017	MIPI	Alliance,	Inc.
SoundWire®	Linux	Slave
• Slave	Driver	registers	Slave	to	Bus
– int sdw_register_driver(struct sdw_driver *drv);
– void	sdw_unregister_driver(struct sdw_driver *drv);
• Probed	when	device	found	in	firmware	description
– Matching	uses	only	Manufacturer	ID,	Part	ID
– Instance	not	used,	load	same	driver	for	different	instances
15
Intel	Corp
©	2017	MIPI	Alliance,	Inc.
SoundWire®	Slave	Driver
• Typical	Linux	subsystem	driver
• Provides	probe,	remove,	shutdown	
methods
• ID	table	for	SDW	IDs
• Ops	for	Slave	driver	callbacks
16
Intel	Corp
struct	sdw_driver	{
								const	char	*name;
								int	(*probe)(struct	sdw_slave	*sdw,
																								const	struct	sdw_device_id	*id);
								int	(*remove)(struct	sdw_slave	*sdw);
								void	(*shutdown)(struct	sdw_slave	*sdw);
								const	struct	sdw_device_id	*id_table;
								const	struct	sdw_slave_ops	*ops;
								struct	device_driver	driver;
};
struct	sdw_device_id	{
								__u16	mfg_id;
								__u16	part_id;
								__u8	class_id;
								kernel_ulong_t	driver_data;
};
©	2017	MIPI	Alliance,	Inc.
Q	&	A
17
Intel	Corp
©	2017	MIPI	Alliance,	Inc.
Links
• SoundWire®	Brief	http://www.aes.org/e-lib/browse.cfm?elib=17407
• SoundWire®	Spec	v1.1	https://members.mipi.org/wg/All-
Members/document/70290
• SoundWire®	DisCo℠	Spec	v1.0	https://members.mipi.org/wg/All-
Members/document/71260
• SoundWire®	Source	Tree	
https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire.git/
18
Intel	Corp
MIPI DevCon Bangalore 2017: SoundWire Linux Subsystem: An Introduction to Protocol and Linux Subsystem
©	2017	MIPI	Alliance,	Inc.
Slaves
• Status
– Not	Attached	(Not	present/operational)
– Attached	(synchronized	w/	Master	and	able	to	handle	commands)
– Alert	(synchronized,	at	least	one	Interrupt	condition	raised)
• Up	to	11	Slaves	per	link,	each	w/	Unique	Device	Number
– Dev	Num 0:	Attached,	but	not	enumerated
– Dev	Num 1	-11:	Enumerated	Device
– Dev	Num 12-13:	Group
– Dev	Num 14:	Reserved	for	Master
– Dev	Num 15:	Broadcast
• Data	Ports
– DP0:	Bulk	command	protocol	(BRA,	BTP)
– DP1-DP14:	Data	ports	(for	audio	streaming)
– DP15:	Alias	port	(program	all	ports	with	single	command)
20
Intel	Corp
©	2017	MIPI	Alliance,	Inc.
Frame
• Serial	transmission	but	frame	defined	
by	2D	pattern	(MaxRow,	MaxCol)
• Command/Control:
– First	48	Rows	of	Col0
• PCM
– Can	use	multiple	columns/multiple	rows
• Low	latency	streams	(1-bit	PDM):
– Samples	evenly	distributed	in	time
– ‘vertical	stripes’	in	bit	allocation
– No	conflicts	with	command/control	or	
PCM
21
Intel	Corp
©	2017	MIPI	Alliance,	Inc.
Master	Operations
• Spec	doesn’t	define	Master	
implementation
• Bus	provides	ops	for	Master	
Driver,	Mandatory
– DisCo property	read
– Transfer	messages	(IO)
– Register	Bank	Switches
• Optional
– Setting	SSP	interval
– Bus	Parameters	computation
22
Intel	Corp
struct	sdw_master_ops	{
								int	(*read_prop)(struct	sdw_bus	*bus);
								enum	sdw_command_response	(*xfer_msg)
																								(struct	sdw_bus	*bus,	
																								struct	sdw_msg	*msg,	int	page);
								enum	sdw_command_response	(*xfer_msg_defer)
																								(struct	sdw_bus	*bus,	struct	sdw_msg	*msg,
																								int	page,	struct	sdw_defer	*defer);
								enum	sdw_command_response	(*reset_page_addr)
																								(struct	sdw_bus	*bus,	unsigned	int	dev_num);
								int	(*set_ssp_interval)(struct	sdw_bus	*bus,	
																								unsigned	int	ssp_interval,
																								unsigned	int	bank);
								int	(*set_bus_conf)(struct	sdw_bus	*bus,
																								struct	sdw_bus_conf	*conf);
								int	(*pre_bank_switch)(struct	sdw_bus	*bus);
								int	(*post_bank_switch)(struct	sdw_bus	*bus);
};
©	2017	MIPI	Alliance,	Inc.
Slave	Driver	Ops
• DisCo property	read
• Interrupt	update	(implementation	defined	
interrupts)
• Clock	stop	query	and	apply
• Bus	configuration	change	update
• Data	port	prepare	(pre/post)
23
Intel	Corp
struct	sdw_slave_ops	{
								int	(*read_prop)(struct	sdw_slave	*sdw);
								int	(*interrupt_callback)(struct	sdw_slave	*slave,
																								struct	sdw_slave_intr_status	*status);
								int	(*update_status)(struct	sdw_slave	*slave,
																								enum	sdw_slave_status	status);
								int	(*get_clk_stop_mode)(struct	sdw_slave	*slave);
								int	(*clk_stop)(struct	sdw_slave	*slave,
																								enum	sdw_clk_stop_mode	mode,
																								enum	sdw_clok_stop_type	type);
								int	(*pre_bus_config)(struct	sdw_slave	*slave,
																								struct	sdw_bus_conf	*conf);
								int	(*port_prep)(struct	sdw_slave	*slave,
																								struct	sdw_prepare_ch	*prepare_ch,
																								enum	sdw_port_prep_ops	pre_ops);
};
©	2017	MIPI	Alliance,	Inc.
Frame	Shape
• Columns:	2-4-6-8-10-12-14-16
• Rows:	48	to	256,	not	all	combinations	are	valid
• Frame	shape	determined	by
– Bus	clock
– Frame	rate	typically	8-48	kHz
– Audio	sample	rate
– Oversampling	ratio	for	PDM
• Slaves	are	required	to	handle	pairwise	combinations	of	Rows,	Cols
• Master	will	typically	only	use	few	combinations	based	on	2^n	factors
24
Intel	Corp

More Related Content

PPTX
Forensics audio and video
PDF
MIPI DevCon 2016: Comprehensive Verification of MIPI SoundWire Master-Slave S...
PDF
MIPI DevCon 2016: MIPI DisCo and ACPI - Streamlining MIPI Component Integration
PDF
Embedded Recipes 2019 - Pipewire a new foundation for embedded multimedia
PDF
This Document gives a complete understanding of the I3C protocol which is int...
PDF
MIPI DevCon 2020 | The Story Behind the MIPI I3C HCI Driver for Linux
PDF
MIPI DevCon 2016: Mobile System Sideband GPIO Minimization and Secondary IPC ...
PDF
MPLAB® Harmony Ecosystem
Forensics audio and video
MIPI DevCon 2016: Comprehensive Verification of MIPI SoundWire Master-Slave S...
MIPI DevCon 2016: MIPI DisCo and ACPI - Streamlining MIPI Component Integration
Embedded Recipes 2019 - Pipewire a new foundation for embedded multimedia
This Document gives a complete understanding of the I3C protocol which is int...
MIPI DevCon 2020 | The Story Behind the MIPI I3C HCI Driver for Linux
MIPI DevCon 2016: Mobile System Sideband GPIO Minimization and Secondary IPC ...
MPLAB® Harmony Ecosystem

Similar to MIPI DevCon Bangalore 2017: SoundWire Linux Subsystem: An Introduction to Protocol and Linux Subsystem (19)

PDF
MIPI DevCon 2020 | Interoperability Challenges and Solutions for MIPI I3C
PDF
Getting started with SIP Express Media Server SIP app server and SBC - workshop
PDF
MIPI DevCon 2016: How MIPI Debug Specifications Help Me to Develop System SW
PDF
MIPI DevCon 2020 | MIPI A-PHY: Laying the Groundwork for MIPI’s Automotive Se...
PDF
What's going on with SPI
PPSX
System on chip buses
PPTX
Rsockets ofa12
PDF
MPI DevCon Hsinchu City 2017: MIPI VGI for Sideband GPIO and Messaging Consol...
PDF
MIPI DevCon Bangalore 2017: MIPI VGI for Sideband GPIO and Messaging Consolid...
PDF
MIPI DevCon Seoul 2018: Evolving MIPI I3C for New Usages and Industries
PDF
MIPI DevCon 2021: MIPI I3C Signal Integrity Challenges on DDR5-based Server P...
PDF
MIPI DevCon Seoul 2018: Troubleshooting MIPI M-PHY Link and Protocol Issues
PDF
MIPI DevCon 2021: MIPI HTI, PTI and STP: The Bases for Next-Generation Online...
PDF
MIPI DevCon 2016: Specifications Roadmap - The Wires for Wireless
PDF
MIPI DevCon 2016: A Developer's Guide to MIPI I3C Implementation
PPT
lesson24.ppt
PPTX
Ppt on six month training on embedded system & IOT
PPT
Low cost embedded system
PPT
PCI
MIPI DevCon 2020 | Interoperability Challenges and Solutions for MIPI I3C
Getting started with SIP Express Media Server SIP app server and SBC - workshop
MIPI DevCon 2016: How MIPI Debug Specifications Help Me to Develop System SW
MIPI DevCon 2020 | MIPI A-PHY: Laying the Groundwork for MIPI’s Automotive Se...
What's going on with SPI
System on chip buses
Rsockets ofa12
MPI DevCon Hsinchu City 2017: MIPI VGI for Sideband GPIO and Messaging Consol...
MIPI DevCon Bangalore 2017: MIPI VGI for Sideband GPIO and Messaging Consolid...
MIPI DevCon Seoul 2018: Evolving MIPI I3C for New Usages and Industries
MIPI DevCon 2021: MIPI I3C Signal Integrity Challenges on DDR5-based Server P...
MIPI DevCon Seoul 2018: Troubleshooting MIPI M-PHY Link and Protocol Issues
MIPI DevCon 2021: MIPI HTI, PTI and STP: The Bases for Next-Generation Online...
MIPI DevCon 2016: Specifications Roadmap - The Wires for Wireless
MIPI DevCon 2016: A Developer's Guide to MIPI I3C Implementation
lesson24.ppt
Ppt on six month training on embedded system & IOT
Low cost embedded system
PCI
Ad

More from MIPI Alliance (20)

PDF
MIPI DevCon 2021: MIPI I3C Under the Spotlight: A Fireside Chat with the I3C ...
PDF
MIPI DevCon 2021: MIPI I3C Application and Validation Models for IoT Sensor N...
PDF
MIPI DevCon 2021: MIPI I3C interface for the ETSI Smart Secure Platform
PDF
MIPI DevCon 2021: MIPI Security for Automotive and IoT – Initial Focus on MASS
PDF
MIPI DevCon 2021: Meeting the Needs of Next-Generation Displays with a High-P...
PDF
MIPI DevCon 2021: MIPI CSI-2 v4.0 Panel Discussion with the MIPI Camera Worki...
PDF
MIPI DevCon 2021: MIPI D-PHY and MIPI CSI-2 for IoT: AI Edge Devices
PDF
MIPI DevCon 2021: Enabling Long-Reach MIPI CSI-2 Connectivity in Automotive w...
PDF
MIPI DevCon 2021: Latest Developments within MIPI Automotive SerDes Solutions...
PDF
MIPI DevCon 2021: The MIPI Specification Roadmap: Driving Advancements in Mob...
PDF
MIPI DevCon 2021: State of the Alliance
PDF
MIPI DevCon 2020 | Snapshot of MIPI RFFE v3.0 from a System-Architecture Per...
PDF
MIPI DevCon 2020 | Why an Integrated MIPI C-PHY/D-PHY IP is Essential
PDF
MIPI DevCon 2020 | MIPI to Bluetooth LE: Leveraging Mobile Technology for Wir...
PDF
MIPI DevCon 2020 | MIPI Alliance: Enabling the IoT Opportunity
PDF
MIPI DevCon 2020 | MIPI DevCon 2020 | How MIPI Interfaces Solve Challenges in...
PDF
MIPI DevCon 2020 | MASS: Automotive Displays Using VDC-M Visually Lossless C...
PDF
MIPI DevCon 2020 | High Speed MIPI CSI-2 Interface Meeting Automotive ASIL-B
PDF
MIPI DevCon 2020 | State of the Alliance
PDF
MIPI DevCon 2020 | Keynote: Trends in Future In-Vehicle Communication Networks
MIPI DevCon 2021: MIPI I3C Under the Spotlight: A Fireside Chat with the I3C ...
MIPI DevCon 2021: MIPI I3C Application and Validation Models for IoT Sensor N...
MIPI DevCon 2021: MIPI I3C interface for the ETSI Smart Secure Platform
MIPI DevCon 2021: MIPI Security for Automotive and IoT – Initial Focus on MASS
MIPI DevCon 2021: Meeting the Needs of Next-Generation Displays with a High-P...
MIPI DevCon 2021: MIPI CSI-2 v4.0 Panel Discussion with the MIPI Camera Worki...
MIPI DevCon 2021: MIPI D-PHY and MIPI CSI-2 for IoT: AI Edge Devices
MIPI DevCon 2021: Enabling Long-Reach MIPI CSI-2 Connectivity in Automotive w...
MIPI DevCon 2021: Latest Developments within MIPI Automotive SerDes Solutions...
MIPI DevCon 2021: The MIPI Specification Roadmap: Driving Advancements in Mob...
MIPI DevCon 2021: State of the Alliance
MIPI DevCon 2020 | Snapshot of MIPI RFFE v3.0 from a System-Architecture Per...
MIPI DevCon 2020 | Why an Integrated MIPI C-PHY/D-PHY IP is Essential
MIPI DevCon 2020 | MIPI to Bluetooth LE: Leveraging Mobile Technology for Wir...
MIPI DevCon 2020 | MIPI Alliance: Enabling the IoT Opportunity
MIPI DevCon 2020 | MIPI DevCon 2020 | How MIPI Interfaces Solve Challenges in...
MIPI DevCon 2020 | MASS: Automotive Displays Using VDC-M Visually Lossless C...
MIPI DevCon 2020 | High Speed MIPI CSI-2 Interface Meeting Automotive ASIL-B
MIPI DevCon 2020 | State of the Alliance
MIPI DevCon 2020 | Keynote: Trends in Future In-Vehicle Communication Networks
Ad

Recently uploaded (6)

DOC
Camb毕业证学历认证,格罗斯泰斯特主教大学毕业证仿冒文凭毕业证
DOC
证书学历UoA毕业证,澳大利亚中汇学院毕业证国外大学毕业证
PPTX
ASMS Telecommunication company Profile
PPTX
Introduction to Packet Tracer Course Overview - Aug 21 (1).pptx
PDF
Lesson 13- HEREDITY _ pedSAWEREGFVCXZDSASEWFigree.pdf
PDF
6-UseCfgfhgfhgfhgfhgfhfhhaseActivity.pdf
Camb毕业证学历认证,格罗斯泰斯特主教大学毕业证仿冒文凭毕业证
证书学历UoA毕业证,澳大利亚中汇学院毕业证国外大学毕业证
ASMS Telecommunication company Profile
Introduction to Packet Tracer Course Overview - Aug 21 (1).pptx
Lesson 13- HEREDITY _ pedSAWEREGFVCXZDSASEWFigree.pdf
6-UseCfgfhgfhgfhgfhgfhfhhaseActivity.pdf

MIPI DevCon Bangalore 2017: SoundWire Linux Subsystem: An Introduction to Protocol and Linux Subsystem