summaryrefslogtreecommitdiff
path: root/common/dptf.c
Commit message (Collapse)AuthorAgeFilesLines
* zephyr: add DPTF supportKeith Short2021-03-121-0/+4
| | | | | | | | | | | | | | | | | | | | | | Add a Kconfig option to enable DPTF support. Adds support for the following ACPI entries: EC_ACPI_MEM_FAN_DUTY (0x04) EC_ACPI_MEM_TEMP_ID (0x05) EC_ACPI_MEM_TEMP_THRESHOLD (0x06) EC_ACPI_MEM_TEMP_COMMIT (0x07) BUG=b:179886912 BRANCH=none TEST=zmake testall TEST=Boot zephyr-ec on Volteer, observe that ACPI warnings for ignored read/writes for DPTF commands are fixed. Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I40cbe79e57c3d4687d828ec46fe0d51034e96bfc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2757028 Reviewed-by: Simon Glass <sjg@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org>
* tree: Use new atomic_* implementationDawid Niedzwiecki2020-10-271-4/+4
| | | | | | | | | | | | | | | | | | | | | | | It is done as a part of porting to Zephyr. Since the implementation of atomic functions is done for all architectures use atomic_* instead of deprecated_atomic_*. Sometimes there was a compilation error "discards 'volatile' qualifier" due to dropping "volatile" in the argument of the functions, thus some pointers casts need to be made. It shouldn't cause any issues, because we are sure about generated asm (store operation will be performed). BUG=b:169151160 BRANCH=none TEST=buildall Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: I98f590c323c3af52035e62825e8acfa358e0805a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2478949 Tested-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* core: rename atomic_clear to atomic_clear_bitsDawid Niedzwiecki2020-10-061-2/+2
| | | | | | | | | | | | | | | | | | Change the name of atomic_clear to atomic_clear_bits to make to name more clear - the function clears only selected bits, but the name may suggest that it clears the whole variable. It is done as a part of porting to Zephyr, where atomic_clear zeros the variable. BUG=b:169151160 BRANCH=none TEST=buildall Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: I7b0b47959c6c54af40f61bca8d9baebaa0375970 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2428943 Reviewed-by: Jett Rink <jettrink@chromium.org>
* tree: rename atomic_* functions to deprecated_atomic_*Jack Rosenthal2020-09-291-4/+4
| | | | | | | | | | | | | | | | We will move to an API compatible with Zephyr's API. See the bug for complete rationale and plan. BUG=b:169151160 BRANCH=none TEST=buildall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Id611f663446abf00b24298a669f2ae47fef7f632 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2427507 Tested-by: Dawid Niedźwiecki <dn@semihalf.com> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* dptf: Prevent sensor warning in G3Scott Collyer2019-07-021-1/+3
| | | | | | | | | | | | | | | | | | | | | This CL adds a check for chipset state to prevent the console message "can't read any temp sensors!" from being displayed when the AP is in G3. It is likely that temp sensors are tied to a rail that's not up in the G3 state. BUG=b:123900860 BRANCH=Master TEST=Put the AP in G3 and verified that the console message is no longer displayed. Change-Id: Iee8549b8d2425bbc42972d704ebc931bbe6c2690 Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1679041 Tested-by: Scott Collyer <scollyer@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org> Auto-Submit: Scott Collyer <scollyer@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
* common: dptf: Guard against wild sensor IDsEvan Green2019-05-231-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | If developers have not set up TEMP_SENSOR_COUNT correctly, or the caller starts sending wild sensor_id or idx values down, then the EC will do arbitrary reads and writes over its own memory. In one case, the PD log buffer indices are next in memory, so we would see the following spew in the kernel (every 60 seconds, since the kernel only checks that often): [ 138.151937] PDLOG 2019/05/17 22:46:26.913 P0 Disconnected [ 138.158512] PDLOG 2019/05/17 22:46:04.936 P0 Disconnected [ 138.165066] PDLOG 2019/05/17 22:46:04.935 P0 Disconnected [ 138.171643] PDLOG 2019/05/17 22:46:04.935 P0 Disconnected [ 138.178162] PDLOG 2019/05/17 22:46:04.935 P0 Disconnected ... BUG=b:132999028 BRANCH=none TEST=Build and boot hatch, observe no more log spam Change-Id: If2e20972c3268e84bb4cdfa315c6b7f7cb76868f Signed-off-by: Evan Green <evgreen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1623176 Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Scott Collyer <scollyer@chromium.org>
* common: dptf: Fix function name typoEvan Green2019-05-231-2/+2
| | | | | | | | | | | | | | s/dpft_check_temp_threshold/dptf_check_temp_threshold/ BUG=b:132999028 BRANCH=none TEST=make -j BOARD=hatch Change-Id: I453a154ee9e4a58ce88e7d6ffe34f14ae8b08d65 Signed-off-by: Evan Green <evgreen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1623175 Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* common: bit change 1 << constants with BIT(constants)Gwendal Grignou2019-03-261-5/+5
| | | | | | | | | | | | | | | | | Mechanical replacement of bit operation where operand is a constant. More bit operation exist, but prone to errors. Reveal a bug in npcx: chip/npcx/system-npcx7.c:114:54: error: conversion from 'long unsigned int' to 'uint8_t' {aka 'volatile unsigned char'} changes value from '16777215' to '255' [-Werror=overflow] BUG=None BRANCH=None TEST=None Change-Id: I006614026143fa180702ac0d1cc2ceb1b3c6eeb0 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1518660 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* tablet_mode: Set EC_HOST_EVENT_MODE_CHANGE in tablet_set_mode()Edward Hill2019-03-141-13/+0
| | | | | | | | | | | | | | Move setting of EC_HOST_EVENT_MODE_CHANGE out of dptf.c so it works on devices that don't use DPTF. BUG=b:124132058 BRANCH=grunt TEST=evtest shows tablet mode events Change-Id: Ie880dfb49838e9f564f755cb18872c9832a3aa91 Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1524621 Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* dptf: Get rid of CONFIG_DPTF_DEVICE_ORIENTATIONFurquan Shaikh2018-10-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CONFIG_DPTF_DEVICE_ORIENTATION was added to indicate mode change to the host to allow it to read the tablet mode flag from shared EC memory and select the right DPTF table to load (if supported). However, this config seems unnecessary because of the following reasons: 1. Host sets SCI mask to indicate to the EC which events it wants to process. Thus, even if the EC sets mode change flag, it will not be notified to the host unless it supports mode change event. 2. Additionally, if host supports mode change event, but does not support multiple DPTF tables, then EC ACPI code takes care of ensuring that there is a thermal event handler present to reload tables. 3. CONFIG_DPTF_DEVICE_ORIENTATION was defined for almost all new x86 boards. BUG=b:117844490 BRANCH=None TEST=make -j buildall Change-Id: Ic4097ae047e2d559673a321da4df86514f902993 Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://chromium-review.googlesource.com/1292359 Commit-Ready: Furquan Shaikh <furquan@chromium.org> Tested-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* eve: Move DPTF tablet mode support to common codeGwendal Grignou2017-02-141-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enable ACPI to retrieve the tablet mode switch status. BUG=chrome-os-partner:62223 BRANCH=eve TEST=With evtest, check we receive tablet switch event. ... /dev/input/event4: Tablet Mode Switch ... Supported events: Event type 0 (EV_SYN) Event type 5 (EV_SW) Event code 1 (SW_TABLET_MODE) Properties: Testing ... (interrupt to exit) Event: time 1486670351.311647, type 5 (EV_SW), code 1 (SW_TABLET_MODE), value 1 Event: time 1486670351.311647, -------------- SYN_REPORT ------------ Event: time 1486670352.574079, type 5 (EV_SW), code 1 (SW_TABLET_MODE), value 0 Event: time 1486670352.574079, -------------- SYN_REPORT ------------ ... Change-Id: I5db6aa2c113bbd2b8e8d8fe0c55551e1edac0c79 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/440405 Commit-Ready: Duncan Laurie <dlaurie@google.com> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* cleanup: DECLARE_CONSOLE_COMMAND only needs 4 argsBill Richardson2016-08-241-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Since pretty much always, we've declared console commands to take a "longhelp" argument with detailed explanations of what the command does. But since almost as long, we've never actually used that argument for anything - we just silently throw it away in the macro. There's only one command (usbchargemode) that even thinks it defines that argument. We're never going to use this, let's just get rid of it. BUG=none BRANCH=none CQ-DEPEND=CL:*279060 CQ-DEPEND=CL:*279158 CQ-DEPEND=CL:*279037 TEST=make buildall; tested on Cr50 hardware Everything builds. Since we never used this arg anyway, there had better not be any difference in the result. Change-Id: Id3f71a53d02e3dc625cfcc12aa71ecb50e35eb9f Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/374163 Reviewed-by: Myles Watson <mylesgw@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* separate dptf logic from existing thermal logic.Ravi Chandra Sadineni2016-07-301-0/+188
Signed-off-by: Ravi Chandra Sadineni <ravisadineni@chromium.org> BRANCH=none BUG=chromium:631848 TEST=make buildall -j Change-Id: I718a29b067d37af477306f9bebfcb8e71d84d4ee Reviewed-on: https://chromium-review.googlesource.com/363008 Commit-Ready: David Hendricks <dhendrix@chromium.org> Tested-by: David Hendricks <dhendrix@chromium.org> Reviewed-by: David Hendricks <dhendrix@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@google.com>