Lines Matching +full:warn +full:- +full:soc +full:- +full:level
1 // SPDX-License-Identifier: GPL-2.0
5 * Copyright (c) 2012-2013, Intel Corporation
27 #include <linux/pinctrl/pinconf-generic.h>
29 #include "pinctrl-intel.h"
566 offset -= comm->pin_base; in byt_gpio_reg()
575 reg_offset = comm->pad_map[offset] * 16; in byt_gpio_reg()
579 return comm->pad_regs + reg_offset + reg; in byt_gpio_reg()
603 dev_warn(vg->dev, "Group %s, pin %i not muxed (can't retrieve CONF0)\n", in byt_set_group_simple_mux()
632 dev_warn(vg->dev, "Group %s, pin %i not muxed (can't retrieve CONF0)\n", in byt_set_group_mixed_mux()
650 const struct intel_function func = vg->soc->functions[func_selector]; in byt_set_mux()
651 const struct intel_pingroup group = vg->soc->groups[group_selector]; in byt_set_mux()
665 /* SCORE pin 92-93 */ in byt_get_gpio_mux()
666 if (!strcmp(vg->soc->uid, BYT_SCORE_ACPI_UID) && in byt_get_gpio_mux()
670 /* SUS pin 11-21 */ in byt_get_gpio_mux()
671 if (!strcmp(vg->soc->uid, BYT_SUS_ACPI_UID) && in byt_get_gpio_mux()
687 /* Do not clear direct-irq enabled IRQs (from gpio_disable_free) */ in byt_gpio_clear_triggering()
722 dev_warn(vg->dev, FW_BUG "Pin %i: forcibly re-configured as GPIO\n", offset); in byt_gpio_request_enable()
727 pm_runtime_get(vg->dev); in byt_gpio_request_enable()
739 pm_runtime_put(vg->dev); in byt_gpio_disable_free()
754 dev_info_once(vg->dev, in byt_gpio_direct_irq_check()
831 return -EINVAL; in byt_set_pull_strength()
858 return -EINVAL; in byt_pin_config_get()
863 return -EINVAL; in byt_pin_config_get()
871 return -EINVAL; in byt_pin_config_get()
878 return -EINVAL; in byt_pin_config_get()
907 return -EINVAL; in byt_pin_config_get()
912 return -ENOTSUPP; in byt_pin_config_get()
955 * chip is not in input mode, set it and warn about it. in byt_pin_config_set()
960 dev_warn(vg->dev, "Pin %i: forcibly set to input mode\n", offset); in byt_pin_config_set()
975 * chip is not in input mode, set it and warn about it. in byt_pin_config_set()
980 dev_warn(vg->dev, "Pin %i: forcibly set to input mode\n", offset); in byt_pin_config_set()
1025 ret = -EINVAL; in byt_pin_config_set()
1038 ret = -ENOTSUPP; in byt_pin_config_set()
1107 return -EINVAL; in byt_gpio_get_direction()
1118 return -EINVAL; in byt_gpio_get_direction()
1176 for (i = 0; i < vg->soc->npins; i++) { in byt_gpio_dbg_show()
1185 pin = vg->soc->pins[i].number; in byt_gpio_dbg_show()
1238 " gpio-%-3d (%-20.20s) %s %s %s pad-%-3d offset:0x%03x mux:%d %s%s%s", in byt_gpio_dbg_show()
1244 comm->pad_map[i], comm->pad_map[i] * 16, in byt_gpio_dbg_show()
1248 conf0 & BYT_TRIG_LVL ? " level" : " "); in byt_gpio_dbg_show()
1251 seq_printf(s, " %-4s %-3s", pull, pull_str); in byt_gpio_dbg_show()
1256 seq_puts(s, " open-drain"); in byt_gpio_dbg_show()
1352 return -EINVAL; in byt_irq_type()
1357 WARN(value & BYT_DIRECT_IRQ_EN, in byt_irq_type()
1360 /* For level trigges the BYT_TRIG_POS and BYT_TRIG_NEG bits in byt_irq_type()
1361 * are used to indicate high and low level triggering in byt_irq_type()
1382 .name = "BYT-GPIO",
1401 for (base = 0; base < vg->chip.ngpio; base += 32) { in byt_gpio_irq_handler()
1405 dev_warn(vg->dev, "Pin %i: can't retrieve INT_STAT%u\n", base / 32, base); in byt_gpio_irq_handler()
1413 generic_handle_domain_irq(vg->chip.irq.domain, base + pin); in byt_gpio_irq_handler()
1415 chip->irq_eoi(data); in byt_gpio_irq_handler()
1424 memcpy_fromio(direct_irq_mux, vg->communities->pad_regs + BYT_DIRECT_IRQ_REG, in byt_direct_irq_sanity_check()
1428 dev_warn(vg->dev, FW_BUG "Pin %i: DIRECT_IRQ_EN set but no IRQ assigned, clearing\n", pin); in byt_direct_irq_sanity_check()
1432 direct_irq = match - direct_irq_mux; in byt_direct_irq_sanity_check()
1433 /* Base IO-APIC pin numbers come from atom-e3800-family-datasheet.pdf */ in byt_direct_irq_sanity_check()
1434 ioapic_direct_irq_base = (vg->communities->npins == BYT_NGPIO_SCORE) ? 51 : 67; in byt_direct_irq_sanity_check()
1435 dev_dbg(vg->dev, "Pin %i: uses direct IRQ %d (IO-APIC %d)\n", pin, in byt_direct_irq_sanity_check()
1440 * direct-irq-en flag and the direct IRQ mux connect the output of the GPIO's IRQ in byt_direct_irq_sanity_check()
1442 * 0x800, to one of the IO-APIC pins according to the mux registers. in byt_direct_irq_sanity_check()
1447 * passed (1:1 or inverted) to the IO-APIC pin, if TRIG_LVL is not set, in byt_direct_irq_sanity_check()
1448 * selecting edge mode operation then on the first edge the IO-APIC pin goes in byt_direct_irq_sanity_check()
1449 * high, but since no write-to-clear write will be done to the IRQ status reg in byt_direct_irq_sanity_check()
1455 dev_warn(vg->dev, in byt_direct_irq_sanity_check()
1478 for (i = 0; i < vg->soc->npins; i++) { in byt_init_irq_valid_mask()
1479 unsigned int pin = vg->soc->pins[i].number; in byt_init_irq_valid_mask()
1483 dev_warn(vg->dev, "Pin %i: could not retrieve CONF0\n", i); in byt_init_irq_valid_mask()
1498 dev_dbg(vg->dev, "disabling GPIO %d\n", i); in byt_init_irq_valid_mask()
1510 for (base = 0; base < vg->soc->npins; base += 32) { in byt_gpio_irq_init_hw()
1514 dev_warn(vg->dev, "Pin %i: can't retrieve INT_STAT%u\n", base / 32, base); in byt_gpio_irq_init_hw()
1523 dev_err(vg->dev, in byt_gpio_irq_init_hw()
1534 struct device *dev = vg->dev; in byt_gpio_add_pin_ranges()
1537 ret = gpiochip_add_pin_range(chip, dev_name(dev), 0, 0, vg->soc->npins); in byt_gpio_add_pin_ranges()
1546 struct platform_device *pdev = to_platform_device(vg->dev); in byt_gpio_probe()
1551 vg->chip = byt_gpio_chip; in byt_gpio_probe()
1552 gc = &vg->chip; in byt_gpio_probe()
1553 gc->label = dev_name(vg->dev); in byt_gpio_probe()
1554 gc->base = -1; in byt_gpio_probe()
1555 gc->can_sleep = false; in byt_gpio_probe()
1556 gc->add_pin_ranges = byt_gpio_add_pin_ranges; in byt_gpio_probe()
1557 gc->parent = vg->dev; in byt_gpio_probe()
1558 gc->ngpio = vg->soc->npins; in byt_gpio_probe()
1561 vg->context.pads = devm_kcalloc(vg->dev, gc->ngpio, sizeof(*vg->context.pads), in byt_gpio_probe()
1563 if (!vg->context.pads) in byt_gpio_probe()
1564 return -ENOMEM; in byt_gpio_probe()
1572 girq = &gc->irq; in byt_gpio_probe()
1574 girq->init_hw = byt_gpio_irq_init_hw; in byt_gpio_probe()
1575 girq->init_valid_mask = byt_init_irq_valid_mask; in byt_gpio_probe()
1576 girq->parent_handler = byt_gpio_irq_handler; in byt_gpio_probe()
1577 girq->num_parents = 1; in byt_gpio_probe()
1578 girq->parents = devm_kcalloc(vg->dev, girq->num_parents, in byt_gpio_probe()
1579 sizeof(*girq->parents), GFP_KERNEL); in byt_gpio_probe()
1580 if (!girq->parents) in byt_gpio_probe()
1581 return -ENOMEM; in byt_gpio_probe()
1582 girq->parents[0] = irq; in byt_gpio_probe()
1583 girq->default_type = IRQ_TYPE_NONE; in byt_gpio_probe()
1584 girq->handler = handle_bad_irq; in byt_gpio_probe()
1587 ret = devm_gpiochip_add_data(vg->dev, gc, vg); in byt_gpio_probe()
1589 dev_err(vg->dev, "failed adding byt-gpio chip\n"); in byt_gpio_probe()
1597 const struct intel_pinctrl_soc_data *soc) in byt_set_soc_data() argument
1599 struct platform_device *pdev = to_platform_device(vg->dev); in byt_set_soc_data()
1602 vg->soc = soc; in byt_set_soc_data()
1604 vg->ncommunities = vg->soc->ncommunities; in byt_set_soc_data()
1605 vg->communities = devm_kcalloc(vg->dev, vg->ncommunities, in byt_set_soc_data()
1606 sizeof(*vg->communities), GFP_KERNEL); in byt_set_soc_data()
1607 if (!vg->communities) in byt_set_soc_data()
1608 return -ENOMEM; in byt_set_soc_data()
1610 for (i = 0; i < vg->soc->ncommunities; i++) { in byt_set_soc_data()
1611 struct intel_community *comm = vg->communities + i; in byt_set_soc_data()
1613 *comm = vg->soc->communities[i]; in byt_set_soc_data()
1615 comm->pad_regs = devm_platform_ioremap_resource(pdev, 0); in byt_set_soc_data()
1616 if (IS_ERR(comm->pad_regs)) in byt_set_soc_data()
1617 return PTR_ERR(comm->pad_regs); in byt_set_soc_data()
1632 struct device *dev = &pdev->dev; in byt_pinctrl_probe()
1642 return -ENOMEM; in byt_pinctrl_probe()
1644 vg->dev = dev; in byt_pinctrl_probe()
1647 dev_err(dev, "failed to set soc data\n"); in byt_pinctrl_probe()
1651 vg->pctldesc = byt_pinctrl_desc; in byt_pinctrl_probe()
1652 vg->pctldesc.name = dev_name(dev); in byt_pinctrl_probe()
1653 vg->pctldesc.pins = vg->soc->pins; in byt_pinctrl_probe()
1654 vg->pctldesc.npins = vg->soc->npins; in byt_pinctrl_probe()
1656 vg->pctldev = devm_pinctrl_register(dev, &vg->pctldesc, vg); in byt_pinctrl_probe()
1657 if (IS_ERR(vg->pctldev)) { in byt_pinctrl_probe()
1659 return PTR_ERR(vg->pctldev); in byt_pinctrl_probe()
1680 for (i = 0; i < vg->soc->npins; i++) { in byt_gpio_suspend()
1683 unsigned int pin = vg->soc->pins[i].number; in byt_gpio_suspend()
1687 dev_warn(vg->dev, "Pin %i: can't retrieve CONF0\n", i); in byt_gpio_suspend()
1691 vg->context.pads[i].conf0 = value; in byt_gpio_suspend()
1695 dev_warn(vg->dev, "Pin %i: can't retrieve VAL\n", i); in byt_gpio_suspend()
1699 vg->context.pads[i].val = value; in byt_gpio_suspend()
1714 for (i = 0; i < vg->soc->npins; i++) { in byt_gpio_resume()
1717 unsigned int pin = vg->soc->pins[i].number; in byt_gpio_resume()
1721 dev_warn(vg->dev, "Pin %i: can't retrieve CONF0\n", i); in byt_gpio_resume()
1726 vg->context.pads[i].conf0) { in byt_gpio_resume()
1728 value |= vg->context.pads[i].conf0; in byt_gpio_resume()
1735 dev_warn(vg->dev, "Pin %i: can't retrieve VAL\n", i); in byt_gpio_resume()
1740 vg->context.pads[i].val) { in byt_gpio_resume()
1744 v |= vg->context.pads[i].val; in byt_gpio_resume()