mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-11 02:15:14 +00:00
chip/g: use ccd_ext_is_enabled() instead of ccd_get_mode()
Currently, only usb_pd_protocol.c cares about the actual ccd mode (disabled/partial/enabled). Everything else just cares whether it's enabled or not. So promote the boolean ccd_is_connected() from board/cr50 up to chip/g, and rename it to ccd_ext_is_enabled() to match the new nomenclature (since 'CCD' itself is now too overloaded). This will make it easier to handle CCD state directly in board/cr50 after we split it from common/case_closed_debug.c BUG=none BRANCH=cr50 TEST=make buildall; boot cr50; make sure USB endpoints still work Change-Id: Ic3df7467bfe29f1c5d7060cac1309a1f0e090d9e Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/648212 Reviewed-by: Mary Ruthven <mruthven@chromium.org>
This commit is contained in:
committed by
chrome-bot
parent
29d8cc67c3
commit
ac1ce379e0
@@ -277,7 +277,6 @@ void print_servo_state(void);
|
||||
|
||||
int ap_is_on(void);
|
||||
int ec_is_on(void);
|
||||
int rdd_is_connected(void);
|
||||
int servo_is_connected(void);
|
||||
|
||||
void set_ap_on_deferred(void);
|
||||
|
||||
@@ -18,11 +18,6 @@
|
||||
|
||||
#define CPRINTS(format, args...) cprints(CC_USB, format, ## args)
|
||||
|
||||
int rdd_is_connected(void)
|
||||
{
|
||||
return ccd_get_mode() == CCD_MODE_ENABLED;
|
||||
}
|
||||
|
||||
/* If the UART TX is connected the pinmux select will have a non-zero value */
|
||||
int uart_tx_is_connected(int uart)
|
||||
{
|
||||
@@ -57,7 +52,7 @@ void uartn_tx_connect(int uart)
|
||||
* something to transmit) and servo is disconnected (we won't be
|
||||
* drive-fighting with servo).
|
||||
*/
|
||||
if (servo_is_connected() || !rdd_is_connected())
|
||||
if (servo_is_connected() || !ccd_ext_is_enabled())
|
||||
return;
|
||||
|
||||
if (uart == UART_AP) {
|
||||
@@ -88,7 +83,7 @@ void uartn_tx_disconnect(int uart)
|
||||
static void configure_ccd(int enable)
|
||||
{
|
||||
if (enable) {
|
||||
if (rdd_is_connected())
|
||||
if (ccd_ext_is_enabled())
|
||||
return;
|
||||
|
||||
/* Enable CCD */
|
||||
@@ -119,7 +114,7 @@ static void rdd_check_pin(void)
|
||||
/* The CCD mode pin is active low. */
|
||||
int enable = !gpio_get_level(GPIO_CCD_MODE_L);
|
||||
|
||||
if (enable == rdd_is_connected())
|
||||
if (enable == ccd_ext_is_enabled())
|
||||
return;
|
||||
|
||||
configure_ccd(enable);
|
||||
@@ -177,7 +172,8 @@ static int command_ccd(int argc, char **argv)
|
||||
print_rdd_state();
|
||||
print_servo_state();
|
||||
|
||||
ccprintf("CCD: %s\n", rdd_is_connected() ? "enabled" : "disabled");
|
||||
ccprintf("CCD EXT: %s\n",
|
||||
ccd_ext_is_enabled() ? "enabled" : "disabled");
|
||||
ccprintf("AP UART: %s\n",
|
||||
uartn_is_enabled(UART_AP) ?
|
||||
uart_tx_is_connected(UART_AP) ? "RX+TX" : "RX" : "disabled");
|
||||
|
||||
@@ -78,7 +78,7 @@ int usb_i2c_board_enable(void)
|
||||
return EC_ERROR_BUSY;
|
||||
}
|
||||
|
||||
if (!rdd_is_connected())
|
||||
if (!ccd_ext_is_enabled())
|
||||
return EC_ERROR_BUSY;
|
||||
|
||||
if (!ccd_is_cap_enabled(CCD_CAP_I2C))
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "case_closed_debug.h"
|
||||
#include "clock.h"
|
||||
#include "common.h"
|
||||
#include "console.h"
|
||||
@@ -75,7 +76,7 @@ static int utmi_wakeup_is_enabled(void)
|
||||
* USB is only used for CCD, so only enable UTMI wakeups when RDD
|
||||
* detects that a debug accessory is attached.
|
||||
*/
|
||||
return rdd_is_connected();
|
||||
return ccd_ext_is_enabled();
|
||||
#else
|
||||
/* USB is used for the host interface, so always enable UTMI wakeups */
|
||||
return 1;
|
||||
|
||||
@@ -609,8 +609,7 @@ static int handle_setup_with_in_stage(enum table_case tc,
|
||||
if (idx >= USB_STR_COUNT)
|
||||
return -1;
|
||||
#ifdef CONFIG_USB_SERIALNO
|
||||
if (idx == USB_STR_SERIALNO &&
|
||||
ccd_get_mode() == CCD_MODE_ENABLED)
|
||||
if (idx == USB_STR_SERIALNO && ccd_ext_is_enabled())
|
||||
data = usb_serialno_desc;
|
||||
else
|
||||
#endif
|
||||
|
||||
@@ -65,3 +65,8 @@ enum ccd_mode ccd_get_mode(void)
|
||||
{
|
||||
return current_mode;
|
||||
}
|
||||
|
||||
int ccd_ext_is_enabled(void)
|
||||
{
|
||||
return ccd_get_mode() == CCD_MODE_ENABLED;
|
||||
}
|
||||
|
||||
@@ -43,6 +43,11 @@ void ccd_phy_init(int enable_ccd);
|
||||
*/
|
||||
enum ccd_mode ccd_get_mode(void);
|
||||
|
||||
/**
|
||||
* Return non-zero if the CCD external interface is enabled.
|
||||
*/
|
||||
int ccd_ext_is_enabled(void);
|
||||
|
||||
/******************************************************************************/
|
||||
/* New CCD "V1" configuration. Eventually this will supersede the above code */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user