History log of /linux-master/sound/soc/codecs/rt5677.h
Revision Date Author Comments
# 043bb9c0 30-Jun-2023 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

ASoC: rt5677: Use device_get_match_data()

Use device_get_match_data() to simplify the code.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230630172155.83754-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 5512ffd9 30-Jun-2023 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

ASoC: rt5677: Refactor GPIO support code

After compiler complains:

sound/soc/codecs/rt5677.c:4748:30: warning: dubious: x | !y

I looked into the code and realized that we can refactor it
for better reading and fixing above issue at the same time.
Hence this change. It does not imply any functional changes.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230630172155.83754-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# ba0b3a97 05-Nov-2019 Curtis Malainey <cujomalainey@chromium.org>

ASoC: rt5677: Set ADC clock to use PLL and enable ASRC

Use the PLL to kept the correct 24M clock rate so frequency shift does
not occur when using the DSP VAD.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20191106011335.223061-11-cujomalainey@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# ee0be4a9 05-Nov-2019 Ben Zhang <benzh@chromium.org>

ASoC: rt5677: Disable irq at suspend

The irq is disabled at suspend to avoid running the threaded irq
handler after the codec has been powered off. At resume, codec irq is
re-enabled and the interrupt status register is checked to see if
headphone has been pluggnd/unplugged while the device is suspended.

There is still a chance that the headphone gets enabled or disabled
after the codec is suspended. disable_irq syncs the threaded irq
handler, but soc-jack's threaded irq handler schedules a delayed
work to poll gpios (for debounce). This is still OK. The codec won't
be powered back on again because all audio paths have been suspended,
and there are no force enabled supply widgets (MICBIAS1 is disabled).
The gpio status read after codec power off could be wrong, so the
gpio values are checked again after resume.

Signed-off-by: Ben Zhang <benzh@chromium.org>
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20191106011335.223061-8-cujomalainey@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 3f81068d 05-Nov-2019 Ben Zhang <benzh@chromium.org>

ASoC: rt5677: Stop and restart DSP over suspend/resume

MCLK1 gets disabled at suspend and re-enabled at resume. Before
MCLK1 is re-enabled, if the DSP is already on (either the DSP was
left on during suspend, or the DSP is turned on early at resume),
i2c register read returns garbage and corrupts the regmap cache.

This patch stops the DSP before suspend and restarts it after
resume with a dalay to ensure MCLK is on while loading firmware.

Signed-off-by: Ben Zhang <benzh@chromium.org>
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20191106011335.223061-7-cujomalainey@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 461c6232 05-Nov-2019 Ben Zhang <benzh@chromium.org>

ASoC: rt5677: Load firmware via SPI using delayed work

The firmware rt5677_elf_vad is an ELF binary obtained from
request_firmware(). Sections of the ELF are loaded to
the DSP via SPI. A model (e.g. en_us.mmap) can optionally be
loaded to the DSP at RT5677_MODEL_ADDR to overwrite the
baked-in model in rt5677_elf_vad.

Then we switch to DSP mode, load firmware, and let DSP run.
When a hotword is detected, an interrupt is fired and
rt5677_irq() is called. When 'DSP VAD Switch' is turned off,
the codec is set back to normal mode.

The kcontrol 'DSP VAD Switch' is automatically enabled/disabled
when the hotwording PCM stream is opened/closed.

Signed-off-by: Ben Zhang <benzh@chromium.org>
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20191106011335.223061-2-cujomalainey@chromium.org
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>


# 4f7b018b 18-Jun-2019 Ben Zhang <benzh@chromium.org>

ASoC: rt5677: clear interrupts by polarity flip

The rt5677 jack detection function has a requirement that the polarity
of an interrupt be flipped after it fires in order to clear the
interrupt.

This patch implements an irq_chip with irq_domain directly instead of
using regmap-irq, so that interrupt source line polarities can be
flipped in the irq handler.

The reason that this patch does not add this feature within regmap-irq
is that future patches will add hotword detection support to this irq
handler. Those patches will require adding additional logic that would
not make sense to have in regmap-irq.

Signed-off-by: Ben Zhang <benzh@chromium.org>
Signed-off-by: Fletcher Woodruff <fletcherw@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 24180064 14-Jun-2019 Fletcher Woodruff <fletcherw@chromium.org>

ASoC: rt5677: move jack-detect init to i2c probe

This patch moves the code to select the gpios for jack detection
from rt5677_probe to rt5677_init_irq (called from rt5677_i2c_probe).

It also sets some registers to fix bugs related to jack detection, and
adds some constants and comments to make it easier to understand what
certain register settings are controlling.

Signed-off-by: Ben Zhang <benzh@chromium.org>
Signed-off-by: Fletcher Woodruff <fletcherw@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# f499edf9 29-May-2019 Curtis Malainey <cujomalainey@chromium.org>

ASoC: rt5677: Add missing voice activation register definitions

Most of the voice activation definitions were missing, they will be
needed for when hotwording is added. Also the source bits are only 2
wide not 3 and needed to be corrected.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 893d1a9c 07-May-2019 Curtis Malainey <cujomalainey@chromium.org>

ASoC: rt5677: Add component driver name

Add name to component driver so it is possible to lookup the component
when needed.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


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

ASoC: rt5645/rt5677: replace codec to component

Now we can replace Codec to Component. Let's do it.

Because Intel/Mediatek platforms are using rt5645/rt5677,
we need to update these all related drivers in same time.
Otherwise compile error/warning happen

rt5645:
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

rt5677:
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>


# ddc9e69b 18-Jul-2017 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

ASoC: rt5677: Hide platform data in the module sources

There is no user of legacy platform data.

Remove separate header and hide its content inside module sources.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# efd901ee 22-Jun-2015 Ben Zhang <benzh@chromium.org>

ASoC: rt5677: Switch to use descriptor-based gpiod API

This patch makes the driver use the new descriptor-based gpiod API
so that gpio assignment info can be provided by Device Tree, ACPI
or board files.

Signed-off-by: Ben Zhang <benzh@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# b3b10e99 13-May-2015 Anatol Pomozov <anatol.pomozov@gmail.com>

ASoC: rt5677: Add reset-gpio dts option

It allows to configure codec's RESET pin gpio

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 16ab6e18 27-Apr-2015 Bard Liao <bardliao@realtek.com>

ASoC: rt5677: add i2s asrc clk src selection

The ASRC source of i2s are also configurable. We add the selection
in the existing rt5677_sel_asrc_clk_src API.

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


# c36aa0a1 16-Mar-2015 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: add API to select ASRC clock source

This patch defines an API to select the clock source for specified filters.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# ab1f7095 11-Feb-2015 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: Add the chip type to distinguish the setting of the clock source

There is only one clock source in the rt5676, so the chip type is added to
distinguish the setting of the clock source in the VAD function.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 40e3262e 04-Dec-2014 Dylan Reid <dgreid@chromium.org>

ASoC: rt5677: make volume TLV closer to reality

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. Update the masks to reflect
that these are registers have the LSB ignored.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 6fe17da0 24-Nov-2014 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: Fix the issue that the regmap_range "rt5677_ranges" cannot be accessed

After the patch "ASoC: rt5677: Use specific r/w function for DSP mode", the
regmap_range "rt5677_ranges" was not registered in rt5677_regmap_physical, and
it caused that the regmap_range "rt5677_ranges" cannot be accessed by the
specific r/w function. The patch fixes this issue.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 683996cb 18-Nov-2014 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: Set the slow charge of the vref in the end of the power sequences

Set the slow charge of the vref in the end of the power sequences

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 91159eca 11-Nov-2014 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: Add TDM channel mux in DAC side of IF1 and IF2

It is the slot selection in DAC side of IF1 and IF2.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 19ba484d 04-Nov-2014 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: Use specific r/w function for DSP mode

In DSP mode, the register r/w should use the specific function to access
that is invoked by address mapping of the DSP.

The MX-65[1] is for switching DSP or codec mode.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# e6f6ebc1 22-Oct-2014 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: Add TDM channel mapping function

It is for channel to slot mapping, and it is not only for 8 channels mapping,
but also in 2, 4 and 6 channels mapping. If we want to use the 2 channels in
the stereo2 adc path, we need to set the item "2/1/3/4" or "2/3/1/4".

It also adds for stereo channel swap. It can map the sterero channels "L/R"
to "R/L", "L/L" or R/R.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 5e3363ad 16-Oct-2014 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: add GPIO IRQ support

This allows to enable Mic Jack detection feature

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Modified-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# af48f1d0 06-Oct-2014 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: Support DSP function for VAD application

The ALC5677 has a programmable DSP, and there is a SPI that is dadicated for DSP
firmware loading. Therefore, the patch includes a SPI driver for writing the DSP
firmware. The VAD(Voice Activaty Detection) has be implemented and use the DSP to
recognize the key phase.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 80fff6bf 03-Oct-2014 Ben Zhang <benzh@chromium.org>

ASoC: rt5677: Include gpio driver header

The header file is needed because struct gpio_chip is
placed in struct rt5677_priv.

Signed-off-by: Ben Zhang <benzh@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# f9f6a592 17-Sep-2014 Anatol Pomozov <anatol.pomozov@gmail.com>

ASoC: rt5677: Add a configuration option for LDO2_POW pin

Some boards have this pin statically tied and do not require any configuration,
some other boards allow to enable chip using GPIO.

Add an option that tells which GPIO is used to power the audio codec.

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 90bdbb46 18-Sep-2014 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: Add sidetone function

Add sidetone function

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 44caf764 15-Sep-2014 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: Add the GPIO function

The patch adds the GPIO function.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# e5b2791d 15-Sep-2014 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: Revise the wrong name in the header file

The patch revises the wrong name in the header file.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 2d15d974 27-Aug-2014 Bard Liao <bardliao@realtek.com>

ASoC: rt5677: Add DMIC2 clock selection

There are two pins can be used for rt5677's DMIC2 clock. This patch
add the select options for it.

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


# cc6b0ae9 07-Jul-2014 Oder Chiou <oder_chiou@realtek.com>

ASoC: rt5677: Remove the redundant definition in head file

The patch removes the redundant definition in head file

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 099d334e 16-Jun-2014 Axel Lin <axel.lin@ingics.com>

ASoC: rt5677: Convert to use rl6231_pll_calc

The implementation of rt5677_pll_calc() has the same logic of rl6231_pll_calc().
The only difference is the lower boundary checking for freq_in.

This patch calls rl6231_pll_calc() instead of open-coded.
The k_bp of struct rt5677_pll_code is always false, thus also remove the
code to check pll_code.k_bp.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Tested-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 0e826e86 26-May-2014 Oder Chiou <oder_chiou@realtek.com>

ASoC: add RT5677 CODEC driver

This patch adds the Realtek ALC5677 codec driver.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@linaro.org>