diff options
Diffstat (limited to 'chip')
-rw-r--r-- | chip/g/rdd.c | 37 | ||||
-rw-r--r-- | chip/g/rdd.h | 10 |
2 files changed, 24 insertions, 23 deletions
diff --git a/chip/g/rdd.c b/chip/g/rdd.c index 5e5ed42f6d..57c4bd96b9 100644 --- a/chip/g/rdd.c +++ b/chip/g/rdd.c @@ -51,8 +51,8 @@ static int rdd_is_detected(void) void print_rdd_state(void) { - ccprintf("RDD: %s\n", - force_detected ? "forced enable" : device_state_name(state)); + ccprintf("Rdd: %s\n", + force_detected ? "keepalive" : device_state_name(state)); } /** @@ -60,7 +60,7 @@ void print_rdd_state(void) */ static void rdd_disconnect(void) { - CPRINTS("Debug accessory disconnect"); + CPRINTS("Rdd disconnect"); state = DEVICE_STATE_DISCONNECTED; /* @@ -92,7 +92,7 @@ static void rdd_connect(void) return; /* We were previously disconnected, so connect */ - CPRINTS("Debug accessory connect"); + CPRINTS("Rdd connect"); state = DEVICE_STATE_CONNECTED; /* Start pulling CCD_MODE_L low to enable the SBUx muxes */ @@ -227,16 +227,27 @@ void init_rdd_state(void) GWRITE_FIELD(RDD, INT_ENABLE, INTR_DEBUG_STATE_DETECTED, 1); } -void force_rdd_detect(int enable) +static int command_rdd_keepalive(int argc, char **argv) { - force_detected = enable; + if (argc == 1) { + print_rdd_state(); + return EC_SUCCESS; + } - /* - * If we're forcing detection, trigger then connect handler early. - * - * Otherwise, we'll revert to the normal logic of checking the RDD - * hardware CC state. - */ - if (force_detected) + if (!parse_bool(argv[1], &force_detected)) + return EC_ERROR_PARAM1; + + if (force_detected) { + /* Force Rdd detect */ + ccprintf("Forcing Rdd detect keepalive\n"); hook_call_deferred(&rdd_connect_data, 0); + } else { + /* Go back to actual hardware state */ + ccprintf("Using actual Rdd state\n"); + } + + return EC_SUCCESS; } +DECLARE_CONSOLE_COMMAND(rddkeepalive, command_rdd_keepalive, + "[BOOLEAN]", + "Get Rdd state or force keepalive"); diff --git a/chip/g/rdd.h b/chip/g/rdd.h index 4e25fe4293..1fd4f89152 100644 --- a/chip/g/rdd.h +++ b/chip/g/rdd.h @@ -12,16 +12,6 @@ void init_rdd_state(void); /** - * Enable/disable forcing debug accessory detection. - * - * When enabled, the RDD module will assert CCD_MODE_L even if the CC value - * does not indicate a debug accessory is present. - * - * @param enable Enable (1) or disable (0) keepalive. - */ -void force_rdd_detect(int enable); - -/** * Print debug accessory detect state */ void print_rdd_state(void); |