static int tegra_dc_rgb_init(struct tegra_dc *dc) { struct tegra_edid *edid; struct tegra_dc_edid *dc_edid; struct fb_monspecs specs; int err; if (dc->out == NULL || dc->out->dcc_bus < 0) return 0; edid = tegra_edid_create(dc->out->dcc_bus); if (IS_ERR_OR_NULL(edid)) { dev_err(&dc->ndev->dev, "rgb: can't create edid\n"); return PTR_ERR(edid); } err = tegra_edid_get_monspecs(edid, &specs); if (err < 0) { dev_err(&dc->ndev->dev, "error reading edid\n"); return err; } if (dc->pdata->default_out->n_modes > 0) { dc->mode.h_sync_width = specs.modedb->hsync_len; dc->mode.v_sync_width = specs.modedb->vsync_len; dc->mode.h_back_porch = specs.modedb->left_margin; dc->mode.v_back_porch = specs.modedb->upper_margin; dc->mode.h_active = specs.modedb->xres; dc->mode.v_active = specs.modedb->yres; dc->mode.h_front_porch = specs.modedb->right_margin; if (!machine_is_avalon() && !machine_is_titan()) dc->mode.pclk = PICOS2KHZ(specs.modedb->pixclock) * 1000; if (!machine_is_avalon()) dc->mode.v_front_porch = specs.modedb->lower_margin; } if (dc->pdata->fb) { dc->pdata->fb->xres = specs.modedb->xres; dc->pdata->fb->yres = specs.modedb->yres; } dc_edid = tegra_edid_get_data(edid); if (IS_ERR_OR_NULL(dc_edid)) return PTR_ERR(dc_edid); dc->out->width = dc_edid->buf[DTD_H_SIZE]; dc->out->height = dc_edid->buf[DTD_V_SIZE]; tegra_edid_put_data(dc_edid); if (specs.modedb->xres > specs.modedb->yres) { if (dc->out->width <= dc->out->height) dc->out->width += 0xFF; } else { if (dc->out->width > dc->out->height) dc->out->height += 0xFF; } fb_destroy_modedb(specs.modedb); return 0; }
static int tegra_wm8903_event_int_mic(struct snd_soc_dapm_widget *w, struct snd_kcontrol *k, int event) { struct snd_soc_dapm_context *dapm = w->dapm; struct snd_soc_card *card = dapm->card; struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card); struct tegra_wm8903_platform_data *pdata = machine->pdata; //printk(KERN_INFO "###### %s: %s\n", __FUNCTION__, SND_SOC_DAPM_EVENT_ON(event)?"Enable":"Disable"); if(machine_is_avalon() || machine_is_sphinx()) { if (machine->dmic_reg) { if (SND_SOC_DAPM_EVENT_ON(event)) regulator_enable(machine->dmic_reg); else regulator_disable(machine->dmic_reg); } } #ifdef CONFIG_SND_SOC_FM34 tegra_pcm_control(SND_SOC_DAPM_EVENT_ON(event), machine->cap_substream); #endif if (!(machine->gpio_requested & GPIO_INT_MIC_EN)) return 0; gpio_set_value_cansleep(pdata->gpio_int_mic_en, SND_SOC_DAPM_EVENT_ON(event)); return 0; }
static bool isl29023_read_lux(struct i2c_client *client, int *lux, int *lux2) { int lux_data; int lux_data_remaing; struct isl29023_chip *chip = i2c_get_clientdata(client); lux_data = isl29023_read_sensor_input(client, COMMMAND1_OPMODE_ALS_ONCE); if (lux_data > 0) { *lux = (lux_data * chip->range) >> chip->adc_bit; check_proper_range(chip, *lux); lux_data_remaing=(((lux_data * chip->range) & 0xffff)*10) >> chip->adc_bit; *lux2 = lux_data_remaing>9?9:lux_data_remaing; if (machine_is_avalon() || machine_is_sphinx()) { if ( *lux < 1 ) { if ( *lux2 <= 5 ) { if ( ast_mt9d115_led_get_state () > 0 ) *lux2 = 0; } } } return true; }
int __init ast_panel_init(void) { if (machine_is_avalon() || machine_is_titan()) { return avalon_panel_init(); } else if (machine_is_sphinx()) { /* panel: add sphinx-specific here */ /* NOTE: sphinx LCD panel initialization is quiet different from avalon/titan */ /* We implement it in different file, board-sphinx-panel.c */ return sphinx_panel_init(); } return 0; }
/* Initialize the pins to desired state as per power/asic/system-eng * recomendation */ int __init ast_pins_state_init(void) { if (machine_is_avalon()) { set_unused_pin_gpio(&pin_lpm_avalon[0], ARRAY_SIZE(pin_lpm_avalon)); } else if (machine_is_sphinx()) { set_unused_pin_gpio(&pin_lpm_sphinx[0], ARRAY_SIZE(pin_lpm_sphinx)); } else if (machine_is_titan()) { set_unused_pin_gpio(&pin_lpm_titan[0], ARRAY_SIZE(pin_lpm_titan)); } return 0; }
int __init ast_pinmux_init(void) { ast_gpio_init_configure(); tegra_pinmux_config_table(ast_pinmux_common, ARRAY_SIZE(ast_pinmux_common)); tegra_drive_pinmux_config_table(ast_drive_pinmux, ARRAY_SIZE(ast_drive_pinmux)); if (machine_is_avalon()) { tegra_pinmux_config_table(avalon_pinmux, ARRAY_SIZE(avalon_pinmux)); } else if (machine_is_sphinx()) { tegra_pinmux_config_table(sphinx_pinmux, ARRAY_SIZE(sphinx_pinmux)); } else if (machine_is_titan()) { tegra_pinmux_config_table(titan_pinmux, ARRAY_SIZE(titan_pinmux)); } ast_pinmux_audio_init(); return 0; }
static __devinit int tegra_wm8903_driver_probe(struct platform_device *pdev) { struct snd_soc_card *card = &snd_soc_tegra_wm8903; struct tegra_wm8903 *machine; struct tegra_wm8903_platform_data *pdata; int ret; pdata = pdev->dev.platform_data; if (!pdata) { dev_err(&pdev->dev, "No platform data supplied\n"); return -EINVAL; } machine = kzalloc(sizeof(struct tegra_wm8903), GFP_KERNEL); if (!machine) { dev_err(&pdev->dev, "Can't allocate tegra_wm8903 struct\n"); return -ENOMEM; } machine->pdata = pdata; #ifdef CONFIG_SND_SOC_FM34 mutex_init(&machine->fm34_lock); #endif ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev); if (ret) goto err_free_machine; machine->spk_reg = regulator_get(&pdev->dev, "vdd_spk_amp"); if (IS_ERR(machine->spk_reg)) { dev_info(&pdev->dev, "No speaker regulator found\n"); machine->spk_reg = 0; } machine->dmic_reg = regulator_get(&pdev->dev, "vdd_dmic"); if (IS_ERR(machine->dmic_reg)) { dev_info(&pdev->dev, "No digital mic regulator found\n"); machine->dmic_reg = 0; } if(machine_is_titan()) { regulator_enable(machine->dmic_reg); } machine->amic_reg = regulator_get(&pdev->dev, "vdd_amic"); if (IS_ERR(machine->amic_reg)) { dev_info(&pdev->dev, "No analog mic regulator found\n"); machine->amic_reg = 0; } machine->codec_reg = regulator_get(&pdev->dev, "vdd_1v8_codec"); if (IS_ERR(machine->codec_reg)) { dev_info(&pdev->dev, "No audio codec regulator found\n"); machine->codec_reg = 0; } else { if (machine_is_avalon() || machine_is_titan()) { ret = regulator_set_voltage(machine->codec_reg, 1800000, 1800000); if (ret) { dev_err(&pdev->dev, "%s regulator_set_voltage failed: %d", "vdd_1v8_codec", ret); }else { regulator_enable(machine->codec_reg); } } else if (machine_is_sphinx()) { regulator_enable(machine->codec_reg); } } tegra_wm8903_dai[0].codec_name = "wm8903.0-001a"; tegra_wm8903_dai[0].cpu_dai_name = "tegra30-i2s.1"; tegra_wm8903_dai[1].cpu_dai_name = "tegra30-spdif"; tegra_wm8903_dai[2].cpu_dai_name = "tegra30-i2s.3"; #ifdef CONFIG_SWITCH /* Addd h2w swith class support */ ret = switch_dev_register(&tegra_wm8903_headset_switch); if (ret < 0) goto err_fini_utils; #endif card->dev = &pdev->dev; platform_set_drvdata(pdev, card); snd_soc_card_set_drvdata(card, machine); ret = snd_soc_register_card(card); if (ret) { dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret); goto err_unregister_switch; } if (!card->instantiated) { ret = -ENODEV; dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret); goto err_unregister_card; } ret = device_create_file(card->dev, &dev_attr_jack_status); if (ret) { dev_err(card->dev, "%s: add_sysfs_entry jack_status failed\n", __FUNCTION__); } ret = device_create_file(card->dev, &dev_attr_input_source); if (ret) { dev_err(card->dev, "%s: add_sysfs_entry input_source failed\n", __FUNCTION__); } ret = device_create_file(card->dev, &dev_attr_voice_call); if (ret) { dev_err(card->dev, "%s: add_sysfs_entry output_source failed\n", __FUNCTION__); } ret = device_create_file(card->dev, &dev_attr_audio_mode); if (ret) { dev_err(card->dev, "%s: add_sysfs_entry audio_mode failed\n", __FUNCTION__); } return 0; err_unregister_card: snd_soc_unregister_card(card); err_unregister_switch: #ifdef CONFIG_SWITCH switch_dev_unregister(&tegra_wm8903_headset_switch); err_fini_utils: #endif tegra_asoc_utils_fini(&machine->util_data); err_free_machine: kfree(machine); return ret; }