Re: [PATCH resend 2/2] usb: phy: mxs: add usb charger type detection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Peter Chen <hzpeterchen@xxxxxxxxx> writes:
> On Mon, Sep 04, 2017 at 11:14:02PM +0800, Li Jun wrote:
>>  }
>>  
>> +#define MXS_USB_CHARGER_DATA_CONTACT_TIME_OUT	100
>
> How about using "DATA_CONTACT_TIMEOUT_LOOP"?

this really doesn't change anything. The only thing is that TIMEOUT is
more common than TIME_OUT. I'll make that change locally.

>> +static int mxs_charger_data_contact_detect(struct mxs_phy *x)
>> +{
>> +	struct regmap *regmap = x->regmap_anatop;
>> +	int i, stable_contact_count = 0;
>> +	u32 val;
>> +
>> +	/* Check if vbus is valid */
>> +	regmap_read(regmap, ANADIG_USB1_VBUS_DET_STAT, &val);
>> +	if (!(val & ANADIG_USB1_VBUS_DET_STAT_VBUS_VALID)) {
>> +		dev_err(x->phy.dev, "vbus is not valid\n");
>> +		return -EINVAL;
>> +	}
>> +
>> +	/* Enable charger detector */
>> +	regmap_write(regmap, ANADIG_USB1_CHRG_DETECT_CLR,
>> +				ANADIG_USB1_CHRG_DETECT_EN_B);
>> +	/*
>> +	 * - Do not check whether a charger is connected to the USB port
>> +	 * - Check whether the USB plug has been in contact with each other
>> +	 */
>> +	regmap_write(regmap, ANADIG_USB1_CHRG_DETECT_SET,
>> +			ANADIG_USB1_CHRG_DETECT_CHK_CONTACT |
>> +			ANADIG_USB1_CHRG_DETECT_CHK_CHRG_B);
>> +
>> +	/* Check if plug is connected */
>> +	for (i = 0; i < MXS_USB_CHARGER_DATA_CONTACT_TIME_OUT; i = i + 1) {
>
> We use i++ at for-loop usually.

this I can also fix while applying. Thanksn

-- 
balbi

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux