Commit a126750f authored by Cezary Rojewski's avatar Cezary Rojewski Committed by Mark Brown

ASoC: Intel: catpt: PCM operations

DSP designed for Lynxpoint and Wildcat Point offers no dynamic topology
i.e. all pipelines are already defined within firmware and host is
relegated to allocing stream for predefined pins. This is represented by
'catpt_topology' member.

Implementation covers all available pin types:
- system playback and capture
- two offload streams
- loopback (reference)
- bluetooth playback and capture

PCM DAI operations differentiate between those pins as some (mainly
offload) are to be handled differently - DSP expects wp updates on each
notify_position notification.

System playback has no volume control capability as it is routed to
mixer stream directly. Other primary streams - capture and two offloads
- offer individual volume controls.

Compared to sound/soc/intel/haswell this configures SSP device format
automatically on pcm creation.
Signed-off-by: default avatarCezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@intel.com>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200929141247.8058-7-cezary.rojewski@intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent a9aa6fb3
......@@ -175,4 +175,12 @@ struct catpt_stream_runtime {
struct list_head node;
};
int catpt_register_plat_component(struct catpt_dev *cdev);
void catpt_stream_update_position(struct catpt_dev *cdev,
struct catpt_stream_runtime *stream,
struct catpt_notify_position *pos);
struct catpt_stream_runtime *
catpt_stream_find(struct catpt_dev *cdev, u8 stream_hw_id);
int catpt_arm_stream_templates(struct catpt_dev *cdev);
#endif
......@@ -138,6 +138,42 @@ int catpt_dsp_send_msg(struct catpt_dev *cdev, struct catpt_ipc_msg request,
cdev->ipc.default_timeout);
}
static void
catpt_dsp_notify_stream(struct catpt_dev *cdev, union catpt_notify_msg msg)
{
struct catpt_stream_runtime *stream;
struct catpt_notify_position pos;
struct catpt_notify_glitch glitch;
stream = catpt_stream_find(cdev, msg.stream_hw_id);
if (!stream) {
dev_warn(cdev->dev, "notify %d for non-existent stream %d\n",
msg.notify_reason, msg.stream_hw_id);
return;
}
switch (msg.notify_reason) {
case CATPT_NOTIFY_POSITION_CHANGED:
memcpy_fromio(&pos, catpt_inbox_addr(cdev), sizeof(pos));
catpt_stream_update_position(cdev, stream, &pos);
break;
case CATPT_NOTIFY_GLITCH_OCCURRED:
memcpy_fromio(&glitch, catpt_inbox_addr(cdev), sizeof(glitch));
dev_warn(cdev->dev, "glitch %d at pos: 0x%08llx, wp: 0x%08x\n",
glitch.type, glitch.presentation_pos,
glitch.write_pos);
break;
default:
dev_warn(cdev->dev, "unknown notification: %d received\n",
msg.notify_reason);
break;
}
}
static void catpt_dsp_copy_rx(struct catpt_dev *cdev, u32 header)
{
struct catpt_ipc *ipc = &cdev->ipc;
......@@ -177,6 +213,7 @@ static void catpt_dsp_process_response(struct catpt_dev *cdev, u32 header)
case CATPT_GLB_STREAM_MESSAGE:
switch (msg.stream_msg_type) {
case CATPT_STRM_NOTIFICATION:
catpt_dsp_notify_stream(cdev, msg);
break;
default:
catpt_dsp_copy_rx(cdev, header);
......
......@@ -658,6 +658,12 @@ int catpt_first_boot_firmware(struct catpt_dev *cdev)
if (ret)
return CATPT_IPC_ERROR(ret);
ret = catpt_arm_stream_templates(cdev);
if (ret) {
dev_err(cdev->dev, "arm templates failed: %d\n", ret);
return ret;
}
/* update dram pg for scratch and restricted regions */
catpt_dsp_update_srampge(cdev, &cdev->dram, cdev->spec->dram_mask);
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment