From: Hans de Goede <hidden> Date: 2021-10-18 14:33:39
Hi All,
We have been open-coding x86_match_cpu() checks for enabling some
SoC specific behavior in various places.
The sound/soc/intel drivers used to also open-code this but this was
cleaned up a while ago introducing a number of soc_intel_is_*() helpers.
This series moves the definition of these helpers to a more public place
and uses it in a couple of more places outside the sound tree.
Mark, I know we are a bit late in the cycle, but if you can pick up
patch 1/3 (assuming on one objects) for 5.16, then the rest can be
applied after 5.16-rc1 is out.
Regards,
Hans
Hans de Goede (3):
ASoC: Intel: Move soc_intel_is_foo() helpers to a generic header
platform/x86: intel_int0002_vgpio: Use the new soc_intel_is_byt/cht
helpers
Input: axp20x-pek - Use new soc_intel_is_cht() helper
drivers/input/misc/axp20x-pek.c | 26 ++-------
drivers/platform/x86/intel/int0002_vgpio.c | 14 +----
include/linux/platform_data/x86/soc.h | 65 ++++++++++++++++++++++
sound/soc/intel/common/soc-intel-quirks.h | 51 +----------------
4 files changed, 75 insertions(+), 81 deletions(-)
create mode 100644 include/linux/platform_data/x86/soc.h
--
2.31.1
From: Hans de Goede <hidden> Date: 2021-10-18 14:33:40
The soc_intel_is_foo() helpers from
sound/soc/intel/common/soc-intel-quirks.h are useful outside of the
sound subsystem too.
Move these to include/linux/platform_data/x86/soc.h, so that
other code can use them too.
Suggested-by: Andy Shevchenko <redacted>
Signed-off-by: Hans de Goede <redacted>
---
include/linux/platform_data/x86/soc.h | 65 +++++++++++++++++++++++
sound/soc/intel/common/soc-intel-quirks.h | 51 ++----------------
2 files changed, 68 insertions(+), 48 deletions(-)
create mode 100644 include/linux/platform_data/x86/soc.h
From: Hans de Goede <hidden> Date: 2021-10-18 14:33:41
Use the new soc_intel_is_byt/cht helpers to clean things up a bit.
Signed-off-by: Hans de Goede <redacted>
---
drivers/platform/x86/intel/int0002_vgpio.c | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
@@ -34,13 +34,11 @@#include<linux/io.h>#include<linux/kernel.h>#include<linux/module.h>+#include<linux/platform_data/x86/soc.h>#include<linux/platform_device.h>#include<linux/slab.h>#include<linux/suspend.h>-#include<asm/cpu_device_id.h>-#include<asm/intel-family.h>-#define DRV_NAME "INT0002 Virtual GPIO"/* For some reason the virtual GPIO pin tied to the GPE is numbered pin 2 */
From: Hans de Goede <hidden> Date: 2021-10-18 14:33:43
Use the new soc_intel_is_cht() helper to find out if we are running
on a CHT device rather then checking the ACPI _HRV field.
This is more reliable (some CHT devices have been found where the _HRV
for the PMIC is 2 rather then 3) and leads to a nice cleanup.
Signed-off-by: Hans de Goede <redacted>
---
drivers/input/misc/axp20x-pek.c | 26 +++++---------------------
1 file changed, 5 insertions(+), 21 deletions(-)
@@ -255,41 +256,24 @@ static int axp20x_pek_probe_input_device(struct axp20x_pek *axp20x_pek,return0;}-#ifdef CONFIG_ACPI-staticboolaxp20x_pek_should_register_input(structaxp20x_pek*axp20x_pek,-structplatform_device*pdev)+staticboolaxp20x_pek_should_register_input(structaxp20x_pek*axp20x_pek){-unsignedlonglonghrv=0;-acpi_statusstatus;-if(IS_ENABLED(CONFIG_INPUT_SOC_BUTTON_ARRAY)&&axp20x_pek->axp20x->variant==AXP288_ID){-status=acpi_evaluate_integer(ACPI_HANDLE(pdev->dev.parent),-"_HRV",NULL,&hrv);-if(ACPI_FAILURE(status))-dev_err(&pdev->dev,"Failed to get PMIC hardware revision\n");-/**OnCherryTrailplatforms(hrv==3),donotregisterthe*inputdeviceifthereisan"INTCFD9"or"ACPI0011"gpio*buttonACPIdevice,asthathandlesthepowerbuttontoo,*andotherwiseweendupreportingallpressestwice.*/-if(hrv==3&&(acpi_dev_present("INTCFD9",NULL,-1)||+if(soc_intel_is_cht()&&+(acpi_dev_present("INTCFD9",NULL,-1)||acpi_dev_present("ACPI0011",NULL,-1)))returnfalse;-}returntrue;}-#else-staticboolaxp20x_pek_should_register_input(structaxp20x_pek*axp20x_pek,-structplatform_device*pdev)-{-returntrue;-}-#endifstaticintaxp20x_pek_probe(structplatform_device*pdev){
@@ -321,7 +305,7 @@ static int axp20x_pek_probe(struct platform_device *pdev)axp20x_pek->irq_dbf=regmap_irq_get_virq(axp20x_pek->axp20x->regmap_irqc,axp20x_pek->irq_dbf);-if(axp20x_pek_should_register_input(axp20x_pek,pdev)){+if(axp20x_pek_should_register_input(axp20x_pek)){error=axp20x_pek_probe_input_device(axp20x_pek,pdev);if(error)returnerror;
From: Andy Shevchenko <hidden> Date: 2021-10-18 14:59:22
On Mon, Oct 18, 2021 at 5:33 PM Hans de Goede [off-list ref] wrote:
Hi All,
We have been open-coding x86_match_cpu() checks for enabling some
SoC specific behavior in various places.
The sound/soc/intel drivers used to also open-code this but this was
cleaned up a while ago introducing a number of soc_intel_is_*() helpers.
This series moves the definition of these helpers to a more public place
and uses it in a couple of more places outside the sound tree.
Mark, I know we are a bit late in the cycle, but if you can pick up
patch 1/3 (assuming on one objects) for 5.16, then the rest can be
I suppose s/on one/no-one/ :-)
applied after 5.16-rc1 is out.
What I like about this series is dropping ugly ifdeffery here and
there and consolidating it in one place.
Reviewed-by: Andy Shevchenko <redacted>
P.S. Btw, since you are the maintainer of PDx86 it means either you or
Mark (whoever gives an Ack to the other one) can take at least two
patches that makes visible that the change is not just for a single
user.
Hans de Goede (3):
ASoC: Intel: Move soc_intel_is_foo() helpers to a generic header
platform/x86: intel_int0002_vgpio: Use the new soc_intel_is_byt/cht
helpers
Input: axp20x-pek - Use new soc_intel_is_cht() helper
drivers/input/misc/axp20x-pek.c | 26 ++-------
drivers/platform/x86/intel/int0002_vgpio.c | 14 +----
include/linux/platform_data/x86/soc.h | 65 ++++++++++++++++++++++
sound/soc/intel/common/soc-intel-quirks.h | 51 +----------------
4 files changed, 75 insertions(+), 81 deletions(-)
create mode 100644 include/linux/platform_data/x86/soc.h
--
2.31.1
From: Andy Shevchenko <hidden> Date: 2021-10-18 15:03:04
On Mon, Oct 18, 2021 at 5:33 PM Hans de Goede [off-list ref] wrote:
The soc_intel_is_foo() helpers from
sound/soc/intel/common/soc-intel-quirks.h are useful outside of the
sound subsystem too.
Move these to include/linux/platform_data/x86/soc.h, so that
other code can use them too.
A nit-pick below which may be ignored.
quoted hunk
Suggested-by: Andy Shevchenko <redacted>
Signed-off-by: Hans de Goede <redacted>
---
include/linux/platform_data/x86/soc.h | 65 +++++++++++++++++++++++
sound/soc/intel/common/soc-intel-quirks.h | 51 ++----------------
2 files changed, 68 insertions(+), 48 deletions(-)
create mode 100644 include/linux/platform_data/x86/soc.h
@@ -34,13 +34,11 @@#include<linux/io.h>#include<linux/kernel.h>#include<linux/module.h>+#include<linux/platform_data/x86/soc.h>#include<linux/platform_device.h>#include<linux/slab.h>#include<linux/suspend.h>-#include<asm/cpu_device_id.h>-#include<asm/intel-family.h>-#define DRV_NAME "INT0002 Virtual GPIO"/* For some reason the virtual GPIO pin tied to the GPE is numbered pin 2 */
From: Andy Shevchenko <hidden> Date: 2021-10-18 15:09:37
On Mon, Oct 18, 2021 at 6:03 PM Andy Shevchenko
[off-list ref] wrote:
On Mon, Oct 18, 2021 at 5:33 PM Hans de Goede [off-list ref] wrote:
...
quoted
+ if (!soc_intel_is_byt() && !soc_intel_is_cht())
if (!(soc_intel_is_byt() || soc_intel_is_cht()))
?
Self-nak on this. && is slightly better in case we got the first
argument false. Proposed variant will always evaluate both.
--
With Best Regards,
Andy Shevchenko
On Mon, Oct 18, 2021 at 04:33:24PM +0200, Hans de Goede wrote:
Use the new soc_intel_is_cht() helper to find out if we are running
on a CHT device rather then checking the ACPI _HRV field.
This is more reliable (some CHT devices have been found where the _HRV
for the PMIC is 2 rather then 3) and leads to a nice cleanup.
Signed-off-by: Hans de Goede <redacted>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Please feel free to merge with the rest of the patches.
Thanks.
--
Dmitry
From: Hans de Goede <hidden> Date: 2021-10-19 15:38:38
Hi all,
On 10/18/21 16:33, Hans de Goede wrote:
Hi All,
We have been open-coding x86_match_cpu() checks for enabling some
SoC specific behavior in various places.
The sound/soc/intel drivers used to also open-code this but this was
cleaned up a while ago introducing a number of soc_intel_is_*() helpers.
This series moves the definition of these helpers to a more public place
and uses it in a couple of more places outside the sound tree.
Mark, I know we are a bit late in the cycle, but if you can pick up
patch 1/3 (assuming on one objects) for 5.16, then the rest can be
applied after 5.16-rc1 is out.
Regards,
Hans