static void cypress_touchkey_con_hw(struct cypress_touchkey_info *dev_info, bool flag) { struct cypress_touchkey_info *info = dev_info; gpio_set_value(info->pdata->gpio_led_en, flag ? 1 : 0); #if defined(SEC_TOUCHKEY_DEBUG) dev_notice(&info->client->dev, "%s : called with flag %d.\n", __func__, flag); #endif }
static int tegra_cec_suspend(struct platform_device *pdev, pm_message_t state) { struct tegra_cec *cec = platform_get_drvdata(pdev); /* cancel the work queue */ cancel_work_sync(&cec->work); clk_disable(cec->clk); dev_notice(&pdev->dev, "suspended\n"); return 0; }
static int mv88fx_initalize_machine_data(struct platform_device *pdev) { struct resource *r = NULL; int err = 0; mv88fx_snd_debug("mv88fx_initalize_machine_data"); mv88fx_machine_data.port = pdev->id; mv88fx_machine_data.pdata = (struct orion_i2s_platform_data *)pdev->dev.platform_data; r = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!r) { err = -ENXIO; goto error; } r = request_mem_region(r->start, SZ_16K, DRIVER_NAME); if (!r) { err = -EBUSY; goto error; } mv88fx_machine_data.res = r; mv88fx_machine_data.base = ioremap(r->start, SZ_16K); if (!mv88fx_machine_data.base) { mv88fx_snd_error("ioremap failed"); err = -ENOMEM; goto error; } mv88fx_machine_data.base -= MV_AUDIO_REGS_OFFSET(mv88fx_machine_data.port); mv88fx_machine_data.irq = platform_get_irq(pdev, 0); if (mv88fx_machine_data.irq == NO_IRQ) { err = -ENXIO; goto error; } #if defined(CONFIG_HAVE_CLK) mv88fx_machine_data.clk = clk_get(&pdev->dev, NULL); if (IS_ERR(mv88fx_machine_data.clk)) dev_notice(&pdev->dev, "cannot get clkdev\n"); else clk_enable(mv88fx_machine_data.clk); #endif return 0; error: if (mv88fx_machine_data.base) { iounmap(mv88fx_machine_data.base); mv88fx_machine_data.base = NULL; } release_mem_region(mv88fx_machine_data.res->start, SZ_16K); return err; }
static ssize_t touchkey_led_control(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct abov_tk_info *info = dev_get_drvdata(dev); struct i2c_client *client = info->client; int data; int ret; u8 cmd; ret = sscanf(buf, "%d", &data); if (ret != 1) { dev_err(&client->dev, "%s: cmd read err\n", __func__); return count; } if (!(data == 0 || data == 1)) { dev_err(&client->dev, "%s: wrong command(%d)\n", __func__, data); return count; } if (!info->enabled) return count; if (data == 1) { dev_notice(&client->dev, "led on\n"); cmd = CMD_LED_ON; } else { dev_notice(&client->dev, "led off\n"); cmd = CMD_LED_OFF; } if(info->pdata->gpio_tkey_led_en >= 0) gpio_direction_output(info->pdata->gpio_tkey_led_en,data); ret = abov_tk_i2c_write(client, ABOV_BTNSTATUS, &cmd, 1); if (ret < 0) dev_err(&client->dev, "%s fail(%d)\n", __func__, ret); return count; }
static int ccp_platform_remove(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct ccp_device *ccp = dev_get_drvdata(dev); ccp_destroy(ccp); kfree(ccp); dev_notice(dev, "disabled\n"); return 0; }
static void asus_wireless_notify(struct acpi_device *adev, u32 event) { struct asus_wireless_data *data = acpi_driver_data(adev); dev_dbg(&adev->dev, "event=%#x\n", event); if (event != 0x88) { dev_notice(&adev->dev, "Unknown ASHS event: %#x\n", event); return; } input_report_key(data->idev, KEY_RFKILL, 1); input_report_key(data->idev, KEY_RFKILL, 0); input_sync(data->idev); }
static void cypress_touchkey_brightness_set (struct led_classdev *led_cdev, enum led_brightness brightness) { /* Must not sleep, use a workqueue if needed */ if (!info) return; info->brightness = brightness; if (info->current_status && !touchkey_update_status) queue_work(info->led_wq, &info->led_work); else dev_notice(&info->client->dev, "%s under suspend status or FW updating\n", __func__); }
static int ccp_get_irqs(struct ccp_device *ccp) { struct device *dev = ccp->dev; int ret; ret = ccp_get_irq(ccp); if (!ret) return 0; /* Couldn't get an interrupt */ dev_notice(dev, "could not enable interrupts (%d)\n", ret); return ret; }
static void cypress_touchkey_con_hw(struct cypress_touchkey_info *info, bool flag) { if (flag) { gpio_set_value(info->pdata->gpio_ldo_en, 1); gpio_set_value(info->pdata->gpio_led_en, 1); } else { gpio_set_value(info->pdata->gpio_led_en, 0); gpio_set_value(info->pdata->gpio_ldo_en, 0); } #if !defined(CONFIG_SAMSUNG_PRODUCT_SHIP) dev_notice(&info->client->dev, "%s : called with flag %d.\n", __func__, flag); #endif }
static ssize_t tc300k_led_control(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct tc300k_data *data = dev_get_drvdata(dev); struct i2c_client *client = data->client; int scan_buffer; int ret; u8 cmd; ret = sscanf(buf, "%d", &scan_buffer); if (ret != 1) { dev_err(&client->dev, "%s: cmd read err\n", __func__); return count; } if (!(scan_buffer == 0 || scan_buffer == 1)) { dev_err(&client->dev, "%s: wrong command(%d)\n", __func__, scan_buffer); return count; } if ((!data->enabled) || data->fw_downloding) return count; if (scan_buffer == 1) { dev_notice(&client->dev, "led on\n"); cmd = TC300K_CMD_LED_ON; } else { dev_notice(&client->dev, "led off\n"); cmd = TC300K_CMD_LED_OFF; } ret = i2c_smbus_write_byte_data(client, TC300K_CMD_ADDR, cmd); if (ret < 0) dev_err(&client->dev, "%s fail(%d)\n", __func__, ret); return count; }
static ssize_t touchkey_fw_update(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct abov_tk_info *info = dev_get_drvdata(dev); struct i2c_client *client = info->client; int ret; u8 cmd; if (info->fw_update_possible == false) { dev_err(&client->dev, "%s fail (no reset pin)\n", __func__); info->fw_update_state = 2; goto touchkey_fw_update_out; } switch(*buf) { case 's': case 'S': cmd = BUILT_IN; break; case 'i': case 'I': cmd = SDCARD; break; default: info->fw_update_state = 2; goto touchkey_fw_update_out; } info->fw_update_state = 1; disable_irq(info->irq); info->enabled = false; ret = abov_flash_fw(info, false, cmd); if (info->glovemode) abov_glove_mode_enable(client, CMD_GLOVE_ON); info->enabled = true; enable_irq(info->irq); if (ret) { dev_err(&client->dev, "%s fail\n", __func__); info->fw_update_state = 2; } else { dev_notice(&client->dev, "%s success\n", __func__); info->fw_update_state = 0; } touchkey_fw_update_out: dev_dbg(&client->dev, "%s : %d\n", __func__, info->fw_update_state); return count; }
/* * The open implementation. */ static int kern_open(struct inode *inode, struct file *filp) { /* you can use dev_printk like you would printk only with the added device... */ dev_printk(KERN_DEBUG, my_device, "this is my debug message"); /* or better yet, use the predefined ones: */ dev_emerg(my_device, "emergency"); dev_alert(my_device, "alert"); dev_crit(my_device, "critical"); dev_err(my_device, "error"); dev_warn(my_device, "warning"); dev_notice(my_device, "notice"); dev_info(my_device, "info"); return 0; }
void ni_tio_handle_interrupt(struct ni_gpct *counter, struct comedi_subdevice *s) { unsigned int cidx = counter->counter_index; unsigned long flags; int gate_error; int tc_error; int perm_stale_data; ni_tio_acknowledge_and_confirm(counter, &gate_error, &tc_error, &perm_stale_data); if (gate_error) { dev_notice(counter->counter_dev->dev->class_dev, "%s: Gi_Gate_Error detected.\n", __func__); s->async->events |= COMEDI_CB_OVERFLOW; } if (perm_stale_data) s->async->events |= COMEDI_CB_ERROR; switch (counter->counter_dev->variant) { case ni_gpct_variant_m_series: case ni_gpct_variant_660x: if (ni_tio_read(counter, NITIO_DMA_STATUS_REG(cidx)) & GI_DRQ_ERROR) { dev_notice(counter->counter_dev->dev->class_dev, "%s: Gi_DRQ_Error detected.\n", __func__); s->async->events |= COMEDI_CB_OVERFLOW; } break; case ni_gpct_variant_e_series: break; } spin_lock_irqsave(&counter->lock, flags); if (counter->mite_chan) mite_ack_linkc(counter->mite_chan, s, true); spin_unlock_irqrestore(&counter->lock, flags); }
void iwmct_dbg_init_params(struct iwmct_priv *priv) { #ifdef CONFIG_IWMC3200TOP_DEBUG int i; for (i = 0; i < log_level_argc; i++) { dev_notice(&priv->func->dev, "log_level[%d]=0x%X\n", i, log_level[i]); iwmct_log_set_filter((log_level[i] >> 8) & 0xFF, log_level[i] & 0xFF); } for (i = 0; i < log_level_fw_argc; i++) { dev_notice(&priv->func->dev, "log_level_fw[%d]=0x%X\n", i, log_level_fw[i]); iwmct_log_set_fw_filter((log_level_fw[i] >> 8) & 0xFF, log_level_fw[i] & 0xFF); } #endif priv->dbg.blocks = blocks; LOG_INFO(priv, INIT, "blocks=%d\n", blocks); priv->dbg.dump = (bool)dump; LOG_INFO(priv, INIT, "dump=%d\n", dump); priv->dbg.jump = (bool)jump; LOG_INFO(priv, INIT, "jump=%d\n", jump); priv->dbg.direct = (bool)direct; LOG_INFO(priv, INIT, "direct=%d\n", direct); priv->dbg.checksum = (bool)checksum; LOG_INFO(priv, INIT, "checksum=%d\n", checksum); priv->dbg.fw_download = (bool)fw_download; LOG_INFO(priv, INIT, "fw_download=%d\n", fw_download); priv->dbg.block_size = block_size; LOG_INFO(priv, INIT, "block_size=%d\n", block_size); priv->dbg.download_trans_blks = download_trans_blks; LOG_INFO(priv, INIT, "download_trans_blks=%d\n", download_trans_blks); }
/* * Function: dma_dwc_init * arguments: hsdev * returns status * This function initializes the SATA DMA driver */ static int dma_dwc_init(struct sata_dwc_device *hsdev, int irq) { int err; err = dma_request_interrupts(hsdev, irq); if (err) { dev_err(host_pvt.dwc_dev, "%s: dma_request_interrupts returns" " %d\n", __func__, err); goto error_out; } /* Enabe DMA */ out_le32(&(host_pvt.sata_dma_regs->dma_cfg.low), DMA_EN); dev_notice(host_pvt.dwc_dev, "DMA initialized\n"); dev_d
static ssize_t set_pwm(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) { struct pc87427_data *data = dev_get_drvdata(dev); int nr = to_sensor_dev_attr(devattr)->index; unsigned long val; int iobase = data->address[LD_FAN]; u8 mode; if (kstrtoul(buf, 10, &val) < 0 || val > 0xff) return -EINVAL; mutex_lock(&data->lock); pc87427_readall_pwm(data, nr); mode = data->pwm_enable[nr] & PWM_ENABLE_MODE_MASK; if (mode != PWM_MODE_MANUAL && mode != PWM_MODE_OFF) { dev_notice(dev, "Can't set PWM%d duty cycle while not in manual mode\n", nr + 1); mutex_unlock(&data->lock); return -EPERM; } /* We may have to change the mode */ if (mode == PWM_MODE_MANUAL && val == 0) { /* Transition from Manual to Off */ update_pwm_enable(data, nr, PWM_MODE_OFF); mode = PWM_MODE_OFF; dev_dbg(dev, "Switching PWM%d from %s to %s\n", nr + 1, "manual", "off"); } else if (mode == PWM_MODE_OFF && val != 0) { /* Transition from Off to Manual */ update_pwm_enable(data, nr, PWM_MODE_MANUAL); mode = PWM_MODE_MANUAL; dev_dbg(dev, "Switching PWM%d from %s to %s\n", nr + 1, "off", "manual"); } data->pwm[nr] = val; if (mode == PWM_MODE_MANUAL) outb(val, iobase + PC87427_REG_PWM_DUTY); mutex_unlock(&data->lock); return count; }
static void xonar_ext_power_gpio_changed(struct oxygen *chip) { struct xonar_generic *data = chip->model_data; u8 has_power; has_power = !!(oxygen_read8(chip, data->ext_power_reg) & data->ext_power_bit); if (has_power != data->has_power) { data->has_power = has_power; if (has_power) { dev_notice(chip->card->dev, "power restored\n"); } else { dev_crit(chip->card->dev, "Hey! Don't unplug the power cable!\n"); /* TODO: stop PCMs */ } } }
static int imx1_pinctrl_parse_groups(struct device_node *np, struct imx1_pin_group *grp, struct imx1_pinctrl_soc_info *info, u32 index) { int size; const __be32 *list; int i; dev_dbg(info->dev, "group(%d): %s\n", index, np->name); /* Initialise group */ grp->name = np->name; /* * the binding format is fsl,pins = <PIN MUX_ID CONFIG> */ list = of_get_property(np, "fsl,pins", &size); /* we do not check return since it's safe node passed down */ if (!size || size % 12) { dev_notice(info->dev, "Not a valid fsl,pins property (%s)\n", np->name); return -EINVAL; } grp->npins = size / 12; grp->pins = devm_kzalloc(info->dev, grp->npins * sizeof(struct imx1_pin), GFP_KERNEL); grp->pin_ids = devm_kzalloc(info->dev, grp->npins * sizeof(unsigned int), GFP_KERNEL); if (!grp->pins || !grp->pin_ids) return -ENOMEM; for (i = 0; i < grp->npins; i++) { grp->pins[i].pin_id = be32_to_cpu(*list++); grp->pins[i].mux_id = be32_to_cpu(*list++); grp->pins[i].config = be32_to_cpu(*list++); grp->pin_ids[i] = grp->pins[i].pin_id; } return 0; }
static int ccp_get_irq(struct ccp_device *ccp) { struct device *dev = ccp->dev; struct platform_device *pdev = container_of(dev, struct platform_device, dev); int ret; ret = platform_get_irq(pdev, 0); if (ret < 0) return ret; ccp->irq = ret; ret = request_irq(ccp->irq, ccp_irq_handler, 0, "ccp", dev); if (ret) { dev_notice(dev, "unable to allocate IRQ (%d)\n", ret); return ret; } return 0; }
static int tegra_cec_suspend(struct platform_device *pdev, pm_message_t state) { struct tegra_cec *cec = platform_get_drvdata(pdev); atomic_set(&cec->init_cancel, 1); wmb(); wake_up_interruptible(&cec->suspend_waitq); /* cancel the work queue */ cancel_work_sync(&cec->work); atomic_set(&cec->init_done, 0); atomic_set(&cec->init_cancel, 0); clk_disable(cec->clk); dev_notice(&pdev->dev, "suspended\n"); return 0; }
static int abov_tk_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct abov_tk_info *info = i2c_get_clientdata(client); if (!info->enabled) return 0; dev_notice(&info->client->dev, "%s: users=%d\n", __func__, info->input_dev->users); disable_irq(info->irq); info->enabled = false; release_all_fingers(info); if (info->pdata->power) info->pdata->power(info->pdata, false); else abov_sleep_mode(client, CMD_STOP_MODE); return 0; }
static int ambarella_wdt_release(struct inode *inode, struct file *file) { int errorCode = -EBUSY; struct ambarella_wdt_info *pinfo; pinfo = (struct ambarella_wdt_info *)file->private_data; if (pinfo) { if (pinfo->state == AMBA_WDT_CLOSE_STATE_ALLOW) { ambarella_wdt_stop(pinfo); } else { dev_notice(pinfo->dev, "Not stopping watchdog, V first!\n"); ambarella_wdt_keepalive(pinfo); } pinfo->state = AMBA_WDT_CLOSE_STATE_DISABLE; up(&pinfo->wdt_mutex); errorCode = 0; } return errorCode; }
static int gadc_thermal_read_linear_lookup_table(struct device *dev, struct gadc_thermal_info *gti) { struct device_node *np = dev->of_node; int ntable; int ret; ntable = of_property_count_elems_of_size(np, "temperature-lookup-table", sizeof(u32)); if (ntable <= 0) { dev_notice(dev, "no lookup table, assuming DAC channel returns milliCelcius\n"); return 0; } if (ntable % 2) { dev_err(dev, "Pair of temperature vs ADC read value missing\n"); return -EINVAL; } gti->lookup_table = devm_kcalloc(dev, ntable, sizeof(*gti->lookup_table), GFP_KERNEL); if (!gti->lookup_table) return -ENOMEM; ret = of_property_read_u32_array(np, "temperature-lookup-table", (u32 *)gti->lookup_table, ntable); if (ret < 0) { dev_err(dev, "Failed to read temperature lookup table: %d\n", ret); return ret; } gti->nlookup_table = ntable / 2; return 0; }
/* * netvsc_device_remove - Callback when the root bus device is removed */ int netvsc_device_remove(struct hv_device *device) { struct netvsc_device *net_device; unsigned long flags; net_device = hv_get_drvdata(device); netvsc_disconnect_vsp(net_device); /* * Since we have already drained, we don't need to busy wait * as was done in final_release_stor_device() * Note that we cannot set the ext pointer to NULL until * we have drained - to drain the outgoing packets, we need to * allow incoming packets. */ spin_lock_irqsave(&device->channel->inbound_lock, flags); hv_set_drvdata(device, NULL); spin_unlock_irqrestore(&device->channel->inbound_lock, flags); /* * At this point, no one should be accessing net_device * except in here */ dev_notice(&device->device, "net device safe to remove\n"); /* Now, we can close the channel safely */ vmbus_close(device->channel); /* Release all resources */ if (net_device->sub_cb_buf) vfree(net_device->sub_cb_buf); kfree(net_device); return 0; }
/* * netvsc_device_remove - Callback when the root bus device is removed */ int netvsc_device_remove(struct hv_device *device) { struct net_device *ndev = hv_get_drvdata(device); struct net_device_context *net_device_ctx = netdev_priv(ndev); struct netvsc_device *net_device = net_device_ctx->nvdev; netvsc_disconnect_vsp(device); net_device_ctx->nvdev = NULL; /* * At this point, no one should be accessing net_device * except in here */ dev_notice(&device->device, "net device safe to remove\n"); /* Now, we can close the channel safely */ vmbus_close(device->channel); /* Release all resources */ vfree(net_device->sub_cb_buf); free_netvsc_device(net_device); return 0; }
static int gpio_function_request(struct gpio_chip *gc, unsigned offset) { static bool __print_once; struct sh_pfc *pfc = gpio_to_pfc(gc); unsigned int mark = pfc->info->func_gpios[offset].enum_id; unsigned long flags; int ret; if (!__print_once) { dev_notice(pfc->dev, "Use of GPIO API for function requests is deprecated." " Convert to pinctrl\n"); __print_once = true; } if (mark == 0) return -EINVAL; spin_lock_irqsave(&pfc->lock, flags); ret = sh_pfc_config_mux(pfc, mark, PINMUX_TYPE_FUNCTION); spin_unlock_irqrestore(&pfc->lock, flags); return ret; }
static int stm_fdma_fw_request(struct stm_fdma_device *fdev) { const struct firmware *fw = NULL; struct ELF32_info *elfinfo = NULL; int result = 0; int fw_major, fw_minor; int hw_major, hw_minor; uint8_t *fw_data; BUG_ON(!fdev); /* Generate FDMA firmware file name */ result = snprintf(fdev->fw_name, sizeof(fdev->fw_name), "fdma_%s_%d.elf", stm_soc(), (fdev->fdma_id == -1) ? 0 : fdev->fdma_id); BUG_ON(result >= sizeof(fdev->fw_name)); dev_notice(fdev->dev, "Requesting firmware: %s\n", fdev->fw_name); /* Request the FDMA firmware */ result = request_firmware(&fw, fdev->fw_name, fdev->dev); if (result || !fw) { dev_err(fdev->dev, "Failed request firmware: not present?\n"); result = -ENODEV; goto error_no_fw; } #ifdef CONFIG_HIBERNATION /* Save a copy of the firmware data for future reload */ fw_data = devm_kzalloc(fdev->dev, fw->size, GFP_KERNEL); if (!fw_data) { dev_err(fdev->dev, "Cannot allocate memory for firmware\n"); result = -ENOMEM; goto error_elf_init; } memcpy(fw_data, fw->data, fw->size); #else /* Set pointer to the firmware data */ fw_data = (uint8_t *) fw->data; #endif /* Initialise firmware as an in-memory ELF file */ elfinfo = (struct ELF32_info *)ELF32_initFromMem(fw_data, fw->size, 0); if (elfinfo == NULL) { dev_err(fdev->dev, "Failed to initialise in-memory ELF file\n"); result = -ENOMEM; goto error_elf_init; } /* Attempt to load the ELF file */ result = stm_fdma_fw_load(fdev, elfinfo); if (result) { dev_err(fdev->dev, "Failed to load firmware\n"); goto error_elf_load; } /* Retrieve the hardware and firmware versions */ stm_fdma_hw_get_revisions(fdev, &hw_major, &hw_minor, &fw_major, &fw_minor); dev_notice(fdev->dev, "SLIM hw %d.%d, FDMA fw %d.%d\n", hw_major, hw_minor, fw_major, fw_minor); /* Indicate firmware loaded */ fdev->fw_state = STM_FDMA_FW_STATE_LOADED; /* Save pointer to ELF (which points at fw_data) for future reload */ fdev->fw_elfinfo = elfinfo; /* Wake up the wait queue */ wake_up(&fdev->fw_load_q); /* Release the firmware */ release_firmware(fw); return 0; error_elf_load: ELF32_free(elfinfo); error_elf_init: if (fw_data && fw_data != fw->data) devm_kfree(fdev->dev, fw_data); release_firmware(fw); error_no_fw: fdev->fw_state = STM_FDMA_FW_STATE_ERROR; return result; }
static int piix4_setup(struct pci_dev *PIIX4_dev, const struct pci_device_id *id) { unsigned char temp; unsigned short piix4_smba; if ((PIIX4_dev->vendor == PCI_VENDOR_ID_SERVERWORKS) && (PIIX4_dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5)) srvrworks_csb5_delay = 1; /* On some motherboards, it was reported that accessing the SMBus caused severe hardware problems */ if (dmi_check_system(piix4_dmi_blacklist)) { dev_err(&PIIX4_dev->dev, "Accessing the SMBus on this system is unsafe!\n"); return -EPERM; } /* Don't access SMBus on IBM systems which get corrupted eeproms */ if (dmi_check_system(piix4_dmi_ibm) && PIIX4_dev->vendor == PCI_VENDOR_ID_INTEL) { dev_err(&PIIX4_dev->dev, "IBM system detected; this module " "may corrupt your serial eeprom! Refusing to load " "module!\n"); return -EPERM; } /* Determine the address of the SMBus areas */ if (force_addr) { piix4_smba = force_addr & 0xfff0; force = 0; } else { pci_read_config_word(PIIX4_dev, SMBBA, &piix4_smba); piix4_smba &= 0xfff0; if(piix4_smba == 0) { dev_err(&PIIX4_dev->dev, "SMBus base address " "uninitialized - upgrade BIOS or use " "force_addr=0xaddr\n"); return -ENODEV; } } if (acpi_check_region(piix4_smba, SMBIOSIZE, piix4_driver.name)) return -ENODEV; if (!request_region(piix4_smba, SMBIOSIZE, piix4_driver.name)) { dev_err(&PIIX4_dev->dev, "SMBus region 0x%x already in use!\n", piix4_smba); return -EBUSY; } pci_read_config_byte(PIIX4_dev, SMBHSTCFG, &temp); /* If force_addr is set, we program the new address here. Just to make sure, we disable the PIIX4 first. */ if (force_addr) { pci_write_config_byte(PIIX4_dev, SMBHSTCFG, temp & 0xfe); pci_write_config_word(PIIX4_dev, SMBBA, piix4_smba); pci_write_config_byte(PIIX4_dev, SMBHSTCFG, temp | 0x01); dev_info(&PIIX4_dev->dev, "WARNING: SMBus interface set to " "new address %04x!\n", piix4_smba); } else if ((temp & 1) == 0) { if (force) { /* This should never need to be done, but has been * noted that many Dell machines have the SMBus * interface on the PIIX4 disabled!? NOTE: This assumes * I/O space and other allocations WERE done by the * Bios! Don't complain if your hardware does weird * things after enabling this. :') Check for Bios * updates before resorting to this. */ pci_write_config_byte(PIIX4_dev, SMBHSTCFG, temp | 1); dev_notice(&PIIX4_dev->dev, "WARNING: SMBus interface has been FORCEFULLY ENABLED!\n"); } else { dev_err(&PIIX4_dev->dev, "Host SMBus controller not enabled!\n"); release_region(piix4_smba, SMBIOSIZE); return -ENODEV; } } if (((temp & 0x0E) == 8) || ((temp & 0x0E) == 2)) dev_dbg(&PIIX4_dev->dev, "Using Interrupt 9 for SMBus.\n"); else if ((temp & 0x0E) == 0) dev_dbg(&PIIX4_dev->dev, "Using Interrupt SMI# for SMBus.\n"); else dev_err(&PIIX4_dev->dev, "Illegal Interrupt configuration " "(or code out of date)!\n"); pci_read_config_byte(PIIX4_dev, SMBREV, &temp); dev_info(&PIIX4_dev->dev, "SMBus Host Controller at 0x%x, revision %d\n", piix4_smba, temp); return piix4_smba; }
static int __init tegra_rtc_probe(struct platform_device *pdev) { struct resource *res; int ret; /* get resources from arch/arm/mach-tegra/board-nvodm.c */ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { dev_err( &pdev->dev, "Unable to allocate resources for device.\n" ); return -EBUSY; } tegra_rtc_irq = platform_get_irq(pdev, 0); if (tegra_rtc_irq <= 0) { tegra_rtc_irq = 0; return -EBUSY; } rtc_base = ioremap(res->start, res->end - res->start + 1); if (!rtc_base) { dev_err(&pdev->dev, "Unable to grab IOs for device.\n"); return -EBUSY; } /* clear out the hardware. */ tegra_rtc_write_not_busy(&pdev->dev, RTC_TEGRA_REG_SECONDS_ALARM0, 0); tegra_rtc_write_not_busy(&pdev->dev, RTC_TEGRA_REG_INTR_STATUS, -1); tegra_rtc_write_not_busy(&pdev->dev, RTC_TEGRA_REG_INTR_MASK, 0); device_init_wakeup(&pdev->dev, 1); rtc_dev = rtc_device_register( pdev->name, &pdev->dev, &tegra_rtc_ops, THIS_MODULE); if (IS_ERR(rtc_dev)) { ret = PTR_ERR(rtc_dev); rtc_dev = NULL; dev_err(&pdev->dev, "Unable to register device (err=%d).\n", ret); goto err_iounmap; } ret = request_irq(tegra_rtc_irq, tegra_rtc_irq_handler, IRQF_DISABLED, "rtc alarm", &pdev->dev); if (ret) { dev_err(&pdev->dev, "Unable to request interrupt for device (err=%d).\n", ret); goto err_dev_unreg; } dev_notice(&pdev->dev, "Tegra internal Real Time Clock\n"); return 0; err_dev_unreg: rtc_device_unregister(rtc_dev); rtc_dev = NULL; err_iounmap: iounmap(rtc_base); rtc_base = NULL; return ret; }
static int __devinit fsl_ssi_probe(struct platform_device *pdev, const struct of_device_id *match) { struct fsl_ssi_private *ssi_private; int ret = 0; struct device_attribute *dev_attr = NULL; struct device_node *np = pdev->dev.of_node; const char *p, *sprop; const uint32_t *iprop; struct resource res; char name[64]; /* SSIs that are not connected on the board should have a * status = "disabled" * property in their device tree nodes. */ if (!of_device_is_available(np)) return -ENODEV; /* Check for a codec-handle property. */ if (!of_get_property(np, "codec-handle", NULL)) { dev_err(&pdev->dev, "missing codec-handle property\n"); return -ENODEV; } /* We only support the SSI in "I2S Slave" mode */ sprop = of_get_property(np, "fsl,mode", NULL); if (!sprop || strcmp(sprop, "i2s-slave")) { dev_notice(&pdev->dev, "mode %s is unsupported\n", sprop); return -ENODEV; } /* The DAI name is the last part of the full name of the node. */ p = strrchr(np->full_name, '/') + 1; ssi_private = kzalloc(sizeof(struct fsl_ssi_private) + strlen(p), GFP_KERNEL); if (!ssi_private) { dev_err(&pdev->dev, "could not allocate DAI object\n"); return -ENOMEM; } strcpy(ssi_private->name, p); /* Initialize this copy of the CPU DAI driver structure */ memcpy(&ssi_private->cpu_dai_drv, &fsl_ssi_dai_template, sizeof(fsl_ssi_dai_template)); ssi_private->cpu_dai_drv.name = ssi_private->name; /* Get the addresses and IRQ */ ret = of_address_to_resource(np, 0, &res); if (ret) { dev_err(&pdev->dev, "could not determine device resources\n"); kfree(ssi_private); return ret; } ssi_private->ssi = ioremap(res.start, 1 + res.end - res.start); ssi_private->ssi_phys = res.start; ssi_private->irq = irq_of_parse_and_map(np, 0); /* Are the RX and the TX clocks locked? */ if (of_find_property(np, "fsl,ssi-asynchronous", NULL)) ssi_private->asynchronous = 1; else ssi_private->cpu_dai_drv.symmetric_rates = 1; /* Determine the FIFO depth. */ iprop = of_get_property(np, "fsl,fifo-depth", NULL); if (iprop) ssi_private->fifo_depth = *iprop; else /* Older 8610 DTs didn't have the fifo-depth property */ ssi_private->fifo_depth = 8; /* Initialize the the device_attribute structure */ dev_attr = &ssi_private->dev_attr; dev_attr->attr.name = "statistics"; dev_attr->attr.mode = S_IRUGO; dev_attr->show = fsl_sysfs_ssi_show; ret = device_create_file(&pdev->dev, dev_attr); if (ret) { dev_err(&pdev->dev, "could not create sysfs %s file\n", ssi_private->dev_attr.attr.name); goto error; } /* Register with ASoC */ dev_set_drvdata(&pdev->dev, ssi_private); ret = snd_soc_register_dai(&pdev->dev, &ssi_private->cpu_dai_drv); if (ret) { dev_err(&pdev->dev, "failed to register DAI: %d\n", ret); goto error; } /* Trigger the machine driver's probe function. The platform driver * name of the machine driver is taken from the /model property of the * device tree. We also pass the address of the CPU DAI driver * structure. */ sprop = of_get_property(of_find_node_by_path("/"), "model", NULL); /* Sometimes the model name has a "fsl," prefix, so we strip that. */ p = strrchr(sprop, ','); if (p) sprop = p + 1; snprintf(name, sizeof(name), "snd-soc-%s", sprop); make_lowercase(name); ssi_private->pdev = platform_device_register_data(&pdev->dev, name, 0, NULL, 0); if (IS_ERR(ssi_private->pdev)) { ret = PTR_ERR(ssi_private->pdev); dev_err(&pdev->dev, "failed to register platform: %d\n", ret); goto error; } return 0; error: snd_soc_unregister_dai(&pdev->dev); dev_set_drvdata(&pdev->dev, NULL); if (dev_attr) device_remove_file(&pdev->dev, dev_attr); irq_dispose_mapping(ssi_private->irq); iounmap(ssi_private->ssi); kfree(ssi_private); return ret; }