cthw20k1.c (d905163c5b23f6d8511971e06081a1b525e8a0bd) | cthw20k1.c (29959a09cc1aabd2d5f4f03afc0305de6bd29248) |
---|---|
1/** 2 * Copyright (C) 2008, Creative Technology Ltd. All Rights Reserved. 3 * 4 * This source file is released under GPL v2 license (no other versions). 5 * See the COPYING file included in the main directory of this source 6 * distribution for the license terms and conditions. 7 * 8 * @File cthw20k1.c --- 1897 unchanged lines hidden (view full) --- 1906 pci_set_consistent_dma_mask(pci, CT_XFI_DMA_MASK) < 0) { 1907 printk(KERN_ERR "architecture does not support PCI " 1908 "busmaster DMA with mask 0x%llx\n", 1909 CT_XFI_DMA_MASK); 1910 err = -ENXIO; 1911 goto error1; 1912 } 1913 | 1/** 2 * Copyright (C) 2008, Creative Technology Ltd. All Rights Reserved. 3 * 4 * This source file is released under GPL v2 license (no other versions). 5 * See the COPYING file included in the main directory of this source 6 * distribution for the license terms and conditions. 7 * 8 * @File cthw20k1.c --- 1897 unchanged lines hidden (view full) --- 1906 pci_set_consistent_dma_mask(pci, CT_XFI_DMA_MASK) < 0) { 1907 printk(KERN_ERR "architecture does not support PCI " 1908 "busmaster DMA with mask 0x%llx\n", 1909 CT_XFI_DMA_MASK); 1910 err = -ENXIO; 1911 goto error1; 1912 } 1913 |
1914 err = pci_request_regions(pci, "XFi"); 1915 if (err < 0) 1916 goto error1; | 1914 if (!hw->io_base) { 1915 err = pci_request_regions(pci, "XFi"); 1916 if (err < 0) 1917 goto error1; |
1917 | 1918 |
1919 if (hw->model == CTUAA) 1920 hw->io_base = pci_resource_start(pci, 5); 1921 else 1922 hw->io_base = pci_resource_start(pci, 0); 1923 1924 } 1925 |
|
1918 /* Switch to X-Fi mode from UAA mode if neeeded */ 1919 if (hw->model == CTUAA) { 1920 err = uaa_to_xfi(pci); 1921 if (err) 1922 goto error2; 1923 | 1926 /* Switch to X-Fi mode from UAA mode if neeeded */ 1927 if (hw->model == CTUAA) { 1928 err = uaa_to_xfi(pci); 1929 if (err) 1930 goto error2; 1931 |
1924 hw->io_base = pci_resource_start(pci, 5); 1925 } else { 1926 hw->io_base = pci_resource_start(pci, 0); | |
1927 } 1928 | 1932 } 1933 |
1929 err = request_irq(pci->irq, ct_20k1_interrupt, IRQF_SHARED, 1930 "ctxfi", hw); 1931 if (err < 0) { 1932 printk(KERN_ERR "XFi: Cannot get irq %d\n", pci->irq); 1933 goto error2; | 1934 if (hw->irq < 0) { 1935 err = request_irq(pci->irq, ct_20k1_interrupt, IRQF_SHARED, 1936 "ctxfi", hw); 1937 if (err < 0) { 1938 printk(KERN_ERR "XFi: Cannot get irq %d\n", pci->irq); 1939 goto error2; 1940 } 1941 hw->irq = pci->irq; |
1934 } | 1942 } |
1935 hw->irq = pci->irq; | |
1936 1937 pci_set_master(pci); 1938 1939 return 0; 1940 1941error2: 1942 pci_release_regions(pci); 1943 hw->io_base = 0; 1944error1: 1945 pci_disable_device(pci); 1946 return err; 1947} 1948 1949static int hw_card_stop(struct hw *hw) 1950{ | 1943 1944 pci_set_master(pci); 1945 1946 return 0; 1947 1948error2: 1949 pci_release_regions(pci); 1950 hw->io_base = 0; 1951error1: 1952 pci_disable_device(pci); 1953 return err; 1954} 1955 1956static int hw_card_stop(struct hw *hw) 1957{ |
1958 unsigned int data; 1959 1960 /* disable transport bus master and queueing of request */ 1961 hw_write_20kx(hw, TRNCTL, 0x00); 1962 1963 /* disable pll */ 1964 data = hw_read_20kx(hw, PLLCTL); 1965 hw_write_20kx(hw, PLLCTL, (data & (~(0x0F<<12)))); 1966 |
|
1951 /* TODO: Disable interrupt and so on... */ 1952 if (hw->irq >= 0) 1953 synchronize_irq(hw->irq); 1954 return 0; 1955} 1956 1957static int hw_card_shutdown(struct hw *hw) 1958{ --- 23 unchanged lines hidden (view full) --- 1982 unsigned int gctl; 1983 u32 data; 1984 struct dac_conf dac_info = {0}; 1985 struct adc_conf adc_info = {0}; 1986 struct daio_conf daio_info = {0}; 1987 struct trn_conf trn_info = {0}; 1988 1989 /* Get PCI io port base address and do Hendrix switch if needed. */ | 1967 /* TODO: Disable interrupt and so on... */ 1968 if (hw->irq >= 0) 1969 synchronize_irq(hw->irq); 1970 return 0; 1971} 1972 1973static int hw_card_shutdown(struct hw *hw) 1974{ --- 23 unchanged lines hidden (view full) --- 1998 unsigned int gctl; 1999 u32 data; 2000 struct dac_conf dac_info = {0}; 2001 struct adc_conf adc_info = {0}; 2002 struct daio_conf daio_info = {0}; 2003 struct trn_conf trn_info = {0}; 2004 2005 /* Get PCI io port base address and do Hendrix switch if needed. */ |
1990 if (!hw->io_base) { 1991 err = hw_card_start(hw); 1992 if (err) 1993 return err; 1994 } | 2006 err = hw_card_start(hw); 2007 if (err) 2008 return err; |
1995 1996 /* PLL init */ 1997 err = hw_pll_init(hw, info->rsr); 1998 if (err < 0) 1999 return err; 2000 2001 /* kick off auto-init */ 2002 err = hw_auto_init(hw); --- 56 unchanged lines hidden (view full) --- 2059 2060 data = hw_read_20kx(hw, SRCMCTL); 2061 data |= 0x1; /* Enables input from the audio ring */ 2062 hw_write_20kx(hw, SRCMCTL, data); 2063 2064 return 0; 2065} 2066 | 2009 2010 /* PLL init */ 2011 err = hw_pll_init(hw, info->rsr); 2012 if (err < 0) 2013 return err; 2014 2015 /* kick off auto-init */ 2016 err = hw_auto_init(hw); --- 56 unchanged lines hidden (view full) --- 2073 2074 data = hw_read_20kx(hw, SRCMCTL); 2075 data |= 0x1; /* Enables input from the audio ring */ 2076 hw_write_20kx(hw, SRCMCTL, data); 2077 2078 return 0; 2079} 2080 |
2081#ifdef CONFIG_PM 2082static int hw_suspend(struct hw *hw, pm_message_t state) 2083{ 2084 struct pci_dev *pci = hw->pci; 2085 2086 hw_card_stop(hw); 2087 2088 if (hw->model == CTUAA) { 2089 /* Switch to UAA config space. */ 2090 pci_write_config_dword(pci, UAA_CFG_SPACE_FLAG, 0x0); 2091 } 2092 2093 pci_disable_device(pci); 2094 pci_save_state(pci); 2095 pci_set_power_state(pci, pci_choose_state(pci, state)); 2096 2097 return 0; 2098} 2099 2100static int hw_resume(struct hw *hw, struct card_conf *info) 2101{ 2102 struct pci_dev *pci = hw->pci; 2103 2104 pci_set_power_state(pci, PCI_D0); 2105 pci_restore_state(pci); 2106 2107 /* Re-initialize card hardware. */ 2108 return hw_card_init(hw, info); 2109} 2110#endif 2111 |
|
2067static u32 hw_read_20kx(struct hw *hw, u32 reg) 2068{ 2069 u32 value; 2070 unsigned long flags; 2071 2072 spin_lock_irqsave( 2073 &container_of(hw, struct hw20k1, hw)->reg_20k1_lock, flags); 2074 outl(reg, hw->io_base + 0x0); --- 48 unchanged lines hidden (view full) --- 2123 .irq = -1, 2124 2125 .card_init = hw_card_init, 2126 .card_stop = hw_card_stop, 2127 .pll_init = hw_pll_init, 2128 .is_adc_source_selected = hw_is_adc_input_selected, 2129 .select_adc_source = hw_adc_input_select, 2130 .have_digit_io_switch = hw_have_digit_io_switch, | 2112static u32 hw_read_20kx(struct hw *hw, u32 reg) 2113{ 2114 u32 value; 2115 unsigned long flags; 2116 2117 spin_lock_irqsave( 2118 &container_of(hw, struct hw20k1, hw)->reg_20k1_lock, flags); 2119 outl(reg, hw->io_base + 0x0); --- 48 unchanged lines hidden (view full) --- 2168 .irq = -1, 2169 2170 .card_init = hw_card_init, 2171 .card_stop = hw_card_stop, 2172 .pll_init = hw_pll_init, 2173 .is_adc_source_selected = hw_is_adc_input_selected, 2174 .select_adc_source = hw_adc_input_select, 2175 .have_digit_io_switch = hw_have_digit_io_switch, |
2176#ifdef CONFIG_PM 2177 .suspend = hw_suspend, 2178 .resume = hw_resume, 2179#endif |
|
2131 2132 .src_rsc_get_ctrl_blk = src_get_rsc_ctrl_blk, 2133 .src_rsc_put_ctrl_blk = src_put_rsc_ctrl_blk, 2134 .src_mgr_get_ctrl_blk = src_mgr_get_ctrl_blk, 2135 .src_mgr_put_ctrl_blk = src_mgr_put_ctrl_blk, 2136 .src_set_state = src_set_state, 2137 .src_set_bm = src_set_bm, 2138 .src_set_rsr = src_set_rsr, --- 110 unchanged lines hidden --- | 2180 2181 .src_rsc_get_ctrl_blk = src_get_rsc_ctrl_blk, 2182 .src_rsc_put_ctrl_blk = src_put_rsc_ctrl_blk, 2183 .src_mgr_get_ctrl_blk = src_mgr_get_ctrl_blk, 2184 .src_mgr_put_ctrl_blk = src_mgr_put_ctrl_blk, 2185 .src_set_state = src_set_state, 2186 .src_set_bm = src_set_bm, 2187 .src_set_rsr = src_set_rsr, --- 110 unchanged lines hidden --- |