Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
868299c
soundwire: sdw_slave: add probe_complete structure and new fields
plbossart Oct 9, 2019
950c2c0
soundwire: sdw_slave: add enumeration_complete structure
plbossart Sep 26, 2019
d609f23
soundwire: sdw_slave: add initialization_complete definition
plbossart Nov 4, 2019
0847d0c
soundwire: sdw_slave: track unattach_request to handle all init seque…
plbossart Nov 11, 2019
6045db1
soundwire: intel: update interfaces between ASoC and SoundWire
plbossart Oct 23, 2019
577d805
soundwire: intel: update stream callbacks for hwparams/free stream op…
RanderWang Aug 19, 2019
82154a0
soundwire: intel: update headers for interrupts
bardliao Nov 22, 2019
c2c7f7d
ASoC: codecs: rt700: add Soundwire support
shumingfan Apr 18, 2018
d116121
ASoC: codecs: rt1308: add SoundWire support
shumingfan Aug 2, 2019
0bc6be9
ASoC: codecs: rt711: add SoundWire support
shumingfan Aug 15, 2019
c89ab58
ASoC: codecs: rt715: add SoundWire support
Aug 21, 2019
f7a1d76
ASoC: codecs: Add DEBUG to Makefile
plbossart Apr 18, 2019
7d90c61
ASoC: codecs: rt715: rt715_sdw_regmap can be static
intel-lab-lkp Oct 18, 2019
b3bbd10
ASoC: rt711: changes 32bits address mapping of index defined register…
shumingfan Oct 23, 2019
a5254cd
ASoC: rt700: changes 32bits address mapping of index defined register…
shumingfan Oct 23, 2019
36b8360
ASoC: rt1308-sdw: fix some coding style
shumingfan Oct 23, 2019
fbb7804
Resume correct register setting for dmic recording after suspend.
Oct 24, 2019
e5566b8
ASoC: rt711: add JD2 configuration
shumingfan Oct 24, 2019
3ccd04e
ASoC: codec:rt715-sdw:Modify register mapping of index from 32bits to…
Oct 25, 2019
383a457
ASoC: rt700: fix pop noise while stopping playback
shumingfan Oct 28, 2019
3b823cf
ASoC: rt711: fix pop noise while stopping playback
shumingfan Oct 28, 2019
6c92896
ASoC: rt1308-sdw: fix DC offset loading from EFUSE and increase DAC v…
shumingfan Oct 28, 2019
9aabdf8
ASoC: codec:rt715-sdw: Modify some ret values regarding to warning an…
Oct 29, 2019
969099d
ASoC: rt1308-sdw: output gain enhancement
shumingfan Oct 30, 2019
06a3fdc
ASoC: rt711: move rt711_parse_dt to rt711_probe
bardliao Nov 4, 2019
7e2aabd
ASoC: codecs: rt1308-sdw.c: wait for initialization_complete
plbossart Nov 4, 2019
33c409e
ASoC: codecs: rt700-sdw.c: wait for initialization_complete
plbossart Nov 4, 2019
20b5da5
ASoC: codecs: rt711-sdw.c: wait for initialization_complete
plbossart Nov 4, 2019
18367b2
ASoC: codecs: rt715-sdw.c: wait for initialization_complete
plbossart Nov 4, 2019
dafa489
ASoC: rt700: enable wake_capable
shumingfan Nov 7, 2019
d8640f5
ASoC: rt711: enable wake_capable
shumingfan Nov 7, 2019
6c9f514
ASoC: rt715: enable wake_capable
shumingfan Nov 7, 2019
bdf02cb
ASoC: rt700: re-do io_init in cache_bypass mode when system resume
shumingfan Nov 7, 2019
2f5253e
ASoC: rt711: re-do io_init in cache_bypass mode when system resume
shumingfan Nov 7, 2019
727c28a
ASoC: rt1308-sdw: re-do io_init in cache_bypass mode when system resume
shumingfan Nov 7, 2019
06aad31
ASoC: codec: rt715: Remove unused rt715_index_read function.
Nov 11, 2019
1278f0c
ASoC: codecs: rt1308-sdw: check unattach request before wait_for_comp…
plbossart Nov 8, 2019
e883ae2
ASoC: codecs: rt700-sdw: check unattach request before wait_for_compl…
plbossart Nov 8, 2019
a89062c
ASoC: codecs: rt711-sdw: check unattach request before wait_for_compl…
plbossart Nov 8, 2019
2394d0c
ASoC: codecs: rt715-sdw: check unattach request before wait_for_compl…
plbossart Nov 8, 2019
a243269
ASoC: rt711: fix no sound output after waking up from deep s3
shumingfan Nov 13, 2019
00ebe88
Correct some sdw default registers and add missing registers in rt715…
Nov 22, 2019
2724b80
ASoC: rt5682: Add the field "is_sdw" of private data
oder-chiou Nov 22, 2019
7d4c813
ASoC: rt5682: Add the soundwire support
oder-chiou Nov 26, 2019
77b3ef4
Add missing rt715_reg_defaults values.
Dec 2, 2019
ebe45fa
ASoC: codec: Fix IO timeout when doing jack detection
RanderWang Dec 2, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions drivers/soundwire/intel.c
Original file line number Diff line number Diff line change
Expand Up @@ -529,17 +529,24 @@ intel_pdi_alh_configure(struct sdw_intel *sdw, struct sdw_cdns_pdi *pdi)
intel_writel(alh, SDW_ALH_STRMZCFG(pdi->intel_alh_id), conf);
}

static int intel_config_stream(struct sdw_intel *sdw,
static int intel_params_stream(struct sdw_intel *sdw,
struct snd_pcm_substream *substream,
struct snd_soc_dai *dai,
struct snd_pcm_hw_params *hw_params, int link_id)
struct snd_pcm_hw_params *hw_params,
int link_id, int alh_stream_id)
{
struct sdw_intel_link_res *res = sdw->res;
struct sdw_intel_stream_params_data params_data;

if (res->ops && res->ops->config_stream && res->arg)
return res->ops->config_stream(res->arg,
substream, dai, hw_params, link_id);
params_data.substream = substream;
params_data.dai = dai;
params_data.hw_params = hw_params;
params_data.link_id = link_id;
params_data.alh_stream_id = alh_stream_id;

if (res->ops && res->ops->params_stream && res->dev)
return res->ops->params_stream(res->dev,
&params_data);
return -EIO;
}

Expand Down Expand Up @@ -654,7 +661,8 @@ static int intel_hw_params(struct snd_pcm_substream *substream,


/* Inform DSP about PDI stream number */
ret = intel_config_stream(sdw, substream, dai, params,
ret = intel_params_stream(sdw, substream, dai, params,
sdw->instance,
pdi->intel_alh_id);
if (ret)
goto error;
Expand Down
13 changes: 8 additions & 5 deletions drivers/soundwire/intel.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,26 @@
#define __SDW_INTEL_LOCAL_H

/**
* struct sdw_intel_link_res - Soundwire link resources
* struct sdw_intel_link_res - Soundwire Intel link resource structure,
* typically populated by the controller driver.
* @pdev: platform_device
* @mmio_base: mmio base of SoundWire registers
* @registers: Link IO registers base
* @shim: Audio shim pointer
* @alh: ALH (Audio Link Hub) pointer
* @irq: Interrupt line
* @ops: Shim callback ops
* @arg: Shim callback ops argument
*
* This is set as pdata for each link instance.
* @dev: device implementing hw_params and free callbacks
*/
struct sdw_intel_link_res {
struct platform_device *pdev;
void __iomem *mmio_base; /* not strictly needed, useful for debug */
void __iomem *registers;
void __iomem *shim;
void __iomem *alh;
int irq;
const struct sdw_intel_ops *ops;
void *arg;
struct device *dev;
};

#endif /* __SDW_INTEL_LOCAL_H */
31 changes: 8 additions & 23 deletions drivers/soundwire/intel_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,9 @@ static int link_mask;
module_param_named(sdw_link_mask, link_mask, int, 0444);
MODULE_PARM_DESC(sdw_link_mask, "Intel link mask (one bit per link)");

struct sdw_link_data {
struct sdw_intel_link_res res;
struct platform_device *pdev;
};

struct sdw_intel_ctx {
int count;
struct sdw_link_data *links;
};

static int sdw_intel_cleanup_pdev(struct sdw_intel_ctx *ctx)
{
struct sdw_link_data *link = ctx->links;
struct sdw_intel_link_res *link = ctx->links;
int i;

if (!link)
Expand All @@ -62,7 +52,7 @@ static struct sdw_intel_ctx
{
struct platform_device_info pdevinfo;
struct platform_device *pdev;
struct sdw_link_data *link;
struct sdw_intel_link_res *link;
struct sdw_intel_ctx *ctx;
struct acpi_device *adev;
int ret, i;
Expand Down Expand Up @@ -123,23 +113,20 @@ static struct sdw_intel_ctx
continue;
}

link->res.irq = res->irq;
link->res.registers = res->mmio_base + SDW_LINK_BASE
link->registers = res->mmio_base + SDW_LINK_BASE
+ (SDW_LINK_SIZE * i);
link->res.shim = res->mmio_base + SDW_SHIM_BASE;
link->res.alh = res->mmio_base + SDW_ALH_BASE;
link->shim = res->mmio_base + SDW_SHIM_BASE;
link->alh = res->mmio_base + SDW_ALH_BASE;

link->res.ops = res->ops;
link->res.arg = res->arg;
link->ops = res->ops;
link->dev = res->dev;

memset(&pdevinfo, 0, sizeof(pdevinfo));

pdevinfo.parent = res->parent;
pdevinfo.name = "int-sdw";
pdevinfo.id = i;
pdevinfo.fwnode = acpi_fwnode_handle(adev);
pdevinfo.data = &link->res;
pdevinfo.size_data = sizeof(link->res);

pdev = platform_device_register_full(&pdevinfo);
if (IS_ERR(pdev)) {
Expand Down Expand Up @@ -224,10 +211,8 @@ EXPORT_SYMBOL(sdw_intel_init);
*
* Delete the controller instances created and cleanup
*/
void sdw_intel_exit(void *arg)
void sdw_intel_exit(struct sdw_intel_ctx *ctx)
{
struct sdw_intel_ctx *ctx = arg;

sdw_intel_cleanup_pdev(ctx);
kfree(ctx);
}
Expand Down
19 changes: 19 additions & 0 deletions include/linux/soundwire/sdw.h
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,20 @@ struct sdw_slave_ops {
* @node: node for bus list
* @port_ready: Port ready completion flag for each Slave port
* @dev_num: Device Number assigned by Bus
* @probed: boolean tracking driver state
* @probe_complete: completion utility to control potential races
* on startup between driver probe/initialization and SoundWire
* Slave state changes/implementation-defined interrupts
* @enumeration_complete: completion utility to control potential races
* on startup between device enumeration and read/write access to the
* Slave device
* @initialization_complete: completion utility to control potential races
* on startup between device enumeration and settings being restored
* @unattach_request: mask field to keep track why the Slave re-attached and
* was re-initialized. This is useful to deal with potential race conditions
* between the Master suspending and the codec resuming, and make sure that
* when the Master triggered a reset the Slave is properly enumerated and
* initialized
*/
struct sdw_slave {
struct sdw_slave_id id;
Expand All @@ -561,6 +575,11 @@ struct sdw_slave {
struct list_head node;
struct completion *port_ready;
u16 dev_num;
bool probed;
struct completion probe_complete;
struct completion enumeration_complete;
struct completion initialization_complete;
u32 unattach_request;
};

#define dev_to_sdw_dev(_dev) container_of(_dev, struct sdw_slave, dev)
Expand Down
111 changes: 102 additions & 9 deletions include/linux/soundwire/sdw_intel.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,129 @@
#ifndef __SDW_INTEL_H
#define __SDW_INTEL_H

/**
* struct sdw_intel_stream_params_data: configuration passed during
* the @params_stream callback, e.g. for interaction with DSP
* firmware.
*/
struct sdw_intel_stream_params_data {
struct snd_pcm_substream *substream;
struct snd_soc_dai *dai;
struct snd_pcm_hw_params *hw_params;
int link_id;
int alh_stream_id;
};

/**
* struct sdw_intel_stream_free_data: configuration passed during
* the @free_stream callback, e.g. for interaction with DSP
* firmware.
*/
struct sdw_intel_stream_free_data {
struct snd_pcm_substream *substream;
struct snd_soc_dai *dai;
int link_id;
};

/**
* struct sdw_intel_ops: Intel audio driver callback ops
*
* @config_stream: configure the stream with the hw_params
* the first argument containing the context is mandatory
*/
struct sdw_intel_ops {
int (*config_stream)(void *arg, void *substream,
void *dai, void *hw_params, int stream_num);
int (*params_stream)(struct device *dev,
struct sdw_intel_stream_params_data *params_data);
int (*free_stream)(struct device *dev,
struct sdw_intel_stream_free_data *free_data);
};

/**
* struct sdw_intel_res - Soundwire Intel resource structure
* struct sdw_intel_acpi_info - Soundwire Intel information found in ACPI tables
* @handle: ACPI controller handle
* @count: link count found with "sdw-master-count" property
* @link_mask: bit-wise mask listing links enabled by BIOS menu
*
* this structure could be expanded to e.g. provide all the _ADR
* information in case the link_mask is not sufficient to identify
* platform capabilities.
*/
struct sdw_intel_acpi_info {
acpi_handle handle;
int count;
u32 link_mask;
};

struct sdw_intel_link_res;

/**
* struct sdw_intel_ctx - context allocated by the controller
* driver probe
* @count: link count
* @mmio_base: mmio base of SoundWire registers, only used to check
* hardware capabilities after all power dependencies are settled.
* @link_mask: bit-wise mask listing SoundWire links reported by the
* Controller
* @handle: ACPI parent handle
* @links: information for each link (controller-specific and kept
* opaque here)
*/
struct sdw_intel_ctx {
int count;
void __iomem *mmio_base;
u32 link_mask;
acpi_handle handle;
struct sdw_intel_link_res *links;
};

/**
* struct sdw_intel_res - Soundwire Intel global resource structure,
* typically populated by the DSP driver
*
* @count: link count
* @mmio_base: mmio base of SoundWire registers
* @irq: interrupt number
* @handle: ACPI parent handle
* @parent: parent device
* @ops: callback ops
* @arg: callback arg
* @dev: device implementing hwparams and free callbacks
* @link_mask: bit-wise mask listing links selected by the DSP driver
* This mask may be a subset of the one reported by the controller since
* machine-specific quirks are handled in the DSP driver.
*/
struct sdw_intel_res {
int count;
void __iomem *mmio_base;
int irq;
acpi_handle handle;
struct device *parent;
const struct sdw_intel_ops *ops;
void *arg;
struct device *dev;
u32 link_mask;
};

void *sdw_intel_init(acpi_handle *parent_handle, struct sdw_intel_res *res);
void sdw_intel_exit(void *arg);
/*
* On Intel platforms, the SoundWire IP has dependencies on power
* rails shared with the DSP, and the initialization steps are split
* in three. First an ACPI scan to check what the firmware describes
* in DSDT tables, then an allocation step (with no hardware
* configuration but with all the relevant devices created) and last
* the actual hardware configuration. The final stage is a global
* interrupt enable which is controlled by the DSP driver. Splitting
* these phases helps simplify the boot flow and make early decisions
* on e.g. which machine driver to select (I2S mode, HDaudio or
* SoundWire).
*/
int sdw_intel_acpi_scan(acpi_handle *parent_handle,
struct sdw_intel_acpi_info *info);

struct sdw_intel_ctx *
sdw_intel_probe(struct sdw_intel_res *res);

int sdw_intel_startup(struct sdw_intel_ctx *ctx);

void sdw_intel_exit(struct sdw_intel_ctx *ctx);

void sdw_intel_enable_irq(void __iomem *mmio_base, bool enable);

irqreturn_t sdw_intel_thread(int irq, void *dev_id);

#endif
39 changes: 39 additions & 0 deletions sound/soc/codecs/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1057,6 +1057,45 @@ config SND_SOC_RT5677_SPI
config SND_SOC_RT5682
tristate

config SND_SOC_RT5682_SDW
tristate "Realtek RT5682 Codec - SDW"
depends on SOUNDWIRE
select SND_SOC_RT5682
select REGMAP_SOUNDWIRE

config SND_SOC_RT700
tristate

config SND_SOC_RT700_SDW
tristate "Realtek RT700 Codec - SDW"
depends on SOUNDWIRE
select SND_SOC_RT700
select REGMAP_SOUNDWIRE

config SND_SOC_RT1308_SDW
tristate "Realtek RT1308 Codec - SDW"
depends on SOUNDWIRE
select SND_SOC_RT1308
select REGMAP_SOUNDWIRE

config SND_SOC_RT711
tristate

config SND_SOC_RT711_SDW
tristate "Realtek RT711 Codec - SDW"
depends on SOUNDWIRE
select SND_SOC_RT711
select REGMAP_SOUNDWIRE

config SND_SOC_RT715
tristate

config SND_SOC_RT715_SDW
tristate "Realtek RT715 Codec - SDW"
depends on SOUNDWIRE
select SND_SOC_RT715
select REGMAP_SOUNDWIRE

#Freescale sgtl5000 codec
config SND_SOC_SGTL5000
tristate "Freescale SGTL5000 CODEC"
Expand Down
Loading