public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Darren Hart <dvhart@infradead.org>
To: Azael Avalos <coproscefalo@gmail.com>
Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/4] toshiba_acpi: Add support for USB Sleep and Charge function
Date: Sun, 18 Jan 2015 10:55:51 -0800	[thread overview]
Message-ID: <20150118185551.GF56582@vmdeb7> (raw)
In-Reply-To: <1421271621-8330-2-git-send-email-coproscefalo@gmail.com>

On Wed, Jan 14, 2015 at 02:40:18PM -0700, Azael Avalos wrote:
> Newer Toshiba models now come with a feature called Sleep and Charge,
> where the computer USB ports remain powered when the computer is
> asleep or turned off.
> 
> This patch adds support to such feature, creating a sysfs entry
> called "usb_sleep_charge" to set the desired charging mode or to
> disable it.
> 
> The sysfs entry accepts three parameters, 0x0, 0x9 and 0x21, beign
> disabled, alternate and auto respectively.
> 
> Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
> ---
>  drivers/platform/x86/toshiba_acpi.c | 112 ++++++++++++++++++++++++++++++++++++
>  1 file changed, 112 insertions(+)
...

> +static ssize_t toshiba_usb_sleep_charge_store(struct device *dev,
> +					      struct device_attribute *attr,
> +					      const char *buf, size_t count)
> +{
> +	struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev);
> +	int state;
> +	int ret;
> +
> +	ret = kstrtoint(buf, 0, &state);
> +	if (ret)
> +		return ret;
> +
> +	/* Set the USB charging mode where:
> +	 * 0x30000 - Disable
> +	 * 0x30009 - Alternate
> +	 * 0x30021 - Auto
> +	 */
> +	state |= 0x30000;
> +	if (state != SCI_USB_CHARGE_DISABLED && state != SCI_USB_CHARGE_AUTO &&
> +	    state != SCI_USB_CHARGE_ALTERNATE)
> +		return -EINVAL;

Sorry, I missed this as the input validation on my first pass. Looks good.

-- 
Darren Hart
Intel Open Source Technology Center

  parent reply	other threads:[~2015-01-18 18:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-14 21:40 [PATCH 0/4] toshiba_acpi: Add support for USB Sleep functions Azael Avalos
2015-01-14 21:40 ` [PATCH 1/4] toshiba_acpi: Add support for USB Sleep and Charge function Azael Avalos
2015-01-18 18:46   ` Darren Hart
2015-01-18 18:55   ` Darren Hart [this message]
2015-01-14 21:40 ` [PATCH 2/4] toshiba_acpi: Add support for USB Sleep functions under battery Azael Avalos
2015-01-18 18:54   ` Darren Hart
2015-01-14 21:40 ` [PATCH 3/4] toshiba_acpi: Add support for USB Rapid Charge Azael Avalos
2015-01-18 19:00   ` Darren Hart
2015-01-14 21:40 ` [PATCH 4/4] toshiba_acpi: Add support for USB Sleep and Music Azael Avalos
2015-01-18 19:07 ` [PATCH 0/4] toshiba_acpi: Add support for USB Sleep functions Darren Hart

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=20150118185551.GF56582@vmdeb7 \
    --to=dvhart@infradead.org \
    --cc=coproscefalo@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.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