forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 132
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
[DNM] ASoC: SOF: imx: imx driver refactorization and imx95 driver introduction #5307
Draft
LaurentiuM1234
wants to merge
9
commits into
thesofproject:topic/sof-dev
Choose a base branch
from
LaurentiuM1234:feat/imx_driver_refactor
base: topic/sof-dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
[DNM] ASoC: SOF: imx: imx driver refactorization and imx95 driver introduction #5307
LaurentiuM1234
wants to merge
9
commits into
thesofproject:topic/sof-dev
from
LaurentiuM1234:feat/imx_driver_refactor
+972
−1,591
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LaurentiuM1234
force-pushed
the
feat/imx_driver_refactor
branch
2 times, most recently
from
January 23, 2025 14:53
eb54f7b
to
d6dbfe0
Compare
The SOF drivers for imx chips have a lot of duplicate code and routines/code snippets that could certainly be reused among drivers. As such, introduce a new set of structures and functions that will help eliminate the redundancy and code size of the drivers. Signed-off-by: Laurentiu Mihalcea <[email protected]>
The common interface for imx chips (defined in imx-common.c) contains the definitions for a lot of functions required by the SOF core. As such, the platform driver can just use the common definitions instead of duplicating code by re-defining aforementioned functions. Make the transition to the new common interface. This consists of: 1) Removing unneeded functions, which are already defined in the common interface. 2) Defining some chip-specific operations/structures required by the interface to work. 3) Dropping structure definitions that are no longer needed. 4) Adapting some existing functions to the new interface. Signed-off-by: Laurentiu Mihalcea <[email protected]>
The definition of 'struct sof_dev_desc' has the following properties for imx chips: 1) FW path is the same for all chips. 2) Topology path is the same for all chips. 3) FW name can be written as: "sof-${machine_name}.ri" 4) IPC3 is the only supported protocol The structure takes quite a few lines of code. Since the intention is to add support for more imx8 chips in the same driver, we need to try and reduce the number of lines taken by information that's not particularly useful. As such, we can use 'IMX_SOF_DEV_DESC()' to reduce the declaration of the structure to just one line. The only information that's particularly useful can be seen from the parameters of the macro. Of course, if any of the assumptions don't apply anymore, driver writers can simply declare the 'struct sof_dev_desc' the "old fashioned way". No reason to make the macro suit multiple needs. The same logic applies to the array of 'struct snd_soc_dai_driver'. Signed-off-by: Laurentiu Mihalcea <[email protected]>
Shuffle the definitions of some structures and functions such that they are better grouped. This is purely a cosmetic change. Signed-off-by: Laurentiu Mihalcea <[email protected]>
Drop some unneeded/unused macro definitions and header includes. Signed-off-by: Laurentiu Mihalcea <[email protected]>
LaurentiuM1234
force-pushed
the
feat/imx_driver_refactor
branch
from
January 23, 2025 18:11
d6dbfe0
to
bea6639
Compare
The definition for the ops_init() operation is similar among the imx8 chips (namely: imx8, imx8x, imx8m, and imx8ulp). The only difference is the name of the 'struct snd_soc_dai_driver' array used to fill the SOF ops structure. As such, 'imx8_ops_init()' can be made into an utility function that takes the 'struct snd_soc_dai_driver' array and its size as parameters and fills the SOF ops structure fields accordingly. This will allow us to reuse this function when the other drivers (imx8m, imx8ulp) are merged into this one. Since the definition of the function is changed, it can no longer be used directly by the SOF core. Therefore, also introduce a wrapper: 'imx_ops_init()' that will call 'imx8_ops_init()' with the right parameters based on the chip. Signed-off-by: Laurentiu Mihalcea <[email protected]>
Now that the common interface for imx chip has been introduced, there's no longer a need to have a separate platform driver for imx8m. As such, merge the driver with the imx8 driver. Furthermore, delete the old driver as it's no longer useful. Signed-off-by: Laurentiu Mihalcea <[email protected]>
Now that the common interface for imx chip has been introduced, there's no longer a need to have a separate platform driver for imx8ulp. As such, merge the driver with the imx8 driver. Furthermore, delete the old driver as it's no longer useful. Signed-off-by: Laurentiu Mihalcea <[email protected]>
LaurentiuM1234
force-pushed
the
feat/imx_driver_refactor
branch
from
January 23, 2025 18:19
bea6639
to
252b1bd
Compare
Add SOF support for the imx95 chip. Although the support is just for the imx95 chip, the driver is intended for all chips in the imx9 family. Note that the imx95 support could have just as easily been added to the imx8 platform driver but a new platform driver was created because the intention is to keep the families in separate drivers. Signed-off-by: Laurentiu Mihalcea <[email protected]>
LaurentiuM1234
force-pushed
the
feat/imx_driver_refactor
branch
from
January 23, 2025 18:21
252b1bd
to
386ce80
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A rather aggressive but arguably much needed refactorization of the imx SOF drivers. The refactorization is meant to address the code duplication in the imx drivers and decrease the coding effort required for introducing a new imx platform.
After the refactorization, only two drivers remain: imx8 (meant for imx chips belonging to the imx8 family: imx8 (aka imx8qm), imx8x (aka imx8qxp), imx8m, imx8ulp) and imx9 (mean for imx chips belonging to the imx9 family: imx95).
The series also includes the introduction of the imx95 driver.
The series requires some CI testing, which is why it's tagged with [DNM]. Submitted for initial comments.