/*jsl:import ipa.js */ /*jsl:import search.js */ /* Authors: * Adam Young * * Copyright (C) 2010 Red Hat * see file 'COPYING' for use and warranty information * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js, widget.js */ /* DNS */ IPA.entity_factories.dnszone = function() { if (!IPA.dns_enabled) { var except = { expected: true }; throw except; } return IPA.entity_builder(). entity('dnszone'). search_facet({ title: IPA.metadata.objects.dnszone.label, columns:['idnsname'] }). details_facet({ sections:[{ name:'identity', fields:[ 'idnsname', 'idnszoneactive', 'idnssoamname', 'idnssoarname', 'idnssoaserial', 'idnssoarefresh', 'idnssoaretry', 'idnssoaexpire', 'idnssoaminimum', 'dnsttl', 'dnsclass', 'idnsallowdynupdate', 'idnsupdatepolicy']}] }). nested_search_facet({ facet_group: 'member', nested_entity : 'dnsrecord', name: 'records', title: IPA.metadata.objects.dnszone.label_singular, label: IPA.metadata.objects.dnsrecord.label, load: IPA.dns_record_search_load, get_values: IPA.dnsrecord_get_delete_values, columns:[ { name: 'idnsname', label: IPA.get_entity_param('dnsrecord', 'idnsname').label, primary_key: true }, { name: 'type', label: IPA.messages.objects.dnsrecord.type }, { name: 'data', label: IPA.messages.objects.dnsrecord.data } ] }). standard_association_facets(). adder_dialog({ factory: IPA.dnszone_adder_dialog, width: 500, height: 300, fields: [ 'idnsname', { factory: IPA.checkbox_widget, name: 'name_from_ip', undo: false }, 'idnssoamname', 'idnssoarname', { factory: IPA.force_dnszone_add_checkbox_widget } ] }). build(); }; IPA.dnszone_adder_dialog = function(spec) { spec = spec || {}; var that = IPA.add_dialog(spec); that.save = function(record) { var idnsname; var name_from_ip; var fields = that.fields.values; for (var i=0; i', { 'text': IPA.messages.objects.dnsrecord.deleted_no_data }).appendTo(that.container); $('

', { 'text': IPA.messages.objects.dnsrecord.redirection_dnszone }).appendTo(that.container); }; that.add_button(IPA.messages.buttons.ok, function() { that.close(); IPA.nav.show_page('dnszone','default'); }); return that; }; IPA.dnsrecord_host_link_widget = function(spec){ var that = IPA.entity_link_widget(spec); that.other_pkeys = function(){ var pkey = that.entity.get_primary_key(); return [pkey[0]+'.'+pkey[1]]; }; return that; }; IPA.dns_record_types = function(){ var attrs = IPA.metadata.objects.dnsrecord.default_attributes; var record_types = []; for (var i =0; i < attrs.length; i+=1){ var attr = attrs[i]; var index = attr.search('record$'); if (index > -1){ var rec_type = { label: attr.substring(0,index).toUpperCase(), value: attr }; record_types.push(rec_type); } } return record_types; }; IPA.dnsrecord_type_widget = function (spec){ spec.options = IPA.dns_record_types(); var that = IPA.select_widget(spec); return that; }; IPA.force_dnszone_add_checkbox_widget = function(spec) { var param_info = IPA.get_method_option('dnszone_add', 'force'); spec.name = 'force'; spec.label = param_info.label; spec.tooltip = param_info.doc; spec.undo = false; return IPA.checkbox_widget(spec); }; IPA.dnsrecord_get_delete_values = function(){ var records = {}; var value; var record_type; $('input[name="select"]:checked', this.table.tbody).each(function() { $('span',$(this).parent().parent()).each(function(){ var name = this.attributes['name'].value; if (name === 'idnsname'){ value = records[$(this).text()]; if (!value){ value = {pkey:$(this).text()}; records[$(this).text()] = value; } }else if (name === 'type'){ record_type = $(this).text(); }else if (name === 'data'){ if (!value[record_type]){ value[record_type] = $(this).text(); }else{ value[record_type] += "," + $(this).text(); } } }); }); var value_array = []; for (var key in records){ value_array.push(records[key]); } return value_array; }; ref='#n332'>332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452

/*
 * wm9705.c  --  ALSA Soc WM9705 codec support
 *
 * Copyright 2008 Ian Molton <spyro@f2s.com>
 *
 *  This program is free software; you can redistribute  it and/or modify it
 *  under  the terms of  the GNU General  Public License as published by the
 *  Free Software Foundation; Version 2 of the  License only.
 *
 */

#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/device.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/ac97_codec.h>
#include <sound/initval.h>
#include <sound/soc.h>
#include <sound/soc-dapm.h>

#include "wm9705.h"

/*
 * WM9705 register cache
 */
static const u16 wm9705_reg[] = {
	0x6150, 0x8000, 0x8000, 0x8000, /* 0x0  */
	0x0000, 0x8000, 0x8008, 0x8008, /* 0x8  */
	0x8808, 0x8808, 0x8808, 0x8808, /* 0x10 */
	0x8808, 0x0000, 0x8000, 0x0000, /* 0x18 */
	0x0000, 0x0000, 0x0000, 0x000f, /* 0x20 */
	0x0605, 0x0000, 0xbb80, 0x0000, /* 0x28 */
	0x0000, 0xbb80, 0x0000, 0x0000, /* 0x30 */
	0x0000, 0x2000, 0x0000, 0x0000, /* 0x38 */
	0x0000, 0x0000, 0x0000, 0x0000, /* 0x40 */
	0x0000, 0x0000, 0x0000, 0x0000, /* 0x48 */
	0x0000, 0x0000, 0x0000, 0x0000, /* 0x50 */
	0x0000, 0x0000, 0x0000, 0x0000, /* 0x58 */
	0x0000, 0x0000, 0x0000, 0x0000, /* 0x60 */
	0x0000, 0x0000, 0x0000, 0x0000, /* 0x68 */
	0x0000, 0x0808, 0x0000, 0x0006, /* 0x70 */
	0x0000, 0x0000, 0x574d, 0x4c05, /* 0x78 */
};

static const struct snd_kcontrol_new wm9705_snd_ac97_controls[] = {
	SOC_DOUBLE("Master Playback Volume", AC97_MASTER, 8, 0, 31, 1),
	SOC_SINGLE("Master Playback Switch", AC97_MASTER, 15, 1, 1),
	SOC_DOUBLE("Headphone Playback Volume", AC97_HEADPHONE, 8, 0, 31, 1),
	SOC_SINGLE("Headphone Playback Switch", AC97_HEADPHONE, 15, 1, 1),
	SOC_DOUBLE("PCM Playback Volume", AC97_PCM, 8, 0, 31, 1),
	SOC_SINGLE("PCM Playback Switch", AC97_PCM, 15, 1, 1),
	SOC_SINGLE("Mono Playback Volume", AC97_MASTER_MONO, 0, 31, 1),
	SOC_SINGLE("Mono Playback Switch", AC97_MASTER_MONO, 15, 1, 1),
	SOC_SINGLE("PCBeep Playback Volume", AC97_PC_BEEP, 1, 15, 1),
	SOC_SINGLE("Phone Playback Volume", AC97_PHONE, 0, 31, 1),
	SOC_DOUBLE("Line Playback Volume", AC97_LINE, 8, 0, 31, 1),
	SOC_DOUBLE("CD Playback Volume", AC97_CD, 8, 0, 31, 1),
	SOC_SINGLE("Mic Playback Volume", AC97_MIC, 0, 31, 1),
	SOC_SINGLE("Mic 20dB Boost Switch", AC97_MIC, 6, 1, 0),
	SOC_DOUBLE("Capture Volume", AC97_REC_GAIN, 8, 0, 15, 0),
	SOC_SINGLE("Capture Switch", AC97_REC_GAIN, 15, 1, 1),
};

static const char *wm9705_mic[] = {"Mic 1", "Mic 2"};
static const char *wm9705_rec_sel[] = {"Mic", "CD", "NC", "NC",
	"Line", "Stereo Mix", "Mono Mix", "Phone"};