lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 06 Oct 2015 20:51:28 +0900
From:	Chanwoo Choi <cw00.choi@...sung.com>
To:	"Pallala, Ramakrishna" <ramakrishna.pallala@...el.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Cc:	"k.kozlowski@...sung.com" <k.kozlowski@...sung.com>,
	"ckeepax@...nsource.wolfsonmicro.com" 
	<ckeepax@...nsource.wolfsonmicro.com>,
	"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
	"rogerq@...com" <rogerq@...com>,
	"patches@...nsource.wolfsonmicro.com" 
	<patches@...nsource.wolfsonmicro.com>,
	"myungjoo.ham@...sung.com" <myungjoo.ham@...sung.com>
Subject: Re: [PATCH 1/2] extcon: Modify the id and name of external connector

Hi Ram,

On 2015년 10월 06일 20:42, Pallala, Ramakrishna wrote:
> Hi Choi,
> 
> 
>> Subject: [PATCH 1/2] extcon: Modify the id and name of external connector
>>
>> This patch modifies the id and name of external connector with the additional
>> prefix to clarify both attribute and meaning of external connector as following:
>> - EXTCON_CHG_* mean the charger connector.
>> - EXTCON_JACK_* mean the jack connector.
>> - EXTCON_DISP_* mean the display port connector.
>>
>> Following table show the new name of external connector with old name:
>> --------------------------------------------------
>> Old extcon name         | New extcon name        |
>> --------------------------------------------------
>> EXTCON_TA               | EXTCON_CHG_USB_DCP     |
>> EXTCON_FAST_CHARGER     | EXTCON_CHG_USB_DCP_FAST|
>> EXTCON_SLOW_CHARGER     | EXTCON_CHG_USB_DCP_SLOW|
>> EXTCON_CHARGE_DOWNSTREAM| EXTCON_CHG_USB_CDP     |
>> --------------------------------------------------
>> EXTCON_MICROPHONE       | EXTCON_JACK_MICROPHONE |
>> EXTCON_HEADPHONE        | EXTCON_JACK_HEADPHONE  |
>> EXTCON_LINE_IN          | EXTCON_JACK_LINE_IN    |
>> EXTCON_LINE_OUT         | EXTCON_JACK_LINE_OUT   |
>> EXTCON_VIDEO_IN         | EXTCON_JACK_VIDEO_IN   |
>> EXTCON_VIDEO_OUT        | EXTCON_JACK_VIDEO_OUT  |
>> EXTCON_SPDIF_IN         | EXTCON_JACK_SPDIF_IN   |
>> EXTCON_SPDIF_OUT        | EXTCON_JACK_SPDIF_OUT  |
>> --------------------------------------------------
>> EXTCON_HMDI             | EXTCON_DISP_HDMI       |
>> EXTCON_MHL              | EXTCON_DISP_MHL        |
>> EXTCON_DVI              | EXTCON_DISP_DVI        |
>> EXTCON_VGA              | EXTCON_DISP_VGA        |
>> --------------------------------------------------
>>
>> And, when altering the name of USB charger connector, EXTCON refers to the
>> "Battery Charging v1.2 Spec and Adopters Agreement"[1] to use the standard
>> name of USB charging port as following. Following name of USB charging port
>> are already used in power_supply subsystem. We chan check it on patch[2].
>> - EXTCON_CHG_USB	/* Standard Downstream Port */
>> - EXTCON_CHG_USB_DCP	/* Dedicated Charging Port */
>> - EXTCON_CHG_USB_CDP	/* Charging Downstream Port */
>> - EXTCON_CHG_USB_ACA	/* Accessory Charger Adapter */
>>
>> [1] www.usb.org/developers/docs/devclass_docs/BCv1.2_070312.zip
>> [2] commit 85efc8a18ce ("[PATCH] power_supply: Add types for USB chargers")
>>
>> Signed-off-by: Chanwoo Choi <cw00.choi@...sung.com>
>> [ckeepax: For the Arizona changes]
>> Acked-by: Charles Keepax <ckeepax@...nsource.wolfsonmicro.com>
>> ---
>>  drivers/extcon/extcon-arizona.c  | 18 ++++++------
>>  drivers/extcon/extcon-axp288.c   | 12 ++++----
>>  drivers/extcon/extcon-max14577.c | 17 +++++------  drivers/extcon/extcon-
>> max77693.c | 32 +++++++++++----------  drivers/extcon/extcon-max77843.c | 27
>> +++++++++--------  drivers/extcon/extcon-max8997.c  | 21 +++++++-------
>> drivers/extcon/extcon-rt8973a.c  |  4 +--
>>  drivers/extcon/extcon-sm5502.c   |  4 +--
>>  drivers/extcon/extcon.c          | 61 ++++++++++++++++++++-------------------
>>  include/linux/extcon.h           | 62 +++++++++++++++++++++++-----------------
>>  10 files changed, 139 insertions(+), 119 deletions(-)
>>
>> diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
>> index a1ab0a56b798..e4890dd4fefd 100644
>> --- a/drivers/extcon/extcon-arizona.c
>> +++ b/drivers/extcon/extcon-arizona.c
>> @@ -137,9 +137,9 @@ static const int arizona_micd_levels[] = {
>>
>>  static const unsigned int arizona_cable[] = {
>>  	EXTCON_MECHANICAL,
>> -	EXTCON_MICROPHONE,
>> -	EXTCON_HEADPHONE,
>> -	EXTCON_LINE_OUT,
>> +	EXTCON_JACK_MICROPHONE,
>> +	EXTCON_JACK_HEADPHONE,
>> +	EXTCON_JACK_LINE_OUT,
>>  	EXTCON_NONE,
>>  };
>>
>> @@ -600,7 +600,7 @@ static irqreturn_t arizona_hpdet_irq(int irq, void *data)
>>  	struct arizona_extcon_info *info = data;
>>  	struct arizona *arizona = info->arizona;
>>  	int id_gpio = arizona->pdata.hpdet_id_gpio;
>> -	unsigned int report = EXTCON_HEADPHONE;
>> +	unsigned int report = EXTCON_JACK_HEADPHONE;
>>  	int ret, reading;
>>  	bool mic = false;
>>
>> @@ -645,9 +645,9 @@ static irqreturn_t arizona_hpdet_irq(int irq, void *data)
>>
>>  	/* Report high impedence cables as line outputs */
>>  	if (reading >= 5000)
>> -		report = EXTCON_LINE_OUT;
>> +		report = EXTCON_JACK_LINE_OUT;
>>  	else
>> -		report = EXTCON_HEADPHONE;
>> +		report = EXTCON_JACK_HEADPHONE;
>>
>>  	ret = extcon_set_cable_state_(info->edev, report, true);
>>  	if (ret != 0)
>> @@ -732,7 +732,7 @@ err:
>>  			   ARIZONA_ACCDET_MODE_MASK,
>> ARIZONA_ACCDET_MODE_MIC);
>>
>>  	/* Just report headphone */
>> -	ret = extcon_set_cable_state_(info->edev, EXTCON_HEADPHONE, true);
>> +	ret = extcon_set_cable_state_(info->edev, EXTCON_JACK_HEADPHONE,
>> +true);
>>  	if (ret != 0)
>>  		dev_err(arizona->dev, "Failed to report headphone: %d\n", ret);
>>
>> @@ -789,7 +789,7 @@ err:
>>  			   ARIZONA_ACCDET_MODE_MASK,
>> ARIZONA_ACCDET_MODE_MIC);
>>
>>  	/* Just report headphone */
>> -	ret = extcon_set_cable_state_(info->edev, EXTCON_HEADPHONE, true);
>> +	ret = extcon_set_cable_state_(info->edev, EXTCON_JACK_HEADPHONE,
>> +true);
>>  	if (ret != 0)
>>  		dev_err(arizona->dev, "Failed to report headphone: %d\n", ret);
>>
>> @@ -915,7 +915,7 @@ static void arizona_micd_detect(struct work_struct
>> *work)
>>  		arizona_identify_headphone(info);
>>
>>  		ret = extcon_set_cable_state_(info->edev,
>> -					      EXTCON_MICROPHONE, true);
>> +					      EXTCON_JACK_MICROPHONE,
>> true);
>>  		if (ret != 0)
>>  			dev_err(arizona->dev, "Headset report failed: %d\n",
>>  				ret);
>> diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c
>> index 9668d6a94e38..14e748051288 100644
>> --- a/drivers/extcon/extcon-axp288.c
>> +++ b/drivers/extcon/extcon-axp288.c
>> @@ -102,9 +102,9 @@ enum axp288_extcon_irq {  };
>>
>>  static const unsigned int axp288_extcon_cables[] = {
>> -	EXTCON_SLOW_CHARGER,
>> -	EXTCON_CHARGE_DOWNSTREAM,
>> -	EXTCON_FAST_CHARGER,
>> +	EXTCON_CHG_USB_DCP_SLOW,
>> +	EXTCON_CHG_USB_CDP,
>> +	EXTCON_CHG_USB_DCP_FAST,
>>  	EXTCON_NONE,
>>  };
>>
>> @@ -192,18 +192,18 @@ static int axp288_handle_chrg_det_event(struct
>> axp288_extcon_info *info)
>>  		dev_dbg(info->dev, "sdp cable is connecetd\n");
>>  		notify_otg = true;
>>  		notify_charger = true;
>> -		cable = EXTCON_SLOW_CHARGER;
>> +		cable = EXTCON_CHG_USB_DCP_SLOW;
>>  		break;
>>  	case DET_STAT_CDP:
>>  		dev_dbg(info->dev, "cdp cable is connecetd\n");
>>  		notify_otg = true;
>>  		notify_charger = true;
>> -		cable = EXTCON_CHARGE_DOWNSTREAM;
>> +		cable = EXTCON_CHG_USB_CDP;
>>  		break;
>>  	case DET_STAT_DCP:
>>  		dev_dbg(info->dev, "dcp cable is connecetd\n");
>>  		notify_charger = true;
>> -		cable = EXTCON_FAST_CHARGER;
>> +		cable = EXTCON_CHG_USB_DCP_FAST;
>>  		break;
>>  	default:
>>  		dev_warn(info->dev,
>> diff --git a/drivers/extcon/extcon-max14577.c b/drivers/extcon/extcon-
>> max14577.c
>> index df0659d98e5a..15c2dcc73fc6 100644
>> --- a/drivers/extcon/extcon-max14577.c
>> +++ b/drivers/extcon/extcon-max14577.c
>> @@ -150,10 +150,10 @@ enum max14577_muic_acc_type {
>>
>>  static const unsigned int max14577_extcon_cable[] = {
>>  	EXTCON_USB,
>> -	EXTCON_TA,
>> -	EXTCON_FAST_CHARGER,
>> -	EXTCON_SLOW_CHARGER,
>> -	EXTCON_CHARGE_DOWNSTREAM,
>> +	EXTCON_CHG_USB_DCP,
>> +	EXTCON_CHG_USB_DCP_FAST,
>> +	EXTCON_CHG_USB_DCP_SLOW,
>> +	EXTCON_CHG_USB_CDP,
>>  	EXTCON_JIG,
>>  	EXTCON_NONE,
>>  };
>> @@ -456,18 +456,19 @@ static int max14577_muic_chg_handler(struct
>> max14577_muic_info *info)
>>  		extcon_set_cable_state_(info->edev, EXTCON_USB, attached);
>>  		break;
>>  	case MAX14577_CHARGER_TYPE_DEDICATED_CHG:
>> -		extcon_set_cable_state_(info->edev, EXTCON_TA, attached);
>> +		extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_DCP,
>> +					attached);
>>  		break;
>>  	case MAX14577_CHARGER_TYPE_DOWNSTREAM_PORT:
>> -		extcon_set_cable_state_(info->edev,
>> EXTCON_CHARGE_DOWNSTREAM,
>> +		extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_CDP,
>>  					attached);
>>  		break;
>>  	case MAX14577_CHARGER_TYPE_SPECIAL_500MA:
>> -		extcon_set_cable_state_(info->edev,
>> EXTCON_SLOW_CHARGER,
>> +		extcon_set_cable_state_(info->edev,
>> EXTCON_CHG_USB_DCP_SLOW,
>>  					attached);
>>  		break;
>>  	case MAX14577_CHARGER_TYPE_SPECIAL_1A:
>> -		extcon_set_cable_state_(info->edev, EXTCON_FAST_CHARGER,
>> +		extcon_set_cable_state_(info->edev,
>> EXTCON_CHG_USB_DCP_FAST,
>>  					attached);
>>  		break;
>>  	case MAX14577_CHARGER_TYPE_NONE:
>> diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-
>> max77693.c
>> index 35b9e118b2fb..95c707b1fcee 100644
>> --- a/drivers/extcon/extcon-max77693.c
>> +++ b/drivers/extcon/extcon-max77693.c
>> @@ -204,11 +204,11 @@ enum max77693_muic_acc_type {  static const
>> unsigned int max77693_extcon_cable[] = {
>>  	EXTCON_USB,
>>  	EXTCON_USB_HOST,
>> -	EXTCON_TA,
>> -	EXTCON_FAST_CHARGER,
>> -	EXTCON_SLOW_CHARGER,
>> -	EXTCON_CHARGE_DOWNSTREAM,
>> -	EXTCON_MHL,
>> +	EXTCON_CHG_USB_DCP,
>> +	EXTCON_CHG_USB_DCP_FAST,
>> +	EXTCON_CHG_USB_DCP_SLOW,
>> +	EXTCON_CHG_USB_CDP,
>> +	EXTCON_DISP_MHL,
>>  	EXTCON_JIG,
>>  	EXTCON_DOCK,
>>  	EXTCON_NONE,
>> @@ -505,7 +505,7 @@ static int max77693_muic_dock_handler(struct
>> max77693_muic_info *info,
>>  			return ret;
>>
>>  		extcon_set_cable_state_(info->edev, EXTCON_DOCK,
>> attached);
>> -		extcon_set_cable_state_(info->edev, EXTCON_MHL, attached);
>> +		extcon_set_cable_state_(info->edev, EXTCON_DISP_MHL,
>> attached);
>>  		goto out;
>>  	case MAX77693_MUIC_ADC_AUDIO_MODE_REMOTE:	/* Dock-Desk
>> */
>>  		dock_id = EXTCON_DOCK;
>> @@ -605,7 +605,7 @@ static int max77693_muic_adc_ground_handler(struct
>> max77693_muic_info *info)
>>  	case MAX77693_MUIC_GND_MHL:
>>  	case MAX77693_MUIC_GND_MHL_VB:
>>  		/* MHL or MHL with USB/TA cable */
>> -		extcon_set_cable_state_(info->edev, EXTCON_MHL, attached);
>> +		extcon_set_cable_state_(info->edev, EXTCON_DISP_MHL,
>> attached);
>>  		break;
>>  	default:
>>  		dev_err(info->dev, "failed to detect %s cable of gnd type\n",
>> @@ -801,10 +801,11 @@ static int max77693_muic_chg_handler(struct
>> max77693_muic_info *info)
>>  			 * - Support charging through micro-usb port without
>>  			 *   data connection
>>  			 */
>> -			extcon_set_cable_state_(info->edev, EXTCON_TA,
>> attached);
>> +			extcon_set_cable_state_(info->edev,
>> EXTCON_CHG_USB_DCP,
>> +						attached);
>>  			if (!cable_attached)
>> -				extcon_set_cable_state_(info->edev,
>> EXTCON_MHL,
>> -							cable_attached);
>> +				extcon_set_cable_state_(info->edev,
>> +						EXTCON_DISP_MHL,
>> cable_attached);
>>  			break;
>>  		}
>>
>> @@ -862,7 +863,7 @@ static int max77693_muic_chg_handler(struct
>> max77693_muic_info *info)
>>
>>  			extcon_set_cable_state_(info->edev, EXTCON_DOCK,
>>  						attached);
>> -			extcon_set_cable_state_(info->edev, EXTCON_MHL,
>> +			extcon_set_cable_state_(info->edev,
>> EXTCON_DISP_MHL,
>>  						attached);
>>  			break;
>>  		}
>> @@ -901,20 +902,21 @@ static int max77693_muic_chg_handler(struct
>> max77693_muic_info *info)
>>  			break;
>>  		case MAX77693_CHARGER_TYPE_DEDICATED_CHG:
>>  			/* Only TA cable */
>> -			extcon_set_cable_state_(info->edev, EXTCON_TA,
>> attached);
>> +			extcon_set_cable_state_(info->edev,
>> EXTCON_CHG_USB_DCP,
>> +						attached);
>>  			break;
>>  		}
>>  		break;
>>  	case MAX77693_CHARGER_TYPE_DOWNSTREAM_PORT:
>> -		extcon_set_cable_state_(info->edev,
>> EXTCON_CHARGE_DOWNSTREAM,
>> +		extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_CDP,
>>  					attached);
>>  		break;
>>  	case MAX77693_CHARGER_TYPE_APPLE_500MA:
>> -		extcon_set_cable_state_(info->edev,
>> EXTCON_SLOW_CHARGER,
>> +		extcon_set_cable_state_(info->edev,
>> EXTCON_CHG_USB_DCP_SLOW,
>>  					attached);
>>  		break;
>>  	case MAX77693_CHARGER_TYPE_APPLE_1A_2A:
>> -		extcon_set_cable_state_(info->edev, EXTCON_FAST_CHARGER,
>> +		extcon_set_cable_state_(info->edev,
>> EXTCON_CHG_USB_DCP_FAST,
>>  					attached);
>>  		break;
>>  	case MAX77693_CHARGER_TYPE_DEAD_BATTERY:
>> diff --git a/drivers/extcon/extcon-max77843.c b/drivers/extcon/extcon-
>> max77843.c
>> index fdd928542c19..97aebe5d67a6 100644
>> --- a/drivers/extcon/extcon-max77843.c
>> +++ b/drivers/extcon/extcon-max77843.c
>> @@ -122,11 +122,11 @@ enum max77843_muic_charger_type {  static const
>> unsigned int max77843_extcon_cable[] = {
>>  	EXTCON_USB,
>>  	EXTCON_USB_HOST,
>> -	EXTCON_TA,
>> -	EXTCON_CHARGE_DOWNSTREAM,
>> -	EXTCON_FAST_CHARGER,
>> -	EXTCON_SLOW_CHARGER,
>> -	EXTCON_MHL,
>> +	EXTCON_CHG_USB_DCP,
>> +	EXTCON_CHG_USB_CDP,
>> +	EXTCON_CHG_USB_DCP_FAST,
>> +	EXTCON_CHG_USB_DCP_SLOW,
>> +	EXTCON_DISP_MHL,
>>  	EXTCON_JIG,
>>  	EXTCON_NONE,
>>  };
>> @@ -355,7 +355,7 @@ static int max77843_muic_adc_gnd_handler(struct
>> max77843_muic_info *info)
>>  		if (ret < 0)
>>  			return ret;
>>
>> -		extcon_set_cable_state_(info->edev, EXTCON_MHL, attached);
>> +		extcon_set_cable_state_(info->edev, EXTCON_DISP_MHL,
>> attached);
>>  		break;
>>  	default:
>>  		dev_err(info->dev, "failed to detect %s accessory(gnd:0x%x)\n",
>> @@ -494,7 +494,7 @@ static int max77843_muic_chg_handler(struct
>> max77843_muic_info *info)
>>  		if (ret < 0)
>>  			return ret;
>>
>> -		extcon_set_cable_state_(info->edev,
>> EXTCON_CHARGE_DOWNSTREAM,
>> +		extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_CDP,
>>  					attached);
>>  		break;
>>  	case MAX77843_MUIC_CHG_DEDICATED:
>> @@ -504,7 +504,8 @@ static int max77843_muic_chg_handler(struct
>> max77843_muic_info *info)
>>  		if (ret < 0)
>>  			return ret;
>>
>> -		extcon_set_cable_state_(info->edev, EXTCON_TA, attached);
>> +		extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_DCP,
>> +					attached);
>>  		break;
>>  	case MAX77843_MUIC_CHG_SPECIAL_500MA:
>>  		ret = max77843_muic_set_path(info,
>> @@ -513,7 +514,7 @@ static int max77843_muic_chg_handler(struct
>> max77843_muic_info *info)
>>  		if (ret < 0)
>>  			return ret;
>>
>> -		extcon_set_cable_state_(info->edev,
>> EXTCON_SLOW_CHARGER,
>> +		extcon_set_cable_state_(info->edev,
>> EXTCON_CHG_USB_DCP_SLOW,
>>  					attached);
>>  		break;
>>  	case MAX77843_MUIC_CHG_SPECIAL_1A:
>> @@ -523,7 +524,7 @@ static int max77843_muic_chg_handler(struct
>> max77843_muic_info *info)
>>  		if (ret < 0)
>>  			return ret;
>>
>> -		extcon_set_cable_state_(info->edev, EXTCON_FAST_CHARGER,
>> +		extcon_set_cable_state_(info->edev,
>> EXTCON_CHG_USB_DCP_FAST,
>>  					attached);
>>  		break;
>>  	case MAX77843_MUIC_CHG_GND:
>> @@ -532,9 +533,11 @@ static int max77843_muic_chg_handler(struct
>> max77843_muic_info *info)
>>
>>  		/* Charger cable on MHL accessory is attach or detach */
>>  		if (gnd_type == MAX77843_MUIC_GND_MHL_VB)
>> -			extcon_set_cable_state_(info->edev, EXTCON_TA,
>> true);
>> +			extcon_set_cable_state_(info->edev,
>> EXTCON_CHG_USB_DCP,
>> +						true);
>>  		else if (gnd_type == MAX77843_MUIC_GND_MHL)
>> -			extcon_set_cable_state_(info->edev, EXTCON_TA,
>> false);
>> +			extcon_set_cable_state_(info->edev,
>> EXTCON_CHG_USB_DCP,
>> +						false);
>>  		break;
>>  	case MAX77843_MUIC_CHG_NONE:
>>  		break;
>> diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-
>> max8997.c index 7b1ef200b121..8dbec5febdb6 100644
>> --- a/drivers/extcon/extcon-max8997.c
>> +++ b/drivers/extcon/extcon-max8997.c
>> @@ -148,11 +148,11 @@ struct max8997_muic_info {  static const unsigned int
>> max8997_extcon_cable[] = {
>>  	EXTCON_USB,
>>  	EXTCON_USB_HOST,
>> -	EXTCON_TA,
>> -	EXTCON_FAST_CHARGER,
>> -	EXTCON_SLOW_CHARGER,
>> -	EXTCON_CHARGE_DOWNSTREAM,
>> -	EXTCON_MHL,
>> +	EXTCON_CHG_USB_DCP,
>> +	EXTCON_CHG_USB_DCP_FAST,
>> +	EXTCON_CHG_USB_DCP_SLOW,
>> +	EXTCON_CHG_USB_CDP,
>> +	EXTCON_DISP_MHL,
>>  	EXTCON_DOCK,
>>  	EXTCON_JIG,
>>  	EXTCON_NONE,
>> @@ -403,7 +403,7 @@ static int max8997_muic_adc_handler(struct
>> max8997_muic_info *info)
>>  			return ret;
>>  		break;
>>  	case MAX8997_MUIC_ADC_MHL:
>> -		extcon_set_cable_state_(info->edev, EXTCON_MHL, attached);
>> +		extcon_set_cable_state_(info->edev, EXTCON_DISP_MHL,
>> attached);
>>  		break;
>>  	case MAX8997_MUIC_ADC_FACTORY_MODE_USB_OFF:
>>  	case MAX8997_MUIC_ADC_FACTORY_MODE_USB_ON:
>> @@ -486,18 +486,19 @@ static int max8997_muic_chg_handler(struct
>> max8997_muic_info *info)
>>  		}
>>  		break;
>>  	case MAX8997_CHARGER_TYPE_DOWNSTREAM_PORT:
>> -		extcon_set_cable_state_(info->edev,
>> EXTCON_CHARGE_DOWNSTREAM,
>> +		extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_CDP,
>>  					attached);
>>  		break;
>>  	case MAX8997_CHARGER_TYPE_DEDICATED_CHG:
>> -		extcon_set_cable_state_(info->edev, EXTCON_TA, attached);
>> +		extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_DCP,
>> +					attached);
>>  		break;
>>  	case MAX8997_CHARGER_TYPE_500MA:
>> -		extcon_set_cable_state_(info->edev,
>> EXTCON_SLOW_CHARGER,
>> +		extcon_set_cable_state_(info->edev,
>> EXTCON_CHG_USB_DCP_SLOW,
>>  					attached);
>>  		break;
>>  	case MAX8997_CHARGER_TYPE_1A:
>> -		extcon_set_cable_state_(info->edev, EXTCON_FAST_CHARGER,
>> +		extcon_set_cable_state_(info->edev,
>> EXTCON_CHG_USB_DCP_FAST,
>>  					attached);
>>  		break;
>>  	default:
>> diff --git a/drivers/extcon/extcon-rt8973a.c b/drivers/extcon/extcon-rt8973a.c
>> index 1bc3737ea01c..36bf1d63791c 100644
>> --- a/drivers/extcon/extcon-rt8973a.c
>> +++ b/drivers/extcon/extcon-rt8973a.c
>> @@ -93,7 +93,7 @@ static struct reg_data rt8973a_reg_data[] = {  static const
>> unsigned int rt8973a_extcon_cable[] = {
>>  	EXTCON_USB,
>>  	EXTCON_USB_HOST,
>> -	EXTCON_TA,
>> +	EXTCON_CHG_USB_DCP,
>>  	EXTCON_JIG,
>>  	EXTCON_NONE,
>>  };
>> @@ -333,7 +333,7 @@ static int rt8973a_muic_cable_handler(struct
>> rt8973a_muic_info *info,
>>  		con_sw = DM_DP_SWITCH_USB;
>>  		break;
>>  	case RT8973A_MUIC_ADC_TA:
>> -		id = EXTCON_TA;
>> +		id = EXTCON_CHG_USB_DCP;
>>  		con_sw = DM_DP_SWITCH_OPEN;
>>  		break;
>>  	case RT8973A_MUIC_ADC_FACTORY_MODE_BOOT_OFF_USB:
>> diff --git a/drivers/extcon/extcon-sm5502.c b/drivers/extcon/extcon-sm5502.c
>> index 2945091bfd0e..7aac3cc7efd7 100644
>> --- a/drivers/extcon/extcon-sm5502.c
>> +++ b/drivers/extcon/extcon-sm5502.c
>> @@ -95,7 +95,7 @@ static struct reg_data sm5502_reg_data[] = {  static const
>> unsigned int sm5502_extcon_cable[] = {
>>  	EXTCON_USB,
>>  	EXTCON_USB_HOST,
>> -	EXTCON_TA,
>> +	EXTCON_CHG_USB_DCP,
>>  	EXTCON_NONE,
>>  };
>>
>> @@ -389,7 +389,7 @@ static int sm5502_muic_cable_handler(struct
>> sm5502_muic_info *info,
>>  		vbus_sw	= VBUSIN_SWITCH_VBUSOUT_WITH_USB;
>>  		break;
>>  	case SM5502_MUIC_ADC_OPEN_TA:
>> -		id	= EXTCON_TA;
>> +		id	= EXTCON_CHG_USB_DCP;
>>  		con_sw	= DM_DP_SWITCH_OPEN;
>>  		vbus_sw	= VBUSIN_SWITCH_VBUSOUT;
>>  		break;
>> diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c index
>> 8dd0af1d50bc..525e423f9cda 100644
>> --- a/drivers/extcon/extcon.c
>> +++ b/drivers/extcon/extcon.c
>> @@ -39,37 +39,40 @@
>>  #define CABLE_NAME_MAX		30
>>
>>  static const char *extcon_name[] =  {
>> -	[EXTCON_NONE]		= "NONE",
>> +	[EXTCON_NONE]			= "EXTCON_NONE",
>>
>>  	/* USB external connector */
>> -	[EXTCON_USB]		= "USB",
>> -	[EXTCON_USB_HOST]	= "USB-HOST",
>> -
>> -	/* Charger external connector */
>> -	[EXTCON_TA]		= "TA",
>> -	[EXTCON_FAST_CHARGER]	= "FAST-CHARGER",
>> -	[EXTCON_SLOW_CHARGER]	= "SLOW-CHARGER",
>> -	[EXTCON_CHARGE_DOWNSTREAM] = "CHARGE-DOWNSTREAM",
>> -
>> -	/* Audio/Video external connector */
>> -	[EXTCON_LINE_IN]	= "LINE-IN",
>> -	[EXTCON_LINE_OUT]	= "LINE-OUT",
>> -	[EXTCON_MICROPHONE]	= "MICROPHONE",
>> -	[EXTCON_HEADPHONE]	= "HEADPHONE",
>> -
>> -	[EXTCON_HDMI]		= "HDMI",
>> -	[EXTCON_MHL]		= "MHL",
>> -	[EXTCON_DVI]		= "DVI",
>> -	[EXTCON_VGA]		= "VGA",
>> -	[EXTCON_SPDIF_IN]	= "SPDIF-IN",
>> -	[EXTCON_SPDIF_OUT]	= "SPDIF-OUT",
>> -	[EXTCON_VIDEO_IN]	= "VIDEO-IN",
>> -	[EXTCON_VIDEO_OUT]	= "VIDEO-OUT",
>> -
>> -	/* Etc external connector */
>> -	[EXTCON_DOCK]		= "DOCK",
>> -	[EXTCON_JIG]		= "JIG",
>> -	[EXTCON_MECHANICAL]	= "MECHANICAL",
>> +	[EXTCON_USB]			= "EXTCON_USB",
>> +	[EXTCON_USB_HOST]		= "EXTCON_USB_HOST",
>> +
>> +	/* Charging external connector */
>> +	[EXTCON_CHG_USB]		= "EXTCON_CHG_USB",
>> +	[EXTCON_CHG_USB_CDP]		= "EXTCON_CHG_USB_CDP",
>> +	[EXTCON_CHG_USB_DCP]		= "EXTCON_CHG_USB_DCP",
>> +	[EXTCON_CHG_USB_DCP_FAST]	= "EXTCON_CHG_USB_DCP_FAST",
>> +	[EXTCON_CHG_USB_DCP_SLOW]	=
>> "EXTCON_CHG_USB_DCP_SLOW",
>> +	[EXTCON_CHG_USB_ACA]		= "EXTCON_CHG_USB_ACA",
>> +
>> +	/* Jack external connector */
>> +	[EXTCON_JACK_MICROPHONE]	= "EXTCON_JACK_MICROPHONE",
>> +	[EXTCON_JACK_HEADPHONE]		=
>> "EXTCON_JACK_HEADPHONE",
>> +	[EXTCON_JACK_LINE_IN]		= "EXTCON_JACK_LINE_IN",
>> +	[EXTCON_JACK_LINE_OUT]		= "EXTCON_JACK_LINE_OUT",
>> +	[EXTCON_JACK_VIDEO_IN]		= "EXTCON_JACK_VIDEO_IN",
>> +	[EXTCON_JACK_VIDEO_OUT]		=
>> "EXTCON_JACK_VIDEO_OUT",
>> +	[EXTCON_JACK_SPDIF_IN]		= "EXTCON_JACK_SPDIF_IN",
>> +	[EXTCON_JACK_SPDIF_OUT]		=
>> "EXTCON_JACK_SPDIF_OUT",
>> +
>> +	/* Display external connector */
>> +	[EXTCON_DISP_HDMI]		= "EXTCON_DISP_HDMI",
>> +	[EXTCON_DISP_MHL]		= "EXTCON_DISP_MHL",
>> +	[EXTCON_DISP_DVI]		= "EXTCON_DISP_DVI",
>> +	[EXTCON_DISP_VGA]		= "EXTCON_DISP_VGA",
>> +
>> +	/* Miscellaneous external connector */
>> +	[EXTCON_DOCK]			= "EXTCON_DOCK",
>> +	[EXTCON_JIG]			= "EXTCON_JIG",
>> +	[EXTCON_MECHANICAL]		= "EXTCON_MECHANICAL",
>>
>>  	NULL,
>>  };
>> diff --git a/include/linux/extcon.h b/include/linux/extcon.h index
>> c0f8c4fc5d45..c8dd881e2b8d 100644
>> --- a/include/linux/extcon.h
>> +++ b/include/linux/extcon.h
>> @@ -31,32 +31,42 @@
>>  /*
>>   * Define the unique id of supported external connectors
>>   */
>> -#define EXTCON_NONE			0
>> -
>> -#define EXTCON_USB			1	/* USB connector */
>> -#define EXTCON_USB_HOST			2
>> -
>> -#define EXTCON_TA			3	/* Charger connector */
>> -#define EXTCON_FAST_CHARGER		4
>> -#define EXTCON_SLOW_CHARGER		5
>> -#define EXTCON_CHARGE_DOWNSTREAM	6
>> -
>> -#define EXTCON_LINE_IN			7	/* Audio/Video
>> connector */
>> -#define EXTCON_LINE_OUT			8
>> -#define EXTCON_MICROPHONE		9
>> -#define EXTCON_HEADPHONE		10
>> -#define EXTCON_HDMI			11
>> -#define EXTCON_MHL			12
>> -#define EXTCON_DVI			13
>> -#define EXTCON_VGA			14
>> -#define EXTCON_SPDIF_IN			15
>> -#define EXTCON_SPDIF_OUT		16
>> -#define EXTCON_VIDEO_IN			17
>> -#define EXTCON_VIDEO_OUT		18
>> -
>> -#define EXTCON_DOCK			19	/* Misc connector */
>> -#define EXTCON_JIG			20
>> -#define EXTCON_MECHANICAL		21
>> +#define EXTCON_NONE		0
>> +
>> +/* USB external connector */
>> +#define EXTCON_USB		1	/* Universal Serial Bus */
>> +#define EXTCON_USB_HOST		2
>> +
>> +/* Charging external connector */
>> +#define EXTCON_CHG_USB		5	/* Standard Downstream Port
>> */
>> +#define EXTCON_CHG_USB_CDP	6	/* Charging Downstream Port
>> */
>> +#define EXTCON_CHG_USB_DCP	7	/* Dedicated Charging Port */
>> +#define EXTCON_CHG_USB_DCP_FAST	8
>> +#define EXTCON_CHG_USB_DCP_SLOW	9
>> +#define EXTCON_CHG_USB_ACA	10	/* Accessory Charger Adapter
>> */
>> +
>> +/* Jack external connector */
>> +#define EXTCON_JACK_MICROPHONE	20
>> +#define EXTCON_JACK_HEADPHONE	21
>> +#define EXTCON_JACK_LINE_IN	22
>> +#define EXTCON_JACK_LINE_OUT	23
>> +#define EXTCON_JACK_VIDEO_IN	24
>> +#define EXTCON_JACK_VIDEO_OUT	25
>> +#define EXTCON_JACK_SPDIF_IN	26	/* Sony Philips Digital
>> InterFace */
>> +#define EXTCON_JACK_SPDIF_OUT	27
>> +
>> +/* Display external connector */
>> +#define EXTCON_DISP_HDMI	40	/* High-Definition Multimedia
>> Interface */
>> +#define EXTCON_DISP_MHL		41	/* Mobile High-Definition Link
>> */
>> +#define EXTCON_DISP_DVI		42	/* Digital Visual Inteface */
>> +#define EXTCON_DISP_VGA		43	/* Video Graphics Array */
>> +
>> +/* Miscellaneous external connector */
>> +#define EXTCON_DOCK	60
>> +#define EXTCON_JIG		61
>> +#define EXTCON_MECHANICAL	62
>> +
>> +#define EXTCON_NUM		63
> 
> Can we change the #define macro's to enum's? is there problem with that?

It is possible. But, the unique id of external connector will be used on device tree file
as following patch[1]. Following patch[1] defines the include/dt-bindings/extcon/extcon.h
which is include in *.dts file. In *.dts file, we can not use the 'enum'.
[1] https://lkml.org/lkml/2015/10/5/38
So, I use the "#define" keyword instead of enum.

I used the 'enum' on first patch to define the unique id
but I altered it by using '#define' instead of 'enum' on following patch[2].
[2] commit 73b6ecdb93e8e ("extcon: Redefine the unique id of supported external connectors without 'enum extcon' type")

Thanks,
Chanwoo Choi

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists