summaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/surface3_power.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* platform/surface: Move Surface 3 Power OpRegion driver to platform/surfaceMaximilian Luz2020-10-271-589/+0
| | | | | | | | | | Move the Surface 3 Power operation region driver from platform/x86 to the newly created platform/surface directory. Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20201009141128.683254-5-luzmaximilian@gmail.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: surface3_power: Fix a NULL vs IS_ERR() check in probeDan Carpenter2020-04-171-2/+2
| | | | | | | | | 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>
* platform/x86: surface3_power: Fix always true condition in ↵Andy Shevchenko2020-03-301-5/+7
| | | | | | | | | | | | | 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>
* platform/x86: surface3_power: Add missed headersAndy Shevchenko2020-03-281-0/+2
| | | | | | 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>
* platform/x86: surface3_power: Reformat GUID assignmentAndy Shevchenko2020-03-281-2/+3
| | | | | | | 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>
* platform/x86: surface3_power: Drop useless macro ACPI_PTR()Andy Shevchenko2020-03-281-1/+1
| | | | | | | 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>
* platform/x86: surface3_power: Prefix POLL_INTERVAL with SURFACE_3Andy Shevchenko2020-03-281-3/+3
| | | | | | For better namespace maintenance prefix POLL_INTERVAL macro with SURFACE_3. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
* platform/x86: surface3_power: Simplify mshw0011_adp_psr() to one linerAndy Shevchenko2020-03-281-8/+1
| | | | | | Refactor mshw0011_adp_psr() to be one liner. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
* platform/x86: surface3_power: Use dev_err() instead of pr_err()Andy Shevchenko2020-03-281-1/+1
| | | | | | We have device and we may use it to print messages. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
* platform/x86: surface3_power: Drop unused structure definitionAndy Shevchenko2020-03-281-7/+0
| | | | | | | | 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>
* platform/x86: surface3_power: MSHW0011 rev-eng implementationBlaž Hrastnik2020-03-261-0/+598
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>