/** * DOC: Implementation Status * * At the moment jacks have a simple implementation and can only be used to * receive notifications about a plugged in/out device. * * VIRTIO_SND_R_JACK_REMAP * is not supported
*/
/** * struct virtio_jack - VirtIO jack. * @jack: Kernel jack control. * @nid: Functional group node identifier. * @features: Jack virtio feature bit map (1 << VIRTIO_SND_JACK_F_XXX). * @defconf: Pin default configuration value. * @caps: Pin capabilities value. * @connected: Current jack connection status. * @type: Kernel jack type (SND_JACK_XXX).
*/ struct virtio_jack { struct snd_jack *jack;
u32 nid;
u32 features;
u32 defconf;
u32 caps; bool connected; int type;
};
/** * virtsnd_jack_get_label() - Get the name string for the jack. * @vjack: VirtIO jack. * * Returns the jack name based on the default pin configuration value (see HDA * specification). * * Context: Any context. * Return: Name string.
*/ staticconstchar *virtsnd_jack_get_label(struct virtio_jack *vjack)
{ unsignedint defconf = vjack->defconf; unsignedint device =
(defconf & AC_DEFCFG_DEVICE) >> AC_DEFCFG_DEVICE_SHIFT; unsignedint location =
(defconf & AC_DEFCFG_LOCATION) >> AC_DEFCFG_LOCATION_SHIFT;
switch (device) { case AC_JACK_LINE_OUT: return"Line Out"; case AC_JACK_SPEAKER: return"Speaker"; case AC_JACK_HP_OUT: return"Headphone"; case AC_JACK_CD: return"CD"; case AC_JACK_SPDIF_OUT: case AC_JACK_DIG_OTHER_OUT: if (location == AC_JACK_LOC_HDMI) return"HDMI Out"; else return"SPDIF Out"; case AC_JACK_LINE_IN: return"Line"; case AC_JACK_AUX: return"Aux"; case AC_JACK_MIC_IN: return"Mic"; case AC_JACK_SPDIF_IN: return"SPDIF In"; case AC_JACK_DIG_OTHER_IN: return"Digital In"; default: return"Misc";
}
}
/** * virtsnd_jack_get_type() - Get the type for the jack. * @vjack: VirtIO jack. * * Returns the jack type based on the default pin configuration value (see HDA * specification). * * Context: Any context. * Return: SND_JACK_XXX value.
*/ staticint virtsnd_jack_get_type(struct virtio_jack *vjack)
{ unsignedint defconf = vjack->defconf; unsignedint device =
(defconf & AC_DEFCFG_DEVICE) >> AC_DEFCFG_DEVICE_SHIFT;
switch (device) { case AC_JACK_LINE_OUT: case AC_JACK_SPEAKER: return SND_JACK_LINEOUT; case AC_JACK_HP_OUT: return SND_JACK_HEADPHONE; case AC_JACK_SPDIF_OUT: case AC_JACK_DIG_OTHER_OUT: return SND_JACK_AVOUT; case AC_JACK_MIC_IN: return SND_JACK_MICROPHONE; default: return SND_JACK_LINEIN;
}
}
/** * virtsnd_jack_parse_cfg() - Parse the jack configuration. * @snd: VirtIO sound device. * * This function is called during initial device initialization. * * Context: Any context that permits to sleep. * Return: 0 on success, -errno on failure.
*/ int virtsnd_jack_parse_cfg(struct virtio_snd *snd)
{ struct virtio_device *vdev = snd->vdev; struct virtio_snd_jack_info *info;
u32 i; int rc;
virtio_cread_le(vdev, struct virtio_snd_config, jacks, &snd->njacks); if (!snd->njacks) return 0;
snd->jacks = devm_kcalloc(&vdev->dev, snd->njacks, sizeof(*snd->jacks),
GFP_KERNEL); if (!snd->jacks) return -ENOMEM;
info = kcalloc(snd->njacks, sizeof(*info), GFP_KERNEL); if (!info) return -ENOMEM;
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.