summaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/rt5645.c
AgeCommit message (Collapse)AuthorFilesLines
2015-05-19ASoC: rt5645: Rename HP control to HeadphoneNicolas Boichat1-2/+2
Use the standard name "Headphone" instead of "HP" for better userspace integration. Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Acked-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-19ASoC: rt5645: fix kernel hang when call rt5645_set_jack_detect()John Lin1-1/+2
rt5645_set_jack_detect() is usually called from snd_soc_dai_link.init() and it calls snd_soc_jack_report() from rt5645_irq_detection() if jack is inserted. snd_soc_jack_report() results in kernel hang if it is called from a context which cannot sleep. This patch makes sure snd_soc_jack_report() is called from workqueue. It can fix the kernel hang issue. Signed-off-by: John Lin <john.lin@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-12ASoC: rt5645: fix jack type detect errorJohn Lin1-15/+20
rt5645_jack_detect doesn't report the correct jack type consistently. It mistakes OMTP type headset to CTIA type in particular HW design. Register changes are needed for this issue. This patch can make it more stable. Signed-off-by: John Lin <john.lin@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-12ASoC: rt5645: fix IRQ error in jack detectionJohn Lin1-14/+24
IRQ of jack and button detection is abnormal if "LDO2" and "Mic Det Power" power disable in rt5645_jack_detect. This patch make these two power keep enabled until jack out. Signed-off-by: John Lin <john.lin@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-12ASoC: rt5645: remove unnecessary power in JD functionJohn Lin1-11/+0
The power of "micbias1" and "micbias2" are unnecessary for jack detection. So, we remove it in rt5645_set_jack_detect function. Signed-off-by: John Lin <john.lin@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-12ASoC: rt5645: improve headphone depop functionJohn Lin1-78/+174
We add a calibration function and call it at the beginning of i2c_probe. The calibration value will be kept until codec is shutdown. We will reset the codec after the calibration is finished. So, we set cache_bypass in the calibration function. The benefit is we can shorter the delay time in headphone depop. We also change the register setting in the depop sequence which will reduce the pop noise in headphone playback. Signed-off-by: John Lin <john.lin@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-07ASoC: rt5645: Fix mask for setting RT5645_DMIC_2_DP_GPIO12 bitAxel Lin1-1/+1
Current code uses wrong mask when setting RT5645_DMIC_2_DP_GPIO12 bit, fix it. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-07ASoC: rt5645: Add ACPI match IDFang, Yang A1-0/+11
This patch adds the ACPI match ID for rt5645/5650 codec Signed-off-by: Fang, Yang A <yang.a.fang@intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-06ASoC: rt5645: remove unused field in pdataBard Liao1-65/+59
We can know if dmic is used by reading the value of dmic1_data_pin and dmic2_data_pin. Also IRQ must be used if codec JD or button detection function is used. So, dmic_en and en_jd_func can be remove from platform data. Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-06ASoC: rt5645: fix add missing widgetBard Liao1-0/+2
"IF1 DAC0" and "IF1 DAC3" are used in rt5645_dapm_routes but missing in rt5645_dapm_widgets. Signed-off-by: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-01ASoC: rt5645: make volume TLV closer to realityBard Liao1-6/+6
The volume blocks have an step of 0.375dB, but TLV uses 0.01dB for units. Only use the resolution supported, ignoring the LSB of the volume register. This results in half the steps and 0.75dB per step, but reports accurate levels through TLV. Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-01ASoC: rt5645: add TDM slot control into dapm routeBard Liao1-57/+298
This patch adds TDM slot control into dapm route. The control bits are different between rt5645 and rt5650, so we have separate dapm routes for each codec. Signed-off-by: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-01ASoC: rt5645: remove RT5645_I2S_BCLK_MS1 controlBard Liao1-3/+2
RT5645_I2S_BCLK_MS1 (reg 0x73 [5]) is reserverd in rt5645 and rt5650. This function is move to TDM control. We can configure it by snd_soc_dai_set_tdm_slot's slot_width parameter. Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-01ASoC: rt5645: fix wrong mask for button reportBard Liao1-1/+2
rt5645->btn_jack is for jack button report. So the mask should be SND_JACK_BTN_0 | SND_JACK_BTN_1 | SND_JACK_BTN_2 | SND_JACK_BTN_3. Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-04-30ASoC: rt5645: fix implicit declaration errorBard Liao1-0/+2
kbuild robot reports a implicit declaration of function 'rt5645_irq_detection' error. Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-04-29ASoC: rt5645: Adds push button support for rt5650Bard Liao1-36/+230
rt5650 support headset button detection. Currently, the button detection is only implemented for rt5650 codec. The button detection configuration register's default value is different from rt5645. And we didn't touch the register in the driver, so we will get the wrong value when we dump the registers. We will fix it in another patch. Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-04-28ASoC: rt5645: fixed section mismatchSudip Mukherjee1-1/+1
while building as a module we are getting warning about section mismatch. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-04-28ASoC: rt5645: fixed kbuild errFang, Yang A1-0/+1
kbuild robot reports following error/warnings sound/soc/codecs/rt5645.c: In function 'rt5645_i2c_probe': >> sound/soc/codecs/rt5645.c:2720:4: error: implicit declaration of >> function 'devm_gpiod_get_index' >> [-Werror=implicit-function-declaration] gpiod = devm_gpiod_get_index(&i2c->dev, "rt5645", 0); ^ >> sound/soc/codecs/rt5645.c:2720:10: warning: assignment makes pointer >> from integer without a cast gpiod = devm_gpiod_get_index(&i2c->dev, "rt5645", 0); ^ >> sound/soc/codecs/rt5645.c:2722:4: error: implicit declaration of >> function 'gpiod_direction_input' >> [-Werror=implicit-function-declaration] if (IS_ERR(gpiod) || gpiod_direction_input(gpiod)) { ^ >> sound/soc/codecs/rt5645.c:2726:5: error: implicit declaration of >> function 'desc_to_gpio' [-Werror=implicit-function-declaration] rt5645->pdata.hp_det_gpio = desc_to_gpio(gpiod); ^ >> sound/soc/codecs/rt5645.c:2728:7: error: implicit declaration of >> function 'gpiod_is_active_low' >> [-Werror=implicit-function-declaration] = !gpiod_is_active_low(gpiod); ^ cc1: some warnings being treated as errors Signed-off-by: Fang, Yang A <yang.a.fang@intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-04-27ASoC: rt5645: set platform data base on DMIFang, Yang A1-1/+46
set platform specific data for intel strago platform Signed-off-by: Fang, Yang A <yang.a.fang@intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-04-27Merge branch 'fix/rt5645' of ↵Mark Brown1-1/+12
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-rt5645
2015-04-27ASoC: Move bias level update to the coreLars-Peter Clausen1-1/+0
All drivers have the same line at the end of the set_bias_level callback to update the bias_level state. Move this update into snd_soc_dapm_force_bias_level() and remove them from the drivers. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-04-27ASoC: Route all bias level updates through the coreLars-Peter Clausen1-1/+1
Use the new snd_soc_codec_force_bias_level() helper function to invoke the bias_level callback of a driver instead of calling the callback by hand. Currently the effect of this is the same, but having all bias level updates go through a central place will allow us to move more of the bias level management into the DAPM core. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-04-27ASoC: rt5645: Fix mask for setting RT5645_DMIC_2_DP_GPIO12 bitAxel Lin1-1/+1
Current code uses wrong mask when setting RT5645_DMIC_2_DP_GPIO12 bit, fix it. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-04-24ASoC: rt5645: Add ACPI match IDFang, Yang A1-0/+11
This patch adds the ACPI match ID for rt5645/5650 codec Signed-off-by: Fang, Yang A <yang.a.fang@intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-03-27ASoC: rt5645: Restore HP depop setting in HP offBard Liao1-0/+2
This driver will set RT5645_DEPOP_MAN bit in headphone power up depop process. We need to restore it in headphone power down process. Otherwise, we will get headphone noise when push button function is enabled. Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-03-27ASoC: rt5645: Use update_bits for bit controlBard Liao1-1/+2
In codec bias level off, we need to disable gate mode with MCLK for power saving. It is set by one bit. We don't need to write while register for that. Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-03-27ASoC: rt5645: Set use_single_rw flag for regmapBard Liao1-1/+1
RT5645 doesn't support auto incrementing writes so driver should set the use_single_rw flag for regmap. Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-03-27ASoC: rt5645: Redefine format config for rt5650Bard Liao1-10/+29
rt5650 and rt5645 use different register bits for format configuration. This patch modifies rt5645_hw_params and rt5645_set_dai_fmt to support both codecs. Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-03-13ASoC: rt5645: Remove adc stereo2 filterBard Liao1-3/+0
Remove adc stereo2 filter since it is not in rt5645/rt5650 codec. Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-03-12ASoC: rt5645: Add TDM support for rt5650Bard Liao1-11/+30
rt5650 and rt5645 use different register bits for TDM configuration. This patch modifies rt5645_set_tdm_slot to support both codecs. Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-02-09Merge remote-tracking branches 'asoc/topic/fsl-spdif', 'asoc/topic/imx', ↵Mark Brown1-17/+222
'asoc/topic/intel', 'asoc/topic/jz4740' and 'asoc/topic/max98357a' into asoc-next
2015-02-05ASoC: rt5645: add API to select ASRC clock sourceFang, Yang A1-0/+81
This patch defines an API to select the clock source for specified filters. Signed-off-by: Fang, Yang A <yang.a.fang@intel.com> Acked-by: Kevin Strasser <kevin.strasser@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-01-27ASoC: rt5645: Add rt5650 codec supportBard Liao1-17/+141
This patch adds support for rt5650 codec. Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-01-15ASoC: rt5645: Replace w->codec snd_soc_dapm_to_codec(w->dapm)Lars-Peter Clausen1-7/+9
The codec field of the snd_soc_widget struct is eventually going to be removed, use snd_soc_dapm_to_codec(w->dapm) instead. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-12-16Merge remote-tracking branches 'asoc/fix/atmel', 'asoc/fix/intel', ↵Mark Brown1-19/+185
'asoc/fix/rt5645', 'asoc/fix/rt5677' and 'asoc/fix/samsung' into asoc-linus
2014-12-09ASoC: rt5645: Fix potential crash in jd functionBard Liao1-0/+4
If no one defined the rt5645->pdata.hp_det_gpio in coreboot/bios. It will cause kernel to reboot because rt5645->pdata.hp_det_gpio is 0. So it is worth to add a check in rt5645_jack_detect. Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Fang, Yang A <yang.a.fang@intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-12-08Merge remote-tracking branches 'asoc/topic/rt5645', 'asoc/topic/rt5670', ↵Mark Brown1-19/+181
'asoc/topic/rt5677', 'asoc/topic/samsung' and 'asoc/topic/sgtl5000' into asoc-next
2014-11-25ASoC: rt5645: multiple JD mode supportBard Liao1-1/+34
There are 3 JD modes in RT5645. This patch configure register values according to platform data. Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-14ASoC: rt5645: two jacks for hp and micBard Liao1-9/+8
Some OS need headphone and microphone to be separated. Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-13ASoC: rt5645: add register setting for TDMBard Liao1-1/+4
We need to set extra register to avoid a recording issue in TDM mode. Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-11ASoC: rt5645: remove unused rt5645_clk_sel_putBard Liao1-59/+0
Remove rt5645_clk_sel_put function since it is never used. Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-07ASoC: rt5645: Add ASRC supportBard Liao1-0/+144
This patch add ASRC support for rt5645 codec. Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-06ASoC: rt5645: Add JD function supportBard Liao1-0/+20
rt5645 codec support jack detection function. The patch will set related registers if JD function is used. Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-04ASoC: rt5645: make bias level more reasonaleBard Liao1-8/+17
This patah separate bias level off to standby and off. The standby level will provide the necessary power for JD and push button functions. Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-29ASoC: rt5645: Mark RT5645_TDM_CTRL_3 as readableFang, Yang A1-0/+2
amixer query fails due to it is not readable reigster Signed-off-by: Fang, Yang A <yang.a.fang@intel.com> Acked-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-20ASoC: rt5645: Add the workqueue of the jack detect function for the debouncingOder Chiou1-1/+14
Add the workqueue of the jack detect function for the debouncing. Signed-off-by: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-01ASoC: rt5645: Add headset detect functionOder Chiou1-0/+99
Add headset detect function Signed-off-by: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-06-21ASoC: rt5645: Remove unneeded goto in rt5645_i2c_probeAxel Lin1-8/+2
Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-01ASoC: rt5640: Add the function "get_clk_info" to RL6231 shared supportOder Chiou1-16/+1
The patch adds the function "get_clk_info" to RL6231 shared support. Signed-off-by: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-01ASoC: rt5640: Add the function of the PLL clock calculation to RL6231 shared ↵Oder Chiou1-70/+2
support The patch adds the function of the PLL clock calculation to RL6231 shared support. Signed-off-by: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Mark Brown <broonie@linaro.org>