static void snd_byt_rt5651_mc_add_amp_en_gpio_mapping(struct device *codec) { struct byt_rt5651_acpi_resource_data data = { 0, -1 }; LIST_HEAD(resources); int ret; ret = acpi_dev_get_resources(ACPI_COMPANION(codec), &resources, snd_byt_rt5651_acpi_resource, &data); if (ret < 0) { dev_warn(codec, "Failed to get ACPI resources, not adding external amplifier GPIO mapping\n"); return; } /* All info we need is gathered during the walk */ acpi_dev_free_resource_list(&resources); switch (data.gpio_int_idx) { case 0: devm_acpi_dev_add_driver_gpios(codec, byt_rt5651_amp_en_second); break; case 1: devm_acpi_dev_add_driver_gpios(codec, byt_rt5651_amp_en_first); break; default: dev_warn(codec, "Unknown GpioInt index %d, not adding external amplifier GPIO mapping\n", data.gpio_int_idx); } }
static int dwc3_pci_quirks(struct dwc3_pci *dwc) { struct pci_dev *pdev = dwc->pci; if (pdev->vendor == PCI_VENDOR_ID_INTEL) { if (pdev->device == PCI_DEVICE_ID_INTEL_BXT || pdev->device == PCI_DEVICE_ID_INTEL_BXT_M) { guid_parse(PCI_INTEL_BXT_DSM_GUID, &dwc->guid); dwc->has_dsm_for_pm = true; } if (pdev->device == PCI_DEVICE_ID_INTEL_BYT) { struct gpio_desc *gpio; int ret; /* On BYT the FW does not always enable the refclock */ ret = dwc3_byt_enable_ulpi_refclock(pdev); if (ret) return ret; ret = devm_acpi_dev_add_driver_gpios(&pdev->dev, acpi_dwc3_byt_gpios); if (ret) dev_dbg(&pdev->dev, "failed to add mapping table\n"); /* * A lot of BYT devices lack ACPI resource entries for * the GPIOs, add a fallback mapping to the reference * design GPIOs which all boards seem to use. */ gpiod_add_lookup_table(&platform_bytcr_gpios); /* * These GPIOs will turn on the USB2 PHY. Note that we have to * put the gpio descriptors again here because the phy driver * might want to grab them, too. */ gpio = devm_gpiod_get_optional(&pdev->dev, "cs", GPIOD_OUT_LOW); if (IS_ERR(gpio)) return PTR_ERR(gpio); gpiod_set_value_cansleep(gpio, 1); gpio = devm_gpiod_get_optional(&pdev->dev, "reset", GPIOD_OUT_LOW); if (IS_ERR(gpio)) return PTR_ERR(gpio); if (gpio) { gpiod_set_value_cansleep(gpio, 1); usleep_range(10000, 11000); } } } return 0; }
static int st_nci_spi_probe(struct spi_device *dev) { struct st_nci_spi_phy *phy; int r; dev_dbg(&dev->dev, "%s\n", __func__); dev_dbg(&dev->dev, "IRQ: %d\n", dev->irq); /* Check SPI platform functionnalities */ if (!dev) { pr_debug("%s: dev is NULL. Device is not accessible.\n", __func__); return -ENODEV; } phy = devm_kzalloc(&dev->dev, sizeof(struct st_nci_spi_phy), GFP_KERNEL); if (!phy) return -ENOMEM; phy->spi_dev = dev; spi_set_drvdata(dev, phy); r = devm_acpi_dev_add_driver_gpios(&dev->dev, acpi_st_nci_gpios); if (r) dev_dbg(&dev->dev, "Unable to add GPIO mapping table\n"); /* Get RESET GPIO */ phy->gpiod_reset = devm_gpiod_get(&dev->dev, "reset", GPIOD_OUT_HIGH); if (IS_ERR(phy->gpiod_reset)) { nfc_err(&dev->dev, "Unable to get RESET GPIO\n"); return PTR_ERR(phy->gpiod_reset); } phy->se_status.is_ese_present = device_property_read_bool(&dev->dev, "ese-present"); phy->se_status.is_uicc_present = device_property_read_bool(&dev->dev, "uicc-present"); r = ndlc_probe(phy, &spi_phy_ops, &dev->dev, ST_NCI_FRAME_HEADROOM, ST_NCI_FRAME_TAILROOM, &phy->ndlc, &phy->se_status); if (r < 0) { nfc_err(&dev->dev, "Unable to register ndlc layer\n"); return r; } phy->irq_active = true; r = devm_request_threaded_irq(&dev->dev, dev->irq, NULL, st_nci_irq_thread_fn, IRQF_ONESHOT, ST_NCI_SPI_DRIVER_NAME, phy); if (r < 0) nfc_err(&dev->dev, "Unable to register IRQ handler\n"); return r; }
static int snd_cht_mc_probe(struct platform_device *pdev) { const struct dmi_system_id *dmi_id; struct device *dev = &pdev->dev; int ret_val = 0; struct cht_mc_private *drv; const char *mclk_name; int quirks = 0; dmi_id = dmi_first_match(cht_max98090_quirk_table); if (dmi_id) quirks = (unsigned long)dmi_id->driver_data; drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_KERNEL); if (!drv) return -ENOMEM; drv->ts3a227e_present = acpi_dev_found("104C227E"); if (!drv->ts3a227e_present) { /* no need probe TI jack detection chip */ snd_soc_card_cht.aux_dev = NULL; snd_soc_card_cht.num_aux_devs = 0; ret_val = devm_acpi_dev_add_driver_gpios(dev->parent, acpi_max98090_gpios); if (ret_val) dev_dbg(dev, "Unable to add GPIO mapping table\n"); } /* register the soc card */ snd_soc_card_cht.dev = &pdev->dev; snd_soc_card_set_drvdata(&snd_soc_card_cht, drv); if (quirks & QUIRK_PMC_PLT_CLK_0) mclk_name = "pmc_plt_clk_0"; else mclk_name = "pmc_plt_clk_3"; drv->mclk = devm_clk_get(&pdev->dev, mclk_name); if (IS_ERR(drv->mclk)) { dev_err(&pdev->dev, "Failed to get MCLK from %s: %ld\n", mclk_name, PTR_ERR(drv->mclk)); return PTR_ERR(drv->mclk); } ret_val = devm_snd_soc_register_card(&pdev->dev, &snd_soc_card_cht); if (ret_val) { dev_err(&pdev->dev, "snd_soc_register_card failed %d\n", ret_val); return ret_val; } platform_set_drvdata(pdev, &snd_soc_card_cht); return ret_val; }
static int dwc3_pci_quirks(struct dwc3_pci *dwc) { struct platform_device *dwc3 = dwc->dwc3; struct pci_dev *pdev = dwc->pci; if (pdev->vendor == PCI_VENDOR_ID_AMD && pdev->device == PCI_DEVICE_ID_AMD_NL_USB) { struct property_entry properties[] = { PROPERTY_ENTRY_BOOL("snps,has-lpm-erratum"), PROPERTY_ENTRY_U8("snps,lpm-nyet-threshold", 0xf), PROPERTY_ENTRY_BOOL("snps,u2exit_lfps_quirk"), PROPERTY_ENTRY_BOOL("snps,u2ss_inp3_quirk"), PROPERTY_ENTRY_BOOL("snps,req_p1p2p3_quirk"), PROPERTY_ENTRY_BOOL("snps,del_p1p2p3_quirk"), PROPERTY_ENTRY_BOOL("snps,del_phy_power_chg_quirk"), PROPERTY_ENTRY_BOOL("snps,lfps_filter_quirk"), PROPERTY_ENTRY_BOOL("snps,rx_detect_poll_quirk"), PROPERTY_ENTRY_BOOL("snps,tx_de_emphasis_quirk"), PROPERTY_ENTRY_U8("snps,tx_de_emphasis", 1), /* * FIXME these quirks should be removed when AMD NL * tapes out */ PROPERTY_ENTRY_BOOL("snps,disable_scramble_quirk"), PROPERTY_ENTRY_BOOL("snps,dis_u3_susphy_quirk"), PROPERTY_ENTRY_BOOL("snps,dis_u2_susphy_quirk"), PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"), { }, }; return platform_device_add_properties(dwc3, properties); } if (pdev->vendor == PCI_VENDOR_ID_INTEL) { int ret; struct property_entry properties[] = { PROPERTY_ENTRY_STRING("dr_mode", "peripheral"), PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"), { } }; ret = platform_device_add_properties(dwc3, properties); if (ret < 0) return ret; if (pdev->device == PCI_DEVICE_ID_INTEL_BXT || pdev->device == PCI_DEVICE_ID_INTEL_BXT_M) { guid_parse(PCI_INTEL_BXT_DSM_GUID, &dwc->guid); dwc->has_dsm_for_pm = true; } if (pdev->device == PCI_DEVICE_ID_INTEL_BYT) { struct gpio_desc *gpio; ret = devm_acpi_dev_add_driver_gpios(&pdev->dev, acpi_dwc3_byt_gpios); if (ret) dev_dbg(&pdev->dev, "failed to add mapping table\n"); /* * These GPIOs will turn on the USB2 PHY. Note that we have to * put the gpio descriptors again here because the phy driver * might want to grab them, too. */ gpio = gpiod_get_optional(&pdev->dev, "cs", GPIOD_OUT_LOW); if (IS_ERR(gpio)) return PTR_ERR(gpio); gpiod_set_value_cansleep(gpio, 1); gpiod_put(gpio); gpio = gpiod_get_optional(&pdev->dev, "reset", GPIOD_OUT_LOW); if (IS_ERR(gpio)) return PTR_ERR(gpio); if (gpio) { gpiod_set_value_cansleep(gpio, 1); gpiod_put(gpio); usleep_range(10000, 11000); } } } if (pdev->vendor == PCI_VENDOR_ID_SYNOPSYS && (pdev->device == PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3 || pdev->device == PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3_AXI || pdev->device == PCI_DEVICE_ID_SYNOPSYS_HAPSUSB31)) { struct property_entry properties[] = { PROPERTY_ENTRY_BOOL("snps,usb3_lpm_capable"), PROPERTY_ENTRY_BOOL("snps,has-lpm-erratum"), PROPERTY_ENTRY_BOOL("snps,dis_enblslpm_quirk"), PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"), { }, }; return platform_device_add_properties(dwc3, properties); } return 0; }
static int snd_cht_mc_probe(struct platform_device *pdev) { const struct dmi_system_id *dmi_id; struct device *dev = &pdev->dev; int ret_val = 0; struct cht_mc_private *drv; const char *mclk_name; struct snd_soc_acpi_mach *mach; const char *platform_name; drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_KERNEL); if (!drv) return -ENOMEM; dmi_id = dmi_first_match(cht_max98090_quirk_table); if (dmi_id) drv->quirks = (unsigned long)dmi_id->driver_data; drv->ts3a227e_present = acpi_dev_found("104C227E"); if (!drv->ts3a227e_present) { /* no need probe TI jack detection chip */ snd_soc_card_cht.aux_dev = NULL; snd_soc_card_cht.num_aux_devs = 0; ret_val = devm_acpi_dev_add_driver_gpios(dev->parent, acpi_max98090_gpios); if (ret_val) dev_dbg(dev, "Unable to add GPIO mapping table\n"); } /* override plaform name, if required */ mach = (&pdev->dev)->platform_data; platform_name = mach->mach_params.platform; ret_val = snd_soc_fixup_dai_links_platform_name(&snd_soc_card_cht, platform_name); if (ret_val) return ret_val; /* register the soc card */ snd_soc_card_cht.dev = &pdev->dev; snd_soc_card_set_drvdata(&snd_soc_card_cht, drv); if (drv->quirks & QUIRK_PMC_PLT_CLK_0) mclk_name = "pmc_plt_clk_0"; else mclk_name = "pmc_plt_clk_3"; drv->mclk = devm_clk_get(&pdev->dev, mclk_name); if (IS_ERR(drv->mclk)) { dev_err(&pdev->dev, "Failed to get MCLK from %s: %ld\n", mclk_name, PTR_ERR(drv->mclk)); return PTR_ERR(drv->mclk); } /* * Boards which have the MAX98090's clk connected to clk_0 do not seem * to like it if we muck with the clock. If we disable the clock when * it is unused we get "max98090 i2c-193C9890:00: PLL unlocked" errors * and the PLL never seems to lock again. * So for these boards we enable it here once and leave it at that. */ if (drv->quirks & QUIRK_PMC_PLT_CLK_0) { ret_val = clk_prepare_enable(drv->mclk); if (ret_val < 0) { dev_err(&pdev->dev, "MCLK enable error: %d\n", ret_val); return ret_val; } } ret_val = devm_snd_soc_register_card(&pdev->dev, &snd_soc_card_cht); if (ret_val) { dev_err(&pdev->dev, "snd_soc_register_card failed %d\n", ret_val); return ret_val; } platform_set_drvdata(pdev, &snd_soc_card_cht); return ret_val; }