From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Werner Sembach <wse@tuxedocomputers.com>
Cc: W_Armin@gmx.de, Hans de Goede <hansg@kernel.org>,
platform-driver-x86@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v6 2/5] platform/x86: uniwill-laptop: Implement USB-C power priority setting
Date: Tue, 24 Mar 2026 15:21:54 +0200 (EET) [thread overview]
Message-ID: <f4678518-0bac-40f1-cc49-e8e23a8ad46a@linux.intel.com> (raw)
In-Reply-To: <118aaa63-1050-4a98-88e1-a824c4e01315@tuxedocomputers.com>
[-- Attachment #1: Type: text/plain, Size: 3958 bytes --]
On Tue, 24 Mar 2026, Werner Sembach wrote:
> Am 24.03.26 um 14:08 schrieb Ilpo Järvinen:
> > On Thu, 12 Mar 2026, Werner Sembach wrote:
> >
> > > On some devices Uniwill offers the option to set the USB-C port to
> > > prioritise charging or performance. This patch exposes this setting to the
> > > userspace via sysfs for all TUXEDO devices supporting it.
> > >
> > > Signed-off-by: Werner Sembach <wse@tuxedocomputers.com>
> > > Reviewed-by: Armin Wolf <W_Armin@gmx.de>
> > > ---
> > > drivers/platform/x86/uniwill/uniwill-acpi.c | 145 +++++++++++++++++++-
> > > 1 file changed, 138 insertions(+), 7 deletions(-)
> > >
> > > diff --git a/drivers/platform/x86/uniwill/uniwill-acpi.c
> > > b/drivers/platform/x86/uniwill/uniwill-acpi.c
> > > index 048b265bff374..22ae5fccd6a06 100644
> > > --- a/drivers/platform/x86/uniwill/uniwill-acpi.c
> > > +++ b/drivers/platform/x86/uniwill/uniwill-acpi.c
> > > @@ -266,8 +266,8 @@
> > > #define BATTERY_CHARGE_FULL_OVER_24H BIT(3)
> > > #define BATTERY_ERM_STATUS_REACHED BIT(4)
> > > -#define EC_ADDR_CHARGE_PRIO 0x07CC
> > > -#define CHARGING_PERFORMANCE BIT(7)
> > > +#define EC_ADDR_USB_C_POWER_PRIORITY 0x07CC
> > > +#define USB_C_POWER_PRIORITY BIT(7)
> > > /* Same bits as EC_ADDR_LIGHTBAR_AC_CTRL except LIGHTBAR_S3_OFF */
> > > #define EC_ADDR_LIGHTBAR_BAT_CTRL 0x07E2
> > > @@ -324,6 +324,12 @@
> > > #define UNIWILL_FEATURE_PRIMARY_FAN BIT(7)
> > > #define UNIWILL_FEATURE_SECONDARY_FAN BIT(8)
> > > #define UNIWILL_FEATURE_NVIDIA_CTGP_CONTROL BIT(9)
> > > +#define UNIWILL_FEATURE_USB_C_POWER_PRIORITY BIT(10)
> > > +
> > > +enum usb_c_power_priority_options {
> > > + USB_C_POWER_PRIORITY_CHARGING = 0,
> > > + USB_C_POWER_PRIORITY_PERFORMANCE,
> > > +};
> > > struct uniwill_data {
> > > struct device *dev;
> > > @@ -343,6 +349,8 @@ struct uniwill_data {
> > > struct mutex input_lock; /* Protects input sequence during
> > > notify */
> > > struct input_dev *input_device;
> > > struct notifier_block nb;
> > > + struct mutex usb_c_power_priority_lock; /* Protects dependent bit
> > > write and state safe */
> > > + enum usb_c_power_priority_options last_usb_c_power_priority_option;
> > > };
> > > struct uniwill_battery_entry {
> > > @@ -527,6 +535,7 @@ static bool uniwill_writeable_reg(struct device *dev,
> > > unsigned int reg)
> > > case EC_ADDR_CTGP_DB_CTGP_OFFSET:
> > > case EC_ADDR_CTGP_DB_TPP_OFFSET:
> > > case EC_ADDR_CTGP_DB_DB_OFFSET:
> > > + case EC_ADDR_USB_C_POWER_PRIORITY:
> > > return true;
> > > default:
> > > return false;
> > > @@ -565,6 +574,7 @@ static bool uniwill_readable_reg(struct device *dev,
> > > unsigned int reg)
> > > case EC_ADDR_CTGP_DB_CTGP_OFFSET:
> > > case EC_ADDR_CTGP_DB_TPP_OFFSET:
> > > case EC_ADDR_CTGP_DB_DB_OFFSET:
> > > + case EC_ADDR_USB_C_POWER_PRIORITY:
> > > return true;
> > > default:
> > > return false;
> > > @@ -587,6 +597,7 @@ static bool uniwill_volatile_reg(struct device *dev,
> > > unsigned int reg)
> > > case EC_ADDR_TRIGGER:
> > > case EC_ADDR_SWITCH_STATUS:
> > > case EC_ADDR_CHARGE_CTRL:
> > > + case EC_ADDR_USB_C_POWER_PRIORITY:
> > > return true;
> > > default:
> > > return false;
> > > @@ -883,6 +894,104 @@ static int uniwill_nvidia_ctgp_init(struct
> > > uniwill_data *data)
> > > return 0;
> > > }
> > > +static const char * const USB_C_POWER_PRIORITY_TEXT[] = {
> > > +static const u8 USB_C_POWER_PRIORITY_VALUE[] = {
> > These two arrays need to be lowercase as they're not macros.
>
> I copied a design pattern if found here for example:
> https://elixir.bootlin.com/linux/v6.19.9/source/drivers/power/supply/power_supply_sysfs.c#L63
>
> But ofc can lower case it.
Yes, please use lowercase for them.
I read through the other patches of the series in the meantime. They
seemed fine.
--
i.
next prev parent reply other threads:[~2026-03-24 13:22 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-12 19:25 [PATCH v6 0/5] platform/x86: uniwill-laptop: More support for TUXEDO devices Werner Sembach
2026-03-12 19:25 ` [PATCH v6 1/5] platform/x86: uniwill-laptop: Rework hwmon feature defines Werner Sembach
2026-03-12 19:25 ` [PATCH v6 2/5] platform/x86: uniwill-laptop: Implement USB-C power priority setting Werner Sembach
2026-03-24 13:08 ` Ilpo Järvinen
2026-03-24 13:18 ` Werner Sembach
2026-03-24 13:21 ` Ilpo Järvinen [this message]
2026-03-12 19:25 ` [PATCH v6 3/5] platform/x86: uniwill-laptop: Fix XMG Fusion 15 (L19) entries Werner Sembach
2026-03-12 19:25 ` [PATCH v6 4/5] platform/x86: uniwill-laptop: Apply features across all TUXEDO devices Werner Sembach
2026-03-12 19:25 ` [PATCH v6 5/5] Documentation: laptops: Update documentation for uniwill laptops Werner Sembach
2026-03-20 17:14 ` [PATCH v6 0/5] platform/x86: uniwill-laptop: More support for TUXEDO devices Armin Wolf
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=f4678518-0bac-40f1-cc49-e8e23a8ad46a@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=W_Armin@gmx.de \
--cc=hansg@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=wse@tuxedocomputers.com \
/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