drivers: bmi160: use direct GPIO trigger instead of IPM
Directly use AON GPIO trigger instead of IPM. In the past, SW did not allow arc to receive AON GPIO interrupt. So, interrupt from BMI160 was routed to x86 cpu. Then, x86 cpu passed the event to arc through IPM. But, SW was updated and arc is able to directly receive interrupt from AON GPIO now. So, IPM is not needed any more. Let's remove IPM related code and use GPIO as the default trigger source. This change is on top of the bmi160 sample app change to not use IPM. Change-Id: I49d8040764d03b24e09d89e66643c020ef63a3c9 Signed-off-by: Baohong Liu <baohong.liu@intel.com>
This commit is contained in:
parent
9e4c2e92ca
commit
f2c1b4bb02
4 changed files with 5 additions and 56 deletions
|
@ -76,20 +76,6 @@ config BMI160_TRIGGER
|
|||
bool
|
||||
depends on BMI160
|
||||
|
||||
choice
|
||||
prompt "Trigger source"
|
||||
depends on BMI160 && BMI160_TRIGGER && (GPIO || IPM)
|
||||
default BMI160_TRIGGER_SOURCE_IPM
|
||||
|
||||
config BMI160_TRIGGER_SOURCE_IPM
|
||||
bool "IPM device"
|
||||
depends on IPM
|
||||
|
||||
config BMI160_TRIGGER_SOURCE_GPIO
|
||||
bool "GPIO device"
|
||||
depends on GPIO
|
||||
endchoice
|
||||
|
||||
config BMI160_THREAD_PRIORITY
|
||||
int "Own thread priority"
|
||||
depends on BMI160 && BMI160_TRIGGER_OWN_THREAD
|
||||
|
@ -107,7 +93,7 @@ config BMI160_THREAD_STACK_SIZE
|
|||
config BMI160_GPIO_DEV_NAME
|
||||
string "Gpio device"
|
||||
default "GPIO_1"
|
||||
depends on BMI160 && BMI160_TRIGGER && BMI160_TRIGGER_SOURCE_GPIO
|
||||
depends on BMI160 && BMI160_TRIGGER
|
||||
help
|
||||
The name of the GPIO device to which the BMI160 interrupt pin is
|
||||
connected.
|
||||
|
@ -115,7 +101,7 @@ config BMI160_GPIO_DEV_NAME
|
|||
config BMI160_GPIO_PIN_NUM
|
||||
int "Interrupt GPIO pin number"
|
||||
default 4
|
||||
depends on BMI160 && BMI160_TRIGGER && BMI160_TRIGGER_SOURCE_GPIO
|
||||
depends on BMI160 && BMI160_TRIGGER
|
||||
help
|
||||
The number of the GPIO pin which is connected to BMI160 interrupt pin.
|
||||
|
||||
|
|
|
@ -942,7 +942,7 @@ const struct bmi160_device_config bmi160_config = {
|
|||
.spi_port = CONFIG_BMI160_SPI_PORT_NAME,
|
||||
.spi_freq = CONFIG_BMI160_SPI_BUS_FREQ,
|
||||
.spi_slave = CONFIG_BMI160_SLAVE,
|
||||
#if defined(CONFIG_BMI160_TRIGGER) && defined(CONFIG_BMI160_TRIGGER_SOURCE_GPIO)
|
||||
#if defined(CONFIG_BMI160_TRIGGER)
|
||||
.gpio_port = CONFIG_BMI160_GPIO_DEV_NAME,
|
||||
.int_pin = CONFIG_BMI160_GPIO_PIN_NUM,
|
||||
#endif
|
||||
|
|
|
@ -394,7 +394,7 @@ struct bmi160_range {
|
|||
|
||||
struct bmi160_device_config {
|
||||
const char *spi_port;
|
||||
#if defined(CONFIG_BMI160_TRIGGER) && defined(CONFIG_BMI160_TRIGGER_SOURCE_GPIO)
|
||||
#if defined(CONFIG_BMI160_TRIGGER)
|
||||
const char *gpio_port;
|
||||
uint8_t int_pin;
|
||||
#endif
|
||||
|
@ -442,12 +442,9 @@ struct bmi160_scale {
|
|||
|
||||
struct bmi160_device_data {
|
||||
struct device *spi;
|
||||
#if defined(CONFIG_BMI160_TRIGGER) && defined(CONFIG_BMI160_TRIGGER_SOURCE_GPIO)
|
||||
#if defined(CONFIG_BMI160_TRIGGER)
|
||||
struct device *gpio;
|
||||
struct gpio_callback gpio_cb;
|
||||
#elif defined(CONFIG_BMI160_TRIGGER) && \
|
||||
defined(CONFIG_BMI160_TRIGGER_SOURCE_IPM)
|
||||
struct device *ipm;
|
||||
#endif
|
||||
union bmi160_pmu_status pmu_sts;
|
||||
union bmi160_sample sample;
|
||||
|
|
|
@ -17,13 +17,7 @@
|
|||
|
||||
#include <kernel.h>
|
||||
#include <sensor.h>
|
||||
|
||||
#ifdef CONFIG_BMI160_TRIGGER_SOURCE_GPIO
|
||||
#include <gpio.h>
|
||||
#else
|
||||
#include <ipm.h>
|
||||
#include <ipm/ipm_quark_se.h>
|
||||
#endif
|
||||
|
||||
#include "bmi160.h"
|
||||
|
||||
|
@ -121,7 +115,6 @@ static void bmi160_work_handler(struct k_work *work)
|
|||
|
||||
extern struct bmi160_device_data bmi160_data;
|
||||
|
||||
#ifdef CONFIG_BMI160_TRIGGER_SOURCE_GPIO
|
||||
static void bmi160_gpio_callback(struct device *port,
|
||||
struct gpio_callback *cb, uint32_t pin)
|
||||
{
|
||||
|
@ -134,20 +127,6 @@ static void bmi160_gpio_callback(struct device *port,
|
|||
k_work_submit(&bmi160->work);
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
QUARK_SE_IPM_DEFINE(bmi160_ipm, 0, QUARK_SE_IPM_INBOUND);
|
||||
|
||||
static void bmi160_ipm_callback(void *context, uint32_t id, volatile void *data)
|
||||
{
|
||||
struct bmi160_device_data *bmi160 = context;
|
||||
|
||||
#if defined(CONFIG_BMI160_TRIGGER_OWN_THREAD)
|
||||
k_sem_give(&bmi160->sem);
|
||||
#elif defined(CONFIG_BMI160_TRIGGER_GLOBAL_THREAD)
|
||||
k_work_submit(&bmi160->work);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
static int bmi160_trigger_drdy_set(struct device *dev,
|
||||
enum sensor_channel chan,
|
||||
|
@ -306,7 +285,6 @@ int bmi160_trigger_mode_init(struct device *dev)
|
|||
{
|
||||
struct bmi160_device_data *bmi160 = dev->driver_data;
|
||||
|
||||
#ifdef CONFIG_BMI160_TRIGGER_SOURCE_GPIO
|
||||
const struct bmi160_device_config *cfg = dev->config->config_info;
|
||||
|
||||
bmi160->gpio = device_get_binding((char *)cfg->gpio_port);
|
||||
|
@ -314,13 +292,6 @@ int bmi160_trigger_mode_init(struct device *dev)
|
|||
SYS_LOG_DBG("Gpio controller %s not found.", cfg->gpio_port);
|
||||
return -EINVAL;
|
||||
}
|
||||
#else /* CONFIG_BMI160_TRIGGER_SOURCE_IPM */
|
||||
bmi160->ipm = device_get_binding("bmi160_ipm");
|
||||
if (!bmi160->ipm) {
|
||||
SYS_LOG_DBG("Ipm device bmi160_ipm not found.");
|
||||
return -EINVAL;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_BMI160_TRIGGER_OWN_THREAD)
|
||||
k_sem_init(&bmi160->sem, 0, UINT_MAX);
|
||||
|
@ -339,7 +310,6 @@ int bmi160_trigger_mode_init(struct device *dev)
|
|||
return -EIO;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_BMI160_TRIGGER_SOURCE_GPIO)
|
||||
gpio_pin_configure(bmi160->gpio, cfg->int_pin,
|
||||
GPIO_DIR_IN | GPIO_INT | GPIO_INT_EDGE |
|
||||
GPIO_INT_ACTIVE_LOW | GPIO_INT_DEBOUNCE);
|
||||
|
@ -350,10 +320,6 @@ int bmi160_trigger_mode_init(struct device *dev)
|
|||
|
||||
gpio_add_callback(bmi160->gpio, &bmi160->gpio_cb);
|
||||
gpio_pin_enable_callback(bmi160->gpio, cfg->int_pin);
|
||||
#elif defined(CONFIG_BMI160_TRIGGER_SOURCE_IPM)
|
||||
ipm_register_callback(bmi160->ipm, bmi160_ipm_callback, bmi160);
|
||||
ipm_set_enabled(bmi160->ipm, 1);
|
||||
#endif
|
||||
|
||||
return bmi160_byte_write(dev, BMI160_REG_INT_OUT_CTRL,
|
||||
BMI160_INT1_OUT_EN | BMI160_INT1_EDGE_CTRL);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue