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"?
> +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.
--
Best Regards,
Peter Chen
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html