aboutsummaryrefslogtreecommitdiff
path: root/sound/pci/hda/patch_ca0132.c
AgeCommit message (Collapse)Author
2014-09-16ALSA: hda - Use standard hda_jack infrastructure for CA0132 driverTakashi Iwai
For its headphone, mic and DSP responses, we can use the standard hda_jack infrastructure in CA0132 driver, too. The only point to handle carefully is the delayed headphone jack handling. It tries to react after a certain delay. Here we use the existing block_report flag in hda_jack_tbl (that was implemented for HDMI). Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-09-11ALSA: hda - Get rid of action field from struct hda_jack_tblTakashi Iwai
The action value assigned to each hda_jack_tbl entry is mostly superfluous. The actually used values are either the widget NID or a value specific to the callback. The former case can be simply replaced by a reference to widget NID itself. The only place doing the latter is STAC/IDT codec driver for the powermap handling. But, the code doesn't need to check the action field at all -- the function jack_update_power() is called either with a specific pin or with NULL. So the check of jack->action can be removed completely there, too. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-08-10ALSA: hda/ca0132 - Don't try loading firmware at resume when already failedTakashi Iwai
CA0132 driver tries to reload the firmware at resume. Usually this works since the firmware loader core caches the firmware contents by itself. However, if the driver failed to load the firmwares (e.g. missing files), reloading the firmware at resume goes through the actual file loading code path, and triggers a kernel WARNING like: WARNING: CPU: 10 PID:11371 at drivers/base/firmware_class.c:1105 _request_firmware+0x9ab/0x9d0() For avoiding this situation, this patch makes CA0132 skipping the f/w loading at resume when it failed at probe time. Reported-and-tested-by: Janek Kozicki <cosurgi@gmail.com> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-06-25ALSA: hda - Kill the rest of snd_print*() usagesTakashi Iwai
Pass the codec object so that we can replace all the rest of snd_print*() usages with the proper device-specific print helpers. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-02-25ALSA: hda - Replace with standard printkTakashi Iwai
Use dev_err() and co for messages from HD-audio controller and codec drivers. The codec drivers are mostly bound with codec objects, so some helper macros, codec_err(), codec_info(), etc, are provided. They merely wrap the corresponding dev_xxx(). There are a few places still calling snd_printk() and its variants as they are called without the codec or device context. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-02-25Merge branch 'for-linus' into HEADTakashi Iwai
2014-02-19ALSA: hda/ca0132 - Fix recording from mode id 0x8Hsin-Yu Chao
Incorrect ADC is picked in ca0132_capture_pcm_prepare(), where it assumes multiple streams while there is one stream per ADC. Note that ca0132_capture_pcm_cleanup() already does the right thing. The Chromebook Pixel has a microphone under the keyboard that is attached to node id 0x8. Before this fix, recording would always go to the main internal mic (node id 0x7). Signed-off-by: Hsin-Yu Chao <hychao@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-02-19ALSA: hda/ca0132 - setup/cleanup streamsHsin-Yu Chao
When a HDMI stream is opened with the same stream tag as a following opened stream to ca0132, audio will be heard from two ports simultaneously. Fix this issue by change to use snd_hda_codec_setup_stream and snd_hda_codec_cleanup_stream instead, so that an inactive stream can be marked as 'dirty' when found with a conflict stream tag, and then get purified. Signed-off-by: Hsin-Yu Chao <hychao@chromium.org> Reviewed-by: Chih-Chung Chang <chihchung@chromium.org> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-02-15ALSA: hda - Remove superfluous inclusion of linux/pci.hTakashi Iwai
Some codec drivers still have it since using PCI_VENDOR_ID_*. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-09-13ALSA: hda/ca0132: Staticize codec_send_commandSachin Kamat
'codec_send_command' is used only in this file. Make it static. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-06-28ALSA: Replace the magic number 44 with constTakashi Iwai
The char arrays with size 44 are for the name string of snd_ctl_elem_id. Define the constant and replace the raw numbers with it for clarifying better. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-04-05ALSA: hda/ca0132 - Update latency based on DSP state.Dylan Reid
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>
2013-04-02ALSA: hda/ca0132 - Delay HP amp turnon.Chih-Chung Chang
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>
2013-03-15ALSA: hda/ca0132 - Remove extra setting of dsp_state.Dylan Reid
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>
2013-03-15ALSA: hda/ca0132 - Check download state of DSP.Dylan Reid
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>
2013-03-15ALSA: hda/ca0132 - Check if dspload_image succeeded.Dylan Reid
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>
2013-03-07ALSA: hda/ca0132 - Avoid division by zero in dspxfr_one_seg()Xi Wang
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>
2013-02-12ALSA: hda/ca0132 - Add missing \n to debug printsTakashi Iwai
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-02-12ALSA: hda/ca0132 - Fix type of INVALID_CHIP_ADDRESSTakashi Iwai
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>
2013-02-11ALSA: hda/ca0132 - Slight optimization for build with DSPTakashi Iwai
This reduces the resultant binary size. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-02-10ALSA: hda - Fix memory leak and error handling in CA0132 DSP loaderTakashi Iwai
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>
2013-02-10ALSA: CA0132: Improve the DSP transfer timeout calculationsIan Minett
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>
2013-02-07ALSA: hda - Fix misc compile warnings in patch_ca0132.cTakashi Iwai
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>
2013-02-04ALSA: hda - Add new Kconfig CONFIG_SND_HDA_CODEC_CA0132_DSPTakashi Iwai
... 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>
2013-01-16ALSA: hda/ca0132 - Make some symbols staticTakashi Iwai
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>
2013-01-15ALSA: hda/ca0132 - Fix a wrong comma in snd_printdd() callTakashi Iwai
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>
2013-01-15ALSA: hda/ca0132 - Declare firmware only when really builtTakashi Iwai
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-15ALSA: hda/ca0132 - Fix possible invalid DMA channel deallocationTakashi Iwai
... in the error path in dspxfr_image(). Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-15ALSA: hda/ca0132 - Fix possible NULL dereferenceTakashi Iwai
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>
2013-01-15ALSA: hda/ca0132 - Fix another smatch warningTakashi Iwai
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>
2013-01-15ALSA: hda/ca0132 - Fix superfluous unsigned checkTakashi Iwai
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>
2013-01-15ALSA: hda/ca0132 - Use snd_hda_set_pin_ctl() helper againTakashi Iwai
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>
2013-01-15Revert "ALSA: hda - Add firmware caching to CA0132 codec"Takashi Iwai
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>
2013-01-15ALSA: hda/ca0132: Fix potential init errors and update module descriptionIan Minett
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>
2013-01-15ALSA: hda/ca0132: Shuffle to group together related codeIan Minett
Signed-off-by: Ian Minett <ian_minett@creativelabs.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-15ALSA: hda/ca0132: Code shuffle to group similar functions.Ian Minett
Signed-off-by: Ian Minett <ian_minett@creativelabs.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-01-15ALSA: hda/ca0132: Add tuning controlsIan Minett
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>
2013-01-15ALSA: hda/ca0132: Add unsol handler for DSP and jack detectionIan Minett
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>
2013-01-15ALSA: hda/ca0132: Add PCM enhancementsIan Minett
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>
2013-01-15ALSA: hda/ca0132: Add DSP mixer controls and helpersIan Minett
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>
2013-01-15ALSA: hda/ca0132: Init chip, DSP effects and mixer settingsIan Minett
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>
2013-01-15ALSA: hda/ca0132: Add new definitions and structs for DSPIan Minett
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>
2012-11-28ALSA: hda - Remove superfluous zero-clear memset in patch_ca0132.cTakashi Iwai
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-28ALSA: hda - Fix NULL dereference in error path of patch_ca0132.cTakashi Iwai
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-28ALSA: hda - Remove unnecessary struct hda_stream_format from CA0132Ian Minett
Signed-off-by: Ian Minett <ian_minett@creativelabs.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-28ALSA: hda - Update chipio functions and DSP write wait timeoutIan Minett
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>
2012-11-28ALSA: hda - Add comments and descriptions to CA0132 functionsIan Minett
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>
2012-11-28ALSA: hda - Add firmware caching to CA0132 codecIan Minett
Signed-off-by: Ian Minett <ian_minett@creativelabs.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-11-28ALSA: hda - Update CA0132 codec to load DSP firmware binaryIan Minett
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>
2012-11-28ALSA: hda - Add DSP firmware enums and defs to CA0132 codecIan Minett
Signed-off-by: Ian Minett <ian_minett@creativelabs.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>