RE: [PATCH] platform/x86: dell-privacy: Add support for new privacy driver

From: Yuan, Perry
Date: Wed Nov 11 2020 - 02:21:38 EST


> -----Original Message-----
> From: Matthew Garrett <mjg59@xxxxxxxxxxxxx>
> Sent: Wednesday, November 4, 2020 9:49 AM
> To: Yuan, Perry
> Cc: hdegoede@xxxxxxxxxx; mgross@xxxxxxxxxxxxxxx; pali@xxxxxxxxxx; linux-
> kernel@xxxxxxxxxxxxxxx; platform-driver-x86@xxxxxxxxxxxxxxx; Limonciello,
> Mario
> Subject: Re: [PATCH] platform/x86: dell-privacy: Add support for new privacy
> driver
>
>
> [EXTERNAL EMAIL]
>
> On Tue, Nov 03, 2020 at 04:55:42AM -0800, Perry Yuan wrote:
>
> > +#define PRIVACY_PlATFORM_NAME "dell-privacy-acpi"
> > +#define ACPI_PRIVACY_DEVICE "\\_SB.PC00.LPCB.ECDV"
>
> This looks like the EC rather than a privacy device? If so, you probably want
> to collaborate with the EC driver to obtain the handle rather than depending
> on the path, unless it's guaranteed that this path will never change.

Thanks Matthew
I will change the path to handle as you suggested.


>
> > +static int micmute_led_set(struct led_classdev *led_cdev,
> > + enum led_brightness brightness) {
> > + acpi_status status;
> > +
> > + status = acpi_evaluate_object(NULL, ACPI_PRIVACY_EC_ACK, NULL,
> NULL);
> > + if (ACPI_FAILURE(status)) {
> > + dev_err(led_cdev->dev, "Error setting privacy audio EC ack
> value: %d\n",status);
> > + return -EIO;
> > + }
> > + return 0;
> > +}
>
> What's actually being set here? You don't seem to be passing any arguments.

Yes, it is a EC ack notification without any arguments needed.


>
> > +static const struct acpi_device_id privacy_acpi_device_ids[] = {
> > + {"PNP0C09", 0},
>
> Oooh no please don't do this - you'll trigger autoloading on everything that
> exposes a PNP0C09 device.

Got it , I need to adjust the driver register logic.
In drivers/platform/x86/dell-privacy-wmi.c .
The privacy acpi driver will be loaded by privacy wmi driver.
The privacy wmi driver need to check if the privacy device is present.
It can avoid loading driver on non-dell-privacy system.


+static const struct wmi_device_id dell_wmi_privacy_wmi_id_table[] = {
+ { .guid_string = DELL_PRIVACY_GUID },
+ { },




>
> --
> Matthew Garrett | mjg59@xxxxxxxxxxxxx