Re: [PATCH v2 5/6] usb: typec: tcpm: Allow slow charging loops to comply to pSnkStby

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

 



> > @@ -4047,9 +4053,12 @@ static void run_state_machine(struct tcpm_port *port)
> >  		break;
> >  	case SNK_DISCOVERY:
> >  		if (port->vbus_present) {
> > -			tcpm_set_current_limit(port,
> > -					       tcpm_get_current_limit(port),
> > -					       5000);
> > +			u32 current_lim = (!port->slow_charger_loop ||
> > +					   (tcpm_get_current_limit(port) <=
> > +					    PD_P_SNK_STDBY_MW / 5)) ?
> > +				tcpm_get_current_limit(port) :
> > +				PD_P_SNK_STDBY_MW / 5;
> 
> Here the use of the ternary operator is not appropriate. Please try to
> clean that up somehow. Maybe something like this would be better?
> 
>                         u32 current_lim = tcpm_get_current_limit(port);
> 
> 			if (port->slow_charger_loop || (current_lim < PD_P_SNK_STDBY_MW / 5))
> 				current_lim = PD_P_SNK_STDBY_MW / 5;

Sorry, I mean:

			if (port->slow_charger_loop || (current_lim > PD_P_SNK_STDBY_MW / 5))
				current_lim = PD_P_SNK_STDBY_MW / 5;

thanks,

-- 
heikki



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux