Nick Crews
14e14aaf61
platform/chrome: wilco_ec: Standardize mailbox interface
...
The current API for the wilco EC mailbox interface is bad.
It assumes that most messages sent to the EC follow a similar structure,
with a command byte in MBOX[0], followed by a junk byte, followed by
actual data. This doesn't happen in several cases, such as setting the
RTC time, using the raw debugfs interface, and reading or writing
properties such as the Peak Shift policy (this last to be submitted soon).
Similarly for the response message from the EC, the current interface
assumes that the first byte of data is always 0, and the second byte
is unused. However, in both setting and getting the RTC time, in the
debugfs interface, and for reading and writing properties, this isn't
true.
The current way to resolve this is to use WILCO_EC_FLAG_RAW* flags to
specify when and when not to skip these initial bytes in the sent and
received message. They are confusing and used so much that they are
normal, and not exceptions. In addition, the first byte of
response in the debugfs interface is still always skipped, which is
weird, since this raw interface should be giving the entire result.
Additionally, sent messages assume the first byte is a command, and so
struct wilco_ec_message contains the "command" field. In setting or
getting properties however, the first byte is not a command, and so this
field has to be filled with a byte that isn't actually a command. This
is again inconsistent.
wilco_ec_message contains a result field as well, copied from
wilco_ec_response->result. The message result field should be removed:
if the message fails, the cause is already logged, and the callers are
alerted. They will never care about the actual state of the result flag.
These flags and different cases make the wilco_ec_transfer() function,
used in wilco_ec_mailbox(), really gross, dealing with a bunch of
different cases. It's difficult to figure out what it is doing.
Finally, making these assumptions about the structure of a message make
it so that the messages do not correspond well with the specification
for the EC's mailbox interface. For instance, this interface
specification may say that MBOX[9] in the received message contains
some information, but the calling code needs to remember that the first
byte of response is always skipped, and because it didn't set the
RESPONSE_RAW flag, the next byte is also skipped, so this information
is actually contained within wilco_ec_message->response_data[7]. This
makes it difficult to maintain this code in the future.
To fix these problems this patch standardizes the mailbox interface by:
- Removing the WILCO_EC_FLAG_RAW* flags
- Removing the command and reserved_raw bytes from wilco_ec_request
- Removing the mbox0 byte from wilco_ec_response
- Simplifying wilco_ec_transfer() because of these changes
- Gives the callers of wilco_ec_mailbox() the responsibility of exactly
and consistently defining the structure of the mailbox request and
response
- Removing command and result from wilco_ec_message.
This results in the reduction of total code, and makes it much more
maintainable and understandable.
Signed-off-by: Nick Crews <[email protected] >
Acked-by: Alexandre Belloni <[email protected] >
Signed-off-by: Enric Balletbo i Serra <[email protected] >
2019-04-15 16:07:42 +02:00
..
class.c
rtc: class: reimplement devm_rtc_device_register
2018-12-18 22:53:32 +01:00
dev.c
rtc: remove rtc_class_ops.read_callback
2019-02-25 21:20:45 +01:00
hctosys.c
RTC for 4.21
2019-01-01 13:24:31 -08:00
interface.c
rtc: enforce rtc_timer_init private_data type
2018-12-18 22:53:29 +01:00
Kconfig
chrome platform changes for v5.1
2019-03-12 09:46:32 -07:00
lib.c
rtc: Fix UBSAN overflow warning
2019-01-10 22:02:44 +01:00
Makefile
chrome platform changes for v5.1
2019-03-12 09:46:32 -07:00
nvmem.c
rtc: nvmem: fix possible use after free
2018-12-31 00:49:36 +01:00
proc.c
rtc: rename core files
2018-12-31 11:36:16 +01:00
rtc-88pm80x.c
rtc: 88pm80x: fix unintended sign extension
2019-02-08 09:30:13 +01:00
rtc-88pm860x.c
rtc: 88pm860x: fix unintended sign extension
2019-02-08 09:30:13 +01:00
rtc-ab-b5ze-s3.c
rtc: ab-b5ze-s3: let the core handle the RTC range
2018-05-17 22:23:25 +02:00
rtc-ab-eoz9.c
rtc: add AB-RTCMC-32.768kHz-EOZ9 RTC support
2019-02-18 22:39:30 +01:00
rtc-ab3100.c
rtc: stop validating rtc_time after rtc_time64_to_tm
2018-03-01 10:49:41 +01:00
rtc-ab8500.c
rtc: ab8500: remove useless check
2018-09-28 14:36:49 +02:00
rtc-abx80x.c
rtc: update my email address
2019-03-04 20:21:19 +01:00
rtc-ac100.c
treewide: Use struct_size() for devm_kmalloc() and friends
2018-06-06 11:15:43 -07:00
rtc-armada38x.c
rtc: armada38x: switch to rtc_time64_to_tm/rtc_tm_to_time64
2018-09-28 14:21:03 +02:00
rtc-as3722.c
rtc: as3722: Drop IRQF_EARLY_RESUME flag
2016-03-14 17:08:25 +01:00
rtc-asm9260.c
rtc: asm9260: fix module autoload
2016-10-19 08:45:48 +02:00
rtc-at91rm9200.c
rtc: at91rm9200: Switch to use %ptR
2018-12-10 22:39:39 +01:00
rtc-at91rm9200.h
rtc-at91sam9.c
rtc: at91sam9: Switch to use %ptR
2018-12-10 22:39:44 +01:00
rtc-au1xxx.c
rtc: stop validating rtc_time in .read_time
2018-03-02 10:09:58 +01:00
rtc-bq32k.c
rtc: remove VLA usage
2018-03-17 14:20:56 +01:00
rtc-bq4802.c
rtc: bq4802: add error handling for devm_ioremap
2018-07-11 20:41:01 +02:00
rtc-brcmstb-waketimer.c
rtc: brcmstb-waketimer: add range
2018-05-21 22:33:52 +02:00
rtc-cadence.c
rtc: Add Cadence RTC driver
2019-01-22 19:18:27 +01:00
rtc-cmos.c
rtc: cmos: Do not export alarm rtc_ops when we do not support alarms
2018-11-07 17:13:55 +01:00
rtc-coh901331.c
rtc: coh901331: fix a missing check of clk_prepare
2019-01-22 19:01:19 +01:00
rtc-core.h
rtc: move rtc_add_group/s definitions
2018-09-28 14:20:59 +02:00
rtc-cpcap.c
headers: separate linux/mod_devicetable.h from linux/platform_device.h
2018-07-07 17:52:26 +02:00
rtc-cros-ec.c
rtc: cros-ec: Switch to SPDX identifier.
2018-06-07 20:09:49 +02:00
rtc-da9052.c
rtc: diasemi: stop validating rtc_time in .read_time
2018-03-02 10:11:02 +01:00
rtc-da9055.c
rtc: diasemi: stop validating rtc_time in .read_time
2018-03-02 10:11:02 +01:00
rtc-da9063.c
rtc: diasemi: stop validating rtc_time in .read_time
2018-03-02 10:11:02 +01:00
rtc-davinci.c
rtc: constify rtc_class_ops structures
2016-09-02 01:24:06 +02:00
rtc-digicolor.c
rtc: constify rtc_class_ops structures
2016-09-02 01:24:06 +02:00
rtc-dm355evm.c
mfd: dm355evm_msp: Move header file out of I2C realm
2017-08-15 08:06:14 +01:00
rtc-ds1216.c
rtc: simplify getting .drvdata
2018-05-03 22:08:00 +02:00
rtc-ds1286.c
rtc: stop validating rtc_time in .read_time
2018-03-02 10:09:58 +01:00
rtc-ds1302.c
rtc: stop validating rtc_time in .read_time
2018-03-02 10:09:58 +01:00
rtc-ds1305.c
rtc: stop validating rtc_time in .read_time
2018-03-02 10:09:58 +01:00
rtc-ds1307.c
rtc: ds1307: rx8130: Fix alarm handling
2019-02-07 20:55:48 +01:00
rtc-ds1343.c
rtc: stop validating rtc_time in .read_time
2018-03-02 10:09:58 +01:00
rtc-ds1347.c
rtc: stop validating rtc_time in .read_time
2018-03-02 10:09:58 +01:00
rtc-ds1374.c
rtc: ds1374: wdt: Fix stop/start ioctl always returning -EINVAL
2017-05-04 14:46:25 +02:00
rtc-ds1390.c
rtc: stop validating rtc_time in .read_time
2018-03-02 10:09:58 +01:00
rtc-ds1511.c
rtc: simplify getting .drvdata
2018-05-03 22:08:00 +02:00
rtc-ds1553.c
rtc: simplify getting .drvdata
2018-05-03 22:08:00 +02:00
rtc-ds1672.c
rtc: ds1672: fix unintended sign extension
2019-02-05 23:11:31 +01:00
rtc-ds1685.c
rtc: ds1685: simplify getting .driver_data
2018-10-22 17:53:12 +02:00
rtc-ds1742.c
rtc: ds1742: don't explicitly specify word_size and stride of nvmem
2018-05-21 22:34:36 +02:00
rtc-ds2404.c
rtc: stop validating rtc_time in .read_time
2018-03-02 10:09:58 +01:00
rtc-ds3232.c
rtc: stop validating rtc_time in .read_time
2018-03-02 10:09:58 +01:00
rtc-efi-platform.c
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02 11:10:55 +01:00
rtc-efi.c
rtc: stop validating rtc_time in .read_time
2018-03-02 10:09:58 +01:00
rtc-em3027.c
rtc: constify i2c_device_id
2017-09-01 01:10:11 +02:00
rtc-ep93xx.c
rtc: clean up indentation issues, remove extraneous space, add missing tabs
2018-11-12 23:14:07 +01:00
rtc-fm3130.c
rtc: stop validating rtc_time in .read_time
2018-03-02 10:09:58 +01:00
rtc-ftrtc010.c
headers: separate linux/mod_devicetable.h from linux/platform_device.h
2018-07-07 17:52:26 +02:00
rtc-generic.c
rtc: generic: remove get_rtc_time/set_rtc_time wrappers
2016-06-04 00:23:35 +02:00
rtc-goldfish.c
rtc: goldfish: Add missing MODULE_LICENSE
2018-02-13 21:46:04 +01:00
rtc-hid-sensor-time.c
iio/hid-sensors: Fix IIO_CHAN_INFO_RAW returning wrong values for signed numbers
2018-11-16 11:42:12 +00:00
rtc-hym8563.c
rtc: hym8563: fix a missing check of block data read
2019-01-22 19:03:43 +01:00
rtc-imx-sc.c
rtc: imx-sc: use rtc_time64_to_tm
2019-03-03 22:12:38 +01:00
rtc-imxdi.c
sched/wait: Disambiguate wq_entry->task_list and wq_head->task_list naming
2017-06-20 12:19:14 +02:00
rtc-isl1208.c
rtc: isl1208: Add new style nvmem support to driver
2019-02-17 21:29:10 +01:00
rtc-isl12022.c
rtc: isl12022: use true and false for boolean values
2018-04-03 16:40:46 +02:00
rtc-isl12026.c
rtc: isl12026: fixup nvmem registration
2018-03-17 14:20:51 +01:00
rtc-jz4740.c
rtc: stop validating rtc_time after rtc_time_to_tm
2018-03-01 10:49:41 +01:00
rtc-lp8788.c
rtc-lpc24xx.c
rtc: stop validating rtc_time in .read_time
2018-03-02 10:09:58 +01:00
rtc-lpc32xx.c
rtc: simplify getting .drvdata
2018-05-03 22:08:00 +02:00
rtc-ls1x.c
rtc: ls1x: add range
2018-05-18 09:38:22 +02:00
rtc-m41t80.c
rtc: m41t80: Switch to use %ptR
2018-12-10 22:39:47 +01:00
rtc-m41t93.c
rtc: m41t93: stop validating rtc_time in .read_time
2018-03-02 10:12:19 +01:00
rtc-m41t94.c
rtc: stop validating rtc_time in .read_time
2018-03-02 10:09:58 +01:00
rtc-m48t35.c
rtc: stop validating rtc_time in .read_time
2018-03-02 10:09:58 +01:00
rtc-m48t59.c
rtc: m48t59: Switch to use %ptR
2018-12-10 22:39:49 +01:00
rtc-m48t86.c
rtc: stop validating rtc_time in .read_time
2018-03-02 10:09:58 +01:00
rtc-max6900.c
rtc: max6900: remove useless indirection
2018-03-17 14:20:46 +01:00
rtc-max6902.c
rtc: stop validating rtc_time in .read_time
2018-03-02 10:09:58 +01:00
rtc-max6916.c
rtc: clean up indentation issues, remove extraneous space, add missing tabs
2018-11-12 23:14:07 +01:00
rtc-max8907.c
rtc-max8925.c
rtc: max8925: remove redundant check on ret
2017-07-31 00:17:48 +02:00
rtc-max8997.c
rtc: max8997: Fix the returned value in case of error in 'max8997_rtc_read_alarm()'
2018-11-22 18:11:35 +01:00
rtc-max8998.c
rtc: maxim: Add SPDX license identifiers
2018-08-14 23:38:45 +02:00
rtc-max77686.c
rtc: max77686: Fix the returned value in case of error in 'max77686_rtc_read_time()'
2018-11-14 10:44:43 +01:00
rtc-mc13xxx.c
headers: separate linux/mod_devicetable.h from linux/platform_device.h
2018-07-07 17:52:26 +02:00
rtc-mc146818-lib.c
rtc: cmos: ignore bogus century byte
2019-01-22 19:05:32 +01:00
rtc-mcp795.c
rtc: mcp795: Switch to use %ptR
2018-12-10 22:39:52 +01:00
rtc-meson.c
rtc: meson: remove useless rtc_nvmem_unregister call
2019-02-17 21:28:39 +01:00
rtc-moxart.c
rtc: Fix module autoload for OF platform drivers
2015-09-05 19:37:22 +02:00
rtc-mpc5121.c
rtc: stop validating rtc_time after rtc_time_to_tm
2018-03-01 10:49:41 +01:00
rtc-mrst.c
rtc: mrst: remove set but not used variable 'valid'
2018-08-31 11:17:41 +02:00
rtc-msm6242.c
rtc: stop validating rtc_time in .read_time
2018-03-02 10:09:58 +01:00
rtc-mt6397.c
rtc: mt6397: fix possible race condition
2018-09-11 13:56:20 +02:00
rtc-mt7622.c
rtc: mt7622: fix module autoloading for OF platform drivers
2018-04-03 16:40:48 +02:00
rtc-mv.c
rtc: mv: let the core handle invalid alarms
2018-10-03 11:07:24 +02:00
rtc-mxc.c
rtc: mxc: Switch to SPDX identifier
2018-05-22 09:47:17 +02:00
rtc-mxc_v2.c
headers: separate linux/mod_devicetable.h from linux/platform_device.h
2018-07-07 17:52:26 +02:00
rtc-nuc900.c
rtc: nuc900: stop validating rtc_time in .read_time
2018-03-02 10:12:17 +01:00
rtc-omap.c
rtc: omap: Use define directive for PIN_CONFIG_ACTIVE_HIGH
2018-11-12 23:14:06 +01:00
rtc-opal.c
rtc: opal: Fix OPAL RTC driver OPAL_BUSY loops
2018-04-25 13:24:13 +10:00
rtc-palmas.c
rtc: constify rtc_class_ops structures
2016-09-02 01:24:06 +02:00
rtc-pcap.c
rtc: simplify getting .drvdata
2018-05-03 22:08:00 +02:00
rtc-pcf2123.c
rtc: pcf2123: Add Microcrystal rv2123
2018-12-18 22:53:35 +01:00
rtc-pcf2127.c
rtc: pcf2127: fix a kmemleak caused in pcf2127_i2c_gather_write
2018-11-07 17:13:56 +01:00
rtc-pcf8523.c
rtc: pcf8523: set xtal load capacitance from DT
2019-01-22 18:57:08 +01:00
rtc-pcf8563.c
rtc: pcf8563: don't alway enable the alarm
2017-11-09 01:16:36 +01:00
rtc-pcf8583.c
rtc: Drop owner assignment from i2c_driver
2015-09-05 13:19:06 +02:00
rtc-pcf50633.c
rtc: pcf50633: Switch to use %ptR
2018-12-10 22:39:54 +01:00
rtc-pcf85063.c
rtc: pcf85063: remove dead code
2019-03-02 21:55:47 +01:00
rtc-pcf85363.c
rtc: pcf85363: Add support for NXP pcf85263 rtc
2018-12-11 00:48:17 +01:00
rtc-pic32.c
rtc: pic32: convert to SPDX identifier
2019-03-04 20:23:15 +01:00
rtc-pl030.c
rtc: pl030: fix possible race condition
2018-09-11 13:56:35 +02:00
rtc-pl031.c
rtc: pl031: switch to devm_rtc_allocate_device/rtc_register_device
2018-09-11 13:56:35 +02:00
rtc-pm8xxx.c
rtc: pm8xxx: fix unintended sign extension
2019-02-08 09:30:13 +01:00
rtc-ps3.c
rtc: stop validating rtc_time after rtc_time_to_tm
2018-03-01 10:49:41 +01:00
rtc-puv3.c
rtc: puv3: Switch to use %ptR
2018-12-10 22:40:01 +01:00
rtc-pxa.c
rtc: pxa: fix probe function
2018-06-07 20:11:08 +02:00
rtc-r7301.c
headers: separate linux/mod_devicetable.h from linux/platform_device.h
2018-07-07 17:52:26 +02:00
rtc-r9701.c
rtc: stop validating rtc_time in .read_time
2018-03-02 10:09:58 +01:00
rtc-rc5t583.c
rtc: explicitly set tm_sec = 0 for drivers with minute accurancy
2016-07-19 18:15:21 +02:00
rtc-rk808.c
rtc: rk808: Switch to use %ptR
2018-12-10 22:40:03 +01:00
rtc-rp5c01.c
rtc: stop validating rtc_time in .read_time
2018-03-02 10:09:58 +01:00
rtc-rs5c313.c
rtc: remove useless DRV_VERSION
2016-05-20 12:33:51 +02:00
rtc-rs5c348.c
rtc: rs5c348: report error when time is invalid
2018-09-28 14:21:03 +02:00
rtc-rs5c372.c
rtc: rs5c372: Fix reading from rtc when the oscillator got interrupted.
2019-02-11 09:41:21 +01:00
rtc-rtd119x.c
rtc: Add Realtek RTD1295
2017-09-05 09:55:02 +02:00
rtc-rv3028.c
rtc: rv3028: add new driver
2019-02-17 21:29:10 +01:00
rtc-rv3029c2.c
rtc: rv3029: Clean up error handling in rv3029_eeprom_write()
2017-10-12 16:24:19 +02:00
rtc-rv8803.c
rtc: update my email address
2019-03-04 20:21:19 +01:00
rtc-rx4581.c
rtc: rx4581: remove useless message
2018-03-02 10:12:24 +01:00
rtc-rx6110.c
rtc: rx6110: Switch to use %ptR
2018-12-10 22:40:05 +01:00
rtc-rx8010.c
rtc: stop validating rtc_time in .read_time
2018-03-02 10:09:58 +01:00
rtc-rx8025.c
rtc: rx8025: Switch to use %ptR
2018-12-10 22:40:07 +01:00
rtc-rx8581.c
rtc: rx8581: Add support for Epson rx8571 RTC
2019-03-02 22:20:58 +01:00
rtc-s3c.c
rtc: s3c: Use generic helper to get driver data
2019-01-22 18:36:27 +01:00
rtc-s3c.h
rtc-s5m.c
rtc: s5m: Switch to use %ptR
2018-12-10 22:40:10 +01:00
rtc-s35390a.c
rtc: s35390a: Change buf's type to u8 in s35390a_init
2018-10-22 19:29:43 +02:00
rtc-sa1100.c
rtc: sa1100: don't set PIE frequency
2018-07-25 15:29:43 +02:00
rtc-sa1100.h
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02 11:10:55 +01:00
rtc-sc27xx.c
rtc: sc27xx: Always read normal alarm when registering RTC device
2018-10-25 02:35:42 +02:00
rtc-sd3078.c
rtc: sd3078: fix platform_no_drv_owner.cocci warnings
2019-01-23 15:42:31 +01:00
rtc-sh.c
rtc: sh: convert to SPDX identifiers
2018-11-12 23:14:09 +01:00
rtc-sirfsoc.c
rtc: sirfsoc: remove useless sirfsoc_rtc_ioctl
2018-03-01 10:49:27 +01:00
rtc-snvs.c
rtc: snvs: make sure clock is enabled for interrupt handle
2019-02-05 23:11:31 +01:00
rtc-spear.c
rtc: spear: stop validating rtc_time in .set_time and .set_alarm
2018-03-02 10:12:21 +01:00
rtc-st-lpc.c
rtc: st-lpc: add range
2018-05-23 09:26:19 +02:00
rtc-starfire.c
rtc: stop validating rtc_time after rtc_time_to_tm
2018-03-01 10:49:41 +01:00
rtc-stk17ta8.c
rtc: simplify getting .drvdata
2018-05-03 22:08:00 +02:00
rtc-stm32.c
rtc: stm32: add stm32mp1 rtc support
2018-05-22 20:10:54 +02:00
rtc-stmp3xxx.c
rtc: stmp3xxx: Don't reset the rtc in .probe() when watchdog is running
2018-07-11 20:42:08 +02:00
rtc-sun4v.c
rtc: sparc: make sun4v explicitly non-modular
2016-11-04 23:31:33 +01:00
rtc-sun6i.c
rtc: sun6i: Expose internal oscillator through device tree
2018-12-06 18:13:46 +01:00
rtc-sunxi.c
rtc: sunxi: fix possible race condition
2018-06-04 14:36:14 +02:00
rtc-tegra.c
rtc: tegra: Switch to use %ptR
2018-12-10 22:40:12 +01:00
rtc-test.c
rtc: test: Switch to SPDX identifier
2018-09-28 14:21:00 +02:00
rtc-tps6586x.c
rtc: tps6586x: let the core handle rtc range
2018-05-17 22:54:24 +02:00
rtc-tps65910.c
rtc: tps65910: add range
2018-05-17 22:37:11 +02:00
rtc-tps80031.c
rtc: tps80031: Drop IRQF_EARLY_RESUME flag
2016-03-14 17:08:24 +01:00
rtc-twl.c
mfd: twl: Move header file out of I2C realm
2017-09-04 14:41:02 +01:00
rtc-tx4939.c
rtc: tx4939: convert to SPDX identifier
2019-03-04 20:21:19 +01:00
rtc-v3020.c
rtc: v3020: move rtc-v3020.h to platform_data
2016-07-09 10:24:21 +02:00
rtc-vr41xx.c
rtc: vr41xx: switch to rtc_time64_to_tm/rtc_tm_to_time64
2018-10-03 11:07:22 +02:00
rtc-vt8500.c
rtc: Fix module autoload for OF platform drivers
2015-09-05 19:37:22 +02:00
rtc-wilco-ec.c
platform/chrome: wilco_ec: Standardize mailbox interface
2019-04-15 16:07:42 +02:00
rtc-wm831x.c
rtc: stop validating rtc_time after rtc_time_to_tm
2018-03-01 10:49:41 +01:00
rtc-wm8350.c
rtc: wm8350: Remove unused to_wm8350_from_rtc_dev
2017-03-16 22:59:54 +01:00
rtc-x1205.c
rtc: remove useless DRV_VERSION
2016-05-20 12:33:51 +02:00
rtc-xgene.c
rtc: stop validating rtc_time after rtc_time_to_tm
2018-03-01 10:49:41 +01:00
rtc-zynqmp.c
rtc: zynqmp: let the core handle range
2019-03-03 22:38:34 +01:00
sysfs.c
rtc: rename core files
2018-12-31 11:36:16 +01:00
systohc.c
rtc: remove a warning during scripts/kernel-doc step
2018-03-27 10:45:05 +02:00