Skip to content

Commit 9bc0b49

Browse files
authored
zephyr: Pick up some changes found in 3.4.0 merge to private repos (#207)
* zephyr: Pick up some changes found in 3.4.0 merge to private repos Forgot to update the release version number. Changes in fuel gauge, SMS messages, unsolicited murata events, the regulator, tsl2540 compile, cxd5605 interrupts and power, lis2dw12 tap 3D. Signed-off-by: Dennis Ruffer <[email protected]> * zephyr: Pick up some changes found in 3.4.0 merge to private repos Found some compliance issues in the code I brought in. Signed-off-by: Dennis Ruffer <[email protected]> * zephyr: Pick up some changes found in 3.4.0 merge to private repos Compliance is still not happy. Signed-off-by: Dennis Ruffer <[email protected]> * zephyr: Pick up some changes found in 3.4.0 merge to private repos Try again with a rebase. Signed-off-by: Dennis Ruffer <[email protected]> --------- Signed-off-by: Dennis Ruffer <[email protected]>
1 parent fac6d79 commit 9bc0b49

File tree

12 files changed

+376
-77
lines changed

12 files changed

+376
-77
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ VERSION_MAJOR = 3
22
VERSION_MINOR = 4
33
PATCHLEVEL = 0
44
VERSION_TWEAK = 0
5-
EXTRAVERSION = rc3
5+
EXTRAVERSION =

drivers/fuel_gauge/act81461/act81461.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,10 @@ static int act81461_charger_get_prop(const struct device *dev, struct fuel_gauge
198198
* IDK if this is the best way to handle this, but this is our mode and
199199
* there is no stanard nor spec for this property
200200
*/
201-
case FUEL_GAUGE_MODE:
201+
case FUEL_GAUGE_SBS_MODE:
202202
rc = i2c_reg_read_byte_dt(&config->i2c, BAT_STAT_REG, &val);
203203

204-
prop->value.mode = val & CHG_STAT_MSK;
204+
prop->value.sbs_mode = val & CHG_STAT_MSK;
205205
break;
206206

207207
/* TODO: Support reading charge current/voltage settings */

drivers/modem/modem_shell.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,8 @@ static int cmd_modem_sms_send(const struct shell *shell, size_t argc,
281281

282282
if (strlen(argv[3]) > (sizeof(sms.msg) - 1)) {
283283
shell_fprintf(shell, SHELL_WARNING,
284-
"Specified message longer than maximum, truncating message\n");
284+
"SMS message exceeds limit (%d>%d), truncating message",
285+
strlen(argv[3]), CONFIG_MODEM_SMS_OUT_MSG_MAX_LEN);
285286
}
286287

287288
snprintk(sms.phone, sizeof(sms.phone), "%s", argv[2]);

drivers/modem/murata-1sc.c

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,7 @@ MODEM_CMD_DEFINE(on_cmd_unsol_cmt)
10211021
#endif /* CONFIG_MODEM_SMS */
10221022

10231023
/**
1024-
* @brief Handler for unsolicited events ( SOCKETEV)
1024+
* @brief Handler for unsolicited events (SOCKETEV)
10251025
*/
10261026
MODEM_CMD_DEFINE(on_cmd_unsol_SEV)
10271027
{
@@ -1068,6 +1068,25 @@ MODEM_CMD_DEFINE(on_cmd_unsol_SEV)
10681068
return 0;
10691069
}
10701070

1071+
/**
1072+
* @brief Handler for unsolicited events (STATCM)
1073+
*/
1074+
MODEM_CMD_DEFINE(on_cmd_unsol_SCM)
1075+
{
1076+
int event = strtol(argv[0], NULL, 10);
1077+
1078+
switch (event) {
1079+
case 0: /* LTE deregistered */
1080+
return net_if_down(mdata.net_iface);
1081+
case 1: /* LTE registered */
1082+
return net_if_up(mdata.net_iface);
1083+
default: /* Ignore all other events */
1084+
break;
1085+
}
1086+
1087+
return 0;
1088+
}
1089+
10711090
/**
10721091
* @brief Handler for manufacturer
10731092
*/
@@ -2231,6 +2250,7 @@ static const struct modem_cmd response_cmds[] = {
22312250

22322251
static const struct modem_cmd unsol_cmds[] = {
22332252
MODEM_CMD("%SOCKETEV:", on_cmd_unsol_SEV, 2U, ","),
2253+
MODEM_CMD("%STATCM:", on_cmd_unsol_SCM, 1U, ","),
22342254
#if defined(CONFIG_MODEM_SMS)
22352255
MODEM_CMD("+CMTI:", on_cmd_unsol_sms, 2U, ","),
22362256
#if defined(CONFIG_MODEM_SMS_CALLBACK)
@@ -4736,6 +4756,7 @@ static int murata_1sc_setup(void)
47364756
SETUP_CMD("AT+CEREG?", "+CEREG:", on_cmd_get_cereg, 0U, ""),
47374757
SETUP_CMD("AT+CGCONTRDP", "+CGCONTRDP:", on_cmd_get_cgcontrdp, 0U, ""),
47384758
#endif
4759+
SETUP_CMD_NOHANDLE("AT%STATCM=1"),
47394760
#if defined(CONFIG_MODEM_DEMO_LOW_POWERMODE)
47404761
SETUP_CMD_NOHANDLE("AT+CFUN=0"),
47414762
#endif

drivers/regulator/regulator_act81461.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,7 +1345,7 @@ int act81461_fault_int_msk_set(const struct device *dev, regulator_error_flags_t
13451345

13461346
if (dev->api == &api) {
13471347
const struct regulator_act81461_node_config *config = dev->config;
1348-
uint8_t reg;
1348+
uint8_t reg, msk;
13491349

13501350
cconfig = config->p->config;
13511351
switch (config->source) {
@@ -1379,7 +1379,7 @@ int act81461_fault_int_msk_set(const struct device *dev, regulator_error_flags_t
13791379
REGULATOR_ERROR_OVER_CURRENT)) {
13801380
return -EINVAL;
13811381
}
1382-
uint8_t msk = 0;
1382+
msk = 0;
13831383

13841384
if (flags & REGULATOR_ERROR_OVER_VOLTAGE) {
13851385
msk |= OV_INT_MSK;
@@ -1409,7 +1409,7 @@ int act81461_fault_int_msk_set(const struct device *dev, regulator_error_flags_t
14091409
if (flags & ~REGULATOR_ERROR_OVER_CURRENT) {
14101410
return -EINVAL;
14111411
}
1412-
uint8_t msk = 0;
1412+
msk = 0;
14131413

14141414
if (flags & REGULATOR_ERROR_OVER_CURRENT) {
14151415
msk |= ILIM_INT_MSK;
@@ -1422,7 +1422,7 @@ int act81461_fault_int_msk_set(const struct device *dev, regulator_error_flags_t
14221422
REGULATOR_ERROR_OVER_CURRENT)) {
14231423
return -EINVAL;
14241424
}
1425-
uint8_t msk = 0;
1425+
msk = 0;
14261426

14271427
if (flags & REGULATOR_ERROR_OVER_VOLTAGE) {
14281428
msk |= BST_OV_INT_MSK;
@@ -1439,12 +1439,14 @@ int act81461_fault_int_msk_set(const struct device *dev, regulator_error_flags_t
14391439
return -EINVAL;
14401440
}
14411441
} else {
1442+
uint8_t msk;
1443+
14421444
cconfig = dev->config;
14431445
if (flags & ~(REGULATOR_ERROR_OVER_TEMP | REGULATOR_ERROR_VSYS_UNDER_VOLTAGE |
14441446
REGULATOR_ERROR_VBAT_LOW)) {
14451447
return -EINVAL;
14461448
}
1447-
uint8_t msk = 0;
1449+
msk = 0;
14481450

14491451
if (flags & REGULATOR_ERROR_OVER_TEMP) {
14501452
msk |= TWARN;

drivers/sensor/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,12 @@ add_subdirectory_ifdef(CONFIG_TEMP_NRF5 nrf5)
128128
add_subdirectory_ifdef(CONFIG_TH02 th02)
129129
add_subdirectory_ifdef(CONFIG_TI_HDC ti_hdc)
130130
add_subdirectory_ifdef(CONFIG_TI_HDC20XX ti_hdc20xx)
131-
add_subdirectory_ifdef(CONFIG_TSL2540 tsl2540)
132131
add_subdirectory_ifdef(CONFIG_TMD2620 tmd2620)
133132
add_subdirectory_ifdef(CONFIG_TMP007 tmp007)
134133
add_subdirectory_ifdef(CONFIG_TMP108 tmp108)
135134
add_subdirectory_ifdef(CONFIG_TMP112 tmp112)
136135
add_subdirectory_ifdef(CONFIG_TMP116 tmp116)
136+
add_subdirectory_ifdef(CONFIG_TSL2540 tsl2540)
137137
add_subdirectory_ifdef(CONFIG_VCMP_IT8XXX2 ite_vcmp_it8xxx2)
138138
add_subdirectory_ifdef(CONFIG_VCNL4040 vcnl4040)
139139
add_subdirectory_ifdef(CONFIG_VEML7700 veml7700)

drivers/sensor/cxd5605/cxd5605.c

Lines changed: 17 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,12 @@ static int init(const struct device *dev)
170170

171171
result = gpio_pin_configure_dt(&cfg->rst_gpio, GPIO_OUTPUT_HIGH);
172172

173+
cxd5605_setup_interrupts(dev);
174+
/* setup shim callbacks */
175+
cxd5605_lib_init(dev);
176+
cxd5605_register_resp_callback(dev, driver_cxd5605_resp_cb);
177+
cxd5605_register_nmea_callback(dev, driver_cxd5605_nmea_cb);
178+
173179
return result;
174180
}
175181

@@ -429,11 +435,6 @@ static int cxd5605_attr_set(const struct device *dev,
429435
uint8_t min = 0;
430436
uint8_t sec = 0;
431437

432-
433-
const struct cxd5605_config *config = dev->config;
434-
const struct gpio_dt_spec *pwr_gpio = &config->pwr_gpio;
435-
const struct gpio_dt_spec *rst_gpio = &config->rst_gpio;
436-
437438
if (chan != SENSOR_CHAN_AMBIENT_TEMP && chan != SENSOR_CHAN_ALL) {
438439
return -ENOTSUP;
439440
}
@@ -459,6 +460,9 @@ static int cxd5605_attr_set(const struct device *dev,
459460
__FILE__, __LINE__, result);
460461
return result;
461462
}
463+
drv_data->op_mode = val[0].val1;
464+
drv_data->pos_cycle = val[0].val2;
465+
drv_data->sleep_time = val[1].val1;
462466
break;
463467

464468
case SENSOR_ATTR_CXD5605_PULSE:
@@ -508,6 +512,7 @@ static int cxd5605_attr_set(const struct device *dev,
508512
__FILE__, __LINE__, result);
509513
return result;
510514
}
515+
drv_data->selected_sentences = val->val1;
511516
break;
512517

513518
case SENSOR_ATTR_CXD5605_HOT_START:
@@ -580,39 +585,10 @@ static int cxd5605_attr_set(const struct device *dev,
580585
}
581586
break;
582587

583-
case SENSOR_ATTR_CXD5605_PWR_CTRL:
584-
if (val->val1 == 0) {
585-
result = gpio_pin_configure_dt(pwr_gpio, GPIO_OUTPUT_LOW);
586-
result = gpio_pin_configure_dt(rst_gpio, GPIO_OUTPUT_LOW);
587-
} else {
588-
result = gpio_pin_configure_dt(pwr_gpio, GPIO_OUTPUT_HIGH);
589-
result = gpio_pin_configure_dt(rst_gpio, GPIO_OUTPUT_HIGH);
590-
}
591-
break;
592-
593-
case SENSOR_ATTR_CXD5605_CALLBACK:
594-
init(dev);
595-
LOG_DBG("Got CXD5605_ALERT_INTERRUPTS\n");
596-
cxd5605_setup_interrupts(dev);
597-
/* setup shim callbacks */
598-
#ifdef DEBUG
599-
printf("[driver] register driver callback\n");
600-
#endif
601-
cxd5605_lib_init(dev);
602-
cxd5605_register_resp_callback(dev, driver_cxd5605_resp_cb);
603-
cxd5605_register_nmea_callback(dev, driver_cxd5605_nmea_cb);
604-
return 0;
605-
606588
default:
607589
return -ENOTSUP;
608590
}
609591

610-
if (drv_data->cxd5605_cmd != SENSOR_ATTR_CXD5605_PWR_CTRL) {
611-
result = cxd5605_wait_fetch(dev);
612-
if (result < 0) {
613-
return result;
614-
}
615-
}
616592

617593
return 0;
618594
}
@@ -684,6 +660,7 @@ static int cxd5605_driver_pm_action(const struct device *dev,
684660
{
685661
const struct cxd5605_config *config = dev->config;
686662
const struct gpio_dt_spec *rst_gpio = &config->rst_gpio;
663+
struct cxd5605_data *drv_data = dev->data;
687664

688665
int result = 0;
689666

@@ -699,6 +676,12 @@ static int cxd5605_driver_pm_action(const struct device *dev,
699676
if (result < 0) {
700677
printk("ERROR: I2C interface not working (CXD5605 driver)\n");
701678
}
679+
if (drv_data->pps_cb) {
680+
cxd5605_pulse(dev, 1);
681+
}
682+
cxd5605_operating_mode(dev, drv_data->op_mode, drv_data->pos_cycle, \
683+
drv_data->sleep_time);
684+
cxd5605_sentence_select(dev, drv_data->selected_sentences);
702685

703686
case PM_DEVICE_ACTION_SUSPEND:
704687
cxd5605_sleep(dev, 0);

drivers/sensor/lis2dw12/Kconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ config LIS2DW12_TAP
6060
help
6161
Enable tap (single/double) detection
6262

63+
config LIS2DW12_TAP_3D
64+
bool "Directional Tap and Tap-Tap detection"
65+
depends on LIS2DW12_TAP
66+
help
67+
Enable directional tap (single/double) detection
68+
6369
endif # LIS2DW12_TRIGGER
6470

6571
config LIS2DW12_THRESHOLD
@@ -73,6 +79,12 @@ config LIS2DW12_THRESHOLD
7379
be bigger than the threshold. See ST AN5038 for more details about
7480
the feature.
7581

82+
config LIS2DW12_THRESHOLD_3D
83+
bool "Directional threshold trigger"
84+
depends on LIS2DW12_THRESHOLD
85+
help
86+
Enable directional triggers for the wakeup threshold
87+
7688
config LIS2DW12_FREEFALL
7789
bool "Free Fall detection (via interrupt)"
7890
help

0 commit comments

Comments
 (0)