Skip to content

dai: support explicit clock control - #4213

Closed
brentlu wants to merge 1 commit into
thesofproject:mainfrom
brentlu:dai_clk_driver
Closed

brentlu wants to merge 1 commit into
thesofproject:mainfrom
brentlu:dai_clk_driver

Conversation

@brentlu

@brentlu brentlu commented May 19, 2021

Copy link
Copy Markdown
Contributor

Add the SOF_IPC_DAI_CLKCTRL command for host to enable/disable DAI
clocks explicitly.

Signed-off-by: Brent Lu brent.lu@intel.com

@brentlu brentlu linked an issue May 19, 2021 that may be closed by this pull request
Comment thread src/drivers/intel/ssp/ssp.c Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I don't know how to control mclk/bclk separately...

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest that we add two helper functions to control mclk and bclk respectively. We count ref count in those helper functions. And we use the helper functions within ssp_set_clkctrl, ssp_port_stop, and ssp_port_start.

@lgirdwood lgirdwood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Best to get inputs from @plbossart, @keyonjie and @slawblauciak

Comment thread src/include/sof/lib/dai.h Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can just be called dai_clkctrl()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Comment thread src/include/sof/lib/dai.h Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clkctrl

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Comment thread src/include/sof/drivers/ssp.h Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have a comment what this is used for ?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am thinking what should we do if we want to enable MCLK only?

Comment thread src/include/ipc/dai.h Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dont think we need the union here as the interface looks generic.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in fact, I would just put the

	uint32_t clk_en;	/**< Zero to disable the clock */
        uint32_t clk_id;	/**< Clock id to operate */

in here directly

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Comment thread src/include/ipc/dai-intel.h Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dont think this struct is needed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Comment thread src/include/ipc/dai-intel.h Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets keep it generic and remove "SSP" from these names.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Comment thread src/drivers/intel/ssp/ssp.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we not use "state" here, I'm assuming this needs to be in a configured but inactive state ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the state checking is added back.

@lgirdwood

Copy link
Copy Markdown
Member

@bardliao @keyonjie @RanderWang @mengdonglin fyi - please lets all help on the solution.
@brentlu do you have any kernel PR ?

@brentlu

brentlu commented May 20, 2021

Copy link
Copy Markdown
Contributor Author

Kernel PR is here:
thesofproject/linux#2932

@bardliao bardliao left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @brentlu for starting this. See my comments below

Comment thread src/include/sof/drivers/ssp.h Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am thinking what should we do if we want to enable MCLK only?

Comment thread src/drivers/intel/ssp/ssp.c Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest that we add two helper functions to control mclk and bclk respectively. We count ref count in those helper functions. And we use the helper functions within ssp_set_clkctrl, ssp_port_stop, and ssp_port_start.

Add the SOF_IPC_DAI_CLKCTRL command for host to enable/disable DAI
clocks explicitly.

Signed-off-by: Brent Lu <brent.lu@intel.com>
@brentlu

brentlu commented May 20, 2021

Copy link
Copy Markdown
Contributor Author

Thanks @bardliao, we still need to figure our how to enable/disable mclk/bclk separately. In this test patch I just enable entire port and check the log to see if the IPC command works.

@brentlu
brentlu marked this pull request as draft May 20, 2021 09:27
@plbossart

Copy link
Copy Markdown
Member

@brentlu @lgirdwood I don't think it's required to add new IPCs for the current version of SOF, we can get by with what @bardliao is working on. It'd rather add this capability at a later stage when we have fewer in-flight IPC transitions on-going.

@plbossart

Copy link
Copy Markdown
Member

closing since we've enabled the early bitclock support.

@plbossart plbossart closed this Nov 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Explicit clock control

4 participants