summaryrefslogtreecommitdiff
path: root/drivers/platform/x86/surface3_power.c
AgeCommit message (Collapse)Author
2020-04-17platform/x86: surface3_power: Fix a NULL vs IS_ERR() check in probeDan Carpenter
The i2c_acpi_new_device() function never returns NULL, it returns error pointers. Fixes: b1f81b496b0d ("platform/x86: surface3_power: MSHW0011 rev-eng implementation") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-03-30platform/x86: surface3_power: Fix always true condition in ↵Andy Shevchenko
mshw0011_space_handler() smatch warnings: .../surface3_power.c:417 mshw0011_space_handler() warn: always true condition '(ret >= 0) => +(0-u32max >= 0)' Refactor error handling returned by mshw0011_adp_psr() to avoid always true condition. Reported-by: kbuild test robot <lkp@intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-03-28platform/x86: surface3_power: Add missed headersAndy Shevchenko
We obviously are users of bits.h and types.h. Add them to the list. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-03-28platform/x86: surface3_power: Reformat GUID assignmentAndy Shevchenko
For better readability reformat GUID assignment. While here, add the comment how this GUID looks in a string representation. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-03-28platform/x86: surface3_power: Drop useless macro ACPI_PTR()Andy Shevchenko
Driver depends to ACPI, this marco always is evaluated to the parameter, thus useless. Drop it for good. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-03-28platform/x86: surface3_power: Prefix POLL_INTERVAL with SURFACE_3Andy Shevchenko
For better namespace maintenance prefix POLL_INTERVAL macro with SURFACE_3. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-03-28platform/x86: surface3_power: Simplify mshw0011_adp_psr() to one linerAndy Shevchenko
Refactor mshw0011_adp_psr() to be one liner. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-03-28platform/x86: surface3_power: Use dev_err() instead of pr_err()Andy Shevchenko
We have device and we may use it to print messages. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-03-28platform/x86: surface3_power: Drop unused structure definitionAndy Shevchenko
As reported by kbuild bot the struct mshw0011_lookup in never used. Drop its definition for good. Reported-by: kbuild test robot <lkp@intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-03-26platform/x86: surface3_power: MSHW0011 rev-eng implementationBlaž Hrastnik
Patch was rebased on top of for-next. Thanks for your patience! Blaž I'm resubmitting this patch with review feedback addressed: https://patchwork.kernel.org/patch/10584079/ The patch was previously not resubmitted because it required a change that was reverted in the ACPICA. That has since been corrected: https://github.com/acpica/acpica/commit/9159c09a2a5897a43f78c95cdffc160d399722c3 We've been using this patch for a while and user reports confirm that it works: https://github.com/linux-surface/linux-surface Previous description follows. >8------------------------------------------------------8< The MSHW0011 device is a chip that replaces the battery firmware by using ACPI operation regions on the Surface 3. It is unclear whether or not the chip will be reused somewhere else (under Windows, the chip is called "Surface Platform Power Driver" and the driver is provided by Microsoft). The values have been obtained by reverse engineering, and are subject to errors. Looks like it works on overall pretty well. I couldn't manage to get the IRQ correctly triggered, so I am using a good old polling thread to check for changes. This is something to be fixed in a later version. Link: https://bugzilla.kernel.org/show_bug.cgi?id=106231 Signed-off-by: Blaž Hrastnik <blaz@mxxn.io> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Stephen Just <stephenjust@gmail.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>