1. 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
  2. 07 6月, 2018 1 次提交
    • K
      treewide: Use struct_size() for kmalloc()-family · acafe7e3
      Kees Cook 提交于
      One of the more common cases of allocation size calculations is finding
      the size of a structure that has a zero-sized array at the end, along
      with memory for some number of elements for that array. For example:
      
      struct foo {
          int stuff;
          void *entry[];
      };
      
      instance = kmalloc(sizeof(struct foo) + sizeof(void *) * count, GFP_KERNEL);
      
      Instead of leaving these open-coded and prone to type mistakes, we can
      now use the new struct_size() helper:
      
      instance = kmalloc(struct_size(instance, entry, count), GFP_KERNEL);
      
      This patch makes the changes for kmalloc()-family (and kvmalloc()-family)
      uses. It was done via automatic conversion with manual review for the
      "CHECKME" non-standard cases noted below, using the following Coccinelle
      script:
      
      // pkey_cache = kmalloc(sizeof *pkey_cache + tprops->pkey_tbl_len *
      //                      sizeof *pkey_cache->table, GFP_KERNEL);
      @@
      identifier alloc =~ "kmalloc|kzalloc|kvmalloc|kvzalloc";
      expression GFP;
      identifier VAR, ELEMENT;
      expression COUNT;
      @@
      
      - alloc(sizeof(*VAR) + COUNT * sizeof(*VAR->ELEMENT), GFP)
      + alloc(struct_size(VAR, ELEMENT, COUNT), GFP)
      
      // mr = kzalloc(sizeof(*mr) + m * sizeof(mr->map[0]), GFP_KERNEL);
      @@
      identifier alloc =~ "kmalloc|kzalloc|kvmalloc|kvzalloc";
      expression GFP;
      identifier VAR, ELEMENT;
      expression COUNT;
      @@
      
      - alloc(sizeof(*VAR) + COUNT * sizeof(VAR->ELEMENT[0]), GFP)
      + alloc(struct_size(VAR, ELEMENT, COUNT), GFP)
      
      // Same pattern, but can't trivially locate the trailing element name,
      // or variable name.
      @@
      identifier alloc =~ "kmalloc|kzalloc|kvmalloc|kvzalloc";
      expression GFP;
      expression SOMETHING, COUNT, ELEMENT;
      @@
      
      - alloc(sizeof(SOMETHING) + COUNT * sizeof(ELEMENT), GFP)
      + alloc(CHECKME_struct_size(&SOMETHING, ELEMENT, COUNT), GFP)
      Signed-off-by: NKees Cook <keescook@chromium.org>
      acafe7e3
  3. 04 6月, 2018 1 次提交
  4. 01 6月, 2018 1 次提交
  5. 14 3月, 2018 1 次提交
  6. 15 2月, 2018 1 次提交
  7. 07 2月, 2018 1 次提交
    • K
      ASoC: dapm: fix debugfs read using path->connected · 28735af3
      KaiChieh Chuang 提交于
      This fix a bug in dapm_widget_power_read_file(),
      where it may sent opposite order of source/sink widget
      into the p->connected().
      
      for example,
      static int connected_check(source, sink);
      {"w_sink", NULL, "w_source", connected_check}
      
      the dapm_widget_power_read_file() will query p->connected()
      in following case
      	p->conneted("w_source", "w_sink")
      	p->conneted("w_sink", "w_source")
      we should avoid the last case, since it's the wrong order (source/sink)
      as declared in snd_soc_dapm_route.
      Signed-off-by: NKaiChieh Chuang <kaichieh.chuang@mediatek.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      28735af3
  8. 09 1月, 2018 1 次提交
  9. 10 10月, 2017 2 次提交
    • A
      ASoC: dapm: mark 'snd_soc_dapm_free_kcontrol' as static · c42c5ac4
      Arnd Bergmann 提交于
      The newly introduced function is declared as globally visible,
      but is not declared in a header, causing a warning 'make W=1'
      or 'make C=1':
      
      sound/soc/soc-dapm.c:3782:1: warning: symbol 'snd_soc_dapm_free_kcontrol' was not declared. Should it be static?
      
      The suggestion to make it static seems appropriate here, so let's
      do that.
      
      Fixes: 19ad683a ("ASoC: dapm: Avoid creating kcontrol for params")
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      c42c5ac4
    • A
      ASoC: dapm: add initialization for w_param_text pointer · 667ebc97
      Arnd Bergmann 提交于
      We now allocate the array conditionally, but we always pass
      the pointer to the new snd_soc_dapm_free_kcontrol() function,
      which introduces a warning for the case that it is not
      initialized:
      
      sound/soc/soc-dapm.c: In function 'snd_soc_dapm_new_pcm':
      sound/soc/soc-dapm.c:3940:2: error: 'w_param_text' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      
      As snd_soc_dapm_free_kcontrol() is global, it doesn't get inlined
      and gcc fails to notice that we don't actually access the array
      in that case, so the code is actually safe. Adding an initialization
      for the array pointer shuts up the warning.
      
      Fixes: 19ad683a ("ASoC: dapm: Avoid creating kcontrol for params")
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      667ebc97
  10. 06 10月, 2017 1 次提交
  11. 26 9月, 2017 2 次提交
  12. 20 9月, 2017 2 次提交
  13. 20 1月, 2017 1 次提交
  14. 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
  15. 02 11月, 2016 2 次提交
    • C
      ASoC: dapm: Implement stereo mixer control support · e7aa450f
      Chen-Yu Tsai 提交于
      While DAPM is mono or single channel, its controls can be shared between
      widgets, such as sharing one stereo mixer control between the left and
      right channel widgets. An example such as the following routes
      
          [Line In Left]----------<Line In Playback Switch>-------[Left Mixer]
                                                ^
                ^           ^                   |                      ^
             (inputs)    (paths)   <shared stereo mixer control>   (outputs)
                v           v                   |                      v
                                                v
          [Line In Right]---------<Line In Playback Switch>-------[Right Mixer]
      
      where we have separate widgets and paths for the left and right channels
      from "Line In" to "Mixer", but a shared stereo mixer control for the
      2 paths.
      
      This patch introduces support for such shared mixer controls, allowing
      more than 1 path to be attached to a single stereo control, and being
      able to control left/right channels independently.
      Signed-off-by: NChen-Yu Tsai <wens@csie.org>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      e7aa450f
    • C
      ASoC: dapm: Support second register for DAPM control updates · e411b0b5
      Chen-Yu Tsai 提交于
      To support double channel shared controls split across 2 registers, one
      for each channel, we must be able to update both registers together.
      
      Add a second set of register fields to struct snd_soc_dapm_update, and
      update the DAPM control writeback (put) callbacks to support this.
      
      For codecs that use custom events which call into DAPM to do updates,
      also clear struct snd_soc_dapm_update before using it, so the second
      set of fields remains clean.
      Signed-off-by: NChen-Yu Tsai <wens@csie.org>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      e411b0b5
  16. 02 9月, 2016 3 次提交
  17. 16 8月, 2016 1 次提交
  18. 28 7月, 2016 1 次提交
    • N
      ASoC: dapm: Add a dummy snd_pcm_runtime to avoid NULL pointer access · 8053f216
      Nicolin Chen 提交于
      The SND_SOC_DAPM_PRE_PMU case would call startup()/hw_params() that
      might access substream->runtime through other functions.
      
      For example:
      
      Unable to handle kernel NULL pointer dereference at virtual address
      [....]
      PC is at snd_pcm_hw_rule_add+0x24/0x1b0
      LR is at snd_pcm_hw_constraint_list+0x20/0x28
      [....]
      Process arecord (pid: 424, stack limit = 0xffffffc1ecaf0020)
      Call trace:
      [<ffffffc00086be68>] snd_pcm_hw_rule_add+0x24/0x1b0
      [<ffffffc00086c014>] snd_pcm_hw_constraint_list+0x20/0x28
      [<ffffffc0008b47a4>] cs53l30_pcm_startup+0x24/0x30
      [<ffffffc0008a6260>] snd_soc_dai_link_event+0x290/0x354
      [<ffffffc0008a7528>] dapm_seq_check_event.isra.31+0x134/0x2c8
      [<ffffffc0008a7768>] dapm_seq_run_coalesced+0x94/0x1c8
      [<ffffffc0008a7940>] dapm_seq_run+0xa4/0x404
      [<ffffffc0008a8bac>] dapm_power_widgets+0x524/0x984
      [<ffffffc0008ab1c4>] snd_soc_dapm_stream_event+0x8c/0xa8
      [<ffffffc0008ac7f4>] soc_pcm_prepare+0x10c/0x1ec
      [<ffffffc000865b9c>] snd_pcm_do_prepare+0x1c/0x38
      [<ffffffc000865600>] snd_pcm_action_single+0x40/0x88
      [<ffffffc0008656b8>] snd_pcm_action_nonatomic+0x70/0x90
      [<ffffffc000868d28>] snd_pcm_common_ioctl1+0xb6c/0xdd8
      [<ffffffc000869508>] snd_pcm_capture_ioctl1+0x200/0x334
      [<ffffffc00086a084>] snd_pcm_ioctl_compat+0x648/0x95c
      [<ffffffc0001ff4b4>] compat_SyS_ioctl+0xac/0xfc4
      [<ffffffc000084cf0>] el0_svc_naked+0x24/0x28
      ---[ end trace 0dc4f99c2759c35c ]---
      
      So this patch adds a dummy runtime for the original dummy substream
      to merely avoid the NULL pointer access.
      Signed-off-by: NNicolin Chen <nicoleotsuka@gmail.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      8053f216
  19. 05 7月, 2016 1 次提交
  20. 15 6月, 2016 1 次提交
  21. 30 5月, 2016 1 次提交
    • P
      ASoC: dapm: support user-defined stop condition in dai_get_connected_widgets · 6742064a
      Piotr Stankiewicz 提交于
      Certain situations may warrant examining DAPM paths only to a certain
      arbitrary point, as opposed to always following them to the end. For
      instance, when establishing a connection between a front-end DAI link
      and a back-end DAI link in a DPCM path, it does not make sense to walk
      the DAPM graph beyond the first widget associated with a back-end link.
      
      This patch introduces a mechanism which lets a user of
      dai_get_connected_widgets supply a function which will be called for
      every node during the graph walk. When invoked, this function can
      execute arbitrary logic to decide whether the walk, given a DAPM widget
      and walk direction, should be terminated at that point or continued
      as normal.
      Signed-off-by: NPiotr Stankiewicz <piotrs@opensource.wolfsonmicro.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      6742064a
  22. 18 3月, 2016 1 次提交
  23. 05 3月, 2016 1 次提交
  24. 01 3月, 2016 1 次提交
  25. 04 2月, 2016 1 次提交
  26. 02 12月, 2015 1 次提交
    • C
      ASoC: dapm: Make enable/disable_pin work with always on widgets · 20bb0184
      Charles Keepax 提交于
      Always on widgets currently have some odd interactions with DAPM.
      Enabling/disabling a widget (snd_soc_dapm_enable_pin) then connecting
      it to a path works as expected, ie. when the widget is disabled the
      path doesn't power up and it does when the widget is enabled. However
      once in a path enabling the widget does not cause anything to power
      up, dapm_widget_set_power will return the current power state of the
      widget as 1, meaning we never check peer power states.
      
      This patch updates dapm_always_on_check_power to return w->connected
      such that it is effected by snd_soc_dapm_enable_pin and the like.
      Signed-off-by: NCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      20bb0184
  27. 25 11月, 2015 1 次提交
  28. 19 11月, 2015 1 次提交
    • M
      ASoC: Change the PCM runtime array to a list · 1a497983
      Mengdong Lin 提交于
      Currently the number of DAI links is statically defined by the machine
      driver at build time using an array. This makes it difficult to shrink/
      grow the number of DAI links at runtime in order to reflect any changes
      in topology.
      
      We can change the DAI link array in the core to a list so that PCMs and
      FE DAI links can be added and deleted at runtime to reflect changes in
      use case and DSP topology. The machine driver can still register DAI links
      as an array.
      
      As the 1st step, this patch change the PCM runtime array to a list. A new
      PCM runtime is added to the list when a DAI link is bound successfully.
      
      Later patches will further implement the DAI link list.
      
      More:
      - define snd_soc_new/free_pcm_runtime() to create/free a runtime.
      - define soc_add_pcm_runtime() to add a runtime to the rtd list.
      - define soc_remove_pcm_runtimes() to clean up the runtime list.
      
      - traverse the rtd list to probe the link components and dais.
      
      - Add a field "num" to PCM runtime struct, used to specify the device
        number when creating the pcm device, and for a soc card to access
        its dai_props array.
      
      - The following 3rd party machine/platform drivers iterate the rtd list
        to check the runtimes:
        sound/soc/intel/atom/sst-mfld-platform-pcm.c
        sound/soc/intel/boards/cht_bsw_rt5645.c
        sound/soc/intel/boards/cht_bsw_rt5672.c
        sound/soc/intel/boards/cht_bsw_max98090_ti.c
      Signed-off-by: NMengdong Lin <mengdong.lin@linux.intel.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      1a497983
  29. 11 11月, 2015 1 次提交
  30. 22 10月, 2015 3 次提交
  31. 11 9月, 2015 1 次提交
  32. 29 8月, 2015 1 次提交