[PATCH v5 09/13] iio: adc: mt6370: Add MediaTek MT6370 support
Andy Shevchenko
andy.shevchenko at gmail.com
Fri Jul 15 06:18:16 PDT 2022
On Fri, Jul 15, 2022 at 1:28 PM ChiaEn Wu <peterwu.pub at gmail.com> wrote:
>
> From: ChiaEn Wu <chiaen_wu at richtek.com>
>
> MediaTek MT6370 is a SubPMIC consisting of a single cell battery charger
> with ADC monitoring, RGB LEDs, dual channel flashlight, WLED backlight
> driver, display bias voltage supply, one general purpose LDO, and the
> USB Type-C & PD controller complies with the latest USB Type-C and PD
> standards.
>
> This adds support the MT6370 ADC driver for system monitoring, including
This adds --> Add a
> charger current, voltage, and temperature.
...
> +#include <linux/bits.h>
> +#include <linux/bitfield.h>
> +#include <linux/iio/iio.h>
> +#include <linux/kernel.h>
> +#include <linux/mod_devicetable.h>
> +#include <linux/module.h>
> +#include <linux/mutex.h>
> +#include <linux/platform_device.h>
> +#include <linux/regmap.h>
> +#include <linux/sysfs.h>
...
> +#define MT6370_AICR_400MA 0x6
> +#define MT6370_ICHG_500MA 0x4
> +#define MT6370_ICHG_900MA 0x8
_mA ?
...
> + ret = regmap_read_poll_timeout(priv->regmap,
> + MT6370_REG_CHG_ADC, reg_val,
> + !(reg_val & MT6370_ADC_START_MASK),
> + ADC_CONV_POLLING_TIME_US,
> + ADC_CONV_TIME_MS * 1000 * 3);
1000 --> MILLI ?
...
> +static int mt6370_adc_probe(struct platform_device *pdev)
> +{
Given comment in one place in the entire series would be good to use
in another where appropriate. For example, here it would also be nice
to have a temporary variable
struct device *dev = &pdev->dev;
It will shorten some lines.
> + struct mt6370_adc_data *priv;
> + struct iio_dev *indio_dev;
> + struct regmap *regmap;
> + int ret;
> +}
--
With Best Regards,
Andy Shevchenko
More information about the Linux-mediatek
mailing list