summaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_ca0132.c
Commit message (Collapse)AuthorAgeFilesLines
* ALSA: hda/ca0132 - Update latency based on DSP state.Dylan Reid2013-04-051-2/+53
| | | | | | | | | | | The DSP in the CA0132 codec adds a variable latency to audio depending on what processing is being done. Add a new patch op to return that latency for capture and playback streams. The latency is determined by which blocks are enabled and knowing how much latency is added by each block. Signed-off-by: Dylan Reid <dgreid@chromium.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda/ca0132 - Delay HP amp turnon.Chih-Chung Chang2013-04-021-4/+23
| | | | | | | | | | | Turing on the headphone amp interferes with the impedance measurement used to detect a TRRS style headset microphone. Delay the HP turn on until 500ms after the jack is detected, allowing the mic detection state machine to run to completion. Signed-off-by: Chih-Chung Chang <chihchung@chromium.org> Signed-off-by: Dylan Reid <dgreid@chromium.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda/ca0132 - Remove extra setting of dsp_state.Dylan Reid2013-03-151-9/+6
| | | | | | | | spec->dsp_state is initialized to DSP_DOWNLOAD_INIT, no need to reset and check it in ca0132_download_dsp(). Signed-off-by: Dylan Reid <dgreid@chromium.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda/ca0132 - Check download state of DSP.Dylan Reid2013-03-151-2/+3
| | | | | | | | | | | Instead of using the dspload_is_loaded() function, check the dsp_state that is kept in the spec. The dspload_is_loaded() function returns true if the DSP transfer was never started. This false-positive leads to multiple second delays when ca0132_setup_efaults() times out on each write. Signed-off-by: Dylan Reid <dgreid@chromium.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda/ca0132 - Check if dspload_image succeeded.Dylan Reid2013-03-151-2/+6
| | | | | | | | | | If dspload_image() fails, it was ignored and dspload_wait_loaded() was still called. dsp_loaded should never be set to true in this case, skip it. The check in dspload_wait_loaded() return true if the DSP is loaded or if it never started. Signed-off-by: Dylan Reid <dgreid@chromium.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda/ca0132 - Avoid division by zero in dspxfr_one_seg()Xi Wang2013-03-071-2/+6
| | | | | | | | | | Move the zero check `hda_frame_size_words == 0' before the modulus `buffer_size_words % hda_frame_size_words'. Also remove the redundant null check `buffer_addx == NULL'. Signed-off-by: Xi Wang <xi.wang@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda/ca0132 - Add missing \n to debug printsTakashi Iwai2013-02-121-75/+75
| | | | Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda/ca0132 - Fix type of INVALID_CHIP_ADDRESSTakashi Iwai2013-02-121-2/+2
| | | | | | | | | | The chip address is 32bit long but INVALID_CHIP_ADDRESS is defined as an unsigned long. This makes dsp_chip_to_dsp_addx() misbehaving on 64bit architectures. Fix the INVALID_CHIP_ADDRESS definition to be 32bit. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda/ca0132 - Slight optimization for build with DSPTakashi Iwai2013-02-111-0/+4
| | | | | | This reduces the resultant binary size. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Fix memory leak and error handling in CA0132 DSP loaderTakashi Iwai2013-02-101-3/+7
| | | | | | | | | | This patch fixes a few obvious bugs in DSP loader stuff: - Fix possible memory leaks in the error path - Avoid double-free calls in dma_reset() - Properly set/unset WC bits for DMA buffers - Add missing error status checks Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: CA0132: Improve the DSP transfer timeout calculationsIan Minett2013-02-101-16/+25
| | | | | | | Base the DSP firmware transfer and communication timeouts on jiffy values. Signed-off-by: Ian Minett <ian_minett@creativelabs.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Fix misc compile warnings in patch_ca0132.cTakashi Iwai2013-02-071-8/+6
| | | | | | | | sound/pci/hda/patch_ca0132.c: In function ‘ca0132_is_vnode_effective’: sound/pci/hda/patch_ca0132.c:3331:15: warning: ‘nid’ may be used uninitialized in this function [-Wmaybe-uninitialized] sound/pci/hda/patch_ca0132.c:4345:13: warning: ‘ca0132_download_dsp’ defined but not used [-Wunused-function] Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Add new Kconfig CONFIG_SND_HDA_CODEC_CA0132_DSPTakashi Iwai2013-02-041-2/+2
| | | | | | | | | ... to be less confusing for the update path. This new kconfig will choose CONFIG_SND_HDA_DSP_LOADER, which is basically a device-independent feature in hda_intel.c. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda/ca0132 - Make some symbols staticTakashi Iwai2013-01-161-2/+2
| | | | | | | sound/pci/hda/patch_ca0132.c:387:19: sparse: symbol 'ca0132_voicefx' was not declared. Should it be static? Reported-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda/ca0132 - Fix a wrong comma in snd_printdd() callTakashi Iwai2013-01-151-1/+1
| | | | | | | | sound/pci/hda/patch_ca0132.c: In function ‘ca0132_effects_set’: sound/pci/hda/patch_ca0132.c:3391:2: warning: too many arguments for format [-Wformat-extra-args] Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda/ca0132 - Declare firmware only when really builtTakashi Iwai2013-01-151-0/+2
| | | | Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda/ca0132 - Fix possible invalid DMA channel deallocationTakashi Iwai2013-01-151-3/+3
| | | | | | ... in the error path in dspxfr_image(). Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda/ca0132 - Fix possible NULL dereferenceTakashi Iwai2013-01-151-6/+4
| | | | | | | | | | | Spotted by smatch, sound/pci/hda/patch_ca0132.c:1950 dspxfr_image() error: potential null dereference 'dma_engine'. (kzalloc returns null) sound/pci/hda/patch_ca0132.c:1950 dspxfr_image() error: we previously assumed 'dma_engine' could be null (see line 1857) Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda/ca0132 - Fix another smatch warningTakashi Iwai2013-01-151-1/+1
| | | | | | | | sound/pci/hda/patch_ca0132.c:1781 dspxfr_one_seg() info: why not propagate 'status' from dsp_dma_stop() instead of (-5)? Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda/ca0132 - Fix superfluous unsigned checkTakashi Iwai2013-01-151-1/+1
| | | | | | | | | Fix a warning by smatch, sound/pci/hda/patch_ca0132.c:714 dspio_send() warn: always true condition '(res >= 0) => (0-u32max >= 0)' Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda/ca0132 - Use snd_hda_set_pin_ctl() helper againTakashi Iwai2013-01-151-16/+10
| | | | | | | | The recent update of ca0132 driver replaced the pinctl setup to the direct write via snd_hda_codec_write() again. This should be covered by snd_hda_set_pin_ctl() to be safer. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* Revert "ALSA: hda - Add firmware caching to CA0132 codec"Takashi Iwai2013-01-151-22/+6
| | | | | | | | | This reverts commit c3b4eea26208b8e247ece9d3a9ec8b2eab48c464. Since the recent firmware loader code supports caching at S3/S4 by itself, we don't have to handle f/w caching in the driver. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda/ca0132: Fix potential init errors and update module descriptionIan Minett2013-01-151-6/+8
| | | | | | | | | | Handle a potential dma_engine alloc error and fix the possible use of an uninitialized status variable in dspxfr_one_seg(). Also correct the initial sampling rate for Mic 1. Update the module description. Signed-off-by: Ian Minett <ian_minett@creativelabs.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda/ca0132: Shuffle to group together related codeIan Minett2013-01-151-76/+76
| | | | | Signed-off-by: Ian Minett <ian_minett@creativelabs.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda/ca0132: Code shuffle to group similar functions.Ian Minett2013-01-151-187/+188
| | | | | Signed-off-by: Ian Minett <ian_minett@creativelabs.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda/ca0132: Add tuning controlsIan Minett2013-01-151-0/+289
| | | | | | | This patch adds the controls used for tuning the DSP effects. Signed-off-by: Ian Minett <ian_minett@creativelabs.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda/ca0132: Add unsol handler for DSP and jack detectionIan Minett2013-01-151-0/+142
| | | | | | | | This patch adds the unsolicited response handler for incoming DSP responses and jack detection reporting, and routines for reading the incoming DSP response. Signed-off-by: Ian Minett <ian_minett@creativelabs.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda/ca0132: Add PCM enhancementsIan Minett2013-01-151-13/+118
| | | | | | | | | | | | | Remove the playback PCM open callback. PCM stream setup and cleanup functions are added for use by PCM callbacks. Delay stream cleanup if effects are on, to allow time for any effects tail to finish. Add the analog capture PCM callbacks. Change the max channels of analog playback to 6. Add two new PCMs: AMic2 and What-U-Hear. Signed-off-by: Ian Minett <ian_minett@creativelabs.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda/ca0132: Add DSP mixer controls and helpersIan Minett2013-01-151-288/+544
| | | | | | | | | | | | | | | | | This patch adds the kcontrols for the DSP effects, playback and recording source selection. ca0132_is_vnode_effective() checks whether virtual node settings have taken effect. The control change helpers ca0132_pe_switch_set(), ca0132_voicefx_set() and ca0132_cvoice_switch_set() are added to toggle playback / capture DSP effects, ca0132_voicefx_info(), _get() and _put() are added for input path DSP effect value access. The volume helpers are updated to volume_info(), _get() and _set() to use the virtual nodes. The redundant headphone and speaker switches and ct_extension function are removed. Signed-off-by: Ian Minett <ian_minett@creativelabs.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda/ca0132: Init chip, DSP effects and mixer settingsIan Minett2013-01-151-32/+700
| | | | | | | | | | | | | | | | | | | | | This patch adds the framework to set effect parameters: ca0132_effects_set() and ca0132_setup_defaults() are general functions for parameter setting and initializing to default values. dspio_set_param() and dspio_set_uint_param() are lower-level fns to simplify setting individual DSP parameters via an SCP buffer transfer to the firmware. The CA0132 chip parameter init code is added in ca0132_init_params(). In chipio_[write,read]_data(), the current chip address is auto-incremented if no error has occurred. ca0132_select_out() selects the current output. If autodetect is enabled, use headphones (if jack detected) or speakers (if no jack). ca0132_select_mic() selects the current mic in. If autodetect is enabled, use exterior mic (if jack detected) or built-in mic (if no jack). Init digital mic and switch between dmic and amic with ca0132_init_dmic(), ca0132_set_dmic(). amic2 is initialized in ca0132_init_analog_mic2(). Finally, add verb tables for configuring DSP firmware. Signed-off-by: Ian Minett <ian_minett@creativelabs.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda/ca0132: Add new definitions and structs for DSPIan Minett2013-01-151-3/+442
| | | | | | | | | This patch adds definitions and structs used for configuring DSP effects, virtual nodes, effect tuning controls, and mixer control helpers. The effect structs are also initialized. Signed-off-by: Ian Minett <ian_minett@creativelabs.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Remove superfluous zero-clear memset in patch_ca0132.cTakashi Iwai2012-11-281-1/+0
| | | | Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Fix NULL dereference in error path of patch_ca0132.cTakashi Iwai2012-11-281-4/+2
| | | | Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Remove unnecessary struct hda_stream_format from CA0132Ian Minett2012-11-281-24/+20
| | | | | Signed-off-by: Ian Minett <ian_minett@creativelabs.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Update chipio functions and DSP write wait timeoutIan Minett2012-11-281-36/+16
| | | | | | | | Tidy up and condense chipio_write_address|addx() functions. Improve dspio_write_wait() to use jiffies for timeout calc. Signed-off-by: Ian Minett <ian_minett@creativelabs.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Add comments and descriptions to CA0132 functionsIan Minett2012-11-281-17/+163
| | | | | | | | | Add comments and descriptions to functions. Bump dsp_free_ports() to below dsp_allocate_ports_format() to group the alloc functions together for commenting. Signed-off-by: Ian Minett <ian_minett@creativelabs.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Add firmware caching to CA0132 codecIan Minett2012-11-281-6/+22
| | | | | Signed-off-by: Ian Minett <ian_minett@creativelabs.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Update CA0132 codec to load DSP firmware binaryIan Minett2012-11-281-4/+1605
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds the code needed to fetch the DSP binary image from the local firmware install location and transfer it over to the chip using the new DSP loader bus ops. Actual DSP effect controls, parameters and mixers are to be included later. - Add calls to new DSP loader system to transfer firmware to the hardware. - Add chip read/write routines, DSP I/O, SCP packet format helper functions and transfer DMA management. - Add guard around DSP download to ensure loader config switch is enabled. The general scheme for downloading the DSP is as follows: 1) If DSP firmware loader is enabled, ca0132_download_dsp() is called to start the process. 2) Driver requests DSP image using request_firmware(). 3) Driver sets up the streaming DMA for DSP image download with dspload_image() and dspxfr_image(), which in turn calls the DSP loader op snd_hda_codec_load_dsp_prepare() to ready the system. 4) DSP image will consist of 1 or more segments, each transferred in sequence by a call to dspxfr_one_seg() and snd_hda_codec_load_dsp_trigger(). 5) Once complete, the loader state is cleaned up with snd_hda_codec_load_dsp_cleanup(). Signed-off-by: Ian Minett <ian_minett@creativelabs.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Add DSP firmware enums and defs to CA0132 codecIan Minett2012-11-281-8/+43
| | | | | Signed-off-by: Ian Minett <ian_minett@creativelabs.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Add CA0132 register definitions fileIan Minett2012-11-281-0/+2
| | | | | Signed-off-by: Ian Minett <ian_minett@creativelabs.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - don't create dysfunctional mixer controls for ca0132David Henningsson2012-08-201-0/+8
| | | | | | | | | | | It's possible that these amps are settable somehow, e g through secret codec verbs, but for now, don't create the controls (as they won't be working anyway, and cause errors in amixer). Cc: stable@kernel.org BugLink: https://bugs.launchpad.net/bugs/1038651 Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Add missing SPDIF I/O setup for CA0132Takashi Iwai2012-08-081-6/+14
| | | | | | | | | | CA0132 driver had some codes to handle the S/PDIF I/O, but the actual setups of pins and converters were missing. Now the pins are added. Also, fixed a few points triggering invalid codec verbs and mixer elements since the digital I/O audio widgets on CA0132 have no amp. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Use the standard PCM ops for CA0132Takashi Iwai2012-08-081-113/+29
| | | | | | | Now with the workaround using codec->pcm_format_first flag, we can clean up the home-baked codes in patch_ca0132.c. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Fix superfluous "-in" suffix from CA0132 capture itemsTakashi Iwai2012-08-081-2/+2
| | | | Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Move BIOS pin-parser code to hda_auto_parser.cTakashi Iwai2012-05-081-0/+1
| | | | | | Just code shuffles. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Add snd_hda_get_default_vref() helper functionTakashi Iwai2012-04-201-1/+2
| | | | | | | | Add a new helper function to guess the default VREF pin control bits for mic in. This can be used to set the pin control value safely matching with the actual pin capabilities. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Introduce snd_hda_set_pin_ctl*() helper functionsTakashi Iwai2012-04-201-5/+2
| | | | | | | | | | | | | | | For setting the pin-control values more safely to match with the actual pin capability bits, a copule of new helper functions, snd_hda_set_pin_ctl() and snd_hda_set_pin_ctl_cache(), are introduced. These are simple replacement of the codec verb write with AC_VERB_SET_PIN_WIDGET but do more sanity checks and filter out superfluous pin-control bits if they don't fit with the corresponding pin capabilities. Some codecs are screwed up or ignore the command when such a wrong bit is set. These helpers will avoid such secret errors. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: hda - Fix error handling in patch_ca0132.cTakashi Iwai2012-02-071-14/+19
| | | | | | | | | In patch_ca0132.c, the error returned from chipio_write() isn't checked always. Also, the power-up/down sequence isn't tracked properly in some error paths. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* sound: Add module.h to the previously silent sound usersPaul Gortmaker2011-10-311-0/+1
| | | | | | | | Lots of sound drivers were getting module.h via the implicit presence of it in <linux/device.h> but we are going to clean that up. So fix up those users now. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
* ALSA: hda - Fix a compile error in patch_ca0132.c for the recent SPDIF changeTakashi Iwai2011-06-211-1/+2
| | | | Signed-off-by: Takashi Iwai <tiwai@suse.de>
OpenPOWER on IntegriCloud