Repository navigation
Conversation
|
|
||
| init.name = pdata->dai_clks[i].name; | ||
| init.ops = &sof_clk_ops; | ||
| init.flags = CLK_GET_RATE_NOCACHE | CLK_SET_RATE_GATE; |
There was a problem hiding this comment.
The problem here is I don't know the correct flag for the virtual clock. Need expert to comment the flag.
There was a problem hiding this comment.
not an expert in the clock API, but how about 0? :-) So far this clock doesn't even change rate, so why cannot it be cached?
There was a problem hiding this comment.
RATE_GATE might be valid for SCLK they tend to like being stopped in order to be changed, but are we ever going to allow that?
if not then should we use fixed-clock for SOF clocks?
A virtual clock driver is added to SOF platform driver. Machine driver could use the clock interface to send IPCs to SOF FW to enable/disable the clocks. Signed-off-by: Brent Lu <brent.lu@intel.com>
| clkctrl.clk_en = enable ? 1 : 0; | ||
| clkctrl.clk_id = dai_clk->clk_id; | ||
|
|
||
| dev_dbg(sdev->dev, "clkctrl: SSP%d clk_en %d clk_id %d\n", |
There was a problem hiding this comment.
is this clock SSP-only? If it is, it should be clear at the file / function level, if it isn't, it shouldn't be hard-coded here
There was a problem hiding this comment.
It might be better to be human readable:
dev_dbg(sdev->dev, "clkctrl: %s (clkid: %d) - %s\n", dai_clk->name, dai_clk->clk_id, enable ? "Enable" : "Disable");
|
|
||
| init.name = pdata->dai_clks[i].name; | ||
| init.ops = &sof_clk_ops; | ||
| init.flags = CLK_GET_RATE_NOCACHE | CLK_SET_RATE_GATE; |
There was a problem hiding this comment.
not an expert in the clock API, but how about 0? :-) So far this clock doesn't even change rate, so why cannot it be cached?
| } | ||
|
|
||
| dai_clk_lookup = clkdev_hw_create(&clkdev->hw, init.name, | ||
| NULL); |
There was a problem hiding this comment.
NULL would comfortably fit onto the previous line
| do { | ||
| if (sdev->dai_clks_lookup[i]) | ||
| clkdev_drop(sdev->dai_clks_lookup[i]); | ||
| } while (i-- > 0); |
There was a problem hiding this comment.
you can simplify this: from your above code whenever on iteration i you encounter an error and jump to err you know, that all sdev->dai_clks_lookup[0..i-1] have been created successfully, right? So, you could just
while (i-- > 0)
clkdev_drop(sdev->dai_clks_lookup[i]);
or similar
| for (i = sdev->num_clks - 1; i >= 0; --i) { | ||
| if (sdev->dai_clks_lookup[i]) | ||
| clkdev_drop(sdev->dai_clks_lookup[i]); | ||
| } |
There was a problem hiding this comment.
same here: I assume, this is only called if .probe() above was successful. In that case you know, that all sdev->dai_clks_lookup[0..sdev->num_clks-1] elements have been created successfully
| struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(component); | ||
| int i; | ||
|
|
||
| for (i = sdev->num_clks - 1; i >= 0; --i) { |
There was a problem hiding this comment.
just curious - any specific reason to run this in reverse order?
| uint32_t dai_index; /**< index of this type dai */ | ||
|
|
||
| uint32_t clk_en; /**< zero to disable the clock */ | ||
| uint32_t clk_id; /**< clock id to operate */ |
There was a problem hiding this comment.
how sure are we that this is all we'll ever need? Can it be that at some point we'll also need to send a rate down? Or maybe even the duty cycle (ok, maybe not this one)?
|
I'm curious on how the clock API works on non DT world. How the machine driver would request the SCLK from one of the SSP ports the broken by design codec is connected to? Is it so that we just look for a unique clock name to request? |
| struct sof_clk *clkdev; | ||
|
|
||
| clkdev = devm_kzalloc(dev, sizeof(*clkdev), GFP_KERNEL); | ||
| if (!clkdev) { |
There was a problem hiding this comment.
I think this operations should be platform specific. In IMX case we just have the clocks defined in the device tree file (dts) and then just get a reference to the clock here.
Also, with the IMX we enable and configure IP clocks (not only DAI clocks) on the Host side.
There was a problem hiding this comment.
@dbaluta, you are right, but it should also depend on firmware version. Do we have the clock support enabled in the firmware?
At the end we will have SOF as a clock provider as well so platforms can move audio related clock implementations into the firmware and manage it via IPC.
There was a problem hiding this comment.
@ujfalusi for IMX there is little to zero support for IPs clocks in the firmware. 2 out of 3 IMX supported platforms have a dedicated M4 core that is running a firmware which handles the clocks.
I like the idea of making the SOF (DSP) as a clock provider. It will make sense for IMX future platforms.
|
@brentlu there is already an on-going work to start toggling the bclk during the hw_params stage and stop it during the hw_free stage. That would cover the current issues with most codecs and will be rather simple to backport. I would like to push the introduction of new IPCs to a later stage when we have the SOF client support that @ujfalusi is working on. |
|
let's work on #2965 for now, we'll have to add clock control when we have the SOF client in place. |
A virtual clock driver is added to SOF platform driver. Machine driver
could use the clock interface to send IPCs to SOF FW to enable/disable
the clocks.
Signed-off-by: Brent Lu brent.lu@intel.com