-
Notifications
You must be signed in to change notification settings - Fork 349
Loopback mode kcontrol support #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e662282
71d3257
f97f254
5867e43
850d213
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -457,16 +457,31 @@ static inline int ssp_set_loopback_mode(struct dai *dai, uint32_t lbm) | |
| { | ||
| struct ssp_pdata *ssp = dai_get_drvdata(dai); | ||
|
|
||
| trace_ssp("loo"); | ||
| spin_lock(&ssp->lock); | ||
| trace_ssp("los"); | ||
|
|
||
| ssp_update_bits(dai, SSCR1, SSCR1_LBM, lbm ? SSCR1_LBM : 0); | ||
| if (ssp->lbm == lbm) | ||
| return 0; | ||
|
|
||
| spin_lock(&ssp->lock); | ||
| ssp->lbm = lbm; | ||
| ssp_update_bits(dai, SSCR1, SSCR1_LBM, lbm ? SSCR1_LBM : 0); | ||
| spin_unlock(&ssp->lock); | ||
|
|
||
| return 0; | ||
| } | ||
|
|
||
| static inline int ssp_get_loopback_mode(struct dai *dai) | ||
| { | ||
| struct ssp_pdata *ssp = dai_get_drvdata(dai); | ||
| int ret; | ||
|
|
||
| trace_ssp("log"); | ||
| spin_lock(&ssp->lock); | ||
| ret = ssp->lbm; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we really need this variable to track state ? cant we just use the SSP LBM bit for this ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, will use the register value directly, |
||
| spin_unlock(&ssp->lock); | ||
| return ret; | ||
| } | ||
|
|
||
| /* start the SSP for either playback or capture */ | ||
| static void ssp_start(struct dai *dai, int direction) | ||
| { | ||
|
|
@@ -608,4 +623,5 @@ const struct dai_ops ssp_ops = { | |
| .pm_context_restore = ssp_context_restore, | ||
| .probe = ssp_probe, | ||
| .set_loopback_mode = ssp_set_loopback_mode, | ||
| .get_loopback_mode = ssp_get_loopback_mode, | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1454,13 +1454,19 @@ static inline int dmic_set_loopback_mode(struct dai *dai, uint32_t lbm) | |
| return -EINVAL; | ||
| } | ||
|
|
||
| static inline int dmic_get_loopback_mode(struct dai *dai) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not needed with ioctl change. |
||
| { | ||
| return -EINVAL; | ||
| } | ||
|
|
||
| const struct dai_ops dmic_ops = { | ||
| .trigger = dmic_trigger, | ||
| .set_config = dmic_set_config, | ||
| .pm_context_store = dmic_context_store, | ||
| .pm_context_restore = dmic_context_restore, | ||
| .probe = dmic_probe, | ||
| .set_loopback_mode = dmic_set_loopback_mode, | ||
| .get_loopback_mode = dmic_get_loopback_mode, | ||
| }; | ||
|
|
||
| #endif | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -64,6 +64,7 @@ struct dai_ops { | |
| int (*pm_context_store)(struct dai *dai); | ||
| int (*probe)(struct dai *dai); | ||
| int (*set_loopback_mode)(struct dai *dai, uint32_t lbm); | ||
| int (*get_loopback_mode)(struct dai *dai); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please remove set_loopback_mode and use an int (*ioctl)(*dai, int cmd, void *data) callback for this.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, will refine DAI. |
||
| }; | ||
|
|
||
| /* DAI slot map to audio channel */ | ||
|
|
@@ -129,6 +130,11 @@ static inline int dai_set_loopback_mode(struct dai *dai, uint32_t lbm) | |
| return dai->ops->set_loopback_mode(dai, lbm); | ||
| } | ||
|
|
||
| static inline int dai_get_loopback_mode(struct dai *dai) | ||
| { | ||
| return dai->ops->get_loopback_mode(dai); | ||
| } | ||
|
|
||
| /* Digital Audio interface trigger */ | ||
| static inline int dai_trigger(struct dai *dai, int cmd, int direction) | ||
| { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -236,6 +236,7 @@ struct ssp_pdata { | |
| uint32_t psp; | ||
| spinlock_t lock; | ||
| uint32_t state[2]; /* SSP_STATE_ for each direction */ | ||
| uint32_t lbm; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is platform data, so it cant hold any "status". It can however store a flag that can be used to do a one time configure of the SSP hardware. Please also use a more descriptive name for this, what does it do ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will use register value. |
||
| completion_t drain_complete; | ||
| struct sof_ipc_dai_config config; | ||
| struct sof_ipc_dai_ssp_params params; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will flow easier when using ioctl as the cmd can be passed directly in most cases.