acpi_lpss.c 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162
  1. /*
  2. * ACPI support for Intel Lynxpoint LPSS.
  3. *
  4. * Copyright (C) 2013, Intel Corporation
  5. * Authors: Mika Westerberg <mika.westerberg@linux.intel.com>
  6. * Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #include <linux/acpi.h>
  13. #include <linux/clkdev.h>
  14. #include <linux/clk-provider.h>
  15. #include <linux/err.h>
  16. #include <linux/io.h>
  17. #include <linux/mutex.h>
  18. #include <linux/platform_device.h>
  19. #include <linux/platform_data/clk-lpss.h>
  20. #include <linux/platform_data/x86/pmc_atom.h>
  21. #include <linux/pm_domain.h>
  22. #include <linux/pm_runtime.h>
  23. #include <linux/pwm.h>
  24. #include <linux/delay.h>
  25. #include "internal.h"
  26. ACPI_MODULE_NAME("acpi_lpss");
  27. #ifdef CONFIG_X86_INTEL_LPSS
  28. #include <asm/cpu_device_id.h>
  29. #include <asm/intel-family.h>
  30. #include <asm/iosf_mbi.h>
  31. #define LPSS_ADDR(desc) ((unsigned long)&desc)
  32. #define LPSS_CLK_SIZE 0x04
  33. #define LPSS_LTR_SIZE 0x18
  34. /* Offsets relative to LPSS_PRIVATE_OFFSET */
  35. #define LPSS_CLK_DIVIDER_DEF_MASK (BIT(1) | BIT(16))
  36. #define LPSS_RESETS 0x04
  37. #define LPSS_RESETS_RESET_FUNC BIT(0)
  38. #define LPSS_RESETS_RESET_APB BIT(1)
  39. #define LPSS_GENERAL 0x08
  40. #define LPSS_GENERAL_LTR_MODE_SW BIT(2)
  41. #define LPSS_GENERAL_UART_RTS_OVRD BIT(3)
  42. #define LPSS_SW_LTR 0x10
  43. #define LPSS_AUTO_LTR 0x14
  44. #define LPSS_LTR_SNOOP_REQ BIT(15)
  45. #define LPSS_LTR_SNOOP_MASK 0x0000FFFF
  46. #define LPSS_LTR_SNOOP_LAT_1US 0x800
  47. #define LPSS_LTR_SNOOP_LAT_32US 0xC00
  48. #define LPSS_LTR_SNOOP_LAT_SHIFT 5
  49. #define LPSS_LTR_SNOOP_LAT_CUTOFF 3000
  50. #define LPSS_LTR_MAX_VAL 0x3FF
  51. #define LPSS_TX_INT 0x20
  52. #define LPSS_TX_INT_MASK BIT(1)
  53. #define LPSS_PRV_REG_COUNT 9
  54. /* LPSS Flags */
  55. #define LPSS_CLK BIT(0)
  56. #define LPSS_CLK_GATE BIT(1)
  57. #define LPSS_CLK_DIVIDER BIT(2)
  58. #define LPSS_LTR BIT(3)
  59. #define LPSS_SAVE_CTX BIT(4)
  60. #define LPSS_NO_D3_DELAY BIT(5)
  61. struct lpss_private_data;
  62. struct lpss_device_desc {
  63. unsigned int flags;
  64. const char *clk_con_id;
  65. unsigned int prv_offset;
  66. size_t prv_size_override;
  67. struct property_entry *properties;
  68. void (*setup)(struct lpss_private_data *pdata);
  69. };
  70. static const struct lpss_device_desc lpss_dma_desc = {
  71. .flags = LPSS_CLK,
  72. };
  73. struct lpss_private_data {
  74. struct acpi_device *adev;
  75. void __iomem *mmio_base;
  76. resource_size_t mmio_size;
  77. unsigned int fixed_clk_rate;
  78. struct clk *clk;
  79. const struct lpss_device_desc *dev_desc;
  80. u32 prv_reg_ctx[LPSS_PRV_REG_COUNT];
  81. };
  82. /* LPSS run time quirks */
  83. static unsigned int lpss_quirks;
  84. /*
  85. * LPSS_QUIRK_ALWAYS_POWER_ON: override power state for LPSS DMA device.
  86. *
  87. * The LPSS DMA controller has neither _PS0 nor _PS3 method. Moreover
  88. * it can be powered off automatically whenever the last LPSS device goes down.
  89. * In case of no power any access to the DMA controller will hang the system.
  90. * The behaviour is reproduced on some HP laptops based on Intel BayTrail as
  91. * well as on ASuS T100TA transformer.
  92. *
  93. * This quirk overrides power state of entire LPSS island to keep DMA powered
  94. * on whenever we have at least one other device in use.
  95. */
  96. #define LPSS_QUIRK_ALWAYS_POWER_ON BIT(0)
  97. /* UART Component Parameter Register */
  98. #define LPSS_UART_CPR 0xF4
  99. #define LPSS_UART_CPR_AFCE BIT(4)
  100. static void lpss_uart_setup(struct lpss_private_data *pdata)
  101. {
  102. unsigned int offset;
  103. u32 val;
  104. offset = pdata->dev_desc->prv_offset + LPSS_TX_INT;
  105. val = readl(pdata->mmio_base + offset);
  106. writel(val | LPSS_TX_INT_MASK, pdata->mmio_base + offset);
  107. val = readl(pdata->mmio_base + LPSS_UART_CPR);
  108. if (!(val & LPSS_UART_CPR_AFCE)) {
  109. offset = pdata->dev_desc->prv_offset + LPSS_GENERAL;
  110. val = readl(pdata->mmio_base + offset);
  111. val |= LPSS_GENERAL_UART_RTS_OVRD;
  112. writel(val, pdata->mmio_base + offset);
  113. }
  114. }
  115. static void lpss_deassert_reset(struct lpss_private_data *pdata)
  116. {
  117. unsigned int offset;
  118. u32 val;
  119. offset = pdata->dev_desc->prv_offset + LPSS_RESETS;
  120. val = readl(pdata->mmio_base + offset);
  121. val |= LPSS_RESETS_RESET_APB | LPSS_RESETS_RESET_FUNC;
  122. writel(val, pdata->mmio_base + offset);
  123. }
  124. /*
  125. * BYT PWM used for backlight control by the i915 driver on systems without
  126. * the Crystal Cove PMIC.
  127. */
  128. static struct pwm_lookup byt_pwm_lookup[] = {
  129. PWM_LOOKUP_WITH_MODULE("80860F09:00", 0, "0000:00:02.0",
  130. "pwm_backlight", 0, PWM_POLARITY_NORMAL,
  131. "pwm-lpss-platform"),
  132. };
  133. static void byt_pwm_setup(struct lpss_private_data *pdata)
  134. {
  135. struct acpi_device *adev = pdata->adev;
  136. /* Only call pwm_add_table for the first PWM controller */
  137. if (!adev->pnp.unique_id || strcmp(adev->pnp.unique_id, "1"))
  138. return;
  139. if (!acpi_dev_present("INT33FD", NULL, -1))
  140. pwm_add_table(byt_pwm_lookup, ARRAY_SIZE(byt_pwm_lookup));
  141. }
  142. #define LPSS_I2C_ENABLE 0x6c
  143. static void byt_i2c_setup(struct lpss_private_data *pdata)
  144. {
  145. lpss_deassert_reset(pdata);
  146. if (readl(pdata->mmio_base + pdata->dev_desc->prv_offset))
  147. pdata->fixed_clk_rate = 133000000;
  148. writel(0, pdata->mmio_base + LPSS_I2C_ENABLE);
  149. }
  150. /* BSW PWM used for backlight control by the i915 driver */
  151. static struct pwm_lookup bsw_pwm_lookup[] = {
  152. PWM_LOOKUP_WITH_MODULE("80862288:00", 0, "0000:00:02.0",
  153. "pwm_backlight", 0, PWM_POLARITY_NORMAL,
  154. "pwm-lpss-platform"),
  155. };
  156. static void bsw_pwm_setup(struct lpss_private_data *pdata)
  157. {
  158. struct acpi_device *adev = pdata->adev;
  159. /* Only call pwm_add_table for the first PWM controller */
  160. if (!adev->pnp.unique_id || strcmp(adev->pnp.unique_id, "1"))
  161. return;
  162. pwm_add_table(bsw_pwm_lookup, ARRAY_SIZE(bsw_pwm_lookup));
  163. }
  164. static const struct lpss_device_desc lpt_dev_desc = {
  165. .flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_CLK_DIVIDER | LPSS_LTR,
  166. .prv_offset = 0x800,
  167. };
  168. static const struct lpss_device_desc lpt_i2c_dev_desc = {
  169. .flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_LTR,
  170. .prv_offset = 0x800,
  171. };
  172. static struct property_entry uart_properties[] = {
  173. PROPERTY_ENTRY_U32("reg-io-width", 4),
  174. PROPERTY_ENTRY_U32("reg-shift", 2),
  175. PROPERTY_ENTRY_BOOL("snps,uart-16550-compatible"),
  176. { },
  177. };
  178. static const struct lpss_device_desc lpt_uart_dev_desc = {
  179. .flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_CLK_DIVIDER | LPSS_LTR,
  180. .clk_con_id = "baudclk",
  181. .prv_offset = 0x800,
  182. .setup = lpss_uart_setup,
  183. .properties = uart_properties,
  184. };
  185. static const struct lpss_device_desc lpt_sdio_dev_desc = {
  186. .flags = LPSS_LTR,
  187. .prv_offset = 0x1000,
  188. .prv_size_override = 0x1018,
  189. };
  190. static const struct lpss_device_desc byt_pwm_dev_desc = {
  191. .flags = LPSS_SAVE_CTX,
  192. .setup = byt_pwm_setup,
  193. };
  194. static const struct lpss_device_desc bsw_pwm_dev_desc = {
  195. .flags = LPSS_SAVE_CTX | LPSS_NO_D3_DELAY,
  196. .setup = bsw_pwm_setup,
  197. };
  198. static const struct lpss_device_desc byt_uart_dev_desc = {
  199. .flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_CLK_DIVIDER | LPSS_SAVE_CTX,
  200. .clk_con_id = "baudclk",
  201. .prv_offset = 0x800,
  202. .setup = lpss_uart_setup,
  203. .properties = uart_properties,
  204. };
  205. static const struct lpss_device_desc bsw_uart_dev_desc = {
  206. .flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_CLK_DIVIDER | LPSS_SAVE_CTX
  207. | LPSS_NO_D3_DELAY,
  208. .clk_con_id = "baudclk",
  209. .prv_offset = 0x800,
  210. .setup = lpss_uart_setup,
  211. .properties = uart_properties,
  212. };
  213. static const struct lpss_device_desc byt_spi_dev_desc = {
  214. .flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_CLK_DIVIDER | LPSS_SAVE_CTX,
  215. .prv_offset = 0x400,
  216. };
  217. static const struct lpss_device_desc byt_sdio_dev_desc = {
  218. .flags = LPSS_CLK,
  219. };
  220. static const struct lpss_device_desc byt_i2c_dev_desc = {
  221. .flags = LPSS_CLK | LPSS_SAVE_CTX,
  222. .prv_offset = 0x800,
  223. .setup = byt_i2c_setup,
  224. };
  225. static const struct lpss_device_desc bsw_i2c_dev_desc = {
  226. .flags = LPSS_CLK | LPSS_SAVE_CTX | LPSS_NO_D3_DELAY,
  227. .prv_offset = 0x800,
  228. .setup = byt_i2c_setup,
  229. };
  230. static const struct lpss_device_desc bsw_spi_dev_desc = {
  231. .flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_CLK_DIVIDER | LPSS_SAVE_CTX
  232. | LPSS_NO_D3_DELAY,
  233. .prv_offset = 0x400,
  234. .setup = lpss_deassert_reset,
  235. };
  236. #define ICPU(model) { X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, }
  237. static const struct x86_cpu_id lpss_cpu_ids[] = {
  238. ICPU(INTEL_FAM6_ATOM_SILVERMONT1), /* Valleyview, Bay Trail */
  239. ICPU(INTEL_FAM6_ATOM_AIRMONT), /* Braswell, Cherry Trail */
  240. {}
  241. };
  242. #else
  243. #define LPSS_ADDR(desc) (0UL)
  244. #endif /* CONFIG_X86_INTEL_LPSS */
  245. static const struct acpi_device_id acpi_lpss_device_ids[] = {
  246. /* Generic LPSS devices */
  247. { "INTL9C60", LPSS_ADDR(lpss_dma_desc) },
  248. /* Lynxpoint LPSS devices */
  249. { "INT33C0", LPSS_ADDR(lpt_dev_desc) },
  250. { "INT33C1", LPSS_ADDR(lpt_dev_desc) },
  251. { "INT33C2", LPSS_ADDR(lpt_i2c_dev_desc) },
  252. { "INT33C3", LPSS_ADDR(lpt_i2c_dev_desc) },
  253. { "INT33C4", LPSS_ADDR(lpt_uart_dev_desc) },
  254. { "INT33C5", LPSS_ADDR(lpt_uart_dev_desc) },
  255. { "INT33C6", LPSS_ADDR(lpt_sdio_dev_desc) },
  256. { "INT33C7", },
  257. /* BayTrail LPSS devices */
  258. { "80860F09", LPSS_ADDR(byt_pwm_dev_desc) },
  259. { "80860F0A", LPSS_ADDR(byt_uart_dev_desc) },
  260. { "80860F0E", LPSS_ADDR(byt_spi_dev_desc) },
  261. { "80860F14", LPSS_ADDR(byt_sdio_dev_desc) },
  262. { "80860F41", LPSS_ADDR(byt_i2c_dev_desc) },
  263. { "INT33B2", },
  264. { "INT33FC", },
  265. /* Braswell LPSS devices */
  266. { "80862288", LPSS_ADDR(bsw_pwm_dev_desc) },
  267. { "8086228A", LPSS_ADDR(bsw_uart_dev_desc) },
  268. { "8086228E", LPSS_ADDR(bsw_spi_dev_desc) },
  269. { "808622C1", LPSS_ADDR(bsw_i2c_dev_desc) },
  270. /* Broadwell LPSS devices */
  271. { "INT3430", LPSS_ADDR(lpt_dev_desc) },
  272. { "INT3431", LPSS_ADDR(lpt_dev_desc) },
  273. { "INT3432", LPSS_ADDR(lpt_i2c_dev_desc) },
  274. { "INT3433", LPSS_ADDR(lpt_i2c_dev_desc) },
  275. { "INT3434", LPSS_ADDR(lpt_uart_dev_desc) },
  276. { "INT3435", LPSS_ADDR(lpt_uart_dev_desc) },
  277. { "INT3436", LPSS_ADDR(lpt_sdio_dev_desc) },
  278. { "INT3437", },
  279. /* Wildcat Point LPSS devices */
  280. { "INT3438", LPSS_ADDR(lpt_dev_desc) },
  281. { }
  282. };
  283. #ifdef CONFIG_X86_INTEL_LPSS
  284. static int is_memory(struct acpi_resource *res, void *not_used)
  285. {
  286. struct resource r;
  287. return !acpi_dev_resource_memory(res, &r);
  288. }
  289. /* LPSS main clock device. */
  290. static struct platform_device *lpss_clk_dev;
  291. static inline void lpt_register_clock_device(void)
  292. {
  293. lpss_clk_dev = platform_device_register_simple("clk-lpt", -1, NULL, 0);
  294. }
  295. static int register_device_clock(struct acpi_device *adev,
  296. struct lpss_private_data *pdata)
  297. {
  298. const struct lpss_device_desc *dev_desc = pdata->dev_desc;
  299. const char *devname = dev_name(&adev->dev);
  300. struct clk *clk;
  301. struct lpss_clk_data *clk_data;
  302. const char *parent, *clk_name;
  303. void __iomem *prv_base;
  304. if (!lpss_clk_dev)
  305. lpt_register_clock_device();
  306. clk_data = platform_get_drvdata(lpss_clk_dev);
  307. if (!clk_data)
  308. return -ENODEV;
  309. clk = clk_data->clk;
  310. if (!pdata->mmio_base
  311. || pdata->mmio_size < dev_desc->prv_offset + LPSS_CLK_SIZE)
  312. return -ENODATA;
  313. parent = clk_data->name;
  314. prv_base = pdata->mmio_base + dev_desc->prv_offset;
  315. if (pdata->fixed_clk_rate) {
  316. clk = clk_register_fixed_rate(NULL, devname, parent, 0,
  317. pdata->fixed_clk_rate);
  318. goto out;
  319. }
  320. if (dev_desc->flags & LPSS_CLK_GATE) {
  321. clk = clk_register_gate(NULL, devname, parent, 0,
  322. prv_base, 0, 0, NULL);
  323. parent = devname;
  324. }
  325. if (dev_desc->flags & LPSS_CLK_DIVIDER) {
  326. /* Prevent division by zero */
  327. if (!readl(prv_base))
  328. writel(LPSS_CLK_DIVIDER_DEF_MASK, prv_base);
  329. clk_name = kasprintf(GFP_KERNEL, "%s-div", devname);
  330. if (!clk_name)
  331. return -ENOMEM;
  332. clk = clk_register_fractional_divider(NULL, clk_name, parent,
  333. 0, prv_base,
  334. 1, 15, 16, 15, 0, NULL);
  335. parent = clk_name;
  336. clk_name = kasprintf(GFP_KERNEL, "%s-update", devname);
  337. if (!clk_name) {
  338. kfree(parent);
  339. return -ENOMEM;
  340. }
  341. clk = clk_register_gate(NULL, clk_name, parent,
  342. CLK_SET_RATE_PARENT | CLK_SET_RATE_GATE,
  343. prv_base, 31, 0, NULL);
  344. kfree(parent);
  345. kfree(clk_name);
  346. }
  347. out:
  348. if (IS_ERR(clk))
  349. return PTR_ERR(clk);
  350. pdata->clk = clk;
  351. clk_register_clkdev(clk, dev_desc->clk_con_id, devname);
  352. return 0;
  353. }
  354. struct lpss_device_links {
  355. const char *supplier_hid;
  356. const char *supplier_uid;
  357. const char *consumer_hid;
  358. const char *consumer_uid;
  359. u32 flags;
  360. };
  361. /*
  362. * The _DEP method is used to identify dependencies but instead of creating
  363. * device links for every handle in _DEP, only links in the following list are
  364. * created. That is necessary because, in the general case, _DEP can refer to
  365. * devices that might not have drivers, or that are on different buses, or where
  366. * the supplier is not enumerated until after the consumer is probed.
  367. */
  368. static const struct lpss_device_links lpss_device_links[] = {
  369. {"808622C1", "7", "80860F14", "3", DL_FLAG_PM_RUNTIME},
  370. };
  371. static bool hid_uid_match(const char *hid1, const char *uid1,
  372. const char *hid2, const char *uid2)
  373. {
  374. return !strcmp(hid1, hid2) && uid1 && uid2 && !strcmp(uid1, uid2);
  375. }
  376. static bool acpi_lpss_is_supplier(struct acpi_device *adev,
  377. const struct lpss_device_links *link)
  378. {
  379. return hid_uid_match(acpi_device_hid(adev), acpi_device_uid(adev),
  380. link->supplier_hid, link->supplier_uid);
  381. }
  382. static bool acpi_lpss_is_consumer(struct acpi_device *adev,
  383. const struct lpss_device_links *link)
  384. {
  385. return hid_uid_match(acpi_device_hid(adev), acpi_device_uid(adev),
  386. link->consumer_hid, link->consumer_uid);
  387. }
  388. struct hid_uid {
  389. const char *hid;
  390. const char *uid;
  391. };
  392. static int match_hid_uid(struct device *dev, void *data)
  393. {
  394. struct acpi_device *adev = ACPI_COMPANION(dev);
  395. struct hid_uid *id = data;
  396. if (!adev)
  397. return 0;
  398. return hid_uid_match(acpi_device_hid(adev), acpi_device_uid(adev),
  399. id->hid, id->uid);
  400. }
  401. static struct device *acpi_lpss_find_device(const char *hid, const char *uid)
  402. {
  403. struct hid_uid data = {
  404. .hid = hid,
  405. .uid = uid,
  406. };
  407. return bus_find_device(&platform_bus_type, NULL, &data, match_hid_uid);
  408. }
  409. static bool acpi_lpss_dep(struct acpi_device *adev, acpi_handle handle)
  410. {
  411. struct acpi_handle_list dep_devices;
  412. acpi_status status;
  413. int i;
  414. if (!acpi_has_method(adev->handle, "_DEP"))
  415. return false;
  416. status = acpi_evaluate_reference(adev->handle, "_DEP", NULL,
  417. &dep_devices);
  418. if (ACPI_FAILURE(status)) {
  419. dev_dbg(&adev->dev, "Failed to evaluate _DEP.\n");
  420. return false;
  421. }
  422. for (i = 0; i < dep_devices.count; i++) {
  423. if (dep_devices.handles[i] == handle)
  424. return true;
  425. }
  426. return false;
  427. }
  428. static void acpi_lpss_link_consumer(struct device *dev1,
  429. const struct lpss_device_links *link)
  430. {
  431. struct device *dev2;
  432. dev2 = acpi_lpss_find_device(link->consumer_hid, link->consumer_uid);
  433. if (!dev2)
  434. return;
  435. if (acpi_lpss_dep(ACPI_COMPANION(dev2), ACPI_HANDLE(dev1)))
  436. device_link_add(dev2, dev1, link->flags);
  437. put_device(dev2);
  438. }
  439. static void acpi_lpss_link_supplier(struct device *dev1,
  440. const struct lpss_device_links *link)
  441. {
  442. struct device *dev2;
  443. dev2 = acpi_lpss_find_device(link->supplier_hid, link->supplier_uid);
  444. if (!dev2)
  445. return;
  446. if (acpi_lpss_dep(ACPI_COMPANION(dev1), ACPI_HANDLE(dev2)))
  447. device_link_add(dev1, dev2, link->flags);
  448. put_device(dev2);
  449. }
  450. static void acpi_lpss_create_device_links(struct acpi_device *adev,
  451. struct platform_device *pdev)
  452. {
  453. int i;
  454. for (i = 0; i < ARRAY_SIZE(lpss_device_links); i++) {
  455. const struct lpss_device_links *link = &lpss_device_links[i];
  456. if (acpi_lpss_is_supplier(adev, link))
  457. acpi_lpss_link_consumer(&pdev->dev, link);
  458. if (acpi_lpss_is_consumer(adev, link))
  459. acpi_lpss_link_supplier(&pdev->dev, link);
  460. }
  461. }
  462. static int acpi_lpss_create_device(struct acpi_device *adev,
  463. const struct acpi_device_id *id)
  464. {
  465. const struct lpss_device_desc *dev_desc;
  466. struct lpss_private_data *pdata;
  467. struct resource_entry *rentry;
  468. struct list_head resource_list;
  469. struct platform_device *pdev;
  470. int ret;
  471. dev_desc = (const struct lpss_device_desc *)id->driver_data;
  472. if (!dev_desc) {
  473. pdev = acpi_create_platform_device(adev, NULL);
  474. return IS_ERR_OR_NULL(pdev) ? PTR_ERR(pdev) : 1;
  475. }
  476. pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
  477. if (!pdata)
  478. return -ENOMEM;
  479. INIT_LIST_HEAD(&resource_list);
  480. ret = acpi_dev_get_resources(adev, &resource_list, is_memory, NULL);
  481. if (ret < 0)
  482. goto err_out;
  483. list_for_each_entry(rentry, &resource_list, node)
  484. if (resource_type(rentry->res) == IORESOURCE_MEM) {
  485. if (dev_desc->prv_size_override)
  486. pdata->mmio_size = dev_desc->prv_size_override;
  487. else
  488. pdata->mmio_size = resource_size(rentry->res);
  489. pdata->mmio_base = ioremap(rentry->res->start,
  490. pdata->mmio_size);
  491. break;
  492. }
  493. acpi_dev_free_resource_list(&resource_list);
  494. if (!pdata->mmio_base) {
  495. /* Avoid acpi_bus_attach() instantiating a pdev for this dev. */
  496. adev->pnp.type.platform_id = 0;
  497. /* Skip the device, but continue the namespace scan. */
  498. ret = 0;
  499. goto err_out;
  500. }
  501. pdata->adev = adev;
  502. pdata->dev_desc = dev_desc;
  503. if (dev_desc->setup)
  504. dev_desc->setup(pdata);
  505. if (dev_desc->flags & LPSS_CLK) {
  506. ret = register_device_clock(adev, pdata);
  507. if (ret) {
  508. /* Skip the device, but continue the namespace scan. */
  509. ret = 0;
  510. goto err_out;
  511. }
  512. }
  513. /*
  514. * This works around a known issue in ACPI tables where LPSS devices
  515. * have _PS0 and _PS3 without _PSC (and no power resources), so
  516. * acpi_bus_init_power() will assume that the BIOS has put them into D0.
  517. */
  518. ret = acpi_device_fix_up_power(adev);
  519. if (ret) {
  520. /* Skip the device, but continue the namespace scan. */
  521. ret = 0;
  522. goto err_out;
  523. }
  524. adev->driver_data = pdata;
  525. pdev = acpi_create_platform_device(adev, dev_desc->properties);
  526. if (!IS_ERR_OR_NULL(pdev)) {
  527. acpi_lpss_create_device_links(adev, pdev);
  528. return 1;
  529. }
  530. ret = PTR_ERR(pdev);
  531. adev->driver_data = NULL;
  532. err_out:
  533. kfree(pdata);
  534. return ret;
  535. }
  536. static u32 __lpss_reg_read(struct lpss_private_data *pdata, unsigned int reg)
  537. {
  538. return readl(pdata->mmio_base + pdata->dev_desc->prv_offset + reg);
  539. }
  540. static void __lpss_reg_write(u32 val, struct lpss_private_data *pdata,
  541. unsigned int reg)
  542. {
  543. writel(val, pdata->mmio_base + pdata->dev_desc->prv_offset + reg);
  544. }
  545. static int lpss_reg_read(struct device *dev, unsigned int reg, u32 *val)
  546. {
  547. struct acpi_device *adev;
  548. struct lpss_private_data *pdata;
  549. unsigned long flags;
  550. int ret;
  551. ret = acpi_bus_get_device(ACPI_HANDLE(dev), &adev);
  552. if (WARN_ON(ret))
  553. return ret;
  554. spin_lock_irqsave(&dev->power.lock, flags);
  555. if (pm_runtime_suspended(dev)) {
  556. ret = -EAGAIN;
  557. goto out;
  558. }
  559. pdata = acpi_driver_data(adev);
  560. if (WARN_ON(!pdata || !pdata->mmio_base)) {
  561. ret = -ENODEV;
  562. goto out;
  563. }
  564. *val = __lpss_reg_read(pdata, reg);
  565. out:
  566. spin_unlock_irqrestore(&dev->power.lock, flags);
  567. return ret;
  568. }
  569. static ssize_t lpss_ltr_show(struct device *dev, struct device_attribute *attr,
  570. char *buf)
  571. {
  572. u32 ltr_value = 0;
  573. unsigned int reg;
  574. int ret;
  575. reg = strcmp(attr->attr.name, "auto_ltr") ? LPSS_SW_LTR : LPSS_AUTO_LTR;
  576. ret = lpss_reg_read(dev, reg, &ltr_value);
  577. if (ret)
  578. return ret;
  579. return snprintf(buf, PAGE_SIZE, "%08x\n", ltr_value);
  580. }
  581. static ssize_t lpss_ltr_mode_show(struct device *dev,
  582. struct device_attribute *attr, char *buf)
  583. {
  584. u32 ltr_mode = 0;
  585. char *outstr;
  586. int ret;
  587. ret = lpss_reg_read(dev, LPSS_GENERAL, &ltr_mode);
  588. if (ret)
  589. return ret;
  590. outstr = (ltr_mode & LPSS_GENERAL_LTR_MODE_SW) ? "sw" : "auto";
  591. return sprintf(buf, "%s\n", outstr);
  592. }
  593. static DEVICE_ATTR(auto_ltr, S_IRUSR, lpss_ltr_show, NULL);
  594. static DEVICE_ATTR(sw_ltr, S_IRUSR, lpss_ltr_show, NULL);
  595. static DEVICE_ATTR(ltr_mode, S_IRUSR, lpss_ltr_mode_show, NULL);
  596. static struct attribute *lpss_attrs[] = {
  597. &dev_attr_auto_ltr.attr,
  598. &dev_attr_sw_ltr.attr,
  599. &dev_attr_ltr_mode.attr,
  600. NULL,
  601. };
  602. static const struct attribute_group lpss_attr_group = {
  603. .attrs = lpss_attrs,
  604. .name = "lpss_ltr",
  605. };
  606. static void acpi_lpss_set_ltr(struct device *dev, s32 val)
  607. {
  608. struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev));
  609. u32 ltr_mode, ltr_val;
  610. ltr_mode = __lpss_reg_read(pdata, LPSS_GENERAL);
  611. if (val < 0) {
  612. if (ltr_mode & LPSS_GENERAL_LTR_MODE_SW) {
  613. ltr_mode &= ~LPSS_GENERAL_LTR_MODE_SW;
  614. __lpss_reg_write(ltr_mode, pdata, LPSS_GENERAL);
  615. }
  616. return;
  617. }
  618. ltr_val = __lpss_reg_read(pdata, LPSS_SW_LTR) & ~LPSS_LTR_SNOOP_MASK;
  619. if (val >= LPSS_LTR_SNOOP_LAT_CUTOFF) {
  620. ltr_val |= LPSS_LTR_SNOOP_LAT_32US;
  621. val = LPSS_LTR_MAX_VAL;
  622. } else if (val > LPSS_LTR_MAX_VAL) {
  623. ltr_val |= LPSS_LTR_SNOOP_LAT_32US | LPSS_LTR_SNOOP_REQ;
  624. val >>= LPSS_LTR_SNOOP_LAT_SHIFT;
  625. } else {
  626. ltr_val |= LPSS_LTR_SNOOP_LAT_1US | LPSS_LTR_SNOOP_REQ;
  627. }
  628. ltr_val |= val;
  629. __lpss_reg_write(ltr_val, pdata, LPSS_SW_LTR);
  630. if (!(ltr_mode & LPSS_GENERAL_LTR_MODE_SW)) {
  631. ltr_mode |= LPSS_GENERAL_LTR_MODE_SW;
  632. __lpss_reg_write(ltr_mode, pdata, LPSS_GENERAL);
  633. }
  634. }
  635. #ifdef CONFIG_PM
  636. /**
  637. * acpi_lpss_save_ctx() - Save the private registers of LPSS device
  638. * @dev: LPSS device
  639. * @pdata: pointer to the private data of the LPSS device
  640. *
  641. * Most LPSS devices have private registers which may loose their context when
  642. * the device is powered down. acpi_lpss_save_ctx() saves those registers into
  643. * prv_reg_ctx array.
  644. */
  645. static void acpi_lpss_save_ctx(struct device *dev,
  646. struct lpss_private_data *pdata)
  647. {
  648. unsigned int i;
  649. for (i = 0; i < LPSS_PRV_REG_COUNT; i++) {
  650. unsigned long offset = i * sizeof(u32);
  651. pdata->prv_reg_ctx[i] = __lpss_reg_read(pdata, offset);
  652. dev_dbg(dev, "saving 0x%08x from LPSS reg at offset 0x%02lx\n",
  653. pdata->prv_reg_ctx[i], offset);
  654. }
  655. }
  656. /**
  657. * acpi_lpss_restore_ctx() - Restore the private registers of LPSS device
  658. * @dev: LPSS device
  659. * @pdata: pointer to the private data of the LPSS device
  660. *
  661. * Restores the registers that were previously stored with acpi_lpss_save_ctx().
  662. */
  663. static void acpi_lpss_restore_ctx(struct device *dev,
  664. struct lpss_private_data *pdata)
  665. {
  666. unsigned int i;
  667. for (i = 0; i < LPSS_PRV_REG_COUNT; i++) {
  668. unsigned long offset = i * sizeof(u32);
  669. __lpss_reg_write(pdata->prv_reg_ctx[i], pdata, offset);
  670. dev_dbg(dev, "restoring 0x%08x to LPSS reg at offset 0x%02lx\n",
  671. pdata->prv_reg_ctx[i], offset);
  672. }
  673. }
  674. static void acpi_lpss_d3_to_d0_delay(struct lpss_private_data *pdata)
  675. {
  676. /*
  677. * The following delay is needed or the subsequent write operations may
  678. * fail. The LPSS devices are actually PCI devices and the PCI spec
  679. * expects 10ms delay before the device can be accessed after D3 to D0
  680. * transition. However some platforms like BSW does not need this delay.
  681. */
  682. unsigned int delay = 10; /* default 10ms delay */
  683. if (pdata->dev_desc->flags & LPSS_NO_D3_DELAY)
  684. delay = 0;
  685. msleep(delay);
  686. }
  687. static int acpi_lpss_activate(struct device *dev)
  688. {
  689. struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev));
  690. int ret;
  691. ret = acpi_dev_resume(dev);
  692. if (ret)
  693. return ret;
  694. acpi_lpss_d3_to_d0_delay(pdata);
  695. /*
  696. * This is called only on ->probe() stage where a device is either in
  697. * known state defined by BIOS or most likely powered off. Due to this
  698. * we have to deassert reset line to be sure that ->probe() will
  699. * recognize the device.
  700. */
  701. if (pdata->dev_desc->flags & LPSS_SAVE_CTX)
  702. lpss_deassert_reset(pdata);
  703. return 0;
  704. }
  705. static void acpi_lpss_dismiss(struct device *dev)
  706. {
  707. acpi_dev_suspend(dev, false);
  708. }
  709. /* IOSF SB for LPSS island */
  710. #define LPSS_IOSF_UNIT_LPIOEP 0xA0
  711. #define LPSS_IOSF_UNIT_LPIO1 0xAB
  712. #define LPSS_IOSF_UNIT_LPIO2 0xAC
  713. #define LPSS_IOSF_PMCSR 0x84
  714. #define LPSS_PMCSR_D0 0
  715. #define LPSS_PMCSR_D3hot 3
  716. #define LPSS_PMCSR_Dx_MASK GENMASK(1, 0)
  717. #define LPSS_IOSF_GPIODEF0 0x154
  718. #define LPSS_GPIODEF0_DMA1_D3 BIT(2)
  719. #define LPSS_GPIODEF0_DMA2_D3 BIT(3)
  720. #define LPSS_GPIODEF0_DMA_D3_MASK GENMASK(3, 2)
  721. #define LPSS_GPIODEF0_DMA_LLP BIT(13)
  722. static DEFINE_MUTEX(lpss_iosf_mutex);
  723. static void lpss_iosf_enter_d3_state(void)
  724. {
  725. u32 value1 = 0;
  726. u32 mask1 = LPSS_GPIODEF0_DMA_D3_MASK | LPSS_GPIODEF0_DMA_LLP;
  727. u32 value2 = LPSS_PMCSR_D3hot;
  728. u32 mask2 = LPSS_PMCSR_Dx_MASK;
  729. /*
  730. * PMC provides an information about actual status of the LPSS devices.
  731. * Here we read the values related to LPSS power island, i.e. LPSS
  732. * devices, excluding both LPSS DMA controllers, along with SCC domain.
  733. */
  734. u32 func_dis, d3_sts_0, pmc_status, pmc_mask = 0xfe000ffe;
  735. int ret;
  736. ret = pmc_atom_read(PMC_FUNC_DIS, &func_dis);
  737. if (ret)
  738. return;
  739. mutex_lock(&lpss_iosf_mutex);
  740. ret = pmc_atom_read(PMC_D3_STS_0, &d3_sts_0);
  741. if (ret)
  742. goto exit;
  743. /*
  744. * Get the status of entire LPSS power island per device basis.
  745. * Shutdown both LPSS DMA controllers if and only if all other devices
  746. * are already in D3hot.
  747. */
  748. pmc_status = (~(d3_sts_0 | func_dis)) & pmc_mask;
  749. if (pmc_status)
  750. goto exit;
  751. iosf_mbi_modify(LPSS_IOSF_UNIT_LPIO1, MBI_CFG_WRITE,
  752. LPSS_IOSF_PMCSR, value2, mask2);
  753. iosf_mbi_modify(LPSS_IOSF_UNIT_LPIO2, MBI_CFG_WRITE,
  754. LPSS_IOSF_PMCSR, value2, mask2);
  755. iosf_mbi_modify(LPSS_IOSF_UNIT_LPIOEP, MBI_CR_WRITE,
  756. LPSS_IOSF_GPIODEF0, value1, mask1);
  757. exit:
  758. mutex_unlock(&lpss_iosf_mutex);
  759. }
  760. static void lpss_iosf_exit_d3_state(void)
  761. {
  762. u32 value1 = LPSS_GPIODEF0_DMA1_D3 | LPSS_GPIODEF0_DMA2_D3 |
  763. LPSS_GPIODEF0_DMA_LLP;
  764. u32 mask1 = LPSS_GPIODEF0_DMA_D3_MASK | LPSS_GPIODEF0_DMA_LLP;
  765. u32 value2 = LPSS_PMCSR_D0;
  766. u32 mask2 = LPSS_PMCSR_Dx_MASK;
  767. mutex_lock(&lpss_iosf_mutex);
  768. iosf_mbi_modify(LPSS_IOSF_UNIT_LPIOEP, MBI_CR_WRITE,
  769. LPSS_IOSF_GPIODEF0, value1, mask1);
  770. iosf_mbi_modify(LPSS_IOSF_UNIT_LPIO2, MBI_CFG_WRITE,
  771. LPSS_IOSF_PMCSR, value2, mask2);
  772. iosf_mbi_modify(LPSS_IOSF_UNIT_LPIO1, MBI_CFG_WRITE,
  773. LPSS_IOSF_PMCSR, value2, mask2);
  774. mutex_unlock(&lpss_iosf_mutex);
  775. }
  776. static int acpi_lpss_suspend(struct device *dev, bool wakeup)
  777. {
  778. struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev));
  779. int ret;
  780. if (pdata->dev_desc->flags & LPSS_SAVE_CTX)
  781. acpi_lpss_save_ctx(dev, pdata);
  782. ret = acpi_dev_suspend(dev, wakeup);
  783. /*
  784. * This call must be last in the sequence, otherwise PMC will return
  785. * wrong status for devices being about to be powered off. See
  786. * lpss_iosf_enter_d3_state() for further information.
  787. */
  788. if (lpss_quirks & LPSS_QUIRK_ALWAYS_POWER_ON && iosf_mbi_available())
  789. lpss_iosf_enter_d3_state();
  790. return ret;
  791. }
  792. static int acpi_lpss_resume(struct device *dev)
  793. {
  794. struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev));
  795. int ret;
  796. /*
  797. * This call is kept first to be in symmetry with
  798. * acpi_lpss_runtime_suspend() one.
  799. */
  800. if (lpss_quirks & LPSS_QUIRK_ALWAYS_POWER_ON && iosf_mbi_available())
  801. lpss_iosf_exit_d3_state();
  802. ret = acpi_dev_resume(dev);
  803. if (ret)
  804. return ret;
  805. acpi_lpss_d3_to_d0_delay(pdata);
  806. if (pdata->dev_desc->flags & LPSS_SAVE_CTX)
  807. acpi_lpss_restore_ctx(dev, pdata);
  808. return 0;
  809. }
  810. #ifdef CONFIG_PM_SLEEP
  811. static int acpi_lpss_suspend_late(struct device *dev)
  812. {
  813. int ret;
  814. if (dev_pm_smart_suspend_and_suspended(dev))
  815. return 0;
  816. ret = pm_generic_suspend_late(dev);
  817. return ret ? ret : acpi_lpss_suspend(dev, device_may_wakeup(dev));
  818. }
  819. static int acpi_lpss_resume_early(struct device *dev)
  820. {
  821. int ret = acpi_lpss_resume(dev);
  822. return ret ? ret : pm_generic_resume_early(dev);
  823. }
  824. #endif /* CONFIG_PM_SLEEP */
  825. static int acpi_lpss_runtime_suspend(struct device *dev)
  826. {
  827. int ret = pm_generic_runtime_suspend(dev);
  828. return ret ? ret : acpi_lpss_suspend(dev, true);
  829. }
  830. static int acpi_lpss_runtime_resume(struct device *dev)
  831. {
  832. int ret = acpi_lpss_resume(dev);
  833. return ret ? ret : pm_generic_runtime_resume(dev);
  834. }
  835. #endif /* CONFIG_PM */
  836. static struct dev_pm_domain acpi_lpss_pm_domain = {
  837. #ifdef CONFIG_PM
  838. .activate = acpi_lpss_activate,
  839. .dismiss = acpi_lpss_dismiss,
  840. #endif
  841. .ops = {
  842. #ifdef CONFIG_PM
  843. #ifdef CONFIG_PM_SLEEP
  844. .prepare = acpi_subsys_prepare,
  845. .complete = acpi_subsys_complete,
  846. .suspend = acpi_subsys_suspend,
  847. .suspend_late = acpi_lpss_suspend_late,
  848. .suspend_noirq = acpi_subsys_suspend_noirq,
  849. .resume_noirq = acpi_subsys_resume_noirq,
  850. .resume_early = acpi_lpss_resume_early,
  851. .freeze = acpi_subsys_freeze,
  852. .freeze_late = acpi_subsys_freeze_late,
  853. .freeze_noirq = acpi_subsys_freeze_noirq,
  854. .thaw_noirq = acpi_subsys_thaw_noirq,
  855. .poweroff = acpi_subsys_suspend,
  856. .poweroff_late = acpi_lpss_suspend_late,
  857. .poweroff_noirq = acpi_subsys_suspend_noirq,
  858. .restore_noirq = acpi_subsys_resume_noirq,
  859. .restore_early = acpi_lpss_resume_early,
  860. #endif
  861. .runtime_suspend = acpi_lpss_runtime_suspend,
  862. .runtime_resume = acpi_lpss_runtime_resume,
  863. #endif
  864. },
  865. };
  866. static int acpi_lpss_platform_notify(struct notifier_block *nb,
  867. unsigned long action, void *data)
  868. {
  869. struct platform_device *pdev = to_platform_device(data);
  870. struct lpss_private_data *pdata;
  871. struct acpi_device *adev;
  872. const struct acpi_device_id *id;
  873. id = acpi_match_device(acpi_lpss_device_ids, &pdev->dev);
  874. if (!id || !id->driver_data)
  875. return 0;
  876. if (acpi_bus_get_device(ACPI_HANDLE(&pdev->dev), &adev))
  877. return 0;
  878. pdata = acpi_driver_data(adev);
  879. if (!pdata)
  880. return 0;
  881. if (pdata->mmio_base &&
  882. pdata->mmio_size < pdata->dev_desc->prv_offset + LPSS_LTR_SIZE) {
  883. dev_err(&pdev->dev, "MMIO size insufficient to access LTR\n");
  884. return 0;
  885. }
  886. switch (action) {
  887. case BUS_NOTIFY_BIND_DRIVER:
  888. dev_pm_domain_set(&pdev->dev, &acpi_lpss_pm_domain);
  889. break;
  890. case BUS_NOTIFY_DRIVER_NOT_BOUND:
  891. case BUS_NOTIFY_UNBOUND_DRIVER:
  892. dev_pm_domain_set(&pdev->dev, NULL);
  893. break;
  894. case BUS_NOTIFY_ADD_DEVICE:
  895. dev_pm_domain_set(&pdev->dev, &acpi_lpss_pm_domain);
  896. if (pdata->dev_desc->flags & LPSS_LTR)
  897. return sysfs_create_group(&pdev->dev.kobj,
  898. &lpss_attr_group);
  899. break;
  900. case BUS_NOTIFY_DEL_DEVICE:
  901. if (pdata->dev_desc->flags & LPSS_LTR)
  902. sysfs_remove_group(&pdev->dev.kobj, &lpss_attr_group);
  903. dev_pm_domain_set(&pdev->dev, NULL);
  904. break;
  905. default:
  906. break;
  907. }
  908. return 0;
  909. }
  910. static struct notifier_block acpi_lpss_nb = {
  911. .notifier_call = acpi_lpss_platform_notify,
  912. };
  913. static void acpi_lpss_bind(struct device *dev)
  914. {
  915. struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev));
  916. if (!pdata || !pdata->mmio_base || !(pdata->dev_desc->flags & LPSS_LTR))
  917. return;
  918. if (pdata->mmio_size >= pdata->dev_desc->prv_offset + LPSS_LTR_SIZE)
  919. dev->power.set_latency_tolerance = acpi_lpss_set_ltr;
  920. else
  921. dev_err(dev, "MMIO size insufficient to access LTR\n");
  922. }
  923. static void acpi_lpss_unbind(struct device *dev)
  924. {
  925. dev->power.set_latency_tolerance = NULL;
  926. }
  927. static struct acpi_scan_handler lpss_handler = {
  928. .ids = acpi_lpss_device_ids,
  929. .attach = acpi_lpss_create_device,
  930. .bind = acpi_lpss_bind,
  931. .unbind = acpi_lpss_unbind,
  932. };
  933. void __init acpi_lpss_init(void)
  934. {
  935. const struct x86_cpu_id *id;
  936. int ret;
  937. ret = lpt_clk_init();
  938. if (ret)
  939. return;
  940. id = x86_match_cpu(lpss_cpu_ids);
  941. if (id)
  942. lpss_quirks |= LPSS_QUIRK_ALWAYS_POWER_ON;
  943. bus_register_notifier(&platform_bus_type, &acpi_lpss_nb);
  944. acpi_scan_add_handler(&lpss_handler);
  945. }
  946. #else
  947. static struct acpi_scan_handler lpss_handler = {
  948. .ids = acpi_lpss_device_ids,
  949. };
  950. void __init acpi_lpss_init(void)
  951. {
  952. acpi_scan_add_handler(&lpss_handler);
  953. }
  954. #endif /* CONFIG_X86_INTEL_LPSS */