• Simon Trimmer's avatar
    ASoC: wm_adsp: Expand firmware loading search options · b6b62d94
    Simon Trimmer authored
    The parts supported by this driver can have product-specific
    firmware and tunings files. Typically these have been used on
    embedded systems where the manufacturer is responsible for
    installing the correct product-specific firmware files into
    /lib/firmware. However, the linux-firmware repository places all
    available firmwares into /lib/firmware and it is up to the driver to
    select the correct product-specific firmware from that directory.
    
    For example a product containing four smart amplifiers may provide
    firmware specific for that product and each of the amplifiers may
    have coefficient files containing tunings for their placement in the
    mechanical design.
    
    This change extends firmware (wmfw) and coefficient (bin) filenames
    to be of the general form:
    
    <cirrus/>part-dspN-fwtype<-system_name<-asoc_component_prefix>>.type
    
    Where the cirrus subdirectory, system_name and asoc_component_prefix
    are optional.
    
    New files will be placed in the cirrus subdirectory to avoid
    polluting the main /lib/firmware/ location. The generic name must be
    searched in /lib/firmware before /lib/firmware/cirrus so that a
    generic file in the new location does not override existing
    product-specific files in the legacy location.
    
    The search order for firmware files is:
      - cirrus/part-dspN-fwtype-system_name-asoc_component_prefix.wmfw
      - cirrus/part-dspN-fwtype-system_name.wmfw
      - part-dspN-fwtype.wmfw
      - cirrus/part-dspN-fwtype.wmfw
    
    - Qualifications are added to the filename so that rightwards is more
      specific.
    - The system_name is provided by the codec driver.
    - The asoc_component_prefix is used to identify tunings for individual
      parts because it would already exist to disambiguate the controls
      and it makes it obvious which firmware file applies to which device.
    
    The optional coefficient file must have the same filename
    construction as the discovered wmfw except:
      - where the wmfw has only system_name then the bin file can
        optionally include the asoc_component_prefix. This is to allow a
        common wmfw for all amps but separate tunings per amp.
    Signed-off-by: default avatarSimon Trimmer <simont@opensource.cirrus.com>
    Acked-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
    Link: https://lore.kernel.org/r/20220303155016.122125-1-simont@opensource.cirrus.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
    b6b62d94
wm_adsp.c 50.8 KB