Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: da7213: Extend support for the MCK in range [2, 50] MHz

According to DA7212 HW manual, the codec's PLL input divider can operate
with MCLK range from 2MHz to 50MHz but current driver only set the
minimum supported MCLK frequency to 5MHz. That cause 11.025kHz audio
which is corresponding to MCLK of 2.8224MHz (11.025kHz * 256) unable to
play in case audio-simple-card is used.

Signed-off-by: Hao Bui <hao.bui.yg@renesas.com>
Co-developed-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://patch.msgid.link/20241106081826.1211088-27-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Hao Bui and committed by
Mark Brown
b3296f90 1e1a2ef9

+14 -5
+13 -5
sound/soc/codecs/da7213.c
··· 20 20 #include <sound/pcm.h> 21 21 #include <sound/pcm_params.h> 22 22 #include <linux/pm_runtime.h> 23 + #include <linux/units.h> 23 24 #include <sound/soc.h> 24 25 #include <sound/initval.h> 25 26 #include <sound/tlv.h> ··· 1560 1559 if (freq == 0) 1561 1560 return 0; 1562 1561 1563 - if (((freq < 5000000) && (freq != 32768)) || (freq > 54000000)) { 1562 + if (((freq < da7213->fin_min_rate) && (freq != 32768)) || (freq > 54000000)) { 1564 1563 dev_err(component->dev, "Unsupported MCLK value %d\n", 1565 1564 freq); 1566 1565 return -EINVAL; ··· 1859 1858 return 0; 1860 1859 } 1861 1860 1861 + #define DA7213_FIN_MIN_RATE (5 * MEGA) 1862 + #define DA7212_FIN_MIN_RATE (2 * MEGA) 1863 + 1862 1864 #if defined(CONFIG_OF) 1863 1865 /* DT */ 1864 1866 static const struct of_device_id da7213_of_match[] = { 1865 - { .compatible = "dlg,da7212", }, 1866 - { .compatible = "dlg,da7213", }, 1867 + { .compatible = "dlg,da7212", .data = (void *)DA7212_FIN_MIN_RATE }, 1868 + { .compatible = "dlg,da7213", .data = (void *)DA7213_FIN_MIN_RATE }, 1867 1869 { } 1868 1870 }; 1869 1871 MODULE_DEVICE_TABLE(of, da7213_of_match); ··· 1874 1870 1875 1871 #ifdef CONFIG_ACPI 1876 1872 static const struct acpi_device_id da7213_acpi_match[] = { 1877 - { "DLGS7212", 0}, 1878 - { "DLGS7213", 0}, 1873 + { "DLGS7212", DA7212_FIN_MIN_RATE }, 1874 + { "DLGS7213", DA7213_FIN_MIN_RATE }, 1879 1875 { }, 1880 1876 }; 1881 1877 MODULE_DEVICE_TABLE(acpi, da7213_acpi_match); ··· 2170 2166 da7213 = devm_kzalloc(&i2c->dev, sizeof(*da7213), GFP_KERNEL); 2171 2167 if (!da7213) 2172 2168 return -ENOMEM; 2169 + 2170 + da7213->fin_min_rate = (uintptr_t)i2c_get_match_data(i2c); 2171 + if (!da7213->fin_min_rate) 2172 + return -EINVAL; 2173 2173 2174 2174 i2c_set_clientdata(i2c, da7213); 2175 2175
+1
sound/soc/codecs/da7213.h
··· 600 600 struct clk *mclk; 601 601 unsigned int mclk_rate; 602 602 unsigned int out_rate; 603 + unsigned int fin_min_rate; 603 604 int clk_src; 604 605 bool master; 605 606 bool alc_calib_auto;