Skip to content
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

ASoC: SOF: mediatek: Add machine driver dsp ops for mt8195 platform #3239

Closed

Conversation

yaochunhung
Copy link

Hi,
This patch is to support dsp ops callback to select and register machine driver.

{
struct snd_sof_pdata *sof_pdata = sdev->pdata;
struct snd_soc_acpi_mach *mach;

Copy link
Collaborator

Choose a reason for hiding this comment

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

My only concern here is that we aren't really using ACPI right?

Copy link
Author

Choose a reason for hiding this comment

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

yes, I don't use acpi and don't provide id for it.

/* machine driver */
.machine_select = mt8195_machine_select,
.machine_register = sof_machine_register,

Copy link
Member

Choose a reason for hiding this comment

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

same comment as @dbaluta, in theory you should have a device tree device for the machine driver?

Copy link
Author

@yaochunhung yaochunhung Oct 27, 2021

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

if you specify a driver for the machine, the SOF core will create a platform device.

But if you also have a DT binding for the machine driver, then you will create a second platform device, no?

Something seems wrong here?

Copy link
Author

@yaochunhung yaochunhung Oct 28, 2021

Choose a reason for hiding this comment

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

@plbossart Sorry for confusion, currently we only use SOF core to create platform device for machine (dts binding is item (3) above.). We use mt8195_machine_select to get driver name then create it. We don't use device tree binding for "mt8195_mt6359_rt1019_rt5682" for SOF,

item(3)
  adsp: adsp@10803000 {
       compatible =  "mediatek,mt8195-dsp";
...
       sound {
              mediatek,dptx-codec = <&dp_tx>;
              mediatek,hdmi-codec = <&hdmi0>;
              mediatek,platform = <&afe>;
             };

The non-sof device tree binding(item (2) above) is used without SOF support and it will create platform device via device tree. Thanks.

item(2)
    sound: mt8195-sound {
        compatible = "mediatek,mt8195_mt6359_rt1019_rt5682";
        mediatek,platform = <&afe>;
        pinctrl-names = "default";

Copy link
Member

Choose a reason for hiding this comment

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

Sorry @yaochunhung I am really confused. In previous PRs you described how the same card can include SOF and non-SOF managed streams. But above you seem to describe a case where the card is created in two different ways.

I don't get how this might work.

Copy link
Author

@yaochunhung yaochunhung Nov 29, 2021

Choose a reason for hiding this comment

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

@ujfalusi Thanks for your detail descriptions. I will base on your suggestion to modify the DSP node as property of sound card node as below,

&sound {
	pinctrl-names = "default";
	pinctrl-0 = <&aud_pins_default>;
	mediatek,adsp = <&adsp>;
        mediatek,platform =<&afe>;
	status = "okay";
}

where adsp is DSP node for dsp driver and afe is regular(non-sof) node for regular platform driver. Therefore, machine register won't be needed in this patch. But I still keep the machine_select to get sof_tplg_filename. Please feel free to tell me if I am misunderstanding. The machine driver code is in the link https://patchwork.kernel.org/project/linux-mediatek/patch/20211129141057.12422-4-trevor.wu@mediatek.com . Thanks.

Copy link
Author

Choose a reason for hiding this comment

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

@ujfalusi @plbossart Thanks for review. The machine driver is applied to mark/for-next branch as the link https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git/commit/?id=3d00d2c07f04f47aa4228700b440ac47abf13853. Please help to check if you have any concern or suggestions about this PR. Thanks.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I agree with @dbaluta and @plbossart that the machine_select should not be used, but you should be using the of match data in a similar way iMX is doing.

Copy link
Author

Choose a reason for hiding this comment

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

@dbaluta I check this function sof_machine_check and snd_sof_machine_select should return mach to avoid fail. Could you please advice how to avoid it without providing machine_select callback on iMX? Otherwise, I think sof_tplg_filename is also needed, but I don't know how to assign it without call machine_select . Thanks.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@yaochunhung I think this might be useful. https://www.spinics.net/lists/devicetree/msg433908.html

But I hit a roadblock and didn't get a chance to find a better solution.

I think for now at least we can have a default_tplg_filename in sof_dev_desc and select it based on probed platform.

struct snd_soc_acpi_mach *mach;

mach = &sof_mt8195_mach;
if (!mach) {
Copy link

Choose a reason for hiding this comment

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

this is impossible - as long as sof_mt8195_mach is a "normal real" object

Copy link
Author

Choose a reason for hiding this comment

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

@lyakh Thanks. I will remove it.

Add dsp ops callback to machine select to get sof topolgy file name

Signed-off-by: YC Hung <yc.hung@mediatek.com>
@yaochunhung
Copy link
Author

@plbossart @ujfalusi @lyakh Thanks for review, please help to check if there are any suggestions or concerns about this PR. Thanks a lot.

@yaochunhung
Copy link
Author

yaochunhung commented Jan 4, 2022

@plbossart @ujfalusi @lyakh @dbaluta Friendly reminders. Do you have a chance to look at this patch and give comments if any? Thanks a lot.

/* machine driver */
.machine_select = mt8195_machine_select,
.machine_register = sof_machine_register,

Copy link
Collaborator

Choose a reason for hiding this comment

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

I agree with @dbaluta and @plbossart that the machine_select should not be used, but you should be using the of match data in a similar way iMX is doing.

@plbossart
Copy link
Member

@yaochunhung is this still relevant? Last update was in January 2022.

@chunxu-li
Copy link

@plbossart
It looks like the machine_select callback is not optional, the callback must be implemented, otherwise sof can only support NOCODEC_MODE as the restrictions in function sof_machine_check .

@ujfalusi
Copy link
Collaborator

@chunxu-li, but how iMX is working? Is it using nocodec? @dbaluta, can you clarify this?

@yaochunhung
Copy link
Author

@ujfalusi I think @dbaluta provide IMX's solution like #3239 (comment). Thanks.

@plbossart plbossart added the Unclear No agreement on problem statement and resolution label Jun 21, 2022
@plbossart
Copy link
Member

@yaochunhung this PR has been marked as 'Unclear' for several weeks. Unless there's an update and/or a need for comments, we should close this PR. You can always resubmit a new one later, it's just not efficient to leave such PRs dangling without any progress.

@yaochunhung
Copy link
Author

@plbossart I will close this PR. Thanks

@yaochunhung yaochunhung closed this Aug 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Unclear No agreement on problem statement and resolution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants