@@ -170,6 +170,12 @@ static int init(const struct device *dev)
170
170
171
171
result = gpio_pin_configure_dt (& cfg -> rst_gpio , GPIO_OUTPUT_HIGH );
172
172
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
+
173
179
return result ;
174
180
}
175
181
@@ -429,11 +435,6 @@ static int cxd5605_attr_set(const struct device *dev,
429
435
uint8_t min = 0 ;
430
436
uint8_t sec = 0 ;
431
437
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
-
437
438
if (chan != SENSOR_CHAN_AMBIENT_TEMP && chan != SENSOR_CHAN_ALL ) {
438
439
return - ENOTSUP ;
439
440
}
@@ -459,6 +460,9 @@ static int cxd5605_attr_set(const struct device *dev,
459
460
__FILE__ , __LINE__ , result );
460
461
return result ;
461
462
}
463
+ drv_data -> op_mode = val [0 ].val1 ;
464
+ drv_data -> pos_cycle = val [0 ].val2 ;
465
+ drv_data -> sleep_time = val [1 ].val1 ;
462
466
break ;
463
467
464
468
case SENSOR_ATTR_CXD5605_PULSE :
@@ -508,6 +512,7 @@ static int cxd5605_attr_set(const struct device *dev,
508
512
__FILE__ , __LINE__ , result );
509
513
return result ;
510
514
}
515
+ drv_data -> selected_sentences = val -> val1 ;
511
516
break ;
512
517
513
518
case SENSOR_ATTR_CXD5605_HOT_START :
@@ -580,39 +585,10 @@ static int cxd5605_attr_set(const struct device *dev,
580
585
}
581
586
break ;
582
587
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
-
606
588
default :
607
589
return - ENOTSUP ;
608
590
}
609
591
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
- }
616
592
617
593
return 0 ;
618
594
}
@@ -684,6 +660,7 @@ static int cxd5605_driver_pm_action(const struct device *dev,
684
660
{
685
661
const struct cxd5605_config * config = dev -> config ;
686
662
const struct gpio_dt_spec * rst_gpio = & config -> rst_gpio ;
663
+ struct cxd5605_data * drv_data = dev -> data ;
687
664
688
665
int result = 0 ;
689
666
@@ -699,6 +676,11 @@ static int cxd5605_driver_pm_action(const struct device *dev,
699
676
if (result < 0 ) {
700
677
printk ("ERROR: I2C interface not working (CXD5605 driver)\n" );
701
678
}
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 , drv_data -> sleep_time );
683
+ cxd5605_sentence_select (dev , drv_data -> selected_sentences );
702
684
703
685
case PM_DEVICE_ACTION_SUSPEND :
704
686
cxd5605_sleep (dev , 0 );
0 commit comments