platform/chrome: cros_ec: Call interrupt bottom half in ISH or RPMSG mode
Call the same bottom half for all EC protocols (threaded code). Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Link: https://lore.kernel.org/r/20210122054637.1422289-2-gwendal@chromium.org
This commit is contained in:
committed by
Enric Balletbo i Serra
parent
4c2e9b3e18
commit
24c69043be
@@ -32,7 +32,14 @@ static struct cros_ec_platform pd_p = {
|
|||||||
.cmd_offset = EC_CMD_PASSTHRU_OFFSET(CROS_EC_DEV_PD_INDEX),
|
.cmd_offset = EC_CMD_PASSTHRU_OFFSET(CROS_EC_DEV_PD_INDEX),
|
||||||
};
|
};
|
||||||
|
|
||||||
static irqreturn_t ec_irq_handler(int irq, void *data)
|
/**
|
||||||
|
* cros_ec_irq_handler() - top half part of the interrupt handler
|
||||||
|
* @irq: IRQ id
|
||||||
|
* @data: (ec_dev) Device with events to process.
|
||||||
|
*
|
||||||
|
* Return: Wakeup the bottom half
|
||||||
|
*/
|
||||||
|
static irqreturn_t cros_ec_irq_handler(int irq, void *data)
|
||||||
{
|
{
|
||||||
struct cros_ec_device *ec_dev = data;
|
struct cros_ec_device *ec_dev = data;
|
||||||
|
|
||||||
@@ -51,7 +58,7 @@ static irqreturn_t ec_irq_handler(int irq, void *data)
|
|||||||
* Return: true if more events are still pending and this function should be
|
* Return: true if more events are still pending and this function should be
|
||||||
* called again.
|
* called again.
|
||||||
*/
|
*/
|
||||||
bool cros_ec_handle_event(struct cros_ec_device *ec_dev)
|
static bool cros_ec_handle_event(struct cros_ec_device *ec_dev)
|
||||||
{
|
{
|
||||||
bool wake_event;
|
bool wake_event;
|
||||||
bool ec_has_more_events;
|
bool ec_has_more_events;
|
||||||
@@ -73,9 +80,15 @@ bool cros_ec_handle_event(struct cros_ec_device *ec_dev)
|
|||||||
|
|
||||||
return ec_has_more_events;
|
return ec_has_more_events;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(cros_ec_handle_event);
|
|
||||||
|
|
||||||
static irqreturn_t ec_irq_thread(int irq, void *data)
|
/**
|
||||||
|
* cros_ec_irq_thread() - bottom half part of the interrupt handler
|
||||||
|
* @irq: IRQ id
|
||||||
|
* @data: (ec_dev) Device with events to process.
|
||||||
|
*
|
||||||
|
* Return: Interrupt handled.
|
||||||
|
*/
|
||||||
|
irqreturn_t cros_ec_irq_thread(int irq, void *data)
|
||||||
{
|
{
|
||||||
struct cros_ec_device *ec_dev = data;
|
struct cros_ec_device *ec_dev = data;
|
||||||
bool ec_has_more_events;
|
bool ec_has_more_events;
|
||||||
@@ -86,6 +99,7 @@ static irqreturn_t ec_irq_thread(int irq, void *data)
|
|||||||
|
|
||||||
return IRQ_HANDLED;
|
return IRQ_HANDLED;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(cros_ec_irq_thread);
|
||||||
|
|
||||||
static int cros_ec_sleep_event(struct cros_ec_device *ec_dev, u8 sleep_event)
|
static int cros_ec_sleep_event(struct cros_ec_device *ec_dev, u8 sleep_event)
|
||||||
{
|
{
|
||||||
@@ -194,8 +208,8 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
|
|||||||
|
|
||||||
if (ec_dev->irq > 0) {
|
if (ec_dev->irq > 0) {
|
||||||
err = devm_request_threaded_irq(dev, ec_dev->irq,
|
err = devm_request_threaded_irq(dev, ec_dev->irq,
|
||||||
ec_irq_handler,
|
cros_ec_irq_handler,
|
||||||
ec_irq_thread,
|
cros_ec_irq_thread,
|
||||||
IRQF_TRIGGER_LOW | IRQF_ONESHOT,
|
IRQF_TRIGGER_LOW | IRQF_ONESHOT,
|
||||||
"chromeos-ec", ec_dev);
|
"chromeos-ec", ec_dev);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|||||||
@@ -8,12 +8,14 @@
|
|||||||
#ifndef __CROS_EC_H
|
#ifndef __CROS_EC_H
|
||||||
#define __CROS_EC_H
|
#define __CROS_EC_H
|
||||||
|
|
||||||
|
#include <linux/interrupt.h>
|
||||||
|
|
||||||
int cros_ec_register(struct cros_ec_device *ec_dev);
|
int cros_ec_register(struct cros_ec_device *ec_dev);
|
||||||
int cros_ec_unregister(struct cros_ec_device *ec_dev);
|
int cros_ec_unregister(struct cros_ec_device *ec_dev);
|
||||||
|
|
||||||
int cros_ec_suspend(struct cros_ec_device *ec_dev);
|
int cros_ec_suspend(struct cros_ec_device *ec_dev);
|
||||||
int cros_ec_resume(struct cros_ec_device *ec_dev);
|
int cros_ec_resume(struct cros_ec_device *ec_dev);
|
||||||
|
|
||||||
bool cros_ec_handle_event(struct cros_ec_device *ec_dev);
|
irqreturn_t cros_ec_irq_thread(int irq, void *data);
|
||||||
|
|
||||||
#endif /* __CROS_EC_H */
|
#endif /* __CROS_EC_H */
|
||||||
|
|||||||
@@ -140,12 +140,8 @@ static void ish_evt_handler(struct work_struct *work)
|
|||||||
{
|
{
|
||||||
struct ishtp_cl_data *client_data =
|
struct ishtp_cl_data *client_data =
|
||||||
container_of(work, struct ishtp_cl_data, work_ec_evt);
|
container_of(work, struct ishtp_cl_data, work_ec_evt);
|
||||||
struct cros_ec_device *ec_dev = client_data->ec_dev;
|
|
||||||
bool ec_has_more_events;
|
|
||||||
|
|
||||||
do {
|
cros_ec_irq_thread(0, client_data->ec_dev);
|
||||||
ec_has_more_events = cros_ec_handle_event(ec_dev);
|
|
||||||
} while (ec_has_more_events);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -149,12 +149,8 @@ cros_ec_rpmsg_host_event_function(struct work_struct *host_event_work)
|
|||||||
struct cros_ec_rpmsg *ec_rpmsg = container_of(host_event_work,
|
struct cros_ec_rpmsg *ec_rpmsg = container_of(host_event_work,
|
||||||
struct cros_ec_rpmsg,
|
struct cros_ec_rpmsg,
|
||||||
host_event_work);
|
host_event_work);
|
||||||
struct cros_ec_device *ec_dev = dev_get_drvdata(&ec_rpmsg->rpdev->dev);
|
|
||||||
bool ec_has_more_events;
|
|
||||||
|
|
||||||
do {
|
cros_ec_irq_thread(0, dev_get_drvdata(&ec_rpmsg->rpdev->dev));
|
||||||
ec_has_more_events = cros_ec_handle_event(ec_dev);
|
|
||||||
} while (ec_has_more_events);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cros_ec_rpmsg_callback(struct rpmsg_device *rpdev, void *data,
|
static int cros_ec_rpmsg_callback(struct rpmsg_device *rpdev, void *data,
|
||||||
|
|||||||
Reference in New Issue
Block a user