summaryrefslogtreecommitdiff
path: root/drivers/staging
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/Kconfig12
-rw-r--r--drivers/staging/Makefile7
-rw-r--r--drivers/staging/altera-stapl/Kconfig8
-rw-r--r--drivers/staging/altera-stapl/Makefile3
-rw-r--r--drivers/staging/altera-stapl/altera-comp.c142
-rw-r--r--drivers/staging/altera-stapl/altera-exprt.h33
-rw-r--r--drivers/staging/altera-stapl/altera-jtag.c1021
-rw-r--r--drivers/staging/altera-stapl/altera-jtag.h113
-rw-r--r--drivers/staging/altera-stapl/altera-lpt.c70
-rw-r--r--drivers/staging/altera-stapl/altera.c2527
-rw-r--r--drivers/staging/ath6kl/htc2/AR6000/ar6k_gmbox_hciuart.c6
-rw-r--r--drivers/staging/ath6kl/include/aggr_recv_api.h2
-rw-r--r--drivers/staging/ath6kl/include/common/a_hci.h4
-rw-r--r--drivers/staging/ath6kl/include/common/dbglog.h2
-rw-r--r--drivers/staging/ath6kl/include/common/epping_test.h2
-rw-r--r--drivers/staging/ath6kl/include/common/ini_dset.h2
-rw-r--r--drivers/staging/ath6kl/include/common/testcmd.h4
-rw-r--r--drivers/staging/ath6kl/include/common/wmi.h8
-rw-r--r--drivers/staging/ath6kl/include/common/wmix.h2
-rw-r--r--drivers/staging/ath6kl/include/htc_api.h6
-rw-r--r--drivers/staging/ath6kl/miscdrv/credit_dist.c6
-rw-r--r--drivers/staging/ath6kl/os/linux/ar6000_android.c2
-rw-r--r--drivers/staging/ath6kl/os/linux/ar6000_drv.c8
-rw-r--r--drivers/staging/ath6kl/wmi/wmi.c2
-rw-r--r--drivers/staging/bcm/Adapter.h10
-rw-r--r--drivers/staging/bcm/CmHost.c16
-rw-r--r--drivers/staging/bcm/HostMIBSInterface.h2
-rw-r--r--drivers/staging/bcm/IPv6Protocol.c4
-rw-r--r--drivers/staging/bcm/InterfaceIdleMode.c4
-rw-r--r--drivers/staging/bcm/InterfaceIsr.c4
-rw-r--r--drivers/staging/bcm/InterfaceRx.c10
-rw-r--r--drivers/staging/bcm/Ioctl.h2
-rw-r--r--drivers/staging/bcm/LeakyBucket.c2
-rw-r--r--drivers/staging/bcm/Misc.c6
-rw-r--r--drivers/staging/bcm/Qos.c2
-rw-r--r--drivers/staging/bcm/cntrl_SignalingInterface.h6
-rw-r--r--drivers/staging/bcm/nvm.c54
-rw-r--r--drivers/staging/brcm80211/README2
-rw-r--r--drivers/staging/brcm80211/brcmfmac/bcmsdh_linux.c4
-rw-r--r--drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c2
-rw-r--r--drivers/staging/brcm80211/brcmfmac/dhd_custom_gpio.c2
-rw-r--r--drivers/staging/brcm80211/brcmfmac/dhd_linux.c2
-rw-r--r--drivers/staging/brcm80211/brcmfmac/dhd_sdio.c4
-rw-r--r--drivers/staging/brcm80211/brcmsmac/wl_mac80211.c2
-rw-r--r--drivers/staging/brcm80211/brcmsmac/wlc_ampdu.c6
-rw-r--r--drivers/staging/brcm80211/brcmsmac/wlc_bmac.c2
-rw-r--r--drivers/staging/brcm80211/brcmsmac/wlc_main.c13
-rw-r--r--drivers/staging/brcm80211/brcmsmac/wlc_rate.c2
-rw-r--r--drivers/staging/brcm80211/include/bcmsrom_fmt.h2
-rw-r--r--drivers/staging/brcm80211/include/hndsoc.h2
-rw-r--r--drivers/staging/brcm80211/util/bcmotp.c4
-rw-r--r--drivers/staging/brcm80211/util/bcmsrom.c2
-rw-r--r--drivers/staging/brcm80211/util/hnddma.c6
-rw-r--r--drivers/staging/brcm80211/util/sbpcmcia.h2
-rw-r--r--drivers/staging/brcm80211/util/siutils.c2
-rw-r--r--drivers/staging/comedi/comedi_fops.c2
-rw-r--r--drivers/staging/comedi/drivers/addi-data/APCI1710_Chrono.c8
-rw-r--r--drivers/staging/comedi/drivers/addi-data/addi_amcc_S5920.c2
-rw-r--r--drivers/staging/comedi/drivers/addi-data/hwdrv_apci2032.c2
-rw-r--r--drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c18
-rw-r--r--drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.h2
-rw-r--r--drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c4
-rw-r--r--drivers/staging/comedi/drivers/adl_pci9118.c6
-rw-r--r--drivers/staging/comedi/drivers/adq12b.c4
-rw-r--r--drivers/staging/comedi/drivers/adv_pci1710.c8
-rw-r--r--drivers/staging/comedi/drivers/cb_pcidas.c6
-rw-r--r--drivers/staging/comedi/drivers/cb_pcidas64.c14
-rw-r--r--drivers/staging/comedi/drivers/comedi_test.c2
-rw-r--r--drivers/staging/comedi/drivers/das1800.c2
-rw-r--r--drivers/staging/comedi/drivers/das800.c2
-rw-r--r--drivers/staging/comedi/drivers/dmm32at.c2
-rw-r--r--drivers/staging/comedi/drivers/dt2811.c2
-rw-r--r--drivers/staging/comedi/drivers/dt9812.c2
-rw-r--r--drivers/staging/comedi/drivers/gsc_hpdi.c4
-rw-r--r--drivers/staging/comedi/drivers/icp_multi.c6
-rw-r--r--drivers/staging/comedi/drivers/me4000.c4
-rw-r--r--drivers/staging/comedi/drivers/mpc624.c14
-rw-r--r--drivers/staging/comedi/drivers/ni_at_a2150.c12
-rw-r--r--drivers/staging/comedi/drivers/ni_labpc.c14
-rw-r--r--drivers/staging/comedi/drivers/ni_pcidio.c2
-rw-r--r--drivers/staging/comedi/drivers/pcl812.c2
-rw-r--r--drivers/staging/comedi/drivers/pcl816.c6
-rw-r--r--drivers/staging/comedi/drivers/pcl818.c6
-rw-r--r--drivers/staging/comedi/drivers/pcmmio.c4
-rw-r--r--drivers/staging/comedi/drivers/pcmuio.c2
-rw-r--r--drivers/staging/comedi/drivers/quatech_daqp_cs.c4
-rw-r--r--drivers/staging/comedi/drivers/rtd520.c12
-rw-r--r--drivers/staging/comedi/drivers/s626.c18
-rw-r--r--drivers/staging/comedi/drivers/usbdux.c22
-rw-r--r--drivers/staging/comedi/drivers/usbduxfast.c8
-rw-r--r--drivers/staging/cptm1217/clearpad_tm1217.c2
-rw-r--r--drivers/staging/crystalhd/crystalhd_cmds.c2
-rw-r--r--drivers/staging/crystalhd/crystalhd_hw.c6
-rw-r--r--drivers/staging/cx25821/Kconfig1
-rw-r--r--drivers/staging/cx25821/cx25821-alsa.c2
-rw-r--r--drivers/staging/cx25821/cx25821-core.c16
-rw-r--r--drivers/staging/cx25821/cx25821-video.c9
-rw-r--r--drivers/staging/cx25821/cx25821.h3
-rw-r--r--drivers/staging/cxd2099/Kconfig11
-rw-r--r--drivers/staging/cxd2099/Makefile5
-rw-r--r--drivers/staging/cxd2099/TODO12
-rw-r--r--drivers/staging/cxd2099/cxd2099.c574
-rw-r--r--drivers/staging/cxd2099/cxd2099.h41
-rw-r--r--drivers/staging/cxt1e1/musycc.c2
-rw-r--r--drivers/staging/cxt1e1/musycc.h4
-rw-r--r--drivers/staging/cxt1e1/pmcc4_defs.h4
-rw-r--r--drivers/staging/cxt1e1/sbecrc.c2
-rw-r--r--drivers/staging/cxt1e1/sbeproc.c2
-rw-r--r--drivers/staging/dabusb/Kconfig14
-rw-r--r--drivers/staging/dabusb/Makefile2
-rw-r--r--drivers/staging/dabusb/TODO5
-rw-r--r--drivers/staging/dabusb/dabusb.c926
-rw-r--r--drivers/staging/dabusb/dabusb.h80
-rw-r--r--drivers/staging/easycap/easycap_ioctl.c3
-rw-r--r--drivers/staging/et131x/et1310_address_map.h4
-rw-r--r--drivers/staging/et131x/et1310_phy.h2
-rw-r--r--drivers/staging/et131x/et1310_rx.c2
-rw-r--r--drivers/staging/et131x/et131x_isr.c2
-rw-r--r--drivers/staging/et131x/et131x_netdev.c2
-rw-r--r--drivers/staging/ft1000/ft1000-pcmcia/ft1000_dev.h4
-rw-r--r--drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c78
-rw-r--r--drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c48
-rw-r--r--drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c3
-rw-r--r--drivers/staging/ft1000/ft1000-usb/ft1000_download.c8
-rw-r--r--drivers/staging/ft1000/ft1000-usb/ft1000_hw.c16
-rw-r--r--drivers/staging/ft1000/ft1000-usb/ft1000_ioctl.h2
-rw-r--r--drivers/staging/ft1000/ft1000-usb/ft1000_usb.h2
-rw-r--r--drivers/staging/generic_serial/generic_serial.c2
-rw-r--r--drivers/staging/generic_serial/rio/map.h2
-rw-r--r--drivers/staging/generic_serial/rio/rioboot.c8
-rw-r--r--drivers/staging/generic_serial/rio/riocmd.c2
-rw-r--r--drivers/staging/generic_serial/rio/rioroute.c4
-rw-r--r--drivers/staging/generic_serial/rio/riotty.c4
-rw-r--r--drivers/staging/generic_serial/sx.c8
-rw-r--r--drivers/staging/gma500/Kconfig2
-rw-r--r--drivers/staging/gma500/psb_drm.h2
-rw-r--r--drivers/staging/gma500/psb_drv.c2
-rw-r--r--drivers/staging/gma500/psb_intel_bios.c2
-rw-r--r--drivers/staging/gma500/psb_intel_sdvo.c2
-rw-r--r--drivers/staging/gma500/psb_intel_sdvo_regs.h2
-rw-r--r--drivers/staging/gma500/psb_ttm_fence_user.h2
-rw-r--r--drivers/staging/go7007/go7007.txt2
-rw-r--r--drivers/staging/hv/blkvsc_drv.c13
-rw-r--r--drivers/staging/hv/channel.c8
-rw-r--r--drivers/staging/hv/channel_mgmt.c2
-rw-r--r--drivers/staging/hv/connection.c4
-rw-r--r--drivers/staging/hv/hv.c2
-rw-r--r--drivers/staging/hv/hv_api.h4
-rw-r--r--drivers/staging/hv/hv_kvp.h2
-rw-r--r--drivers/staging/hv/hv_mouse.c6
-rw-r--r--drivers/staging/hv/hv_util.c2
-rw-r--r--drivers/staging/hv/netvsc_drv.c24
-rw-r--r--drivers/staging/hv/rndis_filter.c2
-rw-r--r--drivers/staging/hv/tools/hv_kvp_daemon.c92
-rw-r--r--drivers/staging/hv/vmbus_drv.c2
-rw-r--r--drivers/staging/hv/vmbus_private.h1
-rw-r--r--drivers/staging/iio/Documentation/iio_utils.h2
-rw-r--r--drivers/staging/iio/accel/adis16201.h2
-rw-r--r--drivers/staging/iio/accel/adis16203.h2
-rw-r--r--drivers/staging/iio/accel/adis16204.h2
-rw-r--r--drivers/staging/iio/accel/adis16209.h2
-rw-r--r--drivers/staging/iio/accel/adis16220.h2
-rw-r--r--drivers/staging/iio/accel/adis16240.h2
-rw-r--r--drivers/staging/iio/accel/lis3l02dq.h26
-rw-r--r--drivers/staging/iio/accel/lis3l02dq_core.c2
-rw-r--r--drivers/staging/iio/accel/lis3l02dq_ring.c4
-rw-r--r--drivers/staging/iio/accel/sca3000.h4
-rw-r--r--drivers/staging/iio/accel/sca3000_ring.c2
-rw-r--r--drivers/staging/iio/adc/ad7298_ring.c2
-rw-r--r--drivers/staging/iio/adc/ad7476_ring.c2
-rw-r--r--drivers/staging/iio/adc/ad7887_ring.c2
-rw-r--r--drivers/staging/iio/adc/ad799x_core.c2
-rw-r--r--drivers/staging/iio/adc/ad799x_ring.c2
-rw-r--r--drivers/staging/iio/adc/max1363_core.c4
-rw-r--r--drivers/staging/iio/adc/max1363_ring.c2
-rw-r--r--drivers/staging/iio/chrdev.h6
-rw-r--r--drivers/staging/iio/gyro/adis16060_core.c2
-rw-r--r--drivers/staging/iio/gyro/adis16080_core.c2
-rw-r--r--drivers/staging/iio/gyro/adis16260.h2
-rw-r--r--drivers/staging/iio/iio.h2
-rw-r--r--drivers/staging/iio/imu/adis16300.h2
-rw-r--r--drivers/staging/iio/imu/adis16350.h2
-rw-r--r--drivers/staging/iio/imu/adis16400.h5
-rw-r--r--drivers/staging/iio/imu/adis16400_core.c20
-rw-r--r--drivers/staging/iio/imu/adis16400_ring.c12
-rw-r--r--drivers/staging/iio/industrialio-core.c2
-rw-r--r--drivers/staging/iio/meter/ade7753.h2
-rw-r--r--drivers/staging/iio/meter/ade7754.h2
-rw-r--r--drivers/staging/iio/meter/ade7758.h2
-rw-r--r--drivers/staging/iio/meter/ade7759.h2
-rw-r--r--drivers/staging/iio/meter/ade7854.h2
-rw-r--r--drivers/staging/iio/ring_generic.h2
-rw-r--r--drivers/staging/intel_sst/TODO2
-rw-r--r--drivers/staging/intel_sst/intel_sst.c4
-rw-r--r--drivers/staging/intel_sst/intel_sst_app_interface.c16
-rw-r--r--drivers/staging/intel_sst/intel_sst_drv_interface.c2
-rw-r--r--drivers/staging/intel_sst/intel_sst_dsp.c4
-rw-r--r--drivers/staging/intel_sst/intel_sst_fw_ipc.h2
-rw-r--r--drivers/staging/intel_sst/intel_sst_stream.c2
-rw-r--r--drivers/staging/intel_sst/intel_sst_stream_encoded.c2
-rw-r--r--drivers/staging/intel_sst/intelmid.c2
-rw-r--r--drivers/staging/intel_sst/intelmid.h2
-rw-r--r--drivers/staging/intel_sst/intelmid_v1_control.c1
-rw-r--r--drivers/staging/intel_sst/intelmid_v2_control.c1
-rw-r--r--drivers/staging/keucr/init.c4
-rw-r--r--drivers/staging/keucr/smilmain.c8
-rw-r--r--drivers/staging/keucr/smilsub.c6
-rw-r--r--drivers/staging/lirc/Kconfig12
-rw-r--r--drivers/staging/lirc/Makefile2
-rw-r--r--drivers/staging/lirc/TODO.lirc_zilog51
-rw-r--r--drivers/staging/lirc/lirc_ene0100.h4
-rw-r--r--drivers/staging/lirc/lirc_imon.c2
-rw-r--r--drivers/staging/lirc/lirc_it87.c1027
-rw-r--r--drivers/staging/lirc/lirc_it87.h116
-rw-r--r--drivers/staging/lirc/lirc_ite8709.c542
-rw-r--r--drivers/staging/lirc/lirc_sasem.c2
-rw-r--r--drivers/staging/lirc/lirc_zilog.c814
-rw-r--r--drivers/staging/memrar/Kconfig15
-rw-r--r--drivers/staging/memrar/Makefile2
-rw-r--r--drivers/staging/memrar/TODO43
-rw-r--r--drivers/staging/memrar/memrar-abi89
-rw-r--r--drivers/staging/memrar/memrar.h174
-rw-r--r--drivers/staging/memrar/memrar_allocator.c432
-rw-r--r--drivers/staging/memrar/memrar_allocator.h149
-rw-r--r--drivers/staging/memrar/memrar_handler.c1007
-rw-r--r--drivers/staging/msm/mdp4_overlay.c2
-rw-r--r--drivers/staging/msm/mdp_ppp_dq.c2
-rw-r--r--drivers/staging/msm/msm_fb.c6
-rw-r--r--drivers/staging/octeon/cvmx-cmd-queue.h2
-rw-r--r--drivers/staging/octeon/cvmx-fpa.h2
-rw-r--r--drivers/staging/octeon/cvmx-helper-board.h2
-rw-r--r--drivers/staging/octeon/cvmx-helper-util.c2
-rw-r--r--drivers/staging/octeon/cvmx-helper.c2
-rw-r--r--drivers/staging/octeon/cvmx-mdio.h2
-rw-r--r--drivers/staging/octeon/cvmx-pko.h4
-rw-r--r--drivers/staging/octeon/cvmx-pow.h12
-rw-r--r--drivers/staging/octeon/ethernet-util.h2
-rw-r--r--drivers/staging/olpc_dcon/Kconfig2
-rw-r--r--drivers/staging/olpc_dcon/olpc_dcon.c1
-rw-r--r--drivers/staging/olpc_dcon/olpc_dcon_xo_1.c3
-rw-r--r--drivers/staging/olpc_dcon/olpc_dcon_xo_1_5.c1
-rw-r--r--drivers/staging/pohmelfs/crypto.c2
-rw-r--r--drivers/staging/quatech_usb2/quatech_usb2.c12
-rw-r--r--drivers/staging/rt2860/chip/rtmp_phy.h2
-rw-r--r--drivers/staging/rt2860/common/ba_action.c4
-rw-r--r--drivers/staging/rt2860/common/cmm_aes.c2
-rw-r--r--drivers/staging/rt2860/common/cmm_cfg.c2
-rw-r--r--drivers/staging/rt2860/common/cmm_data.c4
-rw-r--r--drivers/staging/rt2860/common/cmm_data_pci.c6
-rw-r--r--drivers/staging/rt2860/common/cmm_data_usb.c6
-rw-r--r--drivers/staging/rt2860/common/cmm_mac_pci.c2
-rw-r--r--drivers/staging/rt2860/common/cmm_sanity.c4
-rw-r--r--drivers/staging/rt2860/common/cmm_sync.c2
-rw-r--r--drivers/staging/rt2860/common/cmm_wpa.c4
-rw-r--r--drivers/staging/rt2860/common/mlme.c16
-rw-r--r--drivers/staging/rt2860/common/rtmp_init.c14
-rw-r--r--drivers/staging/rt2860/common/spectrum.c12
-rw-r--r--drivers/staging/rt2860/mlme.h8
-rw-r--r--drivers/staging/rt2860/rt_linux.c2
-rw-r--r--drivers/staging/rt2860/rt_pci_rbus.c2
-rw-r--r--drivers/staging/rt2860/rtmp.h4
-rw-r--r--drivers/staging/rt2860/sta_ioctl.c2
-rw-r--r--drivers/staging/rt2870/common/rtusb_bulk.c6
-rw-r--r--drivers/staging/rt2870/common/rtusb_data.c2
-rw-r--r--drivers/staging/rtl8187se/Kconfig1
-rw-r--r--drivers/staging/rtl8187se/ieee80211/ieee80211.h6
-rw-r--r--drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c2
-rw-r--r--drivers/staging/rtl8187se/r8180_core.c4
-rw-r--r--drivers/staging/rtl8187se/r8180_dm.c4
-rw-r--r--drivers/staging/rtl8187se/r8180_rtl8225z2.c2
-rw-r--r--drivers/staging/rtl8187se/r8185b_init.c2
-rw-r--r--drivers/staging/rtl8192e/Kconfig1
-rw-r--r--drivers/staging/rtl8192e/ieee80211/ieee80211.h8
-rw-r--r--drivers/staging/rtl8192e/ieee80211/ieee80211_rx.c2
-rw-r--r--drivers/staging/rtl8192e/ieee80211/ieee80211_softmac.c4
-rw-r--r--drivers/staging/rtl8192e/ieee80211/rtl819x_HT.h2
-rw-r--r--drivers/staging/rtl8192e/ieee80211/rtl819x_HTProc.c8
-rw-r--r--drivers/staging/rtl8192e/ieee80211/rtl819x_TS.h2
-rw-r--r--drivers/staging/rtl8192e/ieee80211/rtl819x_TSProc.c2
-rw-r--r--drivers/staging/rtl8192e/r819xE_phy.c6
-rw-r--r--drivers/staging/rtl8192u/Kconfig1
-rw-r--r--drivers/staging/rtl8192u/ieee80211/ieee80211.h8
-rw-r--r--drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c2
-rw-r--r--drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c4
-rw-r--r--drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h2
-rw-r--r--drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c8
-rw-r--r--drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h2
-rw-r--r--drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c2
-rw-r--r--drivers/staging/rtl8192u/ieee80211/scatterwalk.c2
-rw-r--r--drivers/staging/rtl8192u/r8192U_core.c6
-rw-r--r--drivers/staging/rtl8192u/r819xU_HTType.h2
-rw-r--r--drivers/staging/rtl8192u/r819xU_phy.c6
-rw-r--r--drivers/staging/rtl8712/rtl871x_cmd.h2
-rw-r--r--drivers/staging/rtl8712/rtl871x_led.h4
-rw-r--r--drivers/staging/rtl8712/rtl871x_mlme.c6
-rw-r--r--drivers/staging/rtl8712/rtl871x_mlme.h2
-rw-r--r--drivers/staging/rtl8712/rtl871x_mp_phy_regdef.h2
-rw-r--r--drivers/staging/rtl8712/usb_halinit.c2
-rw-r--r--drivers/staging/rts_pstor/debug.h2
-rw-r--r--drivers/staging/rts_pstor/ms.c1
-rw-r--r--drivers/staging/rts_pstor/rtsx.c14
-rw-r--r--drivers/staging/rts_pstor/rtsx_chip.c16
-rw-r--r--drivers/staging/rts_pstor/rtsx_chip.h10
-rw-r--r--drivers/staging/rts_pstor/rtsx_scsi.c1
-rw-r--r--drivers/staging/rts_pstor/rtsx_scsi.h2
-rw-r--r--drivers/staging/rts_pstor/sd.c6
-rw-r--r--drivers/staging/rts_pstor/trace.h2
-rw-r--r--drivers/staging/rts_pstor/xd.c1
-rw-r--r--drivers/staging/samsung-laptop/Kconfig10
-rw-r--r--drivers/staging/samsung-laptop/Makefile1
-rw-r--r--drivers/staging/samsung-laptop/TODO5
-rw-r--r--drivers/staging/samsung-laptop/samsung-laptop.c842
-rw-r--r--drivers/staging/se401/Kconfig13
-rw-r--r--drivers/staging/se401/Makefile1
-rw-r--r--drivers/staging/se401/TODO5
-rw-r--r--drivers/staging/se401/se401.c1492
-rw-r--r--drivers/staging/se401/se401.h236
-rw-r--r--drivers/staging/se401/videodev.h318
-rw-r--r--drivers/staging/sep/sep_driver.c25
-rw-r--r--drivers/staging/sep/sep_driver_config.h4
-rw-r--r--drivers/staging/slicoss/README2
-rw-r--r--drivers/staging/sm7xx/smtcfb.c10
-rw-r--r--drivers/staging/solo6x10/Kconfig1
-rw-r--r--drivers/staging/speakup/keyhelp.c2
-rw-r--r--drivers/staging/speakup/spkguide.txt2
-rw-r--r--drivers/staging/spectra/ffsport.c4
-rw-r--r--drivers/staging/spectra/flash.c6
-rw-r--r--drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c20
-rw-r--r--drivers/staging/tidspbridge/core/_tiomap.h2
-rw-r--r--drivers/staging/tidspbridge/core/chnl_sm.c2
-rw-r--r--drivers/staging/tidspbridge/dynload/cload.c2
-rw-r--r--drivers/staging/tidspbridge/hw/hw_mmu.c6
-rw-r--r--drivers/staging/tidspbridge/include/dspbridge/_chnl_sm.h4
-rw-r--r--drivers/staging/tidspbridge/include/dspbridge/clk.h6
-rw-r--r--drivers/staging/tidspbridge/include/dspbridge/cmm.h2
-rw-r--r--drivers/staging/tidspbridge/include/dspbridge/cod.h2
-rw-r--r--drivers/staging/tidspbridge/include/dspbridge/dev.h2
-rw-r--r--drivers/staging/tidspbridge/include/dspbridge/drv.h6
-rw-r--r--drivers/staging/tidspbridge/include/dspbridge/dspdefs.h14
-rw-r--r--drivers/staging/tidspbridge/include/dspbridge/mgr.h4
-rw-r--r--drivers/staging/tidspbridge/include/dspbridge/node.h2
-rw-r--r--drivers/staging/tidspbridge/include/dspbridge/proc.h6
-rw-r--r--drivers/staging/tidspbridge/include/dspbridge/pwr.h8
-rw-r--r--drivers/staging/tidspbridge/pmgr/dev.c6
-rw-r--r--drivers/staging/tidspbridge/rmgr/drv.c2
-rw-r--r--drivers/staging/tidspbridge/rmgr/nldr.c6
-rw-r--r--drivers/staging/tidspbridge/rmgr/proc.c4
-rw-r--r--drivers/staging/tm6000/tm6000-alsa.c13
-rw-r--r--drivers/staging/tm6000/tm6000-cards.c102
-rw-r--r--drivers/staging/tm6000/tm6000-core.c298
-rw-r--r--drivers/staging/tm6000/tm6000-regs.h63
-rw-r--r--drivers/staging/tm6000/tm6000-stds.c35
-rw-r--r--drivers/staging/tm6000/tm6000-video.c346
-rw-r--r--drivers/staging/tm6000/tm6000.h25
-rw-r--r--drivers/staging/tty/cd1865.h2
-rw-r--r--drivers/staging/tty/epca.c16
-rw-r--r--drivers/staging/tty/ip2/i2hw.h4
-rw-r--r--drivers/staging/tty/ip2/i2lib.c8
-rw-r--r--drivers/staging/tty/ip2/ip2main.c2
-rw-r--r--drivers/staging/tty/specialix.c12
-rw-r--r--drivers/staging/tty/specialix_io8.h4
-rw-r--r--drivers/staging/usbip/stub_dev.c6
-rw-r--r--drivers/staging/usbip/stub_rx.c40
-rw-r--r--drivers/staging/usbip/stub_tx.c74
-rw-r--r--drivers/staging/usbip/usbip_common.c64
-rw-r--r--drivers/staging/usbip/usbip_common.h2
-rw-r--r--drivers/staging/usbip/vhci_hcd.c13
-rw-r--r--drivers/staging/usbip/vhci_rx.c3
-rw-r--r--drivers/staging/usbip/vhci_sysfs.c7
-rw-r--r--drivers/staging/usbvideo/Kconfig15
-rw-r--r--drivers/staging/usbvideo/Makefile2
-rw-r--r--drivers/staging/usbvideo/TODO5
-rw-r--r--drivers/staging/usbvideo/usbvideo.c2222
-rw-r--r--drivers/staging/usbvideo/usbvideo.h395
-rw-r--r--drivers/staging/usbvideo/vicam.c946
-rw-r--r--drivers/staging/usbvideo/videodev.h318
-rw-r--r--drivers/staging/vme/bridges/vme_ca91cx42.c6
-rw-r--r--drivers/staging/vme/bridges/vme_tsi148.c4
-rw-r--r--drivers/staging/vme/bridges/vme_tsi148.h8
-rw-r--r--drivers/staging/vme/vme_api.txt6
-rw-r--r--drivers/staging/vt6655/Kconfig2
-rw-r--r--drivers/staging/vt6655/card.c2
-rw-r--r--drivers/staging/vt6655/device_main.c2
-rw-r--r--drivers/staging/vt6655/wcmd.c2
-rw-r--r--drivers/staging/vt6655/wmgr.h4
-rw-r--r--drivers/staging/vt6656/Kconfig2
-rw-r--r--drivers/staging/vt6656/rxtx.c2
-rw-r--r--drivers/staging/vt6656/wcmd.c4
-rw-r--r--drivers/staging/vt6656/wmgr.h4
-rw-r--r--drivers/staging/westbridge/astoria/api/src/cyasdma.c2
-rw-r--r--drivers/staging/westbridge/astoria/api/src/cyaslep2pep.c2
-rw-r--r--drivers/staging/westbridge/astoria/api/src/cyaslowlevel.c2
-rw-r--r--drivers/staging/westbridge/astoria/api/src/cyasmisc.c6
-rw-r--r--drivers/staging/westbridge/astoria/api/src/cyasmtp.c4
-rw-r--r--drivers/staging/westbridge/astoria/api/src/cyasstorage.c6
-rw-r--r--drivers/staging/westbridge/astoria/api/src/cyasusb.c4
-rw-r--r--drivers/staging/westbridge/astoria/arch/arm/mach-omap2/cyashalomap_kernel.c14
-rw-r--r--drivers/staging/westbridge/astoria/arch/arm/plat-omap/include/mach/westbridge/westbridge-omap3-pnand-hal/cyashalomap_kernel.h2
-rw-r--r--drivers/staging/westbridge/astoria/arch/arm/plat-omap/include/mach/westbridge/westbridge-omap3-pnand-hal/cyasmemmap.h4
-rw-r--r--drivers/staging/westbridge/astoria/block/cyasblkdev_block.c11
-rw-r--r--drivers/staging/westbridge/astoria/block/cyasblkdev_queue.c2
-rw-r--r--drivers/staging/westbridge/astoria/gadget/cyasgadget.c1
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyasdevice.h6
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyasdma.h10
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyaserr.h4
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyashaldoc.h2
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyasintr.h2
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyasmisc.h8
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyasprotocol.h4
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyasstorage.h34
-rw-r--r--drivers/staging/westbridge/astoria/include/linux/westbridge/cyasusb.h40
-rw-r--r--drivers/staging/winbond/mds.c2
-rw-r--r--drivers/staging/wlags49_h2/README.ubuntu2
-rw-r--r--drivers/staging/wlags49_h2/TODO4
-rw-r--r--drivers/staging/wlags49_h2/hcf.c24
-rw-r--r--drivers/staging/wlags49_h2/hcfdef.h2
-rw-r--r--drivers/staging/wlags49_h2/wl_wext.c6
-rw-r--r--drivers/staging/wlags49_h25/TODO4
-rw-r--r--drivers/staging/wlan-ng/cfg80211.c2
-rw-r--r--drivers/staging/wlan-ng/prism2sta.c2
-rw-r--r--drivers/staging/xgifb/vb_setmode.c2
-rw-r--r--drivers/staging/xgifb/vgatypes.h2
422 files changed, 6989 insertions, 12941 deletions
diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
index ccaa2009414b..e3786f161bc3 100644
--- a/drivers/staging/Kconfig
+++ b/drivers/staging/Kconfig
@@ -55,11 +55,7 @@ source "drivers/staging/cx25821/Kconfig"
source "drivers/staging/tm6000/Kconfig"
-source "drivers/staging/dabusb/Kconfig"
-
-source "drivers/staging/se401/Kconfig"
-
-source "drivers/staging/usbvideo/Kconfig"
+source "drivers/staging/cxd2099/Kconfig"
source "drivers/staging/usbip/Kconfig"
@@ -121,8 +117,6 @@ source "drivers/staging/hv/Kconfig"
source "drivers/staging/vme/Kconfig"
-source "drivers/staging/memrar/Kconfig"
-
source "drivers/staging/sep/Kconfig"
source "drivers/staging/iio/Kconfig"
@@ -137,8 +131,6 @@ source "drivers/staging/wlags49_h2/Kconfig"
source "drivers/staging/wlags49_h25/Kconfig"
-source "drivers/staging/samsung-laptop/Kconfig"
-
source "drivers/staging/sm7xx/Kconfig"
source "drivers/staging/dt3155v4l/Kconfig"
@@ -183,5 +175,7 @@ source "drivers/staging/ste_rmi4/Kconfig"
source "drivers/staging/gma500/Kconfig"
+source "drivers/staging/altera-stapl/Kconfig"
+
endif # !STAGING_EXCLUDE_BUILD
endif # STAGING
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
index 3b223cbf86b4..f0d5c5315612 100644
--- a/drivers/staging/Makefile
+++ b/drivers/staging/Makefile
@@ -10,9 +10,7 @@ obj-$(CONFIG_SLICOSS) += slicoss/
obj-$(CONFIG_VIDEO_GO7007) += go7007/
obj-$(CONFIG_VIDEO_CX25821) += cx25821/
obj-$(CONFIG_VIDEO_TM6000) += tm6000/
-obj-$(CONFIG_USB_DABUSB) += dabusb/
-obj-$(CONFIG_USB_VICAM) += usbvideo/
-obj-$(CONFIG_USB_SE401) += se401/
+obj-$(CONFIG_DVB_CXD2099) += cxd2099/
obj-$(CONFIG_LIRC_STAGING) += lirc/
obj-$(CONFIG_USB_IP_COMMON) += usbip/
obj-$(CONFIG_W35UND) += winbond/
@@ -42,7 +40,6 @@ obj-$(CONFIG_VT6655) += vt6655/
obj-$(CONFIG_VT6656) += vt6656/
obj-$(CONFIG_HYPERV) += hv/
obj-$(CONFIG_VME_BUS) += vme/
-obj-$(CONFIG_MRST_RAR_HANDLER) += memrar/
obj-$(CONFIG_DX_SEP) += sep/
obj-$(CONFIG_IIO) += iio/
obj-$(CONFIG_CS5535_GPIO) += cs5535_gpio/
@@ -51,7 +48,6 @@ obj-$(CONFIG_XVMALLOC) += zram/
obj-$(CONFIG_ZCACHE) += zcache/
obj-$(CONFIG_WLAGS49_H2) += wlags49_h2/
obj-$(CONFIG_WLAGS49_H25) += wlags49_h25/
-obj-$(CONFIG_SAMSUNG_LAPTOP) += samsung-laptop/
obj-$(CONFIG_FB_SM7XX) += sm7xx/
obj-$(CONFIG_VIDEO_DT3155) += dt3155v4l/
obj-$(CONFIG_CRYSTALHD) += crystalhd/
@@ -70,6 +66,7 @@ obj-$(CONFIG_BCM_WIMAX) += bcm/
obj-$(CONFIG_FT1000) += ft1000/
obj-$(CONFIG_SND_INTEL_SST) += intel_sst/
obj-$(CONFIG_SPEAKUP) += speakup/
+obj-$(CONFIG_ALTERA_STAPL) +=altera-stapl/
obj-$(CONFIG_TOUCHSCREEN_CLEARPAD_TM1217) += cptm1217/
obj-$(CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4) += ste_rmi4/
obj-$(CONFIG_DRM_PSB) += gma500/
diff --git a/drivers/staging/altera-stapl/Kconfig b/drivers/staging/altera-stapl/Kconfig
new file mode 100644
index 000000000000..7f01d8e93992
--- /dev/null
+++ b/drivers/staging/altera-stapl/Kconfig
@@ -0,0 +1,8 @@
+comment "Altera FPGA firmware download module"
+
+config ALTERA_STAPL
+ tristate "Altera FPGA firmware download module"
+ depends on I2C
+ default n
+ help
+ An Altera FPGA module. Say Y when you want to support this tool.
diff --git a/drivers/staging/altera-stapl/Makefile b/drivers/staging/altera-stapl/Makefile
new file mode 100644
index 000000000000..055f61ee781a
--- /dev/null
+++ b/drivers/staging/altera-stapl/Makefile
@@ -0,0 +1,3 @@
+altera-stapl-objs = altera-lpt.o altera-jtag.o altera-comp.o altera.o
+
+obj-$(CONFIG_ALTERA_STAPL) += altera-stapl.o
diff --git a/drivers/staging/altera-stapl/altera-comp.c b/drivers/staging/altera-stapl/altera-comp.c
new file mode 100644
index 000000000000..49b103bedaaf
--- /dev/null
+++ b/drivers/staging/altera-stapl/altera-comp.c
@@ -0,0 +1,142 @@
+/*
+ * altera-comp.c
+ *
+ * altera FPGA driver
+ *
+ * Copyright (C) Altera Corporation 1998-2001
+ * Copyright (C) 2010 NetUP Inc.
+ * Copyright (C) 2010 Igor M. Liplianin <liplianin@netup.ru>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <linux/kernel.h>
+#include "altera-exprt.h"
+
+#define SHORT_BITS 16
+#define CHAR_BITS 8
+#define DATA_BLOB_LENGTH 3
+#define MATCH_DATA_LENGTH 8192
+#define ALTERA_REQUEST_SIZE 1024
+#define ALTERA_BUFFER_SIZE (MATCH_DATA_LENGTH + ALTERA_REQUEST_SIZE)
+
+static u32 altera_bits_req(u32 n)
+{
+ u32 result = SHORT_BITS;
+
+ if (n == 0)
+ result = 1;
+ else {
+ /* Look for the highest non-zero bit position */
+ while ((n & (1 << (SHORT_BITS - 1))) == 0) {
+ n <<= 1;
+ --result;
+ }
+ }
+
+ return result;
+}
+
+static u32 altera_read_packed(u8 *buffer, u32 bits, u32 *bits_avail,
+ u32 *in_index)
+{
+ u32 result = 0;
+ u32 shift = 0;
+ u32 databyte = 0;
+
+ while (bits > 0) {
+ databyte = buffer[*in_index];
+ result |= (((databyte >> (CHAR_BITS - *bits_avail))
+ & (0xff >> (CHAR_BITS - *bits_avail))) << shift);
+
+ if (bits <= *bits_avail) {
+ result &= (0xffff >> (SHORT_BITS - (bits + shift)));
+ *bits_avail -= bits;
+ bits = 0;
+ } else {
+ ++(*in_index);
+ shift += *bits_avail;
+ bits -= *bits_avail;
+ *bits_avail = CHAR_BITS;
+ }
+ }
+
+ return result;
+}
+
+u32 altera_shrink(u8 *in, u32 in_length, u8 *out, u32 out_length, s32 version)
+{
+ u32 i, j, data_length = 0L;
+ u32 offset, length;
+ u32 match_data_length = MATCH_DATA_LENGTH;
+ u32 bits_avail = CHAR_BITS;
+ u32 in_index = 0L;
+
+ if (version > 0)
+ --match_data_length;
+
+ for (i = 0; i < out_length; ++i)
+ out[i] = 0;
+
+ /* Read number of bytes in data. */
+ for (i = 0; i < sizeof(in_length); ++i) {
+ data_length = data_length | (
+ altera_read_packed(in,
+ CHAR_BITS,
+ &bits_avail,
+ &in_index) << (i * CHAR_BITS));
+ }
+
+ if (data_length > out_length) {
+ data_length = 0L;
+ return data_length;
+ }
+
+ i = 0;
+ while (i < data_length) {
+ /* A 0 bit indicates literal data. */
+ if (altera_read_packed(in, 1, &bits_avail,
+ &in_index) == 0) {
+ for (j = 0; j < DATA_BLOB_LENGTH; ++j) {
+ if (i < data_length) {
+ out[i] = (u8)altera_read_packed(in,
+ CHAR_BITS,
+ &bits_avail,
+ &in_index);
+ i++;
+ }
+ }
+ } else {
+ /* A 1 bit indicates offset/length to follow. */
+ offset = altera_read_packed(in, altera_bits_req((s16)
+ (i > match_data_length ?
+ match_data_length : i)),
+ &bits_avail,
+ &in_index);
+ length = altera_read_packed(in, CHAR_BITS,
+ &bits_avail,
+ &in_index);
+ for (j = 0; j < length; ++j) {
+ if (i < data_length) {
+ out[i] = out[i - offset];
+ i++;
+ }
+ }
+ }
+ }
+
+ return data_length;
+}
diff --git a/drivers/staging/altera-stapl/altera-exprt.h b/drivers/staging/altera-stapl/altera-exprt.h
new file mode 100644
index 000000000000..39c38d84a670
--- /dev/null
+++ b/drivers/staging/altera-stapl/altera-exprt.h
@@ -0,0 +1,33 @@
+/*
+ * altera-exprt.h
+ *
+ * altera FPGA driver
+ *
+ * Copyright (C) Altera Corporation 1998-2001
+ * Copyright (C) 2010 NetUP Inc.
+ * Copyright (C) 2010 Igor M. Liplianin <liplianin@netup.ru>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef ALTERA_EXPRT_H
+#define ALTERA_EXPRT_H
+
+
+u32 altera_shrink(u8 *in, u32 in_length, u8 *out, u32 out_length, s32 version);
+int netup_jtag_io_lpt(void *device, int tms, int tdi, int read_tdo);
+
+#endif /* ALTERA_EXPRT_H */
diff --git a/drivers/staging/altera-stapl/altera-jtag.c b/drivers/staging/altera-stapl/altera-jtag.c
new file mode 100644
index 000000000000..876308858b82
--- /dev/null
+++ b/drivers/staging/altera-stapl/altera-jtag.c
@@ -0,0 +1,1021 @@
+/*
+ * altera-jtag.c
+ *
+ * altera FPGA driver
+ *
+ * Copyright (C) Altera Corporation 1998-2001
+ * Copyright (C) 2010 NetUP Inc.
+ * Copyright (C) 2010 Igor M. Liplianin <liplianin@netup.ru>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <linux/delay.h>
+#include <linux/firmware.h>
+#include <linux/slab.h>
+#include <staging/altera.h>
+#include "altera-exprt.h"
+#include "altera-jtag.h"
+
+#define alt_jtag_io(a, b, c)\
+ astate->config->jtag_io(astate->config->dev, a, b, c);
+
+#define alt_malloc(a) kzalloc(a, GFP_KERNEL);
+
+/*
+ * This structure shows, for each JTAG state, which state is reached after
+ * a single TCK clock cycle with TMS high or TMS low, respectively. This
+ * describes all possible state transitions in the JTAG state machine.
+ */
+struct altera_jtag_machine {
+ enum altera_jtag_state tms_high;
+ enum altera_jtag_state tms_low;
+};
+
+static const struct altera_jtag_machine altera_transitions[] = {
+ /* RESET */ { RESET, IDLE },
+ /* IDLE */ { DRSELECT, IDLE },
+ /* DRSELECT */ { IRSELECT, DRCAPTURE },
+ /* DRCAPTURE */ { DREXIT1, DRSHIFT },
+ /* DRSHIFT */ { DREXIT1, DRSHIFT },
+ /* DREXIT1 */ { DRUPDATE, DRPAUSE },
+ /* DRPAUSE */ { DREXIT2, DRPAUSE },
+ /* DREXIT2 */ { DRUPDATE, DRSHIFT },
+ /* DRUPDATE */ { DRSELECT, IDLE },
+ /* IRSELECT */ { RESET, IRCAPTURE },
+ /* IRCAPTURE */ { IREXIT1, IRSHIFT },
+ /* IRSHIFT */ { IREXIT1, IRSHIFT },
+ /* IREXIT1 */ { IRUPDATE, IRPAUSE },
+ /* IRPAUSE */ { IREXIT2, IRPAUSE },
+ /* IREXIT2 */ { IRUPDATE, IRSHIFT },
+ /* IRUPDATE */ { DRSELECT, IDLE }
+};
+
+/*
+ * This table contains the TMS value to be used to take the NEXT STEP on
+ * the path to the desired state. The array index is the current state,
+ * and the bit position is the desired endstate. To find out which state
+ * is used as the intermediate state, look up the TMS value in the
+ * altera_transitions[] table.
+ */
+static const u16 altera_jtag_path_map[16] = {
+ /* RST RTI SDRS CDR SDR E1DR PDR E2DR */
+ 0x0001, 0xFFFD, 0xFE01, 0xFFE7, 0xFFEF, 0xFF0F, 0xFFBF, 0xFFFF,
+ /* UDR SIRS CIR SIR E1IR PIR E2IR UIR */
+ 0xFEFD, 0x0001, 0xF3FF, 0xF7FF, 0x87FF, 0xDFFF, 0xFFFF, 0x7FFD
+};
+
+/* Flag bits for alt_jtag_io() function */
+#define TMS_HIGH 1
+#define TMS_LOW 0
+#define TDI_HIGH 1
+#define TDI_LOW 0
+#define READ_TDO 1
+#define IGNORE_TDO 0
+
+int altera_jinit(struct altera_state *astate)
+{
+ struct altera_jtag *js = &astate->js;
+
+ /* initial JTAG state is unknown */
+ js->jtag_state = ILLEGAL_JTAG_STATE;
+
+ /* initialize to default state */
+ js->drstop_state = IDLE;
+ js->irstop_state = IDLE;
+ js->dr_pre = 0;
+ js->dr_post = 0;
+ js->ir_pre = 0;
+ js->ir_post = 0;
+ js->dr_length = 0;
+ js->ir_length = 0;
+
+ js->dr_pre_data = NULL;
+ js->dr_post_data = NULL;
+ js->ir_pre_data = NULL;
+ js->ir_post_data = NULL;
+ js->dr_buffer = NULL;
+ js->ir_buffer = NULL;
+
+ return 0;
+}
+
+int altera_set_drstop(struct altera_jtag *js, enum altera_jtag_state state)
+{
+ js->drstop_state = state;
+
+ return 0;
+}
+
+int altera_set_irstop(struct altera_jtag *js, enum altera_jtag_state state)
+{
+ js->irstop_state = state;
+
+ return 0;
+}
+
+int altera_set_dr_pre(struct altera_jtag *js,
+ u32 count, u32 start_index,
+ u8 *preamble_data)
+{
+ int status = 0;
+ u32 i;
+ u32 j;
+
+ if (count > js->dr_pre) {
+ kfree(js->dr_pre_data);
+ js->dr_pre_data = (u8 *)alt_malloc((count + 7) >> 3);
+ if (js->dr_pre_data == NULL)
+ status = -ENOMEM;
+ else
+ js->dr_pre = count;
+ } else
+ js->dr_pre = count;
+
+ if (status == 0) {
+ for (i = 0; i < count; ++i) {
+ j = i + start_index;
+
+ if (preamble_data == NULL)
+ js->dr_pre_data[i >> 3] |= (1 << (i & 7));
+ else {
+ if (preamble_data[j >> 3] & (1 << (j & 7)))
+ js->dr_pre_data[i >> 3] |=
+ (1 << (i & 7));
+ else
+ js->dr_pre_data[i >> 3] &=
+ ~(u32)(1 << (i & 7));
+
+ }
+ }
+ }
+
+ return status;
+}
+
+int altera_set_ir_pre(struct altera_jtag *js, u32 count, u32 start_index,
+ u8 *preamble_data)
+{
+ int status = 0;
+ u32 i;
+ u32 j;
+
+ if (count > js->ir_pre) {
+ kfree(js->ir_pre_data);
+ js->ir_pre_data = (u8 *)alt_malloc((count + 7) >> 3);
+ if (js->ir_pre_data == NULL)
+ status = -ENOMEM;
+ else
+ js->ir_pre = count;
+
+ } else
+ js->ir_pre = count;
+
+ if (status == 0) {
+ for (i = 0; i < count; ++i) {
+ j = i + start_index;
+ if (preamble_data == NULL)
+ js->ir_pre_data[i >> 3] |= (1 << (i & 7));
+ else {
+ if (preamble_data[j >> 3] & (1 << (j & 7)))
+ js->ir_pre_data[i >> 3] |=
+ (1 << (i & 7));
+ else
+ js->ir_pre_data[i >> 3] &=
+ ~(u32)(1 << (i & 7));
+
+ }
+ }
+ }
+
+ return status;
+}
+
+int altera_set_dr_post(struct altera_jtag *js, u32 count, u32 start_index,
+ u8 *postamble_data)
+{
+ int status = 0;
+ u32 i;
+ u32 j;
+
+ if (count > js->dr_post) {
+ kfree(js->dr_post_data);
+ js->dr_post_data = (u8 *)alt_malloc((count + 7) >> 3);
+
+ if (js->dr_post_data == NULL)
+ status = -ENOMEM;
+ else
+ js->dr_post = count;
+
+ } else
+ js->dr_post = count;
+
+ if (status == 0) {
+ for (i = 0; i < count; ++i) {
+ j = i + start_index;
+
+ if (postamble_data == NULL)
+ js->dr_post_data[i >> 3] |= (1 << (i & 7));
+ else {
+ if (postamble_data[j >> 3] & (1 << (j & 7)))
+ js->dr_post_data[i >> 3] |=
+ (1 << (i & 7));
+ else
+ js->dr_post_data[i >> 3] &=
+ ~(u32)(1 << (i & 7));
+
+ }
+ }
+ }
+
+ return status;
+}
+
+int altera_set_ir_post(struct altera_jtag *js, u32 count, u32 start_index,
+ u8 *postamble_data)
+{
+ int status = 0;
+ u32 i;
+ u32 j;
+
+ if (count > js->ir_post) {
+ kfree(js->ir_post_data);
+ js->ir_post_data = (u8 *)alt_malloc((count + 7) >> 3);
+ if (js->ir_post_data == NULL)
+ status = -ENOMEM;
+ else
+ js->ir_post = count;
+
+ } else
+ js->ir_post = count;
+
+ if (status != 0)
+ return status;
+
+ for (i = 0; i < count; ++i) {
+ j = i + start_index;
+
+ if (postamble_data == NULL)
+ js->ir_post_data[i >> 3] |= (1 << (i & 7));
+ else {
+ if (postamble_data[j >> 3] & (1 << (j & 7)))
+ js->ir_post_data[i >> 3] |= (1 << (i & 7));
+ else
+ js->ir_post_data[i >> 3] &=
+ ~(u32)(1 << (i & 7));
+
+ }
+ }
+
+ return status;
+}
+
+static void altera_jreset_idle(struct altera_state *astate)
+{
+ struct altera_jtag *js = &astate->js;
+ int i;
+ /* Go to Test Logic Reset (no matter what the starting state may be) */
+ for (i = 0; i < 5; ++i)
+ alt_jtag_io(TMS_HIGH, TDI_LOW, IGNORE_TDO);
+
+ /* Now step to Run Test / Idle */
+ alt_jtag_io(TMS_LOW, TDI_LOW, IGNORE_TDO);
+ js->jtag_state = IDLE;
+}
+
+int altera_goto_jstate(struct altera_state *astate,
+ enum altera_jtag_state state)
+{
+ struct altera_jtag *js = &astate->js;
+ int tms;
+ int count = 0;
+ int status = 0;
+
+ if (js->jtag_state == ILLEGAL_JTAG_STATE)
+ /* initialize JTAG chain to known state */
+ altera_jreset_idle(astate);
+
+ if (js->jtag_state == state) {
+ /*
+ * We are already in the desired state.
+ * If it is a stable state, loop here.
+ * Otherwise do nothing (no clock cycles).
+ */
+ if ((state == IDLE) || (state == DRSHIFT) ||
+ (state == DRPAUSE) || (state == IRSHIFT) ||
+ (state == IRPAUSE)) {
+ alt_jtag_io(TMS_LOW, TDI_LOW, IGNORE_TDO);
+ } else if (state == RESET)
+ alt_jtag_io(TMS_HIGH, TDI_LOW, IGNORE_TDO);
+
+ } else {
+ while ((js->jtag_state != state) && (count < 9)) {
+ /* Get TMS value to take a step toward desired state */
+ tms = (altera_jtag_path_map[js->jtag_state] &
+ (1 << state))
+ ? TMS_HIGH : TMS_LOW;
+
+ /* Take a step */
+ alt_jtag_io(tms, TDI_LOW, IGNORE_TDO);
+
+ if (tms)
+ js->jtag_state =
+ altera_transitions[js->jtag_state].tms_high;
+ else
+ js->jtag_state =
+ altera_transitions[js->jtag_state].tms_low;
+
+ ++count;
+ }
+ }
+
+ if (js->jtag_state != state)
+ status = -EREMOTEIO;
+
+ return status;
+}
+
+int altera_wait_cycles(struct altera_state *astate,
+ s32 cycles,
+ enum altera_jtag_state wait_state)
+{
+ struct altera_jtag *js = &astate->js;
+ int tms;
+ s32 count;
+ int status = 0;
+
+ if (js->jtag_state != wait_state)
+ status = altera_goto_jstate(astate, wait_state);
+
+ if (status == 0) {
+ /*
+ * Set TMS high to loop in RESET state
+ * Set TMS low to loop in any other stable state
+ */
+ tms = (wait_state == RESET) ? TMS_HIGH : TMS_LOW;
+
+ for (count = 0L; count < cycles; count++)
+ alt_jtag_io(tms, TDI_LOW, IGNORE_TDO);
+
+ }
+
+ return status;
+}
+
+int altera_wait_msecs(struct altera_state *astate,
+ s32 microseconds, enum altera_jtag_state wait_state)
+/*
+ * Causes JTAG hardware to sit in the specified stable
+ * state for the specified duration of real time. If
+ * no JTAG operations have been performed yet, then only
+ * a delay is performed. This permits the WAIT USECS
+ * statement to be used in VECTOR programs without causing
+ * any JTAG operations.
+ * Returns 0 for success, else appropriate error code.
+ */
+{
+ struct altera_jtag *js = &astate->js;
+ int status = 0;
+
+ if ((js->jtag_state != ILLEGAL_JTAG_STATE) &&
+ (js->jtag_state != wait_state))
+ status = altera_goto_jstate(astate, wait_state);
+
+ if (status == 0)
+ /* Wait for specified time interval */
+ udelay(microseconds);
+
+ return status;
+}
+
+static void altera_concatenate_data(u8 *buffer,
+ u8 *preamble_data,
+ u32 preamble_count,
+ u8 *target_data,
+ u32 start_index,
+ u32 target_count,
+ u8 *postamble_data,
+ u32 postamble_count)
+/*
+ * Copies preamble data, target data, and postamble data
+ * into one buffer for IR or DR scans.
+ */
+{
+ u32 i, j, k;
+
+ for (i = 0L; i < preamble_count; ++i) {
+ if (preamble_data[i >> 3L] & (1L << (i & 7L)))
+ buffer[i >> 3L] |= (1L << (i & 7L));
+ else
+ buffer[i >> 3L] &= ~(u32)(1L << (i & 7L));
+
+ }
+
+ j = start_index;
+ k = preamble_count + target_count;
+ for (; i < k; ++i, ++j) {
+ if (target_data[j >> 3L] & (1L << (j & 7L)))
+ buffer[i >> 3L] |= (1L << (i & 7L));
+ else
+ buffer[i >> 3L] &= ~(u32)(1L << (i & 7L));
+
+ }
+
+ j = 0L;
+ k = preamble_count + target_count + postamble_count;
+ for (; i < k; ++i, ++j) {
+ if (postamble_data[j >> 3L] & (1L << (j & 7L)))
+ buffer[i >> 3L] |= (1L << (i & 7L));
+ else
+ buffer[i >> 3L] &= ~(u32)(1L << (i & 7L));
+
+ }
+}
+
+static int alt_jtag_drscan(struct altera_state *astate,
+ int start_state,
+ int count,
+ u8 *tdi,
+ u8 *tdo)
+{
+ int i = 0;
+ int tdo_bit = 0;
+ int status = 1;
+
+ /* First go to DRSHIFT state */
+ switch (start_state) {
+ case 0: /* IDLE */
+ alt_jtag_io(1, 0, 0); /* DRSELECT */
+ alt_jtag_io(0, 0, 0); /* DRCAPTURE */
+ alt_jtag_io(0, 0, 0); /* DRSHIFT */
+ break;
+
+ case 1: /* DRPAUSE */
+ alt_jtag_io(1, 0, 0); /* DREXIT2 */
+ alt_jtag_io(1, 0, 0); /* DRUPDATE */
+ alt_jtag_io(1, 0, 0); /* DRSELECT */
+ alt_jtag_io(0, 0, 0); /* DRCAPTURE */
+ alt_jtag_io(0, 0, 0); /* DRSHIFT */
+ break;
+
+ case 2: /* IRPAUSE */
+ alt_jtag_io(1, 0, 0); /* IREXIT2 */
+ alt_jtag_io(1, 0, 0); /* IRUPDATE */
+ alt_jtag_io(1, 0, 0); /* DRSELECT */
+ alt_jtag_io(0, 0, 0); /* DRCAPTURE */
+ alt_jtag_io(0, 0, 0); /* DRSHIFT */
+ break;
+
+ default:
+ status = 0;
+ }
+
+ if (status) {
+ /* loop in the SHIFT-DR state */
+ for (i = 0; i < count; i++) {
+ tdo_bit = alt_jtag_io(
+ (i == count - 1),
+ tdi[i >> 3] & (1 << (i & 7)),
+ (tdo != NULL));
+
+ if (tdo != NULL) {
+ if (tdo_bit)
+ tdo[i >> 3] |= (1 << (i & 7));
+ else
+ tdo[i >> 3] &= ~(u32)(1 << (i & 7));
+
+ }
+ }
+
+ alt_jtag_io(0, 0, 0); /* DRPAUSE */
+ }
+
+ return status;
+}
+
+static int alt_jtag_irscan(struct altera_state *astate,
+ int start_state,
+ int count,
+ u8 *tdi,
+ u8 *tdo)
+{
+ int i = 0;
+ int tdo_bit = 0;
+ int status = 1;
+
+ /* First go to IRSHIFT state */
+ switch (start_state) {
+ case 0: /* IDLE */
+ alt_jtag_io(1, 0, 0); /* DRSELECT */
+ alt_jtag_io(1, 0, 0); /* IRSELECT */
+ alt_jtag_io(0, 0, 0); /* IRCAPTURE */
+ alt_jtag_io(0, 0, 0); /* IRSHIFT */
+ break;
+
+ case 1: /* DRPAUSE */
+ alt_jtag_io(1, 0, 0); /* DREXIT2 */
+ alt_jtag_io(1, 0, 0); /* DRUPDATE */
+ alt_jtag_io(1, 0, 0); /* DRSELECT */
+ alt_jtag_io(1, 0, 0); /* IRSELECT */
+ alt_jtag_io(0, 0, 0); /* IRCAPTURE */
+ alt_jtag_io(0, 0, 0); /* IRSHIFT */
+ break;
+
+ case 2: /* IRPAUSE */
+ alt_jtag_io(1, 0, 0); /* IREXIT2 */
+ alt_jtag_io(1, 0, 0); /* IRUPDATE */
+ alt_jtag_io(1, 0, 0); /* DRSELECT */
+ alt_jtag_io(1, 0, 0); /* IRSELECT */
+ alt_jtag_io(0, 0, 0); /* IRCAPTURE */
+ alt_jtag_io(0, 0, 0); /* IRSHIFT */
+ break;
+
+ default:
+ status = 0;
+ }
+
+ if (status) {
+ /* loop in the SHIFT-IR state */
+ for (i = 0; i < count; i++) {
+ tdo_bit = alt_jtag_io(
+ (i == count - 1),
+ tdi[i >> 3] & (1 << (i & 7)),
+ (tdo != NULL));
+ if (tdo != NULL) {
+ if (tdo_bit)
+ tdo[i >> 3] |= (1 << (i & 7));
+ else
+ tdo[i >> 3] &= ~(u32)(1 << (i & 7));
+
+ }
+ }
+
+ alt_jtag_io(0, 0, 0); /* IRPAUSE */
+ }
+
+ return status;
+}
+
+static void altera_extract_target_data(u8 *buffer,
+ u8 *target_data,
+ u32 start_index,
+ u32 preamble_count,
+ u32 target_count)
+/*
+ * Copies target data from scan buffer, filtering out
+ * preamble and postamble data.
+ */
+{
+ u32 i;
+ u32 j;
+ u32 k;
+
+ j = preamble_count;
+ k = start_index + target_count;
+ for (i = start_index; i < k; ++i, ++j) {
+ if (buffer[j >> 3] & (1 << (j & 7)))
+ target_data[i >> 3] |= (1 << (i & 7));
+ else
+ target_data[i >> 3] &= ~(u32)(1 << (i & 7));
+
+ }
+}
+
+int altera_irscan(struct altera_state *astate,
+ u32 count,
+ u8 *tdi_data,
+ u32 start_index)
+/* Shifts data into instruction register */
+{
+ struct altera_jtag *js = &astate->js;
+ int start_code = 0;
+ u32 alloc_chars = 0;
+ u32 shift_count = js->ir_pre + count + js->ir_post;
+ int status = 0;
+ enum altera_jtag_state start_state = ILLEGAL_JTAG_STATE;
+
+ switch (js->jtag_state) {
+ case ILLEGAL_JTAG_STATE:
+ case RESET:
+ case IDLE:
+ start_code = 0;
+ start_state = IDLE;
+ break;
+
+ case DRSELECT:
+ case DRCAPTURE:
+ case DRSHIFT:
+ case DREXIT1:
+ case DRPAUSE:
+ case DREXIT2:
+ case DRUPDATE:
+ start_code = 1;
+ start_state = DRPAUSE;
+ break;
+
+ case IRSELECT:
+ case IRCAPTURE:
+ case IRSHIFT:
+ case IREXIT1:
+ case IRPAUSE:
+ case IREXIT2:
+ case IRUPDATE:
+ start_code = 2;
+ start_state = IRPAUSE;
+ break;
+
+ default:
+ status = -EREMOTEIO;
+ break;
+ }
+
+ if (status == 0)
+ if (js->jtag_state != start_state)
+ status = altera_goto_jstate(astate, start_state);
+
+ if (status == 0) {
+ if (shift_count > js->ir_length) {
+ alloc_chars = (shift_count + 7) >> 3;
+ kfree(js->ir_buffer);
+ js->ir_buffer = (u8 *)alt_malloc(alloc_chars);
+ if (js->ir_buffer == NULL)
+ status = -ENOMEM;
+ else
+ js->ir_length = alloc_chars * 8;
+
+ }
+ }
+
+ if (status == 0) {
+ /*
+ * Copy preamble data, IR data,
+ * and postamble data into a buffer
+ */
+ altera_concatenate_data(js->ir_buffer,
+ js->ir_pre_data,
+ js->ir_pre,
+ tdi_data,
+ start_index,
+ count,
+ js->ir_post_data,
+ js->ir_post);
+ /* Do the IRSCAN */
+ alt_jtag_irscan(astate,
+ start_code,
+ shift_count,
+ js->ir_buffer,
+ NULL);
+
+ /* alt_jtag_irscan() always ends in IRPAUSE state */
+ js->jtag_state = IRPAUSE;
+ }
+
+ if (status == 0)
+ if (js->irstop_state != IRPAUSE)
+ status = altera_goto_jstate(astate, js->irstop_state);
+
+
+ return status;
+}
+
+int altera_swap_ir(struct altera_state *astate,
+ u32 count,
+ u8 *in_data,
+ u32 in_index,
+ u8 *out_data,
+ u32 out_index)
+/* Shifts data into instruction register, capturing output data */
+{
+ struct altera_jtag *js = &astate->js;
+ int start_code = 0;
+ u32 alloc_chars = 0;
+ u32 shift_count = js->ir_pre + count + js->ir_post;
+ int status = 0;
+ enum altera_jtag_state start_state = ILLEGAL_JTAG_STATE;
+
+ switch (js->jtag_state) {
+ case ILLEGAL_JTAG_STATE:
+ case RESET:
+ case IDLE:
+ start_code = 0;
+ start_state = IDLE;
+ break;
+
+ case DRSELECT:
+ case DRCAPTURE:
+ case DRSHIFT:
+ case DREXIT1:
+ case DRPAUSE:
+ case DREXIT2:
+ case DRUPDATE:
+ start_code = 1;
+ start_state = DRPAUSE;
+ break;
+
+ case IRSELECT:
+ case IRCAPTURE:
+ case IRSHIFT:
+ case IREXIT1:
+ case IRPAUSE:
+ case IREXIT2:
+ case IRUPDATE:
+ start_code = 2;
+ start_state = IRPAUSE;
+ break;
+
+ default:
+ status = -EREMOTEIO;
+ break;
+ }
+
+ if (status == 0)
+ if (js->jtag_state != start_state)
+ status = altera_goto_jstate(astate, start_state);
+
+ if (status == 0) {
+ if (shift_count > js->ir_length) {
+ alloc_chars = (shift_count + 7) >> 3;
+ kfree(js->ir_buffer);
+ js->ir_buffer = (u8 *)alt_malloc(alloc_chars);
+ if (js->ir_buffer == NULL)
+ status = -ENOMEM;
+ else
+ js->ir_length = alloc_chars * 8;
+
+ }
+ }
+
+ if (status == 0) {
+ /*
+ * Copy preamble data, IR data,
+ * and postamble data into a buffer
+ */
+ altera_concatenate_data(js->ir_buffer,
+ js->ir_pre_data,
+ js->ir_pre,
+ in_data,
+ in_index,
+ count,
+ js->ir_post_data,
+ js->ir_post);
+
+ /* Do the IRSCAN */
+ alt_jtag_irscan(astate,
+ start_code,
+ shift_count,
+ js->ir_buffer,
+ js->ir_buffer);
+
+ /* alt_jtag_irscan() always ends in IRPAUSE state */
+ js->jtag_state = IRPAUSE;
+ }
+
+ if (status == 0)
+ if (js->irstop_state != IRPAUSE)
+ status = altera_goto_jstate(astate, js->irstop_state);
+
+
+ if (status == 0)
+ /* Now extract the returned data from the buffer */
+ altera_extract_target_data(js->ir_buffer,
+ out_data, out_index,
+ js->ir_pre, count);
+
+ return status;
+}
+
+int altera_drscan(struct altera_state *astate,
+ u32 count,
+ u8 *tdi_data,
+ u32 start_index)
+/* Shifts data into data register (ignoring output data) */
+{
+ struct altera_jtag *js = &astate->js;
+ int start_code = 0;
+ u32 alloc_chars = 0;
+ u32 shift_count = js->dr_pre + count + js->dr_post;
+ int status = 0;
+ enum altera_jtag_state start_state = ILLEGAL_JTAG_STATE;
+
+ switch (js->jtag_state) {
+ case ILLEGAL_JTAG_STATE:
+ case RESET:
+ case IDLE:
+ start_code = 0;
+ start_state = IDLE;
+ break;
+
+ case DRSELECT:
+ case DRCAPTURE:
+ case DRSHIFT:
+ case DREXIT1:
+ case DRPAUSE:
+ case DREXIT2:
+ case DRUPDATE:
+ start_code = 1;
+ start_state = DRPAUSE;
+ break;
+
+ case IRSELECT:
+ case IRCAPTURE:
+ case IRSHIFT:
+ case IREXIT1:
+ case IRPAUSE:
+ case IREXIT2:
+ case IRUPDATE:
+ start_code = 2;
+ start_state = IRPAUSE;
+ break;
+
+ default:
+ status = -EREMOTEIO;
+ break;
+ }
+
+ if (status == 0)
+ if (js->jtag_state != start_state)
+ status = altera_goto_jstate(astate, start_state);
+
+ if (status == 0) {
+ if (shift_count > js->dr_length) {
+ alloc_chars = (shift_count + 7) >> 3;
+ kfree(js->dr_buffer);
+ js->dr_buffer = (u8 *)alt_malloc(alloc_chars);
+ if (js->dr_buffer == NULL)
+ status = -ENOMEM;
+ else
+ js->dr_length = alloc_chars * 8;
+
+ }
+ }
+
+ if (status == 0) {
+ /*
+ * Copy preamble data, DR data,
+ * and postamble data into a buffer
+ */
+ altera_concatenate_data(js->dr_buffer,
+ js->dr_pre_data,
+ js->dr_pre,
+ tdi_data,
+ start_index,
+ count,
+ js->dr_post_data,
+ js->dr_post);
+ /* Do the DRSCAN */
+ alt_jtag_drscan(astate, start_code, shift_count,
+ js->dr_buffer, NULL);
+ /* alt_jtag_drscan() always ends in DRPAUSE state */
+ js->jtag_state = DRPAUSE;
+ }
+
+ if (status == 0)
+ if (js->drstop_state != DRPAUSE)
+ status = altera_goto_jstate(astate, js->drstop_state);
+
+ return status;
+}
+
+int altera_swap_dr(struct altera_state *astate, u32 count,
+ u8 *in_data, u32 in_index,
+ u8 *out_data, u32 out_index)
+/* Shifts data into data register, capturing output data */
+{
+ struct altera_jtag *js = &astate->js;
+ int start_code = 0;
+ u32 alloc_chars = 0;
+ u32 shift_count = js->dr_pre + count + js->dr_post;
+ int status = 0;
+ enum altera_jtag_state start_state = ILLEGAL_JTAG_STATE;
+
+ switch (js->jtag_state) {
+ case ILLEGAL_JTAG_STATE:
+ case RESET:
+ case IDLE:
+ start_code = 0;
+ start_state = IDLE;
+ break;
+
+ case DRSELECT:
+ case DRCAPTURE:
+ case DRSHIFT:
+ case DREXIT1:
+ case DRPAUSE:
+ case DREXIT2:
+ case DRUPDATE:
+ start_code = 1;
+ start_state = DRPAUSE;
+ break;
+
+ case IRSELECT:
+ case IRCAPTURE:
+ case IRSHIFT:
+ case IREXIT1:
+ case IRPAUSE:
+ case IREXIT2:
+ case IRUPDATE:
+ start_code = 2;
+ start_state = IRPAUSE;
+ break;
+
+ default:
+ status = -EREMOTEIO;
+ break;
+ }
+
+ if (status == 0)
+ if (js->jtag_state != start_state)
+ status = altera_goto_jstate(astate, start_state);
+
+ if (status == 0) {
+ if (shift_count > js->dr_length) {
+ alloc_chars = (shift_count + 7) >> 3;
+ kfree(js->dr_buffer);
+ js->dr_buffer = (u8 *)alt_malloc(alloc_chars);
+
+ if (js->dr_buffer == NULL)
+ status = -ENOMEM;
+ else
+ js->dr_length = alloc_chars * 8;
+
+ }
+ }
+
+ if (status == 0) {
+ /*
+ * Copy preamble data, DR data,
+ * and postamble data into a buffer
+ */
+ altera_concatenate_data(js->dr_buffer,
+ js->dr_pre_data,
+ js->dr_pre,
+ in_data,
+ in_index,
+ count,
+ js->dr_post_data,
+ js->dr_post);
+
+ /* Do the DRSCAN */
+ alt_jtag_drscan(astate,
+ start_code,
+ shift_count,
+ js->dr_buffer,
+ js->dr_buffer);
+
+ /* alt_jtag_drscan() always ends in DRPAUSE state */
+ js->jtag_state = DRPAUSE;
+ }
+
+ if (status == 0)
+ if (js->drstop_state != DRPAUSE)
+ status = altera_goto_jstate(astate, js->drstop_state);
+
+ if (status == 0)
+ /* Now extract the returned data from the buffer */
+ altera_extract_target_data(js->dr_buffer,
+ out_data,
+ out_index,
+ js->dr_pre,
+ count);
+
+ return status;
+}
+
+void altera_free_buffers(struct altera_state *astate)
+{
+ struct altera_jtag *js = &astate->js;
+ /* If the JTAG interface was used, reset it to TLR */
+ if (js->jtag_state != ILLEGAL_JTAG_STATE)
+ altera_jreset_idle(astate);
+
+ kfree(js->dr_pre_data);
+ js->dr_pre_data = NULL;
+
+ kfree(js->dr_post_data);
+ js->dr_post_data = NULL;
+
+ kfree(js->dr_buffer);
+ js->dr_buffer = NULL;
+
+ kfree(js->ir_pre_data);
+ js->ir_pre_data = NULL;
+
+ kfree(js->ir_post_data);
+ js->ir_post_data = NULL;
+
+ kfree(js->ir_buffer);
+ js->ir_buffer = NULL;
+}
diff --git a/drivers/staging/altera-stapl/altera-jtag.h b/drivers/staging/altera-stapl/altera-jtag.h
new file mode 100644
index 000000000000..2f97e36a2fbc
--- /dev/null
+++ b/drivers/staging/altera-stapl/altera-jtag.h
@@ -0,0 +1,113 @@
+/*
+ * altera-jtag.h
+ *
+ * altera FPGA driver
+ *
+ * Copyright (C) Altera Corporation 1998-2001
+ * Copyright (C) 2010 NetUP Inc.
+ * Copyright (C) 2010 Igor M. Liplianin <liplianin@netup.ru>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef ALTERA_JTAG_H
+#define ALTERA_JTAG_H
+
+/* Function Prototypes */
+enum altera_jtag_state {
+ ILLEGAL_JTAG_STATE = -1,
+ RESET = 0,
+ IDLE = 1,
+ DRSELECT = 2,
+ DRCAPTURE = 3,
+ DRSHIFT = 4,
+ DREXIT1 = 5,
+ DRPAUSE = 6,
+ DREXIT2 = 7,
+ DRUPDATE = 8,
+ IRSELECT = 9,
+ IRCAPTURE = 10,
+ IRSHIFT = 11,
+ IREXIT1 = 12,
+ IRPAUSE = 13,
+ IREXIT2 = 14,
+ IRUPDATE = 15
+
+};
+
+struct altera_jtag {
+ /* Global variable to store the current JTAG state */
+ enum altera_jtag_state jtag_state;
+
+ /* Store current stop-state for DR and IR scan commands */
+ enum altera_jtag_state drstop_state;
+ enum altera_jtag_state irstop_state;
+
+ /* Store current padding values */
+ u32 dr_pre;
+ u32 dr_post;
+ u32 ir_pre;
+ u32 ir_post;
+ u32 dr_length;
+ u32 ir_length;
+ u8 *dr_pre_data;
+ u8 *dr_post_data;
+ u8 *ir_pre_data;
+ u8 *ir_post_data;
+ u8 *dr_buffer;
+ u8 *ir_buffer;
+};
+
+#define ALTERA_STACK_SIZE 128
+#define ALTERA_MESSAGE_LENGTH 1024
+
+struct altera_state {
+ struct altera_config *config;
+ struct altera_jtag js;
+ char msg_buff[ALTERA_MESSAGE_LENGTH + 1];
+ long stack[ALTERA_STACK_SIZE];
+};
+
+int altera_jinit(struct altera_state *astate);
+int altera_set_drstop(struct altera_jtag *js, enum altera_jtag_state state);
+int altera_set_irstop(struct altera_jtag *js, enum altera_jtag_state state);
+int altera_set_dr_pre(struct altera_jtag *js, u32 count, u32 start_index,
+ u8 *preamble_data);
+int altera_set_ir_pre(struct altera_jtag *js, u32 count, u32 start_index,
+ u8 *preamble_data);
+int altera_set_dr_post(struct altera_jtag *js, u32 count, u32 start_index,
+ u8 *postamble_data);
+int altera_set_ir_post(struct altera_jtag *js, u32 count, u32 start_index,
+ u8 *postamble_data);
+int altera_goto_jstate(struct altera_state *astate,
+ enum altera_jtag_state state);
+int altera_wait_cycles(struct altera_state *astate, s32 cycles,
+ enum altera_jtag_state wait_state);
+int altera_wait_msecs(struct altera_state *astate, s32 microseconds,
+ enum altera_jtag_state wait_state);
+int altera_irscan(struct altera_state *astate, u32 count,
+ u8 *tdi_data, u32 start_index);
+int altera_swap_ir(struct altera_state *astate,
+ u32 count, u8 *in_data,
+ u32 in_index, u8 *out_data,
+ u32 out_index);
+int altera_drscan(struct altera_state *astate, u32 count,
+ u8 *tdi_data, u32 start_index);
+int altera_swap_dr(struct altera_state *astate, u32 count,
+ u8 *in_data, u32 in_index,
+ u8 *out_data, u32 out_index);
+void altera_free_buffers(struct altera_state *astate);
+#endif /* ALTERA_JTAG_H */
diff --git a/drivers/staging/altera-stapl/altera-lpt.c b/drivers/staging/altera-stapl/altera-lpt.c
new file mode 100644
index 000000000000..91456a03612d
--- /dev/null
+++ b/drivers/staging/altera-stapl/altera-lpt.c
@@ -0,0 +1,70 @@
+/*
+ * altera-lpt.c
+ *
+ * altera FPGA driver
+ *
+ * Copyright (C) Altera Corporation 1998-2001
+ * Copyright (C) 2010 NetUP Inc.
+ * Copyright (C) 2010 Abylay Ospan <aospan@netup.ru>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <linux/io.h>
+#include <linux/kernel.h>
+#include "altera-exprt.h"
+
+static int lpt_hardware_initialized;
+
+static void byteblaster_write(int port, int data)
+{
+ outb((u8)data, (u16)(port + 0x378));
+};
+
+static int byteblaster_read(int port)
+{
+ int data = 0;
+ data = inb((u16)(port + 0x378));
+ return data & 0xff;
+};
+
+int netup_jtag_io_lpt(void *device, int tms, int tdi, int read_tdo)
+{
+ int data = 0;
+ int tdo = 0;
+ int initial_lpt_ctrl = 0;
+
+ if (!lpt_hardware_initialized) {
+ initial_lpt_ctrl = byteblaster_read(2);
+ byteblaster_write(2, (initial_lpt_ctrl | 0x02) & 0xdf);
+ lpt_hardware_initialized = 1;
+ }
+
+ data = ((tdi ? 0x40 : 0) | (tms ? 0x02 : 0));
+
+ byteblaster_write(0, data);
+
+ if (read_tdo) {
+ tdo = byteblaster_read(1);
+ tdo = ((tdo & 0x80) ? 0 : 1);
+ }
+
+ byteblaster_write(0, data | 0x01);
+
+ byteblaster_write(0, data);
+
+ return tdo;
+}
diff --git a/drivers/staging/altera-stapl/altera.c b/drivers/staging/altera-stapl/altera.c
new file mode 100644
index 000000000000..05aad351b120
--- /dev/null
+++ b/drivers/staging/altera-stapl/altera.c
@@ -0,0 +1,2527 @@
+/*
+ * altera.c
+ *
+ * altera FPGA driver
+ *
+ * Copyright (C) Altera Corporation 1998-2001
+ * Copyright (C) 2010,2011 NetUP Inc.
+ * Copyright (C) 2010,2011 Igor M. Liplianin <liplianin@netup.ru>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <asm/unaligned.h>
+#include <linux/ctype.h>
+#include <linux/string.h>
+#include <linux/firmware.h>
+#include <linux/slab.h>
+#include <staging/altera.h>
+#include "altera-exprt.h"
+#include "altera-jtag.h"
+
+static int debug = 1;
+module_param(debug, int, 0644);
+MODULE_PARM_DESC(debug, "enable debugging information");
+
+MODULE_DESCRIPTION("altera FPGA kernel module");
+MODULE_AUTHOR("Igor M. Liplianin <liplianin@netup.ru>");
+MODULE_LICENSE("GPL");
+
+#define dprintk(args...) \
+ if (debug) { \
+ printk(KERN_DEBUG args); \
+ }
+
+enum altera_fpga_opcode {
+ OP_NOP = 0,
+ OP_DUP,
+ OP_SWP,
+ OP_ADD,
+ OP_SUB,
+ OP_MULT,
+ OP_DIV,
+ OP_MOD,
+ OP_SHL,
+ OP_SHR,
+ OP_NOT,
+ OP_AND,
+ OP_OR,
+ OP_XOR,
+ OP_INV,
+ OP_GT,
+ OP_LT,
+ OP_RET,
+ OP_CMPS,
+ OP_PINT,
+ OP_PRNT,
+ OP_DSS,
+ OP_DSSC,
+ OP_ISS,
+ OP_ISSC,
+ OP_DPR = 0x1c,
+ OP_DPRL,
+ OP_DPO,
+ OP_DPOL,
+ OP_IPR,
+ OP_IPRL,
+ OP_IPO,
+ OP_IPOL,
+ OP_PCHR,
+ OP_EXIT,
+ OP_EQU,
+ OP_POPT,
+ OP_ABS = 0x2c,
+ OP_BCH0,
+ OP_PSH0 = 0x2f,
+ OP_PSHL = 0x40,
+ OP_PSHV,
+ OP_JMP,
+ OP_CALL,
+ OP_NEXT,
+ OP_PSTR,
+ OP_SINT = 0x47,
+ OP_ST,
+ OP_ISTP,
+ OP_DSTP,
+ OP_SWPN,
+ OP_DUPN,
+ OP_POPV,
+ OP_POPE,
+ OP_POPA,
+ OP_JMPZ,
+ OP_DS,
+ OP_IS,
+ OP_DPRA,
+ OP_DPOA,
+ OP_IPRA,
+ OP_IPOA,
+ OP_EXPT,
+ OP_PSHE,
+ OP_PSHA,
+ OP_DYNA,
+ OP_EXPV = 0x5c,
+ OP_COPY = 0x80,
+ OP_REVA,
+ OP_DSC,
+ OP_ISC,
+ OP_WAIT,
+ OP_VS,
+ OP_CMPA = 0xc0,
+ OP_VSC,
+};
+
+struct altera_procinfo {
+ char *name;
+ u8 attrs;
+ struct altera_procinfo *next;
+};
+
+/* This function checks if enough parameters are available on the stack. */
+static int altera_check_stack(int stack_ptr, int count, int *status)
+{
+ if (stack_ptr < count) {
+ *status = -EOVERFLOW;
+ return 0;
+ }
+
+ return 1;
+}
+
+static void altera_export_int(char *key, s32 value)
+{
+ dprintk("Export: key = \"%s\", value = %d\n", key, value);
+}
+
+#define HEX_LINE_CHARS 72
+#define HEX_LINE_BITS (HEX_LINE_CHARS * 4)
+
+static void altera_export_bool_array(char *key, u8 *data, s32 count)
+{
+ char string[HEX_LINE_CHARS + 1];
+ s32 i, offset;
+ u32 size, line, lines, linebits, value, j, k;
+
+ if (count > HEX_LINE_BITS) {
+ dprintk("Export: key = \"%s\", %d bits, value = HEX\n",
+ key, count);
+ lines = (count + (HEX_LINE_BITS - 1)) / HEX_LINE_BITS;
+
+ for (line = 0; line < lines; ++line) {
+ if (line < (lines - 1)) {
+ linebits = HEX_LINE_BITS;
+ size = HEX_LINE_CHARS;
+ offset = count - ((line + 1) * HEX_LINE_BITS);
+ } else {
+ linebits =
+ count - ((lines - 1) * HEX_LINE_BITS);
+ size = (linebits + 3) / 4;
+ offset = 0L;
+ }
+
+ string[size] = '\0';
+ j = size - 1;
+ value = 0;
+
+ for (k = 0; k < linebits; ++k) {
+ i = k + offset;
+ if (data[i >> 3] & (1 << (i & 7)))
+ value |= (1 << (i & 3));
+ if ((i & 3) == 3) {
+ sprintf(&string[j], "%1x", value);
+ value = 0;
+ --j;
+ }
+ }
+ if ((k & 3) > 0)
+ sprintf(&string[j], "%1x", value);
+
+ dprintk("%s\n", string);
+ }
+
+ } else {
+ size = (count + 3) / 4;
+ string[size] = '\0';
+ j = size - 1;
+ value = 0;
+
+ for (i = 0; i < count; ++i) {
+ if (data[i >> 3] & (1 << (i & 7)))
+ value |= (1 << (i & 3));
+ if ((i & 3) == 3) {
+ sprintf(&string[j], "%1x", value);
+ value = 0;
+ --j;
+ }
+ }
+ if ((i & 3) > 0)
+ sprintf(&string[j], "%1x", value);
+
+ dprintk("Export: key = \"%s\", %d bits, value = HEX %s\n",
+ key, count, string);
+ }
+}
+
+static int altera_execute(struct altera_state *astate,
+ u8 *p,
+ s32 program_size,
+ s32 *error_address,
+ int *exit_code,
+ int *format_version)
+{
+ struct altera_config *aconf = astate->config;
+ char *msg_buff = astate->msg_buff;
+ long *stack = astate->stack;
+ int status = 0;
+ u32 first_word = 0L;
+ u32 action_table = 0L;
+ u32 proc_table = 0L;
+ u32 str_table = 0L;
+ u32 sym_table = 0L;
+ u32 data_sect = 0L;
+ u32 code_sect = 0L;
+ u32 debug_sect = 0L;
+ u32 action_count = 0L;
+ u32 proc_count = 0L;
+ u32 sym_count = 0L;
+ long *vars = NULL;
+ s32 *var_size = NULL;
+ char *attrs = NULL;
+ u8 *proc_attributes = NULL;
+ u32 pc;
+ u32 opcode_address;
+ u32 args[3];
+ u32 opcode;
+ u32 name_id;
+ u8 charbuf[4];
+ long long_tmp;
+ u32 variable_id;
+ u8 *charptr_tmp;
+ u8 *charptr_tmp2;
+ long *longptr_tmp;
+ int version = 0;
+ int delta = 0;
+ int stack_ptr = 0;
+ u32 arg_count;
+ int done = 0;
+ int bad_opcode = 0;
+ u32 count;
+ u32 index;
+ u32 index2;
+ s32 long_count;
+ s32 long_idx;
+ s32 long_idx2;
+ u32 i;
+ u32 j;
+ u32 uncomp_size;
+ u32 offset;
+ u32 value;
+ int current_proc = 0;
+ int reverse;
+
+ char *name;
+
+ dprintk("%s\n", __func__);
+
+ /* Read header information */
+ if (program_size > 52L) {
+ first_word = get_unaligned_be32(&p[0]);
+ version = (first_word & 1L);
+ *format_version = version + 1;
+ delta = version * 8;
+
+ action_table = get_unaligned_be32(&p[4]);
+ proc_table = get_unaligned_be32(&p[8]);
+ str_table = get_unaligned_be32(&p[4 + delta]);
+ sym_table = get_unaligned_be32(&p[16 + delta]);
+ data_sect = get_unaligned_be32(&p[20 + delta]);
+ code_sect = get_unaligned_be32(&p[24 + delta]);
+ debug_sect = get_unaligned_be32(&p[28 + delta]);
+ action_count = get_unaligned_be32(&p[40 + delta]);
+ proc_count = get_unaligned_be32(&p[44 + delta]);
+ sym_count = get_unaligned_be32(&p[48 + (2 * delta)]);
+ }
+
+ if ((first_word != 0x4A414D00L) && (first_word != 0x4A414D01L)) {
+ done = 1;
+ status = -EIO;
+ goto exit_done;
+ }
+
+ if (sym_count <= 0)
+ goto exit_done;
+
+ vars = kzalloc(sym_count * sizeof(long), GFP_KERNEL);
+
+ if (vars == NULL)
+ status = -ENOMEM;
+
+ if (status == 0) {
+ var_size = kzalloc(sym_count * sizeof(s32), GFP_KERNEL);
+
+ if (var_size == NULL)
+ status = -ENOMEM;
+ }
+
+ if (status == 0) {
+ attrs = kzalloc(sym_count, GFP_KERNEL);
+
+ if (attrs == NULL)
+ status = -ENOMEM;
+ }
+
+ if ((status == 0) && (version > 0)) {
+ proc_attributes = kzalloc(proc_count, GFP_KERNEL);
+
+ if (proc_attributes == NULL)
+ status = -ENOMEM;
+ }
+
+ if (status != 0)
+ goto exit_done;
+
+ delta = version * 2;
+
+ for (i = 0; i < sym_count; ++i) {
+ offset = (sym_table + ((11 + delta) * i));
+
+ value = get_unaligned_be32(&p[offset + 3 + delta]);
+
+ attrs[i] = p[offset];
+
+ /*
+ * use bit 7 of attribute byte to indicate that
+ * this buffer was dynamically allocated
+ * and should be freed later
+ */
+ attrs[i] &= 0x7f;
+
+ var_size[i] = get_unaligned_be32(&p[offset + 7 + delta]);
+
+ /*
+ * Attribute bits:
+ * bit 0: 0 = read-only, 1 = read-write
+ * bit 1: 0 = not compressed, 1 = compressed
+ * bit 2: 0 = not initialized, 1 = initialized
+ * bit 3: 0 = scalar, 1 = array
+ * bit 4: 0 = Boolean, 1 = integer
+ * bit 5: 0 = declared variable,
+ * 1 = compiler created temporary variable
+ */
+
+ if ((attrs[i] & 0x0c) == 0x04)
+ /* initialized scalar variable */
+ vars[i] = value;
+ else if ((attrs[i] & 0x1e) == 0x0e) {
+ /* initialized compressed Boolean array */
+ uncomp_size = get_unaligned_le32(&p[data_sect + value]);
+
+ /* allocate a buffer for the uncompressed data */
+ vars[i] = (long)kzalloc(uncomp_size, GFP_KERNEL);
+ if (vars[i] == 0L)
+ status = -ENOMEM;
+ else {
+ /* set flag so buffer will be freed later */
+ attrs[i] |= 0x80;
+
+ /* uncompress the data */
+ if (altera_shrink(&p[data_sect + value],
+ var_size[i],
+ (u8 *)vars[i],
+ uncomp_size,
+ version) != uncomp_size)
+ /* decompression failed */
+ status = -EIO;
+ else
+ var_size[i] = uncomp_size * 8L;
+
+ }
+ } else if ((attrs[i] & 0x1e) == 0x0c) {
+ /* initialized Boolean array */
+ vars[i] = value + data_sect + (long)p;
+ } else if ((attrs[i] & 0x1c) == 0x1c) {
+ /* initialized integer array */
+ vars[i] = value + data_sect;
+ } else if ((attrs[i] & 0x0c) == 0x08) {
+ /* uninitialized array */
+
+ /* flag attrs so that memory is freed */
+ attrs[i] |= 0x80;
+
+ if (var_size[i] > 0) {
+ u32 size;
+
+ if (attrs[i] & 0x10)
+ /* integer array */
+ size = (var_size[i] * sizeof(s32));
+ else
+ /* Boolean array */
+ size = ((var_size[i] + 7L) / 8L);
+
+ vars[i] = (long)kzalloc(size, GFP_KERNEL);
+
+ if (vars[i] == 0) {
+ status = -ENOMEM;
+ } else {
+ /* zero out memory */
+ for (j = 0; j < size; ++j)
+ ((u8 *)(vars[i]))[j] = 0;
+
+ }
+ } else
+ vars[i] = 0;
+
+ } else
+ vars[i] = 0;
+
+ }
+
+exit_done:
+ if (status != 0)
+ done = 1;
+
+ altera_jinit(astate);
+
+ pc = code_sect;
+ msg_buff[0] = '\0';
+
+ /*
+ * For JBC version 2, we will execute the procedures corresponding to
+ * the selected ACTION
+ */
+ if (version > 0) {
+ if (aconf->action == NULL) {
+ status = -EINVAL;
+ done = 1;
+ } else {
+ int action_found = 0;
+ for (i = 0; (i < action_count) && !action_found; ++i) {
+ name_id = get_unaligned_be32(&p[action_table +
+ (12 * i)]);
+
+ name = &p[str_table + name_id];
+
+ if (strnicmp(aconf->action, name, strlen(name)) == 0) {
+ action_found = 1;
+ current_proc =
+ get_unaligned_be32(&p[action_table +
+ (12 * i) + 8]);
+ }
+ }
+
+ if (!action_found) {
+ status = -EINVAL;
+ done = 1;
+ }
+ }
+
+ if (status == 0) {
+ int first_time = 1;
+ i = current_proc;
+ while ((i != 0) || first_time) {
+ first_time = 0;
+ /* check procedure attribute byte */
+ proc_attributes[i] =
+ (p[proc_table +
+ (13 * i) + 8] &
+ 0x03);
+
+ /*
+ * BIT0 - OPTIONAL
+ * BIT1 - RECOMMENDED
+ * BIT6 - FORCED OFF
+ * BIT7 - FORCED ON
+ */
+
+ i = get_unaligned_be32(&p[proc_table +
+ (13 * i) + 4]);
+ }
+
+ /*
+ * Set current_proc to the first procedure
+ * to be executed
+ */
+ i = current_proc;
+ while ((i != 0) &&
+ ((proc_attributes[i] == 1) ||
+ ((proc_attributes[i] & 0xc0) == 0x40))) {
+ i = get_unaligned_be32(&p[proc_table +
+ (13 * i) + 4]);
+ }
+
+ if ((i != 0) || ((i == 0) && (current_proc == 0) &&
+ ((proc_attributes[0] != 1) &&
+ ((proc_attributes[0] & 0xc0) != 0x40)))) {
+ current_proc = i;
+ pc = code_sect +
+ get_unaligned_be32(&p[proc_table +
+ (13 * i) + 9]);
+ if ((pc < code_sect) || (pc >= debug_sect))
+ status = -ERANGE;
+ } else
+ /* there are no procedures to execute! */
+ done = 1;
+
+ }
+ }
+
+ msg_buff[0] = '\0';
+
+ while (!done) {
+ opcode = (p[pc] & 0xff);
+ opcode_address = pc;
+ ++pc;
+
+ if (debug > 1)
+ printk("opcode: %02x\n", opcode);
+
+ arg_count = (opcode >> 6) & 3;
+ for (i = 0; i < arg_count; ++i) {
+ args[i] = get_unaligned_be32(&p[pc]);
+ pc += 4;
+ }
+
+ switch (opcode) {
+ case OP_NOP:
+ break;
+ case OP_DUP:
+ if (altera_check_stack(stack_ptr, 1, &status)) {
+ stack[stack_ptr] = stack[stack_ptr - 1];
+ ++stack_ptr;
+ }
+ break;
+ case OP_SWP:
+ if (altera_check_stack(stack_ptr, 2, &status)) {
+ long_tmp = stack[stack_ptr - 2];
+ stack[stack_ptr - 2] = stack[stack_ptr - 1];
+ stack[stack_ptr - 1] = long_tmp;
+ }
+ break;
+ case OP_ADD:
+ if (altera_check_stack(stack_ptr, 2, &status)) {
+ --stack_ptr;
+ stack[stack_ptr - 1] += stack[stack_ptr];
+ }
+ break;
+ case OP_SUB:
+ if (altera_check_stack(stack_ptr, 2, &status)) {
+ --stack_ptr;
+ stack[stack_ptr - 1] -= stack[stack_ptr];
+ }
+ break;
+ case OP_MULT:
+ if (altera_check_stack(stack_ptr, 2, &status)) {
+ --stack_ptr;
+ stack[stack_ptr - 1] *= stack[stack_ptr];
+ }
+ break;
+ case OP_DIV:
+ if (altera_check_stack(stack_ptr, 2, &status)) {
+ --stack_ptr;
+ stack[stack_ptr - 1] /= stack[stack_ptr];
+ }
+ break;
+ case OP_MOD:
+ if (altera_check_stack(stack_ptr, 2, &status)) {
+ --stack_ptr;
+ stack[stack_ptr - 1] %= stack[stack_ptr];
+ }
+ break;
+ case OP_SHL:
+ if (altera_check_stack(stack_ptr, 2, &status)) {
+ --stack_ptr;
+ stack[stack_ptr - 1] <<= stack[stack_ptr];
+ }
+ break;
+ case OP_SHR:
+ if (altera_check_stack(stack_ptr, 2, &status)) {
+ --stack_ptr;
+ stack[stack_ptr - 1] >>= stack[stack_ptr];
+ }
+ break;
+ case OP_NOT:
+ if (altera_check_stack(stack_ptr, 1, &status))
+ stack[stack_ptr - 1] ^= (-1L);
+
+ break;
+ case OP_AND:
+ if (altera_check_stack(stack_ptr, 2, &status)) {
+ --stack_ptr;
+ stack[stack_ptr - 1] &= stack[stack_ptr];
+ }
+ break;
+ case OP_OR:
+ if (altera_check_stack(stack_ptr, 2, &status)) {
+ --stack_ptr;
+ stack[stack_ptr - 1] |= stack[stack_ptr];
+ }
+ break;
+ case OP_XOR:
+ if (altera_check_stack(stack_ptr, 2, &status)) {
+ --stack_ptr;
+ stack[stack_ptr - 1] ^= stack[stack_ptr];
+ }
+ break;
+ case OP_INV:
+ if (!altera_check_stack(stack_ptr, 1, &status))
+ break;
+ stack[stack_ptr - 1] = stack[stack_ptr - 1] ? 0L : 1L;
+ break;
+ case OP_GT:
+ if (!altera_check_stack(stack_ptr, 2, &status))
+ break;
+ --stack_ptr;
+ stack[stack_ptr - 1] =
+ (stack[stack_ptr - 1] > stack[stack_ptr]) ?
+ 1L : 0L;
+
+ break;
+ case OP_LT:
+ if (!altera_check_stack(stack_ptr, 2, &status))
+ break;
+ --stack_ptr;
+ stack[stack_ptr - 1] =
+ (stack[stack_ptr - 1] < stack[stack_ptr]) ?
+ 1L : 0L;
+
+ break;
+ case OP_RET:
+ if ((version > 0) && (stack_ptr == 0)) {
+ /*
+ * We completed one of the main procedures
+ * of an ACTION.
+ * Find the next procedure
+ * to be executed and jump to it.
+ * If there are no more procedures, then EXIT.
+ */
+ i = get_unaligned_be32(&p[proc_table +
+ (13 * current_proc) + 4]);
+ while ((i != 0) &&
+ ((proc_attributes[i] == 1) ||
+ ((proc_attributes[i] & 0xc0) == 0x40)))
+ i = get_unaligned_be32(&p[proc_table +
+ (13 * i) + 4]);
+
+ if (i == 0) {
+ /* no procedures to execute! */
+ done = 1;
+ *exit_code = 0; /* success */
+ } else {
+ current_proc = i;
+ pc = code_sect + get_unaligned_be32(
+ &p[proc_table +
+ (13 * i) + 9]);
+ if ((pc < code_sect) ||
+ (pc >= debug_sect))
+ status = -ERANGE;
+ }
+
+ } else
+ if (altera_check_stack(stack_ptr, 1, &status)) {
+ pc = stack[--stack_ptr] + code_sect;
+ if ((pc <= code_sect) ||
+ (pc >= debug_sect))
+ status = -ERANGE;
+
+ }
+
+ break;
+ case OP_CMPS:
+ /*
+ * Array short compare
+ * ...stack 0 is source 1 value
+ * ...stack 1 is source 2 value
+ * ...stack 2 is mask value
+ * ...stack 3 is count
+ */
+ if (altera_check_stack(stack_ptr, 4, &status)) {
+ s32 a = stack[--stack_ptr];
+ s32 b = stack[--stack_ptr];
+ long_tmp = stack[--stack_ptr];
+ count = stack[stack_ptr - 1];
+
+ if ((count < 1) || (count > 32))
+ status = -ERANGE;
+ else {
+ long_tmp &= ((-1L) >> (32 - count));
+
+ stack[stack_ptr - 1] =
+ ((a & long_tmp) == (b & long_tmp))
+ ? 1L : 0L;
+ }
+ }
+ break;
+ case OP_PINT:
+ /*
+ * PRINT add integer
+ * ...stack 0 is integer value
+ */
+ if (!altera_check_stack(stack_ptr, 1, &status))
+ break;
+ sprintf(&msg_buff[strlen(msg_buff)],
+ "%ld", stack[--stack_ptr]);
+ break;
+ case OP_PRNT:
+ /* PRINT finish */
+ if (debug)
+ printk(msg_buff, "\n");
+
+ msg_buff[0] = '\0';
+ break;
+ case OP_DSS:
+ /*
+ * DRSCAN short
+ * ...stack 0 is scan data
+ * ...stack 1 is count
+ */
+ if (!altera_check_stack(stack_ptr, 2, &status))
+ break;
+ long_tmp = stack[--stack_ptr];
+ count = stack[--stack_ptr];
+ put_unaligned_le32(long_tmp, &charbuf[0]);
+ status = altera_drscan(astate, count, charbuf, 0);
+ break;
+ case OP_DSSC:
+ /*
+ * DRSCAN short with capture
+ * ...stack 0 is scan data
+ * ...stack 1 is count
+ */
+ if (!altera_check_stack(stack_ptr, 2, &status))
+ break;
+ long_tmp = stack[--stack_ptr];
+ count = stack[stack_ptr - 1];
+ put_unaligned_le32(long_tmp, &charbuf[0]);
+ status = altera_swap_dr(astate, count, charbuf,
+ 0, charbuf, 0);
+ stack[stack_ptr - 1] = get_unaligned_le32(&charbuf[0]);
+ break;
+ case OP_ISS:
+ /*
+ * IRSCAN short
+ * ...stack 0 is scan data
+ * ...stack 1 is count
+ */
+ if (!altera_check_stack(stack_ptr, 2, &status))
+ break;
+ long_tmp = stack[--stack_ptr];
+ count = stack[--stack_ptr];
+ put_unaligned_le32(long_tmp, &charbuf[0]);
+ status = altera_irscan(astate, count, charbuf, 0);
+ break;
+ case OP_ISSC:
+ /*
+ * IRSCAN short with capture
+ * ...stack 0 is scan data
+ * ...stack 1 is count
+ */
+ if (!altera_check_stack(stack_ptr, 2, &status))
+ break;
+ long_tmp = stack[--stack_ptr];
+ count = stack[stack_ptr - 1];
+ put_unaligned_le32(long_tmp, &charbuf[0]);
+ status = altera_swap_ir(astate, count, charbuf,
+ 0, charbuf, 0);
+ stack[stack_ptr - 1] = get_unaligned_le32(&charbuf[0]);
+ break;
+ case OP_DPR:
+ if (!altera_check_stack(stack_ptr, 1, &status))
+ break;
+ count = stack[--stack_ptr];
+ status = altera_set_dr_pre(&astate->js, count, 0, NULL);
+ break;
+ case OP_DPRL:
+ /*
+ * DRPRE with literal data
+ * ...stack 0 is count
+ * ...stack 1 is literal data
+ */
+ if (!altera_check_stack(stack_ptr, 2, &status))
+ break;
+ count = stack[--stack_ptr];
+ long_tmp = stack[--stack_ptr];
+ put_unaligned_le32(long_tmp, &charbuf[0]);
+ status = altera_set_dr_pre(&astate->js, count, 0,
+ charbuf);
+ break;
+ case OP_DPO:
+ /*
+ * DRPOST
+ * ...stack 0 is count
+ */
+ if (altera_check_stack(stack_ptr, 1, &status)) {
+ count = stack[--stack_ptr];
+ status = altera_set_dr_post(&astate->js, count,
+ 0, NULL);
+ }
+ break;
+ case OP_DPOL:
+ /*
+ * DRPOST with literal data
+ * ...stack 0 is count
+ * ...stack 1 is literal data
+ */
+ if (!altera_check_stack(stack_ptr, 2, &status))
+ break;
+ count = stack[--stack_ptr];
+ long_tmp = stack[--stack_ptr];
+ put_unaligned_le32(long_tmp, &charbuf[0]);
+ status = altera_set_dr_post(&astate->js, count, 0,
+ charbuf);
+ break;
+ case OP_IPR:
+ if (altera_check_stack(stack_ptr, 1, &status)) {
+ count = stack[--stack_ptr];
+ status = altera_set_ir_pre(&astate->js, count,
+ 0, NULL);
+ }
+ break;
+ case OP_IPRL:
+ /*
+ * IRPRE with literal data
+ * ...stack 0 is count
+ * ...stack 1 is literal data
+ */
+ if (altera_check_stack(stack_ptr, 2, &status)) {
+ count = stack[--stack_ptr];
+ long_tmp = stack[--stack_ptr];
+ put_unaligned_le32(long_tmp, &charbuf[0]);
+ status = altera_set_ir_pre(&astate->js, count,
+ 0, charbuf);
+ }
+ break;
+ case OP_IPO:
+ /*
+ * IRPOST
+ * ...stack 0 is count
+ */
+ if (altera_check_stack(stack_ptr, 1, &status)) {
+ count = stack[--stack_ptr];
+ status = altera_set_ir_post(&astate->js, count,
+ 0, NULL);
+ }
+ break;
+ case OP_IPOL:
+ /*
+ * IRPOST with literal data
+ * ...stack 0 is count
+ * ...stack 1 is literal data
+ */
+ if (!altera_check_stack(stack_ptr, 2, &status))
+ break;
+ count = stack[--stack_ptr];
+ long_tmp = stack[--stack_ptr];
+ put_unaligned_le32(long_tmp, &charbuf[0]);
+ status = altera_set_ir_post(&astate->js, count, 0,
+ charbuf);
+ break;
+ case OP_PCHR:
+ if (altera_check_stack(stack_ptr, 1, &status)) {
+ u8 ch;
+ count = strlen(msg_buff);
+ ch = (char) stack[--stack_ptr];
+ if ((ch < 1) || (ch > 127)) {
+ /*
+ * character code out of range
+ * instead of flagging an error,
+ * force the value to 127
+ */
+ ch = 127;
+ }
+ msg_buff[count] = ch;
+ msg_buff[count + 1] = '\0';
+ }
+ break;
+ case OP_EXIT:
+ if (altera_check_stack(stack_ptr, 1, &status))
+ *exit_code = stack[--stack_ptr];
+
+ done = 1;
+ break;
+ case OP_EQU:
+ if (!altera_check_stack(stack_ptr, 2, &status))
+ break;
+ --stack_ptr;
+ stack[stack_ptr - 1] =
+ (stack[stack_ptr - 1] == stack[stack_ptr]) ?
+ 1L : 0L;
+ break;
+ case OP_POPT:
+ if (altera_check_stack(stack_ptr, 1, &status))
+ --stack_ptr;
+
+ break;
+ case OP_ABS:
+ if (!altera_check_stack(stack_ptr, 1, &status))
+ break;
+ if (stack[stack_ptr - 1] < 0)
+ stack[stack_ptr - 1] = 0 - stack[stack_ptr - 1];
+
+ break;
+ case OP_BCH0:
+ /*
+ * Batch operation 0
+ * SWP
+ * SWPN 7
+ * SWP
+ * SWPN 6
+ * DUPN 8
+ * SWPN 2
+ * SWP
+ * DUPN 6
+ * DUPN 6
+ */
+
+ /* SWP */
+ if (altera_check_stack(stack_ptr, 2, &status)) {
+ long_tmp = stack[stack_ptr - 2];
+ stack[stack_ptr - 2] = stack[stack_ptr - 1];
+ stack[stack_ptr - 1] = long_tmp;
+ }
+
+ /* SWPN 7 */
+ index = 7 + 1;
+ if (altera_check_stack(stack_ptr, index, &status)) {
+ long_tmp = stack[stack_ptr - index];
+ stack[stack_ptr - index] = stack[stack_ptr - 1];
+ stack[stack_ptr - 1] = long_tmp;
+ }
+
+ /* SWP */
+ if (altera_check_stack(stack_ptr, 2, &status)) {
+ long_tmp = stack[stack_ptr - 2];
+ stack[stack_ptr - 2] = stack[stack_ptr - 1];
+ stack[stack_ptr - 1] = long_tmp;
+ }
+
+ /* SWPN 6 */
+ index = 6 + 1;
+ if (altera_check_stack(stack_ptr, index, &status)) {
+ long_tmp = stack[stack_ptr - index];
+ stack[stack_ptr - index] = stack[stack_ptr - 1];
+ stack[stack_ptr - 1] = long_tmp;
+ }
+
+ /* DUPN 8 */
+ index = 8 + 1;
+ if (altera_check_stack(stack_ptr, index, &status)) {
+ stack[stack_ptr] = stack[stack_ptr - index];
+ ++stack_ptr;
+ }
+
+ /* SWPN 2 */
+ index = 2 + 1;
+ if (altera_check_stack(stack_ptr, index, &status)) {
+ long_tmp = stack[stack_ptr - index];
+ stack[stack_ptr - index] = stack[stack_ptr - 1];
+ stack[stack_ptr - 1] = long_tmp;
+ }
+
+ /* SWP */
+ if (altera_check_stack(stack_ptr, 2, &status)) {
+ long_tmp = stack[stack_ptr - 2];
+ stack[stack_ptr - 2] = stack[stack_ptr - 1];
+ stack[stack_ptr - 1] = long_tmp;
+ }
+
+ /* DUPN 6 */
+ index = 6 + 1;
+ if (altera_check_stack(stack_ptr, index, &status)) {
+ stack[stack_ptr] = stack[stack_ptr - index];
+ ++stack_ptr;
+ }
+
+ /* DUPN 6 */
+ index = 6 + 1;
+ if (altera_check_stack(stack_ptr, index, &status)) {
+ stack[stack_ptr] = stack[stack_ptr - index];
+ ++stack_ptr;
+ }
+ break;
+ case OP_PSH0:
+ stack[stack_ptr++] = 0;
+ break;
+ case OP_PSHL:
+ stack[stack_ptr++] = (s32) args[0];
+ break;
+ case OP_PSHV:
+ stack[stack_ptr++] = vars[args[0]];
+ break;
+ case OP_JMP:
+ pc = args[0] + code_sect;
+ if ((pc < code_sect) || (pc >= debug_sect))
+ status = -ERANGE;
+ break;
+ case OP_CALL:
+ stack[stack_ptr++] = pc;
+ pc = args[0] + code_sect;
+ if ((pc < code_sect) || (pc >= debug_sect))
+ status = -ERANGE;
+ break;
+ case OP_NEXT:
+ /*
+ * Process FOR / NEXT loop
+ * ...argument 0 is variable ID
+ * ...stack 0 is step value
+ * ...stack 1 is end value
+ * ...stack 2 is top address
+ */
+ if (altera_check_stack(stack_ptr, 3, &status)) {
+ s32 step = stack[stack_ptr - 1];
+ s32 end = stack[stack_ptr - 2];
+ s32 top = stack[stack_ptr - 3];
+ s32 iterator = vars[args[0]];
+ int break_out = 0;
+
+ if (step < 0) {
+ if (iterator <= end)
+ break_out = 1;
+ } else if (iterator >= end)
+ break_out = 1;
+
+ if (break_out) {
+ stack_ptr -= 3;
+ } else {
+ vars[args[0]] = iterator + step;
+ pc = top + code_sect;
+ if ((pc < code_sect) ||
+ (pc >= debug_sect))
+ status = -ERANGE;
+ }
+ }
+ break;
+ case OP_PSTR:
+ /*
+ * PRINT add string
+ * ...argument 0 is string ID
+ */
+ count = strlen(msg_buff);
+ strlcpy(&msg_buff[count],
+ &p[str_table + args[0]],
+ ALTERA_MESSAGE_LENGTH - count);
+ break;
+ case OP_SINT:
+ /*
+ * STATE intermediate state
+ * ...argument 0 is state code
+ */
+ status = altera_goto_jstate(astate, args[0]);
+ break;
+ case OP_ST:
+ /*
+ * STATE final state
+ * ...argument 0 is state code
+ */
+ status = altera_goto_jstate(astate, args[0]);
+ break;
+ case OP_ISTP:
+ /*
+ * IRSTOP state
+ * ...argument 0 is state code
+ */
+ status = altera_set_irstop(&astate->js, args[0]);
+ break;
+ case OP_DSTP:
+ /*
+ * DRSTOP state
+ * ...argument 0 is state code
+ */
+ status = altera_set_drstop(&astate->js, args[0]);
+ break;
+
+ case OP_SWPN:
+ /*
+ * Exchange top with Nth stack value
+ * ...argument 0 is 0-based stack entry
+ * to swap with top element
+ */
+ index = (args[0]) + 1;
+ if (altera_check_stack(stack_ptr, index, &status)) {
+ long_tmp = stack[stack_ptr - index];
+ stack[stack_ptr - index] = stack[stack_ptr - 1];
+ stack[stack_ptr - 1] = long_tmp;
+ }
+ break;
+ case OP_DUPN:
+ /*
+ * Duplicate Nth stack value
+ * ...argument 0 is 0-based stack entry to duplicate
+ */
+ index = (args[0]) + 1;
+ if (altera_check_stack(stack_ptr, index, &status)) {
+ stack[stack_ptr] = stack[stack_ptr - index];
+ ++stack_ptr;
+ }
+ break;
+ case OP_POPV:
+ /*
+ * Pop stack into scalar variable
+ * ...argument 0 is variable ID
+ * ...stack 0 is value
+ */
+ if (altera_check_stack(stack_ptr, 1, &status))
+ vars[args[0]] = stack[--stack_ptr];
+
+ break;
+ case OP_POPE:
+ /*
+ * Pop stack into integer array element
+ * ...argument 0 is variable ID
+ * ...stack 0 is array index
+ * ...stack 1 is value
+ */
+ if (!altera_check_stack(stack_ptr, 2, &status))
+ break;
+ variable_id = args[0];
+
+ /*
+ * If variable is read-only,
+ * convert to writable array
+ */
+ if ((version > 0) &&
+ ((attrs[variable_id] & 0x9c) == 0x1c)) {
+ /* Allocate a writable buffer for this array */
+ count = var_size[variable_id];
+ long_tmp = vars[variable_id];
+ longptr_tmp = kzalloc(count * sizeof(long),
+ GFP_KERNEL);
+ vars[variable_id] = (long)longptr_tmp;
+
+ if (vars[variable_id] == 0) {
+ status = -ENOMEM;
+ break;
+ }
+
+ /* copy previous contents into buffer */
+ for (i = 0; i < count; ++i) {
+ longptr_tmp[i] =
+ get_unaligned_be32(&p[long_tmp]);
+ long_tmp += sizeof(long);
+ }
+
+ /*
+ * set bit 7 - buffer was
+ * dynamically allocated
+ */
+ attrs[variable_id] |= 0x80;
+
+ /* clear bit 2 - variable is writable */
+ attrs[variable_id] &= ~0x04;
+ attrs[variable_id] |= 0x01;
+
+ }
+
+ /* check that variable is a writable integer array */
+ if ((attrs[variable_id] & 0x1c) != 0x18)
+ status = -ERANGE;
+ else {
+ longptr_tmp = (long *)vars[variable_id];
+
+ /* pop the array index */
+ index = stack[--stack_ptr];
+
+ /* pop the value and store it into the array */
+ longptr_tmp[index] = stack[--stack_ptr];
+ }
+
+ break;
+ case OP_POPA:
+ /*
+ * Pop stack into Boolean array
+ * ...argument 0 is variable ID
+ * ...stack 0 is count
+ * ...stack 1 is array index
+ * ...stack 2 is value
+ */
+ if (!altera_check_stack(stack_ptr, 3, &status))
+ break;
+ variable_id = args[0];
+
+ /*
+ * If variable is read-only,
+ * convert to writable array
+ */
+ if ((version > 0) &&
+ ((attrs[variable_id] & 0x9c) == 0x0c)) {
+ /* Allocate a writable buffer for this array */
+ long_tmp =
+ (var_size[variable_id] + 7L) >> 3L;
+ charptr_tmp2 = (u8 *)vars[variable_id];
+ charptr_tmp =
+ kzalloc(long_tmp, GFP_KERNEL);
+ vars[variable_id] = (long)charptr_tmp;
+
+ if (vars[variable_id] == 0) {
+ status = -ENOMEM;
+ break;
+ }
+
+ /* zero the buffer */
+ for (long_idx = 0L;
+ long_idx < long_tmp;
+ ++long_idx) {
+ charptr_tmp[long_idx] = 0;
+ }
+
+ /* copy previous contents into buffer */
+ for (long_idx = 0L;
+ long_idx < var_size[variable_id];
+ ++long_idx) {
+ long_idx2 = long_idx;
+
+ if (charptr_tmp2[long_idx2 >> 3] &
+ (1 << (long_idx2 & 7))) {
+ charptr_tmp[long_idx >> 3] |=
+ (1 << (long_idx & 7));
+ }
+ }
+
+ /*
+ * set bit 7 - buffer was
+ * dynamically allocated
+ */
+ attrs[variable_id] |= 0x80;
+
+ /* clear bit 2 - variable is writable */
+ attrs[variable_id] &= ~0x04;
+ attrs[variable_id] |= 0x01;
+
+ }
+
+ /*
+ * check that variable is
+ * a writable Boolean array
+ */
+ if ((attrs[variable_id] & 0x1c) != 0x08) {
+ status = -ERANGE;
+ break;
+ }
+
+ charptr_tmp = (u8 *)vars[variable_id];
+
+ /* pop the count (number of bits to copy) */
+ long_count = stack[--stack_ptr];
+
+ /* pop the array index */
+ long_idx = stack[--stack_ptr];
+
+ reverse = 0;
+
+ if (version > 0) {
+ /*
+ * stack 0 = array right index
+ * stack 1 = array left index
+ */
+
+ if (long_idx > long_count) {
+ reverse = 1;
+ long_tmp = long_count;
+ long_count = 1 + long_idx -
+ long_count;
+ long_idx = long_tmp;
+
+ /* reverse POPA is not supported */
+ status = -ERANGE;
+ break;
+ } else
+ long_count = 1 + long_count -
+ long_idx;
+
+ }
+
+ /* pop the data */
+ long_tmp = stack[--stack_ptr];
+
+ if (long_count < 1) {
+ status = -ERANGE;
+ break;
+ }
+
+ for (i = 0; i < long_count; ++i) {
+ if (long_tmp & (1L << (s32) i))
+ charptr_tmp[long_idx >> 3L] |=
+ (1L << (long_idx & 7L));
+ else
+ charptr_tmp[long_idx >> 3L] &=
+ ~(1L << (long_idx & 7L));
+
+ ++long_idx;
+ }
+
+ break;
+ case OP_JMPZ:
+ /*
+ * Pop stack and branch if zero
+ * ...argument 0 is address
+ * ...stack 0 is condition value
+ */
+ if (altera_check_stack(stack_ptr, 1, &status)) {
+ if (stack[--stack_ptr] == 0) {
+ pc = args[0] + code_sect;
+ if ((pc < code_sect) ||
+ (pc >= debug_sect))
+ status = -ERANGE;
+ }
+ }
+ break;
+ case OP_DS:
+ case OP_IS:
+ /*
+ * DRSCAN
+ * IRSCAN
+ * ...argument 0 is scan data variable ID
+ * ...stack 0 is array index
+ * ...stack 1 is count
+ */
+ if (!altera_check_stack(stack_ptr, 2, &status))
+ break;
+ long_idx = stack[--stack_ptr];
+ long_count = stack[--stack_ptr];
+ reverse = 0;
+ if (version > 0) {
+ /*
+ * stack 0 = array right index
+ * stack 1 = array left index
+ * stack 2 = count
+ */
+ long_tmp = long_count;
+ long_count = stack[--stack_ptr];
+
+ if (long_idx > long_tmp) {
+ reverse = 1;
+ long_idx = long_tmp;
+ }
+ }
+
+ charptr_tmp = (u8 *)vars[args[0]];
+
+ if (reverse) {
+ /*
+ * allocate a buffer
+ * and reverse the data order
+ */
+ charptr_tmp2 = charptr_tmp;
+ charptr_tmp = kzalloc((long_count >> 3) + 1,
+ GFP_KERNEL);
+ if (charptr_tmp == NULL) {
+ status = -ENOMEM;
+ break;
+ }
+
+ long_tmp = long_idx + long_count - 1;
+ long_idx2 = 0;
+ while (long_idx2 < long_count) {
+ if (charptr_tmp2[long_tmp >> 3] &
+ (1 << (long_tmp & 7)))
+ charptr_tmp[long_idx2 >> 3] |=
+ (1 << (long_idx2 & 7));
+ else
+ charptr_tmp[long_idx2 >> 3] &=
+ ~(1 << (long_idx2 & 7));
+
+ --long_tmp;
+ ++long_idx2;
+ }
+ }
+
+ if (opcode == 0x51) /* DS */
+ status = altera_drscan(astate, long_count,
+ charptr_tmp, long_idx);
+ else /* IS */
+ status = altera_irscan(astate, long_count,
+ charptr_tmp, long_idx);
+
+ if (reverse)
+ kfree(charptr_tmp);
+
+ break;
+ case OP_DPRA:
+ /*
+ * DRPRE with array data
+ * ...argument 0 is variable ID
+ * ...stack 0 is array index
+ * ...stack 1 is count
+ */
+ if (!altera_check_stack(stack_ptr, 2, &status))
+ break;
+ index = stack[--stack_ptr];
+ count = stack[--stack_ptr];
+
+ if (version > 0)
+ /*
+ * stack 0 = array right index
+ * stack 1 = array left index
+ */
+ count = 1 + count - index;
+
+ charptr_tmp = (u8 *)vars[args[0]];
+ status = altera_set_dr_pre(&astate->js, count, index,
+ charptr_tmp);
+ break;
+ case OP_DPOA:
+ /*
+ * DRPOST with array data
+ * ...argument 0 is variable ID
+ * ...stack 0 is array index
+ * ...stack 1 is count
+ */
+ if (!altera_check_stack(stack_ptr, 2, &status))
+ break;
+ index = stack[--stack_ptr];
+ count = stack[--stack_ptr];
+
+ if (version > 0)
+ /*
+ * stack 0 = array right index
+ * stack 1 = array left index
+ */
+ count = 1 + count - index;
+
+ charptr_tmp = (u8 *)vars[args[0]];
+ status = altera_set_dr_post(&astate->js, count, index,
+ charptr_tmp);
+ break;
+ case OP_IPRA:
+ /*
+ * IRPRE with array data
+ * ...argument 0 is variable ID
+ * ...stack 0 is array index
+ * ...stack 1 is count
+ */
+ if (!altera_check_stack(stack_ptr, 2, &status))
+ break;
+ index = stack[--stack_ptr];
+ count = stack[--stack_ptr];
+
+ if (version > 0)
+ /*
+ * stack 0 = array right index
+ * stack 1 = array left index
+ */
+ count = 1 + count - index;
+
+ charptr_tmp = (u8 *)vars[args[0]];
+ status = altera_set_ir_pre(&astate->js, count, index,
+ charptr_tmp);
+
+ break;
+ case OP_IPOA:
+ /*
+ * IRPOST with array data
+ * ...argument 0 is variable ID
+ * ...stack 0 is array index
+ * ...stack 1 is count
+ */
+ if (!altera_check_stack(stack_ptr, 2, &status))
+ break;
+ index = stack[--stack_ptr];
+ count = stack[--stack_ptr];
+
+ if (version > 0)
+ /*
+ * stack 0 = array right index
+ * stack 1 = array left index
+ */
+ count = 1 + count - index;
+
+ charptr_tmp = (u8 *)vars[args[0]];
+ status = altera_set_ir_post(&astate->js, count, index,
+ charptr_tmp);
+
+ break;
+ case OP_EXPT:
+ /*
+ * EXPORT
+ * ...argument 0 is string ID
+ * ...stack 0 is integer expression
+ */
+ if (altera_check_stack(stack_ptr, 1, &status)) {
+ name = &p[str_table + args[0]];
+ long_tmp = stack[--stack_ptr];
+ altera_export_int(name, long_tmp);
+ }
+ break;
+ case OP_PSHE:
+ /*
+ * Push integer array element
+ * ...argument 0 is variable ID
+ * ...stack 0 is array index
+ */
+ if (!altera_check_stack(stack_ptr, 1, &status))
+ break;
+ variable_id = args[0];
+ index = stack[stack_ptr - 1];
+
+ /* check variable type */
+ if ((attrs[variable_id] & 0x1f) == 0x19) {
+ /* writable integer array */
+ longptr_tmp = (long *)vars[variable_id];
+ stack[stack_ptr - 1] = longptr_tmp[index];
+ } else if ((attrs[variable_id] & 0x1f) == 0x1c) {
+ /* read-only integer array */
+ long_tmp = vars[variable_id] +
+ (index * sizeof(long));
+ stack[stack_ptr - 1] =
+ get_unaligned_be32(&p[long_tmp]);
+ } else
+ status = -ERANGE;
+
+ break;
+ case OP_PSHA:
+ /*
+ * Push Boolean array
+ * ...argument 0 is variable ID
+ * ...stack 0 is count
+ * ...stack 1 is array index
+ */
+ if (!altera_check_stack(stack_ptr, 2, &status))
+ break;
+ variable_id = args[0];
+
+ /* check that variable is a Boolean array */
+ if ((attrs[variable_id] & 0x18) != 0x08) {
+ status = -ERANGE;
+ break;
+ }
+
+ charptr_tmp = (u8 *)vars[variable_id];
+
+ /* pop the count (number of bits to copy) */
+ count = stack[--stack_ptr];
+
+ /* pop the array index */
+ index = stack[stack_ptr - 1];
+
+ if (version > 0)
+ /*
+ * stack 0 = array right index
+ * stack 1 = array left index
+ */
+ count = 1 + count - index;
+
+ if ((count < 1) || (count > 32)) {
+ status = -ERANGE;
+ break;
+ }
+
+ long_tmp = 0L;
+
+ for (i = 0; i < count; ++i)
+ if (charptr_tmp[(i + index) >> 3] &
+ (1 << ((i + index) & 7)))
+ long_tmp |= (1L << i);
+
+ stack[stack_ptr - 1] = long_tmp;
+
+ break;
+ case OP_DYNA:
+ /*
+ * Dynamically change size of array
+ * ...argument 0 is variable ID
+ * ...stack 0 is new size
+ */
+ if (!altera_check_stack(stack_ptr, 1, &status))
+ break;
+ variable_id = args[0];
+ long_tmp = stack[--stack_ptr];
+
+ if (long_tmp > var_size[variable_id]) {
+ var_size[variable_id] = long_tmp;
+
+ if (attrs[variable_id] & 0x10)
+ /* allocate integer array */
+ long_tmp *= sizeof(long);
+ else
+ /* allocate Boolean array */
+ long_tmp = (long_tmp + 7) >> 3;
+
+ /*
+ * If the buffer was previously allocated,
+ * free it
+ */
+ if (attrs[variable_id] & 0x80) {
+ kfree((void *)vars[variable_id]);
+ vars[variable_id] = 0;
+ }
+
+ /*
+ * Allocate a new buffer
+ * of the requested size
+ */
+ vars[variable_id] = (long)
+ kzalloc(long_tmp, GFP_KERNEL);
+
+ if (vars[variable_id] == 0) {
+ status = -ENOMEM;
+ break;
+ }
+
+ /*
+ * Set the attribute bit to indicate that
+ * this buffer was dynamically allocated and
+ * should be freed later
+ */
+ attrs[variable_id] |= 0x80;
+
+ /* zero out memory */
+ count = ((var_size[variable_id] + 7L) /
+ 8L);
+ charptr_tmp = (u8 *)(vars[variable_id]);
+ for (index = 0; index < count; ++index)
+ charptr_tmp[index] = 0;
+
+ }
+
+ break;
+ case OP_EXPV:
+ /*
+ * Export Boolean array
+ * ...argument 0 is string ID
+ * ...stack 0 is variable ID
+ * ...stack 1 is array right index
+ * ...stack 2 is array left index
+ */
+ if (!altera_check_stack(stack_ptr, 3, &status))
+ break;
+ if (version == 0) {
+ /* EXPV is not supported in JBC 1.0 */
+ bad_opcode = 1;
+ break;
+ }
+ name = &p[str_table + args[0]];
+ variable_id = stack[--stack_ptr];
+ long_idx = stack[--stack_ptr];/* right indx */
+ long_idx2 = stack[--stack_ptr];/* left indx */
+
+ if (long_idx > long_idx2) {
+ /* reverse indices not supported */
+ status = -ERANGE;
+ break;
+ }
+
+ long_count = 1 + long_idx2 - long_idx;
+
+ charptr_tmp = (u8 *)vars[variable_id];
+ charptr_tmp2 = NULL;
+
+ if ((long_idx & 7L) != 0) {
+ s32 k = long_idx;
+ charptr_tmp2 =
+ kzalloc(((long_count + 7L) / 8L),
+ GFP_KERNEL);
+ if (charptr_tmp2 == NULL) {
+ status = -ENOMEM;
+ break;
+ }
+
+ for (i = 0; i < long_count; ++i) {
+ if (charptr_tmp[k >> 3] &
+ (1 << (k & 7)))
+ charptr_tmp2[i >> 3] |=
+ (1 << (i & 7));
+ else
+ charptr_tmp2[i >> 3] &=
+ ~(1 << (i & 7));
+
+ ++k;
+ }
+ charptr_tmp = charptr_tmp2;
+
+ } else if (long_idx != 0)
+ charptr_tmp = &charptr_tmp[long_idx >> 3];
+
+ altera_export_bool_array(name, charptr_tmp,
+ long_count);
+
+ /* free allocated buffer */
+ if ((long_idx & 7L) != 0)
+ kfree(charptr_tmp2);
+
+ break;
+ case OP_COPY: {
+ /*
+ * Array copy
+ * ...argument 0 is dest ID
+ * ...argument 1 is source ID
+ * ...stack 0 is count
+ * ...stack 1 is dest index
+ * ...stack 2 is source index
+ */
+ s32 copy_count;
+ s32 copy_index;
+ s32 copy_index2;
+ s32 destleft;
+ s32 src_count;
+ s32 dest_count;
+ int src_reverse = 0;
+ int dest_reverse = 0;
+
+ if (!altera_check_stack(stack_ptr, 3, &status))
+ break;
+
+ copy_count = stack[--stack_ptr];
+ copy_index = stack[--stack_ptr];
+ copy_index2 = stack[--stack_ptr];
+ reverse = 0;
+
+ if (version > 0) {
+ /*
+ * stack 0 = source right index
+ * stack 1 = source left index
+ * stack 2 = destination right index
+ * stack 3 = destination left index
+ */
+ destleft = stack[--stack_ptr];
+
+ if (copy_count > copy_index) {
+ src_reverse = 1;
+ reverse = 1;
+ src_count = 1 + copy_count - copy_index;
+ /* copy_index = source start index */
+ } else {
+ src_count = 1 + copy_index - copy_count;
+ /* source start index */
+ copy_index = copy_count;
+ }
+
+ if (copy_index2 > destleft) {
+ dest_reverse = 1;
+ reverse = !reverse;
+ dest_count = 1 + copy_index2 - destleft;
+ /* destination start index */
+ copy_index2 = destleft;
+ } else
+ dest_count = 1 + destleft - copy_index2;
+
+ copy_count = (src_count < dest_count) ?
+ src_count : dest_count;
+
+ if ((src_reverse || dest_reverse) &&
+ (src_count != dest_count))
+ /*
+ * If either the source or destination
+ * is reversed, we can't tolerate
+ * a length mismatch, because we
+ * "left justify" arrays when copying.
+ * This won't work correctly
+ * with reversed arrays.
+ */
+ status = -ERANGE;
+
+ }
+
+ count = copy_count;
+ index = copy_index;
+ index2 = copy_index2;
+
+ /*
+ * If destination is a read-only array,
+ * allocate a buffer and convert it to a writable array
+ */
+ variable_id = args[1];
+ if ((version > 0) &&
+ ((attrs[variable_id] & 0x9c) == 0x0c)) {
+ /* Allocate a writable buffer for this array */
+ long_tmp =
+ (var_size[variable_id] + 7L) >> 3L;
+ charptr_tmp2 = (u8 *)vars[variable_id];
+ charptr_tmp =
+ kzalloc(long_tmp, GFP_KERNEL);
+ vars[variable_id] = (long)charptr_tmp;
+
+ if (vars[variable_id] == 0) {
+ status = -ENOMEM;
+ break;
+ }
+
+ /* zero the buffer */
+ for (long_idx = 0L; long_idx < long_tmp;
+ ++long_idx)
+ charptr_tmp[long_idx] = 0;
+
+ /* copy previous contents into buffer */
+ for (long_idx = 0L;
+ long_idx < var_size[variable_id];
+ ++long_idx) {
+ long_idx2 = long_idx;
+
+ if (charptr_tmp2[long_idx2 >> 3] &
+ (1 << (long_idx2 & 7)))
+ charptr_tmp[long_idx >> 3] |=
+ (1 << (long_idx & 7));
+
+ }
+
+ /*
+ set bit 7 - buffer was dynamically allocated */
+ attrs[variable_id] |= 0x80;
+
+ /* clear bit 2 - variable is writable */
+ attrs[variable_id] &= ~0x04;
+ attrs[variable_id] |= 0x01;
+ }
+
+ charptr_tmp = (u8 *)vars[args[1]];
+ charptr_tmp2 = (u8 *)vars[args[0]];
+
+ /* check if destination is a writable Boolean array */
+ if ((attrs[args[1]] & 0x1c) != 0x08) {
+ status = -ERANGE;
+ break;
+ }
+
+ if (count < 1) {
+ status = -ERANGE;
+ break;
+ }
+
+ if (reverse)
+ index2 += (count - 1);
+
+ for (i = 0; i < count; ++i) {
+ if (charptr_tmp2[index >> 3] &
+ (1 << (index & 7)))
+ charptr_tmp[index2 >> 3] |=
+ (1 << (index2 & 7));
+ else
+ charptr_tmp[index2 >> 3] &=
+ ~(1 << (index2 & 7));
+
+ ++index;
+ if (reverse)
+ --index2;
+ else
+ ++index2;
+ }
+
+ break;
+ }
+ case OP_DSC:
+ case OP_ISC: {
+ /*
+ * DRSCAN with capture
+ * IRSCAN with capture
+ * ...argument 0 is scan data variable ID
+ * ...argument 1 is capture variable ID
+ * ...stack 0 is capture index
+ * ...stack 1 is scan data index
+ * ...stack 2 is count
+ */
+ s32 scan_right, scan_left;
+ s32 capture_count = 0;
+ s32 scan_count = 0;
+ s32 capture_index;
+ s32 scan_index;
+
+ if (!altera_check_stack(stack_ptr, 3, &status))
+ break;
+
+ capture_index = stack[--stack_ptr];
+ scan_index = stack[--stack_ptr];
+
+ if (version > 0) {
+ /*
+ * stack 0 = capture right index
+ * stack 1 = capture left index
+ * stack 2 = scan right index
+ * stack 3 = scan left index
+ * stack 4 = count
+ */
+ scan_right = stack[--stack_ptr];
+ scan_left = stack[--stack_ptr];
+ capture_count = 1 + scan_index - capture_index;
+ scan_count = 1 + scan_left - scan_right;
+ scan_index = scan_right;
+ }
+
+ long_count = stack[--stack_ptr];
+ /*
+ * If capture array is read-only, allocate a buffer
+ * and convert it to a writable array
+ */
+ variable_id = args[1];
+ if ((version > 0) &&
+ ((attrs[variable_id] & 0x9c) == 0x0c)) {
+ /* Allocate a writable buffer for this array */
+ long_tmp =
+ (var_size[variable_id] + 7L) >> 3L;
+ charptr_tmp2 = (u8 *)vars[variable_id];
+ charptr_tmp =
+ kzalloc(long_tmp, GFP_KERNEL);
+ vars[variable_id] = (long)charptr_tmp;
+
+ if (vars[variable_id] == 0) {
+ status = -ENOMEM;
+ break;
+ }
+
+ /* zero the buffer */
+ for (long_idx = 0L; long_idx < long_tmp;
+ ++long_idx)
+ charptr_tmp[long_idx] = 0;
+
+ /* copy previous contents into buffer */
+ for (long_idx = 0L;
+ long_idx < var_size[variable_id];
+ ++long_idx) {
+ long_idx2 = long_idx;
+
+ if (charptr_tmp2[long_idx2 >> 3] &
+ (1 << (long_idx2 & 7)))
+ charptr_tmp[long_idx >> 3] |=
+ (1 << (long_idx & 7));
+
+ }
+
+ /*
+ * set bit 7 - buffer was
+ * dynamically allocated
+ */
+ attrs[variable_id] |= 0x80;
+
+ /* clear bit 2 - variable is writable */
+ attrs[variable_id] &= ~0x04;
+ attrs[variable_id] |= 0x01;
+
+ }
+
+ charptr_tmp = (u8 *)vars[args[0]];
+ charptr_tmp2 = (u8 *)vars[args[1]];
+
+ if ((version > 0) &&
+ ((long_count > capture_count) ||
+ (long_count > scan_count))) {
+ status = -ERANGE;
+ break;
+ }
+
+ /*
+ * check that capture array
+ * is a writable Boolean array
+ */
+ if ((attrs[args[1]] & 0x1c) != 0x08) {
+ status = -ERANGE;
+ break;
+ }
+
+ if (status == 0) {
+ if (opcode == 0x82) /* DSC */
+ status = altera_swap_dr(astate,
+ long_count,
+ charptr_tmp,
+ scan_index,
+ charptr_tmp2,
+ capture_index);
+ else /* ISC */
+ status = altera_swap_ir(astate,
+ long_count,
+ charptr_tmp,
+ scan_index,
+ charptr_tmp2,
+ capture_index);
+
+ }
+
+ break;
+ }
+ case OP_WAIT:
+ /*
+ * WAIT
+ * ...argument 0 is wait state
+ * ...argument 1 is end state
+ * ...stack 0 is cycles
+ * ...stack 1 is microseconds
+ */
+ if (!altera_check_stack(stack_ptr, 2, &status))
+ break;
+ long_tmp = stack[--stack_ptr];
+
+ if (long_tmp != 0L)
+ status = altera_wait_cycles(astate, long_tmp,
+ args[0]);
+
+ long_tmp = stack[--stack_ptr];
+
+ if ((status == 0) && (long_tmp != 0L))
+ status = altera_wait_msecs(astate,
+ long_tmp,
+ args[0]);
+
+ if ((status == 0) && (args[1] != args[0]))
+ status = altera_goto_jstate(astate,
+ args[1]);
+
+ if (version > 0) {
+ --stack_ptr; /* throw away MAX cycles */
+ --stack_ptr; /* throw away MAX microseconds */
+ }
+ break;
+ case OP_CMPA: {
+ /*
+ * Array compare
+ * ...argument 0 is source 1 ID
+ * ...argument 1 is source 2 ID
+ * ...argument 2 is mask ID
+ * ...stack 0 is source 1 index
+ * ...stack 1 is source 2 index
+ * ...stack 2 is mask index
+ * ...stack 3 is count
+ */
+ s32 a, b;
+ u8 *source1 = (u8 *)vars[args[0]];
+ u8 *source2 = (u8 *)vars[args[1]];
+ u8 *mask = (u8 *)vars[args[2]];
+ u32 index1;
+ u32 index2;
+ u32 mask_index;
+
+ if (!altera_check_stack(stack_ptr, 4, &status))
+ break;
+
+ index1 = stack[--stack_ptr];
+ index2 = stack[--stack_ptr];
+ mask_index = stack[--stack_ptr];
+ long_count = stack[--stack_ptr];
+
+ if (version > 0) {
+ /*
+ * stack 0 = source 1 right index
+ * stack 1 = source 1 left index
+ * stack 2 = source 2 right index
+ * stack 3 = source 2 left index
+ * stack 4 = mask right index
+ * stack 5 = mask left index
+ */
+ s32 mask_right = stack[--stack_ptr];
+ s32 mask_left = stack[--stack_ptr];
+ /* source 1 count */
+ a = 1 + index2 - index1;
+ /* source 2 count */
+ b = 1 + long_count - mask_index;
+ a = (a < b) ? a : b;
+ /* mask count */
+ b = 1 + mask_left - mask_right;
+ a = (a < b) ? a : b;
+ /* source 2 start index */
+ index2 = mask_index;
+ /* mask start index */
+ mask_index = mask_right;
+ long_count = a;
+ }
+
+ long_tmp = 1L;
+
+ if (long_count < 1)
+ status = -ERANGE;
+ else {
+ count = long_count;
+
+ for (i = 0; i < count; ++i) {
+ if (mask[mask_index >> 3] &
+ (1 << (mask_index & 7))) {
+ a = source1[index1 >> 3] &
+ (1 << (index1 & 7))
+ ? 1 : 0;
+ b = source2[index2 >> 3] &
+ (1 << (index2 & 7))
+ ? 1 : 0;
+
+ if (a != b) /* failure */
+ long_tmp = 0L;
+ }
+ ++index1;
+ ++index2;
+ ++mask_index;
+ }
+ }
+
+ stack[stack_ptr++] = long_tmp;
+
+ break;
+ }
+ default:
+ /* Unrecognized opcode -- ERROR! */
+ bad_opcode = 1;
+ break;
+ }
+
+ if (bad_opcode)
+ status = -ENOSYS;
+
+ if ((stack_ptr < 0) || (stack_ptr >= ALTERA_STACK_SIZE))
+ status = -EOVERFLOW;
+
+ if (status != 0) {
+ done = 1;
+ *error_address = (s32)(opcode_address - code_sect);
+ }
+ }
+
+ altera_free_buffers(astate);
+
+ /* Free all dynamically allocated arrays */
+ if ((attrs != NULL) && (vars != NULL))
+ for (i = 0; i < sym_count; ++i)
+ if (attrs[i] & 0x80)
+ kfree((void *)vars[i]);
+
+ kfree(vars);
+ kfree(var_size);
+ kfree(attrs);
+ kfree(proc_attributes);
+
+ return status;
+}
+
+static int altera_get_note(u8 *p, s32 program_size,
+ s32 *offset, char *key, char *value, int length)
+/*
+ * Gets key and value of NOTE fields in the JBC file.
+ * Can be called in two modes: if offset pointer is NULL,
+ * then the function searches for note fields which match
+ * the key string provided. If offset is not NULL, then
+ * the function finds the next note field of any key,
+ * starting at the offset specified by the offset pointer.
+ * Returns 0 for success, else appropriate error code
+ */
+{
+ int status = -ENODATA;
+ u32 note_strings = 0L;
+ u32 note_table = 0L;
+ u32 note_count = 0L;
+ u32 first_word = 0L;
+ int version = 0;
+ int delta = 0;
+ char *key_ptr;
+ char *value_ptr;
+ int i;
+
+ /* Read header information */
+ if (program_size > 52L) {
+ first_word = get_unaligned_be32(&p[0]);
+ version = (first_word & 1L);
+ delta = version * 8;
+
+ note_strings = get_unaligned_be32(&p[8 + delta]);
+ note_table = get_unaligned_be32(&p[12 + delta]);
+ note_count = get_unaligned_be32(&p[44 + (2 * delta)]);
+ }
+
+ if ((first_word != 0x4A414D00L) && (first_word != 0x4A414D01L))
+ return -EIO;
+
+ if (note_count <= 0L)
+ return status;
+
+ if (offset == NULL) {
+ /*
+ * We will search for the first note with a specific key,
+ * and return only the value
+ */
+ for (i = 0; (i < note_count) &&
+ (status != 0); ++i) {
+ key_ptr = &p[note_strings +
+ get_unaligned_be32(
+ &p[note_table + (8 * i)])];
+ if ((strnicmp(key, key_ptr, strlen(key_ptr)) == 0) &&
+ (key != NULL)) {
+ status = 0;
+
+ value_ptr = &p[note_strings +
+ get_unaligned_be32(
+ &p[note_table + (8 * i) + 4])];
+
+ if (value != NULL)
+ strlcpy(value, value_ptr, length);
+
+ }
+ }
+ } else {
+ /*
+ * We will search for the next note, regardless of the key,
+ * and return both the value and the key
+ */
+
+ i = *offset;
+
+ if ((i >= 0) && (i < note_count)) {
+ status = 0;
+
+ if (key != NULL)
+ strlcpy(key, &p[note_strings +
+ get_unaligned_be32(
+ &p[note_table + (8 * i)])],
+ length);
+
+ if (value != NULL)
+ strlcpy(value, &p[note_strings +
+ get_unaligned_be32(
+ &p[note_table + (8 * i) + 4])],
+ length);
+
+ *offset = i + 1;
+ }
+ }
+
+ return status;
+}
+
+static int altera_check_crc(u8 *p, s32 program_size)
+{
+ int status = 0;
+ u16 local_expected = 0,
+ local_actual = 0,
+ shift_reg = 0xffff;
+ int bit, feedback;
+ u8 databyte;
+ u32 i;
+ u32 crc_section = 0L;
+ u32 first_word = 0L;
+ int version = 0;
+ int delta = 0;
+
+ if (program_size > 52L) {
+ first_word = get_unaligned_be32(&p[0]);
+ version = (first_word & 1L);
+ delta = version * 8;
+
+ crc_section = get_unaligned_be32(&p[32 + delta]);
+ }
+
+ if ((first_word != 0x4A414D00L) && (first_word != 0x4A414D01L))
+ status = -EIO;
+
+ if (crc_section >= program_size)
+ status = -EIO;
+
+ if (status == 0) {
+ local_expected = (u16)get_unaligned_be16(&p[crc_section]);
+
+ for (i = 0; i < crc_section; ++i) {
+ databyte = p[i];
+ for (bit = 0; bit < 8; bit++) {
+ feedback = (databyte ^ shift_reg) & 0x01;
+ shift_reg >>= 1;
+ if (feedback)
+ shift_reg ^= 0x8408;
+
+ databyte >>= 1;
+ }
+ }
+
+ local_actual = (u16)~shift_reg;
+
+ if (local_expected != local_actual)
+ status = -EILSEQ;
+
+ }
+
+ if (debug || status) {
+ switch (status) {
+ case 0:
+ printk(KERN_INFO "%s: CRC matched: %04x\n", __func__,
+ local_actual);
+ break;
+ case -EILSEQ:
+ printk(KERN_ERR "%s: CRC mismatch: expected %04x, "
+ "actual %04x\n", __func__, local_expected,
+ local_actual);
+ break;
+ case -ENODATA:
+ printk(KERN_ERR "%s: expected CRC not found, "
+ "actual CRC = %04x\n", __func__,
+ local_actual);
+ break;
+ case -EIO:
+ printk(KERN_ERR "%s: error: format isn't "
+ "recognized.\n", __func__);
+ break;
+ default:
+ printk(KERN_ERR "%s: CRC function returned error "
+ "code %d\n", __func__, status);
+ break;
+ }
+ }
+
+ return status;
+}
+
+static int altera_get_file_info(u8 *p,
+ s32 program_size,
+ int *format_version,
+ int *action_count,
+ int *procedure_count)
+{
+ int status = -EIO;
+ u32 first_word = 0;
+ int version = 0;
+
+ if (program_size <= 52L)
+ return status;
+
+ first_word = get_unaligned_be32(&p[0]);
+
+ if ((first_word == 0x4A414D00L) || (first_word == 0x4A414D01L)) {
+ status = 0;
+
+ version = (first_word & 1L);
+ *format_version = version + 1;
+
+ if (version > 0) {
+ *action_count = get_unaligned_be32(&p[48]);
+ *procedure_count = get_unaligned_be32(&p[52]);
+ }
+ }
+
+ return status;
+}
+
+static int altera_get_act_info(u8 *p,
+ s32 program_size,
+ int index,
+ char **name,
+ char **description,
+ struct altera_procinfo **proc_list)
+{
+ int status = -EIO;
+ struct altera_procinfo *procptr = NULL;
+ struct altera_procinfo *tmpptr = NULL;
+ u32 first_word = 0L;
+ u32 action_table = 0L;
+ u32 proc_table = 0L;
+ u32 str_table = 0L;
+ u32 note_strings = 0L;
+ u32 action_count = 0L;
+ u32 proc_count = 0L;
+ u32 act_name_id = 0L;
+ u32 act_desc_id = 0L;
+ u32 act_proc_id = 0L;
+ u32 act_proc_name = 0L;
+ u8 act_proc_attribute = 0;
+
+ if (program_size <= 52L)
+ return status;
+ /* Read header information */
+ first_word = get_unaligned_be32(&p[0]);
+
+ if (first_word != 0x4A414D01L)
+ return status;
+
+ action_table = get_unaligned_be32(&p[4]);
+ proc_table = get_unaligned_be32(&p[8]);
+ str_table = get_unaligned_be32(&p[12]);
+ note_strings = get_unaligned_be32(&p[16]);
+ action_count = get_unaligned_be32(&p[48]);
+ proc_count = get_unaligned_be32(&p[52]);
+
+ if (index >= action_count)
+ return status;
+
+ act_name_id = get_unaligned_be32(&p[action_table + (12 * index)]);
+ act_desc_id = get_unaligned_be32(&p[action_table + (12 * index) + 4]);
+ act_proc_id = get_unaligned_be32(&p[action_table + (12 * index) + 8]);
+
+ *name = &p[str_table + act_name_id];
+
+ if (act_desc_id < (note_strings - str_table))
+ *description = &p[str_table + act_desc_id];
+
+ do {
+ act_proc_name = get_unaligned_be32(
+ &p[proc_table + (13 * act_proc_id)]);
+ act_proc_attribute =
+ (p[proc_table + (13 * act_proc_id) + 8] & 0x03);
+
+ procptr = (struct altera_procinfo *)
+ kzalloc(sizeof(struct altera_procinfo),
+ GFP_KERNEL);
+
+ if (procptr == NULL)
+ status = -ENOMEM;
+ else {
+ procptr->name = &p[str_table + act_proc_name];
+ procptr->attrs = act_proc_attribute;
+ procptr->next = NULL;
+
+ /* add record to end of linked list */
+ if (*proc_list == NULL)
+ *proc_list = procptr;
+ else {
+ tmpptr = *proc_list;
+ while (tmpptr->next != NULL)
+ tmpptr = tmpptr->next;
+ tmpptr->next = procptr;
+ }
+ }
+
+ act_proc_id = get_unaligned_be32(
+ &p[proc_table + (13 * act_proc_id) + 4]);
+ } while ((act_proc_id != 0) && (act_proc_id < proc_count));
+
+ return status;
+}
+
+int altera_init(struct altera_config *config, const struct firmware *fw)
+{
+ struct altera_state *astate = NULL;
+ struct altera_procinfo *proc_list = NULL;
+ struct altera_procinfo *procptr = NULL;
+ char *key = NULL;
+ char *value = NULL;
+ char *action_name = NULL;
+ char *description = NULL;
+ int exec_result = 0;
+ int exit_code = 0;
+ int format_version = 0;
+ int action_count = 0;
+ int procedure_count = 0;
+ int index = 0;
+ s32 offset = 0L;
+ s32 error_address = 0L;
+
+ key = kzalloc(33 * sizeof(char), GFP_KERNEL);
+ if (!key)
+ return -ENOMEM;
+ value = kzalloc(257 * sizeof(char), GFP_KERNEL);
+ if (!value)
+ return -ENOMEM;
+ astate = kzalloc(sizeof(struct altera_state), GFP_KERNEL);
+ if (!astate)
+ return -ENOMEM;
+
+ astate->config = config;
+ if (!astate->config->jtag_io) {
+ dprintk(KERN_INFO "%s: using byteblaster!\n", __func__);
+ astate->config->jtag_io = netup_jtag_io_lpt;
+ }
+
+ altera_check_crc((u8 *)fw->data, fw->size);
+
+ if (debug) {
+ altera_get_file_info((u8 *)fw->data, fw->size, &format_version,
+ &action_count, &procedure_count);
+ printk(KERN_INFO "%s: File format is %s ByteCode format\n",
+ __func__, (format_version == 2) ? "Jam STAPL" :
+ "pre-standardized Jam 1.1");
+ while (altera_get_note((u8 *)fw->data, fw->size,
+ &offset, key, value, 256) == 0)
+ printk(KERN_INFO "%s: NOTE \"%s\" = \"%s\"\n",
+ __func__, key, value);
+ }
+
+ if (debug && (format_version == 2) && (action_count > 0)) {
+ printk(KERN_INFO "%s: Actions available:\n", __func__);
+ for (index = 0; index < action_count; ++index) {
+ altera_get_act_info((u8 *)fw->data, fw->size,
+ index, &action_name,
+ &description,
+ &proc_list);
+
+ if (description == NULL)
+ printk(KERN_INFO "%s: %s\n",
+ __func__,
+ action_name);
+ else
+ printk(KERN_INFO "%s: %s \"%s\"\n",
+ __func__,
+ action_name,
+ description);
+
+ procptr = proc_list;
+ while (procptr != NULL) {
+ if (procptr->attrs != 0)
+ printk(KERN_INFO "%s: %s (%s)\n",
+ __func__,
+ procptr->name,
+ (procptr->attrs == 1) ?
+ "optional" : "recommended");
+
+ proc_list = procptr->next;
+ kfree(procptr);
+ procptr = proc_list;
+ }
+ }
+
+ printk(KERN_INFO "\n");
+ }
+
+ exec_result = altera_execute(astate, (u8 *)fw->data, fw->size,
+ &error_address, &exit_code, &format_version);
+
+ if (exit_code)
+ exec_result = -EREMOTEIO;
+
+ if ((format_version == 2) && (exec_result == -EINVAL)) {
+ if (astate->config->action == NULL)
+ printk(KERN_ERR "%s: error: no action specified for "
+ "Jam STAPL file.\nprogram terminated.\n",
+ __func__);
+ else
+ printk(KERN_ERR "%s: error: action \"%s\""
+ " is not supported "
+ "for this Jam STAPL file.\n"
+ "Program terminated.\n", __func__,
+ astate->config->action);
+
+ } else if (exec_result)
+ printk(KERN_ERR "%s: error %d\n", __func__, exec_result);
+
+ kfree(key);
+ kfree(value);
+ kfree(astate);
+
+ return 0;
+}
+EXPORT_SYMBOL(altera_init);
diff --git a/drivers/staging/ath6kl/htc2/AR6000/ar6k_gmbox_hciuart.c b/drivers/staging/ath6kl/htc2/AR6000/ar6k_gmbox_hciuart.c
index c6488e0d1305..41223f953589 100644
--- a/drivers/staging/ath6kl/htc2/AR6000/ar6k_gmbox_hciuart.c
+++ b/drivers/staging/ath6kl/htc2/AR6000/ar6k_gmbox_hciuart.c
@@ -237,7 +237,7 @@ static int CreditsAvailableCallback(void *pContext, int Credits, bool CreditIRQE
pProt->CreditsCurrentSeek));
if (pProt->CreditsAvailable >= pProt->CreditsCurrentSeek) {
- /* we have enough credits to fullfill at least 1 packet waiting in the queue */
+ /* we have enough credits to fulfill at least 1 packet waiting in the queue */
pProt->CreditsCurrentSeek = 0;
pProt->SendStateFlags &= ~HCI_SEND_WAIT_CREDITS;
doPendingSends = true;
@@ -285,7 +285,7 @@ static void FailureCallback(void *pContext, int Status)
{
struct gmbox_proto_hci_uart *pProt = (struct gmbox_proto_hci_uart *)pContext;
- /* target assertion occured */
+ /* target assertion occurred */
NotifyTransportFailure(pProt, Status);
}
@@ -507,7 +507,7 @@ static int HCIUartMessagePending(void *pContext, u8 LookAheadBytes[], int ValidB
} while (false);
- /* check if we need to disable the reciever */
+ /* check if we need to disable the receiver */
if (status || blockRecv) {
DevGMboxIRQAction(pProt->pDev, GMBOX_RECV_IRQ_DISABLE, PROC_IO_SYNC);
}
diff --git a/drivers/staging/ath6kl/include/aggr_recv_api.h b/drivers/staging/ath6kl/include/aggr_recv_api.h
index 67a058492c4d..5ead58d5febd 100644
--- a/drivers/staging/ath6kl/include/aggr_recv_api.h
+++ b/drivers/staging/ath6kl/include/aggr_recv_api.h
@@ -72,7 +72,7 @@ aggr_process_bar(void *cntxt, u8 tid, u16 seq_no);
* This event is to initiate/modify the receive side window.
* Target will send WMI_ADDBA_REQ_EVENTID event to host - to setup
* recv re-ordering queues. Target will negotiate ADDBA with peer,
- * and indicate via this event after succesfully completing the
+ * and indicate via this event after successfully completing the
* negotiation. This happens in two situations:
* 1. Initial setup of aggregation
* 2. Renegotiation of current recv window.
diff --git a/drivers/staging/ath6kl/include/common/a_hci.h b/drivers/staging/ath6kl/include/common/a_hci.h
index 08cb013090be..379d65224e3a 100644
--- a/drivers/staging/ath6kl/include/common/a_hci.h
+++ b/drivers/staging/ath6kl/include/common/a_hci.h
@@ -124,7 +124,7 @@
#define PAL_NUM_COMPL_DATA_BLOCK_EVENT 0x48
#define PAL_SHORT_RANGE_MODE_CHANGE_COMPL_EVENT 0x4C
#define PAL_AMP_STATUS_CHANGE_EVENT 0x4D
-/*======== End of PAL events definiton =================*/
+/*======== End of PAL events definition =================*/
/*======== Timeouts (not part of HCI cmd, but input to PAL engine) =========*/
@@ -430,7 +430,7 @@ typedef struct hci_event_hw_err_t {
u8 hw_err_code;
} POSTPACK HCI_EVENT_HW_ERR;
-/* Flush occured event */
+/* Flush occurred event */
/* Qos Violation event */
typedef struct hci_event_handle_t {
u8 event_code;
diff --git a/drivers/staging/ath6kl/include/common/dbglog.h b/drivers/staging/ath6kl/include/common/dbglog.h
index 3a3d00da0b81..b7a123086ccf 100644
--- a/drivers/staging/ath6kl/include/common/dbglog.h
+++ b/drivers/staging/ath6kl/include/common/dbglog.h
@@ -44,7 +44,7 @@ extern "C" {
#define DBGLOG_MODULEID_NUM_MAX 16 /* Upper limit is width of mask */
/*
- * Please ensure that the definition of any new module intrduced is captured
+ * Please ensure that the definition of any new module introduced is captured
* between the DBGLOG_MODULEID_START and DBGLOG_MODULEID_END defines. The
* structure is required for the parser to correctly pick up the values for
* different modules.
diff --git a/drivers/staging/ath6kl/include/common/epping_test.h b/drivers/staging/ath6kl/include/common/epping_test.h
index 5c40d8a2229d..7027fac8f37e 100644
--- a/drivers/staging/ath6kl/include/common/epping_test.h
+++ b/drivers/staging/ath6kl/include/common/epping_test.h
@@ -92,7 +92,7 @@ typedef PREPACK struct {
#define EPPING_CMD_RESET_RECV_CNT 2 /* reset recv count */
#define EPPING_CMD_CAPTURE_RECV_CNT 3 /* fetch recv count, 4-byte count returned in CmdBuffer_t */
#define EPPING_CMD_NO_ECHO 4 /* non-echo packet test (tx-only) */
-#define EPPING_CMD_CONT_RX_START 5 /* continous RX packets, parameters are in CmdBuffer_h */
+#define EPPING_CMD_CONT_RX_START 5 /* continuous RX packets, parameters are in CmdBuffer_h */
#define EPPING_CMD_CONT_RX_STOP 6 /* stop continuous RX packet transmission */
/* test command parameters may be no more than 8 bytes */
diff --git a/drivers/staging/ath6kl/include/common/ini_dset.h b/drivers/staging/ath6kl/include/common/ini_dset.h
index 8bfc75940c8f..a9e05fa0f659 100644
--- a/drivers/staging/ath6kl/include/common/ini_dset.h
+++ b/drivers/staging/ath6kl/include/common/ini_dset.h
@@ -31,7 +31,7 @@
*/
typedef enum {
#if defined(AR6002_REV4) || defined(AR6003)
-/* Add these definitions for compatability */
+/* Add these definitions for compatibility */
#define WHAL_INI_DATA_ID_BB_RFGAIN_LNA1 WHAL_INI_DATA_ID_BB_RFGAIN
#define WHAL_INI_DATA_ID_BB_RFGAIN_LNA2 WHAL_INI_DATA_ID_BB_RFGAIN
WHAL_INI_DATA_ID_NULL =0,
diff --git a/drivers/staging/ath6kl/include/common/testcmd.h b/drivers/staging/ath6kl/include/common/testcmd.h
index 9ca1f2ac2cbf..7d94aee508b3 100644
--- a/drivers/staging/ath6kl/include/common/testcmd.h
+++ b/drivers/staging/ath6kl/include/common/testcmd.h
@@ -43,8 +43,8 @@ typedef enum {
PN15_PATTERN
}TX_DATA_PATTERN;
-/* Continous tx
- mode : TCMD_CONT_TX_OFF - Disabling continous tx
+/* Continuous tx
+ mode : TCMD_CONT_TX_OFF - Disabling continuous tx
TCMD_CONT_TX_SINE - Enable continuous unmodulated tx
TCMD_CONT_TX_FRAME- Enable continuous modulated tx
freq : Channel freq in Mhz. (e.g 2412 for channel 1 in 11 g)
diff --git a/drivers/staging/ath6kl/include/common/wmi.h b/drivers/staging/ath6kl/include/common/wmi.h
index c645af373442..4e6343485362 100644
--- a/drivers/staging/ath6kl/include/common/wmi.h
+++ b/drivers/staging/ath6kl/include/common/wmi.h
@@ -1568,8 +1568,8 @@ typedef PREPACK struct {
switch to ps-poll mode
default = 3 */
- u32 scoContStompMax; /* max number of continous stomp allowed in opt mode.
- if excedded switch to pspoll mode
+ u32 scoContStompMax; /* max number of continuous stomp allowed in opt mode.
+ if exceeded switch to pspoll mode
default = 3 */
u32 scoMinlowRateMbps; /* Low rate threshold */
@@ -2084,7 +2084,7 @@ typedef PREPACK struct {
/*
* BSS INFO HDR version 2.0
* With 6 bytes HTC header and 6 bytes of WMI header
- * WMI_BSS_INFO_HDR cannot be accomodated in the removed 802.11 management
+ * WMI_BSS_INFO_HDR cannot be accommodated in the removed 802.11 management
* header space.
* - Reduce the ieMask to 2 bytes as only two bit flags are used
* - Remove rssi and compute it on the host. rssi = snr - 95
@@ -2911,7 +2911,7 @@ typedef PREPACK struct {
u8 pktID; /* packet ID to identify parent packet */
u8 rateIdx; /* rate index on successful transmission */
u8 ackFailures; /* number of ACK failures in tx attempt */
-#if 0 /* optional params currently ommitted. */
+#if 0 /* optional params currently omitted. */
u32 queueDelay; // usec delay measured Tx Start time - host delivery time
u32 mediaDelay; // usec delay measured ACK rx time - host delivery time
#endif
diff --git a/drivers/staging/ath6kl/include/common/wmix.h b/drivers/staging/ath6kl/include/common/wmix.h
index 5ebb8285d135..36acba66d49f 100644
--- a/drivers/staging/ath6kl/include/common/wmix.h
+++ b/drivers/staging/ath6kl/include/common/wmix.h
@@ -191,7 +191,7 @@ typedef PREPACK struct {
} POSTPACK WMIX_GPIO_INTR_ACK_CMD;
/*
- * Target informs Host of GPIO interrupts that have ocurred since the
+ * Target informs Host of GPIO interrupts that have occurred since the
* last WMIX_GIPO_INTR_ACK_CMD was received. Additional information --
* the current GPIO input values is provided -- in order to support
* use of a GPIO interrupt as a Data Valid signal for other GPIO pins.
diff --git a/drivers/staging/ath6kl/include/htc_api.h b/drivers/staging/ath6kl/include/htc_api.h
index 1bc2488788ab..4fb767559f82 100644
--- a/drivers/staging/ath6kl/include/htc_api.h
+++ b/drivers/staging/ath6kl/include/htc_api.h
@@ -209,7 +209,7 @@ struct htc_endpoint_credit_dist {
typedef enum _HTC_CREDIT_DIST_REASON {
HTC_CREDIT_DIST_SEND_COMPLETE = 0, /* credits available as a result of completed
send operations (MANDATORY) resulting in credit reports */
- HTC_CREDIT_DIST_ACTIVITY_CHANGE = 1, /* a change in endpoint activity occured (OPTIONAL) */
+ HTC_CREDIT_DIST_ACTIVITY_CHANGE = 1, /* a change in endpoint activity occurred (OPTIONAL) */
HTC_CREDIT_DIST_SEEK_CREDITS, /* an endpoint needs to "seek" credits (OPTIONAL) */
HTC_DUMP_CREDIT_STATE /* for debugging, dump any state information that is kept by
the distribution function */
@@ -253,7 +253,7 @@ struct htc_endpoint_stats {
u32 RxPacketsBundled; /* count of recv packets received in a bundle */
u32 RxBundleLookAheads; /* count of number of bundled lookaheads */
u32 RxBundleIndFromHdr; /* count of the number of bundle indications from the HTC header */
- u32 RxAllocThreshHit; /* count of the number of times the recv allocation threshhold was hit */
+ u32 RxAllocThreshHit; /* count of the number of times the recv allocation threshold was hit */
u32 RxAllocThreshBytes; /* total number of bytes */
};
@@ -391,7 +391,7 @@ int HTCSendPkt(HTC_HANDLE HTCHandle, struct htc_packet *pPacket);
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
void HTCStop(HTC_HANDLE HTCHandle);
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Destory HTC service
+ @desc: Destroy HTC service
@function name: HTCDestroy
@input: HTCHandle
@output:
diff --git a/drivers/staging/ath6kl/miscdrv/credit_dist.c b/drivers/staging/ath6kl/miscdrv/credit_dist.c
index ae54e1f48e50..33fa0209026d 100644
--- a/drivers/staging/ath6kl/miscdrv/credit_dist.c
+++ b/drivers/staging/ath6kl/miscdrv/credit_dist.c
@@ -341,7 +341,7 @@ static void SeekCredits(struct common_credit_state_info *pCredInfo,
credits = min(pCredInfo->CurrentFreeCredits,pEPDist->TxCreditsSeek);
if (credits >= pEPDist->TxCreditsSeek) {
- /* we found some to fullfill the seek request */
+ /* we found some to fulfill the seek request */
break;
}
@@ -364,8 +364,8 @@ static void SeekCredits(struct common_credit_state_info *pCredInfo,
if ((pCurEpDist->TxCreditsAssigned - need) >= pCurEpDist->TxCreditsMin) {
/* the current one has been allocated more than it's minimum and it
- * has enough credits assigned above it's minimum to fullfill our need
- * try to take away just enough to fullfill our need */
+ * has enough credits assigned above it's minimum to fulfill our need
+ * try to take away just enough to fulfill our need */
ReduceCredits(pCredInfo,
pCurEpDist,
pCurEpDist->TxCreditsAssigned - need);
diff --git a/drivers/staging/ath6kl/os/linux/ar6000_android.c b/drivers/staging/ath6kl/os/linux/ar6000_android.c
index c96f6e9c99c6..4aa75ee2cb13 100644
--- a/drivers/staging/ath6kl/os/linux/ar6000_android.c
+++ b/drivers/staging/ath6kl/os/linux/ar6000_android.c
@@ -372,7 +372,7 @@ void android_ar6k_check_wow_status(struct ar6_softc *ar, struct sk_buff *skb, bo
}
}
if (needWake) {
- /* keep host wake up if there is any event and packate comming in*/
+ /* keep host wake up if there is any event and packate coming in*/
if (wowledon) {
char buf[32];
int len = sprintf(buf, "on");
diff --git a/drivers/staging/ath6kl/os/linux/ar6000_drv.c b/drivers/staging/ath6kl/os/linux/ar6000_drv.c
index 27cb02dfad3c..97d6ce63b5c0 100644
--- a/drivers/staging/ath6kl/os/linux/ar6000_drv.c
+++ b/drivers/staging/ath6kl/os/linux/ar6000_drv.c
@@ -520,7 +520,7 @@ dbglog_parse_debug_logs(s8 *datap, u32 len)
int
ar6000_dbglog_get_debug_logs(struct ar6_softc *ar)
{
- u32 data[8]; /* Should be able to accomodate struct dbglog_buf_s */
+ u32 data[8]; /* Should be able to accommodate struct dbglog_buf_s */
u32 address;
u32 length;
u32 dropped;
@@ -2063,7 +2063,7 @@ ar6000_stop_endpoint(struct net_device *dev, bool keepprofile, bool getdbglogs)
* - In case of surprise removal, the hcd already frees up the pending
* for the device and hence there is no need to unregister the function
* driver inorder to get these requests. For planned removal, the function
- * driver has to explictly unregister itself to have the hcd return all the
+ * driver has to explicitly unregister itself to have the hcd return all the
* pending requests before the data structures for the devices are freed up.
* Note that as per the current implementation, the function driver will
* end up releasing all the devices since there is no API to selectively
@@ -2982,7 +2982,7 @@ ar6000_data_tx(struct sk_buff *skb, struct net_device *dev)
/* If target is not associated */
if( (!ar->arConnected && !bypasswmi)
#ifdef CONFIG_HOST_TCMD_SUPPORT
- /* TCMD doesnt support any data, free the buf and return */
+ /* TCMD doesn't support any data, free the buf and return */
|| (ar->arTargetMode == AR6000_TCMD_MODE)
#endif
) {
@@ -6393,7 +6393,7 @@ static void DoHTCSendPktsTest(struct ar6_softc *ar, int MapNo, HTC_ENDPOINT_ID e
/*
* Add support for adding and removing a virtual adapter for soft AP.
* Some OS requires different adapters names for station and soft AP mode.
- * To support these requirement, create and destory a netdevice instance
+ * To support these requirement, create and destroy a netdevice instance
* when the AP mode is operational. A full fledged support for virual device
* is not implemented. Rather a virtual interface is created and is linked
* with the existing physical device instance during the operation of the
diff --git a/drivers/staging/ath6kl/wmi/wmi.c b/drivers/staging/ath6kl/wmi/wmi.c
index 0ddaee21f9d7..a00bf0a59871 100644
--- a/drivers/staging/ath6kl/wmi/wmi.c
+++ b/drivers/staging/ath6kl/wmi/wmi.c
@@ -4867,7 +4867,7 @@ wmi_set_country(struct wmi_t *wmip, u8 *countryCode)
#ifdef CONFIG_HOST_TCMD_SUPPORT
/* WMI layer doesn't need to know the data type of the test cmd.
This would be beneficial for customers like Qualcomm, who might
- have different test command requirements from differnt manufacturers
+ have different test command requirements from different manufacturers
*/
int
wmi_test_cmd(struct wmi_t *wmip, u8 *buf, u32 len)
diff --git a/drivers/staging/bcm/Adapter.h b/drivers/staging/bcm/Adapter.h
index 32909e2938d5..20cca24ff5f0 100644
--- a/drivers/staging/bcm/Adapter.h
+++ b/drivers/staging/bcm/Adapter.h
@@ -412,7 +412,7 @@ struct _MINI_ADAPTER
// this to keep track of the Tx and Rx MailBox Registers.
atomic_t CurrNumFreeTxDesc;
- // to keep track the no of byte recieved
+ // to keep track the no of byte received
USHORT PrevNumRecvDescs;
USHORT CurrNumRecvDescs;
UINT u32TotalDSD;
@@ -527,7 +527,7 @@ struct _MINI_ADAPTER
BOOLEAN bStatusWrite;
UINT uiNVMDSDSize;
UINT uiVendorExtnFlag;
- //it will always represent choosed DSD at any point of time.
+ //it will always represent chosen DSD at any point of time.
// Generally it is Active DSD but in case of NVM RD/WR it might be different.
UINT ulFlashCalStart;
ULONG ulFlashControlSectionStart;
@@ -546,10 +546,10 @@ struct _MINI_ADAPTER
PFLASH_CS_INFO psFlashCSInfo ;
PFLASH2X_VENDORSPECIFIC_INFO psFlash2xVendorInfo;
UINT uiFlashBaseAdd; //Flash start address
- UINT uiActiveISOOffset; //Active ISO offset choosen before f/w download
+ UINT uiActiveISOOffset; //Active ISO offset chosen before f/w download
FLASH2X_SECTION_VAL eActiveISO; //Active ISO section val
- FLASH2X_SECTION_VAL eActiveDSD; //Active DSD val choosen before f/w download
- UINT uiActiveDSDOffsetAtFwDld; //For accessing Active DSD choosen before f/w download
+ FLASH2X_SECTION_VAL eActiveDSD; //Active DSD val chosen before f/w download
+ UINT uiActiveDSDOffsetAtFwDld; //For accessing Active DSD chosen before f/w download
UINT uiFlashLayoutMajorVersion ;
UINT uiFlashLayoutMinorVersion;
BOOLEAN bAllDSDWriteAllow ;
diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c
index 9be184f143e5..c0ee95a71343 100644
--- a/drivers/staging/bcm/CmHost.c
+++ b/drivers/staging/bcm/CmHost.c
@@ -384,7 +384,7 @@ static inline VOID CopyClassifierRuleToSF(PMINI_ADAPTER Adapter,stConvergenceSLT
}
if(psfCSType->cCPacketClassificationRule.u8Protocol == 0)
{
- //we didnt get protocol field filled in by the BS
+ //we didn't get protocol field filled in by the BS
pstClassifierEntry->ucProtocolLength=0;
}
else
@@ -879,7 +879,7 @@ static VOID CopyToAdapter( register PMINI_ADAPTER Adapter, /**<Pointer to the A
/*
Passing the argument u8PHSI instead of clsid. Because for DL with no classifier rule,
- clsid will be zero hence we cant have multiple PHS rules for the same SF.
+ clsid will be zero hence we can't have multiple PHS rules for the same SF.
To support multiple PHS rule, passing u8PHSI.
*/
@@ -1103,7 +1103,7 @@ static VOID DumpCmControlPacket(PVOID pvBuffer)
BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8TrafficIndicationPreference : 0x%X",
pstAddIndication->sfAuthorizedSet.u8TrafficIndicationPreference);
- BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " Total Classifiers Recieved : 0x%X",pstAddIndication->sfAuthorizedSet.u8TotalClassifiers);
+ BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " Total Classifiers Received : 0x%X",pstAddIndication->sfAuthorizedSet.u8TotalClassifiers);
nCurClassifierCnt = pstAddIndication->sfAuthorizedSet.u8TotalClassifiers;
@@ -1305,7 +1305,7 @@ static VOID DumpCmControlPacket(PVOID pvBuffer)
BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, "u8TrafficIndicationPreference : 0x%02X",
pstAddIndication->sfAdmittedSet.u8TrafficIndicationPreference);
- BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " Total Classifiers Recieved : 0x%X",pstAddIndication->sfAdmittedSet.u8TotalClassifiers);
+ BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " Total Classifiers Received : 0x%X",pstAddIndication->sfAdmittedSet.u8TotalClassifiers);
nCurClassifierCnt = pstAddIndication->sfAdmittedSet.u8TotalClassifiers;
@@ -1502,7 +1502,7 @@ static VOID DumpCmControlPacket(PVOID pvBuffer)
BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " u8TrafficIndicationPreference : 0x%X",
pstAddIndication->sfActiveSet.u8TrafficIndicationPreference);
- BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " Total Classifiers Recieved : 0x%X",pstAddIndication->sfActiveSet.u8TotalClassifiers);
+ BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, DUMP_CONTROL, DBG_LVL_ALL, " Total Classifiers Received : 0x%X",pstAddIndication->sfActiveSet.u8TotalClassifiers);
nCurClassifierCnt = pstAddIndication->sfActiveSet.u8TotalClassifiers;
@@ -1696,7 +1696,7 @@ ULONG StoreCmControlResponseMessage(PMINI_ADAPTER Adapter,PVOID pvBuffer,UINT *p
//No Special handling send the message as it is
return 1;
}
- // For DSA_REQ, only upto "psfAuthorizedSet" parameter should be accessed by driver!
+ // For DSA_REQ, only up to "psfAuthorizedSet" parameter should be accessed by driver!
pstAddIndication=kmalloc(sizeof(*pstAddIndication), GFP_KERNEL);
if(NULL==pstAddIndication)
@@ -1788,7 +1788,7 @@ static inline stLocalSFAddIndicationAlt
BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "Inside RestoreCmControlResponseMessage ");
/*
//Need to Allocate memory to contain the SUPER Large structures
- //Our driver cant create these structures on Stack :(
+ //Our driver can't create these structures on Stack :(
*/
pstAddIndicationDest=kmalloc(sizeof(stLocalSFAddIndicationAlt), GFP_KERNEL);
@@ -1957,7 +1957,7 @@ INT AllocAdapterDsxBuffer(PMINI_ADAPTER Adapter)
{
/*
//Need to Allocate memory to contain the SUPER Large structures
- //Our driver cant create these structures on Stack
+ //Our driver can't create these structures on Stack
*/
Adapter->caDsxReqResp=kmalloc(sizeof(stLocalSFAddIndicationAlt)+LEADER_SIZE, GFP_KERNEL);
if(!Adapter->caDsxReqResp)
diff --git a/drivers/staging/bcm/HostMIBSInterface.h b/drivers/staging/bcm/HostMIBSInterface.h
index f17a4f13474c..e34531b638e8 100644
--- a/drivers/staging/bcm/HostMIBSInterface.h
+++ b/drivers/staging/bcm/HostMIBSInterface.h
@@ -62,7 +62,7 @@ typedef struct _S_MIBS_HOST_INFO
ULONG NumDesUsed;
ULONG CurrNumFreeDesc;
ULONG PrevNumFreeDesc;
- // to keep track the no of byte recieved
+ // to keep track the no of byte received
ULONG PrevNumRcevBytes;
ULONG CurrNumRcevBytes;
diff --git a/drivers/staging/bcm/IPv6Protocol.c b/drivers/staging/bcm/IPv6Protocol.c
index 91b6fbe33c91..5b4fd372ec36 100644
--- a/drivers/staging/bcm/IPv6Protocol.c
+++ b/drivers/staging/bcm/IPv6Protocol.c
@@ -287,7 +287,7 @@ static BOOLEAN MatchSrcIpv6Address(S_CLASSIFIER_RULE *pstClassifierRule,IPV6Head
for(uiLoopIndex=0;uiLoopIndex<uiCountIPSrcAddresses;uiLoopIndex+=uiIpv6AddrNoLongWords)
{
- BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "\n Src Ipv6 Address In Recieved Packet : \n ");
+ BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "\n Src Ipv6 Address In Received Packet : \n ");
DumpIpv6Address(aulSrcIP);
BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "\n Src Ipv6 Mask In Classifier Rule: \n");
DumpIpv6Address(&pstClassifierRule->stSrcIpAddress.ulIpv6Mask[uiLoopIndex]);
@@ -340,7 +340,7 @@ static BOOLEAN MatchDestIpv6Address(S_CLASSIFIER_RULE *pstClassifierRule,IPV6Hea
for(uiLoopIndex=0;uiLoopIndex<uiCountIPDestinationAddresses;uiLoopIndex+=uiIpv6AddrNoLongWords)
{
- BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "\n Destination Ipv6 Address In Recieved Packet : \n ");
+ BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "\n Destination Ipv6 Address In Received Packet : \n ");
DumpIpv6Address(aulDestIP);
BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "\n Destination Ipv6 Mask In Classifier Rule: \n");
DumpIpv6Address(&pstClassifierRule->stDestIpAddress.ulIpv6Mask[uiLoopIndex]);
diff --git a/drivers/staging/bcm/InterfaceIdleMode.c b/drivers/staging/bcm/InterfaceIdleMode.c
index bf5c0ad86610..96fa4ead7930 100644
--- a/drivers/staging/bcm/InterfaceIdleMode.c
+++ b/drivers/staging/bcm/InterfaceIdleMode.c
@@ -11,7 +11,7 @@ Input parameters: IN PMINI_ADAPTER Adapter - Miniport Adapter Context
Return: BCM_STATUS_SUCCESS - If Wakeup of the HW Interface was successful.
- Other - If an error occured.
+ Other - If an error occurred.
*/
@@ -26,7 +26,7 @@ Input parameters: IN PMINI_ADAPTER Adapter - Miniport Adapter Context
Return: BCM_STATUS_SUCCESS - If Idle mode response related HW configuration was successful.
- Other - If an error occured.
+ Other - If an error occurred.
*/
/*
diff --git a/drivers/staging/bcm/InterfaceIsr.c b/drivers/staging/bcm/InterfaceIsr.c
index 220ff922bdcf..67719d57256d 100644
--- a/drivers/staging/bcm/InterfaceIsr.c
+++ b/drivers/staging/bcm/InterfaceIsr.c
@@ -80,8 +80,8 @@ static void read_int_callback(struct urb *urb/*, struct pt_regs *regs*/)
}
case -EINPROGRESS:
{
- //This situation may happend when URBunlink is used. for detail check usb_unlink_urb documentation.
- BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, INTF_INIT, DBG_LVL_ALL,"Impossibe condition has occured... something very bad is going on");
+ //This situation may happened when URBunlink is used. for detail check usb_unlink_urb documentation.
+ BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, INTF_INIT, DBG_LVL_ALL,"Impossibe condition has occurred... something very bad is going on");
break ;
//return;
}
diff --git a/drivers/staging/bcm/InterfaceRx.c b/drivers/staging/bcm/InterfaceRx.c
index 533f8ebe0f84..806ef5d18522 100644
--- a/drivers/staging/bcm/InterfaceRx.c
+++ b/drivers/staging/bcm/InterfaceRx.c
@@ -34,7 +34,7 @@ GetBulkInRcb(PS_INTERFACE_ADAPTER psIntfAdapter)
return pRcb;
}
-/*this is receive call back - when pkt avilable for receive (BULK IN- end point)*/
+/*this is receive call back - when pkt available for receive (BULK IN- end point)*/
static void read_bulk_callback(struct urb *urb)
{
struct sk_buff *skb = NULL;
@@ -123,7 +123,7 @@ static void read_bulk_callback(struct urb *urb)
if((ntohs(pLeader->Vcid) == VCID_CONTROL_PACKET) ||
(!(pLeader->Status >= 0x20 && pLeader->Status <= 0x3F)))
{
- BCM_DEBUG_PRINT(psIntfAdapter->psAdapter,DBG_TYPE_RX, RX_CTRL, DBG_LVL_ALL, "Recived control pkt...");
+ BCM_DEBUG_PRINT(psIntfAdapter->psAdapter,DBG_TYPE_RX, RX_CTRL, DBG_LVL_ALL, "Received control pkt...");
*(PUSHORT)skb->data = pLeader->Status;
memcpy(skb->data+sizeof(USHORT), urb->transfer_buffer +
(sizeof(LEADER)), pLeader->PLength);
@@ -142,7 +142,7 @@ static void read_bulk_callback(struct urb *urb)
* Data Packet, Format a proper Ethernet Header
* and give it to the stack
*/
- BCM_DEBUG_PRINT(psIntfAdapter->psAdapter,DBG_TYPE_RX, RX_DATA, DBG_LVL_ALL, "Recived Data pkt...");
+ BCM_DEBUG_PRINT(psIntfAdapter->psAdapter,DBG_TYPE_RX, RX_DATA, DBG_LVL_ALL, "Received Data pkt...");
skb_reserve(skb, 2 + SKB_RESERVE_PHS_BYTES);
memcpy(skb->data+ETH_HLEN, (PUCHAR)urb->transfer_buffer + sizeof(LEADER), pLeader->PLength);
skb->dev = Adapter->dev;
@@ -151,7 +151,7 @@ static void read_bulk_callback(struct urb *urb)
skb_put (skb, pLeader->PLength + ETH_HLEN);
Adapter->PackInfo[QueueIndex].uiTotalRxBytes+=pLeader->PLength;
Adapter->PackInfo[QueueIndex].uiThisPeriodRxBytes+= pLeader->PLength;
- BCM_DEBUG_PRINT(psIntfAdapter->psAdapter,DBG_TYPE_RX, RX_DATA, DBG_LVL_ALL, "Recived Data pkt of len :0x%X", pLeader->PLength);
+ BCM_DEBUG_PRINT(psIntfAdapter->psAdapter,DBG_TYPE_RX, RX_DATA, DBG_LVL_ALL, "Received Data pkt of len :0x%X", pLeader->PLength);
if(netif_running(Adapter->dev))
{
@@ -237,7 +237,7 @@ Input parameters: IN PMINI_ADAPTER Adapter - Miniport Adapter Context
Return: TRUE - If Rx was successful.
- Other - If an error occured.
+ Other - If an error occurred.
*/
BOOLEAN InterfaceRx (PS_INTERFACE_ADAPTER psIntfAdapter)
diff --git a/drivers/staging/bcm/Ioctl.h b/drivers/staging/bcm/Ioctl.h
index e4f8eb70be1e..f859cf1c47b0 100644
--- a/drivers/staging/bcm/Ioctl.h
+++ b/drivers/staging/bcm/Ioctl.h
@@ -241,7 +241,7 @@ typedef struct bulkwrmbuffer
typedef enum _FLASH2X_SECTION_VAL
{
- NO_SECTION_VAL = 0, //no section is choosen when absolute offset is given for RD/WR
+ NO_SECTION_VAL = 0, //no section is chosen when absolute offset is given for RD/WR
ISO_IMAGE1,
ISO_IMAGE2,
DSD0,
diff --git a/drivers/staging/bcm/LeakyBucket.c b/drivers/staging/bcm/LeakyBucket.c
index f4cf41c0e46b..a55d4228e8e0 100644
--- a/drivers/staging/bcm/LeakyBucket.c
+++ b/drivers/staging/bcm/LeakyBucket.c
@@ -213,7 +213,7 @@ static VOID CheckAndSendPacketFromIndex(PMINI_ADAPTER Adapter, PacketInfo *psSF)
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, "For Queue: %zd\n", psSF-Adapter->PackInfo);
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, "\nAvailable Tokens = %d required = %d\n",
psSF->uiCurrentTokenCount, iPacketLen);
- //this part indicates that becuase of non-availability of the tokens
+ //this part indicates that because of non-availability of the tokens
//pkt has not been send out hence setting the pending flag indicating the host to send it out
//first next iteration .
psSF->uiPendedLast = TRUE;
diff --git a/drivers/staging/bcm/Misc.c b/drivers/staging/bcm/Misc.c
index d624f35d0551..c5003b62234c 100644
--- a/drivers/staging/bcm/Misc.c
+++ b/drivers/staging/bcm/Misc.c
@@ -602,7 +602,7 @@ VOID LinkControlResponseMessage(PMINI_ADAPTER Adapter,PUCHAR pucBuffer)
Adapter->LinkStatus=LINKUP_DONE;
Adapter->bPHSEnabled = *(pucBuffer+3);
Adapter->bETHCSEnabled = *(pucBuffer+4) & ETH_CS_MASK;
- BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "PHS Support Status Recieved In LinkUp Ack : %x \n",Adapter->bPHSEnabled);
+ BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0, "PHS Support Status Received In LinkUp Ack : %x \n",Adapter->bPHSEnabled);
if((FALSE == Adapter->bShutStatus)&&
(FALSE == Adapter->IdleMode))
{
@@ -1153,7 +1153,7 @@ int InitCardAndDownloadFirmware(PMINI_ADAPTER ps_adapter)
/*
* 1. If the LED Settings fails, do not stop and do the Firmware download.
- * 2. This init would happend only if the cfg file is present, else
+ * 2. This init would happened only if the cfg file is present, else
* call from the ioctl context.
*/
@@ -1185,7 +1185,7 @@ int InitCardAndDownloadFirmware(PMINI_ADAPTER ps_adapter)
status = PropagateCalParamsFromFlashToMemory(ps_adapter);
if(status)
{
- BCM_DEBUG_PRINT(ps_adapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL," Propogation of Cal param failed .." );
+ BCM_DEBUG_PRINT(ps_adapter,DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL," Propagation of Cal param failed .." );
goto OUT;
}
}
diff --git a/drivers/staging/bcm/Qos.c b/drivers/staging/bcm/Qos.c
index feade9451b2e..c97020f0fb6a 100644
--- a/drivers/staging/bcm/Qos.c
+++ b/drivers/staging/bcm/Qos.c
@@ -727,7 +727,7 @@ static BOOLEAN EthCSMatchVLANRules(S_CLASSIFIER_RULE *pstClassifierRule,struct s
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "%s CLS UserPrio:%x CLS VLANID:%x\n",__FUNCTION__,ntohs(*((USHORT *)pstClassifierRule->usUserPriority)),pstClassifierRule->usVLANID);
- /* In case FW didn't recieve the TLV, the priority field should be ignored */
+ /* In case FW didn't receive the TLV, the priority field should be ignored */
if(pstClassifierRule->usValidityBitMap & (1<<PKT_CLASSIFICATION_USER_PRIORITY_VALID))
{
if(pstEthCsPktInfo->eNwpktEthFrameType!=eEth802QVLANFrame)
diff --git a/drivers/staging/bcm/cntrl_SignalingInterface.h b/drivers/staging/bcm/cntrl_SignalingInterface.h
index 890778450a86..ab131806e2c9 100644
--- a/drivers/staging/bcm/cntrl_SignalingInterface.h
+++ b/drivers/staging/bcm/cntrl_SignalingInterface.h
@@ -21,7 +21,7 @@
#define VENDOR_PHS_PARAM_LENGTH 10
#define MAX_NUM_ACTIVE_BS 10
#define AUTH_TOKEN_LENGTH 10
-#define NUM_HARQ_CHANNELS 16 //Changed from 10 to 16 to accomodate all HARQ channels
+#define NUM_HARQ_CHANNELS 16 //Changed from 10 to 16 to accommodate all HARQ channels
#define VENDOR_CLASSIFIER_PARAM_LENGTH 1 //Changed the size to 1 byte since we dnt use it
#define VENDOR_SPECIF_QOS_PARAM 1
#define VENDOR_PHS_PARAM_LENGTH 10
@@ -109,13 +109,13 @@ typedef struct _stPhsRuleSI {
B_UINT8 u8PHSI;
/** PHSF Length Of The Service Flow*/
B_UINT8 u8PHSFLength;
- /** String of bytes containing header information to be supressed by the sending CS and reconstructed by the receiving CS*/
+ /** String of bytes containing header information to be suppressed by the sending CS and reconstructed by the receiving CS*/
B_UINT8 u8PHSF[MAX_PHS_LENGTHS];
/** PHSM Length Of The Service Flow*/
B_UINT8 u8PHSMLength;
/** PHS Mask for the SF*/
B_UINT8 u8PHSM[MAX_PHS_LENGTHS];
- /** 8bit Total number of bytes to be supressed for the Service Flow*/
+ /** 8bit Total number of bytes to be suppressed for the Service Flow*/
B_UINT8 u8PHSS;
/** 8bit Indicates whether or not Packet Header contents need to be verified prior to supression */
B_UINT8 u8PHSV;
diff --git a/drivers/staging/bcm/nvm.c b/drivers/staging/bcm/nvm.c
index c7292373a65f..4da5b7b54a1a 100644
--- a/drivers/staging/bcm/nvm.c
+++ b/drivers/staging/bcm/nvm.c
@@ -313,7 +313,7 @@ INT ReadMacAddressFromNVM(PMINI_ADAPTER Adapter)
// uiNumBytes - Number of bytes to be read from the EEPROM.
//
// Returns:
-// OSAL_STATUS_SUCCESS - if EEPROM read is successfull.
+// OSAL_STATUS_SUCCESS - if EEPROM read is successful.
// <FAILURE> - if failed.
//-----------------------------------------------------------------------------
@@ -431,7 +431,7 @@ INT BeceemEEPROMBulkRead(
// uiNumBytes - Number of bytes to be read from the FLASH.
//
// Returns:
-// OSAL_STATUS_SUCCESS - if FLASH read is successfull.
+// OSAL_STATUS_SUCCESS - if FLASH read is successful.
// <FAILURE> - if failed.
//-----------------------------------------------------------------------------
@@ -1174,7 +1174,7 @@ static INT BeceemFlashBulkWrite(
if(NULL == pTempBuff)
goto BeceemFlashBulkWrite_EXIT;
//
-// check if the data to be written is overlapped accross sectors
+// check if the data to be written is overlapped across sectors
//
if(uiOffset+uiNumBytes < uiSectBoundary)
{
@@ -1390,7 +1390,7 @@ static INT BeceemFlashBulkWriteStatus(
goto BeceemFlashBulkWriteStatus_EXIT;
//
-// check if the data to be written is overlapped accross sectors
+// check if the data to be written is overlapped across sectors
//
if(uiOffset+uiNumBytes < uiSectBoundary)
{
@@ -2020,7 +2020,7 @@ INT BeceemEEPROMBulkWrite(
// uiNumBytes - Number of bytes to be read from the NVM.
//
// Returns:
-// OSAL_STATUS_SUCCESS - if NVM read is successfull.
+// OSAL_STATUS_SUCCESS - if NVM read is successful.
// <FAILURE> - if failed.
//-----------------------------------------------------------------------------
@@ -2083,7 +2083,7 @@ INT BeceemNVMRead(
// uiNumBytes - Number of bytes to be written..
//
// Returns:
-// OSAL_STATUS_SUCCESS - if NVM write is successfull.
+// OSAL_STATUS_SUCCESS - if NVM write is successful.
// <FAILURE> - if failed.
//-----------------------------------------------------------------------------
@@ -2218,7 +2218,7 @@ INT BeceemNVMWrite(
// uiSectorSize - sector size
//
// Returns:
-// OSAL_STATUS_SUCCESS - if NVM write is successfull.
+// OSAL_STATUS_SUCCESS - if NVM write is successful.
// <FAILURE> - if failed.
//-----------------------------------------------------------------------------
@@ -2430,7 +2430,7 @@ INT BcmInitNVM(PMINI_ADAPTER ps_adapter)
*Input Parameter:
* Adapter data structure
*Return Value :
-* 0. means sucess;
+* 0. means success;
*/
/***************************************************************************/
@@ -2998,7 +2998,7 @@ INT BcmGetSectionValStartOffset(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlas
/*
* Considering all the section for which end offset can be calculated or directly given
* in CS Structure. if matching case does not exist, return STATUS_FAILURE indicating section
- * endoffset can't be calculated or given in CS Stucture.
+ * endoffset can't be calculated or given in CS Structure.
*/
INT SectStartOffset = 0 ;
@@ -3173,7 +3173,7 @@ INT BcmGetSectionValEndOffset(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlash2
* @uiNumBytes : Number of Bytes for Read
*
* Return value:-
-* return true on sucess and STATUS_FAILURE on fail.
+* return true on success and STATUS_FAILURE on fail.
*/
INT BcmFlash2xBulkRead(
@@ -3241,7 +3241,7 @@ INT BcmFlash2xBulkRead(
* @uiNumBytes : Number of Bytes for Write
*
* Return value:-
-* return true on sucess and STATUS_FAILURE on fail.
+* return true on success and STATUS_FAILURE on fail.
*
*/
@@ -3308,7 +3308,7 @@ INT BcmFlash2xBulkWrite(
* @Adapter :-Drivers private Data Structure
*
* Return Value:-
-* Return STATUS_SUCESS if get sucess in setting the right DSD else negaive error code
+* Return STATUS_SUCESS if get success in setting the right DSD else negaive error code
*
**/
static INT BcmGetActiveDSD(PMINI_ADAPTER Adapter)
@@ -3384,7 +3384,7 @@ static INT BcmGetActiveISO(PMINI_ADAPTER Adapter)
* @uiOffset : Offset provided in the Flash
*
* Return Value:-
-* Sucess:-TRUE , offset is writable
+* Success:-TRUE , offset is writable
* Failure:-FALSE, offset is RO
*
**/
@@ -3441,7 +3441,7 @@ static INT BcmDumpFlash2xSectionBitMap(PFLASH2X_BITMAP psFlash2xBitMap)
@Adapter:-Driver private Data Structure
*
* Return value:-
-* Sucess:- STATUS_SUCESS
+* Success:- STATUS_SUCESS
* Failure:- negative error code
**/
@@ -3783,7 +3783,7 @@ INT BcmSetActiveSection(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlash2xSectV
// This is a SPECIAL Case which will only happen if the current highest priority ISO has priority value = 0x7FFFFFFF.
// We will write 1 to the current Highest priority ISO And then shall increase the priority of the requested ISO
// by user
- BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "SectImagePriority wraparound happend, eFlash2xSectVal: 0x%x\n",eFlash2xSectVal);
+ BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, NVM_RW, DBG_LVL_ALL, "SectImagePriority wraparound happened, eFlash2xSectVal: 0x%x\n",eFlash2xSectVal);
SectImagePriority = htonl(0x1);
Status = BcmFlash2xBulkWrite(Adapter,
&SectImagePriority,
@@ -3853,7 +3853,7 @@ INT BcmSetActiveSection(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlash2xSectV
// This is a SPECIAL Case which will only happen if the current highest priority DSD has priority value = 0x7FFFFFFF.
// We will write 1 to the current Highest priority DSD And then shall increase the priority of the requested DSD
// by user
- BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, NVM_RW, DBG_LVL_ALL, "SectImagePriority wraparound happend, eFlash2xSectVal: 0x%x\n",eFlash2xSectVal);
+ BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, NVM_RW, DBG_LVL_ALL, "SectImagePriority wraparound happened, eFlash2xSectVal: 0x%x\n",eFlash2xSectVal);
SectImagePriority = htonl(0x1);
Status = BcmFlash2xBulkWrite(Adapter,
@@ -4119,7 +4119,7 @@ INT BcmCopyISO(PMINI_ADAPTER Adapter, FLASH2X_COPY_SECTION sCopySectStrut)
MAX_RW_SIZE);
IsThisHeaderSector = FALSE ;
}
- //substracting the written Data
+ //subtracting the written Data
uiTotalDataToCopy = uiTotalDataToCopy - Adapter->uiSectorSize ;
}
@@ -4250,7 +4250,7 @@ INT BcmCopyISO(PMINI_ADAPTER Adapter, FLASH2X_COPY_SECTION sCopySectStrut)
IsThisHeaderSector = FALSE ;
}
- //substracting the written Data
+ //subtracting the written Data
uiTotalDataToCopy = uiTotalDataToCopy - Adapter->uiSectorSize ;
}
@@ -4268,7 +4268,7 @@ BcmFlash2xCorruptSig : this API is used to corrupt the written sig in Bcm Header
@eFlash2xSectionVal :- Flash section val which has header
Return Value :-
- Sucess :- If Section is present and writable, corrupt the sig and return STATUS_SUCCESS
+ Success :- If Section is present and writable, corrupt the sig and return STATUS_SUCCESS
Failure :-Return negative error code
@@ -4301,7 +4301,7 @@ BcmFlash2xWriteSig :-this API is used to Write the sig if requested Section has
@eFlashSectionVal :- Flash section val which has header
Return Value :-
- Sucess :- If Section is present and writable write the sig and return STATUS_SUCCESS
+ Success :- If Section is present and writable write the sig and return STATUS_SUCCESS
Failure :-Return negative error code
**/
@@ -4504,7 +4504,7 @@ BcmCopySection :- This API is used to copy the One section in another. Both sect
in case of numofBytes equal zero complete section will be copied.
Return Values-
- Sucess : Return STATUS_SUCCESS
+ Success : Return STATUS_SUCCESS
Faillure :- return negative error code
**/
@@ -4621,7 +4621,7 @@ SaveHeaderIfPresent :- This API is use to Protect the Header in case of Header S
@uiOffset :- Flash offset that has to be written.
Return value :-
- Sucess :- On sucess return STATUS_SUCCESS
+ Success :- On success return STATUS_SUCCESS
Faillure :- Return negative error code
**/
@@ -4634,7 +4634,7 @@ INT SaveHeaderIfPresent(PMINI_ADAPTER Adapter, PUCHAR pBuff, UINT uiOffset)
UINT uiSectAlignAddr = 0;
UINT sig = 0;
- //making the offset sector alligned
+ //making the offset sector aligned
uiSectAlignAddr = uiOffset & ~(Adapter->uiSectorSize - 1);
@@ -4643,7 +4643,7 @@ INT SaveHeaderIfPresent(PMINI_ADAPTER Adapter, PUCHAR pBuff, UINT uiOffset)
(uiSectAlignAddr == BcmGetSectionValEndOffset(Adapter,DSD0)- Adapter->uiSectorSize))
{
- //offset from the sector boundry having the header map
+ //offset from the sector boundary having the header map
offsetToProtect = Adapter->psFlash2xCSInfo->OffsetFromDSDStartForDSDHeader % Adapter->uiSectorSize;
HeaderSizeToProtect = sizeof(DSD_HEADER);
bHasHeader = TRUE ;
@@ -4697,7 +4697,7 @@ BcmDoChipSelect : This will selcet the appropriate chip for writing.
@Adapater :- Bcm Driver Private Data Structure
OutPut:-
- Select the Appropriate chip and retrn status Sucess
+ Select the Appropriate chip and retrn status Success
**/
static INT BcmDoChipSelect(PMINI_ADAPTER Adapter, UINT offset)
{
@@ -5086,7 +5086,7 @@ static INT CorruptDSDSig(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlash2xSect
{
if(IsSectionWritable(Adapter,eFlash2xSectionVal) != TRUE)
{
- BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Section is not Writable...Hence cant Corrupt signature");
+ BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Section is not Writable...Hence can't Corrupt signature");
return SECTOR_IS_NOT_WRITABLE;
}
}
@@ -5155,7 +5155,7 @@ static INT CorruptISOSig(PMINI_ADAPTER Adapter, FLASH2X_SECTION_VAL eFlash2xSect
if(IsSectionWritable(Adapter,eFlash2xSectionVal) != TRUE)
{
- BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Section is not Writable...Hence cant Corrupt signature");
+ BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Section is not Writable...Hence can't Corrupt signature");
return SECTOR_IS_NOT_WRITABLE;
}
diff --git a/drivers/staging/brcm80211/README b/drivers/staging/brcm80211/README
index 99e67669f26b..f8facb0786ec 100644
--- a/drivers/staging/brcm80211/README
+++ b/drivers/staging/brcm80211/README
@@ -71,7 +71,7 @@ the driver. The devices use a single worldwide regulatory domain, with channels
passive operation. Transmission on those channels is suppressed until
appropriate other traffic is observed on those channels.
-Within the driver, we use the ficticious country code "X2" to represent this
+Within the driver, we use the fictitious country code "X2" to represent this
worldwide regulatory domain. There is currently no interface to configure a
different domain.
diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh_linux.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh_linux.c
index e3556ff43bb9..ac5bbc8722e5 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmsdh_linux.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh_linux.c
@@ -341,7 +341,7 @@ int bcmsdh_register_oob_intr(void *dhdp)
if (error)
return -ENODEV;
- set_irq_wake(sdhcinfo->oob_irq, 1);
+ irq_set_irq_wake(sdhcinfo->oob_irq, 1);
sdhcinfo->oob_irq_registered = true;
}
@@ -352,7 +352,7 @@ void bcmsdh_unregister_oob_intr(void)
{
SDLX_MSG(("%s: Enter\n", __func__));
- set_irq_wake(sdhcinfo->oob_irq, 0);
+ irq_set_irq_wake(sdhcinfo->oob_irq, 0);
disable_irq(sdhcinfo->oob_irq); /* just in case.. */
free_irq(sdhcinfo->oob_irq, NULL);
sdhcinfo->oob_irq_registered = false;
diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
index 65313fa0cf4a..71c3571ee143 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
@@ -264,7 +264,7 @@ extern SDIOH_API_RC sdioh_disable_func_intr(void)
}
#endif /* defined(OOB_INTR_ONLY) && defined(HW_OOB) */
-/* Configure callback to client when we recieve client interrupt */
+/* Configure callback to client when we receive client interrupt */
extern SDIOH_API_RC
sdioh_interrupt_register(sdioh_info_t *sd, sdioh_cb_fn_t fn, void *argh)
{
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_custom_gpio.c b/drivers/staging/brcm80211/brcmfmac/dhd_custom_gpio.c
index cbfa1c1b7059..1cf6c5dc2bb7 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_custom_gpio.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_custom_gpio.c
@@ -46,7 +46,7 @@ extern int sdioh_mmc_irq(int irq);
#include <mach/gpio.h>
#endif
-/* Customer specific Host GPIO defintion */
+/* Customer specific Host GPIO definition */
static int dhd_oob_gpio_num = -1; /* GG 19 */
module_param(dhd_oob_gpio_num, int, 0644);
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
index 02c6d446934c..dd0375793875 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
@@ -478,7 +478,7 @@ static int dhd_set_suspend(int value, dhd_pub_t *dhd)
dhd_set_packet_filter(1, dhd);
/* if dtim skip setup as default force it
- * to wake each thrid dtim
+ * to wake each third dtim
* for better power saving.
* Note that side effect is chance to miss BC/MC
* packet
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
index 106627040db0..464f52af1315 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
@@ -3659,7 +3659,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
* control pkt receives.
* Later we use buffer-poll for data as well
* as control packets.
- * This is required becuase dhd receives full
+ * This is required because dhd receives full
* frame in gSPI unlike SDIO.
* After the frame is received we have to
* distinguish whether it is data
@@ -3744,7 +3744,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
bus->dhd->rx_errors++;
dhd_os_sdunlock_rxq(bus->dhd);
/* Force retry w/normal header read.
- * Don't attemp NAK for
+ * Don't attempt NAK for
* gSPI
*/
dhdsdio_rxfail(bus, true,
diff --git a/drivers/staging/brcm80211/brcmsmac/wl_mac80211.c b/drivers/staging/brcm80211/brcmsmac/wl_mac80211.c
index 774b4e916b29..c1b07ae31674 100644
--- a/drivers/staging/brcm80211/brcmsmac/wl_mac80211.c
+++ b/drivers/staging/brcm80211/brcmsmac/wl_mac80211.c
@@ -1079,7 +1079,7 @@ static int ieee_hw_init(struct ieee80211_hw *hw)
*/
hw->max_rates = 2; /* Primary rate and 1 fallback rate */
- hw->channel_change_time = 7 * 1000; /* channel change time is dependant on chip and band */
+ hw->channel_change_time = 7 * 1000; /* channel change time is dependent on chip and band */
hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
hw->rate_control_algorithm = "minstrel_ht";
diff --git a/drivers/staging/brcm80211/brcmsmac/wlc_ampdu.c b/drivers/staging/brcm80211/brcmsmac/wlc_ampdu.c
index c6cdcd940956..f00865957881 100644
--- a/drivers/staging/brcm80211/brcmsmac/wlc_ampdu.c
+++ b/drivers/staging/brcm80211/brcmsmac/wlc_ampdu.c
@@ -89,7 +89,7 @@ u32 wl_ampdu_dbg =
/* structure to hold tx fifo information and pre-loading state
* counters specific to tx underflows of ampdus
* some counters might be redundant with the ones in wlc or ampdu structures.
- * This allows to maintain a specific state independantly of
+ * This allows to maintain a specific state independently of
* how often and/or when the wlc counters are updated.
*/
typedef struct wlc_fifo_info {
@@ -265,7 +265,7 @@ static void scb_ampdu_update_config(struct ampdu_info *ampdu, struct scb *scb)
scb_ampdu->max_pdu = (u8) ampdu->wlc->pub->tunables->ampdunummpdu;
- /* go back to legacy size if some preloading is occuring */
+ /* go back to legacy size if some preloading is occurring */
for (i = 0; i < NUM_FFPLD_FIFO; i++) {
if (ampdu->fifo_tb[i].ampdu_pld_size > FFPLD_PLD_INCR)
scb_ampdu->max_pdu = AMPDU_NUM_MPDU_LEGACY;
@@ -406,7 +406,7 @@ static int wlc_ffpld_check_txfunfl(struct wlc_info *wlc, int fid)
/*
compute a new dma xfer rate for max_mpdu @ max mcs.
This is the minimum dma rate that
- can acheive no unferflow condition for the current mpdu size.
+ can achieve no unferflow condition for the current mpdu size.
*/
/* note : we divide/multiply by 100 to avoid integer overflows */
fifo->dmaxferrate =
diff --git a/drivers/staging/brcm80211/brcmsmac/wlc_bmac.c b/drivers/staging/brcm80211/brcmsmac/wlc_bmac.c
index 5a96dc3cdb36..4b6e181c7dc9 100644
--- a/drivers/staging/brcm80211/brcmsmac/wlc_bmac.c
+++ b/drivers/staging/brcm80211/brcmsmac/wlc_bmac.c
@@ -1915,7 +1915,7 @@ void wlc_bmac_phy_reset(struct wlc_hw_info *wlc_hw)
phy_bw_clkbits = wlc_phy_clk_bwbits(wlc_hw->band->pi);
- /* Specfic reset sequence required for NPHY rev 3 and 4 */
+ /* Specific reset sequence required for NPHY rev 3 and 4 */
if (WLCISNPHY(wlc_hw->band) && NREV_GE(wlc_hw->band->phyrev, 3) &&
NREV_LE(wlc_hw->band->phyrev, 4)) {
/* Set the PHY bandwidth */
diff --git a/drivers/staging/brcm80211/brcmsmac/wlc_main.c b/drivers/staging/brcm80211/brcmsmac/wlc_main.c
index 639b5d7c9603..ab7ab850e199 100644
--- a/drivers/staging/brcm80211/brcmsmac/wlc_main.c
+++ b/drivers/staging/brcm80211/brcmsmac/wlc_main.c
@@ -6283,7 +6283,7 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
((preamble_type[1] == WLC_MM_PREAMBLE) ==
(txh->MModeFbrLen != 0)));
- ac = wme_fifo2ac[queue];
+ ac = skb_get_queue_mapping(p);
if (SCB_WME(scb) && qos && wlc->edcf_txop[ac]) {
uint frag_dur, dur, dur_fallback;
@@ -6919,8 +6919,7 @@ prep_mac80211_status(struct wlc_info *wlc, d11rxhdr_t *rxh, struct sk_buff *p,
preamble = 0;
if (IS_CCK(rspec)) {
if (rxh->PhyRxStatus_0 & PRXS0_SHORTH)
- WL_ERROR("Short CCK\n");
- rx_status->flag |= RX_FLAG_SHORTPRE;
+ rx_status->flag |= RX_FLAG_SHORTPRE;
} else if (IS_OFDM(rspec)) {
rx_status->flag |= RX_FLAG_SHORTPRE;
} else {
@@ -7079,10 +7078,8 @@ void BCMFASTPATH wlc_recv(struct wlc_info *wlc, struct sk_buff *p)
if (ieee80211_is_probe_req(h->frame_control))
goto toss;
- if (is_amsdu) {
- WL_ERROR("%s: is_amsdu causing toss\n", __func__);
+ if (is_amsdu)
goto toss;
- }
wlc_recvctl(wlc, rxh, p);
return;
@@ -8295,7 +8292,7 @@ wlc_txflowcontrol_prio_isset(struct wlc_info *wlc, struct wlc_txq_info *q,
return (q->stopped & prio_mask) == prio_mask;
}
-/* propogate the flow control to all interfaces using the given tx queue */
+/* propagate the flow control to all interfaces using the given tx queue */
void wlc_txflowcontrol(struct wlc_info *wlc, struct wlc_txq_info *qi,
bool on, int prio)
{
@@ -8462,7 +8459,7 @@ static void wlc_txq_free(struct wlc_info *wlc, struct wlc_txq_info *qi)
}
/*
- * Flag 'scan in progress' to withold dynamic phy calibration
+ * Flag 'scan in progress' to withhold dynamic phy calibration
*/
void wlc_scan_start(struct wlc_info *wlc)
{
diff --git a/drivers/staging/brcm80211/brcmsmac/wlc_rate.c b/drivers/staging/brcm80211/brcmsmac/wlc_rate.c
index 0cfa36023cf1..d284f1ac49cc 100644
--- a/drivers/staging/brcm80211/brcmsmac/wlc_rate.c
+++ b/drivers/staging/brcm80211/brcmsmac/wlc_rate.c
@@ -332,7 +332,7 @@ wlc_rate_hwrs_filter_sort_validate(wlc_rateset_t *rs,
return false;
}
-/* caluclate the rate of a rx'd frame and return it as a ratespec */
+/* calculate the rate of a rx'd frame and return it as a ratespec */
ratespec_t BCMFASTPATH wlc_compute_rspec(d11rxhdr_t *rxh, u8 *plcp)
{
int phy_type;
diff --git a/drivers/staging/brcm80211/include/bcmsrom_fmt.h b/drivers/staging/brcm80211/include/bcmsrom_fmt.h
index ae2bff828607..4768968f910a 100644
--- a/drivers/staging/brcm80211/include/bcmsrom_fmt.h
+++ b/drivers/staging/brcm80211/include/bcmsrom_fmt.h
@@ -103,7 +103,7 @@
#define SROM_CRCREV 63
-/* SROM Rev 4: Reallocate the software part of the srom to accomodate
+/* SROM Rev 4: Reallocate the software part of the srom to accommodate
* MIMO features. It assumes up to two PCIE functions and 440 bytes
* of useable srom i.e. the useable storage in chips with OTP that
* implements hardware redundancy.
diff --git a/drivers/staging/brcm80211/include/hndsoc.h b/drivers/staging/brcm80211/include/hndsoc.h
index 9747cc46ca96..6435686b329f 100644
--- a/drivers/staging/brcm80211/include/hndsoc.h
+++ b/drivers/staging/brcm80211/include/hndsoc.h
@@ -181,7 +181,7 @@
* conventions for the use the flash space:
*/
-/* Minumum amount of flash we support */
+/* Minimum amount of flash we support */
#define FLASH_MIN 0x00020000 /* Minimum flash size */
/* A boot/binary may have an embedded block that describes its size */
diff --git a/drivers/staging/brcm80211/util/bcmotp.c b/drivers/staging/brcm80211/util/bcmotp.c
index ba71c108b366..17991212a22d 100644
--- a/drivers/staging/brcm80211/util/bcmotp.c
+++ b/drivers/staging/brcm80211/util/bcmotp.c
@@ -213,7 +213,7 @@ static u16 ipxotp_read_bit(void *oh, chipcregs_t *cc, uint off)
return (int)st;
}
-/* Calculate max HW/SW region byte size by substracting fuse region and checksum size,
+/* Calculate max HW/SW region byte size by subtracting fuse region and checksum size,
* osizew is oi->wsize (OTP size - GU size) in words
*/
static int ipxotp_max_rgnsz(si_t *sih, int osizew)
@@ -229,7 +229,7 @@ static int ipxotp_max_rgnsz(si_t *sih, int osizew)
ret = osizew * 2 - OTP_SZ_FU_72 - OTP_SZ_CHECKSUM;
break;
default:
- ASSERT(0); /* Don't konw about this chip */
+ ASSERT(0); /* Don't know about this chip */
}
return ret;
diff --git a/drivers/staging/brcm80211/util/bcmsrom.c b/drivers/staging/brcm80211/util/bcmsrom.c
index eca35b94e96c..850bfa6593e0 100644
--- a/drivers/staging/brcm80211/util/bcmsrom.c
+++ b/drivers/staging/brcm80211/util/bcmsrom.c
@@ -1859,7 +1859,7 @@ static int initvars_srom_pci(si_t *sih, void *curmap, char **vars, uint *count)
/*
* Apply CRC over SROM content regardless SROM is present or not,
- * and use variable <devpath>sromrev's existance in flash to decide
+ * and use variable <devpath>sromrev's existence in flash to decide
* if we should return an error when CRC fails or read SROM variables
* from flash.
*/
diff --git a/drivers/staging/brcm80211/util/hnddma.c b/drivers/staging/brcm80211/util/hnddma.c
index 8a81eb997f99..be339feae77d 100644
--- a/drivers/staging/brcm80211/util/hnddma.c
+++ b/drivers/staging/brcm80211/util/hnddma.c
@@ -1179,7 +1179,7 @@ static void BCMFASTPATH dma64_txreclaim(dma_info_t *di, txd_range_t range)
(range == HNDDMA_RANGE_ALL) ? "all" :
((range ==
HNDDMA_RANGE_TRANSMITTED) ? "transmitted" :
- "transfered")));
+ "transferred")));
if (di->txin == di->txout)
return;
@@ -1549,7 +1549,7 @@ static int BCMFASTPATH dma64_txfast(dma_info_t *di, struct sk_buff *p0,
* If range is HNDDMA_RANGE_TRANSMITTED, reclaim descriptors that have be
* transmitted as noted by the hardware "CurrDescr" pointer.
* If range is HNDDMA_RANGE_TRANSFERED, reclaim descriptors that have be
- * transfered by the DMA as noted by the hardware "ActiveDescr" pointer.
+ * transferred by the DMA as noted by the hardware "ActiveDescr" pointer.
* If range is HNDDMA_RANGE_ALL, reclaim all txd(s) posted to the ring and
* return associated packet regardless of the value of hardware pointers.
*/
@@ -1563,7 +1563,7 @@ static void *BCMFASTPATH dma64_getnexttxp(dma_info_t *di, txd_range_t range)
(range == HNDDMA_RANGE_ALL) ? "all" :
((range ==
HNDDMA_RANGE_TRANSMITTED) ? "transmitted" :
- "transfered")));
+ "transferred")));
if (di->ntxd == 0)
return NULL;
diff --git a/drivers/staging/brcm80211/util/sbpcmcia.h b/drivers/staging/brcm80211/util/sbpcmcia.h
index 6b9923f551a9..d4c156586e81 100644
--- a/drivers/staging/brcm80211/util/sbpcmcia.h
+++ b/drivers/staging/brcm80211/util/sbpcmcia.h
@@ -109,7 +109,7 @@
#define CISTPL_CFTABLE 0x1b /* Config table entry */
#define CISTPL_END 0xff /* End of the CIS tuple chain */
-/* Function identifier provides context for the function extentions tuple */
+/* Function identifier provides context for the function extensions tuple */
#define CISTPL_FID_SDIO 0x0c /* Extensions defined by SDIO spec */
/* Function extensions for LANs (assumed for extensions other than SDIO) */
diff --git a/drivers/staging/brcm80211/util/siutils.c b/drivers/staging/brcm80211/util/siutils.c
index ed168ceba5f0..6ebd7f58af81 100644
--- a/drivers/staging/brcm80211/util/siutils.c
+++ b/drivers/staging/brcm80211/util/siutils.c
@@ -1319,7 +1319,7 @@ int si_clkctl_xtal(si_t *sih, uint what, bool on)
}
/*
- * clock control policy function throught chipcommon
+ * clock control policy function through chipcommon
*
* set dynamic clk control mode (forceslow, forcefast, dynamic)
* returns true if we are forcing fast clock
diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
index a4ceb29c358e..e7e72b8d8cde 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -2064,7 +2064,7 @@ void comedi_event(struct comedi_device *dev, struct comedi_subdevice *s)
COMEDI_CB_OVERFLOW)) {
runflags_mask |= SRF_RUNNING;
}
- /* remember if an error event has occured, so an error
+ /* remember if an error event has occurred, so an error
* can be returned the next time the user does a read() */
if (s->async->events & (COMEDI_CB_ERROR | COMEDI_CB_OVERFLOW)) {
runflags_mask |= SRF_ERROR;
diff --git a/drivers/staging/comedi/drivers/addi-data/APCI1710_Chrono.c b/drivers/staging/comedi/drivers/addi-data/APCI1710_Chrono.c
index 644bda44556e..482a412aa652 100644
--- a/drivers/staging/comedi/drivers/addi-data/APCI1710_Chrono.c
+++ b/drivers/staging/comedi/drivers/addi-data/APCI1710_Chrono.c
@@ -124,9 +124,9 @@ You should also find the complete GPL in the COPYING file accompanying this sour
| -5: The selected PCI input clock is wrong |
| -6: Timing unity selection is wrong |
| -7: Base timing selection is wrong |
-| -8: You can not used the 40MHz clock selection wich |
+| -8: You can not used the 40MHz clock selection with |
| this board |
-| -9: You can not used the 40MHz clock selection wich |
+| -9: You can not used the 40MHz clock selection with |
| this CHRONOS version |
+----------------------------------------------------------------------------+
*/
@@ -721,10 +721,10 @@ int i_APCI1710_InsnConfigInitChrono(struct comedi_device *dev, struct comedi_sub
}
} else {
/**************************************************************/
- /* You can not used the 40MHz clock selection wich this board */
+ /* You can not use the 40MHz clock selection with this board */
/**************************************************************/
- DPRINTK("You can not used the 40MHz clock selection wich this board\n");
+ DPRINTK("You can not used the 40MHz clock selection with this board\n");
i_ReturnValue =
-8;
}
diff --git a/drivers/staging/comedi/drivers/addi-data/addi_amcc_S5920.c b/drivers/staging/comedi/drivers/addi-data/addi_amcc_S5920.c
index 90e71e12784a..b973095146f9 100644
--- a/drivers/staging/comedi/drivers/addi-data/addi_amcc_S5920.c
+++ b/drivers/staging/comedi/drivers/addi-data/addi_amcc_S5920.c
@@ -59,7 +59,7 @@ You should also find the complete GPL in the COPYING file accompanying this sour
/*+----------------------------------------------------------------------------+*/
/*| Input Parameters : int i_NbOfWordsToRead : Nbr. of word to read |*/
/*| unsigned int dw_PCIBoardEepromAddress : Address of the eeprom |*/
-/*| unsigned short w_EepromStartAddress : Eeprom strat address |*/
+/*| unsigned short w_EepromStartAddress : Eeprom start address |*/
/*+----------------------------------------------------------------------------+*/
/*| Output Parameters : unsigned short * pw_DataRead : Read data |*/
/*+----------------------------------------------------------------------------+*/
diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2032.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2032.c
index 9dd857df93c8..002297dfe33f 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2032.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2032.c
@@ -498,7 +498,7 @@ void v_APCI2032_Interrupt(int irq, void *d)
struct comedi_device *dev = d;
unsigned int ui_DO;
- ui_DO = inl(devpriv->iobase + APCI2032_DIGITAL_OP_IRQ) & 0x1; /* Check if VCC OR CC interrupt has occured. */
+ ui_DO = inl(devpriv->iobase + APCI2032_DIGITAL_OP_IRQ) & 0x1; /* Check if VCC OR CC interrupt has occurred. */
if (ui_DO == 0) {
printk("\nInterrupt from unKnown source\n");
diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
index a813fdbbd96e..fc61214151b7 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
@@ -148,7 +148,7 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device *dev, struct comedi_subd
unsigned short us_ConvertTiming, us_TmpValue, i;
unsigned char b_Tmp;
- /* fix convertion time to 10 us */
+ /* fix conversion time to 10 us */
if (!devpriv->ui_EocEosConversionTime) {
printk("No timer0 Value using 10 us\n");
us_ConvertTiming = 10;
@@ -251,7 +251,7 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device *dev, struct comedi_subd
APCI3120_SELECT_TIMER_0_WORD;
outb(b_Tmp, devpriv->iobase + APCI3120_TIMER_CRT0);
- /* Set the convertion time */
+ /* Set the conversion time */
outw(us_ConvertTiming,
devpriv->iobase + APCI3120_TIMER_VALUE);
@@ -311,7 +311,7 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device *dev, struct comedi_subd
APCI3120_SELECT_TIMER_0_WORD;
outb(b_Tmp, devpriv->iobase + APCI3120_TIMER_CRT0);
- /* Set the convertion time */
+ /* Set the conversion time */
outw(us_ConvertTiming,
devpriv->iobase + APCI3120_TIMER_VALUE);
@@ -354,9 +354,9 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device *dev, struct comedi_subd
/* Start conversion */
outw(0, devpriv->iobase + APCI3120_START_CONVERSION);
- /* Waiting of end of convertion if interrupt is not installed */
+ /* Waiting of end of conversion if interrupt is not installed */
if (devpriv->b_EocEosInterrupt == APCI3120_DISABLE) {
- /* Waiting the end of convertion */
+ /* Waiting the end of conversion */
do {
us_TmpValue =
inw(devpriv->iobase +
@@ -854,7 +854,7 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device *dev,
b_DigitalOutputRegister) & 0xF0) |
APCI3120_SELECT_TIMER_0_WORD;
outb(b_Tmp, dev->iobase + APCI3120_TIMER_CRT0);
- /* Set the convertion time */
+ /* Set the conversion time */
outw(((unsigned short) ui_TimerValue0),
dev->iobase + APCI3120_TIMER_VALUE);
break;
@@ -872,7 +872,7 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device *dev,
b_DigitalOutputRegister) & 0xF0) |
APCI3120_SELECT_TIMER_1_WORD;
outb(b_Tmp, dev->iobase + APCI3120_TIMER_CRT0);
- /* Set the convertion time */
+ /* Set the conversion time */
outw(((unsigned short) ui_TimerValue1),
dev->iobase + APCI3120_TIMER_VALUE);
@@ -889,7 +889,7 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device *dev,
APCI3120_SELECT_TIMER_0_WORD;
outb(b_Tmp, dev->iobase + APCI3120_TIMER_CRT0);
- /* Set the convertion time */
+ /* Set the conversion time */
outw(((unsigned short) ui_TimerValue0),
dev->iobase + APCI3120_TIMER_VALUE);
break;
@@ -1104,7 +1104,7 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device *dev,
/*
* 4
- * amount of bytes to be transfered set transfer count used ADDON
+ * amount of bytes to be transferred set transfer count used ADDON
* MWTC register commented testing
* outl(devpriv->ui_DmaBufferUsesize[0],
* devpriv->i_IobaseAddon+AMCC_OP_REG_AMWTC);
diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.h b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.h
index b3c81979f14d..50eb0a0a0a05 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.h
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.h
@@ -169,7 +169,7 @@ struct str_AnalogReadInformation {
unsigned char b_Type; /* EOC or EOS */
unsigned char b_InterruptFlag; /* Interrupt use or not */
- unsigned int ui_ConvertTiming; /* Selection of the convertion time */
+ unsigned int ui_ConvertTiming; /* Selection of the conversion time */
unsigned char b_NbrOfChannel; /* Number of channel to read */
unsigned int ui_ChannelList[MAX_ANALOGINPUT_CHANNELS]; /* Number of the channel to be read */
unsigned int ui_RangeList[MAX_ANALOGINPUT_CHANNELS]; /* Gain of each channel */
diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c
index a93e2349ad3a..c75a1a1fd775 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c
@@ -103,7 +103,7 @@ struct str_BoardInfos s_BoardInfos[100]; /* 100 will be the max number of board
/*+----------------------------------------------------------------------------+*/
/*| Input Parameters : int i_NbOfWordsToRead : Nbr. of word to read |*/
/*| unsigned int dw_PCIBoardEepromAddress : Address of the eeprom |*/
-/*| unsigned short w_EepromStartAddress : Eeprom strat address |*/
+/*| unsigned short w_EepromStartAddress : Eeprom start address |*/
/*+----------------------------------------------------------------------------+*/
/*| Output Parameters : unsigned short * pw_DataRead : Read data |*/
/*+----------------------------------------------------------------------------+*/
@@ -849,7 +849,7 @@ int i_APCI3200_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdev
| 0:Single Read
| 1:Read more channel
2:Single scan
- | 3:Continous Scan
+ | 3:Continuous Scan
data[13] :Number of channels to read
| data[14] :RTD connection type
:0:RTD not used
diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c
index 766103c882ad..632d5d0721cd 100644
--- a/drivers/staging/comedi/drivers/adl_pci9118.c
+++ b/drivers/staging/comedi/drivers/adl_pci9118.c
@@ -23,7 +23,7 @@ For AI:
- If cmd->scan_begin_src=TRIG_EXT then trigger input is TGIN (pin 46).
- If cmd->convert_src=TRIG_EXT then trigger input is EXTTRG (pin 44).
- If cmd->start_src/stop_src=TRIG_EXT then trigger input is TGIN (pin 46).
-- It is not neccessary to have cmd.scan_end_arg=cmd.chanlist_len but
+- It is not necessary to have cmd.scan_end_arg=cmd.chanlist_len but
cmd.scan_end_arg modulo cmd.chanlist_len must by 0.
- If return value of cmdtest is 5 then you've bad channel list
(it isn't possible mixture S.E. and DIFF inputs or bipolar and unipolar
@@ -823,7 +823,7 @@ static void interrupt_pci9118_ai_dma(struct comedi_device *dev,
move_block_from_dma(dev, s,
devpriv->dmabuf_virt[devpriv->dma_actbuf],
samplesinbuf);
- m = m - sampls; /* m= how many samples was transfered */
+ m = m - sampls; /* m= how many samples was transferred */
}
/* DPRINTK("YYY\n"); */
@@ -1297,7 +1297,7 @@ static int Compute_and_setup_dma(struct comedi_device *dev)
DPRINTK("3 dmalen0=%d dmalen1=%d\n", dmalen0, dmalen1);
/* transfer without TRIG_WAKE_EOS */
if (!(devpriv->ai_flags & TRIG_WAKE_EOS)) {
- /* if it's possible then allign DMA buffers to length of scan */
+ /* if it's possible then align DMA buffers to length of scan */
i = dmalen0;
dmalen0 =
(dmalen0 / (devpriv->ai_n_realscanlen << 1)) *
diff --git a/drivers/staging/comedi/drivers/adq12b.c b/drivers/staging/comedi/drivers/adq12b.c
index 4b470000b69c..5361f318b010 100644
--- a/drivers/staging/comedi/drivers/adq12b.c
+++ b/drivers/staging/comedi/drivers/adq12b.c
@@ -65,7 +65,7 @@ If you do not specify any options, they will default to
written by jeremy theler <thelerg@ib.cnea.gov.ar>
instituto balseiro
- comision nacional de energia atomica
+ commission nacional de energia atomica
universidad nacional de cuyo
argentina
@@ -342,7 +342,7 @@ static int adq12b_ai_rinsn(struct comedi_device *dev,
/* convert n samples */
for (n = 0; n < insn->n; n++) {
- /* wait for end of convertion */
+ /* wait for end of conversion */
i = 0;
do {
/* udelay(1); */
diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c
index 466e69f94ef2..da2b75b15d4e 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -98,7 +98,7 @@ Configuration options:
#define Status_FE 0x0100 /* 1=FIFO is empty */
#define Status_FH 0x0200 /* 1=FIFO is half full */
#define Status_FF 0x0400 /* 1=FIFO is full, fatal error */
-#define Status_IRQ 0x0800 /* 1=IRQ occured */
+#define Status_IRQ 0x0800 /* 1=IRQ occurred */
/* bits from control register (PCI171x_CONTROL) */
#define Control_CNT0 0x0040 /* 1=CNT0 have external source,
* 0=have internal 100kHz source */
@@ -1161,7 +1161,7 @@ static int check_channel_list(struct comedi_device *dev,
}
if (n_chan > 1) {
- chansegment[0] = chanlist[0]; /* first channel is everytime ok */
+ chansegment[0] = chanlist[0]; /* first channel is every time ok */
for (i = 1, seglen = 1; i < n_chan; i++, seglen++) { /* build part of chanlist */
/* printk("%d. %d %d\n",i,CR_CHAN(chanlist[i]),CR_RANGE(chanlist[i])); */
if (chanlist[0] == chanlist[i])
@@ -1176,9 +1176,9 @@ static int check_channel_list(struct comedi_device *dev,
(CR_CHAN(chansegment[i - 1]) + 1) % s->n_chan;
if (CR_AREF(chansegment[i - 1]) == AREF_DIFF)
nowmustbechan = (nowmustbechan + 1) % s->n_chan;
- if (nowmustbechan != CR_CHAN(chanlist[i])) { /* channel list isn't continous :-( */
+ if (nowmustbechan != CR_CHAN(chanlist[i])) { /* channel list isn't continuous :-( */
printk
- ("channel list must be continous! chanlist[%i]=%d but must be %d or %d!\n",
+ ("channel list must be continuous! chanlist[%i]=%d but must be %d or %d!\n",
i, CR_CHAN(chanlist[i]), nowmustbechan,
CR_CHAN(chanlist[0]));
return 0;
diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c
index 0941643b3869..61968a505f24 100644
--- a/drivers/staging/comedi/drivers/cb_pcidas.c
+++ b/drivers/staging/comedi/drivers/cb_pcidas.c
@@ -115,7 +115,7 @@ analog triggering on 1602 series
#define INT_MASK 0x3 /* mask of interrupt select bits */
#define INTE 0x4 /* interrupt enable */
#define DAHFIE 0x8 /* dac half full interrupt enable */
-#define EOAIE 0x10 /* end of aquisition interrupt enable */
+#define EOAIE 0x10 /* end of acquisition interrupt enable */
#define DAHFI 0x20 /* dac half full read status / write interrupt clear */
#define EOAI 0x40 /* read end of acq. interrupt status / write clear */
#define INT 0x80 /* read interrupt status / write clear */
@@ -440,7 +440,7 @@ struct cb_pcidas_private {
unsigned int divisor1;
unsigned int divisor2;
volatile unsigned int count; /* number of analog input samples remaining */
- volatile unsigned int adc_fifo_bits; /* bits to write to interupt/adcfifo register */
+ volatile unsigned int adc_fifo_bits; /* bits to write to interrupt/adcfifo register */
volatile unsigned int s5933_intcsr_bits; /* bits to write to amcc s5933 interrupt control/status register */
volatile unsigned int ao_control_bits; /* bits to write to ao control and status register */
short ai_buffer[AI_BUFFER_SIZE];
@@ -1653,7 +1653,7 @@ static irqreturn_t cb_pcidas_interrupt(int irq, void *d)
spin_unlock_irqrestore(&dev->spinlock, flags);
} else if (status & EOAI) {
comedi_error(dev,
- "bug! encountered end of aquisition interrupt?");
+ "bug! encountered end of acquisition interrupt?");
/* clear EOA interrupt latch */
spin_lock_irqsave(&dev->spinlock, flags);
outw(devpriv->adc_fifo_bits | EOAI,
diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c
index 2583e16cd02a..1e324198996c 100644
--- a/drivers/staging/comedi/drivers/cb_pcidas64.c
+++ b/drivers/staging/comedi/drivers/cb_pcidas64.c
@@ -104,7 +104,7 @@ TODO:
#endif
#define TIMER_BASE 25 /* 40MHz master clock */
-#define PRESCALED_TIMER_BASE 10000 /* 100kHz 'prescaled' clock for slow aquisition, maybe I'll support this someday */
+#define PRESCALED_TIMER_BASE 10000 /* 100kHz 'prescaled' clock for slow acquisition, maybe I'll support this someday */
#define DMA_BUFFER_SIZE 0x1000
#define PCI_VENDOR_ID_COMPUTERBOARDS 0x1307
@@ -136,7 +136,7 @@ enum write_only_registers {
ADC_DELAY_INTERVAL_UPPER_REG = 0x1c, /* upper 8 bits of delay interval counter */
ADC_COUNT_LOWER_REG = 0x1e, /* lower 16 bits of hardware conversion/scan counter */
ADC_COUNT_UPPER_REG = 0x20, /* upper 8 bits of hardware conversion/scan counter */
- ADC_START_REG = 0x22, /* software trigger to start aquisition */
+ ADC_START_REG = 0x22, /* software trigger to start acquisition */
ADC_CONVERT_REG = 0x24, /* initiates single conversion */
ADC_QUEUE_CLEAR_REG = 0x26, /* clears adc queue */
ADC_QUEUE_LOAD_REG = 0x28, /* loads adc queue */
@@ -199,7 +199,7 @@ enum intr_enable_contents {
ADC_INTR_EOSCAN_BITS = 0x2, /* interrupt end of scan */
ADC_INTR_EOSEQ_BITS = 0x3, /* interrupt end of sequence (probably wont use this it's pretty fancy) */
EN_ADC_INTR_SRC_BIT = 0x4, /* enable adc interrupt source */
- EN_ADC_DONE_INTR_BIT = 0x8, /* enable adc aquisition done interrupt */
+ EN_ADC_DONE_INTR_BIT = 0x8, /* enable adc acquisition done interrupt */
DAC_INTR_SRC_MASK = 0x30,
DAC_INTR_QEMPTY_BITS = 0x0,
DAC_INTR_HIGH_CHAN_BITS = 0x10,
@@ -2867,7 +2867,7 @@ static int ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
spin_unlock_irqrestore(&dev->spinlock, flags);
- /* start aquisition */
+ /* start acquisition */
if (cmd->start_src == TRIG_NOW) {
writew(0, priv(dev)->main_iobase + ADC_START_REG);
DEBUG_PRINT("soft trig\n");
@@ -2942,7 +2942,7 @@ static void pio_drain_ai_fifo_16(struct comedi_device *dev)
/* Read from 32 bit wide ai fifo of 4020 - deal with insane grey coding of pointers.
* The pci-4020 hardware only supports
* dma transfers (it only supports the use of pio for draining the last remaining
- * points from the fifo when a data aquisition operation has completed).
+ * points from the fifo when a data acquisition operation has completed).
*/
static void pio_drain_ai_fifo_32(struct comedi_device *dev)
{
@@ -3046,7 +3046,7 @@ static void handle_ai_interrupt(struct comedi_device *dev,
comedi_error(dev, "fifo overrun");
async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
}
- /* spin lock makes sure noone else changes plx dma control reg */
+ /* spin lock makes sure no one else changes plx dma control reg */
spin_lock_irqsave(&dev->spinlock, flags);
dma1_status = readb(priv(dev)->plx9080_iobase + PLX_DMA1_CS_REG);
if (plx_status & ICS_DMA1_A) { /* dma chan 1 interrupt */
@@ -3170,7 +3170,7 @@ static void handle_ao_interrupt(struct comedi_device *dev,
async = s->async;
cmd = &async->cmd;
- /* spin lock makes sure noone else changes plx dma control reg */
+ /* spin lock makes sure no one else changes plx dma control reg */
spin_lock_irqsave(&dev->spinlock, flags);
dma0_status = readb(priv(dev)->plx9080_iobase + PLX_DMA0_CS_REG);
if (plx_status & ICS_DMA0_A) { /* dma chan 0 interrupt */
diff --git a/drivers/staging/comedi/drivers/comedi_test.c b/drivers/staging/comedi/drivers/comedi_test.c
index b220b3055412..a804742b8022 100644
--- a/drivers/staging/comedi/drivers/comedi_test.c
+++ b/drivers/staging/comedi/drivers/comedi_test.c
@@ -81,7 +81,7 @@ static const struct waveform_board waveform_boards[] = {
/* Data unique to this driver */
struct waveform_private {
struct timer_list timer;
- struct timeval last; /* time at which last timer interrupt occured */
+ struct timeval last; /* time at which last timer interrupt occurred */
unsigned int uvolt_amplitude; /* waveform amplitude in microvolts */
unsigned long usec_period; /* waveform period in microseconds */
unsigned long usec_current; /* current time (modulo waveform period) */
diff --git a/drivers/staging/comedi/drivers/das1800.c b/drivers/staging/comedi/drivers/das1800.c
index 6ea93f9c0b48..60c2b12d6ffb 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -1087,7 +1087,7 @@ static void das1800_flush_dma_channel(struct comedi_device *dev,
return;
}
-/* flushes remaining data from board when external trigger has stopped aquisition
+/* flushes remaining data from board when external trigger has stopped acquisition
* and we are using dma transfers */
static void das1800_flush_dma(struct comedi_device *dev,
struct comedi_subdevice *s)
diff --git a/drivers/staging/comedi/drivers/das800.c b/drivers/staging/comedi/drivers/das800.c
index aecaedc5027e..96d41ad76956 100644
--- a/drivers/staging/comedi/drivers/das800.c
+++ b/drivers/staging/comedi/drivers/das800.c
@@ -391,7 +391,7 @@ static irqreturn_t das800_interrupt(int irq, void *d)
spin_lock_irqsave(&dev->spinlock, irq_flags);
outb(CONTROL1, dev->iobase + DAS800_GAIN); /* select base address + 7 to be STATUS2 register */
status = inb(dev->iobase + DAS800_STATUS2) & STATUS2_HCEN;
- /* don't release spinlock yet since we want to make sure noone else disables hardware conversions */
+ /* don't release spinlock yet since we want to make sure no one else disables hardware conversions */
if (status == 0) {
spin_unlock_irqrestore(&dev->spinlock, irq_flags);
return IRQ_HANDLED;
diff --git a/drivers/staging/comedi/drivers/dmm32at.c b/drivers/staging/comedi/drivers/dmm32at.c
index 693728e14bdb..2b4e6e6eb825 100644
--- a/drivers/staging/comedi/drivers/dmm32at.c
+++ b/drivers/staging/comedi/drivers/dmm32at.c
@@ -532,7 +532,7 @@ static int dmm32at_ai_rinsn(struct comedi_device *dev,
msb = dmm_inb(dev, DMM32AT_AIMSB);
/* invert sign bit to make range unsigned, this is an
- idiosyncracy of the diamond board, it return
+ idiosyncrasy of the diamond board, it return
conversions as a signed value, i.e. -32768 to
32767, flipping the bit and interpreting it as
signed gives you a range of 0 to 65535 which is
diff --git a/drivers/staging/comedi/drivers/dt2811.c b/drivers/staging/comedi/drivers/dt2811.c
index a1664caa1d96..0131d5225b52 100644
--- a/drivers/staging/comedi/drivers/dt2811.c
+++ b/drivers/staging/comedi/drivers/dt2811.c
@@ -560,7 +560,7 @@ int dt2811_adtrig(kdev_t minor, comedi_adtrig *adtrig)
switch (dev->i_admode) {
case COMEDI_MDEMAND:
dev->ntrig = adtrig->n - 1;
- /* not neccessary */
+ /* not necessary */
/*printk("dt2811: AD soft trigger\n"); */
/*outb(DT2811_CLRERROR|DT2811_INTENB,
dev->iobase+DT2811_ADCSR); */
diff --git a/drivers/staging/comedi/drivers/dt9812.c b/drivers/staging/comedi/drivers/dt9812.c
index 06059850dae2..32d9c42e9659 100644
--- a/drivers/staging/comedi/drivers/dt9812.c
+++ b/drivers/staging/comedi/drivers/dt9812.c
@@ -773,7 +773,7 @@ static int dt9812_probe(struct usb_interface *interface,
retval = dt9812_read_info(dev, 1, &fw, sizeof(fw));
if (retval == 0) {
dev_info(&interface->dev,
- "usb_reset_configuration succeded "
+ "usb_reset_configuration succeeded "
"after %d iterations\n", i);
break;
}
diff --git a/drivers/staging/comedi/drivers/gsc_hpdi.c b/drivers/staging/comedi/drivers/gsc_hpdi.c
index 1661b57ca2ad..bc020dea141b 100644
--- a/drivers/staging/comedi/drivers/gsc_hpdi.c
+++ b/drivers/staging/comedi/drivers/gsc_hpdi.c
@@ -1031,7 +1031,7 @@ static irqreturn_t handle_interrupt(int irq, void *d)
writel(hpdi_intr_status,
priv(dev)->hpdi_iobase + INTERRUPT_STATUS_REG);
}
- /* spin lock makes sure noone else changes plx dma control reg */
+ /* spin lock makes sure no one else changes plx dma control reg */
spin_lock_irqsave(&dev->spinlock, flags);
dma0_status = readb(priv(dev)->plx9080_iobase + PLX_DMA0_CS_REG);
if (plx_status & ICS_DMA0_A) { /* dma chan 0 interrupt */
@@ -1045,7 +1045,7 @@ static irqreturn_t handle_interrupt(int irq, void *d)
}
spin_unlock_irqrestore(&dev->spinlock, flags);
- /* spin lock makes sure noone else changes plx dma control reg */
+ /* spin lock makes sure no one else changes plx dma control reg */
spin_lock_irqsave(&dev->spinlock, flags);
dma1_status = readb(priv(dev)->plx9080_iobase + PLX_DMA1_CS_REG);
if (plx_status & ICS_DMA1_A) { /* XXX *//* dma chan 1 interrupt */
diff --git a/drivers/staging/comedi/drivers/icp_multi.c b/drivers/staging/comedi/drivers/icp_multi.c
index 0bab39b3409b..126550f3c02b 100644
--- a/drivers/staging/comedi/drivers/icp_multi.c
+++ b/drivers/staging/comedi/drivers/icp_multi.c
@@ -715,7 +715,7 @@ Description:
is built correctly
Parameters:
- struct comedi_device *dev Pointer to current sevice structure
+ struct comedi_device *dev Pointer to current service structure
struct comedi_subdevice *s Pointer to current subdevice structure
unsigned int *chanlist Pointer to packed channel list
unsigned int n_chan Number of channels to scan
@@ -772,7 +772,7 @@ Description:
Status register.
Parameters:
- struct comedi_device *dev Pointer to current sevice structure
+ struct comedi_device *dev Pointer to current service structure
struct comedi_subdevice *s Pointer to current subdevice structure
unsigned int *chanlist Pointer to packed channel list
unsigned int n_chan Number of channels to scan
@@ -848,7 +848,7 @@ Description:
This function resets the icp multi device to a 'safe' state
Parameters:
- struct comedi_device *dev Pointer to current sevice structure
+ struct comedi_device *dev Pointer to current service structure
Returns:int 0 = success
diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c
index 75511bae0191..b692fea0d2b0 100644
--- a/drivers/staging/comedi/drivers/me4000.c
+++ b/drivers/staging/comedi/drivers/me4000.c
@@ -1810,7 +1810,7 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id)
ai_context->irq_status_reg) &
ME4000_IRQ_STATUS_BIT_AI_HF) {
ISR_PDEBUG
- ("me4000_ai_isr(): Fifo half full interrupt occured\n");
+ ("me4000_ai_isr(): Fifo half full interrupt occurred\n");
/* Read status register to find out what happened */
tmp = me4000_inl(dev, ai_context->ctrl_reg);
@@ -1903,7 +1903,7 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id)
if (me4000_inl(dev,
ai_context->irq_status_reg) & ME4000_IRQ_STATUS_BIT_SC) {
ISR_PDEBUG
- ("me4000_ai_isr(): Sample counter interrupt occured\n");
+ ("me4000_ai_isr(): Sample counter interrupt occurred\n");
s->async->events |= COMEDI_CB_BLOCK | COMEDI_CB_EOA;
diff --git a/drivers/staging/comedi/drivers/mpc624.c b/drivers/staging/comedi/drivers/mpc624.c
index a89eebd23f65..dd09a6d46e5c 100644
--- a/drivers/staging/comedi/drivers/mpc624.c
+++ b/drivers/staging/comedi/drivers/mpc624.c
@@ -39,8 +39,8 @@ Status: working
Configuration Options:
[0] - I/O base address
- [1] - convertion rate
- Convertion rate RMS noise Effective Number Of Bits
+ [1] - conversion rate
+ Conversion rate RMS noise Effective Number Of Bits
0 3.52kHz 23uV 17
1 1.76kHz 3.5uV 20
2 880Hz 2uV 21.3
@@ -93,8 +93,8 @@ Configuration Options:
#define MPC624_DMY_BIT (1<<30)
#define MPC624_SGN_BIT (1<<29)
-/* Convertion speeds */
-/* OSR4 OSR3 OSR2 OSR1 OSR0 Convertion rate RMS noise ENOB^
+/* Conversion speeds */
+/* OSR4 OSR3 OSR2 OSR1 OSR0 Conversion rate RMS noise ENOB^
* X 0 0 0 1 3.52kHz 23uV 17
* X 0 0 1 0 1.76kHz 3.5uV 20
* X 0 0 1 1 880Hz 2uV 21.3
@@ -227,7 +227,7 @@ static int mpc624_attach(struct comedi_device *dev, struct comedi_devconfig *it)
break;
default:
printk
- (KERN_ERR "illegal convertion rate setting!"
+ (KERN_ERR "illegal conversion rate setting!"
" Valid numbers are 0..9. Using 9 => 6.875 Hz, ");
devpriv->ulConvertionRate = MPC624_SPEED_3_52_kHz;
}
@@ -296,7 +296,7 @@ static int mpc624_ai_rinsn(struct comedi_device *dev,
}
for (n = 0; n < insn->n; n++) {
- /* Trigger the convertion */
+ /* Trigger the conversion */
outb(MPC624_ADSCK, dev->iobase + MPC624_ADC);
udelay(1);
outb(MPC624_ADCS | MPC624_ADSCK, dev->iobase + MPC624_ADC);
@@ -304,7 +304,7 @@ static int mpc624_ai_rinsn(struct comedi_device *dev,
outb(0, dev->iobase + MPC624_ADC);
udelay(1);
- /* Wait for the convertion to end */
+ /* Wait for the conversion to end */
for (i = 0; i < TIMEOUT; i++) {
ucPort = inb(dev->iobase + MPC624_ADC);
if (ucPort & MPC624_ADBUSY)
diff --git a/drivers/staging/comedi/drivers/ni_at_a2150.c b/drivers/staging/comedi/drivers/ni_at_a2150.c
index 4d0053ea2465..c192b71ec04f 100644
--- a/drivers/staging/comedi/drivers/ni_at_a2150.c
+++ b/drivers/staging/comedi/drivers/ni_at_a2150.c
@@ -104,10 +104,10 @@ TRIG_WAKE_EOS
#define STATUS_REG 0x12 /* read only */
#define FNE_BIT 0x1 /* fifo not empty */
#define OVFL_BIT 0x8 /* fifo overflow */
-#define EDAQ_BIT 0x10 /* end of aquisition interrupt */
+#define EDAQ_BIT 0x10 /* end of acquisition interrupt */
#define DCAL_BIT 0x20 /* offset calibration in progress */
-#define INTR_BIT 0x40 /* interrupt has occured */
-#define DMA_TC_BIT 0x80 /* dma terminal count interrupt has occured */
+#define INTR_BIT 0x40 /* interrupt has occurred */
+#define DMA_TC_BIT 0x80 /* dma terminal count interrupt has occurred */
#define ID_BITS(x) (((x) >> 8) & 0x3)
#define IRQ_DMA_CNTRL_REG 0x12 /* write only */
#define DMA_CHAN_BITS(x) ((x) & 0x7) /* sets dma channel */
@@ -434,7 +434,7 @@ static int a2150_attach(struct comedi_device *dev, struct comedi_devconfig *it)
s->cancel = a2150_cancel;
/* need to do this for software counting of completed conversions, to
- * prevent hardware count from stopping aquisition */
+ * prevent hardware count from stopping acquisition */
outw(HW_COUNT_DISABLE, dev->iobase + I8253_MODE_REG);
/* set card's irq and dma levels */
@@ -729,7 +729,7 @@ static int a2150_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
/* send trigger config bits */
outw(trigger_bits, dev->iobase + TRIGGER_REG);
- /* start aquisition for soft trigger */
+ /* start acquisition for soft trigger */
if (cmd->start_src == TRIG_NOW) {
outw(0, dev->iobase + FIFO_START_REG);
}
@@ -768,7 +768,7 @@ static int a2150_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
/* setup start triggering */
outw(0, dev->iobase + TRIGGER_REG);
- /* start aquisition for soft trigger */
+ /* start acquisition for soft trigger */
outw(0, dev->iobase + FIFO_START_REG);
/* there is a 35.6 sample delay for data to get through the antialias filter */
diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c
index 241fe525abf0..ab8f37022a3c 100644
--- a/drivers/staging/comedi/drivers/ni_labpc.c
+++ b/drivers/staging/comedi/drivers/ni_labpc.c
@@ -183,11 +183,11 @@ NI manuals:
#define OVERRUN_BIT 0x2
/* fifo overflow */
#define OVERFLOW_BIT 0x4
-/* timer interrupt has occured */
+/* timer interrupt has occurred */
#define TIMER_BIT 0x8
-/* dma terminal count has occured */
+/* dma terminal count has occurred */
#define DMATC_BIT 0x10
-/* external trigger has occured */
+/* external trigger has occurred */
#define EXT_TRIG_BIT 0x40
/* 1200 boards only */
#define STATUS2_REG 0x1d
@@ -1149,7 +1149,7 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
range = CR_RANGE(cmd->chanlist[0]);
aref = CR_AREF(cmd->chanlist[0]);
- /* make sure board is disabled before setting up aquisition */
+ /* make sure board is disabled before setting up acquisition */
spin_lock_irqsave(&dev->spinlock, flags);
devpriv->command2_bits &= ~SWTRIG_BIT & ~HWTRIG_BIT & ~PRETRIG_BIT;
devpriv->write_byte(devpriv->command2_bits, dev->iobase + COMMAND2_REG);
@@ -1349,7 +1349,7 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
devpriv->command3_bits &= ~ADC_FNE_INTR_EN_BIT;
devpriv->write_byte(devpriv->command3_bits, dev->iobase + COMMAND3_REG);
- /* startup aquisition */
+ /* startup acquisition */
/* command2 reg */
/* use 2 cascaded counters for pacing */
@@ -1571,8 +1571,8 @@ static void handle_isa_dma(struct comedi_device *dev)
devpriv->write_byte(0x1, dev->iobase + DMATC_CLEAR_REG);
}
-/* makes sure all data acquired by board is transfered to comedi (used
- * when aquisition is terminated by stop_src == TRIG_EXT). */
+/* makes sure all data acquired by board is transferred to comedi (used
+ * when acquisition is terminated by stop_src == TRIG_EXT). */
static void labpc_drain_dregs(struct comedi_device *dev)
{
if (devpriv->current_transfer == isa_dma_transfer)
diff --git a/drivers/staging/comedi/drivers/ni_pcidio.c b/drivers/staging/comedi/drivers/ni_pcidio.c
index 005d2fe86ee4..8dd3a01d48dd 100644
--- a/drivers/staging/comedi/drivers/ni_pcidio.c
+++ b/drivers/staging/comedi/drivers/ni_pcidio.c
@@ -821,7 +821,7 @@ static int ni_pcidio_cmdtest(struct comedi_device *dev,
cmd->scan_begin_arg = MAX_SPEED;
err++;
}
- /* no minumum speed */
+ /* no minimum speed */
} else {
/* TRIG_EXT */
/* should be level/edge, hi/lo specification here */
diff --git a/drivers/staging/comedi/drivers/pcl812.c b/drivers/staging/comedi/drivers/pcl812.c
index c6dce4a1425e..09ff4723b225 100644
--- a/drivers/staging/comedi/drivers/pcl812.c
+++ b/drivers/staging/comedi/drivers/pcl812.c
@@ -34,7 +34,7 @@
* and I cann't test all features.)
*
* This driver supports insn and cmd interfaces. Some boards support only insn
- * becouse their hardware don't allow more (PCL-813/B, ACL-8113, ISO-813).
+ * because their hardware don't allow more (PCL-813/B, ACL-8113, ISO-813).
* Data transfer over DMA is supported only when you measure only one
* channel, this is too hardware limitation of these boards.
*
diff --git a/drivers/staging/comedi/drivers/pcl816.c b/drivers/staging/comedi/drivers/pcl816.c
index ef3cc4f3be6e..8f3fc6ee088b 100644
--- a/drivers/staging/comedi/drivers/pcl816.c
+++ b/drivers/staging/comedi/drivers/pcl816.c
@@ -954,7 +954,7 @@ check_channel_list(struct comedi_device *dev,
}
if (chanlen > 1) {
- /* first channel is everytime ok */
+ /* first channel is every time ok */
chansegment[0] = chanlist[0];
for (i = 1, seglen = 1; i < chanlen; i++, seglen++) {
/* build part of chanlist */
@@ -968,10 +968,10 @@ check_channel_list(struct comedi_device *dev,
nowmustbechan =
(CR_CHAN(chansegment[i - 1]) + 1) % chanlen;
if (nowmustbechan != CR_CHAN(chanlist[i])) {
- /* channel list isn't continous :-( */
+ /* channel list isn't continuous :-( */
printk(KERN_WARNING
"comedi%d: pcl816: channel list must "
- "be continous! chanlist[%i]=%d but "
+ "be continuous! chanlist[%i]=%d but "
"must be %d or %d!\n", dev->minor,
i, CR_CHAN(chanlist[i]), nowmustbechan,
CR_CHAN(chanlist[0]));
diff --git a/drivers/staging/comedi/drivers/pcl818.c b/drivers/staging/comedi/drivers/pcl818.c
index f58d75be7295..e3eea09ae1fb 100644
--- a/drivers/staging/comedi/drivers/pcl818.c
+++ b/drivers/staging/comedi/drivers/pcl818.c
@@ -1231,7 +1231,7 @@ static int check_channel_list(struct comedi_device *dev,
}
if (n_chan > 1) {
- /* first channel is everytime ok */
+ /* first channel is every time ok */
chansegment[0] = chanlist[0];
/* build part of chanlist */
for (i = 1, seglen = 1; i < n_chan; i++, seglen++) {
@@ -1245,9 +1245,9 @@ static int check_channel_list(struct comedi_device *dev,
break;
nowmustbechan =
(CR_CHAN(chansegment[i - 1]) + 1) % s->n_chan;
- if (nowmustbechan != CR_CHAN(chanlist[i])) { /* channel list isn't continous :-( */
+ if (nowmustbechan != CR_CHAN(chanlist[i])) { /* channel list isn't continuous :-( */
printk
- ("comedi%d: pcl818: channel list must be continous! chanlist[%i]=%d but must be %d or %d!\n",
+ ("comedi%d: pcl818: channel list must be continuous! chanlist[%i]=%d but must be %d or %d!\n",
dev->minor, i, CR_CHAN(chanlist[i]),
nowmustbechan, CR_CHAN(chanlist[0]));
return 0;
diff --git a/drivers/staging/comedi/drivers/pcmmio.c b/drivers/staging/comedi/drivers/pcmmio.c
index 5c832d7ed45d..f2e88e57d558 100644
--- a/drivers/staging/comedi/drivers/pcmmio.c
+++ b/drivers/staging/comedi/drivers/pcmmio.c
@@ -733,7 +733,7 @@ static int pcmmio_dio_insn_config(struct comedi_device *dev,
break;
case INSN_CONFIG_DIO_QUERY:
- /* retreive from shadow register */
+ /* retrieve from shadow register */
data[1] =
(s->io_bits & (1 << chan)) ? COMEDI_OUTPUT : COMEDI_INPUT;
return insn->n;
@@ -1279,7 +1279,7 @@ static int wait_dac_ready(unsigned long iobase)
"no busy waiting" policy. The fact is that the hardware is
normally so fast that we usually only need one time through the loop
anyway. The longer timeout is for rare occasions and for detecting
- non-existant hardware. */
+ non-existent hardware. */
while (retry--) {
if (inb(iobase + 3) & 0x80)
diff --git a/drivers/staging/comedi/drivers/pcmuio.c b/drivers/staging/comedi/drivers/pcmuio.c
index 7a9287433b2e..b2c2c8971a32 100644
--- a/drivers/staging/comedi/drivers/pcmuio.c
+++ b/drivers/staging/comedi/drivers/pcmuio.c
@@ -605,7 +605,7 @@ static int pcmuio_dio_insn_config(struct comedi_device *dev,
break;
case INSN_CONFIG_DIO_QUERY:
- /* retreive from shadow register */
+ /* retrieve from shadow register */
data[1] =
(s->io_bits & (1 << chan)) ? COMEDI_OUTPUT : COMEDI_INPUT;
return insn->n;
diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c b/drivers/staging/comedi/drivers/quatech_daqp_cs.c
index ebba9bb47777..82942e5728a5 100644
--- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c
+++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c
@@ -390,7 +390,7 @@ static int daqp_ai_insn_read(struct comedi_device *dev,
outb(v, dev->iobase + DAQP_CONTROL);
- /* Reset any pending interrupts (my card has a tendancy to require
+ /* Reset any pending interrupts (my card has a tendency to require
* require multiple reads on the status register to achieve this)
*/
@@ -752,7 +752,7 @@ static int daqp_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
outb(v, dev->iobase + DAQP_CONTROL);
- /* Reset any pending interrupts (my card has a tendancy to require
+ /* Reset any pending interrupts (my card has a tendency to require
* require multiple reads on the status register to achieve this)
*/
counter = 100;
diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c
index 357858d27441..7f09ed755fe6 100644
--- a/drivers/staging/comedi/drivers/rtd520.c
+++ b/drivers/staging/comedi/drivers/rtd520.c
@@ -75,7 +75,7 @@ Configuration options:
das1800, since they have the best documented code. Driver
cb_pcidas64.c uses the same DMA controller.
- As far as I can tell, the About interrupt doesnt work if Sample is
+ As far as I can tell, the About interrupt doesn't work if Sample is
also enabled. It turns out that About really isn't needed, since
we always count down samples read.
@@ -370,7 +370,7 @@ struct rtdPrivate {
/* timer gate (when enabled) */
u8 utcGate[4]; /* 1 extra allows simple range check */
- /* shadow registers affect other registers, but cant be read back */
+ /* shadow registers affect other registers, but can't be read back */
/* The macros below update these on writes */
u16 intMask; /* interrupt mask */
u16 intClearMask; /* interrupt clear mask */
@@ -485,7 +485,7 @@ struct rtdPrivate {
#define RtdAdcFifoGet(dev) \
readw(devpriv->las1+LAS1_ADC_FIFO)
-/* Read two ADC data values (DOESNT WORK) */
+/* Read two ADC data values (DOESN'T WORK) */
#define RtdAdcFifoGet2(dev) \
readl(devpriv->las1+LAS1_ADC_FIFO)
@@ -857,7 +857,7 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it)
DPRINTK("rtd520: PCI latency = %d\n", pci_latency);
}
- /* Undocumented EPLD version (doesnt match RTD driver results) */
+ /* Undocumented EPLD version (doesn't match RTD driver results) */
/*DPRINTK ("rtd520: Reading epld from %p\n",
devpriv->las0+0);
epld_version = readl (devpriv->las0+0);
@@ -1291,7 +1291,7 @@ static int rtd520_probe_fifo_depth(struct comedi_device *dev)
/*
"instructions" read/write data in "one-shot" or "software-triggered"
mode (simplest case).
- This doesnt use interrupts.
+ This doesn't use interrupts.
Note, we don't do any settling delays. Use a instruction list to
select, delay, then read.
@@ -2120,7 +2120,7 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
}
/*
- Stop a running data aquisition.
+ Stop a running data acquisition.
*/
static int rtd_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s)
{
diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c
index d5ba3ab357a3..23fc64b9988e 100644
--- a/drivers/staging/comedi/drivers/s626.c
+++ b/drivers/staging/comedi/drivers/s626.c
@@ -139,7 +139,7 @@ struct s626_private {
int got_regions;
short allocatedBuf;
uint8_t ai_cmd_running; /* ai_cmd is running */
- uint8_t ai_continous; /* continous aquisition */
+ uint8_t ai_continous; /* continous acquisition */
int ai_sample_count; /* number of samples to acquire */
unsigned int ai_sample_timer;
/* time between samples in units of the timer */
@@ -1048,7 +1048,7 @@ static irqreturn_t s626_irq_handler(int irq, void *d)
uint8_t group;
uint16_t irqbit;
- DEBUG("s626_irq_handler: interrupt request recieved!!!\n");
+ DEBUG("s626_irq_handler: interrupt request received!!!\n");
if (dev->attached == 0)
return IRQ_NONE;
@@ -1165,14 +1165,14 @@ static irqreturn_t s626_irq_handler(int irq, void *d)
(16 * group)))
== 1 && cmd->start_src == TRIG_EXT) {
DEBUG
- ("s626_irq_handler: Edge capture interrupt recieved from channel %d\n",
+ ("s626_irq_handler: Edge capture interrupt received from channel %d\n",
cmd->start_arg);
/* Start executing the RPS program. */
MC_ENABLE(P_MC1, MC1_ERPS1);
DEBUG
- ("s626_irq_handler: aquisition start triggered!!!\n");
+ ("s626_irq_handler: acquisition start triggered!!!\n");
if (cmd->scan_begin_src ==
TRIG_EXT) {
@@ -1194,7 +1194,7 @@ static irqreturn_t s626_irq_handler(int irq, void *d)
&& cmd->scan_begin_src ==
TRIG_EXT) {
DEBUG
- ("s626_irq_handler: Edge capture interrupt recieved from channel %d\n",
+ ("s626_irq_handler: Edge capture interrupt received from channel %d\n",
cmd->scan_begin_arg);
/* Trigger ADC scan loop start by setting RPS Signal 0. */
@@ -1236,7 +1236,7 @@ static irqreturn_t s626_irq_handler(int irq, void *d)
== 1
&& cmd->convert_src == TRIG_EXT) {
DEBUG
- ("s626_irq_handler: Edge capture interrupt recieved from channel %d\n",
+ ("s626_irq_handler: Edge capture interrupt received from channel %d\n",
cmd->convert_arg);
/* Trigger ADC scan loop start by setting RPS Signal 0. */
@@ -1805,7 +1805,7 @@ static int s626_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
DEBUG("s626_ai_cmd: NULL command\n");
return -EINVAL;
} else {
- DEBUG("s626_ai_cmd: command recieved!!!\n");
+ DEBUG("s626_ai_cmd: command received!!!\n");
}
if (dev->irq == 0) {
@@ -1880,7 +1880,7 @@ static int s626_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
devpriv->ai_continous = 0;
break;
case TRIG_NONE:
- /* continous aquisition */
+ /* continous acquisition */
devpriv->ai_continous = 1;
devpriv->ai_sample_count = 0;
break;
@@ -2570,7 +2570,7 @@ static uint32_t I2Chandshake(struct comedi_device *dev, uint32_t val)
while ((RR7146(P_I2CCTRL) & (I2C_BUSY | I2C_ERR)) == I2C_BUSY)
;
- /* Return non-zero if I2C error occured. */
+ /* Return non-zero if I2C error occurred. */
return RR7146(P_I2CCTRL) & I2C_ERR;
}
diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c
index be93c30e4b15..e543e6c2b1bb 100644
--- a/drivers/staging/comedi/drivers/usbdux.c
+++ b/drivers/staging/comedi/drivers/usbdux.c
@@ -285,7 +285,7 @@ struct usbduxsub {
short int ao_cmd_running;
/* pwm is running */
short int pwm_cmd_running;
- /* continous aquisition */
+ /* continous acquisition */
short int ai_continous;
short int ao_continous;
/* number of samples to acquire */
@@ -500,7 +500,7 @@ static void usbduxsub_ai_IsocIrq(struct urb *urb)
/* test, if we transmit only a fixed number of samples */
if (!(this_usbduxsub->ai_continous)) {
- /* not continous, fixed number of samples */
+ /* not continuous, fixed number of samples */
this_usbduxsub->ai_sample_count--;
/* all samples received? */
if (this_usbduxsub->ai_sample_count < 0) {
@@ -653,7 +653,7 @@ static void usbduxsub_ao_IsocIrq(struct urb *urb)
/* timer zero */
this_usbduxsub->ao_counter = this_usbduxsub->ao_timer;
- /* handle non continous aquisition */
+ /* handle non continous acquisition */
if (!(this_usbduxsub->ao_continous)) {
/* fixed number of samples */
this_usbduxsub->ao_sample_count--;
@@ -957,7 +957,7 @@ static int usbdux_ai_cmdtest(struct comedi_device *dev,
if (!cmd->scan_begin_src || tmp != cmd->scan_begin_src)
err++;
- /* scanning is continous */
+ /* scanning is continuous */
tmp = cmd->convert_src;
cmd->convert_src &= TRIG_NOW;
if (!cmd->convert_src || tmp != cmd->convert_src)
@@ -1222,7 +1222,7 @@ static int usbdux_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
up(&this_usbduxsub->sem);
return -EBUSY;
}
- /* set current channel of the running aquisition to zero */
+ /* set current channel of the running acquisition to zero */
s->async->cur_chan = 0;
this_usbduxsub->dux_commands[1] = cmd->chanlist_len;
@@ -1284,7 +1284,7 @@ static int usbdux_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
this_usbduxsub->ai_sample_count = cmd->stop_arg;
this_usbduxsub->ai_continous = 0;
} else {
- /* continous aquisition */
+ /* continous acquisition */
this_usbduxsub->ai_continous = 1;
this_usbduxsub->ai_sample_count = 0;
}
@@ -1515,7 +1515,7 @@ static int usbdux_ao_cmdtest(struct comedi_device *dev,
/* just now we scan also in the high speed mode every frame */
/* this is due to ehci driver limitations */
if (0) { /* (this_usbduxsub->high_speed) */
- /* start immidiately a new scan */
+ /* start immediately a new scan */
/* the sampling rate is set by the coversion rate */
cmd->scan_begin_src &= TRIG_FOLLOW;
} else {
@@ -1525,7 +1525,7 @@ static int usbdux_ao_cmdtest(struct comedi_device *dev,
if (!cmd->scan_begin_src || tmp != cmd->scan_begin_src)
err++;
- /* scanning is continous */
+ /* scanning is continuous */
tmp = cmd->convert_src;
/* we always output at 1kHz just now all channels at once */
if (0) { /* (this_usbduxsub->high_speed) */
@@ -1645,7 +1645,7 @@ static int usbdux_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
dev_dbg(&this_usbduxsub->interface->dev,
"comedi%d: %s\n", dev->minor, __func__);
- /* set current channel of the running aquisition to zero */
+ /* set current channel of the running acquisition to zero */
s->async->cur_chan = 0;
for (i = 0; i < cmd->chanlist_len; ++i) {
chan = CR_CHAN(cmd->chanlist[i]);
@@ -1694,7 +1694,7 @@ static int usbdux_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
this_usbduxsub->ao_counter = this_usbduxsub->ao_timer;
if (cmd->stop_src == TRIG_COUNT) {
- /* not continous */
+ /* not continuous */
/* counter */
/* high speed also scans everything at once */
if (0) { /* (this_usbduxsub->high_speed) */
@@ -1708,7 +1708,7 @@ static int usbdux_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
}
this_usbduxsub->ao_continous = 0;
} else {
- /* continous aquisition */
+ /* continous acquisition */
this_usbduxsub->ao_continous = 1;
this_usbduxsub->ao_sample_count = 0;
}
diff --git a/drivers/staging/comedi/drivers/usbduxfast.c b/drivers/staging/comedi/drivers/usbduxfast.c
index 5b15e6df54e6..2a8e725b7859 100644
--- a/drivers/staging/comedi/drivers/usbduxfast.c
+++ b/drivers/staging/comedi/drivers/usbduxfast.c
@@ -180,7 +180,7 @@ struct usbduxfastsub_s {
/* comedi device for the interrupt context */
struct comedi_device *comedidev;
short int ai_cmd_running; /* asynchronous command is running */
- short int ai_continous; /* continous aquisition */
+ short int ai_continous; /* continous acquisition */
long int ai_sample_count; /* number of samples to acquire */
uint8_t *dux_commands; /* commands */
int ignore; /* counter which ignores the first
@@ -392,7 +392,7 @@ static void usbduxfastsub_ai_Irq(struct urb *urb)
p = urb->transfer_buffer;
if (!udfs->ignore) {
if (!udfs->ai_continous) {
- /* not continous, fixed number of samples */
+ /* not continuous, fixed number of samples */
n = urb->actual_length / sizeof(uint16_t);
if (unlikely(udfs->ai_sample_count < n)) {
/*
@@ -775,7 +775,7 @@ static int usbduxfast_ai_cmd(struct comedi_device *dev,
up(&udfs->sem);
return -EBUSY;
}
- /* set current channel of the running aquisition to zero */
+ /* set current channel of the running acquisition to zero */
s->async->cur_chan = 0;
/*
@@ -1182,7 +1182,7 @@ static int usbduxfast_ai_cmd(struct comedi_device *dev,
}
udfs->ai_continous = 0;
} else {
- /* continous aquisition */
+ /* continous acquisition */
udfs->ai_continous = 1;
udfs->ai_sample_count = 0;
}
diff --git a/drivers/staging/cptm1217/clearpad_tm1217.c b/drivers/staging/cptm1217/clearpad_tm1217.c
index 76e4b782d2fb..0fe713e72e9d 100644
--- a/drivers/staging/cptm1217/clearpad_tm1217.c
+++ b/drivers/staging/cptm1217/clearpad_tm1217.c
@@ -52,7 +52,7 @@
#define TMA1217_DEV_STATUS 0x13 /* Device Status */
#define TMA1217_INT_STATUS 0x14 /* Interrupt Status */
-/* Controller can detect upto 2 possible finger touches.
+/* Controller can detect up to 2 possible finger touches.
* Each finger touch provides 12 bit X Y co-ordinates, the values are split
* across 2 registers, and an 8 bit Z value */
#define TMA1217_FINGER_STATE 0x18 /* Finger State */
diff --git a/drivers/staging/crystalhd/crystalhd_cmds.c b/drivers/staging/crystalhd/crystalhd_cmds.c
index 1429608544d6..3735ed3da4c6 100644
--- a/drivers/staging/crystalhd/crystalhd_cmds.c
+++ b/drivers/staging/crystalhd/crystalhd_cmds.c
@@ -914,7 +914,7 @@ enum BC_STATUS crystalhd_user_open(struct crystalhd_cmd *ctx,
* Return:
* status
*
- * Closer aplication handle and release app specific
+ * Closer application handle and release app specific
* resources.
*/
enum BC_STATUS crystalhd_user_close(struct crystalhd_cmd *ctx, struct crystalhd_user *uc)
diff --git a/drivers/staging/crystalhd/crystalhd_hw.c b/drivers/staging/crystalhd/crystalhd_hw.c
index 13a514dd0f79..5acf39e7cdef 100644
--- a/drivers/staging/crystalhd/crystalhd_hw.c
+++ b/drivers/staging/crystalhd/crystalhd_hw.c
@@ -302,7 +302,7 @@ static bool crystalhd_start_device(struct crystalhd_adp *adp)
crystalhd_enable_interrupts(adp);
/* Enable the option for getting the total no. of DWORDS
- * that have been transfered by the RXDMA engine
+ * that have been transferred by the RXDMA engine
*/
dbg_options = crystalhd_reg_rd(adp, MISC1_DMA_DEBUG_OPTIONS_REG);
dbg_options |= 0x10;
@@ -1776,7 +1776,7 @@ enum BC_STATUS crystalhd_do_fw_cmd(struct crystalhd_hw *hw,
return sts;
}
- /*Get the Responce Address*/
+ /*Get the Response Address*/
cmd_res_addr = bc_dec_reg_rd(hw->adp, Cpu2HstMbx1);
/*Read the Response*/
@@ -2367,7 +2367,7 @@ enum BC_STATUS crystalhd_hw_set_core_clock(struct crystalhd_hw *hw)
BCMLOG(BCMLOG_INFO, "clock is moving to %d with n %d with vco_mg %d\n",
hw->core_clock_mhz, n, vco_mg);
- /* Change the DRAM refresh rate to accomodate the new frequency */
+ /* Change the DRAM refresh rate to accommodate the new frequency */
/* refresh reg = ((refresh_rate * clock_rate)/16) - 1; rounding up*/
refresh_reg = (7 * hw->core_clock_mhz / 16);
bc_dec_reg_wr(hw->adp, SDRAM_REF_PARAM, ((1 << 12) | refresh_reg));
diff --git a/drivers/staging/cx25821/Kconfig b/drivers/staging/cx25821/Kconfig
index b2656957aa8f..5f6b54213713 100644
--- a/drivers/staging/cx25821/Kconfig
+++ b/drivers/staging/cx25821/Kconfig
@@ -1,7 +1,6 @@
config VIDEO_CX25821
tristate "Conexant cx25821 support"
depends on DVB_CORE && VIDEO_DEV && PCI && I2C
- depends on BKL # please fix
select I2C_ALGOBIT
select VIDEO_BTCX
select VIDEO_TVEEPROM
diff --git a/drivers/staging/cx25821/cx25821-alsa.c b/drivers/staging/cx25821/cx25821-alsa.c
index 160f6693aa33..ebdba7c65bc5 100644
--- a/drivers/staging/cx25821/cx25821-alsa.c
+++ b/drivers/staging/cx25821/cx25821-alsa.c
@@ -770,10 +770,12 @@ static int cx25821_alsa_init(void)
struct cx25821_dev *dev = NULL;
struct list_head *list;
+ mutex_lock(&cx25821_devlist_mutex);
list_for_each(list, &cx25821_devlist) {
dev = list_entry(list, struct cx25821_dev, devlist);
cx25821_audio_initdev(dev);
}
+ mutex_unlock(&cx25821_devlist_mutex);
if (dev == NULL)
pr_info("ERROR ALSA: no cx25821 cards found\n");
diff --git a/drivers/staging/cx25821/cx25821-core.c b/drivers/staging/cx25821/cx25821-core.c
index a216b620b718..523ac5e16c1b 100644
--- a/drivers/staging/cx25821/cx25821-core.c
+++ b/drivers/staging/cx25821/cx25821-core.c
@@ -33,9 +33,6 @@ MODULE_DESCRIPTION("Driver for Athena cards");
MODULE_AUTHOR("Shu Lin - Hiep Huynh");
MODULE_LICENSE("GPL");
-struct list_head cx25821_devlist;
-EXPORT_SYMBOL(cx25821_devlist);
-
static unsigned int debug;
module_param(debug, int, 0644);
MODULE_PARM_DESC(debug, "enable debug messages");
@@ -46,8 +43,10 @@ MODULE_PARM_DESC(card, "card type");
static unsigned int cx25821_devcount;
-static DEFINE_MUTEX(devlist);
+DEFINE_MUTEX(cx25821_devlist_mutex);
+EXPORT_SYMBOL(cx25821_devlist_mutex);
LIST_HEAD(cx25821_devlist);
+EXPORT_SYMBOL(cx25821_devlist);
struct sram_channel cx25821_sram_channels[] = {
[SRAM_CH00] = {
@@ -911,9 +910,9 @@ static int cx25821_dev_setup(struct cx25821_dev *dev)
dev->nr = ++cx25821_devcount;
sprintf(dev->name, "cx25821[%d]", dev->nr);
- mutex_lock(&devlist);
+ mutex_lock(&cx25821_devlist_mutex);
list_add_tail(&dev->devlist, &cx25821_devlist);
- mutex_unlock(&devlist);
+ mutex_unlock(&cx25821_devlist_mutex);
strcpy(cx25821_boards[UNKNOWN_BOARD].name, "unknown");
strcpy(cx25821_boards[CX25821_BOARD].name, "cx25821");
@@ -1465,9 +1464,9 @@ static void __devexit cx25821_finidev(struct pci_dev *pci_dev)
if (pci_dev->irq)
free_irq(pci_dev->irq, dev);
- mutex_lock(&devlist);
+ mutex_lock(&cx25821_devlist_mutex);
list_del(&dev->devlist);
- mutex_unlock(&devlist);
+ mutex_unlock(&cx25821_devlist_mutex);
cx25821_dev_unregister(dev);
v4l2_device_unregister(v4l2_dev);
@@ -1501,7 +1500,6 @@ static struct pci_driver cx25821_pci_driver = {
static int __init cx25821_init(void)
{
- INIT_LIST_HEAD(&cx25821_devlist);
pr_info("driver version %d.%d.%d loaded\n",
(CX25821_VERSION_CODE >> 16) & 0xff,
(CX25821_VERSION_CODE >> 8) & 0xff,
diff --git a/drivers/staging/cx25821/cx25821-video.c b/drivers/staging/cx25821/cx25821-video.c
index 0d8d75670516..ab05392386e8 100644
--- a/drivers/staging/cx25821/cx25821-video.c
+++ b/drivers/staging/cx25821/cx25821-video.c
@@ -27,7 +27,6 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include "cx25821-video.h"
-#include <linux/smp_lock.h>
MODULE_DESCRIPTION("v4l2 driver module for cx25821 based TV cards");
MODULE_AUTHOR("Hiep Huynh <hiep.huynh@conexant.com>");
@@ -815,7 +814,7 @@ static int video_open(struct file *file)
if (NULL == fh)
return -ENOMEM;
- lock_kernel();
+ mutex_lock(&cx25821_devlist_mutex);
list_for_each(list, &cx25821_devlist)
{
@@ -832,8 +831,8 @@ static int video_open(struct file *file)
}
if (NULL == dev) {
- unlock_kernel();
- return -ENODEV;
+ mutex_unlock(&cx25821_devlist_mutex);
+ return -ENODEV;
}
file->private_data = fh;
@@ -862,7 +861,7 @@ static int video_open(struct file *file)
sizeof(struct cx25821_buffer), fh, NULL);
dprintk(1, "post videobuf_queue_init()\n");
- unlock_kernel();
+ mutex_unlock(&cx25821_devlist_mutex);
return 0;
}
diff --git a/drivers/staging/cx25821/cx25821.h b/drivers/staging/cx25821/cx25821.h
index 55115235f7f6..6230243e2ccb 100644
--- a/drivers/staging/cx25821/cx25821.h
+++ b/drivers/staging/cx25821/cx25821.h
@@ -31,7 +31,6 @@
#include <linux/delay.h>
#include <linux/sched.h>
#include <linux/kdev_t.h>
-#include <linux/smp_lock.h>
#include <media/v4l2-common.h>
#include <media/v4l2-device.h>
@@ -445,6 +444,8 @@ static inline struct cx25821_dev *get_cx25821(struct v4l2_device *v4l2_dev)
v4l2_device_call_all(&dev->v4l2_dev, 0, o, f, ##args)
extern struct list_head cx25821_devlist;
+extern struct mutex cx25821_devlist_mutex;
+
extern struct cx25821_board cx25821_boards[];
extern struct cx25821_subid cx25821_subids[];
diff --git a/drivers/staging/cxd2099/Kconfig b/drivers/staging/cxd2099/Kconfig
new file mode 100644
index 000000000000..9d638c30735d
--- /dev/null
+++ b/drivers/staging/cxd2099/Kconfig
@@ -0,0 +1,11 @@
+config DVB_CXD2099
+ tristate "CXD2099AR Common Interface driver"
+ depends on DVB_CORE && PCI && I2C && DVB_NGENE
+ ---help---
+ Support for the CI module found on cineS2 DVB-S2, supported by
+ the Micronas PCIe device driver (ngene).
+
+ For now, data is passed through '/dev/dvb/adapterX/sec0':
+ - Encrypted data must be written to 'sec0'.
+ - Decrypted data can be read from 'sec0'.
+ - Setup the CAM using device 'ca0'.
diff --git a/drivers/staging/cxd2099/Makefile b/drivers/staging/cxd2099/Makefile
new file mode 100644
index 000000000000..72b14558c119
--- /dev/null
+++ b/drivers/staging/cxd2099/Makefile
@@ -0,0 +1,5 @@
+obj-$(CONFIG_DVB_CXD2099) += cxd2099.o
+
+EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/
+EXTRA_CFLAGS += -Idrivers/media/dvb/frontends/
+EXTRA_CFLAGS += -Idrivers/media/common/tuners/
diff --git a/drivers/staging/cxd2099/TODO b/drivers/staging/cxd2099/TODO
new file mode 100644
index 000000000000..375bb6f8ee2c
--- /dev/null
+++ b/drivers/staging/cxd2099/TODO
@@ -0,0 +1,12 @@
+For now, data is passed through '/dev/dvb/adapterX/sec0':
+ - Encrypted data must be written to 'sec0'.
+ - Decrypted data can be read from 'sec0'.
+ - Setup the CAM using device 'ca0'.
+
+But this is wrong. There are some discussions about the proper way for
+doing it, as seen at:
+ http://www.mail-archive.com/linux-media@vger.kernel.org/msg22196.html
+
+While there's no proper fix for it, the driver should be kept in staging.
+
+Patches should be submitted to: linux-media@vger.kernel.org.
diff --git a/drivers/staging/cxd2099/cxd2099.c b/drivers/staging/cxd2099/cxd2099.c
new file mode 100644
index 000000000000..b49186c74eb3
--- /dev/null
+++ b/drivers/staging/cxd2099/cxd2099.c
@@ -0,0 +1,574 @@
+/*
+ * cxd2099.c: Driver for the CXD2099AR Common Interface Controller
+ *
+ * Copyright (C) 2010 DigitalDevices UG
+ *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 only, as published by the Free Software Foundation.
+ *
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA
+ * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
+ */
+
+#include <linux/version.h>
+#include <linux/slab.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/init.h>
+#include <linux/i2c.h>
+#include <linux/wait.h>
+#include <linux/delay.h>
+#include <linux/mutex.h>
+#include <linux/io.h>
+
+#include "cxd2099.h"
+
+#define MAX_BUFFER_SIZE 248
+
+struct cxd {
+ struct dvb_ca_en50221 en;
+
+ struct i2c_adapter *i2c;
+ u8 adr;
+ u8 regs[0x23];
+ u8 lastaddress;
+ u8 clk_reg_f;
+ u8 clk_reg_b;
+ int mode;
+ u32 bitrate;
+ int ready;
+ int dr;
+ int slot_stat;
+
+ u8 amem[1024];
+ int amem_read;
+
+ int cammode;
+ struct mutex lock;
+};
+
+static int i2c_write_reg(struct i2c_adapter *adapter, u8 adr,
+ u8 reg, u8 data)
+{
+ u8 m[2] = {reg, data};
+ struct i2c_msg msg = {.addr = adr, .flags = 0, .buf = m, .len = 2};
+
+ if (i2c_transfer(adapter, &msg, 1) != 1) {
+ printk(KERN_ERR "Failed to write to I2C register %02x@%02x!\n",
+ reg, adr);
+ return -1;
+ }
+ return 0;
+}
+
+static int i2c_write(struct i2c_adapter *adapter, u8 adr,
+ u8 *data, u8 len)
+{
+ struct i2c_msg msg = {.addr = adr, .flags = 0, .buf = data, .len = len};
+
+ if (i2c_transfer(adapter, &msg, 1) != 1) {
+ printk(KERN_ERR "Failed to write to I2C!\n");
+ return -1;
+ }
+ return 0;
+}
+
+static int i2c_read_reg(struct i2c_adapter *adapter, u8 adr,
+ u8 reg, u8 *val)
+{
+ struct i2c_msg msgs[2] = {{.addr = adr, .flags = 0,
+ .buf = &reg, .len = 1 },
+ {.addr = adr, .flags = I2C_M_RD,
+ .buf = val, .len = 1 } };
+
+ if (i2c_transfer(adapter, msgs, 2) != 2) {
+ printk(KERN_ERR "error in i2c_read_reg\n");
+ return -1;
+ }
+ return 0;
+}
+
+static int i2c_read(struct i2c_adapter *adapter, u8 adr,
+ u8 reg, u8 *data, u8 n)
+{
+ struct i2c_msg msgs[2] = {{.addr = adr, .flags = 0,
+ .buf = &reg, .len = 1 },
+ {.addr = adr, .flags = I2C_M_RD,
+ .buf = data, .len = n } };
+
+ if (i2c_transfer(adapter, msgs, 2) != 2) {
+ printk(KERN_ERR "error in i2c_read\n");
+ return -1;
+ }
+ return 0;
+}
+
+static int read_block(struct cxd *ci, u8 adr, u8 *data, u8 n)
+{
+ int status;
+
+ status = i2c_write_reg(ci->i2c, ci->adr, 0, adr);
+ if (!status) {
+ ci->lastaddress = adr;
+ status = i2c_read(ci->i2c, ci->adr, 1, data, n);
+ }
+ return status;
+}
+
+static int read_reg(struct cxd *ci, u8 reg, u8 *val)
+{
+ return read_block(ci, reg, val, 1);
+}
+
+
+static int read_pccard(struct cxd *ci, u16 address, u8 *data, u8 n)
+{
+ int status;
+ u8 addr[3] = { 2, address&0xff, address>>8 };
+
+ status = i2c_write(ci->i2c, ci->adr, addr, 3);
+ if (!status)
+ status = i2c_read(ci->i2c, ci->adr, 3, data, n);
+ return status;
+}
+
+static int write_pccard(struct cxd *ci, u16 address, u8 *data, u8 n)
+{
+ int status;
+ u8 addr[3] = { 2, address&0xff, address>>8 };
+
+ status = i2c_write(ci->i2c, ci->adr, addr, 3);
+ if (!status) {
+ u8 buf[256] = {3};
+ memcpy(buf+1, data, n);
+ status = i2c_write(ci->i2c, ci->adr, buf, n+1);
+ }
+ return status;
+}
+
+static int read_io(struct cxd *ci, u16 address, u8 *val)
+{
+ int status;
+ u8 addr[3] = { 2, address&0xff, address>>8 };
+
+ status = i2c_write(ci->i2c, ci->adr, addr, 3);
+ if (!status)
+ status = i2c_read(ci->i2c, ci->adr, 3, val, 1);
+ return status;
+}
+
+static int write_io(struct cxd *ci, u16 address, u8 val)
+{
+ int status;
+ u8 addr[3] = { 2, address&0xff, address>>8 };
+ u8 buf[2] = { 3, val };
+
+ status = i2c_write(ci->i2c, ci->adr, addr, 3);
+ if (!status)
+ status = i2c_write(ci->i2c, ci->adr, buf, 2);
+
+ return status;
+}
+
+
+static int write_regm(struct cxd *ci, u8 reg, u8 val, u8 mask)
+{
+ int status;
+
+ status = i2c_write_reg(ci->i2c, ci->adr, 0, reg);
+ if (!status && reg >= 6 && reg <= 8 && mask != 0xff)
+ status = i2c_read_reg(ci->i2c, ci->adr, 1, &ci->regs[reg]);
+ ci->regs[reg] = (ci->regs[reg]&(~mask))|val;
+ if (!status) {
+ ci->lastaddress = reg;
+ status = i2c_write_reg(ci->i2c, ci->adr, 1, ci->regs[reg]);
+ }
+ if (reg == 0x20)
+ ci->regs[reg] &= 0x7f;
+ return status;
+}
+
+static int write_reg(struct cxd *ci, u8 reg, u8 val)
+{
+ return write_regm(ci, reg, val, 0xff);
+}
+
+#ifdef BUFFER_MODE
+static int write_block(struct cxd *ci, u8 adr, u8 *data, int n)
+{
+ int status;
+ u8 buf[256] = {1};
+
+ status = i2c_write_reg(ci->i2c, ci->adr, 0, adr);
+ if (!status) {
+ ci->lastaddress = adr;
+ memcpy(buf+1, data, n);
+ status = i2c_write(ci->i2c, ci->adr, buf, n+1);
+ }
+ return status;
+}
+#endif
+
+static void set_mode(struct cxd *ci, int mode)
+{
+ if (mode == ci->mode)
+ return;
+
+ switch (mode) {
+ case 0x00: /* IO mem */
+ write_regm(ci, 0x06, 0x00, 0x07);
+ break;
+ case 0x01: /* ATT mem */
+ write_regm(ci, 0x06, 0x02, 0x07);
+ break;
+ default:
+ break;
+ }
+ ci->mode = mode;
+}
+
+static void cam_mode(struct cxd *ci, int mode)
+{
+ if (mode == ci->cammode)
+ return;
+
+ switch (mode) {
+ case 0x00:
+ write_regm(ci, 0x20, 0x80, 0x80);
+ break;
+ case 0x01:
+ printk(KERN_INFO "enable cam buffer mode\n");
+ /* write_reg(ci, 0x0d, 0x00); */
+ /* write_reg(ci, 0x0e, 0x01); */
+ write_regm(ci, 0x08, 0x40, 0x40);
+ /* read_reg(ci, 0x12, &dummy); */
+ write_regm(ci, 0x08, 0x80, 0x80);
+ break;
+ default:
+ break;
+ }
+ ci->cammode = mode;
+}
+
+
+
+#define CHK_ERROR(s) if ((status = s)) break
+
+static int init(struct cxd *ci)
+{
+ int status;
+
+ mutex_lock(&ci->lock);
+ ci->mode = -1;
+ do {
+ CHK_ERROR(write_reg(ci, 0x00, 0x00));
+ CHK_ERROR(write_reg(ci, 0x01, 0x00));
+ CHK_ERROR(write_reg(ci, 0x02, 0x10));
+ CHK_ERROR(write_reg(ci, 0x03, 0x00));
+ CHK_ERROR(write_reg(ci, 0x05, 0xFF));
+ CHK_ERROR(write_reg(ci, 0x06, 0x1F));
+ CHK_ERROR(write_reg(ci, 0x07, 0x1F));
+ CHK_ERROR(write_reg(ci, 0x08, 0x28));
+ CHK_ERROR(write_reg(ci, 0x14, 0x20));
+
+ CHK_ERROR(write_reg(ci, 0x09, 0x4D)); /* Input Mode C, BYPass Serial, TIVAL = low, MSB */
+ CHK_ERROR(write_reg(ci, 0x0A, 0xA7)); /* TOSTRT = 8, Mode B (gated clock), falling Edge, Serial, POL=HIGH, MSB */
+
+ /* Sync detector */
+ CHK_ERROR(write_reg(ci, 0x0B, 0x33));
+ CHK_ERROR(write_reg(ci, 0x0C, 0x33));
+
+ CHK_ERROR(write_regm(ci, 0x14, 0x00, 0x0F));
+ CHK_ERROR(write_reg(ci, 0x15, ci->clk_reg_b));
+ CHK_ERROR(write_regm(ci, 0x16, 0x00, 0x0F));
+ CHK_ERROR(write_reg(ci, 0x17, ci->clk_reg_f));
+
+ CHK_ERROR(write_reg(ci, 0x20, 0x28)); /* Integer Divider, Falling Edge, Internal Sync, */
+ CHK_ERROR(write_reg(ci, 0x21, 0x00)); /* MCLKI = TICLK/8 */
+ CHK_ERROR(write_reg(ci, 0x22, 0x07)); /* MCLKI = TICLK/8 */
+
+
+ CHK_ERROR(write_regm(ci, 0x20, 0x80, 0x80)); /* Reset CAM state machine */
+
+ CHK_ERROR(write_regm(ci, 0x03, 0x02, 02)); /* Enable IREQA Interrupt */
+ CHK_ERROR(write_reg(ci, 0x01, 0x04)); /* Enable CD Interrupt */
+ CHK_ERROR(write_reg(ci, 0x00, 0x31)); /* Enable TS1,Hot Swap,Slot A */
+ CHK_ERROR(write_regm(ci, 0x09, 0x08, 0x08)); /* Put TS in bypass */
+ ci->cammode = -1;
+#ifdef BUFFER_MODE
+ cam_mode(ci, 0);
+#endif
+ } while (0);
+ mutex_unlock(&ci->lock);
+
+ return 0;
+}
+
+
+static int read_attribute_mem(struct dvb_ca_en50221 *ca,
+ int slot, int address)
+{
+ struct cxd *ci = ca->data;
+ u8 val;
+ mutex_lock(&ci->lock);
+ set_mode(ci, 1);
+ read_pccard(ci, address, &val, 1);
+ mutex_unlock(&ci->lock);
+ return val;
+}
+
+
+static int write_attribute_mem(struct dvb_ca_en50221 *ca, int slot,
+ int address, u8 value)
+{
+ struct cxd *ci = ca->data;
+
+ mutex_lock(&ci->lock);
+ set_mode(ci, 1);
+ write_pccard(ci, address, &value, 1);
+ mutex_unlock(&ci->lock);
+ return 0;
+}
+
+static int read_cam_control(struct dvb_ca_en50221 *ca,
+ int slot, u8 address)
+{
+ struct cxd *ci = ca->data;
+ u8 val;
+
+ mutex_lock(&ci->lock);
+ set_mode(ci, 0);
+ read_io(ci, address, &val);
+ mutex_unlock(&ci->lock);
+ return val;
+}
+
+static int write_cam_control(struct dvb_ca_en50221 *ca, int slot,
+ u8 address, u8 value)
+{
+ struct cxd *ci = ca->data;
+
+ mutex_lock(&ci->lock);
+ set_mode(ci, 0);
+ write_io(ci, address, value);
+ mutex_unlock(&ci->lock);
+ return 0;
+}
+
+static int slot_reset(struct dvb_ca_en50221 *ca, int slot)
+{
+ struct cxd *ci = ca->data;
+
+ mutex_lock(&ci->lock);
+ cam_mode(ci, 0);
+ write_reg(ci, 0x00, 0x21);
+ write_reg(ci, 0x06, 0x1F);
+ write_reg(ci, 0x00, 0x31);
+ write_regm(ci, 0x20, 0x80, 0x80);
+ write_reg(ci, 0x03, 0x02);
+ ci->ready = 0;
+ ci->mode = -1;
+ {
+ int i;
+ for (i = 0; i < 100; i++) {
+ msleep(10);
+ if (ci->ready)
+ break;
+ }
+ }
+ mutex_unlock(&ci->lock);
+ /* msleep(500); */
+ return 0;
+}
+
+static int slot_shutdown(struct dvb_ca_en50221 *ca, int slot)
+{
+ struct cxd *ci = ca->data;
+
+ printk(KERN_INFO "slot_shutdown\n");
+ mutex_lock(&ci->lock);
+ /* write_regm(ci, 0x09, 0x08, 0x08); */
+ write_regm(ci, 0x20, 0x80, 0x80);
+ write_regm(ci, 0x06, 0x07, 0x07);
+ ci->mode = -1;
+ mutex_unlock(&ci->lock);
+ return 0; /* shutdown(ci); */
+}
+
+static int slot_ts_enable(struct dvb_ca_en50221 *ca, int slot)
+{
+ struct cxd *ci = ca->data;
+
+ mutex_lock(&ci->lock);
+ write_regm(ci, 0x09, 0x00, 0x08);
+ set_mode(ci, 0);
+#ifdef BUFFER_MODE
+ cam_mode(ci, 1);
+#endif
+ mutex_unlock(&ci->lock);
+ return 0;
+}
+
+
+static int campoll(struct cxd *ci)
+{
+ u8 istat;
+
+ read_reg(ci, 0x04, &istat);
+ if (!istat)
+ return 0;
+ write_reg(ci, 0x05, istat);
+
+ if (istat&0x40) {
+ ci->dr = 1;
+ printk(KERN_INFO "DR\n");
+ }
+ if (istat&0x20)
+ printk(KERN_INFO "WC\n");
+
+ if (istat&2) {
+ u8 slotstat;
+
+ read_reg(ci, 0x01, &slotstat);
+ if (!(2&slotstat)) {
+ if (!ci->slot_stat) {
+ ci->slot_stat |= DVB_CA_EN50221_POLL_CAM_PRESENT;
+ write_regm(ci, 0x03, 0x08, 0x08);
+ }
+
+ } else {
+ if (ci->slot_stat) {
+ ci->slot_stat = 0;
+ write_regm(ci, 0x03, 0x00, 0x08);
+ printk(KERN_INFO "NO CAM\n");
+ ci->ready = 0;
+ }
+ }
+ if (istat&8 && ci->slot_stat == DVB_CA_EN50221_POLL_CAM_PRESENT) {
+ ci->ready = 1;
+ ci->slot_stat |= DVB_CA_EN50221_POLL_CAM_READY;
+ printk(KERN_INFO "READY\n");
+ }
+ }
+ return 0;
+}
+
+
+static int poll_slot_status(struct dvb_ca_en50221 *ca, int slot, int open)
+{
+ struct cxd *ci = ca->data;
+ u8 slotstat;
+
+ mutex_lock(&ci->lock);
+ campoll(ci);
+ read_reg(ci, 0x01, &slotstat);
+ mutex_unlock(&ci->lock);
+
+ return ci->slot_stat;
+}
+
+#ifdef BUFFER_MODE
+static int read_data(struct dvb_ca_en50221 *ca, int slot, u8 *ebuf, int ecount)
+{
+ struct cxd *ci = ca->data;
+ u8 msb, lsb;
+ u16 len;
+
+ mutex_lock(&ci->lock);
+ campoll(ci);
+ mutex_unlock(&ci->lock);
+
+ printk(KERN_INFO "read_data\n");
+ if (!ci->dr)
+ return 0;
+
+ mutex_lock(&ci->lock);
+ read_reg(ci, 0x0f, &msb);
+ read_reg(ci, 0x10, &lsb);
+ len = (msb<<8)|lsb;
+ read_block(ci, 0x12, ebuf, len);
+ ci->dr = 0;
+ mutex_unlock(&ci->lock);
+
+ return len;
+}
+
+static int write_data(struct dvb_ca_en50221 *ca, int slot, u8 *ebuf, int ecount)
+{
+ struct cxd *ci = ca->data;
+
+ mutex_lock(&ci->lock);
+ printk(KERN_INFO "write_data %d\n", ecount);
+ write_reg(ci, 0x0d, ecount>>8);
+ write_reg(ci, 0x0e, ecount&0xff);
+ write_block(ci, 0x11, ebuf, ecount);
+ mutex_unlock(&ci->lock);
+ return ecount;
+}
+#endif
+
+static struct dvb_ca_en50221 en_templ = {
+ .read_attribute_mem = read_attribute_mem,
+ .write_attribute_mem = write_attribute_mem,
+ .read_cam_control = read_cam_control,
+ .write_cam_control = write_cam_control,
+ .slot_reset = slot_reset,
+ .slot_shutdown = slot_shutdown,
+ .slot_ts_enable = slot_ts_enable,
+ .poll_slot_status = poll_slot_status,
+#ifdef BUFFER_MODE
+ .read_data = read_data,
+ .write_data = write_data,
+#endif
+
+};
+
+struct dvb_ca_en50221 *cxd2099_attach(u8 adr, void *priv,
+ struct i2c_adapter *i2c)
+{
+ struct cxd *ci = 0;
+ u32 bitrate = 62000000;
+ u8 val;
+
+ if (i2c_read_reg(i2c, adr, 0, &val) < 0) {
+ printk(KERN_ERR "No CXD2099 detected at %02x\n", adr);
+ return 0;
+ }
+
+ ci = kmalloc(sizeof(struct cxd), GFP_KERNEL);
+ if (!ci)
+ return 0;
+ memset(ci, 0, sizeof(*ci));
+
+ mutex_init(&ci->lock);
+ ci->i2c = i2c;
+ ci->adr = adr;
+ ci->lastaddress = 0xff;
+ ci->clk_reg_b = 0x4a;
+ ci->clk_reg_f = 0x1b;
+ ci->bitrate = bitrate;
+
+ memcpy(&ci->en, &en_templ, sizeof(en_templ));
+ ci->en.data = ci;
+ init(ci);
+ printk(KERN_INFO "Attached CXD2099AR at %02x\n", ci->adr);
+ return &ci->en;
+}
+EXPORT_SYMBOL(cxd2099_attach);
+
+MODULE_DESCRIPTION("cxd2099");
+MODULE_AUTHOR("Ralph Metzler <rjkm@metzlerbros.de>");
+MODULE_LICENSE("GPL");
diff --git a/drivers/staging/cxd2099/cxd2099.h b/drivers/staging/cxd2099/cxd2099.h
new file mode 100644
index 000000000000..bed54ff3e30b
--- /dev/null
+++ b/drivers/staging/cxd2099/cxd2099.h
@@ -0,0 +1,41 @@
+/*
+ * cxd2099.h: Driver for the CXD2099AR Common Interface Controller
+ *
+ * Copyright (C) 2010 DigitalDevices UG
+ *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 only, as published by the Free Software Foundation.
+ *
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA
+ * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
+ */
+
+#ifndef _CXD2099_H_
+#define _CXD2099_H_
+
+#include <dvb_ca_en50221.h>
+
+#if defined(CONFIG_DVB_CXD2099) || \
+ (defined(CONFIG_DVB_CXD2099_MODULE) && defined(MODULE))
+struct dvb_ca_en50221 *cxd2099_attach(u8 adr, void *priv, struct i2c_adapter *i2c);
+#else
+static inline struct dvb_ca_en50221 *cxd2099_attach(u8 adr, void *priv, struct i2c_adapter *i2c)
+{
+ printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
+ return NULL;
+}
+#endif
+
+#endif
diff --git a/drivers/staging/cxt1e1/musycc.c b/drivers/staging/cxt1e1/musycc.c
index f274c77fb3fc..5cc3423a6646 100644
--- a/drivers/staging/cxt1e1/musycc.c
+++ b/drivers/staging/cxt1e1/musycc.c
@@ -1455,7 +1455,7 @@ musycc_intr_bh_tasklet (ci_t * ci)
/*
* If the descriptor has not recovered, then leaving the EMPTY
* entry set will not signal to the MUSYCC that this descriptor
- * has been serviced. The Interrupt Queue can then start loosing
+ * has been serviced. The Interrupt Queue can then start losing
* available descriptors and MUSYCC eventually encounters and
* reports the INTFULL condition. Per manual, changing any bit
* marks descriptor as available, thus the use of different
diff --git a/drivers/staging/cxt1e1/musycc.h b/drivers/staging/cxt1e1/musycc.h
index d2c91ef686d1..68f3660f4477 100644
--- a/drivers/staging/cxt1e1/musycc.h
+++ b/drivers/staging/cxt1e1/musycc.h
@@ -74,7 +74,7 @@ extern "C"
#define INT_QUEUE_SIZE MUSYCC_NIQD
-/* RAM image of MUSYCC registers layed out as a C structure */
+/* RAM image of MUSYCC registers laid out as a C structure */
struct musycc_groupr
{
VINT32 thp[32]; /* Transmit Head Pointer [5-29] */
@@ -96,7 +96,7 @@ extern "C"
VINT32 pcd; /* Port Configuration Descriptor [5-19] */
};
-/* hardware MUSYCC registers layed out as a C structure */
+/* hardware MUSYCC registers laid out as a C structure */
struct musycc_globalr
{
VINT32 gbp; /* Group Base Pointer */
diff --git a/drivers/staging/cxt1e1/pmcc4_defs.h b/drivers/staging/cxt1e1/pmcc4_defs.h
index 186347b8d565..a39505f45c29 100644
--- a/drivers/staging/cxt1e1/pmcc4_defs.h
+++ b/drivers/staging/cxt1e1/pmcc4_defs.h
@@ -54,8 +54,8 @@
#define MUSYCC_MTU 2048 /* default */
#define MUSYCC_TXDESC_MIN 10 /* HDLC mode default */
#define MUSYCC_RXDESC_MIN 18 /* HDLC mode default */
-#define MUSYCC_TXDESC_TRANS 4 /* Transparent mode minumum # of TX descriptors */
-#define MUSYCC_RXDESC_TRANS 12 /* Transparent mode minumum # of RX descriptors */
+#define MUSYCC_TXDESC_TRANS 4 /* Transparent mode minimum # of TX descriptors */
+#define MUSYCC_RXDESC_TRANS 12 /* Transparent mode minimum # of RX descriptors */
#define MAX_DEFAULT_IFQLEN 32 /* network qlen */
diff --git a/drivers/staging/cxt1e1/sbecrc.c b/drivers/staging/cxt1e1/sbecrc.c
index 51232948091f..3f3cd60ac367 100644
--- a/drivers/staging/cxt1e1/sbecrc.c
+++ b/drivers/staging/cxt1e1/sbecrc.c
@@ -95,7 +95,7 @@ sbeCrc (u_int8_t *buffer, /* data buffer to crc */
/*
* if table not yet created, do so. Don't care about "extra" time
- * checking this everytime sbeCrc() is called, since CRC calculations are
+ * checking this every time sbeCrc() is called, since CRC calculations are
* already time consuming
*/
if (!crcTableInit)
diff --git a/drivers/staging/cxt1e1/sbeproc.c b/drivers/staging/cxt1e1/sbeproc.c
index 70b9b33f3522..f42531c3d8da 100644
--- a/drivers/staging/cxt1e1/sbeproc.c
+++ b/drivers/staging/cxt1e1/sbeproc.c
@@ -239,7 +239,7 @@ sbecom_proc_get_sbe_info (char *buffer, char **start, off_t offset,
*/
#if 1
- /* #4 - intepretation of above = set EOF, return len */
+ /* #4 - interpretation of above = set EOF, return len */
*eof = 1;
#endif
diff --git a/drivers/staging/dabusb/Kconfig b/drivers/staging/dabusb/Kconfig
deleted file mode 100644
index 87bdc425d3c5..000000000000
--- a/drivers/staging/dabusb/Kconfig
+++ /dev/null
@@ -1,14 +0,0 @@
-config USB_DABUSB
- tristate "DABUSB driver"
- depends on USB
- ---help---
- A Digital Audio Broadcasting (DAB) Receiver for USB and Linux
- brought to you by the DAB-Team
- <http://wwwbode.cs.tum.edu/Par/arch/dab/>. This driver can be taken
- as an example for URB-based bulk, control, and isochronous
- transactions. URB's are explained in
- <Documentation/usb/URB.txt>.
-
- To compile this driver as a module, choose M here: the
- module will be called dabusb.
-
diff --git a/drivers/staging/dabusb/Makefile b/drivers/staging/dabusb/Makefile
deleted file mode 100644
index 2ff2f228e5f9..000000000000
--- a/drivers/staging/dabusb/Makefile
+++ /dev/null
@@ -1,2 +0,0 @@
-obj-$(CONFIG_USB_DABUSB) += dabusb.o
-
diff --git a/drivers/staging/dabusb/TODO b/drivers/staging/dabusb/TODO
deleted file mode 100644
index f9c0314ea0c1..000000000000
--- a/drivers/staging/dabusb/TODO
+++ /dev/null
@@ -1,5 +0,0 @@
-This is a driver for an experimental sample developed in 2003. The driver
-never supported any commercial product, nor had any known user.
-If nobody takes care on it, the driver will be removed for 2.6.39.
-
-Please send patches to linux-media@vger.kernel.org
diff --git a/drivers/staging/dabusb/dabusb.c b/drivers/staging/dabusb/dabusb.c
deleted file mode 100644
index 21768a627750..000000000000
--- a/drivers/staging/dabusb/dabusb.c
+++ /dev/null
@@ -1,926 +0,0 @@
-/*****************************************************************************/
-
-/*
- * dabusb.c -- dab usb driver.
- *
- * Copyright (C) 1999 Deti Fliegl (deti@fliegl.de)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *
- *
- * $Id: dabusb.c,v 1.54 2000/07/24 21:39:39 deti Exp $
- *
- */
-
-/*****************************************************************************/
-
-#include <linux/module.h>
-#include <linux/socket.h>
-#include <linux/list.h>
-#include <linux/vmalloc.h>
-#include <linux/slab.h>
-#include <linux/init.h>
-#include <linux/uaccess.h>
-#include <linux/atomic.h>
-#include <linux/delay.h>
-#include <linux/usb.h>
-#include <linux/mutex.h>
-#include <linux/firmware.h>
-#include <linux/ihex.h>
-
-#include "dabusb.h"
-
-/*
- * Version Information
- */
-#define DRIVER_VERSION "v1.54"
-#define DRIVER_AUTHOR "Deti Fliegl, deti@fliegl.de"
-#define DRIVER_DESC "DAB-USB Interface Driver for Linux (c)1999"
-
-/* --------------------------------------------------------------------- */
-
-#ifdef CONFIG_USB_DYNAMIC_MINORS
-#define NRDABUSB 256
-#else
-#define NRDABUSB 4
-#endif
-
-/*-------------------------------------------------------------------*/
-
-static dabusb_t dabusb[NRDABUSB];
-static int buffers = 256;
-static struct usb_driver dabusb_driver;
-
-/*-------------------------------------------------------------------*/
-
-static int dabusb_add_buf_tail(pdabusb_t s, struct list_head *dst,
- struct list_head *src)
-{
- unsigned long flags;
- struct list_head *tmp;
- int ret = 0;
-
- spin_lock_irqsave(&s->lock, flags);
-
- if (list_empty(src)) {
- /* no elements in source buffer */
- ret = -1;
- goto err;
- }
- tmp = src->next;
- list_move_tail(tmp, dst);
-
-err: spin_unlock_irqrestore(&s->lock, flags);
- return ret;
-}
-/*-------------------------------------------------------------------*/
-#ifdef DEBUG
-static void dump_urb(struct urb *urb)
-{
- dbg("urb :%p", urb);
- dbg("dev :%p", urb->dev);
- dbg("pipe :%08X", urb->pipe);
- dbg("status :%d", urb->status);
- dbg("transfer_flags :%08X", urb->transfer_flags);
- dbg("transfer_buffer :%p", urb->transfer_buffer);
- dbg("transfer_buffer_length:%d", urb->transfer_buffer_length);
- dbg("actual_length :%d", urb->actual_length);
- dbg("setup_packet :%p", urb->setup_packet);
- dbg("start_frame :%d", urb->start_frame);
- dbg("number_of_packets :%d", urb->number_of_packets);
- dbg("interval :%d", urb->interval);
- dbg("error_count :%d", urb->error_count);
- dbg("context :%p", urb->context);
- dbg("complete :%p", urb->complete);
-}
-#endif
-/*-------------------------------------------------------------------*/
-static int dabusb_cancel_queue(pdabusb_t s, struct list_head *q)
-{
- unsigned long flags;
- pbuff_t b;
-
- dbg("dabusb_cancel_queue");
-
- spin_lock_irqsave(&s->lock, flags);
-
- list_for_each_entry(b, q, buff_list) {
-#ifdef DEBUG
- dump_urb(b->purb);
-#endif
- usb_unlink_urb(b->purb);
- }
- spin_unlock_irqrestore(&s->lock, flags);
- return 0;
-}
-/*-------------------------------------------------------------------*/
-static int dabusb_free_queue(struct list_head *q)
-{
- struct list_head *tmp;
- struct list_head *p;
- pbuff_t b;
-
- dbg("dabusb_free_queue");
- for (p = q->next; p != q;) {
- b = list_entry(p, buff_t, buff_list);
-
-#ifdef DEBUG
- dump_urb(b->purb);
-#endif
- kfree(b->purb->transfer_buffer);
- usb_free_urb(b->purb);
- tmp = p->next;
- list_del(p);
- kfree(b);
- p = tmp;
- }
-
- return 0;
-}
-/*-------------------------------------------------------------------*/
-static int dabusb_free_buffers(pdabusb_t s)
-{
- unsigned long flags;
- dbg("dabusb_free_buffers");
-
- spin_lock_irqsave(&s->lock, flags);
-
- dabusb_free_queue(&s->free_buff_list);
- dabusb_free_queue(&s->rec_buff_list);
-
- spin_unlock_irqrestore(&s->lock, flags);
-
- s->got_mem = 0;
- return 0;
-}
-/*-------------------------------------------------------------------*/
-static void dabusb_iso_complete(struct urb *purb)
-{
- pbuff_t b = purb->context;
- pdabusb_t s = b->s;
- int i;
- int len;
- int dst = 0;
- void *buf = purb->transfer_buffer;
-
- dbg("dabusb_iso_complete");
-
- /* process if URB was not killed */
- if (purb->status != -ENOENT) {
- unsigned int pipe = usb_rcvisocpipe(purb->dev, _DABUSB_ISOPIPE);
- int pipesize = usb_maxpacket(purb->dev, pipe,
- usb_pipeout(pipe));
- for (i = 0; i < purb->number_of_packets; i++)
- if (!purb->iso_frame_desc[i].status) {
- len = purb->iso_frame_desc[i].actual_length;
- if (len <= pipesize) {
- memcpy(buf + dst, buf + purb->iso_frame_desc[i].offset, len);
- dst += len;
- } else
- dev_err(&purb->dev->dev,
- "dabusb_iso_complete: invalid len %d\n",
- len);
- } else
- dev_warn(&purb->dev->dev,
- "dabusb_iso_complete: corrupted packet status: %d\n",
- purb->iso_frame_desc[i].status);
- if (dst != purb->actual_length)
- dev_err(&purb->dev->dev,
- "dst!=purb->actual_length:%d!=%d\n",
- dst, purb->actual_length);
- }
-
- if (atomic_dec_and_test(&s->pending_io) &&
- !s->remove_pending && s->state != _stopped) {
- s->overruns++;
- dev_err(&purb->dev->dev, "overrun (%d)\n", s->overruns);
- }
- wake_up(&s->wait);
-}
-/*-------------------------------------------------------------------*/
-static int dabusb_alloc_buffers(pdabusb_t s)
-{
- int transfer_len = 0;
- pbuff_t b;
- unsigned int pipe = usb_rcvisocpipe(s->usbdev, _DABUSB_ISOPIPE);
- int pipesize = usb_maxpacket(s->usbdev, pipe, usb_pipeout(pipe));
- int packets = _ISOPIPESIZE / pipesize;
- int transfer_buffer_length = packets * pipesize;
- int i;
-
- dbg("dabusb_alloc_buffers pipesize:%d packets:%d transfer_buffer_len:%d",
- pipesize, packets, transfer_buffer_length);
-
- while (transfer_len < (s->total_buffer_size << 10)) {
- b = kzalloc(sizeof(buff_t), GFP_KERNEL);
- if (!b) {
- dev_err(&s->usbdev->dev,
- "kzalloc(sizeof(buff_t))==NULL\n");
- goto err;
- }
- b->s = s;
- b->purb = usb_alloc_urb(packets, GFP_KERNEL);
- if (!b->purb) {
- dev_err(&s->usbdev->dev, "usb_alloc_urb == NULL\n");
- kfree(b);
- goto err;
- }
-
- b->purb->transfer_buffer = kmalloc(transfer_buffer_length,
- GFP_KERNEL);
- if (!b->purb->transfer_buffer) {
- kfree(b->purb);
- kfree(b);
- dev_err(&s->usbdev->dev,
- "kmalloc(%d)==NULL\n", transfer_buffer_length);
- goto err;
- }
-
- b->purb->transfer_buffer_length = transfer_buffer_length;
- b->purb->number_of_packets = packets;
- b->purb->complete = dabusb_iso_complete;
- b->purb->context = b;
- b->purb->dev = s->usbdev;
- b->purb->pipe = pipe;
- b->purb->transfer_flags = URB_ISO_ASAP;
-
- for (i = 0; i < packets; i++) {
- b->purb->iso_frame_desc[i].offset = i * pipesize;
- b->purb->iso_frame_desc[i].length = pipesize;
- }
-
- transfer_len += transfer_buffer_length;
- list_add_tail(&b->buff_list, &s->free_buff_list);
- }
- s->got_mem = transfer_len;
-
- return 0;
-
-err:
- dabusb_free_buffers(s);
- return -ENOMEM;
-}
-/*-------------------------------------------------------------------*/
-static int dabusb_bulk(pdabusb_t s, pbulk_transfer_t pb)
-{
- int ret;
- unsigned int pipe;
- int actual_length;
-
- dbg("dabusb_bulk");
-
- if (!pb->pipe)
- pipe = usb_rcvbulkpipe(s->usbdev, 2);
- else
- pipe = usb_sndbulkpipe(s->usbdev, 2);
-
- ret = usb_bulk_msg(s->usbdev, pipe, pb->data,
- pb->size, &actual_length, 100);
- if (ret < 0) {
- dev_err(&s->usbdev->dev,
- "usb_bulk_msg failed(%d)\n", ret);
-
- if (usb_set_interface(s->usbdev, _DABUSB_IF, 1) < 0) {
- dev_err(&s->usbdev->dev, "set_interface failed\n");
- return -EINVAL;
- }
-
- }
-
- if (ret == -EPIPE) {
- dev_warn(&s->usbdev->dev, "CLEAR_FEATURE request to remove STALL condition.\n");
- if (usb_clear_halt(s->usbdev, usb_pipeendpoint(pipe)))
- dev_err(&s->usbdev->dev, "request failed\n");
- }
-
- pb->size = actual_length;
- return ret;
-}
-/* --------------------------------------------------------------------- */
-static int dabusb_writemem(pdabusb_t s, int pos, const unsigned char *data,
- int len)
-{
- int ret;
- unsigned char *transfer_buffer = kmalloc(len, GFP_KERNEL);
-
- if (!transfer_buffer) {
- dev_err(&s->usbdev->dev,
- "dabusb_writemem: kmalloc(%d) failed.\n", len);
- return -ENOMEM;
- }
-
- memcpy(transfer_buffer, data, len);
-
- ret = usb_control_msg(s->usbdev, usb_sndctrlpipe(s->usbdev, 0),
- 0xa0, 0x40, pos, 0, transfer_buffer, len, 300);
-
- kfree(transfer_buffer);
- return ret;
-}
-/* --------------------------------------------------------------------- */
-static int dabusb_8051_reset(pdabusb_t s, unsigned char reset_bit)
-{
- dbg("dabusb_8051_reset: %d", reset_bit);
- return dabusb_writemem(s, CPUCS_REG, &reset_bit, 1);
-}
-/* --------------------------------------------------------------------- */
-static int dabusb_loadmem(pdabusb_t s, const char *fname)
-{
- int ret;
- const struct ihex_binrec *rec;
- const struct firmware *uninitialized_var(fw);
-
- dbg("Enter dabusb_loadmem (internal)");
-
- ret = request_ihex_firmware(&fw, "dabusb/firmware.fw", &s->usbdev->dev);
- if (ret) {
- dev_err(&s->usbdev->dev,
- "Failed to load \"dabusb/firmware.fw\": %d\n", ret);
- goto out;
- }
- ret = dabusb_8051_reset(s, 1);
-
- for (rec = (const struct ihex_binrec *)fw->data; rec;
- rec = ihex_next_binrec(rec)) {
- dbg("dabusb_writemem: %04X %p %d)", be32_to_cpu(rec->addr),
- rec->data, be16_to_cpu(rec->len));
-
- ret = dabusb_writemem(s, be32_to_cpu(rec->addr), rec->data,
- be16_to_cpu(rec->len));
- if (ret < 0) {
- dev_err(&s->usbdev->dev,
- "dabusb_writemem failed (%d %04X %p %d)\n",
- ret, be32_to_cpu(rec->addr),
- rec->data, be16_to_cpu(rec->len));
- break;
- }
- }
- ret = dabusb_8051_reset(s, 0);
- release_firmware(fw);
- out:
- dbg("dabusb_loadmem: exit");
-
- return ret;
-}
-/* --------------------------------------------------------------------- */
-static int dabusb_fpga_clear(pdabusb_t s, pbulk_transfer_t b)
-{
- b->size = 4;
- b->data[0] = 0x2a;
- b->data[1] = 0;
- b->data[2] = 0;
- b->data[3] = 0;
-
- dbg("dabusb_fpga_clear");
-
- return dabusb_bulk(s, b);
-}
-/* --------------------------------------------------------------------- */
-static int dabusb_fpga_init(pdabusb_t s, pbulk_transfer_t b)
-{
- b->size = 4;
- b->data[0] = 0x2c;
- b->data[1] = 0;
- b->data[2] = 0;
- b->data[3] = 0;
-
- dbg("dabusb_fpga_init");
-
- return dabusb_bulk(s, b);
-}
-/* --------------------------------------------------------------------- */
-static int dabusb_fpga_download(pdabusb_t s, const char *fname)
-{
- pbulk_transfer_t b = kmalloc(sizeof(bulk_transfer_t), GFP_KERNEL);
- const struct firmware *fw;
- unsigned int blen, n;
- int ret;
-
- dbg("Enter dabusb_fpga_download (internal)");
-
- if (!b) {
- dev_err(&s->usbdev->dev,
- "kmalloc(sizeof(bulk_transfer_t))==NULL\n");
- return -ENOMEM;
- }
-
- ret = request_firmware(&fw, "dabusb/bitstream.bin", &s->usbdev->dev);
- if (ret) {
- dev_err(&s->usbdev->dev,
- "Failed to load \"dabusb/bitstream.bin\": %d\n", ret);
- kfree(b);
- return ret;
- }
-
- b->pipe = 1;
- ret = dabusb_fpga_clear(s, b);
- mdelay(10);
- blen = fw->data[73] + (fw->data[72] << 8);
-
- dbg("Bitstream len: %i", blen);
-
- b->data[0] = 0x2b;
- b->data[1] = 0;
- b->data[2] = 0;
- b->data[3] = 60;
-
- for (n = 0; n <= blen + 60; n += 60) {
- /* some cclks for startup */
- b->size = 64;
- memcpy(b->data + 4, fw->data + 74 + n, 60);
- ret = dabusb_bulk(s, b);
- if (ret < 0) {
- dev_err(&s->usbdev->dev, "dabusb_bulk failed.\n");
- break;
- }
- mdelay(1);
- }
-
- ret = dabusb_fpga_init(s, b);
- kfree(b);
- release_firmware(fw);
-
- dbg("exit dabusb_fpga_download");
-
- return ret;
-}
-
-static int dabusb_stop(pdabusb_t s)
-{
- dbg("dabusb_stop");
-
- s->state = _stopped;
- dabusb_cancel_queue(s, &s->rec_buff_list);
-
- dbg("pending_io: %d", s->pending_io.counter);
-
- s->pending_io.counter = 0;
- return 0;
-}
-
-static int dabusb_startrek(pdabusb_t s)
-{
- if (!s->got_mem && s->state != _started) {
-
- dbg("dabusb_startrek");
-
- if (dabusb_alloc_buffers(s) < 0)
- return -ENOMEM;
- dabusb_stop(s);
- s->state = _started;
- s->readptr = 0;
- }
-
- if (!list_empty(&s->free_buff_list)) {
- pbuff_t end;
- int ret;
-
- while (!dabusb_add_buf_tail(s, &s->rec_buff_list, &s->free_buff_list)) {
-
- dbg("submitting: end:%p s->rec_buff_list:%p",
- s->rec_buff_list.prev, &s->rec_buff_list);
-
- end = list_entry(s->rec_buff_list.prev,
- buff_t, buff_list);
-
- ret = usb_submit_urb(end->purb, GFP_KERNEL);
- if (ret) {
- dev_err(&s->usbdev->dev,
- "usb_submit_urb returned:%d\n", ret);
- if (dabusb_add_buf_tail(s, &s->free_buff_list,
- &s->rec_buff_list))
- dev_err(&s->usbdev->dev,
- "startrek: dabusb_add_buf_tail failed\n");
- break;
- } else
- atomic_inc(&s->pending_io);
- }
- dbg("pending_io: %d", s->pending_io.counter);
- }
-
- return 0;
-}
-
-static ssize_t dabusb_read(struct file *file, char __user *buf,
- size_t count, loff_t *ppos)
-{
- pdabusb_t s = (pdabusb_t)file->private_data;
- unsigned long flags;
- unsigned ret = 0;
- int rem;
- int cnt;
- pbuff_t b;
- struct urb *purb = NULL;
-
- dbg("dabusb_read");
-
- if (*ppos)
- return -ESPIPE;
-
- if (s->remove_pending)
- return -EIO;
-
-
- if (!s->usbdev)
- return -EIO;
-
- while (count > 0) {
- dabusb_startrek(s);
-
- spin_lock_irqsave(&s->lock, flags);
-
- if (list_empty(&s->rec_buff_list)) {
-
- spin_unlock_irqrestore(&s->lock, flags);
-
- dev_err(&s->usbdev->dev,
- "error: rec_buf_list is empty\n");
- goto err;
- }
-
- b = list_entry(s->rec_buff_list.next, buff_t, buff_list);
- purb = b->purb;
-
- spin_unlock_irqrestore(&s->lock, flags);
-
- if (purb->status == -EINPROGRESS) {
- /* return nonblocking */
- if (file->f_flags & O_NONBLOCK) {
- if (!ret)
- ret = -EAGAIN;
- goto err;
- }
-
- interruptible_sleep_on(&s->wait);
-
- if (signal_pending(current)) {
- if (!ret)
- ret = -ERESTARTSYS;
- goto err;
- }
-
- spin_lock_irqsave(&s->lock, flags);
-
- if (list_empty(&s->rec_buff_list)) {
- spin_unlock_irqrestore(&s->lock, flags);
- dev_err(&s->usbdev->dev,
- "error: still no buffer available.\n");
- goto err;
- }
- spin_unlock_irqrestore(&s->lock, flags);
- s->readptr = 0;
- }
- if (s->remove_pending) {
- ret = -EIO;
- goto err;
- }
-
- /* set remaining bytes to copy */
- rem = purb->actual_length - s->readptr;
-
- if (count >= rem)
- cnt = rem;
- else
- cnt = count;
-
- dbg("copy_to_user:%p %p %d", buf,
- purb->transfer_buffer + s->readptr, cnt);
-
- if (copy_to_user(buf,
- purb->transfer_buffer + s->readptr,
- cnt)) {
- dev_err(&s->usbdev->dev, "read: copy_to_user failed\n");
- if (!ret)
- ret = -EFAULT;
- goto err;
- }
-
- s->readptr += cnt;
- count -= cnt;
- buf += cnt;
- ret += cnt;
-
- if (s->readptr == purb->actual_length) {
- /* finished, take next buffer */
- if (dabusb_add_buf_tail(s, &s->free_buff_list,
- &s->rec_buff_list))
- dev_err(&s->usbdev->dev,
- "read: dabusb_add_buf_tail failed\n");
- s->readptr = 0;
- }
- }
-err: /*mutex_unlock(&s->mutex);*/
- return ret;
-}
-
-static int dabusb_open(struct inode *inode, struct file *file)
-{
- int devnum = iminor(inode);
- pdabusb_t s;
- int r;
-
- if (devnum < DABUSB_MINOR || devnum >= (DABUSB_MINOR + NRDABUSB))
- return -EIO;
-
- s = &dabusb[devnum - DABUSB_MINOR];
-
- dbg("dabusb_open");
- mutex_lock(&s->mutex);
-
- while (!s->usbdev || s->opened) {
- mutex_unlock(&s->mutex);
-
- if (file->f_flags & O_NONBLOCK)
- return -EBUSY;
- msleep_interruptible(500);
-
- if (signal_pending(current))
- return -EAGAIN;
- mutex_lock(&s->mutex);
- }
- if (usb_set_interface(s->usbdev, _DABUSB_IF, 1) < 0) {
- mutex_unlock(&s->mutex);
- dev_err(&s->usbdev->dev, "set_interface failed\n");
- return -EINVAL;
- }
- s->opened = 1;
- mutex_unlock(&s->mutex);
-
- file->f_pos = 0;
- file->private_data = s;
-
- r = nonseekable_open(inode, file);
- return r;
-}
-
-static int dabusb_release(struct inode *inode, struct file *file)
-{
- pdabusb_t s = (pdabusb_t)file->private_data;
-
- dbg("dabusb_release");
-
- mutex_lock(&s->mutex);
- dabusb_stop(s);
- dabusb_free_buffers(s);
- mutex_unlock(&s->mutex);
-
- if (!s->remove_pending) {
- if (usb_set_interface(s->usbdev, _DABUSB_IF, 0) < 0)
- dev_err(&s->usbdev->dev, "set_interface failed\n");
- } else
- wake_up(&s->remove_ok);
-
- s->opened = 0;
- return 0;
-}
-
-static long dabusb_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
-{
- pdabusb_t s = (pdabusb_t)file->private_data;
- pbulk_transfer_t pbulk;
- int ret = 0;
- int version = DABUSB_VERSION;
-
- dbg("dabusb_ioctl");
-
- if (s->remove_pending)
- return -EIO;
-
- mutex_lock(&s->mutex);
-
- if (!s->usbdev) {
- mutex_unlock(&s->mutex);
- return -EIO;
- }
-
- switch (cmd) {
-
- case IOCTL_DAB_BULK:
- pbulk = memdup_user((void __user *)arg,
- sizeof(bulk_transfer_t));
-
- if (IS_ERR(pbulk)) {
- ret = PTR_ERR(pbulk);
- break;
- }
-
- ret = dabusb_bulk(s, pbulk);
- if (ret == 0)
- if (copy_to_user((void __user *)arg, pbulk,
- sizeof(bulk_transfer_t)))
- ret = -EFAULT;
- kfree(pbulk);
- break;
-
- case IOCTL_DAB_OVERRUNS:
- ret = put_user(s->overruns, (unsigned int __user *) arg);
- break;
-
- case IOCTL_DAB_VERSION:
- ret = put_user(version, (unsigned int __user *) arg);
- break;
-
- default:
- ret = -ENOIOCTLCMD;
- break;
- }
- mutex_unlock(&s->mutex);
- return ret;
-}
-
-static const struct file_operations dabusb_fops = {
- .owner = THIS_MODULE,
- .llseek = no_llseek,
- .read = dabusb_read,
- .unlocked_ioctl = dabusb_ioctl,
- .open = dabusb_open,
- .release = dabusb_release,
-};
-
-static char *dabusb_devnode(struct device *dev, mode_t *mode)
-{
- return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev));
-}
-
-static struct usb_class_driver dabusb_class = {
- .name = "dabusb%d",
- .devnode = dabusb_devnode,
- .fops = &dabusb_fops,
- .minor_base = DABUSB_MINOR,
-};
-
-
-/* --------------------------------------------------------------------- */
-static int dabusb_probe(struct usb_interface *intf,
- const struct usb_device_id *id)
-{
- struct usb_device *usbdev = interface_to_usbdev(intf);
- int retval;
- pdabusb_t s;
-
- dbg("dabusb: probe: vendor id 0x%x, device id 0x%x ifnum:%d",
- le16_to_cpu(usbdev->descriptor.idVendor),
- le16_to_cpu(usbdev->descriptor.idProduct),
- intf->altsetting->desc.bInterfaceNumber);
-
- /* We don't handle multiple configurations */
- if (usbdev->descriptor.bNumConfigurations != 1)
- return -ENODEV;
-
- if (intf->altsetting->desc.bInterfaceNumber != _DABUSB_IF &&
- le16_to_cpu(usbdev->descriptor.idProduct) == 0x9999)
- return -ENODEV;
-
-
-
- s = &dabusb[intf->minor];
-
- mutex_lock(&s->mutex);
- s->remove_pending = 0;
- s->usbdev = usbdev;
- s->devnum = intf->minor;
-
- if (usb_reset_configuration(usbdev) < 0) {
- dev_err(&intf->dev, "reset_configuration failed\n");
- goto reject;
- }
- if (le16_to_cpu(usbdev->descriptor.idProduct) == 0x2131) {
- dabusb_loadmem(s, NULL);
- goto reject;
- } else {
- dabusb_fpga_download(s, NULL);
-
- if (usb_set_interface(s->usbdev, _DABUSB_IF, 0) < 0) {
- dev_err(&intf->dev, "set_interface failed\n");
- goto reject;
- }
- }
- dbg("bound to interface: %d", intf->altsetting->desc.bInterfaceNumber);
- usb_set_intfdata(intf, s);
- mutex_unlock(&s->mutex);
-
- retval = usb_register_dev(intf, &dabusb_class);
- if (retval) {
- usb_set_intfdata(intf, NULL);
- return -ENOMEM;
- }
-
- return 0;
-
-reject:
- mutex_unlock(&s->mutex);
- s->usbdev = NULL;
- return -ENODEV;
-}
-
-static void dabusb_disconnect(struct usb_interface *intf)
-{
- wait_queue_t __wait;
- pdabusb_t s = usb_get_intfdata(intf);
-
- dbg("dabusb_disconnect");
-
- init_waitqueue_entry(&__wait, current);
-
- usb_set_intfdata(intf, NULL);
- if (s) {
- usb_deregister_dev(intf, &dabusb_class);
- s->remove_pending = 1;
- wake_up(&s->wait);
- add_wait_queue(&s->remove_ok, &__wait);
- set_current_state(TASK_UNINTERRUPTIBLE);
- if (s->state == _started)
- schedule();
- current->state = TASK_RUNNING;
- remove_wait_queue(&s->remove_ok, &__wait);
-
- s->usbdev = NULL;
- s->overruns = 0;
- }
-}
-
-static struct usb_device_id dabusb_ids[] = {
- /* { USB_DEVICE(0x0547, 0x2131) },*/ /* An2131 chip, no boot ROM */
- { USB_DEVICE(0x0547, 0x9999) },
- { } /* Terminating entry */
-};
-
-MODULE_DEVICE_TABLE(usb, dabusb_ids);
-
-static struct usb_driver dabusb_driver = {
- .name = "dabusb",
- .probe = dabusb_probe,
- .disconnect = dabusb_disconnect,
- .id_table = dabusb_ids,
-};
-
-/* --------------------------------------------------------------------- */
-
-static int __init dabusb_init(void)
-{
- int retval;
- unsigned u;
-
- /* initialize struct */
- for (u = 0; u < NRDABUSB; u++) {
- pdabusb_t s = &dabusb[u];
- memset(s, 0, sizeof(dabusb_t));
- mutex_init(&s->mutex);
- s->usbdev = NULL;
- s->total_buffer_size = buffers;
- init_waitqueue_head(&s->wait);
- init_waitqueue_head(&s->remove_ok);
- spin_lock_init(&s->lock);
- INIT_LIST_HEAD(&s->free_buff_list);
- INIT_LIST_HEAD(&s->rec_buff_list);
- }
-
- /* register misc device */
- retval = usb_register(&dabusb_driver);
- if (retval)
- goto out;
-
- dbg("dabusb_init: driver registered");
-
- printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
- DRIVER_DESC "\n");
-
-out:
- return retval;
-}
-
-static void __exit dabusb_cleanup(void)
-{
- dbg("dabusb_cleanup");
-
- usb_deregister(&dabusb_driver);
-}
-
-/* --------------------------------------------------------------------- */
-
-MODULE_AUTHOR(DRIVER_AUTHOR);
-MODULE_DESCRIPTION(DRIVER_DESC);
-MODULE_LICENSE("GPL");
-MODULE_FIRMWARE("dabusb/firmware.fw");
-MODULE_FIRMWARE("dabusb/bitstream.bin");
-
-module_param(buffers, int, 0);
-MODULE_PARM_DESC(buffers, "Number of buffers (default=256)");
-
-module_init(dabusb_init);
-module_exit(dabusb_cleanup);
-
-/* --------------------------------------------------------------------- */
diff --git a/drivers/staging/dabusb/dabusb.h b/drivers/staging/dabusb/dabusb.h
deleted file mode 100644
index c1772efe7c2c..000000000000
--- a/drivers/staging/dabusb/dabusb.h
+++ /dev/null
@@ -1,80 +0,0 @@
-#define _BULK_DATA_LEN 64
-typedef struct {
- unsigned char data[_BULK_DATA_LEN];
- unsigned int size;
- unsigned int pipe;
-} bulk_transfer_t, *pbulk_transfer_t;
-
-#define DABUSB_MINOR 240 /* some unassigned USB minor */
-#define DABUSB_VERSION 0x1000
-#define IOCTL_DAB_BULK _IOWR('d', 0x30, bulk_transfer_t)
-#define IOCTL_DAB_OVERRUNS _IOR('d', 0x15, int)
-#define IOCTL_DAB_VERSION _IOR('d', 0x3f, int)
-
-#ifdef __KERNEL__
-
-typedef enum { _stopped = 0, _started } driver_state_t;
-
-typedef struct {
- struct mutex mutex;
- struct usb_device *usbdev;
- wait_queue_head_t wait;
- wait_queue_head_t remove_ok;
- spinlock_t lock;
- atomic_t pending_io;
- driver_state_t state;
- int remove_pending;
- int got_mem;
- int total_buffer_size;
- unsigned int overruns;
- int readptr;
- int opened;
- int devnum;
- struct list_head free_buff_list;
- struct list_head rec_buff_list;
-} dabusb_t, *pdabusb_t;
-
-typedef struct {
- pdabusb_t s;
- struct urb *purb;
- struct list_head buff_list;
-} buff_t, *pbuff_t;
-
-typedef struct {
- wait_queue_head_t wait;
-} bulk_completion_context_t, *pbulk_completion_context_t;
-
-
-#define _DABUSB_IF 2
-#define _DABUSB_ISOPIPE 0x09
-#define _ISOPIPESIZE 16384
-
-#define _BULK_DATA_LEN 64
-/* Vendor specific request code for Anchor Upload/Download
- *This one is implemented in the core */
-#define ANCHOR_LOAD_INTERNAL 0xA0
-
-/* EZ-USB Control and Status Register. Bit 0 controls 8051 reset */
-#define CPUCS_REG 0x7F92
-#define _TOTAL_BUFFERS 384
-
-#define MAX_INTEL_HEX_RECORD_LENGTH 16
-
-#ifndef _BYTE_DEFINED
-#define _BYTE_DEFINED
-typedef unsigned char BYTE;
-#endif /* !_BYTE_DEFINED */
-
-#ifndef _WORD_DEFINED
-#define _WORD_DEFINED
-typedef unsigned short WORD;
-#endif /* !_WORD_DEFINED */
-
-typedef struct _INTEL_HEX_RECORD {
- BYTE Length;
- WORD Address;
- BYTE Type;
- BYTE Data[MAX_INTEL_HEX_RECORD_LENGTH];
-} INTEL_HEX_RECORD, *PINTEL_HEX_RECORD;
-
-#endif
diff --git a/drivers/staging/easycap/easycap_ioctl.c b/drivers/staging/easycap/easycap_ioctl.c
index 28a28e02c9ce..b3bd11d5879f 100644
--- a/drivers/staging/easycap/easycap_ioctl.c
+++ b/drivers/staging/easycap/easycap_ioctl.c
@@ -1391,8 +1391,7 @@ long easycap_unlocked_ioctl(struct file *file,
break;
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
- case VIDIOC_S_CTRL:
- {
+ case VIDIOC_S_CTRL: {
struct v4l2_control v4l2_control;
JOM(8, "VIDIOC_S_CTRL\n");
diff --git a/drivers/staging/et131x/et1310_address_map.h b/drivers/staging/et131x/et1310_address_map.h
index e6c8cb3828e9..425e9274f28a 100644
--- a/drivers/staging/et131x/et1310_address_map.h
+++ b/drivers/staging/et131x/et1310_address_map.h
@@ -856,7 +856,7 @@ typedef union _RXMAC_UNI_PF_ADDR3_t {
*/
/*
- * structure for space availiable reg in rxmac address map.
+ * structure for space available reg in rxmac address map.
* located at address 0x4094
*
* 31-17: reserved
@@ -1031,7 +1031,7 @@ typedef struct _RXMAC_t { /* Location: */
* 31: reset MII mgmt
* 30-6: unused
* 5: scan auto increment
- * 4: preamble supress
+ * 4: preamble suppress
* 3: undefined
* 2-0: mgmt clock reset
*/
diff --git a/drivers/staging/et131x/et1310_phy.h b/drivers/staging/et131x/et1310_phy.h
index 78349adc7d8e..946c0c547404 100644
--- a/drivers/staging/et131x/et1310_phy.h
+++ b/drivers/staging/et131x/et1310_phy.h
@@ -468,7 +468,7 @@ typedef union _MI_ANAR_t {
#define TRUEPHY_ANEG_COMPLETE 1
#define TRUEPHY_ANEG_DISABLED 2
-/* Define duplex advertisment flags */
+/* Define duplex advertisement flags */
#define TRUEPHY_ADV_DUPLEX_NONE 0x00
#define TRUEPHY_ADV_DUPLEX_FULL 0x01
#define TRUEPHY_ADV_DUPLEX_HALF 0x02
diff --git a/drivers/staging/et131x/et1310_rx.c b/drivers/staging/et131x/et1310_rx.c
index 339136f64be1..fc6bd438366d 100644
--- a/drivers/staging/et131x/et1310_rx.c
+++ b/drivers/staging/et131x/et1310_rx.c
@@ -122,7 +122,7 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
* number of entries in FBR1.
*
* FBR1 holds "large" frames, FBR0 holds "small" frames. If FBR1
- * entries are huge in order to accomodate a "jumbo" frame, then it
+ * entries are huge in order to accommodate a "jumbo" frame, then it
* will have less entries. Conversely, FBR1 will now be relied upon
* to carry more "normal" frames, thus it's entry size also increases
* and the number of entries goes up too (since it now carries
diff --git a/drivers/staging/et131x/et131x_isr.c b/drivers/staging/et131x/et131x_isr.c
index ce4d93042679..f716e408712b 100644
--- a/drivers/staging/et131x/et131x_isr.c
+++ b/drivers/staging/et131x/et131x_isr.c
@@ -466,7 +466,7 @@ void et131x_isr_handler(struct work_struct *work)
/* Handle SLV Timeout Interrupt */
if (status & ET_INTR_SLV_TIMEOUT) {
/*
- * This means a timeout has occured on a read or
+ * This means a timeout has occurred on a read or
* write request to one of the JAGCore registers. The
* Global Resources block has terminated the request
* and on a read request, returned a "fake" value.
diff --git a/drivers/staging/et131x/et131x_netdev.c b/drivers/staging/et131x/et131x_netdev.c
index 0c298cae90d9..b25bae29042e 100644
--- a/drivers/staging/et131x/et131x_netdev.c
+++ b/drivers/staging/et131x/et131x_netdev.c
@@ -415,7 +415,7 @@ void et131x_multicast(struct net_device *netdev)
*/
PacketFilter = adapter->PacketFilter;
- /* Clear the 'multicast' flag locally; becuase we only have a single
+ /* Clear the 'multicast' flag locally; because we only have a single
* flag to check multicast, and multiple multicast addresses can be
* set, this is the easiest way to determine if more than one
* multicast address is being set.
diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dev.h b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dev.h
index 4a89bd1bbf74..0b63f051f27c 100644
--- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dev.h
+++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dev.h
@@ -30,7 +30,7 @@
//---------------------------------------------------------------------------
//
// Function: ft1000_read_reg
-// Descripton: This function will read the value of a given ASIC register.
+// Description: This function will read the value of a given ASIC register.
// Input:
// dev - device structure
// offset - ASIC register offset
@@ -49,7 +49,7 @@ static inline u16 ft1000_read_reg (struct net_device *dev, u16 offset) {
//---------------------------------------------------------------------------
//
// Function: ft1000_write_reg
-// Descripton: This function will set the value for a given ASIC register.
+// Description: This function will set the value for a given ASIC register.
// Input:
// dev - device structure
// offset - ASIC register offset
diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c
index b0729fc3c89a..fb375ea26dd2 100644
--- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c
+++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c
@@ -95,47 +95,47 @@ void put_request_value(struct net_device *dev, long lvalue);
USHORT hdr_checksum(PPSEUDO_HDR pHdr);
typedef struct _DSP_FILE_HDR {
- long build_date;
- long dsp_coff_date;
- long loader_code_address;
- long loader_code_size;
- long loader_code_end;
- long dsp_code_address;
- long dsp_code_size;
- long dsp_code_end;
- long reserved[8];
+ u32 build_date;
+ u32 dsp_coff_date;
+ u32 loader_code_address;
+ u32 loader_code_size;
+ u32 loader_code_end;
+ u32 dsp_code_address;
+ u32 dsp_code_size;
+ u32 dsp_code_end;
+ u32 reserved[8];
} __attribute__ ((packed)) DSP_FILE_HDR, *PDSP_FILE_HDR;
typedef struct _DSP_FILE_HDR_5 {
- long version_id; // Version ID of this image format.
- long package_id; // Package ID of code release.
- long build_date; // Date/time stamp when file was built.
- long commands_offset; // Offset to attached commands in Pseudo Hdr format.
- long loader_offset; // Offset to bootloader code.
- long loader_code_address; // Start address of bootloader.
- long loader_code_end; // Where bootloader code ends.
- long loader_code_size;
- long version_data_offset; // Offset were scrambled version data begins.
- long version_data_size; // Size, in words, of scrambled version data.
- long nDspImages; // Number of DSP images in file.
+ u32 version_id; // Version ID of this image format.
+ u32 package_id; // Package ID of code release.
+ u32 build_date; // Date/time stamp when file was built.
+ u32 commands_offset; // Offset to attached commands in Pseudo Hdr format.
+ u32 loader_offset; // Offset to bootloader code.
+ u32 loader_code_address; // Start address of bootloader.
+ u32 loader_code_end; // Where bootloader code ends.
+ u32 loader_code_size;
+ u32 version_data_offset; // Offset were scrambled version data begins.
+ u32 version_data_size; // Size, in words, of scrambled version data.
+ u32 nDspImages; // Number of DSP images in file.
} __attribute__ ((packed)) DSP_FILE_HDR_5, *PDSP_FILE_HDR_5;
typedef struct _DSP_IMAGE_INFO {
- long coff_date; // Date/time when DSP Coff image was built.
- long begin_offset; // Offset in file where image begins.
- long end_offset; // Offset in file where image begins.
- long run_address; // On chip Start address of DSP code.
- long image_size; // Size of image.
- long version; // Embedded version # of DSP code.
+ u32 coff_date; // Date/time when DSP Coff image was built.
+ u32 begin_offset; // Offset in file where image begins.
+ u32 end_offset; // Offset in file where image begins.
+ u32 run_address; // On chip Start address of DSP code.
+ u32 image_size; // Size of image.
+ u32 version; // Embedded version # of DSP code.
} __attribute__ ((packed)) DSP_IMAGE_INFO, *PDSP_IMAGE_INFO;
typedef struct _DSP_IMAGE_INFO_V6 {
- long coff_date; // Date/time when DSP Coff image was built.
- long begin_offset; // Offset in file where image begins.
- long end_offset; // Offset in file where image begins.
- long run_address; // On chip Start address of DSP code.
- long image_size; // Size of image.
- long version; // Embedded version # of DSP code.
+ u32 coff_date; // Date/time when DSP Coff image was built.
+ u32 begin_offset; // Offset in file where image begins.
+ u32 end_offset; // Offset in file where image begins.
+ u32 run_address; // On chip Start address of DSP code.
+ u32 image_size; // Size of image.
+ u32 version; // Embedded version # of DSP code.
unsigned short checksum; // Dsp File checksum
unsigned short pad1;
} __attribute__ ((packed)) DSP_IMAGE_INFO_V6, *PDSP_IMAGE_INFO_V6;
@@ -846,8 +846,8 @@ int card_download(struct net_device *dev, const u8 *pFileStart, UINT FileLength)
break;
case STATE_DONE_DWNLD:
- if (((UINT) (pUcFile) - (UINT) pFileStart) >=
- (UINT) FileLength) {
+ if (((unsigned long) (pUcFile) - (unsigned long) pFileStart) >=
+ (unsigned long) FileLength) {
uiState = STATE_DONE_FILE;
break;
}
@@ -901,11 +901,11 @@ int card_download(struct net_device *dev, const u8 *pFileStart, UINT FileLength)
&info->prov_list);
// Move to next entry if available
pUcFile =
- (UCHAR *) ((UINT) pUcFile +
- (UINT) ((usHdrLength + 1) & 0xFFFFFFFE) + sizeof(PSEUDO_HDR));
- if ((UINT) (pUcFile) -
- (UINT) (pFileStart) >=
- (UINT) FileLength) {
+ (UCHAR *) ((unsigned long) pUcFile +
+ (unsigned long) ((usHdrLength + 1) & 0xFFFFFFFE) + sizeof(PSEUDO_HDR));
+ if ((unsigned long) (pUcFile) -
+ (unsigned long) (pFileStart) >=
+ (unsigned long) FileLength) {
uiState =
STATE_DONE_FILE;
}
diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
index ff691d9b984e..830822f86e41 100644
--- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
+++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
@@ -90,7 +90,7 @@ MODULE_SUPPORTED_DEVICE("FT1000");
//---------------------------------------------------------------------------
//
// Function: ft1000_asic_read
-// Descripton: This function will retrieve the value of a specific ASIC
+// Description: This function will retrieve the value of a specific ASIC
// register.
// Input:
// dev - network device structure
@@ -107,7 +107,7 @@ inline u16 ft1000_asic_read(struct net_device *dev, u16 offset)
//---------------------------------------------------------------------------
//
// Function: ft1000_asic_write
-// Descripton: This function will set the value of a specific ASIC
+// Description: This function will set the value of a specific ASIC
// register.
// Input:
// dev - network device structure
@@ -124,7 +124,7 @@ inline void ft1000_asic_write(struct net_device *dev, u16 offset, u16 value)
//---------------------------------------------------------------------------
//
// Function: ft1000_read_fifo_len
-// Descripton: This function will read the ASIC Uplink FIFO status register
+// Description: This function will read the ASIC Uplink FIFO status register
// which will return the number of bytes remaining in the Uplink FIFO.
// Sixteen bytes are subtracted to make sure that the ASIC does not
// reach its threshold.
@@ -148,7 +148,7 @@ static inline u16 ft1000_read_fifo_len(struct net_device *dev)
//---------------------------------------------------------------------------
//
// Function: ft1000_read_dpram
-// Descripton: This function will read the specific area of dpram
+// Description: This function will read the specific area of dpram
// (Electrabuzz ASIC only)
// Input:
// dev - device structure
@@ -175,7 +175,7 @@ u16 ft1000_read_dpram(struct net_device * dev, int offset)
//---------------------------------------------------------------------------
//
// Function: ft1000_write_dpram
-// Descripton: This function will write to a specific area of dpram
+// Description: This function will write to a specific area of dpram
// (Electrabuzz ASIC only)
// Input:
// dev - device structure
@@ -201,7 +201,7 @@ static inline void ft1000_write_dpram(struct net_device *dev,
//---------------------------------------------------------------------------
//
// Function: ft1000_read_dpram_mag_16
-// Descripton: This function will read the specific area of dpram
+// Description: This function will read the specific area of dpram
// (Magnemite ASIC only)
// Input:
// dev - device structure
@@ -233,7 +233,7 @@ u16 ft1000_read_dpram_mag_16(struct net_device *dev, int offset, int Index)
//---------------------------------------------------------------------------
//
// Function: ft1000_write_dpram_mag_16
-// Descripton: This function will write to a specific area of dpram
+// Description: This function will write to a specific area of dpram
// (Magnemite ASIC only)
// Input:
// dev - device structure
@@ -263,7 +263,7 @@ static inline void ft1000_write_dpram_mag_16(struct net_device *dev,
//---------------------------------------------------------------------------
//
// Function: ft1000_read_dpram_mag_32
-// Descripton: This function will read the specific area of dpram
+// Description: This function will read the specific area of dpram
// (Magnemite ASIC only)
// Input:
// dev - device structure
@@ -290,7 +290,7 @@ u32 ft1000_read_dpram_mag_32(struct net_device *dev, int offset)
//---------------------------------------------------------------------------
//
// Function: ft1000_write_dpram_mag_32
-// Descripton: This function will write to a specific area of dpram
+// Description: This function will write to a specific area of dpram
// (Magnemite ASIC only)
// Input:
// dev - device structure
@@ -315,7 +315,7 @@ void ft1000_write_dpram_mag_32(struct net_device *dev, int offset, u32 value)
//---------------------------------------------------------------------------
//
// Function: ft1000_enable_interrupts
-// Descripton: This function will enable interrupts base on the current interrupt mask.
+// Description: This function will enable interrupts base on the current interrupt mask.
// Input:
// dev - device structure
// Output:
@@ -340,7 +340,7 @@ static void ft1000_enable_interrupts(struct net_device *dev)
//---------------------------------------------------------------------------
//
// Function: ft1000_disable_interrupts
-// Descripton: This function will disable all interrupts.
+// Description: This function will disable all interrupts.
// Input:
// dev - device structure
// Output:
@@ -364,7 +364,7 @@ static void ft1000_disable_interrupts(struct net_device *dev)
//---------------------------------------------------------------------------
//
// Function: ft1000_reset_asic
-// Descripton: This function will call the Card Service function to reset the
+// Description: This function will call the Card Service function to reset the
// ASIC.
// Input:
// dev - device structure
@@ -408,7 +408,7 @@ static void ft1000_reset_asic(struct net_device *dev)
//---------------------------------------------------------------------------
//
// Function: ft1000_reset_card
-// Descripton: This function will reset the card
+// Description: This function will reset the card
// Input:
// dev - device structure
// Output:
@@ -571,7 +571,7 @@ static int ft1000_reset_card(struct net_device *dev)
//---------------------------------------------------------------------------
//
// Function: ft1000_chkcard
-// Descripton: This function will check if the device is presently available on
+// Description: This function will check if the device is presently available on
// the system.
// Input:
// dev - device structure
@@ -607,7 +607,7 @@ static int ft1000_chkcard(struct net_device *dev)
//---------------------------------------------------------------------------
//
// Function: ft1000_hbchk
-// Descripton: This function will perform the heart beat check of the DSP as
+// Description: This function will perform the heart beat check of the DSP as
// well as the ASIC.
// Input:
// dev - device structure
@@ -828,7 +828,7 @@ static void ft1000_hbchk(u_long data)
//---------------------------------------------------------------------------
//
// Function: ft1000_send_cmd
-// Descripton:
+// Description:
// Input:
// Output:
//
@@ -908,7 +908,7 @@ void ft1000_send_cmd (struct net_device *dev, u16 *ptempbuffer, int size, u16 qt
//---------------------------------------------------------------------------
//
// Function: ft1000_receive_cmd
-// Descripton: This function will read a message from the dpram area.
+// Description: This function will read a message from the dpram area.
// Input:
// dev - network device structure
// pbuffer - caller supply address to buffer
@@ -1003,7 +1003,7 @@ BOOLEAN ft1000_receive_cmd(struct net_device *dev, u16 * pbuffer, int maxsz, u16
//---------------------------------------------------------------------------
//
// Function: ft1000_proc_drvmsg
-// Descripton: This function will process the various driver messages.
+// Description: This function will process the various driver messages.
// Input:
// dev - device structure
// pnxtph - pointer to next pseudo header
@@ -1285,7 +1285,7 @@ void ft1000_proc_drvmsg(struct net_device *dev)
//---------------------------------------------------------------------------
//
// Function: ft1000_parse_dpram_msg
-// Descripton: This function will parse the message received from the DSP
+// Description: This function will parse the message received from the DSP
// via the DPRAM interface.
// Input:
// dev - device structure
@@ -1442,7 +1442,7 @@ int ft1000_parse_dpram_msg(struct net_device *dev)
//---------------------------------------------------------------------------
//
// Function: ft1000_flush_fifo
-// Descripton: This function will flush one packet from the downlink
+// Description: This function will flush one packet from the downlink
// FIFO.
// Input:
// dev - device structure
@@ -1587,7 +1587,7 @@ static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum)
//---------------------------------------------------------------------------
//
// Function: ft1000_copy_up_pkt
-// Descripton: This function will pull Flarion packets out of the Downlink
+// Description: This function will pull Flarion packets out of the Downlink
// FIFO and convert it to an ethernet packet. The ethernet packet will
// then be deliver to the TCP/IP stack.
// Input:
@@ -1773,7 +1773,7 @@ int ft1000_copy_up_pkt(struct net_device *dev)
//---------------------------------------------------------------------------
//
// Function: ft1000_copy_down_pkt
-// Descripton: This function will take an ethernet packet and convert it to
+// Description: This function will take an ethernet packet and convert it to
// a Flarion packet prior to sending it to the ASIC Downlink
// FIFO.
// Input:
@@ -2288,7 +2288,3 @@ err_dev:
free_netdev(dev);
return NULL;
}
-
-EXPORT_SYMBOL(init_ft1000_card);
-EXPORT_SYMBOL(stop_ft1000_card);
-EXPORT_SYMBOL(flarion_ft1000_cnt);
diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c
index 935608e72007..bdfb1aec58df 100644
--- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c
+++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c
@@ -214,6 +214,3 @@ void ft1000CleanupProc(struct net_device *dev)
remove_proc_entry(FT1000_PROC, init_net.proc_net);
unregister_netdevice_notifier(&ft1000_netdev_notifier);
}
-
-EXPORT_SYMBOL(ft1000InitProc);
-EXPORT_SYMBOL(ft1000CleanupProc);
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
index 8e622425aa13..1972b72450d4 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c
@@ -488,7 +488,7 @@ static int check_buffers(u16 *buff_w, u16 *buff_r, int len, int offset)
// Parameters: struct ft1000_device - device structure
// u16 **pUsFile - DSP image file pointer in u16
// u8 **pUcFile - DSP image file pointer in u8
-// long word_length - lenght of the buffer to be written
+// long word_length - length of the buffer to be written
// to DPRAM
//
// Returns: STATUS_SUCCESS - success
@@ -628,7 +628,7 @@ static void usb_dnld_complete (struct urb *urb)
// Parameters: struct ft1000_device - device structure
// u16 **pUsFile - DSP image file pointer in u16
// u8 **pUcFile - DSP image file pointer in u8
-// long word_length - lenght of the buffer to be written
+// long word_length - length of the buffer to be written
// to DPRAM
//
// Returns: STATUS_SUCCESS - success
@@ -817,7 +817,7 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart,
* Error, beyond boot code range.
*/
DEBUG
- ("FT1000:download:Download error: Requested len=%d exceeds BOOT code boundry.\n",
+ ("FT1000:download:Download error: Requested len=%d exceeds BOOT code boundary.\n",
(int)word_length);
status = STATUS_FAILURE;
break;
@@ -950,7 +950,7 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart,
* Error, beyond boot code range.
*/
DEBUG
- ("FT1000:download:Download error: Requested len=%d exceeds DSP code boundry.\n",
+ ("FT1000:download:Download error: Requested len=%d exceeds DSP code boundary.\n",
(int)word_length);
status = STATUS_FAILURE;
break;
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
index 78dcd49bb985..684e69eacb71 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
@@ -585,7 +585,7 @@ int dsp_reload(struct ft1000_device *ft1000dev)
//---------------------------------------------------------------------------
//
// Function: ft1000_reset_asic
-// Descripton: This function will call the Card Service function to reset the
+// Description: This function will call the Card Service function to reset the
// ASIC.
// Input:
// dev - device structure
@@ -626,7 +626,7 @@ static void ft1000_reset_asic(struct net_device *dev)
//---------------------------------------------------------------------------
//
// Function: ft1000_reset_card
-// Descripton: This function will reset the card
+// Description: This function will reset the card
// Input:
// dev - device structure
// Output:
@@ -917,7 +917,7 @@ static void ft1000_usb_transmit_complete(struct urb *urb)
//---------------------------------------------------------------------------
//
// Function: ft1000_copy_down_pkt
-// Descripton: This function will take an ethernet packet and convert it to
+// Description: This function will take an ethernet packet and convert it to
// a Flarion packet prior to sending it to the ASIC Downlink
// FIFO.
// Input:
@@ -1075,10 +1075,10 @@ err:
//---------------------------------------------------------------------------
//
// Function: ft1000_copy_up_pkt
-// Descripton: This function will take a packet from the FIFO up link and
+// Description: This function will take a packet from the FIFO up link and
// convert it into an ethernet packet and deliver it to the IP stack
// Input:
-// urb - the receving usb urb
+// urb - the receiving usb urb
//
// Output:
// status - FAILURE
@@ -1182,7 +1182,7 @@ static int ft1000_copy_up_pkt(struct urb *urb)
//---------------------------------------------------------------------------
//
// Function: ft1000_submit_rx_urb
-// Descripton: the receiving function of the network driver
+// Description: the receiving function of the network driver
//
// Input:
// info - a private structure contains the device information
@@ -1316,7 +1316,7 @@ Jim
//---------------------------------------------------------------------------
//
// Function: ft1000_chkcard
-// Descripton: This function will check if the device is presently available on
+// Description: This function will check if the device is presently available on
// the system.
// Input:
// dev - device structure
@@ -1363,7 +1363,7 @@ static int ft1000_chkcard(struct ft1000_device *dev)
//---------------------------------------------------------------------------
//
// Function: ft1000_receive_cmd
-// Descripton: This function will read a message from the dpram area.
+// Description: This function will read a message from the dpram area.
// Input:
// dev - network device structure
// pbuffer - caller supply address to buffer
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_ioctl.h b/drivers/staging/ft1000/ft1000-usb/ft1000_ioctl.h
index 3f72d5bb3f92..6a8a1969f9e1 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_ioctl.h
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_ioctl.h
@@ -55,7 +55,7 @@ struct pseudo_hdr {
unsigned char seq_num; //sequence number
unsigned char rsvd2; //reserved
unsigned short qos_class; //Quality of Service class (Not applicable on Mobile)
- unsigned short checksum; //Psuedo header checksum
+ unsigned short checksum; //Pseudo header checksum
} __attribute__ ((packed));
typedef struct _IOCTL_GET_VER
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h
index e047c03fbf3a..f2ecb3eae9cd 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h
@@ -364,7 +364,7 @@ struct prov_record {
#define ISR_EMPTY (u8)0x00 // no bits set in ISR
-#define ISR_DOORBELL_ACK (u8)0x01 // the doorbell i sent has been recieved.
+#define ISR_DOORBELL_ACK (u8)0x01 // the doorbell i sent has been received.
#define ISR_DOORBELL_PEND (u8)0x02 // doorbell for me
diff --git a/drivers/staging/generic_serial/generic_serial.c b/drivers/staging/generic_serial/generic_serial.c
index 466988dbc37d..f29dda4e9f20 100644
--- a/drivers/staging/generic_serial/generic_serial.c
+++ b/drivers/staging/generic_serial/generic_serial.c
@@ -113,7 +113,7 @@ int gs_write(struct tty_struct * tty,
c = count;
- /* This is safe because we "OWN" the "head". Noone else can
+ /* This is safe because we "OWN" the "head". No one else can
change the "head": we own the port_write_mutex. */
/* Don't overrun the end of the buffer */
t = SERIAL_XMIT_SIZE - port->xmit_head;
diff --git a/drivers/staging/generic_serial/rio/map.h b/drivers/staging/generic_serial/rio/map.h
index 8366978578c1..28a66129293e 100644
--- a/drivers/staging/generic_serial/rio/map.h
+++ b/drivers/staging/generic_serial/rio/map.h
@@ -87,7 +87,7 @@ struct Map {
** The Topology array contains the ID of the unit connected to each of the
** four links on this unit. The entry will be 0xFFFF if NOTHING is connected
** to the link, or will be 0xFF00 if an UNKNOWN unit is connected to the link.
-** The Name field is a null-terminated string, upto 31 characters, containing
+** The Name field is a null-terminated string, up to 31 characters, containing
** the 'cute' name that the sysadmin/users know the RTA by. It is permissible
** for this string to contain any character in the range \040 to \176 inclusive.
** In particular, ctrl sequences and DEL (0x7F, \177) are not allowed. The
diff --git a/drivers/staging/generic_serial/rio/rioboot.c b/drivers/staging/generic_serial/rio/rioboot.c
index d956dd316005..ffa01c590216 100644
--- a/drivers/staging/generic_serial/rio/rioboot.c
+++ b/drivers/staging/generic_serial/rio/rioboot.c
@@ -109,7 +109,7 @@ int RIOBootCodeRTA(struct rio_info *p, struct DownLoad * rbp)
rio_dprintk(RIO_DEBUG_BOOT, "Data at user address %p\n", rbp->DataP);
/*
- ** Check that we have set asside enough memory for this
+ ** Check that we have set aside enough memory for this
*/
if (rbp->Count > SIXTY_FOUR_K) {
rio_dprintk(RIO_DEBUG_BOOT, "RTA Boot Code Too Large!\n");
@@ -293,7 +293,7 @@ int RIOBootCodeHOST(struct rio_info *p, struct DownLoad *rbp)
/*
** S T O P !
**
- ** Upto this point the code has been fairly rational, and possibly
+ ** Up to this point the code has been fairly rational, and possibly
** even straight forward. What follows is a pile of crud that will
** magically turn into six bytes of transputer assembler. Normally
** you would expect an array or something, but, being me, I have
@@ -419,7 +419,7 @@ int RIOBootCodeHOST(struct rio_info *p, struct DownLoad *rbp)
rio_dprintk(RIO_DEBUG_BOOT, "Set control port\n");
/*
- ** Now, wait for upto five seconds for the Tp to setup the parmmap
+ ** Now, wait for up to five seconds for the Tp to setup the parmmap
** pointer:
*/
for (wait_count = 0; (wait_count < p->RIOConf.StartupTime) && (readw(&HostP->__ParmMapR) == OldParmMap); wait_count++) {
@@ -475,7 +475,7 @@ int RIOBootCodeHOST(struct rio_info *p, struct DownLoad *rbp)
/*
** now wait for the card to set all the parmmap->XXX stuff
- ** this is a wait of upto two seconds....
+ ** this is a wait of up to two seconds....
*/
rio_dprintk(RIO_DEBUG_BOOT, "Looking for init_done - %d ticks\n", p->RIOConf.StartupTime);
HostP->timeout_id = 0;
diff --git a/drivers/staging/generic_serial/rio/riocmd.c b/drivers/staging/generic_serial/rio/riocmd.c
index f121357e5af0..61efd538e850 100644
--- a/drivers/staging/generic_serial/rio/riocmd.c
+++ b/drivers/staging/generic_serial/rio/riocmd.c
@@ -863,7 +863,7 @@ int RIOUnUse(unsigned long iPortP, struct CmdBlk *CmdBlkP)
** being transferred from the write queue into the transmit packets
** (add_transmit) and no furthur transmit interrupt will be sent for that
** data. The next interrupt will occur up to 500ms later (RIOIntr is called
- ** twice a second as a saftey measure). This was the case when kermit was
+ ** twice a second as a safety measure). This was the case when kermit was
** used to send data into a RIO port. After each packet was sent, TCFLSH
** was called to flush the read queue preemptively. PortP->InUse was
** incremented, thereby blocking the 6 byte acknowledgement packet
diff --git a/drivers/staging/generic_serial/rio/rioroute.c b/drivers/staging/generic_serial/rio/rioroute.c
index f9b936ac3394..8757378e8320 100644
--- a/drivers/staging/generic_serial/rio/rioroute.c
+++ b/drivers/staging/generic_serial/rio/rioroute.c
@@ -450,7 +450,7 @@ int RIORouteRup(struct rio_info *p, unsigned int Rup, struct Host *HostP, struct
** we reset the unit, because we didn't boot it.
** However, if the table is full, it could be that we did boot
** this unit, and so we won't reboot it, because it isn't really
- ** all that disasterous to keep the old bins in most cases. This
+ ** all that disastrous to keep the old bins in most cases. This
** is a rather tacky feature, but we are on the edge of reallity
** here, because the implication is that someone has connected
** 16+MAX_EXTRA_UNITS onto one host.
@@ -678,7 +678,7 @@ static int RIOCheck(struct Host *HostP, unsigned int UnitId)
HostP->Mapping[UnitId].Flags &= ~BEEN_HERE;
- /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d DOESNT KNOW THE HOST!\n", UnitId)); */
+ /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d DOESN'T KNOW THE HOST!\n", UnitId)); */
return 0;
}
diff --git a/drivers/staging/generic_serial/rio/riotty.c b/drivers/staging/generic_serial/rio/riotty.c
index 8a90393faf3c..e7e9911d7a72 100644
--- a/drivers/staging/generic_serial/rio/riotty.c
+++ b/drivers/staging/generic_serial/rio/riotty.c
@@ -124,7 +124,7 @@ int riotopen(struct tty_struct *tty, struct file *filp)
}
/*
- ** Grab pointer to the port stucture
+ ** Grab pointer to the port structure
*/
PortP = p->RIOPortp[SysPort]; /* Get control struc */
rio_dprintk(RIO_DEBUG_TTY, "PortP: %p\n", PortP);
@@ -161,7 +161,7 @@ int riotopen(struct tty_struct *tty, struct file *filp)
}
/*
- ** If the RTA has not booted yet and the user has choosen to block
+ ** If the RTA has not booted yet and the user has chosen to block
** until the RTA is present then we must spin here waiting for
** the RTA to boot.
*/
diff --git a/drivers/staging/generic_serial/sx.c b/drivers/staging/generic_serial/sx.c
index 1291462bcddb..4f94aaffbe83 100644
--- a/drivers/staging/generic_serial/sx.c
+++ b/drivers/staging/generic_serial/sx.c
@@ -158,13 +158,13 @@
* Readying for release on 2.0.x (sorry David, 1.01 becomes 1.1 for RCS).
*
* Revision 0.12 1999/03/28 09:20:10 wolff
- * Fixed problem in 0.11, continueing cleanup.
+ * Fixed problem in 0.11, continuing cleanup.
*
* Revision 0.11 1999/03/28 08:46:44 wolff
* cleanup. Not good.
*
* Revision 0.10 1999/03/28 08:09:43 wolff
- * Fixed loosing characters on close.
+ * Fixed losing characters on close.
*
* Revision 0.9 1999/03/21 22:52:01 wolff
* Ported back to 2.2.... (minor things)
@@ -1588,7 +1588,7 @@ static void sx_close(void *ptr)
#define R0 if (read_sx_byte(board, i) != 0x55) return 1
#define R1 if (read_sx_byte(board, i) != 0xaa) return 1
-/* This memtest takes a human-noticable time. You normally only do it
+/* This memtest takes a human-noticeable time. You normally only do it
once a boot, so I guess that it is worth it. */
static int do_memtest(struct sx_board *board, int min, int max)
{
@@ -1645,7 +1645,7 @@ static int do_memtest(struct sx_board *board, int min, int max)
#define R1 if (read_sx_word(board, i) != 0xaa55) return 1
#if 0
-/* This memtest takes a human-noticable time. You normally only do it
+/* This memtest takes a human-noticeable time. You normally only do it
once a boot, so I guess that it is worth it. */
static int do_memtest_w(struct sx_board *board, int min, int max)
{
diff --git a/drivers/staging/gma500/Kconfig b/drivers/staging/gma500/Kconfig
index 5501eb9b3355..ce8bedaeaac2 100644
--- a/drivers/staging/gma500/Kconfig
+++ b/drivers/staging/gma500/Kconfig
@@ -1,6 +1,6 @@
config DRM_PSB
tristate "Intel GMA500 KMS Framebuffer"
- depends on DRM && PCI
+ depends on DRM && PCI && X86
select FB_CFB_COPYAREA
select FB_CFB_FILLRECT
select FB_CFB_IMAGEBLIT
diff --git a/drivers/staging/gma500/psb_drm.h b/drivers/staging/gma500/psb_drm.h
index fb9b4245bada..a339406052ef 100644
--- a/drivers/staging/gma500/psb_drm.h
+++ b/drivers/staging/gma500/psb_drm.h
@@ -131,7 +131,7 @@ struct drm_psb_reloc {
u32 pre_add; /* Destination format: */
u32 background; /* Destination add */
u32 dst_buffer; /* Destination buffer. Index into buffer_list */
- u32 arg0; /* Reloc-op dependant */
+ u32 arg0; /* Reloc-op dependent */
u32 arg1;
};
diff --git a/drivers/staging/gma500/psb_drv.c b/drivers/staging/gma500/psb_drv.c
index 44cd095d2862..d01d45e7a14d 100644
--- a/drivers/staging/gma500/psb_drv.c
+++ b/drivers/staging/gma500/psb_drv.c
@@ -561,7 +561,7 @@ static int psb_driver_unload(struct drm_device *dev)
kfree(dev_priv);
dev->dev_private = NULL;
- /*destory VBT data*/
+ /*destroy VBT data*/
psb_intel_destroy_bios(dev);
}
diff --git a/drivers/staging/gma500/psb_intel_bios.c b/drivers/staging/gma500/psb_intel_bios.c
index f5bcd119b87d..48ac8ba7f40b 100644
--- a/drivers/staging/gma500/psb_intel_bios.c
+++ b/drivers/staging/gma500/psb_intel_bios.c
@@ -271,7 +271,7 @@ bool psb_intel_init_bios(struct drm_device *dev)
}
/**
- * Destory and free VBT data
+ * Destroy and free VBT data
*/
void psb_intel_destroy_bios(struct drm_device *dev)
{
diff --git a/drivers/staging/gma500/psb_intel_sdvo.c b/drivers/staging/gma500/psb_intel_sdvo.c
index 731a5a2261d3..1d2bb021c0a5 100644
--- a/drivers/staging/gma500/psb_intel_sdvo.c
+++ b/drivers/staging/gma500/psb_intel_sdvo.c
@@ -573,7 +573,7 @@ static bool psb_sdvo_set_current_inoutmap(struct psb_intel_output *output,
/* Make all fields of the args/ret to zero */
memset(byArgs, 0, sizeof(byArgs));
- /* Fill up the arguement values; */
+ /* Fill up the argument values; */
byArgs[0] = (u8) (in0outputmask & 0xFF);
byArgs[1] = (u8) ((in0outputmask >> 8) & 0xFF);
byArgs[2] = (u8) (in1outputmask & 0xFF);
diff --git a/drivers/staging/gma500/psb_intel_sdvo_regs.h b/drivers/staging/gma500/psb_intel_sdvo_regs.h
index a1d1475a9315..c7107a37e33d 100644
--- a/drivers/staging/gma500/psb_intel_sdvo_regs.h
+++ b/drivers/staging/gma500/psb_intel_sdvo_regs.h
@@ -217,7 +217,7 @@ struct psb_intel_sdvo_set_target_input_args {
} __attribute__ ((packed));
/**
- * Takes a struct psb_intel_sdvo_output_flags of which outputs are targetted by
+ * Takes a struct psb_intel_sdvo_output_flags of which outputs are targeted by
* future output commands.
*
* Affected commands inclue SET_OUTPUT_TIMINGS_PART[12],
diff --git a/drivers/staging/gma500/psb_ttm_fence_user.h b/drivers/staging/gma500/psb_ttm_fence_user.h
index fc13f89c6e12..762a05728632 100644
--- a/drivers/staging/gma500/psb_ttm_fence_user.h
+++ b/drivers/staging/gma500/psb_ttm_fence_user.h
@@ -130,7 +130,7 @@ struct ttm_fence_unref_arg {
};
/*
- * Ioctl offsets frome extenstion start.
+ * Ioctl offsets from extenstion start.
*/
#define TTM_FENCE_SIGNALED 0x01
diff --git a/drivers/staging/go7007/go7007.txt b/drivers/staging/go7007/go7007.txt
index 06a76da32128..9db1f3952fd2 100644
--- a/drivers/staging/go7007/go7007.txt
+++ b/drivers/staging/go7007/go7007.txt
@@ -2,7 +2,7 @@ This is a driver for the WIS GO7007SB multi-format video encoder.
Pete Eberlein <pete@sensoray.com>
-The driver was orignally released under the GPL and is currently hosted at:
+The driver was originally released under the GPL and is currently hosted at:
http://nikosapi.org/wiki/index.php/WIS_Go7007_Linux_driver
The go7007 firmware can be acquired from the package on the site above.
diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 6e02f1b0c46f..68ad17d67098 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -124,7 +124,8 @@ static void blkvsc_shutdown(struct device *device);
static int blkvsc_open(struct block_device *bdev, fmode_t mode);
static int blkvsc_release(struct gendisk *disk, fmode_t mode);
-static int blkvsc_media_changed(struct gendisk *gd);
+static unsigned int blkvsc_check_events(struct gendisk *gd,
+ unsigned int clearing);
static int blkvsc_revalidate_disk(struct gendisk *gd);
static int blkvsc_getgeo(struct block_device *bd, struct hd_geometry *hg);
static int blkvsc_ioctl(struct block_device *bd, fmode_t mode,
@@ -155,7 +156,7 @@ static const struct block_device_operations block_ops = {
.owner = THIS_MODULE,
.open = blkvsc_open,
.release = blkvsc_release,
- .media_changed = blkvsc_media_changed,
+ .check_events = blkvsc_check_events,
.revalidate_disk = blkvsc_revalidate_disk,
.getgeo = blkvsc_getgeo,
.ioctl = blkvsc_ioctl,
@@ -357,6 +358,7 @@ static int blkvsc_probe(struct device *device)
else
blkdev->gd->first_minor = 0;
blkdev->gd->fops = &block_ops;
+ blkdev->gd->events = DISK_EVENT_MEDIA_CHANGE;
blkdev->gd->private_data = blkdev;
blkdev->gd->driverfs_dev = &(blkdev->device_ctx->device);
sprintf(blkdev->gd->disk_name, "hd%c", 'a' + devnum);
@@ -892,7 +894,7 @@ static int blkvsc_submit_request(struct blkvsc_request *blkvsc_req,
/*
* We break the request into 1 or more blkvsc_requests and submit
- * them. If we cant submit them all, we put them on the
+ * them. If we can't submit them all, we put them on the
* pending_list. The blkvsc_request() will work on the pending_list.
*/
static int blkvsc_do_request(struct block_device_context *blkdev,
@@ -1337,10 +1339,11 @@ static int blkvsc_release(struct gendisk *disk, fmode_t mode)
return 0;
}
-static int blkvsc_media_changed(struct gendisk *gd)
+static unsigned int blkvsc_check_events(struct gendisk *gd,
+ unsigned int clearing)
{
DPRINT_DBG(BLKVSC_DRV, "- enter\n");
- return 1;
+ return DISK_EVENT_MEDIA_CHANGE;
}
static int blkvsc_revalidate_disk(struct gendisk *gd)
diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c
index 775a52a91222..f7ce7d2494b3 100644
--- a/drivers/staging/hv/channel.c
+++ b/drivers/staging/hv/channel.c
@@ -81,14 +81,14 @@ static void vmbus_setevent(struct vmbus_channel *channel)
if (channel->offermsg.monitor_allocated) {
/* Each u32 represents 32 channels */
- set_bit(channel->offermsg.child_relid & 31,
+ sync_set_bit(channel->offermsg.child_relid & 31,
(unsigned long *) vmbus_connection.send_int_page +
(channel->offermsg.child_relid >> 5));
monitorpage = vmbus_connection.monitor_pages;
monitorpage++; /* Get the child to parent monitor page */
- set_bit(channel->monitor_bit,
+ sync_set_bit(channel->monitor_bit,
(unsigned long *)&monitorpage->trigger_group
[channel->monitor_grp].pending);
@@ -104,7 +104,7 @@ static void VmbusChannelClearEvent(struct vmbus_channel *channel)
if (Channel->offermsg.monitor_allocated) {
/* Each u32 represents 32 channels */
- clear_bit(Channel->offermsg.child_relid & 31,
+ sync_clear_bit(Channel->offermsg.child_relid & 31,
(unsigned long *)vmbus_connection.send_int_page +
(Channel->offermsg.child_relid >> 5));
@@ -112,7 +112,7 @@ static void VmbusChannelClearEvent(struct vmbus_channel *channel)
vmbus_connection.monitor_pages;
monitorPage++; /* Get the child to parent monitor page */
- clear_bit(Channel->monitor_bit,
+ sync_clear_bit(Channel->monitor_bit,
(unsigned long *)&monitorPage->trigger_group
[Channel->monitor_grp].Pending);
}
diff --git a/drivers/staging/hv/channel_mgmt.c b/drivers/staging/hv/channel_mgmt.c
index bc0393a41d29..06b573227e8d 100644
--- a/drivers/staging/hv/channel_mgmt.c
+++ b/drivers/staging/hv/channel_mgmt.c
@@ -166,7 +166,7 @@ EXPORT_SYMBOL(prep_negotiate_resp);
* from Hyper-V. This stub responds to the default negotiate messages
* that come in for every non IDE/SCSI/Network request.
* This behavior is normally overwritten in the hv_utils driver. That
- * driver handles requests like gracefull shutdown, heartbeats etc.
+ * driver handles requests like graceful shutdown, heartbeats etc.
*
* Mainly used by Hyper-V drivers.
*/
diff --git a/drivers/staging/hv/connection.c b/drivers/staging/hv/connection.c
index 44b203b95a22..afc8116e7aa4 100644
--- a/drivers/staging/hv/connection.c
+++ b/drivers/staging/hv/connection.c
@@ -296,7 +296,7 @@ void vmbus_on_event(unsigned long data)
for (dword = 0; dword < maxdword; dword++) {
if (recv_int_page[dword]) {
for (bit = 0; bit < 32; bit++) {
- if (test_and_clear_bit(bit,
+ if (sync_test_and_clear_bit(bit,
(unsigned long *)
&recv_int_page[dword])) {
relid = (dword << 5) + bit;
@@ -338,7 +338,7 @@ int vmbus_post_msg(void *buffer, size_t buflen)
int vmbus_set_event(u32 child_relid)
{
/* Each u32 represents 32 channels */
- set_bit(child_relid & 31,
+ sync_set_bit(child_relid & 31,
(unsigned long *)vmbus_connection.send_int_page +
(child_relid >> 5));
diff --git a/drivers/staging/hv/hv.c b/drivers/staging/hv/hv.c
index 2d492adb95bb..0b06f4fe5838 100644
--- a/drivers/staging/hv/hv.c
+++ b/drivers/staging/hv/hv.c
@@ -37,7 +37,7 @@ struct hv_context hv_context = {
/*
* query_hypervisor_presence
- * - Query the cpuid for presense of windows hypervisor
+ * - Query the cpuid for presence of windows hypervisor
*/
static int query_hypervisor_presence(void)
{
diff --git a/drivers/staging/hv/hv_api.h b/drivers/staging/hv/hv_api.h
index 7114fceab21e..43a722888dc4 100644
--- a/drivers/staging/hv/hv_api.h
+++ b/drivers/staging/hv/hv_api.h
@@ -53,14 +53,14 @@ struct hv_guid {
/*
* HV_STATUS_INVALID_ALIGNMENT
- * The hypervisor could not perform the operation beacuse a parameter has an
+ * The hypervisor could not perform the operation because a parameter has an
* invalid alignment.
*/
#define HV_STATUS_INVALID_ALIGNMENT ((u16)0x0004)
/*
* HV_STATUS_INVALID_PARAMETER
- * The hypervisor could not perform the operation beacuse an invalid parameter
+ * The hypervisor could not perform the operation because an invalid parameter
* was specified.
*/
#define HV_STATUS_INVALID_PARAMETER ((u16)0x0005)
diff --git a/drivers/staging/hv/hv_kvp.h b/drivers/staging/hv/hv_kvp.h
index e069f59b5135..8c402f357d37 100644
--- a/drivers/staging/hv/hv_kvp.h
+++ b/drivers/staging/hv/hv_kvp.h
@@ -36,7 +36,7 @@
* registry.
*
* Note: This value is used in defining the KVP exchange message - this value
- * cannot be modified without affecting the message size and compatability.
+ * cannot be modified without affecting the message size and compatibility.
*/
/*
diff --git a/drivers/staging/hv/hv_mouse.c b/drivers/staging/hv/hv_mouse.c
index 50147f84741c..118c7be22562 100644
--- a/drivers/staging/hv/hv_mouse.c
+++ b/drivers/staging/hv/hv_mouse.c
@@ -14,6 +14,7 @@
*/
#include <linux/init.h>
#include <linux/module.h>
+#include <linux/delay.h>
#include <linux/device.h>
#include <linux/workqueue.h>
#include <linux/sched.h>
@@ -23,6 +24,7 @@
#include <linux/hiddev.h>
#include <linux/pci.h>
#include <linux/dmi.h>
+#include <linux/delay.h>
#include "hv_api.h"
#include "logging.h"
@@ -374,7 +376,7 @@ static void MousevscOnReceiveDeviceInfo(struct mousevsc_dev *InputDevice, struct
desc->desc[0].wDescriptorLength);
/* Send the ack */
- memset(&ack, sizeof(struct mousevsc_prt_msg), 0);
+ memset(&ack, 0, sizeof(struct mousevsc_prt_msg));
ack.type = PipeMessageData;
ack.size = sizeof(struct synthhid_device_info_ack);
@@ -595,7 +597,7 @@ static int MousevscConnectToVsp(struct hv_device *Device)
/*
* Now, initiate the vsc/vsp initialization protocol on the open channel
*/
- memset(request, sizeof(struct mousevsc_prt_msg), 0);
+ memset(request, 0, sizeof(struct mousevsc_prt_msg));
request->type = PipeMessageData;
request->size = sizeof(struct synthhid_protocol_request);
diff --git a/drivers/staging/hv/hv_util.c b/drivers/staging/hv/hv_util.c
index 4792f2c402b2..2df15683f8fa 100644
--- a/drivers/staging/hv/hv_util.c
+++ b/drivers/staging/hv/hv_util.c
@@ -80,7 +80,7 @@ static void shutdown_onchannelcallback(void *context)
execute_shutdown = true;
DPRINT_INFO(VMBUS, "Shutdown request received -"
- " gracefull shutdown initiated");
+ " graceful shutdown initiated");
break;
default:
icmsghdrp->status = HV_E_FAIL;
diff --git a/drivers/staging/hv/netvsc_drv.c b/drivers/staging/hv/netvsc_drv.c
index 2d40f5f86b24..33973568214f 100644
--- a/drivers/staging/hv/netvsc_drv.c
+++ b/drivers/staging/hv/netvsc_drv.c
@@ -46,6 +46,7 @@ struct net_device_context {
/* point back to our device context */
struct hv_device *device_ctx;
unsigned long avail;
+ struct work_struct work;
};
@@ -219,6 +220,7 @@ static void netvsc_linkstatus_callback(struct hv_device *device_obj,
unsigned int status)
{
struct net_device *net = dev_get_drvdata(&device_obj->device);
+ struct net_device_context *ndev_ctx;
if (!net) {
DPRINT_ERR(NETVSC_DRV, "got link status but net device "
@@ -230,6 +232,8 @@ static void netvsc_linkstatus_callback(struct hv_device *device_obj,
netif_carrier_on(net);
netif_wake_queue(net);
netif_notify_peers(net);
+ ndev_ctx = netdev_priv(net);
+ schedule_work(&ndev_ctx->work);
} else {
netif_carrier_off(net);
netif_stop_queue(net);
@@ -328,6 +332,25 @@ static const struct net_device_ops device_ops = {
.ndo_set_mac_address = eth_mac_addr,
};
+/*
+ * Send GARP packet to network peers after migrations.
+ * After Quick Migration, the network is not immediately operational in the
+ * current context when receiving RNDIS_STATUS_MEDIA_CONNECT event. So, add
+ * another netif_notify_peers() into a scheduled work, otherwise GARP packet
+ * will not be sent after quick migration, and cause network disconnection.
+ */
+static void netvsc_send_garp(struct work_struct *w)
+{
+ struct net_device_context *ndev_ctx;
+ struct net_device *net;
+
+ msleep(20);
+ ndev_ctx = container_of(w, struct net_device_context, work);
+ net = dev_get_drvdata(&ndev_ctx->device_ctx->device);
+ netif_notify_peers(net);
+}
+
+
static int netvsc_probe(struct device *device)
{
struct hv_driver *drv =
@@ -353,6 +376,7 @@ static int netvsc_probe(struct device *device)
net_device_ctx->device_ctx = device_obj;
net_device_ctx->avail = ring_size;
dev_set_drvdata(device, net);
+ INIT_WORK(&net_device_ctx->work, netvsc_send_garp);
/* Notify the netvsc driver of the new device */
ret = net_drv_obj->base.dev_add(device_obj, &device_info);
diff --git a/drivers/staging/hv/rndis_filter.c b/drivers/staging/hv/rndis_filter.c
index e7189cd324ca..048376b2b676 100644
--- a/drivers/staging/hv/rndis_filter.c
+++ b/drivers/staging/hv/rndis_filter.c
@@ -585,7 +585,7 @@ static int rndis_filter_set_packet_filter(struct rndis_device *dev,
ret = -1;
DPRINT_ERR(NETVSC, "timeout before we got a set response...");
/*
- * We cant deallocate the request since we may still receive a
+ * We can't deallocate the request since we may still receive a
* send completion for it.
*/
goto Exit;
diff --git a/drivers/staging/hv/tools/hv_kvp_daemon.c b/drivers/staging/hv/tools/hv_kvp_daemon.c
index f5a2dd694611..33f0f1c8ad73 100644
--- a/drivers/staging/hv/tools/hv_kvp_daemon.c
+++ b/drivers/staging/hv/tools/hv_kvp_daemon.c
@@ -102,22 +102,22 @@ static char kvp_send_buffer[4096];
static char kvp_recv_buffer[4096];
static struct sockaddr_nl addr;
-static char os_name[100];
-static char os_major[50];
-static char os_minor[50];
-static char processor_arch[50];
-static char os_build[100];
+static char *os_name = "";
+static char *os_major = "";
+static char *os_minor = "";
+static char *processor_arch;
+static char *os_build;
static char *lic_version;
+static struct utsname uts_buf;
void kvp_get_os_info(void)
{
FILE *file;
- char *eol;
- struct utsname buf;
+ char *p, buf[512];
- uname(&buf);
- strcpy(os_build, buf.release);
- strcpy(processor_arch, buf.machine);
+ uname(&uts_buf);
+ os_build = uts_buf.release;
+ processor_arch= uts_buf.machine;
file = fopen("/etc/SuSE-release", "r");
if (file != NULL)
@@ -132,21 +132,46 @@ void kvp_get_os_info(void)
/*
* We don't have information about the os.
*/
- strcpy(os_name, "Linux");
- strcpy(os_major, "0");
- strcpy(os_minor, "0");
+ os_name = uts_buf.sysname;
return;
kvp_osinfo_found:
- fgets(os_name, 99, file);
- eol = index(os_name, '\n');
- *eol = '\0';
- fgets(os_major, 49, file);
- eol = index(os_major, '\n');
- *eol = '\0';
- fgets(os_minor, 49, file);
- eol = index(os_minor, '\n');
- *eol = '\0';
+ /* up to three lines */
+ p = fgets(buf, sizeof(buf), file);
+ if (p) {
+ p = strchr(buf, '\n');
+ if (p)
+ *p = '\0';
+ p = strdup(buf);
+ if (!p)
+ goto done;
+ os_name = p;
+
+ /* second line */
+ p = fgets(buf, sizeof(buf), file);
+ if (p) {
+ p = strchr(buf, '\n');
+ if (p)
+ *p = '\0';
+ p = strdup(buf);
+ if (!p)
+ goto done;
+ os_major = p;
+
+ /* third line */
+ p = fgets(buf, sizeof(buf), file);
+ if (p) {
+ p = strchr(buf, '\n');
+ if (p)
+ *p = '\0';
+ p = strdup(buf);
+ if (p)
+ os_minor = p;
+ }
+ }
+ }
+
+done:
fclose(file);
return;
}
@@ -202,7 +227,7 @@ kvp_get_ip_address(int family, char *buffer, int length)
/*
* We only support AF_INET and AF_INET6
- * and the list of addresses is seperated by a ";".
+ * and the list of addresses is separated by a ";".
*/
struct sockaddr_in6 *addr =
(struct sockaddr_in6 *) curp->ifa_addr;
@@ -293,7 +318,7 @@ netlink_send(int fd, struct cn_msg *msg)
return sendmsg(fd, &message, 0);
}
-main(void)
+int main(void)
{
int fd, len, sock_opt;
int error;
@@ -301,9 +326,10 @@ main(void)
struct pollfd pfd;
struct nlmsghdr *incoming_msg;
struct cn_msg *incoming_cn_msg;
+ struct hv_ku_msg *hv_msg;
+ char *p;
char *key_value;
char *key_name;
- int key_index;
daemon(1, 0);
openlog("KVP", 0, LOG_USER);
@@ -373,9 +399,10 @@ main(void)
* Driver is registering with us; stash away the version
* information.
*/
- lic_version = malloc(strlen(incoming_cn_msg->data) + 1);
+ p = (char *)incoming_cn_msg->data;
+ lic_version = malloc(strlen(p) + 1);
if (lic_version) {
- strcpy(lic_version, incoming_cn_msg->data);
+ strcpy(lic_version, p);
syslog(LOG_INFO, "KVP LIC Version: %s",
lic_version);
} else {
@@ -389,14 +416,11 @@ main(void)
continue;
}
- key_index =
- ((struct hv_ku_msg *)incoming_cn_msg->data)->kvp_index;
- key_name =
- ((struct hv_ku_msg *)incoming_cn_msg->data)->kvp_key;
- key_value =
- ((struct hv_ku_msg *)incoming_cn_msg->data)->kvp_value;
+ hv_msg = (struct hv_ku_msg *)incoming_cn_msg->data;
+ key_name = (char *)hv_msg->kvp_key;
+ key_value = (char *)hv_msg->kvp_value;
- switch (key_index) {
+ switch (hv_msg->kvp_index) {
case FullyQualifiedDomainName:
kvp_get_domain_name(key_value,
HV_KVP_EXCHANGE_MAX_VALUE_SIZE);
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index b473f468dd83..79089f85d903 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -254,7 +254,7 @@ static int vmbus_on_isr(void)
event = (union hv_synic_event_flags *)page_addr + VMBUS_MESSAGE_SINT;
/* Since we are a child, we only need to check bit 0 */
- if (test_and_clear_bit(0, (unsigned long *) &event->flags32[0])) {
+ if (sync_test_and_clear_bit(0, (unsigned long *) &event->flags32[0])) {
DPRINT_DBG(VMBUS, "received event %d", event->flags32[0]);
ret |= 0x2;
}
diff --git a/drivers/staging/hv/vmbus_private.h b/drivers/staging/hv/vmbus_private.h
index ca050a499b99..6f0d8df5e178 100644
--- a/drivers/staging/hv/vmbus_private.h
+++ b/drivers/staging/hv/vmbus_private.h
@@ -31,6 +31,7 @@
#include "channel_mgmt.h"
#include "ring_buffer.h"
#include <linux/list.h>
+#include <asm/sync_bitops.h>
/*
diff --git a/drivers/staging/iio/Documentation/iio_utils.h b/drivers/staging/iio/Documentation/iio_utils.h
index 8095727b3966..fd78e4ff99ae 100644
--- a/drivers/staging/iio/Documentation/iio_utils.h
+++ b/drivers/staging/iio/Documentation/iio_utils.h
@@ -556,7 +556,7 @@ int _write_sysfs_string(char *filename, char *basedir, char *val, int verify)
if (strcmp(temp, val) != 0) {
printf("Possible failure in string write of %s "
"Should be %s "
- "writen to %s\%s\n",
+ "written to %s\%s\n",
temp,
val,
basedir,
diff --git a/drivers/staging/iio/accel/adis16201.h b/drivers/staging/iio/accel/adis16201.h
index c9bf22c13428..23fe54d09d12 100644
--- a/drivers/staging/iio/accel/adis16201.h
+++ b/drivers/staging/iio/accel/adis16201.h
@@ -70,7 +70,7 @@
* @indio_dev: industrial I/O device structure
* @trig: data ready trigger registered with iio
* @tx: transmit buffer
- * @rx: recieve buffer
+ * @rx: receive buffer
* @buf_lock: mutex to protect tx and rx
**/
struct adis16201_state {
diff --git a/drivers/staging/iio/accel/adis16203.h b/drivers/staging/iio/accel/adis16203.h
index b39323eac9e3..b88688128d61 100644
--- a/drivers/staging/iio/accel/adis16203.h
+++ b/drivers/staging/iio/accel/adis16203.h
@@ -65,7 +65,7 @@
* @indio_dev: industrial I/O device structure
* @trig: data ready trigger registered with iio
* @tx: transmit buffer
- * @rx: recieve buffer
+ * @rx: receive buffer
* @buf_lock: mutex to protect tx and rx
**/
struct adis16203_state {
diff --git a/drivers/staging/iio/accel/adis16204.h b/drivers/staging/iio/accel/adis16204.h
index e9ed7cb048cf..e61844684f99 100644
--- a/drivers/staging/iio/accel/adis16204.h
+++ b/drivers/staging/iio/accel/adis16204.h
@@ -73,7 +73,7 @@
* @indio_dev: industrial I/O device structure
* @trig: data ready trigger registered with iio
* @tx: transmit buffer
- * @rx: recieve buffer
+ * @rx: receive buffer
* @buf_lock: mutex to protect tx and rx
**/
struct adis16204_state {
diff --git a/drivers/staging/iio/accel/adis16209.h b/drivers/staging/iio/accel/adis16209.h
index 4e97596620ef..8b0da1349555 100644
--- a/drivers/staging/iio/accel/adis16209.h
+++ b/drivers/staging/iio/accel/adis16209.h
@@ -109,7 +109,7 @@
* @indio_dev: industrial I/O device structure
* @trig: data ready trigger registered with iio
* @tx: transmit buffer
- * @rx: recieve buffer
+ * @rx: receive buffer
* @buf_lock: mutex to protect tx and rx
**/
struct adis16209_state {
diff --git a/drivers/staging/iio/accel/adis16220.h b/drivers/staging/iio/accel/adis16220.h
index 7013314a9d77..4d5758c2c047 100644
--- a/drivers/staging/iio/accel/adis16220.h
+++ b/drivers/staging/iio/accel/adis16220.h
@@ -132,7 +132,7 @@
* @indio_dev: industrial I/O device structure
* @trig: data ready trigger registered with iio
* @tx: transmit buffer
- * @rx: recieve buffer
+ * @rx: receive buffer
* @buf_lock: mutex to protect tx and rx
**/
struct adis16220_state {
diff --git a/drivers/staging/iio/accel/adis16240.h b/drivers/staging/iio/accel/adis16240.h
index 51a807dde27c..76a45797b9dd 100644
--- a/drivers/staging/iio/accel/adis16240.h
+++ b/drivers/staging/iio/accel/adis16240.h
@@ -132,7 +132,7 @@
* @indio_dev: industrial I/O device structure
* @trig: data ready trigger registered with iio
* @tx: transmit buffer
- * @rx: recieve buffer
+ * @rx: receive buffer
* @buf_lock: mutex to protect tx and rx
**/
struct adis16240_state {
diff --git a/drivers/staging/iio/accel/lis3l02dq.h b/drivers/staging/iio/accel/lis3l02dq.h
index 579b3a26e5d7..11402187f9ae 100644
--- a/drivers/staging/iio/accel/lis3l02dq.h
+++ b/drivers/staging/iio/accel/lis3l02dq.h
@@ -57,7 +57,7 @@
/* Reboot memory content */
#define LIS3L02DQ_REG_CTRL_2_REBOOT_MEMORY 0x10
-/* Interupt Enable - applies data ready to the RDY pad */
+/* Interrupt Enable - applies data ready to the RDY pad */
#define LIS3L02DQ_REG_CTRL_2_ENABLE_INTERRUPT 0x08
/* Enable Data Ready Generation - relationship with previous unclear in docs */
@@ -70,34 +70,34 @@
* - option for 16 bit left justified */
#define LIS3L02DQ_REG_CTRL_2_DATA_ALIGNMENT_16_BIT_LEFT_JUSTIFIED 0x01
-/* Interupt related stuff */
+/* Interrupt related stuff */
#define LIS3L02DQ_REG_WAKE_UP_CFG_ADDR 0x23
/* Switch from or combination fo conditions to and */
#define LIS3L02DQ_REG_WAKE_UP_CFG_BOOLEAN_AND 0x80
-/* Latch interupt request,
+/* Latch interrupt request,
* if on ack must be given by reading the ack register */
#define LIS3L02DQ_REG_WAKE_UP_CFG_LATCH_SRC 0x40
-/* Z Interupt on High (above threshold)*/
+/* Z Interrupt on High (above threshold)*/
#define LIS3L02DQ_REG_WAKE_UP_CFG_INTERRUPT_Z_HIGH 0x20
-/* Z Interupt on Low */
+/* Z Interrupt on Low */
#define LIS3L02DQ_REG_WAKE_UP_CFG_INTERRUPT_Z_LOW 0x10
-/* Y Interupt on High */
+/* Y Interrupt on High */
#define LIS3L02DQ_REG_WAKE_UP_CFG_INTERRUPT_Y_HIGH 0x08
-/* Y Interupt on Low */
+/* Y Interrupt on Low */
#define LIS3L02DQ_REG_WAKE_UP_CFG_INTERRUPT_Y_LOW 0x04
-/* X Interupt on High */
+/* X Interrupt on High */
#define LIS3L02DQ_REG_WAKE_UP_CFG_INTERRUPT_X_HIGH 0x02
-/* X Interupt on Low */
+/* X Interrupt on Low */
#define LIS3L02DQ_REG_WAKE_UP_CFG_INTERRUPT_X_LOW 0x01
-/* Register that gives description of what caused interupt
+/* Register that gives description of what caused interrupt
* - latched if set in CFG_ADDRES */
#define LIS3L02DQ_REG_WAKE_UP_SRC_ADDR 0x24
/* top bit ignored */
-/* Interupt Active */
+/* Interrupt Active */
#define LIS3L02DQ_REG_WAKE_UP_SRC_INTERRUPT_ACTIVATED 0x40
/* Interupts that have been triggered */
#define LIS3L02DQ_REG_WAKE_UP_SRC_INTERRUPT_Z_HIGH 0x20
@@ -123,7 +123,7 @@
#define LIS3L02DQ_REG_STATUS_X_NEW_DATA 0x01
/* The accelerometer readings - low and high bytes.
-Form of high byte dependant on justification set in ctrl reg */
+Form of high byte dependent on justification set in ctrl reg */
#define LIS3L02DQ_REG_OUT_X_L_ADDR 0x28
#define LIS3L02DQ_REG_OUT_X_H_ADDR 0x29
#define LIS3L02DQ_REG_OUT_Y_L_ADDR 0x2A
@@ -155,7 +155,7 @@ Form of high byte dependant on justification set in ctrl reg */
* @inter: used to check if new interrupt has been triggered
* @trig: data ready trigger registered with iio
* @tx: transmit buffer
- * @rx: recieve buffer
+ * @rx: receive buffer
* @buf_lock: mutex to protect tx and rx
**/
struct lis3l02dq_state {
diff --git a/drivers/staging/iio/accel/lis3l02dq_core.c b/drivers/staging/iio/accel/lis3l02dq_core.c
index c4b4ab7e6423..3067f9662d20 100644
--- a/drivers/staging/iio/accel/lis3l02dq_core.c
+++ b/drivers/staging/iio/accel/lis3l02dq_core.c
@@ -77,7 +77,7 @@ int lis3l02dq_spi_read_reg_8(struct device *dev, u8 reg_address, u8 *val)
/**
* lis3l02dq_spi_write_reg_8() - write single byte to a register
* @dev: device associated with child of actual device (iio_dev or iio_trig)
- * @reg_address: the address of the register to be writen
+ * @reg_address: the address of the register to be written
* @val: the value to write
**/
int lis3l02dq_spi_write_reg_8(struct device *dev,
diff --git a/drivers/staging/iio/accel/lis3l02dq_ring.c b/drivers/staging/iio/accel/lis3l02dq_ring.c
index 2c461a31f129..529a3cc6d0c7 100644
--- a/drivers/staging/iio/accel/lis3l02dq_ring.c
+++ b/drivers/staging/iio/accel/lis3l02dq_ring.c
@@ -217,7 +217,7 @@ static const u8 read_all_tx_array[] = {
/**
* lis3l02dq_read_all() Reads all channels currently selected
* @st: device specific state
- * @rx_array: (dma capable) recieve array, must be at least
+ * @rx_array: (dma capable) receive array, must be at least
* 4*number of channels
**/
static int lis3l02dq_read_all(struct lis3l02dq_state *st, u8 *rx_array)
@@ -409,7 +409,7 @@ static const struct attribute_group lis3l02dq_trigger_attr_group = {
*
* As the trigger may occur on any data element being updated it is
* really rather likely to occur during the read from the previous
- * trigger event. The only way to discover if this has occured on
+ * trigger event. The only way to discover if this has occurred on
* boards not supporting level interrupts is to take a look at the line.
* If it is indicating another interrupt and we don't seem to have a
* handler looking at it, then we need to notify the core that we need
diff --git a/drivers/staging/iio/accel/sca3000.h b/drivers/staging/iio/accel/sca3000.h
index 23892848f5ae..db710334b99b 100644
--- a/drivers/staging/iio/accel/sca3000.h
+++ b/drivers/staging/iio/accel/sca3000.h
@@ -185,7 +185,7 @@ struct sca3000_state {
};
/**
- * struct sca3000_chip_info - model dependant parameters
+ * struct sca3000_chip_info - model dependent parameters
* @name: model identification
* @scale: string containing floating point scale factor
* @temp_output: some devices have temperature sensors.
@@ -213,7 +213,7 @@ struct sca3000_chip_info {
* sca3000_read_data() read a series of values from the device
* @dev: device
* @reg_address_high: start address (decremented read)
- * @rx: pointer where recieved data is placed. Callee
+ * @rx: pointer where received data is placed. Callee
* responsible for freeing this.
* @len: number of bytes to read
*
diff --git a/drivers/staging/iio/accel/sca3000_ring.c b/drivers/staging/iio/accel/sca3000_ring.c
index c872fddfb2bf..a730a7638de1 100644
--- a/drivers/staging/iio/accel/sca3000_ring.c
+++ b/drivers/staging/iio/accel/sca3000_ring.c
@@ -43,7 +43,7 @@
* leading byte used in bus comms.
*
* Currently does not provide timestamps. As the hardware doesn't add them they
- * can only be inferred aproximately from ring buffer events such as 50% full
+ * can only be inferred approximately from ring buffer events such as 50% full
* and knowledge of when buffer was last emptied. This is left to userspace.
**/
static int sca3000_rip_hw_rb(struct iio_ring_buffer *r,
diff --git a/drivers/staging/iio/adc/ad7298_ring.c b/drivers/staging/iio/adc/ad7298_ring.c
index 19d1aced1e6c..9068d7f54d15 100644
--- a/drivers/staging/iio/adc/ad7298_ring.c
+++ b/drivers/staging/iio/adc/ad7298_ring.c
@@ -157,7 +157,7 @@ static int ad7298_ring_preenable(struct iio_dev *indio_dev)
/**
* ad7298_poll_func_th() th of trigger launched polling to ring buffer
*
- * As sampling only occurs on spi comms occuring, leave timestamping until
+ * As sampling only occurs on spi comms occurring, leave timestamping until
* then. Some triggers will generate their own time stamp. Currently
* there is no way of notifying them when no one cares.
**/
diff --git a/drivers/staging/iio/adc/ad7476_ring.c b/drivers/staging/iio/adc/ad7476_ring.c
index 1d654c86099d..92d93787d5b8 100644
--- a/drivers/staging/iio/adc/ad7476_ring.c
+++ b/drivers/staging/iio/adc/ad7476_ring.c
@@ -112,7 +112,7 @@ static int ad7476_ring_preenable(struct iio_dev *indio_dev)
/**
* ad7476_poll_func_th() th of trigger launched polling to ring buffer
*
- * As sampling only occurs on i2c comms occuring, leave timestamping until
+ * As sampling only occurs on i2c comms occurring, leave timestamping until
* then. Some triggers will generate their own time stamp. Currently
* there is no way of notifying them when no one cares.
**/
diff --git a/drivers/staging/iio/adc/ad7887_ring.c b/drivers/staging/iio/adc/ad7887_ring.c
index 2d7fe65049dd..da77f266c16b 100644
--- a/drivers/staging/iio/adc/ad7887_ring.c
+++ b/drivers/staging/iio/adc/ad7887_ring.c
@@ -165,7 +165,7 @@ static int ad7887_ring_postdisable(struct iio_dev *indio_dev)
/**
* ad7887_poll_func_th() th of trigger launched polling to ring buffer
*
- * As sampling only occurs on spi comms occuring, leave timestamping until
+ * As sampling only occurs on spi comms occurring, leave timestamping until
* then. Some triggers will generate their own time stamp. Currently
* there is no way of notifying them when no one cares.
**/
diff --git a/drivers/staging/iio/adc/ad799x_core.c b/drivers/staging/iio/adc/ad799x_core.c
index e50841b3ac69..f04e642e7272 100644
--- a/drivers/staging/iio/adc/ad799x_core.c
+++ b/drivers/staging/iio/adc/ad799x_core.c
@@ -184,7 +184,7 @@ static ssize_t ad799x_read_single_channel(struct device *dev,
mutex_lock(&dev_info->mlock);
mask = 1 << this_attr->address;
- /* If ring buffer capture is occuring, query the buffer */
+ /* If ring buffer capture is occurring, query the buffer */
if (iio_ring_enabled(dev_info)) {
data = ret = ad799x_single_channel_from_ring(st, mask);
if (ret < 0)
diff --git a/drivers/staging/iio/adc/ad799x_ring.c b/drivers/staging/iio/adc/ad799x_ring.c
index 56abc395f177..0875a7ef67a5 100644
--- a/drivers/staging/iio/adc/ad799x_ring.c
+++ b/drivers/staging/iio/adc/ad799x_ring.c
@@ -101,7 +101,7 @@ static int ad799x_ring_preenable(struct iio_dev *indio_dev)
/**
* ad799x_poll_func_th() th of trigger launched polling to ring buffer
*
- * As sampling only occurs on i2c comms occuring, leave timestamping until
+ * As sampling only occurs on i2c comms occurring, leave timestamping until
* then. Some triggers will generate their own time stamp. Currently
* there is no way of notifying them when no one cares.
**/
diff --git a/drivers/staging/iio/adc/max1363_core.c b/drivers/staging/iio/adc/max1363_core.c
index dde097afb430..de83c3b37a2d 100644
--- a/drivers/staging/iio/adc/max1363_core.c
+++ b/drivers/staging/iio/adc/max1363_core.c
@@ -255,7 +255,7 @@ static ssize_t max1363_read_single_channel(struct device *dev,
goto error_ret;
}
- /* If ring buffer capture is occuring, query the buffer */
+ /* If ring buffer capture is occurring, query the buffer */
if (iio_ring_enabled(dev_info)) {
mask = max1363_mode_table[this_attr->address].modemask;
data = max1363_single_channel_from_ring(mask, st);
@@ -1425,7 +1425,7 @@ error_ret:
}
/*
- * To keep this managable we always use one of 3 scan modes.
+ * To keep this manageable we always use one of 3 scan modes.
* Scan 0...3, 0-1,2-3 and 1-0,3-2
*/
static inline int __max1363_check_event_mask(int thismask, int checkmask)
diff --git a/drivers/staging/iio/adc/max1363_ring.c b/drivers/staging/iio/adc/max1363_ring.c
index 5532f3e466bc..d36fcc62e976 100644
--- a/drivers/staging/iio/adc/max1363_ring.c
+++ b/drivers/staging/iio/adc/max1363_ring.c
@@ -108,7 +108,7 @@ static int max1363_ring_preenable(struct iio_dev *indio_dev)
/**
* max1363_poll_func_th() - th of trigger launched polling to ring buffer
*
- * As sampling only occurs on i2c comms occuring, leave timestamping until
+ * As sampling only occurs on i2c comms occurring, leave timestamping until
* then. Some triggers will generate their own time stamp. Currently
* there is no way of notifying them when no one cares.
**/
diff --git a/drivers/staging/iio/chrdev.h b/drivers/staging/iio/chrdev.h
index 98d1a2c12df2..4fcb99c816f9 100644
--- a/drivers/staging/iio/chrdev.h
+++ b/drivers/staging/iio/chrdev.h
@@ -33,7 +33,7 @@ struct iio_handler {
/**
* struct iio_event_data - The actual event being pushed to userspace
* @id: event identifier
- * @timestamp: best estimate of time of event occurance (often from
+ * @timestamp: best estimate of time of event occurrence (often from
* the interrupt handler)
*/
struct iio_event_data {
@@ -42,7 +42,7 @@ struct iio_event_data {
};
/**
- * struct iio_detected_event_list - list element for events that have occured
+ * struct iio_detected_event_list - list element for events that have occurred
* @list: linked list header
* @ev: the event itself
* @shared_pointer: used when the event is shared - i.e. can be escallated
@@ -98,7 +98,7 @@ struct iio_event_interface {
* @list: list header
* @refcount: as the handler may be shared between multiple device
* side events, reference counting ensures clean removal
- * @exist_lock: prevents race conditions related to refcount useage.
+ * @exist_lock: prevents race conditions related to refcount usage.
* @handler: event handler function - called on event if this
* event_handler is enabled.
*
diff --git a/drivers/staging/iio/gyro/adis16060_core.c b/drivers/staging/iio/gyro/adis16060_core.c
index 700eb3980f9e..ae53e71d1c2f 100644
--- a/drivers/staging/iio/gyro/adis16060_core.c
+++ b/drivers/staging/iio/gyro/adis16060_core.c
@@ -30,7 +30,7 @@
* @us_w: actual spi_device to write config
* @us_r: actual spi_device to read back data
* @indio_dev: industrial I/O device structure
- * @buf: transmit or recieve buffer
+ * @buf: transmit or receive buffer
* @buf_lock: mutex to protect tx and rx
**/
struct adis16060_state {
diff --git a/drivers/staging/iio/gyro/adis16080_core.c b/drivers/staging/iio/gyro/adis16080_core.c
index fb4336c7d2a6..ef9e304a226d 100644
--- a/drivers/staging/iio/gyro/adis16080_core.c
+++ b/drivers/staging/iio/gyro/adis16080_core.c
@@ -35,7 +35,7 @@
* struct adis16080_state - device instance specific data
* @us: actual spi_device to write data
* @indio_dev: industrial I/O device structure
- * @buf: transmit or recieve buffer
+ * @buf: transmit or receive buffer
* @buf_lock: mutex to protect tx and rx
**/
struct adis16080_state {
diff --git a/drivers/staging/iio/gyro/adis16260.h b/drivers/staging/iio/gyro/adis16260.h
index c1fd4364287f..1369501b4096 100644
--- a/drivers/staging/iio/gyro/adis16260.h
+++ b/drivers/staging/iio/gyro/adis16260.h
@@ -91,7 +91,7 @@
* @indio_dev: industrial I/O device structure
* @trig: data ready trigger registered with iio
* @tx: transmit buffer
- * @rx: recieve buffer
+ * @rx: receive buffer
* @buf_lock: mutex to protect tx and rx
* @negate: negate the scale parameter
**/
diff --git a/drivers/staging/iio/iio.h b/drivers/staging/iio/iio.h
index 248bdd2846fd..7127f26f8d26 100644
--- a/drivers/staging/iio/iio.h
+++ b/drivers/staging/iio/iio.h
@@ -92,7 +92,7 @@ void iio_remove_event_from_list(struct iio_event_handler_list *el,
* changes
* @available_scan_masks: [DRIVER] optional array of allowed bitmasks
* @trig: [INTERN] current device trigger (ring buffer modes)
- * @pollfunc: [DRIVER] function run on trigger being recieved
+ * @pollfunc: [DRIVER] function run on trigger being received
**/
struct iio_dev {
int id;
diff --git a/drivers/staging/iio/imu/adis16300.h b/drivers/staging/iio/imu/adis16300.h
index 1f25d68064a0..c0957591aed7 100644
--- a/drivers/staging/iio/imu/adis16300.h
+++ b/drivers/staging/iio/imu/adis16300.h
@@ -99,7 +99,7 @@
* @indio_dev: industrial I/O device structure
* @trig: data ready trigger registered with iio
* @tx: transmit buffer
- * @rx: recieve buffer
+ * @rx: receive buffer
* @buf_lock: mutex to protect tx and rx
**/
struct adis16300_state {
diff --git a/drivers/staging/iio/imu/adis16350.h b/drivers/staging/iio/imu/adis16350.h
index b00001e3edd0..b1ad48662a2c 100644
--- a/drivers/staging/iio/imu/adis16350.h
+++ b/drivers/staging/iio/imu/adis16350.h
@@ -105,7 +105,7 @@
* @indio_dev: industrial I/O device structure
* @trig: data ready trigger registered with iio
* @tx: transmit buffer
- * @rx: recieve buffer
+ * @rx: receive buffer
* @buf_lock: mutex to protect tx and rx
**/
struct adis16350_state {
diff --git a/drivers/staging/iio/imu/adis16400.h b/drivers/staging/iio/imu/adis16400.h
index 6ff33e1ad8c1..e328bcc5922f 100644
--- a/drivers/staging/iio/imu/adis16400.h
+++ b/drivers/staging/iio/imu/adis16400.h
@@ -17,7 +17,8 @@
#ifndef SPI_ADIS16400_H_
#define SPI_ADIS16400_H_
-#define ADIS16400_STARTUP_DELAY 220 /* ms */
+#define ADIS16400_STARTUP_DELAY 290 /* ms */
+#define ADIS16400_MTEST_DELAY 90 /* ms */
#define ADIS16400_READ_REG(a) a
#define ADIS16400_WRITE_REG(a) ((a) | 0x80)
@@ -131,7 +132,7 @@
* @indio_dev: industrial I/O device structure
* @trig: data ready trigger registered with iio
* @tx: transmit buffer
- * @rx: recieve buffer
+ * @rx: receive buffer
* @buf_lock: mutex to protect tx and rx
**/
struct adis16400_state {
diff --git a/drivers/staging/iio/imu/adis16400_core.c b/drivers/staging/iio/imu/adis16400_core.c
index cfb108a1545b..540bde69cc3b 100644
--- a/drivers/staging/iio/imu/adis16400_core.c
+++ b/drivers/staging/iio/imu/adis16400_core.c
@@ -6,6 +6,7 @@
*
* Copyright (c) 2009 Manuel Stahl <manuel.stahl@iis.fraunhofer.de>
* Copyright (c) 2007 Jonathan Cameron <jic23@cam.ac.uk>
+ * Copyright (c) 2011 Analog Devices Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -93,7 +94,6 @@ static int adis16400_spi_write_reg_16(struct device *dev,
.tx_buf = st->tx + 2,
.bits_per_word = 8,
.len = 2,
- .cs_change = 1,
},
};
@@ -137,7 +137,6 @@ static int adis16400_spi_read_reg_16(struct device *dev,
.rx_buf = st->rx,
.bits_per_word = 8,
.len = 2,
- .cs_change = 1,
},
};
@@ -375,7 +374,7 @@ static int adis16400_self_test(struct device *dev)
dev_err(dev, "problem starting self test");
goto err_ret;
}
-
+ msleep(ADIS16400_MTEST_DELAY);
adis16400_check_status(dev);
err_ret:
@@ -471,10 +470,11 @@ static int adis16400_initial_setup(struct adis16400_state *st)
if (ret)
goto err_ret;
- if (prod_id != ADIS16400_PRODUCT_ID_DEFAULT)
+ if ((prod_id & 0xF000) != ADIS16400_PRODUCT_ID_DEFAULT)
dev_warn(dev, "unknown product id");
- printk(KERN_INFO DRIVER_NAME ": prod_id 0x%04x at CS%d (irq %d)\n",
+
+ dev_info(dev, ": prod_id 0x%04x at CS%d (irq %d)\n",
prod_id, st->us->chip_select, st->us->irq);
/* use high spi speed if possible */
@@ -497,12 +497,12 @@ err_ret:
_reg)
static ADIS16400_DEV_ATTR_CALIBBIAS(GYRO_X, ADIS16400_XGYRO_OFF);
-static ADIS16400_DEV_ATTR_CALIBBIAS(GYRO_Y, ADIS16400_XGYRO_OFF);
-static ADIS16400_DEV_ATTR_CALIBBIAS(GYRO_Z, ADIS16400_XGYRO_OFF);
+static ADIS16400_DEV_ATTR_CALIBBIAS(GYRO_Y, ADIS16400_YGYRO_OFF);
+static ADIS16400_DEV_ATTR_CALIBBIAS(GYRO_Z, ADIS16400_ZGYRO_OFF);
static ADIS16400_DEV_ATTR_CALIBBIAS(ACCEL_X, ADIS16400_XACCL_OFF);
-static ADIS16400_DEV_ATTR_CALIBBIAS(ACCEL_Y, ADIS16400_XACCL_OFF);
-static ADIS16400_DEV_ATTR_CALIBBIAS(ACCEL_Z, ADIS16400_XACCL_OFF);
+static ADIS16400_DEV_ATTR_CALIBBIAS(ACCEL_Y, ADIS16400_YACCL_OFF);
+static ADIS16400_DEV_ATTR_CALIBBIAS(ACCEL_Z, ADIS16400_ZACCL_OFF);
static IIO_DEV_ATTR_IN_NAMED_RAW(0, supply, adis16400_read_14bit_signed,
@@ -647,7 +647,7 @@ static int __devinit adis16400_probe(struct spi_device *spi)
ret = iio_ring_buffer_register(st->indio_dev->ring, 0);
if (ret) {
- printk(KERN_ERR "failed to initialize the ring\n");
+ dev_err(&spi->dev, "failed to initialize the ring\n");
goto error_unreg_ring_funcs;
}
diff --git a/drivers/staging/iio/imu/adis16400_ring.c b/drivers/staging/iio/imu/adis16400_ring.c
index 33293fba9bcc..da28cb4288af 100644
--- a/drivers/staging/iio/imu/adis16400_ring.c
+++ b/drivers/staging/iio/imu/adis16400_ring.c
@@ -122,12 +122,10 @@ static int adis16400_spi_read_burst(struct device *dev, u8 *rx)
.tx_buf = st->tx,
.bits_per_word = 8,
.len = 2,
- .cs_change = 0,
}, {
.rx_buf = rx,
.bits_per_word = 8,
.len = 24,
- .cs_change = 1,
},
};
@@ -162,9 +160,10 @@ static void adis16400_trigger_bh_to_ring(struct work_struct *work_s)
work_trigger_to_ring);
struct iio_ring_buffer *ring = st->indio_dev->ring;
- int i = 0;
+ int i = 0, j;
s16 *data;
size_t datasize = ring->access.get_bytes_per_datum(ring);
+ unsigned long mask = ring->scan_mask;
data = kmalloc(datasize , GFP_KERNEL);
if (data == NULL) {
@@ -174,9 +173,12 @@ static void adis16400_trigger_bh_to_ring(struct work_struct *work_s)
if (ring->scan_count)
if (adis16400_spi_read_burst(&st->indio_dev->dev, st->rx) >= 0)
- for (; i < ring->scan_count; i++)
+ for (; i < ring->scan_count; i++) {
+ j = __ffs(mask);
+ mask &= ~(1 << j);
data[i] = be16_to_cpup(
- (__be16 *)&(st->rx[i*2]));
+ (__be16 *)&(st->rx[j*2]));
+ }
/* Guaranteed to be aligned with 8 byte boundary */
if (ring->scan_timestamp)
diff --git a/drivers/staging/iio/industrialio-core.c b/drivers/staging/iio/industrialio-core.c
index f3bf111f354f..1795ee1e8207 100644
--- a/drivers/staging/iio/industrialio-core.c
+++ b/drivers/staging/iio/industrialio-core.c
@@ -258,7 +258,7 @@ static ssize_t iio_event_chrdev_read(struct file *filep,
->det_events.list));
if (ret)
goto error_ret;
- /* Single access device so noone else can get the data */
+ /* Single access device so no one else can get the data */
mutex_lock(&ev_int->event_list_lock);
}
diff --git a/drivers/staging/iio/meter/ade7753.h b/drivers/staging/iio/meter/ade7753.h
index 70dabae6efe9..3b9c7f6a50e7 100644
--- a/drivers/staging/iio/meter/ade7753.h
+++ b/drivers/staging/iio/meter/ade7753.h
@@ -62,7 +62,7 @@
* @us: actual spi_device
* @indio_dev: industrial I/O device structure
* @tx: transmit buffer
- * @rx: recieve buffer
+ * @rx: receive buffer
* @buf_lock: mutex to protect tx and rx
**/
struct ade7753_state {
diff --git a/drivers/staging/iio/meter/ade7754.h b/drivers/staging/iio/meter/ade7754.h
index 8faa9b3b48b6..0aa0522a33a3 100644
--- a/drivers/staging/iio/meter/ade7754.h
+++ b/drivers/staging/iio/meter/ade7754.h
@@ -80,7 +80,7 @@
* @us: actual spi_device
* @indio_dev: industrial I/O device structure
* @tx: transmit buffer
- * @rx: recieve buffer
+ * @rx: receive buffer
* @buf_lock: mutex to protect tx and rx
**/
struct ade7754_state {
diff --git a/drivers/staging/iio/meter/ade7758.h b/drivers/staging/iio/meter/ade7758.h
index df5bb7ba5a0f..c6fd94f3b3ee 100644
--- a/drivers/staging/iio/meter/ade7758.h
+++ b/drivers/staging/iio/meter/ade7758.h
@@ -98,7 +98,7 @@
* @indio_dev: industrial I/O device structure
* @trig: data ready trigger registered with iio
* @tx: transmit buffer
- * @rx: recieve buffer
+ * @rx: receive buffer
* @buf_lock: mutex to protect tx and rx
**/
struct ade7758_state {
diff --git a/drivers/staging/iio/meter/ade7759.h b/drivers/staging/iio/meter/ade7759.h
index e9d1c43336fe..cc76c2c4c039 100644
--- a/drivers/staging/iio/meter/ade7759.h
+++ b/drivers/staging/iio/meter/ade7759.h
@@ -43,7 +43,7 @@
* @us: actual spi_device
* @indio_dev: industrial I/O device structure
* @tx: transmit buffer
- * @rx: recieve buffer
+ * @rx: receive buffer
* @buf_lock: mutex to protect tx and rx
**/
struct ade7759_state {
diff --git a/drivers/staging/iio/meter/ade7854.h b/drivers/staging/iio/meter/ade7854.h
index 4ad84a3bb462..79a21109f4e2 100644
--- a/drivers/staging/iio/meter/ade7854.h
+++ b/drivers/staging/iio/meter/ade7854.h
@@ -149,7 +149,7 @@
* @spi: actual spi_device
* @indio_dev: industrial I/O device structure
* @tx: transmit buffer
- * @rx: recieve buffer
+ * @rx: receive buffer
* @buf_lock: mutex to protect tx and rx
**/
struct ade7854_state {
diff --git a/drivers/staging/iio/ring_generic.h b/drivers/staging/iio/ring_generic.h
index f21ac09373cf..32948e55dc81 100644
--- a/drivers/staging/iio/ring_generic.h
+++ b/drivers/staging/iio/ring_generic.h
@@ -30,7 +30,7 @@ int iio_push_ring_event(struct iio_ring_buffer *ring_buf,
* @event_code: event indentification code
* @timestamp: time of event
*
- * Typical usecase is to escalate a 50% ring full to 75% full if noone has yet
+ * Typical usecase is to escalate a 50% ring full to 75% full if no one has yet
* read the first event. Clearly the 50% full is no longer of interest in
* typical use case.
**/
diff --git a/drivers/staging/intel_sst/TODO b/drivers/staging/intel_sst/TODO
index a24e5ed5689c..c733d7011091 100644
--- a/drivers/staging/intel_sst/TODO
+++ b/drivers/staging/intel_sst/TODO
@@ -1,7 +1,7 @@
TODO
----
-Get the memrar driver cleaned up and upstream (dependancy blocking SST)
+Get the memrar driver cleaned up and upstream (dependency blocking SST)
Replace long/short press with two virtual buttons
Review the printks and kill off any left over ST_ERR: messages
Review the misc device ioctls for 32/64bit safety and sanity
diff --git a/drivers/staging/intel_sst/intel_sst.c b/drivers/staging/intel_sst/intel_sst.c
index ce4a9f79ccd2..81c24d19eb9e 100644
--- a/drivers/staging/intel_sst/intel_sst.c
+++ b/drivers/staging/intel_sst/intel_sst.c
@@ -263,7 +263,7 @@ static int __devinit intel_sst_probe(struct pci_dev *pci,
/* Init the device */
ret = pci_enable_device(pci);
if (ret) {
- pr_err("device cant be enabled\n");
+ pr_err("device can't be enabled\n");
goto do_free_mem;
}
sst_drv_ctx->pci = pci_dev_get(pci);
@@ -453,7 +453,7 @@ int intel_sst_resume(struct pci_dev *pci)
pci_restore_state(pci);
ret = pci_enable_device(pci);
if (ret)
- pr_err("device cant be enabled\n");
+ pr_err("device can't be enabled\n");
mutex_lock(&sst_drv_ctx->sst_lock);
sst_drv_ctx->sst_state = SST_UN_INIT;
diff --git a/drivers/staging/intel_sst/intel_sst_app_interface.c b/drivers/staging/intel_sst/intel_sst_app_interface.c
index a367991d5600..1d0621260ea8 100644
--- a/drivers/staging/intel_sst/intel_sst_app_interface.c
+++ b/drivers/staging/intel_sst/intel_sst_app_interface.c
@@ -236,7 +236,7 @@ int intel_sst_mmap(struct file *file_ptr, struct vm_area_struct *vma)
if (!sst_drv_ctx->mmap_mem)
return -EIO;
- /* round it up to the page bondary */
+ /* round it up to the page boundary */
/*mem_area = (void *)((((unsigned long)sst_drv_ctx->mmap_mem)
+ PAGE_SIZE - 1) & PAGE_MASK);*/
mem_area = (void *) PAGE_ALIGN((unsigned int) sst_drv_ctx->mmap_mem);
@@ -871,7 +871,7 @@ int sst_send_algo_ipc(struct ipc_post **msg)
}
/**
- * intel_sst_ioctl_dsp - recieves the device ioctl's
+ * intel_sst_ioctl_dsp - receives the device ioctl's
*
* @cmd:Ioctl cmd
* @arg:data
@@ -1067,7 +1067,7 @@ long intel_sst_ioctl(struct file *file_ptr, unsigned int cmd, unsigned long arg)
retval = -EFAULT;
break;
}
- pr_debug("SET_VOLUME recieved for %d!\n",
+ pr_debug("SET_VOLUME received for %d!\n",
set_vol.stream_id);
if (minor == STREAM_MODULE && set_vol.stream_id == 0) {
pr_debug("invalid operation!\n");
@@ -1085,7 +1085,7 @@ long intel_sst_ioctl(struct file *file_ptr, unsigned int cmd, unsigned long arg)
retval = -EFAULT;
break;
}
- pr_debug("IOCTL_GET_VOLUME recieved for stream = %d!\n",
+ pr_debug("IOCTL_GET_VOLUME received for stream = %d!\n",
get_vol.stream_id);
if (minor == STREAM_MODULE && get_vol.stream_id == 0) {
pr_debug("invalid operation!\n");
@@ -1117,7 +1117,7 @@ long intel_sst_ioctl(struct file *file_ptr, unsigned int cmd, unsigned long arg)
retval = -EFAULT;
break;
}
- pr_debug("SNDRV_SST_SET_VOLUME recieved for %d!\n",
+ pr_debug("SNDRV_SST_SET_VOLUME received for %d!\n",
set_mute.stream_id);
if (minor == STREAM_MODULE && set_mute.stream_id == 0) {
retval = -EPERM;
@@ -1153,7 +1153,7 @@ long intel_sst_ioctl(struct file *file_ptr, unsigned int cmd, unsigned long arg)
case _IOC_NR(SNDRV_SST_MMAP_CAPTURE): {
struct snd_sst_mmap_buffs mmap_buf;
- pr_debug("SNDRV_SST_MMAP_PLAY/CAPTURE recieved!\n");
+ pr_debug("SNDRV_SST_MMAP_PLAY/CAPTURE received!\n");
if (minor != STREAM_MODULE) {
retval = -EBADRQC;
break;
@@ -1239,7 +1239,7 @@ long intel_sst_ioctl(struct file *file_ptr, unsigned int cmd, unsigned long arg)
case _IOC_NR(SNDRV_SST_SET_TARGET_DEVICE): {
struct snd_sst_target_device target_device;
- pr_debug("SET_TARGET_DEVICE recieved!\n");
+ pr_debug("SET_TARGET_DEVICE received!\n");
if (copy_from_user(&target_device, (void __user *)arg,
sizeof(target_device))) {
retval = -EFAULT;
@@ -1256,7 +1256,7 @@ long intel_sst_ioctl(struct file *file_ptr, unsigned int cmd, unsigned long arg)
case _IOC_NR(SNDRV_SST_DRIVER_INFO): {
struct snd_sst_driver_info info;
- pr_debug("SNDRV_SST_DRIVER_INFO recived\n");
+ pr_debug("SNDRV_SST_DRIVER_INFO received\n");
info.version = SST_VERSION_NUM;
/* hard coding, shud get sumhow later */
info.active_pcm_streams = sst_drv_ctx->stream_cnt -
diff --git a/drivers/staging/intel_sst/intel_sst_drv_interface.c b/drivers/staging/intel_sst/intel_sst_drv_interface.c
index ea8e251b5099..e9c182108243 100644
--- a/drivers/staging/intel_sst/intel_sst_drv_interface.c
+++ b/drivers/staging/intel_sst/intel_sst_drv_interface.c
@@ -315,7 +315,7 @@ int sst_open_pcm_stream(struct snd_sst_params *str_param)
pm_runtime_get_sync(&sst_drv_ctx->pci->dev);
if (sst_drv_ctx->sst_state == SST_SUSPENDED) {
- /* LPE is suspended, resume it before proceding*/
+ /* LPE is suspended, resume it before proceeding*/
pr_debug("Resuming from Suspended state\n");
retval = intel_sst_resume(sst_drv_ctx->pci);
if (retval) {
diff --git a/drivers/staging/intel_sst/intel_sst_dsp.c b/drivers/staging/intel_sst/intel_sst_dsp.c
index 6e5c9152da9f..bffe4c6e2928 100644
--- a/drivers/staging/intel_sst/intel_sst_dsp.c
+++ b/drivers/staging/intel_sst/intel_sst_dsp.c
@@ -350,7 +350,7 @@ static int sst_download_library(const struct firmware *fw_lib,
}
-/* This function is called befoer downloading the codec/postprocessing
+/* This function is called before downloading the codec/postprocessing
library is set for download to SST DSP*/
static int sst_validate_library(const struct firmware *fw_lib,
struct lib_slot_info *slot,
@@ -405,7 +405,7 @@ exit:
}
-/* This function is called when FW requests for a particular libary download
+/* This function is called when FW requests for a particular library download
This function prepares the library to download*/
int sst_load_library(struct snd_sst_lib_download *lib, u8 ops)
{
diff --git a/drivers/staging/intel_sst/intel_sst_fw_ipc.h b/drivers/staging/intel_sst/intel_sst_fw_ipc.h
index 8df313d10d2a..0f0c5bbc5f4b 100644
--- a/drivers/staging/intel_sst/intel_sst_fw_ipc.h
+++ b/drivers/staging/intel_sst/intel_sst_fw_ipc.h
@@ -111,7 +111,7 @@
#define IPC_SST_PERIOD_ELAPSED 0x97 /* period elapsed */
#define IPC_IA_TARGET_DEV_CHNGD 0x98 /* error in processing a stream */
-#define IPC_SST_ERROR_EVENT 0x99 /* Buffer over run occured */
+#define IPC_SST_ERROR_EVENT 0x99 /* Buffer over run occurred */
/* L2S messages */
#define IPC_SC_DDR_LINK_UP 0xC0
#define IPC_SC_DDR_LINK_DOWN 0xC1
diff --git a/drivers/staging/intel_sst/intel_sst_stream.c b/drivers/staging/intel_sst/intel_sst_stream.c
index 795e42ab7360..dd58be5b1975 100644
--- a/drivers/staging/intel_sst/intel_sst_stream.c
+++ b/drivers/staging/intel_sst/intel_sst_stream.c
@@ -98,7 +98,7 @@ static unsigned int get_mrst_stream_id(void)
if (sst_drv_ctx->streams[i].status == STREAM_UN_INIT)
return i;
}
- pr_debug("Didnt find empty stream for mrst\n");
+ pr_debug("Didn't find empty stream for mrst\n");
return -EBUSY;
}
diff --git a/drivers/staging/intel_sst/intel_sst_stream_encoded.c b/drivers/staging/intel_sst/intel_sst_stream_encoded.c
index 29753c7519a7..d5f07b878828 100644
--- a/drivers/staging/intel_sst/intel_sst_stream_encoded.c
+++ b/drivers/staging/intel_sst/intel_sst_stream_encoded.c
@@ -914,7 +914,7 @@ static int sst_prepare_input_buffers_rar(struct stream_info *str_info,
(void *) ((unsigned long) rar_buffers.bus_address);
pr_debug("RAR buf addr in DnR (input buffer function)0x%lu",
(unsigned long) str_info->decode_ibuf);
- pr_debug("rar in DnR decode funtion/output b_add rar =0x%lu",
+ pr_debug("rar in DnR decode function/output b_add rar =0x%lu",
(unsigned long) rar_buffers.bus_address);
*input_index = i + 1;
str_info->decode_isize = dbufs->ibufs->buff_entry[i].size;
diff --git a/drivers/staging/intel_sst/intelmid.c b/drivers/staging/intel_sst/intelmid.c
index fb2292186703..d207636a7b6d 100644
--- a/drivers/staging/intel_sst/intelmid.c
+++ b/drivers/staging/intel_sst/intelmid.c
@@ -773,7 +773,7 @@ static int __devinit snd_intelmad_sst_register(
if (ret_val)
return ret_val;
sst_card_vendor_id = (vendor_addr.value & (MASK2|MASK1|MASK0));
- pr_debug("orginal n extrated vendor id = 0x%x %d\n",
+ pr_debug("original n extrated vendor id = 0x%x %d\n",
vendor_addr.value, sst_card_vendor_id);
if (sst_card_vendor_id < 0 || sst_card_vendor_id > 2) {
pr_err("vendor card not supported!!\n");
diff --git a/drivers/staging/intel_sst/intelmid.h b/drivers/staging/intel_sst/intelmid.h
index ca881b790cb2..e77da87e1df0 100644
--- a/drivers/staging/intel_sst/intelmid.h
+++ b/drivers/staging/intel_sst/intelmid.h
@@ -90,7 +90,7 @@ struct mad_jack_msg_wq {
* @card_index: sound card index
* @card_id: sound card id detected
* @sstdrv_ops: ptr to sst driver ops
- * @pdev: ptr to platfrom device
+ * @pdev: ptr to platform device
* @irq: interrupt number detected
* @pmic_status: Device status of sound card
* @int_base: ptr to MMIO interrupt region
diff --git a/drivers/staging/intel_sst/intelmid_v1_control.c b/drivers/staging/intel_sst/intelmid_v1_control.c
index 9cc15c1c18d4..1ea814218059 100644
--- a/drivers/staging/intel_sst/intelmid_v1_control.c
+++ b/drivers/staging/intel_sst/intelmid_v1_control.c
@@ -28,6 +28,7 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/pci.h>
+#include <linux/delay.h>
#include <linux/file.h>
#include <asm/mrst.h>
#include <sound/pcm.h>
diff --git a/drivers/staging/intel_sst/intelmid_v2_control.c b/drivers/staging/intel_sst/intelmid_v2_control.c
index 26d815a67eb8..3c6b3abff3c3 100644
--- a/drivers/staging/intel_sst/intelmid_v2_control.c
+++ b/drivers/staging/intel_sst/intelmid_v2_control.c
@@ -29,6 +29,7 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/pci.h>
+#include <linux/delay.h>
#include <linux/file.h>
#include "intel_sst.h"
#include "intelmid_snd_control.h"
diff --git a/drivers/staging/keucr/init.c b/drivers/staging/keucr/init.c
index 5c01f28f0734..8af7c84daee2 100644
--- a/drivers/staging/keucr/init.c
+++ b/drivers/staging/keucr/init.c
@@ -90,7 +90,7 @@ int ENE_MSInit(struct us_data *us)
result = ENE_SendScsiCmd(us, FDIR_READ, &buf, 0);
if (result != USB_STOR_XFER_GOOD) {
- printk(KERN_ERR "Exection MS Init Code Fail !!\n");
+ printk(KERN_ERR "Execution MS Init Code Fail !!\n");
return USB_STOR_TRANSPORT_ERROR;
}
@@ -145,7 +145,7 @@ int ENE_SMInit(struct us_data *us)
result = ENE_SendScsiCmd(us, FDIR_READ, &buf, 0);
if (result != USB_STOR_XFER_GOOD) {
printk(KERN_ERR
- "Exection SM Init Code Fail !! result = %x\n", result);
+ "Execution SM Init Code Fail !! result = %x\n", result);
return USB_STOR_TRANSPORT_ERROR;
}
diff --git a/drivers/staging/keucr/smilmain.c b/drivers/staging/keucr/smilmain.c
index 2cbe9f897eef..95c688a5c95a 100644
--- a/drivers/staging/keucr/smilmain.c
+++ b/drivers/staging/keucr/smilmain.c
@@ -64,7 +64,7 @@ extern struct SSFDCTYPE Ssfdc;
extern struct ADDRESS Media;
extern struct CIS_AREA CisArea;
-//BIT Controll Macro
+//BIT Control Macro
BYTE BitData[] = { 0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80 } ;
#define Set_D_Bit(a,b) (a[(BYTE)((b)/8)]|= BitData[(b)%8])
#define Clr_D_Bit(a,b) (a[(BYTE)((b)/8)]&=~BitData[(b)%8])
@@ -76,7 +76,7 @@ extern BYTE IsXDCompliance;
//
-////Power Controll & Media Exist Check Function
+////Power Control & Media Exist Check Function
////----- Init_D_SmartMedia() --------------------------------------------
//int Init_D_SmartMedia(void)
//{
@@ -575,7 +575,7 @@ int Media_D_OneSectWriteFlush(PFDO_DEVICE_EXTENSION fdoExt)
// return(SUCCESS);
//}
//
-////Power Controll & Media Exist Check Subroutine
+////Power Control & Media Exist Check Subroutine
////----- Initialize_D_Media() -------------------------------------------
//void Initialize_D_Media(void)
//{
@@ -738,7 +738,7 @@ int Check_D_MediaFmt(struct us_data *us)
// return(SUCCESS);
//}
*/
-//SmartMedia Physical Address Controll Subroutine
+//SmartMedia Physical Address Control Subroutine
//----- Conv_D_MediaAddr() ---------------------------------------------
int Conv_D_MediaAddr(struct us_data *us, DWORD addr)
{
diff --git a/drivers/staging/keucr/smilsub.c b/drivers/staging/keucr/smilsub.c
index 80da61c37bff..4fe47422eb79 100644
--- a/drivers/staging/keucr/smilsub.c
+++ b/drivers/staging/keucr/smilsub.c
@@ -57,7 +57,7 @@ extern WORD WriteBlock;
#define ODD 1 // Odd Page for 256byte/page
-//SmartMedia Redundant buffer data Controll Subroutine
+//SmartMedia Redundant buffer data Control Subroutine
//----- Check_D_DataBlank() --------------------------------------------
int Check_D_DataBlank(BYTE *redundant)
{
@@ -1367,7 +1367,7 @@ BYTE _Check_D_DevCode(BYTE dcode)
}
}
/*
-////SmartMedia Power Controll Subroutine
+////SmartMedia Power Control Subroutine
////----- Cnt_D_Reset() ----------------------------------------------
//void Cnt_D_Reset(void)
//{
@@ -1478,7 +1478,7 @@ BYTE _Check_D_DevCode(BYTE dcode)
//}
//
*/
-//SmartMedia ECC Controll Subroutine
+//SmartMedia ECC Control Subroutine
//----- Check_D_ReadError() ----------------------------------------------
int Check_D_ReadError(BYTE *redundant)
{
diff --git a/drivers/staging/lirc/Kconfig b/drivers/staging/lirc/Kconfig
index cdaff5903a8f..526ec0fc2f04 100644
--- a/drivers/staging/lirc/Kconfig
+++ b/drivers/staging/lirc/Kconfig
@@ -32,18 +32,6 @@ config LIRC_IMON
Current generation iMON devices use the input layer imon driver.
-config LIRC_IT87
- tristate "ITE IT87XX CIR Port Receiver"
- depends on LIRC && PNP
- help
- Driver for the ITE IT87xx IR Receiver
-
-config LIRC_ITE8709
- tristate "ITE8709 CIR Port Receiver"
- depends on LIRC && PNP
- help
- Driver for the ITE8709 IR Receiver
-
config LIRC_PARALLEL
tristate "Homebrew Parallel Port Receiver"
depends on LIRC && PARPORT
diff --git a/drivers/staging/lirc/Makefile b/drivers/staging/lirc/Makefile
index 94af218d8373..d76b0fa2af53 100644
--- a/drivers/staging/lirc/Makefile
+++ b/drivers/staging/lirc/Makefile
@@ -6,8 +6,6 @@
obj-$(CONFIG_LIRC_BT829) += lirc_bt829.o
obj-$(CONFIG_LIRC_IGORPLUGUSB) += lirc_igorplugusb.o
obj-$(CONFIG_LIRC_IMON) += lirc_imon.o
-obj-$(CONFIG_LIRC_IT87) += lirc_it87.o
-obj-$(CONFIG_LIRC_ITE8709) += lirc_ite8709.o
obj-$(CONFIG_LIRC_PARALLEL) += lirc_parallel.o
obj-$(CONFIG_LIRC_SASEM) += lirc_sasem.o
obj-$(CONFIG_LIRC_SERIAL) += lirc_serial.o
diff --git a/drivers/staging/lirc/TODO.lirc_zilog b/drivers/staging/lirc/TODO.lirc_zilog
index 2d0263f07937..a97800a8e127 100644
--- a/drivers/staging/lirc/TODO.lirc_zilog
+++ b/drivers/staging/lirc/TODO.lirc_zilog
@@ -1,34 +1,33 @@
-1. Both ir-kbd-i2c and lirc_zilog provide support for RX events.
-The 'tx_only' lirc_zilog module parameter will allow ir-kbd-i2c
-and lirc_zilog to coexist in the kernel, if the user requires such a set-up.
-However the IR unit will not work well without coordination between the
-two modules. A shared mutex, for transceiver access locking, needs to be
-supplied by bridge drivers, in struct IR_i2_init_data, to both ir-kbd-i2c
-and lirc_zilog, before they will coexist usefully. This should be fixed
-before moving out of staging.
-
-2. References and locking need careful examination. For cx18 and ivtv PCI
-cards, which are not easily "hot unplugged", the imperfect state of reference
-counting and locking is acceptable if not correct. For USB connected units
-like HD PVR, PVR USB2, HVR-1900, and HVR1950, the likelyhood of an Ooops on
-unplug is probably great. Proper reference counting and locking needs to be
-implemented before this module is moved out of staging.
-
-3. The binding between hdpvr and lirc_zilog is currently disabled,
-due to an OOPS reported a few years ago when both the hdpvr and cx18
-drivers were loaded in his system. More details can be seen at:
- http://www.mail-archive.com/linux-media@vger.kernel.org/msg09163.html
-More tests need to be done, in order to fix the reported issue.
-
-4. In addition to providing a shared mutex for transceiver access
-locking, bridge drivers, if able, should provide a chip reset() callback
+1. Both ir-kbd-i2c and lirc_zilog provide support for RX events for
+the chips supported by lirc_zilog. Before moving lirc_zilog out of staging:
+
+a. ir-kbd-i2c needs a module parameter added to allow the user to tell
+ ir-kbd-i2c to ignore Z8 IR units.
+
+b. lirc_zilog should provide Rx key presses to the rc core like ir-kbd-i2c
+ does.
+
+
+2. lirc_zilog module ref-counting need examination. It has not been
+verified that cdev and lirc_dev will take the proper module references on
+lirc_zilog to prevent removal of lirc_zilog when the /dev/lircN device node
+is open.
+
+(The good news is ref-counting of lirc_zilog internal structures appears to be
+complete. Testing has shown the cx18 module can be unloaded out from under
+irw + lircd + lirc_dev, with the /dev/lirc0 device node open, with no adverse
+effects. The cx18 module could then be reloaded and irw properly began
+receiving button presses again and ir_send worked without error.)
+
+
+3. Bridge drivers, if able, should provide a chip reset() callback
to lirc_zilog via struct IR_i2c_init_data. cx18 and ivtv already have routines
-to perform Z8 chip resets via GPIO manipulations. This will allow lirc_zilog
+to perform Z8 chip resets via GPIO manipulations. This would allow lirc_zilog
to bring the chip back to normal when it hangs, in the same places the
original lirc_pvr150 driver code does. This is not strictly needed, so it
is not required to move lirc_zilog out of staging.
-5. Both lirc_zilog and ir-kbd-i2c support the Zilog Z8 for IR, as programmed
+Note: Both lirc_zilog and ir-kbd-i2c support the Zilog Z8 for IR, as programmed
and installed on Hauppauge products. When working on either module, developers
must consider at least the following bridge drivers which mention an IR Rx unit
at address 0x71 (indicative of a Z8):
diff --git a/drivers/staging/lirc/lirc_ene0100.h b/drivers/staging/lirc/lirc_ene0100.h
index 776b693bb307..06bebd6acc46 100644
--- a/drivers/staging/lirc/lirc_ene0100.h
+++ b/drivers/staging/lirc/lirc_ene0100.h
@@ -81,7 +81,7 @@
/* CIR block settings */
#define ENE_CIR_CONF1 0xFEC0
-#define ENE_CIR_CONF1_ADC_ON 0x7 /* reciever on gpio40 enabled */
+#define ENE_CIR_CONF1_ADC_ON 0x7 /* receiver on gpio40 enabled */
#define ENE_CIR_CONF1_LEARN1 (1 << 3) /* enabled on learning mode */
#define ENE_CIR_CONF1_TX_ON 0x30 /* enabled on transmit */
#define ENE_CIR_CONF1_TX_CARR (1 << 7) /* send TX carrier or not */
@@ -96,7 +96,7 @@
/* transmitter - not implemented yet */
/* KB3926C and higher */
-/* transmission is very similiar to recieving, a byte is written to */
+/* transmission is very similar to receiving, a byte is written to */
/* ENE_TX_INPUT, in same manner as it is read from sample buffer */
/* sample period is fixed*/
diff --git a/drivers/staging/lirc/lirc_imon.c b/drivers/staging/lirc/lirc_imon.c
index 235cab0eb087..4039eda2a15b 100644
--- a/drivers/staging/lirc/lirc_imon.c
+++ b/drivers/staging/lirc/lirc_imon.c
@@ -379,7 +379,7 @@ static ssize_t vfd_write(struct file *file, const char *buf,
struct imon_context *context;
const unsigned char vfd_packet6[] = {
0x01, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF };
- int *data_buf;
+ int *data_buf = NULL;
context = file->private_data;
if (!context) {
diff --git a/drivers/staging/lirc/lirc_it87.c b/drivers/staging/lirc/lirc_it87.c
deleted file mode 100644
index 5938616f3e8f..000000000000
--- a/drivers/staging/lirc/lirc_it87.c
+++ /dev/null
@@ -1,1027 +0,0 @@
-/*
- * LIRC driver for ITE IT8712/IT8705 CIR port
- *
- * Copyright (C) 2001 Hans-Gunter Lutke Uphues <hg_lu@web.de>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- *
- * ITE IT8705 and IT8712(not tested) and IT8720 CIR-port support for lirc based
- * via cut and paste from lirc_sir.c (C) 2000 Milan Pikula
- *
- * Attention: Sendmode only tested with debugging logs
- *
- * 2001/02/27 Christoph Bartelmus <lirc@bartelmus.de> :
- * reimplemented read function
- * 2005/06/05 Andrew Calkin implemented support for Asus Digimatrix,
- * based on work of the following member of the Outertrack Digimatrix
- * Forum: Art103 <r_tay@hotmail.com>
- * 2009/12/24 James Edwards <jimbo-lirc@edwardsclan.net> implemeted support
- * for ITE8704/ITE8718, on my machine, the DSDT reports 8704, but the
- * chip identifies as 18.
- */
-
-#include <linux/module.h>
-#include <linux/sched.h>
-#include <linux/errno.h>
-#include <linux/signal.h>
-#include <linux/fs.h>
-#include <linux/interrupt.h>
-#include <linux/ioport.h>
-#include <linux/kernel.h>
-#include <linux/time.h>
-#include <linux/string.h>
-#include <linux/types.h>
-#include <linux/wait.h>
-#include <linux/mm.h>
-#include <linux/delay.h>
-#include <linux/poll.h>
-#include <asm/system.h>
-#include <linux/io.h>
-#include <linux/irq.h>
-#include <linux/fcntl.h>
-
-#include <linux/timer.h>
-#include <linux/pnp.h>
-
-#include <media/lirc.h>
-#include <media/lirc_dev.h>
-
-#include "lirc_it87.h"
-
-#ifdef LIRC_IT87_DIGIMATRIX
-static int digimatrix = 1;
-static int it87_freq = 36; /* kHz */
-static int irq = 9;
-#else
-static int digimatrix;
-static int it87_freq = 38; /* kHz */
-static int irq = IT87_CIR_DEFAULT_IRQ;
-#endif
-
-static unsigned long it87_bits_in_byte_out;
-static unsigned long it87_send_counter;
-static unsigned char it87_RXEN_mask = IT87_CIR_RCR_RXEN;
-
-#define RBUF_LEN 1024
-
-#define LIRC_DRIVER_NAME "lirc_it87"
-
-/* timeout for sequences in jiffies (=5/100s) */
-/* must be longer than TIME_CONST */
-#define IT87_TIMEOUT (HZ*5/100)
-
-/* module parameters */
-static int debug;
-#define dprintk(fmt, args...) \
- do { \
- if (debug) \
- printk(KERN_DEBUG LIRC_DRIVER_NAME ": " \
- fmt, ## args); \
- } while (0)
-
-static int io = IT87_CIR_DEFAULT_IOBASE;
-/* receiver demodulator default: off */
-static int it87_enable_demodulator;
-
-static int timer_enabled;
-static DEFINE_SPINLOCK(timer_lock);
-static struct timer_list timerlist;
-/* time of last signal change detected */
-static struct timeval last_tv = {0, 0};
-/* time of last UART data ready interrupt */
-static struct timeval last_intr_tv = {0, 0};
-static int last_value;
-
-static DECLARE_WAIT_QUEUE_HEAD(lirc_read_queue);
-
-static DEFINE_SPINLOCK(hardware_lock);
-static DEFINE_SPINLOCK(dev_lock);
-static bool device_open;
-
-static int rx_buf[RBUF_LEN];
-unsigned int rx_tail, rx_head;
-
-static struct pnp_driver it87_pnp_driver;
-
-/* SECTION: Prototypes */
-
-/* Communication with user-space */
-static int lirc_open(struct inode *inode, struct file *file);
-static int lirc_close(struct inode *inode, struct file *file);
-static unsigned int lirc_poll(struct file *file, poll_table *wait);
-static ssize_t lirc_read(struct file *file, char *buf,
- size_t count, loff_t *ppos);
-static ssize_t lirc_write(struct file *file, const char *buf,
- size_t n, loff_t *pos);
-static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg);
-static void add_read_queue(int flag, unsigned long val);
-static int init_chrdev(void);
-static void drop_chrdev(void);
-/* Hardware */
-static irqreturn_t it87_interrupt(int irq, void *dev_id);
-static void send_space(unsigned long len);
-static void send_pulse(unsigned long len);
-static void init_send(void);
-static void terminate_send(unsigned long len);
-static int init_hardware(void);
-static void drop_hardware(void);
-/* Initialisation */
-static int init_port(void);
-static void drop_port(void);
-
-
-/* SECTION: Communication with user-space */
-
-static int lirc_open(struct inode *inode, struct file *file)
-{
- spin_lock(&dev_lock);
- if (device_open) {
- spin_unlock(&dev_lock);
- return -EBUSY;
- }
- device_open = true;
- spin_unlock(&dev_lock);
- return 0;
-}
-
-
-static int lirc_close(struct inode *inode, struct file *file)
-{
- spin_lock(&dev_lock);
- device_open = false;
- spin_unlock(&dev_lock);
- return 0;
-}
-
-
-static unsigned int lirc_poll(struct file *file, poll_table *wait)
-{
- poll_wait(file, &lirc_read_queue, wait);
- if (rx_head != rx_tail)
- return POLLIN | POLLRDNORM;
- return 0;
-}
-
-
-static ssize_t lirc_read(struct file *file, char *buf,
- size_t count, loff_t *ppos)
-{
- int n = 0;
- int retval = 0;
-
- while (n < count) {
- if (file->f_flags & O_NONBLOCK && rx_head == rx_tail) {
- retval = -EAGAIN;
- break;
- }
- retval = wait_event_interruptible(lirc_read_queue,
- rx_head != rx_tail);
- if (retval)
- break;
-
- if (copy_to_user((void *) buf + n, (void *) (rx_buf + rx_head),
- sizeof(int))) {
- retval = -EFAULT;
- break;
- }
- rx_head = (rx_head + 1) & (RBUF_LEN - 1);
- n += sizeof(int);
- }
- if (n)
- return n;
- return retval;
-}
-
-
-static ssize_t lirc_write(struct file *file, const char *buf,
- size_t n, loff_t *pos)
-{
- int i = 0;
- int *tx_buf;
-
- if (n % sizeof(int))
- return -EINVAL;
- tx_buf = memdup_user(buf, n);
- if (IS_ERR(tx_buf))
- return PTR_ERR(tx_buf);
- n /= sizeof(int);
- init_send();
- while (1) {
- if (i >= n)
- break;
- if (tx_buf[i])
- send_pulse(tx_buf[i]);
- i++;
- if (i >= n)
- break;
- if (tx_buf[i])
- send_space(tx_buf[i]);
- i++;
- }
- terminate_send(tx_buf[i - 1]);
- kfree(tx_buf);
- return n;
-}
-
-
-static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
-{
- int retval = 0;
- __u32 value = 0;
- unsigned long hw_flags;
-
- if (cmd == LIRC_GET_FEATURES)
- value = LIRC_CAN_SEND_PULSE |
- LIRC_CAN_SET_SEND_CARRIER |
- LIRC_CAN_REC_MODE2;
- else if (cmd == LIRC_GET_SEND_MODE)
- value = LIRC_MODE_PULSE;
- else if (cmd == LIRC_GET_REC_MODE)
- value = LIRC_MODE_MODE2;
-
- switch (cmd) {
- case LIRC_GET_FEATURES:
- case LIRC_GET_SEND_MODE:
- case LIRC_GET_REC_MODE:
- retval = put_user(value, (__u32 *) arg);
- break;
-
- case LIRC_SET_SEND_MODE:
- case LIRC_SET_REC_MODE:
- retval = get_user(value, (__u32 *) arg);
- break;
-
- case LIRC_SET_SEND_CARRIER:
- retval = get_user(value, (__u32 *) arg);
- if (retval)
- return retval;
- value /= 1000;
- if (value > IT87_CIR_FREQ_MAX ||
- value < IT87_CIR_FREQ_MIN)
- return -EINVAL;
-
- it87_freq = value;
-
- spin_lock_irqsave(&hardware_lock, hw_flags);
- outb(((inb(io + IT87_CIR_TCR2) & IT87_CIR_TCR2_TXMPW) |
- (it87_freq - IT87_CIR_FREQ_MIN) << 3),
- io + IT87_CIR_TCR2);
- spin_unlock_irqrestore(&hardware_lock, hw_flags);
- dprintk("demodulation frequency: %d kHz\n", it87_freq);
-
- break;
-
- default:
- retval = -EINVAL;
- }
-
- if (retval)
- return retval;
-
- if (cmd == LIRC_SET_REC_MODE) {
- if (value != LIRC_MODE_MODE2)
- retval = -ENOSYS;
- } else if (cmd == LIRC_SET_SEND_MODE) {
- if (value != LIRC_MODE_PULSE)
- retval = -ENOSYS;
- }
- return retval;
-}
-
-static void add_read_queue(int flag, unsigned long val)
-{
- unsigned int new_rx_tail;
- int newval;
-
- dprintk("add flag %d with val %lu\n", flag, val);
-
- newval = val & PULSE_MASK;
-
- /*
- * statistically, pulses are ~TIME_CONST/2 too long. we could
- * maybe make this more exact, but this is good enough
- */
- if (flag) {
- /* pulse */
- if (newval > TIME_CONST / 2)
- newval -= TIME_CONST / 2;
- else /* should not ever happen */
- newval = 1;
- newval |= PULSE_BIT;
- } else
- newval += TIME_CONST / 2;
- new_rx_tail = (rx_tail + 1) & (RBUF_LEN - 1);
- if (new_rx_tail == rx_head) {
- dprintk("Buffer overrun.\n");
- return;
- }
- rx_buf[rx_tail] = newval;
- rx_tail = new_rx_tail;
- wake_up_interruptible(&lirc_read_queue);
-}
-
-
-static const struct file_operations lirc_fops = {
- .owner = THIS_MODULE,
- .read = lirc_read,
- .write = lirc_write,
- .poll = lirc_poll,
- .unlocked_ioctl = lirc_ioctl,
-#ifdef CONFIG_COMPAT
- .compat_ioctl = lirc_ioctl,
-#endif
- .open = lirc_open,
- .release = lirc_close,
- .llseek = noop_llseek,
-};
-
-static int set_use_inc(void *data)
-{
- return 0;
-}
-
-static void set_use_dec(void *data)
-{
-}
-
-static struct lirc_driver driver = {
- .name = LIRC_DRIVER_NAME,
- .minor = -1,
- .code_length = 1,
- .sample_rate = 0,
- .data = NULL,
- .add_to_buf = NULL,
- .set_use_inc = set_use_inc,
- .set_use_dec = set_use_dec,
- .fops = &lirc_fops,
- .dev = NULL,
- .owner = THIS_MODULE,
-};
-
-
-static int init_chrdev(void)
-{
- driver.minor = lirc_register_driver(&driver);
-
- if (driver.minor < 0) {
- printk(KERN_ERR LIRC_DRIVER_NAME ": init_chrdev() failed.\n");
- return -EIO;
- }
- return 0;
-}
-
-
-static void drop_chrdev(void)
-{
- lirc_unregister_driver(driver.minor);
-}
-
-
-/* SECTION: Hardware */
-static long delta(struct timeval *tv1, struct timeval *tv2)
-{
- unsigned long deltv;
-
- deltv = tv2->tv_sec - tv1->tv_sec;
- if (deltv > 15)
- deltv = 0xFFFFFF;
- else
- deltv = deltv*1000000 + tv2->tv_usec - tv1->tv_usec;
- return deltv;
-}
-
-static void it87_timeout(unsigned long data)
-{
- unsigned long flags;
-
- /* avoid interference with interrupt */
- spin_lock_irqsave(&timer_lock, flags);
-
- if (digimatrix) {
- /* We have timed out. Disable the RX mechanism. */
-
- outb((inb(io + IT87_CIR_RCR) & ~IT87_CIR_RCR_RXEN) |
- IT87_CIR_RCR_RXACT, io + IT87_CIR_RCR);
- if (it87_RXEN_mask)
- outb(inb(io + IT87_CIR_RCR) | IT87_CIR_RCR_RXEN,
- io + IT87_CIR_RCR);
- dprintk(" TIMEOUT\n");
- timer_enabled = 0;
-
- /* fifo clear */
- outb(inb(io + IT87_CIR_TCR1) | IT87_CIR_TCR1_FIFOCLR,
- io+IT87_CIR_TCR1);
-
- } else {
- /*
- * if last received signal was a pulse, but receiving stopped
- * within the 9 bit frame, we need to finish this pulse and
- * simulate a signal change to from pulse to space. Otherwise
- * upper layers will receive two sequences next time.
- */
-
- if (last_value) {
- unsigned long pulse_end;
-
- /* determine 'virtual' pulse end: */
- pulse_end = delta(&last_tv, &last_intr_tv);
- dprintk("timeout add %d for %lu usec\n",
- last_value, pulse_end);
- add_read_queue(last_value, pulse_end);
- last_value = 0;
- last_tv = last_intr_tv;
- }
- }
- spin_unlock_irqrestore(&timer_lock, flags);
-}
-
-static irqreturn_t it87_interrupt(int irq, void *dev_id)
-{
- unsigned char data;
- struct timeval curr_tv;
- static unsigned long deltv;
- unsigned long deltintrtv;
- unsigned long flags, hw_flags;
- int iir, lsr;
- int fifo = 0;
- static char lastbit;
- char bit;
-
- /* Bit duration in microseconds */
- const unsigned long bit_duration = 1000000ul /
- (115200 / IT87_CIR_BAUDRATE_DIVISOR);
-
-
- iir = inb(io + IT87_CIR_IIR);
-
- switch (iir & IT87_CIR_IIR_IID) {
- case 0x4:
- case 0x6:
- lsr = inb(io + IT87_CIR_RSR) & (IT87_CIR_RSR_RXFTO |
- IT87_CIR_RSR_RXFBC);
- fifo = lsr & IT87_CIR_RSR_RXFBC;
- dprintk("iir: 0x%x fifo: 0x%x\n", iir, lsr);
-
- /* avoid interference with timer */
- spin_lock_irqsave(&timer_lock, flags);
- spin_lock_irqsave(&hardware_lock, hw_flags);
- if (digimatrix) {
- static unsigned long acc_pulse;
- static unsigned long acc_space;
-
- do {
- data = inb(io + IT87_CIR_DR);
- data = ~data;
- fifo--;
- if (data != 0x00) {
- if (timer_enabled)
- del_timer(&timerlist);
- /*
- * start timer for end of
- * sequence detection
- */
- timerlist.expires = jiffies +
- IT87_TIMEOUT;
- add_timer(&timerlist);
- timer_enabled = 1;
- }
- /* Loop through */
- for (bit = 0; bit < 8; ++bit) {
- if ((data >> bit) & 1) {
- ++acc_pulse;
- if (lastbit == 0) {
- add_read_queue(0,
- acc_space *
- bit_duration);
- acc_space = 0;
- }
- } else {
- ++acc_space;
- if (lastbit == 1) {
- add_read_queue(1,
- acc_pulse *
- bit_duration);
- acc_pulse = 0;
- }
- }
- lastbit = (data >> bit) & 1;
- }
-
- } while (fifo != 0);
- } else { /* Normal Operation */
- do {
- del_timer(&timerlist);
- data = inb(io + IT87_CIR_DR);
-
- dprintk("data=%02x\n", data);
- do_gettimeofday(&curr_tv);
- deltv = delta(&last_tv, &curr_tv);
- deltintrtv = delta(&last_intr_tv, &curr_tv);
-
- dprintk("t %lu , d %d\n",
- deltintrtv, (int)data);
-
- /*
- * if nothing came in last 2 cycles,
- * it was gap
- */
- if (deltintrtv > TIME_CONST * 2) {
- if (last_value) {
- dprintk("GAP\n");
-
- /* simulate signal change */
- add_read_queue(last_value,
- deltv -
- deltintrtv);
- last_value = 0;
- last_tv.tv_sec =
- last_intr_tv.tv_sec;
- last_tv.tv_usec =
- last_intr_tv.tv_usec;
- deltv = deltintrtv;
- }
- }
- data = 1;
- if (data ^ last_value) {
- /*
- * deltintrtv > 2*TIME_CONST,
- * remember ? the other case is
- * timeout
- */
- add_read_queue(last_value,
- deltv-TIME_CONST);
- last_value = data;
- last_tv = curr_tv;
- if (last_tv.tv_usec >= TIME_CONST)
- last_tv.tv_usec -= TIME_CONST;
- else {
- last_tv.tv_sec--;
- last_tv.tv_usec += 1000000 -
- TIME_CONST;
- }
- }
- last_intr_tv = curr_tv;
- if (data) {
- /*
- * start timer for end of
- * sequence detection
- */
- timerlist.expires =
- jiffies + IT87_TIMEOUT;
- add_timer(&timerlist);
- }
- outb((inb(io + IT87_CIR_RCR) &
- ~IT87_CIR_RCR_RXEN) |
- IT87_CIR_RCR_RXACT,
- io + IT87_CIR_RCR);
- if (it87_RXEN_mask)
- outb(inb(io + IT87_CIR_RCR) |
- IT87_CIR_RCR_RXEN,
- io + IT87_CIR_RCR);
- fifo--;
- } while (fifo != 0);
- }
- spin_unlock_irqrestore(&hardware_lock, hw_flags);
- spin_unlock_irqrestore(&timer_lock, flags);
-
- return IRQ_RETVAL(IRQ_HANDLED);
-
- default:
- /* not our irq */
- dprintk("unknown IRQ (shouldn't happen) !!\n");
- return IRQ_RETVAL(IRQ_NONE);
- }
-}
-
-
-static void send_it87(unsigned long len, unsigned long stime,
- unsigned char send_byte, unsigned int count_bits)
-{
- long count = len / stime;
- long time_left = 0;
- static unsigned char byte_out;
- unsigned long hw_flags;
-
- dprintk("%s: len=%ld, sb=%d\n", __func__, len, send_byte);
-
- time_left = (long)len - (long)count * (long)stime;
- count += ((2 * time_left) / stime);
- while (count) {
- long i = 0;
- for (i = 0; i < count_bits; i++) {
- byte_out = (byte_out << 1) | (send_byte & 1);
- it87_bits_in_byte_out++;
- }
- if (it87_bits_in_byte_out == 8) {
- dprintk("out=0x%x, tsr_txfbc: 0x%x\n",
- byte_out,
- inb(io + IT87_CIR_TSR) &
- IT87_CIR_TSR_TXFBC);
-
- while ((inb(io + IT87_CIR_TSR) &
- IT87_CIR_TSR_TXFBC) >= IT87_CIR_FIFO_SIZE)
- ;
-
- spin_lock_irqsave(&hardware_lock, hw_flags);
- outb(byte_out, io + IT87_CIR_DR);
- spin_unlock_irqrestore(&hardware_lock, hw_flags);
-
- it87_bits_in_byte_out = 0;
- it87_send_counter++;
- byte_out = 0;
- }
- count--;
- }
-}
-
-
-/*TODO: maybe exchange space and pulse because it8705 only modulates 0-bits */
-
-static void send_space(unsigned long len)
-{
- send_it87(len, TIME_CONST, IT87_CIR_SPACE, IT87_CIR_BAUDRATE_DIVISOR);
-}
-
-static void send_pulse(unsigned long len)
-{
- send_it87(len, TIME_CONST, IT87_CIR_PULSE, IT87_CIR_BAUDRATE_DIVISOR);
-}
-
-
-static void init_send()
-{
- unsigned long flags;
-
- spin_lock_irqsave(&hardware_lock, flags);
- /* RXEN=0: receiver disable */
- it87_RXEN_mask = 0;
- outb(inb(io + IT87_CIR_RCR) & ~IT87_CIR_RCR_RXEN,
- io + IT87_CIR_RCR);
- spin_unlock_irqrestore(&hardware_lock, flags);
- it87_bits_in_byte_out = 0;
- it87_send_counter = 0;
-}
-
-
-static void terminate_send(unsigned long len)
-{
- unsigned long flags;
- unsigned long last = 0;
-
- last = it87_send_counter;
- /* make sure all necessary data has been sent */
- while (last == it87_send_counter)
- send_space(len);
- /* wait until all data sent */
- while ((inb(io + IT87_CIR_TSR) & IT87_CIR_TSR_TXFBC) != 0)
- ;
- /* then re-enable receiver */
- spin_lock_irqsave(&hardware_lock, flags);
- it87_RXEN_mask = IT87_CIR_RCR_RXEN;
- outb(inb(io + IT87_CIR_RCR) | IT87_CIR_RCR_RXEN,
- io + IT87_CIR_RCR);
- spin_unlock_irqrestore(&hardware_lock, flags);
-}
-
-
-static int init_hardware(void)
-{
- unsigned long flags;
- unsigned char it87_rcr = 0;
-
- spin_lock_irqsave(&hardware_lock, flags);
- /* init cir-port */
- /* enable r/w-access to Baudrate-Register */
- outb(IT87_CIR_IER_BR, io + IT87_CIR_IER);
- outb(IT87_CIR_BAUDRATE_DIVISOR % 0x100, io+IT87_CIR_BDLR);
- outb(IT87_CIR_BAUDRATE_DIVISOR / 0x100, io+IT87_CIR_BDHR);
- /* Baudrate Register off, define IRQs: Input only */
- if (digimatrix) {
- outb(IT87_CIR_IER_IEC | IT87_CIR_IER_RFOIE, io + IT87_CIR_IER);
- /* RX: HCFS=0, RXDCR = 001b (33,75..38,25 kHz), RXEN=1 */
- } else {
- outb(IT87_CIR_IER_IEC | IT87_CIR_IER_RDAIE, io + IT87_CIR_IER);
- /* RX: HCFS=0, RXDCR = 001b (35,6..40,3 kHz), RXEN=1 */
- }
- it87_rcr = (IT87_CIR_RCR_RXEN & it87_RXEN_mask) | 0x1;
- if (it87_enable_demodulator)
- it87_rcr |= IT87_CIR_RCR_RXEND;
- outb(it87_rcr, io + IT87_CIR_RCR);
- if (digimatrix) {
- /* Set FIFO depth to 1 byte, and disable TX */
- outb(inb(io + IT87_CIR_TCR1) | 0x00,
- io + IT87_CIR_TCR1);
-
- /*
- * TX: it87_freq (36kHz), 'reserved' sensitivity
- * setting (0x00)
- */
- outb(((it87_freq - IT87_CIR_FREQ_MIN) << 3) | 0x00,
- io + IT87_CIR_TCR2);
- } else {
- /* TX: 38kHz, 13,3us (pulse-width) */
- outb(((it87_freq - IT87_CIR_FREQ_MIN) << 3) | 0x06,
- io + IT87_CIR_TCR2);
- }
- spin_unlock_irqrestore(&hardware_lock, flags);
- return 0;
-}
-
-
-static void drop_hardware(void)
-{
- unsigned long flags;
-
- spin_lock_irqsave(&hardware_lock, flags);
- disable_irq(irq);
- /* receiver disable */
- it87_RXEN_mask = 0;
- outb(0x1, io + IT87_CIR_RCR);
- /* turn off irqs */
- outb(0, io + IT87_CIR_IER);
- /* fifo clear */
- outb(IT87_CIR_TCR1_FIFOCLR, io+IT87_CIR_TCR1);
- /* reset */
- outb(IT87_CIR_IER_RESET, io+IT87_CIR_IER);
- enable_irq(irq);
- spin_unlock_irqrestore(&hardware_lock, flags);
-}
-
-
-static unsigned char it87_read(unsigned char port)
-{
- outb(port, IT87_ADRPORT);
- return inb(IT87_DATAPORT);
-}
-
-
-static void it87_write(unsigned char port, unsigned char data)
-{
- outb(port, IT87_ADRPORT);
- outb(data, IT87_DATAPORT);
-}
-
-
-/* SECTION: Initialisation */
-
-static int init_port(void)
-{
- unsigned long hw_flags;
- int retval = 0;
-
- unsigned char init_bytes[4] = IT87_INIT;
- unsigned char it87_chipid = 0;
- unsigned char ldn = 0;
- unsigned int it87_io = 0;
- unsigned int it87_irq = 0;
-
- /* Enter MB PnP Mode */
- outb(init_bytes[0], IT87_ADRPORT);
- outb(init_bytes[1], IT87_ADRPORT);
- outb(init_bytes[2], IT87_ADRPORT);
- outb(init_bytes[3], IT87_ADRPORT);
-
- /* 8712 or 8705 ? */
- it87_chipid = it87_read(IT87_CHIP_ID1);
- if (it87_chipid != 0x87) {
- retval = -ENXIO;
- return retval;
- }
- it87_chipid = it87_read(IT87_CHIP_ID2);
- if ((it87_chipid != 0x05) &&
- (it87_chipid != 0x12) &&
- (it87_chipid != 0x18) &&
- (it87_chipid != 0x20)) {
- printk(KERN_INFO LIRC_DRIVER_NAME
- ": no IT8704/05/12/18/20 found (claimed IT87%02x), "
- "exiting..\n", it87_chipid);
- retval = -ENXIO;
- return retval;
- }
- printk(KERN_INFO LIRC_DRIVER_NAME
- ": found IT87%02x.\n",
- it87_chipid);
-
- /* get I/O-Port and IRQ */
- if (it87_chipid == 0x12 || it87_chipid == 0x18)
- ldn = IT8712_CIR_LDN;
- else
- ldn = IT8705_CIR_LDN;
- it87_write(IT87_LDN, ldn);
-
- it87_io = it87_read(IT87_CIR_BASE_MSB) * 256 +
- it87_read(IT87_CIR_BASE_LSB);
- if (it87_io == 0) {
- if (io == 0)
- io = IT87_CIR_DEFAULT_IOBASE;
- printk(KERN_INFO LIRC_DRIVER_NAME
- ": set default io 0x%x\n",
- io);
- it87_write(IT87_CIR_BASE_MSB, io / 0x100);
- it87_write(IT87_CIR_BASE_LSB, io % 0x100);
- } else
- io = it87_io;
-
- it87_irq = it87_read(IT87_CIR_IRQ);
- if (digimatrix || it87_irq == 0) {
- if (irq == 0)
- irq = IT87_CIR_DEFAULT_IRQ;
- printk(KERN_INFO LIRC_DRIVER_NAME
- ": set default irq 0x%x\n",
- irq);
- it87_write(IT87_CIR_IRQ, irq);
- } else
- irq = it87_irq;
-
- spin_lock_irqsave(&hardware_lock, hw_flags);
- /* reset */
- outb(IT87_CIR_IER_RESET, io+IT87_CIR_IER);
- /* fifo clear */
- outb(IT87_CIR_TCR1_FIFOCLR |
- /* IT87_CIR_TCR1_ILE | */
- IT87_CIR_TCR1_TXRLE |
- IT87_CIR_TCR1_TXENDF, io+IT87_CIR_TCR1);
- spin_unlock_irqrestore(&hardware_lock, hw_flags);
-
- /* get I/O port access and IRQ line */
- if (request_region(io, 8, LIRC_DRIVER_NAME) == NULL) {
- printk(KERN_ERR LIRC_DRIVER_NAME
- ": i/o port 0x%.4x already in use.\n", io);
- /* Leaving MB PnP Mode */
- it87_write(IT87_CFGCTRL, 0x2);
- return -EBUSY;
- }
-
- /* activate CIR-Device */
- it87_write(IT87_CIR_ACT, 0x1);
-
- /* Leaving MB PnP Mode */
- it87_write(IT87_CFGCTRL, 0x2);
-
- retval = request_irq(irq, it87_interrupt, 0 /*IRQF_DISABLED*/,
- LIRC_DRIVER_NAME, NULL);
- if (retval < 0) {
- printk(KERN_ERR LIRC_DRIVER_NAME
- ": IRQ %d already in use.\n",
- irq);
- release_region(io, 8);
- return retval;
- }
-
- printk(KERN_INFO LIRC_DRIVER_NAME
- ": I/O port 0x%.4x, IRQ %d.\n", io, irq);
-
- init_timer(&timerlist);
- timerlist.function = it87_timeout;
- timerlist.data = 0xabadcafe;
-
- return 0;
-}
-
-
-static void drop_port(void)
-{
-#if 0
- unsigned char init_bytes[4] = IT87_INIT;
-
- /* Enter MB PnP Mode */
- outb(init_bytes[0], IT87_ADRPORT);
- outb(init_bytes[1], IT87_ADRPORT);
- outb(init_bytes[2], IT87_ADRPORT);
- outb(init_bytes[3], IT87_ADRPORT);
-
- /* deactivate CIR-Device */
- it87_write(IT87_CIR_ACT, 0x0);
-
- /* Leaving MB PnP Mode */
- it87_write(IT87_CFGCTRL, 0x2);
-#endif
-
- del_timer_sync(&timerlist);
- free_irq(irq, NULL);
- release_region(io, 8);
-}
-
-
-static int init_lirc_it87(void)
-{
- int retval;
-
- init_waitqueue_head(&lirc_read_queue);
- retval = init_port();
- if (retval < 0)
- return retval;
- init_hardware();
- printk(KERN_INFO LIRC_DRIVER_NAME ": Installed.\n");
- return 0;
-}
-
-static int it87_probe(struct pnp_dev *pnp_dev,
- const struct pnp_device_id *dev_id)
-{
- int retval;
-
- driver.dev = &pnp_dev->dev;
-
- retval = init_chrdev();
- if (retval < 0)
- return retval;
-
- retval = init_lirc_it87();
- if (retval)
- goto init_lirc_it87_failed;
-
- return 0;
-
-init_lirc_it87_failed:
- drop_chrdev();
-
- return retval;
-}
-
-static int __init lirc_it87_init(void)
-{
- return pnp_register_driver(&it87_pnp_driver);
-}
-
-
-static void __exit lirc_it87_exit(void)
-{
- drop_hardware();
- drop_chrdev();
- drop_port();
- pnp_unregister_driver(&it87_pnp_driver);
- printk(KERN_INFO LIRC_DRIVER_NAME ": Uninstalled.\n");
-}
-
-/* SECTION: PNP for ITE8704/13/18 */
-
-static const struct pnp_device_id pnp_dev_table[] = {
- {"ITE8704", 0},
- {"ITE8713", 0},
- {}
-};
-
-MODULE_DEVICE_TABLE(pnp, pnp_dev_table);
-
-static struct pnp_driver it87_pnp_driver = {
- .name = LIRC_DRIVER_NAME,
- .id_table = pnp_dev_table,
- .probe = it87_probe,
-};
-
-module_init(lirc_it87_init);
-module_exit(lirc_it87_exit);
-
-MODULE_DESCRIPTION("LIRC driver for ITE IT8704/05/12/18/20 CIR port");
-MODULE_AUTHOR("Hans-Gunter Lutke Uphues");
-MODULE_LICENSE("GPL");
-
-module_param(io, int, S_IRUGO);
-MODULE_PARM_DESC(io, "I/O base address (default: 0x310)");
-
-module_param(irq, int, S_IRUGO);
-#ifdef LIRC_IT87_DIGIMATRIX
-MODULE_PARM_DESC(irq, "Interrupt (1,3-12) (default: 9)");
-#else
-MODULE_PARM_DESC(irq, "Interrupt (1,3-12) (default: 7)");
-#endif
-
-module_param(it87_enable_demodulator, bool, S_IRUGO);
-MODULE_PARM_DESC(it87_enable_demodulator,
- "Receiver demodulator enable/disable (1/0), default: 0");
-
-module_param(debug, bool, S_IRUGO | S_IWUSR);
-MODULE_PARM_DESC(debug, "Enable debugging messages");
-
-module_param(digimatrix, bool, S_IRUGO | S_IWUSR);
-#ifdef LIRC_IT87_DIGIMATRIX
-MODULE_PARM_DESC(digimatrix,
- "Asus Digimatrix it87 compat. enable/disable (1/0), default: 1");
-#else
-MODULE_PARM_DESC(digimatrix,
- "Asus Digimatrix it87 compat. enable/disable (1/0), default: 0");
-#endif
-
-
-module_param(it87_freq, int, S_IRUGO);
-#ifdef LIRC_IT87_DIGIMATRIX
-MODULE_PARM_DESC(it87_freq,
- "Carrier demodulator frequency (kHz), (default: 36)");
-#else
-MODULE_PARM_DESC(it87_freq,
- "Carrier demodulator frequency (kHz), (default: 38)");
-#endif
diff --git a/drivers/staging/lirc/lirc_it87.h b/drivers/staging/lirc/lirc_it87.h
deleted file mode 100644
index cf021c893a35..000000000000
--- a/drivers/staging/lirc/lirc_it87.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/* lirc_it87.h */
-/* SECTION: Definitions */
-
-/********************************* ITE IT87xx ************************/
-
-/* based on the following documentation from ITE:
- a) IT8712F Preliminary CIR Programming Guide V0.1
- b) IT8705F Simple LPC I/O Preliminary Specification V0.3
- c) IT8712F EC-LPC I/O Preliminary Specification V0.5
-*/
-
-/* IT8712/05 Ports: */
-#define IT87_ADRPORT 0x2e
-#define IT87_DATAPORT 0x2f
-#define IT87_INIT {0x87, 0x01, 0x55, 0x55}
-
-/* alternate Ports: */
-/*
-#define IT87_ADRPORT 0x4e
-#define IT87_DATAPORT 0x4f
-#define IT87_INIT {0x87, 0x01, 0x55, 0xaa}
- */
-
-/* IT8712/05 Registers */
-#define IT87_CFGCTRL 0x2
-#define IT87_LDN 0x7
-#define IT87_CHIP_ID1 0x20
-#define IT87_CHIP_ID2 0x21
-#define IT87_CFG_VERSION 0x22
-#define IT87_SWSUSPEND 0x23
-
-#define IT8712_CIR_LDN 0xa
-#define IT8705_CIR_LDN 0x7
-
-/* CIR Configuration Registers: */
-#define IT87_CIR_ACT 0x30
-#define IT87_CIR_BASE_MSB 0x60
-#define IT87_CIR_BASE_LSB 0x61
-#define IT87_CIR_IRQ 0x70
-#define IT87_CIR_CONFIG 0xf0
-
-/* List of IT87_CIR registers: offset to BaseAddr */
-#define IT87_CIR_DR 0
-#define IT87_CIR_IER 1
-#define IT87_CIR_RCR 2
-#define IT87_CIR_TCR1 3
-#define IT87_CIR_TCR2 4
-#define IT87_CIR_TSR 5
-#define IT87_CIR_RSR 6
-#define IT87_CIR_BDLR 5
-#define IT87_CIR_BDHR 6
-#define IT87_CIR_IIR 7
-
-/* Bit Definition */
-/* IER: */
-#define IT87_CIR_IER_TM_EN 0x80
-#define IT87_CIR_IER_RESEVED 0x40
-#define IT87_CIR_IER_RESET 0x20
-#define IT87_CIR_IER_BR 0x10
-#define IT87_CIR_IER_IEC 0x8
-#define IT87_CIR_IER_RFOIE 0x4
-#define IT87_CIR_IER_RDAIE 0x2
-#define IT87_CIR_IER_TLDLIE 0x1
-
-/* RCR: */
-#define IT87_CIR_RCR_RDWOS 0x80
-#define IT87_CIR_RCR_HCFS 0x40
-#define IT87_CIR_RCR_RXEN 0x20
-#define IT87_CIR_RCR_RXEND 0x10
-#define IT87_CIR_RCR_RXACT 0x8
-#define IT87_CIR_RCR_RXDCR 0x7
-
-/* TCR1: */
-#define IT87_CIR_TCR1_FIFOCLR 0x80
-#define IT87_CIR_TCR1_ILE 0x40
-#define IT87_CIR_TCR1_FIFOTL 0x30
-#define IT87_CIR_TCR1_TXRLE 0x8
-#define IT87_CIR_TCR1_TXENDF 0x4
-#define IT87_CIR_TCR1_TXMPM 0x3
-
-/* TCR2: */
-#define IT87_CIR_TCR2_CFQ 0xf8
-#define IT87_CIR_TCR2_TXMPW 0x7
-
-/* TSR: */
-#define IT87_CIR_TSR_RESERVED 0xc0
-#define IT87_CIR_TSR_TXFBC 0x3f
-
-/* RSR: */
-#define IT87_CIR_RSR_RXFTO 0x80
-#define IT87_CIR_RSR_RESERVED 0x40
-#define IT87_CIR_RSR_RXFBC 0x3f
-
-/* IIR: */
-#define IT87_CIR_IIR_RESERVED 0xf8
-#define IT87_CIR_IIR_IID 0x6
-#define IT87_CIR_IIR_IIP 0x1
-
-/* TM: */
-#define IT87_CIR_TM_IL_SEL 0x80
-#define IT87_CIR_TM_RESERVED 0x40
-#define IT87_CIR_TM_TM_REG 0x3f
-
-#define IT87_CIR_FIFO_SIZE 32
-
-/* Baudratedivisor for IT87: power of 2: only 1,2,4 or 8) */
-#define IT87_CIR_BAUDRATE_DIVISOR 0x1
-#define IT87_CIR_DEFAULT_IOBASE 0x310
-#define IT87_CIR_DEFAULT_IRQ 0x7
-#define IT87_CIR_SPACE 0x00
-#define IT87_CIR_PULSE 0xff
-#define IT87_CIR_FREQ_MIN 27
-#define IT87_CIR_FREQ_MAX 58
-#define TIME_CONST (IT87_CIR_BAUDRATE_DIVISOR * 8000000ul / 115200ul)
-
-/********************************* ITE IT87xx ************************/
diff --git a/drivers/staging/lirc/lirc_ite8709.c b/drivers/staging/lirc/lirc_ite8709.c
deleted file mode 100644
index cb20cfdcfadd..000000000000
--- a/drivers/staging/lirc/lirc_ite8709.c
+++ /dev/null
@@ -1,542 +0,0 @@
-/*
- * LIRC driver for ITE8709 CIR port
- *
- * Copyright (C) 2008 Grégory Lardière <spmf2004-lirc@yahoo.fr>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include <linux/module.h>
-#include <linux/interrupt.h>
-#include <linux/sched.h>
-#include <linux/delay.h>
-#include <linux/pnp.h>
-#include <linux/io.h>
-
-#include <media/lirc.h>
-#include <media/lirc_dev.h>
-
-#define LIRC_DRIVER_NAME "lirc_ite8709"
-
-#define BUF_CHUNK_SIZE sizeof(int)
-#define BUF_SIZE (128*BUF_CHUNK_SIZE)
-
-/*
- * The ITE8709 device seems to be the combination of IT8512 superIO chip and
- * a specific firmware running on the IT8512's embedded micro-controller.
- * In addition of the embedded micro-controller, the IT8512 chip contains a
- * CIR module and several other modules. A few modules are directly accessible
- * by the host CPU, but most of them are only accessible by the
- * micro-controller. The CIR module is only accessible by the micro-controller.
- * The battery-backed SRAM module is accessible by the host CPU and the
- * micro-controller. So one of the MC's firmware role is to act as a bridge
- * between the host CPU and the CIR module. The firmware implements a kind of
- * communication protocol using the SRAM module as a shared memory. The IT8512
- * specification is publicly available on ITE's web site, but the communication
- * protocol is not, so it was reverse-engineered.
- */
-
-/* ITE8709 Registers addresses and values (reverse-engineered) */
-#define ITE8709_MODE 0x1a
-#define ITE8709_REG_ADR 0x1b
-#define ITE8709_REG_VAL 0x1c
-#define ITE8709_IIR 0x1e /* Interrupt identification register */
-#define ITE8709_RFSR 0x1f /* Receiver FIFO status register */
-#define ITE8709_FIFO_START 0x20
-
-#define ITE8709_MODE_READY 0X00
-#define ITE8709_MODE_WRITE 0X01
-#define ITE8709_MODE_READ 0X02
-#define ITE8709_IIR_RDAI 0x02 /* Receiver data available interrupt */
-#define ITE8709_IIR_RFOI 0x04 /* Receiver FIFO overrun interrupt */
-#define ITE8709_RFSR_MASK 0x3f /* FIFO byte count mask */
-
-/*
- * IT8512 CIR-module registers addresses and values
- * (from IT8512 E/F specification v0.4.1)
- */
-#define IT8512_REG_MSTCR 0x01 /* Master control register */
-#define IT8512_REG_IER 0x02 /* Interrupt enable register */
-#define IT8512_REG_CFR 0x04 /* Carrier frequency register */
-#define IT8512_REG_RCR 0x05 /* Receive control register */
-#define IT8512_REG_BDLR 0x08 /* Baud rate divisor low byte register */
-#define IT8512_REG_BDHR 0x09 /* Baud rate divisor high byte register */
-
-#define IT8512_MSTCR_RESET 0x01 /* Reset registers to default value */
-#define IT8512_MSTCR_FIFOCLR 0x02 /* Clear FIFO */
-#define IT8512_MSTCR_FIFOTL_7 0x04 /* FIFO threshold level : 7 */
-#define IT8512_MSTCR_FIFOTL_25 0x0c /* FIFO threshold level : 25 */
-#define IT8512_IER_RDAIE 0x02 /* Enable data interrupt request */
-#define IT8512_IER_RFOIE 0x04 /* Enable FIFO overrun interrupt req */
-#define IT8512_IER_IEC 0x80 /* Enable interrupt request */
-#define IT8512_CFR_CF_36KHZ 0x09 /* Carrier freq : low speed, 36kHz */
-#define IT8512_RCR_RXDCR_1 0x01 /* Demodulation carrier range : 1 */
-#define IT8512_RCR_RXACT 0x08 /* Receiver active */
-#define IT8512_RCR_RXEN 0x80 /* Receiver enable */
-#define IT8512_BDR_6 6 /* Baud rate divisor : 6 */
-
-/* Actual values used by this driver */
-#define CFG_FIFOTL IT8512_MSTCR_FIFOTL_25
-#define CFG_CR_FREQ IT8512_CFR_CF_36KHZ
-#define CFG_DCR IT8512_RCR_RXDCR_1
-#define CFG_BDR IT8512_BDR_6
-#define CFG_TIMEOUT 100000 /* Rearm interrupt when a space is > 100 ms */
-
-static int debug;
-
-struct ite8709_device {
- int use_count;
- int io;
- int irq;
- spinlock_t hardware_lock;
- __u64 acc_pulse;
- __u64 acc_space;
- char lastbit;
- struct timeval last_tv;
- struct lirc_driver driver;
- struct tasklet_struct tasklet;
- char force_rearm;
- char rearmed;
- char device_busy;
-};
-
-#define dprintk(fmt, args...) \
- do { \
- if (debug) \
- printk(KERN_DEBUG LIRC_DRIVER_NAME ": " \
- fmt, ## args); \
- } while (0)
-
-
-static unsigned char ite8709_read(struct ite8709_device *dev,
- unsigned char port)
-{
- outb(port, dev->io);
- return inb(dev->io+1);
-}
-
-static void ite8709_write(struct ite8709_device *dev, unsigned char port,
- unsigned char data)
-{
- outb(port, dev->io);
- outb(data, dev->io+1);
-}
-
-static void ite8709_wait_device(struct ite8709_device *dev)
-{
- int i = 0;
- /*
- * loop until device tells it's ready to continue
- * iterations count is usually ~750 but can sometimes achieve 13000
- */
- for (i = 0; i < 15000; i++) {
- udelay(2);
- if (ite8709_read(dev, ITE8709_MODE) == ITE8709_MODE_READY)
- break;
- }
-}
-
-static void ite8709_write_register(struct ite8709_device *dev,
- unsigned char reg_adr, unsigned char reg_value)
-{
- ite8709_wait_device(dev);
-
- ite8709_write(dev, ITE8709_REG_VAL, reg_value);
- ite8709_write(dev, ITE8709_REG_ADR, reg_adr);
- ite8709_write(dev, ITE8709_MODE, ITE8709_MODE_WRITE);
-}
-
-static void ite8709_init_hardware(struct ite8709_device *dev)
-{
- spin_lock_irq(&dev->hardware_lock);
- dev->device_busy = 1;
- spin_unlock_irq(&dev->hardware_lock);
-
- ite8709_write_register(dev, IT8512_REG_BDHR, (CFG_BDR >> 8) & 0xff);
- ite8709_write_register(dev, IT8512_REG_BDLR, CFG_BDR & 0xff);
- ite8709_write_register(dev, IT8512_REG_CFR, CFG_CR_FREQ);
- ite8709_write_register(dev, IT8512_REG_IER,
- IT8512_IER_IEC | IT8512_IER_RFOIE | IT8512_IER_RDAIE);
- ite8709_write_register(dev, IT8512_REG_RCR, CFG_DCR);
- ite8709_write_register(dev, IT8512_REG_MSTCR,
- CFG_FIFOTL | IT8512_MSTCR_FIFOCLR);
- ite8709_write_register(dev, IT8512_REG_RCR,
- IT8512_RCR_RXEN | IT8512_RCR_RXACT | CFG_DCR);
-
- spin_lock_irq(&dev->hardware_lock);
- dev->device_busy = 0;
- spin_unlock_irq(&dev->hardware_lock);
-
- tasklet_enable(&dev->tasklet);
-}
-
-static void ite8709_drop_hardware(struct ite8709_device *dev)
-{
- tasklet_disable(&dev->tasklet);
-
- spin_lock_irq(&dev->hardware_lock);
- dev->device_busy = 1;
- spin_unlock_irq(&dev->hardware_lock);
-
- ite8709_write_register(dev, IT8512_REG_RCR, 0);
- ite8709_write_register(dev, IT8512_REG_MSTCR,
- IT8512_MSTCR_RESET | IT8512_MSTCR_FIFOCLR);
-
- spin_lock_irq(&dev->hardware_lock);
- dev->device_busy = 0;
- spin_unlock_irq(&dev->hardware_lock);
-}
-
-static int ite8709_set_use_inc(void *data)
-{
- struct ite8709_device *dev;
- dev = data;
- if (dev->use_count == 0)
- ite8709_init_hardware(dev);
- dev->use_count++;
- return 0;
-}
-
-static void ite8709_set_use_dec(void *data)
-{
- struct ite8709_device *dev;
- dev = data;
- dev->use_count--;
- if (dev->use_count == 0)
- ite8709_drop_hardware(dev);
-}
-
-static void ite8709_add_read_queue(struct ite8709_device *dev, int flag,
- __u64 val)
-{
- int value;
-
- dprintk("add a %llu usec %s\n", val, flag ? "pulse" : "space");
-
- value = (val > PULSE_MASK) ? PULSE_MASK : val;
- if (flag)
- value |= PULSE_BIT;
-
- if (!lirc_buffer_full(dev->driver.rbuf)) {
- lirc_buffer_write(dev->driver.rbuf, (void *) &value);
- wake_up(&dev->driver.rbuf->wait_poll);
- }
-}
-
-static irqreturn_t ite8709_interrupt(int irq, void *dev_id)
-{
- unsigned char data;
- int iir, rfsr, i;
- int fifo = 0;
- char bit;
- struct timeval curr_tv;
-
- /* Bit duration in microseconds */
- const unsigned long bit_duration = 1000000ul / (115200 / CFG_BDR);
-
- struct ite8709_device *dev;
- dev = dev_id;
-
- /*
- * If device is busy, we simply discard data because we are in one of
- * these two cases : shutting down or rearming the device, so this
- * doesn't really matter and this avoids waiting too long in IRQ ctx
- */
- spin_lock(&dev->hardware_lock);
- if (dev->device_busy) {
- spin_unlock(&dev->hardware_lock);
- return IRQ_RETVAL(IRQ_HANDLED);
- }
-
- iir = ite8709_read(dev, ITE8709_IIR);
-
- switch (iir) {
- case ITE8709_IIR_RFOI:
- dprintk("fifo overrun, scheduling forced rearm just in case\n");
- dev->force_rearm = 1;
- tasklet_schedule(&dev->tasklet);
- spin_unlock(&dev->hardware_lock);
- return IRQ_RETVAL(IRQ_HANDLED);
-
- case ITE8709_IIR_RDAI:
- rfsr = ite8709_read(dev, ITE8709_RFSR);
- fifo = rfsr & ITE8709_RFSR_MASK;
- if (fifo > 32)
- fifo = 32;
- dprintk("iir: 0x%x rfsr: 0x%x fifo: %d\n", iir, rfsr, fifo);
-
- if (dev->rearmed) {
- do_gettimeofday(&curr_tv);
- dev->acc_space += 1000000ull
- * (curr_tv.tv_sec - dev->last_tv.tv_sec)
- + (curr_tv.tv_usec - dev->last_tv.tv_usec);
- dev->rearmed = 0;
- }
- for (i = 0; i < fifo; i++) {
- data = ite8709_read(dev, i+ITE8709_FIFO_START);
- data = ~data;
- /* Loop through */
- for (bit = 0; bit < 8; ++bit) {
- if ((data >> bit) & 1) {
- dev->acc_pulse += bit_duration;
- if (dev->lastbit == 0) {
- ite8709_add_read_queue(dev, 0,
- dev->acc_space);
- dev->acc_space = 0;
- }
- } else {
- dev->acc_space += bit_duration;
- if (dev->lastbit == 1) {
- ite8709_add_read_queue(dev, 1,
- dev->acc_pulse);
- dev->acc_pulse = 0;
- }
- }
- dev->lastbit = (data >> bit) & 1;
- }
- }
- ite8709_write(dev, ITE8709_RFSR, 0);
-
- if (dev->acc_space > CFG_TIMEOUT) {
- dprintk("scheduling rearm IRQ\n");
- do_gettimeofday(&dev->last_tv);
- dev->force_rearm = 0;
- tasklet_schedule(&dev->tasklet);
- }
-
- spin_unlock(&dev->hardware_lock);
- return IRQ_RETVAL(IRQ_HANDLED);
-
- default:
- /* not our irq */
- dprintk("unknown IRQ (shouldn't happen) !!\n");
- spin_unlock(&dev->hardware_lock);
- return IRQ_RETVAL(IRQ_NONE);
- }
-}
-
-static void ite8709_rearm_irq(unsigned long data)
-{
- struct ite8709_device *dev;
- unsigned long flags;
- dev = (struct ite8709_device *) data;
-
- spin_lock_irqsave(&dev->hardware_lock, flags);
- dev->device_busy = 1;
- spin_unlock_irqrestore(&dev->hardware_lock, flags);
-
- if (dev->force_rearm || dev->acc_space > CFG_TIMEOUT) {
- dprintk("rearming IRQ\n");
- ite8709_write_register(dev, IT8512_REG_RCR,
- IT8512_RCR_RXACT | CFG_DCR);
- ite8709_write_register(dev, IT8512_REG_MSTCR,
- CFG_FIFOTL | IT8512_MSTCR_FIFOCLR);
- ite8709_write_register(dev, IT8512_REG_RCR,
- IT8512_RCR_RXEN | IT8512_RCR_RXACT | CFG_DCR);
- if (!dev->force_rearm)
- dev->rearmed = 1;
- dev->force_rearm = 0;
- }
-
- spin_lock_irqsave(&dev->hardware_lock, flags);
- dev->device_busy = 0;
- spin_unlock_irqrestore(&dev->hardware_lock, flags);
-}
-
-static int ite8709_cleanup(struct ite8709_device *dev, int stage, int errno,
- char *msg)
-{
- if (msg != NULL)
- printk(KERN_ERR LIRC_DRIVER_NAME ": %s\n", msg);
-
- switch (stage) {
- case 6:
- if (dev->use_count > 0)
- ite8709_drop_hardware(dev);
- case 5:
- free_irq(dev->irq, dev);
- case 4:
- release_region(dev->io, 2);
- case 3:
- lirc_unregister_driver(dev->driver.minor);
- case 2:
- lirc_buffer_free(dev->driver.rbuf);
- kfree(dev->driver.rbuf);
- case 1:
- kfree(dev);
- case 0:
- ;
- }
-
- return errno;
-}
-
-static int __devinit ite8709_pnp_probe(struct pnp_dev *dev,
- const struct pnp_device_id *dev_id)
-{
- struct lirc_driver *driver;
- struct ite8709_device *ite8709_dev;
- int ret;
-
- /* Check resources validity */
- if (!pnp_irq_valid(dev, 0))
- return ite8709_cleanup(NULL, 0, -ENODEV, "invalid IRQ");
- if (!pnp_port_valid(dev, 2))
- return ite8709_cleanup(NULL, 0, -ENODEV, "invalid IO port");
-
- /* Allocate memory for device struct */
- ite8709_dev = kzalloc(sizeof(struct ite8709_device), GFP_KERNEL);
- if (ite8709_dev == NULL)
- return ite8709_cleanup(NULL, 0, -ENOMEM, "kzalloc failed");
- pnp_set_drvdata(dev, ite8709_dev);
-
- /* Initialize device struct */
- ite8709_dev->use_count = 0;
- ite8709_dev->irq = pnp_irq(dev, 0);
- ite8709_dev->io = pnp_port_start(dev, 2);
- ite8709_dev->hardware_lock =
- __SPIN_LOCK_UNLOCKED(ite8709_dev->hardware_lock);
- ite8709_dev->acc_pulse = 0;
- ite8709_dev->acc_space = 0;
- ite8709_dev->lastbit = 0;
- do_gettimeofday(&ite8709_dev->last_tv);
- tasklet_init(&ite8709_dev->tasklet, ite8709_rearm_irq,
- (long) ite8709_dev);
- ite8709_dev->force_rearm = 0;
- ite8709_dev->rearmed = 0;
- ite8709_dev->device_busy = 0;
-
- /* Initialize driver struct */
- driver = &ite8709_dev->driver;
- strcpy(driver->name, LIRC_DRIVER_NAME);
- driver->minor = -1;
- driver->code_length = sizeof(int) * 8;
- driver->sample_rate = 0;
- driver->features = LIRC_CAN_REC_MODE2;
- driver->data = ite8709_dev;
- driver->add_to_buf = NULL;
- driver->set_use_inc = ite8709_set_use_inc;
- driver->set_use_dec = ite8709_set_use_dec;
- driver->dev = &dev->dev;
- driver->owner = THIS_MODULE;
-
- /* Initialize LIRC buffer */
- driver->rbuf = kmalloc(sizeof(struct lirc_buffer), GFP_KERNEL);
- if (!driver->rbuf)
- return ite8709_cleanup(ite8709_dev, 1, -ENOMEM,
- "can't allocate lirc_buffer");
- if (lirc_buffer_init(driver->rbuf, BUF_CHUNK_SIZE, BUF_SIZE))
- return ite8709_cleanup(ite8709_dev, 1, -ENOMEM,
- "lirc_buffer_init() failed");
-
- /* Register LIRC driver */
- ret = lirc_register_driver(driver);
- if (ret < 0)
- return ite8709_cleanup(ite8709_dev, 2, ret,
- "lirc_register_driver() failed");
-
- /* Reserve I/O port access */
- if (!request_region(ite8709_dev->io, 2, LIRC_DRIVER_NAME))
- return ite8709_cleanup(ite8709_dev, 3, -EBUSY,
- "i/o port already in use");
-
- /* Reserve IRQ line */
- ret = request_irq(ite8709_dev->irq, ite8709_interrupt, 0,
- LIRC_DRIVER_NAME, ite8709_dev);
- if (ret < 0)
- return ite8709_cleanup(ite8709_dev, 4, ret,
- "IRQ already in use");
-
- /* Initialize hardware */
- ite8709_drop_hardware(ite8709_dev); /* Shutdown hw until first use */
-
- printk(KERN_INFO LIRC_DRIVER_NAME ": device found : irq=%d io=0x%x\n",
- ite8709_dev->irq, ite8709_dev->io);
-
- return 0;
-}
-
-static void __devexit ite8709_pnp_remove(struct pnp_dev *dev)
-{
- struct ite8709_device *ite8709_dev;
- ite8709_dev = pnp_get_drvdata(dev);
-
- ite8709_cleanup(ite8709_dev, 6, 0, NULL);
-
- printk(KERN_INFO LIRC_DRIVER_NAME ": device removed\n");
-}
-
-#ifdef CONFIG_PM
-static int ite8709_pnp_suspend(struct pnp_dev *dev, pm_message_t state)
-{
- struct ite8709_device *ite8709_dev;
- ite8709_dev = pnp_get_drvdata(dev);
-
- if (ite8709_dev->use_count > 0)
- ite8709_drop_hardware(ite8709_dev);
-
- return 0;
-}
-
-static int ite8709_pnp_resume(struct pnp_dev *dev)
-{
- struct ite8709_device *ite8709_dev;
- ite8709_dev = pnp_get_drvdata(dev);
-
- if (ite8709_dev->use_count > 0)
- ite8709_init_hardware(ite8709_dev);
-
- return 0;
-}
-#else
-#define ite8709_pnp_suspend NULL
-#define ite8709_pnp_resume NULL
-#endif
-
-static const struct pnp_device_id pnp_dev_table[] = {
- {"ITE8709", 0},
- {}
-};
-
-MODULE_DEVICE_TABLE(pnp, pnp_dev_table);
-
-static struct pnp_driver ite8709_pnp_driver = {
- .name = LIRC_DRIVER_NAME,
- .probe = ite8709_pnp_probe,
- .remove = __devexit_p(ite8709_pnp_remove),
- .suspend = ite8709_pnp_suspend,
- .resume = ite8709_pnp_resume,
- .id_table = pnp_dev_table,
-};
-
-static int __init ite8709_init_module(void)
-{
- return pnp_register_driver(&ite8709_pnp_driver);
-}
-module_init(ite8709_init_module);
-
-static void __exit ite8709_cleanup_module(void)
-{
- pnp_unregister_driver(&ite8709_pnp_driver);
-}
-module_exit(ite8709_cleanup_module);
-
-MODULE_DESCRIPTION("LIRC driver for ITE8709 CIR port");
-MODULE_AUTHOR("Grégory Lardière");
-MODULE_LICENSE("GPL");
-
-module_param(debug, bool, S_IRUGO | S_IWUSR);
-MODULE_PARM_DESC(debug, "Enable debugging messages");
diff --git a/drivers/staging/lirc/lirc_sasem.c b/drivers/staging/lirc/lirc_sasem.c
index 925eabe14854..63a438d1c849 100644
--- a/drivers/staging/lirc/lirc_sasem.c
+++ b/drivers/staging/lirc/lirc_sasem.c
@@ -364,7 +364,7 @@ static ssize_t vfd_write(struct file *file, const char *buf,
int i;
int retval = 0;
struct sasem_context *context;
- int *data_buf;
+ int *data_buf = NULL;
context = (struct sasem_context *) file->private_data;
if (!context) {
diff --git a/drivers/staging/lirc/lirc_zilog.c b/drivers/staging/lirc/lirc_zilog.c
index 0aad0d7a74a3..dd6a57c3c3a3 100644
--- a/drivers/staging/lirc/lirc_zilog.c
+++ b/drivers/staging/lirc/lirc_zilog.c
@@ -63,14 +63,16 @@
#include <media/lirc_dev.h>
#include <media/lirc.h>
+struct IR;
+
struct IR_rx {
+ struct kref ref;
+ struct IR *ir;
+
/* RX device */
+ struct mutex client_lock;
struct i2c_client *c;
- /* RX device buffer & lock */
- struct lirc_buffer buf;
- struct mutex buf_lock;
-
/* RX polling thread data */
struct task_struct *task;
@@ -80,7 +82,11 @@ struct IR_rx {
};
struct IR_tx {
+ struct kref ref;
+ struct IR *ir;
+
/* TX device */
+ struct mutex client_lock;
struct i2c_client *c;
/* TX additional actions needed */
@@ -89,19 +95,34 @@ struct IR_tx {
};
struct IR {
+ struct kref ref;
+ struct list_head list;
+
+ /* FIXME spinlock access to l.features */
struct lirc_driver l;
+ struct lirc_buffer rbuf;
struct mutex ir_lock;
- int open;
+ atomic_t open_count;
struct i2c_adapter *adapter;
+
+ spinlock_t rx_ref_lock; /* struct IR_rx kref get()/put() */
struct IR_rx *rx;
+
+ spinlock_t tx_ref_lock; /* struct IR_tx kref get()/put() */
struct IR_tx *tx;
};
-/* Minor -> data mapping */
-static struct mutex ir_devices_lock;
-static struct IR *ir_devices[MAX_IRCTL_DEVICES];
+/* IR transceiver instance object list */
+/*
+ * This lock is used for the following:
+ * a. ir_devices_list access, insertions, deletions
+ * b. struct IR kref get()s and put()s
+ * c. serialization of ir_probe() for the two i2c_clients for a Z8
+ */
+static DEFINE_MUTEX(ir_devices_lock);
+static LIST_HEAD(ir_devices_list);
/* Block size for IR transmitter */
#define TX_BLOCK_SIZE 99
@@ -147,6 +168,157 @@ static int minor = -1; /* minor number */
## args); \
} while (0)
+
+/* struct IR reference counting */
+static struct IR *get_ir_device(struct IR *ir, bool ir_devices_lock_held)
+{
+ if (ir_devices_lock_held) {
+ kref_get(&ir->ref);
+ } else {
+ mutex_lock(&ir_devices_lock);
+ kref_get(&ir->ref);
+ mutex_unlock(&ir_devices_lock);
+ }
+ return ir;
+}
+
+static void release_ir_device(struct kref *ref)
+{
+ struct IR *ir = container_of(ref, struct IR, ref);
+
+ /*
+ * Things should be in this state by now:
+ * ir->rx set to NULL and deallocated - happens before ir->rx->ir put()
+ * ir->rx->task kthread stopped - happens before ir->rx->ir put()
+ * ir->tx set to NULL and deallocated - happens before ir->tx->ir put()
+ * ir->open_count == 0 - happens on final close()
+ * ir_lock, tx_ref_lock, rx_ref_lock, all released
+ */
+ if (ir->l.minor >= 0 && ir->l.minor < MAX_IRCTL_DEVICES) {
+ lirc_unregister_driver(ir->l.minor);
+ ir->l.minor = MAX_IRCTL_DEVICES;
+ }
+ if (ir->rbuf.fifo_initialized)
+ lirc_buffer_free(&ir->rbuf);
+ list_del(&ir->list);
+ kfree(ir);
+}
+
+static int put_ir_device(struct IR *ir, bool ir_devices_lock_held)
+{
+ int released;
+
+ if (ir_devices_lock_held)
+ return kref_put(&ir->ref, release_ir_device);
+
+ mutex_lock(&ir_devices_lock);
+ released = kref_put(&ir->ref, release_ir_device);
+ mutex_unlock(&ir_devices_lock);
+
+ return released;
+}
+
+/* struct IR_rx reference counting */
+static struct IR_rx *get_ir_rx(struct IR *ir)
+{
+ struct IR_rx *rx;
+
+ spin_lock(&ir->rx_ref_lock);
+ rx = ir->rx;
+ if (rx != NULL)
+ kref_get(&rx->ref);
+ spin_unlock(&ir->rx_ref_lock);
+ return rx;
+}
+
+static void destroy_rx_kthread(struct IR_rx *rx, bool ir_devices_lock_held)
+{
+ /* end up polling thread */
+ if (!IS_ERR_OR_NULL(rx->task)) {
+ kthread_stop(rx->task);
+ rx->task = NULL;
+ /* Put the ir ptr that ir_probe() gave to the rx poll thread */
+ put_ir_device(rx->ir, ir_devices_lock_held);
+ }
+}
+
+static void release_ir_rx(struct kref *ref)
+{
+ struct IR_rx *rx = container_of(ref, struct IR_rx, ref);
+ struct IR *ir = rx->ir;
+
+ /*
+ * This release function can't do all the work, as we want
+ * to keep the rx_ref_lock a spinlock, and killing the poll thread
+ * and releasing the ir reference can cause a sleep. That work is
+ * performed by put_ir_rx()
+ */
+ ir->l.features &= ~LIRC_CAN_REC_LIRCCODE;
+ /* Don't put_ir_device(rx->ir) here; lock can't be freed yet */
+ ir->rx = NULL;
+ /* Don't do the kfree(rx) here; we still need to kill the poll thread */
+ return;
+}
+
+static int put_ir_rx(struct IR_rx *rx, bool ir_devices_lock_held)
+{
+ int released;
+ struct IR *ir = rx->ir;
+
+ spin_lock(&ir->rx_ref_lock);
+ released = kref_put(&rx->ref, release_ir_rx);
+ spin_unlock(&ir->rx_ref_lock);
+ /* Destroy the rx kthread while not holding the spinlock */
+ if (released) {
+ destroy_rx_kthread(rx, ir_devices_lock_held);
+ kfree(rx);
+ /* Make sure we're not still in a poll_table somewhere */
+ wake_up_interruptible(&ir->rbuf.wait_poll);
+ }
+ /* Do a reference put() for the rx->ir reference, if we released rx */
+ if (released)
+ put_ir_device(ir, ir_devices_lock_held);
+ return released;
+}
+
+/* struct IR_tx reference counting */
+static struct IR_tx *get_ir_tx(struct IR *ir)
+{
+ struct IR_tx *tx;
+
+ spin_lock(&ir->tx_ref_lock);
+ tx = ir->tx;
+ if (tx != NULL)
+ kref_get(&tx->ref);
+ spin_unlock(&ir->tx_ref_lock);
+ return tx;
+}
+
+static void release_ir_tx(struct kref *ref)
+{
+ struct IR_tx *tx = container_of(ref, struct IR_tx, ref);
+ struct IR *ir = tx->ir;
+
+ ir->l.features &= ~LIRC_CAN_SEND_PULSE;
+ /* Don't put_ir_device(tx->ir) here, so our lock doesn't get freed */
+ ir->tx = NULL;
+ kfree(tx);
+}
+
+static int put_ir_tx(struct IR_tx *tx, bool ir_devices_lock_held)
+{
+ int released;
+ struct IR *ir = tx->ir;
+
+ spin_lock(&ir->tx_ref_lock);
+ released = kref_put(&tx->ref, release_ir_tx);
+ spin_unlock(&ir->tx_ref_lock);
+ /* Do a reference put() for the tx->ir reference, if we released tx */
+ if (released)
+ put_ir_device(ir, ir_devices_lock_held);
+ return released;
+}
+
static int add_to_buf(struct IR *ir)
{
__u16 code;
@@ -156,23 +328,38 @@ static int add_to_buf(struct IR *ir)
int ret;
int failures = 0;
unsigned char sendbuf[1] = { 0 };
- struct IR_rx *rx = ir->rx;
+ struct lirc_buffer *rbuf = ir->l.rbuf;
+ struct IR_rx *rx;
+ struct IR_tx *tx;
+ if (lirc_buffer_full(rbuf)) {
+ dprintk("buffer overflow\n");
+ return -EOVERFLOW;
+ }
+
+ rx = get_ir_rx(ir);
if (rx == NULL)
return -ENXIO;
- if (lirc_buffer_full(&rx->buf)) {
- dprintk("buffer overflow\n");
- return -EOVERFLOW;
+ /* Ensure our rx->c i2c_client remains valid for the duration */
+ mutex_lock(&rx->client_lock);
+ if (rx->c == NULL) {
+ mutex_unlock(&rx->client_lock);
+ put_ir_rx(rx, false);
+ return -ENXIO;
}
+ tx = get_ir_tx(ir);
+
/*
* service the device as long as it is returning
* data and we have space
*/
do {
- if (kthread_should_stop())
- return -ENODATA;
+ if (kthread_should_stop()) {
+ ret = -ENODATA;
+ break;
+ }
/*
* Lock i2c bus for the duration. RX/TX chips interfere so
@@ -182,7 +369,8 @@ static int add_to_buf(struct IR *ir)
if (kthread_should_stop()) {
mutex_unlock(&ir->ir_lock);
- return -ENODATA;
+ ret = -ENODATA;
+ break;
}
/*
@@ -196,7 +384,7 @@ static int add_to_buf(struct IR *ir)
mutex_unlock(&ir->ir_lock);
zilog_error("unable to read from the IR chip "
"after 3 resets, giving up\n");
- return ret;
+ break;
}
/* Looks like the chip crashed, reset it */
@@ -206,19 +394,23 @@ static int add_to_buf(struct IR *ir)
set_current_state(TASK_UNINTERRUPTIBLE);
if (kthread_should_stop()) {
mutex_unlock(&ir->ir_lock);
- return -ENODATA;
+ ret = -ENODATA;
+ break;
}
schedule_timeout((100 * HZ + 999) / 1000);
- ir->tx->need_boot = 1;
+ if (tx != NULL)
+ tx->need_boot = 1;
++failures;
mutex_unlock(&ir->ir_lock);
+ ret = 0;
continue;
}
if (kthread_should_stop()) {
mutex_unlock(&ir->ir_lock);
- return -ENODATA;
+ ret = -ENODATA;
+ break;
}
ret = i2c_master_recv(rx->c, keybuf, sizeof(keybuf));
mutex_unlock(&ir->ir_lock);
@@ -234,12 +426,17 @@ static int add_to_buf(struct IR *ir)
/* key pressed ? */
if (rx->hdpvr_data_fmt) {
- if (got_data && (keybuf[0] == 0x80))
- return 0;
- else if (got_data && (keybuf[0] == 0x00))
- return -ENODATA;
- } else if ((rx->b[0] & 0x80) == 0)
- return got_data ? 0 : -ENODATA;
+ if (got_data && (keybuf[0] == 0x80)) {
+ ret = 0;
+ break;
+ } else if (got_data && (keybuf[0] == 0x00)) {
+ ret = -ENODATA;
+ break;
+ }
+ } else if ((rx->b[0] & 0x80) == 0) {
+ ret = got_data ? 0 : -ENODATA;
+ break;
+ }
/* look what we have */
code = (((__u16)rx->b[0] & 0x7f) << 6) | (rx->b[1] >> 2);
@@ -248,11 +445,16 @@ static int add_to_buf(struct IR *ir)
codes[1] = code & 0xff;
/* return it */
- lirc_buffer_write(&rx->buf, codes);
+ lirc_buffer_write(rbuf, codes);
++got_data;
- } while (!lirc_buffer_full(&rx->buf));
+ ret = 0;
+ } while (!lirc_buffer_full(rbuf));
- return 0;
+ mutex_unlock(&rx->client_lock);
+ if (tx != NULL)
+ put_ir_tx(tx, false);
+ put_ir_rx(rx, false);
+ return ret;
}
/*
@@ -268,19 +470,19 @@ static int add_to_buf(struct IR *ir)
static int lirc_thread(void *arg)
{
struct IR *ir = arg;
- struct IR_rx *rx = ir->rx;
+ struct lirc_buffer *rbuf = ir->l.rbuf;
dprintk("poll thread started\n");
while (!kthread_should_stop()) {
- set_current_state(TASK_INTERRUPTIBLE);
-
/* if device not opened, we can sleep half a second */
- if (!ir->open) {
+ if (atomic_read(&ir->open_count) == 0) {
schedule_timeout(HZ/2);
continue;
}
+ set_current_state(TASK_INTERRUPTIBLE);
+
/*
* This is ~113*2 + 24 + jitter (2*repeat gap + code length).
* We use this interval as the chip resets every time you poll
@@ -295,7 +497,7 @@ static int lirc_thread(void *arg)
if (kthread_should_stop())
break;
if (!add_to_buf(ir))
- wake_up_interruptible(&rx->buf.wait_poll);
+ wake_up_interruptible(&rbuf->wait_poll);
}
dprintk("poll thread ended\n");
@@ -304,34 +506,12 @@ static int lirc_thread(void *arg)
static int set_use_inc(void *data)
{
- struct IR *ir = data;
-
- if (ir->l.owner == NULL || try_module_get(ir->l.owner) == 0)
- return -ENODEV;
-
- /* lock bttv in memory while /dev/lirc is in use */
- /*
- * this is completely broken code. lirc_unregister_driver()
- * must be possible even when the device is open
- */
- if (ir->rx != NULL)
- i2c_use_client(ir->rx->c);
- if (ir->tx != NULL)
- i2c_use_client(ir->tx->c);
-
return 0;
}
static void set_use_dec(void *data)
{
- struct IR *ir = data;
-
- if (ir->rx)
- i2c_release_client(ir->rx->c);
- if (ir->tx)
- i2c_release_client(ir->tx->c);
- if (ir->l.owner != NULL)
- module_put(ir->l.owner);
+ return;
}
/* safe read of a uint32 (always network byte order) */
@@ -585,7 +765,7 @@ static int fw_load(struct IR_tx *tx)
}
/* Request codeset data file */
- ret = request_firmware(&fw_entry, "haup-ir-blaster.bin", &tx->c->dev);
+ ret = request_firmware(&fw_entry, "haup-ir-blaster.bin", tx->ir->l.dev);
if (ret != 0) {
zilog_error("firmware haup-ir-blaster.bin not available "
"(%d)\n", ret);
@@ -711,59 +891,32 @@ out:
return ret;
}
-/* initialise the IR TX device */
-static int tx_init(struct IR_tx *tx)
-{
- int ret;
-
- /* Load 'firmware' */
- ret = fw_load(tx);
- if (ret != 0)
- return ret;
-
- /* Send boot block */
- ret = send_boot_data(tx);
- if (ret != 0)
- return ret;
- tx->need_boot = 0;
-
- /* Looks good */
- return 0;
-}
-
-/* do nothing stub to make LIRC happy */
-static loff_t lseek(struct file *filep, loff_t offset, int orig)
-{
- return -ESPIPE;
-}
-
/* copied from lirc_dev */
static ssize_t read(struct file *filep, char *outbuf, size_t n, loff_t *ppos)
{
struct IR *ir = filep->private_data;
- struct IR_rx *rx = ir->rx;
- int ret = 0, written = 0;
+ struct IR_rx *rx;
+ struct lirc_buffer *rbuf = ir->l.rbuf;
+ int ret = 0, written = 0, retries = 0;
+ unsigned int m;
DECLARE_WAITQUEUE(wait, current);
dprintk("read called\n");
- if (rx == NULL)
- return -ENODEV;
-
- if (mutex_lock_interruptible(&rx->buf_lock))
- return -ERESTARTSYS;
-
- if (n % rx->buf.chunk_size) {
+ if (n % rbuf->chunk_size) {
dprintk("read result = -EINVAL\n");
- mutex_unlock(&rx->buf_lock);
return -EINVAL;
}
+ rx = get_ir_rx(ir);
+ if (rx == NULL)
+ return -ENXIO;
+
/*
* we add ourselves to the task queue before buffer check
* to avoid losing scan code (in case when queue is awaken somewhere
* between while condition checking and scheduling)
*/
- add_wait_queue(&rx->buf.wait_poll, &wait);
+ add_wait_queue(&rbuf->wait_poll, &wait);
set_current_state(TASK_INTERRUPTIBLE);
/*
@@ -771,7 +924,7 @@ static ssize_t read(struct file *filep, char *outbuf, size_t n, loff_t *ppos)
* mode and 'copy_to_user' is happy, wait for data.
*/
while (written < n && ret == 0) {
- if (lirc_buffer_empty(&rx->buf)) {
+ if (lirc_buffer_empty(rbuf)) {
/*
* According to the read(2) man page, 'written' can be
* returned as less than 'n', instead of blocking
@@ -791,20 +944,27 @@ static ssize_t read(struct file *filep, char *outbuf, size_t n, loff_t *ppos)
schedule();
set_current_state(TASK_INTERRUPTIBLE);
} else {
- unsigned char buf[rx->buf.chunk_size];
- lirc_buffer_read(&rx->buf, buf);
- ret = copy_to_user((void *)outbuf+written, buf,
- rx->buf.chunk_size);
- written += rx->buf.chunk_size;
+ unsigned char buf[rbuf->chunk_size];
+ m = lirc_buffer_read(rbuf, buf);
+ if (m == rbuf->chunk_size) {
+ ret = copy_to_user((void *)outbuf+written, buf,
+ rbuf->chunk_size);
+ written += rbuf->chunk_size;
+ } else {
+ retries++;
+ }
+ if (retries >= 5) {
+ zilog_error("Buffer read failed!\n");
+ ret = -EIO;
+ }
}
}
- remove_wait_queue(&rx->buf.wait_poll, &wait);
+ remove_wait_queue(&rbuf->wait_poll, &wait);
+ put_ir_rx(rx, false);
set_current_state(TASK_RUNNING);
- mutex_unlock(&rx->buf_lock);
- dprintk("read result = %s (%d)\n",
- ret ? "-EFAULT" : "OK", ret);
+ dprintk("read result = %d (%s)\n", ret, ret ? "Error" : "OK");
return ret ? ret : written;
}
@@ -931,17 +1091,27 @@ static ssize_t write(struct file *filep, const char *buf, size_t n,
loff_t *ppos)
{
struct IR *ir = filep->private_data;
- struct IR_tx *tx = ir->tx;
+ struct IR_tx *tx;
size_t i;
int failures = 0;
- if (tx == NULL)
- return -ENODEV;
-
/* Validate user parameters */
if (n % sizeof(int))
return -EINVAL;
+ /* Get a struct IR_tx reference */
+ tx = get_ir_tx(ir);
+ if (tx == NULL)
+ return -ENXIO;
+
+ /* Ensure our tx->c i2c_client remains valid for the duration */
+ mutex_lock(&tx->client_lock);
+ if (tx->c == NULL) {
+ mutex_unlock(&tx->client_lock);
+ put_ir_tx(tx, false);
+ return -ENXIO;
+ }
+
/* Lock i2c bus for the duration */
mutex_lock(&ir->ir_lock);
@@ -952,11 +1122,24 @@ static ssize_t write(struct file *filep, const char *buf, size_t n,
if (copy_from_user(&command, buf + i, sizeof(command))) {
mutex_unlock(&ir->ir_lock);
+ mutex_unlock(&tx->client_lock);
+ put_ir_tx(tx, false);
return -EFAULT;
}
/* Send boot data first if required */
if (tx->need_boot == 1) {
+ /* Make sure we have the 'firmware' loaded, first */
+ ret = fw_load(tx);
+ if (ret != 0) {
+ mutex_unlock(&ir->ir_lock);
+ mutex_unlock(&tx->client_lock);
+ put_ir_tx(tx, false);
+ if (ret != -ENOMEM)
+ ret = -EIO;
+ return ret;
+ }
+ /* Prep the chip for transmitting codes */
ret = send_boot_data(tx);
if (ret == 0)
tx->need_boot = 0;
@@ -968,6 +1151,8 @@ static ssize_t write(struct file *filep, const char *buf, size_t n,
(unsigned)command & 0xFFFF);
if (ret == -EPROTO) {
mutex_unlock(&ir->ir_lock);
+ mutex_unlock(&tx->client_lock);
+ put_ir_tx(tx, false);
return ret;
}
}
@@ -985,6 +1170,8 @@ static ssize_t write(struct file *filep, const char *buf, size_t n,
zilog_error("unable to send to the IR chip "
"after 3 resets, giving up\n");
mutex_unlock(&ir->ir_lock);
+ mutex_unlock(&tx->client_lock);
+ put_ir_tx(tx, false);
return ret;
}
set_current_state(TASK_UNINTERRUPTIBLE);
@@ -998,6 +1185,11 @@ static ssize_t write(struct file *filep, const char *buf, size_t n,
/* Release i2c bus */
mutex_unlock(&ir->ir_lock);
+ mutex_unlock(&tx->client_lock);
+
+ /* Give back our struct IR_tx reference */
+ put_ir_tx(tx, false);
+
/* All looks good */
return n;
}
@@ -1006,23 +1198,32 @@ static ssize_t write(struct file *filep, const char *buf, size_t n,
static unsigned int poll(struct file *filep, poll_table *wait)
{
struct IR *ir = filep->private_data;
- struct IR_rx *rx = ir->rx;
+ struct IR_rx *rx;
+ struct lirc_buffer *rbuf = ir->l.rbuf;
unsigned int ret;
dprintk("poll called\n");
- if (rx == NULL)
- return -ENODEV;
-
- mutex_lock(&rx->buf_lock);
- poll_wait(filep, &rx->buf.wait_poll, wait);
+ rx = get_ir_rx(ir);
+ if (rx == NULL) {
+ /*
+ * Revisit this, if our poll function ever reports writeable
+ * status for Tx
+ */
+ dprintk("poll result = POLLERR\n");
+ return POLLERR;
+ }
- dprintk("poll result = %s\n",
- lirc_buffer_empty(&rx->buf) ? "0" : "POLLIN|POLLRDNORM");
+ /*
+ * Add our lirc_buffer's wait_queue to the poll_table. A wake up on
+ * that buffer's wait queue indicates we may have a new poll status.
+ */
+ poll_wait(filep, &rbuf->wait_poll, wait);
- ret = lirc_buffer_empty(&rx->buf) ? 0 : (POLLIN|POLLRDNORM);
+ /* Indicate what ops could happen immediately without blocking */
+ ret = lirc_buffer_empty(rbuf) ? 0 : (POLLIN|POLLRDNORM);
- mutex_unlock(&rx->buf_lock);
+ dprintk("poll result = %s\n", ret ? "POLLIN|POLLRDNORM" : "none");
return ret;
}
@@ -1030,11 +1231,9 @@ static long ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
{
struct IR *ir = filep->private_data;
int result;
- unsigned long mode, features = 0;
+ unsigned long mode, features;
- features |= LIRC_CAN_SEND_PULSE;
- if (ir->rx != NULL)
- features |= LIRC_CAN_REC_LIRCCODE;
+ features = ir->l.features;
switch (cmd) {
case LIRC_GET_LENGTH:
@@ -1061,9 +1260,15 @@ static long ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
result = -EINVAL;
break;
case LIRC_GET_SEND_MODE:
+ if (!(features&LIRC_CAN_SEND_MASK))
+ return -ENOSYS;
+
result = put_user(LIRC_MODE_PULSE, (unsigned long *) arg);
break;
case LIRC_SET_SEND_MODE:
+ if (!(features&LIRC_CAN_SEND_MASK))
+ return -ENOSYS;
+
result = get_user(mode, (unsigned long *) arg);
if (!result && mode != LIRC_MODE_PULSE)
return -EINVAL;
@@ -1074,13 +1279,24 @@ static long ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
return result;
}
-/* ir_devices_lock must be held */
-static struct IR *find_ir_device_by_minor(unsigned int minor)
+static struct IR *get_ir_device_by_minor(unsigned int minor)
{
- if (minor >= MAX_IRCTL_DEVICES)
- return NULL;
+ struct IR *ir;
+ struct IR *ret = NULL;
+
+ mutex_lock(&ir_devices_lock);
+
+ if (!list_empty(&ir_devices_list)) {
+ list_for_each_entry(ir, &ir_devices_list, list) {
+ if (ir->l.minor == minor) {
+ ret = get_ir_device(ir, true);
+ break;
+ }
+ }
+ }
- return ir_devices[minor];
+ mutex_unlock(&ir_devices_lock);
+ return ret;
}
/*
@@ -1090,31 +1306,20 @@ static struct IR *find_ir_device_by_minor(unsigned int minor)
static int open(struct inode *node, struct file *filep)
{
struct IR *ir;
- int ret;
unsigned int minor = MINOR(node->i_rdev);
/* find our IR struct */
- mutex_lock(&ir_devices_lock);
- ir = find_ir_device_by_minor(minor);
- mutex_unlock(&ir_devices_lock);
+ ir = get_ir_device_by_minor(minor);
if (ir == NULL)
return -ENODEV;
- /* increment in use count */
- mutex_lock(&ir->ir_lock);
- ++ir->open;
- ret = set_use_inc(ir);
- if (ret != 0) {
- --ir->open;
- mutex_unlock(&ir->ir_lock);
- return ret;
- }
- mutex_unlock(&ir->ir_lock);
+ atomic_inc(&ir->open_count);
/* stash our IR struct */
filep->private_data = ir;
+ nonseekable_open(node, filep);
return 0;
}
@@ -1128,22 +1333,12 @@ static int close(struct inode *node, struct file *filep)
return -ENODEV;
}
- /* decrement in use count */
- mutex_lock(&ir->ir_lock);
- --ir->open;
- set_use_dec(ir);
- mutex_unlock(&ir->ir_lock);
+ atomic_dec(&ir->open_count);
+ put_ir_device(ir, false);
return 0;
}
-static struct lirc_driver lirc_template = {
- .name = "lirc_zilog",
- .set_use_inc = set_use_inc,
- .set_use_dec = set_use_dec,
- .owner = THIS_MODULE
-};
-
static int ir_remove(struct i2c_client *client);
static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id);
@@ -1170,7 +1365,7 @@ static struct i2c_driver driver = {
static const struct file_operations lirc_fops = {
.owner = THIS_MODULE,
- .llseek = lseek,
+ .llseek = no_llseek,
.read = read,
.write = write,
.poll = poll,
@@ -1182,97 +1377,64 @@ static const struct file_operations lirc_fops = {
.release = close
};
-static void destroy_rx_kthread(struct IR_rx *rx)
-{
- /* end up polling thread */
- if (rx != NULL && !IS_ERR_OR_NULL(rx->task)) {
- kthread_stop(rx->task);
- rx->task = NULL;
- }
-}
+static struct lirc_driver lirc_template = {
+ .name = "lirc_zilog",
+ .minor = -1,
+ .code_length = 13,
+ .buffer_size = BUFLEN / 2,
+ .sample_rate = 0, /* tell lirc_dev to not start its own kthread */
+ .chunk_size = 2,
+ .set_use_inc = set_use_inc,
+ .set_use_dec = set_use_dec,
+ .fops = &lirc_fops,
+ .owner = THIS_MODULE,
+};
-/* ir_devices_lock must be held */
-static int add_ir_device(struct IR *ir)
+static int ir_remove(struct i2c_client *client)
{
- int i;
-
- for (i = 0; i < MAX_IRCTL_DEVICES; i++)
- if (ir_devices[i] == NULL) {
- ir_devices[i] = ir;
- break;
+ if (strncmp("ir_tx_z8", client->name, 8) == 0) {
+ struct IR_tx *tx = i2c_get_clientdata(client);
+ if (tx != NULL) {
+ mutex_lock(&tx->client_lock);
+ tx->c = NULL;
+ mutex_unlock(&tx->client_lock);
+ put_ir_tx(tx, false);
}
-
- return i == MAX_IRCTL_DEVICES ? -ENOMEM : i;
-}
-
-/* ir_devices_lock must be held */
-static void del_ir_device(struct IR *ir)
-{
- int i;
-
- for (i = 0; i < MAX_IRCTL_DEVICES; i++)
- if (ir_devices[i] == ir) {
- ir_devices[i] = NULL;
- break;
+ } else if (strncmp("ir_rx_z8", client->name, 8) == 0) {
+ struct IR_rx *rx = i2c_get_clientdata(client);
+ if (rx != NULL) {
+ mutex_lock(&rx->client_lock);
+ rx->c = NULL;
+ mutex_unlock(&rx->client_lock);
+ put_ir_rx(rx, false);
}
-}
-
-static int ir_remove(struct i2c_client *client)
-{
- struct IR *ir = i2c_get_clientdata(client);
-
- mutex_lock(&ir_devices_lock);
-
- if (ir == NULL) {
- /* We destroyed everything when the first client came through */
- mutex_unlock(&ir_devices_lock);
- return 0;
}
-
- /* Good-bye LIRC */
- lirc_unregister_driver(ir->l.minor);
-
- /* Good-bye Rx */
- destroy_rx_kthread(ir->rx);
- if (ir->rx != NULL) {
- if (ir->rx->buf.fifo_initialized)
- lirc_buffer_free(&ir->rx->buf);
- i2c_set_clientdata(ir->rx->c, NULL);
- kfree(ir->rx);
- }
-
- /* Good-bye Tx */
- i2c_set_clientdata(ir->tx->c, NULL);
- kfree(ir->tx);
-
- /* Good-bye IR */
- del_ir_device(ir);
- kfree(ir);
-
- mutex_unlock(&ir_devices_lock);
return 0;
}
/* ir_devices_lock must be held */
-static struct IR *find_ir_device_by_adapter(struct i2c_adapter *adapter)
+static struct IR *get_ir_device_by_adapter(struct i2c_adapter *adapter)
{
- int i;
- struct IR *ir = NULL;
+ struct IR *ir;
- for (i = 0; i < MAX_IRCTL_DEVICES; i++)
- if (ir_devices[i] != NULL &&
- ir_devices[i]->adapter == adapter) {
- ir = ir_devices[i];
- break;
+ if (list_empty(&ir_devices_list))
+ return NULL;
+
+ list_for_each_entry(ir, &ir_devices_list, list)
+ if (ir->adapter == adapter) {
+ get_ir_device(ir, true);
+ return ir;
}
- return ir;
+ return NULL;
}
static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
{
struct IR *ir;
+ struct IR_tx *tx;
+ struct IR_rx *rx;
struct i2c_adapter *adap = client->adapter;
int ret;
bool tx_probe = false;
@@ -1296,133 +1458,170 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
mutex_lock(&ir_devices_lock);
/* Use a single struct IR instance for both the Rx and Tx functions */
- ir = find_ir_device_by_adapter(adap);
+ ir = get_ir_device_by_adapter(adap);
if (ir == NULL) {
ir = kzalloc(sizeof(struct IR), GFP_KERNEL);
if (ir == NULL) {
ret = -ENOMEM;
goto out_no_ir;
}
+ kref_init(&ir->ref);
+
/* store for use in ir_probe() again, and open() later on */
- ret = add_ir_device(ir);
- if (ret)
- goto out_free_ir;
+ INIT_LIST_HEAD(&ir->list);
+ list_add_tail(&ir->list, &ir_devices_list);
ir->adapter = adap;
mutex_init(&ir->ir_lock);
+ atomic_set(&ir->open_count, 0);
+ spin_lock_init(&ir->tx_ref_lock);
+ spin_lock_init(&ir->rx_ref_lock);
/* set lirc_dev stuff */
memcpy(&ir->l, &lirc_template, sizeof(struct lirc_driver));
- ir->l.minor = minor; /* module option */
- ir->l.code_length = 13;
- ir->l.rbuf = NULL;
- ir->l.fops = &lirc_fops;
- ir->l.data = ir;
- ir->l.dev = &adap->dev;
- ir->l.sample_rate = 0;
+ /*
+ * FIXME this is a pointer reference to us, but no refcount.
+ *
+ * This OK for now, since lirc_dev currently won't touch this
+ * buffer as we provide our own lirc_fops.
+ *
+ * Currently our own lirc_fops rely on this ir->l.rbuf pointer
+ */
+ ir->l.rbuf = &ir->rbuf;
+ ir->l.dev = &adap->dev;
+ ret = lirc_buffer_init(ir->l.rbuf,
+ ir->l.chunk_size, ir->l.buffer_size);
+ if (ret)
+ goto out_put_ir;
}
if (tx_probe) {
+ /* Get the IR_rx instance for later, if already allocated */
+ rx = get_ir_rx(ir);
+
/* Set up a struct IR_tx instance */
- ir->tx = kzalloc(sizeof(struct IR_tx), GFP_KERNEL);
- if (ir->tx == NULL) {
+ tx = kzalloc(sizeof(struct IR_tx), GFP_KERNEL);
+ if (tx == NULL) {
ret = -ENOMEM;
- goto out_free_xx;
+ goto out_put_xx;
}
-
- ir->tx->c = client;
- ir->tx->need_boot = 1;
- ir->tx->post_tx_ready_poll =
+ kref_init(&tx->ref);
+ ir->tx = tx;
+
+ ir->l.features |= LIRC_CAN_SEND_PULSE;
+ mutex_init(&tx->client_lock);
+ tx->c = client;
+ tx->need_boot = 1;
+ tx->post_tx_ready_poll =
(id->driver_data & ID_FLAG_HDPVR) ? false : true;
+
+ /* An ir ref goes to the struct IR_tx instance */
+ tx->ir = get_ir_device(ir, true);
+
+ /* A tx ref goes to the i2c_client */
+ i2c_set_clientdata(client, get_ir_tx(ir));
+
+ /*
+ * Load the 'firmware'. We do this before registering with
+ * lirc_dev, so the first firmware load attempt does not happen
+ * after a open() or write() call on the device.
+ *
+ * Failure here is not deemed catastrophic, so the receiver will
+ * still be usable. Firmware load will be retried in write(),
+ * if it is needed.
+ */
+ fw_load(tx);
+
+ /* Proceed only if the Rx client is also ready or not needed */
+ if (rx == NULL && !tx_only) {
+ zilog_info("probe of IR Tx on %s (i2c-%d) done. Waiting"
+ " on IR Rx.\n", adap->name, adap->nr);
+ goto out_ok;
+ }
} else {
+ /* Get the IR_tx instance for later, if already allocated */
+ tx = get_ir_tx(ir);
+
/* Set up a struct IR_rx instance */
- ir->rx = kzalloc(sizeof(struct IR_rx), GFP_KERNEL);
- if (ir->rx == NULL) {
+ rx = kzalloc(sizeof(struct IR_rx), GFP_KERNEL);
+ if (rx == NULL) {
ret = -ENOMEM;
- goto out_free_xx;
+ goto out_put_xx;
}
+ kref_init(&rx->ref);
+ ir->rx = rx;
- ret = lirc_buffer_init(&ir->rx->buf, 2, BUFLEN / 2);
- if (ret)
- goto out_free_xx;
-
- mutex_init(&ir->rx->buf_lock);
- ir->rx->c = client;
- ir->rx->hdpvr_data_fmt =
+ ir->l.features |= LIRC_CAN_REC_LIRCCODE;
+ mutex_init(&rx->client_lock);
+ rx->c = client;
+ rx->hdpvr_data_fmt =
(id->driver_data & ID_FLAG_HDPVR) ? true : false;
- /* set lirc_dev stuff */
- ir->l.rbuf = &ir->rx->buf;
- }
-
- i2c_set_clientdata(client, ir);
+ /* An ir ref goes to the struct IR_rx instance */
+ rx->ir = get_ir_device(ir, true);
- /* Proceed only if we have the required Tx and Rx clients ready to go */
- if (ir->tx == NULL ||
- (ir->rx == NULL && !tx_only)) {
- zilog_info("probe of IR %s on %s (i2c-%d) done. Waiting on "
- "IR %s.\n", tx_probe ? "Tx" : "Rx", adap->name,
- adap->nr, tx_probe ? "Rx" : "Tx");
- goto out_ok;
- }
+ /* An rx ref goes to the i2c_client */
+ i2c_set_clientdata(client, get_ir_rx(ir));
- /* initialise RX device */
- if (ir->rx != NULL) {
- /* try to fire up polling thread */
- ir->rx->task = kthread_run(lirc_thread, ir,
- "zilog-rx-i2c-%d", adap->nr);
- if (IS_ERR(ir->rx->task)) {
- ret = PTR_ERR(ir->rx->task);
+ /*
+ * Start the polling thread.
+ * It will only perform an empty loop around schedule_timeout()
+ * until we register with lirc_dev and the first user open()
+ */
+ /* An ir ref goes to the new rx polling kthread */
+ rx->task = kthread_run(lirc_thread, get_ir_device(ir, true),
+ "zilog-rx-i2c-%d", adap->nr);
+ if (IS_ERR(rx->task)) {
+ ret = PTR_ERR(rx->task);
zilog_error("%s: could not start IR Rx polling thread"
"\n", __func__);
- goto out_free_xx;
+ /* Failed kthread, so put back the ir ref */
+ put_ir_device(ir, true);
+ /* Failure exit, so put back rx ref from i2c_client */
+ i2c_set_clientdata(client, NULL);
+ put_ir_rx(rx, true);
+ ir->l.features &= ~LIRC_CAN_REC_LIRCCODE;
+ goto out_put_xx;
+ }
+
+ /* Proceed only if the Tx client is also ready */
+ if (tx == NULL) {
+ zilog_info("probe of IR Rx on %s (i2c-%d) done. Waiting"
+ " on IR Tx.\n", adap->name, adap->nr);
+ goto out_ok;
}
}
/* register with lirc */
+ ir->l.minor = minor; /* module option: user requested minor number */
ir->l.minor = lirc_register_driver(&ir->l);
if (ir->l.minor < 0 || ir->l.minor >= MAX_IRCTL_DEVICES) {
zilog_error("%s: \"minor\" must be between 0 and %d (%d)!\n",
__func__, MAX_IRCTL_DEVICES-1, ir->l.minor);
ret = -EBADRQC;
- goto out_free_thread;
+ goto out_put_xx;
}
+ zilog_info("IR unit on %s (i2c-%d) registered as lirc%d and ready\n",
+ adap->name, adap->nr, ir->l.minor);
- /*
- * if we have the tx device, load the 'firmware'. We do this
- * after registering with lirc as otherwise hotplug seems to take
- * 10s to create the lirc device.
- */
- ret = tx_init(ir->tx);
- if (ret != 0)
- goto out_unregister;
-
- zilog_info("probe of IR %s on %s (i2c-%d) done. IR unit ready.\n",
- tx_probe ? "Tx" : "Rx", adap->name, adap->nr);
out_ok:
+ if (rx != NULL)
+ put_ir_rx(rx, true);
+ if (tx != NULL)
+ put_ir_tx(tx, true);
+ put_ir_device(ir, true);
+ zilog_info("probe of IR %s on %s (i2c-%d) done\n",
+ tx_probe ? "Tx" : "Rx", adap->name, adap->nr);
mutex_unlock(&ir_devices_lock);
return 0;
-out_unregister:
- lirc_unregister_driver(ir->l.minor);
-out_free_thread:
- destroy_rx_kthread(ir->rx);
-out_free_xx:
- if (ir->rx != NULL) {
- if (ir->rx->buf.fifo_initialized)
- lirc_buffer_free(&ir->rx->buf);
- if (ir->rx->c != NULL)
- i2c_set_clientdata(ir->rx->c, NULL);
- kfree(ir->rx);
- }
- if (ir->tx != NULL) {
- if (ir->tx->c != NULL)
- i2c_set_clientdata(ir->tx->c, NULL);
- kfree(ir->tx);
- }
-out_free_ir:
- del_ir_device(ir);
- kfree(ir);
+out_put_xx:
+ if (rx != NULL)
+ put_ir_rx(rx, true);
+ if (tx != NULL)
+ put_ir_tx(tx, true);
+out_put_ir:
+ put_ir_device(ir, true);
out_no_ir:
zilog_error("%s: probing IR %s on %s (i2c-%d) failed with %d\n",
__func__, tx_probe ? "Tx" : "Rx", adap->name, adap->nr,
@@ -1438,7 +1637,6 @@ static int __init zilog_init(void)
zilog_notify("Zilog/Hauppauge IR driver initializing\n");
mutex_init(&tx_data_lock);
- mutex_init(&ir_devices_lock);
request_module("firmware_class");
diff --git a/drivers/staging/memrar/Kconfig b/drivers/staging/memrar/Kconfig
deleted file mode 100644
index cbeebc550904..000000000000
--- a/drivers/staging/memrar/Kconfig
+++ /dev/null
@@ -1,15 +0,0 @@
-config MRST_RAR_HANDLER
- tristate "RAR handler driver for Intel Moorestown platform"
- depends on RAR_REGISTER
- ---help---
- This driver provides a memory management interface to
- restricted access regions (RAR) available on the Intel
- Moorestown platform.
-
- Once locked down, restricted access regions are only
- accessible by specific hardware on the platform. The x86
- CPU is typically not one of those platforms. As such this
- driver does not access RAR, and only provides a buffer
- allocation/bookkeeping mechanism.
-
- If unsure, say N.
diff --git a/drivers/staging/memrar/Makefile b/drivers/staging/memrar/Makefile
deleted file mode 100644
index a3336c00cc5f..000000000000
--- a/drivers/staging/memrar/Makefile
+++ /dev/null
@@ -1,2 +0,0 @@
-obj-$(CONFIG_MRST_RAR_HANDLER) += memrar.o
-memrar-y := memrar_allocator.o memrar_handler.o
diff --git a/drivers/staging/memrar/TODO b/drivers/staging/memrar/TODO
deleted file mode 100644
index 435e09ba44c5..000000000000
--- a/drivers/staging/memrar/TODO
+++ /dev/null
@@ -1,43 +0,0 @@
-RAR Handler (memrar) Driver TODO Items
-======================================
-
-Maintainer: Eugene Epshteyn <eugene.epshteyn@intel.com>
-
-memrar.h
---------
-1. This header exposes the driver's user space and kernel space
- interfaces. It should be moved to <linux/rar/memrar.h>, or
- something along those lines, when this memrar driver is moved out
- of `staging'.
- a. It would be ideal if staging/rar_register/rar_register.h was
- moved to the same directory.
-
-memrar_allocator.[ch]
----------------------
-1. Address potential fragmentation issues with the memrar_allocator.
-
-2. Hide struct memrar_allocator details/fields. They need not be
- exposed to the user.
- a. Forward declare struct memrar_allocator.
- b. Move all three struct definitions to `memrar_allocator.c'
- source file.
- c. Add a memrar_allocator_largest_free_area() function, or
- something like that to get access to the value of the struct
- memrar_allocator "largest_free_area" field. This allows the
- struct memrar_allocator fields to be completely hidden from
- the user. The memrar_handler code really only needs this for
- statistic gathering on-demand.
- d. Do the same for the "capacity" field as the
- "largest_free_area" field.
-
-3. Move memrar_allocator.* to kernel `lib' directory since it is HW
- neutral.
- a. Alternatively, use lib/genalloc.c instead.
- b. A kernel port of Doug Lea's malloc() implementation may also
- be an option.
-
-memrar_handler.c
-----------------
-1. Split user space interface (ioctl code) from core/kernel code,
- e.g.:
- memrar_handler.c -> memrar_core.c, memrar_user.c
diff --git a/drivers/staging/memrar/memrar-abi b/drivers/staging/memrar/memrar-abi
deleted file mode 100644
index c23fc996a435..000000000000
--- a/drivers/staging/memrar/memrar-abi
+++ /dev/null
@@ -1,89 +0,0 @@
-What: /dev/memrar
-Date: March 2010
-KernelVersion: 2.6.34
-Contact: Eugene Epshteyn <eugene.epshteyn@intel.com>
-Description: The Intel Moorestown Restricted Access Region (RAR)
- Handler driver exposes an ioctl() based interface that
- allows a user to reserve and release blocks of RAR
- memory.
-
- Note: A sysfs based one was not appropriate for the
- RAR handler's usage model.
-
- =========================================================
- ioctl() Requests
- =========================================================
- RAR_HANDLER_RESERVE
- -------------------
- Description: Reserve RAR block.
- Type: struct RAR_block_info
- Direction: in/out
- Errors: EINVAL (invalid RAR type or size)
- ENOMEM (not enough RAR memory)
-
- RAR_HANDLER_STAT
- ----------------
- Description: Get RAR statistics.
- Type: struct RAR_stat
- Direction: in/out
- Errors: EINVAL (invalid RAR type)
-
- RAR_HANDLER_RELEASE
- -------------------
- Description: Release previously reserved RAR block.
- Type: 32 bit unsigned integer
- (e.g. uint32_t), i.e the RAR "handle".
- Direction: in
- Errors: EINVAL (invalid RAR handle)
-
-
- =========================================================
- ioctl() Request Parameter Types
- =========================================================
- The structures referred to above are defined as
- follows:
-
- /**
- * struct RAR_block_info - user space struct that
- * describes RAR buffer
- * @type: Type of RAR memory (e.g.,
- * RAR_TYPE_VIDEO or RAR_TYPE_AUDIO) [in]
- * @size: Requested size of a block in bytes to
- * be reserved in RAR. [in]
- * @handle: Handle that can be used to refer to
- * reserved block. [out]
- *
- * This is the basic structure exposed to the user
- * space that describes a given RAR buffer. It used
- * as the parameter for the RAR_HANDLER_RESERVE ioctl.
- * The buffer's underlying bus address is not exposed
- * to the user. User space code refers to the buffer
- * entirely by "handle".
- */
- struct RAR_block_info {
- __u32 type;
- __u32 size;
- __u32 handle;
- };
-
- /**
- * struct RAR_stat - RAR statistics structure
- * @type: Type of RAR memory (e.g.,
- * RAR_TYPE_VIDEO or
- * RAR_TYPE_AUDIO) [in]
- * @capacity: Total size of RAR memory
- * region. [out]
- * @largest_block_size: Size of the largest reservable
- * block. [out]
- *
- * This structure is used for RAR_HANDLER_STAT ioctl.
- */
- struct RAR_stat {
- __u32 type;
- __u32 capacity;
- __u32 largest_block_size;
- };
-
- Lastly, the RAR_HANDLER_RELEASE ioctl expects a
- "handle" to the RAR block of memory. It is a 32 bit
- unsigned integer.
diff --git a/drivers/staging/memrar/memrar.h b/drivers/staging/memrar/memrar.h
deleted file mode 100644
index 0feb73b94c91..000000000000
--- a/drivers/staging/memrar/memrar.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * RAR Handler (/dev/memrar) internal driver API.
- * Copyright (C) 2010 Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General
- * Public License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be
- * useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * The full GNU General Public License is included in this
- * distribution in the file called COPYING.
- */
-
-
-#ifndef _MEMRAR_H
-#define _MEMRAR_H
-
-#include <linux/ioctl.h>
-#include <linux/types.h>
-
-
-/**
- * struct RAR_stat - RAR statistics structure
- * @type: Type of RAR memory (e.g., audio vs. video)
- * @capacity: Total size of RAR memory region.
- * @largest_block_size: Size of the largest reservable block.
- *
- * This structure is used for RAR_HANDLER_STAT ioctl and for the
- * RAR_get_stat() user space wrapper function.
- */
-struct RAR_stat {
- __u32 type;
- __u32 capacity;
- __u32 largest_block_size;
-};
-
-
-/**
- * struct RAR_block_info - user space struct that describes RAR buffer
- * @type: Type of RAR memory (e.g., audio vs. video)
- * @size: Requested size of a block to be reserved in RAR.
- * @handle: Handle that can be used to refer to reserved block.
- *
- * This is the basic structure exposed to the user space that
- * describes a given RAR buffer. The buffer's underlying bus address
- * is not exposed to the user. User space code refers to the buffer
- * entirely by "handle".
- */
-struct RAR_block_info {
- __u32 type;
- __u32 size;
- __u32 handle;
-};
-
-
-#define RAR_IOCTL_BASE 0xE0
-
-/* Reserve RAR block. */
-#define RAR_HANDLER_RESERVE _IOWR(RAR_IOCTL_BASE, 0x00, struct RAR_block_info)
-
-/* Release previously reserved RAR block. */
-#define RAR_HANDLER_RELEASE _IOW(RAR_IOCTL_BASE, 0x01, __u32)
-
-/* Get RAR stats. */
-#define RAR_HANDLER_STAT _IOWR(RAR_IOCTL_BASE, 0x02, struct RAR_stat)
-
-
-#ifdef __KERNEL__
-
-/* -------------------------------------------------------------- */
-/* Kernel Side RAR Handler Interface */
-/* -------------------------------------------------------------- */
-
-/**
- * struct RAR_buffer - kernel space struct that describes RAR buffer
- * @info: structure containing base RAR buffer information
- * @bus_address: buffer bus address
- *
- * Structure that contains all information related to a given block of
- * memory in RAR. It is generally only used when retrieving RAR
- * related bus addresses.
- *
- * Note: This structure is used only by RAR-enabled drivers, and is
- * not intended to be exposed to the user space.
- */
-struct RAR_buffer {
- struct RAR_block_info info;
- dma_addr_t bus_address;
-};
-
-#if defined(CONFIG_MRST_RAR_HANDLER)
-/**
- * rar_reserve() - reserve RAR buffers
- * @buffers: array of RAR_buffers where type and size of buffers to
- * reserve are passed in, handle and bus address are
- * passed out
- * @count: number of RAR_buffers in the "buffers" array
- *
- * This function will reserve buffers in the restricted access regions
- * of given types.
- *
- * It returns the number of successfully reserved buffers. Successful
- * buffer reservations will have the corresponding bus_address field
- * set to a non-zero value in the given buffers vector.
- */
-extern size_t rar_reserve(struct RAR_buffer *buffers,
- size_t count);
-
-/**
- * rar_release() - release RAR buffers
- * @buffers: array of RAR_buffers where handles to buffers to be
- * released are passed in
- * @count: number of RAR_buffers in the "buffers" array
- *
- * This function will release RAR buffers that were retrieved through
- * a call to rar_reserve() or rar_handle_to_bus() by decrementing the
- * reference count. The RAR buffer will be reclaimed when the
- * reference count drops to zero.
- *
- * It returns the number of successfully released buffers. Successful
- * releases will have their handle field set to zero in the given
- * buffers vector.
- */
-extern size_t rar_release(struct RAR_buffer *buffers,
- size_t count);
-
-/**
- * rar_handle_to_bus() - convert a vector of RAR handles to bus addresses
- * @buffers: array of RAR_buffers containing handles to be
- * converted to bus_addresses
- * @count: number of RAR_buffers in the "buffers" array
-
- * This function will retrieve the RAR buffer bus addresses, type and
- * size corresponding to the RAR handles provided in the buffers
- * vector.
- *
- * It returns the number of successfully converted buffers. The bus
- * address will be set to 0 for unrecognized handles.
- *
- * The reference count for each corresponding buffer in RAR will be
- * incremented. Call rar_release() when done with the buffers.
- */
-extern size_t rar_handle_to_bus(struct RAR_buffer *buffers,
- size_t count);
-
-#else
-
-extern inline size_t rar_reserve(struct RAR_buffer *buffers, size_t count)
-{
- return 0;
-}
-
-extern inline size_t rar_release(struct RAR_buffer *buffers, size_t count)
-{
- return 0;
-}
-
-extern inline size_t rar_handle_to_bus(struct RAR_buffer *buffers,
- size_t count)
-{
- return 0;
-}
-
-#endif /* MRST_RAR_HANDLER */
-#endif /* __KERNEL__ */
-
-#endif /* _MEMRAR_H */
diff --git a/drivers/staging/memrar/memrar_allocator.c b/drivers/staging/memrar/memrar_allocator.c
deleted file mode 100644
index a4f8c5846a00..000000000000
--- a/drivers/staging/memrar/memrar_allocator.c
+++ /dev/null
@@ -1,432 +0,0 @@
-/*
- * memrar_allocator 1.0: An allocator for Intel RAR.
- *
- * Copyright (C) 2010 Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General
- * Public License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be
- * useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * The full GNU General Public License is included in this
- * distribution in the file called COPYING.
- *
- *
- * ------------------------------------------------------------------
- *
- * This simple allocator implementation provides a
- * malloc()/free()-like interface for reserving space within a
- * previously reserved block of memory. It is not specific to
- * any hardware, nor is it coupled with the lower level paging
- * mechanism.
- *
- * The primary goal of this implementation is to provide a means
- * to partition an arbitrary block of memory without actually
- * accessing the memory or incurring any hardware side-effects
- * (e.g. paging). It is, in effect, a bookkeeping mechanism for
- * buffers.
- */
-
-
-#include "memrar_allocator.h"
-#include <linux/slab.h>
-#include <linux/bug.h>
-#include <linux/kernel.h>
-
-
-struct memrar_allocator *memrar_create_allocator(unsigned long base,
- size_t capacity,
- size_t block_size)
-{
- struct memrar_allocator *allocator = NULL;
- struct memrar_address_ranges *first_node = NULL;
-
- /*
- * Make sure the base address is aligned on a block_size
- * boundary.
- *
- * @todo Is this necessary?
- */
- /* base = ALIGN(base, block_size); */
-
- /* Validate parameters.
- *
- * Make sure we can allocate the entire memory space. Zero
- * capacity or block size are obviously invalid.
- */
- if (base == 0
- || capacity == 0
- || block_size == 0
- || ULONG_MAX - capacity < base
- || capacity < block_size)
- return allocator;
-
- /*
- * There isn't much point in creating a memory allocator that
- * is only capable of holding one block but we'll allow it,
- * and issue a diagnostic.
- */
- WARN(capacity < block_size * 2,
- "memrar: Only one block available to allocator.\n");
-
- allocator = kmalloc(sizeof(*allocator), GFP_KERNEL);
-
- if (allocator == NULL)
- return allocator;
-
- mutex_init(&allocator->lock);
- allocator->base = base;
-
- /* Round the capacity down to a multiple of block_size. */
- allocator->capacity = (capacity / block_size) * block_size;
-
- allocator->block_size = block_size;
-
- allocator->largest_free_area = allocator->capacity;
-
- /* Initialize the handle and free lists. */
- INIT_LIST_HEAD(&allocator->allocated_list.list);
- INIT_LIST_HEAD(&allocator->free_list.list);
-
- first_node = kmalloc(sizeof(*first_node), GFP_KERNEL);
- if (first_node == NULL) {
- kfree(allocator);
- allocator = NULL;
- } else {
- /* Full range of blocks is available. */
- first_node->range.begin = base;
- first_node->range.end = base + allocator->capacity;
- list_add(&first_node->list,
- &allocator->free_list.list);
- }
-
- return allocator;
-}
-
-void memrar_destroy_allocator(struct memrar_allocator *allocator)
-{
- /*
- * Assume that the memory allocator lock isn't held at this
- * point in time. Caller must ensure that.
- */
-
- struct memrar_address_ranges *pos = NULL;
- struct memrar_address_ranges *n = NULL;
-
- if (allocator == NULL)
- return;
-
- mutex_lock(&allocator->lock);
-
- /* Reclaim free list resources. */
- list_for_each_entry_safe(pos,
- n,
- &allocator->free_list.list,
- list) {
- list_del(&pos->list);
- kfree(pos);
- }
-
- mutex_unlock(&allocator->lock);
-
- kfree(allocator);
-}
-
-unsigned long memrar_allocator_alloc(struct memrar_allocator *allocator,
- size_t size)
-{
- struct memrar_address_ranges *pos = NULL;
-
- size_t num_blocks;
- unsigned long reserved_bytes;
-
- /*
- * Address of allocated buffer. We assume that zero is not a
- * valid address.
- */
- unsigned long addr = 0;
-
- if (allocator == NULL || size == 0)
- return addr;
-
- /* Reserve enough blocks to hold the amount of bytes requested. */
- num_blocks = DIV_ROUND_UP(size, allocator->block_size);
-
- reserved_bytes = num_blocks * allocator->block_size;
-
- mutex_lock(&allocator->lock);
-
- if (reserved_bytes > allocator->largest_free_area) {
- mutex_unlock(&allocator->lock);
- return addr;
- }
-
- /*
- * Iterate through the free list to find a suitably sized
- * range of free contiguous memory blocks.
- *
- * We also take the opportunity to reset the size of the
- * largest free area size statistic.
- */
- list_for_each_entry(pos, &allocator->free_list.list, list) {
- struct memrar_address_range * const fr = &pos->range;
- size_t const curr_size = fr->end - fr->begin;
-
- if (curr_size >= reserved_bytes && addr == 0) {
- struct memrar_address_range *range = NULL;
- struct memrar_address_ranges * const new_node =
- kmalloc(sizeof(*new_node), GFP_KERNEL);
-
- if (new_node == NULL)
- break;
-
- list_add(&new_node->list,
- &allocator->allocated_list.list);
-
- /*
- * Carve out area of memory from end of free
- * range.
- */
- range = &new_node->range;
- range->end = fr->end;
- fr->end -= reserved_bytes;
- range->begin = fr->end;
- addr = range->begin;
-
- /*
- * Check if largest area has decreased in
- * size. We'll need to continue scanning for
- * the next largest area if it has.
- */
- if (curr_size == allocator->largest_free_area)
- allocator->largest_free_area -=
- reserved_bytes;
- else
- break;
- }
-
- /*
- * Reset largest free area size statistic as needed,
- * but only if we've actually allocated memory.
- */
- if (addr != 0
- && curr_size > allocator->largest_free_area) {
- allocator->largest_free_area = curr_size;
- break;
- }
- }
-
- mutex_unlock(&allocator->lock);
-
- return addr;
-}
-
-long memrar_allocator_free(struct memrar_allocator *allocator,
- unsigned long addr)
-{
- struct list_head *pos = NULL;
- struct list_head *tmp = NULL;
- struct list_head *dst = NULL;
-
- struct memrar_address_ranges *allocated = NULL;
- struct memrar_address_range const *handle = NULL;
-
- unsigned long old_end = 0;
- unsigned long new_chunk_size = 0;
-
- if (allocator == NULL)
- return -EINVAL;
-
- if (addr == 0)
- return 0; /* Ignore "free(0)". */
-
- mutex_lock(&allocator->lock);
-
- /* Find the corresponding handle. */
- list_for_each_entry(allocated,
- &allocator->allocated_list.list,
- list) {
- if (allocated->range.begin == addr) {
- handle = &allocated->range;
- break;
- }
- }
-
- /* No such buffer created by this allocator. */
- if (handle == NULL) {
- mutex_unlock(&allocator->lock);
- return -EFAULT;
- }
-
- /*
- * Coalesce adjacent chunks of memory if possible.
- *
- * @note This isn't full blown coalescing since we're only
- * coalescing at most three chunks of memory.
- */
- list_for_each_safe(pos, tmp, &allocator->free_list.list) {
- /* @todo O(n) performance. Optimize. */
-
- struct memrar_address_range * const chunk =
- &list_entry(pos,
- struct memrar_address_ranges,
- list)->range;
-
- /* Extend size of existing free adjacent chunk. */
- if (chunk->end == handle->begin) {
- /*
- * Chunk "less than" than the one we're
- * freeing is adjacent.
- *
- * Before:
- *
- * +-----+------+
- * |chunk|handle|
- * +-----+------+
- *
- * After:
- *
- * +------------+
- * | chunk |
- * +------------+
- */
-
- struct memrar_address_ranges const * const next =
- list_entry(pos->next,
- struct memrar_address_ranges,
- list);
-
- chunk->end = handle->end;
-
- /*
- * Now check if next free chunk is adjacent to
- * the current extended free chunk.
- *
- * Before:
- *
- * +------------+----+
- * | chunk |next|
- * +------------+----+
- *
- * After:
- *
- * +-----------------+
- * | chunk |
- * +-----------------+
- */
- if (!list_is_singular(pos)
- && chunk->end == next->range.begin) {
- chunk->end = next->range.end;
- list_del(pos->next);
- kfree(next);
- }
-
- list_del(&allocated->list);
-
- new_chunk_size = chunk->end - chunk->begin;
-
- goto exit_memrar_free;
-
- } else if (handle->end == chunk->begin) {
- /*
- * Chunk "greater than" than the one we're
- * freeing is adjacent.
- *
- * +------+-----+
- * |handle|chunk|
- * +------+-----+
- *
- * After:
- *
- * +------------+
- * | chunk |
- * +------------+
- */
-
- struct memrar_address_ranges const * const prev =
- list_entry(pos->prev,
- struct memrar_address_ranges,
- list);
-
- chunk->begin = handle->begin;
-
- /*
- * Now check if previous free chunk is
- * adjacent to the current extended free
- * chunk.
- *
- *
- * Before:
- *
- * +----+------------+
- * |prev| chunk |
- * +----+------------+
- *
- * After:
- *
- * +-----------------+
- * | chunk |
- * +-----------------+
- */
- if (!list_is_singular(pos)
- && prev->range.end == chunk->begin) {
- chunk->begin = prev->range.begin;
- list_del(pos->prev);
- kfree(prev);
- }
-
- list_del(&allocated->list);
-
- new_chunk_size = chunk->end - chunk->begin;
-
- goto exit_memrar_free;
-
- } else if (chunk->end < handle->begin
- && chunk->end > old_end) {
- /* Keep track of where the entry could be
- * potentially moved from the "allocated" list
- * to the "free" list if coalescing doesn't
- * occur, making sure the "free" list remains
- * sorted.
- */
- old_end = chunk->end;
- dst = pos;
- }
- }
-
- /*
- * Nothing to coalesce.
- *
- * Move the entry from the "allocated" list to the "free"
- * list.
- */
- list_move(&allocated->list, dst);
- new_chunk_size = handle->end - handle->begin;
- allocated = NULL;
-
-exit_memrar_free:
-
- if (new_chunk_size > allocator->largest_free_area)
- allocator->largest_free_area = new_chunk_size;
-
- mutex_unlock(&allocator->lock);
-
- kfree(allocated);
-
- return 0;
-}
-
-
-
-/*
- Local Variables:
- c-file-style: "linux"
- End:
-*/
diff --git a/drivers/staging/memrar/memrar_allocator.h b/drivers/staging/memrar/memrar_allocator.h
deleted file mode 100644
index 0b80dead710f..000000000000
--- a/drivers/staging/memrar/memrar_allocator.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Copyright (C) 2010 Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General
- * Public License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be
- * useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * The full GNU General Public License is included in this
- * distribution in the file called COPYING.
- */
-
-#ifndef MEMRAR_ALLOCATOR_H
-#define MEMRAR_ALLOCATOR_H
-
-
-#include <linux/mutex.h>
-#include <linux/list.h>
-#include <linux/types.h>
-#include <linux/kernel.h>
-
-
-/**
- * struct memrar_address_range - struct that describes a memory range
- * @begin: Beginning of available address range.
- * @end: End of available address range, one past the end,
- * i.e. [begin, end).
- */
-struct memrar_address_range {
-/* private: internal use only */
- unsigned long begin;
- unsigned long end;
-};
-
-/**
- * struct memrar_address_ranges - list of areas of memory.
- * @list: Linked list of address ranges.
- * @range: Memory address range corresponding to given list node.
- */
-struct memrar_address_ranges {
-/* private: internal use only */
- struct list_head list;
- struct memrar_address_range range;
-};
-
-/**
- * struct memrar_allocator - encapsulation of the memory allocator state
- * @lock: Lock used to synchronize access to the memory
- * allocator state.
- * @base: Base (start) address of the allocator memory
- * space.
- * @capacity: Size of the allocator memory space in bytes.
- * @block_size: The size in bytes of individual blocks within
- * the allocator memory space.
- * @largest_free_area: Largest free area of memory in the allocator
- * in bytes.
- * @allocated_list: List of allocated memory block address
- * ranges.
- * @free_list: List of free address ranges.
- *
- * This structure contains all memory allocator state, including the
- * base address, capacity, free list, lock, etc.
- */
-struct memrar_allocator {
-/* private: internal use only */
- struct mutex lock;
- unsigned long base;
- size_t capacity;
- size_t block_size;
- size_t largest_free_area;
- struct memrar_address_ranges allocated_list;
- struct memrar_address_ranges free_list;
-};
-
-/**
- * memrar_create_allocator() - create a memory allocator
- * @base: Address at which the memory allocator begins.
- * @capacity: Desired size of the memory allocator. This value must
- * be larger than the block_size, ideally more than twice
- * as large since there wouldn't be much point in using a
- * memory allocator otherwise.
- * @block_size: The size of individual blocks within the memory
- * allocator. This value must smaller than the
- * capacity.
- *
- * Create a memory allocator with the given capacity and block size.
- * The capacity will be reduced to be a multiple of the block size, if
- * necessary.
- *
- * Returns an instance of the memory allocator, if creation succeeds,
- * otherwise zero if creation fails. Failure may occur if not enough
- * kernel memory exists to create the memrar_allocator instance
- * itself, or if the capacity and block_size arguments are not
- * compatible or make sense.
- */
-struct memrar_allocator *memrar_create_allocator(unsigned long base,
- size_t capacity,
- size_t block_size);
-
-/**
- * memrar_destroy_allocator() - destroy allocator
- * @allocator: The allocator being destroyed.
- *
- * Reclaim resources held by the memory allocator. The caller must
- * explicitly free all memory reserved by memrar_allocator_alloc()
- * prior to calling this function. Otherwise leaks will occur.
- */
-void memrar_destroy_allocator(struct memrar_allocator *allocator);
-
-/**
- * memrar_allocator_alloc() - reserve an area of memory of given size
- * @allocator: The allocator instance being used to reserve buffer.
- * @size: The size in bytes of the buffer to allocate.
- *
- * This functions reserves an area of memory managed by the given
- * allocator. It returns zero if allocation was not possible.
- * Failure may occur if the allocator no longer has space available.
- */
-unsigned long memrar_allocator_alloc(struct memrar_allocator *allocator,
- size_t size);
-
-/**
- * memrar_allocator_free() - release buffer starting at given address
- * @allocator: The allocator instance being used to release the buffer.
- * @address: The address of the buffer being released.
- *
- * Release an area of memory starting at the given address. Failure
- * could occur if the given address is not in the address space
- * managed by the allocator. Returns zero on success or an errno
- * (negative value) on failure.
- */
-long memrar_allocator_free(struct memrar_allocator *allocator,
- unsigned long address);
-
-#endif /* MEMRAR_ALLOCATOR_H */
-
-
-/*
- Local Variables:
- c-file-style: "linux"
- End:
-*/
diff --git a/drivers/staging/memrar/memrar_handler.c b/drivers/staging/memrar/memrar_handler.c
deleted file mode 100644
index cfcaa8e5b8e6..000000000000
--- a/drivers/staging/memrar/memrar_handler.c
+++ /dev/null
@@ -1,1007 +0,0 @@
-/*
- * memrar_handler 1.0: An Intel restricted access region handler device
- *
- * Copyright (C) 2010 Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General
- * Public License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be
- * useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * The full GNU General Public License is included in this
- * distribution in the file called COPYING.
- *
- * -------------------------------------------------------------------
- *
- * Moorestown restricted access regions (RAR) provide isolated
- * areas of main memory that are only acceessible by authorized
- * devices.
- *
- * The Intel Moorestown RAR handler module exposes a kernel space
- * RAR memory management mechanism. It is essentially a
- * RAR-specific allocator.
- *
- * Besides providing RAR buffer management, the RAR handler also
- * behaves in many ways like an OS virtual memory manager. For
- * example, the RAR "handles" created by the RAR handler are
- * analogous to user space virtual addresses.
- *
- * RAR memory itself is never accessed directly by the RAR
- * handler.
- */
-
-#include <linux/miscdevice.h>
-#include <linux/fs.h>
-#include <linux/slab.h>
-#include <linux/kref.h>
-#include <linux/mutex.h>
-#include <linux/kernel.h>
-#include <linux/uaccess.h>
-#include <linux/mm.h>
-#include <linux/ioport.h>
-#include <linux/io.h>
-#include <linux/rar_register.h>
-
-#include "memrar.h"
-#include "memrar_allocator.h"
-
-
-#define MEMRAR_VER "1.0"
-
-/*
- * Moorestown supports three restricted access regions.
- *
- * We only care about the first two, video and audio. The third,
- * reserved for Chaabi and the P-unit, will be handled by their
- * respective drivers.
- */
-#define MRST_NUM_RAR 2
-
-/* ---------------- -------------------- ------------------- */
-
-/**
- * struct memrar_buffer_info - struct that keeps track of all RAR buffers
- * @list: Linked list of memrar_buffer_info objects.
- * @buffer: Core RAR buffer information.
- * @refcount: Reference count.
- * @owner: File handle corresponding to process that reserved the
- * block of memory in RAR. This will be zero for buffers
- * allocated by other drivers instead of by a user space
- * process.
- *
- * This structure encapsulates a link list of RAR buffers, as well as
- * other characteristics specific to a given list node, such as the
- * reference count on the corresponding RAR buffer.
- */
-struct memrar_buffer_info {
- struct list_head list;
- struct RAR_buffer buffer;
- struct kref refcount;
- struct file *owner;
-};
-
-/**
- * struct memrar_rar_info - characteristics of a given RAR
- * @base: Base bus address of the RAR.
- * @length: Length of the RAR.
- * @iobase: Virtual address of RAR mapped into kernel.
- * @allocator: Allocator associated with the RAR. Note the allocator
- * "capacity" may be smaller than the RAR length if the
- * length is not a multiple of the configured allocator
- * block size.
- * @buffers: Table that keeps track of all reserved RAR buffers.
- * @lock: Lock used to synchronize access to RAR-specific data
- * structures.
- *
- * Each RAR has an associated memrar_rar_info structure that describes
- * where in memory the RAR is located, how large it is, and a list of
- * reserved RAR buffers inside that RAR. Each RAR also has a mutex
- * associated with it to reduce lock contention when operations on
- * multiple RARs are performed in parallel.
- */
-struct memrar_rar_info {
- dma_addr_t base;
- unsigned long length;
- void __iomem *iobase;
- struct memrar_allocator *allocator;
- struct memrar_buffer_info buffers;
- struct mutex lock;
- int allocated; /* True if we own this RAR */
-};
-
-/*
- * Array of RAR characteristics.
- */
-static struct memrar_rar_info memrars[MRST_NUM_RAR];
-
-/* ---------------- -------------------- ------------------- */
-
-/* Validate RAR type. */
-static inline int memrar_is_valid_rar_type(u32 type)
-{
- return type == RAR_TYPE_VIDEO || type == RAR_TYPE_AUDIO;
-}
-
-/* Check if an address/handle falls with the given RAR memory range. */
-static inline int memrar_handle_in_range(struct memrar_rar_info *rar,
- u32 vaddr)
-{
- unsigned long const iobase = (unsigned long) (rar->iobase);
- return (vaddr >= iobase && vaddr < iobase + rar->length);
-}
-
-/* Retrieve RAR information associated with the given handle. */
-static struct memrar_rar_info *memrar_get_rar_info(u32 vaddr)
-{
- int i;
- for (i = 0; i < MRST_NUM_RAR; ++i) {
- struct memrar_rar_info * const rar = &memrars[i];
- if (memrar_handle_in_range(rar, vaddr))
- return rar;
- }
-
- return NULL;
-}
-
-/**
- * memrar_get_bus address - handle to bus address
- *
- * Retrieve bus address from given handle.
- *
- * Returns address corresponding to given handle. Zero if handle is
- * invalid.
- */
-static dma_addr_t memrar_get_bus_address(
- struct memrar_rar_info *rar,
- u32 vaddr)
-{
- unsigned long const iobase = (unsigned long) (rar->iobase);
-
- if (!memrar_handle_in_range(rar, vaddr))
- return 0;
-
- /*
- * An assumption is made that the virtual address offset is
- * the same as the bus address offset, at least based on the
- * way this driver is implemented. For example, vaddr + 2 ==
- * baddr + 2.
- *
- * @todo Is that a valid assumption?
- */
- return rar->base + (vaddr - iobase);
-}
-
-/**
- * memrar_get_physical_address - handle to physical address
- *
- * Retrieve physical address from given handle.
- *
- * Returns address corresponding to given handle. Zero if handle is
- * invalid.
- */
-static dma_addr_t memrar_get_physical_address(
- struct memrar_rar_info *rar,
- u32 vaddr)
-{
- /*
- * @todo This assumes that the bus address and physical
- * address are the same. That is true for Moorestown
- * but not necessarily on other platforms. This
- * deficiency should be addressed at some point.
- */
- return memrar_get_bus_address(rar, vaddr);
-}
-
-/**
- * memrar_release_block - release a block to the pool
- * @kref: kref of block
- *
- * Core block release code. A node has hit zero references so can
- * be released and the lists must be updated.
- *
- * Note: This code removes the node from a list. Make sure any list
- * iteration is performed using list_for_each_safe().
- */
-static void memrar_release_block_i(struct kref *ref)
-{
- /*
- * Last reference is being released. Remove from the table,
- * and reclaim resources.
- */
-
- struct memrar_buffer_info * const node =
- container_of(ref, struct memrar_buffer_info, refcount);
-
- struct RAR_block_info * const user_info =
- &node->buffer.info;
-
- struct memrar_allocator * const allocator =
- memrars[user_info->type].allocator;
-
- list_del(&node->list);
-
- memrar_allocator_free(allocator, user_info->handle);
-
- kfree(node);
-}
-
-/**
- * memrar_init_rar_resources - configure a RAR
- * @rarnum: rar that has been allocated
- * @devname: name of our device
- *
- * Initialize RAR parameters, such as bus addresses, etc and make
- * the resource accessible.
- */
-static int memrar_init_rar_resources(int rarnum, char const *devname)
-{
- /* ---- Sanity Checks ----
- * 1. RAR bus addresses in both Lincroft and Langwell RAR
- * registers should be the same.
- * a. There's no way we can do this through IA.
- *
- * 2. Secure device ID in Langwell RAR registers should be set
- * appropriately, e.g. only LPE DMA for the audio RAR, and
- * security for the other Langwell based RAR registers.
- * a. There's no way we can do this through IA.
- *
- * 3. Audio and video RAR registers and RAR access should be
- * locked down. If not, enable RAR access control. Except
- * for debugging purposes, there is no reason for them to
- * be unlocked.
- * a. We can only do this for the Lincroft (IA) side.
- *
- * @todo Should the RAR handler driver even be aware of audio
- * and video RAR settings?
- */
-
- /*
- * RAR buffer block size.
- *
- * We choose it to be the size of a page to simplify the
- * /dev/memrar mmap() implementation and usage. Otherwise
- * paging is not involved once an RAR is locked down.
- */
- static size_t const RAR_BLOCK_SIZE = PAGE_SIZE;
-
- dma_addr_t low, high;
- struct memrar_rar_info * const rar = &memrars[rarnum];
-
- BUG_ON(MRST_NUM_RAR != ARRAY_SIZE(memrars));
- BUG_ON(!memrar_is_valid_rar_type(rarnum));
- BUG_ON(rar->allocated);
-
- if (rar_get_address(rarnum, &low, &high) != 0)
- /* No RAR is available. */
- return -ENODEV;
-
- if (low == 0 || high == 0) {
- rar->base = 0;
- rar->length = 0;
- rar->iobase = NULL;
- rar->allocator = NULL;
- return -ENOSPC;
- }
-
- /*
- * @todo Verify that LNC and LNW RAR register contents
- * addresses, security, etc are compatible and
- * consistent).
- */
-
- rar->length = high - low + 1;
-
- /* Claim RAR memory as our own. */
- if (request_mem_region(low, rar->length, devname) == NULL) {
- rar->length = 0;
- pr_err("%s: Unable to claim RAR[%d] memory.\n",
- devname, rarnum);
- pr_err("%s: RAR[%d] disabled.\n", devname, rarnum);
- return -EBUSY;
- }
-
- rar->base = low;
-
- /*
- * Now map it into the kernel address space.
- *
- * Note that the RAR memory may only be accessed by IA
- * when debugging. Otherwise attempts to access the
- * RAR memory when it is locked down will result in
- * behavior similar to writing to /dev/null and
- * reading from /dev/zero. This behavior is enforced
- * by the hardware. Even if we don't access the
- * memory, mapping it into the kernel provides us with
- * a convenient RAR handle to bus address mapping.
- */
- rar->iobase = ioremap_nocache(rar->base, rar->length);
- if (rar->iobase == NULL) {
- pr_err("%s: Unable to map RAR memory.\n", devname);
- release_mem_region(low, rar->length);
- return -ENOMEM;
- }
-
- /* Initialize corresponding memory allocator. */
- rar->allocator = memrar_create_allocator((unsigned long) rar->iobase,
- rar->length, RAR_BLOCK_SIZE);
- if (rar->allocator == NULL) {
- iounmap(rar->iobase);
- release_mem_region(low, rar->length);
- return -ENOMEM;
- }
-
- pr_info("%s: BRAR[%d] bus address range = [0x%lx, 0x%lx]\n",
- devname, rarnum, (unsigned long) low, (unsigned long) high);
-
- pr_info("%s: BRAR[%d] size = %zu KiB\n",
- devname, rarnum, rar->allocator->capacity / 1024);
-
- rar->allocated = 1;
- return 0;
-}
-
-/**
- * memrar_fini_rar_resources - free up RAR resources
- *
- * Finalize RAR resources. Free up the resource tables, hand the memory
- * back to the kernel, unmap the device and release the address space.
- */
-static void memrar_fini_rar_resources(void)
-{
- int z;
- struct memrar_buffer_info *pos;
- struct memrar_buffer_info *tmp;
-
- /*
- * @todo Do we need to hold a lock at this point in time?
- * (module initialization failure or exit?)
- */
-
- for (z = MRST_NUM_RAR; z-- != 0; ) {
- struct memrar_rar_info * const rar = &memrars[z];
-
- if (!rar->allocated)
- continue;
-
- /* Clean up remaining resources. */
-
- list_for_each_entry_safe(pos,
- tmp,
- &rar->buffers.list,
- list) {
- kref_put(&pos->refcount, memrar_release_block_i);
- }
-
- memrar_destroy_allocator(rar->allocator);
- rar->allocator = NULL;
-
- iounmap(rar->iobase);
- release_mem_region(rar->base, rar->length);
-
- rar->iobase = NULL;
- rar->base = 0;
- rar->length = 0;
-
- unregister_rar(z);
- }
-}
-
-/**
- * memrar_reserve_block - handle an allocation request
- * @request: block being requested
- * @filp: owner it is tied to
- *
- * Allocate a block of the requested RAR. If successful return the
- * request object filled in and zero, if not report an error code
- */
-
-static long memrar_reserve_block(struct RAR_buffer *request,
- struct file *filp)
-{
- struct RAR_block_info * const rinfo = &request->info;
- struct RAR_buffer *buffer;
- struct memrar_buffer_info *buffer_info;
- u32 handle;
- struct memrar_rar_info *rar = NULL;
-
- /* Prevent array overflow. */
- if (!memrar_is_valid_rar_type(rinfo->type))
- return -EINVAL;
-
- rar = &memrars[rinfo->type];
- if (!rar->allocated)
- return -ENODEV;
-
- /* Reserve memory in RAR. */
- handle = memrar_allocator_alloc(rar->allocator, rinfo->size);
- if (handle == 0)
- return -ENOMEM;
-
- buffer_info = kmalloc(sizeof(*buffer_info), GFP_KERNEL);
-
- if (buffer_info == NULL) {
- memrar_allocator_free(rar->allocator, handle);
- return -ENOMEM;
- }
-
- buffer = &buffer_info->buffer;
- buffer->info.type = rinfo->type;
- buffer->info.size = rinfo->size;
-
- /* Memory handle corresponding to the bus address. */
- buffer->info.handle = handle;
- buffer->bus_address = memrar_get_bus_address(rar, handle);
-
- /*
- * Keep track of owner so that we can later cleanup if
- * necessary.
- */
- buffer_info->owner = filp;
-
- kref_init(&buffer_info->refcount);
-
- mutex_lock(&rar->lock);
- list_add(&buffer_info->list, &rar->buffers.list);
- mutex_unlock(&rar->lock);
-
- rinfo->handle = buffer->info.handle;
- request->bus_address = buffer->bus_address;
-
- return 0;
-}
-
-/**
- * memrar_release_block - release a RAR block
- * @addr: address in RAR space
- *
- * Release a previously allocated block. Releases act on complete
- * blocks, partially freeing a block is not supported
- */
-
-static long memrar_release_block(u32 addr)
-{
- struct memrar_buffer_info *pos;
- struct memrar_buffer_info *tmp;
- struct memrar_rar_info * const rar = memrar_get_rar_info(addr);
- long result = -EINVAL;
-
- if (rar == NULL)
- return -ENOENT;
-
- mutex_lock(&rar->lock);
-
- /*
- * Iterate through the buffer list to find the corresponding
- * buffer to be released.
- */
- list_for_each_entry_safe(pos,
- tmp,
- &rar->buffers.list,
- list) {
- struct RAR_block_info * const info =
- &pos->buffer.info;
-
- /*
- * Take into account handle offsets that may have been
- * added to the base handle, such as in the following
- * scenario:
- *
- * u32 handle = base + offset;
- * rar_handle_to_bus(handle);
- * rar_release(handle);
- */
- if (addr >= info->handle
- && addr < (info->handle + info->size)
- && memrar_is_valid_rar_type(info->type)) {
- kref_put(&pos->refcount, memrar_release_block_i);
- result = 0;
- break;
- }
- }
-
- mutex_unlock(&rar->lock);
-
- return result;
-}
-
-/**
- * memrar_get_stats - read statistics for a RAR
- * @r: statistics to be filled in
- *
- * Returns the statistics data for the RAR, or an error code if
- * the request cannot be completed
- */
-static long memrar_get_stat(struct RAR_stat *r)
-{
- struct memrar_allocator *allocator;
-
- if (!memrar_is_valid_rar_type(r->type))
- return -EINVAL;
-
- if (!memrars[r->type].allocated)
- return -ENODEV;
-
- allocator = memrars[r->type].allocator;
-
- BUG_ON(allocator == NULL);
-
- /*
- * Allocator capacity doesn't change over time. No
- * need to synchronize.
- */
- r->capacity = allocator->capacity;
-
- mutex_lock(&allocator->lock);
- r->largest_block_size = allocator->largest_free_area;
- mutex_unlock(&allocator->lock);
- return 0;
-}
-
-/**
- * memrar_ioctl - ioctl callback
- * @filp: file issuing the request
- * @cmd: command
- * @arg: pointer to control information
- *
- * Perform one of the ioctls supported by the memrar device
- */
-
-static long memrar_ioctl(struct file *filp,
- unsigned int cmd,
- unsigned long arg)
-{
- void __user *argp = (void __user *)arg;
- long result = 0;
-
- struct RAR_buffer buffer;
- struct RAR_block_info * const request = &buffer.info;
- struct RAR_stat rar_info;
- u32 rar_handle;
-
- switch (cmd) {
- case RAR_HANDLER_RESERVE:
- if (copy_from_user(request,
- argp,
- sizeof(*request)))
- return -EFAULT;
-
- result = memrar_reserve_block(&buffer, filp);
- if (result != 0)
- return result;
-
- return copy_to_user(argp, request, sizeof(*request));
-
- case RAR_HANDLER_RELEASE:
- if (copy_from_user(&rar_handle,
- argp,
- sizeof(rar_handle)))
- return -EFAULT;
-
- return memrar_release_block(rar_handle);
-
- case RAR_HANDLER_STAT:
- if (copy_from_user(&rar_info,
- argp,
- sizeof(rar_info)))
- return -EFAULT;
-
- /*
- * Populate the RAR_stat structure based on the RAR
- * type given by the user
- */
- if (memrar_get_stat(&rar_info) != 0)
- return -EINVAL;
-
- /*
- * @todo Do we need to verify destination pointer
- * "argp" is non-zero? Is that already done by
- * copy_to_user()?
- */
- return copy_to_user(argp,
- &rar_info,
- sizeof(rar_info)) ? -EFAULT : 0;
-
- default:
- return -ENOTTY;
- }
-
- return 0;
-}
-
-/**
- * memrar_mmap - mmap helper for deubgging
- * @filp: handle doing the mapping
- * @vma: memory area
- *
- * Support the mmap operation on the RAR space for debugging systems
- * when the memory is not locked down.
- */
-
-static int memrar_mmap(struct file *filp, struct vm_area_struct *vma)
-{
- /*
- * This mmap() implementation is predominantly useful for
- * debugging since the CPU will be prevented from accessing
- * RAR memory by the hardware when RAR is properly locked
- * down.
- *
- * In order for this implementation to be useful RAR memory
- * must be not be locked down. However, we only want to do
- * that when debugging. DO NOT leave RAR memory unlocked in a
- * deployed device that utilizes RAR.
- */
-
- size_t const size = vma->vm_end - vma->vm_start;
-
- /* Users pass the RAR handle as the mmap() offset parameter. */
- unsigned long const handle = vma->vm_pgoff << PAGE_SHIFT;
-
- struct memrar_rar_info * const rar = memrar_get_rar_info(handle);
- unsigned long pfn;
-
- /* Only allow priviledged apps to go poking around this way */
- if (!capable(CAP_SYS_RAWIO))
- return -EPERM;
-
- /* Invalid RAR handle or size passed to mmap(). */
- if (rar == NULL
- || handle == 0
- || size > (handle - (unsigned long) rar->iobase))
- return -EINVAL;
-
- /*
- * Retrieve physical address corresponding to the RAR handle,
- * and convert it to a page frame.
- */
- pfn = memrar_get_physical_address(rar, handle) >> PAGE_SHIFT;
-
-
- pr_debug("memrar: mapping RAR range [0x%lx, 0x%lx) into user space.\n",
- handle,
- handle + size);
-
- /*
- * Map RAR memory into user space. This is really only useful
- * for debugging purposes since the memory won't be
- * accessible, i.e. reads return zero and writes are ignored,
- * when RAR access control is enabled.
- */
- if (remap_pfn_range(vma,
- vma->vm_start,
- pfn,
- size,
- vma->vm_page_prot))
- return -EAGAIN;
-
- /* vma->vm_ops = &memrar_mem_ops; */
-
- return 0;
-}
-
-/**
- * memrar_open - device open method
- * @inode: inode to open
- * @filp: file handle
- *
- * As we support multiple arbitary opens there is no work to be done
- * really.
- */
-
-static int memrar_open(struct inode *inode, struct file *filp)
-{
- nonseekable_open(inode, filp);
- return 0;
-}
-
-/**
- * memrar_release - close method for miscev
- * @inode: inode of device
- * @filp: handle that is going away
- *
- * Free up all the regions that belong to this file handle. We use
- * the handle as a natural Linux style 'lifetime' indicator and to
- * ensure resources are not leaked when their owner explodes in an
- * unplanned fashion.
- */
-
-static int memrar_release(struct inode *inode, struct file *filp)
-{
- /* Free all regions associated with the given file handle. */
-
- struct memrar_buffer_info *pos;
- struct memrar_buffer_info *tmp;
- int z;
-
- for (z = 0; z != MRST_NUM_RAR; ++z) {
- struct memrar_rar_info * const rar = &memrars[z];
-
- mutex_lock(&rar->lock);
-
- list_for_each_entry_safe(pos,
- tmp,
- &rar->buffers.list,
- list) {
- if (filp == pos->owner)
- kref_put(&pos->refcount,
- memrar_release_block_i);
- }
-
- mutex_unlock(&rar->lock);
- }
-
- return 0;
-}
-
-/**
- * rar_reserve - reserve RAR memory
- * @buffers: buffers to reserve
- * @count: number wanted
- *
- * Reserve a series of buffers in the RAR space. Returns the number of
- * buffers successfully allocated
- */
-
-size_t rar_reserve(struct RAR_buffer *buffers, size_t count)
-{
- struct RAR_buffer * const end =
- (buffers == NULL ? buffers : buffers + count);
- struct RAR_buffer *i;
-
- size_t reserve_count = 0;
-
- for (i = buffers; i != end; ++i) {
- if (memrar_reserve_block(i, NULL) == 0)
- ++reserve_count;
- else
- i->bus_address = 0;
- }
-
- return reserve_count;
-}
-EXPORT_SYMBOL(rar_reserve);
-
-/**
- * rar_release - return RAR buffers
- * @buffers: buffers to release
- * @size: size of released block
- *
- * Return a set of buffers to the RAR pool
- */
-
-size_t rar_release(struct RAR_buffer *buffers, size_t count)
-{
- struct RAR_buffer * const end =
- (buffers == NULL ? buffers : buffers + count);
- struct RAR_buffer *i;
-
- size_t release_count = 0;
-
- for (i = buffers; i != end; ++i) {
- u32 * const handle = &i->info.handle;
- if (memrar_release_block(*handle) == 0) {
- /*
- * @todo We assume we should do this each time
- * the ref count is decremented. Should
- * we instead only do this when the ref
- * count has dropped to zero, and the
- * buffer has been completely
- * released/unmapped?
- */
- *handle = 0;
- ++release_count;
- }
- }
-
- return release_count;
-}
-EXPORT_SYMBOL(rar_release);
-
-/**
- * rar_handle_to_bus - RAR to bus address
- * @buffers: RAR buffer structure
- * @count: number of buffers to convert
- *
- * Turn a list of RAR handle mappings into actual bus addresses. Note
- * that when the device is locked down the bus addresses in question
- * are not CPU accessible.
- */
-
-size_t rar_handle_to_bus(struct RAR_buffer *buffers, size_t count)
-{
- struct RAR_buffer * const end =
- (buffers == NULL ? buffers : buffers + count);
- struct RAR_buffer *i;
- struct memrar_buffer_info *pos;
-
- size_t conversion_count = 0;
-
- /*
- * Find all bus addresses corresponding to the given handles.
- *
- * @todo Not liking this nested loop. Optimize.
- */
- for (i = buffers; i != end; ++i) {
- struct memrar_rar_info * const rar =
- memrar_get_rar_info(i->info.handle);
-
- /*
- * Check if we have a bogus handle, and then continue
- * with remaining buffers.
- */
- if (rar == NULL) {
- i->bus_address = 0;
- continue;
- }
-
- mutex_lock(&rar->lock);
-
- list_for_each_entry(pos, &rar->buffers.list, list) {
- struct RAR_block_info * const user_info =
- &pos->buffer.info;
-
- /*
- * Take into account handle offsets that may
- * have been added to the base handle, such as
- * in the following scenario:
- *
- * u32 handle = base + offset;
- * rar_handle_to_bus(handle);
- */
-
- if (i->info.handle >= user_info->handle
- && i->info.handle < (user_info->handle
- + user_info->size)) {
- u32 const offset =
- i->info.handle - user_info->handle;
-
- i->info.type = user_info->type;
- i->info.size = user_info->size - offset;
- i->bus_address =
- pos->buffer.bus_address
- + offset;
-
- /* Increment the reference count. */
- kref_get(&pos->refcount);
-
- ++conversion_count;
- break;
- } else {
- i->bus_address = 0;
- }
- }
-
- mutex_unlock(&rar->lock);
- }
-
- return conversion_count;
-}
-EXPORT_SYMBOL(rar_handle_to_bus);
-
-static const struct file_operations memrar_fops = {
- .owner = THIS_MODULE,
- .unlocked_ioctl = memrar_ioctl,
- .mmap = memrar_mmap,
- .open = memrar_open,
- .release = memrar_release,
- .llseek = no_llseek,
-};
-
-static struct miscdevice memrar_miscdev = {
- .minor = MISC_DYNAMIC_MINOR, /* dynamic allocation */
- .name = "memrar", /* /dev/memrar */
- .fops = &memrar_fops
-};
-
-static char const banner[] __initdata =
- KERN_INFO
- "Intel RAR Handler: " MEMRAR_VER " initialized.\n";
-
-/**
- * memrar_registration_callback - RAR obtained
- * @rar: RAR number
- *
- * We have been granted ownership of the RAR. Add it to our memory
- * management tables
- */
-
-static int memrar_registration_callback(unsigned long rar)
-{
- /*
- * We initialize the RAR parameters early on so that we can
- * discontinue memrar device initialization and registration
- * if suitably configured RARs are not available.
- */
- return memrar_init_rar_resources(rar, memrar_miscdev.name);
-}
-
-/**
- * memrar_init - initialise RAR support
- *
- * Initialise support for RAR handlers. This may get loaded before
- * the RAR support is activated, but the callbacks on the registration
- * will handle that situation for us anyway.
- */
-
-static int __init memrar_init(void)
-{
- int err;
- int i;
-
- printk(banner);
-
- /*
- * Some delayed initialization is performed in this driver.
- * Make sure resources that are used during driver clean-up
- * (e.g. during driver's release() function) are fully
- * initialized before first use. This is particularly
- * important for the case when the delayed initialization
- * isn't completed, leaving behind a partially initialized
- * driver.
- *
- * Such a scenario can occur when RAR is not available on the
- * platform, and the driver is release()d.
- */
- for (i = 0; i != ARRAY_SIZE(memrars); ++i) {
- struct memrar_rar_info * const rar = &memrars[i];
- mutex_init(&rar->lock);
- INIT_LIST_HEAD(&rar->buffers.list);
- }
-
- err = misc_register(&memrar_miscdev);
- if (err)
- return err;
-
- /* Now claim the two RARs we want */
- err = register_rar(0, memrar_registration_callback, 0);
- if (err)
- goto fail;
-
- err = register_rar(1, memrar_registration_callback, 1);
- if (err == 0)
- return 0;
-
- /* It is possible rar 0 registered and allocated resources then rar 1
- failed so do a full resource free */
- memrar_fini_rar_resources();
-fail:
- misc_deregister(&memrar_miscdev);
- return err;
-}
-
-/**
- * memrar_exit - unregister and unload
- *
- * Unregister the device and then unload any mappings and release
- * the RAR resources
- */
-
-static void __exit memrar_exit(void)
-{
- misc_deregister(&memrar_miscdev);
- memrar_fini_rar_resources();
-}
-
-
-module_init(memrar_init);
-module_exit(memrar_exit);
-
-
-MODULE_AUTHOR("Ossama Othman <ossama.othman@intel.com>");
-MODULE_DESCRIPTION("Intel Restricted Access Region Handler");
-MODULE_LICENSE("GPL");
-MODULE_VERSION(MEMRAR_VER);
-
-
-
-/*
- Local Variables:
- c-file-style: "linux"
- End:
-*/
diff --git a/drivers/staging/msm/mdp4_overlay.c b/drivers/staging/msm/mdp4_overlay.c
index de284c28faa1..b9acf5299297 100644
--- a/drivers/staging/msm/mdp4_overlay.c
+++ b/drivers/staging/msm/mdp4_overlay.c
@@ -696,7 +696,7 @@ void mdp4_mixer_stage_down(struct mdp4_overlay_pipe *pipe)
stage = pipe->mixer_stage;
mixer = pipe->mixer_num;
- if (pipe != ctrl->stage[mixer][stage]) /* not runing */
+ if (pipe != ctrl->stage[mixer][stage]) /* not running */
return;
/* MDP_LAYERMIXER_IN_CFG, shard by both mixer 0 and 1 */
diff --git a/drivers/staging/msm/mdp_ppp_dq.c b/drivers/staging/msm/mdp_ppp_dq.c
index 3dc1c0cc61f9..3a687c7a5695 100644
--- a/drivers/staging/msm/mdp_ppp_dq.c
+++ b/drivers/staging/msm/mdp_ppp_dq.c
@@ -200,7 +200,7 @@ static void mdp_ppp_flush_dirty_djobs(void *cond)
msm_fb_ensure_mem_coherency_after_dma(job->info, &job->req, 1);
/* Schedule jobs for cleanup
- * A seperate worker thread does this */
+ * A separate worker thread does this */
queue_delayed_work(mdp_ppp_djob_clnr, &job->cleaner,
mdp_timer_duration);
}
diff --git a/drivers/staging/msm/msm_fb.c b/drivers/staging/msm/msm_fb.c
index a2f29d464051..e7ef836eb8de 100644
--- a/drivers/staging/msm/msm_fb.c
+++ b/drivers/staging/msm/msm_fb.c
@@ -859,7 +859,7 @@ static int msm_fb_register(struct msm_fb_data_type *mfd)
break;
default:
- MSM_FB_ERR("msm_fb_init: fb %d unkown image type!\n",
+ MSM_FB_ERR("msm_fb_init: fb %d unknown image type!\n",
mfd->index);
return ret;
}
@@ -1793,9 +1793,9 @@ static int msmfb_async_blit(struct fb_info *info, void __user *p)
/*
* NOTE: The userspace issues blit operations in a sequence, the sequence
* start with a operation marked START and ends in an operation marked
- * END. It is guranteed by the userspace that all the blit operations
+ * END. It is guaranteed by the userspace that all the blit operations
* between START and END are only within the regions of areas designated
- * by the START and END operations and that the userspace doesnt modify
+ * by the START and END operations and that the userspace doesn't modify
* those areas. Hence it would be enough to perform barrier/cache operations
* only on the START and END operations.
*/
diff --git a/drivers/staging/octeon/cvmx-cmd-queue.h b/drivers/staging/octeon/cvmx-cmd-queue.h
index 59d221422293..614653b686a0 100644
--- a/drivers/staging/octeon/cvmx-cmd-queue.h
+++ b/drivers/staging/octeon/cvmx-cmd-queue.h
@@ -214,7 +214,7 @@ static inline int __cvmx_cmd_queue_get_index(cvmx_cmd_queue_id_t queue_id)
/*
* Warning: This code currently only works with devices that
* have 256 queues or less. Devices with more than 16 queues
- * are layed out in memory to allow cores quick access to
+ * are laid out in memory to allow cores quick access to
* every 16th queue. This reduces cache thrashing when you are
* running 16 queues per port to support lockless operation.
*/
diff --git a/drivers/staging/octeon/cvmx-fpa.h b/drivers/staging/octeon/cvmx-fpa.h
index 50a8c91778fa..1f04f9658736 100644
--- a/drivers/staging/octeon/cvmx-fpa.h
+++ b/drivers/staging/octeon/cvmx-fpa.h
@@ -195,7 +195,7 @@ static inline void cvmx_fpa_async_alloc(uint64_t scr_addr, uint64_t pool)
cvmx_fpa_iobdma_data_t data;
/*
- * Hardware only uses 64 bit alligned locations, so convert
+ * Hardware only uses 64 bit aligned locations, so convert
* from byte address to 64-bit index
*/
data.s.scraddr = scr_addr >> 3;
diff --git a/drivers/staging/octeon/cvmx-helper-board.h b/drivers/staging/octeon/cvmx-helper-board.h
index 611a8e03c216..b465bec43553 100644
--- a/drivers/staging/octeon/cvmx-helper-board.h
+++ b/drivers/staging/octeon/cvmx-helper-board.h
@@ -81,7 +81,7 @@ extern int cvmx_helper_board_get_mii_address(int ipd_port);
* @phy_addr: The address of the PHY to program
* @link_flags:
* Flags to control autonegotiation. Bit 0 is autonegotiation
- * enable/disable to maintain backware compatability.
+ * enable/disable to maintain backware compatibility.
* @link_info: Link speed to program. If the speed is zero and autonegotiation
* is enabled, all possible negotiation speeds are advertised.
*
diff --git a/drivers/staging/octeon/cvmx-helper-util.c b/drivers/staging/octeon/cvmx-helper-util.c
index 41ef8a40bb03..131182bf5abb 100644
--- a/drivers/staging/octeon/cvmx-helper-util.c
+++ b/drivers/staging/octeon/cvmx-helper-util.c
@@ -362,7 +362,7 @@ int __cvmx_helper_setup_gmx(int interface, int num_ports)
}
/**
- * Returns the IPD/PKO port number for a port on teh given
+ * Returns the IPD/PKO port number for a port on the given
* interface.
*
* @interface: Interface to use
diff --git a/drivers/staging/octeon/cvmx-helper.c b/drivers/staging/octeon/cvmx-helper.c
index 591506643d02..e9c5c836ceff 100644
--- a/drivers/staging/octeon/cvmx-helper.c
+++ b/drivers/staging/octeon/cvmx-helper.c
@@ -691,7 +691,7 @@ int __cvmx_helper_errata_fix_ipd_ptr_alignment(void)
if (!retry_cnt)
cvmx_dprintf("WARNING: FIX_IPD_PTR_ALIGNMENT "
- "get_work() timeout occured.\n");
+ "get_work() timeout occurred.\n");
/* Free packet */
if (work)
diff --git a/drivers/staging/octeon/cvmx-mdio.h b/drivers/staging/octeon/cvmx-mdio.h
index f45dc49512f2..d88ab8d8e37d 100644
--- a/drivers/staging/octeon/cvmx-mdio.h
+++ b/drivers/staging/octeon/cvmx-mdio.h
@@ -254,7 +254,7 @@ typedef union {
#define MDIO_CLAUSE_45_READ_INC 2
#define MDIO_CLAUSE_45_READ 3
-/* MMD identifiers, mostly for accessing devices withing XENPAK modules. */
+/* MMD identifiers, mostly for accessing devices within XENPAK modules. */
#define CVMX_MMD_DEVICE_PMA_PMD 1
#define CVMX_MMD_DEVICE_WIS 2
#define CVMX_MMD_DEVICE_PCS 3
diff --git a/drivers/staging/octeon/cvmx-pko.h b/drivers/staging/octeon/cvmx-pko.h
index f068c1982497..de3412aada5d 100644
--- a/drivers/staging/octeon/cvmx-pko.h
+++ b/drivers/staging/octeon/cvmx-pko.h
@@ -98,7 +98,7 @@ typedef enum {
/*
* PKO doesn't do any locking. It is the responsibility of the
* application to make sure that no other core is accessing
- * the same queue at the smae time
+ * the same queue at the same time
*/
CVMX_PKO_LOCK_NONE = 0,
/*
@@ -324,7 +324,7 @@ static inline void cvmx_pko_doorbell(uint64_t port, uint64_t queue,
* - CVMX_PKO_LOCK_NONE
* - PKO doesn't do any locking. It is the responsibility
* of the application to make sure that no other core
- * is accessing the same queue at the smae time.
+ * is accessing the same queue at the same time.
* - CVMX_PKO_LOCK_ATOMIC_TAG
* - PKO performs an atomic tagswitch to insure exclusive
* access to the output queue. This will maintain
diff --git a/drivers/staging/octeon/cvmx-pow.h b/drivers/staging/octeon/cvmx-pow.h
index bf9e069a898c..999aefe3274c 100644
--- a/drivers/staging/octeon/cvmx-pow.h
+++ b/drivers/staging/octeon/cvmx-pow.h
@@ -1492,8 +1492,8 @@ static inline void cvmx_pow_tag_sw_full(cvmx_wqe_t *wqp, uint32_t tag,
/**
* Switch to a NULL tag, which ends any ordering or
* synchronization provided by the POW for the current
- * work queue entry. This operation completes immediatly,
- * so completetion should not be waited for.
+ * work queue entry. This operation completes immediately,
+ * so completion should not be waited for.
* This function does NOT wait for previous tag switches to complete,
* so the caller must ensure that any previous tag switches have completed.
*/
@@ -1532,8 +1532,8 @@ static inline void cvmx_pow_tag_sw_null_nocheck(void)
/**
* Switch to a NULL tag, which ends any ordering or
* synchronization provided by the POW for the current
- * work queue entry. This operation completes immediatly,
- * so completetion should not be waited for.
+ * work queue entry. This operation completes immediately,
+ * so completion should not be waited for.
* This function waits for any pending tag switches to complete
* before requesting the switch to NULL.
*/
@@ -1672,7 +1672,7 @@ static inline void cvmx_pow_set_priority(uint64_t core_num,
/**
* Performs a tag switch and then an immediate deschedule. This completes
- * immediatly, so completion must not be waited for. This function does NOT
+ * immediately, so completion must not be waited for. This function does NOT
* update the wqe in DRAM to match arguments.
*
* This function does NOT wait for any prior tag switches to complete, so the
@@ -1758,7 +1758,7 @@ static inline void cvmx_pow_tag_sw_desched_nocheck(
/**
* Performs a tag switch and then an immediate deschedule. This completes
- * immediatly, so completion must not be waited for. This function does NOT
+ * immediately, so completion must not be waited for. This function does NOT
* update the wqe in DRAM to match arguments.
*
* This function waits for any prior tag switches to complete, so the
diff --git a/drivers/staging/octeon/ethernet-util.h b/drivers/staging/octeon/ethernet-util.h
index 23467563fe57..c745a72a0594 100644
--- a/drivers/staging/octeon/ethernet-util.h
+++ b/drivers/staging/octeon/ethernet-util.h
@@ -55,7 +55,7 @@ static inline int INTERFACE(int ipd_port)
return 2;
else if (ipd_port < 40) /* Interface 3 for loopback */
return 3;
- else if (ipd_port == 40) /* Non existant interface for POW0 */
+ else if (ipd_port == 40) /* Non existent interface for POW0 */
return 4;
else
panic("Illegal ipd_port %d passed to INTERFACE\n", ipd_port);
diff --git a/drivers/staging/olpc_dcon/Kconfig b/drivers/staging/olpc_dcon/Kconfig
index f1082f50fdce..b05306766870 100644
--- a/drivers/staging/olpc_dcon/Kconfig
+++ b/drivers/staging/olpc_dcon/Kconfig
@@ -9,7 +9,7 @@ config FB_OLPC_DCON
config FB_OLPC_DCON_1
bool "OLPC XO-1 DCON support"
- depends on FB_OLPC_DCON
+ depends on FB_OLPC_DCON && GPIO_CS5535
default y
---help---
Enable support for the DCON in XO-1 model laptops. The kernel
diff --git a/drivers/staging/olpc_dcon/olpc_dcon.c b/drivers/staging/olpc_dcon/olpc_dcon.c
index b90c2cf3e247..750fe5045efa 100644
--- a/drivers/staging/olpc_dcon/olpc_dcon.c
+++ b/drivers/staging/olpc_dcon/olpc_dcon.c
@@ -574,6 +574,7 @@ static const struct backlight_ops dcon_bl_ops = {
static struct backlight_properties dcon_bl_props = {
.max_brightness = 15,
+ .type = BACKLIGHT_RAW,
.power = FB_BLANK_UNBLANK,
};
diff --git a/drivers/staging/olpc_dcon/olpc_dcon_xo_1.c b/drivers/staging/olpc_dcon/olpc_dcon_xo_1.c
index b154be7a2fe6..22c04eabed41 100644
--- a/drivers/staging/olpc_dcon/olpc_dcon_xo_1.c
+++ b/drivers/staging/olpc_dcon/olpc_dcon_xo_1.c
@@ -12,6 +12,7 @@
*/
#include <linux/cs5535.h>
#include <linux/gpio.h>
+#include <linux/delay.h>
#include <asm/olpc.h>
#include "olpc_dcon.h"
@@ -80,7 +81,7 @@ static int dcon_init_xo_1(struct dcon_priv *dcon)
lob &= ~(1 << DCON_IRQ);
outb(lob, 0x4d0);
- /* Register the interupt handler */
+ /* Register the interrupt handler */
if (request_irq(DCON_IRQ, &dcon_interrupt, 0, "DCON", dcon)) {
printk(KERN_ERR "olpc-dcon: failed to request DCON's irq\n");
goto err_req_irq;
diff --git a/drivers/staging/olpc_dcon/olpc_dcon_xo_1_5.c b/drivers/staging/olpc_dcon/olpc_dcon_xo_1_5.c
index e213b63f8116..7aa9b1a45bd6 100644
--- a/drivers/staging/olpc_dcon/olpc_dcon_xo_1_5.c
+++ b/drivers/staging/olpc_dcon/olpc_dcon_xo_1_5.c
@@ -7,6 +7,7 @@
*/
#include <linux/acpi.h>
+#include <linux/delay.h>
#include <linux/pci.h>
#include <linux/gpio.h>
#include <asm/olpc.h>
diff --git a/drivers/staging/pohmelfs/crypto.c b/drivers/staging/pohmelfs/crypto.c
index 6540864216c8..5cca24fcf6ca 100644
--- a/drivers/staging/pohmelfs/crypto.c
+++ b/drivers/staging/pohmelfs/crypto.c
@@ -745,7 +745,7 @@ static int pohmelfs_crypto_init_handshake(struct pohmelfs_sb *psb)
/*
* At this point NETFS_CAPABILITIES response command
- * should setup superblock in a way, which is acceptible
+ * should setup superblock in a way, which is acceptable
* for both client and server, so if server refuses connection,
* it will send error in transaction response.
*/
diff --git a/drivers/staging/quatech_usb2/quatech_usb2.c b/drivers/staging/quatech_usb2/quatech_usb2.c
index c45b09ed0d35..ca098cabc2bc 100644
--- a/drivers/staging/quatech_usb2/quatech_usb2.c
+++ b/drivers/staging/quatech_usb2/quatech_usb2.c
@@ -148,7 +148,7 @@ static struct usb_driver quausb2_usb_driver = {
* value of the line status flags from the port
* @shadowMSR: Last received state of the modem status register, holds
* the value of the modem status received from the port
- * @rcv_flush: Flag indicating that a receive flush has occured on
+ * @rcv_flush: Flag indicating that a receive flush has occurred on
* the hardware.
* @xmit_flush: Flag indicating that a transmit flush has been processed by
* the hardware.
@@ -156,7 +156,7 @@ static struct usb_driver quausb2_usb_driver = {
* includes the size (excluding header) of URBs that have been submitted but
* have not yet been sent to to the device, and bytes that have been sent out
* of the port but not yet reported sent by the "xmit_empty" messages (which
- * indicate the number of bytes sent each time they are recieved, despite the
+ * indicate the number of bytes sent each time they are received, despite the
* misleading name).
* - Starts at zero when port is initialised.
* - is incremented by the size of the data to be written (no headers)
@@ -649,7 +649,7 @@ static void qt2_close(struct usb_serial_port *port)
/* although the USB side is now empty, the UART itself may
* still be pushing characters out over the line, so we have to
* wait testing the actual line status until the lines change
- * indicating that the data is done transfering. */
+ * indicating that the data is done transferring. */
/* FIXME: slow this polling down so it doesn't run the USB bus flat out
* if it actually has to spend any time in this loop (which it normally
* doesn't because the buffer is nearly empty) */
@@ -726,7 +726,7 @@ static int qt2_write(struct tty_struct *tty, struct usb_serial_port *port,
return 0;
} else if (port_extra->tx_pending_bytes >= QT2_FIFO_DEPTH) {
/* buffer is full (==). > should not occur, but would indicate
- * that an overflow had occured */
+ * that an overflow had occurred */
dbg("%s(): port transmit buffer is full!", __func__);
/* schedule_work(&port->work); commented in vendor driver */
return 0;
@@ -823,7 +823,7 @@ static int qt2_write_room(struct tty_struct *tty)
* reduce the free space count by the size of the dispatched write.
* When a "transmit empty" message comes back up the USB read stream,
* we decrement the count by the number of bytes reported sent, thus
- * keeping track of the difference between sent and recieved bytes.
+ * keeping track of the difference between sent and received bytes.
*/
room = (QT2_FIFO_DEPTH - port_extra->tx_pending_bytes);
@@ -1795,7 +1795,7 @@ static void qt2_process_rx_char(struct usb_serial_port *port,
}
}
-/** @brief Retreive the value of a register from the device
+/** @brief Retrieve the value of a register from the device
*
* Issues a GET_REGISTER vendor-spcific request over the USB control
* pipe to obtain a value back from a specific register on a specific
diff --git a/drivers/staging/rt2860/chip/rtmp_phy.h b/drivers/staging/rt2860/chip/rtmp_phy.h
index 98454df30a22..a52221f1294e 100644
--- a/drivers/staging/rt2860/chip/rtmp_phy.h
+++ b/drivers/staging/rt2860/chip/rtmp_phy.h
@@ -467,7 +467,7 @@
DBGPRINT_ERR("BBP write R%d=0x%x fail. BusyCnt= %d.bPCIclkOff = %d. \n", _I, BbpCsr.word, BusyCnt, (_A)->bPCIclkOff); \
} \
} else { \
- DBGPRINT_ERR("****** BBP_Write_Latch Buffer exceeds max boundry ****** \n"); \
+ DBGPRINT_ERR("****** BBP_Write_Latch Buffer exceeds max boundary ****** \n"); \
} \
}
#endif /* RTMP_MAC_PCI // */
diff --git a/drivers/staging/rt2860/common/ba_action.c b/drivers/staging/rt2860/common/ba_action.c
index 62f6f6be4acb..133bc1b87d2c 100644
--- a/drivers/staging/rt2860/common/ba_action.c
+++ b/drivers/staging/rt2860/common/ba_action.c
@@ -28,7 +28,7 @@
#include "../rt_config.h"
#include <linux/kernel.h>
-#define BA_ORI_INIT_SEQ (pEntry->TxSeq[TID]) /*1 // inital sequence number of BA session */
+#define BA_ORI_INIT_SEQ (pEntry->TxSeq[TID]) /*1 // initial sequence number of BA session */
#define ORI_SESSION_MAX_RETRY 8
#define ORI_BA_SESSION_TIMEOUT (2000) /* ms */
@@ -1487,7 +1487,7 @@ static void ba_enqueue_reordering_packet(struct rt_rtmp_adapter *pAd,
/*
* flush all pending reordering mpdus
- * and receving mpdu to upper layer
+ * and receiving mpdu to upper layer
* make tcp/ip to take care reordering mechanism
*/
/*ba_refresh_reordering_mpdus(pAd, pBAEntry); */
diff --git a/drivers/staging/rt2860/common/cmm_aes.c b/drivers/staging/rt2860/common/cmm_aes.c
index a99879bada42..d70d229a6e53 100644
--- a/drivers/staging/rt2860/common/cmm_aes.c
+++ b/drivers/staging/rt2860/common/cmm_aes.c
@@ -858,7 +858,7 @@ static uint32 KT1[256];
static uint32 KT2[256];
static uint32 KT3[256];
-/* platform-independant 32-bit integer manipulation macros */
+/* platform-independent 32-bit integer manipulation macros */
#define GET_UINT32(n,b,i) \
{ \
diff --git a/drivers/staging/rt2860/common/cmm_cfg.c b/drivers/staging/rt2860/common/cmm_cfg.c
index 24f439378439..727f79929258 100644
--- a/drivers/staging/rt2860/common/cmm_cfg.c
+++ b/drivers/staging/rt2860/common/cmm_cfg.c
@@ -223,7 +223,7 @@ int RT_CfgSetWepKey(struct rt_rtmp_adapter *pAd,
pAdapter Pointer to our adapter
keyString WPA pre-shared key string
pHashStr String used for password hash function
- hashStrLen Lenght of the hash string
+ hashStrLen Length of the hash string
pPMKBuf Output buffer of WPAPSK key
Return:
diff --git a/drivers/staging/rt2860/common/cmm_data.c b/drivers/staging/rt2860/common/cmm_data.c
index f6c193cb84ee..33799e1449ae 100644
--- a/drivers/staging/rt2860/common/cmm_data.c
+++ b/drivers/staging/rt2860/common/cmm_data.c
@@ -337,7 +337,7 @@ int MlmeHardTransmitMgmtRing(struct rt_rtmp_adapter *pAd,
/* */
/* In WMM-UAPSD, mlme frame should be set psm as power saving but probe request frame */
- /* Data-Null packets alse pass through MMRequest in RT2860, however, we hope control the psm bit to pass APSD */
+ /* Data-Null packets also pass through MMRequest in RT2860, however, we hope control the psm bit to pass APSD */
/* if ((pHeader_802_11->FC.Type != BTYPE_DATA) && (pHeader_802_11->FC.Type != BTYPE_CNTL)) */
{
if ((pHeader_802_11->FC.SubType == SUBTYPE_ACTION) ||
@@ -1933,7 +1933,7 @@ BOOLEAN RTMPCheckEtherType(struct rt_rtmp_adapter *pAd, void *pPacket)
if (TypeLen <= 1500) { /* 802.3, 802.3 LLC */
/*
- DestMAC(6) + SrcMAC(6) + Lenght(2) +
+ DestMAC(6) + SrcMAC(6) + Length(2) +
DSAP(1) + SSAP(1) + Control(1) +
if the DSAP = 0xAA, SSAP=0xAA, Contorl = 0x03, it has a 5-bytes SNAP header.
=> + SNAP (5, OriginationID(3) + etherType(2))
diff --git a/drivers/staging/rt2860/common/cmm_data_pci.c b/drivers/staging/rt2860/common/cmm_data_pci.c
index 7af59ff9e220..f01a51c381f1 100644
--- a/drivers/staging/rt2860/common/cmm_data_pci.c
+++ b/drivers/staging/rt2860/common/cmm_data_pci.c
@@ -438,13 +438,13 @@ int RTMPCheckRxError(struct rt_rtmp_adapter *pAd,
/* Add Rx size to channel load counter, we should ignore error counts */
pAd->StaCfg.CLBusyBytes += (pRxD->SDL0 + 14);
- /* Drop ToDs promiscous frame, it is opened due to CCX 2 channel load statistics */
+ /* Drop ToDs promiscuous frame, it is opened due to CCX 2 channel load statistics */
if (pHeader != NULL) {
if (pHeader->FC.ToDs) {
return (NDIS_STATUS_FAILURE);
}
}
- /* Drop not U2M frames, cant's drop here because we will drop beacon in this case */
+ /* Drop not U2M frames, can't drop here because we will drop beacon in this case */
/* I am kind of doubting the U2M bit operation */
/* if (pRxD->U2M == 0) */
/* return(NDIS_STATUS_FAILURE); */
@@ -939,7 +939,7 @@ int MlmeHardTransmitTxRing(struct rt_rtmp_adapter *pAd,
/* */
/* */
/* In WMM-UAPSD, mlme frame should be set psm as power saving but probe request frame */
- /* Data-Null packets alse pass through MMRequest in RT2860, however, we hope control the psm bit to pass APSD */
+ /* Data-Null packets also pass through MMRequest in RT2860, however, we hope control the psm bit to pass APSD */
if (pHeader_802_11->FC.Type != BTYPE_DATA) {
if ((pHeader_802_11->FC.SubType == SUBTYPE_PROBE_REQ)
|| !(pAd->CommonCfg.bAPSDCapable
diff --git a/drivers/staging/rt2860/common/cmm_data_usb.c b/drivers/staging/rt2860/common/cmm_data_usb.c
index 7c56c2f51987..83a62faa7e57 100644
--- a/drivers/staging/rt2860/common/cmm_data_usb.c
+++ b/drivers/staging/rt2860/common/cmm_data_usb.c
@@ -702,7 +702,7 @@ Arguments:
*pRxPending pending received packet flag
Return Value:
- the recieved packet
+ the received packet
Note:
========================================================================
@@ -850,7 +850,7 @@ int RTMPCheckRxError(struct rt_rtmp_adapter *pAd,
/* Add Rx size to channel load counter, we should ignore error counts */
pAd->StaCfg.CLBusyBytes += (pRxWI->MPDUtotalByteCount + 14);
- /* Drop ToDs promiscous frame, it is opened due to CCX 2 channel load statistics */
+ /* Drop ToDs promiscuous frame, it is opened due to CCX 2 channel load statistics */
if (pHeader->FC.ToDs) {
DBGPRINT_RAW(RT_DEBUG_ERROR, ("Err;FC.ToDs\n"));
return NDIS_STATUS_FAILURE;
@@ -860,7 +860,7 @@ int RTMPCheckRxError(struct rt_rtmp_adapter *pAd,
DBGPRINT_RAW(RT_DEBUG_ERROR, ("received packet too long\n"));
return NDIS_STATUS_FAILURE;
}
- /* Drop not U2M frames, cant's drop here because we will drop beacon in this case */
+ /* Drop not U2M frames, can't drop here because we will drop beacon in this case */
/* I am kind of doubting the U2M bit operation */
/* if (pRxD->U2M == 0) */
/* return(NDIS_STATUS_FAILURE); */
diff --git a/drivers/staging/rt2860/common/cmm_mac_pci.c b/drivers/staging/rt2860/common/cmm_mac_pci.c
index 21eed2507e1c..d06f0a6dc379 100644
--- a/drivers/staging/rt2860/common/cmm_mac_pci.c
+++ b/drivers/staging/rt2860/common/cmm_mac_pci.c
@@ -1446,7 +1446,7 @@ BOOLEAN RT28xxPciAsicRadioOff(struct rt_rtmp_adapter *pAd,
pAd->CheckDmaBusyCount = 0;
}
*/
-/*KH Debug:My original codes have the follwoing codes, but currecnt codes do not have it. */
+/*KH Debug:My original codes have the following codes, but currecnt codes do not have it. */
/* Disable for stability. If PCIE Link Control is modified for advance power save, re-covery this code segment. */
RTMP_IO_WRITE32(pAd, PBF_SYS_CTRL, 0x1280);
/*OPSTATUS_SET_FLAG(pAd, fOP_STATUS_CLKSELECT_40MHZ); */
diff --git a/drivers/staging/rt2860/common/cmm_sanity.c b/drivers/staging/rt2860/common/cmm_sanity.c
index 6b003c903444..3bfb4ad00c1a 100644
--- a/drivers/staging/rt2860/common/cmm_sanity.c
+++ b/drivers/staging/rt2860/common/cmm_sanity.c
@@ -67,7 +67,7 @@ BOOLEAN MlmeAddBAReqSanity(struct rt_rtmp_adapter *pAd,
if ((MsgLen != sizeof(struct rt_mlme_addba_req))) {
DBGPRINT(RT_DEBUG_TRACE,
- ("MlmeAddBAReqSanity fail - message lenght not correct.\n"));
+ ("MlmeAddBAReqSanity fail - message length not correct.\n"));
return FALSE;
}
@@ -104,7 +104,7 @@ BOOLEAN MlmeDelBAReqSanity(struct rt_rtmp_adapter *pAd, void * Msg, unsigned lon
if ((MsgLen != sizeof(struct rt_mlme_delba_req))) {
DBGPRINT(RT_DEBUG_ERROR,
- ("MlmeDelBAReqSanity fail - message lenght not correct.\n"));
+ ("MlmeDelBAReqSanity fail - message length not correct.\n"));
return FALSE;
}
diff --git a/drivers/staging/rt2860/common/cmm_sync.c b/drivers/staging/rt2860/common/cmm_sync.c
index f84194da47bc..aefe1b774650 100644
--- a/drivers/staging/rt2860/common/cmm_sync.c
+++ b/drivers/staging/rt2860/common/cmm_sync.c
@@ -694,7 +694,7 @@ void ScanNextChannel(struct rt_rtmp_adapter *pAd)
MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen);
MlmeFreeMemory(pAd, pOutBuffer);
}
- /* For SCAN_CISCO_PASSIVE, do nothing and silently wait for beacon or other probe reponse */
+ /* For SCAN_CISCO_PASSIVE, do nothing and silently wait for beacon or other probe response */
pAd->Mlme.SyncMachine.CurrState = SCAN_LISTEN;
}
diff --git a/drivers/staging/rt2860/common/cmm_wpa.c b/drivers/staging/rt2860/common/cmm_wpa.c
index 0040f45b629b..616ebec50c61 100644
--- a/drivers/staging/rt2860/common/cmm_wpa.c
+++ b/drivers/staging/rt2860/common/cmm_wpa.c
@@ -1222,7 +1222,7 @@ void PeerGroupMsg2Action(struct rt_rtmp_adapter *pAd,
Note:
All these constants are defined in wpa.h
- For supplicant, there is only EAPOL Key message avaliable
+ For supplicant, there is only EAPOL Key message available
========================================================================
*/
@@ -1267,7 +1267,7 @@ BOOLEAN WpaMsgTypeSubst(u8 EAPType, int * MsgType)
int prefix_len - the length of the label
u8 *data - a specific data with variable length
int data_len - the length of a specific data
- int len - the output lenght
+ int len - the output length
Return Value:
u8 *output - the calculated result
diff --git a/drivers/staging/rt2860/common/mlme.c b/drivers/staging/rt2860/common/mlme.c
index d9c3fd5c2166..e48eac0f3a29 100644
--- a/drivers/staging/rt2860/common/mlme.c
+++ b/drivers/staging/rt2860/common/mlme.c
@@ -632,7 +632,7 @@ void MlmeHalt(struct rt_rtmp_adapter *pAd)
pChipOps->AsicHaltAction(pAd);
}
- RTMPusecDelay(5000); /* 5 msec to gurantee Ant Diversity timer canceled */
+ RTMPusecDelay(5000); /* 5 msec to guarantee Ant Diversity timer canceled */
MlmeQueueDestroy(&pAd->Mlme.Queue);
NdisFreeSpinLock(&pAd->Mlme.TaskLock);
@@ -1107,14 +1107,14 @@ void MlmeSelectTxRateTable(struct rt_rtmp_adapter *pAd,
*pInitTxRateIdx =
RateSwitchTable11N1S[1];
DBGPRINT_RAW(RT_DEBUG_ERROR,
- ("DRS: unkown mode,default use 11N 1S AP \n"));
+ ("DRS: unknown mode,default use 11N 1S AP \n"));
} else {
*ppTable = RateSwitchTable11N2S;
*pTableSize = RateSwitchTable11N2S[0];
*pInitTxRateIdx =
RateSwitchTable11N2S[1];
DBGPRINT_RAW(RT_DEBUG_ERROR,
- ("DRS: unkown mode,default use 11N 2S AP \n"));
+ ("DRS: unknown mode,default use 11N 2S AP \n"));
}
} else {
if (pAd->CommonCfg.TxStream == 1) {
@@ -1123,7 +1123,7 @@ void MlmeSelectTxRateTable(struct rt_rtmp_adapter *pAd,
*pInitTxRateIdx =
RateSwitchTable11N1S[1];
DBGPRINT_RAW(RT_DEBUG_ERROR,
- ("DRS: unkown mode,default use 11N 1S AP \n"));
+ ("DRS: unknown mode,default use 11N 1S AP \n"));
} else {
*ppTable = RateSwitchTable11N2SForABand;
*pTableSize =
@@ -1131,11 +1131,11 @@ void MlmeSelectTxRateTable(struct rt_rtmp_adapter *pAd,
*pInitTxRateIdx =
RateSwitchTable11N2SForABand[1];
DBGPRINT_RAW(RT_DEBUG_ERROR,
- ("DRS: unkown mode,default use 11N 2S AP \n"));
+ ("DRS: unknown mode,default use 11N 2S AP \n"));
}
}
DBGPRINT_RAW(RT_DEBUG_ERROR,
- ("DRS: unkown mode (SupRateLen=%d, ExtRateLen=%d, MCSSet[0]=0x%x, MCSSet[1]=0x%x)\n",
+ ("DRS: unknown mode (SupRateLen=%d, ExtRateLen=%d, MCSSet[0]=0x%x, MCSSet[1]=0x%x)\n",
pAd->StaActive.SupRateLen,
pAd->StaActive.ExtRateLen,
pAd->StaActive.SupportedPhyInfo.MCSSet[0],
@@ -1368,7 +1368,7 @@ void STAMlmePeriodicExec(struct rt_rtmp_adapter *pAd)
if ((pAd->StaCfg.LastScanTime +
10 * OS_HZ) < pAd->Mlme.Now32) {
DBGPRINT(RT_DEBUG_TRACE,
- ("MMCHK - Roaming, No eligable entry, try new scan!\n"));
+ ("MMCHK - Roaming, No eligible entry, try new scan!\n"));
pAd->StaCfg.ScanCnt = 2;
pAd->StaCfg.LastScanTime =
pAd->Mlme.Now32;
@@ -2828,7 +2828,7 @@ void UpdateBasicRateBitmap(struct rt_rtmp_adapter *pAdapter)
/* IRQL = PASSIVE_LEVEL */
/* IRQL = DISPATCH_LEVEL */
-/* bLinkUp is to identify the inital link speed. */
+/* bLinkUp is to identify the initial link speed. */
/* TRUE indicates the rate update at linkup, we should not try to set the rate at 54Mbps. */
void MlmeUpdateTxRates(struct rt_rtmp_adapter *pAd, IN BOOLEAN bLinkUp, u8 apidx)
{
diff --git a/drivers/staging/rt2860/common/rtmp_init.c b/drivers/staging/rt2860/common/rtmp_init.c
index d359a14f5d4d..5fa193eac0d3 100644
--- a/drivers/staging/rt2860/common/rtmp_init.c
+++ b/drivers/staging/rt2860/common/rtmp_init.c
@@ -2037,7 +2037,7 @@ void NICUpdateFifoStaCounters(struct rt_rtmp_adapter *pAd)
pEntry->FIFOCount = 0;
pEntry->OneSecTxNoRetryOkCount++;
- /* update NoDataIdleCount when sucessful send packet to STA. */
+ /* update NoDataIdleCount when successful send packet to STA. */
pEntry->NoDataIdleCount = 0;
pEntry->ContinueTxFailCnt = 0;
}
@@ -2516,7 +2516,7 @@ void UserCfgInit(struct rt_rtmp_adapter *pAd)
/*pAd->TurnAggrBulkInCount = 0; */
pAd->bUsbTxBulkAggre = 0;
- /* init as unsed value to ensure driver will set to MCU once. */
+ /* init as unused value to ensure driver will set to MCU once. */
pAd->LedIndicatorStrength = 0xFF;
pAd->CommonCfg.MaxPktOneTxBulk = 2;
@@ -3076,11 +3076,11 @@ void RTMPSetLED(struct rt_rtmp_adapter *pAd, u8 Status)
========================================================================
Routine Description:
- Set LED Signal Stregth
+ Set LED Signal Strength
Arguments:
pAd Pointer to our adapter
- Dbm Signal Stregth
+ Dbm Signal Strength
Return Value:
None
@@ -3090,7 +3090,7 @@ void RTMPSetLED(struct rt_rtmp_adapter *pAd, u8 Status)
Note:
Can be run on any IRQL level.
- According to Microsoft Zero Config Wireless Signal Stregth definition as belows.
+ According to Microsoft Zero Config Wireless Signal Strength definition as belows.
<= -90 No Signal
<= -81 Very Low
<= -71 Low
@@ -3118,7 +3118,7 @@ void RTMPSetSignalLED(struct rt_rtmp_adapter *pAd, IN NDIS_802_11_RSSI Dbm)
nLed = 31;
/* */
- /* Update Signal Stregth to firmware if changed. */
+ /* Update Signal Strength to firmware if changed. */
/* */
if (pAd->LedIndicatorStrength != nLed) {
AsicSendCommandToMcu(pAd, 0x51, 0xff, nLed,
@@ -3166,7 +3166,7 @@ void RTMPEnableRxTx(struct rt_rtmp_adapter *pAd)
if (pAd->CommonCfg.PSPXlink)
rx_filter_flag = PSPXLINK;
else
- rx_filter_flag = STANORMAL; /* Staion not drop control frame will fail WiFi Certification. */
+ rx_filter_flag = STANORMAL; /* Station not drop control frame will fail WiFi Certification. */
RTMP_IO_WRITE32(pAd, RX_FILTR_CFG, rx_filter_flag);
}
diff --git a/drivers/staging/rt2860/common/spectrum.c b/drivers/staging/rt2860/common/spectrum.c
index c0d2f428069c..ceb622df12d7 100644
--- a/drivers/staging/rt2860/common/spectrum.c
+++ b/drivers/staging/rt2860/common/spectrum.c
@@ -1058,8 +1058,8 @@ static void InsertMeasureReqIE(struct rt_rtmp_adapter *pAd,
3. Measure Token.
4. Measure Request Mode.
5. Measure Request Type.
- 6. Length of Report Infomation
- 7. Pointer of Report Infomation Buffer.
+ 6. Length of Report Information
+ 7. Pointer of Report Information Buffer.
Return : None.
==========================================================================
@@ -1400,7 +1400,7 @@ static void StartDFSProcedure(struct rt_rtmp_adapter *pAd,
Parametrs:
1. MLME message containing the received frame
2. message length.
- 3. Channel switch announcement infomation buffer.
+ 3. Channel switch announcement information buffer.
Return : None.
==========================================================================
@@ -1465,7 +1465,7 @@ static BOOLEAN PeerChSwAnnSanity(struct rt_rtmp_adapter *pAd,
Parametrs:
1. MLME message containing the received frame
2. message length.
- 3. Measurement request infomation buffer.
+ 3. Measurement request information buffer.
Return : None.
==========================================================================
@@ -1538,8 +1538,8 @@ static BOOLEAN PeerMeasureReqSanity(struct rt_rtmp_adapter *pAd,
Parametrs:
1. MLME message containing the received frame
2. message length.
- 3. Measurement report infomation buffer.
- 4. basic report infomation buffer.
+ 3. Measurement report information buffer.
+ 4. basic report information buffer.
Return : None.
==========================================================================
diff --git a/drivers/staging/rt2860/mlme.h b/drivers/staging/rt2860/mlme.h
index cd1ee3d7a91d..a285851692ee 100644
--- a/drivers/staging/rt2860/mlme.h
+++ b/drivers/staging/rt2860/mlme.h
@@ -374,7 +374,7 @@ struct PACKED rt_sec_cha_offset_ie {
struct rt_ht_phy_info {
BOOLEAN bHtEnable; /* If we should use ht rate. */
BOOLEAN bPreNHt; /* If we should use ht rate. */
- /*Substract from HT Capability IE */
+ /*Subtract from HT Capability IE */
u8 MCSSet[16];
};
@@ -392,7 +392,7 @@ struct rt_ht_capability {
u16 AmsduSize:1; /* Max receiving A-MSDU size */
u16 rsv:5;
- /*Substract from Addiont HT INFO IE */
+ /*Subtract from Addiont HT INFO IE */
u8 MaxRAmpduFactor:2;
u8 MpduDensity:3;
u8 ExtChanOffset:2; /* Please note the difference with following u8 NewExtChannelOffset; from 802.11n */
@@ -410,7 +410,7 @@ struct rt_ht_capability {
u8 BSSCoexist2040;
};
-/* field in Addtional HT Information IE . */
+/* field in Additional HT Information IE . */
struct PACKED rt_add_htinfo {
u8 ExtChanOffset:2;
u8 RecomWidth:1;
@@ -857,7 +857,7 @@ struct rt_state_machine {
};
/* MLME AUX data structure that holds temporarliy settings during a connection attempt. */
-/* Once this attemp succeeds, all settings will be copy to pAd->StaActive. */
+/* Once this attempt succeeds, all settings will be copy to pAd->StaActive. */
/* A connection attempt (user set OID, roaming, CCX fast roaming,..) consists of */
/* several steps (JOIN, AUTH, ASSOC or REASSOC) and may fail at any step. We purposely */
/* separate this under-trial settings away from pAd->StaActive so that once */
diff --git a/drivers/staging/rt2860/rt_linux.c b/drivers/staging/rt2860/rt_linux.c
index e5b042712430..1583347fcd52 100644
--- a/drivers/staging/rt2860/rt_linux.c
+++ b/drivers/staging/rt2860/rt_linux.c
@@ -283,7 +283,7 @@ BOOLEAN OS_Need_Clone_Packet(void)
Arguments:
pAd Pointer to our adapter
pInsAMSDUHdr EWC A-MSDU format has extra 14-bytes header. if TRUE, insert this 14-byte hdr in front of MSDU.
- *pSrcTotalLen return total packet length. This lenght is calculated with 802.3 format packet.
+ *pSrcTotalLen return total packet length. This length is calculated with 802.3 format packet.
Return Value:
NDIS_STATUS_SUCCESS
diff --git a/drivers/staging/rt2860/rt_pci_rbus.c b/drivers/staging/rt2860/rt_pci_rbus.c
index e5fb67cd9a68..f80ab4e6a0ac 100644
--- a/drivers/staging/rt2860/rt_pci_rbus.c
+++ b/drivers/staging/rt2860/rt_pci_rbus.c
@@ -619,7 +619,7 @@ IRQ_HANDLE_TYPE rt2860_interrupt(int irq, void *dev_instance)
Or kernel will panic after ifconfig ra0 down sometimes */
/* */
- /* Inital the Interrupt source. */
+ /* Initial the Interrupt source. */
/* */
IntSource.word = 0x00000000L;
/* McuIntSource.word = 0x00000000L; */
diff --git a/drivers/staging/rt2860/rtmp.h b/drivers/staging/rt2860/rtmp.h
index d16b06a6e2ac..3c31340c946a 100644
--- a/drivers/staging/rt2860/rtmp.h
+++ b/drivers/staging/rt2860/rtmp.h
@@ -756,7 +756,7 @@ struct rt_tkip_key_info {
/* */
struct rt_private {
u32 SystemResetCnt; /* System reset counter */
- u32 TxRingFullCnt; /* Tx ring full occurrance number */
+ u32 TxRingFullCnt; /* Tx ring full occurrence number */
u32 PhyRxErrCnt; /* PHY Rx error count, for debug purpose, might move to global counter */
/* Variables for WEP encryption / decryption in rtmp_wep.c */
u32 FCSCRC32;
@@ -925,7 +925,7 @@ struct rt_mlme {
**************************************************************************/
struct reordering_mpdu {
struct reordering_mpdu *next;
- void *pPacket; /* coverted to 802.3 frame */
+ void *pPacket; /* converted to 802.3 frame */
int Sequence; /* sequence number of MPDU */
BOOLEAN bAMSDU;
};
diff --git a/drivers/staging/rt2860/sta_ioctl.c b/drivers/staging/rt2860/sta_ioctl.c
index 5717e12a9544..49b1013e7a03 100644
--- a/drivers/staging/rt2860/sta_ioctl.c
+++ b/drivers/staging/rt2860/sta_ioctl.c
@@ -2460,7 +2460,7 @@ int rt28xx_sta_ioctl(IN struct net_device *net_dev,
}
}
- { /* determine this ioctl command is comming from which interface. */
+ { /* determine this ioctl command is coming from which interface. */
pObj->ioctl_if_type = INT_MAIN;
pObj->ioctl_if = MAIN_MBSSID;
}
diff --git a/drivers/staging/rt2870/common/rtusb_bulk.c b/drivers/staging/rt2870/common/rtusb_bulk.c
index d2746f8732e6..679b802d2169 100644
--- a/drivers/staging/rt2870/common/rtusb_bulk.c
+++ b/drivers/staging/rt2870/common/rtusb_bulk.c
@@ -298,7 +298,7 @@ void RTUSBBulkOutDataPacket(struct rt_rtmp_adapter *pAd,
/*|| ( (ThisBulkSize != 0) && (pTxWI->AMPDU == 0)) */
) {
/* For USB 1.1 or peer which didn't support AMPDU, limit the BulkOut size. */
- /* For performence in b/g mode, now just check for USB 1.1 and didn't care about the APMDU or not! 2008/06/04. */
+ /* For performance in b/g mode, now just check for USB 1.1 and didn't care about the APMDU or not! 2008/06/04. */
pHTTXContext->ENextBulkOutPosition =
TmpBulkEndPos;
break;
@@ -311,7 +311,7 @@ void RTUSBBulkOutDataPacket(struct rt_rtmp_adapter *pAd,
TmpBulkEndPos;
break;
} else if (((pAd->BulkOutMaxPacketSize < 512) && ((ThisBulkSize & 0xfffff800) != 0)) /*|| ( (ThisBulkSize != 0) && (pTxWI->AMPDU == 0)) */) { /* For USB 1.1 or peer which didn't support AMPDU, limit the BulkOut size. */
- /* For performence in b/g mode, now just check for USB 1.1 and didn't care about the APMDU or not! 2008/06/04. */
+ /* For performance in b/g mode, now just check for USB 1.1 and didn't care about the APMDU or not! 2008/06/04. */
pHTTXContext->ENextBulkOutPosition =
TmpBulkEndPos;
break;
@@ -1016,7 +1016,7 @@ void RTUSBKickBulkOut(struct rt_rtmp_adapter *pAd)
RTUSBBulkOutNullFrame(pAd);
}
}
- /* 8. No data avaliable */
+ /* 8. No data available */
else
;
}
diff --git a/drivers/staging/rt2870/common/rtusb_data.c b/drivers/staging/rt2870/common/rtusb_data.c
index 69368862217c..5b72bcdaa78f 100644
--- a/drivers/staging/rt2870/common/rtusb_data.c
+++ b/drivers/staging/rt2870/common/rtusb_data.c
@@ -71,7 +71,7 @@ void REPORT_AMSDU_FRAMES_TO_LLC(struct rt_rtmp_adapter *pAd,
Routine Description:
This subroutine will scan through releative ring descriptor to find
- out avaliable free ring descriptor and compare with request size.
+ out available free ring descriptor and compare with request size.
Arguments:
pAd Pointer to our adapter
diff --git a/drivers/staging/rtl8187se/Kconfig b/drivers/staging/rtl8187se/Kconfig
index 1b3103fbf29c..3162aabbeb07 100644
--- a/drivers/staging/rtl8187se/Kconfig
+++ b/drivers/staging/rtl8187se/Kconfig
@@ -1,6 +1,7 @@
config R8187SE
tristate "RealTek RTL8187SE Wireless LAN NIC driver"
depends on PCI && WLAN
+ depends on m
select WIRELESS_EXT
select WEXT_PRIV
select EEPROM_93CX6
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211.h b/drivers/staging/rtl8187se/ieee80211/ieee80211.h
index dc608c70deb1..16aa6a8952fd 100644
--- a/drivers/staging/rtl8187se/ieee80211/ieee80211.h
+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211.h
@@ -1099,7 +1099,7 @@ struct ieee80211_device {
* not set. As some cards may have different HW queues that
* one might want to use for data and management frames
* the option to have two callbacks might be useful.
- * This fucntion can't sleep.
+ * This function can't sleep.
*/
int (*softmac_hard_start_xmit)(struct sk_buff *skb,
struct net_device *dev);
@@ -1138,9 +1138,9 @@ struct ieee80211_device {
* it is called in a work_queue when swithcing to ad-hoc mode
* or in behalf of iwlist scan when the card is associated
* and root user ask for a scan.
- * the fucntion stop_scan should stop both the syncro and
+ * the function stop_scan should stop both the syncro and
* background scanning and can sleep.
- * The fucntion start_scan should initiate the background
+ * The function start_scan should initiate the background
* scanning and can't sleep.
*/
void (*scan_syncro)(struct net_device *dev);
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c
index 771e0196842e..736a1404f287 100644
--- a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c
+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c
@@ -1954,7 +1954,7 @@ associate_complete:
-/* following are for a simplier TX queue management.
+/* following are for a simpler TX queue management.
* Instead of using netif_[stop/wake]_queue the driver
* will uses these two function (plus a reset one), that
* will internally uses the kernel netif_* and takes
diff --git a/drivers/staging/rtl8187se/r8180_core.c b/drivers/staging/rtl8187se/r8180_core.c
index 70ab0084e5f5..2155a771c339 100644
--- a/drivers/staging/rtl8187se/r8180_core.c
+++ b/drivers/staging/rtl8187se/r8180_core.c
@@ -1591,7 +1591,7 @@ void rtl8180_rx(struct net_device *dev)
priv->RSSI = RSSI;
/* SQ translation formula is provided by SD3 DZ. 2006.06.27 */
if (quality >= 127)
- quality = 1; /*0; */ /* 0 will cause epc to show signal zero , walk aroud now; */
+ quality = 1; /*0; */ /* 0 will cause epc to show signal zero , walk around now; */
else if (quality < 27)
quality = 100;
else
@@ -3883,7 +3883,7 @@ void rtl8180_tx_isr(struct net_device *dev, int pri, short error)
* If the packet previous of the nic pointer has been
* processed this doesn't matter: it will be checked
* here at the next round. Anyway if no more packet are
- * TXed no memory leak occour at all.
+ * TXed no memory leak occur at all.
*/
switch (pri) {
diff --git a/drivers/staging/rtl8187se/r8180_dm.c b/drivers/staging/rtl8187se/r8180_dm.c
index fc4907839c58..261085d4b74a 100644
--- a/drivers/staging/rtl8187se/r8180_dm.c
+++ b/drivers/staging/rtl8187se/r8180_dm.c
@@ -123,7 +123,7 @@ DoTxHighPower(
//
// Description:
// Callback function of UpdateTxPowerWorkItem.
-// Because of some event happend, e.g. CCX TPC, High Power Mechanism,
+// Because of some event happened, e.g. CCX TPC, High Power Mechanism,
// We update Tx power of current channel again.
//
void rtl8180_tx_pw_wq (struct work_struct *work)
@@ -984,7 +984,7 @@ StaRateAdaptive87SE(
{
priv->TryupingCount = 0;
//
- // When transfering from CCK to OFDM, DIG is an important issue.
+ // When transferring from CCK to OFDM, DIG is an important issue.
//
if(priv->CurrentOperaRate == 22)
bUpdateInitialGain = true;
diff --git a/drivers/staging/rtl8187se/r8180_rtl8225z2.c b/drivers/staging/rtl8187se/r8180_rtl8225z2.c
index 2a2afd51cf42..3f09f76080af 100644
--- a/drivers/staging/rtl8187se/r8180_rtl8225z2.c
+++ b/drivers/staging/rtl8187se/r8180_rtl8225z2.c
@@ -378,7 +378,7 @@ static u32 read_rtl8225(struct net_device *dev, u8 adr)
mask = (low2high) ? 0x01 : (((u32)0x01) << (12-1));
/*
- * We must set data pin to HW controled, otherwise RF can't driver it
+ * We must set data pin to HW controlled, otherwise RF can't driver it
* and value RF register won't be able to read back properly.
*/
write_nic_word(dev, RFPinsEnable, (oval2 & (~0x01)));
diff --git a/drivers/staging/rtl8187se/r8185b_init.c b/drivers/staging/rtl8187se/r8185b_init.c
index 3bdf9b31cc4e..4b0b830f9ab6 100644
--- a/drivers/staging/rtl8187se/r8185b_init.c
+++ b/drivers/staging/rtl8187se/r8185b_init.c
@@ -1273,7 +1273,7 @@ MgntDisconnectIBSS(
/*
Stop Beacon.
- Vista add a Adhoc profile, HW radio off untill OID_DOT11_RESET_REQUEST
+ Vista add a Adhoc profile, HW radio off until OID_DOT11_RESET_REQUEST
Driver would set MSR=NO_LINK, then HW Radio ON, MgntQueue Stuck.
Because Bcn DMA isn't complete, mgnt queue would stuck until Bcn packet send.
diff --git a/drivers/staging/rtl8192e/Kconfig b/drivers/staging/rtl8192e/Kconfig
index 2e64b239e241..750c347bfbe1 100644
--- a/drivers/staging/rtl8192e/Kconfig
+++ b/drivers/staging/rtl8192e/Kconfig
@@ -1,6 +1,7 @@
config RTL8192E
tristate "RealTek RTL8192E Wireless LAN NIC driver"
depends on PCI && WLAN
+ depends on m
select WIRELESS_EXT
select WEXT_PRIV
select CRYPTO
diff --git a/drivers/staging/rtl8192e/ieee80211/ieee80211.h b/drivers/staging/rtl8192e/ieee80211/ieee80211.h
index 3ca388152616..dbe21ab0dbf7 100644
--- a/drivers/staging/rtl8192e/ieee80211/ieee80211.h
+++ b/drivers/staging/rtl8192e/ieee80211/ieee80211.h
@@ -1967,7 +1967,7 @@ struct ieee80211_device {
u16 prev_seq_ctl; /* used to drop duplicate frames */
/* map of allowed channels. 0 is dummy */
- // FIXME: remeber to default to a basic channel plan depending of the PHY type
+ // FIXME: remember to default to a basic channel plan depending of the PHY type
#ifdef ENABLE_DOT11D
void* pDot11dInfo;
bool bGlobalDomain;
@@ -2121,7 +2121,7 @@ struct ieee80211_device {
* not set. As some cards may have different HW queues that
* one might want to use for data and management frames
* the option to have two callbacks might be useful.
- * This fucntion can't sleep.
+ * This function can't sleep.
*/
int (*softmac_hard_start_xmit)(struct sk_buff *skb,
struct ieee80211_device *ieee80211);
@@ -2160,9 +2160,9 @@ struct ieee80211_device {
* it is called in a work_queue when swithcing to ad-hoc mode
* or in behalf of iwlist scan when the card is associated
* and root user ask for a scan.
- * the fucntion stop_scan should stop both the syncro and
+ * the function stop_scan should stop both the syncro and
* background scanning and can sleep.
- * The fucntion start_scan should initiate the background
+ * The function start_scan should initiate the background
* scanning and can't sleep.
*/
void (*scan_syncro)(struct ieee80211_device *ieee80211);
diff --git a/drivers/staging/rtl8192e/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192e/ieee80211/ieee80211_rx.c
index add015ebba1c..ed5a38023094 100644
--- a/drivers/staging/rtl8192e/ieee80211/ieee80211_rx.c
+++ b/drivers/staging/rtl8192e/ieee80211/ieee80211_rx.c
@@ -1426,7 +1426,7 @@ int ieee80211_rtl_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
static u8 qos_oui[QOS_OUI_LEN] = { 0x00, 0x50, 0xF2 };
/*
-* Make ther structure we read from the beacon packet has
+* Make the structure we read from the beacon packet to have
* the right values
*/
static int ieee80211_verify_qos_info(struct ieee80211_qos_information_element
diff --git a/drivers/staging/rtl8192e/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192e/ieee80211/ieee80211_softmac.c
index f6922d40a88a..7d4cba3a7c12 100644
--- a/drivers/staging/rtl8192e/ieee80211/ieee80211_softmac.c
+++ b/drivers/staging/rtl8192e/ieee80211/ieee80211_softmac.c
@@ -2023,7 +2023,7 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
return 1;
}
else
- { //filling the PeerHTCap. //maybe not neccesary as we can get its info from current_network.
+ { //filling the PeerHTCap. //maybe not necessary as we can get its info from current_network.
memcpy(ieee->pHTInfo->PeerHTCapBuf, network->bssht.bdHTCapBuf, network->bssht.bdHTCapLen);
memcpy(ieee->pHTInfo->PeerHTInfoBuf, network->bssht.bdHTInfoBuf, network->bssht.bdHTInfoLen);
}
@@ -2163,7 +2163,7 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
return 0;
}
-/* following are for a simplier TX queue management.
+/* following are for a simpler TX queue management.
* Instead of using netif_[stop/wake]_queue the driver
* will uses these two function (plus a reset one), that
* will internally uses the kernel netif_* and takes
diff --git a/drivers/staging/rtl8192e/ieee80211/rtl819x_HT.h b/drivers/staging/rtl8192e/ieee80211/rtl819x_HT.h
index f968817d073c..56a120cf6291 100644
--- a/drivers/staging/rtl8192e/ieee80211/rtl819x_HT.h
+++ b/drivers/staging/rtl8192e/ieee80211/rtl819x_HT.h
@@ -64,7 +64,7 @@ typedef enum _HT_CHANNEL_WIDTH{
}HT_CHANNEL_WIDTH, *PHT_CHANNEL_WIDTH;
//
-// Represent Extention Channel Offset in HT Capabilities
+// Represent Extension Channel Offset in HT Capabilities
// This is available only in 40Mhz mode.
//
typedef enum _HT_EXTCHNL_OFFSET{
diff --git a/drivers/staging/rtl8192e/ieee80211/rtl819x_HTProc.c b/drivers/staging/rtl8192e/ieee80211/rtl819x_HTProc.c
index a2a4fe9dd9da..f7a9da3ec829 100644
--- a/drivers/staging/rtl8192e/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192e/ieee80211/rtl819x_HTProc.c
@@ -459,7 +459,7 @@ u8 HTIOTActIsForcedCTS2Self(struct ieee80211_device *ieee, struct ieee80211_netw
/**
* Function: HTIOTActIsDisableMCS15
*
-* Overview: Check whether driver should declare capability of receving MCS15
+* Overview: Check whether driver should declare capability of receiving MCS15
*
* Input:
* PADAPTER Adapter,
@@ -496,7 +496,7 @@ bool HTIOTActIsDisableMCS15(struct ieee80211_device* ieee)
/**
* Function: HTIOTActIsDisableMCSTwoSpatialStream
*
-* Overview: Check whether driver should declare capability of receving All 2 ss packets
+* Overview: Check whether driver should declare capability of receiving All 2 ss packets
*
* Input:
* PADAPTER Adapter,
@@ -1681,7 +1681,7 @@ void HTSetConnectBwMode(struct ieee80211_device* ieee, HT_CHANNEL_WIDTH Bandwidt
//if in half N mode, set to 20M bandwidth please 09.08.2008 WB.
if (Bandwidth==HT_CHANNEL_WIDTH_20_40 && (!ieee->GetHalfNmodeSupportByAPsHandler(ieee)))
{
- // Handle Illegal extention channel offset!!
+ // Handle Illegal extension channel offset!!
if(ieee->current_network.channel<2 && Offset==HT_EXTCHNL_OFFSET_LOWER)
Offset = HT_EXTCHNL_OFFSET_NO_EXT;
if(Offset==HT_EXTCHNL_OFFSET_UPPER || Offset==HT_EXTCHNL_OFFSET_LOWER) {
@@ -1698,7 +1698,7 @@ void HTSetConnectBwMode(struct ieee80211_device* ieee, HT_CHANNEL_WIDTH Bandwidt
pHTInfo->bSwBwInProgress = true;
- // TODO: 2007.7.13 by Emily Wait 2000ms in order to garantee that switching
+ // TODO: 2007.7.13 by Emily Wait 2000ms in order to guarantee that switching
// bandwidth is executed after scan is finished. It is a temporal solution
// because software should ganrantee the last operation of switching bandwidth
// is executed properlly.
diff --git a/drivers/staging/rtl8192e/ieee80211/rtl819x_TS.h b/drivers/staging/rtl8192e/ieee80211/rtl819x_TS.h
index baaac2149de1..e7e26fd96395 100644
--- a/drivers/staging/rtl8192e/ieee80211/rtl819x_TS.h
+++ b/drivers/staging/rtl8192e/ieee80211/rtl819x_TS.h
@@ -44,7 +44,7 @@ typedef struct _RX_TS_RECORD {
u16 RxTimeoutIndicateSeq;
struct list_head RxPendingPktList;
struct timer_list RxPktPendingTimer;
- BA_RECORD RxAdmittedBARecord; // For BA Recepient
+ BA_RECORD RxAdmittedBARecord; // For BA Recipient
u16 RxLastSeqNum;
u8 RxLastFragNum;
u8 num;
diff --git a/drivers/staging/rtl8192e/ieee80211/rtl819x_TSProc.c b/drivers/staging/rtl8192e/ieee80211/rtl819x_TSProc.c
index 29eecf0ab769..ad6872dcf1c2 100644
--- a/drivers/staging/rtl8192e/ieee80211/rtl819x_TSProc.c
+++ b/drivers/staging/rtl8192e/ieee80211/rtl819x_TSProc.c
@@ -135,7 +135,7 @@ void ResetRxTsEntry(PRX_TS_RECORD pTS)
ResetTsCommonInfo(&pTS->TsCommonInfo);
pTS->RxIndicateSeq = 0xffff; // This indicate the RxIndicateSeq is not used now!!
pTS->RxTimeoutIndicateSeq = 0xffff; // This indicate the RxTimeoutIndicateSeq is not used now!!
- ResetBaEntry(&pTS->RxAdmittedBARecord); // For BA Recepient
+ ResetBaEntry(&pTS->RxAdmittedBARecord); // For BA Recipient
}
void TSInitialize(struct ieee80211_device *ieee)
diff --git a/drivers/staging/rtl8192e/r819xE_phy.c b/drivers/staging/rtl8192e/r819xE_phy.c
index dfa4e112ef46..9e7828ef1cbe 100644
--- a/drivers/staging/rtl8192e/r819xE_phy.c
+++ b/drivers/staging/rtl8192e/r819xE_phy.c
@@ -2032,13 +2032,13 @@ void rtl8192_SetBWModeWorkItem(struct r8192_priv *priv)
{
case HT_CHANNEL_WIDTH_20:
regBwOpMode |= BW_OPMODE_20MHZ;
- // 2007/02/07 Mark by Emily becasue we have not verify whether this register works
+ // 2007/02/07 Mark by Emily because we have not verify whether this register works
write_nic_byte(priv, BW_OPMODE, regBwOpMode);
break;
case HT_CHANNEL_WIDTH_20_40:
regBwOpMode &= ~BW_OPMODE_20MHZ;
- // 2007/02/07 Mark by Emily becasue we have not verify whether this register works
+ // 2007/02/07 Mark by Emily because we have not verify whether this register works
write_nic_byte(priv, BW_OPMODE, regBwOpMode);
break;
@@ -2116,7 +2116,7 @@ void rtl8192_SetBWModeWorkItem(struct r8192_priv *priv)
}
/******************************************************************************
- *function: This function schedules bandwith switch work.
+ *function: This function schedules bandwidth switch work.
* input: struct net_device *dev
* HT_CHANNEL_WIDTH Bandwidth //20M or 40M
* HT_EXTCHNL_OFFSET Offset //Upper, Lower, or Don't care
diff --git a/drivers/staging/rtl8192u/Kconfig b/drivers/staging/rtl8192u/Kconfig
index 28969198e7e2..3f055091b35f 100644
--- a/drivers/staging/rtl8192u/Kconfig
+++ b/drivers/staging/rtl8192u/Kconfig
@@ -1,6 +1,7 @@
config RTL8192U
tristate "RealTek RTL8192U Wireless LAN NIC driver"
depends on PCI && WLAN && USB
+ depends on m
select WIRELESS_EXT
select WEXT_PRIV
select CRYPTO
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h b/drivers/staging/rtl8192u/ieee80211/ieee80211.h
index c0b844d75c0d..e716f7b1144f 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h
@@ -1965,7 +1965,7 @@ struct ieee80211_device {
u16 prev_seq_ctl; /* used to drop duplicate frames */
/* map of allowed channels. 0 is dummy */
- // FIXME: remeber to default to a basic channel plan depending of the PHY type
+ // FIXME: remember to default to a basic channel plan depending of the PHY type
void* pDot11dInfo;
bool bGlobalDomain;
int rate; /* current rate */
@@ -2119,7 +2119,7 @@ struct ieee80211_device {
* not set. As some cards may have different HW queues that
* one might want to use for data and management frames
* the option to have two callbacks might be useful.
- * This fucntion can't sleep.
+ * This function can't sleep.
*/
int (*softmac_hard_start_xmit)(struct sk_buff *skb,
struct net_device *dev);
@@ -2158,9 +2158,9 @@ struct ieee80211_device {
* it is called in a work_queue when swithcing to ad-hoc mode
* or in behalf of iwlist scan when the card is associated
* and root user ask for a scan.
- * the fucntion stop_scan should stop both the syncro and
+ * the function stop_scan should stop both the syncro and
* background scanning and can sleep.
- * The fucntion start_scan should initiate the background
+ * The function start_scan should initiate the background
* scanning and can't sleep.
*/
void (*scan_syncro)(struct net_device *dev);
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
index 498b520efcf4..a414303aef54 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
@@ -1399,7 +1399,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
static u8 qos_oui[QOS_OUI_LEN] = { 0x00, 0x50, 0xF2 };
/*
-* Make ther structure we read from the beacon packet has
+* Make the structure we read from the beacon packet to have
* the right values
*/
static int ieee80211_verify_qos_info(struct ieee80211_qos_information_element
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
index 4992d630f984..4ec0a6520ddc 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
@@ -1973,7 +1973,7 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
return 1;
}
else
- { //filling the PeerHTCap. //maybe not neccesary as we can get its info from current_network.
+ { //filling the PeerHTCap. //maybe not necessary as we can get its info from current_network.
memcpy(ieee->pHTInfo->PeerHTCapBuf, network->bssht.bdHTCapBuf, network->bssht.bdHTCapLen);
memcpy(ieee->pHTInfo->PeerHTInfoBuf, network->bssht.bdHTInfoBuf, network->bssht.bdHTInfoLen);
}
@@ -2113,7 +2113,7 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
return 0;
}
-/* following are for a simplier TX queue management.
+/* following are for a simpler TX queue management.
* Instead of using netif_[stop/wake]_queue the driver
* will uses these two function (plus a reset one), that
* will internally uses the kernel netif_* and takes
diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h b/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h
index cde603f67f43..0b1a1fc09391 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h
@@ -64,7 +64,7 @@ typedef enum _HT_CHANNEL_WIDTH{
}HT_CHANNEL_WIDTH, *PHT_CHANNEL_WIDTH;
//
-// Represent Extention Channel Offset in HT Capabilities
+// Represent Extension Channel Offset in HT Capabilities
// This is available only in 40Mhz mode.
//
typedef enum _HT_EXTCHNL_OFFSET{
diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index 50f4f5943e75..e88a839b2a91 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -423,7 +423,7 @@ u8 HTIOTActIsDisableMCS14(struct ieee80211_device* ieee, u8* PeerMacAddr)
/**
* Function: HTIOTActIsDisableMCS15
*
-* Overview: Check whether driver should declare capability of receving MCS15
+* Overview: Check whether driver should declare capability of receiving MCS15
*
* Input:
* PADAPTER Adapter,
@@ -460,7 +460,7 @@ bool HTIOTActIsDisableMCS15(struct ieee80211_device* ieee)
/**
* Function: HTIOTActIsDisableMCSTwoSpatialStream
*
-* Overview: Check whether driver should declare capability of receving All 2 ss packets
+* Overview: Check whether driver should declare capability of receiving All 2 ss packets
*
* Input:
* PADAPTER Adapter,
@@ -1409,7 +1409,7 @@ void HTSetConnectBwMode(struct ieee80211_device* ieee, HT_CHANNEL_WIDTH Bandwidt
//if in half N mode, set to 20M bandwidth please 09.08.2008 WB.
if(Bandwidth==HT_CHANNEL_WIDTH_20_40 && (!ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)))
{
- // Handle Illegal extention channel offset!!
+ // Handle Illegal extension channel offset!!
if(ieee->current_network.channel<2 && Offset==HT_EXTCHNL_OFFSET_LOWER)
Offset = HT_EXTCHNL_OFFSET_NO_EXT;
if(Offset==HT_EXTCHNL_OFFSET_UPPER || Offset==HT_EXTCHNL_OFFSET_LOWER) {
@@ -1426,7 +1426,7 @@ void HTSetConnectBwMode(struct ieee80211_device* ieee, HT_CHANNEL_WIDTH Bandwidt
pHTInfo->bSwBwInProgress = true;
- // TODO: 2007.7.13 by Emily Wait 2000ms in order to garantee that switching
+ // TODO: 2007.7.13 by Emily Wait 2000ms in order to guarantee that switching
// bandwidth is executed after scan is finished. It is a temporal solution
// because software should ganrantee the last operation of switching bandwidth
// is executed properlly.
diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h b/drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h
index baaac2149de1..e7e26fd96395 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h
@@ -44,7 +44,7 @@ typedef struct _RX_TS_RECORD {
u16 RxTimeoutIndicateSeq;
struct list_head RxPendingPktList;
struct timer_list RxPktPendingTimer;
- BA_RECORD RxAdmittedBARecord; // For BA Recepient
+ BA_RECORD RxAdmittedBARecord; // For BA Recipient
u16 RxLastSeqNum;
u8 RxLastFragNum;
u8 num;
diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c
index c3fcaae0750d..957ce4ef48b5 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c
@@ -135,7 +135,7 @@ void ResetRxTsEntry(PRX_TS_RECORD pTS)
ResetTsCommonInfo(&pTS->TsCommonInfo);
pTS->RxIndicateSeq = 0xffff; // This indicate the RxIndicateSeq is not used now!!
pTS->RxTimeoutIndicateSeq = 0xffff; // This indicate the RxTimeoutIndicateSeq is not used now!!
- ResetBaEntry(&pTS->RxAdmittedBARecord); // For BA Recepient
+ ResetBaEntry(&pTS->RxAdmittedBARecord); // For BA Recipient
}
void TSInitialize(struct ieee80211_device *ieee)
diff --git a/drivers/staging/rtl8192u/ieee80211/scatterwalk.c b/drivers/staging/rtl8192u/ieee80211/scatterwalk.c
index 49f401fbce88..3543a6145046 100644
--- a/drivers/staging/rtl8192u/ieee80211/scatterwalk.c
+++ b/drivers/staging/rtl8192u/ieee80211/scatterwalk.c
@@ -71,7 +71,7 @@ static void scatterwalk_pagedone(struct scatter_walk *walk, int out,
unsigned int more)
{
/* walk->data may be pointing the first byte of the next page;
- however, we know we transfered at least one byte. So,
+ however, we know we transferred at least one byte. So,
walk->data - 1 will be a virtual address in the mapped page. */
if (out)
diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
index da612e6d994e..e81b8ab6aa9d 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -460,7 +460,7 @@ u32 read_nic_dword(struct net_device *dev, int indx)
/* u8 read_phy_cck(struct net_device *dev, u8 adr); */
/* u8 read_phy_ofdm(struct net_device *dev, u8 adr); */
/* this might still called in what was the PHY rtl8185/rtl8192 common code
- * plans are to possibilty turn it again in one common code...
+ * plans are to possibility turn it again in one common code...
*/
inline void force_pci_posting(struct net_device *dev)
{
@@ -1378,7 +1378,7 @@ struct sk_buff *DrvAggr_Aggregation(struct net_device *dev, struct ieee80211_drv
//tx_agg_desc->LINIP = 0;
//tx_agg_desc->CmdInit = 1;
tx_agg_desc->Offset = sizeof(tx_fwinfo_819x_usb) + 8;
- /* already raw data, need not to substract header length */
+ /* already raw data, need not to subtract header length */
tx_agg_desc->PktSize = skb->len & 0xffff;
/*DWORD 1*/
@@ -2888,7 +2888,7 @@ static void rtl8192_get_eeprom_size(struct net_device* dev)
RT_TRACE(COMP_EPROM, "<===========%s(), epromtype:%d\n", __FUNCTION__, priv->epromtype);
}
-//used to swap endian. as ntohl & htonl are not neccessary to swap endian, so use this instead.
+//used to swap endian. as ntohl & htonl are not necessary to swap endian, so use this instead.
static inline u16 endian_swap(u16* data)
{
u16 tmp = *data;
diff --git a/drivers/staging/rtl8192u/r819xU_HTType.h b/drivers/staging/rtl8192u/r819xU_HTType.h
index 01f58b902028..2ac421626e7c 100644
--- a/drivers/staging/rtl8192u/r819xU_HTType.h
+++ b/drivers/staging/rtl8192u/r819xU_HTType.h
@@ -65,7 +65,7 @@ typedef enum _HT_CHANNEL_WIDTH{
}HT_CHANNEL_WIDTH, *PHT_CHANNEL_WIDTH;
//
-// Represent Extention Channel Offset in HT Capabilities
+// Represent Extension Channel Offset in HT Capabilities
// This is available only in 40Mhz mode.
//
typedef enum _HT_EXTCHNL_OFFSET{
diff --git a/drivers/staging/rtl8192u/r819xU_phy.c b/drivers/staging/rtl8192u/r819xU_phy.c
index 41684e8fcf4c..c4586b0817d1 100644
--- a/drivers/staging/rtl8192u/r819xU_phy.c
+++ b/drivers/staging/rtl8192u/r819xU_phy.c
@@ -1531,13 +1531,13 @@ void rtl8192_SetBWModeWorkItem(struct net_device *dev)
{
case HT_CHANNEL_WIDTH_20:
regBwOpMode |= BW_OPMODE_20MHZ;
- // 2007/02/07 Mark by Emily becasue we have not verify whether this register works
+ // 2007/02/07 Mark by Emily because we have not verify whether this register works
write_nic_byte(dev, BW_OPMODE, regBwOpMode);
break;
case HT_CHANNEL_WIDTH_20_40:
regBwOpMode &= ~BW_OPMODE_20MHZ;
- // 2007/02/07 Mark by Emily becasue we have not verify whether this register works
+ // 2007/02/07 Mark by Emily because we have not verify whether this register works
write_nic_byte(dev, BW_OPMODE, regBwOpMode);
break;
@@ -1647,7 +1647,7 @@ void rtl8192_SetBWModeWorkItem(struct net_device *dev)
}
/******************************************************************************
- *function: This function schedules bandwith switch work.
+ *function: This function schedules bandwidth switch work.
* input: struct net_device *dev
* HT_CHANNEL_WIDTH Bandwidth //20M or 40M
* HT_EXTCHNL_OFFSET Offset //Upper, Lower, or Don't care
diff --git a/drivers/staging/rtl8712/rtl871x_cmd.h b/drivers/staging/rtl8712/rtl871x_cmd.h
index 3a945b5f0e01..2dc78476b7d3 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.h
+++ b/drivers/staging/rtl8712/rtl871x_cmd.h
@@ -656,7 +656,7 @@ struct PT_param {
/*
* Result:
* 0x00: success
- * 0x01: sucess, and check Response.
+ * 0x01: success, and check Response.
* 0x02: cmd ignored due to duplicated sequcne number
* 0x03: cmd dropped due to invalid cmd code
* 0x04: reserved.
diff --git a/drivers/staging/rtl8712/rtl871x_led.h b/drivers/staging/rtl8712/rtl871x_led.h
index 994ef82141ab..8085e5eb82b1 100644
--- a/drivers/staging/rtl8712/rtl871x_led.h
+++ b/drivers/staging/rtl8712/rtl871x_led.h
@@ -78,14 +78,14 @@ struct LED_871x {
};
struct led_priv {
- /* add for led controll */
+ /* add for led control */
struct LED_871x SwLed0;
struct LED_871x SwLed1;
enum LED_STRATEGY_871x LedStrategy;
u8 bRegUseLed;
void (*LedControlHandler)(struct _adapter *padapter,
enum LED_CTL_MODE LedAction);
- /* add for led controll */
+ /* add for led control */
};
/*===========================================================================
diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index 98ba7602e250..866554d48d86 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -1663,7 +1663,7 @@ void r8712_update_registrypriv_dev_network(struct _adapter *adapter)
(struct ndis_wlan_bssid_ex *)pdev_network);
}
-/*the fucntion is at passive_level*/
+/*the function is at passive_level*/
void r8712_joinbss_reset(struct _adapter *padapter)
{
int i;
@@ -1726,7 +1726,7 @@ unsigned int r8712_restructure_ht_ie(struct _adapter *padapter, u8 *in_ie,
return phtpriv->ht_option;
}
-/* the fucntion is > passive_level (in critical_section) */
+/* the function is > passive_level (in critical_section) */
static void update_ht_cap(struct _adapter *padapter, u8 *pie, uint ie_len)
{
u8 *p, max_ampdu_sz;
@@ -1803,7 +1803,7 @@ void r8712_issue_addbareq_cmd(struct _adapter *padapter, int priority)
}
}
-/*the fucntion is >= passive_level*/
+/*the function is >= passive_level*/
unsigned int r8712_add_ht_addt_info(struct _adapter *padapter,
u8 *in_ie, u8 *out_ie,
uint in_len, uint *pout_len)
diff --git a/drivers/staging/rtl8712/rtl871x_mlme.h b/drivers/staging/rtl8712/rtl871x_mlme.h
index 2b35b740ab89..2794804d0822 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.h
+++ b/drivers/staging/rtl8712/rtl871x_mlme.h
@@ -29,7 +29,7 @@
* single-tone*/
#define WIFI_MP_CTX_BACKGROUND_PENDING 0x00080000 /* pending in cont, tx
* background due to out of skb*/
-#define WIFI_MP_CTX_CCK_HW 0x00100000 /* in continous tx*/
+#define WIFI_MP_CTX_CCK_HW 0x00100000 /* in continuous tx*/
#define WIFI_MP_CTX_CCK_CS 0x00200000 /* in cont, tx with carrier
* suppression*/
#define WIFI_MP_LPBK_STATE 0x00400000
diff --git a/drivers/staging/rtl8712/rtl871x_mp_phy_regdef.h b/drivers/staging/rtl8712/rtl871x_mp_phy_regdef.h
index e386fb0aac3e..23532a793859 100644
--- a/drivers/staging/rtl8712/rtl871x_mp_phy_regdef.h
+++ b/drivers/staging/rtl8712/rtl871x_mp_phy_regdef.h
@@ -38,7 +38,7 @@
* 2. 0x800/0x900/0xA00/0xC00/0xD00/0xE00
* 3. RF register 0x00-2E
* 4. Bit Mask for BB/RF register
- * 5. Other defintion for BB/RF R/W
+ * 5. Other definition for BB/RF R/W
*
* 1. PMAC duplicate register due to connection: RF_Mode, TRxRN, NumOf L-STF
* 1. Page1(0x100)
diff --git a/drivers/staging/rtl8712/usb_halinit.c b/drivers/staging/rtl8712/usb_halinit.c
index 0e9483bbabe1..46287c17a417 100644
--- a/drivers/staging/rtl8712/usb_halinit.c
+++ b/drivers/staging/rtl8712/usb_halinit.c
@@ -112,7 +112,7 @@ u8 r8712_usb_hal_bus_init(struct _adapter *padapter)
/* Initialization for power on sequence, */
r8712_write8(padapter, SPS0_CTRL + 1, 0x53);
r8712_write8(padapter, SPS0_CTRL, 0x57);
- /* Enable AFE Macro Block's Bandgap adn Enable AFE Macro
+ /* Enable AFE Macro Block's Bandgap and Enable AFE Macro
* Block's Mbias
*/
val8 = r8712_read8(padapter, AFE_MISC);
diff --git a/drivers/staging/rts_pstor/debug.h b/drivers/staging/rts_pstor/debug.h
index e1408b0e7ae4..ab305be96fb5 100644
--- a/drivers/staging/rts_pstor/debug.h
+++ b/drivers/staging/rts_pstor/debug.h
@@ -28,7 +28,7 @@
#define RTSX_STOR "rts_pstor: "
-#if CONFIG_RTS_PSTOR_DEBUG
+#ifdef CONFIG_RTS_PSTOR_DEBUG
#define RTSX_DEBUGP(x...) printk(KERN_DEBUG RTSX_STOR x)
#define RTSX_DEBUGPN(x...) printk(KERN_DEBUG x)
#define RTSX_DEBUGPX(x...) printk(x)
diff --git a/drivers/staging/rts_pstor/ms.c b/drivers/staging/rts_pstor/ms.c
index 810e170894f5..d89795c6a3ac 100644
--- a/drivers/staging/rts_pstor/ms.c
+++ b/drivers/staging/rts_pstor/ms.c
@@ -23,6 +23,7 @@
#include <linux/blkdev.h>
#include <linux/kthread.h>
#include <linux/sched.h>
+#include <linux/vmalloc.h>
#include "rtsx.h"
#include "rtsx_transport.h"
diff --git a/drivers/staging/rts_pstor/rtsx.c b/drivers/staging/rts_pstor/rtsx.c
index 4514419a5fb8..02525d57ba83 100644
--- a/drivers/staging/rts_pstor/rtsx.c
+++ b/drivers/staging/rts_pstor/rtsx.c
@@ -824,13 +824,13 @@ static void rtsx_init_options(struct rtsx_chip *chip)
chip->fpga_ms_hg_clk = CLK_80;
chip->fpga_ms_4bit_clk = CLK_80;
chip->fpga_ms_1bit_clk = CLK_40;
- chip->asic_sd_sdr104_clk = 207;
- chip->asic_sd_sdr50_clk = 99;
- chip->asic_sd_ddr50_clk = 99;
- chip->asic_sd_hs_clk = 99;
- chip->asic_mmc_52m_clk = 99;
- chip->asic_ms_hg_clk = 119;
- chip->asic_ms_4bit_clk = 79;
+ chip->asic_sd_sdr104_clk = 203;
+ chip->asic_sd_sdr50_clk = 98;
+ chip->asic_sd_ddr50_clk = 98;
+ chip->asic_sd_hs_clk = 98;
+ chip->asic_mmc_52m_clk = 98;
+ chip->asic_ms_hg_clk = 117;
+ chip->asic_ms_4bit_clk = 78;
chip->asic_ms_1bit_clk = 39;
chip->ssc_depth_sd_sdr104 = SSC_DEPTH_2M;
chip->ssc_depth_sd_sdr50 = SSC_DEPTH_2M;
diff --git a/drivers/staging/rts_pstor/rtsx_chip.c b/drivers/staging/rts_pstor/rtsx_chip.c
index f443d97a56f8..4e60780ea804 100644
--- a/drivers/staging/rts_pstor/rtsx_chip.c
+++ b/drivers/staging/rts_pstor/rtsx_chip.c
@@ -24,6 +24,7 @@
#include <linux/kthread.h>
#include <linux/sched.h>
#include <linux/workqueue.h>
+#include <linux/vmalloc.h>
#include "rtsx.h"
#include "rtsx_transport.h"
@@ -684,6 +685,11 @@ static int rts5209_init(struct rtsx_chip *chip)
RTSX_DEBUGP("dw in 0x724: 0x%x\n", lval);
val = (u8)lval;
if (!(val & 0x80)) {
+ if (val & 0x08)
+ chip->lun_mode = DEFAULT_SINGLE;
+ else
+ chip->lun_mode = SD_MS_2LUN;
+
if (val & 0x04) {
SET_SDIO_EXIST(chip);
} else {
@@ -705,12 +711,6 @@ static int rts5209_init(struct rtsx_chip *chip)
chip->aspm_l0s_l1_en = (val >> 5) & 0x03;
- if (val & 0x08) {
- chip->lun_mode = DEFAULT_SINGLE;
- } else {
- chip->lun_mode = SD_MS_2LUN;
- }
-
val = (u8)(lval >> 8);
clk = (val >> 5) & 0x07;
@@ -1312,11 +1312,11 @@ void rtsx_polling_func(struct rtsx_chip *chip)
#ifdef SUPPORT_OCP
if (CHECK_LUN_MODE(chip, SD_MS_2LUN)) {
- #if CONFIG_RTS_PSTOR_DEBUG
+#ifdef CONFIG_RTS_PSTOR_DEBUG
if (chip->ocp_stat & (SD_OC_NOW | SD_OC_EVER | MS_OC_NOW | MS_OC_EVER)) {
RTSX_DEBUGP("Over current, OCPSTAT is 0x%x\n", chip->ocp_stat);
}
- #endif
+#endif
if (chip->ocp_stat & (SD_OC_NOW | SD_OC_EVER)) {
if (chip->card_exist & SD_CARD) {
diff --git a/drivers/staging/rts_pstor/rtsx_chip.h b/drivers/staging/rts_pstor/rtsx_chip.h
index 713c5eaadacd..9f7cd82a1541 100644
--- a/drivers/staging/rts_pstor/rtsx_chip.h
+++ b/drivers/staging/rts_pstor/rtsx_chip.h
@@ -180,8 +180,8 @@
#define CUR_ERR 0x70 /* current error */
#define DEF_ERR 0x71 /* specific command error */
-/*---- sense key Infomation ----*/
-#define SNSKEYINFO_LEN 3 /* length of sense key infomation */
+/*---- sense key Information ----*/
+#define SNSKEYINFO_LEN 3 /* length of sense key information */
#define SKSV 0x80
#define CDB_ILLEGAL 0x40
@@ -235,13 +235,13 @@ struct sense_data_t {
unsigned char seg_no; /* segment No. */
unsigned char sense_key; /* byte5 : ILI */
/* bit3-0 : sense key */
- unsigned char info[4]; /* infomation */
+ unsigned char info[4]; /* information */
unsigned char ad_sense_len; /* additional sense data length */
- unsigned char cmd_info[4]; /* command specific infomation */
+ unsigned char cmd_info[4]; /* command specific information */
unsigned char asc; /* ASC */
unsigned char ascq; /* ASCQ */
unsigned char rfu; /* FRU */
- unsigned char sns_key_info[3]; /* sense key specific infomation */
+ unsigned char sns_key_info[3]; /* sense key specific information */
};
/* PCI Operation Register Address */
diff --git a/drivers/staging/rts_pstor/rtsx_scsi.c b/drivers/staging/rts_pstor/rtsx_scsi.c
index 20c2464a20f9..7de1fae443fc 100644
--- a/drivers/staging/rts_pstor/rtsx_scsi.c
+++ b/drivers/staging/rts_pstor/rtsx_scsi.c
@@ -23,6 +23,7 @@
#include <linux/blkdev.h>
#include <linux/kthread.h>
#include <linux/sched.h>
+#include <linux/vmalloc.h>
#include "rtsx.h"
#include "rtsx_transport.h"
diff --git a/drivers/staging/rts_pstor/rtsx_scsi.h b/drivers/staging/rts_pstor/rtsx_scsi.h
index fac122c1eabd..64b84992fdb3 100644
--- a/drivers/staging/rts_pstor/rtsx_scsi.h
+++ b/drivers/staging/rts_pstor/rtsx_scsi.h
@@ -85,7 +85,7 @@
#define CHIP_NORMALMODE 0x00
#define CHIP_DEBUGMODE 0x01
-/* SD Pass Through Command Extention */
+/* SD Pass Through Command Extension */
#define SD_PASS_THRU_MODE 0xD0
#define SD_EXECUTE_NO_DATA 0xD1
#define SD_EXECUTE_READ 0xD2
diff --git a/drivers/staging/rts_pstor/sd.c b/drivers/staging/rts_pstor/sd.c
index 21bfa5755bec..b1277a6c7a8b 100644
--- a/drivers/staging/rts_pstor/sd.c
+++ b/drivers/staging/rts_pstor/sd.c
@@ -909,7 +909,7 @@ static int sd_change_phase(struct rtsx_chip *chip, u8 sample_point, u8 tune_dir)
RTSX_WRITE_REG(chip, SD_VPCLK0_CTL, PHASE_NOT_RESET, PHASE_NOT_RESET);
RTSX_WRITE_REG(chip, CLK_CTL, CHANGE_CLK, 0);
} else {
-#if CONFIG_RTS_PSTOR_DEBUG
+#ifdef CONFIG_RTS_PSTOR_DEBUG
rtsx_read_register(chip, SD_VP_CTL, &val);
RTSX_DEBUGP("SD_VP_CTL: 0x%x\n", val);
rtsx_read_register(chip, SD_DCMPS_CTL, &val);
@@ -958,7 +958,7 @@ static int sd_change_phase(struct rtsx_chip *chip, u8 sample_point, u8 tune_dir)
return STATUS_SUCCESS;
Fail:
-#if CONFIG_RTS_PSTOR_DEBUG
+#ifdef CONFIG_RTS_PSTOR_DEBUG
rtsx_read_register(chip, SD_VP_CTL, &val);
RTSX_DEBUGP("SD_VP_CTL: 0x%x\n", val);
rtsx_read_register(chip, SD_DCMPS_CTL, &val);
@@ -1719,7 +1719,7 @@ static u8 sd_search_final_phase(struct rtsx_chip *chip, u32 phase_map, u8 tune_d
}
Search_Finish:
- RTSX_DEBUGP("Final choosen phase: %d\n", final_phase);
+ RTSX_DEBUGP("Final chosen phase: %d\n", final_phase);
return final_phase;
}
diff --git a/drivers/staging/rts_pstor/trace.h b/drivers/staging/rts_pstor/trace.h
index 2c668bae6ff4..bc83b49a4eb4 100644
--- a/drivers/staging/rts_pstor/trace.h
+++ b/drivers/staging/rts_pstor/trace.h
@@ -82,7 +82,7 @@ do { \
#define TRACE_GOTO(chip, label) goto label
#endif
-#if CONFIG_RTS_PSTOR_DEBUG
+#ifdef CONFIG_RTS_PSTOR_DEBUG
static inline void rtsx_dump(u8 *buf, int buf_len)
{
int i;
diff --git a/drivers/staging/rts_pstor/xd.c b/drivers/staging/rts_pstor/xd.c
index 7bcd468b8f2c..9f3add1e8f59 100644
--- a/drivers/staging/rts_pstor/xd.c
+++ b/drivers/staging/rts_pstor/xd.c
@@ -23,6 +23,7 @@
#include <linux/blkdev.h>
#include <linux/kthread.h>
#include <linux/sched.h>
+#include <linux/vmalloc.h>
#include "rtsx.h"
#include "rtsx_transport.h"
diff --git a/drivers/staging/samsung-laptop/Kconfig b/drivers/staging/samsung-laptop/Kconfig
deleted file mode 100644
index f27c60864c26..000000000000
--- a/drivers/staging/samsung-laptop/Kconfig
+++ /dev/null
@@ -1,10 +0,0 @@
-config SAMSUNG_LAPTOP
- tristate "Samsung Laptop driver"
- default n
- depends on RFKILL && BACKLIGHT_CLASS_DEVICE && X86
- help
- This module implements a driver for the N128 Samsung Laptop
- providing control over the Wireless LED and the LCD backlight
-
- To compile this driver as a module, choose
- M here: the module will be called samsung-laptop.
diff --git a/drivers/staging/samsung-laptop/Makefile b/drivers/staging/samsung-laptop/Makefile
deleted file mode 100644
index 3c6f42045211..000000000000
--- a/drivers/staging/samsung-laptop/Makefile
+++ /dev/null
@@ -1 +0,0 @@
-obj-$(CONFIG_SAMSUNG_LAPTOP) += samsung-laptop.o
diff --git a/drivers/staging/samsung-laptop/TODO b/drivers/staging/samsung-laptop/TODO
deleted file mode 100644
index f7a6d589916e..000000000000
--- a/drivers/staging/samsung-laptop/TODO
+++ /dev/null
@@ -1,5 +0,0 @@
-TODO:
- - review from other developers
- - figure out ACPI video issues
-
-Please send patches to Greg Kroah-Hartman <gregkh@suse.de>
diff --git a/drivers/staging/samsung-laptop/samsung-laptop.c b/drivers/staging/samsung-laptop/samsung-laptop.c
deleted file mode 100644
index 6607a89ccb4b..000000000000
--- a/drivers/staging/samsung-laptop/samsung-laptop.c
+++ /dev/null
@@ -1,842 +0,0 @@
-/*
- * Samsung Laptop driver
- *
- * Copyright (C) 2009,2011 Greg Kroah-Hartman (gregkh@suse.de)
- * Copyright (C) 2009,2011 Novell Inc.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published by
- * the Free Software Foundation.
- *
- */
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/delay.h>
-#include <linux/pci.h>
-#include <linux/backlight.h>
-#include <linux/fb.h>
-#include <linux/dmi.h>
-#include <linux/platform_device.h>
-#include <linux/rfkill.h>
-
-/*
- * This driver is needed because a number of Samsung laptops do not hook
- * their control settings through ACPI. So we have to poke around in the
- * BIOS to do things like brightness values, and "special" key controls.
- */
-
-/*
- * We have 0 - 8 as valid brightness levels. The specs say that level 0 should
- * be reserved by the BIOS (which really doesn't make much sense), we tell
- * userspace that the value is 0 - 7 and then just tell the hardware 1 - 8
- */
-#define MAX_BRIGHT 0x07
-
-
-#define SABI_IFACE_MAIN 0x00
-#define SABI_IFACE_SUB 0x02
-#define SABI_IFACE_COMPLETE 0x04
-#define SABI_IFACE_DATA 0x05
-
-/* Structure to get data back to the calling function */
-struct sabi_retval {
- u8 retval[20];
-};
-
-struct sabi_header_offsets {
- u8 port;
- u8 re_mem;
- u8 iface_func;
- u8 en_mem;
- u8 data_offset;
- u8 data_segment;
-};
-
-struct sabi_commands {
- /*
- * Brightness is 0 - 8, as described above.
- * Value 0 is for the BIOS to use
- */
- u8 get_brightness;
- u8 set_brightness;
-
- /*
- * first byte:
- * 0x00 - wireless is off
- * 0x01 - wireless is on
- * second byte:
- * 0x02 - 3G is off
- * 0x03 - 3G is on
- * TODO, verify 3G is correct, that doesn't seem right...
- */
- u8 get_wireless_button;
- u8 set_wireless_button;
-
- /* 0 is off, 1 is on */
- u8 get_backlight;
- u8 set_backlight;
-
- /*
- * 0x80 or 0x00 - no action
- * 0x81 - recovery key pressed
- */
- u8 get_recovery_mode;
- u8 set_recovery_mode;
-
- /*
- * on seclinux: 0 is low, 1 is high,
- * on swsmi: 0 is normal, 1 is silent, 2 is turbo
- */
- u8 get_performance_level;
- u8 set_performance_level;
-
- /*
- * Tell the BIOS that Linux is running on this machine.
- * 81 is on, 80 is off
- */
- u8 set_linux;
-};
-
-struct sabi_performance_level {
- const char *name;
- u8 value;
-};
-
-struct sabi_config {
- const char *test_string;
- u16 main_function;
- const struct sabi_header_offsets header_offsets;
- const struct sabi_commands commands;
- const struct sabi_performance_level performance_levels[4];
- u8 min_brightness;
- u8 max_brightness;
-};
-
-static const struct sabi_config sabi_configs[] = {
- {
- .test_string = "SECLINUX",
-
- .main_function = 0x4c49,
-
- .header_offsets = {
- .port = 0x00,
- .re_mem = 0x02,
- .iface_func = 0x03,
- .en_mem = 0x04,
- .data_offset = 0x05,
- .data_segment = 0x07,
- },
-
- .commands = {
- .get_brightness = 0x00,
- .set_brightness = 0x01,
-
- .get_wireless_button = 0x02,
- .set_wireless_button = 0x03,
-
- .get_backlight = 0x04,
- .set_backlight = 0x05,
-
- .get_recovery_mode = 0x06,
- .set_recovery_mode = 0x07,
-
- .get_performance_level = 0x08,
- .set_performance_level = 0x09,
-
- .set_linux = 0x0a,
- },
-
- .performance_levels = {
- {
- .name = "silent",
- .value = 0,
- },
- {
- .name = "normal",
- .value = 1,
- },
- { },
- },
- .min_brightness = 1,
- .max_brightness = 8,
- },
- {
- .test_string = "SwSmi@",
-
- .main_function = 0x5843,
-
- .header_offsets = {
- .port = 0x00,
- .re_mem = 0x04,
- .iface_func = 0x02,
- .en_mem = 0x03,
- .data_offset = 0x05,
- .data_segment = 0x07,
- },
-
- .commands = {
- .get_brightness = 0x10,
- .set_brightness = 0x11,
-
- .get_wireless_button = 0x12,
- .set_wireless_button = 0x13,
-
- .get_backlight = 0x2d,
- .set_backlight = 0x2e,
-
- .get_recovery_mode = 0xff,
- .set_recovery_mode = 0xff,
-
- .get_performance_level = 0x31,
- .set_performance_level = 0x32,
-
- .set_linux = 0xff,
- },
-
- .performance_levels = {
- {
- .name = "normal",
- .value = 0,
- },
- {
- .name = "silent",
- .value = 1,
- },
- {
- .name = "overclock",
- .value = 2,
- },
- { },
- },
- .min_brightness = 0,
- .max_brightness = 8,
- },
- { },
-};
-
-static const struct sabi_config *sabi_config;
-
-static void __iomem *sabi;
-static void __iomem *sabi_iface;
-static void __iomem *f0000_segment;
-static struct backlight_device *backlight_device;
-static struct mutex sabi_mutex;
-static struct platform_device *sdev;
-static struct rfkill *rfk;
-
-static int force;
-module_param(force, bool, 0);
-MODULE_PARM_DESC(force,
- "Disable the DMI check and forces the driver to be loaded");
-
-static int debug;
-module_param(debug, bool, S_IRUGO | S_IWUSR);
-MODULE_PARM_DESC(debug, "Debug enabled or not");
-
-static int sabi_get_command(u8 command, struct sabi_retval *sretval)
-{
- int retval = 0;
- u16 port = readw(sabi + sabi_config->header_offsets.port);
- u8 complete, iface_data;
-
- mutex_lock(&sabi_mutex);
-
- /* enable memory to be able to write to it */
- outb(readb(sabi + sabi_config->header_offsets.en_mem), port);
-
- /* write out the command */
- writew(sabi_config->main_function, sabi_iface + SABI_IFACE_MAIN);
- writew(command, sabi_iface + SABI_IFACE_SUB);
- writeb(0, sabi_iface + SABI_IFACE_COMPLETE);
- outb(readb(sabi + sabi_config->header_offsets.iface_func), port);
-
- /* write protect memory to make it safe */
- outb(readb(sabi + sabi_config->header_offsets.re_mem), port);
-
- /* see if the command actually succeeded */
- complete = readb(sabi_iface + SABI_IFACE_COMPLETE);
- iface_data = readb(sabi_iface + SABI_IFACE_DATA);
- if (complete != 0xaa || iface_data == 0xff) {
- pr_warn("SABI get command 0x%02x failed with completion flag 0x%02x and data 0x%02x\n",
- command, complete, iface_data);
- retval = -EINVAL;
- goto exit;
- }
- /*
- * Save off the data into a structure so the caller use it.
- * Right now we only want the first 4 bytes,
- * There are commands that need more, but not for the ones we
- * currently care about.
- */
- sretval->retval[0] = readb(sabi_iface + SABI_IFACE_DATA);
- sretval->retval[1] = readb(sabi_iface + SABI_IFACE_DATA + 1);
- sretval->retval[2] = readb(sabi_iface + SABI_IFACE_DATA + 2);
- sretval->retval[3] = readb(sabi_iface + SABI_IFACE_DATA + 3);
-
-exit:
- mutex_unlock(&sabi_mutex);
- return retval;
-
-}
-
-static int sabi_set_command(u8 command, u8 data)
-{
- int retval = 0;
- u16 port = readw(sabi + sabi_config->header_offsets.port);
- u8 complete, iface_data;
-
- mutex_lock(&sabi_mutex);
-
- /* enable memory to be able to write to it */
- outb(readb(sabi + sabi_config->header_offsets.en_mem), port);
-
- /* write out the command */
- writew(sabi_config->main_function, sabi_iface + SABI_IFACE_MAIN);
- writew(command, sabi_iface + SABI_IFACE_SUB);
- writeb(0, sabi_iface + SABI_IFACE_COMPLETE);
- writeb(data, sabi_iface + SABI_IFACE_DATA);
- outb(readb(sabi + sabi_config->header_offsets.iface_func), port);
-
- /* write protect memory to make it safe */
- outb(readb(sabi + sabi_config->header_offsets.re_mem), port);
-
- /* see if the command actually succeeded */
- complete = readb(sabi_iface + SABI_IFACE_COMPLETE);
- iface_data = readb(sabi_iface + SABI_IFACE_DATA);
- if (complete != 0xaa || iface_data == 0xff) {
- pr_warn("SABI set command 0x%02x failed with completion flag 0x%02x and data 0x%02x\n",
- command, complete, iface_data);
- retval = -EINVAL;
- }
-
- mutex_unlock(&sabi_mutex);
- return retval;
-}
-
-static void test_backlight(void)
-{
- struct sabi_retval sretval;
-
- sabi_get_command(sabi_config->commands.get_backlight, &sretval);
- printk(KERN_DEBUG "backlight = 0x%02x\n", sretval.retval[0]);
-
- sabi_set_command(sabi_config->commands.set_backlight, 0);
- printk(KERN_DEBUG "backlight should be off\n");
-
- sabi_get_command(sabi_config->commands.get_backlight, &sretval);
- printk(KERN_DEBUG "backlight = 0x%02x\n", sretval.retval[0]);
-
- msleep(1000);
-
- sabi_set_command(sabi_config->commands.set_backlight, 1);
- printk(KERN_DEBUG "backlight should be on\n");
-
- sabi_get_command(sabi_config->commands.get_backlight, &sretval);
- printk(KERN_DEBUG "backlight = 0x%02x\n", sretval.retval[0]);
-}
-
-static void test_wireless(void)
-{
- struct sabi_retval sretval;
-
- sabi_get_command(sabi_config->commands.get_wireless_button, &sretval);
- printk(KERN_DEBUG "wireless led = 0x%02x\n", sretval.retval[0]);
-
- sabi_set_command(sabi_config->commands.set_wireless_button, 0);
- printk(KERN_DEBUG "wireless led should be off\n");
-
- sabi_get_command(sabi_config->commands.get_wireless_button, &sretval);
- printk(KERN_DEBUG "wireless led = 0x%02x\n", sretval.retval[0]);
-
- msleep(1000);
-
- sabi_set_command(sabi_config->commands.set_wireless_button, 1);
- printk(KERN_DEBUG "wireless led should be on\n");
-
- sabi_get_command(sabi_config->commands.get_wireless_button, &sretval);
- printk(KERN_DEBUG "wireless led = 0x%02x\n", sretval.retval[0]);
-}
-
-static u8 read_brightness(void)
-{
- struct sabi_retval sretval;
- int user_brightness = 0;
- int retval;
-
- retval = sabi_get_command(sabi_config->commands.get_brightness,
- &sretval);
- if (!retval) {
- user_brightness = sretval.retval[0];
- if (user_brightness != 0)
- user_brightness -= sabi_config->min_brightness;
- }
- return user_brightness;
-}
-
-static void set_brightness(u8 user_brightness)
-{
- u8 user_level = user_brightness - sabi_config->min_brightness;
-
- sabi_set_command(sabi_config->commands.set_brightness, user_level);
-}
-
-static int get_brightness(struct backlight_device *bd)
-{
- return (int)read_brightness();
-}
-
-static int update_status(struct backlight_device *bd)
-{
- set_brightness(bd->props.brightness);
-
- if (bd->props.power == FB_BLANK_UNBLANK)
- sabi_set_command(sabi_config->commands.set_backlight, 1);
- else
- sabi_set_command(sabi_config->commands.set_backlight, 0);
- return 0;
-}
-
-static const struct backlight_ops backlight_ops = {
- .get_brightness = get_brightness,
- .update_status = update_status,
-};
-
-static int rfkill_set(void *data, bool blocked)
-{
- /* Do something with blocked...*/
- /*
- * blocked == false is on
- * blocked == true is off
- */
- if (blocked)
- sabi_set_command(sabi_config->commands.set_wireless_button, 0);
- else
- sabi_set_command(sabi_config->commands.set_wireless_button, 1);
-
- return 0;
-}
-
-static struct rfkill_ops rfkill_ops = {
- .set_block = rfkill_set,
-};
-
-static int init_wireless(struct platform_device *sdev)
-{
- int retval;
-
- rfk = rfkill_alloc("samsung-wifi", &sdev->dev, RFKILL_TYPE_WLAN,
- &rfkill_ops, NULL);
- if (!rfk)
- return -ENOMEM;
-
- retval = rfkill_register(rfk);
- if (retval) {
- rfkill_destroy(rfk);
- return -ENODEV;
- }
-
- return 0;
-}
-
-static void destroy_wireless(void)
-{
- rfkill_unregister(rfk);
- rfkill_destroy(rfk);
-}
-
-static ssize_t get_performance_level(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- struct sabi_retval sretval;
- int retval;
- int i;
-
- /* Read the state */
- retval = sabi_get_command(sabi_config->commands.get_performance_level,
- &sretval);
- if (retval)
- return retval;
-
- /* The logic is backwards, yeah, lots of fun... */
- for (i = 0; sabi_config->performance_levels[i].name; ++i) {
- if (sretval.retval[0] == sabi_config->performance_levels[i].value)
- return sprintf(buf, "%s\n", sabi_config->performance_levels[i].name);
- }
- return sprintf(buf, "%s\n", "unknown");
-}
-
-static ssize_t set_performance_level(struct device *dev,
- struct device_attribute *attr, const char *buf,
- size_t count)
-{
- if (count >= 1) {
- int i;
- for (i = 0; sabi_config->performance_levels[i].name; ++i) {
- const struct sabi_performance_level *level =
- &sabi_config->performance_levels[i];
- if (!strncasecmp(level->name, buf, strlen(level->name))) {
- sabi_set_command(sabi_config->commands.set_performance_level,
- level->value);
- break;
- }
- }
- if (!sabi_config->performance_levels[i].name)
- return -EINVAL;
- }
- return count;
-}
-static DEVICE_ATTR(performance_level, S_IWUSR | S_IRUGO,
- get_performance_level, set_performance_level);
-
-
-static int __init dmi_check_cb(const struct dmi_system_id *id)
-{
- pr_info("found laptop model '%s'\n",
- id->ident);
- return 0;
-}
-
-static struct dmi_system_id __initdata samsung_dmi_table[] = {
- {
- .ident = "N128",
- .matches = {
- DMI_MATCH(DMI_SYS_VENDOR,
- "SAMSUNG ELECTRONICS CO., LTD."),
- DMI_MATCH(DMI_PRODUCT_NAME, "N128"),
- DMI_MATCH(DMI_BOARD_NAME, "N128"),
- },
- .callback = dmi_check_cb,
- },
- {
- .ident = "N130",
- .matches = {
- DMI_MATCH(DMI_SYS_VENDOR,
- "SAMSUNG ELECTRONICS CO., LTD."),
- DMI_MATCH(DMI_PRODUCT_NAME, "N130"),
- DMI_MATCH(DMI_BOARD_NAME, "N130"),
- },
- .callback = dmi_check_cb,
- },
- {
- .ident = "X125",
- .matches = {
- DMI_MATCH(DMI_SYS_VENDOR,
- "SAMSUNG ELECTRONICS CO., LTD."),
- DMI_MATCH(DMI_PRODUCT_NAME, "X125"),
- DMI_MATCH(DMI_BOARD_NAME, "X125"),
- },
- .callback = dmi_check_cb,
- },
- {
- .ident = "X120/X170",
- .matches = {
- DMI_MATCH(DMI_SYS_VENDOR,
- "SAMSUNG ELECTRONICS CO., LTD."),
- DMI_MATCH(DMI_PRODUCT_NAME, "X120/X170"),
- DMI_MATCH(DMI_BOARD_NAME, "X120/X170"),
- },
- .callback = dmi_check_cb,
- },
- {
- .ident = "NC10",
- .matches = {
- DMI_MATCH(DMI_SYS_VENDOR,
- "SAMSUNG ELECTRONICS CO., LTD."),
- DMI_MATCH(DMI_PRODUCT_NAME, "NC10"),
- DMI_MATCH(DMI_BOARD_NAME, "NC10"),
- },
- .callback = dmi_check_cb,
- },
- {
- .ident = "NP-Q45",
- .matches = {
- DMI_MATCH(DMI_SYS_VENDOR,
- "SAMSUNG ELECTRONICS CO., LTD."),
- DMI_MATCH(DMI_PRODUCT_NAME, "SQ45S70S"),
- DMI_MATCH(DMI_BOARD_NAME, "SQ45S70S"),
- },
- .callback = dmi_check_cb,
- },
- {
- .ident = "X360",
- .matches = {
- DMI_MATCH(DMI_SYS_VENDOR,
- "SAMSUNG ELECTRONICS CO., LTD."),
- DMI_MATCH(DMI_PRODUCT_NAME, "X360"),
- DMI_MATCH(DMI_BOARD_NAME, "X360"),
- },
- .callback = dmi_check_cb,
- },
- {
- .ident = "R410 Plus",
- .matches = {
- DMI_MATCH(DMI_SYS_VENDOR,
- "SAMSUNG ELECTRONICS CO., LTD."),
- DMI_MATCH(DMI_PRODUCT_NAME, "R410P"),
- DMI_MATCH(DMI_BOARD_NAME, "R460"),
- },
- .callback = dmi_check_cb,
- },
- {
- .ident = "R518",
- .matches = {
- DMI_MATCH(DMI_SYS_VENDOR,
- "SAMSUNG ELECTRONICS CO., LTD."),
- DMI_MATCH(DMI_PRODUCT_NAME, "R518"),
- DMI_MATCH(DMI_BOARD_NAME, "R518"),
- },
- .callback = dmi_check_cb,
- },
- {
- .ident = "R519/R719",
- .matches = {
- DMI_MATCH(DMI_SYS_VENDOR,
- "SAMSUNG ELECTRONICS CO., LTD."),
- DMI_MATCH(DMI_PRODUCT_NAME, "R519/R719"),
- DMI_MATCH(DMI_BOARD_NAME, "R519/R719"),
- },
- .callback = dmi_check_cb,
- },
- {
- .ident = "N150/N210/N220/N230",
- .matches = {
- DMI_MATCH(DMI_SYS_VENDOR,
- "SAMSUNG ELECTRONICS CO., LTD."),
- DMI_MATCH(DMI_PRODUCT_NAME, "N150/N210/N220/N230"),
- DMI_MATCH(DMI_BOARD_NAME, "N150/N210/N220/N230"),
- },
- .callback = dmi_check_cb,
- },
- {
- .ident = "N150P/N210P/N220P",
- .matches = {
- DMI_MATCH(DMI_SYS_VENDOR,
- "SAMSUNG ELECTRONICS CO., LTD."),
- DMI_MATCH(DMI_PRODUCT_NAME, "N150P/N210P/N220P"),
- DMI_MATCH(DMI_BOARD_NAME, "N150P/N210P/N220P"),
- },
- .callback = dmi_check_cb,
- },
- {
- .ident = "R530/R730",
- .matches = {
- DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
- DMI_MATCH(DMI_PRODUCT_NAME, "R530/R730"),
- DMI_MATCH(DMI_BOARD_NAME, "R530/R730"),
- },
- .callback = dmi_check_cb,
- },
- {
- .ident = "NF110/NF210/NF310",
- .matches = {
- DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
- DMI_MATCH(DMI_PRODUCT_NAME, "NF110/NF210/NF310"),
- DMI_MATCH(DMI_BOARD_NAME, "NF110/NF210/NF310"),
- },
- .callback = dmi_check_cb,
- },
- {
- .ident = "N145P/N250P/N260P",
- .matches = {
- DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
- DMI_MATCH(DMI_PRODUCT_NAME, "N145P/N250P/N260P"),
- DMI_MATCH(DMI_BOARD_NAME, "N145P/N250P/N260P"),
- },
- .callback = dmi_check_cb,
- },
- {
- .ident = "R70/R71",
- .matches = {
- DMI_MATCH(DMI_SYS_VENDOR,
- "SAMSUNG ELECTRONICS CO., LTD."),
- DMI_MATCH(DMI_PRODUCT_NAME, "R70/R71"),
- DMI_MATCH(DMI_BOARD_NAME, "R70/R71"),
- },
- .callback = dmi_check_cb,
- },
- {
- .ident = "P460",
- .matches = {
- DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
- DMI_MATCH(DMI_PRODUCT_NAME, "P460"),
- DMI_MATCH(DMI_BOARD_NAME, "P460"),
- },
- .callback = dmi_check_cb,
- },
- { },
-};
-MODULE_DEVICE_TABLE(dmi, samsung_dmi_table);
-
-static int find_signature(void __iomem *memcheck, const char *testStr)
-{
- int i = 0;
- int loca;
-
- for (loca = 0; loca < 0xffff; loca++) {
- char temp = readb(memcheck + loca);
-
- if (temp == testStr[i]) {
- if (i == strlen(testStr)-1)
- break;
- ++i;
- } else {
- i = 0;
- }
- }
- return loca;
-}
-
-static int __init samsung_init(void)
-{
- struct backlight_properties props;
- struct sabi_retval sretval;
- unsigned int ifaceP;
- int i;
- int loca;
- int retval;
-
- mutex_init(&sabi_mutex);
-
- if (!force && !dmi_check_system(samsung_dmi_table))
- return -ENODEV;
-
- f0000_segment = ioremap_nocache(0xf0000, 0xffff);
- if (!f0000_segment) {
- pr_err("Can't map the segment at 0xf0000\n");
- return -EINVAL;
- }
-
- /* Try to find one of the signatures in memory to find the header */
- for (i = 0; sabi_configs[i].test_string != 0; ++i) {
- sabi_config = &sabi_configs[i];
- loca = find_signature(f0000_segment, sabi_config->test_string);
- if (loca != 0xffff)
- break;
- }
-
- if (loca == 0xffff) {
- pr_err("This computer does not support SABI\n");
- goto error_no_signature;
- }
-
- /* point to the SMI port Number */
- loca += 1;
- sabi = (f0000_segment + loca);
-
- if (debug) {
- printk(KERN_DEBUG "This computer supports SABI==%x\n",
- loca + 0xf0000 - 6);
- printk(KERN_DEBUG "SABI header:\n");
- printk(KERN_DEBUG " SMI Port Number = 0x%04x\n",
- readw(sabi + sabi_config->header_offsets.port));
- printk(KERN_DEBUG " SMI Interface Function = 0x%02x\n",
- readb(sabi + sabi_config->header_offsets.iface_func));
- printk(KERN_DEBUG " SMI enable memory buffer = 0x%02x\n",
- readb(sabi + sabi_config->header_offsets.en_mem));
- printk(KERN_DEBUG " SMI restore memory buffer = 0x%02x\n",
- readb(sabi + sabi_config->header_offsets.re_mem));
- printk(KERN_DEBUG " SABI data offset = 0x%04x\n",
- readw(sabi + sabi_config->header_offsets.data_offset));
- printk(KERN_DEBUG " SABI data segment = 0x%04x\n",
- readw(sabi + sabi_config->header_offsets.data_segment));
- }
-
- /* Get a pointer to the SABI Interface */
- ifaceP = (readw(sabi + sabi_config->header_offsets.data_segment) & 0x0ffff) << 4;
- ifaceP += readw(sabi + sabi_config->header_offsets.data_offset) & 0x0ffff;
- sabi_iface = ioremap_nocache(ifaceP, 16);
- if (!sabi_iface) {
- pr_err("Can't remap %x\n", ifaceP);
- goto exit;
- }
- if (debug) {
- printk(KERN_DEBUG "ifaceP = 0x%08x\n", ifaceP);
- printk(KERN_DEBUG "sabi_iface = %p\n", sabi_iface);
-
- test_backlight();
- test_wireless();
-
- retval = sabi_get_command(sabi_config->commands.get_brightness,
- &sretval);
- printk(KERN_DEBUG "brightness = 0x%02x\n", sretval.retval[0]);
- }
-
- /* Turn on "Linux" mode in the BIOS */
- if (sabi_config->commands.set_linux != 0xff) {
- retval = sabi_set_command(sabi_config->commands.set_linux,
- 0x81);
- if (retval) {
- pr_warn("Linux mode was not set!\n");
- goto error_no_platform;
- }
- }
-
- /* knock up a platform device to hang stuff off of */
- sdev = platform_device_register_simple("samsung", -1, NULL, 0);
- if (IS_ERR(sdev))
- goto error_no_platform;
-
- /* create a backlight device to talk to this one */
- memset(&props, 0, sizeof(struct backlight_properties));
- props.max_brightness = sabi_config->max_brightness;
- backlight_device = backlight_device_register("samsung", &sdev->dev,
- NULL, &backlight_ops,
- &props);
- if (IS_ERR(backlight_device))
- goto error_no_backlight;
-
- backlight_device->props.brightness = read_brightness();
- backlight_device->props.power = FB_BLANK_UNBLANK;
- backlight_update_status(backlight_device);
-
- retval = init_wireless(sdev);
- if (retval)
- goto error_no_rfk;
-
- retval = device_create_file(&sdev->dev, &dev_attr_performance_level);
- if (retval)
- goto error_file_create;
-
-exit:
- return 0;
-
-error_file_create:
- destroy_wireless();
-
-error_no_rfk:
- backlight_device_unregister(backlight_device);
-
-error_no_backlight:
- platform_device_unregister(sdev);
-
-error_no_platform:
- iounmap(sabi_iface);
-
-error_no_signature:
- iounmap(f0000_segment);
- return -EINVAL;
-}
-
-static void __exit samsung_exit(void)
-{
- /* Turn off "Linux" mode in the BIOS */
- if (sabi_config->commands.set_linux != 0xff)
- sabi_set_command(sabi_config->commands.set_linux, 0x80);
-
- device_remove_file(&sdev->dev, &dev_attr_performance_level);
- backlight_device_unregister(backlight_device);
- destroy_wireless();
- iounmap(sabi_iface);
- iounmap(f0000_segment);
- platform_device_unregister(sdev);
-}
-
-module_init(samsung_init);
-module_exit(samsung_exit);
-
-MODULE_AUTHOR("Greg Kroah-Hartman <gregkh@suse.de>");
-MODULE_DESCRIPTION("Samsung Backlight driver");
-MODULE_LICENSE("GPL");
diff --git a/drivers/staging/se401/Kconfig b/drivers/staging/se401/Kconfig
deleted file mode 100644
index b7f8222ad21b..000000000000
--- a/drivers/staging/se401/Kconfig
+++ /dev/null
@@ -1,13 +0,0 @@
-config USB_SE401
- tristate "USB SE401 Camera support (DEPRECATED)"
- depends on VIDEO_DEV && VIDEO_V4L2_COMMON && USB
- ---help---
- Say Y here if you want to connect this type of camera to your
- computer's USB port. See <file:Documentation/video4linux/se401.txt>
- for more information and for a list of supported cameras.
-
- This driver uses the deprecated V4L1 API and will be removed in
- 2.6.39, unless someone converts it to the V4L2 API.
-
- To compile this driver as a module, choose M here: the
- module will be called se401.
diff --git a/drivers/staging/se401/Makefile b/drivers/staging/se401/Makefile
deleted file mode 100644
index b465d49783af..000000000000
--- a/drivers/staging/se401/Makefile
+++ /dev/null
@@ -1 +0,0 @@
-obj-$(CONFIG_USB_SE401) += se401.o
diff --git a/drivers/staging/se401/TODO b/drivers/staging/se401/TODO
deleted file mode 100644
index 3b2c03836286..000000000000
--- a/drivers/staging/se401/TODO
+++ /dev/null
@@ -1,5 +0,0 @@
-This is an obsolete driver for some old webcams that still use V4L1 API.
-As V4L1 support is being removed from kernel, if nobody take care on it,
-the driver will be removed for 2.6.39.
-
-Please send patches to linux-media@vger.kernel.org
diff --git a/drivers/staging/se401/se401.c b/drivers/staging/se401/se401.c
deleted file mode 100644
index 41360d7c3e96..000000000000
--- a/drivers/staging/se401/se401.c
+++ /dev/null
@@ -1,1492 +0,0 @@
-/*
- * Endpoints (formerly known as AOX) se401 USB Camera Driver
- *
- * Copyright (c) 2000 Jeroen B. Vreeken (pe1rxq@amsat.org)
- *
- * Still somewhat based on the Linux ov511 driver.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *
- * Thanks to Endpoints Inc. (www.endpoints.com) for making documentation on
- * their chipset available and supporting me while writing this driver.
- * - Jeroen Vreeken
- */
-
-static const char version[] = "0.24";
-
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/vmalloc.h>
-#include <linux/slab.h>
-#include <linux/pagemap.h>
-#include <linux/usb.h>
-#include "se401.h"
-
-static int flickerless;
-static int video_nr = -1;
-
-static struct usb_device_id device_table[] = {
- { USB_DEVICE(0x03e8, 0x0004) },/* Endpoints/Aox SE401 */
- { USB_DEVICE(0x0471, 0x030b) },/* Philips PCVC665K */
- { USB_DEVICE(0x047d, 0x5001) },/* Kensington 67014 */
- { USB_DEVICE(0x047d, 0x5002) },/* Kensington 6701(5/7) */
- { USB_DEVICE(0x047d, 0x5003) },/* Kensington 67016 */
- { }
-};
-
-MODULE_DEVICE_TABLE(usb, device_table);
-
-MODULE_AUTHOR("Jeroen Vreeken <pe1rxq@amsat.org>");
-MODULE_DESCRIPTION("SE401 USB Camera Driver");
-MODULE_LICENSE("GPL");
-module_param(flickerless, int, 0);
-MODULE_PARM_DESC(flickerless,
- "Net frequency to adjust exposure time to (0/50/60)");
-module_param(video_nr, int, 0);
-
-static struct usb_driver se401_driver;
-
-
-/**********************************************************************
- *
- * Memory management
- *
- **********************************************************************/
-static void *rvmalloc(unsigned long size)
-{
- void *mem;
- unsigned long adr;
-
- size = PAGE_ALIGN(size);
- mem = vmalloc_32(size);
- if (!mem)
- return NULL;
-
- memset(mem, 0, size); /* Clear the ram out, no junk to the user */
- adr = (unsigned long) mem;
- while (size > 0) {
- SetPageReserved(vmalloc_to_page((void *)adr));
- adr += PAGE_SIZE;
- size -= PAGE_SIZE;
- }
-
- return mem;
-}
-
-static void rvfree(void *mem, unsigned long size)
-{
- unsigned long adr;
-
- if (!mem)
- return;
-
- adr = (unsigned long) mem;
- while ((long) size > 0) {
- ClearPageReserved(vmalloc_to_page((void *)adr));
- adr += PAGE_SIZE;
- size -= PAGE_SIZE;
- }
- vfree(mem);
-}
-
-
-
-/****************************************************************************
- *
- * se401 register read/write functions
- *
- ***************************************************************************/
-
-static int se401_sndctrl(int set, struct usb_se401 *se401, unsigned short req,
- unsigned short value, unsigned char *cp, int size)
-{
- return usb_control_msg(
- se401->dev,
- set ? usb_sndctrlpipe(se401->dev, 0) : usb_rcvctrlpipe(se401->dev, 0),
- req,
- (set ? USB_DIR_OUT : USB_DIR_IN) | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
- value,
- 0,
- cp,
- size,
- 1000
- );
-}
-
-static int se401_set_feature(struct usb_se401 *se401, unsigned short selector,
- unsigned short param)
-{
- /* specs say that the selector (address) should go in the value field
- and the param in index, but in the logs of the windows driver they do
- this the other way around...
- */
- return usb_control_msg(
- se401->dev,
- usb_sndctrlpipe(se401->dev, 0),
- SE401_REQ_SET_EXT_FEATURE,
- USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
- param,
- selector,
- NULL,
- 0,
- 1000
- );
-}
-
-static unsigned short se401_get_feature(struct usb_se401 *se401,
- unsigned short selector)
-{
- /* For 'set' the selecetor should be in index, not sure if the spec is
- wrong here to....
- */
- unsigned char cp[2];
- usb_control_msg(
- se401->dev,
- usb_rcvctrlpipe(se401->dev, 0),
- SE401_REQ_GET_EXT_FEATURE,
- USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
- 0,
- selector,
- cp,
- 2,
- 1000
- );
- return cp[0]+cp[1]*256;
-}
-
-/****************************************************************************
- *
- * Camera control
- *
- ***************************************************************************/
-
-
-static int se401_send_pict(struct usb_se401 *se401)
-{
- /* integration time low */
- se401_set_feature(se401, HV7131_REG_TITL, se401->expose_l);
- /* integration time mid */
- se401_set_feature(se401, HV7131_REG_TITM, se401->expose_m);
- /* integration time mid */
- se401_set_feature(se401, HV7131_REG_TITU, se401->expose_h);
- /* reset level value */
- se401_set_feature(se401, HV7131_REG_ARLV, se401->resetlevel);
- /* red color gain */
- se401_set_feature(se401, HV7131_REG_ARCG, se401->rgain);
- /* green color gain */
- se401_set_feature(se401, HV7131_REG_AGCG, se401->ggain);
- /* blue color gain */
- se401_set_feature(se401, HV7131_REG_ABCG, se401->bgain);
-
- return 0;
-}
-
-static void se401_set_exposure(struct usb_se401 *se401, int brightness)
-{
- int integration = brightness << 5;
-
- if (flickerless == 50)
- integration = integration-integration % 106667;
- if (flickerless == 60)
- integration = integration-integration % 88889;
- se401->brightness = integration >> 5;
- se401->expose_h = (integration >> 16) & 0xff;
- se401->expose_m = (integration >> 8) & 0xff;
- se401->expose_l = integration & 0xff;
-}
-
-static int se401_get_pict(struct usb_se401 *se401, struct video_picture *p)
-{
- p->brightness = se401->brightness;
- if (se401->enhance)
- p->whiteness = 32768;
- else
- p->whiteness = 0;
-
- p->colour = 65535;
- p->contrast = 65535;
- p->hue = se401->rgain << 10;
- p->palette = se401->palette;
- p->depth = 3; /* rgb24 */
- return 0;
-}
-
-
-static int se401_set_pict(struct usb_se401 *se401, struct video_picture *p)
-{
- if (p->palette != VIDEO_PALETTE_RGB24)
- return 1;
- se401->palette = p->palette;
- if (p->hue != se401->hue) {
- se401->rgain = p->hue >> 10;
- se401->bgain = 0x40-(p->hue >> 10);
- se401->hue = p->hue;
- }
- if (p->brightness != se401->brightness)
- se401_set_exposure(se401, p->brightness);
-
- if (p->whiteness >= 32768)
- se401->enhance = 1;
- else
- se401->enhance = 0;
- se401_send_pict(se401);
- se401_send_pict(se401);
- return 0;
-}
-
-/*
- Hyundai have some really nice docs about this and other sensor related
- stuff on their homepage: www.hei.co.kr
-*/
-static void se401_auto_resetlevel(struct usb_se401 *se401)
-{
- unsigned int ahrc, alrc;
- int oldreset = se401->resetlevel;
-
- /* For some reason this normally read-only register doesn't get reset
- to zero after reading them just once...
- */
- se401_get_feature(se401, HV7131_REG_HIREFNOH);
- se401_get_feature(se401, HV7131_REG_HIREFNOL);
- se401_get_feature(se401, HV7131_REG_LOREFNOH);
- se401_get_feature(se401, HV7131_REG_LOREFNOL);
- ahrc = 256*se401_get_feature(se401, HV7131_REG_HIREFNOH) +
- se401_get_feature(se401, HV7131_REG_HIREFNOL);
- alrc = 256*se401_get_feature(se401, HV7131_REG_LOREFNOH) +
- se401_get_feature(se401, HV7131_REG_LOREFNOL);
-
- /* Not an exact science, but it seems to work pretty well... */
- if (alrc > 10) {
- while (alrc >= 10 && se401->resetlevel < 63) {
- se401->resetlevel++;
- alrc /= 2;
- }
- } else if (ahrc > 20) {
- while (ahrc >= 20 && se401->resetlevel > 0) {
- se401->resetlevel--;
- ahrc /= 2;
- }
- }
- if (se401->resetlevel != oldreset)
- se401_set_feature(se401, HV7131_REG_ARLV, se401->resetlevel);
-
- return;
-}
-
-/* irq handler for snapshot button */
-static void se401_button_irq(struct urb *urb)
-{
- struct usb_se401 *se401 = urb->context;
- int status;
-
- if (!se401->dev) {
- dev_info(&urb->dev->dev, "device vapourished\n");
- return;
- }
-
- switch (urb->status) {
- case 0:
- /* success */
- break;
- case -ECONNRESET:
- case -ENOENT:
- case -ESHUTDOWN:
- /* this urb is terminated, clean up */
- dbg("%s - urb shutting down with status: %d",
- __func__, urb->status);
- return;
- default:
- dbg("%s - nonzero urb status received: %d",
- __func__, urb->status);
- goto exit;
- }
-
- if (urb->actual_length >= 2)
- if (se401->button)
- se401->buttonpressed = 1;
-exit:
- status = usb_submit_urb(urb, GFP_ATOMIC);
- if (status)
- err("%s - usb_submit_urb failed with result %d",
- __func__, status);
-}
-
-static void se401_video_irq(struct urb *urb)
-{
- struct usb_se401 *se401 = urb->context;
- int length = urb->actual_length;
-
- /* ohoh... */
- if (!se401->streaming)
- return;
-
- if (!se401->dev) {
- dev_info(&urb->dev->dev, "device vapourished\n");
- return;
- }
-
- /* 0 sized packets happen if we are to fast, but sometimes the camera
- keeps sending them forever...
- */
- if (length && !urb->status) {
- se401->nullpackets = 0;
- switch (se401->scratch[se401->scratch_next].state) {
- case BUFFER_READY:
- case BUFFER_BUSY:
- se401->dropped++;
- break;
- case BUFFER_UNUSED:
- memcpy(se401->scratch[se401->scratch_next].data,
- (unsigned char *)urb->transfer_buffer, length);
- se401->scratch[se401->scratch_next].state
- = BUFFER_READY;
- se401->scratch[se401->scratch_next].offset
- = se401->bayeroffset;
- se401->scratch[se401->scratch_next].length = length;
- if (waitqueue_active(&se401->wq))
- wake_up_interruptible(&se401->wq);
- se401->scratch_overflow = 0;
- se401->scratch_next++;
- if (se401->scratch_next >= SE401_NUMSCRATCH)
- se401->scratch_next = 0;
- break;
- }
- se401->bayeroffset += length;
- if (se401->bayeroffset >= se401->cheight * se401->cwidth)
- se401->bayeroffset = 0;
- } else {
- se401->nullpackets++;
- if (se401->nullpackets > SE401_MAX_NULLPACKETS)
- if (waitqueue_active(&se401->wq))
- wake_up_interruptible(&se401->wq);
- }
-
- /* Resubmit urb for new data */
- urb->status = 0;
- urb->dev = se401->dev;
- if (usb_submit_urb(urb, GFP_KERNEL))
- dev_info(&urb->dev->dev, "urb burned down\n");
- return;
-}
-
-static void se401_send_size(struct usb_se401 *se401, int width, int height)
-{
- int i = 0;
- int mode = 0x03; /* No compression */
- int sendheight = height;
- int sendwidth = width;
-
- /* JangGu compression can only be used with the camera supported sizes,
- but bayer seems to work with any size that fits on the sensor.
- We check if we can use compression with the current size with either
- 4 or 16 times subcapturing, if not we use uncompressed bayer data
- but this will result in cutouts of the maximum size....
- */
- while (i < se401->sizes && !(se401->width[i] == width &&
- se401->height[i] == height))
- i++;
- while (i < se401->sizes) {
- if (se401->width[i] == width * 2 &&
- se401->height[i] == height * 2) {
- sendheight = se401->height[i];
- sendwidth = se401->width[i];
- mode = 0x40;
- }
- if (se401->width[i] == width * 4 &&
- se401->height[i] == height * 4) {
- sendheight = se401->height[i];
- sendwidth = se401->width[i];
- mode = 0x42;
- }
- i++;
- }
-
- se401_sndctrl(1, se401, SE401_REQ_SET_WIDTH, sendwidth, NULL, 0);
- se401_sndctrl(1, se401, SE401_REQ_SET_HEIGHT, sendheight, NULL, 0);
- se401_set_feature(se401, SE401_OPERATINGMODE, mode);
-
- if (mode == 0x03)
- se401->format = FMT_BAYER;
- else
- se401->format = FMT_JANGGU;
-}
-
-/*
- In this function se401_send_pict is called several times,
- for some reason (depending on the state of the sensor and the phase of
- the moon :) doing this only in either place doesn't always work...
-*/
-static int se401_start_stream(struct usb_se401 *se401)
-{
- struct urb *urb;
- int err = 0, i;
- se401->streaming = 1;
-
- se401_sndctrl(1, se401, SE401_REQ_CAMERA_POWER, 1, NULL, 0);
- se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 1, NULL, 0);
-
- /* Set picture settings */
- /* windowed + pix intg */
- se401_set_feature(se401, HV7131_REG_MODE_B, 0x05);
- se401_send_pict(se401);
-
- se401_send_size(se401, se401->cwidth, se401->cheight);
-
- se401_sndctrl(1, se401, SE401_REQ_START_CONTINUOUS_CAPTURE,
- 0, NULL, 0);
-
- /* Do some memory allocation */
- for (i = 0; i < SE401_NUMFRAMES; i++) {
- se401->frame[i].data = se401->fbuf + i * se401->maxframesize;
- se401->frame[i].curpix = 0;
- }
- for (i = 0; i < SE401_NUMSBUF; i++) {
- se401->sbuf[i].data = kmalloc(SE401_PACKETSIZE, GFP_KERNEL);
- if (!se401->sbuf[i].data) {
- for (i = i - 1; i >= 0; i--) {
- kfree(se401->sbuf[i].data);
- se401->sbuf[i].data = NULL;
- }
- return -ENOMEM;
- }
- }
-
- se401->bayeroffset = 0;
- se401->scratch_next = 0;
- se401->scratch_use = 0;
- se401->scratch_overflow = 0;
- for (i = 0; i < SE401_NUMSCRATCH; i++) {
- se401->scratch[i].data = kmalloc(SE401_PACKETSIZE, GFP_KERNEL);
- if (!se401->scratch[i].data) {
- for (i = i - 1; i >= 0; i--) {
- kfree(se401->scratch[i].data);
- se401->scratch[i].data = NULL;
- }
- goto nomem_sbuf;
- }
- se401->scratch[i].state = BUFFER_UNUSED;
- }
-
- for (i = 0; i < SE401_NUMSBUF; i++) {
- urb = usb_alloc_urb(0, GFP_KERNEL);
- if (!urb) {
- for (i = i - 1; i >= 0; i--) {
- usb_kill_urb(se401->urb[i]);
- usb_free_urb(se401->urb[i]);
- se401->urb[i] = NULL;
- }
- goto nomem_scratch;
- }
-
- usb_fill_bulk_urb(urb, se401->dev,
- usb_rcvbulkpipe(se401->dev, SE401_VIDEO_ENDPOINT),
- se401->sbuf[i].data, SE401_PACKETSIZE,
- se401_video_irq,
- se401);
-
- se401->urb[i] = urb;
-
- err = usb_submit_urb(se401->urb[i], GFP_KERNEL);
- if (err)
- err("urb burned down");
- }
-
- se401->framecount = 0;
-
- return 0;
-
- nomem_scratch:
- for (i = 0; i < SE401_NUMSCRATCH; i++) {
- kfree(se401->scratch[i].data);
- se401->scratch[i].data = NULL;
- }
- nomem_sbuf:
- for (i = 0; i < SE401_NUMSBUF; i++) {
- kfree(se401->sbuf[i].data);
- se401->sbuf[i].data = NULL;
- }
- return -ENOMEM;
-}
-
-static int se401_stop_stream(struct usb_se401 *se401)
-{
- int i;
-
- if (!se401->streaming || !se401->dev)
- return 1;
-
- se401->streaming = 0;
-
- se401_sndctrl(1, se401, SE401_REQ_STOP_CONTINUOUS_CAPTURE, 0, NULL, 0);
-
- se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 0, NULL, 0);
- se401_sndctrl(1, se401, SE401_REQ_CAMERA_POWER, 0, NULL, 0);
-
- for (i = 0; i < SE401_NUMSBUF; i++)
- if (se401->urb[i]) {
- usb_kill_urb(se401->urb[i]);
- usb_free_urb(se401->urb[i]);
- se401->urb[i] = NULL;
- kfree(se401->sbuf[i].data);
- }
- for (i = 0; i < SE401_NUMSCRATCH; i++) {
- kfree(se401->scratch[i].data);
- se401->scratch[i].data = NULL;
- }
-
- return 0;
-}
-
-static int se401_set_size(struct usb_se401 *se401, int width, int height)
-{
- int wasstreaming = se401->streaming;
- /* Check to see if we need to change */
- if (se401->cwidth == width && se401->cheight == height)
- return 0;
-
- /* Check for a valid mode */
- if (!width || !height)
- return 1;
- if ((width & 1) || (height & 1))
- return 1;
- if (width > se401->width[se401->sizes-1])
- return 1;
- if (height > se401->height[se401->sizes-1])
- return 1;
-
- /* Stop a current stream and start it again at the new size */
- if (wasstreaming)
- se401_stop_stream(se401);
- se401->cwidth = width;
- se401->cheight = height;
- if (wasstreaming)
- se401_start_stream(se401);
- return 0;
-}
-
-
-/****************************************************************************
- *
- * Video Decoding
- *
- ***************************************************************************/
-
-/*
- This shouldn't really be done in a v4l driver....
- But it does make the image look a lot more usable.
- Basically it lifts the dark pixels more than the light pixels.
-*/
-static inline void enhance_picture(unsigned char *frame, int len)
-{
- while (len--) {
- *frame = (((*frame^255)*(*frame^255))/255)^255;
- frame++;
- }
-}
-
-static inline void decode_JangGu_integrate(struct usb_se401 *se401, int data)
-{
- struct se401_frame *frame = &se401->frame[se401->curframe];
- int linelength = se401->cwidth * 3;
-
- if (frame->curlinepix >= linelength) {
- frame->curlinepix = 0;
- frame->curline += linelength;
- }
-
- /* First three are absolute, all others relative.
- * Format is rgb from right to left (mirrorred image),
- * we flip it to get bgr from left to right. */
- if (frame->curlinepix < 3)
- *(frame->curline-frame->curlinepix) = 1 + data * 4;
- else
- *(frame->curline-frame->curlinepix) =
- *(frame->curline-frame->curlinepix + 3) + data * 4;
- frame->curlinepix++;
-}
-
-static inline void decode_JangGu_vlc(struct usb_se401 *se401,
- unsigned char *data, int bit_exp, int packetlength)
-{
- int pos = 0;
- int vlc_cod = 0;
- int vlc_size = 0;
- int vlc_data = 0;
- int bit_cur;
- int bit;
- data += 4;
- while (pos < packetlength) {
- bit_cur = 8;
- while (bit_cur && bit_exp) {
- bit = ((*data) >> (bit_cur-1))&1;
- if (!vlc_cod) {
- if (bit) {
- vlc_size++;
- } else {
- if (!vlc_size)
- decode_JangGu_integrate(se401, 0);
- else {
- vlc_cod = 2;
- vlc_data = 0;
- }
- }
- } else {
- if (vlc_cod == 2) {
- if (!bit)
- vlc_data = -(1 << vlc_size) + 1;
- vlc_cod--;
- }
- vlc_size--;
- vlc_data += bit << vlc_size;
- if (!vlc_size) {
- decode_JangGu_integrate(se401, vlc_data);
- vlc_cod = 0;
- }
- }
- bit_cur--;
- bit_exp--;
- }
- pos++;
- data++;
- }
-}
-
-static inline void decode_JangGu(struct usb_se401 *se401,
- struct se401_scratch *buffer)
-{
- unsigned char *data = buffer->data;
- int len = buffer->length;
- int bit_exp = 0, pix_exp = 0, frameinfo = 0, packetlength = 0, size;
- int datapos = 0;
-
- /* New image? */
- if (!se401->frame[se401->curframe].curpix) {
- se401->frame[se401->curframe].curlinepix = 0;
- se401->frame[se401->curframe].curline =
- se401->frame[se401->curframe].data+
- se401->cwidth * 3 - 1;
- if (se401->frame[se401->curframe].grabstate == FRAME_READY)
- se401->frame[se401->curframe].grabstate = FRAME_GRABBING;
- se401->vlcdatapos = 0;
- }
- while (datapos < len) {
- size = 1024 - se401->vlcdatapos;
- if (size+datapos > len)
- size = len-datapos;
- memcpy(se401->vlcdata+se401->vlcdatapos, data+datapos, size);
- se401->vlcdatapos += size;
- packetlength = 0;
- if (se401->vlcdatapos >= 4) {
- bit_exp = se401->vlcdata[3] + (se401->vlcdata[2] << 8);
- pix_exp = se401->vlcdata[1] +
- ((se401->vlcdata[0] & 0x3f) << 8);
- frameinfo = se401->vlcdata[0] & 0xc0;
- packetlength = ((bit_exp + 47) >> 4) << 1;
- if (packetlength > 1024) {
- se401->vlcdatapos = 0;
- datapos = len;
- packetlength = 0;
- se401->error++;
- se401->frame[se401->curframe].curpix = 0;
- }
- }
- if (packetlength && se401->vlcdatapos >= packetlength) {
- decode_JangGu_vlc(se401, se401->vlcdata, bit_exp,
- packetlength);
- se401->frame[se401->curframe].curpix += pix_exp * 3;
- datapos += size-(se401->vlcdatapos-packetlength);
- se401->vlcdatapos = 0;
- if (se401->frame[se401->curframe].curpix >= se401->cwidth * se401->cheight * 3) {
- if (se401->frame[se401->curframe].curpix == se401->cwidth * se401->cheight * 3) {
- if (se401->frame[se401->curframe].grabstate == FRAME_GRABBING) {
- se401->frame[se401->curframe].grabstate = FRAME_DONE;
- se401->framecount++;
- se401->readcount++;
- }
- if (se401->frame[(se401->curframe + 1) & (SE401_NUMFRAMES - 1)].grabstate == FRAME_READY)
- se401->curframe = (se401->curframe + 1) & (SE401_NUMFRAMES - 1);
- } else
- se401->error++;
- se401->frame[se401->curframe].curpix = 0;
- datapos = len;
- }
- } else
- datapos += size;
- }
-}
-
-static inline void decode_bayer(struct usb_se401 *se401,
- struct se401_scratch *buffer)
-{
- unsigned char *data = buffer->data;
- int len = buffer->length;
- int offset = buffer->offset;
- int datasize = se401->cwidth * se401->cheight;
- struct se401_frame *frame = &se401->frame[se401->curframe];
- unsigned char *framedata = frame->data, *curline, *nextline;
- int width = se401->cwidth;
- int blineoffset = 0, bline;
- int linelength = width * 3, i;
-
-
- if (frame->curpix == 0) {
- if (frame->grabstate == FRAME_READY)
- frame->grabstate = FRAME_GRABBING;
-
- frame->curline = framedata + linelength;
- frame->curlinepix = 0;
- }
-
- if (offset != frame->curpix) {
- /* Regard frame as lost :( */
- frame->curpix = 0;
- se401->error++;
- return;
- }
-
- /* Check if we have to much data */
- if (frame->curpix + len > datasize)
- len = datasize-frame->curpix;
-
- if (se401->cheight % 4)
- blineoffset = 1;
- bline = frame->curpix / se401->cwidth+blineoffset;
-
- curline = frame->curline;
- nextline = curline + linelength;
- if (nextline >= framedata+datasize * 3)
- nextline = curline;
- while (len) {
- if (frame->curlinepix >= width) {
- frame->curlinepix -= width;
- bline = frame->curpix / width + blineoffset;
- curline += linelength*2;
- nextline += linelength*2;
- if (curline >= framedata+datasize * 3) {
- frame->curlinepix++;
- curline -= 3;
- nextline -= 3;
- len--;
- data++;
- frame->curpix++;
- }
- if (nextline >= framedata+datasize*3)
- nextline = curline;
- }
- if (bline & 1) {
- if (frame->curlinepix & 1) {
- *(curline + 2) = *data;
- *(curline - 1) = *data;
- *(nextline + 2) = *data;
- *(nextline - 1) = *data;
- } else {
- *(curline + 1) =
- (*(curline + 1) + *data) / 2;
- *(curline-2) =
- (*(curline - 2) + *data) / 2;
- *(nextline + 1) = *data;
- *(nextline - 2) = *data;
- }
- } else {
- if (frame->curlinepix & 1) {
- *(curline + 1) =
- (*(curline + 1) + *data) / 2;
- *(curline - 2) =
- (*(curline - 2) + *data) / 2;
- *(nextline + 1) = *data;
- *(nextline - 2) = *data;
- } else {
- *curline = *data;
- *(curline - 3) = *data;
- *nextline = *data;
- *(nextline - 3) = *data;
- }
- }
- frame->curlinepix++;
- curline -= 3;
- nextline -= 3;
- len--;
- data++;
- frame->curpix++;
- }
- frame->curline = curline;
-
- if (frame->curpix >= datasize) {
- /* Fix the top line */
- framedata += linelength;
- for (i = 0; i < linelength; i++) {
- framedata--;
- *framedata = *(framedata + linelength);
- }
- /* Fix the left side (green is already present) */
- for (i = 0; i < se401->cheight; i++) {
- *framedata = *(framedata + 3);
- *(framedata + 1) = *(framedata + 4);
- *(framedata + 2) = *(framedata + 5);
- framedata += linelength;
- }
- frame->curpix = 0;
- frame->grabstate = FRAME_DONE;
- se401->framecount++;
- se401->readcount++;
- if (se401->frame[(se401->curframe + 1) &
- (SE401_NUMFRAMES - 1)].grabstate == FRAME_READY) {
- se401->curframe = (se401->curframe+1) &
- (SE401_NUMFRAMES-1);
- }
- }
-}
-
-static int se401_newframe(struct usb_se401 *se401, int framenr)
-{
- DECLARE_WAITQUEUE(wait, current);
- int errors = 0;
-
- while (se401->streaming &&
- (se401->frame[framenr].grabstate == FRAME_READY ||
- se401->frame[framenr].grabstate == FRAME_GRABBING)) {
- if (!se401->frame[framenr].curpix)
- errors++;
-
- wait_interruptible(
- se401->scratch[se401->scratch_use].state != BUFFER_READY,
- &se401->wq, &wait);
- if (se401->nullpackets > SE401_MAX_NULLPACKETS) {
- se401->nullpackets = 0;
- dev_info(&se401->dev->dev,
- "too many null length packets, restarting capture\n");
- se401_stop_stream(se401);
- se401_start_stream(se401);
- } else {
- if (se401->scratch[se401->scratch_use].state !=
- BUFFER_READY) {
- se401->frame[framenr].grabstate = FRAME_ERROR;
- return -EIO;
- }
- se401->scratch[se401->scratch_use].state = BUFFER_BUSY;
- if (se401->format == FMT_JANGGU)
- decode_JangGu(se401,
- &se401->scratch[se401->scratch_use]);
- else
- decode_bayer(se401,
- &se401->scratch[se401->scratch_use]);
-
- se401->scratch[se401->scratch_use].state =
- BUFFER_UNUSED;
- se401->scratch_use++;
- if (se401->scratch_use >= SE401_NUMSCRATCH)
- se401->scratch_use = 0;
- if (errors > SE401_MAX_ERRORS) {
- errors = 0;
- dev_info(&se401->dev->dev,
- "too many errors, restarting capture\n");
- se401_stop_stream(se401);
- se401_start_stream(se401);
- }
- }
- }
-
- if (se401->frame[framenr].grabstate == FRAME_DONE)
- if (se401->enhance)
- enhance_picture(se401->frame[framenr].data,
- se401->cheight * se401->cwidth * 3);
- return 0;
-}
-
-static void usb_se401_remove_disconnected(struct usb_se401 *se401)
-{
- int i;
-
- se401->dev = NULL;
-
- for (i = 0; i < SE401_NUMSBUF; i++)
- if (se401->urb[i]) {
- usb_kill_urb(se401->urb[i]);
- usb_free_urb(se401->urb[i]);
- se401->urb[i] = NULL;
- kfree(se401->sbuf[i].data);
- }
-
- for (i = 0; i < SE401_NUMSCRATCH; i++)
- kfree(se401->scratch[i].data);
-
- if (se401->inturb) {
- usb_kill_urb(se401->inturb);
- usb_free_urb(se401->inturb);
- }
- dev_info(&se401->dev->dev, "%s disconnected", se401->camera_name);
-
- /* Free the memory */
- kfree(se401->width);
- kfree(se401->height);
- kfree(se401);
-}
-
-
-
-/****************************************************************************
- *
- * Video4Linux
- *
- ***************************************************************************/
-
-
-static int se401_open(struct file *file)
-{
- struct video_device *dev = video_devdata(file);
- struct usb_se401 *se401 = (struct usb_se401 *)dev;
- int err = 0;
-
- mutex_lock(&se401->lock);
- if (se401->user) {
- mutex_unlock(&se401->lock);
- return -EBUSY;
- }
- se401->fbuf = rvmalloc(se401->maxframesize * SE401_NUMFRAMES);
- if (se401->fbuf)
- file->private_data = dev;
- else
- err = -ENOMEM;
- se401->user = !err;
- mutex_unlock(&se401->lock);
-
- return err;
-}
-
-static int se401_close(struct file *file)
-{
- struct video_device *dev = file->private_data;
- struct usb_se401 *se401 = (struct usb_se401 *)dev;
- int i;
-
- rvfree(se401->fbuf, se401->maxframesize * SE401_NUMFRAMES);
- if (se401->removed) {
- dev_info(&se401->dev->dev, "device unregistered\n");
- usb_se401_remove_disconnected(se401);
- } else {
- for (i = 0; i < SE401_NUMFRAMES; i++)
- se401->frame[i].grabstate = FRAME_UNUSED;
- if (se401->streaming)
- se401_stop_stream(se401);
- se401->user = 0;
- }
- file->private_data = NULL;
- return 0;
-}
-
-static long se401_do_ioctl(struct file *file, unsigned int cmd, void *arg)
-{
- struct video_device *vdev = file->private_data;
- struct usb_se401 *se401 = (struct usb_se401 *)vdev;
-
- if (!se401->dev)
- return -EIO;
-
- switch (cmd) {
- case VIDIOCGCAP:
- {
- struct video_capability *b = arg;
- strcpy(b->name, se401->camera_name);
- b->type = VID_TYPE_CAPTURE;
- b->channels = 1;
- b->audios = 0;
- b->maxwidth = se401->width[se401->sizes-1];
- b->maxheight = se401->height[se401->sizes-1];
- b->minwidth = se401->width[0];
- b->minheight = se401->height[0];
- return 0;
- }
- case VIDIOCGCHAN:
- {
- struct video_channel *v = arg;
-
- if (v->channel != 0)
- return -EINVAL;
- v->flags = 0;
- v->tuners = 0;
- v->type = VIDEO_TYPE_CAMERA;
- strcpy(v->name, "Camera");
- return 0;
- }
- case VIDIOCSCHAN:
- {
- struct video_channel *v = arg;
-
- if (v->channel != 0)
- return -EINVAL;
- return 0;
- }
- case VIDIOCGPICT:
- {
- struct video_picture *p = arg;
-
- se401_get_pict(se401, p);
- return 0;
- }
- case VIDIOCSPICT:
- {
- struct video_picture *p = arg;
-
- if (se401_set_pict(se401, p))
- return -EINVAL;
- return 0;
- }
- case VIDIOCSWIN:
- {
- struct video_window *vw = arg;
-
- if (vw->flags)
- return -EINVAL;
- if (vw->clipcount)
- return -EINVAL;
- if (se401_set_size(se401, vw->width, vw->height))
- return -EINVAL;
- return 0;
- }
- case VIDIOCGWIN:
- {
- struct video_window *vw = arg;
-
- vw->x = 0; /* FIXME */
- vw->y = 0;
- vw->chromakey = 0;
- vw->flags = 0;
- vw->clipcount = 0;
- vw->width = se401->cwidth;
- vw->height = se401->cheight;
- return 0;
- }
- case VIDIOCGMBUF:
- {
- struct video_mbuf *vm = arg;
- int i;
-
- memset(vm, 0, sizeof(*vm));
- vm->size = SE401_NUMFRAMES * se401->maxframesize;
- vm->frames = SE401_NUMFRAMES;
- for (i = 0; i < SE401_NUMFRAMES; i++)
- vm->offsets[i] = se401->maxframesize * i;
- return 0;
- }
- case VIDIOCMCAPTURE:
- {
- struct video_mmap *vm = arg;
-
- if (vm->format != VIDEO_PALETTE_RGB24)
- return -EINVAL;
- if (vm->frame >= SE401_NUMFRAMES)
- return -EINVAL;
- if (se401->frame[vm->frame].grabstate != FRAME_UNUSED)
- return -EBUSY;
-
- /* Is this according to the v4l spec??? */
- if (se401_set_size(se401, vm->width, vm->height))
- return -EINVAL;
- se401->frame[vm->frame].grabstate = FRAME_READY;
-
- if (!se401->streaming)
- se401_start_stream(se401);
-
- /* Set the picture properties */
- if (se401->framecount == 0)
- se401_send_pict(se401);
- /* Calibrate the reset level after a few frames. */
- if (se401->framecount % 20 == 1)
- se401_auto_resetlevel(se401);
-
- return 0;
- }
- case VIDIOCSYNC:
- {
- int *frame = arg;
- int ret = 0;
-
- if (*frame < 0 || *frame >= SE401_NUMFRAMES)
- return -EINVAL;
-
- ret = se401_newframe(se401, *frame);
- se401->frame[*frame].grabstate = FRAME_UNUSED;
- return ret;
- }
- case VIDIOCGFBUF:
- {
- struct video_buffer *vb = arg;
-
- memset(vb, 0, sizeof(*vb));
- return 0;
- }
- case VIDIOCKEY:
- return 0;
- case VIDIOCCAPTURE:
- return -EINVAL;
- case VIDIOCSFBUF:
- return -EINVAL;
- case VIDIOCGTUNER:
- case VIDIOCSTUNER:
- return -EINVAL;
- case VIDIOCGFREQ:
- case VIDIOCSFREQ:
- return -EINVAL;
- case VIDIOCGAUDIO:
- case VIDIOCSAUDIO:
- return -EINVAL;
- default:
- return -ENOIOCTLCMD;
- } /* end switch */
-
- return 0;
-}
-
-static long se401_ioctl(struct file *file,
- unsigned int cmd, unsigned long arg)
-{
- return video_usercopy(file, cmd, arg, se401_do_ioctl);
-}
-
-static ssize_t se401_read(struct file *file, char __user *buf,
- size_t count, loff_t *ppos)
-{
- int realcount = count, ret = 0;
- struct video_device *dev = file->private_data;
- struct usb_se401 *se401 = (struct usb_se401 *)dev;
-
-
- if (se401->dev == NULL)
- return -EIO;
- if (realcount > se401->cwidth*se401->cheight*3)
- realcount = se401->cwidth*se401->cheight*3;
-
- /* Shouldn't happen: */
- if (se401->frame[0].grabstate == FRAME_GRABBING)
- return -EBUSY;
- se401->frame[0].grabstate = FRAME_READY;
- se401->frame[1].grabstate = FRAME_UNUSED;
- se401->curframe = 0;
-
- if (!se401->streaming)
- se401_start_stream(se401);
-
- /* Set the picture properties */
- if (se401->framecount == 0)
- se401_send_pict(se401);
- /* Calibrate the reset level after a few frames. */
- if (se401->framecount%20 == 1)
- se401_auto_resetlevel(se401);
-
- ret = se401_newframe(se401, 0);
-
- se401->frame[0].grabstate = FRAME_UNUSED;
- if (ret)
- return ret;
- if (copy_to_user(buf, se401->frame[0].data, realcount))
- return -EFAULT;
-
- return realcount;
-}
-
-static int se401_mmap(struct file *file, struct vm_area_struct *vma)
-{
- struct video_device *dev = file->private_data;
- struct usb_se401 *se401 = (struct usb_se401 *)dev;
- unsigned long start = vma->vm_start;
- unsigned long size = vma->vm_end-vma->vm_start;
- unsigned long page, pos;
-
- mutex_lock(&se401->lock);
-
- if (se401->dev == NULL) {
- mutex_unlock(&se401->lock);
- return -EIO;
- }
- if (size > (((SE401_NUMFRAMES * se401->maxframesize) + PAGE_SIZE - 1)
- & ~(PAGE_SIZE - 1))) {
- mutex_unlock(&se401->lock);
- return -EINVAL;
- }
- pos = (unsigned long)se401->fbuf;
- while (size > 0) {
- page = vmalloc_to_pfn((void *)pos);
- if (remap_pfn_range(vma, start, page, PAGE_SIZE, PAGE_SHARED)) {
- mutex_unlock(&se401->lock);
- return -EAGAIN;
- }
- start += PAGE_SIZE;
- pos += PAGE_SIZE;
- if (size > PAGE_SIZE)
- size -= PAGE_SIZE;
- else
- size = 0;
- }
- mutex_unlock(&se401->lock);
-
- return 0;
-}
-
-static const struct v4l2_file_operations se401_fops = {
- .owner = THIS_MODULE,
- .open = se401_open,
- .release = se401_close,
- .read = se401_read,
- .mmap = se401_mmap,
- .ioctl = se401_ioctl,
-};
-static struct video_device se401_template = {
- .name = "se401 USB camera",
- .fops = &se401_fops,
- .release = video_device_release_empty,
-};
-
-
-
-/***************************/
-static int se401_init(struct usb_se401 *se401, int button)
-{
- int i = 0, rc;
- unsigned char cp[0x40];
- char temp[200];
- int slen;
-
- /* led on */
- se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 1, NULL, 0);
-
- /* get camera descriptor */
- rc = se401_sndctrl(0, se401, SE401_REQ_GET_CAMERA_DESCRIPTOR, 0,
- cp, sizeof(cp));
- if (cp[1] != 0x41) {
- err("Wrong descriptor type");
- return 1;
- }
- slen = snprintf(temp, 200, "ExtraFeatures: %d", cp[3]);
-
- se401->sizes = cp[4] + cp[5] * 256;
- se401->width = kmalloc(se401->sizes*sizeof(int), GFP_KERNEL);
- if (!se401->width)
- return 1;
- se401->height = kmalloc(se401->sizes*sizeof(int), GFP_KERNEL);
- if (!se401->height) {
- kfree(se401->width);
- return 1;
- }
- for (i = 0; i < se401->sizes; i++) {
- se401->width[i] = cp[6 + i * 4 + 0] + cp[6 + i*4 + 1] * 256;
- se401->height[i] = cp[6 + i * 4 + 2] + cp[6 + i * 4 + 3] * 256;
- }
- slen += snprintf(temp + slen, 200 - slen, " Sizes:");
- for (i = 0; i < se401->sizes; i++) {
- slen += snprintf(temp + slen, 200 - slen,
- " %dx%d", se401->width[i], se401->height[i]);
- }
- dev_info(&se401->dev->dev, "%s\n", temp);
- se401->maxframesize = se401->width[se401->sizes-1] *
- se401->height[se401->sizes - 1] * 3;
-
- rc = se401_sndctrl(0, se401, SE401_REQ_GET_WIDTH, 0, cp, sizeof(cp));
- se401->cwidth = cp[0]+cp[1]*256;
- rc = se401_sndctrl(0, se401, SE401_REQ_GET_HEIGHT, 0, cp, sizeof(cp));
- se401->cheight = cp[0]+cp[1]*256;
-
- if (!(cp[2] & SE401_FORMAT_BAYER)) {
- err("Bayer format not supported!");
- return 1;
- }
- /* set output mode (BAYER) */
- se401_sndctrl(1, se401, SE401_REQ_SET_OUTPUT_MODE,
- SE401_FORMAT_BAYER, NULL, 0);
-
- rc = se401_sndctrl(0, se401, SE401_REQ_GET_BRT, 0, cp, sizeof(cp));
- se401->brightness = cp[0]+cp[1]*256;
- /* some default values */
- se401->resetlevel = 0x2d;
- se401->rgain = 0x20;
- se401->ggain = 0x20;
- se401->bgain = 0x20;
- se401_set_exposure(se401, 20000);
- se401->palette = VIDEO_PALETTE_RGB24;
- se401->enhance = 1;
- se401->dropped = 0;
- se401->error = 0;
- se401->framecount = 0;
- se401->readcount = 0;
-
- /* Start interrupt transfers for snapshot button */
- if (button) {
- se401->inturb = usb_alloc_urb(0, GFP_KERNEL);
- if (!se401->inturb) {
- dev_info(&se401->dev->dev,
- "Allocation of inturb failed\n");
- return 1;
- }
- usb_fill_int_urb(se401->inturb, se401->dev,
- usb_rcvintpipe(se401->dev, SE401_BUTTON_ENDPOINT),
- &se401->button, sizeof(se401->button),
- se401_button_irq,
- se401,
- 8
- );
- if (usb_submit_urb(se401->inturb, GFP_KERNEL)) {
- dev_info(&se401->dev->dev, "int urb burned down\n");
- return 1;
- }
- } else
- se401->inturb = NULL;
-
- /* Flash the led */
- se401_sndctrl(1, se401, SE401_REQ_CAMERA_POWER, 1, NULL, 0);
- se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 1, NULL, 0);
- se401_sndctrl(1, se401, SE401_REQ_CAMERA_POWER, 0, NULL, 0);
- se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 0, NULL, 0);
-
- return 0;
-}
-
-static int se401_probe(struct usb_interface *intf,
- const struct usb_device_id *id)
-{
- struct usb_device *dev = interface_to_usbdev(intf);
- struct usb_interface_descriptor *interface;
- struct usb_se401 *se401;
- char *camera_name = NULL;
- int button = 1;
-
- /* We don't handle multi-config cameras */
- if (dev->descriptor.bNumConfigurations != 1)
- return -ENODEV;
-
- interface = &intf->cur_altsetting->desc;
-
- /* Is it an se401? */
- if (le16_to_cpu(dev->descriptor.idVendor) == 0x03e8 &&
- le16_to_cpu(dev->descriptor.idProduct) == 0x0004) {
- camera_name = "Endpoints/Aox SE401";
- } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x0471 &&
- le16_to_cpu(dev->descriptor.idProduct) == 0x030b) {
- camera_name = "Philips PCVC665K";
- } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x047d &&
- le16_to_cpu(dev->descriptor.idProduct) == 0x5001) {
- camera_name = "Kensington VideoCAM 67014";
- } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x047d &&
- le16_to_cpu(dev->descriptor.idProduct) == 0x5002) {
- camera_name = "Kensington VideoCAM 6701(5/7)";
- } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x047d &&
- le16_to_cpu(dev->descriptor.idProduct) == 0x5003) {
- camera_name = "Kensington VideoCAM 67016";
- button = 0;
- } else
- return -ENODEV;
-
- /* Checking vendor/product should be enough, but what the hell */
- if (interface->bInterfaceClass != 0x00)
- return -ENODEV;
- if (interface->bInterfaceSubClass != 0x00)
- return -ENODEV;
-
- /* We found one */
- dev_info(&intf->dev, "SE401 camera found: %s\n", camera_name);
-
- se401 = kzalloc(sizeof(*se401), GFP_KERNEL);
- if (se401 == NULL) {
- err("couldn't kmalloc se401 struct");
- return -ENOMEM;
- }
-
- se401->dev = dev;
- se401->iface = interface->bInterfaceNumber;
- se401->camera_name = camera_name;
-
- dev_info(&intf->dev, "firmware version: %02x\n",
- le16_to_cpu(dev->descriptor.bcdDevice) & 255);
-
- if (se401_init(se401, button)) {
- kfree(se401);
- return -EIO;
- }
-
- memcpy(&se401->vdev, &se401_template, sizeof(se401_template));
- memcpy(se401->vdev.name, se401->camera_name,
- strlen(se401->camera_name));
- init_waitqueue_head(&se401->wq);
- mutex_init(&se401->lock);
- wmb();
-
- if (video_register_device(&se401->vdev,
- VFL_TYPE_GRABBER, video_nr) < 0) {
- kfree(se401);
- err("video_register_device failed");
- return -EIO;
- }
- dev_info(&intf->dev, "registered new video device: %s\n",
- video_device_node_name(&se401->vdev));
-
- usb_set_intfdata(intf, se401);
- return 0;
-}
-
-static void se401_disconnect(struct usb_interface *intf)
-{
- struct usb_se401 *se401 = usb_get_intfdata(intf);
-
- usb_set_intfdata(intf, NULL);
- if (se401) {
- video_unregister_device(&se401->vdev);
- if (!se401->user)
- usb_se401_remove_disconnected(se401);
- else {
- se401->frame[0].grabstate = FRAME_ERROR;
- se401->frame[0].grabstate = FRAME_ERROR;
-
- se401->streaming = 0;
-
- wake_up_interruptible(&se401->wq);
- se401->removed = 1;
- }
- }
-}
-
-static struct usb_driver se401_driver = {
- .name = "se401",
- .id_table = device_table,
- .probe = se401_probe,
- .disconnect = se401_disconnect,
-};
-
-
-
-/****************************************************************************
- *
- * Module routines
- *
- ***************************************************************************/
-
-static int __init usb_se401_init(void)
-{
- printk(KERN_INFO "SE401 usb camera driver version %s registering\n",
- version);
- if (flickerless)
- if (flickerless != 50 && flickerless != 60) {
- printk(KERN_ERR "Invallid flickerless value, use 0, 50 or 60.\n");
- return -1;
- }
- return usb_register(&se401_driver);
-}
-
-static void __exit usb_se401_exit(void)
-{
- usb_deregister(&se401_driver);
- printk(KERN_INFO "SE401 driver deregistered\frame");
-}
-
-module_init(usb_se401_init);
-module_exit(usb_se401_exit);
diff --git a/drivers/staging/se401/se401.h b/drivers/staging/se401/se401.h
deleted file mode 100644
index 2758f4716c3d..000000000000
--- a/drivers/staging/se401/se401.h
+++ /dev/null
@@ -1,236 +0,0 @@
-
-#ifndef __LINUX_se401_H
-#define __LINUX_se401_H
-
-#include <linux/uaccess.h>
-#include "videodev.h"
-#include <media/v4l2-common.h>
-#include <media/v4l2-ioctl.h>
-#include <linux/mutex.h>
-
-#define se401_DEBUG /* Turn on debug messages */
-
-#ifdef se401_DEBUG
-# define PDEBUG(level, fmt, args...) \
-if (debug >= level) \
- info("[" __PRETTY_FUNCTION__ ":%d] " fmt, __LINE__ , ## args)
-#else
-# define PDEBUG(level, fmt, args...) do {} while (0)
-#endif
-
-/* An almost drop-in replacement for sleep_on_interruptible */
-#define wait_interruptible(test, queue, wait) \
-{ \
- add_wait_queue(queue, wait); \
- set_current_state(TASK_INTERRUPTIBLE); \
- if (test) \
- schedule(); \
- remove_wait_queue(queue, wait); \
- set_current_state(TASK_RUNNING); \
- if (signal_pending(current)) \
- break; \
-}
-
-#define SE401_REQ_GET_CAMERA_DESCRIPTOR 0x06
-#define SE401_REQ_START_CONTINUOUS_CAPTURE 0x41
-#define SE401_REQ_STOP_CONTINUOUS_CAPTURE 0x42
-#define SE401_REQ_CAPTURE_FRAME 0x43
-#define SE401_REQ_GET_BRT 0x44
-#define SE401_REQ_SET_BRT 0x45
-#define SE401_REQ_GET_WIDTH 0x4c
-#define SE401_REQ_SET_WIDTH 0x4d
-#define SE401_REQ_GET_HEIGHT 0x4e
-#define SE401_REQ_SET_HEIGHT 0x4f
-#define SE401_REQ_GET_OUTPUT_MODE 0x50
-#define SE401_REQ_SET_OUTPUT_MODE 0x51
-#define SE401_REQ_GET_EXT_FEATURE 0x52
-#define SE401_REQ_SET_EXT_FEATURE 0x53
-#define SE401_REQ_CAMERA_POWER 0x56
-#define SE401_REQ_LED_CONTROL 0x57
-#define SE401_REQ_BIOS 0xff
-
-#define SE401_BIOS_READ 0x07
-
-#define SE401_FORMAT_BAYER 0x40
-
-/* Hyundai hv7131b registers
- 7121 and 7141 should be the same (haven't really checked...) */
-/* Mode registers: */
-#define HV7131_REG_MODE_A 0x00
-#define HV7131_REG_MODE_B 0x01
-#define HV7131_REG_MODE_C 0x02
-/* Frame registers: */
-#define HV7131_REG_FRSU 0x10
-#define HV7131_REG_FRSL 0x11
-#define HV7131_REG_FCSU 0x12
-#define HV7131_REG_FCSL 0x13
-#define HV7131_REG_FWHU 0x14
-#define HV7131_REG_FWHL 0x15
-#define HV7131_REG_FWWU 0x16
-#define HV7131_REG_FWWL 0x17
-/* Timing registers: */
-#define HV7131_REG_THBU 0x20
-#define HV7131_REG_THBL 0x21
-#define HV7131_REG_TVBU 0x22
-#define HV7131_REG_TVBL 0x23
-#define HV7131_REG_TITU 0x25
-#define HV7131_REG_TITM 0x26
-#define HV7131_REG_TITL 0x27
-#define HV7131_REG_TMCD 0x28
-/* Adjust Registers: */
-#define HV7131_REG_ARLV 0x30
-#define HV7131_REG_ARCG 0x31
-#define HV7131_REG_AGCG 0x32
-#define HV7131_REG_ABCG 0x33
-#define HV7131_REG_APBV 0x34
-#define HV7131_REG_ASLP 0x54
-/* Offset Registers: */
-#define HV7131_REG_OFSR 0x50
-#define HV7131_REG_OFSG 0x51
-#define HV7131_REG_OFSB 0x52
-/* REset level statistics registers: */
-#define HV7131_REG_LOREFNOH 0x57
-#define HV7131_REG_LOREFNOL 0x58
-#define HV7131_REG_HIREFNOH 0x59
-#define HV7131_REG_HIREFNOL 0x5a
-
-/* se401 registers */
-#define SE401_OPERATINGMODE 0x2000
-
-
-/* size of usb transfers */
-#define SE401_PACKETSIZE 4096
-/* number of queued bulk transfers to use, should be about 8 */
-#define SE401_NUMSBUF 1
-/* read the usb specs for this one :) */
-#define SE401_VIDEO_ENDPOINT 1
-#define SE401_BUTTON_ENDPOINT 2
-/* number of frames supported by the v4l part */
-#define SE401_NUMFRAMES 2
-/* scratch buffers for passing data to the decoders */
-#define SE401_NUMSCRATCH 32
-/* maximum amount of data in a JangGu packet */
-#define SE401_VLCDATALEN 1024
-/* number of nul sized packets to receive before kicking the camera */
-#define SE401_MAX_NULLPACKETS 4000
-/* number of decoding errors before kicking the camera */
-#define SE401_MAX_ERRORS 200
-
-struct usb_device;
-
-struct se401_sbuf {
- unsigned char *data;
-};
-
-enum {
- FRAME_UNUSED, /* Unused (no MCAPTURE) */
- FRAME_READY, /* Ready to start grabbing */
- FRAME_GRABBING, /* In the process of being grabbed into */
- FRAME_DONE, /* Finished grabbing, but not been synced yet */
- FRAME_ERROR, /* Something bad happened while processing */
-};
-
-enum {
- FMT_BAYER,
- FMT_JANGGU,
-};
-
-enum {
- BUFFER_UNUSED,
- BUFFER_READY,
- BUFFER_BUSY,
- BUFFER_DONE,
-};
-
-struct se401_scratch {
- unsigned char *data;
- volatile int state;
- int offset;
- int length;
-};
-
-struct se401_frame {
- unsigned char *data; /* Frame buffer */
-
- volatile int grabstate; /* State of grabbing */
-
- unsigned char *curline;
- int curlinepix;
- int curpix;
-};
-
-struct usb_se401 {
- struct video_device vdev;
-
- /* Device structure */
- struct usb_device *dev;
-
- unsigned char iface;
-
- char *camera_name;
-
- int change;
- int brightness;
- int hue;
- int rgain;
- int ggain;
- int bgain;
- int expose_h;
- int expose_m;
- int expose_l;
- int resetlevel;
-
- int enhance;
-
- int format;
- int sizes;
- int *width;
- int *height;
- int cwidth; /* current width */
- int cheight; /* current height */
- int palette;
- int maxframesize;
- int cframesize; /* current framesize */
-
- struct mutex lock;
- int user; /* user count for exclusive use */
- int removed; /* device disconnected */
-
- int streaming; /* Are we streaming video? */
-
- char *fbuf; /* Videodev buffer area */
-
- struct urb *urb[SE401_NUMSBUF];
- struct urb *inturb;
-
- int button;
- int buttonpressed;
-
- int curframe; /* Current receiving frame */
- struct se401_frame frame[SE401_NUMFRAMES];
- int readcount;
- int framecount;
- int error;
- int dropped;
-
- int scratch_next;
- int scratch_use;
- int scratch_overflow;
- struct se401_scratch scratch[SE401_NUMSCRATCH];
-
- /* Decoder specific data: */
- unsigned char vlcdata[SE401_VLCDATALEN];
- int vlcdatapos;
- int bayeroffset;
-
- struct se401_sbuf sbuf[SE401_NUMSBUF];
-
- wait_queue_head_t wq; /* Processes waiting */
-
- int nullpackets;
-};
-
-
-
-#endif
-
diff --git a/drivers/staging/se401/videodev.h b/drivers/staging/se401/videodev.h
deleted file mode 100644
index f11efbef1c05..000000000000
--- a/drivers/staging/se401/videodev.h
+++ /dev/null
@@ -1,318 +0,0 @@
-/*
- * Video for Linux version 1 - OBSOLETE
- *
- * Header file for v4l1 drivers and applications, for
- * Linux kernels 2.2.x or 2.4.x.
- *
- * Provides header for legacy drivers and applications
- *
- * See http://linuxtv.org for more info
- *
- */
-#ifndef __LINUX_VIDEODEV_H
-#define __LINUX_VIDEODEV_H
-
-#include <linux/types.h>
-#include <linux/ioctl.h>
-#include <linux/videodev2.h>
-
-#define VID_TYPE_CAPTURE 1 /* Can capture */
-#define VID_TYPE_TUNER 2 /* Can tune */
-#define VID_TYPE_TELETEXT 4 /* Does teletext */
-#define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */
-#define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */
-#define VID_TYPE_CLIPPING 32 /* Can clip */
-#define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */
-#define VID_TYPE_SCALES 128 /* Scalable */
-#define VID_TYPE_MONOCHROME 256 /* Monochrome only */
-#define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */
-#define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */
-#define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */
-#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */
-#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */
-
-struct video_capability
-{
- char name[32];
- int type;
- int channels; /* Num channels */
- int audios; /* Num audio devices */
- int maxwidth; /* Supported width */
- int maxheight; /* And height */
- int minwidth; /* Supported width */
- int minheight; /* And height */
-};
-
-
-struct video_channel
-{
- int channel;
- char name[32];
- int tuners;
- __u32 flags;
-#define VIDEO_VC_TUNER 1 /* Channel has a tuner */
-#define VIDEO_VC_AUDIO 2 /* Channel has audio */
- __u16 type;
-#define VIDEO_TYPE_TV 1
-#define VIDEO_TYPE_CAMERA 2
- __u16 norm; /* Norm set by channel */
-};
-
-struct video_tuner
-{
- int tuner;
- char name[32];
- unsigned long rangelow, rangehigh; /* Tuner range */
- __u32 flags;
-#define VIDEO_TUNER_PAL 1
-#define VIDEO_TUNER_NTSC 2
-#define VIDEO_TUNER_SECAM 4
-#define VIDEO_TUNER_LOW 8 /* Uses KHz not MHz */
-#define VIDEO_TUNER_NORM 16 /* Tuner can set norm */
-#define VIDEO_TUNER_STEREO_ON 128 /* Tuner is seeing stereo */
-#define VIDEO_TUNER_RDS_ON 256 /* Tuner is seeing an RDS datastream */
-#define VIDEO_TUNER_MBS_ON 512 /* Tuner is seeing an MBS datastream */
- __u16 mode; /* PAL/NTSC/SECAM/OTHER */
-#define VIDEO_MODE_PAL 0
-#define VIDEO_MODE_NTSC 1
-#define VIDEO_MODE_SECAM 2
-#define VIDEO_MODE_AUTO 3
- __u16 signal; /* Signal strength 16bit scale */
-};
-
-struct video_picture
-{
- __u16 brightness;
- __u16 hue;
- __u16 colour;
- __u16 contrast;
- __u16 whiteness; /* Black and white only */
- __u16 depth; /* Capture depth */
- __u16 palette; /* Palette in use */
-#define VIDEO_PALETTE_GREY 1 /* Linear greyscale */
-#define VIDEO_PALETTE_HI240 2 /* High 240 cube (BT848) */
-#define VIDEO_PALETTE_RGB565 3 /* 565 16 bit RGB */
-#define VIDEO_PALETTE_RGB24 4 /* 24bit RGB */
-#define VIDEO_PALETTE_RGB32 5 /* 32bit RGB */
-#define VIDEO_PALETTE_RGB555 6 /* 555 15bit RGB */
-#define VIDEO_PALETTE_YUV422 7 /* YUV422 capture */
-#define VIDEO_PALETTE_YUYV 8
-#define VIDEO_PALETTE_UYVY 9 /* The great thing about standards is ... */
-#define VIDEO_PALETTE_YUV420 10
-#define VIDEO_PALETTE_YUV411 11 /* YUV411 capture */
-#define VIDEO_PALETTE_RAW 12 /* RAW capture (BT848) */
-#define VIDEO_PALETTE_YUV422P 13 /* YUV 4:2:2 Planar */
-#define VIDEO_PALETTE_YUV411P 14 /* YUV 4:1:1 Planar */
-#define VIDEO_PALETTE_YUV420P 15 /* YUV 4:2:0 Planar */
-#define VIDEO_PALETTE_YUV410P 16 /* YUV 4:1:0 Planar */
-#define VIDEO_PALETTE_PLANAR 13 /* start of planar entries */
-#define VIDEO_PALETTE_COMPONENT 7 /* start of component entries */
-};
-
-struct video_audio
-{
- int audio; /* Audio channel */
- __u16 volume; /* If settable */
- __u16 bass, treble;
- __u32 flags;
-#define VIDEO_AUDIO_MUTE 1
-#define VIDEO_AUDIO_MUTABLE 2
-#define VIDEO_AUDIO_VOLUME 4
-#define VIDEO_AUDIO_BASS 8
-#define VIDEO_AUDIO_TREBLE 16
-#define VIDEO_AUDIO_BALANCE 32
- char name[16];
-#define VIDEO_SOUND_MONO 1
-#define VIDEO_SOUND_STEREO 2
-#define VIDEO_SOUND_LANG1 4
-#define VIDEO_SOUND_LANG2 8
- __u16 mode;
- __u16 balance; /* Stereo balance */
- __u16 step; /* Step actual volume uses */
-};
-
-struct video_clip
-{
- __s32 x,y;
- __s32 width, height;
- struct video_clip *next; /* For user use/driver use only */
-};
-
-struct video_window
-{
- __u32 x,y; /* Position of window */
- __u32 width,height; /* Its size */
- __u32 chromakey;
- __u32 flags;
- struct video_clip __user *clips; /* Set only */
- int clipcount;
-#define VIDEO_WINDOW_INTERLACE 1
-#define VIDEO_WINDOW_CHROMAKEY 16 /* Overlay by chromakey */
-#define VIDEO_CLIP_BITMAP -1
-/* bitmap is 1024x625, a '1' bit represents a clipped pixel */
-#define VIDEO_CLIPMAP_SIZE (128 * 625)
-};
-
-struct video_capture
-{
- __u32 x,y; /* Offsets into image */
- __u32 width, height; /* Area to capture */
- __u16 decimation; /* Decimation divider */
- __u16 flags; /* Flags for capture */
-#define VIDEO_CAPTURE_ODD 0 /* Temporal */
-#define VIDEO_CAPTURE_EVEN 1
-};
-
-struct video_buffer
-{
- void *base;
- int height,width;
- int depth;
- int bytesperline;
-};
-
-struct video_mmap
-{
- unsigned int frame; /* Frame (0 - n) for double buffer */
- int height,width;
- unsigned int format; /* should be VIDEO_PALETTE_* */
-};
-
-struct video_key
-{
- __u8 key[8];
- __u32 flags;
-};
-
-struct video_mbuf
-{
- int size; /* Total memory to map */
- int frames; /* Frames */
- int offsets[VIDEO_MAX_FRAME];
-};
-
-#define VIDEO_NO_UNIT (-1)
-
-struct video_unit
-{
- int video; /* Video minor */
- int vbi; /* VBI minor */
- int radio; /* Radio minor */
- int audio; /* Audio minor */
- int teletext; /* Teletext minor */
-};
-
-struct vbi_format {
- __u32 sampling_rate; /* in Hz */
- __u32 samples_per_line;
- __u32 sample_format; /* VIDEO_PALETTE_RAW only (1 byte) */
- __s32 start[2]; /* starting line for each frame */
- __u32 count[2]; /* count of lines for each frame */
- __u32 flags;
-#define VBI_UNSYNC 1 /* can distingues between top/bottom field */
-#define VBI_INTERLACED 2 /* lines are interlaced */
-};
-
-/* video_info is biased towards hardware mpeg encode/decode */
-/* but it could apply generically to any hardware compressor/decompressor */
-struct video_info
-{
- __u32 frame_count; /* frames output since decode/encode began */
- __u32 h_size; /* current unscaled horizontal size */
- __u32 v_size; /* current unscaled veritcal size */
- __u32 smpte_timecode; /* current SMPTE timecode (for current GOP) */
- __u32 picture_type; /* current picture type */
- __u32 temporal_reference; /* current temporal reference */
- __u8 user_data[256]; /* user data last found in compressed stream */
- /* user_data[0] contains user data flags, user_data[1] has count */
-};
-
-/* generic structure for setting playback modes */
-struct video_play_mode
-{
- int mode;
- int p1;
- int p2;
-};
-
-/* for loading microcode / fpga programming */
-struct video_code
-{
- char loadwhat[16]; /* name or tag of file being passed */
- int datasize;
- __u8 *data;
-};
-
-#define VIDIOCGCAP _IOR('v',1,struct video_capability) /* Get capabilities */
-#define VIDIOCGCHAN _IOWR('v',2,struct video_channel) /* Get channel info (sources) */
-#define VIDIOCSCHAN _IOW('v',3,struct video_channel) /* Set channel */
-#define VIDIOCGTUNER _IOWR('v',4,struct video_tuner) /* Get tuner abilities */
-#define VIDIOCSTUNER _IOW('v',5,struct video_tuner) /* Tune the tuner for the current channel */
-#define VIDIOCGPICT _IOR('v',6,struct video_picture) /* Get picture properties */
-#define VIDIOCSPICT _IOW('v',7,struct video_picture) /* Set picture properties */
-#define VIDIOCCAPTURE _IOW('v',8,int) /* Start, end capture */
-#define VIDIOCGWIN _IOR('v',9, struct video_window) /* Get the video overlay window */
-#define VIDIOCSWIN _IOW('v',10, struct video_window) /* Set the video overlay window - passes clip list for hardware smarts , chromakey etc */
-#define VIDIOCGFBUF _IOR('v',11, struct video_buffer) /* Get frame buffer */
-#define VIDIOCSFBUF _IOW('v',12, struct video_buffer) /* Set frame buffer - root only */
-#define VIDIOCKEY _IOR('v',13, struct video_key) /* Video key event - to dev 255 is to all - cuts capture on all DMA windows with this key (0xFFFFFFFF == all) */
-#define VIDIOCGFREQ _IOR('v',14, unsigned long) /* Set tuner */
-#define VIDIOCSFREQ _IOW('v',15, unsigned long) /* Set tuner */
-#define VIDIOCGAUDIO _IOR('v',16, struct video_audio) /* Get audio info */
-#define VIDIOCSAUDIO _IOW('v',17, struct video_audio) /* Audio source, mute etc */
-#define VIDIOCSYNC _IOW('v',18, int) /* Sync with mmap grabbing */
-#define VIDIOCMCAPTURE _IOW('v',19, struct video_mmap) /* Grab frames */
-#define VIDIOCGMBUF _IOR('v',20, struct video_mbuf) /* Memory map buffer info */
-#define VIDIOCGUNIT _IOR('v',21, struct video_unit) /* Get attached units */
-#define VIDIOCGCAPTURE _IOR('v',22, struct video_capture) /* Get subcapture */
-#define VIDIOCSCAPTURE _IOW('v',23, struct video_capture) /* Set subcapture */
-#define VIDIOCSPLAYMODE _IOW('v',24, struct video_play_mode) /* Set output video mode/feature */
-#define VIDIOCSWRITEMODE _IOW('v',25, int) /* Set write mode */
-#define VIDIOCGPLAYINFO _IOR('v',26, struct video_info) /* Get current playback info from hardware */
-#define VIDIOCSMICROCODE _IOW('v',27, struct video_code) /* Load microcode into hardware */
-#define VIDIOCGVBIFMT _IOR('v',28, struct vbi_format) /* Get VBI information */
-#define VIDIOCSVBIFMT _IOW('v',29, struct vbi_format) /* Set VBI information */
-
-
-#define BASE_VIDIOCPRIVATE 192 /* 192-255 are private */
-
-/* VIDIOCSWRITEMODE */
-#define VID_WRITE_MPEG_AUD 0
-#define VID_WRITE_MPEG_VID 1
-#define VID_WRITE_OSD 2
-#define VID_WRITE_TTX 3
-#define VID_WRITE_CC 4
-#define VID_WRITE_MJPEG 5
-
-/* VIDIOCSPLAYMODE */
-#define VID_PLAY_VID_OUT_MODE 0
- /* p1: = VIDEO_MODE_PAL, VIDEO_MODE_NTSC, etc ... */
-#define VID_PLAY_GENLOCK 1
- /* p1: 0 = OFF, 1 = ON */
- /* p2: GENLOCK FINE DELAY value */
-#define VID_PLAY_NORMAL 2
-#define VID_PLAY_PAUSE 3
-#define VID_PLAY_SINGLE_FRAME 4
-#define VID_PLAY_FAST_FORWARD 5
-#define VID_PLAY_SLOW_MOTION 6
-#define VID_PLAY_IMMEDIATE_NORMAL 7
-#define VID_PLAY_SWITCH_CHANNELS 8
-#define VID_PLAY_FREEZE_FRAME 9
-#define VID_PLAY_STILL_MODE 10
-#define VID_PLAY_MASTER_MODE 11
- /* p1: see below */
-#define VID_PLAY_MASTER_NONE 1
-#define VID_PLAY_MASTER_VIDEO 2
-#define VID_PLAY_MASTER_AUDIO 3
-#define VID_PLAY_ACTIVE_SCANLINES 12
- /* p1 = first active; p2 = last active */
-#define VID_PLAY_RESET 13
-#define VID_PLAY_END_MARK 14
-
-#endif /* __LINUX_VIDEODEV_H */
-
-/*
- * Local variables:
- * c-basic-offset: 8
- * End:
- */
diff --git a/drivers/staging/sep/sep_driver.c b/drivers/staging/sep/sep_driver.c
index 71a5fbc041e4..890eede5e3f9 100644
--- a/drivers/staging/sep/sep_driver.c
+++ b/drivers/staging/sep/sep_driver.c
@@ -55,8 +55,6 @@
#include <linux/jiffies.h>
#include <linux/rar_register.h>
-#include "../memrar/memrar.h"
-
#include "sep_driver_hw_defs.h"
#include "sep_driver_config.h"
#include "sep_driver_api.h"
@@ -586,7 +584,7 @@ static unsigned int sep_poll(struct file *filp, poll_table *wait)
dev_dbg(&sep->pdev->dev, "poll: send_ct is %lx reply ct is %lx\n",
sep->send_ct, sep->reply_ct);
- /* Check if error occured during poll */
+ /* Check if error occurred during poll */
retval2 = sep_read_reg(sep, HW_HOST_SEP_HOST_GPR3_REG_ADDR);
if (retval2 != 0x0) {
dev_warn(&sep->pdev->dev, "poll; poll error %x\n", retval2);
@@ -1106,7 +1104,7 @@ static int sep_lock_user_pages(struct sep_device *sep,
lli_array[count].block_size);
}
- /* Set output params acording to the in_out flag */
+ /* Set output params according to the in_out flag */
if (in_out_flag == SEP_DRIVER_IN_FLAG) {
*lli_array_ptr = lli_array;
sep->dma_res_arr[sep->nr_dcb_creat].in_num_pages = num_pages;
@@ -1577,7 +1575,7 @@ static int sep_prepare_input_dma_table(struct sep_device *sep,
/*
* If this is not the last table -
- * then allign it to the block size
+ * then align it to the block size
*/
if (!last_table_flag)
table_data_size =
@@ -1974,7 +1972,7 @@ static int sep_prepare_input_output_dma_table(struct sep_device *sep,
dev_dbg(&sep->pdev->dev, "SEP_DRIVER_ENTRIES_PER_TABLE_IN_SEP is %x\n",
SEP_DRIVER_ENTRIES_PER_TABLE_IN_SEP);
- /* Call the fucntion that creates table from the lli arrays */
+ /* Call the function that creates table from the lli arrays */
error = sep_construct_dma_tables_from_lli(sep, lli_in_array,
sep->dma_res_arr[sep->nr_dcb_creat].in_num_pages,
lli_out_array,
@@ -2372,7 +2370,6 @@ static int sep_rar_prepare_output_msg_handler(struct sep_device *sep,
int error = 0;
/* Command args */
struct rar_hndl_to_bus_struct command_args;
- struct RAR_buffer rar_buf;
/* Bus address */
dma_addr_t rar_bus = 0;
/* Holds the RAR address in the system memory offset */
@@ -2386,16 +2383,8 @@ static int sep_rar_prepare_output_msg_handler(struct sep_device *sep,
}
/* Call to translation function only if user handle is not NULL */
- if (command_args.rar_handle) {
- memset(&rar_buf, 0, sizeof(rar_buf));
- rar_buf.info.handle = (u32)command_args.rar_handle;
-
- if (rar_handle_to_bus(&rar_buf, 1) != 1) {
- error = -EFAULT;
- goto end_function;
- }
- rar_bus = rar_buf.bus_address;
- }
+ if (command_args.rar_handle)
+ return -EOPNOTSUPP;
dev_dbg(&sep->pdev->dev, "rar msg; rar_addr_bus = %x\n", (u32)rar_bus);
/* Set value in the SYSTEM MEMORY offset */
@@ -2416,7 +2405,7 @@ end_function:
* @cmd: command
* @arg: pointer to argument structure
*
- * Implement the ioctl methods availble on the SEP device.
+ * Implement the ioctl methods available on the SEP device.
*/
static long sep_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{
diff --git a/drivers/staging/sep/sep_driver_config.h b/drivers/staging/sep/sep_driver_config.h
index d3b9220f3963..1033425c9c30 100644
--- a/drivers/staging/sep/sep_driver_config.h
+++ b/drivers/staging/sep/sep_driver_config.h
@@ -65,11 +65,11 @@
#define SEP_DRIVER_MIN_DATA_SIZE_PER_TABLE 16
/* flag that signifies tah the lock is
-currently held by the proccess (struct file) */
+currently held by the process (struct file) */
#define SEP_DRIVER_OWN_LOCK_FLAG 1
/* flag that signifies tah the lock is currently NOT
-held by the proccess (struct file) */
+held by the process (struct file) */
#define SEP_DRIVER_DISOWN_LOCK_FLAG 0
/* indicates whether driver has mapped/unmapped shared area */
diff --git a/drivers/staging/slicoss/README b/drivers/staging/slicoss/README
index 70f49099c065..b83bba19b7f0 100644
--- a/drivers/staging/slicoss/README
+++ b/drivers/staging/slicoss/README
@@ -33,7 +33,7 @@ TODO:
- NAPI?
- wasted overhead of extra stats
- state variables for things that are
- easily availble and shouldn't be kept in card structure, cardnum, ...
+ easily available and shouldn't be kept in card structure, cardnum, ...
slotnumber, events, ...
- get rid of slic_spinlock wrapper
- volatile == bad design => bad code
diff --git a/drivers/staging/sm7xx/smtcfb.c b/drivers/staging/sm7xx/smtcfb.c
index d007e4a12c14..3e2230f0879a 100644
--- a/drivers/staging/sm7xx/smtcfb.c
+++ b/drivers/staging/sm7xx/smtcfb.c
@@ -26,10 +26,6 @@
* Boyod.yang <boyod.yang@siliconmotion.com.cn>
*/
-#ifndef __KERNEL__
-#define __KERNEL__
-#endif
-
#include <linux/io.h>
#include <linux/fb.h>
#include <linux/pci.h>
@@ -965,7 +961,7 @@ static int __devinit smtcfb_pci_probe(struct pci_dev *pdev,
goto failed;
smtcfb_setmode(sfb);
- /* Primary display starting from 0 postion */
+ /* Primary display starting from 0 position */
hw.BaseAddressInVRAM = 0;
sfb->fb.par = &hw;
@@ -1019,6 +1015,7 @@ static void __devexit smtcfb_pci_remove(struct pci_dev *pdev)
smtc_free_fb_info(sfb);
}
+#ifdef CONFIG_PM
/* Jason (08/14/2009)
* suspend function, called when the suspend event is triggered
*/
@@ -1055,7 +1052,7 @@ static int __maybe_unused smtcfb_suspend(struct pci_dev *pdev, pm_message_t msg)
pdev->dev.power.power_state = msg;
- /* additionaly turn off all function blocks including internal PLLs */
+ /* additionally turn off all function blocks including internal PLLs */
smtc_seqw(0x21, 0xff);
return 0;
@@ -1111,6 +1108,7 @@ static int __maybe_unused smtcfb_resume(struct pci_dev *pdev)
return 0;
}
+#endif
/* Jason (08/13/2009)
* pci_driver struct used to wrap the original driver
diff --git a/drivers/staging/solo6x10/Kconfig b/drivers/staging/solo6x10/Kconfig
index 2cf77c940860..03dcac4ea4d0 100644
--- a/drivers/staging/solo6x10/Kconfig
+++ b/drivers/staging/solo6x10/Kconfig
@@ -2,6 +2,7 @@ config SOLO6X10
tristate "Softlogic 6x10 MPEG codec cards"
depends on PCI && VIDEO_DEV && SND && I2C
select VIDEOBUF_DMA_SG
+ select SND_PCM
---help---
This driver supports the Softlogic based MPEG-4 and h.264 codec
codec cards.
diff --git a/drivers/staging/speakup/keyhelp.c b/drivers/staging/speakup/keyhelp.c
index 23cf7f44f450..170f38815ffd 100644
--- a/drivers/staging/speakup/keyhelp.c
+++ b/drivers/staging/speakup/keyhelp.c
@@ -69,7 +69,7 @@ static void build_key_data(void)
memset(key_offsets, 0, sizeof(key_offsets));
kp = state_tbl + nstates + 1;
while (*kp++) {
- /* count occurrances of each function */
+ /* count occurrences of each function */
for (i = 0; i < nstates; i++, kp++) {
if (!*kp)
continue;
diff --git a/drivers/staging/speakup/spkguide.txt b/drivers/staging/speakup/spkguide.txt
index 24362eb7b8f1..f3210571e396 100644
--- a/drivers/staging/speakup/spkguide.txt
+++ b/drivers/staging/speakup/spkguide.txt
@@ -1091,7 +1091,7 @@ screen that is constantly changing, such as a clock or status line.
There is no way to save these window settings, and you can only have one
window defined for each virtual console. There is also no way to have
-windows automaticly defined for specific applications.
+windows automatically defined for specific applications.
In order to define a window, use the review keys to move your reading
cursor to the beginning of the area you want to define. Then press
diff --git a/drivers/staging/spectra/ffsport.c b/drivers/staging/spectra/ffsport.c
index 007b24b54e25..506547b603e1 100644
--- a/drivers/staging/spectra/ffsport.c
+++ b/drivers/staging/spectra/ffsport.c
@@ -38,7 +38,7 @@
* Outputs: Number of Used Bits
* 0, if the argument is 0
* Description: Calculate the number of bits used by a given power of 2 number
-* Number can be upto 32 bit
+* Number can be up to 32 bit
*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
int GLOB_Calc_Used_Bits(u32 n)
{
@@ -653,7 +653,7 @@ static int SBD_setup_device(struct spectra_nand_dev *dev, int which)
}
dev->queue->queuedata = dev;
- /* As Linux block layer doens't support >4KB hardware sector, */
+ /* As Linux block layer doesn't support >4KB hardware sector, */
/* Here we force report 512 byte hardware sector size to Kernel */
blk_queue_logical_block_size(dev->queue, 512);
diff --git a/drivers/staging/spectra/flash.c b/drivers/staging/spectra/flash.c
index a2f820025ae4..aead358e5c2a 100644
--- a/drivers/staging/spectra/flash.c
+++ b/drivers/staging/spectra/flash.c
@@ -965,7 +965,7 @@ static void process_cmd_fail_abort(int *first_failed_cmd,
if (0 == *first_failed_cmd)
*first_failed_cmd = PendingCMD[idx].SBDCmdIndex;
- nand_dbg_print(NAND_DBG_DEBUG, "Uncorrectable error has occured "
+ nand_dbg_print(NAND_DBG_DEBUG, "Uncorrectable error has occurred "
"while executing %u Command %u accesing Block %u\n",
(unsigned int)p_BTableChangesDelta->ftl_cmd_cnt,
PendingCMD[idx].CMD,
@@ -1879,7 +1879,7 @@ static int write_back_to_l2_cache(u8 *buf, u64 logical_addr)
}
/*
- * Seach in the Level2 Cache table to find the cache item.
+ * Search in the Level2 Cache table to find the cache item.
* If find, read the data from the NAND page of L2 Cache,
* Otherwise, return FAIL.
*/
@@ -3989,7 +3989,7 @@ int GLOB_FTL_Block_Erase(u64 blk_addr)
* Inputs: index to block that was just incremented and is at the max
* Outputs: PASS=0 / FAIL=1
* Description: If any erase counts at MAX, adjusts erase count of every
-* block by substracting least worn
+* block by subtracting least worn
* counter from counter value of every entry in wear table
*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
static int FTL_Adjust_Relative_Erase_Count(u32 Index_of_MAX)
diff --git a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c
index d55a8e40318b..3e68d58fdffd 100644
--- a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c
+++ b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c
@@ -71,7 +71,7 @@
#define SYNAPTICS_RMI4_DEVICE_CONTROL_FUNC_NUM (0x01)
/**
- * struct synaptics_rmi4_fn_desc - contains the funtion descriptor information
+ * struct synaptics_rmi4_fn_desc - contains the function descriptor information
* @query_base_addr: base address for query
* @cmd_base_addr: base address for command
* @ctrl_base_addr: base address for control
@@ -92,7 +92,7 @@ struct synaptics_rmi4_fn_desc {
};
/**
- * struct synaptics_rmi4_fn - contains the funtion information
+ * struct synaptics_rmi4_fn - contains the function information
* @fn_number: function number
* @num_of_data_sources: number of data sources
* @num_of_data_points: number of fingers touched
@@ -151,7 +151,7 @@ struct synaptics_rmi4_device_info {
* @input_dev: pointer for input device
* @i2c_client: pointer for i2c client
* @board: constant pointer for touch platform data
- * @fn_list_mutex: mutex for funtion list
+ * @fn_list_mutex: mutex for function list
* @rmi4_page_mutex: mutex for rmi4 page
* @current_page: variable for integer
* @number_of_interrupt_register: interrupt registers count
@@ -278,7 +278,7 @@ static int synaptics_rmi4_i2c_byte_write(struct synaptics_rmi4_data *pdata,
txbuf[0] = address & MASK_8BIT;
txbuf[1] = data;
retval = i2c_master_send(pdata->i2c_client, txbuf, 2);
- /* Add in retry on writes only in certian error return values */
+ /* Add in retry on writes only in certain error return values */
if (retval != 2) {
dev_err(&i2c->dev, "%s:failed:%d\n", __func__, retval);
retval = -EIO;
@@ -561,7 +561,7 @@ static int synpatics_rmi4_touchpad_detect(struct synaptics_rmi4_data *pdata,
}
/*
* 2D data sources have only 3 bits for the number of fingers
- * supported - so the encoding is a bit wierd.
+ * supported - so the encoding is a bit weird.
*/
if ((queries[1] & MASK_3BIT) <= 4)
/* add 1 since zero based */
@@ -1027,7 +1027,7 @@ err_input:
* synaptics_rmi4_remove() - Removes the i2c-client touchscreen driver
* @client: i2c client structure pointer
*
- * This funtion uses to remove the i2c-client
+ * This function uses to remove the i2c-client
* touchscreen driver and returns integer.
*/
static int __devexit synaptics_rmi4_remove(struct i2c_client *client)
@@ -1053,7 +1053,7 @@ static int __devexit synaptics_rmi4_remove(struct i2c_client *client)
* synaptics_rmi4_suspend() - suspend the touch screen controller
* @dev: pointer to device structure
*
- * This funtion is used to suspend the
+ * This function is used to suspend the
* touch panel controller and returns integer
*/
static int synaptics_rmi4_suspend(struct device *dev)
@@ -1089,7 +1089,7 @@ static int synaptics_rmi4_suspend(struct device *dev)
* synaptics_rmi4_resume() - resume the touch screen controller
* @dev: pointer to device structure
*
- * This funtion is used to resume the touch panel
+ * This function is used to resume the touch panel
* controller and returns integer.
*/
static int synaptics_rmi4_resume(struct device *dev)
@@ -1148,7 +1148,7 @@ static struct i2c_driver synaptics_rmi4_driver = {
/**
* synaptics_rmi4_init() - Initialize the touchscreen driver
*
- * This funtion uses to initializes the synaptics
+ * This function uses to initializes the synaptics
* touchscreen driver and returns integer.
*/
static int __init synaptics_rmi4_init(void)
@@ -1158,7 +1158,7 @@ static int __init synaptics_rmi4_init(void)
/**
* synaptics_rmi4_exit() - De-initialize the touchscreen driver
*
- * This funtion uses to de-initialize the synaptics
+ * This function uses to de-initialize the synaptics
* touchscreen driver and returns none.
*/
static void __exit synaptics_rmi4_exit(void)
diff --git a/drivers/staging/tidspbridge/core/_tiomap.h b/drivers/staging/tidspbridge/core/_tiomap.h
index 1e0273e50d2b..7cb587103975 100644
--- a/drivers/staging/tidspbridge/core/_tiomap.h
+++ b/drivers/staging/tidspbridge/core/_tiomap.h
@@ -366,7 +366,7 @@ extern s32 dsp_debug;
* ======== sm_interrupt_dsp ========
* Purpose:
* Set interrupt value & send an interrupt to the DSP processor(s).
- * This is typicaly used when mailbox interrupt mechanisms allow data
+ * This is typically used when mailbox interrupt mechanisms allow data
* to be associated with interrupt such as for OMAP's CMD/DATA regs.
* Parameters:
* dev_context: Handle to Bridge driver defined device info.
diff --git a/drivers/staging/tidspbridge/core/chnl_sm.c b/drivers/staging/tidspbridge/core/chnl_sm.c
index 8381130e1460..6d66e7d0fba8 100644
--- a/drivers/staging/tidspbridge/core/chnl_sm.c
+++ b/drivers/staging/tidspbridge/core/chnl_sm.c
@@ -578,7 +578,7 @@ int bridge_chnl_get_ioc(struct chnl_object *chnl_obj, u32 timeout,
} else if (stat_sync == -EPERM) {
/* This can occur when the user mode thread is
* aborted (^C), or when _VWIN32_WaitSingleObject()
- * fails due to unkown causes. */
+ * fails due to unknown causes. */
/* Even though Wait failed, there may be something in
* the Q: */
if (list_empty(&pchnl->io_completions)) {
diff --git a/drivers/staging/tidspbridge/dynload/cload.c b/drivers/staging/tidspbridge/dynload/cload.c
index 390040984e03..fe1ef0addb09 100644
--- a/drivers/staging/tidspbridge/dynload/cload.c
+++ b/drivers/staging/tidspbridge/dynload/cload.c
@@ -718,7 +718,7 @@ static void dload_symbols(struct dload_state *dlthis)
* as a temporary for .dllview record construction.
* Allocate storage for the whole table. Add 1 to the section count
* in case a trampoline section is auto-generated as well as the
- * size of the trampoline section name so DLLView doens't get lost.
+ * size of the trampoline section name so DLLView doesn't get lost.
*/
siz = sym_count * sizeof(struct local_symbol);
diff --git a/drivers/staging/tidspbridge/hw/hw_mmu.c b/drivers/staging/tidspbridge/hw/hw_mmu.c
index 014f5d5293ae..c214df9b205e 100644
--- a/drivers/staging/tidspbridge/hw/hw_mmu.c
+++ b/drivers/staging/tidspbridge/hw/hw_mmu.c
@@ -59,7 +59,7 @@ enum hw_mmu_page_size_t {
* RETURNS:
*
* Type : hw_status
- * Description : 0 -- No errors occured
+ * Description : 0 -- No errors occurred
* RET_BAD_NULL_PARAM -- A Pointer
* Paramater was set to NULL
*
@@ -102,7 +102,7 @@ static hw_status mmu_flush_entry(const void __iomem *base_address);
* RETURNS:
*
* Type : hw_status
- * Description : 0 -- No errors occured
+ * Description : 0 -- No errors occurred
* RET_BAD_NULL_PARAM -- A Pointer Paramater
* was set to NULL
* RET_PARAM_OUT_OF_RANGE -- Input Parameter out
@@ -147,7 +147,7 @@ static hw_status mmu_set_cam_entry(const void __iomem *base_address,
* RETURNS:
*
* Type : hw_status
- * Description : 0 -- No errors occured
+ * Description : 0 -- No errors occurred
* RET_BAD_NULL_PARAM -- A Pointer Paramater
* was set to NULL
* RET_PARAM_OUT_OF_RANGE -- Input Parameter
diff --git a/drivers/staging/tidspbridge/include/dspbridge/_chnl_sm.h b/drivers/staging/tidspbridge/include/dspbridge/_chnl_sm.h
index d60e25258020..6e7ab4fd8c39 100644
--- a/drivers/staging/tidspbridge/include/dspbridge/_chnl_sm.h
+++ b/drivers/staging/tidspbridge/include/dspbridge/_chnl_sm.h
@@ -144,7 +144,7 @@ struct chnl_object {
s8 chnl_mode; /* Chnl mode and attributes */
/* Chnl I/O completion event (user mode) */
void *user_event;
- /* Abstract syncronization object */
+ /* Abstract synchronization object */
struct sync_object *sync_event;
u32 process; /* Process which created this channel */
u32 cb_arg; /* Argument to use with callback */
@@ -156,7 +156,7 @@ struct chnl_object {
struct list_head io_completions;
struct list_head free_packets_list; /* List of free Irps */
struct ntfy_object *ntfy_obj;
- u32 bytes_moved; /* Total number of bytes transfered */
+ u32 bytes_moved; /* Total number of bytes transferred */
/* For DSP-DMA */
diff --git a/drivers/staging/tidspbridge/include/dspbridge/clk.h b/drivers/staging/tidspbridge/include/dspbridge/clk.h
index b23950323421..685341c50693 100644
--- a/drivers/staging/tidspbridge/include/dspbridge/clk.h
+++ b/drivers/staging/tidspbridge/include/dspbridge/clk.h
@@ -55,7 +55,7 @@ extern void dsp_clk_exit(void);
* Initializes private state of CLK module.
* Parameters:
* Returns:
- * TRUE if initialized; FALSE if error occured.
+ * TRUE if initialized; FALSE if error occurred.
* Requires:
* Ensures:
* CLK initialized.
@@ -71,7 +71,7 @@ void dsp_gpt_wait_overflow(short int clk_id, unsigned int load);
* Parameters:
* Returns:
* 0: Success.
- * -EPERM: Error occured while enabling the clock.
+ * -EPERM: Error occurred while enabling the clock.
* Requires:
* Ensures:
*/
@@ -86,7 +86,7 @@ u32 dsp_clock_enable_all(u32 dsp_per_clocks);
* Parameters:
* Returns:
* 0: Success.
- * -EPERM: Error occured while disabling the clock.
+ * -EPERM: Error occurred while disabling the clock.
* Requires:
* Ensures:
*/
diff --git a/drivers/staging/tidspbridge/include/dspbridge/cmm.h b/drivers/staging/tidspbridge/include/dspbridge/cmm.h
index 27a21b5f3ff0..aff22051cf57 100644
--- a/drivers/staging/tidspbridge/include/dspbridge/cmm.h
+++ b/drivers/staging/tidspbridge/include/dspbridge/cmm.h
@@ -190,7 +190,7 @@ extern int cmm_get_info(struct cmm_object *hcmm_mgr,
* Initializes private state of CMM module.
* Parameters:
* Returns:
- * TRUE if initialized; FALSE if error occured.
+ * TRUE if initialized; FALSE if error occurred.
* Requires:
* Ensures:
* CMM initialized.
diff --git a/drivers/staging/tidspbridge/include/dspbridge/cod.h b/drivers/staging/tidspbridge/include/dspbridge/cod.h
index 53bd4bb8b0bb..cb684c11b302 100644
--- a/drivers/staging/tidspbridge/include/dspbridge/cod.h
+++ b/drivers/staging/tidspbridge/include/dspbridge/cod.h
@@ -249,7 +249,7 @@ extern int cod_get_sym_value(struct cod_manager *cod_mgr_obj,
* Parameters:
* None.
* Returns:
- * TRUE if initialized; FALSE if error occured.
+ * TRUE if initialized; FALSE if error occurred.
* Requires:
* Ensures:
* A requirement for each of the other public COD functions.
diff --git a/drivers/staging/tidspbridge/include/dspbridge/dev.h b/drivers/staging/tidspbridge/include/dspbridge/dev.h
index f41e4783157f..f92b4be0b413 100644
--- a/drivers/staging/tidspbridge/include/dspbridge/dev.h
+++ b/drivers/staging/tidspbridge/include/dspbridge/dev.h
@@ -497,7 +497,7 @@ extern void dev_exit(void);
* Initialize DEV's private state, keeping a reference count on each call.
* Parameters:
* Returns:
- * TRUE if initialized; FALSE if error occured.
+ * TRUE if initialized; FALSE if error occurred.
* Requires:
* Ensures:
* TRUE: A requirement for the other public DEV functions.
diff --git a/drivers/staging/tidspbridge/include/dspbridge/drv.h b/drivers/staging/tidspbridge/include/dspbridge/drv.h
index 25ef1a2c58eb..9cdbd955dce9 100644
--- a/drivers/staging/tidspbridge/include/dspbridge/drv.h
+++ b/drivers/staging/tidspbridge/include/dspbridge/drv.h
@@ -154,7 +154,7 @@ struct process_context {
* Parameters:
* drv_obj: Location to store created DRV Object handle.
* Returns:
- * 0: Sucess
+ * 0: Success
* -ENOMEM: Failed in Memory allocation
* -EPERM: General Failure
* Requires:
@@ -170,7 +170,7 @@ struct process_context {
* There is one Driver Object for the Driver representing
* the driver itself. It contains the list of device
* Objects and the list of Device Extensions in the system.
- * Also it can hold other neccessary
+ * Also it can hold other necessary
* information in its storage area.
*/
extern int drv_create(struct drv_object **drv_obj);
@@ -180,7 +180,7 @@ extern int drv_create(struct drv_object **drv_obj);
* Purpose:
* destroys the Dev Object list, DrvExt list
* and destroy the DRV object
- * Called upon driver unLoading.or unsuccesful loading of the driver.
+ * Called upon driver unLoading.or unsuccessful loading of the driver.
* Parameters:
* driver_obj: Handle to Driver object .
* Returns:
diff --git a/drivers/staging/tidspbridge/include/dspbridge/dspdefs.h b/drivers/staging/tidspbridge/include/dspbridge/dspdefs.h
index c2ba26c09308..ed32bf383132 100644
--- a/drivers/staging/tidspbridge/include/dspbridge/dspdefs.h
+++ b/drivers/staging/tidspbridge/include/dspbridge/dspdefs.h
@@ -52,7 +52,7 @@ struct bridge_dev_context;
* dev_ctxt: Handle to Bridge driver defined device context.
* Returns:
* 0: Success.
- * -ETIMEDOUT: Timeout occured waiting for a response from hardware.
+ * -ETIMEDOUT: Timeout occurred waiting for a response from hardware.
* -EPERM: Other, unspecified error.
* Requires:
* dev_ctxt != NULL
@@ -91,7 +91,7 @@ typedef int(*fxn_brd_setstate) (struct bridge_dev_context
* dsp_addr: DSP address at which to start execution.
* Returns:
* 0: Success.
- * -ETIMEDOUT: Timeout occured waiting for a response from hardware.
+ * -ETIMEDOUT: Timeout occurred waiting for a response from hardware.
* -EPERM: Other, unspecified error.
* Requires:
* dev_ctxt != NULL
@@ -142,7 +142,7 @@ typedef int(*fxn_brd_memcopy) (struct bridge_dev_context
* mem_type: Memory space on DSP to which to transfer.
* Returns:
* 0: Success.
- * -ETIMEDOUT: Timeout occured waiting for a response from hardware.
+ * -ETIMEDOUT: Timeout occurred waiting for a response from hardware.
* -EPERM: Other, unspecified error.
* Requires:
* dev_ctxt != NULL;
@@ -205,7 +205,7 @@ typedef int(*fxn_brd_memunmap) (struct bridge_dev_context
* dev_ctxt: Handle to Bridge driver defined device context.
* Returns:
* 0: Success.
- * -ETIMEDOUT: Timeout occured waiting for a response from hardware.
+ * -ETIMEDOUT: Timeout occurred waiting for a response from hardware.
* -EPERM: Other, unspecified error.
* Requires:
* dev_ctxt != NULL
@@ -248,7 +248,7 @@ typedef int(*fxn_brd_status) (struct bridge_dev_context *dev_ctxt,
* mem_type: Memory space on DSP from which to transfer.
* Returns:
* 0: Success.
- * -ETIMEDOUT: Timeout occured waiting for a response from hardware.
+ * -ETIMEDOUT: Timeout occurred waiting for a response from hardware.
* -EPERM: Other, unspecified error.
* Requires:
* dev_ctxt != NULL;
@@ -274,7 +274,7 @@ typedef int(*fxn_brd_read) (struct bridge_dev_context *dev_ctxt,
* mem_type: Memory space on DSP to which to transfer.
* Returns:
* 0: Success.
- * -ETIMEDOUT: Timeout occured waiting for a response from hardware.
+ * -ETIMEDOUT: Timeout occurred waiting for a response from hardware.
* -EPERM: Other, unspecified error.
* Requires:
* dev_ctxt != NULL;
@@ -601,7 +601,7 @@ typedef int(*fxn_chnl_getmgrinfo) (struct chnl_mgr
* Returns:
* 0: Success;
* -EFAULT: Invalid chnl_obj.
- * -ETIMEDOUT: Timeout occured before channel could be idled.
+ * -ETIMEDOUT: Timeout occurred before channel could be idled.
* Requires:
* Ensures:
*/
diff --git a/drivers/staging/tidspbridge/include/dspbridge/mgr.h b/drivers/staging/tidspbridge/include/dspbridge/mgr.h
index e506c4d49472..47b0318430e1 100644
--- a/drivers/staging/tidspbridge/include/dspbridge/mgr.h
+++ b/drivers/staging/tidspbridge/include/dspbridge/mgr.h
@@ -176,7 +176,7 @@ extern void mgr_exit(void);
* mgr_handle: Handle to the Manager Object
* dcd_handle: Ptr to receive the DCD Handle.
* Returns:
- * 0: Sucess
+ * 0: Success
* -EPERM: Failure to get the Handle
* Requires:
* MGR is initialized.
@@ -195,7 +195,7 @@ extern int mgr_get_dcd_handle(struct mgr_object
* call. Initializes the DCD.
* Parameters:
* Returns:
- * TRUE if initialized; FALSE if error occured.
+ * TRUE if initialized; FALSE if error occurred.
* Requires:
* Ensures:
* TRUE: A requirement for the other public MGR functions.
diff --git a/drivers/staging/tidspbridge/include/dspbridge/node.h b/drivers/staging/tidspbridge/include/dspbridge/node.h
index 53da0ef483c8..16371d818e3d 100644
--- a/drivers/staging/tidspbridge/include/dspbridge/node.h
+++ b/drivers/staging/tidspbridge/include/dspbridge/node.h
@@ -44,7 +44,7 @@
* -ESPIPE: iAlg functions not found for a DAIS node.
* -EDOM: attr_in != NULL and attr_in->prio out of
* range.
- * -EPERM: A failure occured, unable to allocate node.
+ * -EPERM: A failure occurred, unable to allocate node.
* -EBADR: Proccessor is not in the running state.
* Requires:
* node_init(void) called.
diff --git a/drivers/staging/tidspbridge/include/dspbridge/proc.h b/drivers/staging/tidspbridge/include/dspbridge/proc.h
index 5e09fd165d9d..f00dffd51989 100644
--- a/drivers/staging/tidspbridge/include/dspbridge/proc.h
+++ b/drivers/staging/tidspbridge/include/dspbridge/proc.h
@@ -89,7 +89,7 @@ extern int proc_auto_start(struct cfg_devnode *dev_node_obj,
* Returns:
* 0 : SUCCESS
* -EFAULT : Invalid processor handle.
- * -ETIME: A Timeout Occured before the Control information
+ * -ETIME: A Timeout Occurred before the Control information
* could be sent.
* -EPERM : General Failure.
* Requires:
@@ -169,7 +169,7 @@ extern int proc_enum_nodes(void *hprocessor,
* 0 : Success.
* -EFAULT : Invalid processor handle.
* -EBADR: The processor is not in the PROC_RUNNING state.
- * -ETIME: A timeout occured before the DSP responded to the
+ * -ETIME: A timeout occurred before the DSP responded to the
* querry.
* -EPERM : Unable to get Resource Information
* Requires:
@@ -229,7 +229,7 @@ extern int proc_get_dev_object(void *hprocessor,
* call.
* Parameters:
* Returns:
- * TRUE if initialized; FALSE if error occured.
+ * TRUE if initialized; FALSE if error occurred.
* Requires:
* Ensures:
* TRUE: A requirement for the other public PROC functions.
diff --git a/drivers/staging/tidspbridge/include/dspbridge/pwr.h b/drivers/staging/tidspbridge/include/dspbridge/pwr.h
index 5e3ab2123aaa..0fb066488da9 100644
--- a/drivers/staging/tidspbridge/include/dspbridge/pwr.h
+++ b/drivers/staging/tidspbridge/include/dspbridge/pwr.h
@@ -46,7 +46,7 @@
* 0: Success.
* 0: Success, but the DSP was already asleep.
* -EINVAL: The specified sleep_code is not supported.
- * -ETIME: A timeout occured while waiting for DSP sleep
+ * -ETIME: A timeout occurred while waiting for DSP sleep
* confirmation.
* -EPERM: General failure, unable to send sleep command to
* the DSP.
@@ -67,7 +67,7 @@ extern int pwr_sleep_dsp(const u32 sleep_code, const u32 timeout);
* Returns:
* 0: Success.
* 0: Success, but the DSP was already awake.
- * -ETIME: A timeout occured while waiting for wake
+ * -ETIME: A timeout occurred while waiting for wake
* confirmation.
* -EPERM: General failure, unable to send wake command to
* the DSP.
@@ -85,7 +85,7 @@ extern int pwr_wake_dsp(const u32 timeout);
* Returns:
* 0: Success.
* 0: Success, but the DSP was already awake.
- * -ETIME: A timeout occured while waiting for wake
+ * -ETIME: A timeout occurred while waiting for wake
* confirmation.
* -EPERM: General failure, unable to send wake command to
* the DSP.
@@ -103,7 +103,7 @@ extern int pwr_pm_pre_scale(u16 voltage_domain, u32 level);
* Returns:
* 0: Success.
* 0: Success, but the DSP was already awake.
- * -ETIME: A timeout occured while waiting for wake
+ * -ETIME: A timeout occurred while waiting for wake
* confirmation.
* -EPERM: General failure, unable to send wake command to
* the DSP.
diff --git a/drivers/staging/tidspbridge/pmgr/dev.c b/drivers/staging/tidspbridge/pmgr/dev.c
index 9a38d86a84a0..522810bc7427 100644
--- a/drivers/staging/tidspbridge/pmgr/dev.c
+++ b/drivers/staging/tidspbridge/pmgr/dev.c
@@ -787,7 +787,7 @@ int dev_notify_clients(struct dev_object *dev_obj, u32 ret)
/*
* FIXME: this code needs struct proc_object to have a list_head
- * at the begining. If not, this can go horribly wrong.
+ * at the beginning. If not, this can go horribly wrong.
*/
list_for_each(curr, &dev_obj->proc_list)
proc_notify_clients((void *)curr, ret);
@@ -810,7 +810,7 @@ int dev_remove_device(struct cfg_devnode *dev_node_obj)
if (!dev_node_obj)
status = -EFAULT;
- /* Retrieve the device object handle originaly stored with
+ /* Retrieve the device object handle originally stored with
* the dev_node: */
if (!status) {
/* check the device string and then store dev object */
@@ -986,7 +986,7 @@ int dev_insert_proc_object(struct dev_object *hdev_obj,
/* Add DevObject to tail. */
/*
* FIXME: this code needs struct proc_object to have a list_head
- * at the begining. If not, this can go horribly wrong.
+ * at the beginning. If not, this can go horribly wrong.
*/
list_add_tail((struct list_head *)proc_obj, &dev_obj->proc_list);
diff --git a/drivers/staging/tidspbridge/rmgr/drv.c b/drivers/staging/tidspbridge/rmgr/drv.c
index 8c88583364eb..db8215f540d8 100644
--- a/drivers/staging/tidspbridge/rmgr/drv.c
+++ b/drivers/staging/tidspbridge/rmgr/drv.c
@@ -609,7 +609,7 @@ int drv_request_resources(u32 dw_context, u32 *dev_node_strg)
DBC_REQUIRE(dev_node_strg != NULL);
/*
- * Allocate memory to hold the string. This will live untill
+ * Allocate memory to hold the string. This will live until
* it is freed in the Release resources. Update the driver object
* list.
*/
diff --git a/drivers/staging/tidspbridge/rmgr/nldr.c b/drivers/staging/tidspbridge/rmgr/nldr.c
index fb5c2ba01d47..0e70cba15ebc 100644
--- a/drivers/staging/tidspbridge/rmgr/nldr.c
+++ b/drivers/staging/tidspbridge/rmgr/nldr.c
@@ -57,9 +57,9 @@
* uuuuuuuu|fueeeeee|fudddddd|fucccccc|
* where
* u = unused
- * cccccc = prefered/required dynamic mem segid for create phase data/code
- * dddddd = prefered/required dynamic mem segid for delete phase data/code
- * eeeeee = prefered/req. dynamic mem segid for execute phase data/code
+ * cccccc = preferred/required dynamic mem segid for create phase data/code
+ * dddddd = preferred/required dynamic mem segid for delete phase data/code
+ * eeeeee = preferred/req. dynamic mem segid for execute phase data/code
* f = flag indicating if memory is preferred or required:
* f = 1 if required, f = 0 if preferred.
*
diff --git a/drivers/staging/tidspbridge/rmgr/proc.c b/drivers/staging/tidspbridge/rmgr/proc.c
index c4e5c4e0d71c..242dd1399996 100644
--- a/drivers/staging/tidspbridge/rmgr/proc.c
+++ b/drivers/staging/tidspbridge/rmgr/proc.c
@@ -1670,7 +1670,7 @@ int proc_stop(void *hprocessor)
if (!status) {
dev_dbg(bridge, "%s: processor in standby mode\n", __func__);
p_proc_object->proc_state = PROC_STOPPED;
- /* Destory the Node Manager, msg_ctrl Manager */
+ /* Destroy the Node Manager, msg_ctrl Manager */
if (!(dev_destroy2(p_proc_object->dev_obj))) {
/* Destroy the msg_ctrl by calling msg_delete */
dev_get_msg_mgr(p_proc_object->dev_obj, &hmsg_mgr);
@@ -1827,7 +1827,7 @@ static int proc_monitor(struct proc_object *proc_obj)
/* This is needed only when Device is loaded when it is
* already 'ACTIVE' */
- /* Destory the Node Manager, msg_ctrl Manager */
+ /* Destroy the Node Manager, msg_ctrl Manager */
if (!dev_destroy2(proc_obj->dev_obj)) {
/* Destroy the msg_ctrl by calling msg_delete */
dev_get_msg_mgr(proc_obj->dev_obj, &hmsg_mgr);
diff --git a/drivers/staging/tm6000/tm6000-alsa.c b/drivers/staging/tm6000/tm6000-alsa.c
index 184cc505ed86..acb03172a887 100644
--- a/drivers/staging/tm6000/tm6000-alsa.c
+++ b/drivers/staging/tm6000/tm6000-alsa.c
@@ -76,14 +76,11 @@ MODULE_PARM_DESC(debug, "enable debug messages");
static int _tm6000_start_audio_dma(struct snd_tm6000_card *chip)
{
struct tm6000_core *core = chip->core;
- int val;
dprintk(1, "Starting audio DMA\n");
/* Enables audio */
- val = tm6000_get_reg(core, TM6010_REQ07_RCC_ACTIVE_VIDEO_IF, 0x0);
- val |= 0x20;
- tm6000_set_reg(core, TM6010_REQ07_RCC_ACTIVE_VIDEO_IF, val);
+ tm6000_set_reg_mask(core, TM6010_REQ07_RCC_ACTIVE_VIDEO_IF, 0x40, 0x40);
tm6000_set_audio_bitrate(core, 48000);
@@ -98,13 +95,11 @@ static int _tm6000_start_audio_dma(struct snd_tm6000_card *chip)
static int _tm6000_stop_audio_dma(struct snd_tm6000_card *chip)
{
struct tm6000_core *core = chip->core;
- int val;
+
dprintk(1, "Stopping audio DMA\n");
- /* Enables audio */
- val = tm6000_get_reg(core, TM6010_REQ07_RCC_ACTIVE_VIDEO_IF, 0x0);
- val &= ~0x20;
- tm6000_set_reg(core, TM6010_REQ07_RCC_ACTIVE_VIDEO_IF, val);
+ /* Disables audio */
+ tm6000_set_reg_mask(core, TM6010_REQ07_RCC_ACTIVE_VIDEO_IF, 0x00, 0x40);
tm6000_set_reg(core, TM6010_REQ08_R01_A_INIT, 0);
diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c
index 455038bdfc9f..146c7e86deca 100644
--- a/drivers/staging/tm6000/tm6000-cards.c
+++ b/drivers/staging/tm6000/tm6000-cards.c
@@ -50,6 +50,9 @@
#define TM6010_BOARD_BEHOLD_VOYAGER 11
#define TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE 12
#define TM6010_BOARD_TWINHAN_TU501 13
+#define TM6010_BOARD_BEHOLD_WANDER_LITE 14
+#define TM6010_BOARD_BEHOLD_VOYAGER_LITE 15
+#define TM5600_BOARD_TERRATEC_GRABSTER 16
#define TM6000_MAXBOARDS 16
static unsigned int card[] = {[0 ... (TM6000_MAXBOARDS - 1)] = UNSET };
@@ -63,6 +66,8 @@ struct tm6000_board {
char *name;
struct tm6000_capabilities caps;
+ enum tm6000_inaudio aradio;
+ enum tm6000_inaudio avideo;
enum tm6000_devtype type; /* variant of the chipset */
int tuner_type; /* type of the tuner */
@@ -227,12 +232,16 @@ struct tm6000_board tm6000_boards[] = {
.tuner_addr = 0xc2 >> 1,
.demod_addr = 0x1e >> 1,
.type = TM6010,
+ .avideo = TM6000_AIP_SIF1,
+ .aradio = TM6000_AIP_LINE1,
.caps = {
- .has_tuner = 1,
- .has_dvb = 1,
- .has_zl10353 = 1,
- .has_eeprom = 1,
- .has_remote = 1,
+ .has_tuner = 1,
+ .has_dvb = 1,
+ .has_zl10353 = 1,
+ .has_eeprom = 1,
+ .has_remote = 1,
+ .has_input_comp = 1,
+ .has_input_svid = 1,
},
.gpio = {
.tuner_reset = TM6010_GPIO_0,
@@ -245,12 +254,16 @@ struct tm6000_board tm6000_boards[] = {
.tuner_type = TUNER_XC5000,
.tuner_addr = 0xc2 >> 1,
.type = TM6010,
+ .avideo = TM6000_AIP_SIF1,
+ .aradio = TM6000_AIP_LINE1,
.caps = {
- .has_tuner = 1,
- .has_dvb = 0,
- .has_zl10353 = 0,
- .has_eeprom = 1,
- .has_remote = 1,
+ .has_tuner = 1,
+ .has_dvb = 0,
+ .has_zl10353 = 0,
+ .has_eeprom = 1,
+ .has_remote = 1,
+ .has_input_comp = 1,
+ .has_input_svid = 1,
},
.gpio = {
.tuner_reset = TM6010_GPIO_0,
@@ -281,6 +294,11 @@ struct tm6000_board tm6000_boards[] = {
},
.ir_codes = RC_MAP_NEC_TERRATEC_CINERGY_XS,
},
+ [TM5600_BOARD_TERRATEC_GRABSTER] = {
+ .name = "Terratec Grabster AV 150/250 MX",
+ .type = TM5600,
+ .tuner_type = TUNER_ABSENT,
+ },
[TM6010_BOARD_TWINHAN_TU501] = {
.name = "Twinhan TU501(704D1)",
.tuner_type = TUNER_XC2028, /* has a XC3028 */
@@ -303,7 +321,51 @@ struct tm6000_board tm6000_boards[] = {
.dvb_led = TM6010_GPIO_5,
.ir = TM6010_GPIO_0,
},
- }
+ },
+ [TM6010_BOARD_BEHOLD_WANDER_LITE] = {
+ .name = "Beholder Wander Lite DVB-T/TV/FM USB2.0",
+ .tuner_type = TUNER_XC5000,
+ .tuner_addr = 0xc2 >> 1,
+ .demod_addr = 0x1e >> 1,
+ .type = TM6010,
+ .avideo = TM6000_AIP_SIF1,
+ .aradio = TM6000_AIP_LINE1,
+ .caps = {
+ .has_tuner = 1,
+ .has_dvb = 1,
+ .has_zl10353 = 1,
+ .has_eeprom = 1,
+ .has_remote = 0,
+ .has_input_comp = 0,
+ .has_input_svid = 0,
+ },
+ .gpio = {
+ .tuner_reset = TM6010_GPIO_0,
+ .demod_reset = TM6010_GPIO_1,
+ .power_led = TM6010_GPIO_6,
+ },
+ },
+ [TM6010_BOARD_BEHOLD_VOYAGER_LITE] = {
+ .name = "Beholder Voyager Lite TV/FM USB2.0",
+ .tuner_type = TUNER_XC5000,
+ .tuner_addr = 0xc2 >> 1,
+ .type = TM6010,
+ .avideo = TM6000_AIP_SIF1,
+ .aradio = TM6000_AIP_LINE1,
+ .caps = {
+ .has_tuner = 1,
+ .has_dvb = 0,
+ .has_zl10353 = 0,
+ .has_eeprom = 1,
+ .has_remote = 0,
+ .has_input_comp = 0,
+ .has_input_svid = 0,
+ },
+ .gpio = {
+ .tuner_reset = TM6010_GPIO_0,
+ .power_led = TM6010_GPIO_6,
+ },
+ },
};
/* table of devices that work with this driver */
@@ -321,10 +383,13 @@ struct usb_device_id tm6000_id_table[] = {
{ USB_DEVICE(0x6000, 0xdec1), .driver_info = TM6010_BOARD_BEHOLD_VOYAGER },
{ USB_DEVICE(0x0ccd, 0x0086), .driver_info = TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE },
{ USB_DEVICE(0x0ccd, 0x00A5), .driver_info = TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE },
+ { USB_DEVICE(0x0ccd, 0x0079), .driver_info = TM5600_BOARD_TERRATEC_GRABSTER },
{ USB_DEVICE(0x13d3, 0x3240), .driver_info = TM6010_BOARD_TWINHAN_TU501 },
{ USB_DEVICE(0x13d3, 0x3241), .driver_info = TM6010_BOARD_TWINHAN_TU501 },
{ USB_DEVICE(0x13d3, 0x3243), .driver_info = TM6010_BOARD_TWINHAN_TU501 },
{ USB_DEVICE(0x13d3, 0x3264), .driver_info = TM6010_BOARD_TWINHAN_TU501 },
+ { USB_DEVICE(0x6000, 0xdec2), .driver_info = TM6010_BOARD_BEHOLD_WANDER_LITE },
+ { USB_DEVICE(0x6000, 0xdec3), .driver_info = TM6010_BOARD_BEHOLD_VOYAGER_LITE },
{ },
};
@@ -346,6 +411,8 @@ void tm6000_flash_led(struct tm6000_core *dev, u8 state)
break;
case TM6010_BOARD_BEHOLD_WANDER:
case TM6010_BOARD_BEHOLD_VOYAGER:
+ case TM6010_BOARD_BEHOLD_WANDER_LITE:
+ case TM6010_BOARD_BEHOLD_VOYAGER_LITE:
tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
dev->gpio.power_led, 0x01);
break;
@@ -362,6 +429,8 @@ void tm6000_flash_led(struct tm6000_core *dev, u8 state)
break;
case TM6010_BOARD_BEHOLD_WANDER:
case TM6010_BOARD_BEHOLD_VOYAGER:
+ case TM6010_BOARD_BEHOLD_WANDER_LITE:
+ case TM6010_BOARD_BEHOLD_VOYAGER_LITE:
tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
dev->gpio.power_led, 0x00);
break;
@@ -520,6 +589,7 @@ int tm6000_cards_setup(struct tm6000_core *dev)
msleep(15);
break;
case TM6010_BOARD_BEHOLD_WANDER:
+ case TM6010_BOARD_BEHOLD_WANDER_LITE:
/* Power led on (blue) */
tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, dev->gpio.power_led, 0x01);
msleep(15);
@@ -530,6 +600,7 @@ int tm6000_cards_setup(struct tm6000_core *dev)
msleep(15);
break;
case TM6010_BOARD_BEHOLD_VOYAGER:
+ case TM6010_BOARD_BEHOLD_VOYAGER_LITE:
/* Power led on (blue) */
tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, dev->gpio.power_led, 0x01);
msleep(15);
@@ -588,8 +659,6 @@ static void tm6000_config_tuner(struct tm6000_core *dev)
tun_setup.mode_mask = 0;
if (dev->caps.has_tuner)
tun_setup.mode_mask |= (T_ANALOG_TV | T_RADIO);
- if (dev->caps.has_dvb)
- tun_setup.mode_mask |= T_DIGITAL_TV;
switch (dev->tuner_type) {
case TUNER_XC2028:
@@ -644,13 +713,12 @@ static void tm6000_config_tuner(struct tm6000_core *dev)
struct xc5000_config ctl = {
.i2c_address = dev->tuner_addr,
.if_khz = 4570,
- .radio_input = XC5000_RADIO_FM1,
+ .radio_input = XC5000_RADIO_FM1_MONO,
};
xc5000_cfg.tuner = TUNER_XC5000;
xc5000_cfg.priv = &ctl;
-
v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_config,
&xc5000_cfg);
}
@@ -683,6 +751,8 @@ static int tm6000_init_dev(struct tm6000_core *dev)
dev->caps = tm6000_boards[dev->model].caps;
+ dev->avideo = tm6000_boards[dev->model].avideo;
+ dev->aradio = tm6000_boards[dev->model].aradio;
/* initialize hardware */
rc = tm6000_init(dev);
if (rc < 0)
@@ -957,6 +1027,8 @@ static void tm6000_usb_disconnect(struct usb_interface *interface)
break;
case TM6010_BOARD_BEHOLD_WANDER:
case TM6010_BOARD_BEHOLD_VOYAGER:
+ case TM6010_BOARD_BEHOLD_WANDER_LITE:
+ case TM6010_BOARD_BEHOLD_VOYAGER_LITE:
/* Power led off */
tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
dev->gpio.power_led, 0x00);
diff --git a/drivers/staging/tm6000/tm6000-core.c b/drivers/staging/tm6000/tm6000-core.c
index 96aed4ace467..778e53413afb 100644
--- a/drivers/staging/tm6000/tm6000-core.c
+++ b/drivers/staging/tm6000/tm6000-core.c
@@ -116,6 +116,29 @@ int tm6000_get_reg(struct tm6000_core *dev, u8 req, u16 value, u16 index)
}
EXPORT_SYMBOL_GPL(tm6000_get_reg);
+int tm6000_set_reg_mask(struct tm6000_core *dev, u8 req, u16 value,
+ u16 index, u16 mask)
+{
+ int rc;
+ u8 buf[1];
+ u8 new_index;
+
+ rc = tm6000_read_write_usb(dev, USB_DIR_IN | USB_TYPE_VENDOR, req,
+ value, index, buf, 1);
+
+ if (rc < 0)
+ return rc;
+
+ new_index = (buf[0] & ~mask) | (index & mask);
+
+ if (new_index == index)
+ return 0;
+
+ return tm6000_read_write_usb(dev, USB_DIR_OUT | USB_TYPE_VENDOR,
+ req, value, new_index, NULL, 0);
+}
+EXPORT_SYMBOL_GPL(tm6000_set_reg_mask);
+
int tm6000_get_reg16(struct tm6000_core *dev, u8 req, u16 value, u16 index)
{
int rc;
@@ -245,17 +268,12 @@ int tm6000_init_analog_mode(struct tm6000_core *dev)
struct v4l2_frequency f;
if (dev->dev_type == TM6010) {
- int val;
-
/* Enable video */
- val = tm6000_get_reg(dev, TM6010_REQ07_RCC_ACTIVE_VIDEO_IF, 0);
- val |= 0x60;
- tm6000_set_reg(dev, TM6010_REQ07_RCC_ACTIVE_VIDEO_IF, val);
- val = tm6000_get_reg(dev,
- TM6010_REQ07_RC0_ACTIVE_VIDEO_SOURCE, 0);
- val &= ~0x40;
- tm6000_set_reg(dev, TM6010_REQ07_RC0_ACTIVE_VIDEO_SOURCE, val);
+ tm6000_set_reg_mask(dev, TM6010_REQ07_RCC_ACTIVE_VIDEO_IF,
+ 0x60, 0x60);
+ tm6000_set_reg_mask(dev, TM6010_REQ07_RC0_ACTIVE_VIDEO_SOURCE,
+ 0x00, 0x40);
tm6000_set_reg(dev, TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc);
} else {
@@ -268,11 +286,11 @@ int tm6000_init_analog_mode(struct tm6000_core *dev)
tm6000_set_reg(dev, TM6010_REQ07_RC0_ACTIVE_VIDEO_SOURCE, 0x80);
tm6000_set_reg(dev, TM6010_REQ07_RC3_HSTART1, 0x88);
- tm6000_set_reg(dev, TM6010_REQ07_RD8_IR_WAKEUP_SEL, 0x23);
+ tm6000_set_reg(dev, TM6000_REQ07_RDA_CLK_SEL, 0x23);
tm6000_set_reg(dev, TM6010_REQ07_RD1_ADDR_FOR_REQ1, 0xc0);
tm6000_set_reg(dev, TM6010_REQ07_RD2_ADDR_FOR_REQ2, 0xd8);
tm6000_set_reg(dev, TM6010_REQ07_RD6_ENDP_REQ1_REQ2, 0x06);
- tm6000_set_reg(dev, TM6010_REQ07_RD8_IR_PULSE_CNT0, 0x1f);
+ tm6000_set_reg(dev, TM6000_REQ07_RDF_PWDOWN_ACLK, 0x1f);
/* AP Software reset */
tm6000_set_reg(dev, TM6010_REQ07_RFF_SOFT_RESET, 0x08);
@@ -284,8 +302,8 @@ int tm6000_init_analog_mode(struct tm6000_core *dev)
tm6000_set_reg(dev, TM6010_REQ07_R3F_RESET, 0x00);
/* E3: Select input 0 - TV tuner */
- tm6000_set_reg(dev, TM6010_REQ07_RE3_OUT_SEL1, 0x00);
- tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0xeb, 0x60);
+ tm6000_set_reg(dev, TM6000_REQ07_RE3_VADC_INP_LPF_SEL1, 0x00);
+ tm6000_set_reg(dev, TM6000_REQ07_REB_VADC_AADC_MODE, 0x60);
/* This controls input */
tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, TM6000_GPIO_2, 0x0);
@@ -344,21 +362,21 @@ int tm6000_init_digital_mode(struct tm6000_core *dev)
tm6000_set_reg(dev, TM6010_REQ07_RFF_SOFT_RESET, 0x08);
tm6000_set_reg(dev, TM6010_REQ07_RFF_SOFT_RESET, 0x00);
tm6000_set_reg(dev, TM6010_REQ07_R3F_RESET, 0x01);
- tm6000_set_reg(dev, TM6010_REQ07_RD8_IR_PULSE_CNT0, 0x08);
- tm6000_set_reg(dev, TM6010_REQ07_RE2_OUT_SEL2, 0x0c);
- tm6000_set_reg(dev, TM6010_REQ07_RE8_TYPESEL_MOS_I2S, 0xff);
- tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0x00eb, 0xd8);
+ tm6000_set_reg(dev, TM6000_REQ07_RDF_PWDOWN_ACLK, 0x08);
+ tm6000_set_reg(dev, TM6000_REQ07_RE2_VADC_STATUS_CTL, 0x0c);
+ tm6000_set_reg(dev, TM6000_REQ07_RE8_VADC_PWDOWN_CTL, 0xff);
+ tm6000_set_reg(dev, TM6000_REQ07_REB_VADC_AADC_MODE, 0xd8);
tm6000_set_reg(dev, TM6010_REQ07_RC0_ACTIVE_VIDEO_SOURCE, 0x40);
tm6000_set_reg(dev, TM6010_REQ07_RC1_TRESHOLD, 0xd0);
tm6000_set_reg(dev, TM6010_REQ07_RC3_HSTART1, 0x09);
- tm6000_set_reg(dev, TM6010_REQ07_RD8_IR_WAKEUP_SEL, 0x37);
+ tm6000_set_reg(dev, TM6000_REQ07_RDA_CLK_SEL, 0x37);
tm6000_set_reg(dev, TM6010_REQ07_RD1_ADDR_FOR_REQ1, 0xd8);
tm6000_set_reg(dev, TM6010_REQ07_RD2_ADDR_FOR_REQ2, 0xc0);
tm6000_set_reg(dev, TM6010_REQ07_RD6_ENDP_REQ1_REQ2, 0x60);
- tm6000_set_reg(dev, TM6010_REQ07_RE2_OUT_SEL2, 0x0c);
- tm6000_set_reg(dev, TM6010_REQ07_RE8_TYPESEL_MOS_I2S, 0xff);
- tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0x00eb, 0x08);
+ tm6000_set_reg(dev, TM6000_REQ07_RE2_VADC_STATUS_CTL, 0x0c);
+ tm6000_set_reg(dev, TM6000_REQ07_RE8_VADC_PWDOWN_CTL, 0xff);
+ tm6000_set_reg(dev, TM6000_REQ07_REB_VADC_AADC_MODE, 0x08);
msleep(50);
tm6000_set_reg(dev, REQ_04_EN_DISABLE_MCU_INT, 0x0020, 0x00);
@@ -388,18 +406,19 @@ struct reg_init {
/* The meaning of those initializations are unknown */
struct reg_init tm6000_init_tab[] = {
/* REG VALUE */
- { TM6010_REQ07_RD8_IR_PULSE_CNT0, 0x1f },
+ { TM6000_REQ07_RDF_PWDOWN_ACLK, 0x1f },
{ TM6010_REQ07_RFF_SOFT_RESET, 0x08 },
{ TM6010_REQ07_RFF_SOFT_RESET, 0x00 },
{ TM6010_REQ07_RD5_POWERSAVE, 0x4f },
- { TM6010_REQ07_RD8_IR_WAKEUP_SEL, 0x23 },
- { TM6010_REQ07_RD8_IR_WAKEUP_ADD, 0x08 },
- { TM6010_REQ07_RE2_OUT_SEL2, 0x00 },
- { TM6010_REQ07_RE3_OUT_SEL1, 0x10 },
- { TM6010_REQ07_RE5_REMOTE_WAKEUP, 0x00 },
- { TM6010_REQ07_RE8_TYPESEL_MOS_I2S, 0x00 },
- { REQ_07_SET_GET_AVREG, 0xeb, 0x64 }, /* 48000 bits/sample, external input */
- { REQ_07_SET_GET_AVREG, 0xee, 0xc2 },
+ { TM6000_REQ07_RDA_CLK_SEL, 0x23 },
+ { TM6000_REQ07_RDB_OUT_SEL, 0x08 },
+ { TM6000_REQ07_RE2_VADC_STATUS_CTL, 0x00 },
+ { TM6000_REQ07_RE3_VADC_INP_LPF_SEL1, 0x10 },
+ { TM6000_REQ07_RE5_VADC_INP_LPF_SEL2, 0x00 },
+ { TM6000_REQ07_RE8_VADC_PWDOWN_CTL, 0x00 },
+ { TM6000_REQ07_REB_VADC_AADC_MODE, 0x64 }, /* 48000 bits/sample, external input */
+ { TM6000_REQ07_REE_VADC_CTRL_SEL_CONTROL, 0xc2 },
+
{ TM6010_REQ07_R3F_RESET, 0x01 }, /* Start of soft reset */
{ TM6010_REQ07_R00_VIDEO_CONTROL0, 0x00 },
{ TM6010_REQ07_R01_VIDEO_CONTROL1, 0x07 },
@@ -470,6 +489,14 @@ struct reg_init tm6010_init_tab[] = {
{ TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xf0 },
{ TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2 },
{ TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x60 },
+ { TM6010_REQ08_R03_A_AUTO_GAIN_CTRL, 0x00},
+ { TM6010_REQ08_R04_A_SIF_AMP_CTRL, 0x80},
+ { TM6010_REQ08_R0C_A_ASD_THRES2, 0x0a},
+ { TM6010_REQ08_R0D_A_AMD_THRES, 0x40},
+ { TM6010_REQ08_R1A_A_NICAM_SER_MAX, 0x64},
+ { TM6010_REQ08_R1B_A_NICAM_SER_MIN, 0x20},
+ { TM6010_REQ08_R16_A_AGC_GAIN_MAX, 0xfe},
+ { TM6010_REQ08_R17_A_AGC_GAIN_MIN, 0x01},
{ TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc },
{ TM6010_REQ07_R3F_RESET, 0x01 },
@@ -590,38 +617,213 @@ int tm6000_init(struct tm6000_core *dev)
int tm6000_set_audio_bitrate(struct tm6000_core *dev, int bitrate)
{
- int val;
+ int val = 0;
+ u8 areg_f0 = 0x60; /* ADC MCLK = 250 Fs */
+ u8 areg_0a = 0x91; /* SIF 48KHz */
+ switch (bitrate) {
+ case 48000:
+ areg_f0 = 0x60; /* ADC MCLK = 250 Fs */
+ areg_0a = 0x91; /* SIF 48KHz */
+ dev->audio_bitrate = bitrate;
+ break;
+ case 32000:
+ areg_f0 = 0x00; /* ADC MCLK = 375 Fs */
+ areg_0a = 0x90; /* SIF 32KHz */
+ dev->audio_bitrate = bitrate;
+ break;
+ default:
+ return -EINVAL;
+ }
+
+
+ /* enable I2S, if we use sif or external I2S device */
if (dev->dev_type == TM6010) {
- val = tm6000_get_reg(dev, TM6010_REQ08_R0A_A_I2S_MOD, 0);
+ val = tm6000_set_reg(dev, TM6010_REQ08_R0A_A_I2S_MOD, areg_0a);
if (val < 0)
return val;
- val = (val & 0xf0) | 0x1; /* 48 kHz, not muted */
- val = tm6000_set_reg(dev, TM6010_REQ08_R0A_A_I2S_MOD, val);
+
+ val = tm6000_set_reg_mask(dev, TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG,
+ areg_f0, 0xf0);
+ if (val < 0)
+ return val;
+ } else {
+ val = tm6000_set_reg_mask(dev, TM6000_REQ07_REB_VADC_AADC_MODE,
+ areg_f0, 0xf0);
if (val < 0)
return val;
}
+ return 0;
+}
+EXPORT_SYMBOL_GPL(tm6000_set_audio_bitrate);
- val = tm6000_get_reg(dev, REQ_07_SET_GET_AVREG, 0xeb, 0x0);
- if (val < 0)
- return val;
+int tm6000_set_audio_input(struct tm6000_core *dev, enum tm6000_inaudio ainp)
+{
+ if (dev->dev_type == TM6010) {
+ /* Audio crossbar setting, default SIF1 */
+ u8 areg_f0 = 0x03;
- val &= 0x0f; /* Preserve the audio input control bits */
- switch (bitrate) {
- case 44100:
- val |= 0xd0;
- dev->audio_bitrate = bitrate;
+ switch (ainp) {
+ case TM6000_AIP_SIF1:
+ case TM6000_AIP_SIF2:
+ areg_f0 = 0x03;
+ break;
+ case TM6000_AIP_LINE1:
+ areg_f0 = 0x00;
+ break;
+ case TM6000_AIP_LINE2:
+ areg_f0 = 0x08;
+ break;
+ default:
+ return 0;
+ break;
+ }
+ /* Set audio input crossbar */
+ tm6000_set_reg_mask(dev, TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG,
+ areg_f0, 0x0f);
+ } else {
+ /* Audio setting, default LINE1 */
+ u8 areg_eb = 0x00;
+
+ switch (ainp) {
+ case TM6000_AIP_LINE1:
+ areg_eb = 0x00;
+ break;
+ case TM6000_AIP_LINE2:
+ areg_eb = 0x04;
+ break;
+ default:
+ return 0;
+ break;
+ }
+ /* Set audio input */
+ tm6000_set_reg_mask(dev, TM6000_REQ07_REB_VADC_AADC_MODE,
+ areg_eb, 0x0f);
+ }
+ return 0;
+}
+EXPORT_SYMBOL_GPL(tm6000_set_audio_input);
+
+void tm6010_set_mute_sif(struct tm6000_core *dev, u8 mute)
+{
+ u8 mute_reg = 0;
+
+ if (mute)
+ mute_reg = 0x08;
+
+ tm6000_set_reg_mask(dev, TM6010_REQ08_R0A_A_I2S_MOD, mute_reg, 0x08);
+}
+
+void tm6010_set_mute_adc(struct tm6000_core *dev, u8 mute)
+{
+ u8 mute_reg = 0;
+
+ if (mute)
+ mute_reg = 0x20;
+
+ if (dev->dev_type == TM6010) {
+ tm6000_set_reg_mask(dev, TM6010_REQ08_RF2_LEFT_CHANNEL_VOL,
+ mute_reg, 0x20);
+ tm6000_set_reg_mask(dev, TM6010_REQ08_RF3_RIGHT_CHANNEL_VOL,
+ mute_reg, 0x20);
+ } else {
+ tm6000_set_reg_mask(dev, TM6000_REQ07_REC_VADC_AADC_LVOL,
+ mute_reg, 0x20);
+ tm6000_set_reg_mask(dev, TM6000_REQ07_RED_VADC_AADC_RVOL,
+ mute_reg, 0x20);
+ }
+}
+
+int tm6000_tvaudio_set_mute(struct tm6000_core *dev, u8 mute)
+{
+ enum tm6000_inaudio ainp;
+
+ if (dev->radio)
+ ainp = dev->aradio;
+ else
+ ainp = dev->avideo;
+
+ switch (ainp) {
+ case TM6000_AIP_SIF1:
+ case TM6000_AIP_SIF2:
+ if (dev->dev_type == TM6010)
+ tm6010_set_mute_sif(dev, mute);
+ else {
+ printk(KERN_INFO "ERROR: TM5600 and TM6000 don't has"
+ " SIF audio inputs. Please check the %s"
+ " configuration.\n", dev->name);
+ return -EINVAL;
+ }
break;
- case 48000:
- val |= 0x60;
- dev->audio_bitrate = bitrate;
+ case TM6000_AIP_LINE1:
+ case TM6000_AIP_LINE2:
+ tm6010_set_mute_adc(dev, mute);
+ break;
+ default:
+ return -EINVAL;
break;
}
- val = tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0xeb, val);
+ return 0;
+}
+EXPORT_SYMBOL_GPL(tm6000_tvaudio_set_mute);
+
+void tm6010_set_volume_sif(struct tm6000_core *dev, int vol)
+{
+ u8 vol_reg;
+
+ vol_reg = vol & 0x0F;
+
+ if (vol < 0)
+ vol_reg |= 0x40;
+
+ tm6000_set_reg(dev, TM6010_REQ08_R07_A_LEFT_VOL, vol_reg);
+ tm6000_set_reg(dev, TM6010_REQ08_R08_A_RIGHT_VOL, vol_reg);
+}
+
+void tm6010_set_volume_adc(struct tm6000_core *dev, int vol)
+{
+ u8 vol_reg;
+
+ vol_reg = (vol + 0x10) & 0x1f;
+
+ if (dev->dev_type == TM6010) {
+ tm6000_set_reg(dev, TM6010_REQ08_RF2_LEFT_CHANNEL_VOL, vol_reg);
+ tm6000_set_reg(dev, TM6010_REQ08_RF3_RIGHT_CHANNEL_VOL, vol_reg);
+ } else {
+ tm6000_set_reg(dev, TM6000_REQ07_REC_VADC_AADC_LVOL, vol_reg);
+ tm6000_set_reg(dev, TM6000_REQ07_RED_VADC_AADC_RVOL, vol_reg);
+ }
+}
+
+void tm6000_set_volume(struct tm6000_core *dev, int vol)
+{
+ enum tm6000_inaudio ainp;
+
+ if (dev->radio) {
+ ainp = dev->aradio;
+ vol += 8; /* Offset to 0 dB */
+ } else
+ ainp = dev->avideo;
- return val;
+ switch (ainp) {
+ case TM6000_AIP_SIF1:
+ case TM6000_AIP_SIF2:
+ if (dev->dev_type == TM6010)
+ tm6010_set_volume_sif(dev, vol);
+ else
+ printk(KERN_INFO "ERROR: TM5600 and TM6000 don't has"
+ " SIF audio inputs. Please check the %s"
+ " configuration.\n", dev->name);
+ break;
+ case TM6000_AIP_LINE1:
+ case TM6000_AIP_LINE2:
+ tm6010_set_volume_adc(dev, vol);
+ break;
+ default:
+ break;
+ }
}
-EXPORT_SYMBOL_GPL(tm6000_set_audio_bitrate);
+EXPORT_SYMBOL_GPL(tm6000_set_volume);
static LIST_HEAD(tm6000_devlist);
static DEFINE_MUTEX(tm6000_devlist_mutex);
diff --git a/drivers/staging/tm6000/tm6000-regs.h b/drivers/staging/tm6000/tm6000-regs.h
index 1f0ced8fa20f..5375a8347374 100644
--- a/drivers/staging/tm6000/tm6000-regs.h
+++ b/drivers/staging/tm6000/tm6000-regs.h
@@ -97,6 +97,34 @@ enum {
TM6000_URB_MSG_ERR,
};
+/* Define specific TM6000 Video decoder registers */
+#define TM6000_REQ07_RD8_TEST_SEL 0x07, 0xd8
+#define TM6000_REQ07_RD9_A_SIM_SEL 0x07, 0xd9
+#define TM6000_REQ07_RDA_CLK_SEL 0x07, 0xda
+#define TM6000_REQ07_RDB_OUT_SEL 0x07, 0xdb
+#define TM6000_REQ07_RDC_NSEL_I2S 0x07, 0xdc
+#define TM6000_REQ07_RDD_GPIO2_MDRV 0x07, 0xdd
+#define TM6000_REQ07_RDE_GPIO1_MDRV 0x07, 0xde
+#define TM6000_REQ07_RDF_PWDOWN_ACLK 0x07, 0xdf
+#define TM6000_REQ07_RE0_VADC_REF_CTL 0x07, 0xe0
+#define TM6000_REQ07_RE1_VADC_DACLIMP 0x07, 0xe1
+#define TM6000_REQ07_RE2_VADC_STATUS_CTL 0x07, 0xe2
+#define TM6000_REQ07_RE3_VADC_INP_LPF_SEL1 0x07, 0xe3
+#define TM6000_REQ07_RE4_VADC_TARGET1 0x07, 0xe4
+#define TM6000_REQ07_RE5_VADC_INP_LPF_SEL2 0x07, 0xe5
+#define TM6000_REQ07_RE6_VADC_TARGET2 0x07, 0xe6
+#define TM6000_REQ07_RE7_VADC_AGAIN_CTL 0x07, 0xe7
+#define TM6000_REQ07_RE8_VADC_PWDOWN_CTL 0x07, 0xe8
+#define TM6000_REQ07_RE9_VADC_INPUT_CTL1 0x07, 0xe9
+#define TM6000_REQ07_REA_VADC_INPUT_CTL2 0x07, 0xea
+#define TM6000_REQ07_REB_VADC_AADC_MODE 0x07, 0xeb
+#define TM6000_REQ07_REC_VADC_AADC_LVOL 0x07, 0xec
+#define TM6000_REQ07_RED_VADC_AADC_RVOL 0x07, 0xed
+#define TM6000_REQ07_REE_VADC_CTRL_SEL_CONTROL 0x07, 0xee
+#define TM6000_REQ07_REF_VADC_GAIN_MAP_CTL 0x07, 0xef
+#define TM6000_REQ07_RFD_BIST_ERR_VST_LOW 0x07, 0xfd
+#define TM6000_REQ07_RFE_BIST_ERR_VST_HIGH 0x07, 0xfe
+
/* Define TM6000/TM6010 Video decoder registers */
#define TM6010_REQ07_R00_VIDEO_CONTROL0 0x07, 0x00
#define TM6010_REQ07_R01_VIDEO_CONTROL1 0x07, 0x01
@@ -241,6 +269,7 @@ enum {
#define TM6010_REQ07_RC9_VEND1 0x07, 0xc9
#define TM6010_REQ07_RCA_VEND0 0x07, 0xca
#define TM6010_REQ07_RCB_DELAY 0x07, 0xcb
+/* ONLY for TM6010 */
#define TM6010_REQ07_RCC_ACTIVE_VIDEO_IF 0x07, 0xcc
#define TM6010_REQ07_RD0_USB_PERIPHERY_CONTROL 0x07, 0xd0
#define TM6010_REQ07_RD1_ADDR_FOR_REQ1 0x07, 0xd1
@@ -250,32 +279,59 @@ enum {
#define TM6010_REQ07_RD5_POWERSAVE 0x07, 0xd5
#define TM6010_REQ07_RD6_ENDP_REQ1_REQ2 0x07, 0xd6
#define TM6010_REQ07_RD7_ENDP_REQ3_REQ4 0x07, 0xd7
+/* ONLY for TM6010 */
#define TM6010_REQ07_RD8_IR 0x07, 0xd8
+/* ONLY for TM6010 */
#define TM6010_REQ07_RD8_IR_BSIZE 0x07, 0xd9
+/* ONLY for TM6010 */
#define TM6010_REQ07_RD8_IR_WAKEUP_SEL 0x07, 0xda
+/* ONLY for TM6010 */
#define TM6010_REQ07_RD8_IR_WAKEUP_ADD 0x07, 0xdb
+/* ONLY for TM6010 */
#define TM6010_REQ07_RD8_IR_LEADER1 0x07, 0xdc
+/* ONLY for TM6010 */
#define TM6010_REQ07_RD8_IR_LEADER0 0x07, 0xdd
+/* ONLY for TM6010 */
#define TM6010_REQ07_RD8_IR_PULSE_CNT1 0x07, 0xde
+/* ONLY for TM6010 */
#define TM6010_REQ07_RD8_IR_PULSE_CNT0 0x07, 0xdf
+/* ONLY for TM6010 */
#define TM6010_REQ07_RE0_DVIDEO_SOURCE 0x07, 0xe0
+/* ONLY for TM6010 */
#define TM6010_REQ07_RE0_DVIDEO_SOURCE_IF 0x07, 0xe1
+/* ONLY for TM6010 */
#define TM6010_REQ07_RE2_OUT_SEL2 0x07, 0xe2
+/* ONLY for TM6010 */
#define TM6010_REQ07_RE3_OUT_SEL1 0x07, 0xe3
+/* ONLY for TM6010 */
#define TM6010_REQ07_RE4_OUT_SEL0 0x07, 0xe4
+/* ONLY for TM6010 */
#define TM6010_REQ07_RE5_REMOTE_WAKEUP 0x07, 0xe5
+/* ONLY for TM6010 */
#define TM6010_REQ07_RE7_PUB_GPIO 0x07, 0xe7
+/* ONLY for TM6010 */
#define TM6010_REQ07_RE8_TYPESEL_MOS_I2S 0x07, 0xe8
+/* ONLY for TM6010 */
#define TM6010_REQ07_RE9_TYPESEL_MOS_TS 0x07, 0xe9
+/* ONLY for TM6010 */
#define TM6010_REQ07_REA_TYPESEL_MOS_CCIR 0x07, 0xea
+/* ONLY for TM6010 */
#define TM6010_REQ07_RF0_BIST_CRC_RESULT0 0x07, 0xf0
+/* ONLY for TM6010 */
#define TM6010_REQ07_RF1_BIST_CRC_RESULT1 0x07, 0xf1
+/* ONLY for TM6010 */
#define TM6010_REQ07_RF2_BIST_CRC_RESULT2 0x07, 0xf2
+/* ONLY for TM6010 */
#define TM6010_REQ07_RF3_BIST_CRC_RESULT3 0x07, 0xf3
+/* ONLY for TM6010 */
#define TM6010_REQ07_RF4_BIST_ERR_VST2 0x07, 0xf4
+/* ONLY for TM6010 */
#define TM6010_REQ07_RF5_BIST_ERR_VST1 0x07, 0xf5
+/* ONLY for TM6010 */
#define TM6010_REQ07_RF6_BIST_ERR_VST0 0x07, 0xf6
+/* ONLY for TM6010 */
#define TM6010_REQ07_RF7_BIST 0x07, 0xf7
+/* ONLY for TM6010 */
#define TM6010_REQ07_RFE_POWER_DOWN 0x07, 0xfe
#define TM6010_REQ07_RFF_SOFT_RESET 0x07, 0xff
@@ -477,7 +533,8 @@ enum {
#define TM6010_REQ05_RC4_DATA_FIFO14 0x05, 0xf8
#define TM6010_REQ05_RC4_DATA_FIFO15 0x05, 0xfc
-/* Define TM6000/TM6010 Audio decoder registers */
+/* Define TM6010 Audio decoder registers */
+/* This core available only in TM6010 */
#define TM6010_REQ08_R00_A_VERSION 0x08, 0x00
#define TM6010_REQ08_R01_A_INIT 0x08, 0x01
#define TM6010_REQ08_R02_A_FIX_GAIN_CTRL 0x08, 0x02
@@ -518,7 +575,7 @@ enum {
#define TM6010_REQ08_R27_A_NOISE_AMP 0x08, 0x27
#define TM6010_REQ08_R28_A_AUDIO_MODE_RES 0x08, 0x28
-/* Define TM6000/TM6010 Video ADC registers */
+/* Define TM6010 Video ADC registers */
#define TM6010_REQ08_RE0_ADC_REF 0x08, 0xe0
#define TM6010_REQ08_RE1_DAC_CLMP 0x08, 0xe1
#define TM6010_REQ08_RE2_POWER_DOWN_CTRL1 0x08, 0xe2
@@ -534,7 +591,7 @@ enum {
#define TM6010_REQ08_REC_REVERSE_YC_CTRL 0x08, 0xec
#define TM6010_REQ08_RED_GAIN_SEL 0x08, 0xed
-/* Define TM6000/TM6010 Audio ADC registers */
+/* Define TM6010 Audio ADC registers */
#define TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG 0x08, 0xf0
#define TM6010_REQ08_RF1_AADC_POWER_DOWN 0x08, 0xf1
#define TM6010_REQ08_RF2_LEFT_CHANNEL_VOL 0x08, 0xf2
diff --git a/drivers/staging/tm6000/tm6000-stds.c b/drivers/staging/tm6000/tm6000-stds.c
index cc7b8664fc20..da3e51bde109 100644
--- a/drivers/staging/tm6000/tm6000-stds.c
+++ b/drivers/staging/tm6000/tm6000-stds.c
@@ -952,6 +952,22 @@ static int tm6000_set_audio_std(struct tm6000_core *dev,
uint8_t mono_flag = 0; /* No mono */
uint8_t nicam_flag = 0; /* No NICAM */
+ if (dev->radio) {
+ tm6000_set_reg(dev, TM6010_REQ08_R01_A_INIT, 0x00);
+ tm6000_set_reg(dev, TM6010_REQ08_R02_A_FIX_GAIN_CTRL, 0x04);
+ tm6000_set_reg(dev, TM6010_REQ08_R03_A_AUTO_GAIN_CTRL, 0x00);
+ tm6000_set_reg(dev, TM6010_REQ08_R04_A_SIF_AMP_CTRL, 0x80);
+ tm6000_set_reg(dev, TM6010_REQ08_R05_A_STANDARD_MOD, 0x0c);
+ tm6000_set_reg(dev, TM6010_REQ08_R06_A_SOUND_MOD, 0x00);
+ tm6000_set_reg(dev, TM6010_REQ08_R09_A_MAIN_VOL, 0x18);
+ tm6000_set_reg(dev, TM6010_REQ08_R0C_A_ASD_THRES2, 0x0a);
+ tm6000_set_reg(dev, TM6010_REQ08_R0D_A_AMD_THRES, 0x40);
+ tm6000_set_reg(dev, TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc);
+ tm6000_set_reg(dev, TM6010_REQ08_R1E_A_GAIN_DEEMPH_OUT, 0x13);
+ tm6000_set_reg(dev, TM6010_REQ08_R01_A_INIT, 0x80);
+ return 0;
+ }
+
switch (std) {
#if 0
case DK_MONO:
@@ -984,20 +1000,6 @@ static int tm6000_set_audio_std(struct tm6000_core *dev,
case EIAJ:
areg_05 = 0x02;
break;
- case FM_RADIO:
- tm6000_set_reg(dev, TM6010_REQ08_R01_A_INIT, 0x00);
- tm6000_set_reg(dev, TM6010_REQ08_R02_A_FIX_GAIN_CTRL, 0x04);
- tm6000_set_reg(dev, TM6010_REQ08_R03_A_AUTO_GAIN_CTRL, 0x00);
- tm6000_set_reg(dev, TM6010_REQ08_R05_A_STANDARD_MOD, 0x0c);
- tm6000_set_reg(dev, TM6010_REQ08_R06_A_SOUND_MOD, 0x00);
- tm6000_set_reg(dev, TM6010_REQ08_R09_A_MAIN_VOL, 0x18);
- tm6000_set_reg(dev, TM6010_REQ08_R0A_A_I2S_MOD, 0x91);
- tm6000_set_reg(dev, TM6010_REQ08_R16_A_AGC_GAIN_MAX, 0xfe);
- tm6000_set_reg(dev, TM6010_REQ08_R17_A_AGC_GAIN_MIN, 0x01);
- tm6000_set_reg(dev, TM6010_REQ08_R1E_A_GAIN_DEEMPH_OUT, 0x13);
- tm6000_set_reg(dev, TM6010_REQ08_R01_A_INIT, 0x80);
- return 0;
- break;
case I_NICAM:
areg_05 = 0x08;
nicam_flag = 1;
@@ -1010,6 +1012,9 @@ static int tm6000_set_audio_std(struct tm6000_core *dev,
areg_05 = 0x0a;
nicam_flag = 1;
break;
+ default:
+ /* do nothink */
+ break;
}
#if 0
@@ -1156,8 +1161,6 @@ int tm6000_set_standard(struct tm6000_core *dev, v4l2_std_id * norm)
rc = tm6000_load_std(dev, svideo_stds[i].common,
sizeof(svideo_stds[i].
common));
- tm6000_set_audio_std(dev, svideo_stds[i].audio_default_std);
-
goto ret;
}
}
diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c
index eb9b9f1bc138..17db6684abbe 100644
--- a/drivers/staging/tm6000/tm6000-video.c
+++ b/drivers/staging/tm6000/tm6000-video.c
@@ -53,11 +53,17 @@
/* Declare static vars that will be used as parameters */
static unsigned int vid_limit = 16; /* Video memory limit, in Mb */
static int video_nr = -1; /* /dev/videoN, -1 for autodetect */
+static int radio_nr = -1; /* /dev/radioN, -1 for autodetect */
/* Debug level */
int tm6000_debug;
EXPORT_SYMBOL_GPL(tm6000_debug);
+static const struct v4l2_queryctrl no_ctrl = {
+ .name = "42",
+ .flags = V4L2_CTRL_FLAG_DISABLED,
+};
+
/* supported controls */
static struct v4l2_queryctrl tm6000_qctrl[] = {
{
@@ -96,9 +102,26 @@ static struct v4l2_queryctrl tm6000_qctrl[] = {
.step = 0x1,
.default_value = 0,
.flags = 0,
+ },
+ /* --- audio --- */
+ {
+ .id = V4L2_CID_AUDIO_MUTE,
+ .name = "Mute",
+ .minimum = 0,
+ .maximum = 1,
+ .type = V4L2_CTRL_TYPE_BOOLEAN,
+ }, {
+ .id = V4L2_CID_AUDIO_VOLUME,
+ .name = "Volume",
+ .minimum = -15,
+ .maximum = 15,
+ .step = 1,
+ .default_value = 0,
+ .type = V4L2_CTRL_TYPE_INTEGER,
}
};
+static const unsigned int CTRLS = ARRAY_SIZE(tm6000_qctrl);
static int qctl_regs[ARRAY_SIZE(tm6000_qctrl)];
static struct tm6000_fmt format[] = {
@@ -117,6 +140,16 @@ static struct tm6000_fmt format[] = {
}
};
+static const struct v4l2_queryctrl *ctrl_by_id(unsigned int id)
+{
+ unsigned int i;
+
+ for (i = 0; i < CTRLS; i++)
+ if (tm6000_qctrl[i].id == id)
+ return tm6000_qctrl+i;
+ return NULL;
+}
+
/* ------------------------------------------------------------------
* DMA and thread functions
* ------------------------------------------------------------------
@@ -149,7 +182,7 @@ static inline void get_next_buf(struct tm6000_dmaqueue *dma_q,
if (!buf)
return;
- /* Cleans up buffer - Usefull for testing for frame/URB loss */
+ /* Cleans up buffer - Useful for testing for frame/URB loss */
outp = videobuf_to_vmalloc(&(*buf)->vb);
return;
@@ -199,13 +232,17 @@ static int copy_streams(u8 *data, unsigned long len,
char *voutp = NULL;
unsigned int linewidth;
- /* get video buffer */
- get_next_buf(dma_q, &vbuf);
- if (!vbuf)
- return rc;
- voutp = videobuf_to_vmalloc(&vbuf->vb);
- if (!voutp)
- return 0;
+ if (!dev->radio) {
+ /* get video buffer */
+ get_next_buf(dma_q, &vbuf);
+
+ if (!vbuf)
+ return rc;
+ voutp = videobuf_to_vmalloc(&vbuf->vb);
+
+ if (!voutp)
+ return 0;
+ }
for (ptr = data; ptr < endp;) {
if (!dev->isoc_ctl.cmd) {
@@ -257,29 +294,31 @@ static int copy_streams(u8 *data, unsigned long len,
*/
switch (cmd) {
case TM6000_URB_MSG_VIDEO:
- if ((dev->isoc_ctl.vfield != field) &&
- (field == 1)) {
+ if (!dev->radio) {
+ if ((dev->isoc_ctl.vfield != field) &&
+ (field == 1)) {
/* Announces that a new buffer
* were filled
*/
- buffer_filled(dev, dma_q, vbuf);
- dprintk(dev, V4L2_DEBUG_ISOC,
+ buffer_filled(dev, dma_q, vbuf);
+ dprintk(dev, V4L2_DEBUG_ISOC,
"new buffer filled\n");
- get_next_buf(dma_q, &vbuf);
- if (!vbuf)
- return rc;
- voutp = videobuf_to_vmalloc(&vbuf->vb);
- if (!voutp)
- return rc;
- memset(voutp, 0, vbuf->vb.size);
- }
- linewidth = vbuf->vb.width << 1;
- pos = ((line << 1) - field - 1) * linewidth +
- block * TM6000_URB_MSG_LEN;
- /* Don't allow to write out of the buffer */
- if (pos + size > vbuf->vb.size)
- cmd = TM6000_URB_MSG_ERR;
- dev->isoc_ctl.vfield = field;
+ get_next_buf(dma_q, &vbuf);
+ if (!vbuf)
+ return rc;
+ voutp = videobuf_to_vmalloc(&vbuf->vb);
+ if (!voutp)
+ return rc;
+ memset(voutp, 0, vbuf->vb.size);
+ }
+ linewidth = vbuf->vb.width << 1;
+ pos = ((line << 1) - field - 1) *
+ linewidth + block * TM6000_URB_MSG_LEN;
+ /* Don't allow to write out of the buffer */
+ if (pos + size > vbuf->vb.size)
+ cmd = TM6000_URB_MSG_ERR;
+ dev->isoc_ctl.vfield = field;
+ }
break;
case TM6000_URB_MSG_VBI:
break;
@@ -537,7 +576,7 @@ static void tm6000_uninit_isoc(struct tm6000_core *dev)
/*
* Allocate URBs and start IRQ
*/
-static int tm6000_prepare_isoc(struct tm6000_core *dev, unsigned int framesize)
+static int tm6000_prepare_isoc(struct tm6000_core *dev)
{
struct tm6000_dmaqueue *dma_q = &dev->vidq;
int i, j, sb_size, pipe, size, max_packets, num_bufs = 8;
@@ -566,11 +605,7 @@ static int tm6000_prepare_isoc(struct tm6000_core *dev, unsigned int framesize)
dev->isoc_ctl.max_pkt_size = size;
- max_packets = (framesize + size - 1) / size;
-
- if (max_packets > TM6000_MAX_ISO_PACKETS)
- max_packets = TM6000_MAX_ISO_PACKETS;
-
+ max_packets = TM6000_MAX_ISO_PACKETS;
sb_size = max_packets * size;
dev->isoc_ctl.num_bufs = num_bufs;
@@ -746,7 +781,7 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb,
urb_init = 1;
if (urb_init) {
- rc = tm6000_prepare_isoc(dev, buf->vb.size);
+ rc = tm6000_prepare_isoc(dev);
if (rc < 0)
goto fail;
@@ -1045,18 +1080,27 @@ static int vidioc_s_std (struct file *file, void *priv, v4l2_std_id *norm)
static int vidioc_enum_input(struct file *file, void *priv,
struct v4l2_input *inp)
{
+ struct tm6000_fh *fh = priv;
+ struct tm6000_core *dev = fh->dev;
+
switch (inp->index) {
case TM6000_INPUT_TV:
inp->type = V4L2_INPUT_TYPE_TUNER;
strcpy(inp->name, "Television");
break;
case TM6000_INPUT_COMPOSITE:
- inp->type = V4L2_INPUT_TYPE_CAMERA;
- strcpy(inp->name, "Composite");
+ if (dev->caps.has_input_comp) {
+ inp->type = V4L2_INPUT_TYPE_CAMERA;
+ strcpy(inp->name, "Composite");
+ } else
+ return -EINVAL;
break;
case TM6000_INPUT_SVIDEO:
- inp->type = V4L2_INPUT_TYPE_CAMERA;
- strcpy(inp->name, "S-Video");
+ if (dev->caps.has_input_svid) {
+ inp->type = V4L2_INPUT_TYPE_CAMERA;
+ strcpy(inp->name, "S-Video");
+ } else
+ return -EINVAL;
break;
default:
return -EINVAL;
@@ -1143,6 +1187,12 @@ static int vidioc_g_ctrl(struct file *file, void *priv,
case V4L2_CID_HUE:
val = tm6000_get_reg(dev, TM6010_REQ07_R0B_CHROMA_HUE_PHASE_ADJ, 0);
return 0;
+ case V4L2_CID_AUDIO_MUTE:
+ val = dev->ctl_mute;
+ return 0;
+ case V4L2_CID_AUDIO_VOLUME:
+ val = dev->ctl_volume;
+ return 0;
default:
return -EINVAL;
}
@@ -1174,6 +1224,14 @@ static int vidioc_s_ctrl(struct file *file, void *priv,
case V4L2_CID_HUE:
tm6000_set_reg(dev, TM6010_REQ07_R0B_CHROMA_HUE_PHASE_ADJ, val);
return 0;
+ case V4L2_CID_AUDIO_MUTE:
+ dev->ctl_mute = val;
+ tm6000_tvaudio_set_mute(dev, val);
+ return 0;
+ case V4L2_CID_AUDIO_VOLUME:
+ dev->ctl_volume = val;
+ tm6000_set_volume(dev, val);
+ return 0;
}
return -EINVAL;
}
@@ -1221,7 +1279,7 @@ static int vidioc_g_frequency(struct file *file, void *priv,
if (unlikely(UNSET == dev->tuner_type))
return -EINVAL;
- f->type = V4L2_TUNER_ANALOG_TV;
+ f->type = fh->radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
f->frequency = dev->freq;
v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, g_frequency, f);
@@ -1235,13 +1293,14 @@ static int vidioc_s_frequency(struct file *file, void *priv,
struct tm6000_fh *fh = priv;
struct tm6000_core *dev = fh->dev;
- if (unlikely(f->type != V4L2_TUNER_ANALOG_TV))
- return -EINVAL;
-
if (unlikely(UNSET == dev->tuner_type))
return -EINVAL;
if (unlikely(f->tuner != 0))
return -EINVAL;
+ if (0 == fh->radio && V4L2_TUNER_ANALOG_TV != f->type)
+ return -EINVAL;
+ if (1 == fh->radio && V4L2_TUNER_RADIO != f->type)
+ return -EINVAL;
dev->freq = f->frequency;
v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, f);
@@ -1249,6 +1308,122 @@ static int vidioc_s_frequency(struct file *file, void *priv,
return 0;
}
+static int radio_querycap(struct file *file, void *priv,
+ struct v4l2_capability *cap)
+{
+ struct tm6000_fh *fh = file->private_data;
+ struct tm6000_core *dev = fh->dev;
+
+ strcpy(cap->driver, "tm6000");
+ strlcpy(cap->card, dev->name, sizeof(dev->name));
+ sprintf(cap->bus_info, "USB%04x:%04x",
+ le16_to_cpu(dev->udev->descriptor.idVendor),
+ le16_to_cpu(dev->udev->descriptor.idProduct));
+ cap->version = dev->dev_type;
+ cap->capabilities = V4L2_CAP_TUNER;
+
+ return 0;
+}
+
+static int radio_g_tuner(struct file *file, void *priv,
+ struct v4l2_tuner *t)
+{
+ struct tm6000_fh *fh = file->private_data;
+ struct tm6000_core *dev = fh->dev;
+
+ if (0 != t->index)
+ return -EINVAL;
+
+ memset(t, 0, sizeof(*t));
+ strcpy(t->name, "Radio");
+ t->type = V4L2_TUNER_RADIO;
+
+ v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, g_tuner, t);
+
+ if ((dev->aradio == TM6000_AIP_LINE1) ||
+ (dev->aradio == TM6000_AIP_LINE2)) {
+ t->rxsubchans = V4L2_TUNER_SUB_MONO;
+ }
+ else {
+ t->rxsubchans = V4L2_TUNER_SUB_STEREO;
+ }
+
+ return 0;
+}
+
+static int radio_s_tuner(struct file *file, void *priv,
+ struct v4l2_tuner *t)
+{
+ struct tm6000_fh *fh = file->private_data;
+ struct tm6000_core *dev = fh->dev;
+
+ if (0 != t->index)
+ return -EINVAL;
+
+ v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_tuner, t);
+
+ return 0;
+}
+
+static int radio_enum_input(struct file *file, void *priv,
+ struct v4l2_input *i)
+{
+ if (i->index != 0)
+ return -EINVAL;
+
+ strcpy(i->name, "Radio");
+ i->type = V4L2_INPUT_TYPE_TUNER;
+
+ return 0;
+}
+
+static int radio_g_input(struct file *filp, void *priv, unsigned int *i)
+{
+ *i = 0;
+ return 0;
+}
+
+static int radio_g_audio(struct file *file, void *priv,
+ struct v4l2_audio *a)
+{
+ memset(a, 0, sizeof(*a));
+ strcpy(a->name, "Radio");
+ return 0;
+}
+
+static int radio_s_audio(struct file *file, void *priv,
+ struct v4l2_audio *a)
+{
+ return 0;
+}
+
+static int radio_s_input(struct file *filp, void *priv, unsigned int i)
+{
+ return 0;
+}
+
+static int radio_s_std(struct file *file, void *fh, v4l2_std_id *norm)
+{
+ return 0;
+}
+
+static int radio_queryctrl(struct file *file, void *priv,
+ struct v4l2_queryctrl *c)
+{
+ const struct v4l2_queryctrl *ctrl;
+
+ if (c->id < V4L2_CID_BASE ||
+ c->id >= V4L2_CID_LASTP1)
+ return -EINVAL;
+ if (c->id == V4L2_CID_AUDIO_MUTE) {
+ ctrl = ctrl_by_id(c->id);
+ *c = *ctrl;
+ } else
+ *c = no_ctrl;
+
+ return 0;
+}
+
/* ------------------------------------------------------------------
File operations for the device
------------------------------------------------------------------*/
@@ -1260,6 +1435,7 @@ static int tm6000_open(struct file *file)
struct tm6000_fh *fh;
enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
int i, rc;
+ int radio = 0;
printk(KERN_INFO "tm6000: open called (dev=%s)\n",
video_device_node_name(vdev));
@@ -1267,6 +1443,17 @@ static int tm6000_open(struct file *file)
dprintk(dev, V4L2_DEBUG_OPEN, "tm6000: open called (dev=%s)\n",
video_device_node_name(vdev));
+ switch (vdev->vfl_type) {
+ case VFL_TYPE_GRABBER:
+ type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+ break;
+ case VFL_TYPE_VBI:
+ type = V4L2_BUF_TYPE_VBI_CAPTURE;
+ break;
+ case VFL_TYPE_RADIO:
+ radio = 1;
+ break;
+ }
/* If more than one user, mutex should be added */
dev->users++;
@@ -1284,8 +1471,9 @@ static int tm6000_open(struct file *file)
file->private_data = fh;
fh->dev = dev;
-
- fh->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+ fh->radio = radio;
+ dev->radio = radio;
+ fh->type = type;
dev->fourcc = format[0].fourcc;
fh->fmt = format_by_fourcc(dev->fourcc);
@@ -1322,6 +1510,19 @@ static int tm6000_open(struct file *file)
V4L2_FIELD_INTERLACED,
sizeof(struct tm6000_buffer), fh, &dev->lock);
+ if (fh->radio) {
+ dprintk(dev, V4L2_DEBUG_OPEN, "video_open: setting radio device\n");
+ tm6000_set_audio_input(dev, dev->aradio);
+ tm6000_set_volume(dev, dev->ctl_volume);
+ v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_radio);
+ tm6000_prepare_isoc(dev);
+ tm6000_start_thread(dev);
+ }
+ else {
+ tm6000_set_audio_input(dev, dev->avideo);
+ tm6000_set_volume(dev, dev->ctl_volume);
+ }
+
return 0;
}
@@ -1445,6 +1646,36 @@ static struct video_device tm6000_template = {
.current_norm = V4L2_STD_NTSC_M,
};
+static const struct v4l2_file_operations radio_fops = {
+ .owner = THIS_MODULE,
+ .open = tm6000_open,
+ .release = tm6000_release,
+ .ioctl = video_ioctl2,
+};
+
+static const struct v4l2_ioctl_ops radio_ioctl_ops = {
+ .vidioc_querycap = radio_querycap,
+ .vidioc_g_tuner = radio_g_tuner,
+ .vidioc_enum_input = radio_enum_input,
+ .vidioc_g_audio = radio_g_audio,
+ .vidioc_s_tuner = radio_s_tuner,
+ .vidioc_s_audio = radio_s_audio,
+ .vidioc_s_input = radio_s_input,
+ .vidioc_s_std = radio_s_std,
+ .vidioc_queryctrl = radio_queryctrl,
+ .vidioc_g_input = radio_g_input,
+ .vidioc_g_ctrl = vidioc_g_ctrl,
+ .vidioc_s_ctrl = vidioc_s_ctrl,
+ .vidioc_g_frequency = vidioc_g_frequency,
+ .vidioc_s_frequency = vidioc_s_frequency,
+};
+
+struct video_device tm6000_radio_template = {
+ .name = "tm6000",
+ .fops = &radio_fops,
+ .ioctl_ops = &radio_ioctl_ops,
+};
+
/* -----------------------------------------------------------------
* Initialization and module stuff
* ------------------------------------------------------------------
@@ -1499,6 +1730,25 @@ int tm6000_v4l2_register(struct tm6000_core *dev)
printk(KERN_INFO "%s: registered device %s\n",
dev->name, video_device_node_name(dev->vfd));
+ dev->radio_dev = vdev_init(dev, &tm6000_radio_template,
+ "radio");
+ if (!dev->radio_dev) {
+ printk(KERN_INFO "%s: can't register radio device\n",
+ dev->name);
+ return ret; /* FIXME release resource */
+ }
+
+ ret = video_register_device(dev->radio_dev, VFL_TYPE_RADIO,
+ radio_nr);
+ if (ret < 0) {
+ printk(KERN_INFO "%s: can't register radio device\n",
+ dev->name);
+ return ret; /* FIXME release resource */
+ }
+
+ printk(KERN_INFO "%s: registered device %s\n",
+ dev->name, video_device_node_name(dev->radio_dev));
+
printk(KERN_INFO "Trident TVMaster TM5600/TM6000/TM6010 USB2 board (Load status: %d)\n", ret);
return ret;
}
@@ -1507,6 +1757,14 @@ int tm6000_v4l2_unregister(struct tm6000_core *dev)
{
video_unregister_device(dev->vfd);
+ if (dev->radio_dev) {
+ if (video_is_registered(dev->radio_dev))
+ video_unregister_device(dev->radio_dev);
+ else
+ video_device_release(dev->radio_dev);
+ dev->radio_dev = NULL;
+ }
+
return 0;
}
diff --git a/drivers/staging/tm6000/tm6000.h b/drivers/staging/tm6000/tm6000.h
index bf11eeec92c7..99ae50e82b28 100644
--- a/drivers/staging/tm6000/tm6000.h
+++ b/drivers/staging/tm6000/tm6000.h
@@ -53,6 +53,14 @@ enum tm6000_devtype {
TM6010,
};
+enum tm6000_inaudio {
+ TM6000_AIP_UNK = 0,
+ TM6000_AIP_SIF1,
+ TM6000_AIP_SIF2,
+ TM6000_AIP_LINE1,
+ TM6000_AIP_LINE2,
+};
+
/* ------------------------------------------------------------------
* Basic structures
* ------------------------------------------------------------------
@@ -121,6 +129,8 @@ struct tm6000_capabilities {
unsigned int has_zl10353:1;
unsigned int has_eeprom:1;
unsigned int has_remote:1;
+ unsigned int has_input_comp:1;
+ unsigned int has_input_svid:1;
};
struct tm6000_dvb {
@@ -174,6 +184,8 @@ struct tm6000_core {
char *ir_codes;
+ __u8 radio;
+
/* Demodulator configuration */
int demod_addr; /* demodulator address */
@@ -194,6 +206,7 @@ struct tm6000_core {
bool is_res_read;
struct video_device *vfd;
+ struct video_device *radio_dev;
struct tm6000_dmaqueue vidq;
struct v4l2_device v4l2_dev;
@@ -203,6 +216,9 @@ struct tm6000_core {
enum tm6000_mode mode;
+ int ctl_mute; /* audio */
+ int ctl_volume;
+
/* DVB-T support */
struct tm6000_dvb *dvb;
@@ -210,7 +226,8 @@ struct tm6000_core {
struct snd_tm6000_card *adev;
struct work_struct wq_trigger; /* Trigger to start/stop audio for alsa module */
atomic_t stream_started; /* stream should be running if true */
-
+ enum tm6000_inaudio avideo;
+ enum tm6000_inaudio aradio;
struct tm6000_IR *ir;
@@ -248,6 +265,7 @@ struct tm6000_ops {
struct tm6000_fh {
struct tm6000_core *dev;
+ unsigned int radio;
/* video capture */
struct tm6000_fmt *fmt;
@@ -276,12 +294,17 @@ int tm6000_get_reg(struct tm6000_core *dev, u8 req, u16 value, u16 index);
int tm6000_get_reg16(struct tm6000_core *dev, u8 req, u16 value, u16 index);
int tm6000_get_reg32(struct tm6000_core *dev, u8 req, u16 value, u16 index);
int tm6000_set_reg(struct tm6000_core *dev, u8 req, u16 value, u16 index);
+int tm6000_set_reg_mask(struct tm6000_core *dev, u8 req, u16 value,
+ u16 index, u16 mask);
int tm6000_i2c_reset(struct tm6000_core *dev, u16 tsleep);
int tm6000_init(struct tm6000_core *dev);
int tm6000_init_analog_mode(struct tm6000_core *dev);
int tm6000_init_digital_mode(struct tm6000_core *dev);
int tm6000_set_audio_bitrate(struct tm6000_core *dev, int bitrate);
+int tm6000_set_audio_input(struct tm6000_core *dev, enum tm6000_inaudio ainp);
+int tm6000_tvaudio_set_mute(struct tm6000_core *dev, u8 mute);
+void tm6000_set_volume(struct tm6000_core *dev, int vol);
int tm6000_v4l2_register(struct tm6000_core *dev);
int tm6000_v4l2_unregister(struct tm6000_core *dev);
diff --git a/drivers/staging/tty/cd1865.h b/drivers/staging/tty/cd1865.h
index 9940966e7a1d..8c2ad654b79d 100644
--- a/drivers/staging/tty/cd1865.h
+++ b/drivers/staging/tty/cd1865.h
@@ -9,7 +9,7 @@
* Please DO contact io8-linux@specialix.co.uk if you require
* support.
*
- * This driver was developped in the BitWizard linux device
+ * This driver was developed in the BitWizard linux device
* driver service. If you require a linux device driver for your
* product, please contact devices@BitWizard.nl for a quote.
*
diff --git a/drivers/staging/tty/epca.c b/drivers/staging/tty/epca.c
index 7ad3638967ae..7f1369e5b418 100644
--- a/drivers/staging/tty/epca.c
+++ b/drivers/staging/tty/epca.c
@@ -7,7 +7,7 @@
** This driver is no longer supported by Digi **
Much of this design and code came from epca.c which was
- copyright (C) 1994, 1995 Troy De Jongh, and subsquently
+ copyright (C) 1994, 1995 Troy De Jongh, and subsequently
modified by David Nugent, Christoph Lameter, Mike McLagan.
This program is free software; you can redistribute it and/or modify
@@ -471,7 +471,7 @@ static void shutdown(struct channel *ch, struct tty_struct *tty)
memoff(ch);
/*
- * The channel has officialy been closed. The next time it is opened it
+ * The channel has officially been closed. The next time it is opened it
* will have to reinitialized. Set a flag to indicate this.
*/
/* Prevent future Digi programmed interrupts from coming active */
@@ -975,7 +975,7 @@ static int __init pc_init(void)
/*
* Note : If lilo was used to configure the driver and the ignore
- * epcaconfig option was choosen (digiepca=2) then nbdevs and num_cards
+ * epcaconfig option was chosen (digiepca=2) then nbdevs and num_cards
* will equal 0 at this point. This is okay; PCI cards will still be
* picked up if detected.
*/
@@ -1230,14 +1230,14 @@ static void post_fep_init(unsigned int crd)
memaddr = bd->re_map_membase;
/*
- * The below assignment will set bc to point at the BEGINING of the
+ * The below assignment will set bc to point at the BEGINNING of the
* cards channel structures. For 1 card there will be between 8 and 64
* of these structures.
*/
bc = memaddr + CHANSTRUCT;
/*
- * The below assignment will set gd to point at the BEGINING of global
+ * The below assignment will set gd to point at the BEGINNING of global
* memory address 0xc00. The first data in that global memory actually
* starts at address 0xc1a. The command in pointer begins at 0xd10.
*/
@@ -1492,7 +1492,7 @@ static void doevent(int crd)
/*
* The two assignments below get the current modem status
* (mstat) and the previous modem status (lstat). These are
- * useful becuase an event could signal a change in modem
+ * useful because an event could signal a change in modem
* signals itself.
*/
mstat = readb(eventbuf + 2);
@@ -1897,7 +1897,7 @@ static void receive_data(struct channel *ch, struct tty_struct *tty)
/*
* Even if head has wrapped around only report the amount of
* data to be equal to the size - tail. Remember memcpy can't
- * automaticly wrap around the receive buffer.
+ * automatically wrap around the receive buffer.
*/
dataToRead = (wrapgap < bytesAvailable) ? wrapgap
: bytesAvailable;
@@ -2543,7 +2543,7 @@ static void __init epca_setup(char *str, int *ints)
break;
/*
* If the index incremented above refers to a
- * legitamate board type set it here.
+ * legitimate board type set it here.
*/
if (index < EPCA_NUM_TYPES)
board.type = loop;
diff --git a/drivers/staging/tty/ip2/i2hw.h b/drivers/staging/tty/ip2/i2hw.h
index c0ba6c05f0cd..8df2f487217a 100644
--- a/drivers/staging/tty/ip2/i2hw.h
+++ b/drivers/staging/tty/ip2/i2hw.h
@@ -335,7 +335,7 @@ be off by a factor of five. The important point is that the first command reset
in fact generates a reset pulse on the board. This pulse is guaranteed to last
less than 10 milliseconds. The additional delay ensures the 1400 has had the
chance to respond sufficiently to the first reset. Why not a longer delay? Much
-more than 50 milliseconds gets to be noticable, but the board would still work.
+more than 50 milliseconds gets to be noticeable, but the board would still work.
Once all 16 bytes of the Power-on Reset Message have been read, the bootstrap
firmware is ready to receive loadware.
@@ -399,7 +399,7 @@ typedef union _porStr // "por" stands for Power On Reset
// expandable products must report a MAP of available channels. Since
// each UART supports four ports, we represent each UART found by a
// single bit. Using two bytes to supply the mapping information we
- // report the presense or absense of up to 16 UARTS, or 64 ports in
+ // report the presence or absence of up to 16 UARTS, or 64 ports in
// steps of 4 ports. For -IIEX products, the ports are numbered
// starting at the box closest to the controller in the "chain".
diff --git a/drivers/staging/tty/ip2/i2lib.c b/drivers/staging/tty/ip2/i2lib.c
index 0d10b89218ed..13a3caba85f2 100644
--- a/drivers/staging/tty/ip2/i2lib.c
+++ b/drivers/staging/tty/ip2/i2lib.c
@@ -821,7 +821,7 @@ i2GetStatus(i2ChanStrPtr pCh, int resetBits)
//
// Description:
// Strips data from the input buffer and writes it to pDest. If there is a
-// collosal blunder, (invalid structure pointers or the like), returns -1.
+// colossal blunder, (invalid structure pointers or the like), returns -1.
// Otherwise, returns the number of bytes read.
//******************************************************************************
static int
@@ -909,7 +909,7 @@ i2Input_exit:
// Returns: Number of bytes stripped, or -1 for error
//
// Description:
-// Strips any data from the input buffer. If there is a collosal blunder,
+// Strips any data from the input buffer. If there is a colossal blunder,
// (invalid structure pointers or the like), returns -1. Otherwise, returns the
// number of bytes stripped.
//******************************************************************************
@@ -963,7 +963,7 @@ i2InputFlush(i2ChanStrPtr pCh)
// Returns: Number of bytes available, or -1 for error
//
// Description:
-// If there is a collosal blunder, (invalid structure pointers or the like),
+// If there is a colossal blunder, (invalid structure pointers or the like),
// returns -1. Otherwise, returns the number of bytes stripped. Otherwise,
// returns the number of bytes available in the buffer.
//******************************************************************************
@@ -1001,7 +1001,7 @@ i2InputAvailable(i2ChanStrPtr pCh)
//
// Description:
// Queues the data at pSource to be sent as data packets to the board. If there
-// is a collosal blunder, (invalid structure pointers or the like), returns -1.
+// is a colossal blunder, (invalid structure pointers or the like), returns -1.
// Otherwise, returns the number of bytes written. What if there is not enough
// room for all the data? If pCh->channelOptions & CO_NBLOCK_WRITE is set, then
// we transfer as many characters as we can now, then return. If this bit is
diff --git a/drivers/staging/tty/ip2/ip2main.c b/drivers/staging/tty/ip2/ip2main.c
index ea7a8fb08283..ba074fbb4ce2 100644
--- a/drivers/staging/tty/ip2/ip2main.c
+++ b/drivers/staging/tty/ip2/ip2main.c
@@ -1824,7 +1824,7 @@ ip2_flush_chars( PTTY tty )
// ip2trace (CHANN, ITRC_PUTC, 10, 1, strip );
//
- // We may need to restart i2Output if it does not fullfill this request
+ // We may need to restart i2Output if it does not fulfill this request
//
strip = i2Output( pCh, pCh->Pbuf, pCh->Pbuf_stuff);
if ( strip != pCh->Pbuf_stuff ) {
diff --git a/drivers/staging/tty/specialix.c b/drivers/staging/tty/specialix.c
index 47e5753f732a..5c3598ec7456 100644
--- a/drivers/staging/tty/specialix.c
+++ b/drivers/staging/tty/specialix.c
@@ -9,7 +9,7 @@
* support. But please read the documentation (specialix.txt)
* first.
*
- * This driver was developped in the BitWizard linux device
+ * This driver was developed in the BitWizard linux device
* driver service. If you require a linux device driver for your
* product, please contact devices@BitWizard.nl for a quote.
*
@@ -978,7 +978,7 @@ static void sx_change_speed(struct specialix_board *bp,
spin_lock_irqsave(&bp->lock, flags);
sx_out(bp, CD186x_CAR, port_No(port));
- /* The Specialix board doens't implement the RTS lines.
+ /* The Specialix board doesn't implement the RTS lines.
They are used to set the IRQ level. Don't touch them. */
if (sx_crtscts(tty))
port->MSVR = MSVR_DTR | (sx_in(bp, CD186x_MSVR) & MSVR_RTS);
@@ -1416,7 +1416,7 @@ static int sx_open(struct tty_struct *tty, struct file *filp)
board, bp, port, SX_PORT(tty->index));
if (sx_paranoia_check(port, tty->name, "sx_open")) {
- func_enter();
+ func_exit();
return -ENODEV;
}
@@ -1435,13 +1435,13 @@ static int sx_open(struct tty_struct *tty, struct file *filp)
error = sx_setup_port(bp, port);
if (error) {
- func_enter();
+ func_exit();
return error;
}
error = block_til_ready(tty, filp, port);
if (error) {
- func_enter();
+ func_exit();
return error;
}
@@ -1860,7 +1860,7 @@ static int sx_set_serial_info(struct specialix_port *port,
func_enter();
if (copy_from_user(&tmp, newinfo, sizeof(tmp))) {
- func_enter();
+ func_exit();
return -EFAULT;
}
diff --git a/drivers/staging/tty/specialix_io8.h b/drivers/staging/tty/specialix_io8.h
index c63005274d9b..1215d7e2cb37 100644
--- a/drivers/staging/tty/specialix_io8.h
+++ b/drivers/staging/tty/specialix_io8.h
@@ -10,7 +10,7 @@
* Please DO contact io8-linux@specialix.co.uk if you require
* support.
*
- * This driver was developped in the BitWizard linux device
+ * This driver was developed in the BitWizard linux device
* driver service. If you require a linux device driver for your
* product, please contact devices@BitWizard.nl for a quote.
*
@@ -79,7 +79,7 @@ more than a few PCI versions of the card. */
#define SPECIALIX_MAGIC 0x0907
-#define SX_CCR_TIMEOUT 10000 /* CCR timeout. You may need to wait upto
+#define SX_CCR_TIMEOUT 10000 /* CCR timeout. You may need to wait up to
10 milliseconds before the internal
processor is available again after
you give it a command */
diff --git a/drivers/staging/usbip/stub_dev.c b/drivers/staging/usbip/stub_dev.c
index 8214c353d9f5..bce7d039346c 100644
--- a/drivers/staging/usbip/stub_dev.c
+++ b/drivers/staging/usbip/stub_dev.c
@@ -220,8 +220,10 @@ static void stub_shutdown_connection(struct usbip_device *ud)
}
/* 1. stop threads */
- kthread_stop(ud->tcp_rx);
- kthread_stop(ud->tcp_tx);
+ if (ud->tcp_rx && !task_is_dead(ud->tcp_rx))
+ kthread_stop(ud->tcp_rx);
+ if (ud->tcp_tx && !task_is_dead(ud->tcp_tx))
+ kthread_stop(ud->tcp_tx);
/* 2. close the socket */
/*
diff --git a/drivers/staging/usbip/stub_rx.c b/drivers/staging/usbip/stub_rx.c
index 6445f12cb4fd..51fbd0986475 100644
--- a/drivers/staging/usbip/stub_rx.c
+++ b/drivers/staging/usbip/stub_rx.c
@@ -171,33 +171,23 @@ static int tweak_set_configuration_cmd(struct urb *urb)
static int tweak_reset_device_cmd(struct urb *urb)
{
- struct usb_ctrlrequest *req;
- __u16 value;
- __u16 index;
- int ret;
-
- req = (struct usb_ctrlrequest *) urb->setup_packet;
- value = le16_to_cpu(req->wValue);
- index = le16_to_cpu(req->wIndex);
-
- usbip_uinfo("reset_device (port %d) to %s\n", index,
- dev_name(&urb->dev->dev));
+ struct stub_priv *priv = (struct stub_priv *) urb->context;
+ struct stub_device *sdev = priv->sdev;
- /* all interfaces should be owned by usbip driver, so just reset it. */
- ret = usb_lock_device_for_reset(urb->dev, NULL);
- if (ret < 0) {
- dev_err(&urb->dev->dev, "lock for reset\n");
- return ret;
- }
-
- /* try to reset the device */
- ret = usb_reset_device(urb->dev);
- if (ret < 0)
- dev_err(&urb->dev->dev, "device reset\n");
+ usbip_uinfo("reset_device %s\n", dev_name(&urb->dev->dev));
- usb_unlock_device(urb->dev);
-
- return ret;
+ /*
+ * usb_lock_device_for_reset caused a deadlock: it causes the driver
+ * to unbind. In the shutdown the rx thread is signalled to shut down
+ * but this thread is pending in the usb_lock_device_for_reset.
+ *
+ * Instead queue the reset.
+ *
+ * Unfortunatly an existing usbip connection will be dropped due to
+ * driver unbinding.
+ */
+ usb_queue_reset_device(sdev->interface);
+ return 0;
}
/*
diff --git a/drivers/staging/usbip/stub_tx.c b/drivers/staging/usbip/stub_tx.c
index 5523f25998e6..64a52b26dcf6 100644
--- a/drivers/staging/usbip/stub_tx.c
+++ b/drivers/staging/usbip/stub_tx.c
@@ -170,7 +170,6 @@ static int stub_send_ret_submit(struct stub_device *sdev)
struct stub_priv *priv, *tmp;
struct msghdr msg;
- struct kvec iov[3];
size_t txsize;
size_t total_size = 0;
@@ -180,28 +179,73 @@ static int stub_send_ret_submit(struct stub_device *sdev)
struct urb *urb = priv->urb;
struct usbip_header pdu_header;
void *iso_buffer = NULL;
+ struct kvec *iov = NULL;
+ int iovnum = 0;
txsize = 0;
memset(&pdu_header, 0, sizeof(pdu_header));
memset(&msg, 0, sizeof(msg));
- memset(&iov, 0, sizeof(iov));
- usbip_dbg_stub_tx("setup txdata urb %p\n", urb);
+ if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS)
+ iovnum = 2 + urb->number_of_packets;
+ else
+ iovnum = 2;
+
+ iov = kzalloc(iovnum * sizeof(struct kvec), GFP_KERNEL);
+ if (!iov) {
+ usbip_event_add(&sdev->ud, SDEV_EVENT_ERROR_MALLOC);
+ return -1;
+ }
+
+ iovnum = 0;
/* 1. setup usbip_header */
setup_ret_submit_pdu(&pdu_header, urb);
+ usbip_dbg_stub_tx("setup txdata seqnum: %d urb: %p\n",
+ pdu_header.base.seqnum, urb);
+ /*usbip_dump_header(pdu_header);*/
usbip_header_correct_endian(&pdu_header, 1);
- iov[0].iov_base = &pdu_header;
- iov[0].iov_len = sizeof(pdu_header);
+ iov[iovnum].iov_base = &pdu_header;
+ iov[iovnum].iov_len = sizeof(pdu_header);
+ iovnum++;
txsize += sizeof(pdu_header);
/* 2. setup transfer buffer */
- if (usb_pipein(urb->pipe) && urb->actual_length > 0) {
- iov[1].iov_base = urb->transfer_buffer;
- iov[1].iov_len = urb->actual_length;
+ if (usb_pipein(urb->pipe) &&
+ usb_pipetype(urb->pipe) != PIPE_ISOCHRONOUS &&
+ urb->actual_length > 0) {
+ iov[iovnum].iov_base = urb->transfer_buffer;
+ iov[iovnum].iov_len = urb->actual_length;
+ iovnum++;
txsize += urb->actual_length;
+ } else if (usb_pipein(urb->pipe) &&
+ usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) {
+ /*
+ * For isochronous packets: actual length is the sum of
+ * the actual length of the individual, packets, but as
+ * the packet offsets are not changed there will be
+ * padding between the packets. To optimally use the
+ * bandwidth the padding is not transmitted.
+ */
+
+ int i;
+ for (i = 0; i < urb->number_of_packets; i++) {
+ iov[iovnum].iov_base = urb->transfer_buffer + urb->iso_frame_desc[i].offset;
+ iov[iovnum].iov_len = urb->iso_frame_desc[i].actual_length;
+ iovnum++;
+ txsize += urb->iso_frame_desc[i].actual_length;
+ }
+
+ if (txsize != sizeof(pdu_header) + urb->actual_length) {
+ dev_err(&sdev->interface->dev,
+ "actual length of urb (%d) does not match iso packet sizes (%d)\n",
+ urb->actual_length, txsize-sizeof(pdu_header));
+ kfree(iov);
+ usbip_event_add(&sdev->ud, SDEV_EVENT_ERROR_TCP);
+ return -1;
+ }
}
/* 3. setup iso_packet_descriptor */
@@ -212,32 +256,34 @@ static int stub_send_ret_submit(struct stub_device *sdev)
if (!iso_buffer) {
usbip_event_add(&sdev->ud,
SDEV_EVENT_ERROR_MALLOC);
+ kfree(iov);
return -1;
}
- iov[2].iov_base = iso_buffer;
- iov[2].iov_len = len;
+ iov[iovnum].iov_base = iso_buffer;
+ iov[iovnum].iov_len = len;
txsize += len;
+ iovnum++;
}
- ret = kernel_sendmsg(sdev->ud.tcp_socket, &msg, iov,
- 3, txsize);
+ ret = kernel_sendmsg(sdev->ud.tcp_socket, &msg,
+ iov, iovnum, txsize);
if (ret != txsize) {
dev_err(&sdev->interface->dev,
"sendmsg failed!, retval %d for %zd\n",
ret, txsize);
+ kfree(iov);
kfree(iso_buffer);
usbip_event_add(&sdev->ud, SDEV_EVENT_ERROR_TCP);
return -1;
}
+ kfree(iov);
kfree(iso_buffer);
- usbip_dbg_stub_tx("send txdata\n");
total_size += txsize;
}
-
spin_lock_irqsave(&sdev->priv_lock, flags);
list_for_each_entry_safe(priv, tmp, &sdev->priv_free, list) {
diff --git a/drivers/staging/usbip/usbip_common.c b/drivers/staging/usbip/usbip_common.c
index 337abc48f714..7b1fe45bf7dd 100644
--- a/drivers/staging/usbip/usbip_common.c
+++ b/drivers/staging/usbip/usbip_common.c
@@ -333,10 +333,11 @@ void usbip_dump_header(struct usbip_header *pdu)
usbip_udbg("CMD_UNLINK: seq %u\n", pdu->u.cmd_unlink.seqnum);
break;
case USBIP_RET_SUBMIT:
- usbip_udbg("RET_SUBMIT: st %d al %u sf %d ec %d\n",
+ usbip_udbg("RET_SUBMIT: st %d al %u sf %d #p %d ec %d\n",
pdu->u.ret_submit.status,
pdu->u.ret_submit.actual_length,
pdu->u.ret_submit.start_frame,
+ pdu->u.ret_submit.number_of_packets,
pdu->u.ret_submit.error_count);
case USBIP_RET_UNLINK:
usbip_udbg("RET_UNLINK: status %d\n", pdu->u.ret_unlink.status);
@@ -520,6 +521,7 @@ static void usbip_pack_ret_submit(struct usbip_header *pdu, struct urb *urb,
rpdu->status = urb->status;
rpdu->actual_length = urb->actual_length;
rpdu->start_frame = urb->start_frame;
+ rpdu->number_of_packets = urb->number_of_packets;
rpdu->error_count = urb->error_count;
} else {
/* vhci_rx.c */
@@ -527,6 +529,7 @@ static void usbip_pack_ret_submit(struct usbip_header *pdu, struct urb *urb,
urb->status = rpdu->status;
urb->actual_length = rpdu->actual_length;
urb->start_frame = rpdu->start_frame;
+ urb->number_of_packets = rpdu->number_of_packets;
urb->error_count = rpdu->error_count;
}
}
@@ -595,11 +598,13 @@ static void correct_endian_ret_submit(struct usbip_header_ret_submit *pdu,
cpu_to_be32s(&pdu->status);
cpu_to_be32s(&pdu->actual_length);
cpu_to_be32s(&pdu->start_frame);
+ cpu_to_be32s(&pdu->number_of_packets);
cpu_to_be32s(&pdu->error_count);
} else {
be32_to_cpus(&pdu->status);
be32_to_cpus(&pdu->actual_length);
be32_to_cpus(&pdu->start_frame);
+ cpu_to_be32s(&pdu->number_of_packets);
be32_to_cpus(&pdu->error_count);
}
}
@@ -725,6 +730,7 @@ int usbip_recv_iso(struct usbip_device *ud, struct urb *urb)
int size = np * sizeof(*iso);
int i;
int ret;
+ int total_length = 0;
if (!usb_pipeisoc(urb->pipe))
return 0;
@@ -754,19 +760,75 @@ int usbip_recv_iso(struct usbip_device *ud, struct urb *urb)
return -EPIPE;
}
+
for (i = 0; i < np; i++) {
iso = buff + (i * sizeof(*iso));
usbip_iso_pakcet_correct_endian(iso, 0);
usbip_pack_iso(iso, &urb->iso_frame_desc[i], 0);
+ total_length += urb->iso_frame_desc[i].actual_length;
}
kfree(buff);
+ if (total_length != urb->actual_length) {
+ dev_err(&urb->dev->dev,
+ "total length of iso packets (%d) not equal to actual length of buffer (%d)\n",
+ total_length, urb->actual_length);
+
+ if (ud->side == USBIP_STUB)
+ usbip_event_add(ud, SDEV_EVENT_ERROR_TCP);
+ else
+ usbip_event_add(ud, VDEV_EVENT_ERROR_TCP);
+
+ return -EPIPE;
+ }
+
return ret;
}
EXPORT_SYMBOL_GPL(usbip_recv_iso);
+/*
+ * This functions restores the padding which was removed for optimizing
+ * the bandwidth during transfer over tcp/ip
+ *
+ * buffer and iso packets need to be stored and be in propeper endian in urb
+ * before calling this function
+ */
+int usbip_pad_iso(struct usbip_device *ud, struct urb *urb)
+{
+ int np = urb->number_of_packets;
+ int i;
+ int ret;
+ int actualoffset = urb->actual_length;
+
+ if (!usb_pipeisoc(urb->pipe))
+ return 0;
+
+ /* if no packets or length of data is 0, then nothing to unpack */
+ if (np == 0 || urb->actual_length == 0)
+ return 0;
+
+ /*
+ * if actual_length is transfer_buffer_length then no padding is
+ * present.
+ */
+ if (urb->actual_length == urb->transfer_buffer_length)
+ return 0;
+
+ /*
+ * loop over all packets from last to first (to prevent overwritting
+ * memory when padding) and move them into the proper place
+ */
+ for (i = np-1; i > 0; i--) {
+ actualoffset -= urb->iso_frame_desc[i].actual_length;
+ memmove(urb->transfer_buffer + urb->iso_frame_desc[i].offset,
+ urb->transfer_buffer + actualoffset,
+ urb->iso_frame_desc[i].actual_length);
+ }
+ return ret;
+}
+EXPORT_SYMBOL_GPL(usbip_pad_iso);
/* some members of urb must be substituted before. */
int usbip_recv_xbuff(struct usbip_device *ud, struct urb *urb)
diff --git a/drivers/staging/usbip/usbip_common.h b/drivers/staging/usbip/usbip_common.h
index 9f809c315d92..c767f52be5fb 100644
--- a/drivers/staging/usbip/usbip_common.h
+++ b/drivers/staging/usbip/usbip_common.h
@@ -379,6 +379,8 @@ void usbip_header_correct_endian(struct usbip_header *pdu, int send);
int usbip_recv_xbuff(struct usbip_device *ud, struct urb *urb);
/* some members of urb must be substituted before. */
int usbip_recv_iso(struct usbip_device *ud, struct urb *urb);
+/* some members of urb must be substituted before. */
+int usbip_pad_iso(struct usbip_device *ud, struct urb *urb);
void *usbip_alloc_iso_desc_pdu(struct urb *urb, ssize_t *bufflen);
diff --git a/drivers/staging/usbip/vhci_hcd.c b/drivers/staging/usbip/vhci_hcd.c
index e23484998598..4f4f13321f40 100644
--- a/drivers/staging/usbip/vhci_hcd.c
+++ b/drivers/staging/usbip/vhci_hcd.c
@@ -194,7 +194,7 @@ void rh_port_disconnect(int rhport)
*
* So, the maximum number of ports is 31 ( port 0 to port 30) ?
*
- * The return value is the actual transfered length in byte. If nothing has
+ * The return value is the actual transferred length in byte. If nothing has
* been changed, return 0. In the case that the number of ports is less than or
* equal to 6 (VHCI_NPORTS==7), return 1.
*
@@ -876,8 +876,10 @@ static void vhci_shutdown_connection(struct usbip_device *ud)
}
/* kill threads related to this sdev, if v.c. exists */
- kthread_stop(vdev->ud.tcp_rx);
- kthread_stop(vdev->ud.tcp_tx);
+ if (vdev->ud.tcp_rx)
+ kthread_stop(vdev->ud.tcp_rx);
+ if (vdev->ud.tcp_tx)
+ kthread_stop(vdev->ud.tcp_tx);
usbip_uinfo("stop threads\n");
@@ -949,9 +951,6 @@ static void vhci_device_init(struct vhci_device *vdev)
{
memset(vdev, 0, sizeof(*vdev));
- vdev->ud.tcp_rx = kthread_create(vhci_rx_loop, &vdev->ud, "vhci_rx");
- vdev->ud.tcp_tx = kthread_create(vhci_tx_loop, &vdev->ud, "vhci_tx");
-
vdev->ud.side = USBIP_VHCI;
vdev->ud.status = VDEV_ST_NULL;
/* vdev->ud.lock = SPIN_LOCK_UNLOCKED; */
@@ -1139,7 +1138,7 @@ static int vhci_hcd_probe(struct platform_device *pdev)
usbip_uerr("create hcd failed\n");
return -ENOMEM;
}
-
+ hcd->has_tt = 1;
/* this is private data for vhci_hcd */
the_controller = hcd_to_vhci(hcd);
diff --git a/drivers/staging/usbip/vhci_rx.c b/drivers/staging/usbip/vhci_rx.c
index 09bf2355934b..2ffc96a4c0d4 100644
--- a/drivers/staging/usbip/vhci_rx.c
+++ b/drivers/staging/usbip/vhci_rx.c
@@ -100,6 +100,9 @@ static void vhci_recv_ret_submit(struct vhci_device *vdev,
if (usbip_recv_iso(ud, urb) < 0)
return;
+ /* restore the padding in iso packets */
+ if (usbip_pad_iso(ud, urb) < 0)
+ return;
if (usbip_dbg_flag_vhci_rx)
usbip_dump_urb(urb);
diff --git a/drivers/staging/usbip/vhci_sysfs.c b/drivers/staging/usbip/vhci_sysfs.c
index 3f2459f30415..e2dadbd5ef1e 100644
--- a/drivers/staging/usbip/vhci_sysfs.c
+++ b/drivers/staging/usbip/vhci_sysfs.c
@@ -21,6 +21,7 @@
#include "vhci.h"
#include <linux/in.h>
+#include <linux/kthread.h>
/* TODO: refine locking ?*/
@@ -220,13 +221,13 @@ static ssize_t store_attach(struct device *dev, struct device_attribute *attr,
vdev->ud.tcp_socket = socket;
vdev->ud.status = VDEV_ST_NOTASSIGNED;
- wake_up_process(vdev->ud.tcp_rx);
- wake_up_process(vdev->ud.tcp_tx);
-
spin_unlock(&vdev->ud.lock);
spin_unlock(&the_controller->lock);
/* end the lock */
+ vdev->ud.tcp_rx = kthread_run(vhci_rx_loop, &vdev->ud, "vhci_rx");
+ vdev->ud.tcp_tx = kthread_run(vhci_tx_loop, &vdev->ud, "vhci_tx");
+
rh_port_connect(rhport, speed);
return count;
diff --git a/drivers/staging/usbvideo/Kconfig b/drivers/staging/usbvideo/Kconfig
deleted file mode 100644
index 566d659e6ff3..000000000000
--- a/drivers/staging/usbvideo/Kconfig
+++ /dev/null
@@ -1,15 +0,0 @@
-config VIDEO_USBVIDEO
- tristate
-
-config USB_VICAM
- tristate "USB 3com HomeConnect (aka vicam) support (DEPRECATED)"
- depends on VIDEO_DEV && VIDEO_V4L2_COMMON && USB
- select VIDEO_USBVIDEO
- ---help---
- Say Y here if you have 3com homeconnect camera (vicam).
-
- This driver uses the deprecated V4L1 API and will be removed in
- 2.6.39, unless someone converts it to the V4L2 API.
-
- To compile this driver as a module, choose M here: the
- module will be called vicam.
diff --git a/drivers/staging/usbvideo/Makefile b/drivers/staging/usbvideo/Makefile
deleted file mode 100644
index 3c99a9a2d8d3..000000000000
--- a/drivers/staging/usbvideo/Makefile
+++ /dev/null
@@ -1,2 +0,0 @@
-obj-$(CONFIG_VIDEO_USBVIDEO) += usbvideo.o
-obj-$(CONFIG_USB_VICAM) += vicam.o
diff --git a/drivers/staging/usbvideo/TODO b/drivers/staging/usbvideo/TODO
deleted file mode 100644
index 3b2c03836286..000000000000
--- a/drivers/staging/usbvideo/TODO
+++ /dev/null
@@ -1,5 +0,0 @@
-This is an obsolete driver for some old webcams that still use V4L1 API.
-As V4L1 support is being removed from kernel, if nobody take care on it,
-the driver will be removed for 2.6.39.
-
-Please send patches to linux-media@vger.kernel.org
diff --git a/drivers/staging/usbvideo/usbvideo.c b/drivers/staging/usbvideo/usbvideo.c
deleted file mode 100644
index cd4c73af99ab..000000000000
--- a/drivers/staging/usbvideo/usbvideo.c
+++ /dev/null
@@ -1,2222 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/list.h>
-#include <linux/slab.h>
-#include <linux/module.h>
-#include <linux/mm.h>
-#include <linux/vmalloc.h>
-#include <linux/init.h>
-#include <linux/spinlock.h>
-
-#include <linux/io.h>
-
-#include "usbvideo.h"
-
-#if defined(MAP_NR)
-#define virt_to_page(v) MAP_NR(v) /* Kernels 2.2.x */
-#endif
-
-static int video_nr = -1;
-module_param(video_nr, int, 0);
-
-/*
- * Local prototypes.
- */
-static void usbvideo_Disconnect(struct usb_interface *intf);
-static void usbvideo_CameraRelease(struct uvd *uvd);
-
-static long usbvideo_v4l_ioctl(struct file *file,
- unsigned int cmd, unsigned long arg);
-static int usbvideo_v4l_mmap(struct file *file, struct vm_area_struct *vma);
-static int usbvideo_v4l_open(struct file *file);
-static ssize_t usbvideo_v4l_read(struct file *file, char __user *buf,
- size_t count, loff_t *ppos);
-static int usbvideo_v4l_close(struct file *file);
-
-static int usbvideo_StartDataPump(struct uvd *uvd);
-static void usbvideo_StopDataPump(struct uvd *uvd);
-static int usbvideo_GetFrame(struct uvd *uvd, int frameNum);
-static int usbvideo_NewFrame(struct uvd *uvd, int framenum);
-static void usbvideo_SoftwareContrastAdjustment(struct uvd *uvd,
- struct usbvideo_frame *frame);
-
-/*******************************/
-/* Memory management functions */
-/*******************************/
-static void *usbvideo_rvmalloc(unsigned long size)
-{
- void *mem;
- unsigned long adr;
-
- size = PAGE_ALIGN(size);
- mem = vmalloc_32(size);
- if (!mem)
- return NULL;
-
- memset(mem, 0, size); /* Clear the ram out, no junk to the user */
- adr = (unsigned long) mem;
- while (size > 0) {
- SetPageReserved(vmalloc_to_page((void *)adr));
- adr += PAGE_SIZE;
- size -= PAGE_SIZE;
- }
-
- return mem;
-}
-
-static void usbvideo_rvfree(void *mem, unsigned long size)
-{
- unsigned long adr;
-
- if (!mem)
- return;
-
- adr = (unsigned long) mem;
- while ((long) size > 0) {
- ClearPageReserved(vmalloc_to_page((void *)adr));
- adr += PAGE_SIZE;
- size -= PAGE_SIZE;
- }
- vfree(mem);
-}
-
-static void RingQueue_Initialize(struct RingQueue *rq)
-{
- assert(rq != NULL);
- init_waitqueue_head(&rq->wqh);
-}
-
-static void RingQueue_Allocate(struct RingQueue *rq, int rqLen)
-{
- /* Make sure the requested size is a power of 2 and
- round up if necessary. This allows index wrapping
- using masks rather than modulo */
-
- int i = 1;
- assert(rq != NULL);
- assert(rqLen > 0);
-
- while (rqLen >> i)
- i++;
- if (rqLen != 1 << (i-1))
- rqLen = 1 << i;
-
- rq->length = rqLen;
- rq->ri = rq->wi = 0;
- rq->queue = usbvideo_rvmalloc(rq->length);
- assert(rq->queue != NULL);
-}
-
-static int RingQueue_IsAllocated(const struct RingQueue *rq)
-{
- if (rq == NULL)
- return 0;
- return (rq->queue != NULL) && (rq->length > 0);
-}
-
-static void RingQueue_Free(struct RingQueue *rq)
-{
- assert(rq != NULL);
- if (RingQueue_IsAllocated(rq)) {
- usbvideo_rvfree(rq->queue, rq->length);
- rq->queue = NULL;
- rq->length = 0;
- }
-}
-
-int RingQueue_Dequeue(struct RingQueue *rq, unsigned char *dst, int len)
-{
- int rql, toread;
-
- assert(rq != NULL);
- assert(dst != NULL);
-
- rql = RingQueue_GetLength(rq);
- if (!rql)
- return 0;
-
- /* Clip requested length to available data */
- if (len > rql)
- len = rql;
-
- toread = len;
- if (rq->ri > rq->wi) {
- /* Read data from tail */
- int read = (toread < (rq->length - rq->ri)) ? toread : rq->length - rq->ri;
- memcpy(dst, rq->queue + rq->ri, read);
- toread -= read;
- dst += read;
- rq->ri = (rq->ri + read) & (rq->length-1);
- }
- if (toread) {
- /* Read data from head */
- memcpy(dst, rq->queue + rq->ri, toread);
- rq->ri = (rq->ri + toread) & (rq->length-1);
- }
- return len;
-}
-
-EXPORT_SYMBOL(RingQueue_Dequeue);
-
-int RingQueue_Enqueue(struct RingQueue *rq, const unsigned char *cdata, int n)
-{
- int enqueued = 0;
-
- assert(rq != NULL);
- assert(cdata != NULL);
- assert(rq->length > 0);
- while (n > 0) {
- int m, q_avail;
-
- /* Calculate the largest chunk that fits the tail of the ring */
- q_avail = rq->length - rq->wi;
- if (q_avail <= 0) {
- rq->wi = 0;
- q_avail = rq->length;
- }
- m = n;
- assert(q_avail > 0);
- if (m > q_avail)
- m = q_avail;
-
- memcpy(rq->queue + rq->wi, cdata, m);
- RING_QUEUE_ADVANCE_INDEX(rq, wi, m);
- cdata += m;
- enqueued += m;
- n -= m;
- }
- return enqueued;
-}
-
-EXPORT_SYMBOL(RingQueue_Enqueue);
-
-static void RingQueue_InterruptibleSleepOn(struct RingQueue *rq)
-{
- assert(rq != NULL);
- interruptible_sleep_on(&rq->wqh);
-}
-
-void RingQueue_WakeUpInterruptible(struct RingQueue *rq)
-{
- assert(rq != NULL);
- if (waitqueue_active(&rq->wqh))
- wake_up_interruptible(&rq->wqh);
-}
-
-EXPORT_SYMBOL(RingQueue_WakeUpInterruptible);
-
-void RingQueue_Flush(struct RingQueue *rq)
-{
- assert(rq != NULL);
- rq->ri = 0;
- rq->wi = 0;
-}
-
-EXPORT_SYMBOL(RingQueue_Flush);
-
-
-/*
- * usbvideo_VideosizeToString()
- *
- * This procedure converts given videosize value to readable string.
- *
- * History:
- * 07-Aug-2000 Created.
- * 19-Oct-2000 Reworked for usbvideo module.
- */
-static void usbvideo_VideosizeToString(char *buf, int bufLen, videosize_t vs)
-{
- char tmp[40];
- int n;
-
- n = 1 + sprintf(tmp, "%ldx%ld", VIDEOSIZE_X(vs), VIDEOSIZE_Y(vs));
- assert(n < sizeof(tmp));
- if ((buf == NULL) || (bufLen < n))
- err("usbvideo_VideosizeToString: buffer is too small.");
- else
- memmove(buf, tmp, n);
-}
-
-/*
- * usbvideo_OverlayChar()
- *
- * History:
- * 01-Feb-2000 Created.
- */
-static void usbvideo_OverlayChar(struct uvd *uvd, struct usbvideo_frame *frame,
- int x, int y, int ch)
-{
- static const unsigned short digits[16] = {
- 0xF6DE, /* 0 */
- 0x2492, /* 1 */
- 0xE7CE, /* 2 */
- 0xE79E, /* 3 */
- 0xB792, /* 4 */
- 0xF39E, /* 5 */
- 0xF3DE, /* 6 */
- 0xF492, /* 7 */
- 0xF7DE, /* 8 */
- 0xF79E, /* 9 */
- 0x77DA, /* a */
- 0xD75C, /* b */
- 0xF24E, /* c */
- 0xD6DC, /* d */
- 0xF34E, /* e */
- 0xF348 /* f */
- };
- unsigned short digit;
- int ix, iy;
- int value;
-
- if ((uvd == NULL) || (frame == NULL))
- return;
-
- value = hex_to_bin(ch);
- if (value < 0)
- return;
- digit = digits[value];
-
- for (iy = 0; iy < 5; iy++) {
- for (ix = 0; ix < 3; ix++) {
- if (digit & 0x8000) {
- if (uvd->paletteBits & (1L << VIDEO_PALETTE_RGB24))
-/* TODO */ RGB24_PUTPIXEL(frame, x+ix, y+iy, 0xFF, 0xFF, 0xFF);
- }
- digit = digit << 1;
- }
- }
-}
-
-/*
- * usbvideo_OverlayString()
- *
- * History:
- * 01-Feb-2000 Created.
- */
-static void usbvideo_OverlayString(struct uvd *uvd, struct usbvideo_frame *frame,
- int x, int y, const char *str)
-{
- while (*str) {
- usbvideo_OverlayChar(uvd, frame, x, y, *str);
- str++;
- x += 4; /* 3 pixels character + 1 space */
- }
-}
-
-/*
- * usbvideo_OverlayStats()
- *
- * Overlays important debugging information.
- *
- * History:
- * 01-Feb-2000 Created.
- */
-static void usbvideo_OverlayStats(struct uvd *uvd, struct usbvideo_frame *frame)
-{
- const int y_diff = 8;
- char tmp[16];
- int x = 10, y = 10;
- long i, j, barLength;
- const int qi_x1 = 60, qi_y1 = 10;
- const int qi_x2 = VIDEOSIZE_X(frame->request) - 10, qi_h = 10;
-
- /* Call the user callback, see if we may proceed after that */
- if (VALID_CALLBACK(uvd, overlayHook)) {
- if (GET_CALLBACK(uvd, overlayHook)(uvd, frame) < 0)
- return;
- }
-
- /*
- * We draw a (mostly) hollow rectangle with qi_xxx coordinates.
- * Left edge symbolizes the queue index 0; right edge symbolizes
- * the full capacity of the queue.
- */
- barLength = qi_x2 - qi_x1 - 2;
- if ((barLength > 10) && (uvd->paletteBits & (1L << VIDEO_PALETTE_RGB24))) {
-/* TODO */ long u_lo, u_hi, q_used;
- long m_ri, m_wi, m_lo, m_hi;
-
- /*
- * Determine fill zones (used areas of the queue):
- * 0 xxxxxxx u_lo ...... uvd->dp.ri xxxxxxxx u_hi ..... uvd->dp.length
- *
- * if u_lo < 0 then there is no first filler.
- */
-
- q_used = RingQueue_GetLength(&uvd->dp);
- if ((uvd->dp.ri + q_used) >= uvd->dp.length) {
- u_hi = uvd->dp.length;
- u_lo = (q_used + uvd->dp.ri) & (uvd->dp.length-1);
- } else {
- u_hi = (q_used + uvd->dp.ri);
- u_lo = -1;
- }
-
- /* Convert byte indices into screen units */
- m_ri = qi_x1 + ((barLength * uvd->dp.ri) / uvd->dp.length);
- m_wi = qi_x1 + ((barLength * uvd->dp.wi) / uvd->dp.length);
- m_lo = (u_lo > 0) ? (qi_x1 + ((barLength * u_lo) / uvd->dp.length)) : -1;
- m_hi = qi_x1 + ((barLength * u_hi) / uvd->dp.length);
-
- for (j = qi_y1; j < (qi_y1 + qi_h); j++) {
- for (i = qi_x1; i < qi_x2; i++) {
- /* Draw border lines */
- if ((j == qi_y1) || (j == (qi_y1 + qi_h - 1)) ||
- (i == qi_x1) || (i == (qi_x2 - 1))) {
- RGB24_PUTPIXEL(frame, i, j, 0xFF, 0xFF, 0xFF);
- continue;
- }
- /* For all other points the Y coordinate does not matter */
- if ((i >= m_ri) && (i <= (m_ri + 3)))
- RGB24_PUTPIXEL(frame, i, j, 0x00, 0xFF, 0x00);
- else if ((i >= m_wi) && (i <= (m_wi + 3)))
- RGB24_PUTPIXEL(frame, i, j, 0xFF, 0x00, 0x00);
- else if ((i < m_lo) || ((i > m_ri) && (i < m_hi)))
- RGB24_PUTPIXEL(frame, i, j, 0x00, 0x00, 0xFF);
- }
- }
- }
-
- sprintf(tmp, "%8lx", uvd->stats.frame_num);
- usbvideo_OverlayString(uvd, frame, x, y, tmp);
- y += y_diff;
-
- sprintf(tmp, "%8lx", uvd->stats.urb_count);
- usbvideo_OverlayString(uvd, frame, x, y, tmp);
- y += y_diff;
-
- sprintf(tmp, "%8lx", uvd->stats.urb_length);
- usbvideo_OverlayString(uvd, frame, x, y, tmp);
- y += y_diff;
-
- sprintf(tmp, "%8lx", uvd->stats.data_count);
- usbvideo_OverlayString(uvd, frame, x, y, tmp);
- y += y_diff;
-
- sprintf(tmp, "%8lx", uvd->stats.header_count);
- usbvideo_OverlayString(uvd, frame, x, y, tmp);
- y += y_diff;
-
- sprintf(tmp, "%8lx", uvd->stats.iso_skip_count);
- usbvideo_OverlayString(uvd, frame, x, y, tmp);
- y += y_diff;
-
- sprintf(tmp, "%8lx", uvd->stats.iso_err_count);
- usbvideo_OverlayString(uvd, frame, x, y, tmp);
- y += y_diff;
-
- sprintf(tmp, "%8x", uvd->vpic.colour);
- usbvideo_OverlayString(uvd, frame, x, y, tmp);
- y += y_diff;
-
- sprintf(tmp, "%8x", uvd->vpic.hue);
- usbvideo_OverlayString(uvd, frame, x, y, tmp);
- y += y_diff;
-
- sprintf(tmp, "%8x", uvd->vpic.brightness >> 8);
- usbvideo_OverlayString(uvd, frame, x, y, tmp);
- y += y_diff;
-
- sprintf(tmp, "%8x", uvd->vpic.contrast >> 12);
- usbvideo_OverlayString(uvd, frame, x, y, tmp);
- y += y_diff;
-
- sprintf(tmp, "%8d", uvd->vpic.whiteness >> 8);
- usbvideo_OverlayString(uvd, frame, x, y, tmp);
- y += y_diff;
-}
-
-/*
- * usbvideo_ReportStatistics()
- *
- * This procedure prints packet and transfer statistics.
- *
- * History:
- * 14-Jan-2000 Corrected default multiplier.
- */
-static void usbvideo_ReportStatistics(const struct uvd *uvd)
-{
- if ((uvd != NULL) && (uvd->stats.urb_count > 0)) {
- unsigned long allPackets, badPackets, goodPackets, percent;
- allPackets = uvd->stats.urb_count * CAMERA_URB_FRAMES;
- badPackets = uvd->stats.iso_skip_count + uvd->stats.iso_err_count;
- goodPackets = allPackets - badPackets;
- /* Calculate percentage wisely, remember integer limits */
- assert(allPackets != 0);
- if (goodPackets < (((unsigned long)-1)/100))
- percent = (100 * goodPackets) / allPackets;
- else
- percent = goodPackets / (allPackets / 100);
- dev_info(&uvd->dev->dev,
- "Packet Statistics: Total=%lu. Empty=%lu. Usage=%lu%%\n",
- allPackets, badPackets, percent);
- if (uvd->iso_packet_len > 0) {
- unsigned long allBytes, xferBytes;
- char multiplier = ' ';
- allBytes = allPackets * uvd->iso_packet_len;
- xferBytes = uvd->stats.data_count;
- assert(allBytes != 0);
- if (xferBytes < (((unsigned long)-1)/100))
- percent = (100 * xferBytes) / allBytes;
- else
- percent = xferBytes / (allBytes / 100);
- /* Scale xferBytes for easy reading */
- if (xferBytes > 10*1024) {
- xferBytes /= 1024;
- multiplier = 'K';
- if (xferBytes > 10*1024) {
- xferBytes /= 1024;
- multiplier = 'M';
- if (xferBytes > 10*1024) {
- xferBytes /= 1024;
- multiplier = 'G';
- if (xferBytes > 10*1024) {
- xferBytes /= 1024;
- multiplier = 'T';
- }
- }
- }
- }
- dev_info(&uvd->dev->dev,
- "Transfer Statistics: Transferred=%lu%cB Usage=%lu%%\n",
- xferBytes, multiplier, percent);
- }
- }
-}
-
-/*
- * usbvideo_TestPattern()
- *
- * Procedure forms a test pattern (yellow grid on blue background).
- *
- * Parameters:
- * fullframe: if TRUE then entire frame is filled, otherwise the procedure
- * continues from the current scanline.
- * pmode 0: fill the frame with solid blue color (like on VCR or TV)
- * 1: Draw a colored grid
- *
- * History:
- * 01-Feb-2000 Created.
- */
-void usbvideo_TestPattern(struct uvd *uvd, int fullframe, int pmode)
-{
- struct usbvideo_frame *frame;
- int num_cell = 0;
- int scan_length = 0;
- static int num_pass;
-
- if (uvd == NULL) {
- err("%s: uvd == NULL", __func__);
- return;
- }
- if ((uvd->curframe < 0) || (uvd->curframe >= USBVIDEO_NUMFRAMES)) {
- err("%s: uvd->curframe=%d.", __func__, uvd->curframe);
- return;
- }
-
- /* Grab the current frame */
- frame = &uvd->frame[uvd->curframe];
-
- /* Optionally start at the beginning */
- if (fullframe) {
- frame->curline = 0;
- frame->seqRead_Length = 0;
- }
-#if 0
- { /* For debugging purposes only */
- char tmp[20];
- usbvideo_VideosizeToString(tmp, sizeof(tmp), frame->request);
- dev_info(&uvd->dev->dev, "testpattern: frame=%s\n", tmp);
- }
-#endif
- /* Form every scan line */
- for (; frame->curline < VIDEOSIZE_Y(frame->request); frame->curline++) {
- int i;
- unsigned char *f = frame->data +
- (VIDEOSIZE_X(frame->request) * V4L_BYTES_PER_PIXEL * frame->curline);
- for (i = 0; i < VIDEOSIZE_X(frame->request); i++) {
- unsigned char cb = 0x80;
- unsigned char cg = 0;
- unsigned char cr = 0;
-
- if (pmode == 1) {
- if (frame->curline % 32 == 0)
- cb = 0, cg = cr = 0xFF;
- else if (i % 32 == 0) {
- if (frame->curline % 32 == 1)
- num_cell++;
- cb = 0, cg = cr = 0xFF;
- } else {
- cb = ((num_cell*7) + num_pass) & 0xFF;
- cg = ((num_cell*5) + num_pass*2) & 0xFF;
- cr = ((num_cell*3) + num_pass*3) & 0xFF;
- }
- } else {
- /* Just the blue screen */
- }
-
- *f++ = cb;
- *f++ = cg;
- *f++ = cr;
- scan_length += 3;
- }
- }
-
- frame->frameState = FrameState_Done;
- frame->seqRead_Length += scan_length;
- ++num_pass;
-
- /* We do this unconditionally, regardless of FLAGS_OVERLAY_STATS */
- usbvideo_OverlayStats(uvd, frame);
-}
-
-EXPORT_SYMBOL(usbvideo_TestPattern);
-
-
-#ifdef DEBUG
-/*
- * usbvideo_HexDump()
- *
- * A debugging tool. Prints hex dumps.
- *
- * History:
- * 29-Jul-2000 Added printing of offsets.
- */
-void usbvideo_HexDump(const unsigned char *data, int len)
-{
- const int bytes_per_line = 32;
- char tmp[128]; /* 32*3 + 5 */
- int i, k;
-
- for (i = k = 0; len > 0; i++, len--) {
- if (i > 0 && ((i % bytes_per_line) == 0)) {
- printk("%s\n", tmp);
- k = 0;
- }
- if ((i % bytes_per_line) == 0)
- k += sprintf(&tmp[k], "%04x: ", i);
- k += sprintf(&tmp[k], "%02x ", data[i]);
- }
- if (k > 0)
- printk("%s\n", tmp);
-}
-
-EXPORT_SYMBOL(usbvideo_HexDump);
-
-#endif
-
-/* ******************************************************************** */
-
-/* XXX: this piece of crap really wants some error handling.. */
-static int usbvideo_ClientIncModCount(struct uvd *uvd)
-{
- if (uvd == NULL) {
- err("%s: uvd == NULL", __func__);
- return -EINVAL;
- }
- if (uvd->handle == NULL) {
- err("%s: uvd->handle == NULL", __func__);
- return -EINVAL;
- }
- if (!try_module_get(uvd->handle->md_module)) {
- err("%s: try_module_get() == 0", __func__);
- return -ENODEV;
- }
- return 0;
-}
-
-static void usbvideo_ClientDecModCount(struct uvd *uvd)
-{
- if (uvd == NULL) {
- err("%s: uvd == NULL", __func__);
- return;
- }
- if (uvd->handle == NULL) {
- err("%s: uvd->handle == NULL", __func__);
- return;
- }
- if (uvd->handle->md_module == NULL) {
- err("%s: uvd->handle->md_module == NULL", __func__);
- return;
- }
- module_put(uvd->handle->md_module);
-}
-
-int usbvideo_register(
- struct usbvideo **pCams,
- const int num_cams,
- const int num_extra,
- const char *driverName,
- const struct usbvideo_cb *cbTbl,
- struct module *md,
- const struct usb_device_id *id_table)
-{
- struct usbvideo *cams;
- int i, base_size, result;
-
- /* Check parameters for sanity */
- if ((num_cams <= 0) || (pCams == NULL) || (cbTbl == NULL)) {
- err("%s: Illegal call", __func__);
- return -EINVAL;
- }
-
- /* Check registration callback - must be set! */
- if (cbTbl->probe == NULL) {
- err("%s: probe() is required!", __func__);
- return -EINVAL;
- }
-
- base_size = num_cams * sizeof(struct uvd) + sizeof(struct usbvideo);
- cams = kzalloc(base_size, GFP_KERNEL);
- if (cams == NULL) {
- err("Failed to allocate %d. bytes for usbvideo struct", base_size);
- return -ENOMEM;
- }
- dbg("%s: Allocated $%p (%d. bytes) for %d. cameras",
- __func__, cams, base_size, num_cams);
-
- /* Copy callbacks, apply defaults for those that are not set */
- memmove(&cams->cb, cbTbl, sizeof(cams->cb));
- if (cams->cb.getFrame == NULL)
- cams->cb.getFrame = usbvideo_GetFrame;
- if (cams->cb.disconnect == NULL)
- cams->cb.disconnect = usbvideo_Disconnect;
- if (cams->cb.startDataPump == NULL)
- cams->cb.startDataPump = usbvideo_StartDataPump;
- if (cams->cb.stopDataPump == NULL)
- cams->cb.stopDataPump = usbvideo_StopDataPump;
-
- cams->num_cameras = num_cams;
- cams->cam = (struct uvd *) &cams[1];
- cams->md_module = md;
- mutex_init(&cams->lock); /* to 1 == available */
-
- for (i = 0; i < num_cams; i++) {
- struct uvd *up = &cams->cam[i];
-
- up->handle = cams;
-
- /* Allocate user_data separately because of kmalloc's limits */
- if (num_extra > 0) {
- up->user_size = num_cams * num_extra;
- up->user_data = kmalloc(up->user_size, GFP_KERNEL);
- if (up->user_data == NULL) {
- err("%s: Failed to allocate user_data (%d. bytes)",
- __func__, up->user_size);
- while (i) {
- up = &cams->cam[--i];
- kfree(up->user_data);
- }
- kfree(cams);
- return -ENOMEM;
- }
- dbg("%s: Allocated cams[%d].user_data=$%p (%d. bytes)",
- __func__, i, up->user_data, up->user_size);
- }
- }
-
- /*
- * Register ourselves with USB stack.
- */
- strcpy(cams->drvName, (driverName != NULL) ? driverName : "Unknown");
- cams->usbdrv.name = cams->drvName;
- cams->usbdrv.probe = cams->cb.probe;
- cams->usbdrv.disconnect = cams->cb.disconnect;
- cams->usbdrv.id_table = id_table;
-
- /*
- * Update global handle to usbvideo. This is very important
- * because probe() can be called before usb_register() returns.
- * If the handle is not yet updated then the probe() will fail.
- */
- *pCams = cams;
- result = usb_register(&cams->usbdrv);
- if (result) {
- for (i = 0; i < num_cams; i++) {
- struct uvd *up = &cams->cam[i];
- kfree(up->user_data);
- }
- kfree(cams);
- }
-
- return result;
-}
-
-EXPORT_SYMBOL(usbvideo_register);
-
-/*
- * usbvideo_Deregister()
- *
- * Procedure frees all usbvideo and user data structures. Be warned that
- * if you had some dynamically allocated components in ->user field then
- * you should free them before calling here.
- */
-void usbvideo_Deregister(struct usbvideo **pCams)
-{
- struct usbvideo *cams;
- int i;
-
- if (pCams == NULL) {
- err("%s: pCams == NULL", __func__);
- return;
- }
- cams = *pCams;
- if (cams == NULL) {
- err("%s: cams == NULL", __func__);
- return;
- }
-
- dbg("%s: Deregistering %s driver.", __func__, cams->drvName);
- usb_deregister(&cams->usbdrv);
-
- dbg("%s: Deallocating cams=$%p (%d. cameras)", __func__, cams, cams->num_cameras);
- for (i = 0; i < cams->num_cameras; i++) {
- struct uvd *up = &cams->cam[i];
- int warning = 0;
-
- if (up->user_data != NULL) {
- if (up->user_size <= 0)
- ++warning;
- } else {
- if (up->user_size > 0)
- ++warning;
- }
- if (warning) {
- err("%s: Warning: user_data=$%p user_size=%d.",
- __func__, up->user_data, up->user_size);
- } else {
- dbg("%s: Freeing %d. $%p->user_data=$%p",
- __func__, i, up, up->user_data);
- kfree(up->user_data);
- }
- }
- /* Whole array was allocated in one chunk */
- dbg("%s: Freed %d uvd structures",
- __func__, cams->num_cameras);
- kfree(cams);
- *pCams = NULL;
-}
-
-EXPORT_SYMBOL(usbvideo_Deregister);
-
-/*
- * usbvideo_Disconnect()
- *
- * This procedure stops all driver activity. Deallocation of
- * the interface-private structure (pointed by 'ptr') is done now
- * (if we don't have any open files) or later, when those files
- * are closed. After that driver should be removable.
- *
- * This code handles surprise removal. The uvd->user is a counter which
- * increments on open() and decrements on close(). If we see here that
- * this counter is not 0 then we have a client who still has us opened.
- * We set uvd->remove_pending flag as early as possible, and after that
- * all access to the camera will gracefully fail. These failures should
- * prompt client to (eventually) close the video device, and then - in
- * usbvideo_v4l_close() - we decrement uvd->uvd_used and usage counter.
- *
- * History:
- * 22-Jan-2000 Added polling of MOD_IN_USE to delay removal until all users gone.
- * 27-Jan-2000 Reworked to allow pending disconnects; see xxx_close()
- * 24-May-2000 Corrected to prevent race condition (MOD_xxx_USE_COUNT).
- * 19-Oct-2000 Moved to usbvideo module.
- */
-static void usbvideo_Disconnect(struct usb_interface *intf)
-{
- struct uvd *uvd = usb_get_intfdata(intf);
- int i;
-
- if (uvd == NULL) {
- err("%s($%p): Illegal call.", __func__, intf);
- return;
- }
-
- usb_set_intfdata(intf, NULL);
-
- usbvideo_ClientIncModCount(uvd);
- if (uvd->debug > 0)
- dev_info(&intf->dev, "%s(%p.)\n", __func__, intf);
-
- mutex_lock(&uvd->lock);
- uvd->remove_pending = 1; /* Now all ISO data will be ignored */
-
- /* At this time we ask to cancel outstanding URBs */
- GET_CALLBACK(uvd, stopDataPump)(uvd);
-
- for (i = 0; i < USBVIDEO_NUMSBUF; i++)
- usb_free_urb(uvd->sbuf[i].urb);
-
- usb_put_dev(uvd->dev);
- uvd->dev = NULL; /* USB device is no more */
-
- video_unregister_device(&uvd->vdev);
- if (uvd->debug > 0)
- dev_info(&intf->dev, "%s: Video unregistered.\n", __func__);
-
- if (uvd->user)
- dev_info(&intf->dev, "%s: In use, disconnect pending.\n",
- __func__);
- else
- usbvideo_CameraRelease(uvd);
- mutex_unlock(&uvd->lock);
- dev_info(&intf->dev, "USB camera disconnected.\n");
-
- usbvideo_ClientDecModCount(uvd);
-}
-
-/*
- * usbvideo_CameraRelease()
- *
- * This code does final release of uvd. This happens
- * after the device is disconnected -and- all clients
- * closed their files.
- *
- * History:
- * 27-Jan-2000 Created.
- */
-static void usbvideo_CameraRelease(struct uvd *uvd)
-{
- if (uvd == NULL) {
- err("%s: Illegal call", __func__);
- return;
- }
-
- RingQueue_Free(&uvd->dp);
- if (VALID_CALLBACK(uvd, userFree))
- GET_CALLBACK(uvd, userFree)(uvd);
- uvd->uvd_used = 0; /* This is atomic, no need to take mutex */
-}
-
-/*
- * usbvideo_find_struct()
- *
- * This code searches the array of preallocated (static) structures
- * and returns index of the first one that isn't in use. Returns -1
- * if there are no free structures.
- *
- * History:
- * 27-Jan-2000 Created.
- */
-static int usbvideo_find_struct(struct usbvideo *cams)
-{
- int u, rv = -1;
-
- if (cams == NULL) {
- err("No usbvideo handle?");
- return -1;
- }
- mutex_lock(&cams->lock);
- for (u = 0; u < cams->num_cameras; u++) {
- struct uvd *uvd = &cams->cam[u];
- if (!uvd->uvd_used) { /* This one is free */
- uvd->uvd_used = 1; /* In use now */
- mutex_init(&uvd->lock); /* to 1 == available */
- uvd->dev = NULL;
- rv = u;
- break;
- }
- }
- mutex_unlock(&cams->lock);
- return rv;
-}
-
-static const struct v4l2_file_operations usbvideo_fops = {
- .owner = THIS_MODULE,
- .open = usbvideo_v4l_open,
- .release = usbvideo_v4l_close,
- .read = usbvideo_v4l_read,
- .mmap = usbvideo_v4l_mmap,
- .ioctl = usbvideo_v4l_ioctl,
-};
-static const struct video_device usbvideo_template = {
- .fops = &usbvideo_fops,
-};
-
-struct uvd *usbvideo_AllocateDevice(struct usbvideo *cams)
-{
- int i, devnum;
- struct uvd *uvd = NULL;
-
- if (cams == NULL) {
- err("No usbvideo handle?");
- return NULL;
- }
-
- devnum = usbvideo_find_struct(cams);
- if (devnum == -1) {
- err("IBM USB camera driver: Too many devices!");
- return NULL;
- }
- uvd = &cams->cam[devnum];
- dbg("Device entry #%d. at $%p", devnum, uvd);
-
- /* Not relying upon caller we increase module counter ourselves */
- usbvideo_ClientIncModCount(uvd);
-
- mutex_lock(&uvd->lock);
- for (i = 0; i < USBVIDEO_NUMSBUF; i++) {
- uvd->sbuf[i].urb = usb_alloc_urb(FRAMES_PER_DESC, GFP_KERNEL);
- if (uvd->sbuf[i].urb == NULL) {
- err("usb_alloc_urb(%d.) failed.", FRAMES_PER_DESC);
- uvd->uvd_used = 0;
- uvd = NULL;
- goto allocate_done;
- }
- }
- uvd->user = 0;
- uvd->remove_pending = 0;
- uvd->last_error = 0;
- RingQueue_Initialize(&uvd->dp);
-
- /* Initialize video device structure */
- uvd->vdev = usbvideo_template;
- sprintf(uvd->vdev.name, "%.20s USB Camera", cams->drvName);
- /*
- * The client is free to overwrite those because we
- * return control to the client's probe function right now.
- */
-allocate_done:
- mutex_unlock(&uvd->lock);
- usbvideo_ClientDecModCount(uvd);
- return uvd;
-}
-
-EXPORT_SYMBOL(usbvideo_AllocateDevice);
-
-int usbvideo_RegisterVideoDevice(struct uvd *uvd)
-{
- char tmp1[20], tmp2[20]; /* Buffers for printing */
-
- if (uvd == NULL) {
- err("%s: Illegal call.", __func__);
- return -EINVAL;
- }
- if (uvd->video_endp == 0) {
- dev_info(&uvd->dev->dev,
- "%s: No video endpoint specified; data pump disabled.\n",
- __func__);
- }
- if (uvd->paletteBits == 0) {
- err("%s: No palettes specified!", __func__);
- return -EINVAL;
- }
- if (uvd->defaultPalette == 0) {
- dev_info(&uvd->dev->dev, "%s: No default palette!\n",
- __func__);
- }
-
- uvd->max_frame_size = VIDEOSIZE_X(uvd->canvas) *
- VIDEOSIZE_Y(uvd->canvas) * V4L_BYTES_PER_PIXEL;
- usbvideo_VideosizeToString(tmp1, sizeof(tmp1), uvd->videosize);
- usbvideo_VideosizeToString(tmp2, sizeof(tmp2), uvd->canvas);
-
- if (uvd->debug > 0) {
- dev_info(&uvd->dev->dev,
- "%s: iface=%d. endpoint=$%02x paletteBits=$%08lx\n",
- __func__, uvd->iface, uvd->video_endp,
- uvd->paletteBits);
- }
- if (uvd->dev == NULL) {
- err("%s: uvd->dev == NULL", __func__);
- return -EINVAL;
- }
- uvd->vdev.parent = &uvd->dev->dev;
- uvd->vdev.release = video_device_release_empty;
- if (video_register_device(&uvd->vdev, VFL_TYPE_GRABBER, video_nr) < 0) {
- err("%s: video_register_device failed", __func__);
- return -EPIPE;
- }
- if (uvd->debug > 1) {
- dev_info(&uvd->dev->dev,
- "%s: video_register_device() successful\n", __func__);
- }
-
- dev_info(&uvd->dev->dev, "%s on %s: canvas=%s videosize=%s\n",
- (uvd->handle != NULL) ? uvd->handle->drvName : "???",
- video_device_node_name(&uvd->vdev), tmp2, tmp1);
-
- usb_get_dev(uvd->dev);
- return 0;
-}
-
-EXPORT_SYMBOL(usbvideo_RegisterVideoDevice);
-
-/* ******************************************************************** */
-
-static int usbvideo_v4l_mmap(struct file *file, struct vm_area_struct *vma)
-{
- struct uvd *uvd = file->private_data;
- unsigned long start = vma->vm_start;
- unsigned long size = vma->vm_end-vma->vm_start;
- unsigned long page, pos;
-
- if (!CAMERA_IS_OPERATIONAL(uvd))
- return -EFAULT;
-
- if (size > (((USBVIDEO_NUMFRAMES * uvd->max_frame_size) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1)))
- return -EINVAL;
-
- pos = (unsigned long) uvd->fbuf;
- while (size > 0) {
- page = vmalloc_to_pfn((void *)pos);
- if (remap_pfn_range(vma, start, page, PAGE_SIZE, PAGE_SHARED))
- return -EAGAIN;
-
- start += PAGE_SIZE;
- pos += PAGE_SIZE;
- if (size > PAGE_SIZE)
- size -= PAGE_SIZE;
- else
- size = 0;
- }
-
- return 0;
-}
-
-/*
- * usbvideo_v4l_open()
- *
- * This is part of Video 4 Linux API. The driver can be opened by one
- * client only (checks internal counter 'uvdser'). The procedure
- * then allocates buffers needed for video processing.
- *
- * History:
- * 22-Jan-2000 Rewrote, moved scratch buffer allocation here. Now the
- * camera is also initialized here (once per connect), at
- * expense of V4L client (it waits on open() call).
- * 27-Jan-2000 Used USBVIDEO_NUMSBUF as number of URB buffers.
- * 24-May-2000 Corrected to prevent race condition (MOD_xxx_USE_COUNT).
- */
-static int usbvideo_v4l_open(struct file *file)
-{
- struct video_device *dev = video_devdata(file);
- struct uvd *uvd = (struct uvd *) dev;
- const int sb_size = FRAMES_PER_DESC * uvd->iso_packet_len;
- int i, errCode = 0;
-
- if (uvd->debug > 1)
- dev_info(&uvd->dev->dev, "%s($%p)\n", __func__, dev);
-
- if (usbvideo_ClientIncModCount(uvd) < 0)
- return -ENODEV;
- mutex_lock(&uvd->lock);
-
- if (uvd->user) {
- err("%s: Someone tried to open an already opened device!", __func__);
- errCode = -EBUSY;
- } else {
- /* Clear statistics */
- memset(&uvd->stats, 0, sizeof(uvd->stats));
-
- /* Clean pointers so we know if we allocated something */
- for (i = 0; i < USBVIDEO_NUMSBUF; i++)
- uvd->sbuf[i].data = NULL;
-
- /* Allocate memory for the frame buffers */
- uvd->fbuf_size = USBVIDEO_NUMFRAMES * uvd->max_frame_size;
- uvd->fbuf = usbvideo_rvmalloc(uvd->fbuf_size);
- RingQueue_Allocate(&uvd->dp, RING_QUEUE_SIZE);
- if ((uvd->fbuf == NULL) ||
- (!RingQueue_IsAllocated(&uvd->dp))) {
- err("%s: Failed to allocate fbuf or dp", __func__);
- errCode = -ENOMEM;
- } else {
- /* Allocate all buffers */
- for (i = 0; i < USBVIDEO_NUMFRAMES; i++) {
- uvd->frame[i].frameState = FrameState_Unused;
- uvd->frame[i].data = uvd->fbuf + i*(uvd->max_frame_size);
- /*
- * Set default sizes in case IOCTL (VIDIOCMCAPTURE)
- * is not used (using read() instead).
- */
- uvd->frame[i].canvas = uvd->canvas;
- uvd->frame[i].seqRead_Index = 0;
- }
- for (i = 0; i < USBVIDEO_NUMSBUF; i++) {
- uvd->sbuf[i].data = kmalloc(sb_size, GFP_KERNEL);
- if (uvd->sbuf[i].data == NULL) {
- errCode = -ENOMEM;
- break;
- }
- }
- }
- if (errCode != 0) {
- /* Have to free all that memory */
- if (uvd->fbuf != NULL) {
- usbvideo_rvfree(uvd->fbuf, uvd->fbuf_size);
- uvd->fbuf = NULL;
- }
- RingQueue_Free(&uvd->dp);
- for (i = 0; i < USBVIDEO_NUMSBUF; i++) {
- kfree(uvd->sbuf[i].data);
- uvd->sbuf[i].data = NULL;
- }
- }
- }
-
- /* If so far no errors then we shall start the camera */
- if (errCode == 0) {
- /* Start data pump if we have valid endpoint */
- if (uvd->video_endp != 0)
- errCode = GET_CALLBACK(uvd, startDataPump)(uvd);
- if (errCode == 0) {
- if (VALID_CALLBACK(uvd, setupOnOpen)) {
- if (uvd->debug > 1)
- dev_info(&uvd->dev->dev,
- "%s: setupOnOpen callback\n",
- __func__);
- errCode = GET_CALLBACK(uvd, setupOnOpen)(uvd);
- if (errCode < 0) {
- err("%s: setupOnOpen callback failed (%d.).",
- __func__, errCode);
- } else if (uvd->debug > 1) {
- dev_info(&uvd->dev->dev,
- "%s: setupOnOpen callback successful\n",
- __func__);
- }
- }
- if (errCode == 0) {
- uvd->settingsAdjusted = 0;
- if (uvd->debug > 1)
- dev_info(&uvd->dev->dev,
- "%s: Open succeeded.\n",
- __func__);
- uvd->user++;
- file->private_data = uvd;
- }
- }
- }
- mutex_unlock(&uvd->lock);
- if (errCode != 0)
- usbvideo_ClientDecModCount(uvd);
- if (uvd->debug > 0)
- dev_info(&uvd->dev->dev, "%s: Returning %d.\n", __func__,
- errCode);
- return errCode;
-}
-
-/*
- * usbvideo_v4l_close()
- *
- * This is part of Video 4 Linux API. The procedure
- * stops streaming and deallocates all buffers that were earlier
- * allocated in usbvideo_v4l_open().
- *
- * History:
- * 22-Jan-2000 Moved scratch buffer deallocation here.
- * 27-Jan-2000 Used USBVIDEO_NUMSBUF as number of URB buffers.
- * 24-May-2000 Moved MOD_DEC_USE_COUNT outside of code that can sleep.
- */
-static int usbvideo_v4l_close(struct file *file)
-{
- struct video_device *dev = file->private_data;
- struct uvd *uvd = (struct uvd *) dev;
- int i;
-
- if (uvd->debug > 1)
- dev_info(&uvd->dev->dev, "%s($%p)\n", __func__, dev);
-
- mutex_lock(&uvd->lock);
- GET_CALLBACK(uvd, stopDataPump)(uvd);
- usbvideo_rvfree(uvd->fbuf, uvd->fbuf_size);
- uvd->fbuf = NULL;
- RingQueue_Free(&uvd->dp);
-
- for (i = 0; i < USBVIDEO_NUMSBUF; i++) {
- kfree(uvd->sbuf[i].data);
- uvd->sbuf[i].data = NULL;
- }
-
-#if USBVIDEO_REPORT_STATS
- usbvideo_ReportStatistics(uvd);
-#endif
-
- uvd->user--;
- if (uvd->remove_pending) {
- if (uvd->debug > 0)
- dev_info(&uvd->dev->dev, "%s: Final disconnect.\n",
- __func__);
- usbvideo_CameraRelease(uvd);
- }
- mutex_unlock(&uvd->lock);
- usbvideo_ClientDecModCount(uvd);
-
- if (uvd->debug > 1)
- dev_info(&uvd->dev->dev, "%s: Completed.\n", __func__);
- file->private_data = NULL;
- return 0;
-}
-
-/*
- * usbvideo_v4l_ioctl()
- *
- * This is part of Video 4 Linux API. The procedure handles ioctl() calls.
- *
- * History:
- * 22-Jan-2000 Corrected VIDIOCSPICT to reject unsupported settings.
- */
-static long usbvideo_v4l_do_ioctl(struct file *file, unsigned int cmd, void *arg)
-{
- struct uvd *uvd = file->private_data;
-
- if (!CAMERA_IS_OPERATIONAL(uvd))
- return -EIO;
-
- switch (cmd) {
- case VIDIOCGCAP:
- {
- struct video_capability *b = arg;
- *b = uvd->vcap;
- return 0;
- }
- case VIDIOCGCHAN:
- {
- struct video_channel *v = arg;
- *v = uvd->vchan;
- return 0;
- }
- case VIDIOCSCHAN:
- {
- struct video_channel *v = arg;
- if (v->channel != 0)
- return -EINVAL;
- return 0;
- }
- case VIDIOCGPICT:
- {
- struct video_picture *pic = arg;
- *pic = uvd->vpic;
- return 0;
- }
- case VIDIOCSPICT:
- {
- struct video_picture *pic = arg;
- /*
- * Use temporary 'video_picture' structure to preserve our
- * own settings (such as color depth, palette) that we
- * aren't allowing everyone (V4L client) to change.
- */
- uvd->vpic.brightness = pic->brightness;
- uvd->vpic.hue = pic->hue;
- uvd->vpic.colour = pic->colour;
- uvd->vpic.contrast = pic->contrast;
- uvd->settingsAdjusted = 0; /* Will force new settings */
- return 0;
- }
- case VIDIOCSWIN:
- {
- struct video_window *vw = arg;
-
- if (VALID_CALLBACK(uvd, setVideoMode))
- return GET_CALLBACK(uvd, setVideoMode)(uvd, vw);
-
- if (vw->flags)
- return -EINVAL;
- if (vw->clipcount)
- return -EINVAL;
- if (vw->width != VIDEOSIZE_X(uvd->canvas))
- return -EINVAL;
- if (vw->height != VIDEOSIZE_Y(uvd->canvas))
- return -EINVAL;
-
- return 0;
- }
- case VIDIOCGWIN:
- {
- struct video_window *vw = arg;
-
- vw->x = 0;
- vw->y = 0;
- vw->width = VIDEOSIZE_X(uvd->videosize);
- vw->height = VIDEOSIZE_Y(uvd->videosize);
- vw->chromakey = 0;
- if (VALID_CALLBACK(uvd, getFPS))
- vw->flags = GET_CALLBACK(uvd, getFPS)(uvd);
- else
- vw->flags = 10; /* FIXME: do better! */
- return 0;
- }
- case VIDIOCGMBUF:
- {
- struct video_mbuf *vm = arg;
- int i;
-
- memset(vm, 0, sizeof(*vm));
- vm->size = uvd->max_frame_size * USBVIDEO_NUMFRAMES;
- vm->frames = USBVIDEO_NUMFRAMES;
- for (i = 0; i < USBVIDEO_NUMFRAMES; i++)
- vm->offsets[i] = i * uvd->max_frame_size;
-
- return 0;
- }
- case VIDIOCMCAPTURE:
- {
- struct video_mmap *vm = arg;
-
- if (uvd->debug >= 1) {
- dev_info(&uvd->dev->dev,
- "VIDIOCMCAPTURE: frame=%d. size=%dx%d, format=%d.\n",
- vm->frame, vm->width, vm->height, vm->format);
- }
- /*
- * Check if the requested size is supported. If the requestor
- * requests too big a frame then we may be tricked into accessing
- * outside of own preallocated frame buffer (in uvd->frame).
- * This will cause oops or a security hole. Theoretically, we
- * could only clamp the size down to acceptable bounds, but then
- * we'd need to figure out how to insert our smaller buffer into
- * larger caller's buffer... this is not an easy question. So we
- * here just flatly reject too large requests, assuming that the
- * caller will resubmit with smaller size. Callers should know
- * what size we support (returned by VIDIOCGCAP). However vidcat,
- * for one, does not care and allows to ask for any size.
- */
- if ((vm->width > VIDEOSIZE_X(uvd->canvas)) ||
- (vm->height > VIDEOSIZE_Y(uvd->canvas))) {
- if (uvd->debug > 0) {
- dev_info(&uvd->dev->dev,
- "VIDIOCMCAPTURE: Size=%dx%d "
- "too large; allowed only up "
- "to %ldx%ld\n", vm->width,
- vm->height,
- VIDEOSIZE_X(uvd->canvas),
- VIDEOSIZE_Y(uvd->canvas));
- }
- return -EINVAL;
- }
- /* Check if the palette is supported */
- if (((1L << vm->format) & uvd->paletteBits) == 0) {
- if (uvd->debug > 0) {
- dev_info(&uvd->dev->dev,
- "VIDIOCMCAPTURE: format=%d. "
- "not supported "
- "(paletteBits=$%08lx)\n",
- vm->format, uvd->paletteBits);
- }
- return -EINVAL;
- }
- if ((vm->frame < 0) || (vm->frame >= USBVIDEO_NUMFRAMES)) {
- err("VIDIOCMCAPTURE: vm.frame=%d. !E [0-%d]", vm->frame, USBVIDEO_NUMFRAMES-1);
- return -EINVAL;
- }
- if (uvd->frame[vm->frame].frameState == FrameState_Grabbing) {
- /* Not an error - can happen */
- }
- uvd->frame[vm->frame].request = VIDEOSIZE(vm->width, vm->height);
- uvd->frame[vm->frame].palette = vm->format;
-
- /* Mark it as ready */
- uvd->frame[vm->frame].frameState = FrameState_Ready;
-
- return usbvideo_NewFrame(uvd, vm->frame);
- }
- case VIDIOCSYNC:
- {
- int *frameNum = arg;
- int ret;
-
- if (*frameNum < 0 || *frameNum >= USBVIDEO_NUMFRAMES)
- return -EINVAL;
-
- if (uvd->debug >= 1)
- dev_info(&uvd->dev->dev,
- "VIDIOCSYNC: syncing to frame %d.\n",
- *frameNum);
- if (uvd->flags & FLAGS_NO_DECODING)
- ret = usbvideo_GetFrame(uvd, *frameNum);
- else if (VALID_CALLBACK(uvd, getFrame)) {
- ret = GET_CALLBACK(uvd, getFrame)(uvd, *frameNum);
- if ((ret < 0) && (uvd->debug >= 1))
- err("VIDIOCSYNC: getFrame() returned %d.", ret);
- } else {
- err("VIDIOCSYNC: getFrame is not set");
- ret = -EFAULT;
- }
-
- /*
- * The frame is in FrameState_Done_Hold state. Release it
- * right now because its data is already mapped into
- * the user space and it's up to the application to
- * make use of it until it asks for another frame.
- */
- uvd->frame[*frameNum].frameState = FrameState_Unused;
- return ret;
- }
- case VIDIOCGFBUF:
- {
- struct video_buffer *vb = arg;
-
- memset(vb, 0, sizeof(*vb));
- return 0;
- }
- case VIDIOCKEY:
- return 0;
-
- case VIDIOCCAPTURE:
- return -EINVAL;
-
- case VIDIOCSFBUF:
-
- case VIDIOCGTUNER:
- case VIDIOCSTUNER:
-
- case VIDIOCGFREQ:
- case VIDIOCSFREQ:
-
- case VIDIOCGAUDIO:
- case VIDIOCSAUDIO:
- return -EINVAL;
-
- default:
- return -ENOIOCTLCMD;
- }
- return 0;
-}
-
-static long usbvideo_v4l_ioctl(struct file *file,
- unsigned int cmd, unsigned long arg)
-{
- return video_usercopy(file, cmd, arg, usbvideo_v4l_do_ioctl);
-}
-
-/*
- * usbvideo_v4l_read()
- *
- * This is mostly boring stuff. We simply ask for a frame and when it
- * arrives copy all the video data from it into user space. There is
- * no obvious need to override this method.
- *
- * History:
- * 20-Oct-2000 Created.
- * 01-Nov-2000 Added mutex (uvd->lock).
- */
-static ssize_t usbvideo_v4l_read(struct file *file, char __user *buf,
- size_t count, loff_t *ppos)
-{
- struct uvd *uvd = file->private_data;
- int noblock = file->f_flags & O_NONBLOCK;
- int frmx = -1, i;
- struct usbvideo_frame *frame;
-
- if (!CAMERA_IS_OPERATIONAL(uvd) || (buf == NULL))
- return -EFAULT;
-
- if (uvd->debug >= 1)
- dev_info(&uvd->dev->dev,
- "%s: %Zd. bytes, noblock=%d.\n",
- __func__, count, noblock);
-
- mutex_lock(&uvd->lock);
-
- /* See if a frame is completed, then use it. */
- for (i = 0; i < USBVIDEO_NUMFRAMES; i++) {
- if ((uvd->frame[i].frameState == FrameState_Done) ||
- (uvd->frame[i].frameState == FrameState_Done_Hold) ||
- (uvd->frame[i].frameState == FrameState_Error)) {
- frmx = i;
- break;
- }
- }
-
- /* FIXME: If we don't start a frame here then who ever does? */
- if (noblock && (frmx == -1)) {
- count = -EAGAIN;
- goto read_done;
- }
-
- /*
- * If no FrameState_Done, look for a FrameState_Grabbing state.
- * See if a frame is in process (grabbing), then use it.
- * We will need to wait until it becomes cooked, of course.
- */
- if (frmx == -1) {
- for (i = 0; i < USBVIDEO_NUMFRAMES; i++) {
- if (uvd->frame[i].frameState == FrameState_Grabbing) {
- frmx = i;
- break;
- }
- }
- }
-
- /*
- * If no frame is active, start one. We don't care which one
- * it will be, so #0 is as good as any.
- * In read access mode we don't have convenience of VIDIOCMCAPTURE
- * to specify the requested palette (video format) on per-frame
- * basis. This means that we have to return data in -some- format
- * and just hope that the client knows what to do with it.
- * The default format is configured in uvd->defaultPalette field
- * as one of VIDEO_PALETTE_xxx values. We stuff it into the new
- * frame and initiate the frame filling process.
- */
- if (frmx == -1) {
- if (uvd->defaultPalette == 0) {
- err("%s: No default palette; don't know what to do!", __func__);
- count = -EFAULT;
- goto read_done;
- }
- frmx = 0;
- /*
- * We have no per-frame control over video size.
- * Therefore we only can use whatever size was
- * specified as default.
- */
- uvd->frame[frmx].request = uvd->videosize;
- uvd->frame[frmx].palette = uvd->defaultPalette;
- uvd->frame[frmx].frameState = FrameState_Ready;
- usbvideo_NewFrame(uvd, frmx);
- /* Now frame 0 is supposed to start filling... */
- }
-
- /*
- * Get a pointer to the active frame. It is either previously
- * completed frame or frame in progress but not completed yet.
- */
- frame = &uvd->frame[frmx];
-
- /*
- * Sit back & wait until the frame gets filled and postprocessed.
- * If we fail to get the picture [in time] then return the error.
- * In this call we specify that we want the frame to be waited for,
- * postprocessed and switched into FrameState_Done_Hold state. This
- * state is used to hold the frame as "fully completed" between
- * subsequent partial reads of the same frame.
- */
- if (frame->frameState != FrameState_Done_Hold) {
- long rv = -EFAULT;
- if (uvd->flags & FLAGS_NO_DECODING)
- rv = usbvideo_GetFrame(uvd, frmx);
- else if (VALID_CALLBACK(uvd, getFrame))
- rv = GET_CALLBACK(uvd, getFrame)(uvd, frmx);
- else
- err("getFrame is not set");
- if ((rv != 0) || (frame->frameState != FrameState_Done_Hold)) {
- count = rv;
- goto read_done;
- }
- }
-
- /*
- * Copy bytes to user space. We allow for partial reads, which
- * means that the user application can request read less than
- * the full frame size. It is up to the application to issue
- * subsequent calls until entire frame is read.
- *
- * First things first, make sure we don't copy more than we
- * have - even if the application wants more. That would be
- * a big security embarassment!
- */
- if ((count + frame->seqRead_Index) > frame->seqRead_Length)
- count = frame->seqRead_Length - frame->seqRead_Index;
-
- /*
- * Copy requested amount of data to user space. We start
- * copying from the position where we last left it, which
- * will be zero for a new frame (not read before).
- */
- if (copy_to_user(buf, frame->data + frame->seqRead_Index, count)) {
- count = -EFAULT;
- goto read_done;
- }
-
- /* Update last read position */
- frame->seqRead_Index += count;
- if (uvd->debug >= 1) {
- err("%s: {copy} count used=%Zd, new seqRead_Index=%ld",
- __func__, count, frame->seqRead_Index);
- }
-
- /* Finally check if the frame is done with and "release" it */
- if (frame->seqRead_Index >= frame->seqRead_Length) {
- /* All data has been read */
- frame->seqRead_Index = 0;
-
- /* Mark it as available to be used again. */
- uvd->frame[frmx].frameState = FrameState_Unused;
- if (usbvideo_NewFrame(uvd, (frmx + 1) % USBVIDEO_NUMFRAMES))
- err("%s: usbvideo_NewFrame failed.", __func__);
- }
-read_done:
- mutex_unlock(&uvd->lock);
- return count;
-}
-
-/*
- * Make all of the blocks of data contiguous
- */
-static int usbvideo_CompressIsochronous(struct uvd *uvd, struct urb *urb)
-{
- char *cdata;
- int i, totlen = 0;
-
- for (i = 0; i < urb->number_of_packets; i++) {
- int n = urb->iso_frame_desc[i].actual_length;
- int st = urb->iso_frame_desc[i].status;
-
- cdata = urb->transfer_buffer + urb->iso_frame_desc[i].offset;
-
- /* Detect and ignore errored packets */
- if (st < 0) {
- if (uvd->debug >= 1)
- err("Data error: packet=%d. len=%d. status=%d.", i, n, st);
- uvd->stats.iso_err_count++;
- continue;
- }
-
- /* Detect and ignore empty packets */
- if (n <= 0) {
- uvd->stats.iso_skip_count++;
- continue;
- }
- totlen += n; /* Little local accounting */
- RingQueue_Enqueue(&uvd->dp, cdata, n);
- }
- return totlen;
-}
-
-static void usbvideo_IsocIrq(struct urb *urb)
-{
- int i, ret, len;
- struct uvd *uvd = urb->context;
-
- /* We don't want to do anything if we are about to be removed! */
- if (!CAMERA_IS_OPERATIONAL(uvd))
- return;
-#if 0
- if (urb->actual_length > 0) {
- dev_info(&uvd->dev->dev,
- "urb=$%p status=%d. errcount=%d. length=%d.\n",
- urb, urb->status, urb->error_count,
- urb->actual_length);
- } else {
- static int c = 0;
- if (c++ % 100 == 0)
- dev_info(&uvd->dev->dev, "No Isoc data\n");
- }
-#endif
-
- if (!uvd->streaming) {
- if (uvd->debug >= 1)
- dev_info(&uvd->dev->dev,
- "Not streaming, but interrupt!\n");
- return;
- }
-
- uvd->stats.urb_count++;
- if (urb->actual_length <= 0)
- goto urb_done_with;
-
- /* Copy the data received into ring queue */
- len = usbvideo_CompressIsochronous(uvd, urb);
- uvd->stats.urb_length = len;
- if (len <= 0)
- goto urb_done_with;
-
- /* Here we got some data */
- uvd->stats.data_count += len;
- RingQueue_WakeUpInterruptible(&uvd->dp);
-
-urb_done_with:
- for (i = 0; i < FRAMES_PER_DESC; i++) {
- urb->iso_frame_desc[i].status = 0;
- urb->iso_frame_desc[i].actual_length = 0;
- }
- urb->status = 0;
- urb->dev = uvd->dev;
- ret = usb_submit_urb(urb, GFP_KERNEL);
- if (ret)
- err("usb_submit_urb error (%d)", ret);
- return;
-}
-
-/*
- * usbvideo_StartDataPump()
- *
- * History:
- * 27-Jan-2000 Used ibmcam->iface, ibmcam->ifaceAltActive instead
- * of hardcoded values. Simplified by using for loop,
- * allowed any number of URBs.
- */
-static int usbvideo_StartDataPump(struct uvd *uvd)
-{
- struct usb_device *dev = uvd->dev;
- int i, errFlag;
-
- if (uvd->debug > 1)
- dev_info(&uvd->dev->dev, "%s($%p)\n", __func__, uvd);
-
- if (!CAMERA_IS_OPERATIONAL(uvd)) {
- err("%s: Camera is not operational", __func__);
- return -EFAULT;
- }
- uvd->curframe = -1;
-
- /* Alternate interface 1 is is the biggest frame size */
- i = usb_set_interface(dev, uvd->iface, uvd->ifaceAltActive);
- if (i < 0) {
- err("%s: usb_set_interface error", __func__);
- uvd->last_error = i;
- return -EBUSY;
- }
- if (VALID_CALLBACK(uvd, videoStart))
- GET_CALLBACK(uvd, videoStart)(uvd);
- else
- err("%s: videoStart not set", __func__);
-
- /* We double buffer the Iso lists */
- for (i = 0; i < USBVIDEO_NUMSBUF; i++) {
- int j, k;
- struct urb *urb = uvd->sbuf[i].urb;
- urb->dev = dev;
- urb->context = uvd;
- urb->pipe = usb_rcvisocpipe(dev, uvd->video_endp);
- urb->interval = 1;
- urb->transfer_flags = URB_ISO_ASAP;
- urb->transfer_buffer = uvd->sbuf[i].data;
- urb->complete = usbvideo_IsocIrq;
- urb->number_of_packets = FRAMES_PER_DESC;
- urb->transfer_buffer_length = uvd->iso_packet_len * FRAMES_PER_DESC;
- for (j = k = 0; j < FRAMES_PER_DESC; j++, k += uvd->iso_packet_len) {
- urb->iso_frame_desc[j].offset = k;
- urb->iso_frame_desc[j].length = uvd->iso_packet_len;
- }
- }
-
- /* Submit all URBs */
- for (i = 0; i < USBVIDEO_NUMSBUF; i++) {
- errFlag = usb_submit_urb(uvd->sbuf[i].urb, GFP_KERNEL);
- if (errFlag)
- err("%s: usb_submit_isoc(%d) ret %d", __func__, i, errFlag);
- }
-
- uvd->streaming = 1;
- if (uvd->debug > 1)
- dev_info(&uvd->dev->dev,
- "%s: streaming=1 video_endp=$%02x\n", __func__,
- uvd->video_endp);
- return 0;
-}
-
-/*
- * usbvideo_StopDataPump()
- *
- * This procedure stops streaming and deallocates URBs. Then it
- * activates zero-bandwidth alt. setting of the video interface.
- *
- * History:
- * 22-Jan-2000 Corrected order of actions to work after surprise removal.
- * 27-Jan-2000 Used uvd->iface, uvd->ifaceAltInactive instead of hardcoded values.
- */
-static void usbvideo_StopDataPump(struct uvd *uvd)
-{
- int i, j;
-
- if ((uvd == NULL) || (!uvd->streaming) || (uvd->dev == NULL))
- return;
-
- if (uvd->debug > 1)
- dev_info(&uvd->dev->dev, "%s($%p)\n", __func__, uvd);
-
- /* Unschedule all of the iso td's */
- for (i = 0; i < USBVIDEO_NUMSBUF; i++)
- usb_kill_urb(uvd->sbuf[i].urb);
- if (uvd->debug > 1)
- dev_info(&uvd->dev->dev, "%s: streaming=0\n", __func__);
- uvd->streaming = 0;
-
- if (!uvd->remove_pending) {
- /* Invoke minidriver's magic to stop the camera */
- if (VALID_CALLBACK(uvd, videoStop))
- GET_CALLBACK(uvd, videoStop)(uvd);
- else
- err("%s: videoStop not set", __func__);
-
- /* Set packet size to 0 */
- j = usb_set_interface(uvd->dev, uvd->iface, uvd->ifaceAltInactive);
- if (j < 0) {
- err("%s: usb_set_interface() error %d.", __func__, j);
- uvd->last_error = j;
- }
- }
-}
-
-/*
- * usbvideo_NewFrame()
- *
- * History:
- * 29-Mar-00 Added copying of previous frame into the current one.
- * 6-Aug-00 Added model 3 video sizes, removed redundant width, height.
- */
-static int usbvideo_NewFrame(struct uvd *uvd, int framenum)
-{
- struct usbvideo_frame *frame;
- int n;
-
- if (uvd->debug > 1)
- dev_info(&uvd->dev->dev, "usbvideo_NewFrame($%p,%d.)\n", uvd,
- framenum);
-
- /* If we're not grabbing a frame right now and the other frame is */
- /* ready to be grabbed into, then use it instead */
- if (uvd->curframe != -1)
- return 0;
-
- /* If necessary we adjust picture settings between frames */
- if (!uvd->settingsAdjusted) {
- if (VALID_CALLBACK(uvd, adjustPicture))
- GET_CALLBACK(uvd, adjustPicture)(uvd);
- uvd->settingsAdjusted = 1;
- }
-
- n = (framenum + 1) % USBVIDEO_NUMFRAMES;
- if (uvd->frame[n].frameState == FrameState_Ready)
- framenum = n;
-
- frame = &uvd->frame[framenum];
-
- frame->frameState = FrameState_Grabbing;
- frame->scanstate = ScanState_Scanning;
- frame->seqRead_Length = 0; /* Accumulated in xxx_parse_data() */
- frame->deinterlace = Deinterlace_None;
- frame->flags = 0; /* No flags yet, up to minidriver (or us) to set them */
- uvd->curframe = framenum;
-
- /*
- * Normally we would want to copy previous frame into the current one
- * before we even start filling it with data; this allows us to stop
- * filling at any moment; top portion of the frame will be new and
- * bottom portion will stay as it was in previous frame. If we don't
- * do that then missing chunks of video stream will result in flickering
- * portions of old data whatever it was before.
- *
- * If we choose not to copy previous frame (to, for example, save few
- * bus cycles - the frame can be pretty large!) then we have an option
- * to clear the frame before using. If we experience losses in this
- * mode then missing picture will be black (no flickering).
- *
- * Finally, if user chooses not to clean the current frame before
- * filling it with data then the old data will be visible if we fail
- * to refill entire frame with new data.
- */
- if (!(uvd->flags & FLAGS_SEPARATE_FRAMES)) {
- /* This copies previous frame into this one to mask losses */
- int prev = (framenum - 1 + USBVIDEO_NUMFRAMES) % USBVIDEO_NUMFRAMES;
- memmove(frame->data, uvd->frame[prev].data, uvd->max_frame_size);
- } else {
- if (uvd->flags & FLAGS_CLEAN_FRAMES) {
- /* This provides a "clean" frame but slows things down */
- memset(frame->data, 0, uvd->max_frame_size);
- }
- }
- return 0;
-}
-
-/*
- * usbvideo_CollectRawData()
- *
- * This procedure can be used instead of 'processData' callback if you
- * only want to dump the raw data from the camera into the output
- * device (frame buffer). You can look at it with V4L client, but the
- * image will be unwatchable. The main purpose of this code and of the
- * mode FLAGS_NO_DECODING is debugging and capturing of datastreams from
- * new, unknown cameras. This procedure will be automatically invoked
- * instead of the specified callback handler when uvd->flags has bit
- * FLAGS_NO_DECODING set. Therefore, any regular build of any driver
- * based on usbvideo can use this feature at any time.
- */
-static void usbvideo_CollectRawData(struct uvd *uvd, struct usbvideo_frame *frame)
-{
- int n;
-
- assert(uvd != NULL);
- assert(frame != NULL);
-
- /* Try to move data from queue into frame buffer */
- n = RingQueue_GetLength(&uvd->dp);
- if (n > 0) {
- int m;
- /* See how much space we have left */
- m = uvd->max_frame_size - frame->seqRead_Length;
- if (n > m)
- n = m;
- /* Now move that much data into frame buffer */
- RingQueue_Dequeue(
- &uvd->dp,
- frame->data + frame->seqRead_Length,
- m);
- frame->seqRead_Length += m;
- }
- /* See if we filled the frame */
- if (frame->seqRead_Length >= uvd->max_frame_size) {
- frame->frameState = FrameState_Done;
- uvd->curframe = -1;
- uvd->stats.frame_num++;
- }
-}
-
-static int usbvideo_GetFrame(struct uvd *uvd, int frameNum)
-{
- struct usbvideo_frame *frame = &uvd->frame[frameNum];
-
- if (uvd->debug >= 2)
- dev_info(&uvd->dev->dev, "%s($%p,%d.)\n", __func__, uvd,
- frameNum);
-
- switch (frame->frameState) {
- case FrameState_Unused:
- if (uvd->debug >= 2)
- dev_info(&uvd->dev->dev, "%s: FrameState_Unused\n",
- __func__);
- return -EINVAL;
- case FrameState_Ready:
- case FrameState_Grabbing:
- case FrameState_Error:
- {
- int ntries, signalPending;
-redo:
- if (!CAMERA_IS_OPERATIONAL(uvd)) {
- if (uvd->debug >= 2)
- dev_info(&uvd->dev->dev,
- "%s: Camera is not operational (1)\n",
- __func__);
- return -EIO;
- }
- ntries = 0;
- do {
- RingQueue_InterruptibleSleepOn(&uvd->dp);
- signalPending = signal_pending(current);
- if (!CAMERA_IS_OPERATIONAL(uvd)) {
- if (uvd->debug >= 2)
- dev_info(&uvd->dev->dev,
- "%s: Camera is not "
- "operational (2)\n", __func__);
- return -EIO;
- }
- assert(uvd->fbuf != NULL);
- if (signalPending) {
- if (uvd->debug >= 2)
- dev_info(&uvd->dev->dev,
- "%s: Signal=$%08x\n", __func__,
- signalPending);
- if (uvd->flags & FLAGS_RETRY_VIDIOCSYNC) {
- usbvideo_TestPattern(uvd, 1, 0);
- uvd->curframe = -1;
- uvd->stats.frame_num++;
- if (uvd->debug >= 2)
- dev_info(&uvd->dev->dev,
- "%s: Forced test "
- "pattern screen\n",
- __func__);
- return 0;
- } else {
- /* Standard answer: Interrupted! */
- if (uvd->debug >= 2)
- dev_info(&uvd->dev->dev,
- "%s: Interrupted!\n",
- __func__);
- return -EINTR;
- }
- } else {
- /* No signals - we just got new data in dp queue */
- if (uvd->flags & FLAGS_NO_DECODING)
- usbvideo_CollectRawData(uvd, frame);
- else if (VALID_CALLBACK(uvd, processData))
- GET_CALLBACK(uvd, processData)(uvd, frame);
- else
- err("%s: processData not set", __func__);
- }
- } while (frame->frameState == FrameState_Grabbing);
- if (uvd->debug >= 2) {
- dev_info(&uvd->dev->dev,
- "%s: Grabbing done; state=%d. (%lu. bytes)\n",
- __func__, frame->frameState,
- frame->seqRead_Length);
- }
- if (frame->frameState == FrameState_Error) {
- int ret = usbvideo_NewFrame(uvd, frameNum);
- if (ret < 0) {
- err("%s: usbvideo_NewFrame() failed (%d.)", __func__, ret);
- return ret;
- }
- goto redo;
- }
- /* Note that we fall through to meet our destiny below */
- }
- case FrameState_Done:
- /*
- * Do all necessary postprocessing of data prepared in
- * "interrupt" code and the collecting code above. The
- * frame gets marked as FrameState_Done by queue parsing code.
- * This status means that we collected enough data and
- * most likely processed it as we went through. However
- * the data may need postprocessing, such as deinterlacing
- * or picture adjustments implemented in software (horror!)
- *
- * As soon as the frame becomes "final" it gets promoted to
- * FrameState_Done_Hold status where it will remain until the
- * caller consumed all the video data from the frame. Then
- * the empty shell of ex-frame is thrown out for dogs to eat.
- * But we, worried about pets, will recycle the frame!
- */
- uvd->stats.frame_num++;
- if ((uvd->flags & FLAGS_NO_DECODING) == 0) {
- if (VALID_CALLBACK(uvd, postProcess))
- GET_CALLBACK(uvd, postProcess)(uvd, frame);
- if (frame->flags & USBVIDEO_FRAME_FLAG_SOFTWARE_CONTRAST)
- usbvideo_SoftwareContrastAdjustment(uvd, frame);
- }
- frame->frameState = FrameState_Done_Hold;
- if (uvd->debug >= 2)
- dev_info(&uvd->dev->dev,
- "%s: Entered FrameState_Done_Hold state.\n",
- __func__);
- return 0;
-
- case FrameState_Done_Hold:
- /*
- * We stay in this state indefinitely until someone external,
- * like ioctl() or read() call finishes digesting the frame
- * data. Then it will mark the frame as FrameState_Unused and
- * it will be released back into the wild to roam freely.
- */
- if (uvd->debug >= 2)
- dev_info(&uvd->dev->dev,
- "%s: FrameState_Done_Hold state.\n",
- __func__);
- return 0;
- }
-
- /* Catch-all for other cases. We shall not be here. */
- err("%s: Invalid state %d.", __func__, frame->frameState);
- frame->frameState = FrameState_Unused;
- return 0;
-}
-
-/*
- * usbvideo_DeinterlaceFrame()
- *
- * This procedure deinterlaces the given frame. Some cameras produce
- * only half of scanlines - sometimes only even lines, sometimes only
- * odd lines. The deinterlacing method is stored in frame->deinterlace
- * variable.
- *
- * Here we scan the frame vertically and replace missing scanlines with
- * average between surrounding ones - before and after. If we have no
- * line above then we just copy next line. Similarly, if we need to
- * create a last line then preceding line is used.
- */
-void usbvideo_DeinterlaceFrame(struct uvd *uvd, struct usbvideo_frame *frame)
-{
- if ((uvd == NULL) || (frame == NULL))
- return;
-
- if ((frame->deinterlace == Deinterlace_FillEvenLines) ||
- (frame->deinterlace == Deinterlace_FillOddLines)) {
- const int v4l_linesize = VIDEOSIZE_X(frame->request) * V4L_BYTES_PER_PIXEL;
- int i = (frame->deinterlace == Deinterlace_FillEvenLines) ? 0 : 1;
-
- for (; i < VIDEOSIZE_Y(frame->request); i += 2) {
- const unsigned char *fs1, *fs2;
- unsigned char *fd;
- int ip, in, j; /* Previous and next lines */
-
- /*
- * Need to average lines before and after 'i'.
- * If we go out of bounds seeking those lines then
- * we point back to existing line.
- */
- ip = i - 1; /* First, get rough numbers */
- in = i + 1;
-
- /* Now validate */
- if (ip < 0)
- ip = in;
- if (in >= VIDEOSIZE_Y(frame->request))
- in = ip;
-
- /* Sanity check */
- if ((ip < 0) || (in < 0) ||
- (ip >= VIDEOSIZE_Y(frame->request)) ||
- (in >= VIDEOSIZE_Y(frame->request))) {
- err("Error: ip=%d. in=%d. req.height=%ld.",
- ip, in, VIDEOSIZE_Y(frame->request));
- break;
- }
-
- /* Now we need to average lines 'ip' and 'in' to produce line 'i' */
- fs1 = frame->data + (v4l_linesize * ip);
- fs2 = frame->data + (v4l_linesize * in);
- fd = frame->data + (v4l_linesize * i);
-
- /* Average lines around destination */
- for (j = 0; j < v4l_linesize; j++) {
- fd[j] = (unsigned char)((((unsigned) fs1[j]) +
- ((unsigned)fs2[j])) >> 1);
- }
- }
- }
-
- /* Optionally display statistics on the screen */
- if (uvd->flags & FLAGS_OVERLAY_STATS)
- usbvideo_OverlayStats(uvd, frame);
-}
-
-EXPORT_SYMBOL(usbvideo_DeinterlaceFrame);
-
-/*
- * usbvideo_SoftwareContrastAdjustment()
- *
- * This code adjusts the contrast of the frame, assuming RGB24 format.
- * As most software image processing, this job is CPU-intensive.
- * Get a camera that supports hardware adjustment!
- *
- * History:
- * 09-Feb-2001 Created.
- */
-static void usbvideo_SoftwareContrastAdjustment(struct uvd *uvd,
- struct usbvideo_frame *frame)
-{
- int i, j, v4l_linesize;
- signed long adj;
- const int ccm = 128; /* Color correction median - see below */
-
- if ((uvd == NULL) || (frame == NULL)) {
- err("%s: Illegal call.", __func__);
- return;
- }
- adj = (uvd->vpic.contrast - 0x8000) >> 8; /* -128..+127 = -ccm..+(ccm-1)*/
- RESTRICT_TO_RANGE(adj, -ccm, ccm+1);
- if (adj == 0) {
- /* In rare case of no adjustment */
- return;
- }
- v4l_linesize = VIDEOSIZE_X(frame->request) * V4L_BYTES_PER_PIXEL;
- for (i = 0; i < VIDEOSIZE_Y(frame->request); i++) {
- unsigned char *fd = frame->data + (v4l_linesize * i);
- for (j = 0; j < v4l_linesize; j++) {
- signed long v = (signed long) fd[j];
- /* Magnify up to 2 times, reduce down to zero */
- v = 128 + ((ccm + adj) * (v - 128)) / ccm;
- RESTRICT_TO_RANGE(v, 0, 0xFF); /* Must flatten tails */
- fd[j] = (unsigned char) v;
- }
- }
-}
-
-MODULE_LICENSE("GPL");
diff --git a/drivers/staging/usbvideo/usbvideo.h b/drivers/staging/usbvideo/usbvideo.h
deleted file mode 100644
index 95638a072b19..000000000000
--- a/drivers/staging/usbvideo/usbvideo.h
+++ /dev/null
@@ -1,395 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef usbvideo_h
-#define usbvideo_h
-
-#include "videodev.h"
-#include <media/v4l2-common.h>
-#include <media/v4l2-ioctl.h>
-#include <linux/usb.h>
-#include <linux/mutex.h>
-
-/* Most helpful debugging aid */
-#define assert(expr) ((void) ((expr) ? 0 : (err("assert failed at line %d",__LINE__))))
-
-#define USBVIDEO_REPORT_STATS 1 /* Set to 0 to block statistics on close */
-
-/* Bit flags (options) */
-#define FLAGS_RETRY_VIDIOCSYNC (1 << 0)
-#define FLAGS_MONOCHROME (1 << 1)
-#define FLAGS_DISPLAY_HINTS (1 << 2)
-#define FLAGS_OVERLAY_STATS (1 << 3)
-#define FLAGS_FORCE_TESTPATTERN (1 << 4)
-#define FLAGS_SEPARATE_FRAMES (1 << 5)
-#define FLAGS_CLEAN_FRAMES (1 << 6)
-#define FLAGS_NO_DECODING (1 << 7)
-
-/* Bit flags for frames (apply to the frame where they are specified) */
-#define USBVIDEO_FRAME_FLAG_SOFTWARE_CONTRAST (1 << 0)
-
-/* Camera capabilities (maximum) */
-#define CAMERA_URB_FRAMES 32
-#define CAMERA_MAX_ISO_PACKET 1023 /* 1022 actually sent by camera */
-#define FRAMES_PER_DESC (CAMERA_URB_FRAMES)
-#define FRAME_SIZE_PER_DESC (CAMERA_MAX_ISO_PACKET)
-
-/* This macro restricts an int variable to an inclusive range */
-#define RESTRICT_TO_RANGE(v,mi,ma) { if ((v) < (mi)) (v) = (mi); else if ((v) > (ma)) (v) = (ma); }
-
-#define V4L_BYTES_PER_PIXEL 3 /* Because we produce RGB24 */
-
-/*
- * Use this macro to construct constants for different video sizes.
- * We have to deal with different video sizes that have to be
- * configured in the device or compared against when we receive
- * a data. Normally one would define a bunch of VIDEOSIZE_x_by_y
- * #defines and that's the end of story. However this solution
- * does not allow to convert between real pixel sizes and the
- * constant (integer) value that may be used to tag a frame or
- * whatever. The set of macros below constructs videosize constants
- * from the pixel size and allows to reconstruct the pixel size
- * from the combined value later.
- */
-#define VIDEOSIZE(x,y) (((x) & 0xFFFFL) | (((y) & 0xFFFFL) << 16))
-#define VIDEOSIZE_X(vs) ((vs) & 0xFFFFL)
-#define VIDEOSIZE_Y(vs) (((vs) >> 16) & 0xFFFFL)
-typedef unsigned long videosize_t;
-
-/*
- * This macro checks if the camera is still operational. The 'uvd'
- * pointer must be valid, uvd->dev must be valid, we are not
- * removing the device and the device has not erred on us.
- */
-#define CAMERA_IS_OPERATIONAL(uvd) (\
- (uvd != NULL) && \
- ((uvd)->dev != NULL) && \
- ((uvd)->last_error == 0) && \
- (!(uvd)->remove_pending))
-
-/*
- * We use macros to do YUV -> RGB conversion because this is
- * very important for speed and totally unimportant for size.
- *
- * YUV -> RGB Conversion
- * ---------------------
- *
- * B = 1.164*(Y-16) + 2.018*(V-128)
- * G = 1.164*(Y-16) - 0.813*(U-128) - 0.391*(V-128)
- * R = 1.164*(Y-16) + 1.596*(U-128)
- *
- * If you fancy integer arithmetics (as you should), hear this:
- *
- * 65536*B = 76284*(Y-16) + 132252*(V-128)
- * 65536*G = 76284*(Y-16) - 53281*(U-128) - 25625*(V-128)
- * 65536*R = 76284*(Y-16) + 104595*(U-128)
- *
- * Make sure the output values are within [0..255] range.
- */
-#define LIMIT_RGB(x) (((x) < 0) ? 0 : (((x) > 255) ? 255 : (x)))
-#define YUV_TO_RGB_BY_THE_BOOK(my,mu,mv,mr,mg,mb) { \
- int mm_y, mm_yc, mm_u, mm_v, mm_r, mm_g, mm_b; \
- mm_y = (my) - 16; \
- mm_u = (mu) - 128; \
- mm_v = (mv) - 128; \
- mm_yc= mm_y * 76284; \
- mm_b = (mm_yc + 132252*mm_v ) >> 16; \
- mm_g = (mm_yc - 53281*mm_u - 25625*mm_v ) >> 16; \
- mm_r = (mm_yc + 104595*mm_u ) >> 16; \
- mb = LIMIT_RGB(mm_b); \
- mg = LIMIT_RGB(mm_g); \
- mr = LIMIT_RGB(mm_r); \
-}
-
-#define RING_QUEUE_SIZE (128*1024) /* Must be a power of 2 */
-#define RING_QUEUE_ADVANCE_INDEX(rq,ind,n) (rq)->ind = ((rq)->ind + (n)) & ((rq)->length-1)
-#define RING_QUEUE_DEQUEUE_BYTES(rq,n) RING_QUEUE_ADVANCE_INDEX(rq,ri,n)
-#define RING_QUEUE_PEEK(rq,ofs) ((rq)->queue[((ofs) + (rq)->ri) & ((rq)->length-1)])
-
-struct RingQueue {
- unsigned char *queue; /* Data from the Isoc data pump */
- int length; /* How many bytes allocated for the queue */
- int wi; /* That's where we write */
- int ri; /* Read from here until you hit write index */
- wait_queue_head_t wqh; /* Processes waiting */
-};
-
-enum ScanState {
- ScanState_Scanning, /* Scanning for header */
- ScanState_Lines /* Parsing lines */
-};
-
-/* Completion states of the data parser */
-enum ParseState {
- scan_Continue, /* Just parse next item */
- scan_NextFrame, /* Frame done, send it to V4L */
- scan_Out, /* Not enough data for frame */
- scan_EndParse /* End parsing */
-};
-
-enum FrameState {
- FrameState_Unused, /* Unused (no MCAPTURE) */
- FrameState_Ready, /* Ready to start grabbing */
- FrameState_Grabbing, /* In the process of being grabbed into */
- FrameState_Done, /* Finished grabbing, but not been synced yet */
- FrameState_Done_Hold, /* Are syncing or reading */
- FrameState_Error, /* Something bad happened while processing */
-};
-
-/*
- * Some frames may contain only even or odd lines. This type
- * specifies what type of deinterlacing is required.
- */
-enum Deinterlace {
- Deinterlace_None=0,
- Deinterlace_FillOddLines,
- Deinterlace_FillEvenLines
-};
-
-#define USBVIDEO_NUMFRAMES 2 /* How many frames we work with */
-#define USBVIDEO_NUMSBUF 2 /* How many URBs linked in a ring */
-
-/* This structure represents one Isoc request - URB and buffer */
-struct usbvideo_sbuf {
- char *data;
- struct urb *urb;
-};
-
-struct usbvideo_frame {
- char *data; /* Frame buffer */
- unsigned long header; /* Significant bits from the header */
-
- videosize_t canvas; /* The canvas (max. image) allocated */
- videosize_t request; /* That's what the application asked for */
- unsigned short palette; /* The desired format */
-
- enum FrameState frameState;/* State of grabbing */
- enum ScanState scanstate; /* State of scanning */
- enum Deinterlace deinterlace;
- int flags; /* USBVIDEO_FRAME_FLAG_xxx bit flags */
-
- int curline; /* Line of frame we're working on */
-
- long seqRead_Length; /* Raw data length of frame */
- long seqRead_Index; /* Amount of data that has been already read */
-
- void *user; /* Additional data that user may need */
-};
-
-/* Statistics that can be overlaid on screen */
-struct usbvideo_statistics {
- unsigned long frame_num; /* Sequential number of the frame */
- unsigned long urb_count; /* How many URBs we received so far */
- unsigned long urb_length; /* Length of last URB */
- unsigned long data_count; /* How many bytes we received */
- unsigned long header_count; /* How many frame headers we found */
- unsigned long iso_skip_count; /* How many empty ISO packets received */
- unsigned long iso_err_count; /* How many bad ISO packets received */
-};
-
-struct usbvideo;
-
-struct uvd {
- struct video_device vdev; /* Must be the first field! */
- struct usb_device *dev;
- struct usbvideo *handle; /* Points back to the struct usbvideo */
- void *user_data; /* Camera-dependent data */
- int user_size; /* Size of that camera-dependent data */
- int debug; /* Debug level for usbvideo */
- unsigned char iface; /* Video interface number */
- unsigned char video_endp;
- unsigned char ifaceAltActive;
- unsigned char ifaceAltInactive; /* Alt settings */
- unsigned long flags; /* FLAGS_USBVIDEO_xxx */
- unsigned long paletteBits; /* Which palettes we accept? */
- unsigned short defaultPalette; /* What palette to use for read() */
- struct mutex lock;
- int user; /* user count for exclusive use */
-
- videosize_t videosize; /* Current setting */
- videosize_t canvas; /* This is the width,height of the V4L canvas */
- int max_frame_size; /* Bytes in one video frame */
-
- int uvd_used; /* Is this structure in use? */
- int streaming; /* Are we streaming Isochronous? */
- int grabbing; /* Are we grabbing? */
- int settingsAdjusted; /* Have we adjusted contrast etc.? */
- int last_error; /* What calamity struck us? */
-
- char *fbuf; /* Videodev buffer area */
- int fbuf_size; /* Videodev buffer size */
-
- int curframe;
- int iso_packet_len; /* Videomode-dependent, saves bus bandwidth */
-
- struct RingQueue dp; /* Isoc data pump */
- struct usbvideo_frame frame[USBVIDEO_NUMFRAMES];
- struct usbvideo_sbuf sbuf[USBVIDEO_NUMSBUF];
-
- volatile int remove_pending; /* If set then about to exit */
-
- struct video_picture vpic, vpic_old; /* Picture settings */
- struct video_capability vcap; /* Video capabilities */
- struct video_channel vchan; /* May be used for tuner support */
- struct usbvideo_statistics stats;
- char videoName[32]; /* Holds name like "video7" */
-};
-
-/*
- * usbvideo callbacks (virtual methods). They are set when usbvideo
- * services are registered. All of these default to NULL, except those
- * that default to usbvideo-provided methods.
- */
-struct usbvideo_cb {
- int (*probe)(struct usb_interface *, const struct usb_device_id *);
- void (*userFree)(struct uvd *);
- void (*disconnect)(struct usb_interface *);
- int (*setupOnOpen)(struct uvd *);
- void (*videoStart)(struct uvd *);
- void (*videoStop)(struct uvd *);
- void (*processData)(struct uvd *, struct usbvideo_frame *);
- void (*postProcess)(struct uvd *, struct usbvideo_frame *);
- void (*adjustPicture)(struct uvd *);
- int (*getFPS)(struct uvd *);
- int (*overlayHook)(struct uvd *, struct usbvideo_frame *);
- int (*getFrame)(struct uvd *, int);
- int (*startDataPump)(struct uvd *uvd);
- void (*stopDataPump)(struct uvd *uvd);
- int (*setVideoMode)(struct uvd *uvd, struct video_window *vw);
-};
-
-struct usbvideo {
- int num_cameras; /* As allocated */
- struct usb_driver usbdrv; /* Interface to the USB stack */
- char drvName[80]; /* Driver name */
- struct mutex lock; /* Mutex protecting camera structures */
- struct usbvideo_cb cb; /* Table of callbacks (virtual methods) */
- struct video_device vdt; /* Video device template */
- struct uvd *cam; /* Array of camera structures */
- struct module *md_module; /* Minidriver module */
-};
-
-
-/*
- * This macro retrieves callback address from the struct uvd object.
- * No validity checks are done here, so be sure to check the
- * callback beforehand with VALID_CALLBACK.
- */
-#define GET_CALLBACK(uvd,cbName) ((uvd)->handle->cb.cbName)
-
-/*
- * This macro returns either callback pointer or NULL. This is safe
- * macro, meaning that most of components of data structures involved
- * may be NULL - this only results in NULL being returned. You may
- * wish to use this macro to make sure that the callback is callable.
- * However keep in mind that those checks take time.
- */
-#define VALID_CALLBACK(uvd,cbName) ((((uvd) != NULL) && \
- ((uvd)->handle != NULL)) ? GET_CALLBACK(uvd,cbName) : NULL)
-
-int RingQueue_Dequeue(struct RingQueue *rq, unsigned char *dst, int len);
-int RingQueue_Enqueue(struct RingQueue *rq, const unsigned char *cdata, int n);
-void RingQueue_WakeUpInterruptible(struct RingQueue *rq);
-void RingQueue_Flush(struct RingQueue *rq);
-
-static inline int RingQueue_GetLength(const struct RingQueue *rq)
-{
- return (rq->wi - rq->ri + rq->length) & (rq->length-1);
-}
-
-static inline int RingQueue_GetFreeSpace(const struct RingQueue *rq)
-{
- return rq->length - RingQueue_GetLength(rq);
-}
-
-void usbvideo_DrawLine(
- struct usbvideo_frame *frame,
- int x1, int y1,
- int x2, int y2,
- unsigned char cr, unsigned char cg, unsigned char cb);
-void usbvideo_HexDump(const unsigned char *data, int len);
-void usbvideo_SayAndWait(const char *what);
-void usbvideo_TestPattern(struct uvd *uvd, int fullframe, int pmode);
-
-/* Memory allocation routines */
-unsigned long usbvideo_kvirt_to_pa(unsigned long adr);
-
-int usbvideo_register(
- struct usbvideo **pCams,
- const int num_cams,
- const int num_extra,
- const char *driverName,
- const struct usbvideo_cb *cbTable,
- struct module *md,
- const struct usb_device_id *id_table);
-struct uvd *usbvideo_AllocateDevice(struct usbvideo *cams);
-int usbvideo_RegisterVideoDevice(struct uvd *uvd);
-void usbvideo_Deregister(struct usbvideo **uvt);
-
-int usbvideo_v4l_initialize(struct video_device *dev);
-
-void usbvideo_DeinterlaceFrame(struct uvd *uvd, struct usbvideo_frame *frame);
-
-/*
- * This code performs bounds checking - use it when working with
- * new formats, or else you may get oopses all over the place.
- * If pixel falls out of bounds then it gets shoved back (as close
- * to place of offence as possible) and is painted bright red.
- *
- * There are two important concepts: frame width, height and
- * V4L canvas width, height. The former is the area requested by
- * the application -for this very frame-. The latter is the largest
- * possible frame that we can serve (we advertise that via V4L ioctl).
- * The frame data is expected to be formatted as lines of length
- * VIDEOSIZE_X(fr->request), total VIDEOSIZE_Y(frame->request) lines.
- */
-static inline void RGB24_PUTPIXEL(
- struct usbvideo_frame *fr,
- int ix, int iy,
- unsigned char vr,
- unsigned char vg,
- unsigned char vb)
-{
- register unsigned char *pf;
- int limiter = 0, mx, my;
- mx = ix;
- my = iy;
- if (mx < 0) {
- mx=0;
- limiter++;
- } else if (mx >= VIDEOSIZE_X((fr)->request)) {
- mx= VIDEOSIZE_X((fr)->request) - 1;
- limiter++;
- }
- if (my < 0) {
- my = 0;
- limiter++;
- } else if (my >= VIDEOSIZE_Y((fr)->request)) {
- my = VIDEOSIZE_Y((fr)->request) - 1;
- limiter++;
- }
- pf = (fr)->data + V4L_BYTES_PER_PIXEL*((iy)*VIDEOSIZE_X((fr)->request) + (ix));
- if (limiter) {
- *pf++ = 0;
- *pf++ = 0;
- *pf++ = 0xFF;
- } else {
- *pf++ = (vb);
- *pf++ = (vg);
- *pf++ = (vr);
- }
-}
-
-#endif /* usbvideo_h */
diff --git a/drivers/staging/usbvideo/vicam.c b/drivers/staging/usbvideo/vicam.c
deleted file mode 100644
index 38a373a8d077..000000000000
--- a/drivers/staging/usbvideo/vicam.c
+++ /dev/null
@@ -1,946 +0,0 @@
-/*
- * USB ViCam WebCam driver
- * Copyright (c) 2002 Joe Burks (jburks@wavicle.org),
- * Christopher L Cheney (ccheney@cheney.cx),
- * Pavel Machek (pavel@ucw.cz),
- * John Tyner (jtyner@cs.ucr.edu),
- * Monroe Williams (monroe@pobox.com)
- *
- * Supports 3COM HomeConnect PC Digital WebCam
- * Supports Compro PS39U WebCam
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * This source code is based heavily on the CPiA webcam driver which was
- * written by Peter Pregler, Scott J. Bertin and Johannes Erdfelt
- *
- * Portions of this code were also copied from usbvideo.c
- *
- * Special thanks to the whole team at Sourceforge for help making
- * this driver become a reality. Notably:
- * Andy Armstrong who reverse engineered the color encoding and
- * Pavel Machek and Chris Cheney who worked on reverse engineering the
- * camera controls and wrote the first generation driver.
- */
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/init.h>
-#include "videodev.h"
-#include <linux/usb.h>
-#include <linux/vmalloc.h>
-#include <linux/mm.h>
-#include <linux/slab.h>
-#include <linux/mutex.h>
-#include <linux/firmware.h>
-#include <linux/ihex.h>
-#include "usbvideo.h"
-
-/* #define VICAM_DEBUG */
-
-#ifdef VICAM_DEBUG
-#define ADBG(lineno, fmt, args...) printk(fmt, jiffies, __func__, lineno, ##args)
-#define DBG(fmt, args...) ADBG((__LINE__), KERN_DEBUG __FILE__"(%ld):%s (%d):"fmt, ##args)
-#else
-#define DBG(fmn, args...) do {} while (0)
-#endif
-
-#define DRIVER_AUTHOR "Joe Burks, jburks@wavicle.org"
-#define DRIVER_DESC "ViCam WebCam Driver"
-
-/* Define these values to match your device */
-#define USB_VICAM_VENDOR_ID 0x04c1
-#define USB_VICAM_PRODUCT_ID 0x009d
-#define USB_COMPRO_VENDOR_ID 0x0602
-#define USB_COMPRO_PRODUCT_ID 0x1001
-
-#define VICAM_BYTES_PER_PIXEL 3
-#define VICAM_MAX_READ_SIZE (512*242+128)
-#define VICAM_MAX_FRAME_SIZE (VICAM_BYTES_PER_PIXEL*320*240)
-#define VICAM_FRAMES 2
-
-#define VICAM_HEADER_SIZE 64
-
-/* rvmalloc / rvfree copied from usbvideo.c
- *
- * Not sure why these are not yet non-statics which I can reference through
- * usbvideo.h the same as it is in 2.4.20. I bet this will get fixed sometime
- * in the future.
- *
-*/
-static void *rvmalloc(unsigned long size)
-{
- void *mem;
- unsigned long adr;
-
- size = PAGE_ALIGN(size);
- mem = vmalloc_32(size);
- if (!mem)
- return NULL;
-
- memset(mem, 0, size); /* Clear the ram out, no junk to the user */
- adr = (unsigned long) mem;
- while (size > 0) {
- SetPageReserved(vmalloc_to_page((void *)adr));
- adr += PAGE_SIZE;
- size -= PAGE_SIZE;
- }
-
- return mem;
-}
-
-static void rvfree(void *mem, unsigned long size)
-{
- unsigned long adr;
-
- if (!mem)
- return;
-
- adr = (unsigned long) mem;
- while ((long) size > 0) {
- ClearPageReserved(vmalloc_to_page((void *)adr));
- adr += PAGE_SIZE;
- size -= PAGE_SIZE;
- }
- vfree(mem);
-}
-
-struct vicam_camera {
- u16 shutter_speed; /* capture shutter speed */
- u16 gain; /* capture gain */
-
- u8 *raw_image; /* raw data captured from the camera */
- u8 *framebuf; /* processed data in RGB24 format */
- u8 *cntrlbuf; /* area used to send control msgs */
-
- struct video_device vdev; /* v4l video device */
- struct usb_device *udev; /* usb device */
-
- /* guard against simultaneous accesses to the camera */
- struct mutex cam_lock;
-
- int is_initialized;
- u8 open_count;
- u8 bulkEndpoint;
- int needsDummyRead;
-};
-
-static int vicam_probe(struct usb_interface *intf, const struct usb_device_id *id);
-static void vicam_disconnect(struct usb_interface *intf);
-static void read_frame(struct vicam_camera *cam, int framenum);
-static void vicam_decode_color(const u8 *, u8 *);
-
-static int __send_control_msg(struct vicam_camera *cam,
- u8 request,
- u16 value,
- u16 index,
- unsigned char *cp,
- u16 size)
-{
- int status;
-
- /* cp must be memory that has been allocated by kmalloc */
-
- status = usb_control_msg(cam->udev,
- usb_sndctrlpipe(cam->udev, 0),
- request,
- USB_DIR_OUT | USB_TYPE_VENDOR |
- USB_RECIP_DEVICE, value, index,
- cp, size, 1000);
-
- status = min(status, 0);
-
- if (status < 0) {
- printk(KERN_INFO "Failed sending control message, error %d.\n",
- status);
- }
-
- return status;
-}
-
-static int send_control_msg(struct vicam_camera *cam,
- u8 request,
- u16 value,
- u16 index,
- unsigned char *cp,
- u16 size)
-{
- int status = -ENODEV;
- mutex_lock(&cam->cam_lock);
- if (cam->udev) {
- status = __send_control_msg(cam, request, value,
- index, cp, size);
- }
- mutex_unlock(&cam->cam_lock);
- return status;
-}
-static int
-initialize_camera(struct vicam_camera *cam)
-{
- int err;
- const struct ihex_binrec *rec;
- const struct firmware *uninitialized_var(fw);
-
- err = request_ihex_firmware(&fw, "vicam/firmware.fw", &cam->udev->dev);
- if (err) {
- printk(KERN_ERR "Failed to load \"vicam/firmware.fw\": %d\n",
- err);
- return err;
- }
-
- for (rec = (void *)fw->data; rec; rec = ihex_next_binrec(rec)) {
- memcpy(cam->cntrlbuf, rec->data, be16_to_cpu(rec->len));
-
- err = send_control_msg(cam, 0xff, 0, 0,
- cam->cntrlbuf, be16_to_cpu(rec->len));
- if (err)
- break;
- }
-
- release_firmware(fw);
-
- return err;
-}
-
-static int
-set_camera_power(struct vicam_camera *cam, int state)
-{
- int status;
-
- status = send_control_msg(cam, 0x50, state, 0, NULL, 0);
- if (status < 0)
- return status;
-
- if (state)
- send_control_msg(cam, 0x55, 1, 0, NULL, 0);
-
- return 0;
-}
-
-static long
-vicam_ioctl(struct file *file, unsigned int ioctlnr, unsigned long arg)
-{
- void __user *user_arg = (void __user *)arg;
- struct vicam_camera *cam = file->private_data;
- long retval = 0;
-
- if (!cam)
- return -ENODEV;
-
- switch (ioctlnr) {
- /* query capabilities */
- case VIDIOCGCAP:
- {
- struct video_capability b;
-
- DBG("VIDIOCGCAP\n");
- memset(&b, 0, sizeof(b));
- strcpy(b.name, "ViCam-based Camera");
- b.type = VID_TYPE_CAPTURE;
- b.channels = 1;
- b.audios = 0;
- b.maxwidth = 320; /* VIDEOSIZE_CIF */
- b.maxheight = 240;
- b.minwidth = 320; /* VIDEOSIZE_48_48 */
- b.minheight = 240;
-
- if (copy_to_user(user_arg, &b, sizeof(b)))
- retval = -EFAULT;
-
- break;
- }
- /* get/set video source - we are a camera and nothing else */
- case VIDIOCGCHAN:
- {
- struct video_channel v;
-
- DBG("VIDIOCGCHAN\n");
- if (copy_from_user(&v, user_arg, sizeof(v))) {
- retval = -EFAULT;
- break;
- }
- if (v.channel != 0) {
- retval = -EINVAL;
- break;
- }
-
- v.channel = 0;
- strcpy(v.name, "Camera");
- v.tuners = 0;
- v.flags = 0;
- v.type = VIDEO_TYPE_CAMERA;
- v.norm = 0;
-
- if (copy_to_user(user_arg, &v, sizeof(v)))
- retval = -EFAULT;
- break;
- }
-
- case VIDIOCSCHAN:
- {
- int v;
-
- if (copy_from_user(&v, user_arg, sizeof(v)))
- retval = -EFAULT;
- DBG("VIDIOCSCHAN %d\n", v);
-
- if (retval == 0 && v != 0)
- retval = -EINVAL;
-
- break;
- }
-
- /* image properties */
- case VIDIOCGPICT:
- {
- struct video_picture vp;
- DBG("VIDIOCGPICT\n");
- memset(&vp, 0, sizeof(struct video_picture));
- vp.brightness = cam->gain << 8;
- vp.depth = 24;
- vp.palette = VIDEO_PALETTE_RGB24;
- if (copy_to_user(user_arg, &vp, sizeof(struct video_picture)))
- retval = -EFAULT;
- break;
- }
-
- case VIDIOCSPICT:
- {
- struct video_picture vp;
-
- if (copy_from_user(&vp, user_arg, sizeof(vp))) {
- retval = -EFAULT;
- break;
- }
-
- DBG("VIDIOCSPICT depth = %d, pal = %d\n", vp.depth,
- vp.palette);
-
- cam->gain = vp.brightness >> 8;
-
- if (vp.depth != 24
- || vp.palette != VIDEO_PALETTE_RGB24)
- retval = -EINVAL;
-
- break;
- }
-
- /* get/set capture window */
- case VIDIOCGWIN:
- {
- struct video_window vw;
- vw.x = 0;
- vw.y = 0;
- vw.width = 320;
- vw.height = 240;
- vw.chromakey = 0;
- vw.flags = 0;
- vw.clips = NULL;
- vw.clipcount = 0;
-
- DBG("VIDIOCGWIN\n");
-
- if (copy_to_user(user_arg, (void *)&vw, sizeof(vw)))
- retval = -EFAULT;
-
- /* I'm not sure what the deal with a capture window is, it is very poorly described
- * in the doc. So I won't support it now. */
- break;
- }
-
- case VIDIOCSWIN:
- {
-
- struct video_window vw;
-
- if (copy_from_user(&vw, user_arg, sizeof(vw))) {
- retval = -EFAULT;
- break;
- }
-
- DBG("VIDIOCSWIN %d x %d\n", vw.width, vw.height);
-
- if (vw.width != 320 || vw.height != 240)
- retval = -EFAULT;
-
- break;
- }
-
- /* mmap interface */
- case VIDIOCGMBUF:
- {
- struct video_mbuf vm;
- int i;
-
- DBG("VIDIOCGMBUF\n");
- memset(&vm, 0, sizeof(vm));
- vm.size =
- VICAM_MAX_FRAME_SIZE * VICAM_FRAMES;
- vm.frames = VICAM_FRAMES;
- for (i = 0; i < VICAM_FRAMES; i++)
- vm.offsets[i] = VICAM_MAX_FRAME_SIZE * i;
-
- if (copy_to_user(user_arg, (void *)&vm, sizeof(vm)))
- retval = -EFAULT;
-
- break;
- }
-
- case VIDIOCMCAPTURE:
- {
- struct video_mmap vm;
- /* int video_size; */
-
- if (copy_from_user((void *)&vm, user_arg, sizeof(vm))) {
- retval = -EFAULT;
- break;
- }
-
- DBG("VIDIOCMCAPTURE frame=%d, height=%d, width=%d, format=%d.\n",
- vm.frame, vm.width, vm.height, vm.format);
-
- if (vm.frame >= VICAM_FRAMES || vm.format != VIDEO_PALETTE_RGB24)
- retval = -EINVAL;
-
- /* in theory right here we'd start the image capturing
- * (fill in a bulk urb and submit it asynchronously)
- *
- * Instead we're going to do a total hack job for now and
- * retrieve the frame in VIDIOCSYNC */
-
- break;
- }
-
- case VIDIOCSYNC:
- {
- int frame;
-
- if (copy_from_user((void *)&frame, user_arg, sizeof(int))) {
- retval = -EFAULT;
- break;
- }
- DBG("VIDIOCSYNC: %d\n", frame);
-
- read_frame(cam, frame);
- vicam_decode_color(cam->raw_image,
- cam->framebuf +
- frame * VICAM_MAX_FRAME_SIZE);
-
- break;
- }
-
- /* pointless to implement overlay with this camera */
- case VIDIOCCAPTURE:
- case VIDIOCGFBUF:
- case VIDIOCSFBUF:
- case VIDIOCKEY:
- retval = -EINVAL;
- break;
-
- /* tuner interface - we have none */
- case VIDIOCGTUNER:
- case VIDIOCSTUNER:
- case VIDIOCGFREQ:
- case VIDIOCSFREQ:
- retval = -EINVAL;
- break;
-
- /* audio interface - we have none */
- case VIDIOCGAUDIO:
- case VIDIOCSAUDIO:
- retval = -EINVAL;
- break;
- default:
- retval = -ENOIOCTLCMD;
- break;
- }
-
- return retval;
-}
-
-static int
-vicam_open(struct file *file)
-{
- struct vicam_camera *cam = video_drvdata(file);
-
- DBG("open\n");
-
- if (!cam) {
- printk(KERN_ERR
- "vicam video_device improperly initialized");
- return -EINVAL;
- }
-
- /* cam_lock/open_count protects us from simultaneous opens
- * ... for now. we probably shouldn't rely on this fact forever.
- */
-
- mutex_lock(&cam->cam_lock);
- if (cam->open_count > 0) {
- printk(KERN_INFO
- "vicam_open called on already opened camera");
- mutex_unlock(&cam->cam_lock);
- return -EBUSY;
- }
-
- cam->raw_image = kmalloc(VICAM_MAX_READ_SIZE, GFP_KERNEL);
- if (!cam->raw_image) {
- mutex_unlock(&cam->cam_lock);
- return -ENOMEM;
- }
-
- cam->framebuf = rvmalloc(VICAM_MAX_FRAME_SIZE * VICAM_FRAMES);
- if (!cam->framebuf) {
- kfree(cam->raw_image);
- mutex_unlock(&cam->cam_lock);
- return -ENOMEM;
- }
-
- cam->cntrlbuf = kmalloc(PAGE_SIZE, GFP_KERNEL);
- if (!cam->cntrlbuf) {
- kfree(cam->raw_image);
- rvfree(cam->framebuf, VICAM_MAX_FRAME_SIZE * VICAM_FRAMES);
- mutex_unlock(&cam->cam_lock);
- return -ENOMEM;
- }
-
- cam->needsDummyRead = 1;
- cam->open_count++;
-
- file->private_data = cam;
- mutex_unlock(&cam->cam_lock);
-
-
- /* First upload firmware, then turn the camera on */
-
- if (!cam->is_initialized) {
- initialize_camera(cam);
-
- cam->is_initialized = 1;
- }
-
- set_camera_power(cam, 1);
-
- return 0;
-}
-
-static int
-vicam_close(struct file *file)
-{
- struct vicam_camera *cam = file->private_data;
- int open_count;
- struct usb_device *udev;
-
- DBG("close\n");
-
- /* it's not the end of the world if
- * we fail to turn the camera off.
- */
-
- set_camera_power(cam, 0);
-
- kfree(cam->raw_image);
- rvfree(cam->framebuf, VICAM_MAX_FRAME_SIZE * VICAM_FRAMES);
- kfree(cam->cntrlbuf);
-
- mutex_lock(&cam->cam_lock);
-
- cam->open_count--;
- open_count = cam->open_count;
- udev = cam->udev;
-
- mutex_unlock(&cam->cam_lock);
-
- if (!open_count && !udev)
- kfree(cam);
-
- return 0;
-}
-
-static void vicam_decode_color(const u8 *data, u8 *rgb)
-{
- /* vicam_decode_color - Convert from Vicam Y-Cr-Cb to RGB
- * Copyright (C) 2002 Monroe Williams (monroe@pobox.com)
- */
-
- int i, prevY, nextY;
-
- prevY = 512;
- nextY = 512;
-
- data += VICAM_HEADER_SIZE;
-
- for (i = 0; i < 240; i++, data += 512) {
- const int y = (i * 242) / 240;
-
- int j, prevX, nextX;
- int Y, Cr, Cb;
-
- if (y == 242 - 1)
- nextY = -512;
-
- prevX = 1;
- nextX = 1;
-
- for (j = 0; j < 320; j++, rgb += 3) {
- const int x = (j * 512) / 320;
- const u8 * const src = &data[x];
-
- if (x == 512 - 1)
- nextX = -1;
-
- Cr = (src[prevX] - src[0]) +
- (src[nextX] - src[0]);
- Cr /= 2;
-
- Cb = (src[prevY] - src[prevX + prevY]) +
- (src[prevY] - src[nextX + prevY]) +
- (src[nextY] - src[prevX + nextY]) +
- (src[nextY] - src[nextX + nextY]);
- Cb /= 4;
-
- Y = 1160 * (src[0] + (Cr / 2) - 16);
-
- if (i & 1) {
- int Ct = Cr;
- Cr = Cb;
- Cb = Ct;
- }
-
- if ((x ^ i) & 1) {
- Cr = -Cr;
- Cb = -Cb;
- }
-
- rgb[0] = clamp(((Y + (2017 * Cb)) +
- 500) / 900, 0, 255);
- rgb[1] = clamp(((Y - (392 * Cb) -
- (813 * Cr)) +
- 500) / 1000, 0, 255);
- rgb[2] = clamp(((Y + (1594 * Cr)) +
- 500) / 1300, 0, 255);
-
- prevX = -1;
- }
-
- prevY = -512;
- }
-}
-
-static void
-read_frame(struct vicam_camera *cam, int framenum)
-{
- unsigned char *request = cam->cntrlbuf;
- int realShutter;
- int n;
- int actual_length;
-
- if (cam->needsDummyRead) {
- cam->needsDummyRead = 0;
- read_frame(cam, framenum);
- }
-
- memset(request, 0, 16);
- request[0] = cam->gain; /* 0 = 0% gain, FF = 100% gain */
-
- request[1] = 0; /* 512x242 capture */
-
- request[2] = 0x90; /* the function of these two bytes */
- request[3] = 0x07; /* is not yet understood */
-
- if (cam->shutter_speed > 60) {
- /* Short exposure */
- realShutter =
- ((-15631900 / cam->shutter_speed) + 260533) / 1000;
- request[4] = realShutter & 0xFF;
- request[5] = (realShutter >> 8) & 0xFF;
- request[6] = 0x03;
- request[7] = 0x01;
- } else {
- /* Long exposure */
- realShutter = 15600 / cam->shutter_speed - 1;
- request[4] = 0;
- request[5] = 0;
- request[6] = realShutter & 0xFF;
- request[7] = realShutter >> 8;
- }
-
- /* Per John Markus Bjørndalen, byte at index 8 causes problems if it isn't 0*/
- request[8] = 0;
- /* bytes 9-15 do not seem to affect exposure or image quality */
-
- mutex_lock(&cam->cam_lock);
-
- if (!cam->udev)
- goto done;
-
- n = __send_control_msg(cam, 0x51, 0x80, 0, request, 16);
-
- if (n < 0) {
- printk(KERN_ERR
- " Problem sending frame capture control message");
- goto done;
- }
-
- n = usb_bulk_msg(cam->udev,
- usb_rcvbulkpipe(cam->udev, cam->bulkEndpoint),
- cam->raw_image,
- 512 * 242 + 128, &actual_length, 10000);
-
- if (n < 0) {
- printk(KERN_ERR "Problem during bulk read of frame data: %d\n",
- n);
- }
-
- done:
- mutex_unlock(&cam->cam_lock);
-}
-
-static ssize_t
-vicam_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
-{
- struct vicam_camera *cam = file->private_data;
-
- DBG("read %d bytes.\n", (int) count);
-
- if (*ppos >= VICAM_MAX_FRAME_SIZE) {
- *ppos = 0;
- return 0;
- }
-
- if (*ppos == 0) {
- read_frame(cam, 0);
- vicam_decode_color(cam->raw_image,
- cam->framebuf +
- 0 * VICAM_MAX_FRAME_SIZE);
- }
-
- count = min_t(size_t, count, VICAM_MAX_FRAME_SIZE - *ppos);
-
- if (copy_to_user(buf, &cam->framebuf[*ppos], count))
- count = -EFAULT;
- else
- *ppos += count;
-
- if (count == VICAM_MAX_FRAME_SIZE)
- *ppos = 0;
-
- return count;
-}
-
-
-static int
-vicam_mmap(struct file *file, struct vm_area_struct *vma)
-{
- /* TODO: allocate the raw frame buffer if necessary */
- unsigned long page, pos;
- unsigned long start = vma->vm_start;
- unsigned long size = vma->vm_end-vma->vm_start;
- struct vicam_camera *cam = file->private_data;
-
- if (!cam)
- return -ENODEV;
-
- DBG("vicam_mmap: %ld\n", size);
-
- /* We let mmap allocate as much as it wants because Linux was adding 2048 bytes
- * to the size the application requested for mmap and it was screwing apps up.
- if (size > VICAM_FRAMES*VICAM_MAX_FRAME_SIZE)
- return -EINVAL;
- */
-
- pos = (unsigned long)cam->framebuf;
- while (size > 0) {
- page = vmalloc_to_pfn((void *)pos);
- if (remap_pfn_range(vma, start, page, PAGE_SIZE, PAGE_SHARED))
- return -EAGAIN;
-
- start += PAGE_SIZE;
- pos += PAGE_SIZE;
- if (size > PAGE_SIZE)
- size -= PAGE_SIZE;
- else
- size = 0;
- }
-
- return 0;
-}
-
-static const struct v4l2_file_operations vicam_fops = {
- .owner = THIS_MODULE,
- .open = vicam_open,
- .release = vicam_close,
- .read = vicam_read,
- .mmap = vicam_mmap,
- .ioctl = vicam_ioctl,
-};
-
-static struct video_device vicam_template = {
- .name = "ViCam-based USB Camera",
- .fops = &vicam_fops,
- .release = video_device_release_empty,
-};
-
-/* table of devices that work with this driver */
-static struct usb_device_id vicam_table[] = {
- {USB_DEVICE(USB_VICAM_VENDOR_ID, USB_VICAM_PRODUCT_ID)},
- {USB_DEVICE(USB_COMPRO_VENDOR_ID, USB_COMPRO_PRODUCT_ID)},
- {} /* Terminating entry */
-};
-
-MODULE_DEVICE_TABLE(usb, vicam_table);
-
-static struct usb_driver vicam_driver = {
- .name = "vicam",
- .probe = vicam_probe,
- .disconnect = vicam_disconnect,
- .id_table = vicam_table
-};
-
-/**
- * vicam_probe
- * @intf: the interface
- * @id: the device id
- *
- * Called by the usb core when a new device is connected that it thinks
- * this driver might be interested in.
- */
-static int
-vicam_probe(struct usb_interface *intf, const struct usb_device_id *id)
-{
- struct usb_device *dev = interface_to_usbdev(intf);
- int bulkEndpoint = 0;
- const struct usb_host_interface *interface;
- const struct usb_endpoint_descriptor *endpoint;
- struct vicam_camera *cam;
-
- printk(KERN_INFO "ViCam based webcam connected\n");
-
- interface = intf->cur_altsetting;
-
- DBG(KERN_DEBUG "Interface %d. has %u. endpoints!\n",
- interface->desc.bInterfaceNumber, (unsigned) (interface->desc.bNumEndpoints));
- endpoint = &interface->endpoint[0].desc;
-
- if (usb_endpoint_is_bulk_in(endpoint)) {
- /* we found a bulk in endpoint */
- bulkEndpoint = endpoint->bEndpointAddress;
- } else {
- printk(KERN_ERR
- "No bulk in endpoint was found ?! (this is bad)\n");
- }
-
- cam = kzalloc(sizeof(struct vicam_camera), GFP_KERNEL);
- if (cam == NULL) {
- printk(KERN_WARNING
- "could not allocate kernel memory for vicam_camera struct\n");
- return -ENOMEM;
- }
-
-
- cam->shutter_speed = 15;
-
- mutex_init(&cam->cam_lock);
-
- memcpy(&cam->vdev, &vicam_template, sizeof(vicam_template));
- video_set_drvdata(&cam->vdev, cam);
-
- cam->udev = dev;
- cam->bulkEndpoint = bulkEndpoint;
-
- if (video_register_device(&cam->vdev, VFL_TYPE_GRABBER, -1) < 0) {
- kfree(cam);
- printk(KERN_WARNING "video_register_device failed\n");
- return -EIO;
- }
-
- printk(KERN_INFO "ViCam webcam driver now controlling device %s\n",
- video_device_node_name(&cam->vdev));
-
- usb_set_intfdata(intf, cam);
-
- return 0;
-}
-
-static void
-vicam_disconnect(struct usb_interface *intf)
-{
- int open_count;
- struct vicam_camera *cam = usb_get_intfdata(intf);
- usb_set_intfdata(intf, NULL);
-
- /* we must unregister the device before taking its
- * cam_lock. This is because the video open call
- * holds the same lock as video unregister. if we
- * unregister inside of the cam_lock and open also
- * uses the cam_lock, we get deadlock.
- */
-
- video_unregister_device(&cam->vdev);
-
- /* stop the camera from being used */
-
- mutex_lock(&cam->cam_lock);
-
- /* mark the camera as gone */
-
- cam->udev = NULL;
-
- /* the only thing left to do is synchronize with
- * our close/release function on who should release
- * the camera memory. if there are any users using the
- * camera, it's their job. if there are no users,
- * it's ours.
- */
-
- open_count = cam->open_count;
-
- mutex_unlock(&cam->cam_lock);
-
- if (!open_count)
- kfree(cam);
-
- printk(KERN_DEBUG "ViCam-based WebCam disconnected\n");
-}
-
-/*
- */
-static int __init
-usb_vicam_init(void)
-{
- int retval;
- DBG(KERN_INFO "ViCam-based WebCam driver startup\n");
- retval = usb_register(&vicam_driver);
- if (retval)
- printk(KERN_WARNING "usb_register failed!\n");
- return retval;
-}
-
-static void __exit
-usb_vicam_exit(void)
-{
- DBG(KERN_INFO
- "ViCam-based WebCam driver shutdown\n");
-
- usb_deregister(&vicam_driver);
-}
-
-module_init(usb_vicam_init);
-module_exit(usb_vicam_exit);
-
-MODULE_AUTHOR(DRIVER_AUTHOR);
-MODULE_DESCRIPTION(DRIVER_DESC);
-MODULE_LICENSE("GPL");
-MODULE_FIRMWARE("vicam/firmware.fw");
diff --git a/drivers/staging/usbvideo/videodev.h b/drivers/staging/usbvideo/videodev.h
deleted file mode 100644
index f11efbef1c05..000000000000
--- a/drivers/staging/usbvideo/videodev.h
+++ /dev/null
@@ -1,318 +0,0 @@
-/*
- * Video for Linux version 1 - OBSOLETE
- *
- * Header file for v4l1 drivers and applications, for
- * Linux kernels 2.2.x or 2.4.x.
- *
- * Provides header for legacy drivers and applications
- *
- * See http://linuxtv.org for more info
- *
- */
-#ifndef __LINUX_VIDEODEV_H
-#define __LINUX_VIDEODEV_H
-
-#include <linux/types.h>
-#include <linux/ioctl.h>
-#include <linux/videodev2.h>
-
-#define VID_TYPE_CAPTURE 1 /* Can capture */
-#define VID_TYPE_TUNER 2 /* Can tune */
-#define VID_TYPE_TELETEXT 4 /* Does teletext */
-#define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */
-#define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */
-#define VID_TYPE_CLIPPING 32 /* Can clip */
-#define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */
-#define VID_TYPE_SCALES 128 /* Scalable */
-#define VID_TYPE_MONOCHROME 256 /* Monochrome only */
-#define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */
-#define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */
-#define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */
-#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */
-#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */
-
-struct video_capability
-{
- char name[32];
- int type;
- int channels; /* Num channels */
- int audios; /* Num audio devices */
- int maxwidth; /* Supported width */
- int maxheight; /* And height */
- int minwidth; /* Supported width */
- int minheight; /* And height */
-};
-
-
-struct video_channel
-{
- int channel;
- char name[32];
- int tuners;
- __u32 flags;
-#define VIDEO_VC_TUNER 1 /* Channel has a tuner */
-#define VIDEO_VC_AUDIO 2 /* Channel has audio */
- __u16 type;
-#define VIDEO_TYPE_TV 1
-#define VIDEO_TYPE_CAMERA 2
- __u16 norm; /* Norm set by channel */
-};
-
-struct video_tuner
-{
- int tuner;
- char name[32];
- unsigned long rangelow, rangehigh; /* Tuner range */
- __u32 flags;
-#define VIDEO_TUNER_PAL 1
-#define VIDEO_TUNER_NTSC 2
-#define VIDEO_TUNER_SECAM 4
-#define VIDEO_TUNER_LOW 8 /* Uses KHz not MHz */
-#define VIDEO_TUNER_NORM 16 /* Tuner can set norm */
-#define VIDEO_TUNER_STEREO_ON 128 /* Tuner is seeing stereo */
-#define VIDEO_TUNER_RDS_ON 256 /* Tuner is seeing an RDS datastream */
-#define VIDEO_TUNER_MBS_ON 512 /* Tuner is seeing an MBS datastream */
- __u16 mode; /* PAL/NTSC/SECAM/OTHER */
-#define VIDEO_MODE_PAL 0
-#define VIDEO_MODE_NTSC 1
-#define VIDEO_MODE_SECAM 2
-#define VIDEO_MODE_AUTO 3
- __u16 signal; /* Signal strength 16bit scale */
-};
-
-struct video_picture
-{
- __u16 brightness;
- __u16 hue;
- __u16 colour;
- __u16 contrast;
- __u16 whiteness; /* Black and white only */
- __u16 depth; /* Capture depth */
- __u16 palette; /* Palette in use */
-#define VIDEO_PALETTE_GREY 1 /* Linear greyscale */
-#define VIDEO_PALETTE_HI240 2 /* High 240 cube (BT848) */
-#define VIDEO_PALETTE_RGB565 3 /* 565 16 bit RGB */
-#define VIDEO_PALETTE_RGB24 4 /* 24bit RGB */
-#define VIDEO_PALETTE_RGB32 5 /* 32bit RGB */
-#define VIDEO_PALETTE_RGB555 6 /* 555 15bit RGB */
-#define VIDEO_PALETTE_YUV422 7 /* YUV422 capture */
-#define VIDEO_PALETTE_YUYV 8
-#define VIDEO_PALETTE_UYVY 9 /* The great thing about standards is ... */
-#define VIDEO_PALETTE_YUV420 10
-#define VIDEO_PALETTE_YUV411 11 /* YUV411 capture */
-#define VIDEO_PALETTE_RAW 12 /* RAW capture (BT848) */
-#define VIDEO_PALETTE_YUV422P 13 /* YUV 4:2:2 Planar */
-#define VIDEO_PALETTE_YUV411P 14 /* YUV 4:1:1 Planar */
-#define VIDEO_PALETTE_YUV420P 15 /* YUV 4:2:0 Planar */
-#define VIDEO_PALETTE_YUV410P 16 /* YUV 4:1:0 Planar */
-#define VIDEO_PALETTE_PLANAR 13 /* start of planar entries */
-#define VIDEO_PALETTE_COMPONENT 7 /* start of component entries */
-};
-
-struct video_audio
-{
- int audio; /* Audio channel */
- __u16 volume; /* If settable */
- __u16 bass, treble;
- __u32 flags;
-#define VIDEO_AUDIO_MUTE 1
-#define VIDEO_AUDIO_MUTABLE 2
-#define VIDEO_AUDIO_VOLUME 4
-#define VIDEO_AUDIO_BASS 8
-#define VIDEO_AUDIO_TREBLE 16
-#define VIDEO_AUDIO_BALANCE 32
- char name[16];
-#define VIDEO_SOUND_MONO 1
-#define VIDEO_SOUND_STEREO 2
-#define VIDEO_SOUND_LANG1 4
-#define VIDEO_SOUND_LANG2 8
- __u16 mode;
- __u16 balance; /* Stereo balance */
- __u16 step; /* Step actual volume uses */
-};
-
-struct video_clip
-{
- __s32 x,y;
- __s32 width, height;
- struct video_clip *next; /* For user use/driver use only */
-};
-
-struct video_window
-{
- __u32 x,y; /* Position of window */
- __u32 width,height; /* Its size */
- __u32 chromakey;
- __u32 flags;
- struct video_clip __user *clips; /* Set only */
- int clipcount;
-#define VIDEO_WINDOW_INTERLACE 1
-#define VIDEO_WINDOW_CHROMAKEY 16 /* Overlay by chromakey */
-#define VIDEO_CLIP_BITMAP -1
-/* bitmap is 1024x625, a '1' bit represents a clipped pixel */
-#define VIDEO_CLIPMAP_SIZE (128 * 625)
-};
-
-struct video_capture
-{
- __u32 x,y; /* Offsets into image */
- __u32 width, height; /* Area to capture */
- __u16 decimation; /* Decimation divider */
- __u16 flags; /* Flags for capture */
-#define VIDEO_CAPTURE_ODD 0 /* Temporal */
-#define VIDEO_CAPTURE_EVEN 1
-};
-
-struct video_buffer
-{
- void *base;
- int height,width;
- int depth;
- int bytesperline;
-};
-
-struct video_mmap
-{
- unsigned int frame; /* Frame (0 - n) for double buffer */
- int height,width;
- unsigned int format; /* should be VIDEO_PALETTE_* */
-};
-
-struct video_key
-{
- __u8 key[8];
- __u32 flags;
-};
-
-struct video_mbuf
-{
- int size; /* Total memory to map */
- int frames; /* Frames */
- int offsets[VIDEO_MAX_FRAME];
-};
-
-#define VIDEO_NO_UNIT (-1)
-
-struct video_unit
-{
- int video; /* Video minor */
- int vbi; /* VBI minor */
- int radio; /* Radio minor */
- int audio; /* Audio minor */
- int teletext; /* Teletext minor */
-};
-
-struct vbi_format {
- __u32 sampling_rate; /* in Hz */
- __u32 samples_per_line;
- __u32 sample_format; /* VIDEO_PALETTE_RAW only (1 byte) */
- __s32 start[2]; /* starting line for each frame */
- __u32 count[2]; /* count of lines for each frame */
- __u32 flags;
-#define VBI_UNSYNC 1 /* can distingues between top/bottom field */
-#define VBI_INTERLACED 2 /* lines are interlaced */
-};
-
-/* video_info is biased towards hardware mpeg encode/decode */
-/* but it could apply generically to any hardware compressor/decompressor */
-struct video_info
-{
- __u32 frame_count; /* frames output since decode/encode began */
- __u32 h_size; /* current unscaled horizontal size */
- __u32 v_size; /* current unscaled veritcal size */
- __u32 smpte_timecode; /* current SMPTE timecode (for current GOP) */
- __u32 picture_type; /* current picture type */
- __u32 temporal_reference; /* current temporal reference */
- __u8 user_data[256]; /* user data last found in compressed stream */
- /* user_data[0] contains user data flags, user_data[1] has count */
-};
-
-/* generic structure for setting playback modes */
-struct video_play_mode
-{
- int mode;
- int p1;
- int p2;
-};
-
-/* for loading microcode / fpga programming */
-struct video_code
-{
- char loadwhat[16]; /* name or tag of file being passed */
- int datasize;
- __u8 *data;
-};
-
-#define VIDIOCGCAP _IOR('v',1,struct video_capability) /* Get capabilities */
-#define VIDIOCGCHAN _IOWR('v',2,struct video_channel) /* Get channel info (sources) */
-#define VIDIOCSCHAN _IOW('v',3,struct video_channel) /* Set channel */
-#define VIDIOCGTUNER _IOWR('v',4,struct video_tuner) /* Get tuner abilities */
-#define VIDIOCSTUNER _IOW('v',5,struct video_tuner) /* Tune the tuner for the current channel */
-#define VIDIOCGPICT _IOR('v',6,struct video_picture) /* Get picture properties */
-#define VIDIOCSPICT _IOW('v',7,struct video_picture) /* Set picture properties */
-#define VIDIOCCAPTURE _IOW('v',8,int) /* Start, end capture */
-#define VIDIOCGWIN _IOR('v',9, struct video_window) /* Get the video overlay window */
-#define VIDIOCSWIN _IOW('v',10, struct video_window) /* Set the video overlay window - passes clip list for hardware smarts , chromakey etc */
-#define VIDIOCGFBUF _IOR('v',11, struct video_buffer) /* Get frame buffer */
-#define VIDIOCSFBUF _IOW('v',12, struct video_buffer) /* Set frame buffer - root only */
-#define VIDIOCKEY _IOR('v',13, struct video_key) /* Video key event - to dev 255 is to all - cuts capture on all DMA windows with this key (0xFFFFFFFF == all) */
-#define VIDIOCGFREQ _IOR('v',14, unsigned long) /* Set tuner */
-#define VIDIOCSFREQ _IOW('v',15, unsigned long) /* Set tuner */
-#define VIDIOCGAUDIO _IOR('v',16, struct video_audio) /* Get audio info */
-#define VIDIOCSAUDIO _IOW('v',17, struct video_audio) /* Audio source, mute etc */
-#define VIDIOCSYNC _IOW('v',18, int) /* Sync with mmap grabbing */
-#define VIDIOCMCAPTURE _IOW('v',19, struct video_mmap) /* Grab frames */
-#define VIDIOCGMBUF _IOR('v',20, struct video_mbuf) /* Memory map buffer info */
-#define VIDIOCGUNIT _IOR('v',21, struct video_unit) /* Get attached units */
-#define VIDIOCGCAPTURE _IOR('v',22, struct video_capture) /* Get subcapture */
-#define VIDIOCSCAPTURE _IOW('v',23, struct video_capture) /* Set subcapture */
-#define VIDIOCSPLAYMODE _IOW('v',24, struct video_play_mode) /* Set output video mode/feature */
-#define VIDIOCSWRITEMODE _IOW('v',25, int) /* Set write mode */
-#define VIDIOCGPLAYINFO _IOR('v',26, struct video_info) /* Get current playback info from hardware */
-#define VIDIOCSMICROCODE _IOW('v',27, struct video_code) /* Load microcode into hardware */
-#define VIDIOCGVBIFMT _IOR('v',28, struct vbi_format) /* Get VBI information */
-#define VIDIOCSVBIFMT _IOW('v',29, struct vbi_format) /* Set VBI information */
-
-
-#define BASE_VIDIOCPRIVATE 192 /* 192-255 are private */
-
-/* VIDIOCSWRITEMODE */
-#define VID_WRITE_MPEG_AUD 0
-#define VID_WRITE_MPEG_VID 1
-#define VID_WRITE_OSD 2
-#define VID_WRITE_TTX 3
-#define VID_WRITE_CC 4
-#define VID_WRITE_MJPEG 5
-
-/* VIDIOCSPLAYMODE */
-#define VID_PLAY_VID_OUT_MODE 0
- /* p1: = VIDEO_MODE_PAL, VIDEO_MODE_NTSC, etc ... */
-#define VID_PLAY_GENLOCK 1
- /* p1: 0 = OFF, 1 = ON */
- /* p2: GENLOCK FINE DELAY value */
-#define VID_PLAY_NORMAL 2
-#define VID_PLAY_PAUSE 3
-#define VID_PLAY_SINGLE_FRAME 4
-#define VID_PLAY_FAST_FORWARD 5
-#define VID_PLAY_SLOW_MOTION 6
-#define VID_PLAY_IMMEDIATE_NORMAL 7
-#define VID_PLAY_SWITCH_CHANNELS 8
-#define VID_PLAY_FREEZE_FRAME 9
-#define VID_PLAY_STILL_MODE 10
-#define VID_PLAY_MASTER_MODE 11
- /* p1: see below */
-#define VID_PLAY_MASTER_NONE 1
-#define VID_PLAY_MASTER_VIDEO 2
-#define VID_PLAY_MASTER_AUDIO 3
-#define VID_PLAY_ACTIVE_SCANLINES 12
- /* p1 = first active; p2 = last active */
-#define VID_PLAY_RESET 13
-#define VID_PLAY_END_MARK 14
-
-#endif /* __LINUX_VIDEODEV_H */
-
-/*
- * Local variables:
- * c-basic-offset: 8
- * End:
- */
diff --git a/drivers/staging/vme/bridges/vme_ca91cx42.c b/drivers/staging/vme/bridges/vme_ca91cx42.c
index d4a48c4e59c2..a4007287ef47 100644
--- a/drivers/staging/vme/bridges/vme_ca91cx42.c
+++ b/drivers/staging/vme/bridges/vme_ca91cx42.c
@@ -621,7 +621,7 @@ static int ca91cx42_master_set(struct vme_master_resource *image, int enabled,
/*
* Let's allocate the resource here rather than further up the stack as
- * it avoids pushing loads of bus dependant stuff up the stack
+ * it avoids pushing loads of bus dependent stuff up the stack
*/
retval = ca91cx42_alloc_resource(image, size);
if (retval) {
@@ -1052,7 +1052,7 @@ static int ca91cx42_dma_list_add(struct vme_dma_list *list,
pci_attr = dest->private;
}
- /* Check we can do fullfill required attributes */
+ /* Check we can do fulfill required attributes */
if ((vme_attr->aspace & ~(VME_A16 | VME_A24 | VME_A32 | VME_USER1 |
VME_USER2)) != 0) {
@@ -1069,7 +1069,7 @@ static int ca91cx42_dma_list_add(struct vme_dma_list *list,
goto err_cycle;
}
- /* Check to see if we can fullfill source and destination */
+ /* Check to see if we can fulfill source and destination */
if (!(((src->type == VME_DMA_PCI) && (dest->type == VME_DMA_VME)) ||
((src->type == VME_DMA_VME) && (dest->type == VME_DMA_PCI)))) {
diff --git a/drivers/staging/vme/bridges/vme_tsi148.c b/drivers/staging/vme/bridges/vme_tsi148.c
index b00a53e793e7..106aa9daff48 100644
--- a/drivers/staging/vme/bridges/vme_tsi148.c
+++ b/drivers/staging/vme/bridges/vme_tsi148.c
@@ -928,7 +928,7 @@ static int tsi148_master_set(struct vme_master_resource *image, int enabled,
spin_lock(&image->lock);
/* Let's allocate the resource here rather than further up the stack as
- * it avoids pushing loads of bus dependant stuff up the stack. If size
+ * it avoids pushing loads of bus dependent stuff up the stack. If size
* is zero, any existing resource will be freed.
*/
retval = tsi148_alloc_resource(image, size);
@@ -1320,7 +1320,7 @@ static ssize_t tsi148_master_write(struct vme_master_resource *image, void *buf,
/*
* Writes are posted. We need to do a read on the VME bus to flush out
- * all of the writes before we check for errors. We can't guarentee
+ * all of the writes before we check for errors. We can't guarantee
* that reading the data we have just written is safe. It is believed
* that there isn't any read, write re-ordering, so we can read any
* location in VME space, so lets read the Device ID from the tsi148's
diff --git a/drivers/staging/vme/bridges/vme_tsi148.h b/drivers/staging/vme/bridges/vme_tsi148.h
index 9f97fa8084e8..a3ac2fe98816 100644
--- a/drivers/staging/vme/bridges/vme_tsi148.h
+++ b/drivers/staging/vme/bridges/vme_tsi148.h
@@ -212,7 +212,7 @@ static const int TSI148_LCSR_OT[8] = { TSI148_LCSR_OT0, TSI148_LCSR_OT1,
#define TSI148_LCSR_OFFSET_OTAT 0x1C
/*
- * VMEbus interupt ack
+ * VMEbus interrupt ack
* offset 200
*/
#define TSI148_LCSR_VIACK1 0x204
@@ -613,7 +613,7 @@ static const int TSI148_GCSR_MBOX[4] = { TSI148_GCSR_MBOX0,
/*
* PCI-X Status Register (CRG +$054)
*/
-#define TSI148_PCFS_PCIXSTAT_RSCEM (1<<29) /* Recieved Split Comp Error */
+#define TSI148_PCFS_PCIXSTAT_RSCEM (1<<29) /* Received Split Comp Error */
#define TSI148_PCFS_PCIXSTAT_DMCRS_M (7<<26) /* max Cumulative Read Size */
#define TSI148_PCFS_PCIXSTAT_DMOST_M (7<<23) /* max outstanding Split Trans
*/
@@ -982,8 +982,8 @@ static const int TSI148_GCSR_MBOX[4] = { TSI148_GCSR_MBOX0,
#define TSI148_LCSR_VICR_CNTS_IRQ1 (2<<22) /* IRQ1 to Cntr */
#define TSI148_LCSR_VICR_CNTS_IRQ2 (3<<22) /* IRQ2 to Cntr */
-#define TSI148_LCSR_VICR_EDGIS_M (3<<20) /* Edge interupt MASK */
-#define TSI148_LCSR_VICR_EDGIS_DIS (1<<20) /* Edge interupt Disable */
+#define TSI148_LCSR_VICR_EDGIS_M (3<<20) /* Edge interrupt MASK */
+#define TSI148_LCSR_VICR_EDGIS_DIS (1<<20) /* Edge interrupt Disable */
#define TSI148_LCSR_VICR_EDGIS_IRQ1 (2<<20) /* IRQ1 to Edge */
#define TSI148_LCSR_VICR_EDGIS_IRQ2 (3<<20) /* IRQ2 to Edge */
diff --git a/drivers/staging/vme/vme_api.txt b/drivers/staging/vme/vme_api.txt
index a910a0c4388b..4910e92c52af 100644
--- a/drivers/staging/vme/vme_api.txt
+++ b/drivers/staging/vme/vme_api.txt
@@ -6,7 +6,7 @@ Driver registration
As with other subsystems within the Linux kernel, VME device drivers register
with the VME subsystem, typically called from the devices init routine. This is
-achieved via a call to the follwoing function:
+achieved via a call to the following function:
int vme_register_driver (struct vme_driver *driver);
@@ -108,7 +108,7 @@ Master windows
==============
Master windows provide access from the local processor[s] out onto the VME bus.
-The number of windows available and the available access modes is dependant on
+The number of windows available and the available access modes is dependent on
the underlying chipset. A window must be configured before it can be used.
@@ -163,7 +163,7 @@ Slave windows
Slave windows provide devices on the VME bus access into mapped portions of the
local memory. The number of windows available and the access modes that can be
-used is dependant on the underlying chipset. A window must be configured before
+used is dependent on the underlying chipset. A window must be configured before
it can be used.
diff --git a/drivers/staging/vt6655/Kconfig b/drivers/staging/vt6655/Kconfig
index 061e730df2d0..c3ba693a8cad 100644
--- a/drivers/staging/vt6655/Kconfig
+++ b/drivers/staging/vt6655/Kconfig
@@ -1,6 +1,6 @@
config VT6655
tristate "VIA Technologies VT6655 support"
- depends on PCI && WLAN
+ depends on PCI && WLAN && m
select WIRELESS_EXT
select WEXT_PRIV
---help---
diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c
index 951a3a8ddcb2..2721e0798496 100644
--- a/drivers/staging/vt6655/card.c
+++ b/drivers/staging/vt6655/card.c
@@ -1186,7 +1186,7 @@ CARDbStartMeasure (
wDuration += 1; // 1 TU for channel switching
if ((LODWORD(qwStartTSF) == 0) && (HIDWORD(qwStartTSF) == 0)) {
- // start imediately by setting start TSF == current TSF + 2 TU
+ // start immediately by setting start TSF == current TSF + 2 TU
LODWORD(qwStartTSF) = LODWORD(qwCurrTSF) + 2048;
HIDWORD(qwStartTSF) = HIDWORD(qwCurrTSF);
if (LODWORD(qwCurrTSF) > LODWORD(qwStartTSF)) {
diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c
index efaf19bc07b7..ad39c8727e9b 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -137,7 +137,7 @@ DEVICE_PARAM(TxDescriptors1,"Number of transmit descriptors1");
/* IP_byte_align[] is used for IP header unsigned long byte aligned
0: indicate the IP header won't be unsigned long byte aligned.(Default) .
1: indicate the IP header will be unsigned long byte aligned.
- In some enviroment, the IP header should be unsigned long byte aligned,
+ In some environment, the IP header should be unsigned long byte aligned,
or the packet will be droped when we receive it. (eg: IPVS)
*/
DEVICE_PARAM(IP_byte_align,"Enable IP header dword aligned");
diff --git a/drivers/staging/vt6655/wcmd.c b/drivers/staging/vt6655/wcmd.c
index abd6745bc3fe..c30170a2bc44 100644
--- a/drivers/staging/vt6655/wcmd.c
+++ b/drivers/staging/vt6655/wcmd.c
@@ -587,7 +587,7 @@ printk("chester-abyDesireSSID=%s\n",((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->abySS
if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (pMgmt->eCurrState == WMAC_STATE_JOINTED)) {
// Call mgr to begin the deauthentication
- // reason = (3) beacuse sta has left ESS
+ // reason = (3) because sta has left ESS
if (pMgmt->eCurrState>= WMAC_STATE_AUTH) {
vMgrDeAuthenBeginSta((void *)pDevice, pMgmt, pMgmt->abyCurrBSSID, (3), &Status);
}
diff --git a/drivers/staging/vt6655/wmgr.h b/drivers/staging/vt6655/wmgr.h
index 141e80b843af..e3ae562f521a 100644
--- a/drivers/staging/vt6655/wmgr.h
+++ b/drivers/staging/vt6655/wmgr.h
@@ -220,7 +220,7 @@ typedef enum tagWMAC_POWER_MODE {
*/
-// Tx Managment Packet descriptor
+// Tx Management Packet descriptor
typedef struct tagSTxMgmtPacket {
PUWLAN_80211HDR p80211Header;
@@ -230,7 +230,7 @@ typedef struct tagSTxMgmtPacket {
} STxMgmtPacket, *PSTxMgmtPacket;
-// Rx Managment Packet descriptor
+// Rx Management Packet descriptor
typedef struct tagSRxMgmtPacket {
PUWLAN_80211HDR p80211Header;
diff --git a/drivers/staging/vt6656/Kconfig b/drivers/staging/vt6656/Kconfig
index a441ba513c40..f89ab205c8e0 100644
--- a/drivers/staging/vt6656/Kconfig
+++ b/drivers/staging/vt6656/Kconfig
@@ -1,6 +1,6 @@
config VT6656
tristate "VIA Technologies VT6656 support"
- depends on USB && WLAN
+ depends on USB && WLAN && m
select WIRELESS_EXT
select WEXT_PRIV
select FW_LOADER
diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index 8f18578a5903..5185d61564d7 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -1938,7 +1938,7 @@ s_vGenerateMACHeader (
* Out:
* none
*
- * Return Value: CMD_STATUS_PENDING if MAC Tx resource avaliable; otherwise FALSE
+ * Return Value: CMD_STATUS_PENDING if MAC Tx resource available; otherwise FALSE
*
-*/
diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c
index b83b660b1f0f..019fb52de366 100644
--- a/drivers/staging/vt6656/wcmd.c
+++ b/drivers/staging/vt6656/wcmd.c
@@ -421,7 +421,7 @@ void vRunCommand(void *hDeviceContext)
pMgmt->eScanState = WMAC_IS_SCANNING;
pDevice->byScanBBType = pDevice->byBBType; //lucas
pDevice->bStopDataPkt = TRUE;
- // Turn off RCR_BSSID filter everytime
+ // Turn off RCR_BSSID filter every time
MACvRegBitsOff(pDevice, MAC_REG_RCR, RCR_BSSID);
pDevice->byRxMode &= ~RCR_BSSID;
@@ -604,7 +604,7 @@ void vRunCommand(void *hDeviceContext)
// if Infra mode
if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (pMgmt->eCurrState == WMAC_STATE_JOINTED)) {
// Call mgr to begin the deauthentication
- // reason = (3) beacuse sta has left ESS
+ // reason = (3) because sta has left ESS
if (pMgmt->eCurrState >= WMAC_STATE_AUTH) {
vMgrDeAuthenBeginSta((void *)pDevice,
pMgmt,
diff --git a/drivers/staging/vt6656/wmgr.h b/drivers/staging/vt6656/wmgr.h
index 594f3a89d8a7..13dfb3bf8328 100644
--- a/drivers/staging/vt6656/wmgr.h
+++ b/drivers/staging/vt6656/wmgr.h
@@ -218,7 +218,7 @@ typedef enum tagWMAC_POWER_MODE {
-// Tx Managment Packet descriptor
+// Tx Management Packet descriptor
typedef struct tagSTxMgmtPacket {
PUWLAN_80211HDR p80211Header;
@@ -228,7 +228,7 @@ typedef struct tagSTxMgmtPacket {
} STxMgmtPacket, *PSTxMgmtPacket;
-// Rx Managment Packet descriptor
+// Rx Management Packet descriptor
typedef struct tagSRxMgmtPacket {
PUWLAN_80211HDR p80211Header;
diff --git a/drivers/staging/westbridge/astoria/api/src/cyasdma.c b/drivers/staging/westbridge/astoria/api/src/cyasdma.c
index 16b8ec124510..c461d4f60bfb 100644
--- a/drivers/staging/westbridge/astoria/api/src/cyasdma.c
+++ b/drivers/staging/westbridge/astoria/api/src/cyasdma.c
@@ -1082,7 +1082,7 @@ cy_as_dma_received_data(cy_as_device *dev_p,
/*
* if the data received exceeds the size of the DMA buffer,
* clip the data to the size of the buffer. this can lead
- * to loosing some data, but is not different than doing
+ * to losing some data, but is not different than doing
* non-packet reads on the other endpoints.
*/
if (dsize > dma_p->size - dma_p->offset)
diff --git a/drivers/staging/westbridge/astoria/api/src/cyaslep2pep.c b/drivers/staging/westbridge/astoria/api/src/cyaslep2pep.c
index 60b6f3525332..76821e51b817 100644
--- a/drivers/staging/westbridge/astoria/api/src/cyaslep2pep.c
+++ b/drivers/staging/westbridge/astoria/api/src/cyaslep2pep.c
@@ -126,7 +126,7 @@ find_endpoint_directions(cy_as_device *dev_p,
cy_as_physical_endpoint_state desired;
/*
- * note, there is no error checking here becuase
+ * note, there is no error checking here because
* ISO error checking happens when the API is called.
*/
for (i = 0; i < 10; i++) {
diff --git a/drivers/staging/westbridge/astoria/api/src/cyaslowlevel.c b/drivers/staging/westbridge/astoria/api/src/cyaslowlevel.c
index d43dd858de58..96a86d088305 100644
--- a/drivers/staging/westbridge/astoria/api/src/cyaslowlevel.c
+++ b/drivers/staging/westbridge/astoria/api/src/cyaslowlevel.c
@@ -432,7 +432,7 @@ cy_as_mail_box_queued_data_handler(cy_as_device *dev_p)
* is received. When a complete request is received, the callback
* associated with requests on that context is called. When a complete
* response is recevied, the callback associated with the request that
-* generated the reponse is called.
+* generated the response is called.
*/
void
cy_as_mail_box_interrupt_handler(cy_as_device *dev_p)
diff --git a/drivers/staging/westbridge/astoria/api/src/cyasmisc.c b/drivers/staging/westbridge/astoria/api/src/cyasmisc.c
index 7852410b0a4c..4564fc11df22 100644
--- a/drivers/staging/westbridge/astoria/api/src/cyasmisc.c
+++ b/drivers/staging/westbridge/astoria/api/src/cyasmisc.c
@@ -428,7 +428,7 @@ my_misc_callback(cy_as_device *dev_p, uint8_t context,
if (v & CY_AS_MEM_P0_VM_SET_CFGMODE)
cy_as_hal_print_message(
"initialization message "
- "recieved, but config bit "
+ "received, but config bit "
"still set\n");
v = cy_as_hal_read_register(dev_p->tag,
@@ -436,7 +436,7 @@ my_misc_callback(cy_as_device *dev_p, uint8_t context,
if ((v & CY_AS_MEM_RST_RSTCMPT) == 0)
cy_as_hal_print_message(
"initialization message "
- "recieved, but reset complete "
+ "received, but reset complete "
"bit still not set\n");
}
break;
@@ -2381,7 +2381,7 @@ try_wakeup_again:
/*
* release the west bridge micro-_controller from reset,
* so that firmware initialization can complete. the attempt
- * to release antioch reset is made upto 8 times.
+ * to release antioch reset is made up to 8 times.
*/
v = 0x03;
count = 0x08;
diff --git a/drivers/staging/westbridge/astoria/api/src/cyasmtp.c b/drivers/staging/westbridge/astoria/api/src/cyasmtp.c
index 368984633874..8598364f7ab7 100644
--- a/drivers/staging/westbridge/astoria/api/src/cyasmtp.c
+++ b/drivers/staging/westbridge/astoria/api/src/cyasmtp.c
@@ -346,7 +346,7 @@ cy_as_mtp_start(cy_as_device_handle handle,
dev_p->mtp_event_cb = event_c_b;
/*
- * we register here becuase the start request may cause
+ * we register here because the start request may cause
* events to occur before the response to the start request.
*/
cy_as_ll_register_request_callback(dev_p,
@@ -424,7 +424,7 @@ my_handle_response_mtp_stop(cy_as_device *dev_p,
goto destroy;
/*
- * we sucessfully shutdown the stack, so decrement
+ * we successfully shutdown the stack, so decrement
* to make the count zero.
*/
dev_p->mtp_count--;
diff --git a/drivers/staging/westbridge/astoria/api/src/cyasstorage.c b/drivers/staging/westbridge/astoria/api/src/cyasstorage.c
index 2451404b88d4..7abd6a35e828 100644
--- a/drivers/staging/westbridge/astoria/api/src/cyasstorage.c
+++ b/drivers/staging/westbridge/astoria/api/src/cyasstorage.c
@@ -1773,7 +1773,7 @@ cy_as_storage_async_oper(cy_as_device *dev_p, cy_as_end_point_number_t ep,
if (unit > 255)
return CY_AS_ERROR_NO_SUCH_UNIT;
- /* We are supposed to return sucess if the number of
+ /* We are supposed to return success if the number of
* blocks is zero
*/
if (num_blocks == 0) {
@@ -1969,7 +1969,7 @@ cy_as_storage_sync_oper(cy_as_device *dev_p,
if (cy_as_device_is_usb_async_pending(dev_p, 6))
return CY_AS_ERROR_ASYNC_PENDING;
- /* We are supposed to return sucess if the number of
+ /* We are supposed to return success if the number of
* blocks is zero
*/
if (num_blocks == 0)
@@ -3285,7 +3285,7 @@ cy_as_sdio_extended_i_o_async(
if (callback == 0)
return CY_AS_ERROR_NULL_CALLBACK;
- /* We are supposed to return sucess if the number of
+ /* We are supposed to return success if the number of
* blocks is zero
*/
if (((misc_buf&CY_SDIO_BLOCKMODE) != 0) && (argument == 0)) {
diff --git a/drivers/staging/westbridge/astoria/api/src/cyasusb.c b/drivers/staging/westbridge/astoria/api/src/cyasusb.c
index 92ea42503bf3..1b55e611191e 100644
--- a/drivers/staging/westbridge/astoria/api/src/cyasusb.c
+++ b/drivers/staging/westbridge/astoria/api/src/cyasusb.c
@@ -739,7 +739,7 @@ cy_as_usb_start(cy_as_device_handle handle,
cy_as_usb_reset_e_p0_state(dev_p);
/*
- * we register here becuase the start request may cause
+ * we register here because the start request may cause
* events to occur before the response to the start request.
*/
cy_as_ll_register_request_callback(dev_p,
@@ -867,7 +867,7 @@ my_handle_response_usb_stop(cy_as_device *dev_p,
goto destroy;
/*
- * we sucessfully shutdown the stack, so
+ * we successfully shutdown the stack, so
* decrement to make the count zero.
*/
cy_as_usb_cleanup(dev_p);
diff --git a/drivers/staging/westbridge/astoria/arch/arm/mach-omap2/cyashalomap_kernel.c b/drivers/staging/westbridge/astoria/arch/arm/mach-omap2/cyashalomap_kernel.c
index ea9b733c3926..3bcedce13f4a 100644
--- a/drivers/staging/westbridge/astoria/arch/arm/mach-omap2/cyashalomap_kernel.c
+++ b/drivers/staging/westbridge/astoria/arch/arm/mach-omap2/cyashalomap_kernel.c
@@ -87,7 +87,7 @@
/*
- * For performance reasons, we handle storage endpoint transfers upto 4 KB
+ * For performance reasons, we handle storage endpoint transfers up to 4 KB
* within the HAL itself.
*/
#define CYASSTORAGE_WRITE_EP_NUM (4)
@@ -108,12 +108,12 @@
((ep) == 6) || ((ep) == 8))
/*
- * persistant, stores current GPMC interface cfg mode
+ * persistent, stores current GPMC interface cfg mode
*/
static uint8_t pnand_16bit;
/*
- * keep processing new WB DRQ in ISR untill all handled (performance feature)
+ * keep processing new WB DRQ in ISR until all handled (performance feature)
*/
#define PROCESS_MULTIPLE_DRQ_IN_ISR (1)
@@ -157,7 +157,7 @@ typedef struct cy_as_hal_endpoint_dma {
* dma_xfer_sz - size of the next dma xfer on P port
* seg_xfer_cnt - counts xfered bytes for in current sg_list
* memory segment
- * req_xfer_cnt - total number of bytes transfered so far in
+ * req_xfer_cnt - total number of bytes transferred so far in
* current request
* req_length - total request length
*/
@@ -597,7 +597,7 @@ static int cy_as_hal_configure_interrupts(void *dev_p)
int result;
int irq_pin = AST_INT;
- set_irq_type(OMAP_GPIO_IRQ(irq_pin), IRQ_TYPE_LEVEL_LOW);
+ irq_set_irq_type(OMAP_GPIO_IRQ(irq_pin), IRQ_TYPE_LEVEL_LOW);
/*
* for shared IRQS must provide non NULL device ptr
@@ -2160,7 +2160,7 @@ void cy_as_hal_mem_set(void *ptr, uint8_t value, uint32_t cnt)
/*
* This function is expected to create a sleep channel.
* The data structure that represents the sleep channel object
- * sleep channel (which is Linux "wait_queue_head_t wq" for this paticular HAL)
+ * sleep channel (which is Linux "wait_queue_head_t wq" for this particular HAL)
* passed as a pointer, and allpocated by the caller
* (typically as a local var on the stack) "Create" word should read as
* "SleepOn", this func doesn't actually create anything
@@ -2364,7 +2364,7 @@ int start_o_m_a_p_kernel(const char *pgm,
*/
cy_as_hal_gpmc_enable_16bit_bus(cy_true);
#else
- /* Astoria and GPMC are already in 8 bit mode, jsut initialize PNAND_CFG */
+ /* Astoria and GPMC are already in 8 bit mode, just initialize PNAND_CFG */
ast_p_nand_casdi_write(CY_AS_MEM_PNAND_CFG, 0x0000);
#endif
diff --git a/drivers/staging/westbridge/astoria/arch/arm/plat-omap/include/mach/westbridge/westbridge-omap3-pnand-hal/cyashalomap_kernel.h b/drivers/staging/westbridge/astoria/arch/arm/plat-omap/include/mach/westbridge/westbridge-omap3-pnand-hal/cyashalomap_kernel.h
index 80dd530bc4fd..6426ea61f3d4 100644
--- a/drivers/staging/westbridge/astoria/arch/arm/plat-omap/include/mach/westbridge/westbridge-omap3-pnand-hal/cyashalomap_kernel.h
+++ b/drivers/staging/westbridge/astoria/arch/arm/plat-omap/include/mach/westbridge/westbridge-omap3-pnand-hal/cyashalomap_kernel.h
@@ -20,7 +20,7 @@
*/
/*
- * This file contains the defintion of the hardware abstraction
+ * This file contains the definition of the hardware abstraction
* layer on OMAP3430 talking to the West Bridge Astoria device
*/
diff --git a/drivers/staging/westbridge/astoria/arch/arm/plat-omap/include/mach/westbridge/westbridge-omap3-pnand-hal/cyasmemmap.h b/drivers/staging/westbridge/astoria/arch/arm/plat-omap/include/mach/westbridge/westbridge-omap3-pnand-hal/cyasmemmap.h
index 3eee192ffe89..46f06ee29357 100644
--- a/drivers/staging/westbridge/astoria/arch/arm/plat-omap/include/mach/westbridge/westbridge-omap3-pnand-hal/cyasmemmap.h
+++ b/drivers/staging/westbridge/astoria/arch/arm/plat-omap/include/mach/westbridge/westbridge-omap3-pnand-hal/cyasmemmap.h
@@ -51,7 +51,7 @@
* GPMC_ADDR
* [A8:A1]->upD[7:0]
* INT# -GPMC_nWP_GPIO_62
- * DACK -N/C not conected
+ * DACK -N/C not connected
* WAKEUP-GPIO_167
* RESET-GPIO_126
* R/B -GPMC_WAIT2_GPIO_64
@@ -108,7 +108,7 @@
* will be monitored
* PF_EN_ENGINE - 1- ENABLES ENGINE, but it needs to be started after
* that C ctrl reg bit 0
- * PF_FIFO_THRESHOLD - FIFO threshhold in number of BUS(8 or 16) words
+ * PF_FIFO_THRESHOLD - FIFO threshold in number of BUS(8 or 16) words
* PF_WEIGHTED_PRIO - NUM of cycles granted to PFE if RND_ROBIN
* prioritization is enabled
* PF_ROUND_ROBIN - if enabled, gives priority to other CS, but
diff --git a/drivers/staging/westbridge/astoria/block/cyasblkdev_block.c b/drivers/staging/westbridge/astoria/block/cyasblkdev_block.c
index e1851f00be56..289729daba80 100644
--- a/drivers/staging/westbridge/astoria/block/cyasblkdev_block.c
+++ b/drivers/staging/westbridge/astoria/block/cyasblkdev_block.c
@@ -381,10 +381,10 @@ static int cyasblkdev_blk_ioctl(
return -ENOTTY;
}
-/* Media_changed block_device opp
+/* check_events block_device opp
* this one is called by kernel to confirm if the media really changed
* as we indicated by issuing check_disk_change() call */
-int cyasblkdev_media_changed(struct gendisk *gd)
+unsigned int cyasblkdev_check_events(struct gendisk *gd, unsigned int clearing)
{
struct cyasblkdev_blk_data *bd;
@@ -402,7 +402,7 @@ int cyasblkdev_media_changed(struct gendisk *gd)
#endif
}
- /* return media change state "1" yes, 0 no */
+ /* return media change state - DISK_EVENT_MEDIA_CHANGE yes, 0 no */
return 0;
}
@@ -432,7 +432,7 @@ static struct block_device_operations cyasblkdev_bdops = {
.ioctl = cyasblkdev_blk_ioctl,
/* .getgeo = cyasblkdev_blk_getgeo, */
/* added to support media removal( real and simulated) media */
- .media_changed = cyasblkdev_media_changed,
+ .check_events = cyasblkdev_check_events,
/* added to support media removal( real and simulated) media */
.revalidate_disk = cyasblkdev_revalidate_disk,
.owner = THIS_MODULE,
@@ -1090,6 +1090,7 @@ static int cyasblkdev_add_disks(int bus_num,
bd->user_disk_0->first_minor = devidx << CYASBLKDEV_SHIFT;
bd->user_disk_0->minors = 8;
bd->user_disk_0->fops = &cyasblkdev_bdops;
+ bd->user_disk_0->events = DISK_EVENT_MEDIA_CHANGE;
bd->user_disk_0->private_data = bd;
bd->user_disk_0->queue = bd->queue.queue;
bd->dbgprn_flags = DBGPRN_RD_RQ;
@@ -1190,6 +1191,7 @@ static int cyasblkdev_add_disks(int bus_num,
bd->user_disk_1->first_minor = (devidx + 1) << CYASBLKDEV_SHIFT;
bd->user_disk_1->minors = 8;
bd->user_disk_1->fops = &cyasblkdev_bdops;
+ bd->user_disk_1->events = DISK_EVENT_MEDIA_CHANGE;
bd->user_disk_1->private_data = bd;
bd->user_disk_1->queue = bd->queue.queue;
bd->dbgprn_flags = DBGPRN_RD_RQ;
@@ -1278,6 +1280,7 @@ static int cyasblkdev_add_disks(int bus_num,
(devidx + 2) << CYASBLKDEV_SHIFT;
bd->system_disk->minors = 8;
bd->system_disk->fops = &cyasblkdev_bdops;
+ bd->system_disk->events = DISK_EVENT_MEDIA_CHANGE;
bd->system_disk->private_data = bd;
bd->system_disk->queue = bd->queue.queue;
/* don't search for vfat
diff --git a/drivers/staging/westbridge/astoria/block/cyasblkdev_queue.c b/drivers/staging/westbridge/astoria/block/cyasblkdev_queue.c
index 0bbb8a3e191d..d1996a27515e 100644
--- a/drivers/staging/westbridge/astoria/block/cyasblkdev_queue.c
+++ b/drivers/staging/westbridge/astoria/block/cyasblkdev_queue.c
@@ -222,7 +222,7 @@ static int cyasblkdev_queue_thread(void *d)
continue;
}
- /* new req recieved, issue it to the driver */
+ /* new req received, issue it to the driver */
set_current_state(TASK_RUNNING);
#ifndef WESTBRIDGE_NDEBUG
diff --git a/drivers/staging/westbridge/astoria/gadget/cyasgadget.c b/drivers/staging/westbridge/astoria/gadget/cyasgadget.c
index defa05cd5e50..be851ca54cec 100644
--- a/drivers/staging/westbridge/astoria/gadget/cyasgadget.c
+++ b/drivers/staging/westbridge/astoria/gadget/cyasgadget.c
@@ -587,6 +587,7 @@ static int cyasgadget_enable(
"cy_as_usb_end_point_config EP %s mismatch "
"on enabled\n", an_ep->usb_ep_inst.name);
#endif
+ spin_unlock_irqrestore(&an_dev->lock, flags);
return -EINVAL;
}
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasdevice.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasdevice.h
index 0c0726b678ad..6452a9070091 100644
--- a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasdevice.h
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasdevice.h
@@ -119,7 +119,7 @@
#define CY_AS_REQUEST_LIST_STATE_QUEUED (0x00)
/* The request is sent, waiting for response */
#define CY_AS_REQUEST_LIST_STATE_WAITING (0x01)
-/* The response has been received, processing reponse */
+/* The response has been received, processing response */
#define CY_AS_REQUEST_LIST_STATE_RECEIVED (0x02)
/* The request/response is being canceled */
#define CY_AS_REQUEST_LIST_STATE_CANCELING (0x03)
@@ -517,7 +517,7 @@ typedef struct cy_as_context {
cy_as_ll_request_list_node *request_queue_p;
/* The list node in the request queue */
cy_as_ll_request_list_node *last_node_p;
- /* Index upto which data is stored. */
+ /* Index up to which data is stored. */
uint16_t queue_index;
/* Index to the next request in the queue. */
uint16_t rqt_index;
@@ -768,7 +768,7 @@ struct cy_as_device {
uint32_t mtp_count;
/* The MTP event callback supplied by the client */
cy_as_mtp_event_callback mtp_event_cb;
- /* The current block table to be transfered */
+ /* The current block table to be transferred */
cy_as_mtp_block_table *tp_blk_tbl;
cy_as_c_b_queue *func_cbs_mtp;
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasdma.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasdma.h
index 8dab5e900149..16dc9f96018c 100644
--- a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasdma.h
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasdma.h
@@ -108,7 +108,7 @@ typedef enum cy_as_dma_direction {
completes a requested DMA operation.
Returns
- CY_AS_ERROR_SUCCESS - the module initialized sucessfully
+ CY_AS_ERROR_SUCCESS - the module initialized successfully
CY_AS_ERROR_OUT_OF_MEMORY - memory allocation failed during
initialization
CY_AS_ERROR_ALREADY_RUNNING - the DMA module was already running
@@ -131,7 +131,7 @@ cy_as_dma_start(
then freeing the resources associated with each DMA endpoint.
Returns
- CY_AS_ERROR_SUCCESS - the module shutdown sucessfully
+ CY_AS_ERROR_SUCCESS - the module shutdown successfully
CY_AS_ERROR_NOT_RUNNING - the DMA module was not running
See Also
@@ -161,7 +161,7 @@ cy_as_dma_stop(
Returns
CY_AS_ERROR_SUCCESS - the traffic on the endpoint is canceled
- sucessfully
+ successfully
See Also
*/
@@ -266,7 +266,7 @@ cy_as_dma_queue_request(
will have to maintain a list of sleep channels to wake.
Returns
- * CY_AS_ERROR_SUCCESS - the queue has drained sucessfully
+ * CY_AS_ERROR_SUCCESS - the queue has drained successfully
* CY_AS_ERROR_INVALID_ENDPOINT - the endpoint given is not valid
* CY_AS_ERROR_NESTED_SLEEP - CyAsDmaQueueRequest() was requested
* on an endpoint where CyAsDmaQueueRequest was already called
@@ -295,7 +295,7 @@ cy_as_dma_drain_queue(
CyAsHalDmaSetupRead() functoins.
Returns
- * CY_AS_ERROR_SUCCESS - the value was set sucessfully
+ * CY_AS_ERROR_SUCCESS - the value was set successfully
* CY_AS_ERROR_INVALID_SIZE - the size value was not valid
*/
extern cy_as_return_status_t
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyaserr.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyaserr.h
index f78d60270d45..2cd0af1ed781 100644
--- a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyaserr.h
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyaserr.h
@@ -29,7 +29,7 @@
*/
/* Summary
- The function completed sucessfully
+ The function completed successfully
*/
#define CY_AS_ERROR_SUCCESS (0)
@@ -796,7 +796,7 @@
Description
This error is returned when an operation is attempted that cannot be
completed while the USB stack is connected to a USB host. In order
- to sucessfully complete the desired operation, CyAsUsbDisconnect()
+ to successfully complete the desired operation, CyAsUsbDisconnect()
must be called to disconnect from the host.
*/
#define CY_AS_ERROR_USB_CONNECTED (53)
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyashaldoc.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyashaldoc.h
index 28136ad75115..5bcbe9bf2f5d 100644
--- a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyashaldoc.h
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyashaldoc.h
@@ -597,7 +597,7 @@ cy_as_mem_set(
CyAsHalSleepChannel.
Returns
- CyTrue is the initialization was sucessful, and CyFalse otherwise
+ CyTrue is the initialization was successful, and CyFalse otherwise
See Also
* CyAsHalSleepChannel
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasintr.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasintr.h
index 3d7063ea3093..60a6fffb5d53 100644
--- a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasintr.h
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasintr.h
@@ -69,7 +69,7 @@ cy_as_intr_start(
Returns
* CY_AS_ERROR_SUCCESS - the interrupt module was stopped
- * sucessfully
+ * successfully
* CY_AS_ERROR_NOT_RUNNING - the interrupt module was not
* running
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasmisc.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasmisc.h
index 2f0701850561..df7c2b66cf27 100644
--- a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasmisc.h
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasmisc.h
@@ -620,7 +620,7 @@ cy_as_misc_in_standby(
* Nestable: YES
Returns
- * CY_AS_ERROR_SUCCESS - the firmware was sucessfully downloaded
+ * CY_AS_ERROR_SUCCESS - the firmware was successfully downloaded
* CY_AS_ERROR_INVALID_HANDLE
* CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device
* was not configured
@@ -836,7 +836,7 @@ cy_as_misc_reset(
ownership.
Returns
- * CY_AS_ERROR_SUCCESS - the p port sucessfully acquired the
+ * CY_AS_ERROR_SUCCESS - the p port successfully acquired the
* resource of interest
* CY_AS_ERROR_INVALID_HANDLE
* CY_AS_ERROR_NOT_CONFIGURED
@@ -879,7 +879,7 @@ cy_as_misc_acquire_resource(
* Valid In Asynchronous Callback: NO
Returns
- * CY_AS_ERROR_SUCCESS - the p port sucessfully released
+ * CY_AS_ERROR_SUCCESS - the p port successfully released
* the resource of interest
* CY_AS_ERROR_INVALID_HANDLE
* CY_AS_ERROR_NOT_CONFIGURED
@@ -929,7 +929,7 @@ cy_as_misc_release_resource(
Returns
* CY_AS_ERROR_SUCCESS - the trace configuration has been
- * sucessfully changed
+ * successfully changed
* CY_AS_ERROR_NO_SUCH_BUS - the bus specified does not exist
* CY_AS_ERROR_NO_SUCH_DEVICE - the specified media/device
* pair does not exist
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasprotocol.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasprotocol.h
index 317805fc4ff4..773b645ea7eb 100644
--- a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasprotocol.h
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasprotocol.h
@@ -756,7 +756,7 @@
* 1 : Debug mode
Description
- This reponse is sent to return the firmware version
+ This response is sent to return the firmware version
number to the requestor.
*/
#define CY_RESP_FIRMWARE_VERSION (16)
@@ -3655,7 +3655,7 @@
This request is sent to the West Bridge when the P port
needs to send data to the Host in a Turbo Endpoint.
Upon receiving this event, Firmware will make the end point
- avilable for the P port. If the length is zero, then
+ available for the P port. If the length is zero, then
firmware will send a zero length packet.
Direction
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasstorage.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasstorage.h
index 64f078cf202c..52b93c3e4813 100644
--- a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasstorage.h
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasstorage.h
@@ -832,7 +832,7 @@ typedef struct cy_as_sdio_func {
* CY_AS_ERROR_NO_FIRMWARE - the firmware has not been
* loaded into West Bridge
* CY_AS_ERROR_INVALID_HANDLE - an invalid handle was passed in
- * CY_AS_ERROR_SUCCESS - the module started sucessfully
+ * CY_AS_ERROR_SUCCESS - the module started successfully
* CY_AS_ERROR_TIMEOUT - a timeout occurred communicating
* with the West Bridge device
* CY_AS_ERROR_OUT_OF_MEMORY
@@ -882,7 +882,7 @@ cy_as_storage_start(
* CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
* passed in
* CY_AS_ERROR_SUCCESS - this module was shut
- * down sucessfully
+ * down successfully
* CY_AS_ERROR_TIMEOUT - a timeout occurred
* communicating with the West Bridge device
* CY_AS_ERROR_NOT_RUNNING
@@ -934,7 +934,7 @@ cy_as_storage_stop(
* CY_AS_ERROR_INVALID_HANDLE - an invalid handle
* was passed in
* CY_AS_ERROR_SUCCESS - the function was registered
- * sucessfully
+ * successfully
* CY_AS_ERROR_NOT_RUNNING - the stack is not running
See Also
@@ -981,7 +981,7 @@ cy_as_storage_register_callback(
* been started
* CY_AS_ERROR_INVALID_HANDLE - an invalid handle was
* passed in
- * CY_AS_ERROR_SUCCESS - this request was sucessfully
+ * CY_AS_ERROR_SUCCESS - this request was successfully
* transmitted to the West Bridge device
* CY_AS_ERROR_TIMEOUT - a timeout occurred communicating
* with the West Bridge device
@@ -1034,7 +1034,7 @@ cy_as_storage_claim(
* been started
* CY_AS_ERROR_INVALID_HANDLE - an invalid handle
* was passed in
- * CY_AS_ERROR_SUCCESS - the media was sucessfully
+ * CY_AS_ERROR_SUCCESS - the media was successfully
* released
* CY_AS_ERROR_MEDIA_NOT_CLAIMED - the media was not
* claimed by the P port
@@ -1905,7 +1905,7 @@ cy_as_storage_get_transfer_amount(
differ between SD cards.
A large erase can take a while to complete depending on the SD
- card. In such a case it is reccomended that an async call is made.
+ card. In such a case it is recommended that an async call is made.
Returns
* CY_AS_ERROR_SUCCESS - API call completed successfully
@@ -1926,7 +1926,7 @@ cy_as_storage_get_transfer_amount(
* required before erase is allowed
* CY_AS_ERROR_NO_SUCH_BUS
* CY_AS_ERROR_NO_SUCH_DEVICE
- * CY_AS_ERROR_NOT_SUPPORTED - Erase is currenly only supported
+ * CY_AS_ERROR_NOT_SUPPORTED - Erase is currently only supported
* on SD and using SD only firmware
* CY_AS_ERROR_OUT_OF_MEMORY
@@ -1985,7 +1985,7 @@ cy_as_storage_erase(
* type was made
* CY_AS_ERROR_OUT_OF_MEMORY - insufficient memory available
* CY_AS_ERROR_INVALID_RESPONSE - an error message was
- * recieved from the firmware
+ * received from the firmware
* CY_AS_ERROR_MEDIA_ACCESS_FAILURE - there was error in
* reading from the media
* CY_AS_ERROR_INVALID_FUNCTION - An IO attempt was made to
@@ -2047,7 +2047,7 @@ cy_as_sdio_get_c_i_s_info(
* pair does not exist
* CY_AS_ERROR_OUT_OF_MEMORY - insufficient memory available
* CY_AS_ERROR_INVALID_RESPONSE - an error message was
- * recieved from the firmware
+ * received from the firmware
*/
cy_as_return_status_t
@@ -2095,7 +2095,7 @@ cy_as_sdio_query_card(
* pair does not exist
* CY_AS_ERROR_OUT_OF_MEMORY - insufficient memory available
* CY_AS_ERROR_INVALID_RESPONSE - an error message was
- * recieved from the firmware
+ * received from the firmware
*/
cy_as_return_status_t
cy_as_sdio_reset_card(
@@ -2139,7 +2139,7 @@ cy_as_sdio_reset_card(
* CY_AS_ERROR_NO_SUCH_DEVICE - the specified media/device pair
* does not exist
* CY_AS_ERROR_OUT_OF_MEMORY - insufficient memory available
- * CY_AS_ERROR_INVALID_RESPONSE - an error message was recieved
+ * CY_AS_ERROR_INVALID_RESPONSE - an error message was received
* from the firmware
* CY_AS_ERROR_MEDIA_ACCESS_FAILURE - there was error in reading
* from the media
@@ -2198,7 +2198,7 @@ cy_as_sdio_direct_read(
* CY_AS_ERROR_NO_SUCH_DEVICE - the specified media/device
* pair does not exist
* CY_AS_ERROR_OUT_OF_MEMORY - insufficient memory available
- * CY_AS_ERROR_INVALID_RESPONSE - an error message was recieved
+ * CY_AS_ERROR_INVALID_RESPONSE - an error message was received
* from the firmware
* CY_AS_ERROR_MEDIA_ACCESS_FAILURE - there was error in
* reading from the media
@@ -2262,7 +2262,7 @@ cy_as_sdio_direct_write(
* CY_AS_ERROR_OUT_OF_MEMORY - insufficient memory
* available
* CY_AS_ERROR_INVALID_RESPONSE - an error message was
- * recieved from the firmware
+ * received from the firmware
* CY_AS_ERROR_MEDIA_ACCESS_FAILURE - there was error in
* reading from the media
* CY_AS_ERROR_INVALID_FUNCTION - An IO attempt was made
@@ -2319,7 +2319,7 @@ cy_as_sdio_set_blocksize(
* pair does not exist
* CY_AS_ERROR_ASYNC_PENDING - an async operation is pending
* CY_AS_ERROR_OUT_OF_MEMORY - insufficient memory available
- * CY_AS_ERROR_INVALID_RESPONSE - an error message was recieved
+ * CY_AS_ERROR_INVALID_RESPONSE - an error message was received
* from the firmware
* CY_AS_ERROR_MEDIA_ACCESS_FAILURE - there was error in
* reading from the media
@@ -2396,7 +2396,7 @@ cy_as_sdio_extended_read(
* CY_AS_ERROR_ASYNC_PENDING - an async operation is pending
* CY_AS_ERROR_OUT_OF_MEMORY - insufficient memory available
* CY_AS_ERROR_INVALID_RESPONSE - an error message was
- * recieved from the firmware
+ * received from the firmware
* CY_AS_ERROR_MEDIA_ACCESS_FAILURE - there was error in
* reading from the media
* CY_AS_ERROR_INVALID_FUNCTION - An IO attempt was made
@@ -2471,7 +2471,7 @@ cy_as_sdio_extended_write(
* pair does not exist
* CY_AS_ERROR_OUT_OF_MEMORY - insufficient memory available
* CY_AS_ERROR_INVALID_RESPONSE - an error message was
- * recieved from the firmware
+ * received from the firmware
* CY_AS_ERROR_MEDIA_ACCESS_FAILURE - there was error in
* reading from the media
* CY_AS_ERROR_INVALID_FUNCTION - An IO attempt was made
@@ -2714,7 +2714,7 @@ cy_as_sdio_suspend(
* CY_AS_ERROR_OUT_OF_MEMORY - insufficient memory
* available
* CY_AS_ERROR_INVALID_RESPONSE - an error message was
- * recieved from the firmware
+ * received from the firmware
* CY_AS_ERROR_MEDIA_ACCESS_FAILURE - there was error
* in reading from the media
* CY_AS_ERROR_INVALID_FUNCTION - An IO attempt was
diff --git a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasusb.h b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasusb.h
index 4a549e146812..e3ba9ca4c75f 100644
--- a/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasusb.h
+++ b/drivers/staging/westbridge/astoria/include/linux/westbridge/cyasusb.h
@@ -464,7 +464,7 @@ typedef struct cy_as_usb_end_point_config {
be selected on a partitioned storage device.
Description
- West Bridge firmware supports creating upto two
+ West Bridge firmware supports creating up to two
partitions on mass storage devices connected to
West Bridge. When there are two partitions on a device,
the user can choose which of these partitions should be
@@ -698,7 +698,7 @@ cy_as_usb_start(
* been configured
* CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
* into West Bridge
- * CY_AS_ERROR_SUCCESS - this module was shut down sucessfully
+ * CY_AS_ERROR_SUCCESS - this module was shut down successfully
* CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
* the West Bridge device
@@ -752,7 +752,7 @@ cy_as_usb_register_callback(
* Nestable: YES
Returns
- * CY_AS_ERROR_SUCCESS - this module was shut down sucessfully
+ * CY_AS_ERROR_SUCCESS - this module was shut down successfully
* CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
* been configured
* CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
@@ -791,7 +791,7 @@ cy_as_usb_connect(
* Nestable: YES
Returns
- * CY_AS_ERROR_SUCCESS - this module was shut down sucessfully
+ * CY_AS_ERROR_SUCCESS - this module was shut down successfully
* CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
* been configured
* CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
@@ -825,7 +825,7 @@ cy_as_usb_disconnect(
* Valid In Asynchronous Callback: Yes (if cb supplied)
Returns
- * CY_AS_ERROR_SUCCESS - this module was shut down sucessfully
+ * CY_AS_ERROR_SUCCESS - this module was shut down successfully
* CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
* been configured
* CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
@@ -855,13 +855,13 @@ cy_as_usb_set_enum_config(
the USB stack
Description
- This function sends a request to West Bridge to retreive
+ This function sends a request to West Bridge to retrieve
the current configuration
* Valid In Asynchronous Callback: Yes (if cb supplied)
Returns
- * CY_AS_ERROR_SUCCESS - this module was shut down sucessfully
+ * CY_AS_ERROR_SUCCESS - this module was shut down successfully
* CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
* been configured
* CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
@@ -906,7 +906,7 @@ cy_as_usb_get_enum_config(
Chapter 9.
Returns
- * CY_AS_ERROR_SUCCESS - this module was shut down sucessfully
+ * CY_AS_ERROR_SUCCESS - this module was shut down successfully
* CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
* been configured
* CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
@@ -993,7 +993,7 @@ cy_as_usb_clear_descriptors(
Description
This data structure the buffer to hold the descriptor
data, and an in/out parameter ti indicate the
- lenght of the buffer and descriptor data in bytes.
+ length of the buffer and descriptor data in bytes.
See Also
* CyAsUsbGetDescriptor
@@ -1027,7 +1027,7 @@ typedef struct cy_as_get_descriptor_data {
Chapter 9.
Returns
- * CY_AS_ERROR_SUCCESS - this module was shut down sucessfully
+ * CY_AS_ERROR_SUCCESS - this module was shut down successfully
* CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
* been configured
* CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
@@ -1106,7 +1106,7 @@ cy_as_usb_get_descriptor(
* Valid In Asynchronous Callback: NO
Returns
- * CY_AS_ERROR_SUCCESS - this module was shut down sucessfully
+ * CY_AS_ERROR_SUCCESS - this module was shut down successfully
* CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
* been configured
* CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
@@ -1140,7 +1140,7 @@ cy_as_usb_set_physical_configuration(
Add documentation about endpoint configuration limitations
Returns
- * CY_AS_ERROR_SUCCESS - this module was shut down sucessfully
+ * CY_AS_ERROR_SUCCESS - this module was shut down successfully
* CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
* been configured
* CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
@@ -1181,7 +1181,7 @@ cy_as_usb_set_end_point_config(
* Valid In Asynchronous Callback: NO
Returns
- * CY_AS_ERROR_SUCCESS - this module was shut down sucessfully
+ * CY_AS_ERROR_SUCCESS - this module was shut down successfully
* CY_AS_ERROR_NOT_CONFIGURED - the West Bridge device has not
* been configured
* CY_AS_ERROR_NO_FIRMWARE - the firmware has not been loaded
@@ -1219,7 +1219,7 @@ cy_as_usb_get_end_point_config(
functions store away the configuration information and this
CyAsUsbCommitConfig() actually finds the
best hardware configuration based on the requested endpoint
- configuration and sends thsi optimal
+ configuration and sends this optimal
confiuration down to the West Bridge device.
* Valid In Asynchronous Callback: YES (if cb supplied)
@@ -1268,7 +1268,7 @@ cy_as_usb_commit_config(
* Valid In Asynchronous Callback: NO
Returns
- * CY_AS_ERROR_SUCCESS - this module was shut down sucessfully
+ * CY_AS_ERROR_SUCCESS - this module was shut down successfully
* CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
* the West Bridge device
* CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
@@ -1311,7 +1311,7 @@ cy_as_usb_read_data(
* Valid In Asynchronous Callback: YES
Returns
- * CY_AS_ERROR_SUCCESS - this module was shut down sucessfully
+ * CY_AS_ERROR_SUCCESS - this module was shut down successfully
* CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
* the West Bridge device
* CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
@@ -1355,7 +1355,7 @@ cy_as_usb_read_data_async(
a zero length packet transmitted to the USB host.
Returns
- * CY_AS_ERROR_SUCCESS - this module was shut down sucessfully
+ * CY_AS_ERROR_SUCCESS - this module was shut down successfully
* CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
* the West Bridge device
* CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
@@ -1395,7 +1395,7 @@ cy_as_usb_write_data(
in a zero length packet transmitted to the USB host.
Returns
- * CY_AS_ERROR_SUCCESS - this module was shut down sucessfully
+ * CY_AS_ERROR_SUCCESS - this module was shut down successfully
* CY_AS_ERROR_TIMEOUT - a timeout occurred communicating with
* the West Bridge device
* CY_AS_ERROR_NOT_RUNNING - the USB stack is not running
@@ -1435,7 +1435,7 @@ cy_as_usb_write_data_async(
Returns
* CY_AS_ERROR_SUCCESS - this module was shut down
- * sucessfully
+ * successfully
* CY_AS_ERROR_NOT_RUNNING - the USB stack is not
* running
* CY_AS_ERROR_ASYNC_NOT_PENDING - no asynchronous USB
@@ -1791,7 +1791,7 @@ cy_as_usb_set_m_s_report_threshold(
device should be made visible to USB.
Description
- West Bridge firmware supports the creation of upto two
+ West Bridge firmware supports the creation of up to two
partitions on mass storage devices connected to the West Bridge
device. When there are two partitions on a device, the user can
choose which of these partitions should be made visible to the
diff --git a/drivers/staging/winbond/mds.c b/drivers/staging/winbond/mds.c
index 9cfea94bcea5..c9f0e8f856a0 100644
--- a/drivers/staging/winbond/mds.c
+++ b/drivers/staging/winbond/mds.c
@@ -492,7 +492,7 @@ Mds_Tx(struct wbsoft_priv *adapter)
TxDesIndex = pMds->TxDesIndex; /* Get the current ID */
pTxDes->Descriptor_ID = TxDesIndex;
- pMds->TxDesFrom[TxDesIndex] = 2; /* Storing the information of source comming from */
+ pMds->TxDesFrom[TxDesIndex] = 2; /* Storing the information of source coming from */
pMds->TxDesIndex++;
pMds->TxDesIndex %= MAX_USB_TX_DESCRIPTOR;
diff --git a/drivers/staging/wlags49_h2/README.ubuntu b/drivers/staging/wlags49_h2/README.ubuntu
index 47beaec86e4a..edee8b9385be 100644
--- a/drivers/staging/wlags49_h2/README.ubuntu
+++ b/drivers/staging/wlags49_h2/README.ubuntu
@@ -116,7 +116,7 @@ LICENSE
The Agere Systems license applies. This is why I include the original
README.wlags49. The instructions in that file are bogus now. I also
-include the man page. Eventhough setting parameters on the module
+include the man page. Even though setting parameters on the module
does not work anymore but it provides some information about all the
settings.
diff --git a/drivers/staging/wlags49_h2/TODO b/drivers/staging/wlags49_h2/TODO
index 14aa415b1a82..94032b6ac2b5 100644
--- a/drivers/staging/wlags49_h2/TODO
+++ b/drivers/staging/wlags49_h2/TODO
@@ -1,7 +1,7 @@
First of all, the best thing would be that this driver becomes obsolte by
adding support for Hermes II and Hermes II.5 cards to the existing orinoco
driver. The orinoco driver currently only supports Hermes I based cards.
-Since this will not happen by magic and has not happend until now this
+Since this will not happen by magic and has not happened until now this
driver provides a stop-gap solution for these type of cards.
Having said that, the following wishlist comes to mind to make the driver
@@ -18,7 +18,7 @@ TODO:
- the driver is split into a Hermes II and a Hermes II.5 part, it
would be nice to handle both with one module instead of two
- review by the wireless developer community
- - verify the code against the coding standards for a propper linux
+ - verify the code against the coding standards for a proper linux
driver
- resolve license issues (?)
diff --git a/drivers/staging/wlags49_h2/hcf.c b/drivers/staging/wlags49_h2/hcf.c
index d4bdd3ee8be1..a73317ef9350 100644
--- a/drivers/staging/wlags49_h2/hcf.c
+++ b/drivers/staging/wlags49_h2/hcf.c
@@ -540,7 +540,7 @@ HCF_STATIC hcf_16* BASED xxxx[ ] = {
*
*.CONDITIONS
* Except for hcf_action with HCF_ACT_INT_FORCE_ON or HCF_ACT_INT_OFF as parameter or hcf_connect with an I/O
-* address (i.e. not HCF_DISCONNECT), all hcf-function calls MUST be preceeded by a call of hcf_action with
+* address (i.e. not HCF_DISCONNECT), all hcf-function calls MUST be preceded by a call of hcf_action with
* HCF_ACT_INT_OFF as parameter.
* Note that hcf_connect defaults to NIC interrupt disabled mode, i.e. as if hcf_action( HCF_ACT_INT_OFF )
* was called.
@@ -843,7 +843,7 @@ hcf_16 i;
*.MODULE int hcf_cntl( IFBP ifbp, hcf_16 cmd )
*.PURPOSE Connect or disconnect a specific port to a specific network.
*!! ;???????????????? continue needs more explanation
-* recovers by means of "continue" when the connect proces in CCX mode fails
+* recovers by means of "continue" when the connect process in CCX mode fails
* Enables or disables data transmission and reception for the NIC.
* Activates static NIC configuration for a specific port at connect.
* Activates static configuration for all ports at enable.
@@ -1170,12 +1170,12 @@ LTV_STRCT x;
io_addr = io_base;
}
-#if 0 //;? if a subsequent hcf_connect is preceeded by an hcf_disconnect the wakeup is not needed !!
+#if 0 //;? if a subsequent hcf_connect is preceded by an hcf_disconnect the wakeup is not needed !!
#if HCF_SLEEP
OUT_PORT_WORD( .....+HREG_IO, HREG_IO_WAKEUP_ASYNC ); //OPW not yet useable
MSF_WAIT(800); // MSF-defined function to wait n microseconds.
note that MSF_WAIT uses not yet defined!!!! IFB_IOBase and IFB_TickIni (via PROT_CNT_INI)
- so be carefull if this code is restored
+ so be careful if this code is restored
#endif // HCF_SLEEP
#endif // 0
@@ -1563,7 +1563,7 @@ DESC_STRCT *p = descp->next_desc_addr; //pointer to 2nd descriptor of frame
* This function is called by the MSF to supply the HCF with new/more buffers for receive purposes.
* The HCF can be used in 2 fashions: with and without encapsulation for data transfer.
* This is controlled at compile time by the HCF_ENC bit of the HCF_ENCAP system constant.
-* As a consequence, some additional constaints apply to the number of descriptor and the buffers associated
+* As a consequence, some additional constraints apply to the number of descriptor and the buffers associated
* with the first 2 descriptors. Independent of the encapsulation feature, the COUNT fields are ignored.
* A special case is the supplying of the DELWA descriptor, which must be supplied as the first descriptor.
*
@@ -1735,7 +1735,7 @@ DESC_STRCT *descp; // pointer to start of FrameList
* - in case encapsulation by the HCF is selected:
* - The FrameList does not consists of at least 2 Descriptors.
* - The first databuffer does not contain exactly the (space for) the 802.11 header (== 28 words)
-* - The first databuffer does not have a size to additionally accomodate the 802.3 header and the
+* - The first databuffer does not have a size to additionally accommodate the 802.3 header and the
* SNAP header of the frame after encapsulation (== 39 words).
* - The second databuffer does not contain at least DA, SA and 'type/length' (==14 bytes or 7 words)
*!! The 2nd part of the list of asserts should be kept in sync with put_frame_lst, in order to get
@@ -1762,14 +1762,14 @@ DESC_STRCT *descp; // pointer to start of FrameList
* - Copy DA/SA fields from the 2nd buffer
* - Calculate total length of the message (snap-header + type-field + the length of all buffer fragments
* associated with the 802.3 frame (i.e all descriptors except the first), but not the DestinationAddress,
-* SourceAddress and lenght-field)
+* SourceAddress and length-field)
* Assert the message length
* Write length. Note that the message is in BE format, hence on LE platforms the length must be converted
* ;? THIS IS NOT WHAT CURRENTLY IS IMPLEMENTED
* - Write snap header. Note that the last byte of the snap header is NOT copied, that byte is already in
* place as result of the call to hcf_encap.
* Note that there are many ways to skin a cat. To express the offsets in the 1st buffer while writing
-* the snap header, HFS_TYPE is choosen as a reference point to make it easier to grasp that the snap header
+* the snap header, HFS_TYPE is chosen as a reference point to make it easier to grasp that the snap header
* and encapsualtion type are at least relative in the right.
*8: modify 1st descriptor to reflect moved part of the 802.3 header + Snap-header
* modify 2nd descriptor to skip the moved part of the 802.3 header (DA/SA
@@ -1933,7 +1933,7 @@ hcf_16 t = (hcf_16)(*type<<8) + *(type+1); /* 2 */
* HCF_SUCCESS Success
*!! via cmd_exe ( type >= CFG_RID_FW_MIN )
* HCF_ERR_NO_NIC NIC removed during retrieval
-* HCF_ERR_TIME_OUT Expected Hermes event did not occure in expected time
+* HCF_ERR_TIME_OUT Expected Hermes event did not occur in expected time
*!! via cmd_exe and setup_bap (type >= CFG_RID_FW_MIN )
* HCF_ERR_DEFUNCT_... HCF is in defunct mode (bits 0x7F reflect cause)
*
@@ -2958,7 +2958,7 @@ or
* hcf_service_nic is also skipped in those cases.
* To prevent that hcf_service_nic reports bogus information to the MSF with all - possibly difficult to
* debug - undesirable side effects, it is paramount to check the NIC presence. In former days the presence
-* test was based on the Hermes register HREG_SW_0. Since in HCF_ACT_INT_OFF is choosen for strategy based on
+* test was based on the Hermes register HREG_SW_0. Since in HCF_ACT_INT_OFF is chosen for strategy based on
* HREG_EV_STAT, this is now also used in hcf_service_nic. The motivation to change strategy is partly
* due to inconsistent F/W implementations with respect to HREG_SW_0 manipulation around reset and download.
* Note that in polled environments Card Removal is not detected by INT_OFF which makes the check in
@@ -4048,7 +4048,7 @@ hcf_32 FAR *p4; //prevent side effects from macro
HCFASSERT( word_len == 0 || word_len == 2 || word_len == 4, word_len )
HCFASSERT( word_len == 0 || ((hcf_32)bufp & 1 ) == 0, (hcf_32)bufp )
HCFASSERT( word_len <= len, MERGE2( word_len, len ) )
- //see put_frag for an alternative implementation, but be carefull about what are int's and what are
+ //see put_frag for an alternative implementation, but be careful about what are int's and what are
//hcf_16's
if ( word_len ) { //. if there is anything to convert
hcf_8 c;
@@ -4712,7 +4712,7 @@ int rc = HCF_SUCCESS;
* Note that len is unsigned, so even MSF I/F violation works out O.K.
* The '2' in the expression "len+2" is used because 1 word is needed for L itself and 1 word is needed
* for the zero-sentinel
-*8: update MailBox Info length report to MSF with "oldest" MB Info Block size. Be carefull here, if you get
+*8: update MailBox Info length report to MSF with "oldest" MB Info Block size. Be careful here, if you get
* here before the MailBox is registered, you can't read from the buffer addressed by IFB_MBp (it is the
* Null buffer) so don't move this code till the end of this routine but keep it where there is garuanteed
* a buffer.
diff --git a/drivers/staging/wlags49_h2/hcfdef.h b/drivers/staging/wlags49_h2/hcfdef.h
index 4e20171b7829..cb1966d8473f 100644
--- a/drivers/staging/wlags49_h2/hcfdef.h
+++ b/drivers/staging/wlags49_h2/hcfdef.h
@@ -315,7 +315,7 @@ err: these values should match;
#if HCF_DMA
//************************* DMA (bus mastering)
- // Be carefull to use these registers only at a genuine 32 bits NIC
+ // Be careful to use these registers only at a genuine 32 bits NIC
// On 16 bits NICs, these addresses are mapped into the range 0x00 through 0x3F with all consequences
// thereof, e.g. HREG_DMA_CTRL register maps to HREG_CMD.
#define HREG_DMA_CTRL 0x0040
diff --git a/drivers/staging/wlags49_h2/wl_wext.c b/drivers/staging/wlags49_h2/wl_wext.c
index 9e5da0815371..522a31090c58 100644
--- a/drivers/staging/wlags49_h2/wl_wext.c
+++ b/drivers/staging/wlags49_h2/wl_wext.c
@@ -2575,7 +2575,7 @@ static int wireless_set_scan(struct net_device *dev, struct iw_request_info *inf
* This looks like a nice place to test if the HCF is still
* communicating with the card. It seems that sometimes BAP_1
* gets corrupted. By looking at the comments in HCF the
- * cause is still a mistery. Okay, the communication to the
+ * cause is still a mystery. Okay, the communication to the
* card is dead, reset the card to revive.
*/
if((lp->hcfCtx.IFB_CardStat & CARD_STAT_DEFUNCT) != 0)
@@ -3924,7 +3924,7 @@ void wl_wext_event_mic_failed( struct net_device *dev )
memset( msg, 0, sizeof( msg ));
- /* Becuase MIC failures are not part of the Wireless Extensions yet, they
+ /* Because MIC failures are not part of the Wireless Extensions yet, they
must be passed as a string using an IWEVCUSTOM event. In order for the
event to be effective, the string format must be known by both the
driver and the supplicant. The following is the string format used by the
@@ -3999,7 +3999,7 @@ void wl_wext_event_assoc_ie( struct net_device *dev )
memcpy( &data.rawData, &( lp->ltvRecord.u.u8[1] ), 88 );
wpa_ie = wl_parse_wpa_ie( &data, &length );
- /* Becuase this event (Association WPA-IE) is not part of the Wireless
+ /* Because this event (Association WPA-IE) is not part of the Wireless
Extensions yet, it must be passed as a string using an IWEVCUSTOM event.
In order for the event to be effective, the string format must be known
by both the driver and the supplicant. The following is the string format
diff --git a/drivers/staging/wlags49_h25/TODO b/drivers/staging/wlags49_h25/TODO
index 14aa415b1a82..94032b6ac2b5 100644
--- a/drivers/staging/wlags49_h25/TODO
+++ b/drivers/staging/wlags49_h25/TODO
@@ -1,7 +1,7 @@
First of all, the best thing would be that this driver becomes obsolte by
adding support for Hermes II and Hermes II.5 cards to the existing orinoco
driver. The orinoco driver currently only supports Hermes I based cards.
-Since this will not happen by magic and has not happend until now this
+Since this will not happen by magic and has not happened until now this
driver provides a stop-gap solution for these type of cards.
Having said that, the following wishlist comes to mind to make the driver
@@ -18,7 +18,7 @@ TODO:
- the driver is split into a Hermes II and a Hermes II.5 part, it
would be nice to handle both with one module instead of two
- review by the wireless developer community
- - verify the code against the coding standards for a propper linux
+ - verify the code against the coding standards for a proper linux
driver
- resolve license issues (?)
diff --git a/drivers/staging/wlan-ng/cfg80211.c b/drivers/staging/wlan-ng/cfg80211.c
index 6a71f52c59b1..76378397b763 100644
--- a/drivers/staging/wlan-ng/cfg80211.c
+++ b/drivers/staging/wlan-ng/cfg80211.c
@@ -273,7 +273,7 @@ exit:
}
int prism2_set_default_key(struct wiphy *wiphy, struct net_device *dev,
- u8 key_index)
+ u8 key_index, bool unicast, bool multicast)
{
wlandevice_t *wlandev = dev->ml_priv;
diff --git a/drivers/staging/wlan-ng/prism2sta.c b/drivers/staging/wlan-ng/prism2sta.c
index ed751f418db9..21f25a21c291 100644
--- a/drivers/staging/wlan-ng/prism2sta.c
+++ b/drivers/staging/wlan-ng/prism2sta.c
@@ -1976,7 +1976,7 @@ static wlandevice_t *create_wlan(void)
wlandev->nsdcaps = P80211_NSDCAP_HWFRAGMENT | P80211_NSDCAP_AUTOJOIN;
- /* Initialize the device private data stucture. */
+ /* Initialize the device private data structure. */
hw->dot11_desired_bss_type = 1;
return wlandev;
diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c
index 8762a5327693..9669c22cc82c 100644
--- a/drivers/staging/xgifb/vb_setmode.c
+++ b/drivers/staging/xgifb/vb_setmode.c
@@ -7834,7 +7834,7 @@ unsigned short XGI_GetRatePtrCRT2(struct xgi_hw_device_info *pXGIHWDE,
== 600)) {
index++;
}
- /* Alan 10/19/2007; do the similiar adjustment like XGISearchCRT1Rate() */
+ /* Alan 10/19/2007; do the similar adjustment like XGISearchCRT1Rate() */
if ((pVBInfo->RefIndex[RefreshRateTableIndex].XRes == 1024)
&& (pVBInfo->RefIndex[RefreshRateTableIndex].YRes
== 768)) {
diff --git a/drivers/staging/xgifb/vgatypes.h b/drivers/staging/xgifb/vgatypes.h
index 4b87951f4322..d613e84aab62 100644
--- a/drivers/staging/xgifb/vgatypes.h
+++ b/drivers/staging/xgifb/vgatypes.h
@@ -85,7 +85,7 @@ struct xgi_hw_device_info
unsigned long *);
};
-/* Addtional IOCTL for communication xgifb <> X driver */
+/* Additional IOCTL for communication xgifb <> X driver */
/* If changing this, xgifb.h must also be changed (for xgifb) */