mipi soundwire® linux subsystem: an introduction to ...® disco • mipi discovery and...

24
Vinod Koul, Sanyog Kale Intel Corp MIPI SoundWire® Linux Subsystem: An introduction to Protocol and Linux Subsystem

Upload: trinhquynh

Post on 29-May-2018

267 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: MIPI SoundWire® Linux Subsystem: An introduction to ...® DisCo • MIPI Discovery and Configuration (DisCo ) mechanism • MIPI adopted Spec • Optional, but values mandatory for

Vinod Koul, Sanyog KaleIntel Corp

MIPI SoundWire® Linux Subsystem:An introduction to Protocol and Linux Subsystem

Page 2: MIPI SoundWire® Linux Subsystem: An introduction to ...® DisCo • MIPI Discovery and Configuration (DisCo ) mechanism • MIPI adopted Spec • Optional, but values mandatory for

©2017MIPIAlliance,Inc.

Agenda• MIPISoundWire®Basics• LinuxSubsystem• SoundWireLinuxBus• SoundWireMaster• SoundWireSlave

2

IntelCorp

Page 3: MIPI SoundWire® Linux Subsystem: An introduction to ...® DisCo • MIPI Discovery and Configuration (DisCo ) mechanism • MIPI adopted Spec • Optional, but values mandatory for

©2017MIPIAlliance,Inc.

SoundWire®PHY• Supportoneof1.2or1.8V• Clockupto12.288MHz• Dualdatarate• ModifiedNRZIencoding

– Logic0:physicalsignalinvertedfromvalueinprecedingbitSlot– Logic1:nochangeinphysicalsignal,levelmaintainedbybus-keeper

• TDM– Eachdevice‘owns’bitslot

• Data– PCM– PDM– BulkTransfers

• BulkRegisterAccess(BRA)• BulkTransferProtocol(BTP)

3

IntelCorp

Page 4: MIPI SoundWire® Linux Subsystem: An introduction to ...® DisCo • MIPI Discovery and Configuration (DisCo ) mechanism • MIPI adopted Spec • Optional, but values mandatory for

©2017MIPIAlliance,Inc.

DeviceTypes• Master

– ProvidesClockandSyncpatternondataline– Busmanagement,bitallocation

• Slave– Audioperipheral(MIC,Codec,Amps)– 1to11Slavesconnected,Multi-dropbus– InbandInterrupt,Systemwake

• Monitor– Testequipment,insnoopanalyzemode– Temporarilytakeoverbus,issueRead/Writecommands

4

IntelCorp

Page 5: MIPI SoundWire® Linux Subsystem: An introduction to ...® DisCo • MIPI Discovery and Configuration (DisCo ) mechanism • MIPI adopted Spec • Optional, but values mandatory for

©2017MIPIAlliance,Inc.

SoundWire®Topologies

5

IntelCorp

Page 6: MIPI SoundWire® Linux Subsystem: An introduction to ...® DisCo • MIPI Discovery and Configuration (DisCo ) mechanism • MIPI adopted Spec • Optional, but values mandatory for

©2017MIPIAlliance,Inc.

SoundWire®Topologies

6

IntelCorp

Page 7: MIPI SoundWire® Linux Subsystem: An introduction to ...® DisCo • MIPI Discovery and Configuration (DisCo ) mechanism • MIPI adopted Spec • Optional, but values mandatory for

©2017MIPIAlliance,Inc.

SoundWire®Topologies

7

IntelCorp

Page 8: MIPI SoundWire® Linux Subsystem: An introduction to ...® DisCo • MIPI Discovery and Configuration (DisCo ) mechanism • MIPI adopted Spec • Optional, but values mandatory for

©2017MIPIAlliance,Inc.

Enumeration• RegisterDevId 0-5,48-bituniquevalue

– ManufacturerID,PartID– Class(notdefinedyet)– SoundWirespecversion– UniqueID

• SlavereportspresentonDevNum 0• MasterreadsDevId 0-5• AssignsDevNum X(1..11)• SlavereportspresentonDevNum X

8

IntelCorp

Page 9: MIPI SoundWire® Linux Subsystem: An introduction to ...® DisCo • MIPI Discovery and Configuration (DisCo ) mechanism • MIPI adopted Spec • Optional, but values mandatory for

©2017MIPIAlliance,Inc.

SoundWire®DisCo℠• MIPIDiscoveryandConfiguration(DisCo℠)mechanism• MIPIadoptedSpec• Optional,butvaluesmandatoryforSoftware• ImplementedasACPI_DSDmethods• DescribesSoundWireMasterpropertiesandSlaveproperties

9

IntelCorp

Page 10: MIPI SoundWire® Linux Subsystem: An introduction to ...® DisCo • MIPI Discovery and Configuration (DisCo ) mechanism • MIPI adopted Spec • Optional, but values mandatory for

©2017MIPIAlliance,Inc.

SoundWire®LinuxSubsystem

10

IntelCorp

SoundWireMaster

SoundWireBus

SoundWireSlaveSoundWireSlave SoundWireSlave

SoundWireRegmap

Page 11: MIPI SoundWire® Linux Subsystem: An introduction to ...® DisCo • MIPI Discovery and Configuration (DisCo ) mechanism • MIPI adopted Spec • Optional, but values mandatory for

©2017MIPIAlliance,Inc.

SoundWire®DeviceModel

11

IntelCorp

SoundWireMaster0

SoundWireBus

SoundWireSlave0

SoundWireSlave1

Device:sdw-master0BusType:SoundWireDriver:SoundWireMasterDriver

Device:sdw:m<>p<>ParentDevice:int-sdw.0BusType:SoundWireDriver:SoundWireSlaveDriver

Device:sdw:m<>p<>ParentDevice:int-sdw.0BusType:SoundWireDriver:SoundWireSlaveDriver

Page 12: MIPI SoundWire® Linux Subsystem: An introduction to ...® DisCo • MIPI Discovery and Configuration (DisCo ) mechanism • MIPI adopted Spec • Optional, but values mandatory for

©2017MIPIAlliance,Inc.

SoundWire®LinuxBus• TheBusisinstantiatedby:

– int sdw_add_bus_master(struct sdw_bus *bus);– Masterallocatessdw_bus structres– InitializedbyinvokingthisAPI

• Similarlyexitisperformedby:– voidsdw_delete_bus_master(struct sdw_bus

*bus);

12

IntelCorp

structsdw_bus{structdevice*dev;boolacpi_enabled;unsignedintlink_id;structlist_headslaves;boolassigned[SDW_MAX_DEVICES+1];structmutexbus_lock;structmutexmsg_lock;conststructsdw_bus_ops*bus_ops;conststructsdw_master_ops*ops;conststructsdw_master_port_ops*port_ops;structsdw_bus_paramsparams;structsdw_master_propprop;structsdw_master_sysfs*sysfs;structsdw_deferdefer_msg;enumsdw_bus_ops_implimpl;unsignedintclk_stop_timeout;};

Page 13: MIPI SoundWire® Linux Subsystem: An introduction to ...® DisCo • MIPI Discovery and Configuration (DisCo ) mechanism • MIPI adopted Spec • Optional, but values mandatory for

©2017MIPIAlliance,Inc.

IO• SlavestypicallyhaveAudiofunction• NeedIOaccessforimplementationdefinedregisters

– Supportread/writealongwith‘n’consecutiveread/write

13

IntelCorp

intsdw_read(structsdw_slave*slave,u32addr);

intsdw_write(structsdw_slave*slave,u32addr,u8value);

intsdw_nread(structsdw_slave*slave,u32addr,size_tcount,u8*val);

intsdw_nwrite(structsdw_slave*slave,u32addr,size_tcount,u8*val);

Page 14: MIPI SoundWire® Linux Subsystem: An introduction to ...® DisCo • MIPI Discovery and Configuration (DisCo ) mechanism • MIPI adopted Spec • Optional, but values mandatory for

©2017MIPIAlliance,Inc.

SoundWire®Enumeration• SoundWireprotocolenumerablebutnotdiscoverable• Slavesmaybepoweredoffonboot

– Protocolenumerationdoesn’tworkthen

• Implementation(ACPI/DT)based– CreateSoundWireSlavesbasedonfirmwaredescription– MarkSlavesPRESENTwhentheyshowup

14

IntelCorp

Page 15: MIPI SoundWire® Linux Subsystem: An introduction to ...® DisCo • MIPI Discovery and Configuration (DisCo ) mechanism • MIPI adopted Spec • Optional, but values mandatory for

©2017MIPIAlliance,Inc.

SoundWire®LinuxSlave• SlaveDriverregistersSlavetoBus

– int sdw_register_driver(struct sdw_driver *drv);– voidsdw_unregister_driver(struct sdw_driver *drv);

• Probedwhendevicefoundinfirmwaredescription– MatchingusesonlyManufacturerID,PartID– Instancenotused,loadsamedriverfordifferentinstances

15

IntelCorp

Page 16: MIPI SoundWire® Linux Subsystem: An introduction to ...® DisCo • MIPI Discovery and Configuration (DisCo ) mechanism • MIPI adopted Spec • Optional, but values mandatory for

©2017MIPIAlliance,Inc.

SoundWire®SlaveDriver• TypicalLinuxsubsystemdriver• Providesprobe,remove,shutdown

methods• IDtableforSDWIDs• OpsforSlavedrivercallbacks

16

IntelCorp

structsdw_driver{constchar*name;

int(*probe)(structsdw_slave*sdw,conststructsdw_device_id*id);int(*remove)(structsdw_slave*sdw);void(*shutdown)(structsdw_slave*sdw);

conststructsdw_device_id*id_table;conststructsdw_slave_ops*ops;

structdevice_driverdriver;};

structsdw_device_id{__u16mfg_id;__u16part_id;__u8class_id;kernel_ulong_tdriver_data;};

Page 17: MIPI SoundWire® Linux Subsystem: An introduction to ...® DisCo • MIPI Discovery and Configuration (DisCo ) mechanism • MIPI adopted Spec • Optional, but values mandatory for

©2017MIPIAlliance,Inc.

Q&A

17

IntelCorp

Page 18: MIPI SoundWire® Linux Subsystem: An introduction to ...® DisCo • MIPI Discovery and Configuration (DisCo ) mechanism • MIPI adopted Spec • Optional, but values mandatory for

©2017MIPIAlliance,Inc.

Links• SoundWire®Briefhttp://www.aes.org/e-lib/browse.cfm?elib=17407• SoundWire®Specv1.1https://members.mipi.org/wg/All-

Members/document/70290• SoundWire®DisCo℠Specv1.0https://members.mipi.org/wg/All-

Members/document/71260• SoundWire®SourceTree

https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire.git/

18

IntelCorp

Page 19: MIPI SoundWire® Linux Subsystem: An introduction to ...® DisCo • MIPI Discovery and Configuration (DisCo ) mechanism • MIPI adopted Spec • Optional, but values mandatory for
Page 20: MIPI SoundWire® Linux Subsystem: An introduction to ...® DisCo • MIPI Discovery and Configuration (DisCo ) mechanism • MIPI adopted Spec • Optional, but values mandatory for

©2017MIPIAlliance,Inc.

Slaves• Status

– NotAttached(Notpresent/operational)– Attached(synchronizedw/Masterandabletohandlecommands)– Alert(synchronized,atleastoneInterruptconditionraised)

• Upto11Slavesperlink,eachw/UniqueDeviceNumber– DevNum 0:Attached,butnotenumerated– DevNum 1-11:EnumeratedDevice– DevNum 12-13:Group– DevNum 14:ReservedforMaster– DevNum 15:Broadcast

• DataPorts– DP0:Bulkcommandprotocol(BRA,BTP)– DP1-DP14:Dataports(foraudiostreaming)– DP15:Aliasport(programallportswithsinglecommand)

20

IntelCorp

Page 21: MIPI SoundWire® Linux Subsystem: An introduction to ...® DisCo • MIPI Discovery and Configuration (DisCo ) mechanism • MIPI adopted Spec • Optional, but values mandatory for

©2017MIPIAlliance,Inc.

Frame• Serialtransmissionbutframedefined

by2Dpattern(MaxRow,MaxCol)• Command/Control:

– First48RowsofCol0• PCM

– Canusemultiplecolumns/multiplerows• Lowlatencystreams(1-bitPDM):

– Samplesevenlydistributedintime– ‘verticalstripes’inbitallocation– Noconflictswithcommand/controlor

PCM

21

IntelCorp

Page 22: MIPI SoundWire® Linux Subsystem: An introduction to ...® DisCo • MIPI Discovery and Configuration (DisCo ) mechanism • MIPI adopted Spec • Optional, but values mandatory for

©2017MIPIAlliance,Inc.

MasterOperations• Specdoesn’tdefineMaster

implementation• BusprovidesopsforMaster

Driver,Mandatory– DisCo propertyread– Transfermessages(IO)– RegisterBankSwitches

• Optional– SettingSSPinterval– BusParameterscomputation

22

IntelCorp

structsdw_master_ops{int(*read_prop)(structsdw_bus*bus);

enumsdw_command_response(*xfer_msg)(structsdw_bus*bus,structsdw_msg*msg,intpage);enumsdw_command_response(*xfer_msg_defer)(structsdw_bus*bus,structsdw_msg*msg,intpage,structsdw_defer*defer);enumsdw_command_response(*reset_page_addr)(structsdw_bus*bus,unsignedintdev_num);int(*set_ssp_interval)(structsdw_bus*bus,unsignedintssp_interval,unsignedintbank);int(*set_bus_conf)(structsdw_bus*bus,structsdw_bus_conf*conf);int(*pre_bank_switch)(structsdw_bus*bus);int(*post_bank_switch)(structsdw_bus*bus);

};

Page 23: MIPI SoundWire® Linux Subsystem: An introduction to ...® DisCo • MIPI Discovery and Configuration (DisCo ) mechanism • MIPI adopted Spec • Optional, but values mandatory for

©2017MIPIAlliance,Inc.

SlaveDriverOps• DisCo propertyread• Interruptupdate(implementationdefined

interrupts)• Clockstopqueryandapply• Busconfigurationchangeupdate• Dataportprepare(pre/post)

23

IntelCorp

structsdw_slave_ops{int(*read_prop)(structsdw_slave*sdw);int(*interrupt_callback)(structsdw_slave*slave,structsdw_slave_intr_status*status);int(*update_status)(structsdw_slave*slave,enumsdw_slave_statusstatus);int(*get_clk_stop_mode)(structsdw_slave*slave);int(*clk_stop)(structsdw_slave*slave,enumsdw_clk_stop_modemode,enumsdw_clok_stop_typetype);int(*pre_bus_config)(structsdw_slave*slave,structsdw_bus_conf*conf);int(*port_prep)(structsdw_slave*slave,structsdw_prepare_ch*prepare_ch,enumsdw_port_prep_opspre_ops);};

Page 24: MIPI SoundWire® Linux Subsystem: An introduction to ...® DisCo • MIPI Discovery and Configuration (DisCo ) mechanism • MIPI adopted Spec • Optional, but values mandatory for

©2017MIPIAlliance,Inc.

FrameShape• Columns:2-4-6-8-10-12-14-16• Rows:48to256,notallcombinationsarevalid• Frameshapedeterminedby

– Busclock– Frameratetypically8-48kHz– Audiosamplerate– OversamplingratioforPDM

• SlavesarerequiredtohandlepairwisecombinationsofRows,Cols• Masterwilltypicallyonlyusefewcombinationsbasedon2^nfactors

24

IntelCorp