Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'intel-pinctrl-v6.15-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pinctrl/intel into devel

intel-pinctrl for v6.15-1

* Introduce devm_kmemdup_array() and convert Intel pin control drivers
* Update PWM handling for the cases when it's provided by Intel pin control
* Miscellaneous fixes, updates, and cleanups

The following is an automated git shortlog grouped by driver:

baytrail:
- copy communities using devm_kmemdup_array()
- Use dedicated helpers for chained IRQ handlers

cherryview:
- use devm_kmemdup_array()

devres:
- Introduce devm_kmemdup_array()

driver core:
- Split devres APIs to device/devres.h

err.h:
- move IOMEM_ERR_PTR() to err.h

iio:
- adc: xilinx-xadc-core: use devm_kmemdup_array()
- imu: st_lsm9ds0: Replace device.h with what is needed

input:
- ipaq-micro-keys: use devm_kmemdup_array()
- sparse-keymap: use devm_kmemdup_array()

intel:
- drop repeated config dependency
- copy communities using devm_kmemdup_array()
- Fix wrong bypass assignment in intel_pinctrl_probe_pwm()
- Import PWM_LPSS namespace for devm_pwm_lpss_probe()

lynxpoint:
- Use dedicated helpers for chained IRQ handlers

MAINTAINERS:
- Add pin control and GPIO to the Intel MID record

pwm:
- lpss: Clarify the bypass member semantics in struct pwm_lpss_boardinfo
- lpss: Actually use a module namespace by defining the namespace earlier

pxa2xx:
- use devm_kmemdup_array()

tangier:
- use devm_kmemdup_array()

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

+200 -157
+7
MAINTAINERS
··· 11848 11848 F: arch/x86/include/asm/intel-mid.h 11849 11849 F: arch/x86/pci/intel_mid_pci.c 11850 11850 F: arch/x86/platform/intel-mid/ 11851 + F: drivers/dma/hsu/ 11851 11852 F: drivers/extcon/extcon-intel-mrfld.c 11853 + F: drivers/gpio/gpio-merrifield.c 11854 + F: drivers/gpio/gpio-tangier.* 11852 11855 F: drivers/iio/adc/intel_mrfld_adc.c 11853 11856 F: drivers/mfd/intel_soc_pmic_mrfld.c 11857 + F: drivers/pinctrl/intel/pinctrl-merrifield.c 11858 + F: drivers/pinctrl/intel/pinctrl-moorefield.c 11859 + F: drivers/pinctrl/intel/pinctrl-tangier.* 11854 11860 F: drivers/platform/x86/intel/mrfld_pwrbtn.c 11855 11861 F: drivers/platform/x86/intel_scu_* 11856 11862 F: drivers/staging/media/atomisp/ 11863 + F: drivers/tty/serial/8250/8250_mid.c 11857 11864 F: drivers/watchdog/intel-mid_wdt.c 11858 11865 F: include/linux/mfd/intel_soc_pmic_mrfld.h 11859 11866 F: include/linux/platform_data/x86/intel-mid_wdt.h
+2 -2
drivers/iio/adc/xilinx-xadc-core.c
··· 1245 1245 channel_templates = xadc_us_channels; 1246 1246 max_channels = ARRAY_SIZE(xadc_us_channels); 1247 1247 } 1248 - channels = devm_kmemdup(dev, channel_templates, 1249 - sizeof(channels[0]) * max_channels, GFP_KERNEL); 1248 + channels = devm_kmemdup_array(dev, channel_templates, max_channels, 1249 + sizeof(*channel_templates), GFP_KERNEL); 1250 1250 if (!channels) 1251 1251 return -ENOMEM; 1252 1252
+1 -1
drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_i2c.c
··· 7 7 * Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com> 8 8 */ 9 9 10 - #include <linux/device.h> 10 + #include <linux/device/devres.h> 11 11 #include <linux/err.h> 12 12 #include <linux/gfp_types.h> 13 13 #include <linux/i2c.h>
+1 -1
drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_spi.c
··· 7 7 * Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com> 8 8 */ 9 9 10 - #include <linux/device.h> 10 + #include <linux/device/devres.h> 11 11 #include <linux/err.h> 12 12 #include <linux/gfp_types.h> 13 13 #include <linux/module.h>
+2 -3
drivers/input/keyboard/ipaq-micro-keys.c
··· 102 102 103 103 keys->input->keycodesize = sizeof(micro_keycodes[0]); 104 104 keys->input->keycodemax = ARRAY_SIZE(micro_keycodes); 105 - keys->codes = devm_kmemdup(&pdev->dev, micro_keycodes, 106 - keys->input->keycodesize * keys->input->keycodemax, 107 - GFP_KERNEL); 105 + keys->codes = devm_kmemdup_array(&pdev->dev, micro_keycodes, keys->input->keycodemax, 106 + keys->input->keycodesize, GFP_KERNEL); 108 107 if (!keys->codes) 109 108 return -ENOMEM; 110 109
+1 -2
drivers/input/sparse-keymap.c
··· 176 176 for (e = keymap; e->type != KE_END; e++) 177 177 map_size++; 178 178 179 - map = devm_kmemdup(&dev->dev, keymap, map_size * sizeof(*map), 180 - GFP_KERNEL); 179 + map = devm_kmemdup_array(&dev->dev, keymap, map_size, sizeof(*keymap), GFP_KERNEL); 181 180 if (!map) 182 181 return -ENOMEM; 183 182
-2
drivers/pinctrl/intel/Kconfig
··· 39 39 40 40 config PINCTRL_INTEL_PLATFORM 41 41 tristate "Intel pinctrl and GPIO platform driver" 42 - depends on ACPI 43 42 select PINCTRL_INTEL 44 43 help 45 44 This pinctrl driver provides an interface that allows configuring ··· 140 141 141 142 config PINCTRL_METEORPOINT 142 143 tristate "Intel Meteor Point pinctrl and GPIO driver" 143 - depends on ACPI 144 144 select PINCTRL_INTEL 145 145 help 146 146 Meteor Point is the PCH of Intel Meteor Lake. This pinctrl driver
+6 -5
drivers/pinctrl/intel/pinctrl-baytrail.c
··· 1355 1355 void __iomem *reg; 1356 1356 unsigned long pending; 1357 1357 1358 + chained_irq_enter(chip, desc); 1359 + 1358 1360 /* check from GPIO controller which pin triggered the interrupt */ 1359 1361 for (base = 0; base < vg->chip.ngpio; base += 32) { 1360 1362 reg = byt_gpio_reg(vg, base, BYT_INT_STAT_REG); ··· 1371 1369 for_each_set_bit(pin, &pending, 32) 1372 1370 generic_handle_domain_irq(vg->chip.irq.domain, base + pin); 1373 1371 } 1374 - chip->irq_eoi(data); 1372 + 1373 + chained_irq_exit(chip, desc); 1375 1374 } 1376 1375 1377 1376 static bool byt_direct_irq_sanity_check(struct intel_pinctrl *vg, int pin, u32 conf0) ··· 1560 1557 vg->soc = soc; 1561 1558 1562 1559 vg->ncommunities = vg->soc->ncommunities; 1563 - vg->communities = devm_kcalloc(vg->dev, vg->ncommunities, 1564 - sizeof(*vg->communities), GFP_KERNEL); 1560 + vg->communities = devm_kmemdup_array(vg->dev, vg->soc->communities, vg->ncommunities, 1561 + sizeof(*vg->soc->communities), GFP_KERNEL); 1565 1562 if (!vg->communities) 1566 1563 return -ENOMEM; 1567 1564 1568 1565 for (i = 0; i < vg->soc->ncommunities; i++) { 1569 1566 struct intel_community *comm = vg->communities + i; 1570 - 1571 - *comm = vg->soc->communities[i]; 1572 1567 1573 1568 comm->pad_regs = devm_platform_ioremap_resource(pdev, 0); 1574 1569 if (IS_ERR(comm->pad_regs))
+2 -3
drivers/pinctrl/intel/pinctrl-cherryview.c
··· 1631 1631 pctrl->soc = soc_data; 1632 1632 1633 1633 pctrl->ncommunities = pctrl->soc->ncommunities; 1634 - pctrl->communities = devm_kmemdup(dev, pctrl->soc->communities, 1635 - pctrl->ncommunities * sizeof(*pctrl->communities), 1636 - GFP_KERNEL); 1634 + pctrl->communities = devm_kmemdup_array(dev, pctrl->soc->communities, pctrl->ncommunities, 1635 + sizeof(*pctrl->soc->communities), GFP_KERNEL); 1637 1636 if (!pctrl->communities) 1638 1637 return -ENOMEM; 1639 1638
+3 -5
drivers/pinctrl/intel/pinctrl-intel.c
··· 1543 1543 .clk_rate = 19200000, 1544 1544 .npwm = 1, 1545 1545 .base_unit_bits = 22, 1546 - .bypass = true, 1547 1546 }; 1548 1547 struct pwm_chip *chip; 1549 1548 ··· 1576 1577 * to the registers. 1577 1578 */ 1578 1579 pctrl->ncommunities = pctrl->soc->ncommunities; 1579 - pctrl->communities = devm_kcalloc(dev, pctrl->ncommunities, 1580 - sizeof(*pctrl->communities), GFP_KERNEL); 1580 + pctrl->communities = devm_kmemdup_array(dev, pctrl->soc->communities, pctrl->ncommunities, 1581 + sizeof(*pctrl->soc->communities), GFP_KERNEL); 1581 1582 if (!pctrl->communities) 1582 1583 return -ENOMEM; 1583 1584 ··· 1586 1587 void __iomem *regs; 1587 1588 u32 offset; 1588 1589 u32 value; 1589 - 1590 - *community = pctrl->soc->communities[i]; 1591 1590 1592 1591 regs = devm_platform_ioremap_resource(pdev, community->barno); 1593 1592 if (IS_ERR(regs)) ··· 1938 1941 MODULE_AUTHOR("Mika Westerberg <mika.westerberg@linux.intel.com>"); 1939 1942 MODULE_DESCRIPTION("Intel pinctrl/GPIO core driver"); 1940 1943 MODULE_LICENSE("GPL v2"); 1944 + MODULE_IMPORT_NS("PWM_LPSS");
+4 -1
drivers/pinctrl/intel/pinctrl-lynxpoint.c
··· 549 549 unsigned long pending; 550 550 u32 base, pin; 551 551 552 + chained_irq_enter(chip, desc); 553 + 552 554 /* check from GPIO controller which pin triggered the interrupt */ 553 555 for (base = 0; base < lg->chip.ngpio; base += 32) { 554 556 reg = lp_gpio_reg(&lg->chip, base, LP_INT_STAT); ··· 562 560 for_each_set_bit(pin, &pending, 32) 563 561 generic_handle_domain_irq(lg->chip.irq.domain, base + pin); 564 562 } 565 - chip->irq_eoi(data); 563 + 564 + chained_irq_exit(chip, desc); 566 565 } 567 566 568 567 static void lp_irq_ack(struct irq_data *d)
+2 -3
drivers/pinctrl/intel/pinctrl-tangier.c
··· 524 524 struct device *dev = &pdev->dev; 525 525 struct tng_family *families; 526 526 struct tng_pinctrl *tp; 527 - size_t families_len; 528 527 void __iomem *regs; 529 528 unsigned int i; 530 529 ··· 542 543 * Make a copy of the families which we can use to hold pointers 543 544 * to the registers. 544 545 */ 545 - families_len = size_mul(sizeof(*families), tp->nfamilies); 546 - families = devm_kmemdup(dev, tp->families, families_len, GFP_KERNEL); 546 + families = devm_kmemdup_array(dev, tp->families, tp->nfamilies, 547 + sizeof(*tp->families), GFP_KERNEL); 547 548 if (!families) 548 549 return -ENOMEM; 549 550
+4 -4
drivers/pinctrl/pxa/pinctrl-pxa2xx.c
··· 281 281 for (df = pctl->ppins[i].functions; df->name; df++) 282 282 if (!pxa2xx_find_function(pctl, df->name, functions)) 283 283 (functions + pctl->nfuncs++)->name = df->name; 284 - pctl->functions = devm_kmemdup(pctl->dev, functions, 285 - pctl->nfuncs * sizeof(*functions), 286 - GFP_KERNEL); 284 + pctl->functions = devm_kmemdup_array(pctl->dev, functions, pctl->nfuncs, 285 + sizeof(*functions), GFP_KERNEL); 287 286 if (!pctl->functions) 288 287 return -ENOMEM; 289 288 ··· 313 314 pctl->ppins[j].pin.name; 314 315 func = pctl->functions + i; 315 316 func->ngroups = ngroups; 316 - func->groups = devm_kmemdup(pctl->dev, gtmp, ngroups * sizeof(*gtmp), GFP_KERNEL); 317 + func->groups = devm_kmemdup_array(pctl->dev, gtmp, ngroups, 318 + sizeof(*gtmp), GFP_KERNEL); 317 319 if (!func->groups) 318 320 return -ENOMEM; 319 321 }
+2 -2
drivers/pwm/pwm-lpss.c
··· 10 10 * Author: Alan Cox <alan@linux.intel.com> 11 11 */ 12 12 13 + #define DEFAULT_SYMBOL_NAMESPACE "PWM_LPSS" 14 + 13 15 #include <linux/bits.h> 14 16 #include <linux/delay.h> 15 17 #include <linux/io.h> ··· 20 18 #include <linux/module.h> 21 19 #include <linux/pm_runtime.h> 22 20 #include <linux/time.h> 23 - 24 - #define DEFAULT_SYMBOL_NAMESPACE "PWM_LPSS" 25 21 26 22 #include "pwm-lpss.h" 27 23
+1 -118
include/linux/device.h
··· 26 26 #include <linux/atomic.h> 27 27 #include <linux/uidgid.h> 28 28 #include <linux/gfp.h> 29 - #include <linux/overflow.h> 30 29 #include <linux/device/bus.h> 31 30 #include <linux/device/class.h> 31 + #include <linux/device/devres.h> 32 32 #include <linux/device/driver.h> 33 33 #include <linux/cleanup.h> 34 34 #include <asm/device.h> ··· 280 280 const struct bin_attribute *attr); 281 281 void device_remove_bin_file(struct device *dev, 282 282 const struct bin_attribute *attr); 283 - 284 - /* device resource management */ 285 - typedef void (*dr_release_t)(struct device *dev, void *res); 286 - typedef int (*dr_match_t)(struct device *dev, void *res, void *match_data); 287 - 288 - void *__devres_alloc_node(dr_release_t release, size_t size, gfp_t gfp, 289 - int nid, const char *name) __malloc; 290 - #define devres_alloc(release, size, gfp) \ 291 - __devres_alloc_node(release, size, gfp, NUMA_NO_NODE, #release) 292 - #define devres_alloc_node(release, size, gfp, nid) \ 293 - __devres_alloc_node(release, size, gfp, nid, #release) 294 - 295 - void devres_for_each_res(struct device *dev, dr_release_t release, 296 - dr_match_t match, void *match_data, 297 - void (*fn)(struct device *, void *, void *), 298 - void *data); 299 - void devres_free(void *res); 300 - void devres_add(struct device *dev, void *res); 301 - void *devres_find(struct device *dev, dr_release_t release, 302 - dr_match_t match, void *match_data); 303 - void *devres_get(struct device *dev, void *new_res, 304 - dr_match_t match, void *match_data); 305 - void *devres_remove(struct device *dev, dr_release_t release, 306 - dr_match_t match, void *match_data); 307 - int devres_destroy(struct device *dev, dr_release_t release, 308 - dr_match_t match, void *match_data); 309 - int devres_release(struct device *dev, dr_release_t release, 310 - dr_match_t match, void *match_data); 311 - 312 - /* devres group */ 313 - void * __must_check devres_open_group(struct device *dev, void *id, gfp_t gfp); 314 - void devres_close_group(struct device *dev, void *id); 315 - void devres_remove_group(struct device *dev, void *id); 316 - int devres_release_group(struct device *dev, void *id); 317 - 318 - /* managed devm_k.alloc/kfree for device drivers */ 319 - void *devm_kmalloc(struct device *dev, size_t size, gfp_t gfp) __alloc_size(2); 320 - void *devm_krealloc(struct device *dev, void *ptr, size_t size, 321 - gfp_t gfp) __must_check __realloc_size(3); 322 - __printf(3, 0) char *devm_kvasprintf(struct device *dev, gfp_t gfp, 323 - const char *fmt, va_list ap) __malloc; 324 - __printf(3, 4) char *devm_kasprintf(struct device *dev, gfp_t gfp, 325 - const char *fmt, ...) __malloc; 326 - static inline void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp) 327 - { 328 - return devm_kmalloc(dev, size, gfp | __GFP_ZERO); 329 - } 330 - static inline void *devm_kmalloc_array(struct device *dev, 331 - size_t n, size_t size, gfp_t flags) 332 - { 333 - size_t bytes; 334 - 335 - if (unlikely(check_mul_overflow(n, size, &bytes))) 336 - return NULL; 337 - 338 - return devm_kmalloc(dev, bytes, flags); 339 - } 340 - static inline void *devm_kcalloc(struct device *dev, 341 - size_t n, size_t size, gfp_t flags) 342 - { 343 - return devm_kmalloc_array(dev, n, size, flags | __GFP_ZERO); 344 - } 345 - static inline __realloc_size(3, 4) void * __must_check 346 - devm_krealloc_array(struct device *dev, void *p, size_t new_n, size_t new_size, gfp_t flags) 347 - { 348 - size_t bytes; 349 - 350 - if (unlikely(check_mul_overflow(new_n, new_size, &bytes))) 351 - return NULL; 352 - 353 - return devm_krealloc(dev, p, bytes, flags); 354 - } 355 - 356 - void devm_kfree(struct device *dev, const void *p); 357 - char *devm_kstrdup(struct device *dev, const char *s, gfp_t gfp) __malloc; 358 - const char *devm_kstrdup_const(struct device *dev, const char *s, gfp_t gfp); 359 - void *devm_kmemdup(struct device *dev, const void *src, size_t len, gfp_t gfp) 360 - __realloc_size(3); 361 - 362 - unsigned long devm_get_free_pages(struct device *dev, 363 - gfp_t gfp_mask, unsigned int order); 364 - void devm_free_pages(struct device *dev, unsigned long addr); 365 - 366 - #ifdef CONFIG_HAS_IOMEM 367 - void __iomem *devm_ioremap_resource(struct device *dev, 368 - const struct resource *res); 369 - void __iomem *devm_ioremap_resource_wc(struct device *dev, 370 - const struct resource *res); 371 - 372 - void __iomem *devm_of_iomap(struct device *dev, 373 - struct device_node *node, int index, 374 - resource_size_t *size); 375 - #else 376 - 377 - static inline 378 - void __iomem *devm_ioremap_resource(struct device *dev, 379 - const struct resource *res) 380 - { 381 - return ERR_PTR(-EINVAL); 382 - } 383 - 384 - static inline 385 - void __iomem *devm_ioremap_resource_wc(struct device *dev, 386 - const struct resource *res) 387 - { 388 - return ERR_PTR(-EINVAL); 389 - } 390 - 391 - static inline 392 - void __iomem *devm_of_iomap(struct device *dev, 393 - struct device_node *node, int index, 394 - resource_size_t *size) 395 - { 396 - return ERR_PTR(-EINVAL); 397 - } 398 - 399 - #endif 400 283 401 284 /* allows to add/remove a custom action to devres stack */ 402 285 int devm_remove_action_nowarn(struct device *dev, void (*action)(void *), void *data);
+129
include/linux/device/devres.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + #ifndef _DEVICE_DEVRES_H_ 3 + #define _DEVICE_DEVRES_H_ 4 + 5 + #include <linux/err.h> 6 + #include <linux/gfp_types.h> 7 + #include <linux/numa.h> 8 + #include <linux/overflow.h> 9 + #include <linux/stdarg.h> 10 + #include <linux/types.h> 11 + 12 + struct device; 13 + struct device_node; 14 + struct resource; 15 + 16 + /* device resource management */ 17 + typedef void (*dr_release_t)(struct device *dev, void *res); 18 + typedef int (*dr_match_t)(struct device *dev, void *res, void *match_data); 19 + 20 + void * __malloc 21 + __devres_alloc_node(dr_release_t release, size_t size, gfp_t gfp, int nid, const char *name); 22 + #define devres_alloc(release, size, gfp) \ 23 + __devres_alloc_node(release, size, gfp, NUMA_NO_NODE, #release) 24 + #define devres_alloc_node(release, size, gfp, nid) \ 25 + __devres_alloc_node(release, size, gfp, nid, #release) 26 + 27 + void devres_for_each_res(struct device *dev, dr_release_t release, 28 + dr_match_t match, void *match_data, 29 + void (*fn)(struct device *, void *, void *), 30 + void *data); 31 + void devres_free(void *res); 32 + void devres_add(struct device *dev, void *res); 33 + void *devres_find(struct device *dev, dr_release_t release, dr_match_t match, void *match_data); 34 + void *devres_get(struct device *dev, void *new_res, dr_match_t match, void *match_data); 35 + void *devres_remove(struct device *dev, dr_release_t release, dr_match_t match, void *match_data); 36 + int devres_destroy(struct device *dev, dr_release_t release, dr_match_t match, void *match_data); 37 + int devres_release(struct device *dev, dr_release_t release, dr_match_t match, void *match_data); 38 + 39 + /* devres group */ 40 + void * __must_check devres_open_group(struct device *dev, void *id, gfp_t gfp); 41 + void devres_close_group(struct device *dev, void *id); 42 + void devres_remove_group(struct device *dev, void *id); 43 + int devres_release_group(struct device *dev, void *id); 44 + 45 + /* managed devm_k.alloc/kfree for device drivers */ 46 + void * __alloc_size(2) 47 + devm_kmalloc(struct device *dev, size_t size, gfp_t gfp); 48 + void * __must_check __realloc_size(3) 49 + devm_krealloc(struct device *dev, void *ptr, size_t size, gfp_t gfp); 50 + static inline void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp) 51 + { 52 + return devm_kmalloc(dev, size, gfp | __GFP_ZERO); 53 + } 54 + static inline void *devm_kmalloc_array(struct device *dev, size_t n, size_t size, gfp_t flags) 55 + { 56 + size_t bytes; 57 + 58 + if (unlikely(check_mul_overflow(n, size, &bytes))) 59 + return NULL; 60 + 61 + return devm_kmalloc(dev, bytes, flags); 62 + } 63 + static inline void *devm_kcalloc(struct device *dev, size_t n, size_t size, gfp_t flags) 64 + { 65 + return devm_kmalloc_array(dev, n, size, flags | __GFP_ZERO); 66 + } 67 + static inline __realloc_size(3, 4) void * __must_check 68 + devm_krealloc_array(struct device *dev, void *p, size_t new_n, size_t new_size, gfp_t flags) 69 + { 70 + size_t bytes; 71 + 72 + if (unlikely(check_mul_overflow(new_n, new_size, &bytes))) 73 + return NULL; 74 + 75 + return devm_krealloc(dev, p, bytes, flags); 76 + } 77 + 78 + void devm_kfree(struct device *dev, const void *p); 79 + 80 + void * __realloc_size(3) 81 + devm_kmemdup(struct device *dev, const void *src, size_t len, gfp_t gfp); 82 + static inline void *devm_kmemdup_array(struct device *dev, const void *src, 83 + size_t n, size_t size, gfp_t flags) 84 + { 85 + return devm_kmemdup(dev, src, size_mul(size, n), flags); 86 + } 87 + 88 + char * __malloc 89 + devm_kstrdup(struct device *dev, const char *s, gfp_t gfp); 90 + const char *devm_kstrdup_const(struct device *dev, const char *s, gfp_t gfp); 91 + char * __printf(3, 0) __malloc 92 + devm_kvasprintf(struct device *dev, gfp_t gfp, const char *fmt, va_list ap); 93 + char * __printf(3, 4) __malloc 94 + devm_kasprintf(struct device *dev, gfp_t gfp, const char *fmt, ...); 95 + 96 + unsigned long devm_get_free_pages(struct device *dev, gfp_t gfp_mask, unsigned int order); 97 + void devm_free_pages(struct device *dev, unsigned long addr); 98 + 99 + #ifdef CONFIG_HAS_IOMEM 100 + 101 + void __iomem *devm_ioremap_resource(struct device *dev, const struct resource *res); 102 + void __iomem *devm_ioremap_resource_wc(struct device *dev, const struct resource *res); 103 + 104 + void __iomem *devm_of_iomap(struct device *dev, struct device_node *node, int index, 105 + resource_size_t *size); 106 + #else 107 + 108 + static inline 109 + void __iomem *devm_ioremap_resource(struct device *dev, const struct resource *res) 110 + { 111 + return IOMEM_ERR_PTR(-EINVAL); 112 + } 113 + 114 + static inline 115 + void __iomem *devm_ioremap_resource_wc(struct device *dev, const struct resource *res) 116 + { 117 + return IOMEM_ERR_PTR(-EINVAL); 118 + } 119 + 120 + static inline 121 + void __iomem *devm_of_iomap(struct device *dev, struct device_node *node, int index, 122 + resource_size_t *size) 123 + { 124 + return IOMEM_ERR_PTR(-EINVAL); 125 + } 126 + 127 + #endif 128 + 129 + #endif /* _DEVICE_DEVRES_H_ */
+3
include/linux/err.h
··· 44 44 /* Return the pointer in the percpu address space. */ 45 45 #define ERR_PTR_PCPU(error) ((void __percpu *)(unsigned long)ERR_PTR(error)) 46 46 47 + /* Cast an error pointer to __iomem. */ 48 + #define IOMEM_ERR_PTR(error) (__force void __iomem *)ERR_PTR(error) 49 + 47 50 /** 48 51 * PTR_ERR - Extract the error code from an error pointer. 49 52 * @ptr: An error pointer.
-2
include/linux/io.h
··· 65 65 } 66 66 #endif 67 67 68 - #define IOMEM_ERR_PTR(err) (__force void __iomem *)ERR_PTR(err) 69 - 70 68 void __iomem *devm_ioremap(struct device *dev, resource_size_t offset, 71 69 resource_size_t size); 72 70 void __iomem *devm_ioremap_uc(struct device *dev, resource_size_t offset,
+30 -3
include/linux/platform_data/x86/pwm-lpss.h
··· 15 15 unsigned int npwm; 16 16 unsigned long base_unit_bits; 17 17 /* 18 - * Some versions of the IP may stuck in the state machine if enable 19 - * bit is not set, and hence update bit will show busy status till 20 - * the reset. For the rest it may be otherwise. 18 + * NOTE: 19 + * Intel Broxton, Apollo Lake, and Gemini Lake have different programming flow. 20 + * 21 + * Initial Enable or First Activation 22 + * 1. Program the base unit and on time divisor values. 23 + * 2. Set the software update bit. 24 + * 3. Poll in a loop on the PWMCTRL bit until software update bit is cleared.+ 25 + * 4. Enable the PWM output by setting PWM Enable. 26 + * 5. Repeat the above steps for the next PWM Module. 27 + * 28 + * Dynamic update while PWM is Enabled 29 + * 1. Program the base unit and on-time divisor values. 30 + * 2. Set the software update bit. 31 + * 3. Repeat the above steps for the next PWM module. 32 + * 33 + * + After setting PWMCTRL register's SW update bit, hardware automatically 34 + * deasserts the SW update bit after a brief delay. It was observed that 35 + * setting of PWM enable is typically done via read-modify-write of the PWMCTRL 36 + * register. If there is no/little delay between setting software update bit 37 + * and setting enable bit via read-modify-write, it is possible that the read 38 + * could return with software enable as 1. In that case, the last write to set 39 + * enable to 1 could also set sw_update to 1. If this happens, sw_update gets 40 + * stuck and the driver code can hang as it explicitly waits for sw_update bit 41 + * to be 0 after setting the enable bit to 1. To avoid this race condition, 42 + * SW should poll on the software update bit to make sure that it is 0 before 43 + * doing the read-modify-write to set the enable bit to 1. 44 + * 45 + * Also, we noted that if sw_update bit was set in step #1 above then when it 46 + * is set again in step #2, sw_update bit never gets cleared and the flow hangs. 47 + * As such, we need to make sure that sw_update bit is 0 when doing step #1. 21 48 */ 22 49 bool bypass; 23 50 /*