summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/max9867.c
AgeCommit message (Collapse)AuthorFilesLines
2024-05-03ASoC: codecs: Drop explicit initialization of struct ↵Uwe Kleine-König1-1/+1
i2c_device_id::driver_data to 0 These drivers don't use the driver_data member of struct i2c_device_id, so don't explicitly initialize this member. This prepares putting driver_data in an anonymous union which requires either no initialization or named designators. But it's also a nice cleanup on its own. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20240502074722.1103986-2-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2023-10-26ASoC: codecs: max9867: Handle component name prefixKrzysztof Kozlowski1-4/+4
Use snd_soc_dapm_widget_name_cmp() helper when comparing widget names, to include also the component's name prefix. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Reviewed-by: Nuno Sa <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20231023095428.166563-6-krzysztof.kozlowski@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-05-08ASoC: Switch i2c drivers back to use .probe()Uwe Kleine-König1-1/+1
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
2023-03-06ASoC: maxim,max9867: add "mclk" supportBenjamin Bara1-2/+17
Add basic support for the codecs' mclk. Enable it on SND_SOC_BIAS_ON, disable it on SND_SOC_BIAS_OFF. Signed-off-by: Benjamin Bara <benjamin.bara@skidata.com> Signed-off-by: Richard Leitner <richard.leitner@skidata.com> Link: https://lore.kernel.org/r/20230302-max9867-v2-3-fd2036d5e825@skidata.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-11-28ASoC: max9867: Implement exact integer modePavel Dobias1-3/+30
For 8kHz and 16kHz sample rates and certain PCLK values the codec can be programmed to operate in exact integer mode. If available, use it to achieve the exact sample rate. Signed-off-by: Pavel Dobias <dobias@2n.com> Link: https://lore.kernel.org/r/20221123153818.24650-1-dobias@2n.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-27ASoC: max*: Remove now redundant non_legacy_dai_naming flagCharles Keepax1-1/+0
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-53-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-04-11ASoC: max9*: use simple i2c probe functionStephen Kitt1-3/+2
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/20220405165836.2165310-6-steve@sk2.org Signed-off-by: Mark Brown <broonie@kernel.org>
2022-02-28ASoC: max9867: Use modern ASoC DAI format terminologyMark Brown1-7/+7
As part of moving to remove the old style defines for the bus clocks update the max9867 driver to use more modern terminology for clocking. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20220222234026.712070-7-broonie@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-21ASoC: max*: sync parameter naming (rate/sample_bits)Kuninori Morimoto1-1/+1
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/8735z2olg5.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-26ASoC: max9867: skip of_device_id table when !CONFIG_OFKrzysztof Kozlowski1-0/+2
The driver can match by multiple methods. Its of_device_id table is referenced via of_match_ptr() so it will be unused for !CONFIG_OF builds: sound/soc/codecs/max9867.c:652:34: warning: ‘max9867_of_match’ defined but not used [-Wunused-const-variable=] Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Link: https://lore.kernel.org/r/20201125164452.89239-25-krzk@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-27ASoC: max9867: shutdown codec when changing filter typePavel Dobias1-14/+117
Changing filter type without disabling codec results in filter malfunction. Disable codec when changing filter type. Signed-off-by: Pavel Dobias <dobias@2n.cz> Link: https://lore.kernel.org/r/20200827102528.29677-1-dobias@2n.cz Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-17ASoC: codecs: max*: merge .digital_mute() into .mute_stream()Kuninori Morimoto1-2/+3
snd_soc_dai_digital_mute() is internally using both mute_stream() (1) or digital_mute() (2), but the difference between these 2 are only handling direction. We can merge digital_mute() into mute_stream int snd_soc_dai_digital_mute(xxx, int direction) { ... else if (dai->driver->ops->mute_stream) (1) return dai->driver->ops->mute_stream(xxx, direction); else if (direction == SNDRV_PCM_STREAM_PLAYBACK && dai->driver->ops->digital_mute) (2) return dai->driver->ops->digital_mute(xxx); ... } Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Reviewed-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Link: https://lore.kernel.org/r/87y2ntwix0.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-06-01Merge remote-tracking branch 'asoc/for-5.8' into asoc-linusMark Brown1-38/+51
2020-05-22ASoC: max9867: keep ADCs and DACs always onPavel Dobias1-10/+9
Updating power management register requires toggling the shutdown bit otherwise it causes unexpected behavior of the codec. However, toggling the shutdown bit results in loud speaker crackling. Setup the power management register only at startup to avoid that. Signed-off-by: Pavel Dobias <dobias@2n.cz> Link: https://lore.kernel.org/r/20200522142957.18364-3-dobias@2n.cz Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-22ASoC: max9867: add digital microphone controlsPavel Dobias1-2/+24
MAX9867 codec has a possibility of connecting digital microphones. Add DAPM controls to be able to enable them. Signed-off-by: Pavel Dobias <dobias@2n.cz> Link: https://lore.kernel.org/r/20200522142957.18364-2-dobias@2n.cz Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-20ASoC: max9867: add mono playback switchPavel Dobias1-1/+3
Add Mono Playback switch to codec controls which enables codec's capability of mixing left and right channel at the DAC output. Signed-off-by: Pavel Dobias <dobias@2n.cz> Link: https://lore.kernel.org/r/20200520071904.15801-5-dobias@2n.cz Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-20ASoC: max9867: add filter controlsPavel Dobias1-0/+15
Adding missing codec controls - ADC/DAC IIR filter selection. Signed-off-by: Pavel Dobias <dobias@2n.cz> Link: https://lore.kernel.org/r/20200520071904.15801-3-dobias@2n.cz Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-20ASoC: max9867: don't use regmap defaultsPavel Dobias1-25/+0
MAX9867 codec doesn't have reset pin, so the registers don't have default values in the case of reboot without powering off. Remove the reg_defaults struct and let the regmap read initial state of the registers at startup instead of taking them from reg_defaults struct. Signed-off-by: Pavel Dobias <dobias@2n.cz> Link: https://lore.kernel.org/r/20200520071904.15801-2-dobias@2n.cz Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-20ASoC: max9867: fix ADC level controlPavel Dobias1-1/+1
Fix swapped channels in ADC level control. Signed-off-by: Pavel Dobias <dobias@2n.cz> Link: https://lore.kernel.org/r/20200520071904.15801-1-dobias@2n.cz Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-18ASoC: max9867: fix volume controlsPavel Dobias1-2/+2
The xmax values for Master Playback Volume and Mic Boost Capture Volume are specified incorrectly (one greater) which results in the wrong dB gain being shown to the user in the case of Master Playback Volume. Signed-off-by: Pavel Dobias <dobias@2n.cz> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20200515120757.24669-1-dobias@2n.cz Signed-off-by: Mark Brown <broonie@kernel.org>
2018-12-07ASoC: max9867: Add copyright and module authorLadislav Michl1-11/+9
Driver rewritten, assign copyright notice and change module author as original one remains silent and I want to be notified about bugs. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-12-07ASoC: max9867: Fix signal pathsLadislav Michl1-88/+100
Sound capture and line bypass currently do not work as well as some mixer controls. Fix that by building proper audio paths and adjusting volume controls to match datasheet. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-12-07ASoC: max9867: Calculate LRCLK dividerLadislav Michl1-108/+99
Drop "Common NI Values Table" and calculate LRCLK divider, then add allowed rate constraints based on master clock frequency. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-12-07ASoC: max9867: Fix power managementLadislav Michl1-27/+45
Implement set_bias_level to drive shutdown bit, so device is put to sleep when unused. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-12-07ASoC: max9867: Remove useless assignmentLadislav Michl1-4/+2
ret is assigned later, no need to initialize it. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-11-26ASoC: max9867: Fix whitespaceLadislav Michl1-7/+5
Minor changes to match coding style. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-03-02ASoC: max9867: Drop probe functionLadislav Michl1-10/+0
Driver probe function has no use and can be deleted. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-03-02Merge branch 'topic/wm9867' of ↵Mark Brown1-35/+30
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-max9867
2018-03-01ASoC: max9867: DSP modeLadislav Michl1-4/+10
Add configuration for DSP mode. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-03-01ASoC: max9867: Fix codec capabilitiesLadislav Michl1-2/+3
Codes is stereo only with playback and capture streams bind to the same rate. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-03-01ASoC: max9867: Improve error loggingLadislav Michl1-3/+4
Tell user what are clock rate limits and reindent log messages. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-02-12ASoC: wm9867: replace codec to componentKuninori Morimoto1-35/+30
Now we can replace Codec to Component. Let's do it. Note: xxx_codec_xxx() -> xxx_component_xxx() .idle_bias_off = 0 -> .idle_bias_on = 1 .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-18ASoC: codecs: constify snd_soc_dai_ops structuresArvind Yadav1-1/+1
snd_soc_dai_ops are not supposed to change at runtime. All functions working with snd_soc_dai_ops provided by <sound/soc-dai.h> work with const snd_soc_dai_ops. So mark the non-const structs as const. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.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-06-22ASoC: max9867: make array ni_div static constColin Ian King1-1/+1
The array ni_div does not need to be in global scope and is not modified, so make it static const. Cleans up sparse warning: "symbol 'ni_div' was not declared. Should it be static?" Signed-off-by: Colin Ian King <colin.king@canonical.com> Acked-By: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-04-30Merge remote-tracking branches 'asoc/topic/max9878', 'asoc/topic/max98927', ↵Mark Brown1-2/+2
'asoc/topic/mtk' and 'asoc/topic/nau8540' into asoc-next
2017-04-05ASoC: max9867: export OF device ID as module aliasesJavier Martinez Canillas1-2/+2
The I2C core always reports a MODALIAS of the form i2c:<foo> even if the device was registered via OF, this means that exporting the OF device ID table device aliases in the module is not needed. But in order to change how the core reports modaliases to user-space, it's better to export it. While there, move the MODULE_DEVICE_TABLE(i2c, max9867_i2c_id) just next to the I2C device table declaration, for consistency with other drivers. Before this patch: $ modinfo sound/soc/codecs/snd-soc-max9867.ko | grep alias alias: i2c:max9867 After this patch: $ modinfo sound/soc/codecs/snd-soc-max9867.ko | grep alias alias: i2c:max9867 alias: of:N*T*Cmaxim,max9867C* alias: of:N*T*Cmaxim,max9867 Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-12-15ASoC: max9867: remove unused ‘ret’Vinod Koul1-3/+2
In max9867_dai_set_fmt(), 'ret' is initialized as return value of regmap_raw_write() but never checked, so remove this and assignement. sound/soc/codecs/max9867.c: In function ‘max9867_dai_set_fmt’: sound/soc/codecs/max9867.c:312:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable] int ret; Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-29Merge remote-tracking branches 'asoc/topic/max98371', 'asoc/topic/max9867', ↵Mark Brown1-3/+2
'asoc/topic/max98926' and 'asoc/topic/mtk' into asoc-next
2016-09-28ASoC: max9867: remove usage of obsoleted TLV-related macroTakashi Sakamoto1-3/+2
TLV_DB_RANGE_HEAD macro was obsoleted by commit bf1d1c9b6179 ("ALSA: tlv: add DECLARE_TLV_DB_RANGE()"). This commit removes usage of the macro, with the obsoleting macro renamed to SNDRV_CTL_TLVD_DECLARE_DB_RANGE(). Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-08-08ASoC: codec duplicated callback function goes to component on wm9867Kuninori 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-06-22ASoC: max9867: Fix unix permissions for source files.Enric Balletbo i Serra1-0/+0
Change file permissions of source files max9867.c/h from 0755 to 0644. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-02-26ASoC: max9867: silence and array overflow warningDan Carpenter1-0/+2
Smatch complains that we might reach the end of this loop without finding what we're looking for leading to a buffer overflow. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-02-24ASoC: max9867: Use params_width instead of open-codedAxel Lin1-3/+2
Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: anish kumar <yesanishhere@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-02-24ASoC: max9867: fix type of variable containing error codesAndrzej Hajda1-1/+2
value variable can contain error values and is compared with zero. Its type must be signed. The problem has been detected using coccinelle script scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci Signed-off-by: Andrzej Hajda <a.hajda@samsung.com> Reviewed-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-02-20ASoC: max9867: Constify max9867_reg and max9867_regmapAxel Lin1-2/+2
Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: anish kumar <yesanishhere@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-02-20ASoC: max9867: Make max9867_i2c_id NULL terminatedAxel Lin1-0/+1
Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: anish kumar <yesanishhere@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-02-18ASoC: max9867: Changed the if-else case to switch caseanish kumar1-6/+12
Signed-off-by: anish kumar <yesanishhere@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-02-18ASoC: Add max9867 codec driveranish kumar1-0/+537
Signed-off-by: anish kumar <yesanishhere@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>