Add support for Rpi4b + Cirrus Lochnagar2 and CS47L15
Subsystems (8)
Richard Fitzgerald
maintainerPATCH v4 1/6 of: base: Add of_count_phandle_with_fixed_args()
In reply to Richard FitzgeraldAdd an equivalent of of_count_phandle_with_args() for fixed argument sets, to pair with of_parse_phandle_with_fixed_args().
The existing of_count_phandle_with_args() is modified to be a private function that handles both cases and the public functions are trivial wrappers round that.
--- drivers/of/base.c | 73 +++++++++++++++++++++++++++++++--------------- include/linux/of.h | 9 ++++++ 2 files changed, 59 insertions(+), 23 deletions(-)
drivers/of/base.c +50 -23
@@ -1720,34 +1720,22 @@ int of_parse_phandle_with_fixed_args(const struct device_node *np, }EXPORT_SYMBOL (of_parse_phandle_with_fixed_args); -/** -* of_count_phandle_with_args() - Find the number of phandles references in a property -* @np: pointer to a device tree node containing a list -* @list_name: property name that contains a list -* @cells_name: property name that specifies phandles' arguments count -* -* Returns the number of phandle + argument tuples within a property. It -* is a typical pattern to encode a list of phandle and variable -* arguments into a single property. The number of arguments is encoded -* by a property in the phandle-target node. For example, a gpios -* property would contain a list of GPIO specifies consisting of a -* phandle and 1 or more arguments. The number of arguments are -* determined by the #gpio-cells property in the node pointed to by the -* phandle. -*/ -int of_count_phandle_with_args (const struct device_node *np,const char *list_name, -const char *cells_name) +static int __of_count_phandle_with_args (const struct device_node *np, +const char *list_name, +const char *cells_name, +int cells_count) {struct of_phandle_iterator it;int rc, cur_index =0 ;/* -* If cells_name is NULL we assume a cell count of 0. This makes -* counting the phandles trivial as each 32bit word in the list is a -* phandle and no arguments are to consider. So we don't iterate through -* the list but just use the length to determine the phandle count. +* If cells_count < 0 and cells_name is NULL we assume a cell count +* of 0. A zero cell count makes counting the phandles trivial as each +* 32bit word in the list is a phandle and no arguments are to consider. +* So we don't iterate through the list but just use the length to +* determine the phandle count. */ -if (!cells_name) { +if ((cells_count <0 && !cells_name) || cells_count ==0 ) {const __be32 *list;int size;
@@ -1758,7 +1746,7 @@ int of_count_phandle_with_args(const struct device_node *np, const char *list_nareturn size /sizeof (*list); } - rc =of_phandle_iterator_init (&it, np, list_name, cells_name,-1 ); + rc =of_phandle_iterator_init (&it, np, list_name, cells_name, cells_count);if (rc)return rc;
@@ -1770,8 +1758,47 @@ int of_count_phandle_with_args(const struct device_node *np, const char *list_nareturn cur_index; } + +/** +* of_count_phandle_with_args() - Find the number of phandles references in a property +* @np: pointer to a device tree node containing a list +* @list_name: property name that contains a list +* @cells_name: property name that specifies phandles' arguments count +* +* Returns the number of phandle + argument tuples within a property. It +* is a typical pattern to encode a list of phandle and variable +* arguments into a single property. The number of arguments is encoded +* by a property in the phandle-target node. For example, a gpios +* property would contain a list of GPIO specifies consisting of a +* phandle and 1 or more arguments. The number of arguments are +* determined by the #gpio-cells property in the node pointed to by the +* phandle. +*/ +int of_count_phandle_with_args (const struct device_node *np,const char *list_name, +const char *cells_name) +{ +return __of_count_phandle_with_args (np, list_name, cells_name,-1 ); +}EXPORT_SYMBOL (of_count_phandle_with_args); +/** +* of_count_phandle_with_fixed_args() - Find the number of phandles references in a property +* @np: pointer to a device tree node containing a list +* @list_name: property name that contains a list +* @cell_count: number of argument cells following the phandle +* +* Returns the number of phandle + argument tuples within a property. It +* is a typical pattern to encode a list of phandle and variable +* arguments into a single property. +*/ +int of_count_phandle_with_fixed_args (const struct device_node *np, +const char *list_name, +int cells_count) +{ +return __of_count_phandle_with_args (np, list_name,NULL , cells_count); +} +EXPORT_SYMBOL (of_count_phandle_with_fixed_args); +/** * __of_add_property - Add a property to a node without lock operations */
include/linux/of.h +9 -0
@@ -377,6 +377,8 @@ extern int of_parse_phandle_with_fixed_args(const struct device_node *np, struct of_phandle_args *out_args);extern int of_count_phandle_with_args (const struct device_node *np,const char *list_name,const char *cells_name); +extern int of_count_phandle_with_fixed_args (const struct device_node *np, +const char *list_name,int cells_count);/* phandle iterator functions */ extern int of_phandle_iterator_init(struct of_phandle_iterator *it,
@@ -888,6 +890,13 @@ static inline int of_count_phandle_with_args(struct device_node *np,return -ENOSYS ; } +static inline int of_count_phandle_with_fixed_args (const struct device_node *np, +const char *list_name, +int cells_count) +{ +return -ENOSYS ; +} + static inline int of_phandle_iterator_init(struct of_phandle_iterator *it, const struct device_node *np, const char *list_name,
Signature · 1 line
2.20.1
Richard Fitzgerald
maintainerv4 cover Add support for Rpi4b + Cirrus Lochnagar2 and CS47L15
This set of patches provides support for using the Raspberry Pi 4b with a Cirrus Logic Lochnagar 2 audio development platform plus Cirrus Logic CS47L15 codec.
Patches are needed to audio-graph-card to enable support for setting the component sysclks and plls. These are not specific to CS47L15 - several Cirrus and non-Cirrus codecs also require component clock setup, typically for larger codecs with multiple internal clocking options and clock domains.
The codec sysclks and plls cannot be placed under the clock framework because they are typically I2C/SPI/Soundwire-connected peripherals and access to the registers would cause a nested get of the bus clock. The clock framework does not support this and it would result in a deadlock.
Richard Fitzgerald (6):
of: base: Add of_count_phandle_with_fixed_args()
dt-bindings: audio-graph-card: Add plls and sysclks properties
ASoC: audio-graph-card: Support setting component plls and sysclks
ASoC: madera: Allow codecs to be selected from kernel config
ASoC: madera: Export clock config defines to dt-bindings
ARM: dts: Add dts for RPi4b + Cirrus Logic Lochnagar2 + CS47L15
.../bindings/sound/audio-graph.yaml | 46 ++++ MAINTAINERS | 1 + arch/arm/boot/dts/Makefile | 1 + .../dts/bcm2711-rpi-4-b-lochnagar-cs47l15.dts | 186 ++++++++++++++ .../boot/dts/bcm2711-rpi-4-b-lochnagar.dtsi | 201 +++++++++++++++ drivers/of/base.c | 73 ++++-- include/dt-bindings/sound/madera.h | 60 +++++ include/linux/of.h | 9 + include/sound/simple_card_utils.h | 25 ++ sound/soc/codecs/Kconfig | 10 +- sound/soc/codecs/madera.h | 56 +---- sound/soc/generic/audio-graph-card.c | 13 + sound/soc/generic/simple-card-utils.c | 238 ++++++++++++++++++ 13 files changed, 836 insertions(+), 83 deletions(-) create mode 100644 arch/arm/boot/dts/bcm2711-rpi-4-b-lochnagar-cs47l15.dts create mode 100644 arch/arm/boot/dts/bcm2711-rpi-4-b-lochnagar.dtsi
Signature · 1 line
2.20.1
Richard Fitzgerald
maintainerPATCH v4 2/6 dt-bindings: audio-graph-card: Add plls and sysclks properties
The audio-graph-card driver has properties for configuring the clocking for DAIs within a component, but is missing properties for setting up the PLLs and sysclks of the component.
This patch adds the two new properties 'plls' and 'sysclks' so that the audio-graph-driver can fully configure the component clocking.
--- .../bindings/sound/audio-graph.yaml | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+)
Documentation/devicetree/bindings/sound/audio-graph.yaml +46 -0
@@ -39,6 +39,52 @@ properties: mic-det-gpio: maxItems: 1 + plls: + description: | + A list of component pll settings. There are 4 cells per PLL setting: + - phandle to the node of the codec or cpu component, + - component PLL id, + - component clock source id, + - frequency (in Hz) of the PLL output clock. + The PLL id and clock source id are specific to the particular component + so see the relevant component driver for the ids. Typically the + clock source id indicates the pin the source clock is connected to. + The same phandle can appear in multiple entries so that several plls + can be set in the same component. + $ref: /schemas/types.yaml#/definitions/phandle-array + + plls-clocks: + $ref: /schemas/types.yaml#/definitions/non-unique-string-array + description: | + A list of clock names giving the source clock for each setting + in the plls property. + + sysclks: + description: | + A list of component sysclk settings. There are 4 cells per sysclk + setting: + - phandle to the node of the codec or cpu component, + - component sysclk id, + - component clock source id, + - direction of the clock: 0 if the clock is an input to the component, + 1 if it is an output. + The sysclk id and clock source id are specific to the particular + component so see the relevant component driver for the ids. Typically + the clock source id indicates the pin the source clock is connected to. + The same phandle can appear in multiple entries so that several sysclks + can be set in the same component. + $ref: /schemas/types.yaml#/definitions/phandle-array + + sysclks-clocks: + $ref: /schemas/types.yaml#/definitions/non-unique-string-array + description: | + A list of clock names giving the source clock for each setting + in the sysclks property. + +dependencies: + plls: [ plls-clocks ] + sysclks: [ sysclks-clocks ] + required: - dais
Signature · 1 line
2.20.1
Richard Fitzgerald
maintainerPATCH v4 3/6 ASoC: audio-graph-card: Support setting component plls and sysclks
In reply to Richard FitzgeraldSome codecs need plls and/or sysclks to be configured using the snd_soc_component_set_[sysclk|pll] functions. These drivers cannot necessarily be converted to use the clock framework. If the codec is on a I2C/SPI bus, a nested clk_get would be needed to enable the bus clock. But the clock framework does not support nested operations and this would deadlock.
This patch adds new dt properties that list phandles of components with the pll/sysclk settings to be applied. Multiple settings can be given for the same phandle to allow for components with multiple clocks and plls. The plls and sysclks are enabled when the card bias level moves to STANDBY and disabled when it moves to OFF.
The implementation does not attempt to handle specifying complex clock ordering interdependencies between components. The plls and sysclks are applied to a component as it is passed to the card set_bias_level/ set_bias_level_post callbacks. It follows from this that the order components are configured is the order that they are passed to those callbacks.
--- include/sound/simple_card_utils.h | 25 +++ sound/soc/generic/audio-graph-card.c | 13 ++ sound/soc/generic/simple-card-utils.c | 238 ++++++++++++++++++++++++++ 3 files changed, 276 insertions(+)
include/sound/simple_card_utils.h +25 -0
@@ -38,6 +38,16 @@ struct asoc_simple_jack {struct snd_soc_jack_gpio gpio; }; +struct asoc_simple_sysclk_pll { +struct device_node *node; +struct clk *clk; +int id; +int source; +unsigned int freq_out; +int dir; +bool enabled; +}; + struct asoc_simple_priv { struct snd_soc_card snd_card; struct simple_dai_props {
@@ -59,6 +69,11 @@ struct asoc_simple_priv {const struct snd_soc_ops *ops; unsigned int dpcm_selectable:1; unsigned int force_dpcm:1; + +struct asoc_simple_sysclk_pll *sysclks; +int num_sysclks; +struct asoc_simple_sysclk_pll *plls; +int num_plls; };#define simple_priv_to_card (priv) (&(priv)->snd_card)#define simple_priv_to_props (priv, i) ((priv)->dai_props + (i))
@@ -97,6 +112,14 @@ void asoc_simple_shutdown(struct snd_pcm_substream *substream);int asoc_simple_hw_params (struct snd_pcm_substream *substream,struct snd_pcm_hw_params *params);int asoc_simple_dai_init (struct snd_soc_pcm_runtime *rtd); + +int asoc_simple_set_bias_level (struct snd_soc_card *card, +struct snd_soc_dapm_context *dapm, +enum snd_soc_bias_level level); +int asoc_simple_set_bias_level_post (struct snd_soc_card *card, +struct snd_soc_dapm_context *dapm, +enum snd_soc_bias_level level); +int asoc_simple_be_hw_params_fixup (struct snd_soc_pcm_runtime *rtd,struct snd_pcm_hw_params *params);
@@ -131,6 +154,8 @@ int asoc_simple_parse_widgets(struct snd_soc_card *card, char *prefix);int asoc_simple_parse_pin_switches (struct snd_soc_card *card,char *prefix); +int asoc_simple_parse_sysclks (struct asoc_simple_priv *priv,char *prefix); +int asoc_simple_parse_plls (struct asoc_simple_priv *priv,char *prefix); int asoc_simple_init_jack(struct snd_soc_card *card, struct asoc_simple_jack *sjack,
sound/soc/generic/audio-graph-card.c +13 -0
@@ -592,6 +592,19 @@ int graph_parse_of(struct asoc_simple_priv *priv, struct device *dev)snd_soc_card_set_drvdata (card, priv); + ret =asoc_simple_parse_sysclks (priv,NULL ); +if (ret <0 ) + goto err; + + ret =asoc_simple_parse_plls (priv,NULL ); +if (ret <0 ) + goto err; + +if (priv->num_sysclks || priv->num_plls) { + card->set_bias_level = asoc_simple_set_bias_level; + card->set_bias_level_post = asoc_simple_set_bias_level_post; + } +asoc_simple_debug_info (priv); ret =devm_snd_soc_register_card (dev, card);
sound/soc/generic/simple-card-utils.c +238 -0
262 lines not on this page · raw message
Signature · 1 line
2.20.1
Richard Fitzgerald
maintainerPATCH v4 4/6 ASoC: madera: Allow codecs to be selected from kernel config
In reply to Richard FitzgeraldThe codec Kconfig options were hidden and intended to be selected by the machine driver that requires them. But that means having either a dedicated machine driver or building all codecs.
This patch makes the Kconfig options visible so that they can be selected independently of the machine driver, allowing the codec to be used with simple-card and other machine drivers that are not hardcoded to use a fixed set of codecs.
--- sound/soc/codecs/Kconfig | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
sound/soc/codecs/Kconfig +5 -5
@@ -678,23 +678,23 @@ config SND_SOC_CS4349 depends on I2C config SND_SOC_CS47L15 - tristate + tristate "Cirrus Logic CS47L15 CODEC" config SND_SOC_CS47L24 tristate depends on MFD_CS47L24 config SND_SOC_CS47L35 - tristate + tristate "Cirrus Logic CS47L35 CODEC" config SND_SOC_CS47L85 - tristate + tristate "Cirrus Logic CS47L85 CODEC" config SND_SOC_CS47L90 - tristate + tristate "Cirrus Logic CS47L90 CODEC" config SND_SOC_CS47L92 - tristate + tristate "Cirrus Logic CS47L92 CODEC" # Cirrus Logic Quad-Channel ADC config SND_SOC_CS53L30
Signature · 1 line
2.20.1
Richard Fitzgerald
maintainerPATCH v4 6/6 ARM: dts: Add dts for RPi4b + Cirrus Logic Lochnagar2 + CS47L15
In reply to Richard FitzgeraldThis adds a devicetree configuration for Raspberry Pi 4b connected to Cirrus Logic Lochnagar 2 audio development board and CS47L15 codec.
The common (codec-independent) Lochnagar 2 configuration is separated into a dtsi to simplify re-using it for other codecs.
--- MAINTAINERS | 1 + arch/arm/boot/dts/Makefile | 1 + .../dts/bcm2711-rpi-4-b-lochnagar-cs47l15.dts | 186 ++++++++++++++++ .../boot/dts/bcm2711-rpi-4-b-lochnagar.dtsi | 201 ++++++++++++++++++ 4 files changed, 389 insertions(+) create mode 100644 arch/arm/boot/dts/bcm2711-rpi-4-b-lochnagar-cs47l15.dts create mode 100644 arch/arm/boot/dts/bcm2711-rpi-4-b-lochnagar.dtsi
MAINTAINERS +1 -0
@@ -4233,6 +4233,7 @@ M: Charles Keepax <[email protected]> M: Richard Fitzgerald <[email protected]> L: [email protected] S: Supported +F: arch/arm/boot/dts/bcm2711-rpi-4-b-lochnagar* F: Documentation/devicetree/bindings/clock/cirrus,lochnagar.yaml F: Documentation/devicetree/bindings/hwmon/cirrus,lochnagar.yaml F: Documentation/devicetree/bindings/mfd/cirrus,lochnagar.yaml
arch/arm/boot/dts/Makefile +1 -0
@@ -93,6 +93,7 @@ dtb-$(CONFIG_ARCH_BCM2835) += \ bcm2837-rpi-3-b-plus.dtb \ bcm2837-rpi-cm3-io3.dtb \ bcm2711-rpi-4-b.dtb \ + bcm2711-rpi-4-b-lochnagar-cs47l15.dtb \ bcm2835-rpi-zero.dtb \ bcm2835-rpi-zero-w.dtb dtb-$(CONFIG_ARCH_BCM_5301X) += \
arch/arm/boot/dts/bcm2711-rpi-4-b-lochnagar-cs47l15.dts new file +186 -0
186 lines not on this page · raw message
arch/arm/boot/dts/bcm2711-rpi-4-b-lochnagar.dtsi new file +201 -0
201 lines not on this page · raw message
Signature · 1 line
2.20.1
Richard Fitzgerald
maintainerPATCH v4 5/6 ASoC: madera: Export clock config defines to dt-bindings
In reply to Richard FitzgeraldMove the defines for clock/fll IDs and sources into the dt-bindings header so that they can be used by machine driver dts files.
--- include/dt-bindings/sound/madera.h | 60 ++++++++++++++++++++++++++++++ sound/soc/codecs/madera.h | 56 +--------------------------- 2 files changed, 61 insertions(+), 55 deletions(-)
include/dt-bindings/sound/madera.h +60 -0
@@ -22,4 +22,64 @@#define CS47L35_DMIC_REF_MICBIAS2A 2#define CS47L35_DMIC_REF_MICBIAS2B 3 +/* FLL IDs */ +#define MADERA_FLL1_REFCLK 1 +#define MADERA_FLL2_REFCLK 2 +#define MADERA_FLL3_REFCLK 3 +#define MADERA_FLLAO_REFCLK 4 +#define MADERA_FLL1_SYNCCLK 5 +#define MADERA_FLL2_SYNCCLK 6 +#define MADERA_FLL3_SYNCCLK 7 +#define MADERA_FLLAO_SYNCCLK 8 + +/* FLL input source pin IDs */ +#define MADERA_FLL_SRC_NONE -1 +#define MADERA_FLL_SRC_MCLK1 0 +#define MADERA_FLL_SRC_MCLK2 1 +#define MADERA_FLL_SRC_MCLK3 2 +#define MADERA_FLL_SRC_SLIMCLK 3 +#define MADERA_FLL_SRC_FLL1 4 +#define MADERA_FLL_SRC_FLL2 5 +#define MADERA_FLL_SRC_AIF1BCLK 8 +#define MADERA_FLL_SRC_AIF2BCLK 9 +#define MADERA_FLL_SRC_AIF3BCLK 10 +#define MADERA_FLL_SRC_AIF4BCLK 11 +#define MADERA_FLL_SRC_AIF1LRCLK 12 +#define MADERA_FLL_SRC_AIF2LRCLK 13 +#define MADERA_FLL_SRC_AIF3LRCLK 14 +#define MADERA_FLL_SRC_AIF4LRCLK 15 + +/* SYSCLK IDs */ +#define MADERA_CLK_SYSCLK_1 1 +#define MADERA_CLK_ASYNCCLK_1 2 +#define MADERA_CLK_OPCLK 3 +#define MADERA_CLK_ASYNC_OPCLK 4 +#define MADERA_CLK_SYSCLK_2 5 +#define MADERA_CLK_SYSCLK_3 6 +#define MADERA_CLK_ASYNCCLK_2 7 +#define MADERA_CLK_DSPCLK 8 +#define MADERA_CLK_OUTCLK 9 + +/* SYSCLK source IDs */ +#define MADERA_CLK_SRC_MCLK1 0x0 +#define MADERA_CLK_SRC_MCLK2 0x1 +#define MADERA_CLK_SRC_MCLK3 0x2 +#define MADERA_CLK_SRC_FLL1 0x4 +#define MADERA_CLK_SRC_FLL2 0x5 +#define MADERA_CLK_SRC_FLL3 0x6 +#define MADERA_CLK_SRC_FLLAO_HI 0x7 +#define MADERA_CLK_SRC_FLL1_DIV6 0x7 +#define MADERA_CLK_SRC_AIF1BCLK 0x8 +#define MADERA_CLK_SRC_AIF2BCLK 0x9 +#define MADERA_CLK_SRC_AIF3BCLK 0xA +#define MADERA_CLK_SRC_AIF4BCLK 0xB +#define MADERA_CLK_SRC_FLLAO 0xF + +/* OPCLK source IDs */ +#define MADERA_OUTCLK_SYSCLK 0 +#define MADERA_OUTCLK_ASYNCCLK 1 +#define MADERA_OUTCLK_MCLK1 4 +#define MADERA_OUTCLK_MCLK2 5 +#define MADERA_OUTCLK_MCLK3 6 +#endif
sound/soc/codecs/madera.h +1 -55
68 lines not on this page · raw message
Signature · 1 line
2.20.1
Kuninori Morimoto
maintainerRe: [PATCH v4 3/6] ASoC: audio-graph-card: Support setting component plls and sysclks
In reply to Richard FitzgeraldHi Richard
Quoted 20 lines
Some codecs need plls and/or sysclks to be configured using the snd_soc_component_set_[sysclk|pll] functions. These drivers cannot necessarily be converted to use the clock framework. If the codec is on a I2C/SPI bus, a nested
clk_getwould be needed to enable the bus clock. But the clock framework does not support nested operations and this would deadlock.This patch adds new dt properties that list phandles of components with the pll/sysclk settings to be applied. Multiple settings can be given for the same phandle to allow for components with multiple clocks and plls. The plls and sysclks are enabled when the card bias level moves to STANDBY and disabled when it moves to OFF.
The implementation does not attempt to handle specifying complex clock ordering interdependencies between components. The plls and sysclks are applied to a component as it is passed to the card set_bias_level/
set_bias_level_postcallbacks. It follows from this that the order components are configured is the order that they are passed to those callbacks.
Quoted 2 lines
Signed-off-by Richard Fitzgerald <[email protected]>---
As I mentioned in v3, adding *general* pll to common card driver is maybe difficult.
Using your own customized audio-graph-card driver is better idea, instead of adding code to common driver.
I think Sameer's Tegra driver (= [3/6]) is good sample for you ?
https://lore.kernel.org/r/[email protected]
Thank you for your help !!
Best regards
---
Kuninori Morimoto
Richard Fitzgerald
maintainerRe: [PATCH v4 3/6] ASoC: audio-graph-card: Support setting component plls and sysclks
Quoted 23 lines · Kuninori Morimoto
Hi Richard
Quoted 20 lines
Some codecs need plls and/or sysclks to be configured using the snd_soc_component_set_[sysclk|pll] functions. These drivers cannot necessarily be converted to use the clock framework. If the codec is on a I2C/SPI bus, a nested
clk_getwould be needed to enable the bus clock. But the clock framework does not support nested operations and this would deadlock.This patch adds new dt properties that list phandles of components with the pll/sysclk settings to be applied. Multiple settings can be given for the same phandle to allow for components with multiple clocks and plls. The plls and sysclks are enabled when the card bias level moves to STANDBY and disabled when it moves to OFF.
The implementation does not attempt to handle specifying complex clock ordering interdependencies between components. The plls and sysclks are applied to a component as it is passed to the card set_bias_level/
set_bias_level_postcallbacks. It follows from this that the order components are configured is the order that they are passed to those callbacks.
Quoted 5 lines
Quoted 2 lines
Signed-off-by Richard Fitzgerald <[email protected]>---
As I mentioned in v3, adding *general* pll to common card driver is maybe difficult.
You did say that. But you did not say why.
Can you be more specific about what problem you see with adding it to the generic driver?
Quoted 2 lines
Using your own customized audio-graph-card driver is better idea, instead of adding code to common driver.
I just don't want to duplicate code without good reason.
Quoted 11 lines
I think Sameer's Tegra driver (= [3/6]) is good sample for you ?
https://lore.kernel.org/r/[email protected]Thank you for your help !!
Best regards
---
Kuninori Morimoto
Kuninori Morimoto
maintainerRe: [PATCH v4 3/6] ASoC: audio-graph-card: Support setting component plls and sysclks
Hi Richard
Quoted 11 lines
Quoted 2 lines
As I mentioned in v3, adding *general* pll to common card driver is maybe difficult.
You did say that. But you did not say why.
Can you be more specific about what problem you see with adding it to the generic driver?Quoted 2 lines
Using your own customized audio-graph-card driver is better idea, instead of adding code to common driver.
I just don't want to duplicate code without good reason.
Ahh, sorry for my unclear comment.
I think "PLL settings" is very board/platform specific, so, adding such code to common driver will be issue in the future. This is the reason why I don't want add it to audio-graph-card.
But, as I mentioned above and Sameer is already doing, you can reuse audio-graph-card and customize it.
Reuse audio-graph-card + Use your own PLL code = your own customized audio-graph-card
You can reuse audio-graph-card code by calling graph_parse_of(), and customize before/after that.
I think no duplicate code is needed.
I hope it can help you.
Thank you for your help !!
Best regards
---
Kuninori Morimoto
Rob Herring
maintainerRe: [PATCH v4 2/6] dt-bindings: audio-graph-card: Add plls and sysclks properties
In reply to Richard FitzgeraldQuoted 6 lines · Richard Fitzgerald
The audio-graph-card driver has properties for configuring the clocking for DAIs within a component, but is missing properties for setting up the PLLs and sysclks of the component.
This patch adds the two new properties 'plls' and 'sysclks' so that the audio-graph-driver can fully configure the component clocking.
I'm not sure this makes sense to be generic, but if so, we already have the clock binding and should use (and possibly extend) that.
This appears to all be configuration of clocks within the codec, so these properties belong in the codec or cpu nodes.
Quoted 10 lines
Signed-off-by Richard Fitzgerald <[email protected]>--- .../bindings/sound/audio-graph.yaml | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+)Documentation/devicetree/bindings/sound/audio-graph.yaml +0
-0
Documentation/devicetree/bindings/sound/audio-graph.yaml properties: · line 48
Quoted 10 lines
Documentation/devicetree/bindings/sound/audio-graph.yaml +7
-0@@ -39,6 +39,52 @@ properties: mic-det-gpio: maxItems: 1 + plls: + description: | + A list of component pll settings. There are 4 cells per PLL setting: + - phandle to the node of the codec or cpu component, + - component PLL id, + - component clock source id, + - frequency (in Hz) of the PLL output clock.
assigned-clocks binding can set frequencies and parent clocks.
'pll' is too specific to the implementation. You may want to configure the freq and parent of something that's not a pll.
Quoted 12 lines
Documentation/devicetree/bindings/sound/audio-graph.yaml +12
-0+ The PLL id and clock source id are specific to the particular component + so see the relevant component driver for the ids. Typically the + clock source id indicates the pin the source clock is connected to. + The same phandle can appear in multiple entries so that several plls + can be set in the same component. + $ref: /schemas/types.yaml#/definitions/phandle-array + + plls-clocks: + $ref: /schemas/types.yaml#/definitions/non-unique-string-array + description: | + A list of clock names giving the source clock for each setting + in the plls property.
Documentation/devicetree/bindings/sound/audio-graph.yaml properties: · line 70
Quoted 10 lines
Documentation/devicetree/bindings/sound/audio-graph.yaml +10
-0+ + sysclks: + description: | + A list of component sysclk settings. There are 4 cells per sysclk + setting: + - phandle to the node of the codec or cpu component, + - component sysclk id, + - component clock source id, + - direction of the clock: 0 if the clock is an input to the component, + 1 if it is an output.
A clock provider and consumer would provide the direction.
Quoted 23 lines
Documentation/devicetree/bindings/sound/audio-graph.yaml +17
-0+ The sysclk id and clock source id are specific to the particular + component so see the relevant component driver for the ids. Typically + the clock source id indicates the pin the source clock is connected to. + The same phandle can appear in multiple entries so that several sysclks + can be set in the same component. + $ref: /schemas/types.yaml#/definitions/phandle-array + + sysclks-clocks: + $ref: /schemas/types.yaml#/definitions/non-unique-string-array + description: | + A list of clock names giving the source clock for each setting + in the sysclks property. + +dependencies: + plls: [ plls-clocks ] + sysclks: [ sysclks-clocks ] + required: - daisSignature · 1 line
2.20.1
Mark Brown
maintainerRe: [PATCH v4 3/6] ASoC: audio-graph-card: Support setting component plls and sysclks
In reply to Kuninori MorimotoQuoted 4 lines · Kuninori Morimoto
Ahh, sorry for my unclear comment.
I think "PLL settings" is very board/platform specific, so, adding such code to common driver will be issue in the future. This is the reason why I don't want add it to audio-graph-card.
I don't think it's *that* weird, they're a fairly common feature of devices and in terms of integration aren't particularly different to sysclks, though this is for more complex CODECs.
Mark Brown
maintainerRe: [PATCH v4 2/6] dt-bindings: audio-graph-card: Add plls and sysclks properties
In reply to Rob HerringQuoted 5 lines · Rob Herring
I'm not sure this makes sense to be generic, but if so, we already have the clock binding and should use (and possibly extend) that.
This appears to all be configuration of clocks within the codec, so these properties belong in the codec or cpu nodes.
Right, I think this should just be the clock binding.
Quoted 2 lines
Documentation/devicetree/bindings/sound/audio-graph.yaml properties: · line 50
Quoted 2 lines
Documentation/devicetree/bindings/sound/audio-graph.yaml +2
-0+ The PLL id and clock source id are specific to the particular component + so see the relevant component driver for the ids. Typically the
This should refer to the bindings for components, not to their drivers.
Quoted 46 lines
Quoted 10 lines
Documentation/devicetree/bindings/sound/audio-graph.yaml +10
-0+ clock source id indicates the pin the source clock is connected to. + The same phandle can appear in multiple entries so that several plls + can be set in the same component. + $ref: /schemas/types.yaml#/definitions/phandle-array + + plls-clocks: + $ref: /schemas/types.yaml#/definitions/non-unique-string-array + description: | + A list of clock names giving the source clock for each setting + in the plls property.Documentation/devicetree/bindings/sound/audio-graph.yaml properties: · line 70
Quoted 10 lines
Documentation/devicetree/bindings/sound/audio-graph.yaml +10
-0+ + sysclks: + description: | + A list of component sysclk settings. There are 4 cells per sysclk + setting: + - phandle to the node of the codec or cpu component, + - component sysclk id, + - component clock source id, + - direction of the clock: 0 if the clock is an input to the component, + 1 if it is an output.A clock provider and consumer would provide the direction.
Quoted 23 lines
Documentation/devicetree/bindings/sound/audio-graph.yaml +17
-0+ The sysclk id and clock source id are specific to the particular + component so see the relevant component driver for the ids. Typically + the clock source id indicates the pin the source clock is connected to. + The same phandle can appear in multiple entries so that several sysclks + can be set in the same component. + $ref: /schemas/types.yaml#/definitions/phandle-array + + sysclks-clocks: + $ref: /schemas/types.yaml#/definitions/non-unique-string-array + description: | + A list of clock names giving the source clock for each setting + in the sysclks property. + +dependencies: + plls: [ plls-clocks ] + sysclks: [ sysclks-clocks ] + required: - daisSignature · 2 lines
-- 2.20.1
Richard Fitzgerald
maintainerRe: [PATCH v4 2/6] dt-bindings: audio-graph-card: Add plls and sysclks properties
In reply to Rob HerringQuoted 5 lines · Rob Herring
Quoted 4 lines · Richard Fitzgerald
The audio-graph-card driver has properties for configuring the clocking for DAIs within a component, but is missing properties for setting up the PLLs and sysclks of the component.
Quoted 9 lines
Quoted 2 lines
This patch adds the two new properties 'plls' and 'sysclks' so that the audio-graph-driver can fully configure the component clocking.
I'm not sure this makes sense to be generic, but if so, we already have the clock binding and should use (and possibly extend) that.
This appears to all be configuration of clocks within the codec, so these properties belong in the codec or cpu nodes.
audio-graph-card doesn't have codec or cpu nodes. Those were in simple-card but are replaced in audio-graph-card by a simple phandle array forming a graph.
I could assume that all clock settings apply to the codec and that there is only ever one codec in an audio-graph-card configuration.
Quoted 74 lines
Quoted 10 lines
Signed-off-by Richard Fitzgerald <[email protected]>--- .../bindings/sound/audio-graph.yaml | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+)Documentation/devicetree/bindings/sound/audio-graph.yaml +0
-0Documentation/devicetree/bindings/sound/audio-graph.yaml properties: · line 48
Quoted 10 lines
Documentation/devicetree/bindings/sound/audio-graph.yaml +7
-0@@ -39,6 +39,52 @@ properties: mic-det-gpio: maxItems: 1 + plls: + description: | + A list of component pll settings. There are 4 cells per PLL setting: + - phandle to the node of the codec or cpu component, + - component PLL id, + - component clock source id, + - frequency (in Hz) of the PLL output clock.assigned-clocks binding can set frequencies and parent clocks.
'pll' is too specific to the implementation. You may want to configure the freq and parent of something that's not a pll.
Quoted 12 lines
Documentation/devicetree/bindings/sound/audio-graph.yaml +12
-0+ The PLL id and clock source id are specific to the particular component + so see the relevant component driver for the ids. Typically the + clock source id indicates the pin the source clock is connected to. + The same phandle can appear in multiple entries so that several plls + can be set in the same component. + $ref: /schemas/types.yaml#/definitions/phandle-array + + plls-clocks: + $ref: /schemas/types.yaml#/definitions/non-unique-string-array + description: | + A list of clock names giving the source clock for each setting + in the plls property.Documentation/devicetree/bindings/sound/audio-graph.yaml properties: · line 70
Quoted 10 lines
Documentation/devicetree/bindings/sound/audio-graph.yaml +10
-0+ + sysclks: + description: | + A list of component sysclk settings. There are 4 cells per sysclk + setting: + - phandle to the node of the codec or cpu component, + - component sysclk id, + - component clock source id, + - direction of the clock: 0 if the clock is an input to the component, + 1 if it is an output.A clock provider and consumer would provide the direction.
Quoted 23 lines
Documentation/devicetree/bindings/sound/audio-graph.yaml +17
-0+ The sysclk id and clock source id are specific to the particular + component so see the relevant component driver for the ids. Typically + the clock source id indicates the pin the source clock is connected to. + The same phandle can appear in multiple entries so that several sysclks + can be set in the same component. + $ref: /schemas/types.yaml#/definitions/phandle-array + + sysclks-clocks: + $ref: /schemas/types.yaml#/definitions/non-unique-string-array + description: | + A list of clock names giving the source clock for each setting + in the sysclks property. + +dependencies: + plls: [ plls-clocks ] + sysclks: [ sysclks-clocks ] + required: - daisSignature · 1 line
2.20.1
Mark Brown
maintainerRe: [PATCH v4 2/6] dt-bindings: audio-graph-card: Add plls and sysclks properties
Quoted 11 lines · Richard Fitzgerald
Quoted 2 lines · Rob Herring
This appears to all be configuration of clocks within the codec, so these properties belong in the codec or cpu nodes.
audio-graph-card doesn't have codec or cpu nodes. Those were in simple-card but are replaced in audio-graph-card by a simple phandle array forming a graph.
I could assume that all clock settings apply to the codec and that there is only ever one codec in an audio-graph-card configuration.
The suggestion here is to put properties in the node for the relevant device rather than the card.
Richard Fitzgerald
maintainerRe: [PATCH v4 2/6] dt-bindings: audio-graph-card: Add plls and sysclks properties
Quoted 10 lines · Mark Brown
Quoted 8 lines · Richard Fitzgerald
Quoted 2 lines · Rob Herring
This appears to all be configuration of clocks within the codec, so these properties belong in the codec or cpu nodes.
audio-graph-card doesn't have codec or cpu nodes. Those were in simple-card but are replaced in audio-graph-card by a simple phandle array forming a graph.
Quoted 6 lines
Quoted 2 lines
I could assume that all clock settings apply to the codec and that there is only ever one codec in an audio-graph-card configuration.
The suggestion here is to put properties in the node for the relevant device rather than the card.
That's seems bad to me - putting the properties for one driver in the node of another driver. It's also potentially misleading as an example. As in something like:
wm5102: wm5102 {
compatible = "wlf,wm5102";
sysclks = <&some_clock>;
plls = <&some_other_clock>;
...};
To me that seems to imply that these are properties of the wm5102 driver and it is going to setup its own sysclk and pll settings from those properties. But actually it's the machine driver that does it, and these properties are specific to audio-graph-card.
Richard Fitzgerald
maintainerRe: [PATCH v4 2/6] dt-bindings: audio-graph-card: Add plls and sysclks properties
In reply to Mark BrownQuoted 10 lines · Mark Brown
Quoted 5 lines · Rob Herring
I'm not sure this makes sense to be generic, but if so, we already have the clock binding and should use (and possibly extend) that.
This appears to all be configuration of clocks within the codec, so these properties belong in the codec or cpu nodes.
Right, I think this should just be the clock binding.
Ok, so if the idea is to do this:
sound {
clocks = <&audio_mclk>, <&pll>;
clock-names = "mclk", "pll";
}some_codec {
pll: pll {
compatible = "fixed-clock";
clocks = <&audio_mclk>;
clock-frequency = <98304000>;
}
};For this to work the clock binding must be a real clock object (so needs a valid compatible=). But I need to somehow specify the PLL ID and source pin for the PLL configuration. The schema for "fixed-clock" has "additionalProperties: false" so I can't add extra custom properties to the clock node.
Of course if we were able to use the clock framework to provide real clock drivers for the plls and sysclks, the ID would be inherent in the binding, and it can define a custom property for the source pin.
Some options:
1) Remove "additionalProperties: false" from the "fixed-clock" binding.
2) Add new core clock properties. Well, source-pin might legitimately be meaningful, but for a real clock provider the clock ID is implicit.
3) Use 'reg' as fixed-clock doesn't use it. This works, but I suspect it will be seen as an abuse of reg.
4) Put some extra properties in the sound node to define the <id,source> pair for each clock. But that's clumsy to have some of the config in a clock binding and a couple of extra elsewhere.
5) Use a bare clock binding that isn't a real clock provider, like:
sound {
plls = <&pll>;
}some_codec {
pll: pll {
reg = <1>; /* PLL ID */
audio-graph-card,source-pin = <4>;
clocks = <&audio_mclk>;
clock-frequency = <98304000>;
}
};Quoted 51 lines
Quoted 2 lines
Documentation/devicetree/bindings/sound/audio-graph.yaml properties: · line 50
Quoted 2 lines
Documentation/devicetree/bindings/sound/audio-graph.yaml +2
-0+ The PLL id and clock source id are specific to the particular component + so see the relevant component driver for the ids. Typically theThis should refer to the bindings for components, not to their drivers.
Quoted 46 lines
Quoted 10 lines
Documentation/devicetree/bindings/sound/audio-graph.yaml +10
-0+ clock source id indicates the pin the source clock is connected to. + The same phandle can appear in multiple entries so that several plls + can be set in the same component. + $ref: /schemas/types.yaml#/definitions/phandle-array + + plls-clocks: + $ref: /schemas/types.yaml#/definitions/non-unique-string-array + description: | + A list of clock names giving the source clock for each setting + in the plls property.Documentation/devicetree/bindings/sound/audio-graph.yaml properties: · line 70
Quoted 10 lines
Documentation/devicetree/bindings/sound/audio-graph.yaml +10
-0+ + sysclks: + description: | + A list of component sysclk settings. There are 4 cells per sysclk + setting: + - phandle to the node of the codec or cpu component, + - component sysclk id, + - component clock source id, + - direction of the clock: 0 if the clock is an input to the component, + 1 if it is an output.A clock provider and consumer would provide the direction.
Quoted 23 lines
Documentation/devicetree/bindings/sound/audio-graph.yaml +17
-0+ The sysclk id and clock source id are specific to the particular + component so see the relevant component driver for the ids. Typically + the clock source id indicates the pin the source clock is connected to. + The same phandle can appear in multiple entries so that several sysclks + can be set in the same component. + $ref: /schemas/types.yaml#/definitions/phandle-array + + sysclks-clocks: + $ref: /schemas/types.yaml#/definitions/non-unique-string-array + description: | + A list of clock names giving the source clock for each setting + in the sysclks property. + +dependencies: + plls: [ plls-clocks ] + sysclks: [ sysclks-clocks ] + required: - daisSignature · 2 lines
-- 2.20.1
Mark Brown
maintainerRe: [PATCH v4 2/6] dt-bindings: audio-graph-card: Add plls and sysclks properties
Quoted 9 lines · Richard Fitzgerald
Quoted 1 line · Mark Brown
On Wed, Jan 13, 2021 at 09:22:25AM -0600, Rob Herring wrote:
some_codec { pll: pll { compatible = "fixed-clock"; clocks = <&audio_mclk>; clock-frequency = <98304000>; }
A PLL is not a fixed clock, why would you define a fixed clock here? Are you confusing the selection of rates on existing clocks with the use of the assigned-* properties that the clock binding provides?
Quoted 2 lines
For this to work the clock binding must be a real clock object (so needs a valid compatible=). But I need to somehow specify the PLL ID and
That seems like a *very* surprising requirement - why would the clock binding have that requirement? It would seem to create issues for a single device providing multiple clocks which should be a pretty common coase.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/sound/audio-graph.yaml properties: · line 83
Quoted 5 lines
Documentation/devicetree/bindings/sound/audio-graph.yaml +5
-0+ $ref: /schemas/types.yaml#/definitions/non-unique-string-array + description: | + A list of clock names giving the source clock for each setting + in the sysclks property. +
Please delete unneeded context from mails when replying. Doing this makes it much easier to find your reply in the message, helping ensure it won't be missed by people scrolling through the irrelevant quoted material.
Richard Fitzgerald
maintainerRe: [PATCH v4 2/6] dt-bindings: audio-graph-card: Add plls and sysclks properties
Quoted 4 lines · Mark Brown
Quoted 2 lines · Richard Fitzgerald
Quoted 1 line · Mark Brown
On Wed, Jan 13, 2021 at 09:22:25AM -0600, Rob Herring wrote:
Quoted 8 lines
Quoted 6 lines
some_codec { pll: pll { compatible = "fixed-clock"; clocks = <&audio_mclk>; clock-frequency = <98304000>; }A PLL is not a fixed clock, why would you define a fixed clock here?
It's a fixed clock if you are only setting one configuration. Call it compatible="any-other-dummy-clock-type" if you like, it doesn't matter what it is for the purposes of what I was describing.
This isn't a clk driver for a pll, it's just a setting to be passed to snd_soc_component_set_pll() using a clock binding to specify it.
Quoted 3 lines
Are you confusing the selection of rates on existing clocks with the use of the assigned-* properties that the clock binding provides?
I'm not at all sure what you and Rob have in mind here. Perhaps you could give an example of what you are thinking the .dts would look like to define some pll/sysclk settings for audio-graph-card to apply. An example is worth a thousand emails.
Quoted 8 lines
Quoted 2 lines
For this to work the clock binding must be a real clock object (so needs a valid compatible=). But I need to somehow specify the PLL ID and
That seems like a *very* surprising requirement - why would the clock binding have that requirement? It would seem to create issues for a single device providing multiple clocks which should be a pretty common coase.
You misunderstand me. What I'm saying is that to do this:
sound {
clocks = <&pll>;
}The node 'pll' must correspond to a clock provider driver. It can't be just a bare node with some properties pick-n-mixed from the clock binding, like this:
pll1 : pll1 {
clock-frequency = <98304000>;
};which doesn't define a compatible= to match it to a clk driver. An attempt to bulk_get the machine driver clocks here will fail.
To use a bare node with pick-n-mixed useful clock binding properties, that doesn't represent a real clk provider driver, it would have to be pointed to by a custom property that is not treated as a clk framework object, e.g.:
sound {
audio-graph-card,plls = <&pll>;
}In this case pll is a node parsed by audio-graph-card that just happens to use properties from the clock binding.
So the question I'm trying to ask is: when you and Rob said use the clock binding, did you mean pointing to that binding from clocks=<...>, or from a custom property like my audio-graph-card,plls example above.
Mark Brown
maintainerRe: [PATCH v4 2/6] dt-bindings: audio-graph-card: Add plls and sysclks properties
Quoted 12 lines · Richard Fitzgerald
Quoted 10 lines · Mark Brown
Quoted 9 lines · Richard Fitzgerald
Quoted 1 line · Mark Brown
On Wed, Jan 13, 2021 at 09:22:25AM -0600, Rob Herring wrote:
some_codec { pll: pll { compatible = "fixed-clock"; clocks = <&audio_mclk>; clock-frequency = <98304000>; }
Quoted 8 lines
Quoted 1 line
A PLL is not a fixed clock, why would you define a fixed clock here?
It's a fixed clock if you are only setting one configuration. Call it compatible="any-other-dummy-clock-type" if you like, it doesn't matter what it is for the purposes of what I was describing.
This isn't a clk driver for a pll, it's just a setting to be passed to
snd_soc_component_set_pll()using a clock binding to specify it.
So you're trying to describe a crystal on the board? Why would this be a subnode of the CODEC then? Surely it's just a standard fixed clock which provides some input to the CODEC in the same way you'd describe any other input to the CODEC. The above doesn't look anything like the hardware. But if that's what you're doing how is that related to configuring the FLL except possibly as the input clock you'd reference?
Quoted 7 lines
Quoted 2 lines
Are you confusing the selection of rates on existing clocks with the use of the assigned-* properties that the clock binding provides?
I'm not at all sure what you and Rob have in mind here. Perhaps you could give an example of what you are thinking the .dts would look like to define some pll/sysclk settings for audio-graph-card to apply. An example is worth a thousand emails.
As far as I can tell you are trying to configure the FLL in the CODEC, telling it to take an input clock and produce a fixed output clock rate from that. The FLL is a fairly basic clock, there are examples for both that and choosing a configuration for a clock in the clock bindings.
Quoted 7 lines
Quoted 4 lines
That seems like a *very* surprising requirement - why would the clock binding have that requirement? It would seem to create issues for a single device providing multiple clocks which should be a pretty common coase.
You misunderstand me. What I'm saying is that to do this:
Quoted 7 lines
sound { clocks = <&pll>; }The node 'pll' must correspond to a clock provider driver. It can't be just a bare node with some properties pick-n-mixed from the clock binding, like this:
I'm pretty sure I understand you perfectly; again, what makes you say that a description of a clock in the device tree has any requirement for a separate compatible string?
Quoted 4 lines
So the question I'm trying to ask is: when you and Rob said use the clock binding, did you mean pointing to that binding from clocks=<...>, or from a custom property like my audio-graph-card,plls example above.
When we say to use the clock binding what we are saying is to use the actual clock bindings to describe the clocks, not make a custom binding that looks kind of like them - making a custom binding doesn't address the problem.
Richard Fitzgerald
maintainerRe: [PATCH v4 2/6] dt-bindings: audio-graph-card: Add plls and sysclks properties
Quoted 53 lines · Mark Brown
Quoted 12 lines · Richard Fitzgerald
Quoted 10 lines · Mark Brown
Quoted 9 lines · Richard Fitzgerald
Quoted 1 line · Mark Brown
On Wed, Jan 13, 2021 at 09:22:25AM -0600, Rob Herring wrote:
some_codec { pll: pll { compatible = "fixed-clock"; clocks = <&audio_mclk>; clock-frequency = <98304000>; }Quoted 8 lines
Quoted 1 line
A PLL is not a fixed clock, why would you define a fixed clock here?
It's a fixed clock if you are only setting one configuration. Call it compatible="any-other-dummy-clock-type" if you like, it doesn't matter what it is for the purposes of what I was describing.
This isn't a clk driver for a pll, it's just a setting to be passed to
snd_soc_component_set_pll()using a clock binding to specify it.So you're trying to describe a crystal on the board? Why would this be a subnode of the CODEC then? Surely it's just a standard fixed clock which provides some input to the CODEC in the same way you'd describe any other input to the CODEC. The above doesn't look anything like the hardware. But if that's what you're doing how is that related to configuring the FLL except possibly as the input clock you'd reference?
Quoted 7 lines
Quoted 2 lines
Are you confusing the selection of rates on existing clocks with the use of the assigned-* properties that the clock binding provides?
I'm not at all sure what you and Rob have in mind here. Perhaps you could give an example of what you are thinking the .dts would look like to define some pll/sysclk settings for audio-graph-card to apply. An example is worth a thousand emails.
As far as I can tell you are trying to configure the FLL in the CODEC, telling it to take an input clock and produce a fixed output clock rate from that. The FLL is a fairly basic clock, there are examples for both that and choosing a configuration for a clock in the clock bindings.
Quoted 10 lines
Quoted 4 lines
That seems like a *very* surprising requirement - why would the clock binding have that requirement? It would seem to create issues for a single device providing multiple clocks which should be a pretty common coase.
You misunderstand me. What I'm saying is that to do this:
sound { clocks = <&pll>; }
Quoted 8 lines
Quoted 3 lines
The node 'pll' must correspond to a clock provider driver. It can't be just a bare node with some properties pick-n-mixed from the clock binding, like this:
I'm pretty sure I understand you perfectly; again, what makes you say that a description of a clock in the device tree has any requirement for a separate compatible string?
If I do:
sound {
clocks = <&clock>;
};
clock: clock {
compatible = "fixed-clock";
clock-frequency = <98304000>;
};I can clk_bulk_get_all().
But if I remove the 'compatible' from the clock node, clk_bulk_get_all() will return -EPROBE_DEFER and log:
/sound: Failed to get clk index: 0 ret: -517
from the error case in _clk_bulk_get() in clk/clk-bulk.c.
Quoted 10 lines
Quoted 4 lines
So the question I'm trying to ask is: when you and Rob said use the clock binding, did you mean pointing to that binding from clocks=<...>, or from a custom property like my audio-graph-card,plls example above.
When we say to use the clock binding what we are saying is to use the actual clock bindings to describe the clocks, not make a custom binding that looks kind of like them - making a custom binding doesn't address the problem.
But I don't know what you mean by "use the actual clock bindings to describe the clocks".
What is not clear to me is how you want me to use a clock binding to describe something that isn't a clk-framework clk. If you know what you want, then please.. an example would help explain.
Mark Brown
maintainerRe: [PATCH v4 2/6] dt-bindings: audio-graph-card: Add plls and sysclks properties
Quoted 5 lines · Richard Fitzgerald
If I do:
(quoted diff) +0
-0sound { clocks = <&clock>; };
Quoted 8 lines
clock: clock { compatible = "fixed-clock"; clock-frequency = <98304000>; };I can
clk_bulk_get_all().
But if I remove the 'compatible' from the clock node,clk_bulk_get_all()will return -EPROBE_DEFER and log:
OK, so if this is only supposed to represent a fixed clock on the board separate to the CODEC then yes, of course you do need to instantiate a driver for it like you do for every device on the board. However it shouldn't be a subdevice of the CODEC as you had it originally, it should be a distinct device as the above has it since that is what physically exists. This obviously won't configure the FLL at all though (which was what the binding you were proposing was for, the above is definitely not a direct substitute for the binding you originally proposed).
Quoted 11 lines
Quoted 4 lines
When we say to use the clock binding what we are saying is to use the actual clock bindings to describe the clocks, not make a custom binding that looks kind of like them - making a custom binding doesn't address the problem.
But I don't know what you mean by "use the actual clock bindings to describe the clocks".
What is not clear to me is how you want me to use a clock binding to describe something that isn't a clk-framework clk. If you know what you want, then please.. an example would help explain.
The concept of a clock framework is an implementation detail of Linux which should not affect how the DT bindings for a device or system are written, DT bindings should be clear and idiomatic as DT bindings. The goal is to represent the system in a clear and standardized fashion which is useful to OSs in general, not just something convenient for Linux as it happens to be implemented right now. Current Linux internals are not a constraint for DT bindings.
In this case if you can't figure out how to parse clock bindings without moving the clocks over to standard Linux clock APIs (which seems likely) then it follows that if you want to describe the clock configuration in DT then the driver support for these clocks should use the standard Linux clock framework. This seems like a good idea in general anyway.