Changeset 625
- Timestamp:
- Jan 3, 2021, 7:20:20 AM (5 years ago)
- Location:
- GPL/branches/uniaud32-next
- Files:
-
- 4 added
- 74 edited
Legend:
- Unmodified
- Added
- Removed
-
GPL/branches/uniaud32-next/alsa-kernel/core/hwdep.c
r615 r625 5 5 */ 6 6 7 #ifdef TARGET_OS28 #include <sound/core.h>9 #endif10 7 #include <linux/major.h> 11 8 #include <linux/init.h> -
GPL/branches/uniaud32-next/alsa-kernel/core/info.c
r619 r625 232 232 static int snd_info_entry_mmap(struct file *file, struct vm_area_struct *vma) 233 233 { 234 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)235 234 struct inode *inode = file_inode(file); 236 #else237 struct inode *inode = file->f_dentry->d_inode;238 #endif239 235 struct snd_info_private_data *data; 240 236 struct snd_info_entry *entry; … … 479 475 return -ENOMEM; 480 476 snd_proc_root->mode = S_IFDIR | 0555; 481 #ifndef TARGET_OS2482 477 snd_proc_root->p = proc_mkdir("asound", NULL); 483 #else484 snd_proc_root->p = create_proc_entry("asound", S_IFDIR | S_IRUGO | S_IXUGO, NULL);485 #endif486 478 if (!snd_proc_root->p) 487 479 goto error; … … 491 483 goto error; 492 484 #endif 493 #if IS_ENABLED(CONFIG_SND_SEQUENCER) 485 #if IS_ENABLED(CONFIG_SND_SEQUENCER) 494 486 snd_seq_root = create_subdir(THIS_MODULE, "seq"); 495 487 if (!snd_seq_root) … … 551 543 int snd_info_card_register(struct snd_card *card) 552 544 { 553 #ifndef TARGET_OS2554 545 struct proc_dir_entry *p; 555 #endif556 546 int err; 557 547 … … 568 558 if (card->proc_root_link) 569 559 return 0; 570 #ifndef TARGET_OS2571 560 p = proc_symlink(card->id, snd_proc_root->p, card->proc_root->name); 572 561 if (!p) 573 562 return -ENOMEM; 574 563 card->proc_root_link = p; 575 #endif576 564 return 0; 577 565 } … … 587 575 card->proc_root_link = NULL; 588 576 } 589 #ifndef TARGET_OS2590 577 if (strcmp(card->id, card->proc_root->name)) 591 578 card->proc_root_link = proc_symlink(card->id, 592 579 snd_proc_root->p, 593 580 card->proc_root->name); 594 #endif595 581 mutex_unlock(&info_mutex); 596 582 } -
GPL/branches/uniaud32-next/alsa-kernel/core/init.c
r615 r625 5 5 */ 6 6 7 #ifdef TARGET_OS28 #include <sound/core.h>9 #include <sound/initval.h>10 #include <linux/sysfs.h>11 struct class *sound_class;12 #endif13 7 #include <linux/init.h> 14 8 #include <linux/sched.h> … … 26 20 #include <sound/info.h> 27 21 22 #ifdef TARGET_OS2 23 struct class *sound_class; 24 #endif 25 28 26 /* monitor files for graceful shutdown (hotplug) */ 29 27 struct snd_monitor_file { … … 55 53 { 56 54 int match = 1; 57 #ifndef TARGET_OS258 55 #ifdef MODULE 59 56 const char *s1, *s2; … … 84 81 } 85 82 #endif /* MODULE */ 86 #endif87 83 return match; 88 84 } … … 229 225 card->card_dev.class = sound_class; 230 226 card->card_dev.release = release_card_device; 231 #ifndef TARGET_OS2232 227 card->card_dev.groups = card->dev_groups; 233 228 card->dev_groups[0] = &card_dev_attr_group; … … 235 230 if (err < 0) 236 231 goto __error; 232 237 233 snprintf(card->irq_descr, sizeof(card->irq_descr), "%s:%s", 238 234 dev_driver_string(card->dev), dev_name(&card->card_dev)); 239 #endif 235 240 236 /* the control interface cannot be accessed from the user space until */ 241 237 /* snd_cards_bitmask and snd_cards are set with snd_card_register */ … … 478 474 479 475 spin_lock_irq(&card->files_lock); 480 #ifndef TARGET_OS2481 476 wait_event_lock_irq(card->remove_sleep, 482 477 list_empty(&card->files_list), 483 478 card->files_lock); 484 #endif485 479 spin_unlock_irq(&card->files_lock); 486 480 } … … 548 542 if (ret) 549 543 return ret; 550 #ifndef TARGET_OS2551 544 /* wait, until all devices are ready for the free operation */ 552 545 wait_for_completion(&released); 553 #endif554 546 return 0; 555 547 } … … 709 701 return count; 710 702 } 711 #endif 712 713 #ifdef NOT_USED 703 714 704 static DEVICE_ATTR(id, 0644, card_id_show_attr, card_id_store_attr); 715 705 … … 1000 990 } 1001 991 } 1002 #ifndef TARGET_OS21003 992 if (list_empty(&card->files_list)) 1004 993 wake_up_all(&card->remove_sleep); 1005 #endif1006 994 spin_unlock(&card->files_lock); 1007 995 if (!found) { -
GPL/branches/uniaud32-next/alsa-kernel/core/memalloc.c
r615 r625 8 8 9 9 #ifdef TARGET_OS2 10 #include <sound/co re.h>10 #include <sound/config.h> //for CONFIG_HAS_DMA 11 11 #endif 12 12 #include <linux/slab.h> -
GPL/branches/uniaud32-next/alsa-kernel/core/misc.c
r615 r625 31 31 if (res) { 32 32 release_resource(res); 33 kfree _nocheck(res);33 kfree(res); 34 34 } 35 35 } -
GPL/branches/uniaud32-next/alsa-kernel/core/oss/pcm_oss.c
r615 r625 1456 1456 if (substream->oss.setup.partialfrag || 1457 1457 runtime->oss.buffer_used == runtime->oss.period_bytes) { 1458 tmp = snd_pcm_oss_write2(substream, runtime->oss.buffer + runtime->oss.period_ptr, 1458 tmp = snd_pcm_oss_write2(substream, runtime->oss.buffer + runtime->oss.period_ptr, 1459 1459 runtime->oss.buffer_used - runtime->oss.period_ptr, 1); 1460 1460 if (tmp <= 0) -
GPL/branches/uniaud32-next/alsa-kernel/core/pcm.c
r615 r625 1030 1030 return snprintf(buf, PAGE_SIZE, "%s\n", str); 1031 1031 } 1032 #endif 1033 1034 #ifndef TARGET_OS2 1032 1035 1033 static DEVICE_ATTR(pcm_class, 0444, show_pcm_class, NULL); 1036 1034 static struct attribute *pcm_dev_attrs[] = { -
GPL/branches/uniaud32-next/alsa-kernel/core/pcm_lib.c
r619 r625 1408 1408 if ((snd_interval_value(i) == width) || 1409 1409 (width == 0 && snd_interval_value(i) > msbits)) 1410 #ifdef TARGET_OS2 //fixme 1410 #ifdef TARGET_OS2 //fixme min_not_zero uses typeof() 1411 1411 params->msbits = msbits; 1412 1412 #else -
GPL/branches/uniaud32-next/alsa-kernel/core/pcm_native.c
r621 r625 1972 1972 1973 1973 1974 #ifndef TARGET_OS21975 1974 static bool is_pcm_file(struct file *file) 1976 1975 { … … 1990 1989 return true; 1991 1990 } 1992 #endif1993 1991 1994 1992 /* … … 2011 2009 if (!f.file) 2012 2010 return -EBADFD; 2013 #ifndef TARGET_OS22014 2011 if (!is_pcm_file(f.file)) { 2015 2012 res = -EBADFD; 2016 2013 goto _badf; 2017 2014 } 2018 #endif2019 2015 pcm_file = f.file->private_data; 2020 2016 substream1 = pcm_file->substream; -
GPL/branches/uniaud32-next/alsa-kernel/core/seq/oss/seq_oss_event.c
r615 r625 287 287 } 288 288 289 #ifndef TARGET_OS2290 289 ch = array_index_nospec(ch, info->nr_voices); 291 #endif292 290 if (note == 255 && info->ch[ch].note >= 0) { 293 291 /* volume control */ … … 350 348 } 351 349 352 #ifndef TARGET_OS2353 350 ch = array_index_nospec(ch, info->nr_voices); 354 #endif355 351 if (info->ch[ch].note >= 0) { 356 352 note = info->ch[ch].note; -
GPL/branches/uniaud32-next/alsa-kernel/core/seq/oss/seq_oss_midi.c
r615 r625 304 304 if (dev < 0 || dev >= dp->max_mididev) 305 305 return NULL; 306 #ifndef TARGET_OS2307 306 dev = array_index_nospec(dev, dp->max_mididev); 308 #endif309 307 return get_mdev(dev); 310 308 } -
GPL/branches/uniaud32-next/alsa-kernel/core/seq/oss/seq_oss_synth.c
r615 r625 333 333 if (dev < 0 || dev >= dp->max_synthdev) 334 334 return NULL; 335 #ifndef TARGET_OS2336 335 dev = array_index_nospec(dev, SNDRV_SEQ_OSS_MAX_SYNTH_DEVS); 337 #endif338 336 return &dp->synths[dev]; 339 337 } -
GPL/branches/uniaud32-next/alsa-kernel/drivers/mpu401/mpu401.c
r615 r625 6 6 */ 7 7 8 #ifdef TARGET_OS29 #include <sound/config.h>10 #endif11 8 #include <linux/init.h> 12 9 #include <linux/pnp.h> -
GPL/branches/uniaud32-next/alsa-kernel/drivers/opl3/opl3_synth.c
r615 r625 465 465 } 466 466 /* Get register offset of operator */ 467 #ifndef TARGET_OS2468 467 voice_offset = array_index_nospec(voice_offset, MAX_OPL2_VOICES); 469 468 voice_op = array_index_nospec(voice->op, 4); 470 #endif471 469 op_offset = snd_opl3_regmap[voice_offset][voice_op]; 472 470 -
GPL/branches/uniaud32-next/alsa-kernel/hda/array.c
r615 r625 35 35 array->alloced = num; 36 36 } 37 38 37 return snd_array_elem(array, array->used++); 39 38 } -
GPL/branches/uniaud32-next/alsa-kernel/hda/hdac_bus.c
r615 r625 158 158 EXPORT_SYMBOL_GPL(snd_hdac_bus_queue_event); 159 159 160 #ifdef TARGET_OS2 //was ifndef 2020-11-26161 160 /* 162 161 * process queued unsolicited events … … 189 188 spin_unlock_irq(&bus->reg_lock); 190 189 } 191 #endif192 190 193 191 /** -
GPL/branches/uniaud32-next/alsa-kernel/hda/hdac_stream.c
r615 r625 4 4 */ 5 5 6 #ifdef TARGET_OS27 #include <linux/types.h>8 #endif9 6 #include <linux/kernel.h> 10 7 #include <linux/delay.h> … … 303 300 if (azx_dev->opened) 304 301 continue; 305 #ifndef TARGET_OS2306 302 if (azx_dev->assigned_key == key) { 307 #else308 if (azx_dev->device == substream->pcm->device) {309 #endif310 303 res = azx_dev; 311 304 break; … … 318 311 res->opened = 1; 319 312 res->running = 0; 320 #ifndef TARGET_OS2321 313 res->assigned_key = key; 322 #else323 res->device == substream->pcm->device;324 #endif325 314 res->substream = substream; 326 315 spin_unlock_irq(&bus->reg_lock); -
GPL/branches/uniaud32-next/alsa-kernel/include/sound/control.h
r615 r625 64 64 } tlv; 65 65 unsigned long private_value; 66 #ifdef TARGET_OS267 void *private_ptr;68 #endif69 66 void *private_data; 70 67 void (*private_free)(struct snd_kcontrol *kcontrol); … … 143 140 { 144 141 unsigned int ioff = id->numid - kctl->id.numid; 145 #ifndef TARGET_OS2146 142 return array_index_nospec(ioff, kctl->count); 147 #else148 return ioff;149 #endif150 143 } 151 144 … … 153 146 { 154 147 unsigned int ioff = id->index - kctl->id.index; 155 #ifndef TARGET_OS2156 148 return array_index_nospec(ioff, kctl->count); 157 #else158 return ioff;159 #endif160 149 } 161 150 -
GPL/branches/uniaud32-next/alsa-kernel/include/sound/hda_codec.h
r615 r625 206 206 struct list_head conn_list; /* linked-list of connection-list */ 207 207 208 #ifndef TARGET_OS2209 208 struct mutex spdif_mutex; 210 #else211 struct semaphore spdif_mutex;212 #endif213 209 struct mutex control_mutex; 214 210 struct snd_array spdif_out; -
GPL/branches/uniaud32-next/alsa-kernel/include/sound/hdaudio.h
r622 r625 17 17 #include <sound/hda_verbs.h> 18 18 #include <drm/i915_component.h> 19 #ifdef TARGET_OS2 20 #include <linux/clocksource.h> 21 #endif 19 22 20 /* codec node id */ 23 21 typedef u16 hda_nid_t; … … 361 359 /* locks */ 362 360 spinlock_t reg_lock; 363 #ifndef TARGET_OS2364 361 struct mutex cmd_mutex; 365 #else366 struct semaphore cmd_mutex;367 #endif368 362 struct mutex lock; 369 363 … … 538 532 unsigned char stream_tag; /* assigned stream */ 539 533 unsigned char index; /* stream index */ 540 #ifndef TARGET_OS2541 534 int assigned_key; /* last device# key assigned to */ 542 #else543 int device; /* last device number assigned to */544 #endif545 535 bool opened:1; 546 536 bool running:1; -
GPL/branches/uniaud32-next/alsa-kernel/include/sound/initval.h
r615 r625 22 22 #define MODULE_DEVICES(val) 23 23 #define MODULE_PARM_SYNTAX(id, val) 24 #define module_param_array(name, type, nump, perm)25 #define module_param(name, type, perm)26 24 #else 27 25 #define MODULE_CLASSES(val) MODULE_GENERIC_STRING(info_classes, val) -
GPL/branches/uniaud32-next/alsa-kernel/pci/emu10k1/emu10k1_main.c
r615 r625 1926 1926 (unsigned long)(emu->ptb_pages.addr + emu->ptb_pages.bytes)); 1927 1927 1928 #if ndef TARGET_OS21928 #ifdef TARGET_OS2 1929 1929 emu->page_ptr_table = vmalloc(array_size(sizeof(void *), 1930 1930 emu->max_cache_pages)); … … 2091 2091 if (emu->audigy) 2092 2092 size += ARRAY_SIZE(saved_regs_audigy); 2093 #if ndef TARGET_OS22093 #ifdef TARGET_OS2 2094 2094 emu->saved_ptr = vmalloc(array3_size(4, NUM_G, size)); 2095 2095 #else -
GPL/branches/uniaud32-next/alsa-kernel/pci/emu10k1/emufx.c
r615 r625 2685 2685 return -ENOMEM; 2686 2686 len = emu->audigy ? 2 * 1024 : 2 * 512; 2687 #if ndef TARGET_OS22687 #ifdef TARGET_OS2 2688 2688 emu->saved_icode = vmalloc(array_size(len, 4)); 2689 2689 #else -
GPL/branches/uniaud32-next/alsa-kernel/pci/emu10k1/p16v.c
r615 r625 858 858 int snd_p16v_alloc_pm_buffer(struct snd_emu10k1 *emu) 859 859 { 860 #if ndef TARGET_OS2860 #ifdef TARGET_OS2 861 861 emu->p16v_saved = vmalloc(array_size(NUM_CHS * 4, 0x80)); 862 862 #else -
GPL/branches/uniaud32-next/alsa-kernel/pci/hda/hda_controller.c
r615 r625 9 9 * PeiSen Hou <pshou@realtek.com.tw> 10 10 */ 11 12 #ifdef TARGET_OS213 #include <linux/delay.h>14 #include <linux/interrupt.h>15 #include <linux/kernel.h>16 #include <linux/module.h>17 #include <linux/dma-mapping.h>18 #include <linux/moduleparam.h>19 #include <linux/init.h>20 #include <linux/slab.h>21 #include <linux/pci.h>22 #include <linux/mutex.h>23 #include <linux/reboot.h>24 #include <linux/io.h>25 #include <linux/pm_runtime.h>26 #include <linux/clocksource.h>27 #include <linux/time.h>28 #include <linux/completion.h>29 #include <linux/math64.h>30 #endif31 11 32 12 #include <linux/clocksource.h> … … 1396 1376 snd_hda_codec_configure(codec); 1397 1377 } 1378 1398 1379 if (!azx_bus(chip)->num_codecs) 1399 1380 return -ENODEV; -
GPL/branches/uniaud32-next/alsa-kernel/pci/hda/hda_generic.c
r615 r625 27 27 #include "hda_beep.h" 28 28 #include "hda_generic.h" 29 29 30 #ifdef TARGET_OS2 30 31 #define KBUILD_MODNAME "hda_generic" … … 5273 5274 5274 5275 free_kctls(spec); /* no longer needed */ 5276 5275 5277 err = snd_hda_jack_add_kctls(codec, &spec->autocfg); 5276 5278 if (err < 0) … … 5854 5856 aamix_default(codec->spec)); 5855 5857 set_pin_eapd(codec, pin, path->active); 5856 5857 5858 } 5858 5859 -
GPL/branches/uniaud32-next/alsa-kernel/pci/hda/hda_hwdep.c
r615 r625 47 47 } else { 48 48 verb -= codec->core.start_nid; 49 #ifndef TARGET_OS250 49 verb = array_index_nospec(verb, codec->core.num_nodes); 51 #endif52 50 res = codec->wcaps[verb]; 53 51 } -
GPL/branches/uniaud32-next/alsa-kernel/pci/hda/hda_intel.c
r615 r625 37 37 #include <linux/completion.h> 38 38 #ifdef TARGET_OS2 39 #include <linux/math64.h>40 41 39 #define KBUILD_MODNAME "hda_intel" 42 40 #endif … … 53 51 #include <sound/hda_i915.h> 54 52 #include <sound/intel-nhlt.h> 55 #ifndef TARGET_OS256 53 #include <linux/vgaarb.h> 57 54 #include <linux/vga_switcheroo.h> 58 #endif59 55 #include <linux/firmware.h> 60 56 #include <sound/hda_codec.h> … … 811 807 "unable to grab IRQ %d, disabling device\n", 812 808 chip->pci->irq); 813 #ifndef TARGET_OS2814 809 if (do_disconnect) 815 810 snd_card_disconnect(chip->card); 816 #endif817 811 return -1; 818 812 } … … 1401 1395 1402 1396 hda->init_failed = 1; /* to be sure */ 1403 #ifndef TARGET_OS21404 1397 complete_all(&hda->probe_wait); 1405 #endif1406 1398 1407 1399 #ifdef CONFIG_VGA_SWITCHEROO … … 2210 2202 2211 2203 dev++; 2212 #ifndef TARGET_OS22213 2204 if (chip->disabled) 2214 2205 complete_all(&hda->probe_wait); 2215 #endif2216 2206 return 0; 2217 2207 … … 2391 2381 if (!hda->need_i915_power) 2392 2382 display_power(chip, false); 2393 #ifndef TARGET_OS22394 2383 complete_all(&hda->probe_wait); 2395 #endif2396 2384 to_hda_bus(bus)->bus_probing = 0; 2397 2385 return 0; -
GPL/branches/uniaud32-next/alsa-kernel/pci/hda/hda_priv.h
r615 r625 216 216 unsigned char stream_tag; /* assigned stream */ 217 217 unsigned char index; /* stream index */ 218 #ifndef TARGET_OS2219 218 int assigned_key; /* last device# key assigned to */ 220 #else221 int device; /* last device number assigned to */222 #endif223 219 224 220 unsigned int opened:1; -
GPL/branches/uniaud32-next/alsa-kernel/pci/hda/hda_proc.c
r615 r625 903 903 } 904 904 905 #ifdef CONFIG_PROC_FS906 905 /* 907 906 * create a proc read … … 914 913 return snd_card_ro_proc_new(codec->card, name, codec, print_codec_info); 915 914 } 916 #endif -
GPL/branches/uniaud32-next/alsa-kernel/pci/hda/hda_sysfs.c
r615 r625 8 8 */ 9 9 10 #ifdef TARGET_OS211 #include <linux/sysfs.h>12 #endif13 10 #include <linux/init.h> 14 11 #include <linux/slab.h> … … 718 715 int snd_hda_load_patch(struct hda_bus *bus, size_t fw_size, const void *fw_buf) 719 716 { 720 dprintf(("snd_hda_load_patch"));721 717 char buf[128]; 722 718 struct hda_codec *codec; -
GPL/branches/uniaud32-next/alsa-kernel/pci/hda/patch_conexant.c
r615 r625 709 709 710 710 #ifdef TARGET_OS2 711 static const struct hda_pintbl CXT_PINCFG_COMPAQ_CQ60_PINS[] = {712 /* 0x17 was falsely set up as a mic, it should 0x1d */713 { 0x17, 0x400001f0 },714 { 0x1d, 0x97a70120 },715 {0}716 };717 718 711 static const struct hda_pintbl CXT_FIXUP_HEADPHONE_MIC_PIN_PINS[] = { 719 712 { 0x18, 0x03a1913d }, /* use as headphone mic, without its own jack detect */ … … 737 730 static const struct hda_pintbl CXT_FIXUP_HP_530_PINS[] = { 738 731 { 0x12, 0x90a60160 }, /* int mic */ 739 {0}740 };741 742 static const struct hda_pintbl CXT_FIXUP_HP_SPECTRE_PINS[] = {743 /* enable NID 0x1d for the speaker on top */744 { 0x1d, 0x91170111 },745 {0}746 };747 748 static const struct hda_pintbl CXT_FIXUP_HP_MIC_NO_PRESENCE_PINS[] = {749 { 0x1a, 0x02a1113c },750 732 {0} 751 733 }; -
GPL/branches/uniaud32-next/alsa-kernel/pci/hda/patch_sigmatel.c
r621 r625 29 29 #ifdef TARGET_OS2 30 30 #define KBUILD_MODNAME "patch_sigmatel" 31 // 2020-11-17 SHL32 #include <../../../lib32/internal.h>33 31 #endif 34 32 … … 1945 1943 .v.pins = stac92hd89xx_hp_z1_g2_right_mic_jack_pin_configs, 1946 1944 }, 1947 #ifdef TARGET_OS2xxx1948 1945 [STAC_92HD73XX_ASUS_MOBO] = { 1949 1946 .type = HDA_FIXUP_PINS, 1947 #ifndef TARGET_OS2 1950 1948 .v.pins = (const struct hda_pintbl[]) { 1951 1949 /* enable 5.1 and SPDIF out */ … … 1956 1954 {0} 1957 1955 } 1958 }, 1956 #else 1957 .v.pins = STAC_92HD73XX_ASUS_MOBO_PINS, 1959 1958 #endif 1959 }, 1960 1960 }; 1961 1961 -
GPL/branches/uniaud32-next/alsa-kernel/pci/hda/patch_via.c
r615 r625 193 193 snd_hda_codec_write(codec, 0x1, 0, 0xf81, 1); 194 194 codec->jackpoll_interval = 0; 195 //NOT_USEDcancel_delayed_work_sync(&codec->jackpoll_work);195 cancel_delayed_work_sync(&codec->jackpoll_work); 196 196 spec->hp_work_active = false; 197 197 } -
GPL/branches/uniaud32-next/alsa-kernel/pci/intel8x0.c
r615 r625 9 9 * for SiS735, so the code is not fully functional. 10 10 * 11 12 11 */ 13 12 14 13 #ifdef TARGET_OS2 15 14 #define KBUILD_MODNAME "intel8x0" 16 #include <linux/ktime.h>17 extern ktime_t ktime_get(void);18 15 #endif 19 16 … … 3182 3179 static int check_default_spdif_aclink(struct pci_dev *pci) 3183 3180 { 3184 #ifndef TARGET_OS23185 3181 const struct snd_pci_quirk *w; 3186 3182 … … 3197 3193 return w->value; 3198 3194 } 3199 #endif3200 3195 return 0; 3201 3196 } -
GPL/branches/uniaud32-next/alsa-kernel/pci/maestro3.c
r615 r625 2582 2582 quirk = snd_pci_quirk_lookup(pci, m3_amp_quirk_list); 2583 2583 if (quirk) { 2584 #ifndef TARGET_OS22585 2584 dev_info(card->dev, "set amp-gpio for '%s'\n", 2586 2585 snd_pci_quirk_name(quirk)); 2587 #endif2588 2586 chip->amp_gpio = quirk->value; 2589 2587 } else if (chip->allegro_flag) … … 2595 2593 quirk = snd_pci_quirk_lookup(pci, m3_irda_quirk_list); 2596 2594 if (quirk) { 2597 #ifndef TARGET_OS22598 2595 dev_info(card->dev, "enabled irda workaround for '%s'\n", 2599 2596 snd_pci_quirk_name(quirk)); 2600 #endif2601 2597 chip->irda_workaround = 1; 2602 2598 } … … 2653 2649 2654 2650 #ifdef CONFIG_PM_SLEEP 2655 #ifndef TARGET_OS22656 2651 chip->suspend_mem = 2657 2652 vmalloc(array_size(sizeof(u16), 2658 2653 REV_B_CODE_MEMORY_LENGTH + 2659 2654 REV_B_DATA_MEMORY_LENGTH)); 2660 #else2661 chip->suspend_mem = vmalloc(sizeof(u16) * (REV_B_CODE_MEMORY_LENGTH + REV_B_DATA_MEMORY_LENGTH));2662 #endif2663 2655 if (chip->suspend_mem == NULL) 2664 2656 dev_warn(card->dev, "can't allocate apm buffer\n"); … … 2713 2705 int err; 2714 2706 2715 #ifndef TARGET_OS22716 2707 /* don't pick up modems */ 2717 2708 if (((pci->class >> 8) & 0xffff) != PCI_CLASS_MULTIMEDIA_AUDIO) 2718 2709 return -ENODEV; 2719 #endif 2710 2720 2711 if (dev >= SNDRV_CARDS) 2721 2712 return -ENODEV; -
GPL/branches/uniaud32-next/alsa-kernel/pci/trident/trident_main.c
r615 r625 3351 3351 trident->tlb.entries_dmaaddr = ALIGN(trident->tlb.buffer.addr, SNDRV_TRIDENT_MAX_PAGES * 4); 3352 3352 /* allocate shadow TLB page table (virtual addresses) */ 3353 #ifndef TARGET_OS23354 3353 trident->tlb.shadow_entries = 3355 3354 vmalloc(array_size(SNDRV_TRIDENT_MAX_PAGES, 3356 3355 sizeof(unsigned long))); 3357 #else3358 trident->tlb.shadow_entries = vmalloc(SNDRV_TRIDENT_MAX_PAGES*sizeof(unsigned long));3359 #endif3360 3356 if (!trident->tlb.shadow_entries) 3361 3357 return -ENOMEM; -
GPL/branches/uniaud32-next/include/asm/atomic.h
r615 r625 92 92 #define atomic_inc_return(v) atomic_add_return(1, (v)) 93 93 94 typedef struct { 95 long long counter; 96 } atomic64_t; 94 97 98 typedef atomic64_t atomic_long_t; 95 99 #endif -
GPL/branches/uniaud32-next/include/asm/unaligned.h
r598 r625 1 1 #ifndef _ASM_UNALIGNED_H 2 2 #define _ASM_UNALIGNED_H 3 3 # include <linux/unaligned/le_byteshift.h> 4 # include <linux/unaligned/be_byteshift.h> 4 5 #endif -
GPL/branches/uniaud32-next/include/linux/clocksource.h
r615 r625 1 1 #ifndef _LINUX_CLOCKSOURCE_H 2 2 #define _LINUX_CLOCKSOURCE_H 3 4 #include <linux/types.h> 5 3 6 /* clocksource cycle base type */ 4 7 typedef u64 cycle_t; -
GPL/branches/uniaud32-next/include/linux/completion.h
r615 r625 35 35 36 36 extern void complete(struct completion *); 37 37 extern void complete_all(struct completion *); 38 extern void wait_for_completion(struct completion *x); 39 extern bool try_wait_for_completion(struct completion *x); 38 40 #endif /* _LINUX_COMPLETION_H */ -
GPL/branches/uniaud32-next/include/linux/device.h
r622 r625 6 6 #include <linux/sysfs.h> 7 7 #include <linux/lockdep.h> 8 #include <linux/overflow.h> 8 9 9 10 struct device; … … 291 292 extern void *devres_find(struct device *dev, dr_release_t release, 292 293 dr_match_t match, void *match_data); 294 295 /* debugging and troubleshooting/diagnostic helpers. */ 296 extern const char *dev_driver_string(const struct device *dev); 297 293 298 #endif /* _LINUX_DEVICE_H */ 294 299 -
GPL/branches/uniaud32-next/include/linux/fs.h
r615 r625 165 165 struct dentry *f_dentry; 166 166 const struct file_operations *f_op; 167 struct inode *f_inode; /* cached value */ 167 168 spinlock_t f_lock; 168 169 atomic_t f_count; … … 182 183 183 184 struct inode { 184 #ifdef TARGET_OS2185 kdev_t i_rdev;186 struct semaphore i_sem;187 union {188 void *generic_ip;189 } u;190 191 #else192 185 void * i_hash; 193 186 void * i_list; … … 225 218 void *generic_ip; 226 219 } u; 227 #endif228 220 }; 229 221 … … 335 327 #define FMODE_STREAM (( fmode_t)0x200000) 336 328 329 static inline struct inode *file_inode(const struct file *f) 330 { 331 return f->f_inode; 332 } 333 337 334 #endif /* _LINUX_FS_H */ -
GPL/branches/uniaud32-next/include/linux/genalloc.h
r615 r625 1 1 #ifndef _LINUX_GENALLOC_H 2 2 #define _LINUX_GENALLOC_H 3 #include <linux/module.h> 4 #include <linux/types.h> 5 #include <linux/printk.h> 3 6 4 7 #endif /* _LINUX_GENALLOC_H */ -
GPL/branches/uniaud32-next/include/linux/init.h
r615 r625 1 1 #ifndef _LINUX_INIT_H 2 2 #define _LINUX_INIT_H 3 4 #include <asm/errno.h> 5 3 6 4 7 /* These macros are used to mark some functions or -
GPL/branches/uniaud32-next/include/linux/major.h
r32 r625 1 1 #ifndef _LINUX_MAJOR_H 2 2 #define _LINUX_MAJOR_H 3 4 #include <linux/types.h> 3 5 4 6 /* -
GPL/branches/uniaud32-next/include/linux/mm.h
r615 r625 7 7 #include <asm/page.h> 8 8 #include <asm/atomic.h> 9 #include <linux/overflow.h> 9 10 10 11 /* -
GPL/branches/uniaud32-next/include/linux/module.h
r615 r625 7 7 #ifndef _LINUX_MODULE_H 8 8 #define _LINUX_MODULE_H 9 9 10 #include <linux/moduleparam.h> 11 10 12 /* Poke the use count of a module. */ 11 13 -
GPL/branches/uniaud32-next/include/linux/moduleparam.h
r615 r625 138 138 &__param_arr_##name, perm) 139 139 140 #ifndef TARGET_OS2 141 #define module_param_array(name, type, nump, perm) \ 142 module_param_array_named(name, name, type, nump, perm) 143 #endif 140 #define module_param_array(name, type, nump, perm) 141 #define module_param(name, type, perm) 144 142 extern int param_array_set(const char *val, struct kernel_param *kp); 145 143 extern int param_array_get(char *buffer, struct kernel_param *kp); -
GPL/branches/uniaud32-next/include/linux/mutex.h
r615 r625 3 3 4 4 #include <asm/semaphore.h> 5 #include <linux/list.h> 6 7 struct mutex { 8 atomic_long_t owner; 9 spinlock_t wait_lock; 10 #ifdef CONFIG_MUTEX_SPIN_ON_OWNER 11 struct optimistic_spin_queue osq; /* Spinner MCS lock */ 12 #endif 13 struct list_head wait_list; 14 #ifdef CONFIG_DEBUG_MUTEXES 15 void *magic; 16 #endif 17 #ifdef CONFIG_DEBUG_LOCK_ALLOC 18 struct lockdep_map dep_map; 19 #endif 20 }; 5 21 6 22 #define mutex semaphore -
GPL/branches/uniaud32-next/include/linux/pci.h
r615 r625 338 338 unsigned short subsystem_vendor; 339 339 unsigned short subsystem_device; 340 unsigned int _class; /* 3 bytes: (base,sub,prog-if) */341 340 u8 hdr_type; /* PCI header type (`multi' flag masked out) */ 342 341 u8 rom_base_reg; /* Which config register controls the ROM */ -
GPL/branches/uniaud32-next/include/linux/pm_runtime.h
r615 r625 3 3 4 4 #include <asm/errno.h> 5 #include <linux/pm.h> 6 5 7 /* Runtime PM flag argument bits */ 6 8 #define RPM_ASYNC 0x01 /* Request is asynchronous */ -
GPL/branches/uniaud32-next/include/linux/proc_fs.h
r615 r625 241 241 } 242 242 static inline void *PDE_DATA(const struct inode *inode) {return NULL;} 243 244 extern struct proc_dir_entry *proc_symlink(const char *, 245 struct proc_dir_entry *, const char *); 246 extern struct proc_dir_entry *proc_mkdir(const char *, struct proc_dir_entry *); 243 247 #endif /* _LINUX_PROC_FS_H */ -
GPL/branches/uniaud32-next/include/linux/rbtree.h
r615 r625 26 26 See Documentation/rbtree.txt for documentation and samples. 27 27 */ 28 /* from 4.1 4.202*/28 /* from 4.19.163 */ 29 29 30 30 #ifndef _LINUX_RBTREE_H … … 35 35 //#include <linux/rcupdate.h> 36 36 37 #ifdef TARGET_OS238 #pragma pack(4)39 #endif40 37 struct rb_node { 41 38 unsigned long __rb_parent_color; 42 39 struct rb_node *rb_right; 43 40 struct rb_node *rb_left; 44 #ifndef TARGET_OS2 45 } __attribute__((aligned(sizeof(long)))); 46 #else 47 }; 48 #pragma pack() 49 #endif 41 } /*__attribute__((aligned(sizeof(long))))*/; 50 42 /* The alignment might seem pointless, but allegedly CRIS needs it */ 51 43 … … 109 101 extern void rb_replace_node_rcu(struct rb_node *victim, struct rb_node *new, 110 102 struct rb_root *root); 103 extern void rb_replace_node_cached(struct rb_node *victim, struct rb_node *new, 104 struct rb_root_cached *root); 111 105 112 106 static inline void rb_link_node(struct rb_node *node, struct rb_node *parent, -
GPL/branches/uniaud32-next/include/linux/rbtree_augmented.h
r615 r625 21 21 linux/include/linux/rbtree_augmented.h 22 22 */ 23 /* from 4.14.202 */ 23 /* from 4.19.163 */ 24 24 25 #ifndef _LINUX_RBTREE_AUGMENTED_H 25 26 #define _LINUX_RBTREE_AUGMENTED_H … … 27 28 #include <linux/compiler.h> 28 29 #include <linux/rbtree.h> 30 //#include <linux/rcupdate.h> 29 31 30 32 /* … … 56 58 * affected subtrees. 57 59 */ 58 static inlinevoid60 /*static inline*/ void 59 61 rb_insert_augmented(struct rb_node *node, struct rb_root *root, 60 62 const struct rb_augment_callbacks *augment) … … 63 65 } 64 66 65 static inlinevoid67 /*static inline*/ void 66 68 rb_insert_augmented_cached(struct rb_node *node, 67 69 struct rb_root_cached *root, bool newleft, … … 72 74 } 73 75 74 #define RB_DECLARE_CALLBACKS(rb static, rbname, rbstruct, rbfield, \76 #define RB_DECLARE_CALLBACKS(rb/*static*/, rbname, rbstruct, rbfield, \ 75 77 rbtype, rbaugmented, rbcompute) \ 76 static inlinevoid \78 /*static inline*/ void \ 77 79 rbname ## _propagate(struct rb_node *rb, struct rb_node *stop) \ 78 80 { \ … … 86 88 } \ 87 89 } \ 88 static inlinevoid \90 /*static inline*/ void \ 89 91 rbname ## _copy(struct rb_node *rb_old, struct rb_node *rb_new) \ 90 92 { \ … … 93 95 new->rbaugmented = old->rbaugmented; \ 94 96 } \ 95 staticvoid \97 /*static*/ void \ 96 98 rbname ## _rotate(struct rb_node *rb_old, struct rb_node *rb_new) \ 97 99 { \ … … 101 103 old->rbaugmented = rbcompute(old); \ 102 104 } \ 103 rb staticconst struct rb_augment_callbacks rbname = { \105 rb/*static*/ const struct rb_augment_callbacks rbname = { \ 104 106 .propagate = rbname ## _propagate, \ 105 107 .copy = rbname ## _copy, \ … … 120 122 #define rb_is_black(rb) __rb_is_black((rb)->__rb_parent_color) 121 123 122 static inlinevoid rb_set_parent(struct rb_node *rb, struct rb_node *p)124 /*static inline*/ void rb_set_parent(struct rb_node *rb, struct rb_node *p) 123 125 { 124 126 rb->__rb_parent_color = rb_color(rb) | (unsigned long)p; 125 127 } 126 128 127 static inlinevoid rb_set_parent_color(struct rb_node *rb,129 /*static inline*/ void rb_set_parent_color(struct rb_node *rb, 128 130 struct rb_node *p, int color) 129 131 { … … 131 133 } 132 134 133 static inlinevoid135 /*static inline*/ void 134 136 __rb_change_child(struct rb_node *old, struct rb_node *new, 135 137 struct rb_node *parent, struct rb_root *root) … … 145 147 146 148 #ifndef TARGET_OS2 147 static inlinevoid149 /*static inline*/ void 148 150 __rb_change_child_rcu(struct rb_node *old, struct rb_node *new, 149 151 struct rb_node *parent, struct rb_root *root) … … 162 164 void (*augment_rotate)(struct rb_node *old, struct rb_node *new)); 163 165 164 static inlinestruct rb_node *166 /*static inline*/ struct rb_node * 165 167 __rb_erase_augmented(struct rb_node *node, struct rb_root *root, 166 168 struct rb_node **leftmost, … … 270 272 } 271 273 272 static inlinevoid274 /*static inline*/ void 273 275 rb_erase_augmented(struct rb_node *node, struct rb_root *root, 274 276 const struct rb_augment_callbacks *augment) … … 280 282 } 281 283 282 static inlinevoid284 /*static inline*/ void 283 285 rb_erase_augmented_cached(struct rb_node *node, struct rb_root_cached *root, 284 286 const struct rb_augment_callbacks *augment) -
GPL/branches/uniaud32-next/include/linux/regmap.h
r615 r625 13 13 * published by the Free Software Foundation. 14 14 */ 15 /* from 4.1 4.202*/15 /* from 4.19.163 */ 16 16 17 17 #include <linux/list.h> 18 18 #include <linux/rbtree.h> 19 #include <linux/ktime.h> 19 20 #include <linux/delay.h> 20 21 #include <linux/err.h> … … 22 23 #include <linux/lockdep.h> 23 24 24 #define CONFIG_REGMAP25 26 25 struct module; 26 struct clk; 27 27 struct device; 28 28 struct i2c_client; 29 29 struct irq_domain; 30 struct slim_device; 30 31 struct spi_device; 31 32 struct spmi_device; … … 34 35 struct regmap_field; 35 36 struct snd_ac97; 37 struct sdw_slave; 36 38 37 39 /* An enum of all the supported cache types */ … … 124 126 #define regmap_read_poll_timeout(map, addr, val, cond, sleep_us, timeout_us) \ 125 127 ({ \ 126 ktime_t timeout = ktime_add_us(ktime_get(), timeout_us); \ 128 u64 __timeout_us = (timeout_us); \ 129 unsigned long __sleep_us = (sleep_us); \ 130 ktime_t __timeout = ktime_add_us(ktime_get(), __timeout_us); \ 131 int __ret; \ 132 might_sleep_if(__sleep_us); \ 133 for (;;) { \ 134 __ret = regmap_read((map), (addr), &(val)); \ 135 if (__ret) \ 136 break; \ 137 if (cond) \ 138 break; \ 139 if ((__timeout_us) && \ 140 ktime_compare(ktime_get(), __timeout) > 0) { \ 141 __ret = regmap_read((map), (addr), &(val)); \ 142 break; \ 143 } \ 144 if (__sleep_us) \ 145 usleep_range((__sleep_us >> 2) + 1, __sleep_us); \ 146 } \ 147 __ret ?: ((cond) ? 0 : -ETIMEDOUT); \ 148 }) 149 150 /** 151 * regmap_field_read_poll_timeout - Poll until a condition is met or timeout 152 * 153 * @field: Regmap field to read from 154 * @val: Unsigned integer variable to read the value into 155 * @cond: Break condition (usually involving @val) 156 * @sleep_us: Maximum time to sleep between reads in us (0 157 * tight-loops). Should be less than ~20ms since usleep_range 158 * is used (see Documentation/timers/timers-howto.txt). 159 * @timeout_us: Timeout in us, 0 means never timeout 160 * 161 * Returns 0 on success and -ETIMEDOUT upon a timeout or the regmap_field_read 162 * error return value in case of a error read. In the two former cases, 163 * the last read value at @addr is stored in @val. Must not be called 164 * from atomic context if sleep_us or timeout_us are used. 165 * 166 * This is modelled after the readx_poll_timeout macros in linux/iopoll.h. 167 */ 168 #define regmap_field_read_poll_timeout(field, val, cond, sleep_us, timeout_us) \ 169 ({ \ 170 u64 __timeout_us = (timeout_us); \ 171 unsigned long __sleep_us = (sleep_us); \ 172 ktime_t timeout = ktime_add_us(ktime_get(), __timeout_us); \ 127 173 int pollret; \ 128 might_sleep_if( sleep_us); \174 might_sleep_if(__sleep_us); \ 129 175 for (;;) { \ 130 pollret = regmap_ read((map), (addr), &(val)); \176 pollret = regmap_field_read((field), &(val)); \ 131 177 if (pollret) \ 132 178 break; \ 133 179 if (cond) \ 134 180 break; \ 135 if ( timeout_us && ktime_compare(ktime_get(), timeout) > 0) { \136 pollret = regmap_ read((map), (addr), &(val)); \181 if (__timeout_us && ktime_compare(ktime_get(), timeout) > 0) { \ 182 pollret = regmap_field_read((field), &(val)); \ 137 183 break; \ 138 184 } \ 139 if ( sleep_us) \140 usleep_range(( sleep_us >> 2) + 1,sleep_us); \185 if (__sleep_us) \ 186 usleep_range((__sleep_us >> 2) + 1, __sleep_us); \ 141 187 } \ 142 188 pollret ?: ((cond) ? 0 : -ETIMEDOUT); \ 143 189 }) 144 190 191 #define CONFIG_REGMAP 145 192 #ifdef CONFIG_REGMAP 146 193 … … 224 271 * check is performed on such table (a register is precious if 225 272 * it belongs to one of the ranges specified by precious_table). 273 * @readable_noinc_reg: Optional callback returning true if the register 274 * supports multiple read operations without incrementing 275 * the register number. If this field is NULL but 276 * rd_noinc_table (see below) is not, the check is 277 * performed on such table (a register is no increment 278 * readable if it belongs to one of the ranges specified 279 * by rd_noinc_table). 280 * @disable_locking: This regmap is either protected by external means or 281 * is guaranteed not be be accessed from multiple threads. 282 * Don't use any locking mechanisms. 226 283 * @lock: Optional lock callback (overrides regmap's default lock 227 284 * function, based on spinlock or mutex). … … 248 305 * @volatile_table: As above, for volatile registers. 249 306 * @precious_table: As above, for precious registers. 307 * @rd_noinc_table: As above, for no increment readable registers. 250 308 * @reg_defaults: Power on reset values for registers (for use with 251 309 * register cache support). … … 256 314 * @write_flag_mask: Mask to be set in the top bytes of the register when doing 257 315 * a write. If both read_flag_mask and write_flag_mask are 258 * empty the regmap_bus default masks are used. 316 * empty and zero_flag_mask is not set the regmap_bus default 317 * masks are used. 318 * @zero_flag_mask: If set, read_flag_mask and write_flag_mask are used even 319 * if they are both empty. 259 320 * @use_single_rw: If set, converts the bulk read and write operations into 260 321 * a series of single read and write operations. This is useful … … 277 338 * @ranges: Array of configuration entries for virtual address ranges. 278 339 * @num_ranges: Number of range configuration entries. 340 * @use_hwlock: Indicate if a hardware spinlock should be used. 341 * @hwlock_id: Specify the hardware spinlock id. 342 * @hwlock_mode: The hardware spinlock mode, should be HWLOCK_IRQSTATE, 343 * HWLOCK_IRQ or 0. 279 344 */ 280 345 struct regmap_config { … … 290 355 bool (*volatile_reg)(struct device *dev, unsigned int reg); 291 356 bool (*precious_reg)(struct device *dev, unsigned int reg); 357 bool (*readable_noinc_reg)(struct device *dev, unsigned int reg); 358 359 bool disable_locking; 292 360 regmap_lock lock; 293 361 regmap_unlock unlock; … … 304 372 const struct regmap_access_table *volatile_table; 305 373 const struct regmap_access_table *precious_table; 374 const struct regmap_access_table *rd_noinc_table; 306 375 const struct reg_default *reg_defaults; 307 376 unsigned int num_reg_defaults; … … 312 381 unsigned long read_flag_mask; 313 382 unsigned long write_flag_mask; 383 bool zero_flag_mask; 314 384 315 385 bool use_single_read; … … 322 392 const struct regmap_range_cfg *ranges; 323 393 unsigned int num_ranges; 394 395 bool use_hwlock; 396 unsigned int hwlock_id; 397 unsigned int hwlock_mode; 324 398 }; 325 399 … … 454 528 struct lock_class_key *lock_key, 455 529 const char *lock_name); 530 struct regmap *__regmap_init_sccb(struct i2c_client *i2c, 531 const struct regmap_config *config, 532 struct lock_class_key *lock_key, 533 const char *lock_name); 534 struct regmap *__regmap_init_slimbus(struct slim_device *slimbus, 535 const struct regmap_config *config, 536 struct lock_class_key *lock_key, 537 const char *lock_name); 456 538 struct regmap *__regmap_init_spi(struct spi_device *dev, 457 539 const struct regmap_config *config, … … 479 561 struct lock_class_key *lock_key, 480 562 const char *lock_name); 563 struct regmap *__regmap_init_sdw(struct sdw_slave *sdw, 564 const struct regmap_config *config, 565 struct lock_class_key *lock_key, 566 const char *lock_name); 481 567 482 568 struct regmap *__devm_regmap_init(struct device *dev, … … 490 576 struct lock_class_key *lock_key, 491 577 const char *lock_name); 578 struct regmap *__devm_regmap_init_sccb(struct i2c_client *i2c, 579 const struct regmap_config *config, 580 struct lock_class_key *lock_key, 581 const char *lock_name); 492 582 struct regmap *__devm_regmap_init_spi(struct spi_device *dev, 493 583 const struct regmap_config *config, … … 516 606 struct lock_class_key *lock_key, 517 607 const char *lock_name); 518 608 struct regmap *__devm_regmap_init_sdw(struct sdw_slave *sdw, 609 const struct regmap_config *config, 610 struct lock_class_key *lock_key, 611 const char *lock_name); 612 struct regmap *__devm_regmap_init_slimbus(struct slim_device *slimbus, 613 const struct regmap_config *config, 614 struct lock_class_key *lock_key, 615 const char *lock_name); 519 616 /* 520 617 * Wrapper for regmap_init macros to include a unique lockdep key and name … … 571 668 572 669 /** 670 * regmap_init_sccb() - Initialise register map 671 * 672 * @i2c: Device that will be interacted with 673 * @config: Configuration for register map 674 * 675 * The return value will be an ERR_PTR() on error or a valid pointer to 676 * a struct regmap. 677 */ 678 #define regmap_init_sccb(i2c, config) \ 679 __regmap_lockdep_wrapper(__regmap_init_sccb, #config, \ 680 i2c, config) 681 682 /** 683 * regmap_init_slimbus() - Initialise register map 684 * 685 * @slimbus: Device that will be interacted with 686 * @config: Configuration for register map 687 * 688 * The return value will be an ERR_PTR() on error or a valid pointer to 689 * a struct regmap. 690 */ 691 #define regmap_init_slimbus(slimbus, config) \ 692 __regmap_lockdep_wrapper(__regmap_init_slimbus, #config, \ 693 slimbus, config) 694 695 /** 573 696 * regmap_init_spi() - Initialise register map 574 697 * … … 665 788 666 789 /** 790 * regmap_init_sdw() - Initialise register map 791 * 792 * @sdw: Device that will be interacted with 793 * @config: Configuration for register map 794 * 795 * The return value will be an ERR_PTR() on error or a valid pointer to 796 * a struct regmap. 797 */ 798 #define regmap_init_sdw(sdw, config) \ 799 __regmap_lockdep_wrapper(__regmap_init_sdw, #config, \ 800 sdw, config) 801 802 803 /** 667 804 * devm_regmap_init() - Initialise managed register map 668 805 * … … 696 833 697 834 /** 835 * devm_regmap_init_sccb() - Initialise managed register map 836 * 837 * @i2c: Device that will be interacted with 838 * @config: Configuration for register map 839 * 840 * The return value will be an ERR_PTR() on error or a valid pointer 841 * to a struct regmap. The regmap will be automatically freed by the 842 * device management code. 843 */ 844 #define devm_regmap_init_sccb(i2c, config) \ 845 __regmap_lockdep_wrapper(__devm_regmap_init_sccb, #config, \ 846 i2c, config) 847 848 /** 698 849 * devm_regmap_init_spi() - Initialise register map 699 850 * … … 794 945 ac97, config) 795 946 947 /** 948 * devm_regmap_init_sdw() - Initialise managed register map 949 * 950 * @sdw: Device that will be interacted with 951 * @config: Configuration for register map 952 * 953 * The return value will be an ERR_PTR() on error or a valid pointer 954 * to a struct regmap. The regmap will be automatically freed by the 955 * device management code. 956 */ 957 #define devm_regmap_init_sdw(sdw, config) \ 958 __regmap_lockdep_wrapper(__devm_regmap_init_sdw, #config, \ 959 sdw, config) 960 961 /** 962 * devm_regmap_init_slimbus() - Initialise managed register map 963 * 964 * @slimbus: Device that will be interacted with 965 * @config: Configuration for register map 966 * 967 * The return value will be an ERR_PTR() on error or a valid pointer 968 * to a struct regmap. The regmap will be automatically freed by the 969 * device management code. 970 */ 971 #define devm_regmap_init_slimbus(slimbus, config) \ 972 __regmap_lockdep_wrapper(__devm_regmap_init_slimbus, #config, \ 973 slimbus, config) 974 int regmap_mmio_attach_clk(struct regmap *map, struct clk *clk); 975 void regmap_mmio_detach_clk(struct regmap *map); 796 976 void regmap_exit(struct regmap *map); 797 977 int regmap_reinit_cache(struct regmap *map, … … 815 995 int regmap_raw_read(struct regmap *map, unsigned int reg, 816 996 void *val, size_t val_len); 997 int regmap_noinc_read(struct regmap *map, unsigned int reg, 998 void *val, size_t val_len); 817 999 int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val, 818 1000 size_t val_count); … … 1019 1201 unsigned int val) 1020 1202 { 1021 WARN_ONCE(1, "regmap API is disabled");1203 // WARN_ONCE(1, "regmap API is disabled"); 1022 1204 return -EINVAL; 1023 1205 } … … 1060 1242 static inline int regmap_raw_read(struct regmap *map, unsigned int reg, 1061 1243 void *val, size_t val_len) 1244 { 1245 WARN_ONCE(1, "regmap API is disabled"); 1246 return -EINVAL; 1247 } 1248 1249 static inline int regmap_noinc_read(struct regmap *map, unsigned int reg, 1250 void *val, size_t val_len) 1062 1251 { 1063 1252 WARN_ONCE(1, "regmap API is disabled"); -
GPL/branches/uniaud32-next/include/linux/slab.h
r623 r625 7 7 #include <linux/types.h> 8 8 #include <linux/list.h> 9 #include <linux/overflow.h> 9 10 10 11 #if !defined(_LINUX_SLAB_H) -
GPL/branches/uniaud32-next/include/linux/time.h
r615 r625 6 6 #include <linux/ktime.h> 7 7 #include <linux/time64.h> 8 #include <linux/math64.h> 8 9 9 10 #define NSEC_PER_SEC 1000000000L -
GPL/branches/uniaud32-next/include/linux/time64.h
r615 r625 1 1 #ifndef _LINUX_TIME64_H 2 2 #define _LINUX_TIME64_H 3 4 #include <linux/math64.h> 3 5 4 6 typedef __s64 time64_t; -
GPL/branches/uniaud32-next/include/linux/timecounter.h
r615 r625 1 1 #ifndef _LINUX_TIMECOUNTER_H 2 2 #define _LINUX_TIMECOUNTER_H 3 3 #include <linux/clocksource.h> 4 4 #endif /* _LINUX_TIMECOUNTER_H */ -
GPL/branches/uniaud32-next/include/linux/vga_switcheroo.h
r615 r625 1 #ifndef _LINUX_ EXPORT_H2 #define _LINUX_ EXPORT_H1 #ifndef _LINUX_VGA_SWITCHEROO_H 2 #define _LINUX_VGA_SWITCHEROO_H 3 3 4 #endif /* _LINUX_ EXPORT_H */4 #endif /* _LINUX_VGA_SWITCHEROO_H */ -
GPL/branches/uniaud32-next/include/linux/vgaarb.h
r615 r625 1 #ifndef _LINUX_ EXPORT_H2 #define _LINUX_ EXPORT_H1 #ifndef _LINUX_VGAARB_H 2 #define _LINUX_VGAARB_H 3 3 4 #endif /* _LINUX_ EXPORT_H */4 #endif /* _LINUX_VGAARB_H */ -
GPL/branches/uniaud32-next/include/linux/vmalloc.h
r615 r625 4 4 //#include <linux/sched.h> 5 5 //#include <linux/mm.h> 6 #include <linux/overflow.h> 6 7 7 8 #include <asm/page.h> -
GPL/branches/uniaud32-next/include/linux/wait.h
r615 r625 130 130 void __wake_up_locked(wait_queue_head_t *q, unsigned int mode, int nr); 131 131 #endif /* __KERNEL__ */ 132 132 #define wait_event_lock_irq(wq_head, condition, lock) 133 #define wake_up_all(x) 133 134 #endif -
GPL/branches/uniaud32-next/lib32/drivers_base.c
r615 r625 13 13 #include <linux/device.h> 14 14 #include <linux/err.h> 15 #include <linux/pci.h> 15 16 #include <linux/init.h> 16 17 #include <linux/module.h> … … 154 155 EXPORT_SYMBOL_GPL(put_device); 155 156 157 /** 158 * dev_driver_string - Return a device's driver name, if at all possible 159 * @dev: struct device to get the name of 160 * 161 * Will return the device's driver's name if it is bound to a device. If 162 * the device is not bound to a driver, it will return the name of the bus 163 * it is attached to. If it is not attached to a bus either, an empty 164 * string will be returned. 165 */ 166 const char *dev_driver_string(const struct device *dev) 167 { 168 struct device_driver *drv; 169 170 /* dev->driver can change to NULL underneath us because of unbinding, 171 * so be careful about accessing it. dev->bus and dev->class should 172 * never change once they are set, so they don't need special care. 173 */ 174 drv = dev->driver; 175 return drv ? drv->name : 176 (dev->bus ? dev->bus->name : 177 (dev->class ? dev->class->name : "")); 178 } -
GPL/branches/uniaud32-next/lib32/internal.h
r615 r625 10 10 * published by the Free Software Foundation. 11 11 */ 12 /* from 4.1 4.202*/12 /* from 4.19.163 */ 13 13 14 14 #ifndef _REGMAP_INTERNAL_H … … 82 82 83 83 #ifdef CONFIG_DEBUG_FS 84 bool debugfs_disable; 84 85 struct dentry *debugfs; 85 86 const char *debugfs_name; … … 98 99 bool (*volatile_reg)(struct device *dev, unsigned int reg); 99 100 bool (*precious_reg)(struct device *dev, unsigned int reg); 101 bool (*readable_noinc_reg)(struct device *dev, unsigned int reg); 100 102 const struct regmap_access_table *wr_table; 101 103 const struct regmap_access_table *rd_table; 102 104 const struct regmap_access_table *volatile_table; 103 105 const struct regmap_access_table *precious_table; 106 const struct regmap_access_table *rd_noinc_table; 104 107 105 108 int (*reg_read)(void *context, unsigned int reg, unsigned int *val); … … 162 165 struct rb_root range_tree; 163 166 void *selector_work_buf; /* Scratch buffer used for selector */ 167 168 struct hwspinlock *hwlock; 164 169 }; 165 170 … … 183 188 bool regmap_volatile(struct regmap *map, unsigned int reg); 184 189 bool regmap_precious(struct regmap *map, unsigned int reg); 190 bool regmap_readable_noinc(struct regmap *map, unsigned int reg); 185 191 186 192 int _regmap_write(struct regmap *map, unsigned int reg, … … 218 224 extern void regmap_debugfs_init(struct regmap *map, const char *name); 219 225 extern void regmap_debugfs_exit(struct regmap *map); 226 227 static inline void regmap_debugfs_disable(struct regmap *map) 228 { 229 map->debugfs_disable = true; 230 } 231 220 232 #else 221 233 static inline void regmap_debugfs_initcall(void) { } 222 234 static inline void regmap_debugfs_init(struct regmap *map, const char *name) { } 223 235 static inline void regmap_debugfs_exit(struct regmap *map) { } 236 static inline void regmap_debugfs_disable(struct regmap *map) { } 224 237 #endif 225 238 -
GPL/branches/uniaud32-next/lib32/ioctl.c
r621 r625 276 276 277 277 pcms = pcm_instances(deviceid); 278 dprintf(("PSDebug: pcms= %d",pcms)); 278 279 279 if (!pcaps || !pcms) return -1; 280 280 -
GPL/branches/uniaud32-next/lib32/misc.c
r615 r625 246 246 { 247 247 return 0; 248 } 249 //****************************************************************************** 250 //****************************************************************************** 251 struct proc_dir_entry *proc_mkdir_mode(const char *name, umode_t mode, 252 struct proc_dir_entry *parent){ 253 struct proc_dir_entry *proc; 254 proc = (struct proc_dir_entry *)kmalloc(sizeof(struct proc_dir_entry), 0); 255 memset(proc, 0, sizeof(struct proc_dir_entry)); 256 257 proc->name = name; 258 proc->parent = parent; 259 260 return proc; 261 } 262 //****************************************************************************** 263 //****************************************************************************** 264 struct proc_dir_entry *proc_mkdir(const char *name, struct proc_dir_entry *parent) 265 { 266 return proc_mkdir_mode(name, S_IRUGO | S_IXUGO, parent); 267 } 268 //****************************************************************************** 269 //****************************************************************************** 270 struct proc_dir_entry *proc_symlink(const char *name, struct proc_dir_entry *parent, const char *dest) 271 { 272 struct proc_dir_entry *proc; 273 proc = (struct proc_dir_entry *)kmalloc(sizeof(struct proc_dir_entry), 0); 274 memset(proc, 0, sizeof(struct proc_dir_entry)); 275 276 proc->name = name; 277 proc->parent = parent; 278 proc->data = dest; 279 280 return proc; 248 281 } 249 282 //****************************************************************************** -
GPL/branches/uniaud32-next/lib32/rbtree.c
r615 r625 21 21 linux/lib/rbtree.c 22 22 */ 23 /* from 4.1 4.202*/23 /* from 4.19.163 */ 24 24 25 25 #include <linux/rbtree_augmented.h> … … 97 97 } 98 98 99 /*static */ inlinevoid99 /*static inline*/ void 100 100 __rb_insert(struct rb_node *node, struct rb_root *root, 101 101 bool newleft, struct rb_node **leftmost, … … 243 243 * and eliminate the dummy_rotate callback there 244 244 */ 245 /*static */ inlinevoid245 /*static inline*/ void 246 246 ____rb_erase_color(struct rb_node *parent, struct rb_root *root, 247 247 void (*augment_rotate)(struct rb_node *old, struct rb_node *new)) … … 445 445 /*static inline*/ void dummy_rotate(struct rb_node *old, struct rb_node *new) {} 446 446 447 /*static*/const struct rb_augment_callbacks dummy_callbacks = {447 static const struct rb_augment_callbacks dummy_callbacks = { 448 448 .propagate = dummy_propagate, 449 449 .copy = dummy_copy, … … 607 607 EXPORT_SYMBOL(rb_replace_node); 608 608 609 void rb_replace_node_cached(struct rb_node *victim, struct rb_node *new, 610 struct rb_root_cached *root) 611 { 612 rb_replace_node(victim, new, &root->rb_root); 613 614 if (root->rb_leftmost == victim) 615 root->rb_leftmost = new; 616 } 617 EXPORT_SYMBOL(rb_replace_node_cached); 618 609 619 #ifndef TARGET_OS2 610 620 void rb_replace_node_rcu(struct rb_node *victim, struct rb_node *new, … … 631 641 #endif 632 642 633 /*static*/struct rb_node *rb_left_deepest_node(const struct rb_node *node)643 static struct rb_node *rb_left_deepest_node(const struct rb_node *node) 634 644 { 635 645 for (;;) { -
GPL/branches/uniaud32-next/lib32/regcache-flat.c
r615 r625 10 10 * published by the Free Software Foundation. 11 11 */ 12 /* from 4.1 4.202*/12 /* from 4.19.163 */ 13 13 14 14 #include <linux/device.h> 15 15 #include <linux/seq_file.h> 16 16 #include <linux/slab.h> 17 #include <linux/module.h>18 #include <linux/workqueue.h>19 #include <linux/byteorder/little_endian.h>20 #include <linux/printk.h>21 17 22 18 #include "internal.h" … … 43 39 cache = map->cache; 44 40 45 for (i = 0; i < map->num_reg_defaults; i++) 46 cache[regcache_flat_get_index(map, map->reg_defaults[i].reg)] = 47 map->reg_defaults[i].def; 41 for (i = 0; i < map->num_reg_defaults; i++) { 42 unsigned int reg = map->reg_defaults[i].reg; 43 unsigned int index = regcache_flat_get_index(map, reg); 44 45 cache[index] = map->reg_defaults[i].def; 46 } 48 47 49 48 return 0; … … 62 61 { 63 62 unsigned int *cache = map->cache; 63 unsigned int index = regcache_flat_get_index(map, reg); 64 64 65 *value = cache[ regcache_flat_get_index(map, reg)];65 *value = cache[index]; 66 66 67 67 return 0; … … 72 72 { 73 73 unsigned int *cache = map->cache; 74 unsigned int index = regcache_flat_get_index(map, reg); 74 75 75 cache[ regcache_flat_get_index(map, reg)] = value;76 cache[index] = value; 76 77 77 78 return 0; -
GPL/branches/uniaud32-next/lib32/regcache-rbtree.c
r621 r625 10 10 * published by the Free Software Foundation. 11 11 */ 12 /* from 4.1 4.202*/12 /* from 4.19.163 */ 13 13 14 14 //#include <linux/debugfs.h> … … 24 24 #include "internal.h" 25 25 26 /*static*/ int regcache_rbtree_write(struct regmap *map, unsigned int reg,27 unsigned int value);28 /*static*/ int regcache_rbtree_exit(struct regmap *map);29 30 26 #ifdef TARGET_OS2 31 27 #define UINT_MAX (~0U) 32 #pragma pack(1)33 28 #endif 29 30 /*static inline*/ int regcache_rbtree_write(struct regmap *map, unsigned int reg, 31 unsigned int value); 32 /*static inline*/ int regcache_rbtree_exit(struct regmap *map); 33 34 34 struct regcache_rbtree_node { 35 35 /* block of adjacent registers */ 36 36 void *block; 37 37 /* Which registers are present */ 38 unsignedlong *cache_present;38 long *cache_present; 39 39 /* base register handled by this block */ 40 40 unsigned int base_reg; … … 43 43 /* the actual rbtree node holding this block */ 44 44 struct rb_node node; 45 #ifndef TARGET_OS2 46 } __attribute__ ((packed)); 47 #else 48 }; 49 #pragma pack() 50 #endif 45 } /*__attribute__ ((packed))*/; 51 46 52 47 struct regcache_rbtree_ctx { … … 55 50 }; 56 51 57 /*static inline*/ void regcache_rbtree_get_base_top_reg(52 /*static inline*/ inline void regcache_rbtree_get_base_top_reg( 58 53 struct regmap *map, 59 54 struct regcache_rbtree_node *rbnode, … … 64 59 } 65 60 66 /*static */ unsigned int regcache_rbtree_get_register(struct regmap *map,61 /*static inline*/ unsigned int regcache_rbtree_get_register(struct regmap *map, 67 62 struct regcache_rbtree_node *rbnode, unsigned int idx) 68 63 { … … 70 65 } 71 66 72 /*static */ void regcache_rbtree_set_register(struct regmap *map,67 /*static inline*/ void regcache_rbtree_set_register(struct regmap *map, 73 68 struct regcache_rbtree_node *rbnode, 74 69 unsigned int idx, unsigned int val) … … 78 73 } 79 74 80 /*static */ struct regcache_rbtree_node *regcache_rbtree_lookup(struct regmap *map,75 /*static inline*/ struct regcache_rbtree_node *regcache_rbtree_lookup(struct regmap *map, 81 76 unsigned int reg) 82 77 { … … 108 103 } 109 104 } 105 110 106 return NULL; 111 107 } 112 108 113 /*static */ int regcache_rbtree_insert(struct regmap *map, struct rb_root *root,109 /*static inline*/ int regcache_rbtree_insert(struct regmap *map, struct rb_root *root, 114 110 struct regcache_rbtree_node *rbnode) 115 111 { … … 121 117 parent = NULL; 122 118 new = &root->rb_node; 123 124 119 while (*new) { 125 120 rbnode_tmp = rb_entry(*new, struct regcache_rbtree_node, node); … … 148 143 149 144 #ifdef CONFIG_DEBUG_FS 150 /*static */ int rbtree_show(struct seq_file *s, void *ignored)145 /*static inline*/ int rbtree_show(struct seq_file *s, void *ignored) 151 146 { 152 147 struct regmap *map = s->private; … … 192 187 } 193 188 194 /*static */ int rbtree_open(struct inode *inode, struct file *file)189 /*static inline*/ int rbtree_open(struct inode *inode, struct file *file) 195 190 { 196 191 return single_open(file, rbtree_show, inode->i_private); 197 192 } 198 193 199 /*static */ const struct file_operations rbtree_fops = {194 /*static inline*/ const struct file_operations rbtree_fops = { 200 195 .open = rbtree_open, 201 196 .read = seq_read, … … 204 199 }; 205 200 206 /*static */ void rbtree_debugfs_init(struct regmap *map)201 /*static inline*/ void rbtree_debugfs_init(struct regmap *map) 207 202 { 208 203 debugfs_create_file("rbtree", 0400, map->debugfs, map, &rbtree_fops); … … 210 205 #endif 211 206 212 /*static */ int regcache_rbtree_init(struct regmap *map)207 /*static inline*/ int regcache_rbtree_init(struct regmap *map) 213 208 { 214 209 struct regcache_rbtree_ctx *rbtree_ctx; … … 233 228 #endif 234 229 rbtree_ctx->cached_rbnode = NULL; 230 235 231 for (i = 0; i < map->num_reg_defaults; i++) { 236 232 ret = regcache_rbtree_write(map, … … 248 244 } 249 245 250 /*static */ int regcache_rbtree_exit(struct regmap *map)246 /*static inline*/ int regcache_rbtree_exit(struct regmap *map) 251 247 { 252 248 struct rb_node *next; … … 277 273 } 278 274 279 /*static */ int regcache_rbtree_read(struct regmap *map,275 /*static inline*/ int regcache_rbtree_read(struct regmap *map, 280 276 unsigned int reg, unsigned int *value) 281 277 { … … 292 288 return -ENOENT; 293 289 } 294 return 0; 295 } 296 297 298 /*static*/ int regcache_rbtree_insert_to_block(struct regmap *map, 290 291 return 0; 292 } 293 294 295 /*static inline*/ int regcache_rbtree_insert_to_block(struct regmap *map, 299 296 struct regcache_rbtree_node *rbnode, 300 297 unsigned int base_reg, … … 351 348 } 352 349 353 /*static */ struct regcache_rbtree_node *350 /*static inline*/ struct regcache_rbtree_node * 354 351 regcache_rbtree_node_alloc(struct regmap *map, unsigned int reg) 355 352 { … … 369 366 break; 370 367 } 368 371 369 if (i != map->rd_table->n_yes_ranges) { 372 370 range = &map->rd_table->yes_ranges[i]; … … 376 374 } 377 375 } 376 378 377 if (!rbnode->blklen) { 379 378 rbnode->blklen = 1; … … 401 400 } 402 401 403 /*static */ int regcache_rbtree_write(struct regmap *map, unsigned int reg,402 /*static inline*/ int regcache_rbtree_write(struct regmap *map, unsigned int reg, 404 403 unsigned int value) 405 404 { … … 476 475 new_top_reg, reg, 477 476 value); 478 if (ret) {479 return ret; }477 if (ret) 478 return ret; 480 479 rbtree_ctx->cached_rbnode = rbnode; 481 480 return 0; … … 486 485 */ 487 486 rbnode = regcache_rbtree_node_alloc(map, reg); 488 if (!rbnode) {489 return -ENOMEM; }487 if (!rbnode) 488 return -ENOMEM; 490 489 regcache_rbtree_set_register(map, rbnode, 491 490 reg - rbnode->base_reg, value); … … 493 492 rbtree_ctx->cached_rbnode = rbnode; 494 493 } 495 return 0; 496 } 497 498 /*static*/ int regcache_rbtree_sync(struct regmap *map, unsigned int min, 494 495 return 0; 496 } 497 498 /*static inline*/ int regcache_rbtree_sync(struct regmap *map, unsigned int min, 499 499 unsigned int max) 500 500 { … … 537 537 } 538 538 539 /*static */ int regcache_rbtree_drop(struct regmap *map, unsigned int min,539 /*static inline*/ int regcache_rbtree_drop(struct regmap *map, unsigned int min, 540 540 unsigned int max) 541 541 { -
GPL/branches/uniaud32-next/lib32/regcache.c
r621 r625 10 10 * published by the Free Software Foundation. 11 11 */ 12 /* from 4.1 4.202*/12 /* from 4.19.163 */ 13 13 14 14 //#include <linux/bsearch.h> -
GPL/branches/uniaud32-next/lib32/regmap.c
r621 r625 10 10 * published by the Free Software Foundation. 11 11 */ 12 /* from 4.1 4.202*/12 /* from 4.19.163 */ 13 13 14 14 #include <linux/device.h> … … 22 22 #include <linux/delay.h> 23 23 #include <linux/log2.h> 24 //#include <linux/hwspinlock.h> 25 #include <asm/unaligned.h> 24 26 #include <linux/module.h> 25 27 #include <linux/workqueue.h> 26 28 #include <linux/byteorder/little_endian.h> 27 29 #include <linux/printk.h> 30 31 /* hwspinlock mode argument */ 32 #define HWLOCK_IRQSTATE 0x01 /* Disable interrupts, save state */ 33 #define HWLOCK_IRQ 0x02 /* Disable interrupts, don't save state */ 34 #define HWLOCK_RAW 0x03 28 35 29 36 #define CREATE_TRACE_POINTS … … 40 47 #undef LOG_DEVICE 41 48 42 staticint _regmap_update_bits(struct regmap *map, unsigned int reg,49 /*static inline*/ int _regmap_update_bits(struct regmap *map, unsigned int reg, 43 50 unsigned int mask, unsigned int val, 44 51 bool *change, bool force_write); 45 52 46 staticint _regmap_bus_reg_read(void *context, unsigned int reg,53 /*static inline*/ int _regmap_bus_reg_read(void *context, unsigned int reg, 47 54 unsigned int *val); 48 staticint _regmap_bus_read(void *context, unsigned int reg,55 /*static inline*/ int _regmap_bus_read(void *context, unsigned int reg, 49 56 unsigned int *val); 50 staticint _regmap_bus_formatted_write(void *context, unsigned int reg,57 /*static inline*/ int _regmap_bus_formatted_write(void *context, unsigned int reg, 51 58 unsigned int val); 52 staticint _regmap_bus_reg_write(void *context, unsigned int reg,59 /*static inline*/ int _regmap_bus_reg_write(void *context, unsigned int reg, 53 60 unsigned int val); 54 staticint _regmap_bus_raw_write(void *context, unsigned int reg,61 /*static inline*/ int _regmap_bus_raw_write(void *context, unsigned int reg, 55 62 unsigned int val); 56 63 … … 173 180 } 174 181 175 static bool regmap_volatile_range(struct regmap *map, unsigned int reg, 182 bool regmap_readable_noinc(struct regmap *map, unsigned int reg) 183 { 184 if (map->readable_noinc_reg) 185 return map->readable_noinc_reg(map->dev, reg); 186 187 if (map->rd_noinc_table) 188 return regmap_check_range_table(map, reg, map->rd_noinc_table); 189 190 return true; 191 } 192 193 /*static inline*/ bool regmap_volatile_range(struct regmap *map, unsigned int reg, 176 194 size_t num) 177 195 { … … 179 197 180 198 for (i = 0; i < num; i++) 181 if (!regmap_volatile(map, reg + i))199 if (!regmap_volatile(map, reg + regmap_get_offset(map, i))) 182 200 return false; 183 201 … … 185 203 } 186 204 187 staticvoid regmap_format_2_6_write(struct regmap *map,205 /*static inline*/ void regmap_format_2_6_write(struct regmap *map, 188 206 unsigned int reg, unsigned int val) 189 207 { … … 193 211 } 194 212 195 staticvoid regmap_format_4_12_write(struct regmap *map,213 /*static inline*/ void regmap_format_4_12_write(struct regmap *map, 196 214 unsigned int reg, unsigned int val) 197 215 { … … 200 218 } 201 219 202 staticvoid regmap_format_7_9_write(struct regmap *map,220 /*static inline*/ void regmap_format_7_9_write(struct regmap *map, 203 221 unsigned int reg, unsigned int val) 204 222 { … … 207 225 } 208 226 209 staticvoid regmap_format_10_14_write(struct regmap *map,227 /*static inline*/ void regmap_format_10_14_write(struct regmap *map, 210 228 unsigned int reg, unsigned int val) 211 229 { … … 217 235 } 218 236 219 staticvoid regmap_format_8(void *buf, unsigned int val, unsigned int shift)237 /*static inline*/ void regmap_format_8(void *buf, unsigned int val, unsigned int shift) 220 238 { 221 239 u8 *b = buf; … … 224 242 } 225 243 226 static void regmap_format_16_be(void *buf, unsigned int val, unsigned int shift) 227 { 228 __be16 *b = buf; 229 230 b[0] = cpu_to_be16(val << shift); 231 } 232 233 static void regmap_format_16_le(void *buf, unsigned int val, unsigned int shift) 234 { 235 __le16 *b = buf; 236 237 b[0] = cpu_to_le16(val << shift); 238 } 239 240 static void regmap_format_16_native(void *buf, unsigned int val, 244 /*static inline*/ void regmap_format_16_be(void *buf, unsigned int val, unsigned int shift) 245 { 246 put_unaligned_be16(val << shift, buf); 247 } 248 249 /*static inline*/ void regmap_format_16_le(void *buf, unsigned int val, unsigned int shift) 250 { 251 put_unaligned_le16(val << shift, buf); 252 } 253 254 /*static inline*/ void regmap_format_16_native(void *buf, unsigned int val, 241 255 unsigned int shift) 242 256 { 243 *(u16 *)buf = val << shift; 244 } 245 246 static void regmap_format_24(void *buf, unsigned int val, unsigned int shift) 257 u16 v = val << shift; 258 259 memcpy(buf, &v, sizeof(v)); 260 } 261 262 /*static inline*/ void regmap_format_24(void *buf, unsigned int val, unsigned int shift) 247 263 { 248 264 u8 *b = buf; … … 255 271 } 256 272 257 static void regmap_format_32_be(void *buf, unsigned int val, unsigned int shift) 258 { 259 __be32 *b = buf; 260 261 b[0] = cpu_to_be32(val << shift); 262 } 263 264 static void regmap_format_32_le(void *buf, unsigned int val, unsigned int shift) 265 { 266 __le32 *b = buf; 267 268 b[0] = cpu_to_le32(val << shift); 269 } 270 271 static void regmap_format_32_native(void *buf, unsigned int val, 273 /*static inline*/ void regmap_format_32_be(void *buf, unsigned int val, unsigned int shift) 274 { 275 put_unaligned_be32(val << shift, buf); 276 } 277 278 /*static inline*/ void regmap_format_32_le(void *buf, unsigned int val, unsigned int shift) 279 { 280 put_unaligned_le32(val << shift, buf); 281 } 282 283 /*static inline*/ void regmap_format_32_native(void *buf, unsigned int val, 272 284 unsigned int shift) 273 285 { 274 *(u32 *)buf = val << shift; 286 u32 v = val << shift; 287 288 memcpy(buf, &v, sizeof(v)); 275 289 } 276 290 277 291 #ifdef CONFIG_64BIT 278 static void regmap_format_64_be(void *buf, unsigned int val, unsigned int shift) 279 { 280 __be64 *b = buf; 281 282 b[0] = cpu_to_be64((u64)val << shift); 283 } 284 285 static void regmap_format_64_le(void *buf, unsigned int val, unsigned int shift) 286 { 287 __le64 *b = buf; 288 289 b[0] = cpu_to_le64((u64)val << shift); 290 } 291 292 static void regmap_format_64_native(void *buf, unsigned int val, 292 /*static inline*/ void regmap_format_64_be(void *buf, unsigned int val, unsigned int shift) 293 { 294 put_unaligned_be64((u64) val << shift, buf); 295 } 296 297 /*static inline*/ void regmap_format_64_le(void *buf, unsigned int val, unsigned int shift) 298 { 299 put_unaligned_le64((u64) val << shift, buf); 300 } 301 302 /*static inline*/ void regmap_format_64_native(void *buf, unsigned int val, 293 303 unsigned int shift) 294 304 { 295 *(u64 *)buf = (u64)val << shift; 305 u64 v = (u64) val << shift; 306 307 memcpy(buf, &v, sizeof(v)); 296 308 } 297 309 #endif 298 310 299 staticvoid regmap_parse_inplace_noop(void *buf)300 { 301 } 302 303 staticunsigned int regmap_parse_8(const void *buf)311 /*static inline*/ void regmap_parse_inplace_noop(void *buf) 312 { 313 } 314 315 /*static inline*/ unsigned int regmap_parse_8(const void *buf) 304 316 { 305 317 const u8 *b = buf; … … 308 320 } 309 321 310 static unsigned int regmap_parse_16_be(const void *buf) 311 { 312 const __be16 *b = buf; 313 314 return be16_to_cpu(b[0]); 315 } 316 317 static unsigned int regmap_parse_16_le(const void *buf) 318 { 319 const __le16 *b = buf; 320 321 return le16_to_cpu(b[0]); 322 } 323 324 static void regmap_parse_16_be_inplace(void *buf) 325 { 326 __be16 *b = buf; 327 328 b[0] = be16_to_cpu(b[0]); 329 } 330 331 static void regmap_parse_16_le_inplace(void *buf) 332 { 333 __le16 *b = buf; 334 335 b[0] = le16_to_cpu(b[0]); 336 } 337 338 static unsigned int regmap_parse_16_native(const void *buf) 339 { 340 return *(u16 *)buf; 341 } 342 343 static unsigned int regmap_parse_24(const void *buf) 322 /*static inline*/ unsigned int regmap_parse_16_be(const void *buf) 323 { 324 return get_unaligned_be16(buf); 325 } 326 327 /*static inline*/ unsigned int regmap_parse_16_le(const void *buf) 328 { 329 return get_unaligned_le16(buf); 330 } 331 332 /*static inline*/ void regmap_parse_16_be_inplace(void *buf) 333 { 334 u16 v = get_unaligned_be16(buf); 335 336 memcpy(buf, &v, sizeof(v)); 337 } 338 339 /*static inline*/ void regmap_parse_16_le_inplace(void *buf) 340 { 341 u16 v = get_unaligned_le16(buf); 342 343 memcpy(buf, &v, sizeof(v)); 344 } 345 346 /*static inline*/ unsigned int regmap_parse_16_native(const void *buf) 347 { 348 u16 v; 349 350 memcpy(&v, buf, sizeof(v)); 351 return v; 352 } 353 354 /*static inline*/ unsigned int regmap_parse_24(const void *buf) 344 355 { 345 356 const u8 *b = buf; … … 351 362 } 352 363 353 static unsigned int regmap_parse_32_be(const void *buf) 354 { 355 const __be32 *b = buf; 356 357 return be32_to_cpu(b[0]); 358 } 359 360 static unsigned int regmap_parse_32_le(const void *buf) 361 { 362 const __le32 *b = buf; 363 364 return le32_to_cpu(b[0]); 365 } 366 367 static void regmap_parse_32_be_inplace(void *buf) 368 { 369 __be32 *b = buf; 370 371 b[0] = be32_to_cpu(b[0]); 372 } 373 374 static void regmap_parse_32_le_inplace(void *buf) 375 { 376 __le32 *b = buf; 377 378 b[0] = le32_to_cpu(b[0]); 379 } 380 381 static unsigned int regmap_parse_32_native(const void *buf) 382 { 383 return *(u32 *)buf; 364 /*static inline*/ unsigned int regmap_parse_32_be(const void *buf) 365 { 366 return get_unaligned_be32(buf); 367 } 368 369 /*static inline*/ unsigned int regmap_parse_32_le(const void *buf) 370 { 371 return get_unaligned_le32(buf); 372 } 373 374 /*static inline*/ void regmap_parse_32_be_inplace(void *buf) 375 { 376 u32 v = get_unaligned_be32(buf); 377 378 memcpy(buf, &v, sizeof(v)); 379 } 380 381 /*static inline*/ void regmap_parse_32_le_inplace(void *buf) 382 { 383 u32 v = get_unaligned_le32(buf); 384 385 memcpy(buf, &v, sizeof(v)); 386 } 387 388 /*static inline*/ unsigned int regmap_parse_32_native(const void *buf) 389 { 390 u32 v; 391 392 memcpy(&v, buf, sizeof(v)); 393 return v; 384 394 } 385 395 386 396 #ifdef CONFIG_64BIT 387 static unsigned int regmap_parse_64_be(const void *buf) 388 { 389 const __be64 *b = buf; 390 391 return be64_to_cpu(b[0]); 392 } 393 394 static unsigned int regmap_parse_64_le(const void *buf) 395 { 396 const __le64 *b = buf; 397 398 return le64_to_cpu(b[0]); 399 } 400 401 static void regmap_parse_64_be_inplace(void *buf) 402 { 403 __be64 *b = buf; 404 405 b[0] = be64_to_cpu(b[0]); 406 } 407 408 static void regmap_parse_64_le_inplace(void *buf) 409 { 410 __le64 *b = buf; 411 412 b[0] = le64_to_cpu(b[0]); 413 } 414 415 static unsigned int regmap_parse_64_native(const void *buf) 416 { 417 return *(u64 *)buf; 397 /*static inline*/ unsigned int regmap_parse_64_be(const void *buf) 398 { 399 return get_unaligned_be64(buf); 400 } 401 402 /*static inline*/ unsigned int regmap_parse_64_le(const void *buf) 403 { 404 return get_unaligned_le64(buf); 405 } 406 407 /*static inline*/ void regmap_parse_64_be_inplace(void *buf) 408 { 409 u64 v = get_unaligned_be64(buf); 410 411 memcpy(buf, &v, sizeof(v)); 412 } 413 414 /*static inline*/ void regmap_parse_64_le_inplace(void *buf) 415 { 416 u64 v = get_unaligned_le64(buf); 417 418 memcpy(buf, &v, sizeof(v)); 419 } 420 421 /*static inline*/ unsigned int regmap_parse_64_native(const void *buf) 422 { 423 u64 v; 424 425 memcpy(&v, buf, sizeof(v)); 426 return v; 418 427 } 419 428 #endif 420 429 421 static void regmap_lock_mutex(void *__map) 430 /*static inline*/ void regmap_lock_hwlock(void *__map) 431 { 432 struct regmap *map = __map; 433 434 // hwspin_lock_timeout(map->hwlock, UINT_MAX); 435 } 436 437 /*static inline*/ void regmap_lock_hwlock_irq(void *__map) 438 { 439 struct regmap *map = __map; 440 441 // hwspin_lock_timeout_irq(map->hwlock, UINT_MAX); 442 } 443 444 /*static inline*/ void regmap_lock_hwlock_irqsave(void *__map) 445 { 446 struct regmap *map = __map; 447 448 // hwspin_lock_timeout_irqsave(map->hwlock, UINT_MAX, 449 // &map->spinlock_flags); 450 } 451 452 /*static inline*/ void regmap_unlock_hwlock(void *__map) 453 { 454 struct regmap *map = __map; 455 456 // hwspin_unlock(map->hwlock); 457 } 458 459 /*static inline*/ void regmap_unlock_hwlock_irq(void *__map) 460 { 461 struct regmap *map = __map; 462 463 // hwspin_unlock_irq(map->hwlock); 464 } 465 466 /*static inline*/ void regmap_unlock_hwlock_irqrestore(void *__map) 467 { 468 struct regmap *map = __map; 469 470 // hwspin_unlock_irqrestore(map->hwlock, &map->spinlock_flags); 471 } 472 473 /*static inline*/ void regmap_lock_unlock_none(void *__map) 474 { 475 476 } 477 478 /*static inline*/ void regmap_lock_mutex(void *__map) 422 479 { 423 480 struct regmap *map = __map; … … 425 482 } 426 483 427 staticvoid regmap_unlock_mutex(void *__map)484 /*static inline*/ void regmap_unlock_mutex(void *__map) 428 485 { 429 486 struct regmap *map = __map; … … 431 488 } 432 489 433 staticvoid regmap_lock_spinlock(void *__map)490 /*static inline*/ void regmap_lock_spinlock(void *__map) 434 491 __acquires(&map->spinlock) 435 492 { … … 441 498 } 442 499 443 staticvoid regmap_unlock_spinlock(void *__map)500 /*static inline*/ void regmap_unlock_spinlock(void *__map) 444 501 __releases(&map->spinlock) 445 502 { … … 448 505 } 449 506 450 staticvoid dev_get_regmap_release(struct device *dev, void *res)507 /*static inline*/ void dev_get_regmap_release(struct device *dev, void *res) 451 508 { 452 509 /* … … 457 514 } 458 515 459 staticbool _regmap_range_add(struct regmap *map,516 /*static inline*/ bool _regmap_range_add(struct regmap *map, 460 517 struct regmap_range_node *data) 461 518 { … … 482 539 } 483 540 484 staticstruct regmap_range_node *_regmap_range_lookup(struct regmap *map,541 /*static inline*/ struct regmap_range_node *_regmap_range_lookup(struct regmap *map, 485 542 unsigned int reg) 486 543 { … … 502 559 } 503 560 504 staticvoid regmap_range_exit(struct regmap *map)561 /*static inline*/ void regmap_range_exit(struct regmap *map) 505 562 { 506 563 struct rb_node *next; … … 540 597 EXPORT_SYMBOL_GPL(regmap_attach_dev); 541 598 542 staticenum regmap_endian regmap_get_reg_endian(const struct regmap_bus *bus,599 /*static inline*/ enum regmap_endian regmap_get_reg_endian(const struct regmap_bus *bus, 543 600 const struct regmap_config *config) 544 601 { … … 633 690 } 634 691 635 if (config->lock && config->unlock) { 692 if (config->name) { 693 #ifndef TARGET_OS2 694 map->name = kstrdup_const(config->name, GFP_KERNEL); 695 #else 696 map->name = config->name; 697 #endif 698 if (!map->name) { 699 ret = -ENOMEM; 700 goto err_map; 701 } 702 } 703 704 if (config->disable_locking) { 705 map->lock = map->unlock = regmap_lock_unlock_none; 706 regmap_debugfs_disable(map); 707 } else if (config->lock && config->unlock) { 636 708 map->lock = config->lock; 637 709 map->unlock = config->unlock; 638 710 map->lock_arg = config->lock_arg; 711 } else if (config->use_hwlock) { 712 // map->hwlock = hwspin_lock_request_specific(config->hwlock_id); 713 // if (!map->hwlock) { 714 // ret = -ENXIO; 715 // goto err_name; 716 // } 717 718 switch (config->hwlock_mode) { 719 case HWLOCK_IRQSTATE: 720 map->lock = regmap_lock_hwlock_irqsave; 721 map->unlock = regmap_unlock_hwlock_irqrestore; 722 break; 723 case HWLOCK_IRQ: 724 map->lock = regmap_lock_hwlock_irq; 725 map->unlock = regmap_unlock_hwlock_irq; 726 break; 727 default: 728 map->lock = regmap_lock_hwlock; 729 map->unlock = regmap_unlock_hwlock; 730 break; 731 } 732 733 map->lock_arg = map; 639 734 } else { 640 735 if ((bus && bus->fast_io) || … … 693 788 map->volatile_table = config->volatile_table; 694 789 map->precious_table = config->precious_table; 790 map->rd_noinc_table = config->rd_noinc_table; 695 791 map->writeable_reg = config->writeable_reg; 696 792 map->readable_reg = config->readable_reg; 697 793 map->volatile_reg = config->volatile_reg; 698 794 map->precious_reg = config->precious_reg; 795 map->readable_noinc_reg = config->readable_noinc_reg; 699 796 map->cache_type = config->cache_type; 700 map->name = config->name;701 797 702 798 spin_lock_init(&map->async_lock); … … 705 801 init_waitqueue_head(&map->async_waitq); 706 802 707 if (config->read_flag_mask || config->write_flag_mask) { 803 if (config->read_flag_mask || 804 config->write_flag_mask || 805 config->zero_flag_mask) { 708 806 map->read_flag_mask = config->read_flag_mask; 709 807 map->write_flag_mask = config->write_flag_mask; … … 739 837 break; 740 838 default: 741 goto err_ map;839 goto err_hwlock; 742 840 } 743 841 break; … … 749 847 break; 750 848 default: 751 goto err_ map;849 goto err_hwlock; 752 850 } 753 851 break; … … 759 857 break; 760 858 default: 761 goto err_ map;859 goto err_hwlock; 762 860 } 763 861 break; … … 769 867 break; 770 868 default: 771 goto err_ map;869 goto err_hwlock; 772 870 } 773 871 break; … … 789 887 break; 790 888 default: 791 goto err_ map;889 goto err_hwlock; 792 890 } 793 891 break; … … 795 893 case 24: 796 894 if (reg_endian != REGMAP_ENDIAN_BIG) 797 goto err_ map;895 goto err_hwlock; 798 896 map->format.format_reg = regmap_format_24; 799 897 break; … … 811 909 break; 812 910 default: 813 goto err_ map;911 goto err_hwlock; 814 912 } 815 913 break; … … 828 926 break; 829 927 default: 830 goto err_ map;928 goto err_hwlock; 831 929 } 832 930 break; … … 834 932 835 933 default: 836 goto err_ map;934 goto err_hwlock; 837 935 } 838 936 … … 863 961 break; 864 962 default: 865 goto err_ map;963 goto err_hwlock; 866 964 } 867 965 break; 868 966 case 24: 869 967 if (val_endian != REGMAP_ENDIAN_BIG) 870 goto err_ map;968 goto err_hwlock; 871 969 map->format.format_val = regmap_format_24; 872 970 map->format.parse_val = regmap_parse_24; … … 889 987 break; 890 988 default: 891 goto err_ map;989 goto err_hwlock; 892 990 } 893 991 break; … … 910 1008 break; 911 1009 default: 912 goto err_ map;1010 goto err_hwlock; 913 1011 } 914 1012 break; … … 919 1017 if ((reg_endian != REGMAP_ENDIAN_BIG) || 920 1018 (val_endian != REGMAP_ENDIAN_BIG)) 921 goto err_ map;1019 goto err_hwlock; 922 1020 map->use_single_write = true; 923 1021 } … … 925 1023 if (!map->format.format_write && 926 1024 !(map->format.format_reg && map->format.format_val)) 927 goto err_ map;1025 goto err_hwlock; 928 1026 929 1027 map->work_buf = kzalloc(map->format.buf_size, GFP_KERNEL); 930 1028 if (map->work_buf == NULL) { 931 1029 ret = -ENOMEM; 932 goto err_ map;1030 goto err_hwlock; 933 1031 } 934 1032 … … 1047 1145 if (dev) { 1048 1146 ret = regmap_attach_dev(dev, map, config); 1049 1050 1147 if (ret != 0) 1051 1148 goto err_regcache; 1149 } else { 1150 regmap_debugfs_init(map, config->name); 1052 1151 } 1053 1152 … … 1059 1158 regmap_range_exit(map); 1060 1159 kfree(map->work_buf); 1160 err_hwlock: 1161 // if (map->hwlock) 1162 // hwspin_lock_free(map->hwlock); 1163 err_name: 1164 // kfree_const(map->name); 1061 1165 err_map: 1062 1166 kfree(map); … … 1067 1171 1068 1172 #ifndef TARGET_OS2 1069 staticvoid devm_regmap_release(struct device *dev, void *res)1173 /*static inline*/ void devm_regmap_release(struct device *dev, void *res) 1070 1174 { 1071 1175 regmap_exit(*(struct regmap **)res); … … 1099 1203 #endif 1100 1204 1101 staticvoid regmap_field_init(struct regmap_field *rm_field,1205 /*static inline*/ void regmap_field_init(struct regmap_field *rm_field, 1102 1206 struct regmap *regmap, struct reg_field reg_field) 1103 1207 { … … 1216 1320 map->volatile_reg = config->volatile_reg; 1217 1321 map->precious_reg = config->precious_reg; 1322 map->readable_noinc_reg = config->readable_noinc_reg; 1218 1323 map->cache_type = config->cache_type; 1219 1324 … … 1250 1355 kfree(async); 1251 1356 } 1357 // if (map->hwlock) 1358 // hwspin_lock_free(map->hwlock); 1359 // kfree_const(map->name); 1360 kfree(map->patch); 1252 1361 kfree(map); 1253 1362 } 1254 1363 EXPORT_SYMBOL_GPL(regmap_exit); 1255 1364 1256 staticint dev_get_regmap_match(struct device *dev, void *res, void *data)1365 /*static inline*/ int dev_get_regmap_match(struct device *dev, void *res, void *data) 1257 1366 { 1258 1367 struct regmap **r = res; … … 1305 1414 EXPORT_SYMBOL_GPL(regmap_get_device); 1306 1415 1307 staticint _regmap_select_page(struct regmap *map, unsigned int *reg,1416 /*static inline*/ int _regmap_select_page(struct regmap *map, unsigned int *reg, 1308 1417 struct regmap_range_node *range, 1309 1418 unsigned int val_num) … … 1353 1462 } 1354 1463 1355 staticvoid regmap_set_work_buf_flag_mask(struct regmap *map, int max_bytes,1464 /*static inline*/ void regmap_set_work_buf_flag_mask(struct regmap *map, int max_bytes, 1356 1465 unsigned long mask) 1357 1466 { … … 1368 1477 } 1369 1478 1370 int _regmap_raw_write(struct regmap *map, unsigned int reg,1371 1479 /*static inline*/ int _regmap_raw_write_impl(struct regmap *map, unsigned int reg, 1480 const void *val, size_t val_len) 1372 1481 { 1373 1482 struct regmap_range_node *range; … … 1420 1529 dev_dbg(map->dev, "Writing window %d/%zu\n", 1421 1530 win_residue, val_len / map->format.val_bytes); 1422 ret = _regmap_raw_write(map, reg, val, win_residue * 1423 map->format.val_bytes); 1531 ret = _regmap_raw_write_impl(map, reg, val, 1532 win_residue * 1533 map->format.val_bytes); 1424 1534 if (ret != 0) 1425 1535 return ret; … … 1588 1698 EXPORT_SYMBOL_GPL(regmap_get_raw_write_max); 1589 1699 1590 staticint _regmap_bus_formatted_write(void *context, unsigned int reg,1700 /*static inline*/ int _regmap_bus_formatted_write(void *context, unsigned int reg, 1591 1701 unsigned int val) 1592 1702 { … … 1612 1722 } 1613 1723 1614 staticint _regmap_bus_reg_write(void *context, unsigned int reg,1724 /*static inline*/ int _regmap_bus_reg_write(void *context, unsigned int reg, 1615 1725 unsigned int val) 1616 1726 { … … 1620 1730 } 1621 1731 1622 staticint _regmap_bus_raw_write(void *context, unsigned int reg,1732 /*static inline*/ int _regmap_bus_raw_write(void *context, unsigned int reg, 1623 1733 unsigned int val) 1624 1734 { … … 1629 1739 map->format.format_val(map->work_buf + map->format.reg_bytes 1630 1740 + map->format.pad_bytes, val, 0); 1631 return _regmap_raw_write (map, reg,1632 map->work_buf +1633 map->format.reg_bytes +1634 map->format.pad_bytes,1635 map->format.val_bytes);1636 } 1637 1638 staticinline void *_regmap_map_get_context(struct regmap *map)1741 return _regmap_raw_write_impl(map, reg, 1742 map->work_buf + 1743 map->format.reg_bytes + 1744 map->format.pad_bytes, 1745 map->format.val_bytes); 1746 } 1747 1748 /*static inline*/ inline void *_regmap_map_get_context(struct regmap *map) 1639 1749 { 1640 1750 return (map->bus) ? map : map->bus_context; … … 1728 1838 EXPORT_SYMBOL_GPL(regmap_write_async); 1729 1839 1840 int _regmap_raw_write(struct regmap *map, unsigned int reg, 1841 const void *val, size_t val_len) 1842 { 1843 size_t val_bytes = map->format.val_bytes; 1844 size_t val_count = val_len / val_bytes; 1845 size_t chunk_count, chunk_bytes; 1846 size_t chunk_regs = val_count; 1847 int ret, i; 1848 1849 if (!val_count) 1850 return -EINVAL; 1851 1852 if (map->use_single_write) 1853 chunk_regs = 1; 1854 else if (map->max_raw_write && val_len > map->max_raw_write) 1855 chunk_regs = map->max_raw_write / val_bytes; 1856 1857 chunk_count = val_count / chunk_regs; 1858 chunk_bytes = chunk_regs * val_bytes; 1859 1860 /* Write as many bytes as possible with chunk_size */ 1861 for (i = 0; i < chunk_count; i++) { 1862 ret = _regmap_raw_write_impl(map, reg, val, chunk_bytes); 1863 if (ret) 1864 return ret; 1865 1866 reg += regmap_get_offset(map, chunk_regs); 1867 val += chunk_bytes; 1868 val_len -= chunk_bytes; 1869 } 1870 1871 /* Write remaining bytes */ 1872 if (val_len) 1873 ret = _regmap_raw_write_impl(map, reg, val, val_len); 1874 1875 return ret; 1876 } 1877 1730 1878 /** 1731 1879 * regmap_raw_write() - Write raw values to one or more registers … … 1753 1901 if (val_len % map->format.val_bytes) 1754 1902 return -EINVAL; 1755 if (map->max_raw_write && map->max_raw_write < val_len)1756 return -E2BIG;1757 1903 1758 1904 map->lock(map->lock_arg); … … 1845 1991 int ret = 0, i; 1846 1992 size_t val_bytes = map->format.val_bytes; 1847 size_t total_size = val_bytes * val_count;1848 1993 1849 1994 if (!IS_ALIGNED(reg, map->reg_stride)) … … 1851 1996 1852 1997 /* 1853 * Some devices don't support bulk write, for 1854 * them we have a series of single write operations in the first two if 1855 * blocks. 1856 * 1857 * The first if block is used for memory mapped io. It does not allow 1858 * val_bytes of 3 for example. 1859 * The second one is for busses that do not provide raw I/O. 1860 * The third one is used for busses which do not have these limitations 1861 * and can write arbitrary value lengths. 1998 * Some devices don't support bulk write, for them we have a series of 1999 * single write operations. 1862 2000 */ 1863 if (!map->bus ) {2001 if (!map->bus || !map->format.parse_inplace) { 1864 2002 map->lock(map->lock_arg); 1865 2003 for (i = 0; i < val_count; i++) { … … 1894 2032 out: 1895 2033 map->unlock(map->lock_arg); 1896 } else if (map->bus && !map->format.parse_inplace) {1897 const u8 *u8 = val;1898 const u16 *u16 = val;1899 const u32 *u32 = val;1900 unsigned int ival;1901 1902 for (i = 0; i < val_count; i++) {1903 switch (map->format.val_bytes) {1904 case 4:1905 ival = u32[i];1906 break;1907 case 2:1908 ival = u16[i];1909 break;1910 case 1:1911 ival = u8[i];1912 break;1913 default:1914 return -EINVAL;1915 }1916 1917 ret = regmap_write(map, reg + (i * map->reg_stride),1918 ival);1919 if (ret)1920 return ret;1921 }1922 } else if (map->use_single_write ||1923 (map->max_raw_write && map->max_raw_write < total_size)) {1924 int chunk_stride = map->reg_stride;1925 size_t chunk_size = val_bytes;1926 size_t chunk_count = val_count;1927 1928 if (!map->use_single_write) {1929 chunk_size = map->max_raw_write;1930 if (chunk_size % val_bytes)1931 chunk_size -= chunk_size % val_bytes;1932 chunk_count = total_size / chunk_size;1933 chunk_stride *= chunk_size / val_bytes;1934 }1935 1936 map->lock(map->lock_arg);1937 /* Write as many bytes as possible with chunk_size */1938 for (i = 0; i < chunk_count; i++) {1939 ret = _regmap_raw_write(map,1940 reg + (i * chunk_stride),1941 val + (i * chunk_size),1942 chunk_size);1943 if (ret)1944 break;1945 }1946 1947 /* Write remaining bytes */1948 if (!ret && chunk_size * i < total_size) {1949 ret = _regmap_raw_write(map, reg + (i * chunk_stride),1950 val + (i * chunk_size),1951 total_size - i * chunk_size);1952 }1953 map->unlock(map->lock_arg);1954 2034 } else { 1955 2035 void *wval; 1956 2036 1957 if (!val_count)1958 return -EINVAL;1959 1960 2037 wval = kmemdup(val, val_count * val_bytes, map->alloc_flags); 1961 if (!wval) { 1962 dev_err(map->dev, "Error in memory allocation\n"); 2038 if (!wval) 1963 2039 return -ENOMEM; 1964 } 2040 1965 2041 for (i = 0; i < val_count * val_bytes; i += val_bytes) 1966 2042 map->format.parse_inplace(wval + i); 1967 2043 1968 map->lock(map->lock_arg); 1969 ret = _regmap_raw_write(map, reg, wval, val_bytes * val_count); 1970 map->unlock(map->lock_arg); 2044 ret = regmap_raw_write(map, reg, wval, val_bytes * val_count); 1971 2045 1972 2046 kfree(wval); … … 1983 2057 * relative. The page register has been written if that was necessary. 1984 2058 */ 1985 staticint _regmap_raw_multi_reg_write(struct regmap *map,2059 /*static inline*/ int _regmap_raw_multi_reg_write(struct regmap *map, 1986 2060 const struct reg_sequence *regs, 1987 2061 size_t num_regs) … … 2029 2103 } 2030 2104 2031 staticunsigned int _regmap_register_page(struct regmap *map,2105 /*static inline*/ unsigned int _regmap_register_page(struct regmap *map, 2032 2106 unsigned int reg, 2033 2107 struct regmap_range_node *range) … … 2038 2112 } 2039 2113 2040 staticint _regmap_range_multi_paged_reg_write(struct regmap *map,2114 /*static inline*/ int _regmap_range_multi_paged_reg_write(struct regmap *map, 2041 2115 struct reg_sequence *regs, 2042 2116 size_t num_regs) … … 2115 2189 } 2116 2190 2117 staticint _regmap_multi_reg_write(struct regmap *map,2191 /*static inline*/ int _regmap_multi_reg_write(struct regmap *map, 2118 2192 const struct reg_sequence *regs, 2119 2193 size_t num_regs) … … 2310 2384 EXPORT_SYMBOL_GPL(regmap_raw_write_async); 2311 2385 2312 staticint _regmap_raw_read(struct regmap *map, unsigned int reg, void *val,2313 unsigned int val_len )2386 /*static inline*/ int _regmap_raw_read(struct regmap *map, unsigned int reg, void *val, 2387 unsigned int val_len, bool noinc) 2314 2388 { 2315 2389 struct regmap_range_node *range; … … 2324 2398 if (range) { 2325 2399 ret = _regmap_select_page(map, ®, range, 2326 val_len / map->format.val_bytes);2400 noinc ? 1 : val_len / map->format.val_bytes); 2327 2401 if (ret != 0) 2328 2402 return ret; … … 2340 2414 } 2341 2415 2342 staticint _regmap_bus_reg_read(void *context, unsigned int reg,2416 /*static inline*/ int _regmap_bus_reg_read(void *context, unsigned int reg, 2343 2417 unsigned int *val) 2344 2418 { … … 2348 2422 } 2349 2423 2350 staticint _regmap_bus_read(void *context, unsigned int reg,2424 /*static inline*/ int _regmap_bus_read(void *context, unsigned int reg, 2351 2425 unsigned int *val) 2352 2426 { 2353 2427 int ret; 2354 2428 struct regmap *map = context; 2429 void *work_val = map->work_buf + map->format.reg_bytes + 2430 map->format.pad_bytes; 2355 2431 2356 2432 if (!map->format.parse_val) 2357 2433 return -EINVAL; 2358 2434 2359 ret = _regmap_raw_read(map, reg, map->work_buf, map->format.val_bytes);2435 ret = _regmap_raw_read(map, reg, work_val, map->format.val_bytes, false); 2360 2436 if (ret == 0) 2361 *val = map->format.parse_val( map->work_buf);2437 *val = map->format.parse_val(work_val); 2362 2438 2363 2439 return ret; 2364 2440 } 2365 2441 2366 staticint _regmap_read(struct regmap *map, unsigned int reg,2442 /*static inline*/ int _regmap_read(struct regmap *map, unsigned int reg, 2367 2443 unsigned int *val) 2368 2444 { … … 2455 2531 if (regmap_volatile_range(map, reg, val_count) || map->cache_bypass || 2456 2532 map->cache_type == REGCACHE_NONE) { 2533 size_t chunk_count, chunk_bytes; 2534 size_t chunk_regs = val_count; 2535 2457 2536 if (!map->bus->read) { 2458 2537 ret = -ENOTSUPP; 2459 2538 goto out; 2460 2539 } 2461 if (map->max_raw_read && map->max_raw_read < val_len) { 2462 ret = -E2BIG; 2463 goto out; 2464 } 2465 2466 /* Physical block read if there's no cache involved */ 2467 ret = _regmap_raw_read(map, reg, val, val_len); 2468 2540 2541 if (map->use_single_read) 2542 chunk_regs = 1; 2543 else if (map->max_raw_read && val_len > map->max_raw_read) 2544 chunk_regs = map->max_raw_read / val_bytes; 2545 2546 chunk_count = val_count / chunk_regs; 2547 chunk_bytes = chunk_regs * val_bytes; 2548 2549 /* Read bytes that fit into whole chunks */ 2550 for (i = 0; i < chunk_count; i++) { 2551 ret = _regmap_raw_read(map, reg, val, chunk_bytes, false); 2552 if (ret != 0) 2553 goto out; 2554 2555 reg += regmap_get_offset(map, chunk_regs); 2556 val += chunk_bytes; 2557 val_len -= chunk_bytes; 2558 } 2559 2560 /* Read remaining bytes */ 2561 if (val_len) { 2562 ret = _regmap_raw_read(map, reg, val, val_len, false); 2563 if (ret != 0) 2564 goto out; 2565 } 2469 2566 } else { 2470 2567 /* Otherwise go word by word for the cache; should be low … … 2489 2586 2490 2587 /** 2491 * regmap_field_read() - Read a value to a single register field 2588 * regmap_noinc_read(): Read data from a register without incrementing the 2589 * register number 2590 * 2591 * @map: Register map to read from 2592 * @reg: Register to read from 2593 * @val: Pointer to data buffer 2594 * @val_len: Length of output buffer in bytes. 2595 * 2596 * The regmap API usually assumes that bulk bus read operations will read a 2597 * range of registers. Some devices have certain registers for which a read 2598 * operation read will read from an internal FIFO. 2599 * 2600 * The target register must be volatile but registers after it can be 2601 * completely unrelated cacheable registers. 2602 * 2603 * This will attempt multiple reads as required to read val_len bytes. 2604 * 2605 * A value of zero will be returned on success, a negative errno will be 2606 * returned in error cases. 2607 */ 2608 int regmap_noinc_read(struct regmap *map, unsigned int reg, 2609 void *val, size_t val_len) 2610 { 2611 size_t read_len; 2612 int ret; 2613 2614 if (!map->bus) 2615 return -EINVAL; 2616 if (!map->bus->read) 2617 return -ENOTSUPP; 2618 if (val_len % map->format.val_bytes) 2619 return -EINVAL; 2620 if (!IS_ALIGNED(reg, map->reg_stride)) 2621 return -EINVAL; 2622 if (val_len == 0) 2623 return -EINVAL; 2624 2625 map->lock(map->lock_arg); 2626 2627 if (!regmap_volatile(map, reg) || !regmap_readable_noinc(map, reg)) { 2628 ret = -EINVAL; 2629 goto out_unlock; 2630 } 2631 2632 while (val_len) { 2633 if (map->max_raw_read && map->max_raw_read < val_len) 2634 read_len = map->max_raw_read; 2635 else 2636 read_len = val_len; 2637 ret = _regmap_raw_read(map, reg, val, read_len, true); 2638 if (ret) 2639 goto out_unlock; 2640 val = ((u8 *)val) + read_len; 2641 val_len -= read_len; 2642 } 2643 2644 out_unlock: 2645 map->unlock(map->lock_arg); 2646 return ret; 2647 } 2648 EXPORT_SYMBOL_GPL(regmap_noinc_read); 2649 2650 /** 2651 * regmap_field_read(): Read a value to a single register field 2492 2652 * 2493 2653 * @field: Register field to read from … … 2566 2726 if (!IS_ALIGNED(reg, map->reg_stride)) 2567 2727 return -EINVAL; 2728 if (val_count == 0) 2729 return -EINVAL; 2568 2730 2569 2731 if (map->bus && map->format.parse_inplace && (vol || map->cache_type == REGCACHE_NONE)) { 2570 /* 2571 * Some devices does not support bulk read, for 2572 * them we have a series of single read operations. 2573 */ 2574 size_t total_size = val_bytes * val_count; 2575 2576 if (!map->use_single_read && 2577 (!map->max_raw_read || map->max_raw_read > total_size)) { 2578 ret = regmap_raw_read(map, reg, val, 2579 val_bytes * val_count); 2580 if (ret != 0) 2581 return ret; 2582 } else { 2583 /* 2584 * Some devices do not support bulk read or do not 2585 * support large bulk reads, for them we have a series 2586 * of read operations. 2587 */ 2588 int chunk_stride = map->reg_stride; 2589 size_t chunk_size = val_bytes; 2590 size_t chunk_count = val_count; 2591 2592 if (!map->use_single_read) { 2593 chunk_size = map->max_raw_read; 2594 if (chunk_size % val_bytes) 2595 chunk_size -= chunk_size % val_bytes; 2596 chunk_count = total_size / chunk_size; 2597 chunk_stride *= chunk_size / val_bytes; 2598 } 2599 2600 /* Read bytes that fit into a multiple of chunk_size */ 2601 for (i = 0; i < chunk_count; i++) { 2602 ret = regmap_raw_read(map, 2603 reg + (i * chunk_stride), 2604 val + (i * chunk_size), 2605 chunk_size); 2606 if (ret != 0) 2607 return ret; 2608 } 2609 2610 /* Read remaining bytes */ 2611 if (chunk_size * i < total_size) { 2612 ret = regmap_raw_read(map, 2613 reg + (i * chunk_stride), 2614 val + (i * chunk_size), 2615 total_size - i * chunk_size); 2616 if (ret != 0) 2617 return ret; 2618 } 2619 } 2732 ret = regmap_raw_read(map, reg, val, val_bytes * val_count); 2733 if (ret != 0) 2734 return ret; 2620 2735 2621 2736 for (i = 0; i < val_count * val_bytes; i += val_bytes) 2622 2737 map->format.parse_inplace(val + i); 2623 2738 } else { 2739 #ifdef CONFIG_64BIT 2740 u64 *u64 = val; 2741 #endif 2742 u32 *u32 = val; 2743 u16 *u16 = val; 2744 u8 *u8 = val; 2745 2746 map->lock(map->lock_arg); 2747 2624 2748 for (i = 0; i < val_count; i++) { 2625 2749 unsigned int ival; 2626 ret = regmap_read(map, reg + regmap_get_offset(map, i), 2627 &ival); 2750 2751 ret = _regmap_read(map, reg + regmap_get_offset(map, i), 2752 &ival); 2628 2753 if (ret != 0) 2629 return ret; 2630 2631 if (map->format.format_val) { 2632 map->format.format_val(val + (i * val_bytes), ival, 0); 2633 } else { 2634 /* Devices providing read and write 2635 * operations can use the bulk I/O 2636 * functions if they define a val_bytes, 2637 * we assume that the values are native 2638 * endian. 2639 */ 2754 goto out; 2755 2756 switch (map->format.val_bytes) { 2640 2757 #ifdef CONFIG_64BIT 2641 u64 *u64 = val; 2758 case 8: 2759 u64[i] = ival; 2760 break; 2642 2761 #endif 2643 u32 *u32 = val; 2644 u16 *u16 = val; 2645 u8 *u8 = val; 2646 2647 switch (map->format.val_bytes) { 2648 #ifdef CONFIG_64BIT 2649 case 8: 2650 u64[i] = ival; 2651 break; 2652 #endif 2653 case 4: 2654 u32[i] = ival; 2655 break; 2656 case 2: 2657 u16[i] = ival; 2658 break; 2659 case 1: 2660 u8[i] = ival; 2661 break; 2662 default: 2663 return -EINVAL; 2664 } 2762 case 4: 2763 u32[i] = ival; 2764 break; 2765 case 2: 2766 u16[i] = ival; 2767 break; 2768 case 1: 2769 u8[i] = ival; 2770 break; 2771 default: 2772 ret = -EINVAL; 2773 goto out; 2665 2774 } 2666 2775 } 2667 } 2668 2669 return 0; 2776 2777 out: 2778 map->unlock(map->lock_arg); 2779 } 2780 2781 return ret; 2670 2782 } 2671 2783 EXPORT_SYMBOL_GPL(regmap_bulk_read); 2672 2784 2673 staticint _regmap_update_bits(struct regmap *map, unsigned int reg,2785 /*static inline*/ int _regmap_update_bits(struct regmap *map, unsigned int reg, 2674 2786 unsigned int mask, unsigned int val, 2675 2787 bool *change, bool force_write) … … 2764 2876 EXPORT_SYMBOL_GPL(regmap_async_complete_cb); 2765 2877 2766 #ifndef TARGET_OS2 2767 static int regmap_async_is_done(struct regmap *map) 2878 /*static inline*/ int regmap_async_is_done(struct regmap *map) 2768 2879 { 2769 2880 unsigned long flags; … … 2776 2887 return ret; 2777 2888 } 2778 #endif2779 2889 2780 2890 /** … … 2795 2905 return 0; 2796 2906 2797 // FIXMEwait_event(map->async_waitq, regmap_async_is_done(map));2907 // wait_event(map->async_waitq, regmap_async_is_done(map)); 2798 2908 2799 2909 spin_lock_irqsave(&map->async_lock, flags); … … 2835 2945 return 0; 2836 2946 #endif 2837 2838 2947 p = krealloc(map->patch, 2839 2948 sizeof(struct reg_sequence) * (map->patch_regs + num_regs), … … 2924 3033 EXPORT_SYMBOL_GPL(regmap_parse_val); 2925 3034 2926 staticint __init regmap_initcall(void)3035 /*static inline*/ int __init regmap_initcall(void) 2927 3036 { 2928 3037 regmap_debugfs_initcall(); -
GPL/branches/uniaud32-next/lib32/waitqueue.c
r615 r625 109 109 spin_unlock_irqrestore(&x->wait.lock, flags); 110 110 } 111 /** 112 * complete_all: - signals all threads waiting on this completion 113 * @x: holds the state of this particular completion 114 * 115 * This will wake up all threads waiting on this particular completion event. 116 * 117 * If this function wakes up a task, it executes a full memory barrier before 118 * accessing the task state. 119 * 120 * Since complete_all() sets the completion of @x permanently to done 121 * to allow multiple waiters to finish, a call to reinit_completion() 122 * must be used on @x if @x is to be used again. The code must make 123 * sure that all waiters have woken and finished before reinitializing 124 * @x. Also note that the function completion_done() can not be used 125 * to know if there are still waiters after complete_all() has been called. 126 */ 127 void complete_all(struct completion *x) 128 { 129 unsigned long flags; 130 131 spin_lock_irqsave(&x->wait.lock, flags); 132 __wake_up_locked(&x->wait, TASK_NORMAL, 1); 133 spin_unlock_irqrestore(&x->wait.lock, flags); 134 } 111 135 //****************************************************************************** 112 136 //****************************************************************************** … … 115 139 dprintf3(("WARNING: __wake_up_locked STUB")); 116 140 } 141 //****************************************************************************** 142 //****************************************************************************** 143 /** 144 * wait_for_completion: - waits for completion of a task 145 * @x: holds the state of this particular completion 146 * 147 * This waits to be signaled for completion of a specific task. It is NOT 148 * interruptible and there is no timeout. 149 * 150 * See also similar routines (i.e. wait_for_completion_timeout()) with timeout 151 * and interrupt capability. Also see complete(). 152 */ 153 void wait_for_completion(struct completion *x) 154 { 155 dprintf3(("WARNING: wait_for_completion STUB")); 156 } 157 158 159 /** 160 * wait_for_completion_timeout: - waits for completion of a task (w/timeout) 161 * @x: holds the state of this particular completion 162 * @timeout: timeout value in jiffies 163 * 164 * This waits for either a completion of a specific task to be signaled or for a 165 * specified timeout to expire. The timeout is in jiffies. It is not 166 * interruptible. 167 * 168 * Return: 0 if timed out, and positive (at least 1, or number of jiffies left 169 * till timeout) if completed. 170 */ 171 unsigned long wait_for_completion_timeout(struct completion *x, unsigned long timeout) 172 { 173 dprintf3(("WARNING: wait_for_completion_timeout STUB")); 174 return 1; 175 }
Note:
See TracChangeset
for help on using the changeset viewer.