Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 57ede701 authored by Mattia Dongili's avatar Mattia Dongili Committed by Len Brown
Browse files

sony_acpi: Allow multiple sony_acpi_values for the same .name



The acpi handles are kept _only_ if both the requested .acpiget and .acpiset
are available in the DSDT.
Currently only the SCDP/CDPW dualism is known.

Signed-off-by: default avatarMattia Dongili <malattia@linux.it>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 4465857d
Loading
Loading
Loading
Loading
+25 −19
Original line number Diff line number Diff line
@@ -78,6 +78,7 @@ static struct sony_acpi_value {
	int			debug;	 /* active only in debug mode ? */
} sony_acpi_values[] = {
	{
		/* for backward compatibility only */
		.name		= "brightness",
		.acpiget	= "GBRT",
		.acpiset	= "SBRT",
@@ -106,6 +107,14 @@ static struct sony_acpi_value {
		.max		= 1,
		.debug		= 0,
	},
	{
		.name		= "cdpower",
		.acpiget	= "GCDP",
		.acpiset	= "CDPW",
		.min		= 0,
		.max		= 1,
		.debug		= 0,
	},
	{
		.name           = "audiopower",
		.acpiget        = "GAZP",
@@ -356,25 +365,22 @@ static int sony_acpi_add(struct acpi_device *device)
		if (!debug && item->debug)
			continue;

		if (item->acpiget &&
		    ACPI_SUCCESS(acpi_get_handle(sony_acpi_handle,
		if (item->acpiget) {
			if (ACPI_FAILURE(acpi_get_handle(sony_acpi_handle,
							item->acpiget, &handle)))
			proc_file_mode = S_IRUSR;
		else
			printk(LOG_PFX "unable to get ACPI handle for %s (get)\n",
					item->name);
				continue;

		if (item->acpiset &&
		    ACPI_SUCCESS(acpi_get_handle(sony_acpi_handle,
		    		 item->acpiset, &handle)))
			proc_file_mode |= S_IWUSR;
		else
			printk(LOG_PFX "unable to get ACPI handle for %s (set)\n",
					item->name);
			proc_file_mode |= S_IRUSR;
		}

		if (proc_file_mode == 0)
		if (item->acpiset) {
			if (ACPI_FAILURE(acpi_get_handle(sony_acpi_handle,
							item->acpiset, &handle)))
				continue;

			proc_file_mode |= S_IWUSR;
		}

		item->proc = create_proc_entry(item->name, proc_file_mode,
				acpi_device_dir(device));
		if (!item->proc) {