summaryrefslogtreecommitdiff
path: root/common/ec_features.c
Commit message (Collapse)AuthorAgeFilesLines
* ec_features: Add feat console commanddnojiri2020-03-311-0/+10
| | | | | | | | | | | | | | | | | | | | | | EC_CMD_GET_FEATURES (used by ectool inventory) requires the AP to be running. When the AP is running, EC is already running RW in EFS2. Thus, the host command can only query RW features. This patch adds 'feat' console command. It allows RO features to be queried since it doesn't require the AP to be powered. Signed-off-by: dnojiri <dnojiri@chromium.org> BUG=b/152449880 BRANCH=none TEST=Run feat command on Helios. Change-Id: I7a053f1544a8187437e99d34f6e78b580d07aa10 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2125411 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Auto-Submit: Daisuke Nojiri <dnojiri@chromium.org>
* EFS2: Add EC_FEATURE_EFS2dnojiri2020-03-311-0/+3
| | | | | | | | | | | | | | | | | | This patch adds EC_EEATURE_EFS2. It allows AP, servo, and a developer to query whether EFS2 is supported or not. Signed-off-by: dnojiri <dnojiri@chromium.org> BUG=b/152449880 BRANCH=none TEST=Verify ectool inventory prints 38 on Helios. Change-Id: Id308cad4115314380ca47c45c3212e2e6fb4095d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2125410 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Auto-Submit: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org>
* Define board_override_features_flags APIs as overridablednojiri2019-12-101-8/+12
| | | | | | | | | | | | | | | | | | | | | | Currently board_override_features_flags0/1 are enabled by CONFIG_EC_FEATURE_BOARD_OVERRIDE. This patch defines the callbacks as overridable. It will allow us to remove CONFIG_EC_FEATURE_BOARD_OVERRIDE and the redundancy it incurs. Signed-off-by: dnojiri <dnojiri@chromium.org> BUG=none BRANCH=none TEST=buildall Change-Id: I0c2870b746879b272ada35b9615b611627a9f426 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1951810 Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Auto-Submit: Daisuke Nojiri <dnojiri@chromium.org>
* audio_codec: remove unused EC_FEATURE codeTzung-Bi Shih2019-09-031-3/+0
| | | | | | | | | | | | | | | | Audio codec don't use EC feature. Remove all EC_FEATURE-related code. BRANCH=none BUG=b:122027734, b:123268236 TEST=make BOARD=kukui_scp -j Change-Id: Ib46c5a9bc1486547b81b76d3683e1faf7ff8483d Signed-off-by: Tzung-Bi Shih <tzungbi@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1697885 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>
* kblight: Remove dependency on PWMDaisuke Nojiri2019-04-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | Keyboard backlight can be controlled either by PWM or an external controller. This patch decouples keyboard backlight common code and PWM based backlight control. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=none BRANCH=Nami TEST=Verify keyboard backlight can be adjusted on Ekko. Change-Id: I332b01a2a2b15bd37ce385b6c30591c90f078dfc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1549476 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> (cherry picked from commit e879713cee3212b4afffb3f0dd3c4dfbf8237c4a) Reviewed-on: https://chromium-review.googlesource.com/1549606 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* motion: Split configuration for sensor FIFO and tight timestampsEnrico Granata2019-03-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | CONFIG_ACCEL_FIFO was being used both to control the size of the sensor FIFO, and the notion of tight timestamps. The latter is related to the format the EC uses to send sensor event timestamps and not to the size of the FIFO. Split this latter portion into its own configuration flag, CONFIG_SENSOR_TIGHT_TIMESTAMPS. This defaults to enabled, and should be turned on for all new boards. It will be selectively disabled on a few boards where the AP-side filtering this enables does not perform optimally due to jitter issues. BUG=b:123700100 BRANCH=rammus TEST=observe tight_timestamps on the sensor_ring device in kernel be enabled/disabled depending on whether CONFIG_SENSOR_TIGHT_TIMESTAMPS is #undef'ed or not Change-Id: I806ba6bb45a0007512afec9151c57c60d30fd604 Signed-off-by: Enrico Granata <egranata@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1524666 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Alexandru M Stan <amstan@chromium.org>
* ish: add ec_feature flag for ISHRushikesh S Kadam2019-02-041-0/+3
| | | | | | | | | | | | | | | | | | The kernel driver needs to be able to distinguish an ish cros_ec implementation from a normal EC implementation. Add a new flag to the ec features that advertises this. This will follow the same logic that fingerprint and touchpad do in the kernel. BRANCH=none BUG=b:123075957 TEST=verified that dis assembly for arcada includes this new flag Change-Id: Ic766097fc938888fde808101fc9f1f459f061d84 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1446539 Reviewed-by: Nick Crews <ncrews@chromium.org> Reviewed-by: Rushikesh S Kadam <rushikesh.s.kadam@intel.com> Reviewed-by: Gwendal Grignou <gwendal@google.com>
* mt_scp/ipi: Support host command.Yilun Lin2018-12-291-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | mt_scp is the first chip which uses IPI to do host command communication. This CL implements the host command over IPI. TEST=Run ec.RW.bin on kukui by "echo start > /sys/class/remoteproc/remoteproc0/state" and see that there are HC logs from SCP uart [0.000385 hostcmd init 0x0000000000002000] [0.049958 HC 0x0b] [0.050061 HC 0x400b] [0.050108 HC 0x400b err 1] [0.050204 HC 0x08] [0.050240 HC 0x08 err 3] [0.050370 HC 0x8d] [0.050406 HC 0x8d err 1] [0.050821 HC 0x0d] BUG=b:117917141, b:120953723 BRANCH=None Change-Id: I2c2b701d92504a74cc2ee90ab05912e99378acde Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/1379410 Commit-Ready: Nicolas Boichat <drinkcat@chromium.org> Tested-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* audio_codec: add audio codec featureCheng-Yi Chiang2018-12-201-0/+3
| | | | | | | | | | | | | | | | | | | | This CL adds support for the audio codec feature required to support dmic and I2S operation. BRANCH=none BUG=b:116766596 TEST=On cheza verifed recording works using the following kernel commands and the loading the audio file into audacity. amixer -c 0 cset iface=MIXER,name='MultiMedia1 Mixer SEC_MI2S_TX' on amixer -c0 cset numid=27 30,30 arecord -D hw:0,0 -f dat /tmp/rec.wav -d 5 Change-Id: I2b3ba097aaf6a7854551db2033914d00ac3ec275 Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1192702 Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com>
* motion_lid: Allow host to configure tablet mode detection thresholdFurquan Shaikh2018-11-291-0/+3
| | | | | | | | | | | | | | | | | | | | | | | This change adds support for host to configure the tablet mode threshold angle and hysteresis degree using a new motionsense command MOTIONSENSE_CMD_TABLET_MODE_LID_ANGLE. Additionally, the EC sets a new feature bit to indicate support for this refined tablet mode detection. This feature bit can be used by kernel to expose an inclinometer device which can eventually help remove the redundant lid angle calculation in Chrome. BUG=b:120050761 BRANCH=octopus TEST=make -j buildall. Additionally, verified that tablet mode lid angle can be configured by host using ectool. Also, feature flag is correctly set to indicate support for this feature. Change-Id: I51bd160bbfae02d899bdf63096618c13eb5800e8 Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://chromium-review.googlesource.com/1351518 Commit-Ready: Furquan Shaikh <furquan@chromium.org> Tested-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* sensor: Add flag for tight timestampingGwendal Grignou2018-07-031-0/+3
| | | | | | | | | | | | | | | | | | | Kernel needs to be aware of the the new timestamp code to apply proper filtering/spreading. This flag set means that timestamps are always after every sensor sample, and both timestamps (sensor sample and fifo info) are recorded with minimal latency and jitter. TEST=Add 'dev_err(dev, "feature 36 = %d\n", cros_ec_check_features(ec, 36));' in kernel/drivers/platform/chrome/cros_ec_dev.c See the bit set (16, not 0) in dmesg. BUG=b/111079027, b/109786990 Change-Id: Ia71703e035d7a6eac1e0a483caa62b7c75e5cb2a Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Signed-off-by: Alexandru M Stan <amstan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1123218
* lpc/espi: convert remaning CONFIG_LPC to CONFIG_HOSTCMD_X86Jett Rink2018-05-221-1/+1
| | | | | | | | | | | | | | We have converted all LPC-only configs to HOSTCMD_LPC so the remaining CONFIG_LPC defines represent the common case. BRANCH=none BUG=chromium:818804 TEST=Full stack builds and works on yorp (espi) and grunt (lpc) Change-Id: Iba9a48f2cab12fadd0d9ab8eab0d5d5476eab238 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1067503 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* CEC: Add CONFIG_CECStefan Adolfsson2018-05-091-0/+3
| | | | | | | | | | | | | | | | | | Turning on CONFIG_CEC enables the CEC feature code and the CEC console. Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=Build ec-utils and chromeos-ec with CONFIG_CEC set CQ-DEPEND=CL:995440 Change-Id: I23bb50d9456a07de7a9e7ea8bfc71f42c5e52778 Reviewed-on: https://chromium-review.googlesource.com/1030214 Commit-Ready: Stefan Adolfsson <sadolfsson@chromium.org> Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Features: Add EXEC_IN_RAMDaisuke Nojiri2018-04-041-0/+3
| | | | | | | | | | | | | | | This patch adds execution-in-ram, opposite of XIP: execution-in-place (a.k.a. XIP) to the EC features. It can be currently implied by CONFIG_EXTERNAL_STORAGE. BUG=b:77306460 BRANCH=none TEST=Verify ectool prints EXEC_IN_RAM on Fizz. Change-Id: I4a7fb3b267864debe59fd211956371eceac57613 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/995968 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* make EC_FEATURE_RWSIG definition more usefulVincent Palatin2018-03-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also define the EC_FEATURE_RWSIG feature bit if the RO firmware contains the RWSIG task but not the RW. Given the RWSIG verification task is not terribly useful in RW (where it is never executed), it can be skipped there but the host program trying to detect RWSIG usage (e.g. flashrom) still wants to be able to detect it. In order to be able to do so, add the HAS_TASK_xXx_RO and HAS_TASK_xXx_RW flags which define the tasks defined in the other partition (at compilation-time you might still run a frankeinstein combo). Fix ectool 'inventory' to avoid segfaulting on missing feature string definition. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=b:36125319 TEST=on ZerbleBarn, run 'ectool inventory', also uses flashrom to re-flash the RW partition. Change-Id: I224a6cc4aef956204792a2cc04ad12aaed5abf47 Reviewed-on: https://chromium-review.googlesource.com/937262 Commit-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* host_events: Bump up host events and masks to 64-bitFurquan Shaikh2017-11-211-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | With the upcoming change to add a new command to get/set/clear host events and masks, it seems to be the right time to bump up the host events and masks to 64-bit. We are already out of available host events. This change opens up at least 32 bits for new host events. Old EC commands to operate on host events/masks will still deal with lower 32-bits of the events/mask. On the other hand, the new command being added will take care of the entire 64-bit events/masks. This ensures that old BIOS and kernel versions can still work with the newer EC versions. BUG=b:69329196 BRANCH=None TEST=make -j buildall. Verified: 1. hostevent set 0x4000 ==> Sets correct bit in host events 2. hostevent clear 0x4000 ==> Clears correct bit in host events 3. Kernel is able to query and read correct host event bits from EC. Verified using evtest. 4. Coreboot is able to read correct wake reason from EC. Verified using mosys eventlog list. Change-Id: Idcb24ea364ac6c491efc2f8dd9e29a9df6149e07 Signed-off-by: Furquan Shaikh <furquan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/770925 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* host_event_commands: Add support for always reporting masksFurquan Shaikh2017-10-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new mask type (ALWAYS_REPORT mask) that is set by default to certain host events that should always be reported to the host irrespective of the state of SCI, SMI and wake masks. This mask includes host events like critical events resulting in shutdown or reboot, events that are consumed by BIOS, etc. Now that ALWAYS_REPORT mask is added, this change also updates the way EC manages set/query operations for host events: 1. During set operation, EC will check if the host event is present in any of the 4 masks - SCI, SMI, wake and always report. If yes, then it is set in hostevents. 2. During query operation, EC will extract the lowest set event from hostevents, clear it and return it back to the host. In order to reflect the above change in EC behavior, a new feature bit is used EC_FEATURE_UNIFIED_WAKE_MASKS. This allows the host to decide when wake mask needs to be set before checking for host events. BUG=None BRANCH=None TEST=make -j buildall. Also verified following: 1. Wake from S3 works as expected. Host is able to log correct wake sources (Verified power button, lid open, base key press and tablet mode change on soraka). 2. Wake from S5 works as expected. Host is able to log correct wake sources (Verified power button, lid open on soraka). 3. Wake from S0ix works as expected (Verified power button, lid open on soraka). 4. Software method to trigger recovery still works fine: reboot ap-off hostevent set 0x4000 powerb Change-Id: I62e5c1f82247c82348cd019e082883d86ec2688f Signed-off-by: Furquan Shaikh <furquan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/719578 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
* cleanup: Use CONFIG_BATTERY to indicate whether a board has a batteryShawn Nematbakhsh2017-10-131-3/+2
| | | | | | | | | | | | | BUG=b:35528297 BRANCH=None TEST=`make buildall -j` Change-Id: I9e4814b4172f20711f7edd691c9569f9130aec8e Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/713395 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* ec_features / coral: Allow disabling keyboard backlight featurePatrick Georgi2017-08-301-2/+12
| | | | | | | | | | | | | | | | | Allow reporting that keyboard backlight doesn't exist even when the code is compiled in. Useful if there are multiple device models that should share firmware. BUG=b:64705535 BRANCH=none TEST=none Change-Id: I9c1fc370aedf66ef856a571f73831095d27e3d39 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/633926 Commit-Ready: Patrick Georgi <pgeorgi@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
* ec_features: Move feature flags out of ec_command into its own unitPatrick Georgi2017-08-301-0/+114
Prepare for exposing the feature flags through EC ACPI memory space by moving the definitions and collection function into its own unit. BUG=b:64705535 BRANCH=none TEST=builds and returns the same value Change-Id: I66eabebe0d039fdcd14d11b9ecf77c0f1040d006 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/633925 Commit-Ready: Patrick Georgi <pgeorgi@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>