> -----Original Message-----
> From: Alan Stern [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, April 18, 2006 7:19 PM
> To: Rasmit Ranjan (WT01 - Semiconductors & Consumer Electronics)
> Cc: linux-usb-devel@lists.sourceforge.net
> Subject: Re: [linux-pm] Behavior of PCMCIA based HCD in the 
> event of SUSPEND
> 
> On Tue, 18 Apr 2006 [EMAIL PROTECTED] wrote:
> 
> > Now the problem is PCMCIA powers of the card when it gets 
> the suspend 
> > event. So consider the following case:
> > 
> >     Let the device,port,roothub interface and the Host 
> controller, which 
> > are the nodes of the device tree are not suspened.Now a 
> user suspends 
> > the PCMCIA card. So PCMCIA gets the suspend event and powers of the 
> > card. We have a check in PCMCIA suspend event that whether the Host 
> > controller is suspended or not. So considering the above 
> case we find 
> > that Host controller is not suspended. Now according to LINUX USB 
> > framework, parent node should not be supended if all the 
> child devices 
> > are not suspended. So we thought up three solutions for this.
> > 
> > First is, fail the suspend event which we cant do because 
> PCMCIA powes 
> > off the card.
> 
> You can do it.  And you should.
> 
> > Second is, mark Host Controller as suspended. But I hope this is 
> > against the LINUX USB framework because we should not 
> suspend the host 
> > controller when the bus,port and the device connected to 
> the port are 
> > still active.So you suspend the device connected to the port first, 
> > then the port ,then the roothub interface and then the Host 
> controller.
> 
> No, don't do this.  If those devices aren't already suspended 
> then the PCMCIA socket shouldn't get suspended.
> 
> > Third is, as the card is physically powered off, we shutdown the 
> > controller. So we thought up doing this.
> 
> I don't see how.  You can't do anything to the controller 
> (shut it down, suspend it, anything) if it doesn't have power.

It should be very much possible to shutdown/stop the Controller before
PCMCIA layer powers off the card. If you see the CS_EVENT_PM_SUSPEND
event of xxx_cs_event function of PCMCIA client driver, from the
CS_EVENT_PM_SUSPEND, we can call an exported function which is actually
defined in HCD. Inside that exported function we stop the controller.
And PCMCIA powers off the card once  xxx_cs_event function returns. So
we can stop the controller before PCMCIA powers off the card. And this
is the way we can communicate to HCD from PCMCIA as PCMCIA doesnot have
any mechanism. Otherwise HCD will not come to know about the event and
it it is not marked as HALTED.

        Also, it is essential to start the controller when we do card
resume, as none of its contents are preserved on power on. This again
can be done by calling an exported function defined in HCD, as PCMCIA
does not have any mechanism to communicate about the card resume to HCD.

Please see the comments in suspend and resume events in following code.
        
static int
xxx_cs_event(event_t event, int priority, event_callback_args_t *args)
{
        dev_link_t *link = args->client_data;

        switch (event) {
        case CS_EVENT_CARD_REMOVAL:
                link->state &= ~DEV_PRESENT;
                if (link->state & DEV_CONFIG)
                        sl811_cs_release(link);
                break;

        case CS_EVENT_CARD_INSERTION:
                link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
                sl811_cs_config(link);
                break;

        case CS_EVENT_PM_SUSPEND:
                link->state |= DEV_SUSPEND;
                
                /* Here we call function exported by HCD 
                 * This function stops the controller and disconnects RH
as well as child devices 
                */
                hcd_handle_suspend_event(); 

                /* Fall through... */

        case CS_EVENT_RESET_PHYSICAL:
                if (link->state & DEV_CONFIG)
                        pcmcia_release_configuration(link->handle);
                break;

        case CS_EVENT_PM_RESUME:
                link->state &= ~DEV_SUSPEND;

                /* Here we call function exported by HCD 
                 * This function starts the controller.  
                */
                hcd_handle_resume_event()


                /* Fall through... */
        case CS_EVENT_CARD_RESET:
                if (link->state & DEV_CONFIG)
                        pcmcia_request_configuration(link->handle,
&link->conf);
                DBG(0, "reset sl811-hcd here?\n");
                break;
        }
        return 0;
}


> 
> >     As you have replied, PCMCIA should not make assumption 
> about its 
> > client. So doing second and third solution are not feasible 
> as we will 
> > be handling/changing HCD stuff from PCMCIA layer. So only 
> thing can be 
> > done is, when PCMCIA gets the suspend event ,it should 
> check whether 
> > the Host Controller is suspended or not. Acoording to the check 
> > result, PCMCIA should handle the suspend event. i.e. it 
> should power 
> > off the card if the Controller is suspended. Otherwise fail the 
> > suspend event by not powering off the card. But PCMCIA behavior is, 
> > power off the card irrespective anything. Then what should 
> be the solution ?
> 
> The solution is simple and obvious: Fix the PCMCIA layer.

We will look into this as well.

> 
> Alan Stern
> 
> 


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to