Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2f173350 authored by Kim Low's avatar Kim Low Committed by android-build-merger
Browse files

Merge "Add separate sniff mode settings for gamepads"

am: 67814d94

Change-Id: Ibaff9b731e224c20b7f5336c74d02570904cf00e
parents c7c6a17a 67814d94
Loading
Loading
Loading
Loading
+56 −26
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@
#include "bt_target.h"
#include "bta_api.h"
#include "bta_dm_int.h"
#include "bta_hh_api.h"
#include "bta_jv_api.h"
#include "bta_sys.h"

@@ -116,8 +117,8 @@ const tBTA_DM_CFG* p_bta_dm_cfg = &bta_dm_cfg;
const tBTA_DM_RM* p_bta_dm_rm_cfg = &bta_dm_rm_cfg[0];

#define BTA_DM_NUM_PM_ENTRY \
  23 /* number of entries in bta_dm_pm_cfg except the first */
#define BTA_DM_NUM_PM_SPEC 15 /* number of entries in bta_dm_pm_spec */
  25 /* number of entries in bta_dm_pm_cfg except the first */
#define BTA_DM_NUM_PM_SPEC 16 /* number of entries in bta_dm_pm_spec */

tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_CFG
    bta_dm_pm_cfg[BTA_DM_NUM_PM_ENTRY + 1] = {
@@ -133,7 +134,11 @@ tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_CFG
        {BTA_ID_FTC, BTA_ALL_APP_ID, 6},    /* ftc spec table */
        {BTA_ID_FTS, BTA_ALL_APP_ID, 7},    /* fts spec table */
        {BTA_ID_HD, BTA_ALL_APP_ID, 3},     /* hd spec table */
        {BTA_ID_HH, BTA_ALL_APP_ID, 5},   /* hh spec table */
        {BTA_ID_HH, BTA_HH_APP_ID_JOY, 5},  /* app BTA_HH_APP_ID_JOY,
                                               similar to hh spec table */
        {BTA_ID_HH, BTA_HH_APP_ID_GPAD, 5}, /* app BTA_HH_APP_ID_GPAD,
                                               similar to hh spec table */
        {BTA_ID_HH, BTA_ALL_APP_ID, 6},     /* hh spec table */
        {BTA_ID_PBC, BTA_ALL_APP_ID, 2},    /* reuse dg spec table */
        {BTA_ID_PBS, BTA_ALL_APP_ID, 7},    /* reuse fts spec table */
        {BTA_ID_OPC, BTA_ALL_APP_ID, 6},    /* reuse ftc spec table */
@@ -253,7 +258,29 @@ tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_SPEC bta_dm_pm_spec[BTA_DM_NUM_PM_SPEC] = {
          {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */
     }},

    /* HH : 5 */
    /* HH for joysticks and gamepad : 5 */
    {(BTA_DM_PM_SNIFF | BTA_DM_PM_PARK), /* allow park & sniff */
#if (BTM_SSR_INCLUDED == TRUE)
     (BTA_DM_PM_SSR1), /* the SSR entry */
#endif
     {
         {{BTA_DM_PM_SNIFF6, BTA_DM_PM_HH_OPEN_DELAY},
          {BTA_DM_PM_NO_ACTION, 0}}, /* conn open  sniff */
         {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}},   /* conn close  */
         {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app open */
         {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app close */
         {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco open  */
         {{BTA_DM_PM_NO_ACTION, 0},
          {BTA_DM_PM_NO_ACTION, 0}}, /* sco close, used for HH suspend   */
         {{BTA_DM_PM_SNIFF6, BTA_DM_PM_HH_IDLE_DELAY},
          {BTA_DM_PM_NO_ACTION, 0}}, /* idle */
         {{BTA_DM_PM_SNIFF6, BTA_DM_PM_HH_ACTIVE_DELAY},
          {BTA_DM_PM_NO_ACTION, 0}}, /* busy */
         {{BTA_DM_PM_NO_ACTION, 0},
          {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */
     }},

    /* HH : 6 */
    {(BTA_DM_PM_SNIFF | BTA_DM_PM_PARK), /* allow park & sniff */
#if (BTM_SSR_INCLUDED == TRUE)
     (BTA_DM_PM_SSR1), /* the SSR entry */
@@ -275,7 +302,7 @@ tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_SPEC bta_dm_pm_spec[BTA_DM_NUM_PM_SPEC] = {
          {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */
     }},

    /* FTC, OPC, JV : 6 */
    /* FTC, OPC, JV : 7 */
    {(BTA_DM_PM_SNIFF), /* allow sniff */
#if (BTM_SSR_INCLUDED == TRUE)
     (BTA_DM_PM_SSR2), /* the SSR entry */
@@ -295,7 +322,7 @@ tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_SPEC bta_dm_pm_spec[BTA_DM_NUM_PM_SPEC] = {
          {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */
     }},

    /* FTS, PBS, OPS, MSE, BTA_JV_PM_ID_1 : 7 */
    /* FTS, PBS, OPS, MSE, BTA_JV_PM_ID_1 : 8 */
    {(BTA_DM_PM_SNIFF), /* allow sniff */
#if (BTM_SSR_INCLUDED == TRUE)
     (BTA_DM_PM_SSR2), /* the SSR entry */
@@ -315,7 +342,7 @@ tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_SPEC bta_dm_pm_spec[BTA_DM_NUM_PM_SPEC] = {
          {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */
     }},

    /* HL : 8 */
    /* HL : 9 */
    {(BTA_DM_PM_SNIFF), /* allow sniff */
#if (BTM_SSR_INCLUDED == TRUE)
     (BTA_DM_PM_SSR2), /* the SSR entry */
@@ -336,7 +363,7 @@ tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_SPEC bta_dm_pm_spec[BTA_DM_NUM_PM_SPEC] = {
          {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */
     }},

    /* PANU : 9 */
    /* PANU : 10 */
    {(BTA_DM_PM_SNIFF), /* allow sniff */
#if (BTM_SSR_INCLUDED == TRUE)
     (BTA_DM_PM_SSR2), /* the SSR entry */
@@ -356,7 +383,7 @@ tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_SPEC bta_dm_pm_spec[BTA_DM_NUM_PM_SPEC] = {
          {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */
     }},

    /* NAP : 10 */
    /* NAP : 11 */
    {(BTA_DM_PM_SNIFF), /* allow sniff */
#if (BTM_SSR_INCLUDED == TRUE)
     (BTA_DM_PM_SSR2), /* the SSR entry */
@@ -377,7 +404,7 @@ tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_SPEC bta_dm_pm_spec[BTA_DM_NUM_PM_SPEC] = {
          {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */
     }},

    /* HS : 11 */
    /* HS : 12 */
    {(BTA_DM_PM_SNIFF | BTA_DM_PM_PARK), /* allow park & sniff */
#if (BTM_SSR_INCLUDED == TRUE)
     (BTA_DM_PM_SSR2), /* the SSR entry */
@@ -398,7 +425,7 @@ tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_SPEC bta_dm_pm_spec[BTA_DM_NUM_PM_SPEC] = {
          {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */
     }},

    /* AVK : 12 */
    /* AVK : 13 */
    {(BTA_DM_PM_SNIFF), /* allow sniff */
#if (BTM_SSR_INCLUDED == TRUE)
     (BTA_DM_PM_SSR2), /* the SSR entry */
@@ -417,7 +444,7 @@ tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_SPEC bta_dm_pm_spec[BTA_DM_NUM_PM_SPEC] = {
          {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */
     }}

    /* GATTC : 13 */
    /* GATTC : 14 */
    ,
    {(BTA_DM_PM_SNIFF | BTA_DM_PM_PARK), /* allow park & sniff */
#if (BTM_SSR_INCLUDED == TRUE)
@@ -437,7 +464,7 @@ tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_SPEC bta_dm_pm_spec[BTA_DM_NUM_PM_SPEC] = {
         {{BTA_DM_PM_RETRY, 5000},
          {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */
     }}
    /* GATTS : 14 */
    /* GATTS : 15 */
    ,
    {(BTA_DM_PM_SNIFF | BTA_DM_PM_PARK), /* allow park & sniff */
#if (BTM_SSR_INCLUDED == TRUE)
@@ -474,7 +501,7 @@ tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_SPEC bta_dm_pm_spec[BTA_DM_NUM_PM_SPEC] = {
/* Please refer to the SNIFF table definitions in bta_api.h.
 *
 * Adding to or Modifying the Table
 * Additional sniff parameter entries can be added for BTA_DM_PM_SNIFF5 -
 * Additional sniff parameter entries can be added for BTA_DM_PM_SNIFF6 -
 * BTA_DM_PM_SNIFF7.
 * Overrides of additional table entries can be specified in bdroid_buildcfg.h.
 * If additional
@@ -521,6 +548,9 @@ tBTA_DM_PM_TYPE_QUALIFIER tBTM_PM_PWR_MD bta_dm_pm_md[] = {
    {BTA_DM_PM_SNIFF5_MAX, BTA_DM_PM_SNIFF5_MIN, BTA_DM_PM_SNIFF5_ATTEMPT,
     BTA_DM_PM_SNIFF5_TIMEOUT,
     BTM_PM_MD_SNIFF}, /* for BTA_DM_PM_SNIFF5- HD active */
    {BTA_DM_PM_SNIFF6_MAX, BTA_DM_PM_SNIFF6_MIN, BTA_DM_PM_SNIFF6_ATTEMPT,
     BTA_DM_PM_SNIFF6_TIMEOUT,
     BTM_PM_MD_SNIFF}, /* for BTA_DM_PM_SNIFF6- HD active */
    {BTA_DM_PM_PARK_MAX, BTA_DM_PM_PARK_MIN, BTA_DM_PM_PARK_ATTEMPT,
     BTA_DM_PM_PARK_TIMEOUT, BTM_PM_MD_PARK}

+8 −1
Original line number Diff line number Diff line
@@ -877,7 +877,7 @@ typedef uint8_t tBTA_DM_PM_ACTION;

#ifndef BTA_DM_PM_PARK_IDX
#define BTA_DM_PM_PARK_IDX \
  5 /* the actual index to bta_dm_pm_md[] for PARK mode */
  6 /* the actual index to bta_dm_pm_md[] for PARK mode */
#endif

#ifndef BTA_DM_PM_SNIFF_A2DP_IDX
@@ -968,6 +968,13 @@ typedef uint8_t tBTA_DM_PM_ACTION;
#define BTA_DM_PM_SNIFF5_TIMEOUT 0
#endif

#ifndef BTA_DM_PM_SNIFF6_MAX
#define BTA_DM_PM_SNIFF6_MAX 18
#define BTA_DM_PM_SNIFF6_MIN 14
#define BTA_DM_PM_SNIFF6_ATTEMPT 1
#define BTA_DM_PM_SNIFF6_TIMEOUT 0
#endif

#ifndef BTA_DM_PM_PARK_MAX
#define BTA_DM_PM_PARK_MAX 800
#define BTA_DM_PM_PARK_MIN 400
+2 −2
Original line number Diff line number Diff line
@@ -62,12 +62,12 @@ additional description:
    action that `bta_dm_pm_set_mode` will take, the connection will be removed
    from `bta_dm_conn_srvcs` and no longer be considered for power management
    decisions.
  - `BTA_DM_PM_SNIFF` through `BTA_DM_PM_SNIFF4` are special, in that each
  - `BTA_DM_PM_SNIFF` through `BTA_DM_PM_SNIFF6` are special, in that each
    level specifies a set of parameters for the SNIFF mode which relate to the
    min and max intervals, the number of attempts and the timeout. The overall
    action is still the same, however -- SNIFF mode is attempted. There are
    definitions available up to SNIFF7, but actual SSR values are only defined
    up to SNIFF4. Params are defined in `bta_dm_ssr_spec`.
    up to SNIFF6. Params are defined in `bta_dm_ssr_spec`.
  - `BTA_DM_PM_ACTIVE` is full-on power.
  - `BTA_DM_PM_RETRY` has the same effect as `BTA_DM_PM_NO_ACTION`, except a
    timeout is possible to be set, which effectively allows a power operation to