~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/sound/soc/codecs/es83xx-dsm-common.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0-only
  2 //
  3 // Copyright (c) Intel Corporation, 2022
  4 // Copyright Everest Semiconductor Co.,Ltd
  5 
  6 #include <linux/module.h>
  7 #include <linux/acpi.h>
  8 #include "es83xx-dsm-common.h"
  9 
 10 /* UUID ("a9800c04-e016-343e-41f4-6bcce70f4332") */
 11 static const guid_t es83xx_dsm_guid =
 12         GUID_INIT(0xa9800c04, 0xe016, 0x343e,
 13                   0x41, 0xf4, 0x6b, 0xcc, 0xe7, 0x0f, 0x43, 0x32);
 14 
 15 #define ES83xx_DSM_REVID 1
 16 
 17 int es83xx_dsm(struct device *dev, int arg, int *value)
 18 {
 19         acpi_handle dhandle;
 20         union acpi_object *obj;
 21         int ret = 0;
 22 
 23         dhandle = ACPI_HANDLE(dev);
 24         if (!dhandle)
 25                 return -ENOENT;
 26 
 27         obj = acpi_evaluate_dsm(dhandle, &es83xx_dsm_guid, ES83xx_DSM_REVID,
 28                                 arg, NULL);
 29         if (!obj) {
 30                 dev_err(dev, "%s: acpi_evaluate_dsm() failed\n", __func__);
 31                 ret = -EINVAL;
 32                 goto out;
 33         }
 34 
 35         if (obj->type != ACPI_TYPE_INTEGER) {
 36                 dev_err(dev, "%s: object is not ACPI_TYPE_INTEGER\n", __func__);
 37                 ret = -EINVAL;
 38                 goto err;
 39         }
 40 
 41         *value = obj->integer.value;
 42 err:
 43         ACPI_FREE(obj);
 44 out:
 45         return ret;
 46 }
 47 EXPORT_SYMBOL_GPL(es83xx_dsm);
 48 
 49 int es83xx_dsm_dump(struct device *dev)
 50 {
 51         int value;
 52         int ret;
 53 
 54         ret = es83xx_dsm(dev, PLATFORM_MAINMIC_TYPE_ARG, &value);
 55         if (ret < 0)
 56                 return ret;
 57         dev_info(dev, "PLATFORM_MAINMIC_TYPE %#x\n", value);
 58 
 59         ret = es83xx_dsm(dev, PLATFORM_HPMIC_TYPE_ARG, &value);
 60         if (ret < 0)
 61                 return ret;
 62         dev_info(dev, "PLATFORM_HPMIC_TYPE %#x\n", value);
 63 
 64         ret = es83xx_dsm(dev, PLATFORM_SPK_TYPE_ARG, &value);
 65         if (ret < 0)
 66                 return ret;
 67         dev_info(dev, "PLATFORM_SPK_TYPE %#x\n", value);
 68 
 69         ret = es83xx_dsm(dev, PLATFORM_HPDET_INV_ARG, &value);
 70         if (ret < 0)
 71                 return ret;
 72         dev_info(dev, "PLATFORM_HPDET_INV %#x\n", value);
 73 
 74         ret = es83xx_dsm(dev, PLATFORM_PCM_TYPE_ARG, &value);
 75         if (ret < 0)
 76                 return ret;
 77         dev_info(dev, "PLATFORM_PCM_TYPE %#x\n", value);
 78 
 79         ret = es83xx_dsm(dev, PLATFORM_MIC_DE_POP_ARG, &value);
 80         if (ret < 0)
 81                 return ret;
 82         dev_info(dev, "PLATFORM_MIC_DE_POP %#x\n", value);
 83 
 84         return 0;
 85 }
 86 EXPORT_SYMBOL_GPL(es83xx_dsm_dump);
 87 
 88 MODULE_DESCRIPTION("Everest Semi ES83xx DSM helpers");
 89 MODULE_LICENSE("GPL");
 90 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php