Skip to content

machine driver pdata handling is broken #208

Closed

Description

@plbossart

in #164 the patch 'ASoC: SOF: Refine registeration of platform device' modified the way the machine driver is registered, and modified the arguments that are passed as pdata.

In the acpi case, we passed the 'mach' structure as argument because we need to check the actual device name. This is now broken, so this patch needs to be redone - with probably different arguments passed depending on the machine driver (e.g. mach pointer for i2s machine drivers and codec-mask pointer for hdaudio)

This change was also made only for ACPI and PCI but not for SPI, so @lyakh and @lgirdwood would need to chime in on this.

And last there is no consistent handling of the platform_device_unregister(), this was not removed for ACPI, removed for ACPI and removed in the next patch for SPI

To me this was a wild merge that hasn't been tested on all platforms...

Activity

  1. added
    bugSomething isn't working
    P1Blocker bugs or important features
    BYTApplies to Baytrail platform
    GLKApplies to Gemini Lake
    on Oct 23, 2018
  2. RanderWang commented on Oct 24, 2018

    @RanderWang

    @plbossart I can't test it with SPI, does it work at that time? I will check the code again although I don't get the point.

  3. plbossart commented on Oct 24, 2018

    @plbossart
    MemberAuthor

    @RanderWang forget SPI, I am more worried about all the other machine drivers that use the pdata.

    /data/pbossart/ktest/sof-dev-rebase/sound/soc/intel/boards$ git grep platform_data
    bxt_pcm512x.c:  mach = (&pdev->dev)->platform_data;
    bxt_wm8804.c:   mach = (&pdev->dev)->platform_data;
    bytcht_da7213.c:        mach = (&pdev->dev)->platform_data;
    bytcht_es8316.c:        mach = (&pdev->dev)->platform_data;
    bytcr_rt5640.c: mach = byt_rt5640_card.dev->platform_data;
    bytcr_rt5651.c: mach = byt_rt5651_card.dev->platform_data;
    cht_bsw_rt5645.c:       mach = (&pdev->dev)->platform_data;
    cht_bsw_rt5672.c:       struct snd_soc_acpi_mach *mach = pdev->dev.platform_data;
    

    if you changed the parameter passed as pdata then you broke all those platforms.

  4. RanderWang commented on Oct 25, 2018

    @RanderWang

    @plbossart my idea is: my fault in this PR is registering wrong platform_data to BYT, right ?
    and this commit fix this:99d5562.
    with this, mach is registered for BYT

    If I am wrong, please notify me and I will refine later

  5. plbossart commented on Oct 25, 2018

    @plbossart
    MemberAuthor

    The current code expects struct snd_soc_acpi_mach pointer to be passed as pdata to BYT/CHT platforms.

    In the PR, the new registration passes a different structure:

    struct snd_sof_pdata *plat_data;
    
    /* register machine driver */
    	plat_data->pdev_mach =
    		platform_device_register_data(sdev->dev,
    					      plat_data->machine->drv_name,
    					      -1, plat_data,
    					      sizeof(*plat_data));
    

    As I mentioned it, we can change the parameter to something more organized (https://github.com/plbossart/sound/commits/topic/mach-data). Most likely the code should be something like

    /* register machine driver */
    	plat_data->pdev_mach =
    		platform_device_register_data(sdev->dev,
    					      plat_data->machine->drv_name,
    					      -1, plat_data->machine,
    					      sizeof(*plat_data->machine));
    

    makes sense?

  6. RanderWang commented on Oct 26, 2018

    @RanderWang

    Yes, you have prepared patches and want to PR by yourself ?

  7. RanderWang commented on Oct 26, 2018

    @RanderWang

    I study the PRs, they are done in common code. So I need to refine SOF side, right ?
    If so, I will wait for these PRs merged

  8. plbossart commented on Nov 1, 2018

    @plbossart
    MemberAuthor

    @RanderWang I submitted the patches upstream, can you try and suggest an update for the SOF side? I am running out of time and you are probably the best person to make the changes. Thanks for your help.

  9. RanderWang commented on Nov 2, 2018

    @RanderWang

    No problem. I will work on it

  10. plbossart commented on Nov 8, 2018

    @plbossart
    MemberAuthor

    @RanderWang kind reminder. The code is now upstream so before I add the patches i'd need to make sure your changes are compatible and merge in one shot.

  11. RanderWang commented on Nov 19, 2018

    @RanderWang

    @plbossart I check and test the latest code, it is fine now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

BYTApplies to Baytrail platformGLKApplies to Gemini LakeP1Blocker bugs or important featuresbugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions