diff mbox series

[v4,01/16] media: i2c: Add ACPI support to ov8865

Message ID 20211101001119.46056-2-djrscally@gmail.com (mailing list archive)
State New, archived
Headers show
Series Extensions to ov8865 driver | expand

Commit Message

Daniel Scally Nov. 1, 2021, 12:11 a.m. UTC
The ov8865 sensor is sometimes found on x86 platforms enumerated via ACPI.
Add an ACPI match table to the driver so that it's probed on those
platforms.

Signed-off-by: Daniel Scally <djrscally@gmail.com>
---
 drivers/media/i2c/ov8865.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Andy Shevchenko Nov. 1, 2021, 10:01 a.m. UTC | #1
On Mon, Nov 1, 2021 at 2:12 AM Daniel Scally <djrscally@gmail.com> wrote:
>
> The ov8865 sensor is sometimes found on x86 platforms enumerated via ACPI.
> Add an ACPI match table to the driver so that it's probed on those
> platforms.
>
> Signed-off-by: Daniel Scally <djrscally@gmail.com>
> ---
>  drivers/media/i2c/ov8865.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/drivers/media/i2c/ov8865.c b/drivers/media/i2c/ov8865.c
> index ce50f3ea87b8..7626c8608f8f 100644
> --- a/drivers/media/i2c/ov8865.c
> +++ b/drivers/media/i2c/ov8865.c
> @@ -9,6 +9,7 @@
>  #include <linux/delay.h>
>  #include <linux/device.h>
>  #include <linux/i2c.h>
> +#include <linux/mod_devicetable.h>
>  #include <linux/module.h>

>  #include <linux/of_graph.h>

I'm wondering if the code even uses of_*() APIs.
If nbo, maybe it's good to replace of_graph.h with property.h.

>  #include <linux/pm_runtime.h>
> @@ -2946,6 +2947,12 @@ static const struct dev_pm_ops ov8865_pm_ops = {
>         SET_RUNTIME_PM_OPS(ov8865_suspend, ov8865_resume, NULL)
>  };
>
> +static const struct acpi_device_id ov8865_acpi_match[] = {
> +       {"INT347A"},
> +       { }
> +};
> +MODULE_DEVICE_TABLE(acpi, ov8865_acpi_match);
> +
>  static const struct of_device_id ov8865_of_match[] = {
>         { .compatible = "ovti,ov8865" },
>         { }
> @@ -2956,6 +2963,7 @@ static struct i2c_driver ov8865_driver = {
>         .driver = {
>                 .name = "ov8865",
>                 .of_match_table = ov8865_of_match,
> +               .acpi_match_table = ov8865_acpi_match,
>                 .pm = &ov8865_pm_ops,
>         },
>         .probe_new = ov8865_probe,
> --
> 2.25.1
>
Daniel Scally Nov. 1, 2021, 11:24 p.m. UTC | #2
On 01/11/2021 10:01, Andy Shevchenko wrote:
> On Mon, Nov 1, 2021 at 2:12 AM Daniel Scally <djrscally@gmail.com> wrote:
>> The ov8865 sensor is sometimes found on x86 platforms enumerated via ACPI.
>> Add an ACPI match table to the driver so that it's probed on those
>> platforms.
>>
>> Signed-off-by: Daniel Scally <djrscally@gmail.com>
>> ---
>>  drivers/media/i2c/ov8865.c | 8 ++++++++
>>  1 file changed, 8 insertions(+)
>>
>> diff --git a/drivers/media/i2c/ov8865.c b/drivers/media/i2c/ov8865.c
>> index ce50f3ea87b8..7626c8608f8f 100644
>> --- a/drivers/media/i2c/ov8865.c
>> +++ b/drivers/media/i2c/ov8865.c
>> @@ -9,6 +9,7 @@
>>  #include <linux/delay.h>
>>  #include <linux/device.h>
>>  #include <linux/i2c.h>
>> +#include <linux/mod_devicetable.h>
>>  #include <linux/module.h>
>>  #include <linux/of_graph.h>
> I'm wondering if the code even uses of_*() APIs.
> If nbo, maybe it's good to replace of_graph.h with property.h.


Yeah you're right; it doesn't use any of_*() calls. I'll add a patch

>>  #include <linux/pm_runtime.h>
>> @@ -2946,6 +2947,12 @@ static const struct dev_pm_ops ov8865_pm_ops = {
>>         SET_RUNTIME_PM_OPS(ov8865_suspend, ov8865_resume, NULL)
>>  };
>>
>> +static const struct acpi_device_id ov8865_acpi_match[] = {
>> +       {"INT347A"},
>> +       { }
>> +};
>> +MODULE_DEVICE_TABLE(acpi, ov8865_acpi_match);
>> +
>>  static const struct of_device_id ov8865_of_match[] = {
>>         { .compatible = "ovti,ov8865" },
>>         { }
>> @@ -2956,6 +2963,7 @@ static struct i2c_driver ov8865_driver = {
>>         .driver = {
>>                 .name = "ov8865",
>>                 .of_match_table = ov8865_of_match,
>> +               .acpi_match_table = ov8865_acpi_match,
>>                 .pm = &ov8865_pm_ops,
>>         },
>>         .probe_new = ov8865_probe,
>> --
>> 2.25.1
>>
>
diff mbox series

Patch

diff --git a/drivers/media/i2c/ov8865.c b/drivers/media/i2c/ov8865.c
index ce50f3ea87b8..7626c8608f8f 100644
--- a/drivers/media/i2c/ov8865.c
+++ b/drivers/media/i2c/ov8865.c
@@ -9,6 +9,7 @@ 
 #include <linux/delay.h>
 #include <linux/device.h>
 #include <linux/i2c.h>
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/of_graph.h>
 #include <linux/pm_runtime.h>
@@ -2946,6 +2947,12 @@  static const struct dev_pm_ops ov8865_pm_ops = {
 	SET_RUNTIME_PM_OPS(ov8865_suspend, ov8865_resume, NULL)
 };
 
+static const struct acpi_device_id ov8865_acpi_match[] = {
+	{"INT347A"},
+	{ }
+};
+MODULE_DEVICE_TABLE(acpi, ov8865_acpi_match);
+
 static const struct of_device_id ov8865_of_match[] = {
 	{ .compatible = "ovti,ov8865" },
 	{ }
@@ -2956,6 +2963,7 @@  static struct i2c_driver ov8865_driver = {
 	.driver = {
 		.name = "ov8865",
 		.of_match_table = ov8865_of_match,
+		.acpi_match_table = ov8865_acpi_match,
 		.pm = &ov8865_pm_ops,
 	},
 	.probe_new = ov8865_probe,