* [PATCH1/2] hda: add access to jack functions
@ 2008-10-20 21:40 Matthew Ranostay
2008-10-21 6:08 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Matthew Ranostay @ 2008-10-20 21:40 UTC (permalink / raw)
To: alsa-devel; +Cc: Takashi Iwai
Removed 'static' declaration from get_jack_location() to be accessed via the
codec patches. Also added jack location and type reporting functions for use in
the jack abstraction layer implementations.
Signed-off-by: Matthew Ranostay <mranostay@embeddedalley.com>
---
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index 4a08c31..10f26e0 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -383,6 +383,9 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec,
/*
* get widget capabilities
*/
+const char *get_jack_connectivity(u32 cfg);
+const char *get_jack_type(u32 cfg);
+const char *get_jack_location(u32 cfg);
static inline u32 get_wcaps(struct hda_codec *codec, hda_nid_t nid)
{
if (nid < codec->start_nid ||
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c
index 64ab19f..b77c1b1 100644
--- a/sound/pci/hda/hda_proc.c
+++ b/sound/pci/hda/hda_proc.c
@@ -145,7 +145,7 @@ static void print_pcm_caps(struct snd_info_buffer *buffer,
print_pcm_formats(buffer, stream);
}
-static const char *get_jack_location(u32 cfg)
+const char *get_jack_location(u32 cfg)
{
static char *bases[7] = {
"N/A", "Rear", "Front", "Left", "Right", "Top", "Bottom",
@@ -171,6 +171,26 @@ static const char *get_jack_location(u32 cfg)
return "UNKNOWN";
}
+const char *get_jack_connectivity(u32 cfg)
+{
+ static char *jack_locations[4] = { "Ext", "Int", "Sep", "Oth" };
+
+ return jack_locations[(cfg >> (AC_DEFCFG_LOCATION_SHIFT + 4)) & 3];
+}
+
+const char *get_jack_type(u32 cfg)
+{
+ static char *jack_types[16] = {
+ "Line Out", "Speaker", "HP Out", "CD",
+ "SPDIF Out", "Digital Out", "Modem Line", "Modem Hand",
+ "Line In", "Aux", "Mic", "Telephony",
+ "SPDIF In", "Digitial In", "Reserved", "Other"
+ };
+
+ return jack_types[(cfg & AC_DEFCFG_DEVICE)
+ >> AC_DEFCFG_DEVICE_SHIFT];
+}
+
static const char *get_jack_connection(u32 cfg)
{
static char *names[16] = {
@@ -206,13 +226,6 @@ static void print_pin_caps(struct snd_info_buffer *buffer,
int *supports_vref)
{
static char *jack_conns[4] = { "Jack", "N/A", "Fixed", "Both" };
- static char *jack_types[16] = {
- "Line Out", "Speaker", "HP Out", "CD",
- "SPDIF Out", "Digital Out", "Modem Line", "Modem Hand",
- "Line In", "Aux", "Mic", "Telephony",
- "SPDIF In", "Digitial In", "Reserved", "Other"
- };
- static char *jack_locations[4] = { "Ext", "Int", "Sep", "Oth" };
unsigned int caps, val;
caps = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP);
@@ -274,8 +287,8 @@ static void print_pin_caps(struct snd_info_buffer *buffer,
caps = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONFIG_DEFAULT, 0);
snd_iprintf(buffer, " Pin Default 0x%08x: [%s] %s at %s %s\n", caps,
jack_conns[(caps & AC_DEFCFG_PORT_CONN) >> AC_DEFCFG_PORT_CONN_SHIFT],
- jack_types[(caps & AC_DEFCFG_DEVICE) >> AC_DEFCFG_DEVICE_SHIFT],
- jack_locations[(caps >> (AC_DEFCFG_LOCATION_SHIFT + 4)) & 3],
+ get_jack_type(caps),
+ get_jack_connectivity(caps),
get_jack_location(caps));
snd_iprintf(buffer, " Conn = %s, Color = %s\n",
get_jack_connection(caps),
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH1/2] hda: add access to jack functions
2008-10-20 21:40 [PATCH1/2] hda: add access to jack functions Matthew Ranostay
@ 2008-10-21 6:08 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2008-10-21 6:08 UTC (permalink / raw)
To: Matthew Ranostay; +Cc: alsa-devel
At Mon, 20 Oct 2008 17:40:08 -0400,
Matthew Ranostay wrote:
>
> Removed 'static' declaration from get_jack_location() to be accessed via the
> codec patches. Also added jack location and type reporting functions for use in
> the jack abstraction layer implementations.
>
> Signed-off-by: Matthew Ranostay <mranostay@embeddedalley.com>
> ---
>
> diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
> index 4a08c31..10f26e0 100644
> --- a/sound/pci/hda/hda_local.h
> +++ b/sound/pci/hda/hda_local.h
> @@ -383,6 +383,9 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec,
> /*
> * get widget capabilities
> */
> +const char *get_jack_connectivity(u32 cfg);
> +const char *get_jack_type(u32 cfg);
> +const char *get_jack_location(u32 cfg);
Basically all global functions should have snd_ prefix.
Yeah, get_wcaps() has exceptionally no prefix but it's an inline
function.
Also, if these function are really needed in patch_*.c, they must be
moved to hda_codec.c since the build of hda_proc.c depends on
CONFIG_PROC_FS.
thanks,
Takashi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-10-21 6:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-20 21:40 [PATCH1/2] hda: add access to jack functions Matthew Ranostay
2008-10-21 6:08 ` Takashi Iwai
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.