All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mfd: intel_soc_pmic_crc: Add support for non ACPI instantiated i2c_client
@ 2024-10-25  8:37 Hans de Goede
  2024-10-25 13:27 ` Andy Shevchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Hans de Goede @ 2024-10-25  8:37 UTC (permalink / raw)
  To: Andy Shevchenko, Lee Jones; +Cc: Hans de Goede, linux-kernel

On some x86 Bay Trail tablets which shipped with Android as factory OS,
the DSDT is so broken that the PMIC needs to be manually instantiated by
the special x86-android-tablets.ko "fixup" driver for cases like this.

Add an i2c_device_id table so that the driver can match on manually
instantiated i2c_client-s (which lack an ACPI fwnode to match on).

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/mfd/intel_soc_pmic_crc.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/mfd/intel_soc_pmic_crc.c b/drivers/mfd/intel_soc_pmic_crc.c
index 876d017f74fe..ba22458ccb84 100644
--- a/drivers/mfd/intel_soc_pmic_crc.c
+++ b/drivers/mfd/intel_soc_pmic_crc.c
@@ -259,12 +259,19 @@ static const struct acpi_device_id crystal_cove_acpi_match[] = {
 };
 MODULE_DEVICE_TABLE(acpi, crystal_cove_acpi_match);
 
+static const struct i2c_device_id crystal_cove_i2c_match[] = {
+	{ "intel-crystal-cove" },
+	{ }
+};
+MODULE_DEVICE_TABLE(i2c, crystal_cove_i2c_match);
+
 static struct i2c_driver crystal_cove_i2c_driver = {
 	.driver = {
 		.name = "crystal_cove_i2c",
 		.pm = pm_sleep_ptr(&crystal_cove_pm_ops),
 		.acpi_match_table = crystal_cove_acpi_match,
 	},
+	.id_table = crystal_cove_i2c_match,
 	.probe = crystal_cove_i2c_probe,
 	.remove = crystal_cove_i2c_remove,
 	.shutdown = crystal_cove_shutdown,
-- 
2.47.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mfd: intel_soc_pmic_crc: Add support for non ACPI instantiated i2c_client
  2024-10-25  8:37 [PATCH] mfd: intel_soc_pmic_crc: Add support for non ACPI instantiated i2c_client Hans de Goede
@ 2024-10-25 13:27 ` Andy Shevchenko
  2024-10-26 11:42   ` Hans de Goede
  0 siblings, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2024-10-25 13:27 UTC (permalink / raw)
  To: Hans de Goede; +Cc: Lee Jones, linux-kernel

On Fri, Oct 25, 2024 at 10:37:12AM +0200, Hans de Goede wrote:
> On some x86 Bay Trail tablets which shipped with Android as factory OS,
> the DSDT is so broken that the PMIC needs to be manually instantiated by
> the special x86-android-tablets.ko "fixup" driver for cases like this.
> 
> Add an i2c_device_id table so that the driver can match on manually
> instantiated i2c_client-s (which lack an ACPI fwnode to match on).

...

> +static const struct i2c_device_id crystal_cove_i2c_match[] = {
> +	{ "intel-crystal-cove" },

Why this can't be "crystal_cove_i2c"?

> +	{ }
> +};

...

>  	.driver = {
>  		.name = "crystal_cove_i2c",
>  		.pm = pm_sleep_ptr(&crystal_cove_pm_ops),
>  		.acpi_match_table = crystal_cove_acpi_match,
>  	},

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mfd: intel_soc_pmic_crc: Add support for non ACPI instantiated i2c_client
  2024-10-25 13:27 ` Andy Shevchenko
@ 2024-10-26 11:42   ` Hans de Goede
  2024-10-28  9:19     ` Andy Shevchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Hans de Goede @ 2024-10-26 11:42 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Lee Jones, linux-kernel

Hi Andy,

On 25-Oct-24 3:27 PM, Andy Shevchenko wrote:
> On Fri, Oct 25, 2024 at 10:37:12AM +0200, Hans de Goede wrote:
>> On some x86 Bay Trail tablets which shipped with Android as factory OS,
>> the DSDT is so broken that the PMIC needs to be manually instantiated by
>> the special x86-android-tablets.ko "fixup" driver for cases like this.
>>
>> Add an i2c_device_id table so that the driver can match on manually
>> instantiated i2c_client-s (which lack an ACPI fwnode to match on).
> 
> ...
> 
>> +static const struct i2c_device_id crystal_cove_i2c_match[] = {
>> +	{ "intel-crystal-cove" },
> 
> Why this can't be "crystal_cove_i2c"?

It can be any string as long as it is unique. Typically this will
be vendor-model-name though and having i2c in there is a bit weird
since this is used for the modalias, which gets prefixed with
"i2c:" already.

Therefor I would prefer to keep this as is. But if you have
a strong preference I can change this for v2.

Please let me know how you want to proceed with this patch.

Regards,

Hans



> 
>> +	{ }
>> +};
> 
> ...
> 
>>  	.driver = {
>>  		.name = "crystal_cove_i2c",
>>  		.pm = pm_sleep_ptr(&crystal_cove_pm_ops),
>>  		.acpi_match_table = crystal_cove_acpi_match,
>>  	},
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mfd: intel_soc_pmic_crc: Add support for non ACPI instantiated i2c_client
  2024-10-26 11:42   ` Hans de Goede
@ 2024-10-28  9:19     ` Andy Shevchenko
  0 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2024-10-28  9:19 UTC (permalink / raw)
  To: Hans de Goede; +Cc: Lee Jones, linux-kernel

On Sat, Oct 26, 2024 at 01:42:36PM +0200, Hans de Goede wrote:
> On 25-Oct-24 3:27 PM, Andy Shevchenko wrote:
> > On Fri, Oct 25, 2024 at 10:37:12AM +0200, Hans de Goede wrote:

...

> >> +static const struct i2c_device_id crystal_cove_i2c_match[] = {
> >> +	{ "intel-crystal-cove" },
> > 
> > Why this can't be "crystal_cove_i2c"?
> 
> It can be any string as long as it is unique. Typically this will
> be vendor-model-name though and having i2c in there is a bit weird
> since this is used for the modalias, which gets prefixed with
> "i2c:" already.
> 
> Therefor I would prefer to keep this as is. But if you have
> a strong preference I can change this for v2.
> 
> Please let me know how you want to proceed with this patch.

I think that I would like to have the same name there and in the .driver below.
If you think we need align these across PMIC MFD drivers, I'm fine with that as
well.

> >> +	{ }
> >> +};

...

> >>  	.driver = {
> >>  		.name = "crystal_cove_i2c",

At least two options based on the existing code:
"Crystal Cove PMIC" or "intel_soc_pmic_crc". I'm also
not against other one as long as it's done for all
PMIC MFD drivers.

> >>  		.pm = pm_sleep_ptr(&crystal_cove_pm_ops),
> >>  		.acpi_match_table = crystal_cove_acpi_match,
> >>  	},

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-10-28  9:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-25  8:37 [PATCH] mfd: intel_soc_pmic_crc: Add support for non ACPI instantiated i2c_client Hans de Goede
2024-10-25 13:27 ` Andy Shevchenko
2024-10-26 11:42   ` Hans de Goede
2024-10-28  9:19     ` Andy Shevchenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.