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: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200929141247.8058-7-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Cezary Rojewski 2020-09-29 16:12:39 +02:00 committed by Mark Brown
parent a9aa6fb3eb
commit a126750fc8
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
4 changed files with 1226 additions and 0 deletions

View File

@ -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

View File

@ -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);

View File

@ -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);

1175
sound/soc/intel/catpt/pcm.c Normal file

File diff suppressed because it is too large Load Diff