From 8fc6d4186e0a60b3755a6b88bf67a3ac3214dcc3 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 2 Jun 2010 13:29:17 +0200 Subject: ALSA: hda-intel - fix wallclk variable update and condition This patch fixes thinko introduced in "last minutes" before commiting of the last wallclk patch. It also fixes the condition checking if the first period after last wallclk update is processed. There is a little rounding error in period_wallclk. Signed-off-by: Jaroslav Kysela --- sound/pci/hda/hda_intel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index dc79564fea30..af701a894687 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -1913,11 +1913,11 @@ static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev) if (WARN_ONCE(!azx_dev->period_bytes, "hda-intel: zero azx_dev->period_bytes")) return -1; /* this shouldn't happen! */ - if (wallclk <= azx_dev->period_wallclk && + if (wallclk < (azx_dev->period_wallclk * 5) / 4 && pos % azx_dev->period_bytes > azx_dev->period_bytes / 2) /* NG - it's below the first next period boundary */ return bdl_pos_adj[chip->dev_index] ? 0 : -1; - azx_dev->start_wallclk = wallclk; + azx_dev->start_wallclk += wallclk; return 1; /* OK, it's fine */ } -- cgit v1.2.3 From c9ff921abecda352e987a6aae169118a3fc9aa5d Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Tue, 15 Jun 2010 17:26:28 +0300 Subject: ALSA: alsa: riptide: don't use own hex_to_bin() method Signed-off-by: Andy Shevchenko Signed-off-by: Takashi Iwai --- sound/pci/riptide/riptide.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c index ad4462677615..59d79962f236 100644 --- a/sound/pci/riptide/riptide.c +++ b/sound/pci/riptide/riptide.c @@ -97,6 +97,7 @@ #include #include #include +#include #include #include #include @@ -667,13 +668,12 @@ static u32 atoh(const unsigned char *in, unsigned int len) unsigned char c; while (len) { + int value; + c = in[len - 1]; - if ((c >= '0') && (c <= '9')) - sum += mult * (c - '0'); - else if ((c >= 'A') && (c <= 'F')) - sum += mult * (c - ('A' - 10)); - else if ((c >= 'a') && (c <= 'f')) - sum += mult * (c - ('a' - 10)); + value = hex_to_bin(c); + if (value >= 0) + sum += mult * value; mult *= 16; --len; } -- cgit v1.2.3 From 3a3d5fd125f82200019ef406c4d51ba4d9f0a604 Mon Sep 17 00:00:00 2001 From: David Dillow Date: Sun, 27 Jun 2010 00:04:32 +0200 Subject: sis7019: fix capture issues with multiple periods per buffer When using a timing voice to clock out periods during capture, the driver would slowly loose synchronization and never catch up, eventually reaching a point where it no longer generated interrupts. To avoid this situation, the virtual period clocking was changed to shorten the next timing period when our timing voice falls too far behind the capture voice. In addition, the first virtual period for the timing voice was slightly too short, causing the timing voice to initially be ahead of the capture voice. While tracking down this problem, I noticed that the expected sample offset was being incorrectly initialized, causing an overrun to be incorrectly reported when the timing voice happened to be perfectly synchronized. Reported-by: Hans Schou Signed-off-by: Dave Dillow Signed-off-by: Jaroslav Kysela --- sound/pci/sis7019.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/sis7019.c b/sound/pci/sis7019.c index 9cc1b5aa0148..614ff6e514fd 100644 --- a/sound/pci/sis7019.c +++ b/sound/pci/sis7019.c @@ -264,11 +264,13 @@ static void sis_update_voice(struct voice *voice) * if using small periods. * * If we're less than 9 samples behind, we're on target. + * Otherwise, shorten the next vperiod by the amount we've + * been delayed. */ if (sync > -9) voice->vperiod = voice->sync_period_size + 1; else - voice->vperiod = voice->sync_period_size - 4; + voice->vperiod = voice->sync_period_size + sync + 10; if (voice->vperiod < voice->buffer_size) { sis_update_sso(voice, voice->vperiod); @@ -736,7 +738,7 @@ static void sis_prepare_timing_voice(struct voice *voice, period_size = buffer_size; /* Initially, we want to interrupt just a bit behind the end of - * the period we're clocking out. 10 samples seems to give a good + * the period we're clocking out. 12 samples seems to give a good * delay. * * We want to spread our interrupts throughout the virtual period, @@ -747,7 +749,7 @@ static void sis_prepare_timing_voice(struct voice *voice, * * This is all moot if we don't need to use virtual periods. */ - vperiod = runtime->period_size + 10; + vperiod = runtime->period_size + 12; if (vperiod > period_size) { u16 tail = vperiod % period_size; u16 quarter_period = period_size / 4; @@ -776,7 +778,7 @@ static void sis_prepare_timing_voice(struct voice *voice, */ timing->flags |= VOICE_SYNC_TIMING; timing->sync_base = voice->ctrl_base; - timing->sync_cso = runtime->period_size - 1; + timing->sync_cso = runtime->period_size; timing->sync_period_size = runtime->period_size; timing->sync_buffer_size = runtime->buffer_size; timing->period_size = period_size; -- cgit v1.2.3 From 08b450988905505d12f7671bc24b8da73631d327 Mon Sep 17 00:00:00 2001 From: David Dillow Date: Sun, 27 Jun 2010 00:07:57 +0200 Subject: sis7019: increase reset delays A few boards using this controller are reported to need a little extra time during their reset cycle. Reported-by: Michael Goeke Signed-off-by: Dave Dillow Signed-off-by: Jaroslav Kysela --- sound/pci/sis7019.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/sis7019.c b/sound/pci/sis7019.c index 614ff6e514fd..1b8f6742b5fa 100644 --- a/sound/pci/sis7019.c +++ b/sound/pci/sis7019.c @@ -1049,7 +1049,7 @@ static int sis_chip_free(struct sis7019 *sis) /* Reset the chip, and disable all interrputs. */ outl(SIS_GCR_SOFTWARE_RESET, sis->ioport + SIS_GCR); - udelay(10); + udelay(25); outl(0, sis->ioport + SIS_GCR); outl(0, sis->ioport + SIS_GIER); @@ -1085,7 +1085,7 @@ static int sis_chip_init(struct sis7019 *sis) /* Reset the audio controller */ outl(SIS_GCR_SOFTWARE_RESET, io + SIS_GCR); - udelay(10); + udelay(25); outl(0, io + SIS_GCR); /* Get the AC-link semaphore, and reset the codecs @@ -1098,7 +1098,7 @@ static int sis_chip_init(struct sis7019 *sis) return -EIO; outl(SIS_AC97_CMD_CODEC_COLD_RESET, io + SIS_AC97_CMD); - udelay(10); + udelay(250); count = 0xffff; while ((inw(io + SIS_AC97_STATUS) & SIS_AC97_STATUS_BUSY) && --count) -- cgit v1.2.3 From 168f1b07ccc0e8edecb67fab2d0670861853e2fd Mon Sep 17 00:00:00 2001 From: Eliot Blennerhassett Date: Tue, 6 Jul 2010 08:37:06 +1200 Subject: ALSA: asihpi - HPI API updates Remove some deprecated items. Change compander api to one function per parameter. Add a version string define. Signed-off-by: Eliot Blennerhassett Signed-off-by: Takashi Iwai --- sound/pci/asihpi/asihpi.c | 10 +++---- sound/pci/asihpi/hpi.h | 68 ++++++++++++++++++++++++++++++++------------- sound/pci/asihpi/hpidebug.h | 4 +-- 3 files changed, 55 insertions(+), 27 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c index 1db586af4f9c..91218f77217f 100644 --- a/sound/pci/asihpi/asihpi.c +++ b/sound/pci/asihpi/asihpi.c @@ -1383,7 +1383,7 @@ static char *asihpi_src_names[] = compile_time_assert( (ARRAY_SIZE(asihpi_src_names) == - (HPI_SOURCENODE_LAST_INDEX-HPI_SOURCENODE_BASE+1)), + (HPI_SOURCENODE_LAST_INDEX-HPI_SOURCENODE_NONE+1)), assert_src_names_size); #if ASI_STYLE_NAMES @@ -1414,7 +1414,7 @@ static char *asihpi_dst_names[] = compile_time_assert( (ARRAY_SIZE(asihpi_dst_names) == - (HPI_DESTNODE_LAST_INDEX-HPI_DESTNODE_BASE+1)), + (HPI_DESTNODE_LAST_INDEX-HPI_DESTNODE_NONE+1)), assert_dst_names_size); static inline int ctl_add(struct snd_card *card, struct snd_kcontrol_new *ctl, @@ -2171,7 +2171,7 @@ static int snd_asihpi_mux_info(struct snd_kcontrol *kcontrol, &src_node_type, &src_node_index); sprintf(uinfo->value.enumerated.name, "%s %d", - asihpi_src_names[src_node_type - HPI_SOURCENODE_BASE], + asihpi_src_names[src_node_type - HPI_SOURCENODE_NONE], src_node_index); return 0; } @@ -2603,8 +2603,8 @@ static int __devinit snd_card_asihpi_mixer_new(struct snd_card_asihpi *asihpi) } - hpi_ctl.src_node_type -= HPI_SOURCENODE_BASE; - hpi_ctl.dst_node_type -= HPI_DESTNODE_BASE; + hpi_ctl.src_node_type -= HPI_SOURCENODE_NONE; + hpi_ctl.dst_node_type -= HPI_DESTNODE_NONE; /* ASI50xx in SSX mode has multiple meters on the same node. Use subindex to create distinct ALSA controls diff --git a/sound/pci/asihpi/hpi.h b/sound/pci/asihpi/hpi.h index 0173bbe62b67..cee4df460f68 100644 --- a/sound/pci/asihpi/hpi.h +++ b/sound/pci/asihpi/hpi.h @@ -50,7 +50,8 @@ i.e 3.05.02 is a development version #define HPI_VER_RELEASE(v) ((int)(v & 0xFF)) /* Use single digits for versions less that 10 to avoid octal. */ -#define HPI_VER HPI_VERSION_CONSTRUCTOR(4L, 3, 25) +#define HPI_VER HPI_VERSION_CONSTRUCTOR(4L, 3, 36) +#define HPI_VER_STRING "4.03.36" /* Library version as documented in hpi-api-versions.txt */ #define HPI_LIB_VER HPI_VERSION_CONSTRUCTOR(9, 0, 0) @@ -203,8 +204,6 @@ enum HPI_SOURCENODES { exists on a destination node can be searched for using a source node value of either 0, or HPI_SOURCENODE_NONE */ HPI_SOURCENODE_NONE = 100, - /** \deprecated Use HPI_SOURCENODE_NONE instead. */ - HPI_SOURCENODE_BASE = 100, /** Out Stream (Play) node. */ HPI_SOURCENODE_OSTREAM = 101, /** Line in node - could be analog, AES/EBU or network. */ @@ -235,8 +234,6 @@ enum HPI_DESTNODES { exists on a source node can be searched for using a destination node value of either 0, or HPI_DESTNODE_NONE */ HPI_DESTNODE_NONE = 200, - /** \deprecated Use HPI_DESTNODE_NONE instead. */ - HPI_DESTNODE_BASE = 200, /** In Stream (Record) node. */ HPI_DESTNODE_ISTREAM = 201, HPI_DESTNODE_LINEOUT = 202, /**< line out node. */ @@ -432,7 +429,18 @@ Property 2 - adapter can do stream grouping (supports SSX2) Property 1 - adapter can do samplerate conversion (MRX) Property 2 - adapter can do timestretch (TSX) */ - HPI_ADAPTER_PROPERTY_CAPS2 = 269 + HPI_ADAPTER_PROPERTY_CAPS2 = 269, + +/** Readonly adapter sync header connection count. +*/ + HPI_ADAPTER_PROPERTY_SYNC_HEADER_CONNECTIONS = 270, +/** Readonly supports SSX2 property. +Indicates the adapter supports SSX2 in some mode setting. The +return value is true (1) or false (0). If the current adapter +mode is MONO SSX2 is disabled, even though this property will +return true. +*/ + HPI_ADAPTER_PROPERTY_SUPPORTS_SSX2 = 271 }; /** Adapter mode commands @@ -813,8 +821,6 @@ enum HPI_SAMPLECLOCK_SOURCES { /** The sampleclock output is derived from its local samplerate generator. The local samplerate may be set using HPI_SampleClock_SetLocalRate(). */ HPI_SAMPLECLOCK_SOURCE_LOCAL = 1, -/** \deprecated Use HPI_SAMPLECLOCK_SOURCE_LOCAL instead */ - HPI_SAMPLECLOCK_SOURCE_ADAPTER = 1, /** The adapter is clocked from a dedicated AES/EBU SampleClock input.*/ HPI_SAMPLECLOCK_SOURCE_AESEBU_SYNC = 2, /** From external wordclock connector */ @@ -825,10 +831,6 @@ enum HPI_SAMPLECLOCK_SOURCES { HPI_SAMPLECLOCK_SOURCE_SMPTE = 5, /** One of the aesebu inputs */ HPI_SAMPLECLOCK_SOURCE_AESEBU_INPUT = 6, -/** \deprecated The first aesebu input with a valid signal -Superseded by separate Auto enable flag -*/ - HPI_SAMPLECLOCK_SOURCE_AESEBU_AUTO = 7, /** From a network interface e.g. Cobranet or Livewire at either 48 or 96kHz */ HPI_SAMPLECLOCK_SOURCE_NETWORK = 8, /** From previous adjacent module (ASI2416 only)*/ @@ -1015,8 +1017,6 @@ enum HPI_ERROR_CODES { HPI_ERROR_CONTROL_DISABLED = 404, /** I2C transaction failed due to a missing ACK. */ HPI_ERROR_CONTROL_I2C_MISSING_ACK = 405, - /** Control attribute is valid, but not supported by this hardware. */ - HPI_ERROR_UNSUPPORTED_CONTROL_ATTRIBUTE = 406, /** Control is busy, or coming out of reset and cannot be accessed at this time. */ HPI_ERROR_CONTROL_NOT_READY = 407, @@ -1827,13 +1827,41 @@ u16 hpi_parametricEQ__get_coeffs(const struct hpi_hsubsys *ph_subsys, Compressor Expander control *******************************/ -u16 hpi_compander_set(const struct hpi_hsubsys *ph_subsys, u32 h_control, - u16 attack, u16 decay, short ratio100, short threshold0_01dB, - short makeup_gain0_01dB); +u16 hpi_compander_set_enable(const struct hpi_hsubsys *ph_subsys, + u32 h_control, u32 on); + +u16 hpi_compander_get_enable(const struct hpi_hsubsys *ph_subsys, + u32 h_control, u32 *pon); + +u16 hpi_compander_set_makeup_gain(const struct hpi_hsubsys *ph_subsys, + u32 h_control, short makeup_gain0_01dB); + +u16 hpi_compander_get_makeup_gain(const struct hpi_hsubsys *ph_subsys, + u32 h_control, short *pn_makeup_gain0_01dB); + +u16 hpi_compander_set_attack_time_constant(const struct hpi_hsubsys + *ph_subsys, u32 h_control, u32 index, u32 attack); + +u16 hpi_compander_get_attack_time_constant(const struct hpi_hsubsys + *ph_subsys, u32 h_control, u32 index, u32 *pw_attack); + +u16 hpi_compander_set_decay_time_constant(const struct hpi_hsubsys *ph_subsys, + u32 h_control, u32 index, u32 decay); + +u16 hpi_compander_get_decay_time_constant(const struct hpi_hsubsys *ph_subsys, + u32 h_control, u32 index, u32 *pw_decay); + +u16 hpi_compander_set_threshold(const struct hpi_hsubsys *ph_subsys, + u32 h_control, u32 index, short threshold0_01dB); + +u16 hpi_compander_get_threshold(const struct hpi_hsubsys *ph_subsys, + u32 h_control, u32 index, short *pn_threshold0_01dB); + +u16 hpi_compander_set_ratio(const struct hpi_hsubsys *ph_subsys, + u32 h_control, u32 index, u32 ratio100); -u16 hpi_compander_get(const struct hpi_hsubsys *ph_subsys, u32 h_control, - u16 *pw_attack, u16 *pw_decay, short *pw_ratio100, - short *pn_threshold0_01dB, short *pn_makeup_gain0_01dB); +u16 hpi_compander_get_ratio(const struct hpi_hsubsys *ph_subsys, + u32 h_control, u32 index, u32 *pw_ratio100); /******************************* Cobranet HMI control diff --git a/sound/pci/asihpi/hpidebug.h b/sound/pci/asihpi/hpidebug.h index 44dccadcc25b..a2f0952a99f0 100644 --- a/sound/pci/asihpi/hpidebug.h +++ b/sound/pci/asihpi/hpidebug.h @@ -356,7 +356,7 @@ compile_time_assert((HPI_CONTROL_LAST_INDEX + 1 == 27), "HPI_SOURCENODE_ADAPTER" \ } -compile_time_assert((HPI_SOURCENODE_LAST_INDEX - HPI_SOURCENODE_BASE + 1) == +compile_time_assert((HPI_SOURCENODE_LAST_INDEX - HPI_SOURCENODE_NONE + 1) == (12), sourcenode_strings_match_defs); #define HPI_DESTNODE_STRINGS \ @@ -370,7 +370,7 @@ compile_time_assert((HPI_SOURCENODE_LAST_INDEX - HPI_SOURCENODE_BASE + 1) == "HPI_DESTNODE_COBRANET", \ "HPI_DESTNODE_ANALOG" \ } -compile_time_assert((HPI_DESTNODE_LAST_INDEX - HPI_DESTNODE_BASE + 1) == (8), +compile_time_assert((HPI_DESTNODE_LAST_INDEX - HPI_DESTNODE_NONE + 1) == (8), destnode_strings_match_defs); #define HPI_CONTROL_CHANNEL_MODE_STRINGS \ -- cgit v1.2.3 From 1dd6aaaafc930dd9bfaa6ea1d21bac2b4ec12527 Mon Sep 17 00:00:00 2001 From: Eliot Blennerhassett Date: Tue, 6 Jul 2010 08:37:07 +1200 Subject: ALSA: asihpi - Use version string instead of printf formatting Signed-off-by: Eliot Blennerhassett Signed-off-by: Takashi Iwai --- sound/pci/asihpi/hpioctl.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/asihpi/hpioctl.c b/sound/pci/asihpi/hpioctl.c index 7396ac54e99f..311499992a22 100644 --- a/sound/pci/asihpi/hpioctl.c +++ b/sound/pci/asihpi/hpioctl.c @@ -464,9 +464,7 @@ void __init asihpi_init(void) memset(adapters, 0, sizeof(adapters)); - printk(KERN_INFO "ASIHPI driver %d.%02d.%02d\n", - HPI_VER_MAJOR(HPI_VER), HPI_VER_MINOR(HPI_VER), - HPI_VER_RELEASE(HPI_VER)); + printk(KERN_INFO "ASIHPI driver " HPI_VER_STRING "\n"); hpi_init_message_response(&hm, &hr, HPI_OBJ_SUBSYSTEM, HPI_SUBSYS_DRIVER_LOAD); -- cgit v1.2.3 From 38439146355de2c10c369f93136333be6107a16b Mon Sep 17 00:00:00 2001 From: Eliot Blennerhassett Date: Tue, 6 Jul 2010 08:37:08 +1200 Subject: ALSA: asihpi - Add ASI5200 family Signed-off-by: Eliot Blennerhassett Signed-off-by: Takashi Iwai --- sound/pci/asihpi/hpi6000.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'sound/pci') diff --git a/sound/pci/asihpi/hpi6000.c b/sound/pci/asihpi/hpi6000.c index 12dab5e4892c..f7e374ec4414 100644 --- a/sound/pci/asihpi/hpi6000.c +++ b/sound/pci/asihpi/hpi6000.c @@ -687,6 +687,7 @@ static short hpi6000_adapter_boot_load_dsp(struct hpi_adapter_obj *pao, switch (pao->pci.subsys_device_id) { case 0x5100: case 0x5110: /* ASI5100 revB or higher with C6711D */ + case 0x5200: /* ASI5200 PC_ie version of ASI5100 */ case 0x6100: case 0x6200: boot_load_family = HPI_ADAPTER_FAMILY_ASI(0x6200); @@ -1133,6 +1134,12 @@ static short hpi6000_adapter_boot_load_dsp(struct hpi_adapter_obj *pao, subsys_device_id) == HPI_ADAPTER_FAMILY_ASI(0x5100)) mask = 0x00000000L; + /* ASI5200 uses AX6 code, */ + /* but has no PLD r/w register to test */ + if (HPI_ADAPTER_FAMILY_ASI(pao->pci. + subsys_device_id) == + HPI_ADAPTER_FAMILY_ASI(0x5200)) + mask = 0x00000000L; break; case HPI_ADAPTER_FAMILY_ASI(0x8800): /* ASI8800 has 16bit path to FPGA */ -- cgit v1.2.3 From 108ccb3f0fa617a003c6b076b73b74d4f85e4cde Mon Sep 17 00:00:00 2001 From: Eliot Blennerhassett Date: Tue, 6 Jul 2010 08:37:09 +1200 Subject: ALSA: asihpi - Change compander API and tidy Compander API changed to one function per parameter. Factor out some common code for stereo log value reading. Make some more entity functions static. Signed-off-by: Eliot Blennerhassett Signed-off-by: Takashi Iwai --- sound/pci/asihpi/hpi_internal.h | 30 ++-- sound/pci/asihpi/hpifunc.c | 324 ++++++++++++++++++++++++---------------- 2 files changed, 211 insertions(+), 143 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/asihpi/hpi_internal.h b/sound/pci/asihpi/hpi_internal.h index fdd0ce02aa68..7ae7a1d59853 100644 --- a/sound/pci/asihpi/hpi_internal.h +++ b/sound/pci/asihpi/hpi_internal.h @@ -142,12 +142,15 @@ enum HPI_BUSES { /******************************************* CONTROL ATTRIBUTES ****/ /* (in order of control type ID */ - /* This allows for 255 control types, 256 unique attributes each */ +/* This allows for 255 control types, 256 unique attributes each */ #define HPI_CTL_ATTR(ctl, ai) (HPI_CONTROL_##ctl * 0x100 + ai) /* Get the sub-index of the attribute for a control type */ #define HPI_CTL_ATTR_INDEX(i) (i&0xff) +/* Extract the control from the control attribute */ +#define HPI_CTL_ATTR_CONTROL(i) (i>>8) + /* Generic control attributes. */ /** Enable a control. @@ -311,8 +314,7 @@ Used for HPI_ChannelModeSet/Get() /* Microphone control attributes */ #define HPI_MICROPHONE_PHANTOM_POWER HPI_CTL_ATTR(MICROPHONE, 1) -/** Equalizer control attributes -*/ +/** Equalizer control attributes */ /** Used to get number of filters in an EQ. (Can't set) */ #define HPI_EQUALIZER_NUM_FILTERS HPI_CTL_ATTR(EQUALIZER, 1) /** Set/get the filter by type, freq, Q, gain */ @@ -320,13 +322,15 @@ Used for HPI_ChannelModeSet/Get() /** Get the biquad coefficients */ #define HPI_EQUALIZER_COEFFICIENTS HPI_CTL_ATTR(EQUALIZER, 3) -#define HPI_COMPANDER_PARAMS HPI_CTL_ATTR(COMPANDER, 1) +/* Note compander also uses HPI_GENERIC_ENABLE */ +#define HPI_COMPANDER_PARAMS HPI_CTL_ATTR(COMPANDER, 1) +#define HPI_COMPANDER_MAKEUPGAIN HPI_CTL_ATTR(COMPANDER, 2) +#define HPI_COMPANDER_THRESHOLD HPI_CTL_ATTR(COMPANDER, 3) +#define HPI_COMPANDER_RATIO HPI_CTL_ATTR(COMPANDER, 4) +#define HPI_COMPANDER_ATTACK HPI_CTL_ATTR(COMPANDER, 5) +#define HPI_COMPANDER_DECAY HPI_CTL_ATTR(COMPANDER, 6) -/* Cobranet control attributes. - MUST be distinct from all other control attributes. - This is so that host side processing can easily identify a Cobranet control - and apply additional host side operations (like copying data) as required. -*/ +/* Cobranet control attributes. */ #define HPI_COBRANET_SET HPI_CTL_ATTR(COBRANET, 1) #define HPI_COBRANET_GET HPI_CTL_ATTR(COBRANET, 2) #define HPI_COBRANET_SET_DATA HPI_CTL_ATTR(COBRANET, 3) @@ -1512,11 +1516,11 @@ struct hpi_control_cache_single { struct hpi_control_cache_info i; union { struct { /* volume */ - u16 an_log[2]; + short an_log[2]; } v; struct { /* peak meter */ - u16 an_log_peak[2]; - u16 an_logRMS[2]; + short an_log_peak[2]; + short an_logRMS[2]; } p; struct { /* channel mode */ u16 mode; @@ -1526,7 +1530,7 @@ struct hpi_control_cache_single { u16 source_node_index; } x; struct { /* level/trim */ - u16 an_log[2]; + short an_log[2]; } l; struct { /* tuner - partial caching. some attributes go to the DSP. */ diff --git a/sound/pci/asihpi/hpifunc.c b/sound/pci/asihpi/hpifunc.c index 298eef3e20e9..9c6958ab9284 100644 --- a/sound/pci/asihpi/hpifunc.c +++ b/sound/pci/asihpi/hpifunc.c @@ -96,8 +96,7 @@ void hpi_stream_response_to_legacy(struct hpi_stream_res *pSR) static struct hpi_hsubsys gh_subsys; -struct hpi_hsubsys *hpi_subsys_create(void - ) +struct hpi_hsubsys *hpi_subsys_create(void) { struct hpi_message hm; struct hpi_response hr; @@ -302,6 +301,7 @@ u16 hpi_adapter_set_mode_ex(const struct hpi_hsubsys *ph_subsys, { struct hpi_message hm; struct hpi_response hr; + hpi_init_message_response(&hm, &hr, HPI_OBJ_ADAPTER, HPI_ADAPTER_SET_MODE); hm.adapter_index = adapter_index; @@ -510,7 +510,7 @@ u16 hpi_adapter_debug_read(const struct hpi_hsubsys *ph_subsys, hm.adapter_index = adapter_index; hm.u.ax.debug_read.dsp_address = dsp_address; - if (*count_bytes > sizeof(hr.u.bytes)) + if (*count_bytes > (int)sizeof(hr.u.bytes)) *count_bytes = sizeof(hr.u.bytes); hm.u.ax.debug_read.count_bytes = *count_bytes; @@ -976,6 +976,7 @@ u16 hpi_outstream_ancillary_read(const struct hpi_hsubsys *ph_subsys, { struct hpi_message hm; struct hpi_response hr; + hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, HPI_OSTREAM_ANC_READ); u32TOINDEXES(h_outstream, &hm.adapter_index, &hm.obj_index); @@ -1581,6 +1582,7 @@ u16 hpi_control_param_set(const struct hpi_hsubsys *ph_subsys, { struct hpi_message hm; struct hpi_response hr; + hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, HPI_CONTROL_SET_STATE); u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); @@ -1591,6 +1593,22 @@ u16 hpi_control_param_set(const struct hpi_hsubsys *ph_subsys, return hr.error; } +static u16 hpi_control_log_set2(u32 h_control, u16 attrib, short sv0, + short sv1) +{ + struct hpi_message hm; + struct hpi_response hr; + + hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, + HPI_CONTROL_SET_STATE); + u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); + hm.u.c.attribute = attrib; + hm.u.c.an_log_value[0] = sv0; + hm.u.c.an_log_value[1] = sv1; + hpi_send_recv(&hm, &hr); + return hr.error; +} + static u16 hpi_control_param_get(const struct hpi_hsubsys *ph_subsys, const u32 h_control, const u16 attrib, u32 param1, u32 param2, @@ -1598,6 +1616,7 @@ u16 hpi_control_param_get(const struct hpi_hsubsys *ph_subsys, { struct hpi_message hm; struct hpi_response hr; + hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, HPI_CONTROL_GET_STATE); u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); @@ -1605,8 +1624,8 @@ u16 hpi_control_param_get(const struct hpi_hsubsys *ph_subsys, hm.u.c.param1 = param1; hm.u.c.param2 = param2; hpi_send_recv(&hm, &hr); - if (pparam1) - *pparam1 = hr.u.c.param1; + + *pparam1 = hr.u.c.param1; if (pparam2) *pparam2 = hr.u.c.param2; @@ -1617,10 +1636,23 @@ u16 hpi_control_param_get(const struct hpi_hsubsys *ph_subsys, hpi_control_param_get(s, h, a, 0, 0, p1, NULL) #define hpi_control_param2_get(s, h, a, p1, p2) \ hpi_control_param_get(s, h, a, 0, 0, p1, p2) -#define hpi_control_ex_param1_get(s, h, a, p1) \ - hpi_control_ex_param_get(s, h, a, 0, 0, p1, NULL) -#define hpi_control_ex_param2_get(s, h, a, p1, p2) \ - hpi_control_ex_param_get(s, h, a, 0, 0, p1, p2) + +static u16 hpi_control_log_get2(const struct hpi_hsubsys *ph_subsys, + u32 h_control, u16 attrib, short *sv0, short *sv1) +{ + struct hpi_message hm; + struct hpi_response hr; + hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, + HPI_CONTROL_GET_STATE); + u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); + hm.u.c.attribute = attrib; + + hpi_send_recv(&hm, &hr); + *sv0 = hr.u.c.an_log_value[0]; + if (sv1) + *sv1 = hr.u.c.an_log_value[1]; + return hr.error; +} static u16 hpi_control_query(const struct hpi_hsubsys *ph_subsys, @@ -1629,6 +1661,7 @@ u16 hpi_control_query(const struct hpi_hsubsys *ph_subsys, { struct hpi_message hm; struct hpi_response hr; + hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, HPI_CONTROL_GET_INFO); u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); @@ -1643,9 +1676,8 @@ u16 hpi_control_query(const struct hpi_hsubsys *ph_subsys, return hr.error; } -static u16 hpi_control_get_string(const struct hpi_hsubsys *ph_subsys, - const u32 h_control, const u16 attribute, char *psz_string, - const u32 string_length) +static u16 hpi_control_get_string(const u32 h_control, const u16 attribute, + char *psz_string, const u32 string_length) { unsigned int sub_string_index = 0, j = 0; char c = 0; @@ -1916,6 +1948,7 @@ u16 hpi_cobranet_hmi_write(const struct hpi_hsubsys *ph_subsys, u32 h_control, { struct hpi_message hm; struct hpi_response hr; + hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROLEX, HPI_CONTROL_SET_STATE); u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); @@ -1941,6 +1974,7 @@ u16 hpi_cobranet_hmi_read(const struct hpi_hsubsys *ph_subsys, u32 h_control, { struct hpi_message hm; struct hpi_response hr; + hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROLEX, HPI_CONTROL_GET_STATE); u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); @@ -1980,6 +2014,7 @@ u16 hpi_cobranet_hmi_get_status(const struct hpi_hsubsys *ph_subsys, { struct hpi_message hm; struct hpi_response hr; + hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROLEX, HPI_CONTROL_GET_STATE); u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); @@ -2006,6 +2041,7 @@ u16 hpi_cobranet_getI_paddress(const struct hpi_hsubsys *ph_subsys, u32 byte_count; u32 iP; u16 error; + error = hpi_cobranet_hmi_read(ph_subsys, h_control, HPI_COBRANET_HMI_cobra_ip_mon_currentIP, 4, &byte_count, (u8 *)&iP); @@ -2082,6 +2118,7 @@ u16 hpi_cobranet_getMA_caddress(const struct hpi_hsubsys *ph_subsys, u32 byte_count; u16 error; u32 mAC; + error = hpi_cobranet_hmi_read(ph_subsys, h_control, HPI_COBRANET_HMI_cobra_if_phy_address, 4, &byte_count, (u8 *)&mAC); @@ -2103,53 +2140,111 @@ u16 hpi_cobranet_getMA_caddress(const struct hpi_hsubsys *ph_subsys, return error; } -u16 hpi_compander_set(const struct hpi_hsubsys *ph_subsys, u32 h_control, - u16 attack, u16 decay, short ratio100, short threshold0_01dB, - short makeup_gain0_01dB) +u16 hpi_compander_set_enable(const struct hpi_hsubsys *ph_subsys, + u32 h_control, u32 enable) +{ + return hpi_control_param_set(ph_subsys, h_control, HPI_GENERIC_ENABLE, + enable, 0); +} + +u16 hpi_compander_get_enable(const struct hpi_hsubsys *ph_subsys, + u32 h_control, u32 *enable) +{ + return hpi_control_param1_get(ph_subsys, h_control, + HPI_GENERIC_ENABLE, enable); +} + +u16 hpi_compander_set_makeup_gain(const struct hpi_hsubsys *ph_subsys, + u32 h_control, short makeup_gain0_01dB) +{ + return hpi_control_log_set2(h_control, HPI_COMPANDER_MAKEUPGAIN, + makeup_gain0_01dB, 0); +} + +u16 hpi_compander_get_makeup_gain(const struct hpi_hsubsys *ph_subsys, + u32 h_control, short *makeup_gain0_01dB) +{ + return hpi_control_log_get2(ph_subsys, h_control, + HPI_COMPANDER_MAKEUPGAIN, makeup_gain0_01dB, NULL); +} + +u16 hpi_compander_set_attack_time_constant(const struct hpi_hsubsys + *ph_subsys, u32 h_control, unsigned int index, u32 attack) +{ + return hpi_control_param_set(ph_subsys, h_control, + HPI_COMPANDER_ATTACK, attack, index); +} + +u16 hpi_compander_get_attack_time_constant(const struct hpi_hsubsys + *ph_subsys, u32 h_control, unsigned int index, u32 *attack) +{ + return hpi_control_param_get(ph_subsys, h_control, + HPI_COMPANDER_ATTACK, 0, index, attack, &index); +} + +u16 hpi_compander_set_decay_time_constant(const struct hpi_hsubsys *ph_subsys, + u32 h_control, unsigned int index, u32 decay) +{ + return hpi_control_param_set(ph_subsys, h_control, + HPI_COMPANDER_DECAY, decay, index); +} + +u16 hpi_compander_get_decay_time_constant(const struct hpi_hsubsys *ph_subsys, + u32 h_control, unsigned int index, u32 *decay) +{ + return hpi_control_param_get(ph_subsys, h_control, + HPI_COMPANDER_DECAY, 0, index, decay, &index); + +} + +u16 hpi_compander_set_threshold(const struct hpi_hsubsys *ph_subsys, + u32 h_control, unsigned int index, short threshold0_01dB) { struct hpi_message hm; struct hpi_response hr; + hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, HPI_CONTROL_SET_STATE); u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); - - hm.u.c.param1 = attack + ((u32)ratio100 << 16); - hm.u.c.param2 = (decay & 0xFFFFL); + hm.u.c.attribute = HPI_COMPANDER_THRESHOLD; + hm.u.c.param2 = index; hm.u.c.an_log_value[0] = threshold0_01dB; - hm.u.c.an_log_value[1] = makeup_gain0_01dB; - hm.u.c.attribute = HPI_COMPANDER_PARAMS; hpi_send_recv(&hm, &hr); return hr.error; } -u16 hpi_compander_get(const struct hpi_hsubsys *ph_subsys, u32 h_control, - u16 *pw_attack, u16 *pw_decay, short *pw_ratio100, - short *pn_threshold0_01dB, short *pn_makeup_gain0_01dB) +u16 hpi_compander_get_threshold(const struct hpi_hsubsys *ph_subsys, + u32 h_control, unsigned int index, short *threshold0_01dB) { struct hpi_message hm; struct hpi_response hr; + hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, HPI_CONTROL_GET_STATE); u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); - hm.u.c.attribute = HPI_COMPANDER_PARAMS; + hm.u.c.attribute = HPI_COMPANDER_THRESHOLD; + hm.u.c.param2 = index; hpi_send_recv(&hm, &hr); + *threshold0_01dB = hr.u.c.an_log_value[0]; - if (pw_attack) - *pw_attack = (short)(hr.u.c.param1 & 0xFFFF); - if (pw_decay) - *pw_decay = (short)(hr.u.c.param2 & 0xFFFF); - if (pw_ratio100) - *pw_ratio100 = (short)(hr.u.c.param1 >> 16); + return hr.error; +} - if (pn_threshold0_01dB) - *pn_threshold0_01dB = hr.u.c.an_log_value[0]; - if (pn_makeup_gain0_01dB) - *pn_makeup_gain0_01dB = hr.u.c.an_log_value[1]; +u16 hpi_compander_set_ratio(const struct hpi_hsubsys *ph_subsys, + u32 h_control, u32 index, u32 ratio100) +{ + return hpi_control_param_set(ph_subsys, h_control, + HPI_COMPANDER_RATIO, ratio100, index); +} - return hr.error; +u16 hpi_compander_get_ratio(const struct hpi_hsubsys *ph_subsys, + u32 h_control, u32 index, u32 *ratio100) +{ + return hpi_control_param_get(ph_subsys, h_control, + HPI_COMPANDER_RATIO, 0, index, ratio100, &index); } u16 hpi_level_query_range(const struct hpi_hsubsys *ph_subsys, u32 h_control, @@ -2157,6 +2252,7 @@ u16 hpi_level_query_range(const struct hpi_hsubsys *ph_subsys, u32 h_control, { struct hpi_message hm; struct hpi_response hr; + hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, HPI_CONTROL_GET_STATE); u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); @@ -2181,37 +2277,16 @@ u16 hpi_level_set_gain(const struct hpi_hsubsys *ph_subsys, u32 h_control, short an_gain0_01dB[HPI_MAX_CHANNELS] ) { - struct hpi_message hm; - struct hpi_response hr; - - hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, - HPI_CONTROL_SET_STATE); - u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); - memcpy(hm.u.c.an_log_value, an_gain0_01dB, - sizeof(short) * HPI_MAX_CHANNELS); - hm.u.c.attribute = HPI_LEVEL_GAIN; - - hpi_send_recv(&hm, &hr); - - return hr.error; + return hpi_control_log_set2(h_control, HPI_LEVEL_GAIN, + an_gain0_01dB[0], an_gain0_01dB[1]); } u16 hpi_level_get_gain(const struct hpi_hsubsys *ph_subsys, u32 h_control, short an_gain0_01dB[HPI_MAX_CHANNELS] ) { - struct hpi_message hm; - struct hpi_response hr; - hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, - HPI_CONTROL_GET_STATE); - u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); - hm.u.c.attribute = HPI_LEVEL_GAIN; - - hpi_send_recv(&hm, &hr); - - memcpy(an_gain0_01dB, hr.u.c.an_log_value, - sizeof(short) * HPI_MAX_CHANNELS); - return hr.error; + return hpi_control_log_get2(ph_subsys, h_control, HPI_LEVEL_GAIN, + &an_gain0_01dB[0], &an_gain0_01dB[1]); } u16 hpi_meter_query_channels(const struct hpi_hsubsys *ph_subsys, @@ -2413,6 +2488,7 @@ u16 hpi_parametricEQ__get_band(const struct hpi_hsubsys *ph_subsys, { struct hpi_message hm; struct hpi_response hr; + hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, HPI_CONTROL_GET_STATE); u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); @@ -2439,6 +2515,7 @@ u16 hpi_parametricEQ__set_band(const struct hpi_hsubsys *ph_subsys, { struct hpi_message hm; struct hpi_response hr; + hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, HPI_CONTROL_SET_STATE); u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); @@ -2460,6 +2537,7 @@ u16 hpi_parametricEQ__get_coeffs(const struct hpi_hsubsys *ph_subsys, { struct hpi_message hm; struct hpi_response hr; + hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, HPI_CONTROL_GET_STATE); u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); @@ -2623,8 +2701,8 @@ u16 hpi_tone_detector_get_frequency(const struct hpi_hsubsys *ph_subsys, u16 hpi_tone_detector_get_state(const struct hpi_hsubsys *ph_subsys, u32 h_control, u32 *state) { - return hpi_control_param_get(ph_subsys, h_control, - HPI_TONEDETECTOR_STATE, 0, 0, (u32 *)state, NULL); + return hpi_control_param1_get(ph_subsys, h_control, + HPI_TONEDETECTOR_STATE, state); } u16 hpi_tone_detector_set_enable(const struct hpi_hsubsys *ph_subsys, @@ -2637,8 +2715,8 @@ u16 hpi_tone_detector_set_enable(const struct hpi_hsubsys *ph_subsys, u16 hpi_tone_detector_get_enable(const struct hpi_hsubsys *ph_subsys, u32 h_control, u32 *enable) { - return hpi_control_param_get(ph_subsys, h_control, HPI_GENERIC_ENABLE, - 0, 0, (u32 *)enable, NULL); + return hpi_control_param1_get(ph_subsys, h_control, + HPI_GENERIC_ENABLE, enable); } u16 hpi_tone_detector_set_event_enable(const struct hpi_hsubsys *ph_subsys, @@ -2651,8 +2729,8 @@ u16 hpi_tone_detector_set_event_enable(const struct hpi_hsubsys *ph_subsys, u16 hpi_tone_detector_get_event_enable(const struct hpi_hsubsys *ph_subsys, u32 h_control, u32 *event_enable) { - return hpi_control_param_get(ph_subsys, h_control, - HPI_GENERIC_EVENT_ENABLE, 0, 0, (u32 *)event_enable, NULL); + return hpi_control_param1_get(ph_subsys, h_control, + HPI_GENERIC_EVENT_ENABLE, event_enable); } u16 hpi_tone_detector_set_threshold(const struct hpi_hsubsys *ph_subsys, @@ -2665,15 +2743,15 @@ u16 hpi_tone_detector_set_threshold(const struct hpi_hsubsys *ph_subsys, u16 hpi_tone_detector_get_threshold(const struct hpi_hsubsys *ph_subsys, u32 h_control, int *threshold) { - return hpi_control_param_get(ph_subsys, h_control, - HPI_TONEDETECTOR_THRESHOLD, 0, 0, (u32 *)threshold, NULL); + return hpi_control_param1_get(ph_subsys, h_control, + HPI_TONEDETECTOR_THRESHOLD, (u32 *)threshold); } u16 hpi_silence_detector_get_state(const struct hpi_hsubsys *ph_subsys, u32 h_control, u32 *state) { - return hpi_control_param_get(ph_subsys, h_control, - HPI_SILENCEDETECTOR_STATE, 0, 0, (u32 *)state, NULL); + return hpi_control_param1_get(ph_subsys, h_control, + HPI_SILENCEDETECTOR_STATE, state); } u16 hpi_silence_detector_set_enable(const struct hpi_hsubsys *ph_subsys, @@ -2686,50 +2764,50 @@ u16 hpi_silence_detector_set_enable(const struct hpi_hsubsys *ph_subsys, u16 hpi_silence_detector_get_enable(const struct hpi_hsubsys *ph_subsys, u32 h_control, u32 *enable) { - return hpi_control_param_get(ph_subsys, h_control, HPI_GENERIC_ENABLE, - 0, 0, (u32 *)enable, NULL); + return hpi_control_param1_get(ph_subsys, h_control, + HPI_GENERIC_ENABLE, enable); } u16 hpi_silence_detector_set_event_enable(const struct hpi_hsubsys *ph_subsys, u32 h_control, u32 event_enable) { return hpi_control_param_set(ph_subsys, h_control, - HPI_GENERIC_EVENT_ENABLE, (u32)event_enable, 0); + HPI_GENERIC_EVENT_ENABLE, event_enable, 0); } u16 hpi_silence_detector_get_event_enable(const struct hpi_hsubsys *ph_subsys, u32 h_control, u32 *event_enable) { - return hpi_control_param_get(ph_subsys, h_control, - HPI_GENERIC_EVENT_ENABLE, 0, 0, (u32 *)event_enable, NULL); + return hpi_control_param1_get(ph_subsys, h_control, + HPI_GENERIC_EVENT_ENABLE, event_enable); } u16 hpi_silence_detector_set_delay(const struct hpi_hsubsys *ph_subsys, u32 h_control, u32 delay) { return hpi_control_param_set(ph_subsys, h_control, - HPI_SILENCEDETECTOR_DELAY, (u32)delay, 0); + HPI_SILENCEDETECTOR_DELAY, delay, 0); } u16 hpi_silence_detector_get_delay(const struct hpi_hsubsys *ph_subsys, u32 h_control, u32 *delay) { - return hpi_control_param_get(ph_subsys, h_control, - HPI_SILENCEDETECTOR_DELAY, 0, 0, (u32 *)delay, NULL); + return hpi_control_param1_get(ph_subsys, h_control, + HPI_SILENCEDETECTOR_DELAY, delay); } u16 hpi_silence_detector_set_threshold(const struct hpi_hsubsys *ph_subsys, u32 h_control, int threshold) { return hpi_control_param_set(ph_subsys, h_control, - HPI_SILENCEDETECTOR_THRESHOLD, (u32)threshold, 0); + HPI_SILENCEDETECTOR_THRESHOLD, threshold, 0); } u16 hpi_silence_detector_get_threshold(const struct hpi_hsubsys *ph_subsys, u32 h_control, int *threshold) { - return hpi_control_param_get(ph_subsys, h_control, - HPI_SILENCEDETECTOR_THRESHOLD, 0, 0, (u32 *)threshold, NULL); + return hpi_control_param1_get(ph_subsys, h_control, + HPI_SILENCEDETECTOR_THRESHOLD, (u32 *)threshold); } u16 hpi_tuner_query_band(const struct hpi_hsubsys *ph_subsys, @@ -2822,6 +2900,7 @@ u16 hpi_tuner_getRF_level(const struct hpi_hsubsys *ph_subsys, u32 h_control, { struct hpi_message hm; struct hpi_response hr; + hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, HPI_CONTROL_GET_STATE); u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); @@ -2838,6 +2917,7 @@ u16 hpi_tuner_get_rawRF_level(const struct hpi_hsubsys *ph_subsys, { struct hpi_message hm; struct hpi_response hr; + hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, HPI_CONTROL_GET_STATE); u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); @@ -2894,14 +2974,14 @@ u16 hpi_tuner_get_program(const struct hpi_hsubsys *ph_subsys, u32 h_control, u16 hpi_tuner_get_hd_radio_dsp_version(const struct hpi_hsubsys *ph_subsys, u32 h_control, char *psz_dsp_version, const u32 string_size) { - return hpi_control_get_string(ph_subsys, h_control, + return hpi_control_get_string(h_control, HPI_TUNER_HDRADIO_DSP_VERSION, psz_dsp_version, string_size); } u16 hpi_tuner_get_hd_radio_sdk_version(const struct hpi_hsubsys *ph_subsys, u32 h_control, char *psz_sdk_version, const u32 string_size) { - return hpi_control_get_string(ph_subsys, h_control, + return hpi_control_get_string(h_control, HPI_TUNER_HDRADIO_SDK_VERSION, psz_sdk_version, string_size); } @@ -2942,15 +3022,15 @@ u16 hpi_tuner_get_mode(const struct hpi_hsubsys *ph_subsys, u32 h_control, u16 hpi_tuner_get_hd_radio_signal_quality(const struct hpi_hsubsys *ph_subsys, u32 h_control, u32 *pquality) { - return hpi_control_param_get(ph_subsys, h_control, - HPI_TUNER_HDRADIO_SIGNAL_QUALITY, 0, 0, pquality, NULL); + return hpi_control_param1_get(ph_subsys, h_control, + HPI_TUNER_HDRADIO_SIGNAL_QUALITY, pquality); } u16 hpi_tuner_get_hd_radio_signal_blend(const struct hpi_hsubsys *ph_subsys, u32 h_control, u32 *pblend) { - return hpi_control_param_get(ph_subsys, h_control, - HPI_TUNER_HDRADIO_BLEND, 0, 0, pblend, NULL); + return hpi_control_param1_get(ph_subsys, h_control, + HPI_TUNER_HDRADIO_BLEND, pblend); } u16 hpi_tuner_set_hd_radio_signal_blend(const struct hpi_hsubsys *ph_subsys, @@ -2965,6 +3045,7 @@ u16 hpi_tuner_getRDS(const struct hpi_hsubsys *ph_subsys, u32 h_control, { struct hpi_message hm; struct hpi_response hr; + hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, HPI_CONTROL_GET_STATE); u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); @@ -2981,43 +3062,43 @@ u16 hpi_tuner_getRDS(const struct hpi_hsubsys *ph_subsys, u32 h_control, u16 HPI_PAD__get_channel_name(const struct hpi_hsubsys *ph_subsys, u32 h_control, char *psz_string, const u32 data_length) { - return hpi_control_get_string(ph_subsys, h_control, - HPI_PAD_CHANNEL_NAME, psz_string, data_length); + return hpi_control_get_string(h_control, HPI_PAD_CHANNEL_NAME, + psz_string, data_length); } u16 HPI_PAD__get_artist(const struct hpi_hsubsys *ph_subsys, u32 h_control, char *psz_string, const u32 data_length) { - return hpi_control_get_string(ph_subsys, h_control, HPI_PAD_ARTIST, - psz_string, data_length); + return hpi_control_get_string(h_control, HPI_PAD_ARTIST, psz_string, + data_length); } u16 HPI_PAD__get_title(const struct hpi_hsubsys *ph_subsys, u32 h_control, char *psz_string, const u32 data_length) { - return hpi_control_get_string(ph_subsys, h_control, HPI_PAD_TITLE, - psz_string, data_length); + return hpi_control_get_string(h_control, HPI_PAD_TITLE, psz_string, + data_length); } u16 HPI_PAD__get_comment(const struct hpi_hsubsys *ph_subsys, u32 h_control, char *psz_string, const u32 data_length) { - return hpi_control_get_string(ph_subsys, h_control, HPI_PAD_COMMENT, - psz_string, data_length); + return hpi_control_get_string(h_control, HPI_PAD_COMMENT, psz_string, + data_length); } u16 HPI_PAD__get_program_type(const struct hpi_hsubsys *ph_subsys, u32 h_control, u32 *ppTY) { - return hpi_control_param_get(ph_subsys, h_control, - HPI_PAD_PROGRAM_TYPE, 0, 0, ppTY, NULL); + return hpi_control_param1_get(ph_subsys, h_control, + HPI_PAD_PROGRAM_TYPE, ppTY); } u16 HPI_PAD__get_rdsPI(const struct hpi_hsubsys *ph_subsys, u32 h_control, u32 *ppI) { - return hpi_control_param_get(ph_subsys, h_control, HPI_PAD_PROGRAM_ID, - 0, 0, ppI, NULL); + return hpi_control_param1_get(ph_subsys, h_control, + HPI_PAD_PROGRAM_ID, ppI); } u16 hpi_volume_query_channels(const struct hpi_hsubsys *ph_subsys, @@ -3031,36 +3112,16 @@ u16 hpi_volume_set_gain(const struct hpi_hsubsys *ph_subsys, u32 h_control, short an_log_gain[HPI_MAX_CHANNELS] ) { - struct hpi_message hm; - struct hpi_response hr; - hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, - HPI_CONTROL_SET_STATE); - u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); - memcpy(hm.u.c.an_log_value, an_log_gain, - sizeof(short) * HPI_MAX_CHANNELS); - hm.u.c.attribute = HPI_VOLUME_GAIN; - - hpi_send_recv(&hm, &hr); - - return hr.error; + return hpi_control_log_set2(h_control, HPI_VOLUME_GAIN, + an_log_gain[0], an_log_gain[1]); } u16 hpi_volume_get_gain(const struct hpi_hsubsys *ph_subsys, u32 h_control, short an_log_gain[HPI_MAX_CHANNELS] ) { - struct hpi_message hm; - struct hpi_response hr; - hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, - HPI_CONTROL_GET_STATE); - u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); - hm.u.c.attribute = HPI_VOLUME_GAIN; - - hpi_send_recv(&hm, &hr); - - memcpy(an_log_gain, hr.u.c.an_log_value, - sizeof(short) * HPI_MAX_CHANNELS); - return hr.error; + return hpi_control_log_get2(ph_subsys, h_control, HPI_VOLUME_GAIN, + &an_log_gain[0], &an_log_gain[1]); } u16 hpi_volume_query_range(const struct hpi_hsubsys *ph_subsys, u32 h_control, @@ -3068,6 +3129,7 @@ u16 hpi_volume_query_range(const struct hpi_hsubsys *ph_subsys, u32 h_control, { struct hpi_message hm; struct hpi_response hr; + hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, HPI_CONTROL_GET_STATE); u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); @@ -3094,6 +3156,7 @@ u16 hpi_volume_auto_fade_profile(const struct hpi_hsubsys *ph_subsys, { struct hpi_message hm; struct hpi_response hr; + hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, HPI_CONTROL_SET_STATE); u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); @@ -3170,43 +3233,43 @@ static size_t entity_type_to_size[LAST_ENTITY_TYPE] = { 6 * sizeof(char), }; -inline size_t hpi_entity_size(struct hpi_entity *entity_ptr) +static inline size_t hpi_entity_size(struct hpi_entity *entity_ptr) { return entity_ptr->header.size; } -inline size_t hpi_entity_header_size(struct hpi_entity *entity_ptr) +static inline size_t hpi_entity_header_size(struct hpi_entity *entity_ptr) { return sizeof(entity_ptr->header); } -inline size_t hpi_entity_value_size(struct hpi_entity *entity_ptr) +static inline size_t hpi_entity_value_size(struct hpi_entity *entity_ptr) { return hpi_entity_size(entity_ptr) - hpi_entity_header_size(entity_ptr); } -inline size_t hpi_entity_item_count(struct hpi_entity *entity_ptr) +static inline size_t hpi_entity_item_count(struct hpi_entity *entity_ptr) { return hpi_entity_value_size(entity_ptr) / entity_type_to_size[entity_ptr->header.type]; } -inline struct hpi_entity *hpi_entity_ptr_to_next(struct hpi_entity +static inline struct hpi_entity *hpi_entity_ptr_to_next(struct hpi_entity *entity_ptr) { return (void *)(((uint8_t *) entity_ptr) + hpi_entity_size(entity_ptr)); } -inline u16 hpi_entity_check_type(const enum e_entity_type t) +static inline u16 hpi_entity_check_type(const enum e_entity_type t) { if (t >= 0 && t < STR_TYPE_FIELD_MAX) return 0; return HPI_ERROR_ENTITY_TYPE_INVALID; } -inline u16 hpi_entity_check_role(const enum e_entity_role r) +static inline u16 hpi_entity_check_role(const enum e_entity_role r) { if (r >= 0 && r < STR_ROLE_FIELD_MAX) return 0; @@ -3624,6 +3687,7 @@ u16 hpi_async_event_wait(const struct hpi_hsubsys *ph_subsys, u32 h_async, u16 maximum_events, struct hpi_async_event *p_events, u16 *pw_number_returned) { + return 0; } -- cgit v1.2.3 From 36ed8bdd867314660b8dca2d1b6d9e92352b319b Mon Sep 17 00:00:00 2001 From: Eliot Blennerhassett Date: Tue, 6 Jul 2010 08:37:10 +1200 Subject: ALSA: asihpi - Minor HPI error handling fixes Handle errors in tuner level caching, Ccorrect error code for aesebu rx status. Signed-off-by: Eliot Blennerhassett Signed-off-by: Takashi Iwai --- sound/pci/asihpi/hpicmn.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/asihpi/hpicmn.c b/sound/pci/asihpi/hpicmn.c index fcd64539d9ef..dda4f1c6f658 100644 --- a/sound/pci/asihpi/hpicmn.c +++ b/sound/pci/asihpi/hpicmn.c @@ -353,7 +353,12 @@ short hpi_check_control_cache(struct hpi_control_cache *p_cache, phr->u.c.param1 = pC->u.t.band; else if ((phm->u.c.attribute == HPI_TUNER_LEVEL) && (phm->u.c.param1 == HPI_TUNER_LEVEL_AVERAGE)) - phr->u.c.param1 = pC->u.t.level; + if (pC->u.t.level == HPI_ERROR_ILLEGAL_CACHE_VALUE) { + phr->u.c.param1 = 0; + phr->error = + HPI_ERROR_INVALID_CONTROL_ATTRIBUTE; + } else + phr->u.c.param1 = pC->u.t.level; else found = 0; break; @@ -397,7 +402,8 @@ short hpi_check_control_cache(struct hpi_control_cache *p_cache, if (pC->u.clk.source_index == HPI_ERROR_ILLEGAL_CACHE_VALUE) { phr->u.c.param1 = 0; - phr->error = HPI_ERROR_INVALID_OPERATION; + phr->error = + HPI_ERROR_INVALID_CONTROL_ATTRIBUTE; } else phr->u.c.param1 = pC->u.clk.source_index; } else if (phm->u.c.attribute == HPI_SAMPLECLOCK_SAMPLERATE) -- cgit v1.2.3 From f978d36da4024ee22957f74276e944624a8c7f6d Mon Sep 17 00:00:00 2001 From: Eliot Blennerhassett Date: Tue, 6 Jul 2010 08:37:11 +1200 Subject: ALSA: asihpi - Remove unneeded ; Signed-off-by: Eliot Blennerhassett Signed-off-by: Takashi Iwai --- sound/pci/asihpi/hpidebug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound/pci') diff --git a/sound/pci/asihpi/hpidebug.c b/sound/pci/asihpi/hpidebug.c index 4cd85a401b34..949836ec913a 100644 --- a/sound/pci/asihpi/hpidebug.c +++ b/sound/pci/asihpi/hpidebug.c @@ -111,7 +111,7 @@ make_treenode_from_array(hpi_control_type_strings, HPI_CONTROL_TYPE_STRINGS) &hpi_profile_strings,\ &hpi_control_strings, \ &hpi_asyncevent_strings \ -}; +} make_treenode_from_array(hpi_function_strings, HPI_FUNCTION_STRINGS) compile_time_assert(HPI_OBJ_MAXINDEX == 14, obj_list_doesnt_match); -- cgit v1.2.3 From 395c61d19621e80b763810cc988416dc1b6bfd3e Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Mon, 12 Jul 2010 16:27:24 +0200 Subject: ALSA: via82xx: allow changing the initial DXS volume As per-stream volume controls, the DXS controls are not intended to adjust the overall sound level and so are initialized every time a stream is opened. However, there are special situations where one wants to reduce the overall volume in the digital domain, i.e., before the AC'97 codec's PCM volume control. To allow this, add a module parameter that sets the initial DXS volume. Signed-off-by: Clemens Ladisch Tested-by: Soeren D. Schulze Signed-off-by: Takashi Iwai --- sound/pci/via82xx.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c index 7e494b6a1d0e..8c5f8b5a59f0 100644 --- a/sound/pci/via82xx.c +++ b/sound/pci/via82xx.c @@ -85,6 +85,7 @@ static int joystick; static int ac97_clock = 48000; static char *ac97_quirk; static int dxs_support; +static int dxs_init_volume = 31; static int nodelay; module_param(index, int, 0444); @@ -103,6 +104,8 @@ module_param(ac97_quirk, charp, 0444); MODULE_PARM_DESC(ac97_quirk, "AC'97 workaround for strange hardware."); module_param(dxs_support, int, 0444); MODULE_PARM_DESC(dxs_support, "Support for DXS channels (0 = auto, 1 = enable, 2 = disable, 3 = 48k only, 4 = no VRA, 5 = enable any sample rate)"); +module_param(dxs_init_volume, int, 0644); +MODULE_PARM_DESC(dxs_init_volume, "initial DXS volume (0-31)"); module_param(nodelay, int, 0444); MODULE_PARM_DESC(nodelay, "Disable 500ms init delay"); @@ -1245,8 +1248,10 @@ static int snd_via8233_playback_open(struct snd_pcm_substream *substream) return err; stream = viadev->reg_offset / 0x10; if (chip->dxs_controls[stream]) { - chip->playback_volume[stream][0] = 0; - chip->playback_volume[stream][1] = 0; + chip->playback_volume[stream][0] = + VIA_DXS_MAX_VOLUME - (dxs_init_volume & 31); + chip->playback_volume[stream][1] = + VIA_DXS_MAX_VOLUME - (dxs_init_volume & 31); chip->dxs_controls[stream]->vd[0].access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE; snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE | -- cgit v1.2.3 From 315e8f7501ad929acacfa94c251283e837f281ed Mon Sep 17 00:00:00 2001 From: Kulikov Vasiliy Date: Thu, 15 Jul 2010 22:48:19 +0400 Subject: ALSA: asihpi: fix sign bug bytes_per_sec is unsigned, so if snd_pcm_format_width() return error we would not see it. Signed-off-by: Kulikov Vasiliy Signed-off-by: Takashi Iwai --- sound/pci/asihpi/asihpi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c index 91218f77217f..c80b0b863c54 100644 --- a/sound/pci/asihpi/asihpi.c +++ b/sound/pci/asihpi/asihpi.c @@ -460,6 +460,7 @@ static int snd_card_asihpi_pcm_hw_params(struct snd_pcm_substream *substream, struct snd_card_asihpi *card = snd_pcm_substream_chip(substream); int err; u16 format; + int width; unsigned int bytes_per_sec; print_hwparams(params); @@ -512,9 +513,10 @@ static int snd_card_asihpi_pcm_hw_params(struct snd_pcm_substream *substream, dpcm->hpi_buffer_attached); } bytes_per_sec = params_rate(params) * params_channels(params); - bytes_per_sec *= snd_pcm_format_width(params_format(params)); + width = snd_pcm_format_width(params_format(params)); + bytes_per_sec *= width; bytes_per_sec /= 8; - if (bytes_per_sec <= 0) + if (width < 0 || bytes_per_sec == 0) return -EINVAL; dpcm->bytes_per_sec = bytes_per_sec; -- cgit v1.2.3 From 8d4bbee77e63981b91e4af7c569dc6a585ee0eb0 Mon Sep 17 00:00:00 2001 From: Eliot Blennerhassett Date: Fri, 16 Jul 2010 17:50:59 +1200 Subject: ALSA: asihpi - HPI version 4.04.01 Signed-off-by: Eliot Blennerhassett Signed-off-by: Takashi Iwai --- sound/pci/asihpi/hpi.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/asihpi/hpi.h b/sound/pci/asihpi/hpi.h index cee4df460f68..23399d02f666 100644 --- a/sound/pci/asihpi/hpi.h +++ b/sound/pci/asihpi/hpi.h @@ -50,8 +50,8 @@ i.e 3.05.02 is a development version #define HPI_VER_RELEASE(v) ((int)(v & 0xFF)) /* Use single digits for versions less that 10 to avoid octal. */ -#define HPI_VER HPI_VERSION_CONSTRUCTOR(4L, 3, 36) -#define HPI_VER_STRING "4.03.36" +#define HPI_VER HPI_VERSION_CONSTRUCTOR(4L, 4, 1) +#define HPI_VER_STRING "4.04.01" /* Library version as documented in hpi-api-versions.txt */ #define HPI_LIB_VER HPI_VERSION_CONSTRUCTOR(9, 0, 0) -- cgit v1.2.3 From 604a440a9dd08d45570c555d78a17a4602c843d5 Mon Sep 17 00:00:00 2001 From: Eliot Blennerhassett Date: Fri, 16 Jul 2010 17:51:00 +1200 Subject: ALSA: asihpi - Avoid using c99 uintX types. Signed-off-by: Eliot Blennerhassett Signed-off-by: Takashi Iwai --- sound/pci/asihpi/hpi_internal.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/asihpi/hpi_internal.h b/sound/pci/asihpi/hpi_internal.h index 7ae7a1d59853..16f502d459de 100644 --- a/sound/pci/asihpi/hpi_internal.h +++ b/sound/pci/asihpi/hpi_internal.h @@ -104,9 +104,9 @@ typedef void hpi_handler_func(struct hpi_message *, struct hpi_response *); #define STR_ROLE_FIELD_MAX 255U struct hpi_entity_str { - uint16_t size; - uint8_t type; - uint8_t role; + u16 size; + u8 type; + u8 role; }; #if defined(_MSC_VER) @@ -119,11 +119,11 @@ struct hpi_entity { #if ! defined(HPI_OS_DSP_C6000) || (defined(HPI_OS_DSP_C6000) && (__TI_COMPILER_VERSION__ > 6000008)) /* DSP C6000 compiler v6.0.8 and lower do not support flexible array member */ - uint8_t value[]; + u8 value[]; #else /* NOTE! Using sizeof(struct hpi_entity) will give erroneous results */ #define HPI_INTERNAL_WARN_ABOUT_ENTITY_VALUE - uint8_t value[1]; + u8 value[1]; #endif }; -- cgit v1.2.3 From e2768c0c223d86a20ec392528bafd25996ce7585 Mon Sep 17 00:00:00 2001 From: Eliot Blennerhassett Date: Fri, 16 Jul 2010 17:51:01 +1200 Subject: ALSA: asihpi - Avoid useless assignment of returned index values. Signed-off-by: Eliot Blennerhassett Signed-off-by: Takashi Iwai --- sound/pci/asihpi/hpifunc.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/asihpi/hpifunc.c b/sound/pci/asihpi/hpifunc.c index 9c6958ab9284..1e92eb6dd509 100644 --- a/sound/pci/asihpi/hpifunc.c +++ b/sound/pci/asihpi/hpifunc.c @@ -2179,7 +2179,7 @@ u16 hpi_compander_get_attack_time_constant(const struct hpi_hsubsys *ph_subsys, u32 h_control, unsigned int index, u32 *attack) { return hpi_control_param_get(ph_subsys, h_control, - HPI_COMPANDER_ATTACK, 0, index, attack, &index); + HPI_COMPANDER_ATTACK, 0, index, attack, NULL); } u16 hpi_compander_set_decay_time_constant(const struct hpi_hsubsys *ph_subsys, @@ -2193,7 +2193,7 @@ u16 hpi_compander_get_decay_time_constant(const struct hpi_hsubsys *ph_subsys, u32 h_control, unsigned int index, u32 *decay) { return hpi_control_param_get(ph_subsys, h_control, - HPI_COMPANDER_DECAY, 0, index, decay, &index); + HPI_COMPANDER_DECAY, 0, index, decay, NULL); } @@ -2244,7 +2244,7 @@ u16 hpi_compander_get_ratio(const struct hpi_hsubsys *ph_subsys, u32 h_control, u32 index, u32 *ratio100) { return hpi_control_param_get(ph_subsys, h_control, - HPI_COMPANDER_RATIO, 0, index, ratio100, &index); + HPI_COMPANDER_RATIO, 0, index, ratio100, NULL); } u16 hpi_level_query_range(const struct hpi_hsubsys *ph_subsys, u32 h_control, @@ -3258,8 +3258,7 @@ static inline size_t hpi_entity_item_count(struct hpi_entity *entity_ptr) static inline struct hpi_entity *hpi_entity_ptr_to_next(struct hpi_entity *entity_ptr) { - return (void *)(((uint8_t *) entity_ptr) + - hpi_entity_size(entity_ptr)); + return (void *)(((u8 *)entity_ptr) + hpi_entity_size(entity_ptr)); } static inline u16 hpi_entity_check_type(const enum e_entity_type t) -- cgit v1.2.3 From 79c944ad136c4d14388d803b51113dcaaa1d179d Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 19 Jul 2010 15:52:39 +0200 Subject: ALSA: hda-intel - do not mix audio and modem function IDs The function IDs are different for audio and modem. Do not mix them. Also, show the unsolicited bit in the function_id register. Signed-off-by: Jaroslav Kysela --- sound/pci/hda/hda_codec.c | 8 +++++--- sound/pci/hda/hda_codec.h | 5 ++++- sound/pci/hda/hda_proc.c | 7 ++++++- 3 files changed, 15 insertions(+), 5 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index a3d638c8c1fd..6e0de65f1f3a 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -730,15 +730,17 @@ static void /*__devinit*/ setup_fg_nodes(struct hda_codec *codec) total_nodes = snd_hda_get_sub_nodes(codec, AC_NODE_ROOT, &nid); for (i = 0; i < total_nodes; i++, nid++) { function_id = snd_hda_param_read(codec, nid, - AC_PAR_FUNCTION_TYPE) & 0xff; + AC_PAR_FUNCTION_TYPE); switch (function_id) { case AC_GRP_AUDIO_FUNCTION: codec->afg = nid; - codec->function_id = function_id; + codec->afg_function_id = function_id & 0xff; + codec->afg_unsol = (function_id >> 8) & 1; break; case AC_GRP_MODEM_FUNCTION: codec->mfg = nid; - codec->function_id = function_id; + codec->mfg_function_id = function_id & 0xff; + codec->mfg_unsol = (function_id >> 8) & 1; break; default: break; diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index 49e939e7e5cd..f96e909f549c 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h @@ -760,7 +760,10 @@ struct hda_codec { hda_nid_t mfg; /* MFG node id */ /* ids */ - u32 function_id; + u8 afg_function_id; + u8 mfg_function_id; + u8 afg_unsol; + u8 mfg_unsol; u32 vendor_id; u32 subsystem_id; u32 revision_id; diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c index f97d35de66c4..f025200f2a62 100644 --- a/sound/pci/hda/hda_proc.c +++ b/sound/pci/hda/hda_proc.c @@ -557,7 +557,12 @@ static void print_codec_info(struct snd_info_entry *entry, else snd_iprintf(buffer, "Not Set\n"); snd_iprintf(buffer, "Address: %d\n", codec->addr); - snd_iprintf(buffer, "Function Id: 0x%x\n", codec->function_id); + if (codec->afg) + snd_iprintf(buffer, "AFG Function Id: 0x%x (unsol %u)\n", + codec->afg_function_id, codec->afg_unsol); + if (codec->mfg) + snd_iprintf(buffer, "MFG Function Id: 0x%x (unsol %u)\n", + codec->mfg_function_id, codec->mfg_unsol); snd_iprintf(buffer, "Vendor Id: 0x%08x\n", codec->vendor_id); snd_iprintf(buffer, "Subsystem Id: 0x%08x\n", codec->subsystem_id); snd_iprintf(buffer, "Revision Id: 0x%x\n", codec->revision_id); -- cgit v1.2.3 From 0b6d092c8eeeb43893503afd2f6c1c67ceafc863 Mon Sep 17 00:00:00 2001 From: Kulikov Vasiliy Date: Fri, 16 Jul 2010 20:15:43 +0400 Subject: ALSA: echoaudio: check kmalloc() result If kmalloc() fails exit with -ENOMEM. Signed-off-by: Kulikov Vasiliy Ack-by: Giuliano Pochini Signed-off-by: Takashi Iwai --- sound/pci/echoaudio/echoaudio.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sound/pci') diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c index 668a5ec04499..20763dd03fa0 100644 --- a/sound/pci/echoaudio/echoaudio.c +++ b/sound/pci/echoaudio/echoaudio.c @@ -2250,6 +2250,8 @@ static int snd_echo_resume(struct pci_dev *pci) DE_INIT(("resume start\n")); pci_restore_state(pci); commpage_bak = kmalloc(sizeof(struct echoaudio), GFP_KERNEL); + if (commpage_bak == NULL) + return -ENOMEM; commpage = chip->comm_page; memcpy(commpage_bak, commpage, sizeof(struct comm_page)); -- cgit v1.2.3 From 68bf57001f4995a25ca65f3711ff05b6ea25e8b6 Mon Sep 17 00:00:00 2001 From: Kulikov Vasiliy Date: Fri, 16 Jul 2010 20:15:59 +0400 Subject: ALSA: riptide: check kzalloc() result If kzalloc() fails exit with -ENOMEM. Signed-off-by: Kulikov Vasiliy Signed-off-by: Takashi Iwai --- sound/pci/riptide/riptide.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sound/pci') diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c index 59d79962f236..f64fb7d988cb 100644 --- a/sound/pci/riptide/riptide.c +++ b/sound/pci/riptide/riptide.c @@ -1615,7 +1615,10 @@ static int snd_riptide_playback_open(struct snd_pcm_substream *substream) chip->playback_substream[sub_num] = substream; runtime->hw = snd_riptide_playback; + data = kzalloc(sizeof(struct pcmhw), GFP_KERNEL); + if (data == NULL) + return -ENOMEM; data->paths = lbus_play_paths[sub_num]; data->id = play_ids[sub_num]; data->source = play_sources[sub_num]; @@ -1635,7 +1638,10 @@ static int snd_riptide_capture_open(struct snd_pcm_substream *substream) chip->capture_substream = substream; runtime->hw = snd_riptide_capture; + data = kzalloc(sizeof(struct pcmhw), GFP_KERNEL); + if (data == NULL) + return -ENOMEM; data->paths = lbus_rec_path; data->id = PADC; data->source = ACLNK2PADC; -- cgit v1.2.3 From cd7643bfb772dc7103ed6fc8dda6b233a8e14178 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 20 Jul 2010 12:11:25 +0200 Subject: ALSA: hda-intel - fix function_id rework (add missing bitmask) Signed-off-by: Jaroslav Kysela --- sound/pci/hda/hda_codec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound/pci') diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 6e0de65f1f3a..3252945f3743 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -731,7 +731,7 @@ static void /*__devinit*/ setup_fg_nodes(struct hda_codec *codec) for (i = 0; i < total_nodes; i++, nid++) { function_id = snd_hda_param_read(codec, nid, AC_PAR_FUNCTION_TYPE); - switch (function_id) { + switch (function_id & 0xff) { case AC_GRP_AUDIO_FUNCTION: codec->afg = nid; codec->afg_function_id = function_id & 0xff; -- cgit v1.2.3 From 63818c448ac6f4dd75aa42997acaa746f86acb6b Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Wed, 28 Jul 2010 16:58:42 +0800 Subject: ALSA: hpimsgx: fix wrong sizeof The correct size should be sizeof(gRESP_HPI_SUBSYS_FIND_ADAPTERS), sizeof(&gRESP_HPI_SUBSYS_FIND_ADAPTERS) is incorrect. Signed-off-by: Axel Lin Signed-off-by: Takashi Iwai --- sound/pci/asihpi/hpimsgx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound/pci') diff --git a/sound/pci/asihpi/hpimsgx.c b/sound/pci/asihpi/hpimsgx.c index 2ee90dc3d897..f01ab964f602 100644 --- a/sound/pci/asihpi/hpimsgx.c +++ b/sound/pci/asihpi/hpimsgx.c @@ -741,7 +741,7 @@ static void HPIMSGX__reset(u16 adapter_index) hpi_init_response(&hr, HPI_OBJ_SUBSYSTEM, HPI_SUBSYS_FIND_ADAPTERS, 0); memcpy(&gRESP_HPI_SUBSYS_FIND_ADAPTERS, &hr, - sizeof(&gRESP_HPI_SUBSYS_FIND_ADAPTERS)); + sizeof(gRESP_HPI_SUBSYS_FIND_ADAPTERS)); for (adapter = 0; adapter < HPI_MAX_ADAPTERS; adapter++) { -- cgit v1.2.3 From ec9d04b2a8f00b14a3df4714820cb2cda46dc4d6 Mon Sep 17 00:00:00 2001 From: Kulikov Vasiliy Date: Wed, 28 Jul 2010 20:41:56 +0400 Subject: ALSA: asihpi: check return value of get_user() get_user() may fail, if so return -EFAULT. Signed-off-by: Kulikov Vasiliy Signed-off-by: Takashi Iwai --- sound/pci/asihpi/hpioctl.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/asihpi/hpioctl.c b/sound/pci/asihpi/hpioctl.c index 311499992a22..62895a719fcb 100644 --- a/sound/pci/asihpi/hpioctl.c +++ b/sound/pci/asihpi/hpioctl.c @@ -121,11 +121,17 @@ long asihpi_hpi_ioctl(struct file *file, unsigned int cmd, unsigned long arg) phpi_ioctl_data = (struct hpi_ioctl_linux __user *)arg; /* Read the message and response pointers from user space. */ - get_user(puhm, &phpi_ioctl_data->phm); - get_user(puhr, &phpi_ioctl_data->phr); + if (get_user(puhm, &phpi_ioctl_data->phm) || + get_user(puhr, &phpi_ioctl_data->phr)) { + err = -EFAULT; + goto out; + } /* Now read the message size and data from user space. */ - get_user(hm->h.size, (u16 __user *)puhm); + if (get_user(hm->h.size, (u16 __user *)puhm)) { + err = -EFAULT; + goto out; + } if (hm->h.size > sizeof(*hm)) hm->h.size = sizeof(*hm); @@ -138,7 +144,10 @@ long asihpi_hpi_ioctl(struct file *file, unsigned int cmd, unsigned long arg) goto out; } - get_user(res_max_size, (u16 __user *)puhr); + if (get_user(res_max_size, (u16 __user *)puhr)) { + err = -EFAULT; + goto out; + } /* printk(KERN_INFO "user response size %d\n", res_max_size); */ if (res_max_size < sizeof(struct hpi_response_header)) { HPI_DEBUG_LOG(WARNING, "small res size %d\n", res_max_size); -- cgit v1.2.3 From b9619230e1f55a763bc41848c1cd971a394c878c Mon Sep 17 00:00:00 2001 From: Ondrej Zary Date: Tue, 3 Aug 2010 23:57:05 +0200 Subject: ALSA: als4000: enable burst mode Enable burst mode to prevent dropouts during high PCI bus usage. The card is useless in X without this because of dropouts when anything moves on the screen (at least with PCI VGA card). Enabling this is also recommended by the datasheet (page 48). Signed-off-by: Ondrej Zary Signed-off-by: Takashi Iwai --- sound/pci/als4000.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c index 6cf1de8042e8..036a9ba8e1a5 100644 --- a/sound/pci/als4000.c +++ b/sound/pci/als4000.c @@ -763,9 +763,9 @@ static void snd_als4000_configure(struct snd_sb *chip) /* SPECS_PAGE: 39 */ for (i = ALS4K_GCR91_DMA0_ADDR; i <= ALS4K_GCR96_DMA3_MODE_COUNT; ++i) snd_als4k_gcr_write(chip, i, 0); - + /* enable burst mode to prevent dropouts during high PCI bus usage */ snd_als4k_gcr_write(chip, ALS4K_GCR99_DMA_EMULATION_CTRL, - snd_als4k_gcr_read(chip, ALS4K_GCR99_DMA_EMULATION_CTRL)); + snd_als4k_gcr_read(chip, ALS4K_GCR99_DMA_EMULATION_CTRL) | 0x04); spin_unlock_irq(&chip->reg_lock); } -- cgit v1.2.3 From c4685849b4d725ab80cd29f5e09f5f128b4724b5 Mon Sep 17 00:00:00 2001 From: Ondrej Zary Date: Wed, 4 Aug 2010 21:56:44 +0200 Subject: ALSA: als4000: Fix potentially invalid DMA mode setup My previous patch assumed that the DMA mode (represented by 3 lowest bits of ALS4K_GCR99_DMA_EMULATION_CTRL register) is set to the default value 0. If that's not the case, it might result in invalid mode to be set. This patch fixes this potential problem. Signed-off-by: Ondrej Zary Signed-off-by: Takashi Iwai --- sound/pci/als4000.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound/pci') diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c index 036a9ba8e1a5..0e247cb90ecc 100644 --- a/sound/pci/als4000.c +++ b/sound/pci/als4000.c @@ -765,7 +765,7 @@ static void snd_als4000_configure(struct snd_sb *chip) snd_als4k_gcr_write(chip, i, 0); /* enable burst mode to prevent dropouts during high PCI bus usage */ snd_als4k_gcr_write(chip, ALS4K_GCR99_DMA_EMULATION_CTRL, - snd_als4k_gcr_read(chip, ALS4K_GCR99_DMA_EMULATION_CTRL) | 0x04); + (snd_als4k_gcr_read(chip, ALS4K_GCR99_DMA_EMULATION_CTRL) & ~0x07) | 0x04); spin_unlock_irq(&chip->reg_lock); } -- cgit v1.2.3