BigW Consortium Gitlab

Commit 274de470 by David Clark

Merge branch 'master' of ssh://github.com/mangOH/mangOH

parents 4a5fb9f2 8ceb84bc
...@@ -35,3 +35,9 @@ ...@@ -35,3 +35,9 @@
[submodule "apps/Heartbeat"] [submodule "apps/Heartbeat"]
path = apps/Heartbeat path = apps/Heartbeat
url = https://github.com/mangOH/Heartbeat url = https://github.com/mangOH/Heartbeat
[submodule "apps/BatteryService"]
path = apps/BatteryService
url = https://github.com/mangOH/BatteryService
[submodule "samples/BatteryClient"]
path = samples/BatteryClient
url = https://github.com/mangOH/BatteryClient
Subproject commit cba3d131ca6fe030598fb8e2c1684c84ba8177ec
Subproject commit a33b09530162e22e0ac95ae84548d2808708cbf4 Subproject commit 18a0b13c4a5dc0096eefe029ed0c56974ec5e8e1
sources:
{
bq24190-charger.c
}
menuconfig POWER_SUPPLY
bool "Power supply class support"
help
Say Y here to enable power supply class support. This allows
power supply (batteries, AC, USB) monitoring by userspace
via sysfs and uevent (if available) and/or APM kernel interface
(if selected below).
if POWER_SUPPLY
config CHARGER_BQ24190
tristate "TI BQ24190 battery charger driver"
depends on I2C && GPIOLIB
help
Say Y to enable support for the TI BQ24190 battery charger.
endif # POWER_SUPPLY
Driver files were copied from yocto/kernel/drivers/power in revision TBC
/*
* Platform data for the TI bq24190 battery charger driver.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef BQ24190_PLATFORM_DATA_H_
#define BQ24190_PLATFORM_DATA_H_
struct bq24190_platform_data {
int gpio_int; /* GPIO pin that's connected to INT# */
};
#endif
sources:
{
iot-slot-core.c
iot-slot-eeprom.c
}
params:
{
}
/* Copyright (c) 2009-2012, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef IOT_SLOT_EEPROM_1V0_H
#define IOT_SLOT_EEPROM_1V0_H
typedef struct eeprom_if_reserved_ {
char reserved[63];
} __attribute__((packed)) eeprom_if_reserved;
typedef struct eeprom_if_gpio_1v0_ {
uint8_t cfg[4];
char reserved[59];
} __attribute__((packed)) eeprom_if_gpio_1v0;
typedef struct eeprom_if_i2c_1v0_ {
uint8_t address;
uint8_t irq_gpio;
char modalias[32];
char reserved[29];
} __attribute__((packed)) eeprom_if_i2c_1v0;
typedef struct eeprom_if_spi_1v0_ {
uint8_t irq_gpio;
char modalias[32];
char reserved[30];
} __attribute__((packed)) eeprom_if_spi_1v0;
typedef eeprom_if_reserved eeprom_if_usb_1v0;
typedef eeprom_if_reserved eeprom_if_sdio_1v0;
typedef eeprom_if_reserved eeprom_if_adc_1v0;
typedef eeprom_if_reserved eeprom_if_pcm_1v0;
typedef eeprom_if_reserved eeprom_if_clk_1v0;
typedef eeprom_if_reserved eeprom_if_uart_1v0;
typedef struct eeprom_if_plat_1v0_ {
uint8_t irq_gpio;
char modalias[32];
char reserved[30];
} __attribute__((packed)) eeprom_if_plat_1v0;
typedef struct eeprom_if_1v0_ {
uint8_t type;
union {
eeprom_if_gpio_1v0 gpio;
eeprom_if_i2c_1v0 i2c;
eeprom_if_spi_1v0 spi;
eeprom_if_sdio_1v0 sdio;
eeprom_if_usb_1v0 usb;
eeprom_if_adc_1v0 adc;
eeprom_if_pcm_1v0 pcm;
eeprom_if_clk_1v0 clk;
eeprom_if_uart_1v0 uart;
eeprom_if_plat_1v0 plat;
} ifc;
} __attribute__((packed)) eeprom_if_1v0;
#define EEPROM_1V0_INTERFACE_OFFSET 192
#endif /* IOT_SLOT_EEPROM_1V0_H */
/* Copyright (c) 2009-2012, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef IOT_SLOT_EEPROM_H
#define IOT_SLOT_EEPROM_H
#include <linux/i2c.h>
#define IRQ_GPIO_UNUSED (0xFF)
#define EEPROM_GPIO_CFG_INPUT_PULL_UP (0x1)
#define EEPROM_GPIO_CFG_INPUT_PULL_DOWN (0x2)
#define EEPROM_GPIO_CFG_INPUT_FLOATING (0x3)
#define EEPROM_GPIO_CFG_OUTPUT_LOW (0x4)
#define EEPROM_GPIO_CFG_OUTPUT_HIGH (0x5)
enum EepromInterface
{
EEPROM_IF_GPIO,
EEPROM_IF_I2C,
EEPROM_IF_SPI,
EEPROM_IF_USB,
EEPROM_IF_SDIO,
EEPROM_IF_ADC,
EEPROM_IF_PCM,
EEPROM_IF_CLK,
EEPROM_IF_UART,
EEPROM_IF_PLAT,
/* add more interface types here */
EEPROM_IF_LAST_SUPPORTED,
EEPROM_IF_LAST = 0xFF,
};
struct i2c_client *eeprom_load(struct i2c_adapter *i2c_adapter);
void eeprom_unload(struct i2c_client *eeprom);
struct list_head *eeprom_if_list(struct i2c_client *eeprom);
int eeprom_num_slots(struct i2c_client *eeprom);
enum EepromInterface eeprom_if_type(struct list_head *item);
uint8_t eeprom_if_gpio_cfg(struct list_head *item, unsigned int pin);
char *eeprom_if_spi_modalias(struct list_head *item);
int eeprom_if_spi_irq_gpio(struct list_head *item);
char *eeprom_if_i2c_modalias(struct list_head *item);
int eeprom_if_i2c_irq_gpio(struct list_head *item);
uint8_t eeprom_if_i2c_address(struct list_head *item);
#endif /* IOT_SLOT_EEPROM_H */
#ifndef IOT_SLOT_H
#define IOT_SLOT_H
struct spi_master;
struct i2c_adapter;
/*
* TODO:
* Need to decide whether an absent function pointer means that no action is
* needed to acquire the interface or that the interface is not supported on the
* IoT slot. I think not supported makes more sense unless we separate out
* muxing from getting. Eg. have a require_x, get_x, release_x functions.
*/
struct iot_slot_platform_data {
int gpio[4];
int reset_gpio;
int card_detect_gpio;
int (*request_i2c)(struct i2c_adapter **adapter);
int (*release_i2c)(struct i2c_adapter **adapter);
int (*request_spi)(struct spi_master **spi_master, int *cs);
int (*release_spi)(void);
/* TODO: what output param(s) for uart? */
int (*request_uart)(void);
int (*release_uart)(void);
/* TODO: how are adc's managed in the kernel? */
int (*request_adc)(void);
int (*release_adc)(void);
/* TODO: output params? */
int (*request_sdio)(void);
int (*release_sdio)(void);
/* TODO: output params? */
int (*request_pcm)(void);
int (*release_pcm)(void);
};
#endif /* IOT_SLOT_H */
sources:
{
ltc2941-battery-gauge.c
}
menuconfig POWER_SUPPLY
bool "Power supply class support"
help
Say Y here to enable power supply class support. This allows
power supply (batteries, AC, USB) monitoring by userspace
via sysfs and uevent (if available) and/or APM kernel interface
(if selected below).
if POWER_SUPPLY
config BATTERY_GAUGE_LTC2941
tristate "LTC2941/LTC2943 Battery Gauge Driver"
depends on I2C
help
Say Y here to include support for LTC2941 and LTC2943 Battery
Gauge IC. The driver reports the charge count continuously, and
measures the voltage and temperature every 10 seconds.
endif # POWER_SUPPLY
Driver files were copied from git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git in revision 17825ff6ec6db23892e61a1496abf7d737afe9e7
#ifndef LTC294X_PLATFORM_DATA_H
#define LTC294X_PLATFORM_DATA_H
// TODO: duplicated between .c and .h - that's bad
enum ltc294x_id {
LTC2941_ID,
LTC2942_ID,
LTC2943_ID,
LTC2944_ID,
};
struct ltc294x_platform_data
{
enum ltc294x_id chip_id;
int r_sense;
u32 prescaler_exp;
const char *name;
};
#endif /* LTC294X_PLATFORM_DATA_H */
...@@ -2,6 +2,7 @@ cflags: ...@@ -2,6 +2,7 @@ cflags:
{ {
// Needed for lsm6ds3 platform data type definition // Needed for lsm6ds3 platform data type definition
-I${MANGOH_ROOT}/linux_kernel_modules/lsm6ds3 -I${MANGOH_ROOT}/linux_kernel_modules/lsm6ds3
-I${MANGOH_ROOT}/linux_kernel_modules/ltc294x
} }
sources: sources:
......
...@@ -2,11 +2,15 @@ cflags: ...@@ -2,11 +2,15 @@ cflags:
{ {
// Needed for lsm6ds3 platform data type definition // Needed for lsm6ds3 platform data type definition
-I${MANGOH_ROOT}/linux_kernel_modules/lsm6ds3 -I${MANGOH_ROOT}/linux_kernel_modules/lsm6ds3
-I${MANGOH_ROOT}/linux_kernel_modules/ltc294x
-I${MANGOH_ROOT}/linux_kernel_modules/bq24296
-I${MANGOH_ROOT}/linux_kernel_modules/iot_slot
} }
sources: sources:
{ {
mangoh_red.c mangoh_red.c
mangoh_red_mux.c
} }
params: params:
......
...@@ -2,11 +2,15 @@ cflags: ...@@ -2,11 +2,15 @@ cflags:
{ {
// Needed for lsm6ds3 platform data type definition // Needed for lsm6ds3 platform data type definition
-I${MANGOH_ROOT}/linux_kernel_modules/lsm6ds3 -I${MANGOH_ROOT}/linux_kernel_modules/lsm6ds3
-I${MANGOH_ROOT}/linux_kernel_modules/ltc294x
-I${MANGOH_ROOT}/linux_kernel_modules/bq24296
-I${MANGOH_ROOT}/linux_kernel_modules/iot_slot
} }
sources: sources:
{ {
mangoh_red.c mangoh_red.c
mangoh_red_mux.c
} }
params: params:
......
...@@ -2,14 +2,18 @@ cflags: ...@@ -2,14 +2,18 @@ cflags:
{ {
// Needed for lsm6ds3 platform data type definition // Needed for lsm6ds3 platform data type definition
-I${MANGOH_ROOT}/linux_kernel_modules/lsm6ds3 -I${MANGOH_ROOT}/linux_kernel_modules/lsm6ds3
-I${MANGOH_ROOT}/linux_kernel_modules/ltc294x
-I${MANGOH_ROOT}/linux_kernel_modules/bq24296
-I${MANGOH_ROOT}/linux_kernel_modules/iot_slot
} }
sources: sources:
{ {
mangoh_red.c mangoh_red.c
mangoh_red_mux.c
} }
params: params:
{ {
revision = "dv4" revision = "dv5"
} }
#include <linux/kernel.h>
#include <linux/gpio.h>
#include "mangoh_red_mux.h"
static struct platform_device *board_device;
static int sdio_mux_gpio;
static struct mutex sdio_mutex;
static enum sdio_selection sdio_current_selection;
static unsigned int sdio_num_requested;
static int pcm_mux_gpio;
static struct mutex pcm_mutex;
static enum pcm_selection pcm_current_selection;
static unsigned int pcm_num_requested;
int mangoh_red_mux_init(struct platform_device *pdev, int sdio_gpio,
int pcm_gpio)
{
int ret;
struct device *device = &pdev->dev;
board_device = pdev;
sdio_mux_gpio = sdio_gpio;
pcm_mux_gpio = pcm_gpio;
dev_info(device,
"Initializing mangOH mux with sdio_gpio=%d, pcm_gpio=%d\n",
sdio_mux_gpio, pcm_mux_gpio);
ret = devm_gpio_request_one(device, sdio_mux_gpio,
GPIOF_OUT_INIT_HIGH,
"sdio mux");
if (ret != 0) {
dev_err(device, "Couldn't acquire GPIO for SDIO mux\n");
return ret;
}
ret = devm_gpio_request_one(device, pcm_mux_gpio,
GPIOF_OUT_INIT_HIGH,
"pcm mux");
if (ret != 0) {
dev_err(device, "Couldn't acquire GPIO for PCM mux\n");
/* Release the SDIO mux gpio that was acquired previously */
devm_gpio_free(device, sdio_mux_gpio);
return ret;
}
mutex_init(&sdio_mutex);
mutex_init(&pcm_mutex);
/* Initialize based on hardware defaults */
sdio_current_selection = SDIO_SELECTION_SD_CARD_SLOT;
pcm_current_selection = PCM_SELECTION_ONBOARD;
sdio_num_requested = 0;
pcm_num_requested = 0;
return 0;
}
void mangoh_red_mux_deinit(void)
{
struct device *device = &board_device->dev;
devm_gpio_free(device, pcm_mux_gpio);
devm_gpio_free(device, sdio_mux_gpio);
}
int mangoh_red_mux_sdio_select(enum sdio_selection selection)
{
int ret = 0;
dev_info(&board_device->dev, "SDIO mux: selecting %s\n",
(selection == SDIO_SELECTION_SD_CARD_SLOT ?
"SD card slot" : "IoT slot"));
mutex_lock(&sdio_mutex);
if (selection == sdio_current_selection)
sdio_num_requested++;
else {
if (sdio_num_requested == 0) {
ret = gpio_direction_output(
sdio_mux_gpio,
selection == SDIO_SELECTION_SD_CARD_SLOT ?
1 : 0);
if (ret != 0) {
dev_err(&board_device->dev,
"Couldn't set sdio mux\n");
goto unlock;
}
sdio_current_selection = selection;
sdio_num_requested++;
} else {
ret = -EBUSY;
}
}
unlock:
mutex_unlock(&sdio_mutex);
return ret;
}
int mangoh_red_mux_sdio_release(enum sdio_selection selection)
{
int ret = 0;
mutex_lock(&sdio_mutex);
if (selection != sdio_current_selection) {
dev_err(&board_device->dev,
"Trying to release SDIO mux, but the current selection differs from what the client specified\n");
ret = -EACCES;
goto unlock;
}
if (sdio_num_requested != 0) {
sdio_num_requested--;
} else {
dev_err(&board_device->dev,
"Couldn't release SDIO since it wasn't requested\n");
ret = -ENOLCK;
}
unlock:
mutex_unlock(&sdio_mutex);
return ret;
}
int mangoh_red_mux_pcm_select(enum pcm_selection selection)
{
int ret = 0;
dev_info(&board_device->dev, "PCM mux: selecting %s\n",
(selection == PCM_SELECTION_ONBOARD ? "onboard" : "IoT slot"));
mutex_lock(&pcm_mutex);
if (selection == pcm_current_selection)
pcm_num_requested++;
else {
if (pcm_num_requested == 0) {
ret = gpio_direction_output(
pcm_mux_gpio,
selection == PCM_SELECTION_ONBOARD ?
1 : 0);
if (ret != 0) {
dev_err(&board_device->dev,
"Couldn't set pcm mux\n");
goto unlock;
}
pcm_current_selection = selection;
pcm_num_requested++;
} else {
ret = -EBUSY;
}
}
unlock:
mutex_unlock(&pcm_mutex);
return ret;
}
int mangoh_red_mux_pcm_release(enum pcm_selection selection)
{
int ret = 0;
mutex_lock(&pcm_mutex);
if (selection != pcm_current_selection) {
dev_err(
&board_device->dev,
"Trying to release PCM mux, but the current selection differs from what the client specified\n");
ret = -EACCES;
goto unlock;
}
if (pcm_num_requested != 0) {
pcm_num_requested--;
} else {
dev_err(&board_device->dev,
"Couldn't release PCM since it wasn't requested\n");
ret = -ENOLCK;
}
unlock:
mutex_unlock(&pcm_mutex);
return ret;
}
#ifndef MANGOH_RED_MUX_H
#define MANGOH_RED_MUX_H
#include <linux/platform_device.h>
enum sdio_selection {
SDIO_SELECTION_SD_CARD_SLOT,
SDIO_SELECTION_IOT_SLOT,
};
enum pcm_selection {
PCM_SELECTION_IOT_SLOT,
PCM_SELECTION_ONBOARD,
};
int mangoh_red_mux_init(struct platform_device *pdev, int sdio_gpio, int pcm_gpio);
void mangoh_red_mux_deinit(void);
int mangoh_red_mux_sdio_select(enum sdio_selection selection);
int mangoh_red_mux_sdio_release(enum sdio_selection selection);
int mangoh_red_mux_pcm_select(enum pcm_selection selection);
int mangoh_red_mux_pcm_release(enum pcm_selection selection);
#endif /* MANGOH_RED_MUX_H */
...@@ -14,9 +14,11 @@ apps: ...@@ -14,9 +14,11 @@ apps:
$MANGOH_ROOT/apps/DataRouter/dataRouter $MANGOH_ROOT/apps/DataRouter/dataRouter
$MANGOH_ROOT/apps/DataRouter/drTool/drTool $MANGOH_ROOT/apps/DataRouter/drTool/drTool
$MANGOH_ROOT/apps/SocialService/socialService $MANGOH_ROOT/apps/SocialService/socialService
$MANGOH_ROOT/apps/RedSensorToCloud/redSensorToCloud $MANGOH_ROOT/apps/RedSensorToCloud/redSensorToCloud
// Disabled until Release 15 is released due to bug in power supply kernel support
// $MANGOH_ROOT/apps/BatteryService/batteryService
// The heartbeat app is disabled on mangOH Red because the logging messages // The heartbeat app is disabled on mangOH Red because the logging messages
// from the low power microcontroller make it very difficult to use the // from the low power microcontroller make it very difficult to use the
// console port. // console port.
...@@ -37,13 +39,14 @@ interfaceSearch: ...@@ -37,13 +39,14 @@ interfaceSearch:
$MANGOH_ROOT/apps/DataRouter $MANGOH_ROOT/apps/DataRouter
$MANGOH_ROOT/apps/MuxControl $MANGOH_ROOT/apps/MuxControl
$MANGOH_ROOT/apps/SocialService/interfaces $MANGOH_ROOT/apps/SocialService/interfaces
$MANGOH_ROOT/apps/BatteryService
} }
kernelModules: kernelModules:
{ {
// $MANGOH_ROOT/linux_kernel_modules/mangoh/9-mangoh_red_dv2 // $MANGOH_ROOT/linux_kernel_modules/mangoh/9-mangoh_red_dv2
// $MANGOH_ROOT/linux_kernel_modules/mangoh/9-mangoh_red_dv3 $MANGOH_ROOT/linux_kernel_modules/mangoh/9-mangoh_red_dv3
$MANGOH_ROOT/linux_kernel_modules/mangoh/9-mangoh_red_dv4 // $MANGOH_ROOT/linux_kernel_modules/mangoh/9-mangoh_red_dv5
// cp2130 required for MT7697 WiFi/BT // cp2130 required for MT7697 WiFi/BT
$MANGOH_ROOT/linux_kernel_modules/cp2130/0-cp2130 $MANGOH_ROOT/linux_kernel_modules/cp2130/0-cp2130
...@@ -65,6 +68,9 @@ kernelModules: ...@@ -65,6 +68,9 @@ kernelModules:
$MANGOH_ROOT/linux_kernel_modules/bmi160/3-bmi160 $MANGOH_ROOT/linux_kernel_modules/bmi160/3-bmi160
$MANGOH_ROOT/linux_kernel_modules/bmi160/4-bmi160-i2c $MANGOH_ROOT/linux_kernel_modules/bmi160/4-bmi160-i2c
// Don't enable IoT slot driver until failure case testing is complete
// $MANGOH_ROOT/linux_kernel_modules/iot_slot/0-iot_slot
$MANGOH_ROOT/linux_kernel_modules/mt7697q/1-mt7697q $MANGOH_ROOT/linux_kernel_modules/mt7697q/1-mt7697q
$MANGOH_ROOT/linux_kernel_modules/mt7697serial/1-mt7697serial $MANGOH_ROOT/linux_kernel_modules/mt7697serial/1-mt7697serial
$MANGOH_ROOT/linux_kernel_modules/mt7697wifi/2-mt7697wifi_core $MANGOH_ROOT/linux_kernel_modules/mt7697wifi/2-mt7697wifi_core
...@@ -72,4 +78,10 @@ kernelModules: ...@@ -72,4 +78,10 @@ kernelModules:
// spisvc creates a spidev device which will appear as /dev/spidev0.0 once the spidev module is // spisvc creates a spidev device which will appear as /dev/spidev0.0 once the spidev module is
// loaded. // loaded.
$LEGATO_ROOT/drivers/spisvc/spisvc $LEGATO_ROOT/drivers/spisvc/spisvc
// Only on mangOH Red DV4
$MANGOH_ROOT/linux_kernel_modules/ltc294x/0-ltc294x.mdef
// Required for BQ24296
$MANGOH_ROOT/linux_kernel_modules/bq24296/0-bq24296.mdef
} }
Subproject commit 9fa6a660e8bce919e336345069102739674f21c4
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment