Skip to content
Permalink
Chen-Yu-Tsai/c…
Switch branches/tags

Commits on Jan 22, 2022

  1. clk: mediatek: Warn if clk IDs are duplicated

    The Mediatek clk driver library handles duplicate clock IDs in two
    different ways: either ignoring the duplicate entry, or overwriting
    the old clk. Either way may cause unexpected behavior, and the latter
    also causes an orphan clk that cannot be cleaned up.
    
    Align the behavior so that later duplicate entries are ignored, and
    a warning printed. The warning will also aid in making the issue
    noticeable.
    
    Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
    wens authored and intel-lab-lkp committed Jan 22, 2022
  2. clk: mediatek: mt8195: Implement remove functions

    Until now the mediatek clk driver library did not have any way to
    unregister clks, and so none of the drivers implemented remove
    functions.
    
    Now that the library does have APIs to unregister clks, use them
    to implement remove functions for the mt8195 clk drivers.
    
    Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
    wens authored and intel-lab-lkp committed Jan 22, 2022
  3. clk: mediatek: mt8195: Implement error handling in probe functions

    Until now the mediatek clk driver library did not have any way to
    unregister clks, and so all drivers did not do proper cleanup in
    their error paths.
    
    Now that the library does have APIs to unregister clks, use them
    in the error path of the probe functions for the mt8195 clk drivers
    to do proper cleanup.
    
    Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
    wens authored and intel-lab-lkp committed Jan 22, 2022
  4. clk: mediatek: mt8195: Hook up mtk_clk_simple_remove()

    Various small clock controllers only have clock gates, and utilize
    mtk_clk_simple_probe() as their driver probe function.
    
    Now that we have a matching remove function, hook it up for the relevant
    drivers. This was done with the following command:
    
    sed -i -e '/mtk_clk_simple_probe/a \
            .remove = mtk_clk_simple_remove,' drivers/clk/mediatek/clk-mt8195-*.c
    
    Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
    wens authored and intel-lab-lkp committed Jan 22, 2022
  5. clk: mediatek: Unregister clks in mtk_clk_simple_probe() error path

    Until now the mediatek clk driver library did not have any way to
    unregister clks, and so all drivers did not do proper cleanup in
    their error paths.
    
    Now that the library does have APIs to unregister clks, use them
    in the error path of mtk_clk_simple_probe() to do proper cleanup.
    
    Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
    wens authored and intel-lab-lkp committed Jan 22, 2022
  6. clk: mediatek: mtk: Implement error handling in register APIs

    The remaining clk registration functions do not stop or return errors
    if any clk failed to be registered, nor do they implement error
    handling paths. This may result in a partially working device if any
    step fails.
    
    Make the register functions return proper error codes, and bail out if
    errors occur. Proper cleanup, i.e. unregister any clks that were
    successfully registered, is done in the new error path.
    
    This also makes the |struct clk_data *| argument mandatory, as it is
    used to track the list of clks registered.
    
    Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
    wens authored and intel-lab-lkp committed Jan 22, 2022
  7. clk: mediatek: pll: Implement error handling in register API

    The pll clk type registration function does not stop or return errors
    if any clk failed to be registered, nor does it implement an error
    handling path. This may result in a partially working device if any
    step failed.
    
    Make the register function return proper error codes, and bail out if
    errors occur. Proper cleanup, i.e. unregister any clks that were
    successfully registered, and unmap the I/O space, is done in the new
    error path.
    
    Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
    wens authored and intel-lab-lkp committed Jan 22, 2022
  8. clk: mediatek: mux: Implement error handling in register API

    The mux clk type registration function does not stop or return errors
    if any clk failed to be registered, nor does it implement an error
    handling path. This may result in a partially working device if any
    step failed.
    
    Make the register function return proper error codes, and bail out if
    errors occur. Proper cleanup, i.e. unregister any clks that were
    successfully registered, is done in the new error path.
    
    Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
    wens authored and intel-lab-lkp committed Jan 22, 2022
  9. clk: mediatek: mux: Reverse check for existing clk to reduce nesting …

    …level
    
    The clk registration code here currently does:
    
        if (IS_ERR_OR_NULL(clk_data->clks[mux->id])) {
                ... do clk registration ...
        }
    
    This extra level of nesting wastes screen real estate.
    
    Reduce the nesting level by reversing the conditional shown above.
    Other than that, functionality is not changed.
    
    Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
    wens authored and intel-lab-lkp committed Jan 22, 2022
  10. clk: mediatek: gate: Implement error handling in register API

    The gate clk type registration function does not stop or return errors
    if any clk failed to be registered, nor does it implement an error
    handling path. This may result in a partially working device if any
    step failed.
    
    Make the register function return proper error codes, and bail out if
    errors occur. Proper cleanup, i.e. unregister any clks that were
    successfully registered, is done in the new error path.
    
    Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
    wens authored and intel-lab-lkp committed Jan 22, 2022
  11. clk: mediatek: cpumux: Implement error handling in register API

    The cpumux clk type registration function does not stop or return errors
    if any clk failed to be registered, nor does it implement an error
    handling path. This may result in a partially working device if any
    step failed.
    
    Make the register function return proper error codes, and bail out if
    errors occur. Proper cleanup, i.e. unregister any clks that were
    successfully registered, is done in the new error path.
    
    Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
    wens authored and intel-lab-lkp committed Jan 22, 2022
  12. clk: mediatek: mtk: Clean up included headers

    Some included headers aren't actually used anywhere, while other headers
    with the declaration of functions and structures aren't directly
    included.
    
    Get rid of the unused ones, and add the ones that should be included
    directly.
    
    On the header side, replace headers that are included purely for data
    structure definitions with forward declarations. This decreases the
    amount of preprocessing and compilation effort required for each
    inclusion.
    
    Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
    wens authored and intel-lab-lkp committed Jan 22, 2022
  13. clk: mediatek: Add mtk_clk_simple_remove()

    In commit c58cd0e ("clk: mediatek: Add mtk_clk_simple_probe() to
    simplify clock providers"), a generic probe function was added to
    simplify clk drivers that only needed to support clk gates. However due
    to the lack of unregister APIs, a corresponding remove function was not
    added.
    
    Now that the unregister APIs have been implemented, add aforementioned
    remove function to make it complete.
    
    Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
    wens authored and intel-lab-lkp committed Jan 22, 2022
  14. clk: mediatek: Implement mtk_clk_unregister_composites() API

    mtk_clk_register_composites(), as the name suggests, is used to register
    a given list of composite clks. However it is lacking a counterpart
    unregister API.
    
    Implement said unregister API so that the various clock platform drivers
    can utilize it to do proper unregistration, cleanup and removal.
    
    In the header file, the register function's declaration is also
    reformatted to fit code style guidelines.
    
    Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
    wens authored and intel-lab-lkp committed Jan 22, 2022
  15. clk: mediatek: Implement mtk_clk_unregister_divider_clks() API

    mtk_clk_register_divider_clks(), as the name suggests, is used to register
    a given list of divider clks. However it is lacking a counterpart
    unregister API.
    
    Implement said unregister API so that the various clock platform drivers
    can utilize it to do proper unregistration, cleanup and removal.
    
    In the header file, the register function's declaration is also
    reformatted to fit code style guidelines.
    
    Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
    wens authored and intel-lab-lkp committed Jan 22, 2022
  16. clk: mediatek: Implement mtk_clk_unregister_factors() API

    mtk_clk_register_factors(), as the name suggests, is used to register
    a given list of fixed factor clks. However it is lacking a counterpart
    unregister API.
    
    Implement said unregister API so that the various clock platform drivers
    can utilize it to do proper unregistration, cleanup and removal.
    
    In the header file, the register function's declaration is also
    reformatted to fit code style guidelines.
    
    Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
    wens authored and intel-lab-lkp committed Jan 22, 2022
  17. clk: mediatek: Implement mtk_clk_unregister_fixed_clks() API

    mtk_clk_register_fixed_clks(), as the name suggests, is used to register
    a given list of fixed rate clks. However it is lacking a counterpart
    unregister API.
    
    Implement said unregister API so that the various clock platform drivers
    can utilize it to do proper unregistration, cleanup and removal.
    
    In the header file, the register function's declaration is also
    reformatted to fit code style guidelines.
    
    Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
    wens authored and intel-lab-lkp committed Jan 22, 2022
  18. clk: mediatek: pll: Clean up included headers

    Some included headers aren't actually used anywhere, while other headers
    with the declaration of functions and structures aren't directly
    included.
    
    Get rid of the unused ones, and add the ones that should be included
    directly.
    
    Also, expand the MHZ macro with spelled-out "1000 * 1000" to be able
    to not include clk-mtk.h. The existing ternary operator is rewritten
    in a shortened form to accommodate the expanded macro.
    
    Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
    wens authored and intel-lab-lkp committed Jan 22, 2022
  19. clk: mediatek: pll: Implement unregister API

    The PLL clk type within the MediaTek clk driver library only has a
    register function, and no corresponding unregister function. This
    means there is no way for its users to properly implement cleanup
    and removal.
    
    Add a matching unregister function for the PLL type clk.
    
    Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
    wens authored and intel-lab-lkp committed Jan 22, 2022
  20. clk: mediatek: pll: Split definitions into separate header file

    When the PLL type clk was implemented in the MediaTek clk driver
    library, the data structure definitions and function declaration
    were put in the common header file.
    
    Since it is its own type of clk, and not all platform clk drivers
    utilize it, having the definitions in the common header results
    in wasted cycles during compilation.
    
    Split out the related definitions and declarations into its own
    header file, and include that only in the platform clk drivers that
    need it.
    
    Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
    wens authored and intel-lab-lkp committed Jan 22, 2022
  21. clk: mediatek: mux: Clean up included headers

    Some included headers aren't actually used anywhere, while other headers
    with the declaration of functions and structures aren't directly
    included.
    
    Get rid of the unused ones, and add the ones that should be included
    directly.
    
    On the header side, replace headers that are included purely for data
    structure definitions with forward declarations. This decreases the
    amount of preprocessing and compilation effort required for each
    inclusion.
    
    Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
    wens authored and intel-lab-lkp committed Jan 22, 2022
  22. clk: mediatek: mux: Internalize struct mtk_clk_mux

    struct mtk_clk_mux is an implementation detail of the mux clk type,
    and is not used outside of the implementation.
    
    Internalize the definition to minimize leakage of details and shrink
    the header file.
    
    Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
    wens authored and intel-lab-lkp committed Jan 22, 2022
  23. clk: mediatek: mux: Implement unregister API

    The mux clk type within the MediaTek clk driver library only has a
    register function, and no corresponding unregister function. This
    means there is no way for its users to properly implement cleanup
    and removal.
    
    Add a matching unregister function for the mux type clk.
    
    Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
    wens authored and intel-lab-lkp committed Jan 22, 2022
  24. clk: mediatek: cpumux: Clean up included headers

    Some headers with the declaration of functions and structures aren't
    directly included. Explicitly include them so that future changes to
    other headers would not result in an unexpected build break.
    
    On the header side, add forward declarations for any data structures
    whose pointers are used in function signatures. No headers are
    required.
    
    Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
    wens authored and intel-lab-lkp committed Jan 22, 2022
  25. clk: mediatek: cpumux: Internalize struct mtk_clk_cpumux

    struct mtk_clk_cpumux is an implementation detail of the cpumux clk
    type, and is not used outside of the implementation.
    
    Internalize the definition to minimize leakage of details and shrink
    the header file.
    
    Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
    wens authored and intel-lab-lkp committed Jan 22, 2022
  26. clk: mediatek: cpumux: Implement unregister API

    The cpumux clk type within the MediaTek clk driver library only has
    a register function, and no corresponding unregister function. This
    means there is no way for its users to properly implement cleanup
    and removal.
    
    Add a matching unregister function for the cpumux type clk.
    
    Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
    wens authored and intel-lab-lkp committed Jan 22, 2022
  27. clk: mediatek: gate: Clean up included headers

    Some included headers aren't actually used anywhere, while other headers
    with the declaration of functions and structures aren't directly
    included.
    
    Get rid of the unused ones, and add the ones that should be included
    directly.
    
    On the header side, replace headers that are included purely for data
    structure definitions with forward declarations. This decreases the
    amount of preprocessing and compilation effort required for each
    inclusion.
    
    Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
    wens authored and intel-lab-lkp committed Jan 22, 2022
  28. clk: mediatek: gate: Implement unregister API

    The gate clk type within the MediaTek clk driver library only has a
    register function, and no corresponding unregister function. This
    means there is no way for its users to properly implement cleanup
    and removal.
    
    Add a matching unregister function for the gate type clk.
    
    Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
    wens authored and intel-lab-lkp committed Jan 22, 2022
  29. clk: mediatek: gate: Internalize clk implementation

    struct mtk_clk_gate and mtk_clk_register_gate() are not used outside of
    the gate clk library. Only the API that handles a list of clks is used
    by the individual platform clk drivers.
    
    Internalize the parts that aren't used outside of the implementation.
    
    Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
    wens authored and intel-lab-lkp committed Jan 22, 2022
  30. clk: mediatek: gate: Consolidate gate type clk related code

    Right now some bits of the gate type clk code are in clk-gate.[ch], but
    other bits are in clk-mtk.[ch]. This is different from the cpumux and
    mux type clks, for which all of the code are found in the same files.
    
    Move the functions that register multiple clks from a given list,
    mtk_clk_register_gates_with_dev() and mtk_clk_register_gates(), to
    clk-gate.[ch] to consolidate all the code for the gate type clks.
    
    This commit only moves code with minor whitespace fixups to correct
    the code style. Further improvements, such as internalizing various
    functions and structures will be done in later commits.
    
    Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
    wens authored and intel-lab-lkp committed Jan 22, 2022
  31. clk: mediatek: Use %pe to print errors

    If %pe is used to print errors, a string representation of the error
    would be printed instead of a number as with %ld. Also, all the sites
    printing errors are deriving the error code from a pointer. Using %pe
    is more straightforward.
    
    Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
    wens authored and intel-lab-lkp committed Jan 22, 2022

Commits on Jan 19, 2022

  1. clk: mediatek: relicense mt7986 clock driver to GPL-2.0

    The previous mt7986 clock drivers were incorrectly marked as GPL-1.0.
    This patch changes the driver to the standard GPL-2.0 license.
    
    Signed-off-by: Sam Shih <sam.shih@mediatek.com>
    Link: https://lore.kernel.org/r/20220119123658.10095-2-sam.shih@mediatek.com
    Reported-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
    Signed-off-by: Stephen Boyd <sboyd@kernel.org>
    SamShih33 authored and bebarino committed Jan 19, 2022

Commits on Jan 13, 2022

  1. clk: visconti: Fix uninitialized variable in printk

    The "pll_clck" variable is uninitialized.  The "ret" error code was
    supposed to be printed instead.
    
    Fixes: b4cbe60 ("clk: visconti: Add support common clock driver and reset driver")
    Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
    Link: https://lore.kernel.org/r/20220111072529.GJ11243@kili
    Signed-off-by: Stephen Boyd <sboyd@kernel.org>
    error27 authored and bebarino committed Jan 13, 2022
  2. clk: si5341: Fix clock HW provider cleanup

    The call to of_clk_add_hw_provider was not undone on remove or on probe
    failure, which could cause an oops on a subsequent attempt to retrieve
    clocks for the removed device. Switch to the devm version of the
    function to avoid this issue.
    
    Fixes: 3044a86 ("clk: Add Si5341/Si5340 driver")
    Signed-off-by: Robert Hancock <robert.hancock@calian.com>
    Link: https://lore.kernel.org/r/20220112203816.1784610-1-robert.hancock@calian.com
    Signed-off-by: Stephen Boyd <sboyd@kernel.org>
    robhancocksed authored and bebarino committed Jan 13, 2022

Commits on Jan 12, 2022

  1. Merge branches 'clk-ingenic' and 'clk-mediatek' into clk-next

     - Add MDMA and BDMA clks to Ingenic JZ4760 and JZ4770
     - MediaTek mt7986 SoC basic support
    
    * clk-ingenic:
      clk: ingenic: Add MDMA and BDMA clocks
      dt-bindings: clk/ingenic: Add MDMA and BDMA clocks
    
    * clk-mediatek:
      clk: mediatek: add mt7986 clock support
      clk: mediatek: add mt7986 clock IDs
      dt-bindings: clock: mediatek: document clk bindings for mediatek mt7986 SoC
      clk: mediatek: clk-gate: Use regmap_{set/clear}_bits helpers
      clk: mediatek: clk-gate: Shrink by adding clockgating bit check helper
    bebarino committed Jan 12, 2022
Older