15 Aug, 2020

1 commit

  • Pull MFD updates from Lee Jones:
    "Core Frameworks
    - Make better attempt at matching device with the correct OF node
    - Allow batch removal of hierarchical sub-devices

    New Drivers
    - Add STM32 Clocksource driver
    - Add support for Khadas System Control Microcontroller

    Driver Removal
    - Remove unused driver for TI's SMSC ECE1099

    New Device Support
    - Add support for Intel Emmitsburg PCH to Intel LPSS PCI
    - Add support for Intel Tiger Lake PCH-H to Intel LPSS PCI
    - Add support for Dialog DA revision to Dialog DA9063

    New Functionality
    - Add support for AXP803 to be probed by I2C

    Fix-ups
    - Numerous W=1 warning fixes
    - Device Tree changes (stm32-lptimer, gateworks-gsc, khadas,mcu, stmfx, cros-ec, j721e-system-controller)
    - Enabled Regmap 'fast I/O' in stm32-lptimer
    - Change BUG_ON to WARN_ON in arizona-core
    - Remove superfluous code/initialisation (madera, max14577)
    - Trivial formatting/spelling issues (madera-core, madera-i2c, da9055, max77693-private)
    - Switch to of_platform_populate() in sprd-sc27xx-spi
    - Expand out set/get brightness/pwm macros in lm3533-ctrlbank
    - Disable IRQs on suspend in motorola-cpcap
    - Clean-up error handling in intel_soc_pmic_mrfld
    - Ensure correct removal order of sub-devices in madera
    - Many s/HTTP/HTTPS/ link changes
    - Ensure name used with Regmap is unique in syscon

    Bug Fixes
    - Properly 'put' clock on unbind and error in arizona-core
    - Fix revision handling in da9063
    - Fix 'assignment of read-only location' error in kempld-core
    - Avoid using the Regmap API when atomic in rn5t618
    - Redefine volatile register description in rn5t618
    - Use locking to protect event handler in dln2"

    * tag 'mfd-next-5.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (76 commits)
    mfd: syscon: Use a unique name with regmap_config
    mfd: Replace HTTP links with HTTPS ones
    mfd: dln2: Run event handler loop under spinlock
    mfd: madera: Improve handling of regulator unbinding
    mfd: mfd-core: Add mechanism for removal of a subset of children
    mfd: intel_soc_pmic_mrfld: Simplify the return expression of intel_scu_ipc_dev_iowrite8()
    mfd: max14577: Remove redundant initialization of variable current_bits
    mfd: rn5t618: Fix caching of battery related registers
    mfd: max77693-private: Drop a duplicated word
    mfd: da9055: pdata.h: Drop a duplicated word
    mfd: rn5t618: Make restart handler atomic safe
    mfd: kempld-core: Fix 'assignment of read-only location' error
    mfd: axp20x: Allow the AXP803 to be probed by I2C
    mfd: da9063: Add support for latest DA silicon revision
    mfd: da9063: Fix revision handling to correctly select reg tables
    dt-bindings: mfd: st,stmfx: Remove I2C unit name
    dt-bindings: mfd: ti,j721e-system-controller.yaml: Add J721e system controller
    mfd: motorola-cpcap: Disable interrupt for suspend
    mfd: smsc-ece1099: Remove driver
    mfd: core: Add OF_MFD_CELL_REG() helper
    ...

    Linus Torvalds
     

08 Aug, 2020

1 commit

  • We just don't do that. "default y" is for things that are needed for
    compatibility (when an old feature is made unconditional), or for things
    that are basically part of the infrastructure of a platform.

    And it can possibly be used for questions that don't enable code on
    their own, but are used to enable or disable a whole slew of other
    questions.

    A new feature that people aren't using is never 'default y', unless it
    cures cancer or ends world hunger.

    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

07 Aug, 2020

2 commits

  • Pull thermal updates from Daniel Lezcano:

    - Add support to enable/disable the thermal zones resulting on core
    code and drivers cleanup (Andrzej Pietrasiewicz)

    - Add generic netlink support for userspace notifications: events,
    temperature and discovery commands (Daniel Lezcano)

    - Fix redundant initialization for a ret variable (Colin Ian King)

    - Remove the clock cooling code as it is used nowhere (Amit Kucheria)

    - Add the rcar_gen3_thermal's r8a774e1 support (Marian-Cristian
    Rotariu)

    - Replace all references to thermal.txt in the documentation to the
    corresponding yaml files (Amit Kucheria)

    - Add maintainer entry for the IPA (Lukasz Luba)

    - Add support for MSM8939 for the tsens (Shawn Guo)

    - Update power allocator and devfreq cooling to SPDX licensing (Lukasz
    Luba)

    - Add Cannon Lake Low Power PCH support (Sumeet Pawnikar)

    - Add tsensor support for V2 mediatek thermal system (Henry Yen)

    - Fix thermal zone lookup by ID for the core code (Thierry Reding)

    * tag 'thermal-v5.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux: (40 commits)
    thermal: intel: intel_pch_thermal: Add Cannon Lake Low Power PCH support
    thermal: mediatek: Add tsensor support for V2 thermal system
    thermal: mediatek: Prepare to add support for other platforms
    thermal: Update power allocator and devfreq cooling to SPDX licensing
    MAINTAINERS: update entry to thermal governors file name prefixing
    thermal: core: Add thermal zone enable/disable notification
    thermal: qcom: tsens-v0_1: Add support for MSM8939
    dt-bindings: tsens: qcom: Document MSM8939 compatible
    thermal: core: Fix thermal zone lookup by ID
    thermal: int340x: processor_thermal: fix: update Jasper Lake PCI id
    thermal: imx8mm: Support module autoloading
    thermal: ti-soc-thermal: Fix reversed condition in ti_thermal_expose_sensor()
    MAINTAINERS: Add maintenance information for IPA
    thermal: rcar_gen3_thermal: Do not shadow thcode variable
    dt-bindings: thermal: Get rid of thermal.txt and replace references
    thermal: core: Move initialization after core initcall
    thermal: netlink: Improve the initcall ordering
    net: genetlink: Move initialization to core_initcall
    thermal: rcar_gen3_thermal: Add r8a774e1 support
    thermal/drivers/clock_cooling: Remove clock_cooling code
    ...

    Linus Torvalds
     
  • Pull sched/fifo updates from Ingo Molnar:
    "This adds the sched_set_fifo*() encapsulation APIs to remove static
    priority level knowledge from non-scheduler code.

    The three APIs for non-scheduler code to set SCHED_FIFO are:

    - sched_set_fifo()
    - sched_set_fifo_low()
    - sched_set_normal()

    These are two FIFO priority levels: default (high), and a 'low'
    priority level, plus sched_set_normal() to set the policy back to
    non-SCHED_FIFO.

    Since the changes affect a lot of non-scheduler code, we kept this in
    a separate tree"

    * tag 'sched-fifo-2020-08-04' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (24 commits)
    sched,tracing: Convert to sched_set_fifo()
    sched: Remove sched_set_*() return value
    sched: Remove sched_setscheduler*() EXPORTs
    sched,psi: Convert to sched_set_fifo_low()
    sched,rcutorture: Convert to sched_set_fifo_low()
    sched,rcuperf: Convert to sched_set_fifo_low()
    sched,locktorture: Convert to sched_set_fifo()
    sched,irq: Convert to sched_set_fifo()
    sched,watchdog: Convert to sched_set_fifo()
    sched,serial: Convert to sched_set_fifo()
    sched,powerclamp: Convert to sched_set_fifo()
    sched,ion: Convert to sched_set_normal()
    sched,powercap: Convert to sched_set_fifo*()
    sched,spi: Convert to sched_set_fifo*()
    sched,mmc: Convert to sched_set_fifo*()
    sched,ivtv: Convert to sched_set_fifo*()
    sched,drm/scheduler: Convert to sched_set_fifo*()
    sched,msm: Convert to sched_set_fifo*()
    sched,psci: Convert to sched_set_fifo*()
    sched,drbd: Convert to sched_set_fifo*()
    ...

    Linus Torvalds
     

04 Aug, 2020

1 commit


03 Aug, 2020

1 commit

  • * pm-em:
    OPP: refactor dev_pm_opp_of_register_em() and update related drivers
    Documentation: power: update Energy Model description
    PM / EM: change name of em_pd_energy to em_cpu_energy
    PM / EM: remove em_register_perf_domain
    PM / EM: add support for other devices than CPUs in Energy Model
    PM / EM: update callback structure and add device pointer
    PM / EM: introduce em_dev_register_perf_domain function
    PM / EM: change naming convention from 'capacity' to 'performance'

    * pm-core:
    mmc: jz4740: Use pm_ptr() macro
    PM: Make *_DEV_PM_OPS macros use __maybe_unused
    PM: core: introduce pm_ptr() macro

    Rafael J. Wysocki
     

31 Jul, 2020

3 commits

  • This patch adds full support for ver 2 thermal system (e.g., MT7622 SoC).
    The new changes include reading calibration data, converting temperature
    and hardware initialization which are specific for version 2 system.
    Each platform decides which function to call according to its version.

    Fixes: 3966be3c08c3 ("thermal: mediatek: add support for MT7622 SoC")
    Signed-off-by: Henry Yen
    Reviewed-by: Matthias Brugger
    Tested-By: Frank Wunderlich
    Signed-off-by: Daniel Lezcano
    Link: https://lore.kernel.org/r/1588238074-19338-3-git-send-email-henry.yen@mediatek.com

    Henry Yen
     
  • It is known that Mediatek owns two thermal systems, which only differ
    in the way of reading calibration data and converting temperature.
    MT8173, MT8183, MT2701 and MT2712 belongs to version 1 thermal
    system, and MT7622 belongs to version 2.

    In order to handle both systems, the suffix _V1 is appended to the
    current code, and then the second patch will add _V2 functions with
    the same purpose but different implementation.

    Signed-off-by: Henry Yen
    Reviewed-by: Matthias Brugger
    Tested-By: Frank Wunderlich
    Signed-off-by: Daniel Lezcano
    Link: https://lore.kernel.org/r/1588238074-19338-2-git-send-email-henry.yen@mediatek.com

    Henry Yen
     
  • Update the license to the SPDX licensing format.

    Signed-off-by: Lukasz Luba
    Signed-off-by: Daniel Lezcano
    Link: https://lore.kernel.org/r/20200730165117.13998-1-lukasz.luba@arm.com

    Lukasz Luba
     

29 Jul, 2020

1 commit


27 Jul, 2020

1 commit

  • The TSENS integrated on MSM8939 is a v0_1 device with 10 sensors.
    Different from its predecessor MSM8916, where 'calib_sel' bits sit in
    separate qfprom word, MSM8939 has 'cailb' and 'calib_sel' bits mixed and
    spread on discrete offsets. That's why all qfprom bits are read as one
    go and later mapped to calibration data for MSM8939.

    Signed-off-by: Shawn Guo
    Acked-by: Amit Kucheria
    Tested-by: Konrad Dybcio /* on Asus Z00T smartphone */
    Acked-by: Konrad Dybcio
    Signed-off-by: Daniel Lezcano
    Link: https://lore.kernel.org/r/20200629144926.665-3-shawn.guo@linaro.org

    Shawn Guo
     

25 Jul, 2020

1 commit

  • When a thermal zone is looked up by an ID and no zone is found matching
    that ID, the thermal_zone_get_by_id() function will return a pointer to
    the thermal zone list head which isn't actually a valid thermal zone.

    This can lead to a subsequent crash because a valid pointer is returned
    to the called, but dereferencing that pointer as struct thermal_zone is
    not safe.

    Fixes: 329b064fbd13 ("thermal: core: Get thermal zone by id")
    Signed-off-by: Thierry Reding
    Signed-off-by: Daniel Lezcano
    Link: https://lore.kernel.org/r/20200724170105.2705467-1-thierry.reding@gmail.com

    Thierry Reding
     

24 Jul, 2020

1 commit

  • Update PCI device id for Jasper Lake processor thermal device.
    With this proc_thermal driver is getting loaded and processor
    thermal functionality works on Jasper Lake system.

    Fixes: f64a6583d3f5 ("thermal: int340x: processor_thermal: Add Jasper Lake support")
    Signed-off-by: Sumeet Pawnikar
    Signed-off-by: Daniel Lezcano
    Link: https://lore.kernel.org/r/1595577146-1221-1-git-send-email-sumeet.r.pawnikar@intel.com

    Sumeet Pawnikar
     

21 Jul, 2020

9 commits

  • Add a missing MODULE_DEVICE_TABLE entry to support module autoloading.

    Signed-off-by: Anson Huang
    Reviewed-by: Dong Aisheng
    Signed-off-by: Daniel Lezcano
    Link: https://lore.kernel.org/r/1592380074-19222-1-git-send-email-Anson.Huang@nxp.com

    Anson Huang
     
  • This condition is reversed and will cause breakage.

    Fixes: 7440f518dad9 ("thermal/drivers/ti-soc-thermal: Avoid dereferencing ERR_PTR")
    Signed-off-by: Dan Carpenter
    Signed-off-by: Daniel Lezcano
    Link: https://lore.kernel.org/r/20200616091949.GA11940@mwanda

    Dan Carpenter
     
  • The function rcar_gen3_thermal_calc_coefs() takes an argument called
    'thcode' which shadows the static global 'thcode' variable. This is not
    harmful but bad for readability and is harmful for planned changes to
    the driver. The THCODE values should be read from hardware fuses if they
    are available and only fallback to the global 'thcode' variable if they
    are not fused.

    Rename the global 'thcode' variable to 'thcodes' to avoid shadowing the
    symbol in functions that take it as an argument.

    Signed-off-by: Niklas Söderlund
    Reviewed-by: Geert Uytterhoeven
    Signed-off-by: Daniel Lezcano
    Link: https://lore.kernel.org/r/20200610003300.884258-1-niklas.soderlund+renesas@ragnatech.se

    Niklas Söderlund
     
  • The generic netlink is initialized at subsys_initcall, so far after
    the thermal init routine and the thermal generic netlink family
    initialization.

    On ŝome platforms, that leads to a memory corruption.

    The fix was sent to netdev@ to move the genetlink framework
    initialization at core_initcall.

    Move the thermal core initialization to postcore level which is very
    close to core level.

    Reported-by: Marek Szyprowski
    Signed-off-by: Daniel Lezcano
    Tested-by: Marek Szyprowski
    Reviewed-by: Amit Kucheria
    Link: https://lore.kernel.org/r/20200717164217.18819-2-daniel.lezcano@linaro.org

    Daniel Lezcano
     
  • The initcalls like to play joke. In our case, the thermal-netlink
    initcall is called after the thermal-core initcall but this one sends
    a notification before the former is initialized. No issue was spotted,
    but it could lead to a memory corruption, so instead of relying on the
    core_initcall for the thermal-netlink, let's initialize directly from
    the thermal-core init routine, so we have full control of the init
    ordering.

    Reported-by: Marek Szyprowski
    Signed-off-by: Daniel Lezcano
    Tested-by: Marek Szyprowski
    Reviewed-by: Amit Kucheria
    Link: https://lore.kernel.org/r/20200717164217.18819-1-daniel.lezcano@linaro.org

    Daniel Lezcano
     
  • Add r8a774e1 specific compatible string.

    Signed-off-by: Marian-Cristian Rotariu
    Signed-off-by: Lad Prabhakar
    Reviewed-by: Geert Uytterhoeven
    Reviewed-by: Niklas Söderlund
    Signed-off-by: Daniel Lezcano
    Link: https://lore.kernel.org/r/1594811350-14066-4-git-send-email-prabhakar.mahadev-lad.rj@bp.renesas.com

    Marian-Cristian Rotariu
     
  • clock_cooling has no in-kernel users. It has never found any use in
    drivers as far as I can tell.

    Remove the code.

    Signed-off-by: Amit Kucheria
    Signed-off-by: Daniel Lezcano
    Link: https://lore.kernel.org/r/aa5d5ac2589cf7b14ece882130731b4a916849a6.1593619943.git.amit.kucheria@linaro.org

    Amit Kucheria
     
  • The variable ret is being initialized with a value that is never read
    and it is being updated later with a new value. The initialization is
    redundant and can be removed.

    Addresses-Coverity: ("Unused value")
    Signed-off-by: Colin Ian King
    Signed-off-by: Zhang Rui
    Signed-off-by: Daniel Lezcano
    Link: https://lore.kernel.org/r/20200706140747.489075-1-colin.king@canonical.com

    Colin Ian King
     
  • When the network is not configured, the netlink is disabled on all
    the system. The thermal framework assumed the netlink is always
    opt-in.

    Fix this by adding a Kconfig option for the netlink notification,
    defaulting to yes and depending on CONFIG_NET.

    As the change implies multiple stubs and in order to not pollute the
    internal thermal header, the thermal_nelink.h has been added and
    included in the thermal_core.h, so this one regain some kind of
    clarity.

    Reported-by: Randy Dunlap
    Signed-off-by: Daniel Lezcano
    Reviewed-by: Amit Kucheria
    Link: https://lore.kernel.org/r/20200707090159.1018-1-daniel.lezcano@linaro.org

    Daniel Lezcano
     

17 Jul, 2020

1 commit

  • …ermal/linux into master

    Pull thermal fixes from Daniel Lezcano:

    - Fix invalid index array access on int340x_thermal leading to a kernel
    panic (Bartosz Szczepanek)

    - Fix debug message level to prevent flooding on some platform (Alex
    Hung)

    - Fix invalid bank access by reverting "thermal: mediatek: fix register
    index error" (Enric Balletbo i Serra)

    * tag 'thermal-v5.8-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux:
    Revert "thermal: mediatek: fix register index error"
    thermal: int3403_thermal: Downgrade error message
    thermal/int340x_thermal: Prevent page fault on .set_mode() op

    Linus Torvalds
     

15 Jul, 2020

2 commits

  • This reverts commit eb9aecd90d1a39601e91cd08b90d5fee51d321a6

    The above patch is supposed to fix a register index error on mt2701. It
    is not clear if the problem solved is a hang or just an invalid value
    returned, my guess is the second. The patch introduces, though, a new
    hang on MT8173 device making them unusable. So, seems reasonable, revert
    the patch because introduces a worst issue.

    The reason I send a revert instead of trying to fix the issue for MT8173
    is because the information needed to fix the issue is in the datasheet
    and is not public. So I am not really able to fix it.

    Fixes the following bug when CONFIG_MTK_THERMAL is set on MT8173
    devices.

    [ 2.222488] Unable to handle kernel paging request at virtual address ffff8000125f5001
    [ 2.230421] Mem abort info:
    [ 2.233207] ESR = 0x96000021
    [ 2.236261] EC = 0x25: DABT (current EL), IL = 32 bits
    [ 2.241571] SET = 0, FnV = 0
    [ 2.244623] EA = 0, S1PTW = 0
    [ 2.247762] Data abort info:
    [ 2.250640] ISV = 0, ISS = 0x00000021
    [ 2.254473] CM = 0, WnR = 0
    [ 2.257544] swapper pgtable: 4k pages, 48-bit VAs, pgdp=0000000041850000
    [ 2.264251] [ffff8000125f5001] pgd=000000013ffff003, pud=000000013fffe003, pmd=000000013fff9003, pte=006800001100b707
    [ 2.274867] Internal error: Oops: 96000021 [#1] PREEMPT SMP
    [ 2.280432] Modules linked in:
    [ 2.283483] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.7.0-rc6+ #162
    [ 2.289914] Hardware name: Google Elm (DT)
    [ 2.294003] pstate: 20000005 (nzCv daif -PAN -UAO)
    [ 2.298792] pc : mtk_read_temp+0xb8/0x1c8
    [ 2.302793] lr : mtk_read_temp+0x7c/0x1c8
    [ 2.306794] sp : ffff80001003b930
    [ 2.310100] x29: ffff80001003b930 x28: 0000000000000000
    [ 2.315404] x27: 0000000000000002 x26: ffff0000f9550b10
    [ 2.320709] x25: ffff0000f9550a80 x24: 0000000000000090
    [ 2.326014] x23: ffff80001003ba24 x22: 00000000610344c0
    [ 2.331318] x21: 0000000000002710 x20: 00000000000001f4
    [ 2.336622] x19: 0000000000030d40 x18: ffff800011742ec0
    [ 2.341926] x17: 0000000000000001 x16: 0000000000000001
    [ 2.347230] x15: ffffffffffffffff x14: ffffff0000000000
    [ 2.352535] x13: ffffffffffffffff x12: 0000000000000028
    [ 2.357839] x11: 0000000000000003 x10: ffff800011295ec8
    [ 2.363143] x9 : 000000000000291b x8 : 0000000000000002
    [ 2.368447] x7 : 00000000000000a8 x6 : 0000000000000004
    [ 2.373751] x5 : 0000000000000000 x4 : ffff800011295cb0
    [ 2.379055] x3 : 0000000000000002 x2 : ffff8000125f5001
    [ 2.384359] x1 : 0000000000000001 x0 : ffff0000f9550a80
    [ 2.389665] Call trace:
    [ 2.392105] mtk_read_temp+0xb8/0x1c8
    [ 2.395760] of_thermal_get_temp+0x2c/0x40
    [ 2.399849] thermal_zone_get_temp+0x78/0x160
    [ 2.404198] thermal_zone_device_update.part.0+0x3c/0x1f8
    [ 2.409589] thermal_zone_device_update+0x34/0x48
    [ 2.414286] of_thermal_set_mode+0x58/0x88
    [ 2.418375] thermal_zone_of_sensor_register+0x1a8/0x1d8
    [ 2.423679] devm_thermal_zone_of_sensor_register+0x64/0xb0
    [ 2.429242] mtk_thermal_probe+0x690/0x7d0
    [ 2.433333] platform_drv_probe+0x5c/0xb0
    [ 2.437335] really_probe+0xe4/0x448
    [ 2.440901] driver_probe_device+0xe8/0x140
    [ 2.445077] device_driver_attach+0x7c/0x88
    [ 2.449252] __driver_attach+0xac/0x178
    [ 2.453082] bus_for_each_dev+0x78/0xc8
    [ 2.456909] driver_attach+0x2c/0x38
    [ 2.460476] bus_add_driver+0x14c/0x230
    [ 2.464304] driver_register+0x6c/0x128
    [ 2.468131] __platform_driver_register+0x50/0x60
    [ 2.472831] mtk_thermal_driver_init+0x24/0x30
    [ 2.477268] do_one_initcall+0x50/0x298
    [ 2.481098] kernel_init_freeable+0x1ec/0x264
    [ 2.485450] kernel_init+0x1c/0x110
    [ 2.488931] ret_from_fork+0x10/0x1c
    [ 2.492502] Code: f9401081 f9400402 b8a67821 8b010042 (b9400042)
    [ 2.498599] ---[ end trace e43e3105ed27dc99 ]---
    [ 2.503367] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
    [ 2.511020] SMP: stopping secondary CPUs
    [ 2.514941] Kernel Offset: disabled
    [ 2.518421] CPU features: 0x090002,25006005
    [ 2.522595] Memory Limit: none
    [ 2.525644] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b ]--

    Cc: Michael Kao
    Fixes: eb9aecd90d1a ("thermal: mediatek: fix register index error")
    Signed-off-by: Enric Balletbo i Serra
    Reviewed-by: Matthias Brugger
    Signed-off-by: Daniel Lezcano
    Link: https://lore.kernel.org/r/20200707103412.1010823-1-enric.balletbo@collabora.com

    Enric Balletbo i Serra
     
  • Downgrade "Unsupported event" message from dev_err to dev_dbg to avoid
    flooding with this message on some platforms.

    Cc: stable@vger.kernel.org # v5.4+
    Suggested-by: Zhang Rui
    Signed-off-by: Alex Hung
    [ rzhang: fix typo in changelog ]
    Signed-off-by: Zhang Rui
    Link: https://lore.kernel.org/r/20200615223957.183153-1-alex.hung@canonical.com

    Alex Hung
     

14 Jul, 2020

1 commit

  • Starting from commit "thermal/int340x_thermal: Don't require IDSP to
    exist", priv->current_uuid_index is initialized to -1. This value may
    be passed to int3400_thermal_run_osc() from int3400_thermal_set_mode,
    contributing to page fault when accessing int3400_thermal_uuids array
    at index -1.

    This commit adds a check on uuid value to int3400_thermal_run_osc.

    Fixes: 8d485da0ddee ("thermal/int340x_thermal: Don't require IDSP to exist")
    Signed-off-by: Bartosz Szczepanek
    Reviewed-by: Pandruvada, Srinivas
    [ rzhang: Add Fixes tag ]
    Signed-off-by: Zhang Rui
    Link: https://lore.kernel.org/r/20200708134613.131555-1-bsz@semihalf.com

    Bartosz Szczepanek
     

07 Jul, 2020

6 commits

  • The generic netlink protocol is implemented but the different
    notification functions are not yet connected to the core code.

    These changes add the notification calls in the different
    corresponding places.

    Reviewed-by: Amit Kucheria
    Signed-off-by: Daniel Lezcano
    Acked-by: Zhang Rui
    Link: https://lore.kernel.org/r/20200706105538.2159-4-daniel.lezcano@linaro.org

    Daniel Lezcano
     
  • Initially the thermal framework had a very simple notification
    mechanism to send generic netlink messages to the userspace.

    The notification function was never called from anywhere and the
    corresponding dead code was removed. It was probably a first attempt
    to introduce the netlink notification.

    At LPC2018, the presentation "Linux thermal: User kernel interface",
    proposed to create the notifications to the userspace via a kfifo.

    The advantage of the kfifo is the performance. It is usually used from
    a 1:1 communication channel where a driver captures data and sends it
    as fast as possible to a userspace process.

    The drawback is that only one process uses the notification channel
    exclusively, thus no other process is allowed to use the channel to
    get temperature or notifications.

    This patch defines a generic netlink API to discover the current
    thermal setup and adds event notifications as well as temperature
    sampling. As any genetlink protocol, it can evolve and the versioning
    allows to keep the backward compatibility.

    In order to prevent the user from getting flooded with data on a
    single channel, there are two multicast channels, one for the
    temperature sampling when the thermal zone is updated and another one
    for the events, so the user can get the events only without the
    thermal zone temperature sampling.

    Also, a list of commands to discover the thermal setup is added and
    can be extended when needed.

    Reviewed-by: Amit Kucheria
    Signed-off-by: Daniel Lezcano
    Acked-by: Zhang Rui
    Link: https://lore.kernel.org/r/20200706105538.2159-3-daniel.lezcano@linaro.org

    Daniel Lezcano
     
  • The next patch will introduce the generic netlink protocol to handle
    events, sampling and command from the thermal framework. In order to
    deal with the thermal zone, it uses its unique identifier to
    characterize it in the message. Passing an integer is more efficient
    than passing an entire string.

    This change provides a function returning back a thermal zone pointer
    corresponding to the identifier passed as parameter.

    Signed-off-by: Daniel Lezcano
    Reviewed-by: Amit Kucheria
    Acked-by: Zhang Rui
    Link: https://lore.kernel.org/r/20200706105538.2159-2-daniel.lezcano@linaro.org

    Daniel Lezcano
     
  • The cdev, tz and governor list, as well as their respective locks are
    statically defined in the thermal_core.c file.

    In order to give a sane access to these list, like browsing all the
    thermal zones or all the cooling devices, let's define a set of
    helpers where we pass a callback as a parameter to be called for each
    thermal entity.

    We keep the self-encapsulation and ensure the locks are correctly
    taken when looking at the list.

    Acked-by: Zhang Rui
    Reviewed-by: Amit Kucheria
    Signed-off-by: Daniel Lezcano
    Link: https://lore.kernel.org/r/20200706105538.2159-1-daniel.lezcano@linaro.org

    Daniel Lezcano
     
  • This function is not needed by drivers.

    Signed-off-by: Andrzej Pietrasiewicz
    Signed-off-by: Daniel Lezcano
    Link: https://lore.kernel.org/r/20200703104354.19657-4-andrzej.p@collabora.com

    Andrzej Pietrasiewicz
     
  • Use driver's local data to evaluate the need to run or not to run a
    measurement.

    Signed-off-by: Andrzej Pietrasiewicz
    Signed-off-by: Daniel Lezcano
    Link: https://lore.kernel.org/r/20200703104354.19657-3-andrzej.p@collabora.com

    Andrzej Pietrasiewicz
     

30 Jun, 2020

8 commits

  • set_mode() is only called when tzd's mode is about to change. Actual
    setting is performed in thermal_core, in thermal_zone_device_set_mode().
    The meaning of set_mode() callback is actually to notify the driver about
    the mode being changed and giving the driver a chance to oppose such
    change.

    To better reflect the purpose of the method rename it to change_mode()

    Signed-off-by: Andrzej Pietrasiewicz
    [for acerhdf]
    Acked-by: Peter Kaestle
    Reviewed-by: Bartlomiej Zolnierkiewicz
    Reviewed-by: Amit Kucheria
    Signed-off-by: Daniel Lezcano
    Link: https://lore.kernel.org/r/20200629122925.21729-12-andrzej.p@collabora.com

    Andrzej Pietrasiewicz
     
  • Setting polling_delay is now done at thermal_core level (by not polling
    DISABLED devices), so no need to repeat this code.

    int340x: Checking for an impossible enum value is unnecessary.
    acpi/thermal: It only prints debug messages.

    Signed-off-by: Andrzej Pietrasiewicz
    [for acerhdf]
    Acked-by: Peter Kaestle
    Reviewed-by: Bartlomiej Zolnierkiewicz
    Reviewed-by: Amit Kucheria
    Signed-off-by: Daniel Lezcano
    Link: https://lore.kernel.org/r/20200629122925.21729-11-andrzej.p@collabora.com

    Andrzej Pietrasiewicz
     
  • Polling DISABLED devices is not desired, as all such "disabled" devices
    are meant to be handled by userspace. This patch introduces and uses
    should_stop_polling() to decide whether the device should be polled or not.

    Signed-off-by: Andrzej Pietrasiewicz
    Reviewed-by: Bartlomiej Zolnierkiewicz
    Reviewed-by: Amit Kucheria
    Signed-off-by: Daniel Lezcano
    Link: https://lore.kernel.org/r/20200629122925.21729-10-andrzej.p@collabora.com

    Andrzej Pietrasiewicz
     
  • Some thermal zone devices never change their state, so they should be
    always enabled.

    Signed-off-by: Andrzej Pietrasiewicz
    Reviewed-by: Bartlomiej Zolnierkiewicz
    Signed-off-by: Daniel Lezcano
    Link: https://lore.kernel.org/r/20200629122925.21729-9-andrzej.p@collabora.com

    Andrzej Pietrasiewicz
     
  • Use thermal_zone_device_{en|dis}able() and thermal_zone_device_is_enabled().

    Consequently, all set_mode() implementations in drivers:

    - can stop modifying tzd's "mode" member,
    - shall stop taking tzd's lock, as it is taken in the helpers
    - shall stop calling thermal_zone_device_update() as it is called in the
    helpers
    - can assume they are called when the mode truly changes, so checks to
    verify that can be dropped

    Not providing set_mode() by a driver no longer prevents the core from
    being able to set tzd's mode, so the relevant check in mode_store() is
    removed.

    Other comments:

    - acpi/thermal.c: tz->thermal_zone->mode will be updated only after we
    return from set_mode(), so use function parameter in thermal_set_mode()
    instead, no need to call acpi_thermal_check() in set_mode()
    - thermal/imx_thermal.c: regmap writes and mode assignment are done in
    thermal_zone_device_{en|dis}able() and set_mode() callback
    - thermal/intel/intel_quark_dts_thermal.c: soc_dts_{en|dis}able() are a
    part of set_mode() callback, so they don't need to modify tzd->mode, and
    don't need to fall back to the opposite mode if unsuccessful, as the return
    value will be propagated to thermal_zone_device_{en|dis}able() and
    ultimately tzd's member will not be changed in thermal_zone_device_set_mode().
    - thermal/of-thermal.c: no need to set zone->mode to DISABLED in
    of_parse_thermal_zones() as a tzd is kzalloc'ed so mode is DISABLED anyway

    Signed-off-by: Andrzej Pietrasiewicz
    [for acerhdf]
    Acked-by: Peter Kaestle
    Reviewed-by: Amit Kucheria
    Reviewed-by: Bartlomiej Zolnierkiewicz
    Signed-off-by: Daniel Lezcano
    Link: https://lore.kernel.org/r/20200629122925.21729-8-andrzej.p@collabora.com

    Andrzej Pietrasiewicz
     
  • Prepare for making the drivers not access tzd's private members.

    Signed-off-by: Andrzej Pietrasiewicz
    Reviewed-by: Bartlomiej Zolnierkiewicz
    [staticize thermal_zone_device_set_mode()]
    Signed-off-by: kernel test robot
    Signed-off-by: Daniel Lezcano
    Link: https://lore.kernel.org/r/20200629122925.21729-7-andrzej.p@collabora.com

    Andrzej Pietrasiewicz
     
  • get_mode() is now redundant, as the state is stored in struct
    thermal_zone_device.

    Consequently the "mode" attribute in sysfs can always be visible, because
    it is always possible to get the mode from struct tzd.

    Signed-off-by: Andrzej Pietrasiewicz
    [for acerhdf]
    Acked-by: Peter Kaestle
    Reviewed-by: Bartlomiej Zolnierkiewicz
    Reviewed-by: Amit Kucheria
    Signed-off-by: Daniel Lezcano
    Link: https://lore.kernel.org/r/20200629122925.21729-6-andrzej.p@collabora.com

    Andrzej Pietrasiewicz
     
  • Prepare for eliminating get_mode().

    Signed-off-by: Andrzej Pietrasiewicz
    [for acerhdf]
    Acked-by: Peter Kaestle
    Reviewed-by: Bartlomiej Zolnierkiewicz
    Reviewed-by: Amit Kucheria
    Signed-off-by: Daniel Lezcano
    Link: https://lore.kernel.org/r/20200629122925.21729-5-andrzej.p@collabora.com

    Andrzej Pietrasiewicz