ret = of_property_read_u32(np, "mux-int-port", &int_port); if (ret) {
dev_err(dev, "mux-int-port missing or invalid\n"); goto fail;
} if (int_port > MUX_PORT_MAX || int_port == 0) {
dev_err(dev, "mux-int-port: hardware only has %d mux ports\n",
MUX_PORT_MAX);
ret = -EINVAL; goto fail;
}
ret = of_property_read_u32(np, "mux-ext-port", &ext_port); if (ret) {
dev_err(dev, "mux-ext-port missing or invalid\n"); goto fail;
} if (ext_port > MUX_PORT_MAX || ext_port == 0) {
dev_err(dev, "mux-ext-port: hardware only has %d mux ports\n",
MUX_PORT_MAX);
ret = -EINVAL; goto fail;
}
/* * The port numbering in the hardware manual starts at 1, while * the audmux API expects it starts at 0.
*/
int_port--;
ext_port--;
ret = imx_audmux_v2_configure_port(int_port,
IMX_AUDMUX_V2_PTCR_SYN |
IMX_AUDMUX_V2_PTCR_TFSEL(ext_port) |
IMX_AUDMUX_V2_PTCR_TCSEL(ext_port) |
IMX_AUDMUX_V2_PTCR_TFSDIR |
IMX_AUDMUX_V2_PTCR_TCLKDIR,
IMX_AUDMUX_V2_PDCR_RXDSEL(ext_port)); if (ret) {
dev_err(dev, "audmux internal port setup failed\n"); return ret;
}
ret = imx_audmux_v2_configure_port(ext_port,
IMX_AUDMUX_V2_PTCR_SYN,
IMX_AUDMUX_V2_PDCR_RXDSEL(int_port)); if (ret) {
dev_err(dev, "audmux external port setup failed\n"); return ret;
}
ssi_np = of_parse_phandle(pdev->dev.of_node, "ssi-controller", 0);
codec_np = of_parse_phandle(pdev->dev.of_node, "audio-codec", 0); if (!ssi_np || !codec_np) {
dev_err(dev, "phandle missing or invalid\n");
ret = -EINVAL; goto fail;
}
ssi_pdev = of_find_device_by_node(ssi_np); if (!ssi_pdev) {
dev_err(dev, "failed to find SSI platform device\n");
ret = -EINVAL; goto fail;
}
data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); if (!data) {
ret = -ENOMEM; goto put_device;
}
comp = devm_kzalloc(dev, 2 * sizeof(*comp), GFP_KERNEL); if (!comp) {
ret = -ENOMEM; goto put_device;
}
data->dev = dev;
data->jack_gpiod = devm_gpiod_get_optional(dev, "jack", GPIOD_IN); if (IS_ERR(data->jack_gpiod)) {
ret = PTR_ERR(data->jack_gpiod); goto put_device;
}
/* * CPU == Platform * platform is using soc-generic-dmaengine-pcm
*/
data->dai.cpus =
data->dai.platforms = &comp[0];
data->dai.codecs = &comp[1];
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.