Skip to content

Commit

Permalink
ASoC: SOF: hda: manually register/unregister dmic device
Browse files Browse the repository at this point in the history
The Intel machine drivers make use of the "dmic-codec", which isn't
currently ACPI enumerated. While there is no control capability for
the dmic, this dmic-codec allows for the use of parameters such as
wake-up time.

Rather than add conditional code in all machine drivers, add
registration/unregistration for this platform device in the HDaudio
support of SOF. This code would become conditional if there is ever an
ACPI support added to the DMIC.

Signed-off-by: Pierre-Louis Bossart <[email protected]>
  • Loading branch information
plbossart committed Nov 1, 2018
1 parent 7e41d53 commit 5d7f074
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
10 changes: 10 additions & 0 deletions sound/soc/sof/intel/hda.c
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,13 @@ int hda_dsp_probe(struct snd_sof_dev *sdev)
sdev->hda = hdev;
hdev->desc = chip;

hdev->dmic_dev = platform_device_register_data(&pci->dev, "dmic-codec",
-1, NULL, 0);
if (IS_ERR(hdev->dmic_dev)) {
dev_err(&pci->dev, "Failed to create DMIC device\n");
return PTR_ERR(hdev->dmic_dev);
}

/*
* use position update IPC if either it is forced
* or we don't have other choice
Expand Down Expand Up @@ -681,6 +688,9 @@ int hda_dsp_remove(struct snd_sof_dev *sdev)
struct pci_dev *pci = sdev->pci;
const struct sof_intel_dsp_desc *chip = sdev->hda->desc;

if (sdev->hda && (!IS_ERR_OR_NULL(sdev->hda->dmic_dev)))
platform_device_unregister(sdev->hda->dmic_dev);

/* disable DSP IRQ */
snd_sof_dsp_update_bits(sdev, HDA_DSP_PP_BAR, SOF_HDA_REG_PP_PPCTL,
SOF_HDA_PPCTL_PIE, 0);
Expand Down
3 changes: 3 additions & 0 deletions sound/soc/sof/intel/hda.h
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,9 @@ struct sof_intel_hda_dev {
bool no_ipc_position;

int irq;

/* DMIC device */
struct platform_device *dmic_dev;
};

#define bus_to_sof_hda(bus) \
Expand Down

0 comments on commit 5d7f074

Please sign in to comment.