1. 05 10月, 2018 1 次提交
  2. 06 9月, 2018 1 次提交
    • C
      ASoC: dapm: Move error handling to snd_soc_dapm_new_control_unlocked · 3bbf5d34
      Charles Keepax 提交于
      Currently DAPM has a lot of similar code to handle errors from
      snd_soc_dapm_new_control_unlocked, and much of this code does
      not really accurately reflect what the function returns.
      
      Firstly, most places will check for a return value of
      -EPROBE_DEFER and silence any error messages in that case. The
      one notable exception here being dapm_kcontrol_data_alloc
      which does currently print any error messages in the case
      of snd_soc_dapm_new_control_unlocked returning NULL or an
      error. Additionally the error prints being silenced in these
      case are redundant as snd_soc_dapm_new_control_unlocked can
      only return -EPROBE_DEFER or NULL when failing.
      
      Secondly, most places will treat a return value of NULL as
      an -ENOMEM.  This is not correct either since any error except
      EPROBE_DEFER will cause a return value of NULL from
      snd_soc_dapm_new_control_unlocked.
      
      Centralise this handling and the error messages within
      snd_soc_dapm_new_control_unlocked and update the callers
      to simply check IS_ERR and return. Note that this update is
      slightly simpler in the case of dapm_kcontrol_data_alloc where
      that is fairly close to the handling that was already in place.
      Signed-off-by: NCharles Keepax <ckeepax@opensource.cirrus.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      3bbf5d34
  3. 02 7月, 2018 1 次提交
  4. 18 6月, 2018 2 次提交
  5. 13 6月, 2018 1 次提交
    • K
      treewide: kzalloc() -> kcalloc() · 6396bb22
      Kees Cook 提交于
      The kzalloc() function has a 2-factor argument form, kcalloc(). This
      patch replaces cases of:
      
              kzalloc(a * b, gfp)
      
      with:
              kcalloc(a * b, gfp)
      
      as well as handling cases of:
      
              kzalloc(a * b * c, gfp)
      
      with:
      
              kzalloc(array3_size(a, b, c), gfp)
      
      as it's slightly less ugly than:
      
              kzalloc_array(array_size(a, b), c, gfp)
      
      This does, however, attempt to ignore constant size factors like:
      
              kzalloc(4 * 1024, gfp)
      
      though any constants defined via macros get caught up in the conversion.
      
      Any factors with a sizeof() of "unsigned char", "char", and "u8" were
      dropped, since they're redundant.
      
      The Coccinelle script used for this was:
      
      // Fix redundant parens around sizeof().
      @@
      type TYPE;
      expression THING, E;
      @@
      
      (
        kzalloc(
      -	(sizeof(TYPE)) * E
      +	sizeof(TYPE) * E
        , ...)
      |
        kzalloc(
      -	(sizeof(THING)) * E
      +	sizeof(THING) * E
        , ...)
      )
      
      // Drop single-byte sizes and redundant parens.
      @@
      expression COUNT;
      typedef u8;
      typedef __u8;
      @@
      
      (
        kzalloc(
      -	sizeof(u8) * (COUNT)
      +	COUNT
        , ...)
      |
        kzalloc(
      -	sizeof(__u8) * (COUNT)
      +	COUNT
        , ...)
      |
        kzalloc(
      -	sizeof(char) * (COUNT)
      +	COUNT
        , ...)
      |
        kzalloc(
      -	sizeof(unsigned char) * (COUNT)
      +	COUNT
        , ...)
      |
        kzalloc(
      -	sizeof(u8) * COUNT
      +	COUNT
        , ...)
      |
        kzalloc(
      -	sizeof(__u8) * COUNT
      +	COUNT
        , ...)
      |
        kzalloc(
      -	sizeof(char) * COUNT
      +	COUNT
        , ...)
      |
        kzalloc(
      -	sizeof(unsigned char) * COUNT
      +	COUNT
        , ...)
      )
      
      // 2-factor product with sizeof(type/expression) and identifier or constant.
      @@
      type TYPE;
      expression THING;
      identifier COUNT_ID;
      constant COUNT_CONST;
      @@
      
      (
      - kzalloc
      + kcalloc
        (
      -	sizeof(TYPE) * (COUNT_ID)
      +	COUNT_ID, sizeof(TYPE)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(TYPE) * COUNT_ID
      +	COUNT_ID, sizeof(TYPE)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(TYPE) * (COUNT_CONST)
      +	COUNT_CONST, sizeof(TYPE)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(TYPE) * COUNT_CONST
      +	COUNT_CONST, sizeof(TYPE)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(THING) * (COUNT_ID)
      +	COUNT_ID, sizeof(THING)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(THING) * COUNT_ID
      +	COUNT_ID, sizeof(THING)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(THING) * (COUNT_CONST)
      +	COUNT_CONST, sizeof(THING)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(THING) * COUNT_CONST
      +	COUNT_CONST, sizeof(THING)
        , ...)
      )
      
      // 2-factor product, only identifiers.
      @@
      identifier SIZE, COUNT;
      @@
      
      - kzalloc
      + kcalloc
        (
      -	SIZE * COUNT
      +	COUNT, SIZE
        , ...)
      
      // 3-factor product with 1 sizeof(type) or sizeof(expression), with
      // redundant parens removed.
      @@
      expression THING;
      identifier STRIDE, COUNT;
      type TYPE;
      @@
      
      (
        kzalloc(
      -	sizeof(TYPE) * (COUNT) * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        kzalloc(
      -	sizeof(TYPE) * (COUNT) * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        kzalloc(
      -	sizeof(TYPE) * COUNT * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        kzalloc(
      -	sizeof(TYPE) * COUNT * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        kzalloc(
      -	sizeof(THING) * (COUNT) * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      |
        kzalloc(
      -	sizeof(THING) * (COUNT) * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      |
        kzalloc(
      -	sizeof(THING) * COUNT * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      |
        kzalloc(
      -	sizeof(THING) * COUNT * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      )
      
      // 3-factor product with 2 sizeof(variable), with redundant parens removed.
      @@
      expression THING1, THING2;
      identifier COUNT;
      type TYPE1, TYPE2;
      @@
      
      (
        kzalloc(
      -	sizeof(TYPE1) * sizeof(TYPE2) * COUNT
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
        , ...)
      |
        kzalloc(
      -	sizeof(TYPE1) * sizeof(THING2) * (COUNT)
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
        , ...)
      |
        kzalloc(
      -	sizeof(THING1) * sizeof(THING2) * COUNT
      +	array3_size(COUNT, sizeof(THING1), sizeof(THING2))
        , ...)
      |
        kzalloc(
      -	sizeof(THING1) * sizeof(THING2) * (COUNT)
      +	array3_size(COUNT, sizeof(THING1), sizeof(THING2))
        , ...)
      |
        kzalloc(
      -	sizeof(TYPE1) * sizeof(THING2) * COUNT
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
        , ...)
      |
        kzalloc(
      -	sizeof(TYPE1) * sizeof(THING2) * (COUNT)
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
        , ...)
      )
      
      // 3-factor product, only identifiers, with redundant parens removed.
      @@
      identifier STRIDE, SIZE, COUNT;
      @@
      
      (
        kzalloc(
      -	(COUNT) * STRIDE * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kzalloc(
      -	COUNT * (STRIDE) * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kzalloc(
      -	COUNT * STRIDE * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kzalloc(
      -	(COUNT) * (STRIDE) * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kzalloc(
      -	COUNT * (STRIDE) * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kzalloc(
      -	(COUNT) * STRIDE * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kzalloc(
      -	(COUNT) * (STRIDE) * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kzalloc(
      -	COUNT * STRIDE * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      )
      
      // Any remaining multi-factor products, first at least 3-factor products,
      // when they're not all constants...
      @@
      expression E1, E2, E3;
      constant C1, C2, C3;
      @@
      
      (
        kzalloc(C1 * C2 * C3, ...)
      |
        kzalloc(
      -	(E1) * E2 * E3
      +	array3_size(E1, E2, E3)
        , ...)
      |
        kzalloc(
      -	(E1) * (E2) * E3
      +	array3_size(E1, E2, E3)
        , ...)
      |
        kzalloc(
      -	(E1) * (E2) * (E3)
      +	array3_size(E1, E2, E3)
        , ...)
      |
        kzalloc(
      -	E1 * E2 * E3
      +	array3_size(E1, E2, E3)
        , ...)
      )
      
      // And then all remaining 2 factors products when they're not all constants,
      // keeping sizeof() as the second factor argument.
      @@
      expression THING, E1, E2;
      type TYPE;
      constant C1, C2, C3;
      @@
      
      (
        kzalloc(sizeof(THING) * C2, ...)
      |
        kzalloc(sizeof(TYPE) * C2, ...)
      |
        kzalloc(C1 * C2 * C3, ...)
      |
        kzalloc(C1 * C2, ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(TYPE) * (E2)
      +	E2, sizeof(TYPE)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(TYPE) * E2
      +	E2, sizeof(TYPE)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(THING) * (E2)
      +	E2, sizeof(THING)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	sizeof(THING) * E2
      +	E2, sizeof(THING)
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	(E1) * E2
      +	E1, E2
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	(E1) * (E2)
      +	E1, E2
        , ...)
      |
      - kzalloc
      + kcalloc
        (
      -	E1 * E2
      +	E1, E2
        , ...)
      )
      Signed-off-by: NKees Cook <keescook@chromium.org>
      6396bb22
  6. 02 6月, 2018 2 次提交
    • G
      ASoC: topology: Move v4 manifest header data structures to uapi · 348f4822
      Guenter Roeck 提交于
      Topology manifest v4 is still part of the ABI. Move its data structures
      into the uapi header file.
      
      No functional change.
      Signed-off-by: NGuenter Roeck <groeck@chromium.org>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      348f4822
    • G
      ASoC: topology: Improve backwards compatibility with v4 topology files · ac9391da
      Guenter Roeck 提交于
      Commit dc31e741 ("ASoC: topology: ABI - Add the types for BE
      DAI") introduced sound topology files version 5. Initially, this
      change made the topology code incompatible with v4 topology files.
      Backwards compatibility with v4 configuration files was
      subsequently added with commit 288b8da7 ("ASoC: topology:
      Support topology file of ABI v4").
      
      Unfortunately, backwards compatibility was never fully implemented.
      
      First, the manifest size in (Skylake) v4 configuration files is set
      to 0, which causes manifest_new_ver() to bail out with error messages
      similar to the following.
      
      snd_soc_skl 0000:00:1f.3: ASoC: invalid manifest size
      snd_soc_skl 0000:00:1f.3: tplg component load failed-22
      snd_soc_skl 0000:00:1f.3: Failed to init topology!
      snd_soc_skl 0000:00:1f.3: ASoC: failed to probe component -22
      skl_n88l25_m98357a skl_n88l25_m98357a: ASoC: failed to instantiate card -22
      skl_n88l25_m98357a: probe of skl_n88l25_m98357a failed with error -22
      
      After this problem is fixed, the following error message is seen instead.
      
      snd_soc_skl 0000:00:1f.3: ASoC: old version of manifest
      snd_soc_skl 0000:00:1f.3: Invalid descriptor token 1093938482
      snd_soc_skl 0000:00:1f.3: ASoC: failed to load widget media0_in cpr 0
      snd_soc_skl 0000:00:1f.3: tPlg component load failed-22
      
      This message is seen because backwards compatibility for loading widgets
      was never implemented.
      
      The lack of audio support when running the upstream kernel on recent
      Chromebooks has been reported in various forums, and can be traced back
      to this problem. Attempts to fix the problem, usually by providing v5
      configuration files, were only partially successful.
      
      Let's implement backward compatibility properly to solve the problem
      for good.
      Signed-off-by: NGuenter Roeck <groeck@chromium.org>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      ac9391da
  7. 18 4月, 2018 5 次提交
  8. 17 4月, 2018 4 次提交
  9. 12 4月, 2018 1 次提交
  10. 27 3月, 2018 1 次提交
  11. 19 3月, 2018 1 次提交
  12. 13 3月, 2018 1 次提交
  13. 15 9月, 2017 2 次提交
  14. 30 6月, 2017 3 次提交
  15. 10 6月, 2017 1 次提交
  16. 09 6月, 2017 1 次提交
  17. 08 6月, 2017 3 次提交
  18. 19 4月, 2017 1 次提交
  19. 12 4月, 2017 1 次提交
  20. 28 2月, 2017 1 次提交
  21. 18 1月, 2017 1 次提交
    • L
      ASoC: dapm: handle probe deferrals · 37e1df8c
      Linus Walleij 提交于
      This starts to handle probe deferrals on regulators and clocks
      on the ASoC DAPM.
      
      I came to this patch after audio stopped working on Ux500 ages
      ago and I finally looked into it to see what is wrong. I had
      messages like this in the console since a while back:
      
      ab8500-codec.0: ASoC: Failed to request audioclk: -517
      ab8500-codec.0: ASoC: Failed to create DAPM control audioclk
      ab8500-codec.0: Failed to create new controls -12
      snd-soc-mop500.0: ASoC: failed to instantiate card -12
      snd-soc-mop500.0: Error: snd_soc_register_card failed (-12)!
      snd-soc-mop500: probe of snd-soc-mop500.0 failed with error -12
      
      Apparently because the widget table for the codec looks like
      this (sound/soc/codecs/ab8500-codec.c):
      
      static const struct snd_soc_dapm_widget ab8500_dapm_widgets[] = {
      
              /* Clocks */
              SND_SOC_DAPM_CLOCK_SUPPLY("audioclk"),
      
              /* Regulators */
              SND_SOC_DAPM_REGULATOR_SUPPLY("V-AUD", 0, 0),
              SND_SOC_DAPM_REGULATOR_SUPPLY("V-AMIC1", 0, 0),
              SND_SOC_DAPM_REGULATOR_SUPPLY("V-AMIC2", 0, 0),
              SND_SOC_DAPM_REGULATOR_SUPPLY("V-DMIC", 0, 0),
      
      So when we call snd_soc_register_codec() and any of these widgets
      get a deferred probe we do not get an -EPROBE_DEFER (-517) back as
      we should and instead we just fail. Apparently the code assumes
      that clocks and regulators must be available at this point and
      not defer.
      
      After this patch it rather looks like this:
      
      ab8500-codec.0: Failed to create new controls -517
      snd-soc-mop500.0: ASoC: failed to instantiate card -517
      snd-soc-mop500.0: Error: snd_soc_register_card failed (-517)!
      (...)
      abx500-clk.0: registered clocks for ab850x
      snd-soc-mop500.0: ab8500-codec-dai.0 <-> ux500-msp-i2s.1 mapping ok
      snd-soc-mop500.0: ab8500-codec-dai.1 <-> ux500-msp-i2s.3 mapping ok
      
      I'm pretty happy about the patch as it it, but I'm a bit
      uncertain on how to proceed: there are a lot of users of the
      external functions snd_soc_dapm_new_control() (111 sites)
      and that will now return an occassional error pointer, which
      is not handled in the calling sites.
      
      I want an indication from the maintainers whether I should just
      go in and augment all these call sites, or if deferred probe
      is frowned upon when it leads to this much overhead.
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      37e1df8c
  22. 13 1月, 2017 1 次提交
  23. 15 12月, 2016 2 次提交
  24. 12 12月, 2016 1 次提交
  25. 05 12月, 2016 1 次提交