aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/rt5640.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2018-05-11ASoC: rt5640: Add button press supportHans de Goede1-6/+151
Enable button press detection for headsets by using the ovcd IRQ to get notified of button presses. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-05-11ASoC: rt5640: Add jack-detect supportHans de Goede1-0/+286
Add jack-detect support, loosely based on earlier work on this by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Francisco mendez <francisco.mendez@intel.com> Note getting the OVCD to work reliable was sort of finicky, so there are quite a few comments on this to hopefully avoid people breaking it in the future. This (and the follow-up button press support) has been tested on the following devices: Acer Iconia Tab 8 W1-810 Asus T100CHI Asus T100TA Asus T200TA Axxo WT1011 Chuwi Vi8 Dell Venue 8 Pro 5830 HP Pavilion X2 10-n000nd HP Stream 7 I.T. Works TW891 Lamina I8270 MSI S100 Peaq C1010 Pipo W4 PoV MobiiTAB-P800W (v2.0) Toshiba Click Mini L9W-B BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=196377 Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-05-11ASoC: rt5640: Allow specifying dmic data pins through device-propertiesHans de Goede1-0/+19
Allow specifying dmic data pins through device-properties / dt. This will allow us to stop exporting rt5640_dmic_enable() once all callers of it have been converted to setting device-properties for this instead. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-05-11ASoC: rt5640: Move checking of device-properties to component probe callbackHans de Goede1-12/+19
On some platforms the platform code may need to add device-properties, rather then relying only on properties set by the firmware. This commit moves the parsing of the device-properties from the i2c-driver probe() function, which may be called at any time, to the component-driver probe() function, which gets called after the platform code calls snd_soc_register_card(). This allows the platform code to attach extra device-properties before the device-properties are parsed. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-05-11ASoC: rt5640: Remove unused rt5640_platform_dataHans de Goede1-37/+16
There are no in tree users of platform-data for the rt5640 codec driver, so lets remove support for it. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-05-11ASoC: rt5640: Remove is_sys_clk_from_pll, it has ordering issuesHans de Goede1-25/+4
is_sys_clk_from_pll() is used as a snd_soc_dapm_route.connected callback, checking RT5640_GBL_CLK to determine if the sys-clk is PLL1 and thus the PWR_PLL bit in reg PWR_ANLG2 must be set. RT5640_GBL_CLK is changed by rt5640_set_dai_sysclk(), which gets called by the pre_pmu / post_pmd functions of the "Platform Clock" dapm-supply. This creates an ordering issue, during a dapm transition first all connected() callbacks are called to build a list of supplies to enable and then the complete list is walked to enable the supplies. Since the connected() check happens before enabling any supplies, is_sys_clk_from_pll() ends up deciding if the PWR_PLL bit should be set based on the state the "Platform Clock" supply had *before* the transition. This sometimes results in PWR_PLL being off, even though *after* the transition PLL1 is configured as sys-clk. This commit removes is_sys_clk_from_pll() instead simply setting / clearing PWR_PLL in rt5640_set_dai_sysclk() based on the selected sys-clk, which fixes this and as a bonus results in a nice cleanup. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-02-12ASoC: rt5640: replace codec to componentKuninori Morimoto1-134/+126
Now we can replace Codec to Component. Let's do it. Note: xxx_codec_xxx() -> xxx_component_xxx() .idle_bias_off = 1 -> .idle_bias_on = 0 .ignore_pmdown_time = 0 -> .use_pmdown_time = 1 - -> .endianness = 1 - -> .non_legacy_dai_naming = 1 Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-10ASoC: codecs: add const to snd_soc_codec_driver structuresBhumika Goyal1-1/+1
Declare snd_soc_codec_driver structures as const as they are only passed as an argument to the function snd_soc_register_codec. This argument is of type const, so declare the structures with this property as const. In file codecs/sn95031.c, snd_soc_codec_driver structure is also used in a copy operation along with getting passed to snd_soc_register_codec. So, it can be made const too. Done using Coccinelle: @match disable optional_qualifier@ identifier s; position p; @@ static struct snd_soc_codec_driver s@p={...}; @good1@ identifier match.s; position p; @@ snd_soc_register_codec(...,&s@p,...) @bad@ identifier match.s; position p!={match.p,good1.p}; @@ s@p @depends on !bad disable optional_qualifier@ identifier match.s; @@ static +const struct snd_soc_codec_driver s={...}; Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-02-19Merge remote-tracking branches 'asoc/topic/rt5514', 'asoc/topic/rt5640', 'asoc/topic/rt5645', 'asoc/topic/rt5659' and 'asoc/topic/rt5660' into asoc-nextMark Brown1-6/+6
2017-01-31ASoC: rt5640: Add "10EC3276" ACPI IDAlexandrov Stansilav1-0/+1
Add ACPI ID "10EC3276" for sound card found on notebook HP Pavilion X2 10-p000. ACPI DSDT Table on this device describes this card as ALC3276, but it is in fact rt5640. Signed-off-by: Alexandrov Stansilav <neko@nya.ai> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-01-12ASoC: rt5640: use msleep() for long delaysNicholas Mc Guire1-2/+2
ulseep_range() uses hrtimers and provides no advantage over msleep() for larger delays. Fix up the 70/80ms delays here passing the "min" value to msleep(). This reduces the load on the hrtimer subsystem. Link: http://lkml.org/lkml/2017/1/11/377 Fixes: commit 246693ba7b0b ("ASoC: rt5640: change widget sequence for depop") Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-01-04ASoC: rt5640: move DAC2 Power to rt5640_dapm_widgetsBard Liao1-4/+4
"DAC L2 Power" and "DAC R2 Power" are used by both rt5639 and rt5640. But it was defined in rt5640_specific_dapm_widgets[]. Move them to rt5640_dapm_widgets will let both rt5639 and rt5640 can use it. Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-10-28ASoC: rt5640: add Mono ADC Capture Switch controlBard Liao1-0/+2
Mono ADC Capture Switch control is missing in the driver. So, add it. Signed-off-by: Bard Liao <bardliao@realtek.com> Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-10-24ASoC: rt5640: enable MCLK detectionBard Liao1-0/+3
There is a power saving mechanism in rt5640. It will turn off some unused power when MCLK is not present. We call that "MCLK detection" and it should be enabled by default. Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-29Merge remote-tracking branches 'asoc/topic/ac97', 'asoc/topic/ak4104', 'asoc/topic/arizona', 'asoc/topic/atmel' and 'asoc/topic/codec-component' into asoc-nextMark Brown1-6/+8
2016-08-15ASoC: rt5640: add internal clock source supportPierre-Louis Bossart1-0/+3
Adding missing definitions and flags to select internal clock source as system clock, needed for jack detection. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-08-08ASoC: codec duplicated callback function goes to component on rt5640Kuninori Morimoto1-6/+8
codec driver and component driver has duplicated callback functions, and codec side functions are just copied to component side when register timing. This was quick-hack, but no longer needed. This patch moves these functions from codec driver to component driver. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-03-18ASoC: rt5640: Correct the digital interface data selectSugar Zhang1-1/+1
this patch corrects the interface adc/dac control register definition according to datasheet. Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
2016-03-08ASoC: rt5640: remove unused variableSudip Mukherjee1-1/+1
We are getting build warning about: sound/soc/codecs/rt5640.c:1892:11: warning: unused variable 'dai_sel' The use of the variable was removed but the variable itself was not removed. Fixes: c467fc0e010b ("ASoC: rt5640: Set PLL src according to source") Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-03-07ASoC: rt5640: add supplys for dac powerBard Liao1-15/+24
The DAC1/2 power is for both DACs and related mixer/mux. Add SUPPLY type widgets to support it. Signed-off-by: Jack Yu <jack.yu@realtek.com> Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-03-07ASoC: rt5640: Set PLL src according to sourceBard Liao1-14/+5
rt5640_set_dai_pll set pll source according to given source and dai id. However, the pll source should be set according to given source only. Signed-off-by: Jack Yu <jack.yu@realtek.com> Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-02-22ASoC: rt5640: add master clock handling for rt5640Sugar Zhang1-0/+31
enable/disable master clock when codec is active or not. Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-01-05ASoC: Intel: Atom: Add support for HP ElitePad 1000 G2Jorge Fernandez Monteagudo1-0/+1
The BIOS for the HP ElitePad 1000 G2 uses an unexpected HID, (INTCCFFD), add it to the white list of knowns HIDs. Signed-off-by: Jorge Fernandez Monteagudo <jorgefm@cirsa.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-01-05ASoC: rt5640: add ASRC supportJack Yu1-0/+102
Signed-off-by: Jack Yu <jack.yu@realtek.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-22ASoC: rt5640: Fill up the IN3's supportOder Chiou1-1/+21
Signed-off-by: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-08-30Merge remote-tracking branches 'asoc/topic/tas2552', 'asoc/topic/tas5086', 'asoc/topic/tegra', 'asoc/topic/tlv' and 'asoc/topic/topology' into asoc-nextMark Brown1-4/+3
2015-08-30Merge remote-tracking branches 'asoc/topic/rt298', 'asoc/topic/rt5640', 'asoc/topic/rt5651' and 'asoc/topic/rt5670' into asoc-nextMark Brown1-1/+1
2015-08-30Merge remote-tracking branches 'asoc/topic/rcar', 'asoc/topic/reg-default', 'asoc/topic/rl6231', 'asoc/topic/rockchip' and 'asoc/topic/rt286' into asoc-nextMark Brown1-4/+5
2015-08-30Merge remote-tracking branch 'asoc/topic/ssm4567' into asoc-nextMark Brown1-1/+0
2015-08-11ASoC: rt5640: fix line out no sound issueJohn Lin1-3/+37
The power for line out was not turned on when line out is enabled. So we add "LOUT amp" widget to turn on the power for line out. Signed-off-by: John Lin <john.lin@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
2015-08-05ASoC: rt5640: Replace TLV_DB_RANGE_HEAD with DECLARE_TLV_DB_RANGELars-Peter Clausen1-4/+3
DECLARE_TLV_DB_RANGE() has the advantage over using TLV_DB_RANGE_HEAD() that it automatically calculates the number of items in the TLV and is hence less prone to manual error. Generate using the following coccinelle script // <smpl> @@ declarer name DECLARE_TLV_DB_RANGE; identifier tlv; constant x; @@ -unsigned int tlv[] = { - TLV_DB_RANGE_HEAD(x), +DECLARE_TLV_DB_RANGE(tlv, ... -}; +); // </smpl> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-08-05ASoC: Add function "rl6231_get_pre_div" to correct the dmic clock calculationOder Chiou1-3/+4
Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-16regmap: Use reg_sequence for multi_reg_write / register_patchNariman Poushin1-1/+1
Separate the functionality using sequences of register writes from the functions that take register defaults. This change renames the arguments in order to support the extension of reg_sequence to take an optional delay to be applied after any given register in a sequence is written. This avoids adding an int to all register defaults, which could substantially increase memory usage for regmaps with large default tables. This also updates all the clients of multi_reg_write/register_patch. Signed-off-by: Nariman Poushin <nariman@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-15ASoC: drivers: Drop owner assignment from i2c_driverKrzysztof Kozlowski1-1/+0
i2c_driver does not need to set an owner because i2c_register_driver() will set it. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-06ASoC: rt5640: Prefix hexadecimal ID register value with 0x in error printJarkko Nikula1-1/+1
Make it obvious that unexpected value read from ID register is printed in hexadecimal. Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-06-22Merge remote-tracking branches 'asoc/topic/qcom', 'asoc/topic/rcar', 'asoc/topic/rt286' and 'asoc/topic/rt5640' into asoc-nextMark Brown1-3/+2
2015-06-15ASoC: rt5640: Constify ACPI device ids and register defaultsMathias Krause1-3/+2
Constify the ACPI device ID array and the register map, no need to have them writable at runtime. Also drop the unneeded RT5640_INIT_REG_LEN define. Signed-off-by: Mathias Krause <minipli@googlemail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-20ASoC: rt5640: Replace direct snd_soc_codec dapm field accessLars-Peter Clausen1-5/+6
The dapm field of the snd_soc_codec struct is eventually going to be removed, in preparation for this replace all manual access to codec->dapm.bias_level with snd_soc_codec_get_bias_level() and replace all other manual access to codec->dapm with snd_soc_codec_get_dapm(). Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@kernel.org>
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-2/+2
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-02-04Merge remote-tracking branch 'asoc/topic/w-codec' into asoc-nextMark Brown1-5/+6
2015-01-26ASoC: rt5640: Add RT5642 ACPI ID for Intel BaytrailJarkko Nikula1-0/+1
Asus T100TAF uses ACPI ID "10EC5642" for its audio codec. I suppose it is updated ACPI ID for the RT5642 codec since some earlier platforms are using "10EC5640" with the RT5642 too. Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-01-15ASoC: rt5640: Replace w->codec snd_soc_dapm_to_codec(w->dapm)Lars-Peter Clausen1-5/+6
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-10-06Merge remote-tracking branches 'asoc/topic/fsl-easi', 'asoc/topic/fsl-sai', 'asoc/topic/fsl-ssi' and 'asoc/topic/intel' into asoc-nextMark Brown1-19/+30
2014-10-01ASoC: rt5640: Add function for enabling DMIC from ACPI probed machineJarkko Nikula1-19/+30
There is no code enabling DMIC clock in systems that don't provide platform data for rt5640 after commit 71d97a794301 ("ASoC: rt5640: Use the platform data for DMIC settings"). I think it's worth to keep this static DMIC clock and alternative data pin setting during probe time. For making possible to use DMIC from ACPI probed machine (prior ACPI 5.1 with _DSD) this patch moves DMIC configuration to new exported rt5640_dmic_enable() that machine drivers can call. Please note, this patch moves DMIC configuration from i2c probe to codec probe in case platform data for rt5640 is set. Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Cc: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-08-27ASoC: rt5640: Do not allow regmap to use bulk read-write operationsJarkko Nikula1-0/+1
Debugging showed Realtek RT5642 doesn't support autoincrementing writes so driver should set the use_single_rw flag for regmap. Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Mark Brown <broonie@linaro.org> Cc: stable@vger.kernel.org
2014-06-21ASoC: rt5640: Remove unneeded goto in rt5640_i2c_probeAxel Lin1-8/+2
Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-03Merge remote-tracking branches 'asoc/topic/rl6231' and 'asoc/topic/rt5677' into asoc-nextMark Brown1-94/+14
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 supportOder Chiou1-60/+8
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>