summaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/mt6358.c
Commit message (Collapse)AuthorAgeFilesLines
* ASoC: Explicitly include correct DT includesRob Herring2023-10-091-1/+1
| | | | | | | | | | | | | | | | | | | The DT of_device.h and of_platform.h date back to the separate of_platform_bus_type before it was merged into the regular platform bus. As part of that merge prepping Arm DT support 13 years ago, they "temporarily" include each other. They also include platform_device.h and of.h. As a result, there's a pretty much random mix of those include files used throughout the tree. In order to detangle these headers and replace the implicit includes with struct declarations, users need to explicitly include the correct includes. Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com> Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev> # for at91 Signed-off-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20231006-dt-asoc-header-cleanups-v3-1-13a4f0f7fee6@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: mediatek: mt6358: fix UNINIT problemTrevor Wu2023-03-131-1/+1
| | | | | | | | | | | Coverity shows decaring variable reg without initializer. When regmap_read returns an error, reg keeps the value left from earlier computation. To prevent from the unexpected result in the case, assign 0 to reg. Signed-off-by: Trevor Wu <trevor.wu@mediatek.com> Link: https://lore.kernel.org/r/20230307040938.7484-4-trevor.wu@mediatek.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: mt6358: Remove undefined HPx Mux enumeration valuesMark Brown2023-02-281-6/+0
| | | | | | | | | | | | | | | | | | | | The HPx Mux enumerations define values 5, 6 and 7 but describe them as "undefined" and map them to the value 0 on writing. Given the descriptions and behaviour it seems that these values are invalid and should not be present in the register, the current behaviour is detected as problematic by mixer-test: # # HPL Mux.0 expected 5 but read 0, is_volatile 0 # # HPL Mux.0 expected 6 but read 0, is_volatile 0 # # HPL Mux.0 expected 7 but read 0, is_volatile 0 Remove the values from the enumeration, this will prevent userspace setting them. Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20230224-asoc-mt6358-quick-fixes-v1-3-747d9186be4b@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: mt6358: Validate Wake on Voice 2 writesMark Brown2023-02-281-0/+3
| | | | | | | | | | | Currently the Wake on Voice 2 control accepts and stores any value written but it reports that only 0 and 1 are valid values. Reject any out of range values written by userspace. Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20230224-asoc-mt6358-quick-fixes-v1-2-747d9186be4b@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: mt6358: Fix event generation for wake on voice stage 2 switchMark Brown2023-02-281-0/+2
| | | | | | | | | | | ALSA control put() operations should return 0 if the value changed so that events can be generated appropriately for userspace but the custom control for wake on voice stage 2 doesn't do this, fix it. Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20230224-asoc-mt6358-quick-fixes-v1-1-747d9186be4b@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: mediatek: mt6366: support for mt6366 codecJiaxin Yu2022-06-061-0/+1
| | | | | | | | | | Mt6366 is a new version of mt6358, and they are same about audio part. So we can reuse the driver of mt6358 that add a new compatible string inside of the mt6358 driver. Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com> Link: https://lore.kernel.org/r/20220523132858.22166-2-jiaxin.yu@mediatek.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: mt6358: Add endianness flag in snd_soc_component_driverCharles Keepax2022-05-091-6/+4
| | | | | | | | | | | | | | The endianness flag is used on the CODEC side to specify an ambivalence to endian, typically because it is lost over the hardware link. This device receives audio over an I2S DAI and as such should have endianness applied. As the core will now expand the formats to cover both endian types, remove the redundant manual specification of both. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20220504170905.332415-19-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: mediatek: mt6358: add missing EXPORT_SYMBOLsJiaxin Yu2022-03-211-0/+4
| | | | | | | | | | | | | | | Fixes the following build errors when mt6358 is configured as module: >> ERROR: modpost: "mt6358_set_mtkaif_protocol" >> [sound/soc/mediatek/mt8186/mt8186-mt6366-rt1019-rt5682s.ko] undefined! >> ERROR: modpost: "mt6358_set_mtkaif_protocol" >> [sound/soc/mediatek/mt8186/mt8186-mt6366-da7219-max98357.ko] undefined! Fixes: 6a8d4198ca80 ("ASoC: mediatek: mt6358: add codec driver") Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://lore.kernel.org/r/20220319120325.11882-1-jiaxin.yu@mediatek.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: mt6358: remove useless initializationsPierre-Louis Bossart2021-03-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | cppcheck warnings: sound/soc/codecs/mt6358.c:334:19: style: Variable 'stage' is assigned a value that is never used. [unreadVariable] int i = 0, stage = 0; ^ sound/soc/codecs/mt6358.c:350:19: style: Variable 'stage' is assigned a value that is never used. [unreadVariable] int i = 0, stage = 0; ^ 185/930 files checked 25% done Checking sound/soc/codecs/mt6359.c ... sound/soc/codecs/mt6359.c:274:8: style: Variable 'i' is assigned a value that is never used. [unreadVariable] int i = 0, stage = 0; ^ sound/soc/codecs/mt6359.c:274:19: style: Variable 'stage' is assigned a value that is never used. [unreadVariable] int i = 0, stage = 0; ^ Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20210312182246.5153-14-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: mediatek: mt6358: support DMIC one-wire modeJiaxin Yu2020-06-151-1/+22
| | | | | | | | Supports DMIC one-wire mode. Uses a DT property "dmic-mode" to select. Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com> Link: https://lore.kernel.org/r/1591353222-18576-2-git-send-email-jiaxin.yu@mediatek.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: mediatek: mt6358: support WoVTzung-Bi Shih2019-10-211-0/+105
| | | | | | | | Switch mono DMIC on to support wake-on-voice. Signed-off-by: Tzung-Bi Shih <tzungbi@google.com> Link: https://lore.kernel.org/r/20191019143504.2.I57266d36564f393e9d701c9db648cc2efb0346fc@changeid Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: mediatek: mt6358: add delay after dmic clock onJiaxin Yu2019-08-151-0/+4
| | | | | | | | | | | | | Most dmics produce a high level when they receive clock. The difference between power-on and memory record time is about 10ms, but the dmic needs 50ms to output normal data. This commit add 100ms delay after SoC output clock so that we can cut off the pop noise at the beginning. Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com> Link: https://lore.kernel.org/r/1564980997-11359-1-git-send-email-jiaxin.yu@mediatek.com Signed-off-by: Mark Brown <broonie@kernel.org>
* sound: soc: codecs: mt6358: change return type of mt6358_codec_init_regHariprasad Kelam2019-07-221-5/+1
| | | | | | | | | | | | | | As mt6358_codec_init_reg function always returns 0 , change return type from int to void. fixes below issue reported by coccicheck sound/soc/codecs/mt6358.c:2260:5-8: Unneeded variable: "ret". Return "0" on line 2289 Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com> Acked-by: Tzung-Bi Shih <tzungbi@google.com> Link: https://lore.kernel.org/r/20190709182543.GA6611@hari-Inspiron-1545 Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: mediatek: mt6358: save PGA for mixer controlTzung-Bi Shih2019-05-081-4/+29
| | | | | | | | | | mt6358_amic_disable() resets PGA to 0. Save the gain settings from mixer control and restore them when using the microphone. Signed-off-by: Tzung-Bi Shih <tzungbi@google.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: mediatek: mt6358: save output volume for mixer controlsTzung-Bi Shih2019-05-081-40/+51
| | | | | | | | | | | | | | | | | | | Output volume settings from mixer controls would be lost. Imagine that "Headphone Volume" has set to -10dB via amixer: - in mtk_hp_enable() - hp_store_gain() saves the volume setting -10dB from regmap_read() to ana_gain[AUDIO_ANALOG_VOLUME_HPOUTL] - headset_volume_ramp() ramps up from -10dB to -10dB - in mtk_hp_disable() - headset_volume_ramp() ramps down from -10dB to -40dB Next time in mtk_hp_enable(), hp_store_gain() would save -40dB but not -10dB. As a result, headset_volume_ramp() would ramp from -10dB to -40dB (which is mute). Signed-off-by: Tzung-Bi Shih <tzungbi@google.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: mediatek: mt6358: initialize setting when ramping volumeTzung-Bi Shih2019-05-081-4/+3
| | | | | | | | | | | | | Mt6358 ramps up from the smallest volume (i.e. -10dB) to target dB when opening and ramps down from target dB to mute (i.e. -40dB) when closing. If target is equal to -10dB when opening, headset_volume_ramp() simply leaves current setting (which may not be -10dB) unchanged. Execute the loop at least once to initialize the setting to the starting point (i.e. from). Signed-off-by: Tzung-Bi Shih <tzungbi@google.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: mediatek: mt6358: add codec driverShunli Wang2019-01-251-0/+2336
add the mt6358 codec driver. Signed-off-by: Shunli Wang <shunli.wang@mediatek.com> Signed-off-by: Mark Brown <broonie@kernel.org>