Skip to content

Rt5682 module unload fix - #1147

Merged
plbossart merged 2 commits into
thesofproject:topic/sof-devfrom
juimonen:rt5682_fix
Aug 26, 2019
Merged

plbossart merged 2 commits into
thesofproject:topic/sof-devfrom
juimonen:rt5682_fix

Conversation

@juimonen

Copy link
Copy Markdown

@bardliao this fixes the module unloading oops...

plbossart
plbossart previously approved these changes Aug 21, 2019

@plbossart plbossart 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.

LGTM but need @bardliao to chime in

}

return 0;
}

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.

@juimonen a couple of comments: 1. a typo in the commit message "...which disables ..." instead of disabled. 2. Do you think cancelling the jack_detect_work in rt5682 codec driver's remove will be a better option?

static void rt5682_remove(struct snd_soc_component *component)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@ranjani ok, I'll fix the commit message. Adding the remove to sof_rt5682.c was suggested by @bardliao so I'm not totally sure of the possible reason... I guess the removal starts from bottom up and this is the way to do it in earlier stage? however I can try to add it solely to codec and see what happens...

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.

@juimonen I "guess" the reason is we reset the codec on rt5682_remove(), which reset the codec IRQ pin to the initial gpio function and trigger the interrupt. And we doesn't disable irq before that.

@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.

Looks good to me, but we need to set rt5682->hs_jack = NULL when jack detection is disabled.

Comment thread sound/soc/codecs/rt5682.c
@@ -995,6 +995,14 @@ static int rt5682_set_jack_detect(struct snd_soc_component *component,
{
struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component);

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.

We need to set rt5682->hs_jack = hs_jack; even hs_jack = NULL to prevent rt5682->hs_jack from being garbage after codec driver is removed. So I suggest to move rt5682->hs_jack = hs_jack; from line 1043 to here.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

ok

Jaska Uimonen added 2 commits August 22, 2019 07:08
Implement NULL handler in set_jack function to disable
irq's.

Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
When removing sof module the rt5682 jack handler will oops
if jack detection is not disabled. So add remove function,
which disables the jack detection.

Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
@juimonen

Copy link
Copy Markdown
Author

updated. @ranj063 fixed typo. @bardliao moved hs_jack setting.

@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 @juimonen

@wenqingfu

Copy link
Copy Markdown

SOFCI TEST

@aiChaoSONG

Copy link
Copy Markdown

testing results shows that this PR fix #1106

@plbossart
plbossart merged commit 03e99c2 into thesofproject:topic/sof-dev Aug 26, 2019
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.

6 participants