soundwire: add Slave sysfs support
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Mon, 18 May 2020 20:35:51 +0000 (04:35 +0800)
committerVinod Koul <vkoul@kernel.org>
Wed, 20 May 2020 11:52:41 +0000 (17:22 +0530)
commitbcac59029955ae57d3c660a0a1d6d4c7ae78fb49
treed1ed29a40b4a6a59760fce57ce394e0154d7dc57
parentc5778ca49a19420c67dbeff0744a3b3b75ef4e1a
soundwire: add Slave sysfs support

Expose MIPI DisCo Slave properties in sysfs.

For Slave properties and Data Port 0, the attributes are managed with
simple devm_ support.

A Slave Device may have more than one Data Port (DPN), and each Data
Port can be sink or source. The attributes are created dynamically
using pre-canned macros, but still use devm_ with a name attribute
group to avoid creating kobjects - as requested by GregKH. In the
_show function, we use container_of() to retrieve port number and
direction required to extract the information.

Audio modes are not supported for now. Depending on the discussions
the SoundWire Device Class, we may add it later as is or follow the
new specification.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20200518203551.2053-4-yung-chuan.liao@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Documentation/ABI/testing/sysfs-bus-soundwire-slave [new file with mode: 0644]
drivers/soundwire/Makefile
drivers/soundwire/bus.c
drivers/soundwire/bus.h
drivers/soundwire/bus_type.c
drivers/soundwire/sysfs_local.h [new file with mode: 0644]
drivers/soundwire/sysfs_slave.c [new file with mode: 0644]
drivers/soundwire/sysfs_slave_dpn.c [new file with mode: 0644]