Query on sysclk source
Hi All,
I do have a query for snd_soc_dai_set_sysclk(). It takes 'clk_id' as argument which is used for sysclk source purpose in some drivers and in some it seems to be used for clock ID specifically. Please see below references.
- https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git/tree/sound/soc/atmel/sam9g20_wm8731.c#n105(clk_id as sysclk source)
- https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git/tree/sound/soc/atmel/sam9x5_wm8731.c#n50(clk_id as sysclk source)
- https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git/tree/sound/soc/intel/boards/bytcr_wm5102.c#n78(clk_id actually seems refer to specific clock id)
To add snd_soc_component_sysclk() takes both 'clk_id' and 'source' arguments.
Currently snd_soc_dai_set_sysclk() has following implementation.
------------------------------------------------------------------
/ int snd_soc_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id,// // unsigned int freq, int dir)//
// {//
// int ret;//
//
// if (dai->driver->ops &&// //dai->driver->ops->set_sysclk)//
// ret = dai->driver->ops->set_sysclk(dai, clk_id, freq, dir);// // else//
// ret = snd_soc_component_set_sysclk(dai->component, clk_id, 0,// // freq, dir);//
//
// return soc_dai_ret(dai, ret);//
// }/
-------------------------------------------------------------------
The 'source' for snd_soc_component_set_sysclk() is hardcoded to 0 always, which may not be the case always. Please see below.
- https://elixir.bootlin.com/linux/v5.11/source/sound/soc/samsung/bells.c#L161
Hence I am wondering if 'clk_id' argument is being used inconsistently for snd_soc_dai_set_sysclk() and should we rather have a separate 'source' argument for this as well?
Thanks,
Sameer.
Quoted 3 lines · Sameer Pujar
Hence I am wondering if '
clk_id' argument is being used inconsistently forsnd_soc_dai_set_sysclk()and should we rather have a separate 'source' argument for this as well?
Yeah, we should in case someone wants to use it with one of the few devices with selectable sources implemented.