mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-11 07:03:09 -04:00
sgm7220: Reorganize sgm7220 driver architecture
sgm7220 is not typec TCPC architecture, so clear tcpc ops function. propagate from MTK kernel-4.14/drivers/misc/mediatek/typec/tcpc/ Change-Id: Icd59ec48c510306d7f8d46d7e9d0fdf7a39fb72b Reviewed-on: https://gerrit.mot.com/2100791 Reviewed-by: Huosheng Liao <liaohs@motorola.com> SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Submit-Approved: Jira Key
This commit is contained in:
parent
70be896a4a
commit
c8afdd7c14
4 changed files with 554 additions and 612 deletions
68
drivers/usb/typec/mmi_tcpc/inc/sgm7220.h
Normal file
68
drivers/usb/typec/mmi_tcpc/inc/sgm7220.h
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* Copyright (C) 2021 MediaTek Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef __LINUX_SGM7220_H
|
||||
#define __LINUX_SGM7220_H
|
||||
|
||||
/******************************************************************************
|
||||
* Register addresses
|
||||
******************************************************************************/
|
||||
#define REG_BASE 0x00
|
||||
/* 0x00 - 0x07 reserved for ID */
|
||||
#define REG_MOD 0x08
|
||||
#define REG_INT 0x09
|
||||
#define REG_SET 0x0A
|
||||
#define REG_CTL 0X45
|
||||
#define REG_REVISION 0XA0
|
||||
|
||||
/******************************************************************************
|
||||
* Register bits
|
||||
******************************************************************************/
|
||||
/* REG_ID (0x00) */
|
||||
#define ID_REG_LEN 0X08
|
||||
|
||||
/* REG_MOD (0x08) */
|
||||
#define MOD_ACTIVE_CABLE_DETECTION 0X01 /*RU*/
|
||||
#define MOD_ACCESSORY_CONNECTED_SHIFT 1
|
||||
#define MOD_ACCESSORY_CONNECTED (0x07 << MOD_ACCESSORY_CONNECTED_SHIFT) /*RU*/
|
||||
#define MOD_CURRENT_MODE_DETECT_SHIFT 4
|
||||
#define MOD_CURRENT_MODE_DETECT (0x03 << MOD_CURRENT_MODE_DETECT_SHIFT) /*RU*/
|
||||
#define MOD_CURRENT_MODE_ADVERTISE_SHIFT 6
|
||||
#define MOD_CURRENT_MODE_ADVERTISE (0x03 << MOD_CURRENT_MODE_ADVERTISE_SHIFT) /*RW*/
|
||||
|
||||
/* REG_INT (0x09) */
|
||||
#define INT_DRP_DUTY_CYCLE_SHIFT 1
|
||||
#define INT_DRP_DUTY_CYCLE (0x03 << INT_DRP_DUTY_CYCLE_SHIFT) /*RW*/
|
||||
#define INT_INTERRUPT_STATUS_SHIFT 4
|
||||
#define INT_INTERRUPT_STATUS (0x01 << INT_INTERRUPT_STATUS_SHIFT) /*RCU*/
|
||||
#define INT_CABLE_DIR_SHIFT 5
|
||||
#define INT_CABLE_DIR (0x01 << INT_CABLE_DIR_SHIFT) /*RU*/
|
||||
#define INT_ATTACHED_STATE_SHIFT 6
|
||||
#define INT_ATTACHED_STATE (0x03 << INT_ATTACHED_STATE_SHIFT) /*RU*/
|
||||
|
||||
/* REG_SET (0x0A) */
|
||||
#define SET_I2C_DISABLE_TERM 0x01 /*RW*/
|
||||
#define SET_I2C_SOURCE_PREF_SHIFT 1
|
||||
#define SET_I2C_SOURCE_PREF (0x03 << SET_I2C_SOURCE_PREF_SHIFT) /*RW*/
|
||||
#define SET_I2C_SOFT_RESET_SHIFT 3
|
||||
#define SET_I2C_SOFT_RESET (0x01 << SET_I2C_SOFT_RESET_SHIFT) /*RSU*/
|
||||
#define SET_MODE_SELECT_SHIFT 4
|
||||
#define SET_MODE_SELECT (0x03 << SET_MODE_SELECT_SHIFT) /*RW*/
|
||||
#define SET_DEBOUNCE_SHIFT 6
|
||||
#define SET_DEBOUNCE (0x03 << SET_DEBOUNCE_SHIFT) /*RW*/
|
||||
|
||||
/* REG_CTR (0x45) */
|
||||
#define CTR_DISABLE_RD_RP_SHIFT 2
|
||||
#define CTR_DISABLE_RD_RP (0x01 << CTR_DISABLE_RD_RP_SHIFT) /*RW*/
|
||||
|
||||
#endif /* #ifndef __LINUX_SGM7220_H */
|
||||
|
|
@ -318,8 +318,9 @@ static int pd_tcp_notifier_call(struct notifier_block *nb,
|
|||
new_state == TYPEC_ATTACHED_CUSTOM_SRC ||
|
||||
new_state == TYPEC_ATTACHED_DBGACC_SNK)) {
|
||||
dev_info(rpmd->dev,
|
||||
"%s Charger plug in, polarity = %d\n",
|
||||
__func__, noti->typec_state.polarity);
|
||||
"%s Charger plug in, polarity = %d, remote rp = %d\n",
|
||||
__func__, noti->typec_state.polarity,
|
||||
noti->typec_state.rp_level);
|
||||
/*
|
||||
* start charger type detection,
|
||||
* and enable device connection
|
||||
|
|
@ -353,8 +354,9 @@ static int pd_tcp_notifier_call(struct notifier_block *nb,
|
|||
(new_state == TYPEC_ATTACHED_SRC ||
|
||||
new_state == TYPEC_ATTACHED_DEBUG)) {
|
||||
dev_info(rpmd->dev,
|
||||
"%s OTG plug in, polarity = %d\n",
|
||||
__func__, noti->typec_state.polarity);
|
||||
"%s OTG plug in, polarity = %d, local_rp = %d\n",
|
||||
__func__, noti->typec_state.polarity,
|
||||
noti->typec_state.local_rp_level);
|
||||
/* enable host connection */
|
||||
cancel_delayed_work_sync(&rpmd->usb_dwork);
|
||||
rpmd->usb_dr = DR_HOST;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -487,6 +487,7 @@ int tcpci_notify_typec_state(struct tcpc_device *tcpc)
|
|||
TCP_NOTIFY_IDX_USB, TCP_NOTIFY_TYPEC_STATE);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(tcpci_notify_typec_state);
|
||||
|
||||
int tcpci_notify_role_swap(
|
||||
struct tcpc_device *tcpc, uint8_t event, uint8_t role)
|
||||
|
|
|
|||
Loading…
Reference in a new issue