ARM Sunxi Platform Development
 help / color / mirror / Atom feed
From: Oliver Neukum <oneukum@suse.com>
To: Chris Morgan <macroalpha82@gmail.com>, linux-sunxi@lists.linux.dev
Cc: devicetree@vger.kernel.org, linux-pm@vger.kernel.org,
	broonie@kernel.org, lgirdwood@gmail.com, lee@kernel.org,
	samuel@sholland.org, jernej.skrabec@gmail.com, wens@csie.org,
	conor+dt@kernel.org, krzk+dt@kernel.org, robh@kernel.org,
	sre@kernel.org, Chris Morgan <macromorgan@hotmail.com>
Subject: Re: [PATCH 3/4] power: supply: axp20x_usb_power: Add support for AXP717
Date: Mon, 27 May 2024 11:10:32 +0200	[thread overview]
Message-ID: <a2b06a40-4689-4fa9-90bb-9d34311d4221@suse.com> (raw)
In-Reply-To: <20240522230132.364915-4-macroalpha82@gmail.com>



On 23.05.24 01:01, Chris Morgan wrote:
> From: Chris Morgan <macromorgan@hotmail.com>
> 
> Add support for the AXP717. It does USB BC 1.2 detection similar to the
> AXP813, however it is otherwise very different from previous AXP
> devices.
> 
> Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
> ---

> +static int axp717_usb_init(struct axp20x_usb_power *power)
> +{
> +	int ret;
> +
> +	ret = regmap_update_bits(power->regmap, AXP717_ADC_CH_EN_CONTROL,
> +				 AXP717_ADC_EN_VSYS_VOLT |
> +				 AXP717_ADC_EN_VBUS_VOLT,
> +				 AXP717_ADC_EN_VSYS_VOLT |
> +				 AXP717_ADC_EN_VBUS_VOLT);
> +	if (ret)
> +		return ret;
> +
> +	return 0;

This is a bit silly.

> +}
> +
>   static int axp20x_usb_power_set_voltage_min(struct axp20x_usb_power *power,
>   					    int intval)
>   {
> @@ -307,6 +417,20 @@ static int axp20x_usb_power_set_voltage_min(struct axp20x_usb_power *power,
>   	return -EINVAL;
>   }
>   
> +static int axp717_usb_power_set_voltage_min(struct axp20x_usb_power *power,
> +					    int intval)
> +{
> +	int val;
> +
> +	if (intval < 3880000 || intval > 5080000)

Do you really want raw numbers here?

[..]
> +static int axp717_usb_power_set_property(struct power_supply *psy,
> +					 enum power_supply_property psp,
> +					 const union power_supply_propval *val)
> +{
> +	struct axp20x_usb_power *power = power_supply_get_drvdata(psy);
> +
> +	switch (psp) {
> +	case POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT:
> +		return axp717_usb_power_set_input_current_limit(power, val->intval);
> +
> +	case POWER_SUPPLY_PROP_VOLTAGE_MIN:
> +		return axp717_usb_power_set_voltage_min(power, val->intval);
> +
> +	default:
> +		return -EINVAL;
> +	}
> +
> +	return -EINVAL;

This is also a bit silly.

	Regards
		Oliver


  reply	other threads:[~2024-05-27  9:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-22 23:01 [PATCH 0/4] AXP717: Add USB Power Supply Chris Morgan
2024-05-22 23:01 ` [PATCH 1/4] mfd: axp20x: AXP717: Correct MODULE_ENABLE_CONTROL register name Chris Morgan
2024-05-22 23:01 ` [PATCH 2/4] dt-bindings: mfd: x-powers,axp20x-usb-power-supply: add AXP717 Chris Morgan
2024-05-23  6:40   ` Krzysztof Kozlowski
2024-05-22 23:01 ` [PATCH 3/4] power: supply: axp20x_usb_power: Add support for AXP717 Chris Morgan
2024-05-27  9:10   ` Oliver Neukum [this message]
2024-05-29 15:22     ` Chris Morgan
     [not found]     ` <ZldINkZO11XuiJAP@wintermute.localhost.fail>
2024-06-06 17:09       ` Chris Morgan
2024-05-22 23:01 ` [PATCH 4/4] arm64: dts: allwinner: Anbernic RG35XX: add AXP717 USB power Chris Morgan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a2b06a40-4689-4fa9-90bb-9d34311d4221@suse.com \
    --to=oneukum@suse.com \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=lee@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=macroalpha82@gmail.com \
    --cc=macromorgan@hotmail.com \
    --cc=robh@kernel.org \
    --cc=samuel@sholland.org \
    --cc=sre@kernel.org \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox