Re: [PATCH v5 24/25] usb: chipidea: add power_budget limit for ehci to platform data

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

 



On Thu, May 03, 2012 at 03:47:13PM +0300, Alexander Shishkin wrote:
> Some implementations need this limitation to work correctly.
> 
> Signed-off-by: Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>
> ---
>  drivers/usb/chipidea/ci13xxx_pci.c |    3 +++
>  drivers/usb/chipidea/host.c        |    3 +++
>  include/linux/usb/chipidea.h       |    1 +
>  3 files changed, 7 insertions(+)
> 
> diff --git a/drivers/usb/chipidea/ci13xxx_pci.c b/drivers/usb/chipidea/ci13xxx_pci.c
> index 79e9864..a2201b5 100644
> --- a/drivers/usb/chipidea/ci13xxx_pci.c
> +++ b/drivers/usb/chipidea/ci13xxx_pci.c
> @@ -76,6 +76,9 @@ static int __devinit ci13xxx_pci_probe(struct pci_dev *pdev,
>  	if (pdev->vendor == PCI_VENDOR_ID_INTEL) {
>  		driver.capoffset = 0;
>  
> +		if (pdev->device == 0x0829)
> +			driver.power_budget_limit = 200;

please use driver_data from pci_device_id structure. Then you can
simply:

struct ci13xx_pci_driver_data	*data = (struct ci13xx_pci_driver_data *) id->driver_data;

...

driver.power_budget_limit = data->power_budget_limit;

or something similar. And completely loose the per-device ID check.

> diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c
> index 126753c..9ea2a31 100644
> --- a/drivers/usb/chipidea/host.c
> +++ b/drivers/usb/chipidea/host.c
> @@ -117,6 +117,9 @@ static int host_start(struct ci13xxx *ci)
>  	hcd->regs = ci->hw_bank.abs;
>  	hcd->has_tt = 1;
>  
> +	if (ci->udc_driver->power_budget_limit)
> +		hcd->power_budget = ci->udc_driver->power_budget_limit;

you can drop the if, actually. hcd is memset to zero when you allocate
it, so power_budget is zero by default...

-- 
balbi

Attachment: signature.asc
Description: Digital 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