File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -343,9 +343,23 @@ int bt_apollo_controller_init(spi_transmit_fun transmit)
343
343
344
344
int bt_apollo_controller_deinit (void )
345
345
{
346
- int ret = - ENOTSUP ;
346
+ int ret = 0 ;
347
347
348
- #if (CONFIG_SOC_SERIES_APOLLO3X )
348
+ #if (CONFIG_SOC_SERIES_APOLLO4X )
349
+ /* Keep the Controller in resetting state */
350
+ gpio_pin_set_dt (& rst_gpio , 1 );
351
+
352
+ /* Disable XO32MHz */
353
+ clock_control_off (clk32m_dev , (clock_control_subsys_t )CLOCK_CONTROL_AMBIQ_TYPE_HFXTAL_BLE );
354
+ /* Disable XO32kHz */
355
+ clock_control_off (clk32k_dev , (clock_control_subsys_t )CLOCK_CONTROL_AMBIQ_TYPE_LFXTAL );
356
+
357
+ /* Disable GPIOs */
358
+ gpio_pin_configure_dt (& irq_gpio , GPIO_DISCONNECTED );
359
+ gpio_pin_configure_dt (& clkreq_gpio , GPIO_DISCONNECTED );
360
+ gpio_remove_callback (clkreq_gpio .port , & clkreq_gpio_cb );
361
+ gpio_remove_callback (irq_gpio .port , & irq_gpio_cb );
362
+ #elif (CONFIG_SOC_SERIES_APOLLO3X )
349
363
irq_disable (DT_IRQN (SPI_DEV_NODE ));
350
364
351
365
ret = am_apollo3_bt_controller_deinit ();
@@ -355,7 +369,9 @@ int bt_apollo_controller_deinit(void)
355
369
ret = - EPERM ;
356
370
LOG_ERR ("BT controller deinitialization fails" );
357
371
}
358
- #endif /* CONFIG_SOC_SERIES_APOLLO3X */
372
+ #else
373
+ ret = - ENOTSUP ;
374
+ #endif /* CONFIG_SOC_SERIES_APOLLO4X */
359
375
360
376
return ret ;
361
377
}
You can’t perform that action at this time.
0 commit comments