Re: [PATCH 5/6] power: supply: Add support for mp2733 battery charger

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

 



On Tue, Jun 14, 2022 at 5:17 PM Saravanan Sekar <sravanhome@xxxxxxxxx> wrote:
>
> mp2733 is updated version of mp2629 battery charge management
> which supports usb fast-charge and higher range of input voltage.

USB

...

> +static int mp2733_get_usb_type(unsigned int rval)
> +{
> +       int type;

Unneeded, just return directly.

> +       switch (rval) {
> +       case MP2733_SOURCE_TYPE_APPLE_1p0:
> +       case MP2733_SOURCE_TYPE_APPLE_2p1:
> +       case MP2733_SOURCE_TYPE_APPLE_2p4:
> +               type = POWER_SUPPLY_USB_TYPE_APPLE_BRICK_ID;
> +               break;
> +       case MP2733_SOURCE_TYPE_SDP:
> +               type = POWER_SUPPLY_USB_TYPE_SDP;
> +               break;
> +       case MP2733_SOURCE_TYPE_CDP:
> +               type = POWER_SUPPLY_USB_TYPE_CDP;
> +               break;
> +       case MP2733_SOURCE_TYPE_DCP:
> +               type = POWER_SUPPLY_USB_TYPE_DCP;
> +               break;
> +       default:
> +               type = POWER_SUPPLY_USB_TYPE_UNKNOWN;
> +               break;
> +       }
> +
> +       return type;
> +}
> +
> +static int mp2629_get_usb_type(unsigned int rval)
> +{
> +       int type;

Ditto.

> +       switch (rval) {
> +       case MP2629_SOURCE_TYPE_SDP:
> +               type = POWER_SUPPLY_USB_TYPE_SDP;
> +               break;
> +       case MP2629_SOURCE_TYPE_CDP:
> +               type = POWER_SUPPLY_USB_TYPE_CDP;
> +               break;
> +       case MP2629_SOURCE_TYPE_DCP:
> +               type = POWER_SUPPLY_USB_TYPE_DCP;
> +               break;
> +       case MP2629_SOURCE_TYPE_OTG:
> +               type = POWER_SUPPLY_USB_TYPE_PD_DRP;
> +               break;
> +       default:
> +               type = POWER_SUPPLY_USB_TYPE_UNKNOWN;
> +               break;
> +       }
> +
> +       return type;
> +}

...

> +       return sprintf(buf, "USB DP %u:DM %u\n", !!(rval & BIT(2)),
> +                        !!(rval & BIT(1)));

sysfs_emit() ?

...

> +static const struct mp2xx_chip_info mp2xx_chip_info_tbl[] = {
> +       [CHIP_ID_MP2629] = {
> +               .rfields = mp2629_reg_fields,
> +               .chip_props = mp2629_chip_props,
> +               .has_impedance = 1,

> +               .has_fast_charge = 0,

Unneeded.

> +               .mpxx_get_usb_type = mp2629_get_usb_type,
> +       },
> +       [CHIP_ID_MP2733] = {
> +               .rfields = mp2733_reg_fields,
> +               .chip_props = mp2733_chip_props,

> +               .has_impedance = 0,

Ditto.

> +               .has_fast_charge = 1,
> +
> +               .mpxx_get_usb_type = mp2733_get_usb_type,
> +       },
> +};

-- 
With Best Regards,
Andy Shevchenko



[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