mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-15 08:57:42 +00:00
When the EC sends an interrupt to the AP notifying it of new accelerometer data we need to make sure the spot we record the timestamp of the event is virtually identical to the spot the AP records the same point in time. Therefore a better spot for that is right next to the gpio toggling of the interrupt line. BUG=b:67743747 TEST=In the kernel, fifo_info->info.timestamp still has sane values. TEST=CTS should still pass BRANCH=master Change-Id: Ic77101a045123e779f576c46b401c765304976fd Signed-off-by: Alexandru M Stan <amstan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/802976 Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
48 lines
1.5 KiB
C
48 lines
1.5 KiB
C
/* Copyright 2014 The Chromium OS Authors. All rights reserved.
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*
|
|
* Event handling in MKBP keyboard protocol
|
|
*/
|
|
|
|
#ifndef __CROS_EC_MKBP_EVENT_H
|
|
#define __CROS_EC_MKBP_EVENT_H
|
|
|
|
/*
|
|
* Last time the host received an interrupt.
|
|
*
|
|
* Retrieved via __hw_clock_source_read() as close as possible
|
|
* to the interrupt source. Intended to be virtually the same time the
|
|
* first line of the AP hard irq for the EC interrupt.
|
|
*/
|
|
extern uint32_t mkbp_last_event_time;
|
|
|
|
/*
|
|
* Sends an event to the AP.
|
|
*
|
|
* When this is called, the event data must be ready for query. Otherwise,
|
|
* when the AP queries the event, an error is returned and the event is lost.
|
|
*
|
|
* @param event_type One of EC_MKBP_EVENT_*.
|
|
* @return True if event succeeded to generate host interrupt.
|
|
*/
|
|
int mkbp_send_event(uint8_t event_type);
|
|
|
|
/*
|
|
* The struct to store the event source definition. The get_data routine is
|
|
* responsible for returning the event data when queried by the AP. The
|
|
* parameter 'data' points to where the event data needs to be stored, and
|
|
* the size of the event data should be returned.
|
|
*/
|
|
struct mkbp_event_source {
|
|
uint8_t event_type;
|
|
int (*get_data)(uint8_t *data);
|
|
};
|
|
|
|
#define DECLARE_EVENT_SOURCE(type, func) \
|
|
const struct mkbp_event_source __keep __evt_src_##type \
|
|
__attribute__((section(".rodata.evtsrcs"))) \
|
|
= {type, func}
|
|
|
|
#endif /* __CROS_EC_MKBP_EVENT_H */
|