/** * struct segdist_code - Segment Distributions code from * Table 20 of SLIMbus Specs Version 2.0 * * @ratem: Channel Rate Multipler(Segments per Superframe) * @seg_interval: Number of slots between the first Slot of Segment * and the first slot of the next consecutive Segment. * @segdist_code: Segment Distribution Code SD[11:0] * @seg_offset_mask: Segment offset mask in SD[11:0]
*/ struct segdist_code { int ratem; int seg_interval; int segdist_code;
u32 seg_offset_mask;
/* * Presence Rate table for all Natural Frequencies * The Presence rate of a constant bitrate stream is mean flow rate of the * stream expressed in occupied Segments of that Data Channel per second. * Table 66 from SLIMbus 2.0 Specs * * Index of the table corresponds to Presence rate code for the respective rate * in the table.
*/ staticconstint slim_presence_rate_table[] = {
0, /* Not Indicated */
12000,
24000,
48000,
96000,
192000,
384000,
768000,
0, /* Reserved */
11025,
22050,
44100,
88200,
176400,
352800,
705600,
4000,
8000,
16000,
32000,
64000,
128000,
256000,
512000,
};
/** * slim_stream_allocate() - Allocate a new SLIMbus Stream * @dev:Slim device to be associated with * @name: name of the stream * * This is very first call for SLIMbus streaming, this API will allocate * a new SLIMbus stream and return a valid stream runtime pointer for client * to use it in subsequent stream apis. state of stream is set to ALLOCATED * * Return: valid pointer on success and error code on failure. * From ASoC DPCM framework, this state is linked to startup() operation.
*/ struct slim_stream_runtime *slim_stream_allocate(struct slim_device *dev, constchar *name)
{ struct slim_stream_runtime *rt;
rt = kzalloc(sizeof(*rt), GFP_KERNEL); if (!rt) return ERR_PTR(-ENOMEM);
for (i = 0; i < ARRAY_SIZE(slim_presence_rate_table); i++) { if (rate == slim_presence_rate_table[i]) return i;
}
return -EINVAL;
}
/** * slim_stream_prepare() - Prepare a SLIMbus Stream * * @rt: instance of slim stream runtime to configure * @cfg: new configuration for the stream * * This API will configure SLIMbus stream with config parameters from cfg. * return zero on success and error code on failure. From ASoC DPCM framework, * this state is linked to hw_params() operation.
*/ int slim_stream_prepare(struct slim_stream_runtime *rt, struct slim_stream_config *cfg)
{ struct slim_controller *ctrl = rt->dev->ctrl; struct slim_port *port; int num_ports, i, port_id, prrate;
if (rt->ports) {
dev_err(&rt->dev->dev, "Stream already Prepared\n"); return -EINVAL;
}
/** * slim_stream_enable() - Enable a prepared SLIMbus Stream * * @stream: instance of slim stream runtime to enable * * This API will enable all the ports and channels associated with * SLIMbus stream * * Return: zero on success and error code on failure. From ASoC DPCM framework, * this state is linked to trigger() start operation.
*/ int slim_stream_enable(struct slim_stream_runtime *stream)
{
DEFINE_SLIM_BCAST_TXN(txn, SLIM_MSG_MC_BEGIN_RECONFIGURATION,
3, SLIM_LA_MANAGER, NULL); struct slim_controller *ctrl = stream->dev->ctrl; int ret, i;
if (ctrl->enable_stream) {
ret = ctrl->enable_stream(stream); if (ret) return ret;
for (i = 0; i < stream->num_ports; i++)
stream->ports[i].ch.state = SLIM_CH_STATE_ACTIVE;
return ret;
}
ret = slim_do_transfer(ctrl, &txn); if (ret) return ret;
/* define channels first before activating them */ for (i = 0; i < stream->num_ports; i++) { struct slim_port *port = &stream->ports[i];
/** * slim_stream_disable() - Disable a SLIMbus Stream * * @stream: instance of slim stream runtime to disable * * This API will disable all the ports and channels associated with * SLIMbus stream * * Return: zero on success and error code on failure. From ASoC DPCM framework, * this state is linked to trigger() pause operation.
*/ int slim_stream_disable(struct slim_stream_runtime *stream)
{
DEFINE_SLIM_BCAST_TXN(txn, SLIM_MSG_MC_BEGIN_RECONFIGURATION,
3, SLIM_LA_MANAGER, NULL); struct slim_controller *ctrl = stream->dev->ctrl; int ret, i;
if (!stream->ports || !stream->num_ports) return -EINVAL;
if (ctrl->disable_stream)
ctrl->disable_stream(stream);
ret = slim_do_transfer(ctrl, &txn); if (ret) return ret;
for (i = 0; i < stream->num_ports; i++)
slim_deactivate_remove_channel(stream, &stream->ports[i]);
/** * slim_stream_unprepare() - Un-prepare a SLIMbus Stream * * @stream: instance of slim stream runtime to unprepare * * This API will un allocate all the ports and channels associated with * SLIMbus stream * * Return: zero on success and error code on failure. From ASoC DPCM framework, * this state is linked to trigger() stop operation.
*/ int slim_stream_unprepare(struct slim_stream_runtime *stream)
{ int i;
if (!stream->ports || !stream->num_ports) return -EINVAL;
for (i = 0; i < stream->num_ports; i++)
slim_disconnect_port(stream, &stream->ports[i]);
/** * slim_stream_free() - Free a SLIMbus Stream * * @stream: instance of slim stream runtime to free * * This API will un allocate all the memory associated with * slim stream runtime, user is not allowed to make an dereference * to stream after this call. * * Return: zero on success and error code on failure. From ASoC DPCM framework, * this state is linked to shutdown() operation.
*/ int slim_stream_free(struct slim_stream_runtime *stream)
{ struct slim_device *sdev = stream->dev;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.