Commit graph

21439 commits

Author SHA1 Message Date
Takashi Iwai 5e56bcea50 ALSA: hda - Allow driver to add vendor-specific verbs for regmap
Codecs may have own vendor-specific verbs, and we need to allow each
driver to give such verbs for cached accesses.  Here a verb can be put
into a single array and looked through it at readable and writeable
callbacks.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-23 13:19:41 +01:00
Takashi Iwai faa75f8a2e ALSA: hda - Use regmap for parameter caches, too
The amp hash table was used for recording the cached reads of some
capability values like pin caps or amp caps.  Now all these are moved
to regmap as well.

One addition to the regmap helper is codec->caps_overwriting flag.
This is set in snd_hdac_override_parm(), and the regmap helper accepts
any register while this flag is set, so that it can overwrite even the
read-only verb like AC_VERB_PARAMETERS.  The flag is cleared
immediately in snd_hdac_override_parm(), as it's a once-off flag.

Along with these changes, the no longer needed amp hash and relevant
fields are removed from hda_codec struct now.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-23 13:19:40 +01:00
Takashi Iwai eeecd9d10d ALSA: hda - Use regmap for amp accesses
This patch converts the amp access functions to the regmap helpers.
The amp values were formerly cached in the own hash table.  Now it's
dropped by the regmap's cache.

The only tricky conversion is snd_hda_codec_amp_init().  This function
shouldn't do anything if the amp was already initialized.  For
achieving this behavior, a value is read once at first temporarily in
the cache-only mode.  Only if it returns an error,  i.e. the item
still doesn't exist in the cache, it proceeds to the update.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-23 13:19:39 +01:00
Takashi Iwai 9ba17b4d13 ALSA: hda - Implement uncached version of parameter reads
Sometimes we need the uncached reads, e.g. for refreshing the tree.
This patch provides the helper function for that and uses it for
refreshing widgets, reading subtrees and the whole proc reads.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-23 13:19:38 +01:00
Takashi Iwai 01ed3c06c6 ALSA: hda - Use regmap for codec parameter reads
Let's start converting the access functions to regmap.
The first one is the simplest, just converting the codec parameter
read helper function snd_hda_param_read().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-23 13:19:37 +01:00
Takashi Iwai 4d75faa044 ALSA: hda - Add regmap support
This patch adds an infrastructure to support regmap-based verb
accesses.  Because o the asymmetric nature of HD-audio verbs,
especially the amp verbs, we need to translate the verbs as a sort of
pseudo registers to be mapped uniquely in regmap.

In this patch, a pseudo register is built from the NID, the
AC_VERB_GET_* and 8bit parameters, i.e. almost in the form to be sent
to HD-audio bus but without codec address field.  OTOH, for writing,
the same pseudo register is translated to AC_VERB_SET_* automatically.
The AC_VERB_SET_AMP_* verb is re-encoded from the corresponding
AC_VERB_GET_AMP_* verb and parameter at writing.

Some verbs has a single command for read but multiple for writes.  A
write for such a verb is split automatically to multiple verbs.

The patch provides also a few handy helper functions.  They are
designed to be accessible even without regmap.  When no regmap is set
up (e.g. before the codec device instantiation), the direct hardware
access is used.  Also, it tries to avoid the unnecessary power-up.
The power up/down sequence is performed only on demand.

The codec driver needs to call snd_hdac_regmap_exit() and
snd_hdac_regmap_exit() at probe and remove if it wants the regmap
access.

There is one flag added to hdac_device.  When the flag lazy_cache is
set, regmap helper ignores a write for a suspended device and returns
as if it was actually written.  It reduces the hardware access pretty
much, e.g. when adjusting the mixer volume while in idle.  This
assumes that the driver will sync the cache later at resume properly,
so use it carefully.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-23 13:19:36 +01:00
Takashi Iwai 71fc4c7ef5 ALSA: hda - Move generic array helpers to core lib
This will be used by the regmap support.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-23 13:19:35 +01:00
Takashi Iwai e311782acd ALSA: hda - Re-add tracepoints to HD-audio core driver
Now let's take the basic tracepoints back to the HD-audio driver.
The three bus tracepoints, hda_send_cmd, hda_get_response and
hda_unsol_event are revived but in a slightly different form.
Since we don't assign the card number there, print the bus device name
instead.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-23 13:17:58 +01:00
Takashi Iwai c4c2533f80 ALSA: hda - Fix possible runtime PM refcount unbalance
When the driver is unloaded before the codec is bound, it still keeps
the runtime PM refcount up, and results in the unbalance.  This patch
covers these cases by introducing a flag indicating the runtime PM
initialization and handling the codec registration procedure more
properly.  It also fixes the missing input beep device as a gratis,
too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-23 13:17:48 +01:00
Takashi Iwai 0585244869 ALSA: hda - Support indirect execution of verbs
Add an overriding exec_verb op to struct hdac_device so that the call
via snd_hdac_exec_verb() can switch to a different route depending on
the setup.  The codec driver sets this field so that it can handle the
errors or applying quirks appropriately.  Furthermore, this mechanism
will be used for smooth transition for the regmap support in later
patches.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-23 13:17:37 +01:00
Takashi Iwai 3256be6537 ALSA: hda - Add widget sysfs tree
This patch changes the sysfs files assigned to the codec device on the
bus which were formerly identical with hwdep sysfs files.  Now it
shows only a few core parameter, vendor_id, subsystem_id, revision_id,
afg, mfg, vendor_name and chip_name.

In addition, now a widget tree is added to the bus device sysfs
directory for showing the widget topology and attributes.  It's just a
flat tree consisting of subdirectories named as the widget NID
including various attributes like widget capability bits.  The AFG
(usually NID 0x01) is always found there, and it contains always
amp_in_caps, amp_out_caps and power_caps files.  Each of these
attributes show a single value.  The rest are the widget nodes
belonging to that AFG.  Note that the child node might not start from
0x02 but from another value like 0x0a.

Each child node may contain caps, pin_caps, amp_in_caps, amp_out_caps,
power_caps and connections files.  The caps (representing the widget
capability bits) always contain a value.  The rest may contain
value(s) if the attribute exists on the node.  Only connections file
show multiple values while other attributes have zero or one single
value.

An example of ls -R output is like below:
% ls -R /sys/bus/hdaudio/devices/hdaudioC0D0/
/sys/bus/hdaudio/devices/hdaudioC0D0/widgets/:
01/  04/  07/  0a/  0d/  10/  13/  16/  19/  1c/  1f/  22/
02/  05/  08/  0b/  0e/  11/  14/  17/  1a/  1d/  20/  23/
03/  06/  09/  0c/  0f/  12/  15/  18/  1b/  1e/  21/

/sys/bus/hdaudio/devices/hdaudioC0D0/widgets/01:
amp_in_caps  amp_out_caps  power_caps

/sys/bus/hdaudio/devices/hdaudioC0D0/widgets/02:
amp_in_caps  amp_out_caps  caps  connections  pin_caps  pin_cfg
power_caps

/sys/bus/hdaudio/devices/hdaudioC0D0/widgets/03:
.....

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-23 13:17:27 +01:00
Takashi Iwai 7639a06c23 ALSA: hda - Move a part of hda_codec stuff into hdac_device
Now some codes and functionalities of hda_codec struct are moved to
hdac_device struct.  A few basic attributes like the codec address,
vendor ID number, FG numbers, etc are moved to hdac_device, and they
are accessed like codec->core.addr.  The basic verb exec functions are
moved, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-23 13:17:17 +01:00
Takashi Iwai d068ebc25e ALSA: hda - Move some codes up to hdac_bus struct
A few basic codes for communicating over HD-audio bus are moved to
struct hdac_bus now.  It has only command and get_response ops in
addition to the unsolicited event handling.

Note that the codec-side tracing support is disabled temporarily
during this transition due to the code shuffling.  It will be
re-enabled later once when all pieces are settled down.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-23 13:17:02 +01:00
Takashi Iwai e3d280fc6d ALSA: hda - Make snd_hda_bus_type public
Define the common hd-audio driver and device types to bind over
snd_hda_bus_type publicly.  This allows to implement other type of
device and driver code over hd-audio bus.

Now both struct hda_codec and struct hda_codec_driver inherit these
new struct hdac_device and struct hdac_driver, respectively.

The bus registration is done in subsys_initcall() to assure it
before any other driver registrations.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-23 13:15:51 +01:00
Takashi Iwai 3372dbdd8c Merge branch 'for-next' into topic/hda-core 2015-03-23 13:14:02 +01:00
Takashi Iwai 967b1307b6 ALSA: hda - Rename power_mgmt flag with power_save_node
David suggested that the name "power_mgmt" is too ambiguous.  Rename
the flag with a bit clearer one "power_save_node".

Also, add the corresponding description to HD-Audio.txt, too.

Reported-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-20 18:31:18 +01:00
Takashi Iwai 6b275b1400 ALSA: hda - Fix power of pins used for mute LED with vrefs
Some pins are used for controlling the LED with the VREF value.
This patch changes the power behavior of such pins to be constantly
up.  A new state, pin_fixed, is introduced to nid_path to indicate
that the path contains the fixed pin.  This improves also the
readability a bit for other static routes, too.

Then a helper function snd_hda_gen_fix_pin_power() is called from the
codec driver for such fixed pins, and it will create fake paths
containing only these pins with pin_fixed=1 flag.

Reported-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-20 18:30:48 +01:00
Takashi Iwai fc0daafeb4 Merge branch 'topic/hda-power' into for-next 2015-03-20 09:08:01 +01:00
Fabian Frederick b24062bda7 ALSA: aoa: constify of_device_id array
of_device_id is always used as const.
(See driver.of_match_table and open firmware functions)

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-19 12:11:13 +01:00
Takashi Iwai 5ccf835cc7 ALSA: hda - Adjust power of beep widget and outputs
As the widget PM may turn off the pins, this might lead to the silent
output for beep when no explicit paths are given.  This patch adds
fake output paths for the beep widget so that the output pins are
dynamically powered upon beep on/off.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-18 09:23:10 +01:00
Takashi Iwai 688b12cc3c ALSA: hda - Use the new power control for VIA codecs
VIA codecs used to have the own power controls but they were disabled
at transition to the generic parser due to the coding assuming the
fixed routes.  Now we get the proper support of equivalently fine
power management in the generic parser, and the old kludges can be
replaced with it.  This results in the reduction of lots of dead
codes.

The advanced PM feature is disabled as default like before for keeping
the compatible behavior.  It's enabled via "Dynamic Power-Control"
mixer element.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-18 09:22:35 +01:00
Takashi Iwai e6feb5d085 ALSA: hda - Support advanced power state controls
This patch enables the finer power state control of each widget
depending on the jack plug state and streaming state in addition to
the existing power_down_unused power optimization.  The new feature is
enabled only when codec->power_mgmt flag is set.

Two new flags, pin_enabled and stream_enabled, are introduced in
nid_path struct for marking the two individual power states: the pin
plug/unplug and DAC/ADC stream, respectively.  They can be set
statically in case they are static routes (e.g. some mixer paths),
too.

The power up and down events for each pin are triggered via the
standard hda_jack table.  The call order is hard-coded, relying on the
current implementation of jack event chain (a la FILO/stack order).

One point to be dealt carefully is that DAC/ADC cannot be powered
on/off while streaming.  They are pinned as long as the stream is
running.  For controlling the power of DAC/ADC, a new patch_ops is
added.  The generic parser provides the default callback for that.

As of this patch, only IDT/Sigmatel codec driver enables the flag.
The support on other codecs will follow.

An assumption we made in this code is that the widget state (e.g. amp,
pinctl, connections) remains after the widget power transition (not
about FG power transition).  This is true for IDT codecs, at least.
But if the widget state is lost at widget power transition, we'd need
to implement additional code to sync the cached amp/verbs for the
specific NID.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-18 09:22:28 +01:00
Clément Guedez 1aa9a4ea4f ALSA: ice1724: ESI W192M: Add sampling rate control of the ADC/DAC
Add sampling rate control for ADC/DAC for ESI W192M.
Allow to switch between 48K/96K/192K sampling rate.
All DAC need to be mute when changing samplerate.

Signed-off-by: Clément Guedez <klem.dev@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-18 08:07:00 +01:00
Clément Guedez ae8a9a1125 ALSA: ice1724: ESI W192M: Add text Line in/Mic for selecting input gain state
Add text Line in/Mic for selecting input gain state in mixer for ESI W192M.

Signed-off-by: Clément Guedez <klem.dev@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-18 08:06:25 +01:00
Clément Guedez 16ddbe738a ALSA: ice1724: ESI W192M: Add TLV support for control value in dB scale
Add TLV support to control volume using dB scale for input and ouput on ESI W192M.

Signed-off-by: Clément Guedez <klem.dev@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-18 08:05:48 +01:00
Clément Guedez f8a8b3a835 ALSA: ice1724: ESI W192M: Enable midi i/o of port envy24 chip as available
Enable midi i/o port of envy24 chip as their are available on ESI W192M soundcard.

Signed-off-by: Clément Guedez <klem.dev@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-18 08:05:30 +01:00
Clément Guedez 7127744a5e ALSA: ice1724: ESI W192M: Update eeprom structure to C99 standard
Update eeprom structure to C99 standard to be compliant with change in alsa.
It's just a notation change, no configuration change.

Signed-off-by: Clément Guedez <klem.dev@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-18 08:05:07 +01:00
Clément Guedez b56df151d3 ALSA: ice1724: ESI W192M: Correct copy/paste from prodigy driver
Correct copy/paste name from prodigy driver, no behaviour change, only name.

Signed-off-by: Clément Guedez <klem.dev@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-18 08:04:52 +01:00
Takashi Iwai fb83b63510 ALSA: hda - Simplify PCM setup overrides
This patch does two things:
- code refactoring with a local helper function,
- allow codec drivers to provide the specific PCM stream info pointers
  only for overriding the non-NULL entries, instead of copying the
  whole.

This simplifies the codec driver side (currently the only user is
alc269's 44kHz fixed rate).

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-17 20:57:20 +01:00
Takashi Iwai 3fc6c5a1cf ASoC: Fixes for v4.0
As well as the usual collection of driver specific fixes there's a few
 more generic things:
 
  - Lots of fixes from Takashi for drivers using the wrong field in the
    control union to communicate with userspace, leading to potential
    errors on 64 bit systems.
  - A fix from Lars for locking of the lists of devices we maintain,
    mostly only likely to trigger during device probe and removal.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJVCA+HAAoJECTWi3JdVIfQ6oQIAIOFlrPzKpI3C7MqrK6F+ySC
 g/JOf8XZKbStl+RdSu/RI6gL1Nc4VD7EHv5vEM2Br6KtUHQMoQYpsSiPvn1BFJBX
 EkwY3eoDiIyPqQG7cGmdIF/8NXiZgJYh13coamrkdAhBFMXfmqlbrBHo71Z6o1ic
 cg4rng3AmjyJ1NfUDsMW/KTX0F8AUTw7yYs+B4pyjfRBFVmhmzubXGXNjiW+/Tz4
 zjk9c3Qm7ZxC66dbvg5lpIakwbRtX26p7Fn+pWOewL4y81y9qruSvV6IgDZ1RO95
 DRtLsU7qyIK3G9zCw61xJNiL2QAfgOfYYgi7R6XrlS3nttIFT30oELw5ObwjSM0=
 =iSeG
 -----END PGP SIGNATURE-----

Merge tag 'asoc-fix-v4.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus

ASoC: Fixes for v4.0

As well as the usual collection of driver specific fixes there's a few
more generic things:

 - Lots of fixes from Takashi for drivers using the wrong field in the
   control union to communicate with userspace, leading to potential
   errors on 64 bit systems.
 - A fix from Lars for locking of the lists of devices we maintain,
   mostly only likely to trigger during device probe and removal.
2015-03-17 16:30:26 +01:00
Takashi Iwai 2a557a861a Merge branch 'topic/hda-unbind' into for-next 2015-03-16 14:48:20 +01:00
Takashi Iwai 8f88f0256f Merge branch 'topic/hda-bus' into for-next 2015-03-16 14:48:16 +01:00
Takashi Iwai 34e72afe73 Merge branch 'for-linus' into for-next 2015-03-16 14:48:05 +01:00
Takashi Iwai cc261738ad ALSA: hda - Treat stereo-to-mono mix properly
The commit [ef403edb75: ALSA: hda - Don't access stereo amps for
mono channel widgets] fixed the handling of mono widgets in general,
but it still misses an exceptional case: namely, a mono mixer widget
taking a single stereo input.  In this case, it has stereo volumes
although it's a mono widget, and thus we have to take care of both
left and right input channels, as stated in HD-audio spec ("7.1.3
Widget Interconnection Rules").

This patch covers this missing piece by adding proper checks of stereo
amps in both the generic parser and the proc output codes.

Reported-by: Raymond Yau <superquad.vortex2@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-16 14:44:03 +01:00
Mark Brown 33484c6739 Merge remote-tracking branches 'asoc/fix/sgtl5000' and 'asoc/fix/sn95031' into asoc-linus 2015-03-16 12:03:17 +00:00
Mark Brown af6b7a82fd Merge remote-tracking branches 'asoc/fix/ak4671', 'asoc/fix/control', 'asoc/fix/da732x', 'asoc/fix/fsl-ssi', 'asoc/fix/lock' and 'asoc/fix/rt286' into asoc-linus 2015-03-16 12:03:15 +00:00
Mark Brown 016e81f202 Merge remote-tracking branch 'asoc/fix/intel' into asoc-linus 2015-03-16 12:03:14 +00:00
Linus Torvalds 1ee89c519a The clk fixes for 4.0-rc4 comprise three themes. First are the usual
driver fixes for new regressions since v3.19. Second are fixes to the
 common clock divider type caused by recent changes to how we round clock
 rates. This affects many clock drivers that use this common code.
 Finally there are fixes for drivers that improperly compared struct clk
 pointers (drivers must not deref these pointers). While some of these
 drivers have done this for a long time, this did not cause a problem
 until we started generating unique struct clk pointers for every
 consumer. A new function, clk_is_match was introduced to get these
 drivers working again and they are fixed up to no longer deref the
 pointers themselves.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJVBewEAAoJEKI6nJvDJaTUR2gP/2frIXCm/krwkDyofIGxxQ+F
 RwIXFTn9GG9QEUwKLUcxRUegHbWbZMXYp6W19hUcUdYz3pD+uEJSuH0NI8kW1Ohy
 32P5/ALuoTq7OVzBBz/9di9jBDdIM1wusLZGJfOWk9DXBLOS3VHuhN55D47dqWS/
 GsszeEpp8r1WBKFVmAkuQ5Jc0CqgS5GxvMOndXXVN3kDMhCT+9pBiqtUT0V3YV/J
 d5GCvfPlO/Xmjnpjf99MPButkfiW/o6YXt3H0QY6hhskS1Av8alyfabVctk8lqOW
 py8SQFY7MdRLZ84Zk87sqKCKUc/vHkTBT9vKWYm65l3yJ5OEFv60NaFMYY61HVlJ
 n6qWU6SbFZvkPnQTJn6Ii/v7BQ92bXjYpLNcBK8UY35jIjmHsPS/YXCbkmArtn1N
 /yAB4TIfH8uX93smFb3XEmZLSiKFuZAhU8YbjDzYgsGuQ9EwN3aNP9c5mzC7Soou
 tYnDqVic0i993qQTD2Db5dplGwxelCRJpazO2kK6NW/EJzE8XJaM6XVy1xIBKiDX
 bbWPdp53/eWV7gbUEZ8zzcS06G/DLw5/N45XyaWIx+2ThDjhOAlVHTAFDY+Oa743
 42Dkwtr5GZ6yORyXY1wI5HttUGU0gnPN0kM84GQG8O/GbzGureZSW1e6G7tJJljn
 JXhROl0w4aIPwUUxry7R
 =nc5C
 -----END PGP SIGNATURE-----

Merge tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux

Pull clock framework fixes from Michael Turquette:
 "The clk fixes for 4.0-rc4 comprise three themes.

  First are the usual driver fixes for new regressions since v3.19.

  Second are fixes to the common clock divider type caused by recent
  changes to how we round clock rates.  This affects many clock drivers
  that use this common code.

  Finally there are fixes for drivers that improperly compared struct
  clk pointers (drivers must not deref these pointers).  While some of
  these drivers have done this for a long time, this did not cause a
  problem until we started generating unique struct clk pointers for
  every consumer.  A new function, clk_is_match was introduced to get
  these drivers working again and they are fixed up to no longer deref
  the pointers themselves"

* tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux:
  ASoC: kirkwood: fix struct clk pointer comparing
  ASoC: fsl_spdif: fix struct clk pointer comparing
  ARM: imx: fix struct clk pointer comparing
  clk: introduce clk_is_match
  clk: don't export static symbol
  clk: divider: fix calculation of initial best divider when rounding to closest
  clk: divider: fix selection of divider when rounding to closest
  clk: divider: fix calculation of maximal parent rate for a given divider
  clk: divider: return real rate instead of divider value
  clk: qcom: fix platform_no_drv_owner.cocci warnings
  clk: qcom: fix platform_no_drv_owner.cocci warnings
  clk: qcom: Add PLL4 vote clock
  clk: qcom: lcc-msm8960: Fix PLL rate detection
  clk: qcom: Fix slimbus n and m val offsets
  clk: ti: Fix FAPLL parent enable bit handling
2015-03-15 15:07:08 -07:00
Takashi Iwai b2a0bafa75 ALSA: hda - Use shutdown driver ops instead of reboot notifier
The driver shutdown ops is simpler than registering reboot notifier
manually.  There should be no functional change by this -- the codec
driver calls its own callback while the bus driver just calls
azx_stop() like before.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-13 15:28:58 +01:00
Takashi Iwai ef403edb75 ALSA: hda - Don't access stereo amps for mono channel widgets
The current HDA generic parser initializes / modifies the amp values
always in stereo, but this seems causing the problem on ALC3229 codec
that has a few mono channel widgets: namely, these mono widgets react
to actions for both channels equally.

In the driver code, we do care the mono channel and create a control
only for the left channel (as defined in HD-audio spec) for such a
node.  When the control is updated, only the left channel value is
changed.  However, in the resume, the right channel value is also
restored from the initial value we took as stereo, and this overwrites
the left channel value.  This ends up being the silent output as the
right channel has been never touched and remains muted.

This patch covers the places where unconditional stereo amp accesses
are done and converts to the conditional accesses.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=94581
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-13 07:37:21 +01:00
Takashi Iwai e79d74ab25 ALSA: control: Fix breakage of user ctl element addition
In the commit [2225e79b9b: 'ALSA: core: reduce stack usage related
to snd_ctl_new()'], the id field of the newly added kctl is untouched,
thus all attribute like name string remain empty.  The fix is just to
add the forgotten memcpy of the id field.

Fixes: 2225e79b9b ('ALSA: core: reduce stack usage related to snd_ctl_new()')
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-13 07:21:51 +01:00
Takashi Iwai 2ddee91abe ALSA: hda - Add workaround for MacBook Air 5,2 built-in mic
MacBook Air 5,2 has the same problem as MacBook Pro 8,1 where the
built-in mic records only the right channel.  Apply the same
workaround as MBP8,1 to spread the mono channel via a Cirrus codec
vendor-specific COEF setup.

Reported-and-tested-by: Vasil Zlatanov <vasil.zlatanov@gmail.com>
Cc: <stable@vger.kernel.org> # 3.9+
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-12 20:50:32 +01:00
Takashi Iwai bad994f5b4 ALSA: hda - Set single_adc_amp flag for CS420x codecs
CS420x codecs seem to deal only the single amps of ADC nodes even
though the nodes receive multiple inputs.  This leads to the
inconsistent amp value after S3/S4 resume, for example.

The fix is just to set codec->single_adc_amp flag.  Then the driver
handles these ADC amps as if single connections.

Reported-and-tested-by: Vasil Zlatanov <vasil.zlatanov@gmail.com>
Cc: <stable@vger.kernel.org> # 3.9+
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-12 20:28:04 +01:00
Daniel Mack fcdcd1dec6 ALSA: snd-usb: add quirks for Roland UA-22
The device complies to the UAC1 standard but hides that fact with
proprietary descriptors. The autodetect quirk for Roland devices
catches the audio interface but misses the MIDI part, so a specific
quirk is needed.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Reported-by: Rafa Lafuente <rafalafuente@gmail.com>
Tested-by: Raphaël Doursenaud <raphael@doursenaud.fr>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-12 10:19:49 +01:00
Takashi Iwai e6826ef145 Merge branch 'for-linus' into for-next 2015-03-12 07:38:46 +01:00
Takashi Iwai be3bb8236d ALSA: control: Add sanity checks for user ctl id name string
There was no check about the id string of user control elements, so we
accepted even a control element with an empty string, which is
obviously bogus.  This patch adds more sanity checks of id strings.

Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-12 07:36:38 +01:00
Shawn Guo aaa6d06282 ASoC: kirkwood: fix struct clk pointer comparing
Since commit 035a61c314 ("clk: Make clk API return per-user struct clk
instances"), clk API users can no longer check if two struct clk
pointers are pointing to the same hardware clock, i.e. struct clk_hw, by
simply comparing two pointers.  That's because with the per-user clk
change, a brand new struct clk is created whenever clients try to look
up the clock by calling clk_get() or sister functions like clk_get_sys()
and of_clk_get().  This changes the original behavior where the struct
clk is only created for once when clock driver registers the clock to
CCF in the first place.  The net change here is before commit
035a61c314 the struct clk pointer is unique for given hardware
clock, while after the commit the pointers returned by clk lookup calls
become different for the same hardware clock.

That said, the struct clk pointer comparing in the code doesn't work any
more.  Call helper function clk_is_match() instead to fix the problem.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Michael Turquette <mturquette@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2015-03-11 16:00:41 -07:00
Shawn Guo 81efec8514 ASoC: fsl_spdif: fix struct clk pointer comparing
Since commit 035a61c314 ("clk: Make clk API return per-user struct clk
instances"), clk API users can no longer check if two struct clk
pointers are pointing to the same hardware clock, i.e. struct clk_hw, by
simply comparing two pointers.  That's because with the per-user clk
change, a brand new struct clk is created whenever clients try to look
up the clock by calling clk_get() or sister functions like clk_get_sys()
and of_clk_get().  This changes the original behavior where the struct
clk is only created for once when clock driver registers the clock to
CCF in the first place.  The net change here is before commit
035a61c314 the struct clk pointer is unique for given hardware
clock, while after the commit the pointers returned by clk lookup calls
become different for the same hardware clock.

That said, the struct clk pointer comparing in the code doesn't work any
more.  Call helper function clk_is_match() instead to fix the problem.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Michael Turquette <mturquette@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2015-03-11 16:00:22 -07:00
Takashi Iwai ddb6ca75b5 ALSA: hda - Fix built-in mic on Compaq Presario CQ60
Compaq Presario CQ60 laptop with CX20561 gives a wrong pin for the
built-in mic NID 0x17 instead of NID 0x1d, and it results in the
non-working mic.  This patch just remaps the pin correctly via fixup.

Bugzilla: https://bugzilla.opensuse.org/show_bug.cgi?id=920604
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-11 16:05:19 +01:00
Takashi Iwai 4945f1fdc1 ALSA: seq: Fix init order of snd_seq_device stuff
When the sequencer driver is built in kernel, it may panic at boot
because of the uninitialized snd_seq_bus_type.  Initialize it properly
via subsys_initcall() instead of module_init() to assure that the bus
is registered beforehand.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Fixes: 7c37ae5c62 ('ALSA: seq: Rewrite sequencer device binding with standard bus')
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-11 12:53:52 +01:00