Re: [PATCH 1/2] usb: typec: Add USB Power Delivery sink port support

2016-07-19 Thread Felipe Balbi
Hi, Bin Gao writes: > On Mon, Jul 18, 2016 at 10:07:24AM +0300, Felipe Balbi wrote: >> >> Hi, >> >> Bin Gao writes: >> >> > +int pd_sink_queue_msg(struct pd_sink_msg *msg) >> >> > +{ >> >> > + unsigned long flags; >> >> > + struct pd_sink_port *port; >> >> > + >> >> > + if (

Re: [PATCH 1/2] usb: typec: Add USB Power Delivery sink port support

2016-07-19 Thread Felipe Balbi
Hi, Bin Gao writes: > On Sat, Jul 16, 2016 at 08:49:53AM +0900, Greg Kroah-Hartman wrote: >> On Fri, Jul 15, 2016 at 03:41:10PM -0700, Bin Gao wrote: >> > On Fri, Jul 15, 2016 at 02:21:48PM +0300, Felipe Balbi wrote: >> > > Greg Kroah-Hartman writes: >> > > > On Fri, Jul 15, 2016 at 01:38:12PM

Re: [PATCH 1/2] usb: typec: Add USB Power Delivery sink port support

2016-07-18 Thread Bin Gao
On Mon, Jul 18, 2016 at 10:07:24AM +0300, Felipe Balbi wrote: > > Hi, > > Bin Gao writes: > >> > +int pd_sink_queue_msg(struct pd_sink_msg *msg) > >> > +{ > >> > +unsigned long flags; > >> > +struct pd_sink_port *port; > >> > + > >> > +if (msg->port < 0 || msg->port >= MA

Re: [PATCH 1/2] usb: typec: Add USB Power Delivery sink port support

2016-07-18 Thread Bin Gao
On Sat, Jul 16, 2016 at 08:49:53AM +0900, Greg Kroah-Hartman wrote: > On Fri, Jul 15, 2016 at 03:41:10PM -0700, Bin Gao wrote: > > On Fri, Jul 15, 2016 at 02:21:48PM +0300, Felipe Balbi wrote: > > > Greg Kroah-Hartman writes: > > > > On Fri, Jul 15, 2016 at 01:38:12PM +0300, Felipe Balbi wrote: >

Re: [PATCH 1/2] usb: typec: Add USB Power Delivery sink port support

2016-07-18 Thread Felipe Balbi
Hi, Bin Gao writes: >> > +int pd_sink_queue_msg(struct pd_sink_msg *msg) >> > +{ >> > + unsigned long flags; >> > + struct pd_sink_port *port; >> > + >> > + if (msg->port < 0 || msg->port >= MAX_NR_SINK_PORTS) { >> > + pr_err("Invalid port number\n"); >> > + return -EINVAL;

Re: [PATCH 1/2] usb: typec: Add USB Power Delivery sink port support

2016-07-15 Thread Greg Kroah-Hartman
On Fri, Jul 15, 2016 at 03:41:10PM -0700, Bin Gao wrote: > On Fri, Jul 15, 2016 at 02:21:48PM +0300, Felipe Balbi wrote: > > Greg Kroah-Hartman writes: > > > On Fri, Jul 15, 2016 at 01:38:12PM +0300, Felipe Balbi wrote: > > >> > > >> Hi, > > >> > > >> Bin Gao writes: > > >> > +static void print

Re: [PATCH 1/2] usb: typec: Add USB Power Delivery sink port support

2016-07-15 Thread Bin Gao
On Fri, Jul 15, 2016 at 10:25:36AM +0300, Felipe Balbi wrote: > Bin Gao writes: > > > This patch implements a simple USB Power Delivery sink port state machine. > > It assumes the hardware only handles PD packet transmitting and receiving > > over the CC line of the USB Type-C connector. The stat

Re: [PATCH 1/2] usb: typec: Add USB Power Delivery sink port support

2016-07-15 Thread Bin Gao
On Fri, Jul 15, 2016 at 02:21:48PM +0300, Felipe Balbi wrote: > Greg Kroah-Hartman writes: > > On Fri, Jul 15, 2016 at 01:38:12PM +0300, Felipe Balbi wrote: > >> > >> Hi, > >> > >> Bin Gao writes: > >> > +static void print_message(int port, bool is_cmsg, u8 msg, bool recv) > >> > +{ > >> > +

Re: [PATCH 1/2] usb: typec: Add USB Power Delivery sink port support

2016-07-15 Thread Bin Gao
On Fri, Jul 15, 2016 at 08:31:08AM +0200, Oliver Neukum wrote: > > +static void ack_message(struct pd_sink_port *port, int msg_id) > > +{ > > + struct pd_msg_header *header = kzalloc(PD_MSG_HEADER_LEN, GFP_KERNEL); > > This must be GFP_NOIO. We are in a cycle that can lead to deadlock. > > Assu

Re: [PATCH 1/2] usb: typec: Add USB Power Delivery sink port support

2016-07-15 Thread Felipe Balbi
Hi again, Felipe Balbi writes: > Oliver Neukum writes: >> On Fri, 2016-07-15 at 10:25 +0300, Felipe Balbi wrote: >>> > +int pd_sink_queue_msg(struct pd_sink_msg *msg) >>> > +{ >>> > + unsigned long flags; >>> > + struct pd_sink_port *port; >>> > + >>> > + if (msg->port < 0 || msg->p

Re: [PATCH 1/2] usb: typec: Add USB Power Delivery sink port support

2016-07-15 Thread Felipe Balbi
Hi, Greg Kroah-Hartman writes: > On Fri, Jul 15, 2016 at 01:38:12PM +0300, Felipe Balbi wrote: >> >> Hi, >> >> Bin Gao writes: >> > +static void print_message(int port, bool is_cmsg, u8 msg, bool recv) >> > +{ >> > + pr_info("sink port %d: %s message %s %s\n", port, >> > +

Re: [PATCH 1/2] usb: typec: Add USB Power Delivery sink port support

2016-07-15 Thread Greg Kroah-Hartman
On Fri, Jul 15, 2016 at 01:38:12PM +0300, Felipe Balbi wrote: > > Hi, > > Bin Gao writes: > > +static void print_message(int port, bool is_cmsg, u8 msg, bool recv) > > +{ > > + pr_info("sink port %d: %s message %s %s\n", port, > > + is_cmsg ? "Control" : "Data", > > +

Re: [PATCH 1/2] usb: typec: Add USB Power Delivery sink port support

2016-07-15 Thread Felipe Balbi
Hi, Bin Gao writes: > +static void print_message(int port, bool is_cmsg, u8 msg, bool recv) > +{ > + pr_info("sink port %d: %s message %s %s\n", port, > + is_cmsg ? "Control" : "Data", > + msg_to_string(is_cmsg, msg), > + r

Re: [PATCH 1/2] usb: typec: Add USB Power Delivery sink port support

2016-07-15 Thread Felipe Balbi
Hi, Oliver Neukum writes: > On Fri, 2016-07-15 at 10:25 +0300, Felipe Balbi wrote: >> > +int pd_sink_queue_msg(struct pd_sink_msg *msg) >> > +{ >> > + unsigned long flags; >> > + struct pd_sink_port *port; >> > + >> > + if (msg->port < 0 || msg->port >= MAX_NR_SINK_PORTS) { >> > +

Re: [PATCH 1/2] usb: typec: Add USB Power Delivery sink port support

2016-07-15 Thread Oliver Neukum
On Fri, 2016-07-15 at 10:25 +0300, Felipe Balbi wrote: > > +int pd_sink_queue_msg(struct pd_sink_msg *msg) > > +{ > > + unsigned long flags; > > + struct pd_sink_port *port; > > + > > + if (msg->port < 0 || msg->port >= MAX_NR_SINK_PORTS) { > > + pr_err("Invalid port number\

Re: [PATCH 1/2] usb: typec: Add USB Power Delivery sink port support

2016-07-15 Thread Felipe Balbi
Bin Gao writes: > This patch implements a simple USB Power Delivery sink port state machine. > It assumes the hardware only handles PD packet transmitting and receiving > over the CC line of the USB Type-C connector. The state transition is > completely controlled by software. This patch only imp

Re: [PATCH 1/2] usb: typec: Add USB Power Delivery sink port support

2016-07-14 Thread Oliver Neukum
On Thu, 2016-07-14 at 19:14 -0700, Bin Gao wrote: > This patch implements a simple USB Power Delivery sink port state machine. > It assumes the hardware only handles PD packet transmitting and receiving > over the CC line of the USB Type-C connector. The state transition is > completely controlled

[PATCH 1/2] usb: typec: Add USB Power Delivery sink port support

2016-07-14 Thread Bin Gao
This patch implements a simple USB Power Delivery sink port state machine. It assumes the hardware only handles PD packet transmitting and receiving over the CC line of the USB Type-C connector. The state transition is completely controlled by software. This patch only implement the sink port funct