#include <scsc/scsc_logring.h>
#include <scsc/scsc_mx.h>
+
+#include "mxman.h" /* Special case service driver that looks inside mxman */
+
#ifdef CONFIG_SCSC_FM_TEST
#include "mx250_fm_test.h"
#endif
{
int r;
+ if (!fm_client->fm_service) {
+ SCSC_TAG_ERR(FM, "No fm_service\n");
+ r = -EINVAL;
+ goto done;
+ }
+
r = scsc_mx_service_stop(fm_client->fm_service);
if (r) {
SCSC_TAG_ERR(FM, "scsc_mx_service_stop(fm_service) failed %d\n", r);
if (fm_client->ldo_on) {
/* FM turning on */
- scsc_service_on_halt_ldos_on(fm_client->fm_service);
+ mxman_fm_on_halt_ldos_on();
+
} else {
/* FM turning off */
- scsc_service_on_halt_ldos_off(fm_client->fm_service);
+ mxman_fm_on_halt_ldos_off();
/* Invalidate stored FM params */
- scsc_service_fm_set_params(fm_client->fm_service, NULL);
+ mxman_fm_set_params(NULL);
}
r = stop_close_service();
SCSC_TAG_INFO(FM, "freq %u\n", info->freq);
- scsc_service_fm_set_params(fm_client->fm_service, info);
+ mxman_fm_set_params(info);
mutex_unlock(&ss_lock);
}
/* Avoid unused error */
(void)module_client;
+ SCSC_TAG_INFO(FM, "probe\n");
+
mutex_lock(&ss_lock);
- SCSC_TAG_DEBUG(FM, "mx250: %s\n", __func__);
if (reason == SCSC_MODULE_CLIENT_REASON_HW_PROBE) {
fm_client = kzalloc(sizeof(*fm_client), GFP_KERNEL);
if (!fm_client) {
/* Avoid unused error */
(void)module_client;
+ SCSC_TAG_INFO(FM, "remove\n");
+
mutex_lock(&ss_lock);
- SCSC_TAG_DEBUG(FM, "mx250: %s\n", __func__);
if (reason == SCSC_MODULE_CLIENT_REASON_HW_REMOVE) {
if (!fm_client) {
mutex_unlock(&ss_lock);
{
int r;
- SCSC_TAG_DEBUG(FM, "mx250:\n");
+ SCSC_TAG_INFO(FM, "init\n");
r = scsc_mx_module_register_client_module(&fm_client_driver);
if (r) {
static void __exit scsc_fm_client_module_exit(void)
{
- SCSC_TAG_DEBUG(FM, "mx250:\n");
+ SCSC_TAG_INFO(FM, "exit\n");
scsc_mx_module_unregister_client_module(&fm_client_driver);
#ifdef CONFIG_SCSC_FM_TEST
mx250_fm_test_exit();
/* If we have stored FM radio parameters, deliver them to FW now */
if (r == 0 && mxman->fm_params_pending) {
SCSC_TAG_INFO(MXMAN, "Send pending FM params\n");
- mxman_fm_set_params(mxman, &mxman->fm_params);
+ mxman_fm_set_params(&mxman->fm_params);
}
#endif
}
#ifdef CONFIG_SCSC_FM
-void mxman_on_halt_ldos_on(struct mxman *mxman)
+void mxman_fm_on_halt_ldos_on(void)
{
- mxman->on_halt_ldos_on = 1;
+ /* Should always be an active mxman unless module is unloaded */
+ if (!active_mxman) {
+ SCSC_TAG_ERR(MXMAN, "No active MXMAN\n");
+ return;
+ }
+
+ active_mxman->on_halt_ldos_on = 1;
/* FM status to pass into FW at next FW init,
* by which time driver context is lost.
is_fm_on = 1;
}
-void mxman_on_halt_ldos_off(struct mxman *mxman)
+void mxman_fm_on_halt_ldos_off(void)
{
+ /* Should always be an active mxman unless module is unloaded */
+ if (!active_mxman) {
+ SCSC_TAG_ERR(MXMAN, "No active MXMAN\n");
+ return;
+ }
+
/* Newer FW no longer need set shared LDOs
* always-off at WLBT halt, as TCXO gating
* has the same effect. But pass the "off"
* request for backwards compatibility
* with old FW.
*/
- mxman->on_halt_ldos_on = 0;
+ active_mxman->on_halt_ldos_on = 0;
is_fm_on = 0;
}
/* Update parameters passed to WLBT FM */
-int mxman_fm_set_params(struct mxman *mxman, struct wlbt_fm_params *params)
+int mxman_fm_set_params(struct wlbt_fm_params *params)
{
- /* May be called when WLBT is off, so find the context in this case */
- if (!mxman)
- mxman = active_mxman;
-
+ /* Should always be an active mxman unless module is unloaded */
if (!active_mxman) {
SCSC_TAG_ERR(MXMAN, "No active MXMAN\n");
return -EINVAL;
/* Params are no longer valid (FM stopped) */
if (!params) {
- mxman->fm_params_pending = 0;
+ active_mxman->fm_params_pending = 0;
SCSC_TAG_INFO(MXMAN, "FM params cleared\n");
return 0;
}
/* Once set the value needs to be remembered for each time WLBT starts */
- mxman->fm_params = *params;
- mxman->fm_params_pending = 1;
+ active_mxman->fm_params = *params;
+ active_mxman->fm_params_pending = 1;
if (send_fm_params_to_active_mxman(params)) {
SCSC_TAG_INFO(MXMAN, "FM params sent to FW\n");
int mxman_suspend(struct mxman *mxman);
void mxman_resume(struct mxman *mxman);
void mxman_show_last_panic(struct mxman *mxman);
+
#ifdef CONFIG_SCSC_FM
-void mxman_on_halt_ldos_on(struct mxman *mxman);
-void mxman_on_halt_ldos_off(struct mxman *mxman);
-int mxman_fm_set_params(struct mxman *mxman, struct wlbt_fm_params *params);
+void mxman_fm_on_halt_ldos_on(void);
+void mxman_fm_on_halt_ldos_off(void);
+int mxman_fm_set_params(struct wlbt_fm_params *params);
#endif
enum mxman_state {
}
EXPORT_SYMBOL(scsc_mx_service_open);
-#ifdef CONFIG_SCSC_FM
-void scsc_service_on_halt_ldos_on(struct scsc_service *service)
-{
- struct mxman *mxman = scsc_mx_get_mxman(service->mx);
-
- mxman_on_halt_ldos_on(mxman);
-}
-EXPORT_SYMBOL(scsc_service_on_halt_ldos_on);
-
-
-void scsc_service_on_halt_ldos_off(struct scsc_service *service)
-{
- struct mxman *mxman = scsc_mx_get_mxman(service->mx);
-
- mxman_on_halt_ldos_off(mxman);
-}
-EXPORT_SYMBOL(scsc_service_on_halt_ldos_off);
-
-int scsc_service_fm_set_params(struct scsc_service *service, struct wlbt_fm_params *params)
-{
- /* We allow this to be called when service is off and store parameters */
- (void)service;
-
- return mxman_fm_set_params(NULL, params);
-}
-EXPORT_SYMBOL(scsc_service_fm_set_params);
-#endif
-
struct scsc_bt_audio_abox *scsc_mx_service_get_bt_audio_abox(struct scsc_service *service)
{
struct scsc_mx *mx = service->mx;
* their stop_on_failure() handler as a side-effect. */
void scsc_mx_service_service_failed(struct scsc_service *service, const char *reason);
-#ifdef CONFIG_SCSC_FM
-/*
- * This must be used by FM Radio Service only. Other services must not use it.
- * Leave leave sharedLDOs on or turn them off on halt.
- */
-void scsc_service_on_halt_ldos_on(struct scsc_service *service);
-void scsc_service_on_halt_ldos_off(struct scsc_service *service);
-int scsc_service_fm_set_params(struct scsc_service *service, struct wlbt_fm_params *params);
-#endif
-
/* MEMORY Interface*/
/** Allocate a contiguous block of SDRAM accessible to Client Driver. The memory will be allocated
* from generic pool (MIFRAMMAN_MEM_POOL_GENERIC) */