[RAMEN9610-13665][common] Wlbt: FM request API should signal active mxman
authorIvan Priest <i.priest@samsung.com>
Wed, 20 Mar 2019 15:03:55 +0000 (15:03 +0000)
committerhskang <hs1218.kang@samsung.com>
Fri, 22 Mar 2019 08:45:47 +0000 (17:45 +0900)
Signal FM requests to the "active" mxman context,
so that requests can be consumed during WLBT recovery,
instead of querying via the service structure that
could be NULL during the recovery phase.

Remove the service driver API for FM LDO control.

Change-Id: Icd3dadb0105ab3266639f2b83d81c353a89cc0b0
SCSC-Bug-Id: SSB-50826
Signed-off-by: Ivan Priest <i.priest@samsung.com>
drivers/misc/samsung/scsc/mx250_fm.c
drivers/misc/samsung/scsc/mxman.c
drivers/misc/samsung/scsc/mxman.h
drivers/misc/samsung/scsc/scsc_service.c
include/scsc/scsc_mx.h

index bfc642a467cec80e299afec64ecac1895c82769b..df6dabc04d3b541d6a2eb1e7e4b95f8fc1b9a867 100755 (executable)
@@ -13,6 +13,9 @@
 
 #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
@@ -59,6 +62,12 @@ static int stop_close_service(void)
 {
        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);
@@ -144,13 +153,14 @@ static int open_start_close_service(void)
 
        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();
@@ -274,7 +284,7 @@ void mx250_fm_set_params(struct wlbt_fm_params *info)
 
        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);
 }
@@ -286,8 +296,9 @@ void fm_client_module_probe(struct scsc_mx_module_client *module_client, struct
        /* 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) {
@@ -311,8 +322,9 @@ void fm_client_module_remove(struct scsc_mx_module_client *module_client, struct
        /* 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);
@@ -342,7 +354,7 @@ static int __init scsc_fm_client_module_init(void)
 {
        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) {
@@ -357,7 +369,7 @@ static int __init scsc_fm_client_module_init(void)
 
 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();
index 50779fa3998de44264c84d5c4f4d6420c485f1f4..820f02eb220090231b999836c1be93dc300eb9ae 100755 (executable)
@@ -1796,7 +1796,7 @@ int mxman_open(struct mxman *mxman)
        /* 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
 
@@ -2079,9 +2079,15 @@ int mxman_suspend(struct mxman *mxman)
 }
 
 #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.
@@ -2095,25 +2101,28 @@ void mxman_on_halt_ldos_on(struct mxman *mxman)
        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;
@@ -2121,14 +2130,14 @@ int mxman_fm_set_params(struct mxman *mxman, struct wlbt_fm_params *params)
 
        /* 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");
index 6ac3fab902f126a29b34979d4d1637a717c59ccc..7614d1b19ec5636f6ff776ec88cb22f647e5d6ce 100755 (executable)
@@ -27,10 +27,11 @@ int mxman_force_panic(struct mxman *mxman);
 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 {
index c333d20ad44676642c8d8ee37be37462646a5d61..b610ae52f5c8140a544623d183426c1c33a5b716 100755 (executable)
@@ -659,34 +659,6 @@ struct scsc_service *scsc_mx_service_open(struct scsc_mx *mx, enum scsc_service_
 }
 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;
index 46ae99d10eb8403a94d401f11d95bdd327faa971..f5587fd2f285cb7739f73ce9e3782040abb7a2ae 100755 (executable)
@@ -151,16 +151,6 @@ int scsc_mx_service_mif_dump_registers(struct scsc_service *service);
  * 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) */