]> git.alsa-project.org Git - alsa-ucm-conf.git/commitdiff
ucm.conf: add support for the kernel module name tree
authorJaroslav Kysela <perex@perex.cz>
Mon, 22 Jun 2020 15:52:54 +0000 (17:52 +0200)
committerJaroslav Kysela <perex@perex.cz>
Tue, 23 Jun 2020 15:00:19 +0000 (17:00 +0200)
It seems that some ASoC drivers (mainly created from the DT tree)
does not offer any good identification for the common part.
This change adds the sysfs kernel module name lookup to
module/<KernelModuleName>.conf .

Also, modularize V1, V2Name, V2Module blocks. The V1 compatibility
is turned off by default now.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
ucm2/ucm.conf

index 29bef5c96c00a0b8bbc4cdd7b0218d96877341cc..ec8287817a5a1b6764ad873433d494e290d8b668 100644 (file)
 
 Syntax 3
 
+Define.V1 ""           # non-empty string to enable ucm v1 paths
+Define.V2Module yes    # empty string to disable
+Define.V2Name yes      # empty string to disable
+
 If.driver {
        Condition {
                Type String
                Empty "${CardNumber}"
        }
        True {
-
                #
-               # The last probed path for no-hw-card:
+               # The probed path for no-hw-card:
                #
                #   ucm2/${OpenName}/${OpenName}.conf
-               #   ucm/${OpenName}/${OpenName}.conf
                #
-
                UseCasePath {
                        legacy {
                                Directory "${OpenName}"
                                File "${OpenName}.conf"
                        }
-                       v1_legacy {
-                               Version 1
-                               Directory "${OpenName}"
-                               File "${OpenName}.conf"
-                       }
                }
-
        }
        False {
 
                #
-               # The last probed path when hw-card is found:
+               # The probed path when hw-card is found:
                #
+               #   ucm2/${KernelModule}/${KernelModule}.conf
                #   ucm2/${CardDriver}/${CardLongName}.conf
                #   ucm2/${CardDriver}/${CardDriver}.conf
-               #   ucm/${CardLongName}/${CardLongName}.conf
-               #   ucm/${CardName}/${CardName}.conf or \
-               #                       ucm/${OpenName}/${OpenName}.conf
                #
 
-               UseCasePath {
-                       longname {
-                               Directory "${CardDriver}"
-                               File "${CardLongName}.conf"
-                       }
-                       driver {
-                               Directory "${CardDriver}"
-                               File "${CardDriver}.conf"
+               If.V2Module {
+                       Condition {
+                               Type String
+                               Empty "${var:V2Module}"
                        }
-                       v1_longname {
-                               Version 1
-                               Directory "${CardLongName}"
-                               File "${CardLongName}.conf"
+                       False {
+                               Define.KernelModulePath "class/sound/card${CardNumber}/device/driver"
+                               Define.KernelModule "${sys:$KernelModulePath}"
+                               UseCasePath.module {
+                                       Directory "module"
+                                       File "${var:KernelModule}.conf"
+                               }
                        }
                }
-
-               If.hw {
+               If.V2Name {
                        Condition {
                                Type String
-                               Haystack "${OpenName}.conf"
-                               Needle "hw:"
+                               Empty "${var:V2Name}"
+                       }
+                       False.UseCasePath {
+                               longname {
+                                       Directory "${CardDriver}"
+                                       File "${CardLongName}.conf"
+                               }
+                               driver {
+                                       Directory "${CardDriver}"
+                                       File "${CardDriver}.conf"
+                               }
                        }
-                       True {
-                               UseCasePath.v1_cardnamme {
+               }
+       }
+}
+
+If.V1 {
+       Condition {
+               Type String
+               Empty "${var:V1}"
+       }
+       False.If.v1_driver {
+               Condition {
+                       Type String
+                       Empty "${CardNumber}"
+               }
+               True {
+                       #
+                       # The probed path for no-hw-card:
+                       #
+                       #   ucm/${OpenName}/${OpenName}.conf
+                       #
+                       UseCasePath.v1_legacy {
+                               Version 1
+                               Directory "${OpenName}"
+                               File "${OpenName}.conf"
+                       }
+               }
+               False {
+                       #
+                       # The ucm v1 probed path when hw-card is found:
+                       #
+                       #   ucm/${CardLongName}/${CardLongName}.conf
+                       #   ucm/${CardName}/${CardName}.conf or \
+                       #                       ucm/${OpenName}/${OpenName}.conf
+                       #
+                       UseCasePath.v1_longname {
+                               Version 1
+                               Directory "${CardLongName}"
+                               File "${CardLongName}.conf"
+                       }
+                       If.v1_hw {
+                               Condition {
+                                       Type String
+                                       Haystack "${OpenName}"
+                                       Needle "hw:"
+                               }
+                               True.UseCasePath.v1_cardnamme {
                                        Version 1
                                        Directory "${CardName}"
                                        File "${CardName}.conf"
                                }
-                       }
-                       False {
-                               UseCasePath.v1_openname {
+                               False.UseCasePath.v1_openname {
                                        Version 1
                                        Directory "${OpenName}"
                                        File "${OpenName}.conf"