BigW Consortium Gitlab

Commit 9b649134 by Ashish Syal

Merge remote-tracking branch 'origin/master'

parents 4599bac0 19544aa4
......@@ -37,96 +37,108 @@ else
$(MAKE) -C $(LEGATO_ROOT) framework_$(LEGATO_TARGET)
endif
export LEGATO_TARGET := $(subst legato_,,$@)
.PHONY: green_wp85
green_wp85: legato_wp85
TOOLCHAIN_DIR=$(shell $(LEGATO_ROOT)/bin/findtoolchain wp85 dir) \
TOOLCHAIN_PREFIX=$(shell $(LEGATO_ROOT)/bin/findtoolchain wp85 prefix) \
MANGOH_BOARD=GREEN \
MANGOH_BOARD=green \
mksys -t wp85 $(MKSYS_ARGS_COMMON) $(MKSYS_ARGS_GREEN) mangOH.sdef
.PHONY: green_wp750x
green_wp750x: legato_wp750x
TOOLCHAIN_DIR=$(shell $(LEGATO_ROOT)/bin/findtoolchain wp750x dir) \
TOOLCHAIN_PREFIX=$(shell $(LEGATO_ROOT)/bin/findtoolchain wp750x prefix) \
MANGOH_BOARD=GREEN \
MANGOH_BOARD=green \
mksys -t wp750x $(MKSYS_ARGS_COMMON) $(MKSYS_ARGS_GREEN) mangOH.sdef
.PHONY: green_wp76xx
green_wp76xx: legato_wp76xx
TOOLCHAIN_DIR=$(shell $(LEGATO_ROOT)/bin/findtoolchain wp76xx dir) \
TOOLCHAIN_PREFIX=$(shell $(LEGATO_ROOT)/bin/findtoolchain wp76xx prefix) \
MANGOH_BOARD=GREEN \
MANGOH_BOARD=green \
mksys -t wp76xx $(MKSYS_ARGS_COMMON) $(MKSYS_ARGS_GREEN) mangOH.sdef
.PHONY: green_wp77xx
green_wp77xx: legato_wp77xx
TOOLCHAIN_DIR=$(shell $(LEGATO_ROOT)/bin/findtoolchain wp77xx dir) \
TOOLCHAIN_PREFIX=$(shell $(LEGATO_ROOT)/bin/findtoolchain wp77xx prefix) \
MANGOH_BOARD=GREEN \
MANGOH_BOARD=green \
mksys -t wp77xx $(MKSYS_ARGS_COMMON) $(MKSYS_ARGS_GREEN) mangOH.sdef
.PHONY: red_wp85
red_wp85: legato_wp85
TOOLCHAIN_DIR=$(shell $(LEGATO_ROOT)/bin/findtoolchain wp85 dir) \
TOOLCHAIN_PREFIX=$(shell $(LEGATO_ROOT)/bin/findtoolchain wp85 prefix) \
MANGOH_BOARD=RED \
MANGOH_BOARD=red \
mksys -t wp85 $(MKSYS_ARGS_COMMON) $(MKSYS_ARGS_RED) mangOH.sdef
.PHONY: red_wp750x
red_wp750x: legato_wp750x
TOOLCHAIN_DIR=$(shell $(LEGATO_ROOT)/bin/findtoolchain wp750x dir) \
TOOLCHAIN_PREFIX=$(shell $(LEGATO_ROOT)/bin/findtoolchain wp750x prefix) \
MANGOH_BOARD=RED \
MANGOH_BOARD=red \
mksys -t wp750x $(MKSYS_ARGS_COMMON) $(MKSYS_ARGS_RED) mangOH.sdef
.PHONY: red_wp76xx
red_wp76xx: legato_wp76xx
TOOLCHAIN_DIR=$(shell $(LEGATO_ROOT)/bin/findtoolchain wp76xx dir) \
TOOLCHAIN_PREFIX=$(shell $(LEGATO_ROOT)/bin/findtoolchain wp76xx prefix) \
MANGOH_BOARD=RED \
MANGOH_BOARD=red \
mksys -t wp76xx $(MKSYS_ARGS_COMMON) $(MKSYS_ARGS_RED) mangOH.sdef
.PHONY: red_wp77xx
red_wp77xx: legato_wp77xx
TOOLCHAIN_DIR=$(shell $(LEGATO_ROOT)/bin/findtoolchain wp77xx dir) \
TOOLCHAIN_PREFIX=$(shell $(LEGATO_ROOT)/bin/findtoolchain wp77xx prefix) \
MANGOH_BOARD=RED \
MANGOH_BOARD=red \
mksys -t wp77xx $(MKSYS_ARGS_COMMON) $(MKSYS_ARGS_RED) mangOH.sdef
# Until Legato allows external builds in mdefs we will need to build a
# subsystem driver like Cypress Wifi in the top makefile and with scripts
# Define a function to build the Cypress driver for different architectures
# $(call cyp_bld,build_dir)
define cyp_bld
if [ ! -d $(MANGOH_ROOT)/build/$1/modules/cypwifi ] ; then \
mkdir -p $(MANGOH_ROOT)/build/$1/modules/cypwifi ;\
cp -pr $(MANGOH_ROOT)/linux_kernel_modules/cypwifi $(MANGOH_ROOT)/build/$1/modules/ ; \
$(MANGOH_ROOT)/build/$1/modules/cypwifi/build.sh $1 clean; \
else \
$(MANGOH_ROOT)/build/$1/modules/cypwifi/build.sh $1 modules; \
fi
endef
.PHONY: yellow_wp85
yellow_wp85: legato_wp85
# Until Legato allows external builds in mdefs we will need to build a
# subsystem driver like Cypress in the top makefile and with scripts
LEGATO_TARGET=wp85 $(MANGOH_ROOT)/linux_kernel_modules/cypwifi/build.sh
$(call cyp_bld,$@)
TOOLCHAIN_DIR=$(shell $(LEGATO_ROOT)/bin/findtoolchain wp85 dir) \
TOOLCHAIN_PREFIX=$(shell $(LEGATO_ROOT)/bin/findtoolchain wp85 prefix) \
MANGOH_BOARD=YELLOW \
MANGOH_BOARD=yellow \
mksys -t wp85 $(MKSYS_ARGS_COMMON) $(MKSYS_ARGS_YELLOW) mangOH.sdef
.PHONY: yellow_wp750x
yellow_wp750x: legato_wp750x
TOOLCHAIN_DIR=$(shell $(LEGATO_ROOT)/bin/findtoolchain wp750x dir) \
$(call cyp_bld,$@)
TOOLCHAIN_PREFIX=$(shell $(LEGATO_ROOT)/bin/findtoolchain wp750x prefix) \
MANGOH_BOARD=YELLOW \
MANGOH_BOARD=yellow \
mksys -t wp750x $(MKSYS_ARGS_COMMON) $(MKSYS_ARGS_YELLOW) mangOH.sdef
.PHONY: yellow_wp76xx
yellow_wp76xx: legato_wp76xx
# Until Legato allows external builds in mdefs we will need to build a
# subsystem driver like Cypress in the top makefile and with scripts
# This does not seem to work except on 1 board flakily - will try with
# DV2 Yellow
LEGATO_TARGET=wp76xx $(MANGOH_ROOT)/linux_kernel_modules/cypwifi/build.sh
$(call cyp_bld,$@)
TOOLCHAIN_DIR=$(shell $(LEGATO_ROOT)/bin/findtoolchain wp76xx dir) \
TOOLCHAIN_PREFIX=$(shell $(LEGATO_ROOT)/bin/findtoolchain wp76xx prefix) \
MANGOH_BOARD=YELLOW \
MANGOH_BOARD=yellow \
mksys -t wp76xx $(MKSYS_ARGS_COMMON) $(MKSYS_ARGS_YELLOW) mangOH.sdef
.PHONY: yellow_wp77xx
yellow_wp77xx: legato_wp77xx
$(call cyp_bld,$@)
TOOLCHAIN_DIR=$(shell $(LEGATO_ROOT)/bin/findtoolchain wp77xx dir) \
TOOLCHAIN_PREFIX=$(shell $(LEGATO_ROOT)/bin/findtoolchain wp77xx prefix) \
MANGOH_BOARD=YELLOW \
MANGOH_BOARD=yellow \
mksys -t wp77xx $(MKSYS_ARGS_COMMON) $(MKSYS_ARGS_YELLOW) mangOH.sdef
.PHONY: clean
......
Subproject commit 363f934914978482269f07f3395b413b8e11f21a
Subproject commit 0de015c8d564eb5816dc3b254c13e15d0df45568
......@@ -60,4 +60,18 @@
({ \
((typeof(_mask))(_val) << __bf_shf(_mask)) & (_mask); \
})
/**
* FIELD_GET() - extract a bitfield element
* @_mask: shifted mask defining the field's length and position
* @_reg: value of entire bitfield
*
* FIELD_GET() extracts the field specified by @_mask from the
* bitfield passed in as @_reg by masking and shifting it down.
*/
#define FIELD_GET(_mask, _reg) \
({ \
(typeof(_mask))(((_reg) & (_mask)) >> __bf_shf(_mask)); \
})
#endif
......@@ -4,10 +4,10 @@
#define BME680_REG_CHIP_I2C_ID 0xD0
#define BME680_REG_CHIP_SPI_ID 0x50
#define BME680_CHIP_ID_VAL 0x61
#define BME680_CHIP_ID_VAL 0x61
#define BME680_REG_SOFT_RESET_I2C 0xE0
#define BME680_REG_SOFT_RESET_SPI 0x60
#define BME680_CMD_SOFTRESET 0xB6
#define BME680_CMD_SOFTRESET 0xB6
#define BME680_REG_STATUS 0x73
#define BME680_SPI_MEM_PAGE_BIT BIT(4)
#define BME680_SPI_MEM_PAGE_1_VAL 1
......@@ -18,6 +18,7 @@
#define BME680_REG_GAS_MSB 0x2A
#define BME680_REG_GAS_R_LSB 0x2B
#define BME680_GAS_STAB_BIT BIT(4)
#define BME680_GAS_RANGE_MASK GENMASK(3, 0)
#define BME680_REG_CTRL_HUMIDITY 0x72
#define BME680_OSRS_HUMIDITY_MASK GENMASK(2, 0)
......@@ -26,9 +27,8 @@
#define BME680_OSRS_TEMP_MASK GENMASK(7, 5)
#define BME680_OSRS_PRESS_MASK GENMASK(4, 2)
#define BME680_MODE_MASK GENMASK(1, 0)
#define BME680_MODE_FORCED 1
#define BME680_MODE_SLEEP 0
#define BME680_MODE_FORCED 1
#define BME680_MODE_SLEEP 0
#define BME680_REG_CONFIG 0x75
#define BME680_FILTER_MASK GENMASK(4, 2)
......@@ -39,24 +39,21 @@
#define BME680_MAX_OVERFLOW_VAL 0x40000000
#define BME680_HUM_REG_SHIFT_VAL 4
#define BME680_BIT_H1_DATA_MSK 0x0F
#define BME680_BIT_H1_DATA_MASK GENMASK(3, 0)
#define BME680_REG_RES_HEAT_RANGE 0x02
#define BME680_RHRANGE_MSK 0x30
#define BME680_RHRANGE_MASK GENMASK(5, 4)
#define BME680_REG_RES_HEAT_VAL 0x00
#define BME680_REG_RANGE_SW_ERR 0x04
#define BME680_RSERROR_MSK 0xF0
#define BME680_RSERROR_MASK GENMASK(7, 4)
#define BME680_REG_RES_HEAT_0 0x5A
#define BME680_REG_GAS_WAIT_0 0x64
#define BME680_GAS_RANGE_MASK 0x0F
#define BME680_ADC_GAS_RES_SHIFT 6
#define BME680_AMB_TEMP 25
#define BME680_REG_CTRL_GAS_1 0x71
#define BME680_RUN_GAS_MASK BIT(4)
#define BME680_NB_CONV_MASK GENMASK(3, 0)
#define BME680_RUN_GAS_EN_BIT BIT(4)
#define BME680_NB_CONV_0_VAL 0
#define BME680_REG_MEAS_STAT_0 0x1D
#define BME680_GAS_MEAS_BIT BIT(6)
......
This source diff could not be displayed because it is too large. You can view the blob instead.
config KERNEL_4_16
def_bool y
config KERNEL_4_17
def_bool y
config KERNEL_4_18
def_bool y
config KERNEL_4_19
def_bool y
config KERNEL_4_20
def_bool y
config KERNEL_4_21
def_bool y
config KERNEL_4_22
def_bool y
config KERNEL_4_23
def_bool y
config KERNEL_4_24
def_bool y
config KERNEL_4_25
def_bool y
config KERNEL_4_26
def_bool y
config KERNEL_4_27
def_bool y
config KERNEL_4_28
def_bool y
config KERNEL_4_29
def_bool y
config KERNEL_4_30
def_bool y
config KERNEL_4_31
def_bool y
config KERNEL_4_32
def_bool y
config KERNEL_4_33
def_bool y
config KERNEL_4_34
def_bool y
config KERNEL_4_35
def_bool y
config KERNEL_4_36
def_bool y
config KERNEL_4_37
def_bool y
config KERNEL_4_38
def_bool y
config KERNEL_4_39
def_bool y
config KERNEL_4_40
def_bool y
config KERNEL_4_41
def_bool y
config KERNEL_4_42
def_bool y
config KERNEL_4_43
def_bool y
config KERNEL_4_44
def_bool y
config KERNEL_4_45
def_bool y
config KERNEL_4_46
def_bool y
config KERNEL_4_47
def_bool y
config KERNEL_4_48
def_bool y
config KERNEL_4_49
def_bool y
config KERNEL_4_50
def_bool y
config KERNEL_4_51
def_bool y
config KERNEL_4_52
def_bool y
config KERNEL_4_53
def_bool y
config KERNEL_4_54
def_bool y
config KERNEL_4_55
def_bool y
config KERNEL_4_56
def_bool y
config KERNEL_4_57
def_bool y
config KERNEL_4_58
def_bool y
config KERNEL_4_59
def_bool y
config KERNEL_4_60
def_bool y
config KERNEL_4_61
def_bool y
config KERNEL_4_62
def_bool y
config KERNEL_4_63
def_bool y
config KERNEL_4_64
def_bool y
config KERNEL_4_65
def_bool y
config KERNEL_4_66
def_bool y
config KERNEL_4_67
def_bool y
config KERNEL_4_68
def_bool y
config KERNEL_4_69
def_bool y
config KERNEL_4_70
def_bool y
config KERNEL_4_71
def_bool y
config KERNEL_4_72
def_bool y
config KERNEL_4_73
def_bool y
config KERNEL_4_74
def_bool y
config KERNEL_4_75
def_bool y
config KERNEL_4_76
def_bool y
config KERNEL_4_77
def_bool y
config KERNEL_4_78
def_bool y
config KERNEL_4_79
def_bool y
config KERNEL_4_80
def_bool y
config KERNEL_4_81
def_bool y
config KERNEL_4_82
def_bool y
config KERNEL_4_83
def_bool y
config KERNEL_4_84
def_bool y
config KERNEL_4_85
def_bool y
config KERNEL_4_86
def_bool y
config KERNEL_4_87
def_bool y
config KERNEL_4_88
def_bool y
config KERNEL_4_89
def_bool y
config KERNEL_4_90
def_bool y
config KERNEL_4_91
def_bool y
config KERNEL_4_92
def_bool y
config KERNEL_4_93
def_bool y
config KERNEL_4_94
def_bool y
config KERNEL_4_95
def_bool y
config KERNEL_4_96
def_bool y
config KERNEL_4_97
def_bool y
config KERNEL_4_98
def_bool y
config KERNEL_4_99
def_bool y
#ifndef COMPAT_AUTOCONF_INCLUDED
#define COMPAT_AUTOCONF_INCLUDED
/*
* Automatically generated file, don't edit!
* Changes will be overwritten
*/
#define CPTCFG_WIRELESS 1
#define CPTCFG_NET_CORE 1
#define CPTCFG_EXPERT 1
#define CPTCFG_BP_MODULES 1
#define CPTCFG_BPAUTO_REFCOUNT 1
#define CPTCFG_CFG80211_MODULE 1
#define CPTCFG_CFG80211_DEFAULT_PS 1
#define CPTCFG_CFG80211_CRDA_SUPPORT 1
#define CPTCFG_CFG80211_WEXT 1
#define CPTCFG_WLAN 1
#define CPTCFG_WLAN_VENDOR_BROADCOM 1
#define CPTCFG_BRCMUTIL_MODULE 1
#define CPTCFG_BRCMFMAC_MODULE 1
#define CPTCFG_BRCMFMAC_PROTO_BCDC 1
#define CPTCFG_BRCMFMAC_SDIO 1
#define CPTCFG_BRCMFMAC_USB 1
#define CPTCFG_BACKPORTED_WIRELESS 1
#define CPTCFG_BACKPORTED_NET_CORE 1
#define CPTCFG_BACKPORTED_EXPERT 1
#define CPTCFG_BACKPORTED_BP_MODULES 1
#define CPTCFG_BACKPORTED_BPAUTO_REFCOUNT 1
#define CPTCFG_BACKPORTED_CFG80211_MODULE 1
#define CPTCFG_BACKPORTED_CFG80211_DEFAULT_PS 1
#define CPTCFG_BACKPORTED_CFG80211_CRDA_SUPPORT 1
#define CPTCFG_BACKPORTED_CFG80211_WEXT 1
#define CPTCFG_BACKPORTED_WLAN 1
#define CPTCFG_BACKPORTED_WLAN_VENDOR_BROADCOM 1
#define CPTCFG_BACKPORTED_BRCMUTIL_MODULE 1
#define CPTCFG_BACKPORTED_BRCMFMAC_MODULE 1
#define CPTCFG_BACKPORTED_BRCMFMAC_PROTO_BCDC 1
#define CPTCFG_BACKPORTED_BRCMFMAC_SDIO 1
#define CPTCFG_BACKPORTED_BRCMFMAC_USB 1
#endif /* COMPAT_AUTOCONF_INCLUDED */
......@@ -6,9 +6,21 @@
# some are even defined the same - would be good to fix
# If your kernel headers are in a different place than mine - please
# modify the values appropriately
set -x
USAGE="Usage: $0 build_target_dir clean|modules"
if [ -z "$1" ] ; then
echo $USAGE
exit 2
fi
if [ -z "$2" ] ; then
echo $USAGE
exit 3
fi
export PATH=`findtoolchain ${LEGATO_TARGET} dir`:$PATH
export MY_KERNEL=`findtoolchain wp85 kernelroot`
export MY_KERNEL=`findtoolchain ${LEGATO_TARGET} kernelroot`
export KLIB=$MY_KERNEL
export KLIB_BUILD=$MY_KERNEL
......@@ -19,9 +31,14 @@ export CROSS_COMPILE=`findtoolchain ${LEGATO_TARGET} prefix`
# Lets do it
OLDPWD=`pwd`
cd ${MANGOH_ROOT}/linux_kernel_modules/cypwifi
make clean ; make defconfig-brcmfmac ; make modules
cd ${MANGOH_ROOT}/build/${1}/modules/cypwifi
if [ "$2" == "clean" ] ; then
make defconfig-brcmfmac
fi
make modules
if [ $? -ne 0 ] ; then
cd $OLDPWD
exit 1
else
cd $OLDPWD
......
preBuilt:
{
$CURDIR/compat/compat.ko
$CURDIR/net/wireless/cfg80211.ko
$CURDIR/drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko
$CURDIR/drivers/net/wireless/broadcom/brcm80211/brcmutil/brcmutil.ko
$MANGOH_ROOT/build/${MANGOH_BOARD}_${LEGATO_TARGET}/modules/cypwifi/compat/compat.ko
$MANGOH_ROOT/build/${MANGOH_BOARD}_${LEGATO_TARGET}/modules/cypwifi/net/wireless/cfg80211.ko
$MANGOH_ROOT/build/${MANGOH_BOARD}_${LEGATO_TARGET}/modules/cypwifi/drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko
$MANGOH_ROOT/build/${MANGOH_BOARD}_${LEGATO_TARGET}/modules/cypwifi/drivers/net/wireless/broadcom/brcm80211/brcmutil/brcmutil.ko
}
bundles:
......@@ -14,9 +14,17 @@ bundles:
$CURDIR/firmware/brcmfmac43430-sdio.bin /etc/firmware/brcm/brcmfmac43430-sdio.bin
$CURDIR/firmware/brcmfmac43430-sdio.clm_blob /etc/firmware/brcm/brcmfmac43430-sdio.clm_blob
[x] $CURDIR/scripts/cywifi.sh /etc/init.d/cywifi.sh
//[x] $CURDIR/scripts/cywifi_start.sh /etc/init.d/cywifi_start.sh
//[x] $CURDIR/scripts/cywifi_stop.sh /etc/init.d/cywifi_stop.sh
}
}
//scripts:
//{
//install: $CURDIR/scripts/cywifi_start.sh
//remove: $CURDIR/scripts/cywifi_stop.sh
//}
load: manual
......@@ -29,31 +29,30 @@ struct expander_device {
#define CREATE_SYSFS_DEFN(_var, _offset) \
static ssize_t _var##_show(struct device *dev, \
struct device_attribute *attr, \
char *buf) \
static ssize_t _var##_show(struct device *dev, struct device_attribute *attr, \
char *buf) \
{ \
struct expander_device* exp = dev_get_drvdata(dev); \
return sprintf(buf, "%d\n", atomic_read(&exp->_var##_val)); \
}\
static int _var##_store(struct device *dev, \
struct device_attribute *attr, \
const char *buf, size_t count) \
struct expander_device* exp = dev_get_drvdata(dev); \
return sprintf(buf, "%d\n", atomic_read(&exp->_var##_val)); \
} \
static int _var##_store(struct device *dev, struct device_attribute *attr, \
const char *buf, size_t count) \
{ \
struct expander_device* exp = dev_get_drvdata(dev); \
struct expander_device* exp = dev_get_drvdata(dev); \
u8 val; \
int ret; \
\
ret = kstrtou8(buf, 10, &val); \
if (ret || val > 1) \
return -EINVAL; \
\
int ret; \
\
ret = kstrtou8(buf, 10, &val); \
if (ret || val > 1) \
return -EINVAL; \
\
gpio_set_value_cansleep(exp->gpio_expander_base + _offset, val); \
atomic_set(&exp->_var##_val, val); \
dev_info(dev, "Setting GPIO %d to %d\n", exp->gpio_expander_base + _offset, val); \
\
return count; \
} \
atomic_set(&exp->_var##_val, val); \
dev_info(dev, "Setting GPIO %d to %d\n", \
exp->gpio_expander_base + _offset, val); \
\
return count; \
} \
static DEVICE_ATTR_RW(_var)
CREATE_SYSFS_DEFN(generic_led, GENERIC_LED);
......@@ -65,63 +64,52 @@ CREATE_SYSFS_DEFN(tri_led_grn, TRI_LED_GRN);
CREATE_SYSFS_DEFN(buzzer, BUZZER);
static void gpio_initial_status(struct platform_device *pdev,
struct device_attribute *attr,
int function_number,int function_val,
atomic_t *atomic_val)
static int gpio_initial_status(struct platform_device *pdev,
struct device_attribute *attr,
int expander_gpio_offset, int gpio_output_level,
atomic_t *atomic_val)
{
struct expander_device *exp = dev_get_drvdata(&pdev->dev);
const int gpio_num = exp->gpio_expander_base + expander_gpio_offset;
int ret = devm_gpio_request_one(
&pdev->dev, gpio_num,
(GPIOF_DIR_OUT |
(gpio_output_level ? GPIOF_INIT_HIGH : GPIOF_INIT_LOW)),
attr->attr.name);
if (ret != 0) {
dev_err(&pdev->dev, "Couldn't request GPIO %d\n", gpio_num);
return ret;
}
atomic_set(atomic_val, gpio_output_level);
//struct expander_device* exp = dev_get_drvdata(&pdev->dev);
dev_info(&pdev->dev, "%s(): initial_status\n", __func__);
devm_gpio_request(&pdev->dev, function_number,
dev_name(&pdev->dev));
dev_info(&pdev->dev, "%s(): initial_status_line2\n", __func__);
atomic_set(atomic_val, function_val);
dev_info(&pdev->dev, "%s(): initial_status_line3\n", __func__);
gpio_direction_output(function_number,
function_val);
dev_info(&pdev->dev, "%s(): initial_status_line4\n", __func__);
device_create_file(&pdev->dev, attr);
dev_info(&pdev->dev, "%s(): initial_status_line5\n", __func__);
ret = device_create_file(&pdev->dev, attr);
if (ret != 0) {
dev_err(&pdev->dev, "Couldn't create sysfs file for %s\n",
attr->attr.name);
return ret;
}
return ret;
}
static void gpio_final_status(struct platform_device *pdev,
struct device_attribute *attr,
int function_number,int function_val)
static void gpio_final_status(struct platform_device *pdev,
struct device_attribute *attr,
int expander_gpio_offset, int gpio_output_level)
{
dev_info(&pdev->dev, "%s(): final_status\n", __func__);
struct expander_device *exp = dev_get_drvdata(&pdev->dev);
const int gpio_num = exp->gpio_expander_base + expander_gpio_offset;
device_remove_file(&pdev->dev, attr);
dev_info(&pdev->dev, "%s(): final_status_line2\n", __func__);
gpio_set_value_cansleep(function_number, function_val);
dev_info(&pdev->dev, "%s(): final_status_line3\n", __func__);
gpio_set_value_cansleep(gpio_num, gpio_output_level);
}
static int expander_probe(struct platform_device *pdev)
{
struct expander_device* dev;
int ret = 0;
//int *pass = NULL;
struct expander_platform_data *pdata = dev_get_platdata(&pdev->dev);
dev_info(&pdev->dev, "%s(): probe\n", __func__);
dev_dbg(&pdev->dev, "%s(): probe\n", __func__);
if (!pdata) {
ret = -EINVAL;
......@@ -129,8 +117,6 @@ static int expander_probe(struct platform_device *pdev)
goto done;
}
/* Create the driver data and remove the allocated memory when driver
is removed */
dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL);
if (!dev) {
ret = -ENOMEM;
......@@ -139,33 +125,51 @@ static int expander_probe(struct platform_device *pdev)
dev->pdev = pdev;
dev->gpio_expander_base = pdata->gpio_expander_base;
gpio_initial_status(pdev,&dev_attr_generic_led, dev->gpio_expander_base+GENERIC_LED, 0, &dev->generic_led_val);
gpio_initial_status(pdev,&dev_attr_pcm_sel, dev->gpio_expander_base+PCM_SEL, 0, &dev->pcm_sel_val);
gpio_initial_status( pdev,&dev_attr_sdio_sel, dev->gpio_expander_base+SDIO_SEL, 0, &dev->sdio_sel_val);
gpio_initial_status(pdev,&dev_attr_tri_led_blu, dev->gpio_expander_base+TRI_LED_BLU, 0, &dev->tri_led_blu_val);
gpio_initial_status(pdev,&dev_attr_tri_led_red, dev->gpio_expander_base+TRI_LED_RED, 0, &dev->tri_led_red_val);
gpio_initial_status(pdev,&dev_attr_tri_led_grn, dev->gpio_expander_base+TRI_LED_GRN, 0, &dev->tri_led_grn_val);
gpio_initial_status(pdev,&dev_attr_buzzer, dev->gpio_expander_base+BUZZER, 0, &dev->buzzer_val);
platform_set_drvdata(pdev, dev);
ret = gpio_initial_status(pdev, &dev_attr_generic_led, GENERIC_LED, 0,
&dev->generic_led_val);
if (ret)
goto done;
ret = gpio_initial_status(pdev, &dev_attr_pcm_sel, PCM_SEL, 0,
&dev->pcm_sel_val);
if (ret)
goto done;
ret = gpio_initial_status(pdev, &dev_attr_sdio_sel, SDIO_SEL, 0,
&dev->sdio_sel_val);
if (ret)
goto done;
ret = gpio_initial_status(pdev, &dev_attr_tri_led_blu, TRI_LED_BLU, 0,
&dev->tri_led_blu_val);
if (ret)
goto done;
ret = gpio_initial_status(pdev, &dev_attr_tri_led_red, TRI_LED_RED, 0,
&dev->tri_led_red_val);
if (ret)
goto done;
ret = gpio_initial_status(pdev, &dev_attr_tri_led_grn, TRI_LED_GRN, 0,
&dev->tri_led_grn_val);
if (ret)
goto done;
ret = gpio_initial_status(pdev, &dev_attr_buzzer, BUZZER, 0,
&dev->buzzer_val);
if (ret)
goto done;
done:
return ret;
}
static int expander_remove(struct platform_device *pdev)
{
struct expander_device* dev = dev_get_drvdata(&pdev->dev);
/* remove sysfs files & set final state values for gpio expander*/
gpio_final_status(pdev,&dev_attr_generic_led, dev->gpio_expander_base+GENERIC_LED, 0);
gpio_final_status(pdev,&dev_attr_pcm_sel, dev->gpio_expander_base+PCM_SEL, 0);
gpio_final_status(pdev,&dev_attr_sdio_sel, dev->gpio_expander_base+SDIO_SEL, 0);
gpio_final_status(pdev,&dev_attr_tri_led_blu, dev->gpio_expander_base+TRI_LED_BLU, 0);
gpio_final_status(pdev,&dev_attr_tri_led_red, dev->gpio_expander_base+TRI_LED_RED, 0);
gpio_final_status(pdev,&dev_attr_tri_led_grn, dev->gpio_expander_base+TRI_LED_GRN, 0);
gpio_final_status(pdev,&dev_attr_buzzer, dev->gpio_expander_base+BUZZER, 0);
/* remove sysfs files & set final state values for gpio expander */
gpio_final_status(pdev, &dev_attr_generic_led, GENERIC_LED, 0);
gpio_final_status(pdev, &dev_attr_pcm_sel, PCM_SEL, 0);
gpio_final_status(pdev, &dev_attr_sdio_sel, SDIO_SEL, 0);
gpio_final_status(pdev, &dev_attr_tri_led_blu, TRI_LED_BLU, 0);
gpio_final_status(pdev, &dev_attr_tri_led_red, TRI_LED_RED, 0);
gpio_final_status(pdev, &dev_attr_tri_led_grn, TRI_LED_GRN, 0);
gpio_final_status(pdev, &dev_attr_buzzer, BUZZER, 0);
return 0;
}
......
......@@ -167,14 +167,18 @@ static struct i2c_board_info mangoh_red_pressure_devinfo = {
I2C_BOARD_INFO("bmp280", 0x76),
};
static struct ltc294x_platform_data mangoh_red_battery_gauge_platform_data = {
static struct ltc294x_platform_data ltc2942_battery_gauge_platform_data = {
.r_sense = 18,
.prescaler_exp = 32,
.name = "LTC2942",
};
static struct i2c_board_info mangoh_red_battery_gauge_devinfo = {
static struct i2c_board_info ltc2942_battery_gauge_devinfo = {
I2C_BOARD_INFO("ltc2942", 0x64),
.platform_data = &mangoh_red_battery_gauge_platform_data,
.platform_data = &ltc2942_battery_gauge_platform_data,
};
static struct i2c_board_info bq27426_battery_gauge_devinfo = {
I2C_BOARD_INFO("bq27426", 0x55),
};
static struct i2c_board_info mangoh_red_battery_charger_devinfo = {
......@@ -431,15 +435,21 @@ static int mangoh_red_probe(struct platform_device* pdev)
goto cleanup;
}
/* Map the I2C ltc2942 battery gauge */
dev_dbg(&pdev->dev, "mapping ltc2942 battery gauge\n");
mangoh_red_driver_data.battery_gauge = i2c_new_device(
i2c_adapter_batt_charger,
&mangoh_red_battery_gauge_devinfo);
if (!mangoh_red_driver_data.battery_gauge) {
dev_err(&pdev->dev, "battery gauge is missing\n");
ret = -ENODEV;
goto cleanup;
/* Map the I2C battery gauge */
{
struct i2c_board_info *battery_gauge_info =
(mangoh_red_pdata.board_rev == MANGOH_RED_BOARD_REV_DV5) ?
&ltc2942_battery_gauge_devinfo :
&bq27426_battery_gauge_devinfo;
dev_dbg(&pdev->dev, "mapping %s battery gauge\n",
battery_gauge_info->type);
mangoh_red_driver_data.battery_gauge = i2c_new_device(
i2c_adapter_batt_charger, battery_gauge_info);
if (!mangoh_red_driver_data.battery_gauge) {
dev_err(&pdev->dev, "battery gauge is missing\n");
ret = -ENODEV;
goto cleanup;
}
}
/*
......
......@@ -73,7 +73,7 @@ static struct mangoh_yellow_platform_data {
} mangoh_yellow_pdata;
static struct mangoh_yellow_driver_data {
// struct i2c_client* eeprom;
/* struct i2c_client* eeprom; */
struct i2c_client* i2c_switch;
struct i2c_client* imu;
struct i2c_client* environmental;
......@@ -85,7 +85,7 @@ static struct mangoh_yellow_driver_data {
struct i2c_client* gpio_expander;
bool expander_registered;
} mangoh_yellow_driver_data = {
.expander_registered = false,
.expander_registered = false,
};
static struct platform_device mangoh_yellow_device = {
......@@ -171,19 +171,26 @@ static struct platform_device mangoh_yellow_expander = {
/*
* The EEPROM is marked as read-only to prevent accidental writes. The mangOH
* Yellow has the write protect (WP) pin pulled high which has the effect of making
* the upper 1/4 of the address space of the EEPROM write protected by hardware.
* Yellow has the write protect (WP) pin pulled high which has the effect of
* making the upper 1/4 of the address space of the EEPROM write protected by
* hardware.
*/
/*static struct at24_platform_data mangoh_yellow_eeprom_data = {
/*
* The EEPROM is commented out because it's not populated on mangOH Yellow DV2
* hardware, but it is expected to return in later revisions.
*/
/*
static struct at24_platform_data mangoh_yellow_eeprom_data = {
.byte_len = 4096,
.page_size = 32,
.flags = (AT24_FLAG_ADDR16 | AT24_FLAG_READONLY),
};*/
/*static struct i2c_board_info mangoh_yellow_eeprom_info = {
};
static struct i2c_board_info mangoh_yellow_eeprom_info = {
I2C_BOARD_INFO("at24", 0x50),
.platform_data = &mangoh_yellow_eeprom_data,
};
*/
static void mangoh_yellow_release(struct device* dev)
{
/* Nothing alloc'd, so nothign to free */
......@@ -276,11 +283,11 @@ static int mangoh_yellow_probe(struct platform_device* pdev)
}
mangoh_yellow_driver_data.expander_registered = true;
/* Map the I2C BME680 environmental sensor for gas/humidity/temp/pressure sensor */
dev_info(&pdev->dev, "mapping bme680 gas/temperature/pressure sensor\n");
mangoh_yellow_driver_data.environmental =
i2c_new_device(i2c_adapter_port1,
&mangoh_yellow_environmental_devinfo);
/* Map the BME680 environmental sensor (gas/humidity/temp/pressure) */
dev_info(&pdev->dev,
"mapping bme680 gas/humidity/temperature/pressure sensor\n");
mangoh_yellow_driver_data.environmental = i2c_new_device(
i2c_adapter_port1, &mangoh_yellow_environmental_devinfo);
if (!mangoh_yellow_driver_data.environmental) {
dev_err(&pdev->dev,
"Failed to register environmental sensor %s\n",
......@@ -324,7 +331,7 @@ static int mangoh_yellow_probe(struct platform_device* pdev)
goto cleanup;
}
/* Map the I2C Battery Charger*/
/* Map the I2C Battery Charger */
dev_dbg(&pdev->dev, "mapping battery charger\n");
mangoh_yellow_driver_data.battery_charger =
i2c_new_device(i2c_adapter_port2,
......@@ -348,7 +355,6 @@ static int mangoh_yellow_probe(struct platform_device* pdev)
goto cleanup;
}
/* Map the I2C Light Sensor */
dev_dbg(&pdev->dev, "mapping Light Sensor\n");
mangoh_yellow_light_devinfo.irq = gpio_to_irq(CF3_GPIO36);
......@@ -386,10 +392,10 @@ static int mangoh_yellow_remove(struct platform_device* pdev)
i2c_unregister_device(dd->battery_gauge);
i2c_unregister_device(dd->rtc);
if (dd->expander_registered)
platform_device_unregister(&mangoh_yellow_expander);
i2c_unregister_device(dd->gpio_expander);
platform_device_unregister(&mangoh_yellow_expander);
i2c_unregister_device(dd->gpio_expander);
i2c_unregister_device(dd->i2c_switch);
// i2c_unregister_device(dd->eeprom);
/* i2c_unregister_device(dd->eeprom); */
return 0;
}
......@@ -398,6 +404,7 @@ static void mangoh_yellow_expander_release(struct device *dev)
{
/* do nothing */
}
static int __init mangoh_yellow_init(void)
{
platform_driver_register(&mangoh_yellow_driver);
......@@ -409,7 +416,7 @@ static int __init mangoh_yellow_init(void)
mangoh_yellow_pdata.board_rev = MANGOH_YELLOW_BOARD_REV_DEV;
} else {
pr_err("%s:Unsupported mangoh yellow board revision (%s)\n",
__func__, revision);
__func__, revision);
return -ENODEV;
}
......
......@@ -10,7 +10,7 @@
apps:
{
#if ${MANGOH_BOARD} = RED
#if ${MANGOH_BOARD} = red
/*
* There is a conflict between the following software components:
* - sx1509 Linux kernel driver
......@@ -45,21 +45,17 @@ apps:
$MANGOH_ROOT/apps/DataPushTest/dataPushTest
$MANGOH_ROOT/apps/BatteryService/battery
$LEGATO_ROOT/apps/sample/dataHub/dataHub
$LEGATO_ROOT/apps/sample/datahubGps/gpsSensor
$MANGOH_ROOT/apps/mangOHRedSensorToCloud/redSensor
$MANGOH_ROOT/apps/mangOHRedSensorToCloud/redCloud
#elif ${MANGOH_BOARD} = GREEN
#elif ${MANGOH_BOARD} = green
$MANGOH_ROOT/apps/GpioExpander/gpioExpanderService/gpioExpanderServiceGreen
$MANGOH_ROOT/apps/MuxControl/muxCtrlService/muxCtrlService
$MANGOH_ROOT/apps/MuxControl/tools/muxCtrlTools
$MANGOH_ROOT/apps/ArduinoBridge/arduinoBridge
$MANGOH_ROOT/apps/Heartbeat/heartbeatGreen
#elif ${MANGOH_BOARD} = YELLOW
#elif ${MANGOH_BOARD} = yellow
// $MANGOH_ROOT/apps/YellowSensorToCloud/yellowSensor
$LEGATO_ROOT/apps/sample/dataHub/dataHub
$LEGATO_ROOT/apps/sample/datahubGps/gpsSensor
#endif // MANGOH_BOARD
......@@ -74,26 +70,27 @@ apps:
commands:
{
#if ${MANGOH_BOARD} = GREEN
#if ${MANGOH_BOARD} = green
mux = muxCtrlTools:/bin/mux
#else // MANGOH_BOARD
dhub = dataHub:/bin/dhub
#endif // MANGOH_BOARD
dr = drTool:/bin/dr
twitter = socialService:/bin/twitter
dhub = dataHub:/bin/dhub
}
interfaceSearch:
{
#if ${MANGOH_BOARD} = RED
#if ${MANGOH_BOARD} = red
$MANGOH_ROOT/apps/BatteryService
$MANGOH_ROOT/apps/mangOHRedSensorToCloud
$LEGATO_ROOT/apps/sample/dataHub
#elif ${MANGOH_BOARD} = GREEN
#elif ${MANGOH_BOARD} = green
$MANGOH_ROOT/apps/MuxControl
#elif ${MANGOH_BOARD} = YELLOW
#elif ${MANGOH_BOARD} = yellow
$LEGATO_ROOT/apps/sample/dataHub
#endif // MANGOH_BOARD
......@@ -105,16 +102,19 @@ interfaceSearch:
componentSearch:
{
#if ${MANGOH_BOARD} = RED
${CURDIR}/components
#if ${MANGOH_BOARD} = red
${CURDIR}/apps/GpioExpander/gpioExpanderService
${CURDIR}/apps/RedSensorToCloud
${CURDIR}/apps/LocationTriangulation
${CURDIR}/apps/MqttClient
${CURDIR}/components
${CURDIR}/apps/mangOHRedSensorToCloud/interfaces
#elif ${MANGOH_BOARD} = YELLOW
#elif ${MANGOH_BOARD} = green
${CURDIR}/apps/GpioExpander/gpioExpanderService
#elif ${MANGOH_BOARD} = yellow
${CURDIR}/apps/YellowSensorToCloud/interfaces
#endif
#endif
}
......@@ -122,7 +122,7 @@ componentSearch:
kernelModules:
{
#if ${MANGOH_BOARD} = RED
#if ${MANGOH_BOARD} = red
$CURDIR/linux_kernel_modules/mangoh/mangoh_red
$CURDIR/linux_kernel_modules/mt7697wifi/mt7697wifi_core
......@@ -150,7 +150,7 @@ kernelModules:
// Uncomment to build for the CAN Bus IoT card on mangOH Red
// #include "sinc/mangoh_red_can_iot_card.sinc"
#elif ${MANGOH_BOARD} = GREEN
#elif ${MANGOH_BOARD} = green
$CURDIR/linux_kernel_modules/mangoh/mangoh_green_dv4
/*
......@@ -159,7 +159,7 @@ kernelModules:
*/
$CURDIR/linux_kernel_modules/lsm6ds3/lsm6ds3-i2c
$CURDIR/linux_kernel_modules/lsm6ds3/lsm6ds3
#elif ${MANGOH_BOARD} = YELLOW
#elif ${MANGOH_BOARD} = yellow
$CURDIR/linux_kernel_modules/mangoh/mangoh_yellow_dev
#if ${MANGOH_KERNEL_LACKS_IIO} = 1
$CURDIR/linux_kernel_modules/iio/iio-triggered-buffer
......
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