22 Jul, 2020

1 commit

  • commit 01360857486c0e4435dea3aa2f78b47213b7cf6a upstream.

    Adding missing corresponding of_node_put

    Fixes: 7588a511bdb4 ("slimbus: core: add support to device tree helper")
    Signed-off-by: Saravana Kannan
    [Srini: added fixes tag, removed NULL check and updated log]
    Signed-off-by: Srinivas Kandagatla
    Link: https://lore.kernel.org/r/20200511151334.362-3-srinivas.kandagatla@linaro.org
    Signed-off-by: Greg Kroah-Hartman

    Saravana Kannan
     

24 Jun, 2020

1 commit

  • [ Upstream commit b58c663059b484f7ff547d076a34cf6d7a302e56 ]

    Get drvdata directly from parent instead of ngd dev, as ngd
    dev can probe defer and previously set drvdata will become null.

    Signed-off-by: Srinivas Kandagatla
    Link: https://lore.kernel.org/r/20200417093618.7929-1-srinivas.kandagatla@linaro.org
    Signed-off-by: Greg Kroah-Hartman
    Signed-off-by: Sasha Levin

    Srinivas Kandagatla
     

18 Aug, 2019

2 commits

  • fix below issue reported by coccicheck
    ./drivers/slimbus/slimbus.h:440:3-46: duplicated argument to && or ||

    Looks like this was a typo, SLIM_MSG_MC_REQUEST_CHANGE_VALUE is command
    which requires transaction ID, so fix it, this also fix the warning.

    Reported-by: Hariprasad Kelam
    Signed-off-by: Srinivas Kandagatla
    Link: https://lore.kernel.org/r/20190818093902.29993-3-srinivas.kandagatla@linaro.org
    Signed-off-by: Greg Kroah-Hartman

    Srinivas Kandagatla
     
  • Each iteration of for_each_available_child_of_node puts the previous
    node, but in the case of a return from the middle of the loop, there is
    no put, thus causing a memory leak. Hence add an of_node_put before the
    return in two places.
    Issue found with Coccinelle.

    Signed-off-by: Nishka Dasgupta
    Reviewed-by: Bjorn Andersson
    Signed-off-by: Srinivas Kandagatla
    Link: https://lore.kernel.org/r/20190818093902.29993-2-srinivas.kandagatla@linaro.org
    Signed-off-by: Greg Kroah-Hartman

    Nishka Dasgupta
     

20 Jun, 2019

2 commits


11 Jun, 2019

1 commit

  • The kerneldoc comments in drivers/slimbus/stream.c were not properly
    formatted, leading to a distinctly unsatisfying "no structured comments
    found" warning in the docs build. Sprinkle some asterisks around so that
    the comments will be properly recognized.

    Signed-off-by: Jonathan Corbet
    Signed-off-by: Greg Kroah-Hartman

    Jonathan Corbet
     

26 Apr, 2019

1 commit


22 Jan, 2019

4 commits


06 Dec, 2018

2 commits


27 Nov, 2018

2 commits

  • QCOM_QMI_HELPERS is a hidden kconfig, so the proper usage is
    to select it, not depend upon it.

    Because of this change, we now also need to depend on the same
    Kconfigs as QCOM_QMI_HELPERS depends on.

    Signed-off-by: Niklas Cassel
    Signed-off-by: Srinivas Kandagatla
    Signed-off-by: Greg Kroah-Hartman

    Niklas Cassel
     
  • on non DT platforms like x86 of_match_node is set to NULL, dereferencing
    directly would throw an error.
    Fix this by doing this in two steps, get the match then the data.

    Reported-by: Greg KH
    Signed-off-by: Srinivas Kandagatla
    Signed-off-by: Greg Kroah-Hartman

    Srinivas Kandagatla
     

07 Nov, 2018

1 commit

  • SLIM_MSG_CLK_PAUSE_SEQ_FLG is never set in any of the slim core,
    so performing a check in ngd driver is totally unnecessary.

    Also this patch fixes warning about mc field overflow reported
    with CoverityScan.

    Making clk pause feature optional will be added to slim core in
    next development cycle.

    Reported-by: Colin Ian King
    Fixes: 917809e2280b ("slimbus: ngd: Add qcom SLIMBus NGD driver")
    Signed-off-by: Srinivas Kandagatla
    Signed-off-by: Greg Kroah-Hartman

    Srinivas Kandagatla
     

26 Sep, 2018

7 commits


14 Sep, 2018

1 commit

  • qcom_slim_ngd_runtime_suspend is protected by an #ifdef,
    qcom_slim_ngd_runtime_idle is now, which causes a build time warning:

    drivers/slimbus/qcom-ngd-ctrl.c:1470:12: error: 'qcom_slim_ngd_runtime_idle' defined but not used [-Werror=unused-function]

    Marking both as __maybe_unused lets us get rid of the warning
    as well as the #ifdef.

    Fixes: 917809e2280b ("slimbus: ngd: Add qcom SLIMBus NGD driver")
    Signed-off-by: Arnd Bergmann
    Signed-off-by: Greg Kroah-Hartman

    Arnd Bergmann
     

08 Jul, 2018

1 commit

  • This patch fixes below warning during building htmldoc:
    slimbus.h:352: warning: Function parameter or member 'name'
    not described in 'slim_stream_runtime'

    This patch also removes documentation for state variable
    in struct slim_stream_runtime which was redundant and removed.

    Reported-by: kbuild test robot
    Signed-off-by: Srinivas Kandagatla
    Signed-off-by: Greg Kroah-Hartman

    Srinivas Kandagatla
     

07 Jul, 2018

9 commits

  • This patch adds support to stream support, this involve implementing
    user specific implementation of Data channel management and channel
    management SLIMbus messages.

    Signed-off-by: Srinivas Kandagatla
    Signed-off-by: Greg Kroah-Hartman

    Srinivas Kandagatla
     
  • This patch adds support to SLIMbus stream apis for slimbus device.
    SLIMbus streaming involves adding support to Data Channel Management and
    channel Reconfiguration Messages to slim core plus few stream apis.
    >From slim device side the apis are very simple mostly inline with other
    stream apis.

    Currently it only supports Isochronous and Push/Pull transport protocols,
    which are sufficient for audio use cases.

    Signed-off-by: Srinivas Kandagatla
    Signed-off-by: Greg Kroah-Hartman

    Srinivas Kandagatla
     
  • This patch adds suppor to Qualcomm SLIMBus Non-Generic Device (NGD)
    controller driver.
    This is light-weight SLIMBus controller driver responsible for
    communicating with slave HW directly over the bus using messaging
    interface, and communicating with master component residing on ADSP
    for bandwidth and data-channel management

    Based on intial work from
    Karthikeyan Ramasubramanian and
    Sagar Dharia

    Signed-off-by: Srinivas Kandagatla
    Tested-by: Craig Tatlor
    Reviewed-by: Vinod Koul
    Signed-off-by: Greg Kroah-Hartman

    Srinivas Kandagatla
     
  • This patch adds slim_alloc_txn_tid() and slim_free_txn_tid() api
    to allow controllers like ngd to allocate tids for user specific
    commands. This also cleans up the existing code to use single place
    for tid allocations and free.

    This patch also make the tid allocation cyclic one, its very useful
    to track the transactions back during debug.

    Signed-off-by: Srinivas Kandagatla
    Signed-off-by: Greg Kroah-Hartman

    Srinivas Kandagatla
     
  • On SLIMBus controllers like Qcom NGD(non ported device), controller
    can request logical address once the remote side is powered, having a
    helper function like this to explicitly enumerate the bus is helpful.
    Also codec drivers which are taking to interface device would need
    such a helper too.

    Signed-off-by: Srinivas Kandagatla
    Signed-off-by: Greg Kroah-Hartman

    Srinivas Kandagatla
     
  • QCOM SLIMBus controller is already under a 'if SLIMBUS' in Kconfig,
    having depends on SLIMBUS is totally redundant. Just remove it.

    Signed-off-by: Srinivas Kandagatla
    Signed-off-by: Greg Kroah-Hartman

    Srinivas Kandagatla
     
  • slim_val_inf can contain random value from stack, make sure the completion
    is initialized to NULL while filling the msg.

    Signed-off-by: Srinivas Kandagatla
    Signed-off-by: Greg Kroah-Hartman

    Srinivas Kandagatla
     
  • There seems to be a multiple calls to pm_runtime_mark_last_busy(),
    which looks like a typo.
    Fix this by properly adding pm_runtime_put_autosuspend to put controller
    in auto suspend state.

    Signed-off-by: Srinivas Kandagatla
    Signed-off-by: Greg Kroah-Hartman

    Srinivas Kandagatla
     
  • There seems to be a typo while filling msg for slim_write, wbuf is
    set to NULL instead of rbuf.

    Signed-off-by: Srinivas Kandagatla
    Signed-off-by: Greg Kroah-Hartman

    Srinivas Kandagatla
     

13 Jun, 2018

1 commit

  • 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: Kees Cook

    Kees Cook
     

14 May, 2018

1 commit

  • This patch fixes below warning when driver is compiled with W=1
    qcom-ctrl.c: In function 'qcom_slim_rxwq':
    qcom-ctrl.c:442:13: warning: variable 'len' set but not used
    [-Wunused-but-set-variable]

    len seems to be unused in this function, so remove it.

    Signed-off-by: Srinivas Kandagatla
    Signed-off-by: Greg Kroah-Hartman

    Srinivas Kandagatla
     

23 Apr, 2018

1 commit

  • With gcc-4.1.2:

    slimbus/messaging.c: In function ‘slim_slicesize’:
    slimbus/messaging.c:186: warning: statement with no effect

    Indeed, clamp() is a macro not operating in-place, but returning the
    clamped value. Hence the value is not clamped at all, which may lead to
    an out-of-bounds access.

    Fix this by assigning the clamped value.

    Fixes: afbdcc7c384b0d44 ("slimbus: Add messaging APIs to slimbus framework")
    Signed-off-by: Geert Uytterhoeven
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Geert Uytterhoeven
     

16 Mar, 2018

1 commit


10 Jan, 2018

1 commit

  • Below build failure was reported on UML,
    ERROR: "devm_ioremap_resource" [drivers/slimbus/slim-qcom-ctrl.ko] undefined!
    ERROR: "__ioread32_copy" [drivers/slimbus/slim-qcom-ctrl.ko] undefined!
    ERROR: "__iowrite32_copy" [drivers/slimbus/slim-qcom-ctrl.ko] undefined!
    ERROR: "devm_ioremap" [drivers/slimbus/slim-qcom-ctrl.ko] undefined!

    This patch fixes it by making qcom slimbus depend on HAS_IOMEM, as
    these are only defined when HAS_IOMEM is selected.

    Reported-by: Thomas Meyer
    Signed-off-by: Srinivas Kandagatla
    Signed-off-by: Greg Kroah-Hartman

    Srinivas Kandagatla