History log of /linux-master/sound/soc/codecs/rt5670.c
Revision Date Author Comments
# 11cce87f 10-Jun-2023 Mark Brown <broonie@kernel.org>

ASoC: rt5670: Use maple tree register cache

The rt5670 can only support single register read and write operations
so does not benefit from block writes. This means it gets no benefit from
using the rbtree register cache over the maple tree register cache so
convert it to use maple trees instead, it is more modern.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230609-asoc-rt-maple-v1-15-729c6553cdcf@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 9abcd240 25-Apr-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

ASoC: Switch i2c drivers back to use .probe()

After commit b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new()
call-back type"), all drivers being converted to .probe_new() and then
03c835f498b5 ("i2c: Switch .probe() to not take an id parameter") convert
back to (the new) .probe() to be able to eventually drop .probe_new() from
struct i2c_driver.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de
Link: https://lore.kernel.org/r/20230425095716.331419-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org


# 6c900dcc 13-Dec-2022 Hans de Goede <hdegoede@redhat.com>

ASoC: rt5670: Remove unbalanced pm_runtime_put()

For some reason rt5670_i2c_probe() does a pm_runtime_put() at the end
of a successful probe. But it has never done a pm_runtime_get() leading
to the following error being logged into dmesg:

rt5670 i2c-10EC5640:00: Runtime PM usage count underflow!

Fix this by removing the unnecessary pm_runtime_put().

Fixes: 64e89e5f5548 ("ASoC: rt5670: Add runtime PM support")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20221213123319.11285-1-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# ed5c2f5f 15-Aug-2022 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

i2c: Make remove callback return void

The value returned by an i2c driver's remove function is mostly ignored.
(Only an error message is printed if the value is non-zero that the
error is ignored.)

So change the prototype of the remove function to return no value. This
way driver authors are not tempted to assume that passing an error to
the upper layer is a good idea. All drivers are adapted accordingly.
There is no intended change of behaviour, all callbacks were prepared to
return 0 before.

Reviewed-by: Peter Senna Tschudin <peter.senna@gmail.com>
Reviewed-by: Jeremy Kerr <jk@codeconstruct.com.au>
Reviewed-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Crt Mori <cmo@melexis.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Marek Behún <kabel@kernel.org> # for leds-turris-omnia
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Petr Machata <petrm@nvidia.com> # for mlxsw
Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com> # for surface3_power
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> # for bmc150-accel-i2c + kxcjk-1013
Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> # for media/* + staging/media/*
Acked-by: Miguel Ojeda <ojeda@kernel.org> # for auxdisplay/ht16k33 + auxdisplay/lcd2s
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> # for versaclock5
Reviewed-by: Ajay Gupta <ajayg@nvidia.com> # for ucsi_ccg
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> # for iio
Acked-by: Peter Rosin <peda@axentia.se> # for i2c-mux-*, max9860
Acked-by: Adrien Grassein <adrien.grassein@gmail.com> # for lontium-lt8912b
Reviewed-by: Jean Delvare <jdelvare@suse.de> # for hwmon, i2c-core and i2c/muxes
Acked-by: Corey Minyard <cminyard@mvista.com> # for IPMI
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com> # for drivers/power
Acked-by: Krzysztof Hałasa <khalasa@piap.pl>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Wolfram Sang <wsa@kernel.org>


# a524837d 23-Jun-2022 Charles Keepax <ckeepax@opensource.cirrus.com>

ASoC: rt*: Remove now redundant non_legacy_dai_naming flag

The ASoC core has now been changed to default to the non-legacy DAI
naming, as such drivers using the new scheme no longer need to specify
the non_legacy_dai_naming flag.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220623125250.2355471-57-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 35b88858 05-Apr-2022 Stephen Kitt <steve@sk2.org>

ASoC: rt*: use simple i2c probe function

The i2c probe functions here don't use the id information provided in
their second argument, so the single-parameter i2c probe function
("probe_new") can be used instead.

This avoids scanning the identifier tables during probes.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Link: https://lore.kernel.org/r/20220405130326.2107293-1-steve@sk2.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# a4db95b2 24-Sep-2021 Colin Ian King <colin.king@canonical.com>

ASoC: codecs: Fix spelling mistake "Unsupport" -> "Unsupported"

There are spelling mistakes in dev_err error messages. Fix them.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20210924231003.144502-1-colin.king@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 3d534537 02-Apr-2021 Hans de Goede <hdegoede@redhat.com>

ASoC: rt5670: Add a rt5670_components() helper

The rt5670 codec driver uses DMI quirks to configure the DMIC data-pins,
which means that it knows which DMIC interface is used on a specific
device.

ATM we duplicate this DMI matching inside the UCM profiles to select
the right DMIC interface. Add a rt5670_components() helper which the
machine-driver can use to set the components string of the card so
that UCM can get the info from the components string.

This way we only need to add new DMI quirks in one place.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210402140747.174716-6-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 84cb0d55 02-Apr-2021 Hans de Goede <hdegoede@redhat.com>

ASoC: rt5670: Add a quirk for the Dell Venue 10 Pro 5055

Add a quirk with the jack-detect and dmic settings necessary to make
jack-detect and the builtin mic work on Dell Venue 10 Pro 5055 tablets.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210402140747.174716-5-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 7ad9b8d2 02-Mar-2021 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: rt5670: clarify expression

cppcheck warning:

sound/soc/codecs/rt5670.c:2519:61: style: Boolean result is used in
bitwise operation. Clarify expression with
parentheses. [clarifyCondition]
(pll_code.m_bp ? 0 : pll_code.m_code) << RT5670_PLL_M_SFT |
^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210302212527.55158-20-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 98204293 15-Feb-2021 Hans de Goede <hdegoede@redhat.com>

ASoC: rt5670: Add emulated 'DAC1 Playback Switch' control

For reliable output-mute LED control we need a "DAC1 Playback Switch"
control. The "DAC Playback volume" control is the only control in the
path from the DAC1 data input to the speaker output, so the UCM profile
for the speaker output will have its PlaybackMixerElem set to "DAC1".

But userspace (pulseaudio) will set the "DAC1 Playback Volume" control to
its softest setting (which is not fully muted) while still showing the
speaker as being enabled at a low volume in the UI.

If we were to set the SNDRV_CTL_ELEM_ACCESS_SPK_LED on the "DAC1 Playback
Volume" control, this would mean then what pressing KEY_VOLUMEDOWN the
speaker-mute LED (embedded in the volume-mute toggle key) would light
while the UI is still showing the speaker as being enabled at a low
volume, meaning that the UI and the LED are out of sync.

Only after an _extra_ KEY_VOLUMEDOWN press would the UI show the
speaker as being muted.

The path from DAC1 data input to the speaker output does have
a digital mixer with DAC1's data as one of its inputs direclty after
the "DAC1 Playback Volume" control.

This commit adds an emulated "DAC1 Playback Switch" control by:

1. Declaring the enable flag for that mixers DAC1 input as well as the
"DAC1 Playback Switch" control both as SND_SOC_NOPM controls.

2. Storing the settings of both controls as driver-private data

3. Only clearing the mute flag for the DAC1 input of that mixer if the
stored values indicate both controls are enabled.

This is a preparation patch for adding "audio-mute" LED trigger support.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20210215142118.308516-5-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 674e4ff4 15-Feb-2021 Hans de Goede <hdegoede@redhat.com>

ASoC: rt5670: Remove ADC vol-ctrl mute bits poking from Sto1 ADC mixer settings

The SND_SOC_DAPM_MIXER declaration for "Sto1 ADC MIXL" and "Sto1 ADC MIXR"
was using the mute bits from the RT5670_STO1_ADC_DIG_VOL control as mixer
master mute bits.

But these bits are already exposed to userspace as controls as part of the
"ADC Capture Volume" / "ADC Capture Switch" control pair:

SOC_DOUBLE("ADC Capture Switch", RT5670_STO1_ADC_DIG_VOL,
RT5670_L_MUTE_SFT, RT5670_R_MUTE_SFT, 1, 1),
SOC_DOUBLE_TLV("ADC Capture Volume", RT5670_STO1_ADC_DIG_VOL,
RT5670_L_VOL_SFT, RT5670_R_VOL_SFT,
127, 0, adc_vol_tlv),

Both the fact that the mute bits belong to the same reg as the vol-ctrl
and the "Digital Mixer Path" diagram in the datasheet clearly shows that
these mute bits are not part of the mixer and having 2 separate controls
poking at the same bits is a bad idea.

Remove the master-mute bits settings from the "Sto1 ADC MIXL" and
"Sto1 ADC MIXR" DAPM widget declarations, avoiding these bits getting
poked from 2 different places.

This should not cause any issues for userspace. AFAICT the rt567x codecs
are only used on x86/ACPI devices and the UCM profiles used there already
set the "ADC Capture Switch" as needed.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20210215142118.308516-4-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 8022f098 15-Feb-2021 Hans de Goede <hdegoede@redhat.com>

ASoC: rt5670: Remove 'HP Playback Switch' control

The RT5670_L_MUTE_SFT and RT5670_R_MUTE_SFT bits (bits 15 and 7) of the
RT5670_HP_VOL register are set / unset by the headphones deplop code
run by rt5670_hp_event() on SND_SOC_DAPM_POST_PMU / SND_SOC_DAPM_PRE_PMD.

So we should not also export a control to userspace which toggles these
same bits.

This should not cause any issues for userspace. AFAICT the rt567x codecs
are only used on x86/ACPI devices and the UCM profiles used there do not
use the "HP Playback Switch" control.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20210215142118.308516-3-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 30be2641 15-Feb-2021 Hans de Goede <hdegoede@redhat.com>

ASoC: rt5670: Remove 'OUT Channel Switch' control

The "OUT Channel Switch" control is a left over from code copied from
thr rt5640 codec driver.

With the rt5640 codec driver the output volume controls have 2 pairs of
mute bits:
bit 7, 15: Mute Control for Spk/Headphone/Line Output Port
bit 6, 14: Mute Control for Spk/Headphone/Line Volume Channel

Bits 7 and 15 are normal mute bits on the rt5670/5672 which are
controlled by 2 dapm widgets:
SND_SOC_DAPM_SWITCH("LOUT L Playback", SND_SOC_NOPM, 0, 0,
&lout_l_enable_control),
SND_SOC_DAPM_SWITCH("LOUT R Playback", SND_SOC_NOPM, 0, 0,
&lout_r_enable_control),

But on the 5670/5672 bit 6 is always reserved, where as bit 14 is
"LOUT Differential Mode" on the 5670 and also reserved on the 5672.

So the "OUT Channel Switch" control which is controlling bits 6+14
of the "LINE Output Control" register is bogus -> remove it.

This should not cause any issues for userspace. AFAICT the rt567x codecs
are only used on x86/ACPI devices and the UCM profiles used there do not
use the "OUT Channel Switch" control.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20210215142118.308516-2-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 42121c26 15-Feb-2021 Hans de Goede <hdegoede@redhat.com>

ASoC: rt5670: Add emulated 'DAC1 Playback Switch' control

For reliable output-mute LED control we need a "DAC1 Playback Switch"
control. The "DAC Playback volume" control is the only control in the
path from the DAC1 data input to the speaker output, so the UCM profile
for the speaker output will have its PlaybackMixerElem set to "DAC1".

But userspace (pulseaudio) will set the "DAC1 Playback Volume" control to
its softest setting (which is not fully muted) while still showing the
speaker as being enabled at a low volume in the UI.

If we were to set the SNDRV_CTL_ELEM_ACCESS_SPK_LED on the "DAC1 Playback
Volume" control, this would mean then what pressing KEY_VOLUMEDOWN the
speaker-mute LED (embedded in the volume-mute toggle key) would light
while the UI is still showing the speaker as being enabled at a low
volume, meaning that the UI and the LED are out of sync.

Only after an _extra_ KEY_VOLUMEDOWN press would the UI show the
speaker as being muted.

The path from DAC1 data input to the speaker output does have
a digital mixer with DAC1's data as one of its inputs direclty after
the "DAC1 Playback Volume" control.

This commit adds an emulated "DAC1 Playback Switch" control by:

1. Declaring the enable flag for that mixers DAC1 input as well as the
"DAC1 Playback Switch" control both as SND_SOC_NOPM controls.

2. Storing the settings of both controls as driver-private data

3. Only clearing the mute flag for the DAC1 input of that mixer if the
stored values indicate both controls are enabled.

This is a preparation patch for adding "audio-mute" LED trigger support.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20210215142118.308516-5-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 02aa946e 15-Feb-2021 Hans de Goede <hdegoede@redhat.com>

ASoC: rt5670: Remove ADC vol-ctrl mute bits poking from Sto1 ADC mixer settings

The SND_SOC_DAPM_MIXER declaration for "Sto1 ADC MIXL" and "Sto1 ADC MIXR"
was using the mute bits from the RT5670_STO1_ADC_DIG_VOL control as mixer
master mute bits.

But these bits are already exposed to userspace as controls as part of the
"ADC Capture Volume" / "ADC Capture Switch" control pair:

SOC_DOUBLE("ADC Capture Switch", RT5670_STO1_ADC_DIG_VOL,
RT5670_L_MUTE_SFT, RT5670_R_MUTE_SFT, 1, 1),
SOC_DOUBLE_TLV("ADC Capture Volume", RT5670_STO1_ADC_DIG_VOL,
RT5670_L_VOL_SFT, RT5670_R_VOL_SFT,
127, 0, adc_vol_tlv),

Both the fact that the mute bits belong to the same reg as the vol-ctrl
and the "Digital Mixer Path" diagram in the datasheet clearly shows that
these mute bits are not part of the mixer and having 2 separate controls
poking at the same bits is a bad idea.

Remove the master-mute bits settings from the "Sto1 ADC MIXL" and
"Sto1 ADC MIXR" DAPM widget declarations, avoiding these bits getting
poked from 2 different places.

This should not cause any issues for userspace. AFAICT the rt567x codecs
are only used on x86/ACPI devices and the UCM profiles used there already
set the "ADC Capture Switch" as needed.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20210215142118.308516-4-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# caba8d76 15-Feb-2021 Hans de Goede <hdegoede@redhat.com>

ASoC: rt5670: Remove 'HP Playback Switch' control

The RT5670_L_MUTE_SFT and RT5670_R_MUTE_SFT bits (bits 15 and 7) of the
RT5670_HP_VOL register are set / unset by the headphones deplop code
run by rt5670_hp_event() on SND_SOC_DAPM_POST_PMU / SND_SOC_DAPM_PRE_PMD.

So we should not also export a control to userspace which toggles these
same bits.

This should not cause any issues for userspace. AFAICT the rt567x codecs
are only used on x86/ACPI devices and the UCM profiles used there do not
use the "HP Playback Switch" control.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20210215142118.308516-3-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# d917b5dd 15-Feb-2021 Hans de Goede <hdegoede@redhat.com>

ASoC: rt5670: Remove 'OUT Channel Switch' control

The "OUT Channel Switch" control is a left over from code copied from
thr rt5640 codec driver.

With the rt5640 codec driver the output volume controls have 2 pairs of
mute bits:
bit 7, 15: Mute Control for Spk/Headphone/Line Output Port
bit 6, 14: Mute Control for Spk/Headphone/Line Volume Channel

Bits 7 and 15 are normal mute bits on the rt5670/5672 which are
controlled by 2 dapm widgets:
SND_SOC_DAPM_SWITCH("LOUT L Playback", SND_SOC_NOPM, 0, 0,
&lout_l_enable_control),
SND_SOC_DAPM_SWITCH("LOUT R Playback", SND_SOC_NOPM, 0, 0,
&lout_r_enable_control),

But on the 5670/5672 bit 6 is always reserved, where as bit 14 is
"LOUT Differential Mode" on the 5670 and also reserved on the 5672.

So the "OUT Channel Switch" control which is controlling bits 6+14
of the "LINE Output Control" register is bogus -> remove it.

This should not cause any issues for userspace. AFAICT the rt567x codecs
are only used on x86/ACPI devices and the UCM profiles used there do not
use the "OUT Channel Switch" control.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20210215142118.308516-2-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# bc03b391 14-Jan-2021 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rt*: sync parameter naming (rate/sample_bits)

This patch syncs naming rule.

- xxx_rates;
+ xxx_rate;

- xxx_samplebits;
+ xxx_sample_bits;

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87a6taolgs.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 883330c1 02-Jul-2020 Hans de Goede <hdegoede@redhat.com>

ASoC: rt5670: Rename dev_gpio to gpio1_is_irq

Rename the not really descriptive dev_gpio quirk / setting to
gpio1_is_irq, which describes what it actually does.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200703100823.258033-3-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# c14f61a8 02-Jul-2020 Hans de Goede <hdegoede@redhat.com>

ASoC: rt5670: Remove struct rt5670_platform_data

platform_data is an obsolete concept, instead device_properties,
set through e.g. device-tree, should be used.

struct rt5670_platform_data is only used internally by the rt5670 codec
driver, so lets remove it before someone starts relying on it.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200703100823.258033-2-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 3f31f7d9 28-Jun-2020 Hans de Goede <hdegoede@redhat.com>

ASoC: rt5670: Fix dac- and adc- vol-tlv values being off by a factor of 10

The adc_vol_tlv volume-control has a range from -17.625 dB to +30 dB,
not -176.25 dB to + 300 dB. This wrong scale is esp. a problem in userspace
apps which translate the dB scale to a linear scale. With the logarithmic
dB scale being of by a factor of 10 we loose all precision in the lower
area of the range when apps translate things to a linear scale.

E.g. the 0 dB default, which corresponds with a value of 47 of the
0 - 127 range for the control, would be shown as 0/100 in alsa-mixer.

Since the centi-dB values used in the TLV struct cannot represent the
0.375 dB step size used by these controls, change the TLV definition
for them to specify a min and max value instead of min + stepsize.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20200628155231.71089-5-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 85ca6b17 28-Jun-2020 Hans de Goede <hdegoede@redhat.com>

ASoC: rt5670: Add new gpio1_is_ext_spk_en quirk and enable it on the Lenovo Miix 2 10

The Lenovo Miix 2 10 has a keyboard dock with extra speakers in the dock.
Rather then the ACL5672's GPIO1 pin being used as IRQ to the CPU, it is
actually used to enable the amplifier for these speakers
(the IRQ to the CPU comes directly from the jack-detect switch).

Add a quirk for having an ext speaker-amplifier enable pin on GPIO1
and replace the Lenovo Miix 2 10's dmi_system_id table entry's wrong
GPIO_DEV quirk (which needs to be renamed to GPIO1_IS_IRQ) with the
new RT5670_GPIO1_IS_EXT_SPK_EN quirk, so that we enable the external
speaker-amplifier as necessary.

Also update the ident field for the dmi_system_id table entry, the
Miix models are not Thinkpads.

Fixes: 67e03ff3f32f ("ASoC: codecs: rt5670: add Thinkpad Tablet 10 quirk")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1786723
Link: https://lore.kernel.org/r/20200628155231.71089-4-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 467a2553 15-Jun-2020 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: codecs: rt*: rename to snd_soc_component_read()

We need to use snd_soc_component_read()
instead of snd_soc_component_read32()

This patch renames _read32() to _read()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87d05z4mce.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# d2912cb1 04-Jun-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500

Based on 2 normalized pattern(s):

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license version 2 as
published by the free software foundation

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license version 2 as
published by the free software foundation #

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-only

has been chosen to replace the boilerplate/reference in 4122 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Enrico Weigelt <info@metux.net>
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190604081206.933168790@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 3e951e79 31-May-2019 Kovács Tamás <kepszlok@zohomail.eu>

ASoC: Intel: Baytrail: add quirk for Aegex 10 (RU2) tablet

This tablet has an incorrect acpi identifier just like
Thinkpad10 tablet, which is why it is trying to load the RT5640 driver
instead of the RT5762 driver. The RT5640 driver, on the other hand, checks
the hardware ID, so no driver are loaded during boot. This fix resolves to
load the RT5672 driver on this tablet during boot. It also provides the
correct IO configuration, like the jack detect mode 3, for 1.8V pullup. I
would like to thank Pierre-Louis Bossart for helping with this patch.

Signed-off-by: Kovács Tamás <kepszlok@zohomail.eu>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 6606f9df 04-Jan-2019 Bard liao <yung-chuan.liao@linux.intel.com>

ASoC: rt5670: remove unused mux/mixer define

Some mux/mixer are not used. Remove them from the driver.

Signed-off-by: Bard liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 1c96a2f6 01-Sep-2018 David Frey <dpfrey@gmail.com>

regmap: split up regmap_config.use_single_rw

Split regmap_config.use_single_rw into use_single_read and
use_single_write. This change enables drivers of devices which only
support bulk operations in one direction to use the regmap_bulk_*()
functions for both directions and have their bulk operation split into
single operations only when necessary.

Update all struct regmap_config instances where use_single_rw==true to
instead set both use_single_read and use_single_write. No attempt was
made to evaluate whether it is possible to set only one of
use_single_read or use_single_write.

Signed-off-by: David Frey <dpfrey@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 818838e6 21-Aug-2018 Hans de Goede <hdegoede@redhat.com>

ASoC: rt5670: Add quirk for Thinkpad 8 tablet

The Thinkpad 8 needs a quirk for jack-detect and the internal mic to
work correctly.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 81dd1c5d 16-May-2018 Bard Liao <bardliao@realtek.com>

ASoC: rt5670: improve PLL function's stability

Set PR-38 register to 0x1fe1 will make PLL function more stable.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 5ba04c66 28-Jan-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: rt5670: replace codec to component

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>


# d0817657 13-Sep-2017 Bard Liao <bardliao@realtek.com>

ASoC: rt5670: add set_bclk_ratio in dai ops

We need to set a specific bit for 50 bclk rate. So add set_bclk_ratio
function to set the bit.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 8e1b1785 07-Sep-2017 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: rt5670: refactor DMI quirks and fix Dell Venue settings

Additional checks exposed a mistake in the quirk for the Dell Venue
Pro 5855 (Dmic2 instead of Dmic1). Rather than adding quirk tables,
merge all quirks in a single table and use flags to differentiate
platforms. Also add a parameter override to help support additional
platforms using this codec

CC: Bard Liao <bardliao@realtek.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# c26d8389 22-Aug-2017 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: codecs: rt5670: add jack detection quirk for Dell Venue 5585

Jack is not detected by default, using jdmode=3 works fine

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 804e73ad 21-Aug-2017 Takashi Iwai <tiwai@suse.de>

ASoC: rt5670: Fix GPIO headset detection regression

RT5670 codec driver and its machine driver for Intel CHT assume the
implicit GPIO mapping on the index 0 while BIOS on most devices don't
provide it. The recent commit f10e4bf6632b ("gpio: acpi: Even more
tighten up ACPI GPIO lookups") restricts such cases and it resulted in
a regression where the headset jack setup fails like:

rt5670 i2c-10EC5672:00: ASoC: Cannot get gpio at index 0: -2
rt5670 i2c-10EC5672:00: Adding jack GPIO failed

For fixing this, we need to provide the GPIO mapping explicitly in the
machine driver. Also this patch corrects the string to be passed to
gpiolib to match with the pre-given mapping, too.

Fixes: f10e4bf6632b ("gpio: acpi: Even more tighten up ACPI GPIO lookups")
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=115531
Reported-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# a180ba45 03-Aug-2017 Bhumika Goyal <bhumirks@gmail.com>

ASoC: codecs: add const to snd_soc_codec_driver structures

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>


# ea746a29 26-Jul-2017 Bard Liao <bardliao@realtek.com>

ASoC: rt5670: merge ADC L/R Mux

Some ADC L/R Muxes share the some control bit. So, merge them.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 8215313c 26-Jul-2017 Bard Liao <bardliao@realtek.com>

ASoC: rt5670: add symmetric_rates flag

rt5670 requires symmetric rate of capture and playback.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# c243d963 28-Jun-2017 Bard Liao <bardliao@realtek.com>

ASoC: rt5670: fix incompatible pointer type of set_sysclk

The first parameter is codec not dai.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 6c28ce3c 28-Jun-2017 Bard Liao <bardliao@realtek.com>

ASoC: rt5670: move set_sysclk to codec level

Move set_sysclk to codec level and people can use it at both
codec and dai level.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 90384fcc 28-Jun-2017 Bard Liao <bardliao@realtek.com>

ASoC: rt5670: remove duplicate route.

{ "ADC Stereo1 Filter", NULL, "PLL1", is_sys_clk_from_pll }, and
{ "ADC Stereo2 Filter", NULL, "PLL1", is_sys_clk_from_pll }, are
defined twice in the driver.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 8e2d163b 28-Jun-2017 Bard Liao <bardliao@realtek.com>

ASoC: rt5670: fix wrong audio route

When we select "IF1_ADC4" for IF1 ADC Muxes, it is actually connected
to "TxDP_ADC" widget. This patch fixes the audio route and remove the
unexisting "IF1_ADC4" widget.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 8cffb503 22-Jun-2017 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: codecs: rt5670: fix jd mode for Lenovo Miix 2 10

jd mode 2 (3.3V) is required apparently

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=96691
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 67e03ff3 17-Apr-2017 Nicole Faerber <nicole.faerber@id3p.com>

ASoC: codecs: rt5670: add Thinkpad Tablet 10 quirk

The Thinkpad Tablet tablet has a similar audio setup as the Intel Braswell
platform.
A quirk is needed to detect the platform and setup the platform data
properly:

Manufacturer: LENOVO
Product Name: 20C1CTO1WW
Version: ThinkPad 10

Manufacturer: LENOVO
Product Name: 20C3001VHH
Version: ThinkPad 10

Manufacturer: LENOVO
Product Name: 20C10024GE
Version: ThinkPad Tablet B

Manufacturer: LENOVO
Product Name: 20359
Version: Lenovo Miix 2 10

Signed-off-by: Nicole Faerber <nicole.faerber@id3p.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 93ffeaa8 26-Jan-2017 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: codecs: rt5670: add quirk for Lenovo Thinkpad 10

the BIOS incorrectly reports this codec as 5640 but it is
really a rt5670

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# d2528006 30-Nov-2016 Takashi Iwai <tiwai@suse.de>

ASoC: rt5670: Add missing 10EC5072 ACPI ID

rt5670 driver supports also RT5672 codec, but its ACPI ID is missing.
This was found on Dell Wyse 3040 box.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# b4ff47d2 30-Nov-2016 Takashi Iwai <tiwai@suse.de>

ASoC: rt5670: Enable Braswell platform workaround for Dell Wyse 3040

Dell Wyse 3040 requires the platform workaround for enabling dmic and
jack detection as defined for Braswell CRB.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# c8c6f0d8 26-Oct-2016 Bard Liao <bardliao@realtek.com>

ASoC: rt5670: increse LDO power

Inrecse LDO power for better performance.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# a5d93da1 17-Oct-2016 Bard Liao <bardliao@realtek.com>

ASoC: rt5670: Enable MCLK detection

There is a power saving mechanism in rt5670. 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>


# 462fe794 08-Aug-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: codec duplicated callback function goes to component on rt5670

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>


# 874352a7 16-Jun-2016 Bard Liao <bardliao@realtek.com>

ASoC: rt5670: patch reg-0x8a

reg-8a assign the tracking source for each ASRC tracker. The default
value is 0x0000 which means all ASRC trackers will track LRCK1. But
in most case, we wish each ASRC tracker track the corresponding LRCK.
i.e. ASRC1 tracks LRCK1, ASRC2 tracks LRCK2 and so on. So, we rewrite
reg-8a as 0x0123.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# e1f42a2f 06-Jun-2016 Bard Liao <bardliao@realtek.com>

ASoC: rt5670: fix HP Playback Volume control

The register setting for HP Playback Volume is inverted. So, set
the invert flag in SOC_DOUBLE_TLV.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 572f1f61 06-Jun-2016 Bard Liao <bardliao@realtek.com>

ASoC: rt5670: fix HP Playback Volume control

The register setting for HP Playback Volume is inverted. So, set
the invert flag in SOC_DOUBLE_TLV.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# dea6d32e 02-Aug-2015 Lars-Peter Clausen <lars@metafoo.de>

ASoC: rt5670: Replace TLV_DB_RANGE_HEAD with DECLARE_TLV_DB_RANGE

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>


# 00a6d6e5 04-Aug-2015 Oder Chiou <oder_chiou@realtek.com>

ASoC: Add function "rl6231_get_pre_div" to correct the dmic clock calculation

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>


# 8019ff6c 16-Jul-2015 Nariman Poushin <nariman@opensource.wolfsonmicro.com>

regmap: Use reg_sequence for multi_reg_write / register_patch

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>


# 1c07a4de 14-Jul-2015 Krzysztof Kozlowski <krzk@kernel.org>

ASoC: drivers: Drop owner assignment from i2c_driver

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>


# 64793047 15-Jul-2015 Axel Lin <axel.lin@ingics.com>

ASoC: Constify snd_soc_dai_ops variables

The snd_soc_dai_ops variables are not modified after initialization in
these drivers, so make them const.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 387ad57f 25-Jun-2015 Jarkko Nikula <jarkko.nikula@linux.intel.com>

ASoC: rt5670: Prefix hexadecimal ID register value with 0x in error print

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>


# 4e0ce6a4 13-Jun-2015 Mathias Krause <minipli@googlemail.com>

ASoC: rt5670: Constify ACPI device ids and register defaults

Constify the ACPI device ID array and the register map, no need to have
them writable at runtime. Also drop the unneeded RT5670_INIT_REG_LEN
define.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 6d8135ff 19-May-2015 Lars-Peter Clausen <lars@metafoo.de>

ASoC: rt5670: Replace direct snd_soc_codec dapm field access

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>


# f4bf8d77 27-Apr-2015 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Move bias level update to the core

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>


# 66454b3e 14-Jan-2015 Lars-Peter Clausen <lars@metafoo.de>

ASoC: rt5670: Replace w->codec snd_soc_dapm_to_codec(w->dapm)

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>


# cc3c340d 10-Mar-2015 Bard Liao <bardliao@realtek.com>

ASoC: rt5670: export jack suspend/resume APIs

We force enable "Mic Det Power" when a jack is inserted. Also, we
set codec idle_bias_off = true. As a result, codec driver will not
suspend as we expect.

On Braswell, we don't need the jack detection when suspend but need
it after resume, so export the jack suspend/resume APIs which are
provided for machine driver to control during suspend/resume.

Signed-off-by: Jie Yang <yang.jie@intel.com>
Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# d3ef7054 10-Mar-2015 Bard Liao <bardliao@realtek.com>

ASoC: rt5670: Add IRQ function

This patch adds the IRQ function support of rt5670. We use a flag
named dev_gpio in platform data to inform codec driver if the IRQ
function is used or not. Also, we export rt5670_set_jack_detect
for machine driver to pass the jack point.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 485372dc 09-Mar-2015 Bard Liao <bardliao@realtek.com>

ASoC: rt5670: Check sysclk source by private data

Currently, is_sys_clk_from_pll check sysclk source by reading codec
register value. And it will be invoked before updating dapm widget
power. In some machine driver, snd_soc_dai_set_sysclk is called in
dapm event to switch codec sysclk to RC clock in idle mode. And in
some use cases (such as syspend/resume) hw_params will not be called
when the dapm widget is powered up. As a result, is_sys_clk_from_pll
will return 0 although it is supposed to be 1.
To solve this, we let is_sys_clk_from_pll check sysclk sysclk_src
which is stored in private data and don't change the value of sysclk_src
when codec sysclk is switched to internal clock. The internal clock
can only be used in idle mode, so it sould be fine if we don't set
sysclk_src to internal clock.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# bd22f9d4 09-Mar-2015 Bard Liao <bardliao@realtek.com>

ASoC: rt5670: Revert Keep sysclk on patch

The "Keep sysclk on if JD func is used" patch force enable/disable
pin in rt5670_set_dai_sysclk. But some machine driver call it in
dapm widget event. It will cause kernel crash.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 2bf9eba1 03-Mar-2015 Bard Liao <bardliao@realtek.com>

ASoC: rt5670: Fix the speaker mono output issue

We need to set left/right control for the speaker amp to get stereo
output on speaker.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# ea232b3f 06-Jan-2015 Mengdong Lin <mengdong.lin@intel.com>

ASoC: rt5670: add API to select ASRC clock source

When codec is in slave mode, ASRC can suppress noise for asynchronous
MCLK and LRCLK or special I2S format. This patch defines an API to select
the clock source for specified filters. And the codec driver will turn on ASRC
for these filters if ASRC is selected as their clock source.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 77e3ea28 15-Dec-2014 Bard Liao <bardliao@realtek.com>

ASoC: rt5670: Keep sysclk on if JD func is used

System clock is necessary for rt5670 JD function. We assume system
clock source will be set in machine driver. So there are two things
left we should do in codec driver.
1. Set sysclk to codec internal clock in probe since machine driver
may not do that before JD function is registered.
2. Power up PLL once sysclk source is switched to PLL.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 64e89e5f 15-Dec-2014 Bard Liao <bardliao@realtek.com>

ASoC: rt5670: Add runtime PM support

This patch adds runtime PM support on rt5670 codec.

Signed-off-by: Lin Mengdong <mengdong.lin@intel.com>
Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 223c055a 17-Dec-2014 Bard Liao <bardliao@realtek.com>

ASoC: rt5670: set platform data by dmi

This patch set specific data according to dmi data.

Signed-off-by: Jin, Yao <yao.jin@intel.com>
Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 85052924 15-Feb-2015 Bard Liao <bardliao@realtek.com>

ASoC: rt5670: Set RT5670_IRQ_CTRL1 non volatile

RT5670_IRQ_CTRL1(0xbd) is a non volatile register. And we need to
restore its value after suspend/resume.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org


# e7a961c9 16-Feb-2015 Bard Liao <bardliao@realtek.com>

ASoC: rt5670: Fix the speaker mono output issue

We need to set left/right control for the speaker amp to get stereo
output on speaker.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 92b133f2 08-Feb-2015 Bard Liao <bardliao@realtek.com>

ASoC: rt5670: Set use_single_rw flag for regmap

RT5670 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>
Cc: stable@vger.kernel.org


# 8eee1468 14-Jan-2015 Lars-Peter Clausen <lars@metafoo.de>

ASoC: rt5670: Replace w->codec snd_soc_dapm_to_codec(w->dapm)

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>


# e8c47ba3 06-Jan-2015 Mengdong Lin <mengdong.lin@intel.com>

ASoC: rt5670: add API to select ASRC clock source

When codec is in slave mode, ASRC can suppress noise for asynchronous
MCLK and LRCLK or special I2S format. This patch defines an API to select
the clock source for specified filters. And the codec driver will turn on ASRC
for these filters if ASRC is selected as their clock source.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 026e7368 15-Dec-2014 Bard Liao <bardliao@realtek.com>

ASoC: rt5670: Keep sysclk on if JD func is used

System clock is necessary for rt5670 JD function. We assume system
clock source will be set in machine driver. So there are two things
left we should do in codec driver.
1. Set sysclk to codec internal clock in probe since machine driver
may not do that before JD function is registered.
2. Power up PLL once sysclk source is switched to PLL.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# f2ecf2ef 15-Dec-2014 Bard Liao <bardliao@realtek.com>

ASoC: rt5670: Add runtime PM support

This patch adds runtime PM support on rt5670 codec.

Signed-off-by: Lin Mengdong <mengdong.lin@intel.com>
Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# a5a41645 17-Dec-2014 Bard Liao <bardliao@realtek.com>

ASoC: rt5670: set platform data by dmi

This patch set specific data according to dmi data.

Signed-off-by: Jin, Yao <yao.jin@intel.com>
Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# ff4541c3 17-Nov-2014 Bard Liao <bardliao@realtek.com>

ASoC: rt5670: add DMIC ASRC support

This patch will enable ASRC for DMIC if ASRC is useable.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# e50334d4 17-Nov-2014 Bard Liao <bardliao@realtek.com>

ASoC: rt5670: check if asrc is useable

To use ASRC, the sysclk should be faster than 384 times sample rate of I2S1.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 044b724a 12-Nov-2014 Bard Liao <bardliao@realtek.com>

ASoC: rt5670: make bias level more reasonable

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>


# 0605815e 14-Nov-2014 Mengdong Lin <mengdong.lin@intel.com>

ASoC: rt5670 : Add ACPI match ID for Intel CHT/BSW platforms

This patch adds the ACPI match ID for rt5670/5672 codec.
So on Intel CherryTrail/Braswell platforms, the codec can be enumerated from
ACPI and depends on ACPI to get platform-specific info and power saving.

Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
Reviewed-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 0cf18632 11-Nov-2014 Bard Liao <bardliao@realtek.com>

ASoC: rt5670: add rt5672 codec support

rt5672 is very similar to rt5670. Therefore we use one codec driver
to support both codecs. The difference between rt5670 and rt5672 is
there is some difference in their dapm routing table.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 96927ac9 05-Nov-2014 Bard Liao <bardliao@realtek.com>

ASoC: rt5670: change dapm routes of PLL connection

PLL should be powered up once filter power is on. So, "PLL1"
should be connected to filters instead of DACs.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# ac87f221 05-Nov-2014 Bard Liao <bardliao@realtek.com>

ASoC: rt5670: correct the incorrect default values

The patch corrects the incorrect default register values.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org


# 01957572 01-Aug-2014 Mark Brown <broonie@linaro.org>

ASoC: rt5670: Fix duplicate const warnings

Since SOC_ENUM_SINGLE_DECL() includes a const as part of the macro adding
an explicit const in the source is duplication and causes sparse to warn.
Remove the extra consts.

Signed-off-by: Mark Brown <broonie@linaro.org>


# ff62b958 01-Aug-2014 Mark Brown <broonie@linaro.org>

ASoC: rt5670: Staticise non-exported symbols

Signed-off-by: Mark Brown <broonie@linaro.org>


# 5e8351de 30-Jun-2014 Bard Liao <bardliao@realtek.com>

ASoC: add RT5670 CODEC driver

This patch adds a minimum support of Realtek ALC5670 codec.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@linaro.org>