diff options
Diffstat (limited to 'drivers')
70 files changed, 1658 insertions, 291 deletions
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c index 051474c65b78..34d6a1cab8de 100644 --- a/drivers/char/hpet.c +++ b/drivers/char/hpet.c | |||
@@ -163,11 +163,32 @@ static irqreturn_t hpet_interrupt(int irq, void *data) | |||
163 | * This has the effect of treating non-periodic like periodic. | 163 | * This has the effect of treating non-periodic like periodic. |
164 | */ | 164 | */ |
165 | if ((devp->hd_flags & (HPET_IE | HPET_PERIODIC)) == HPET_IE) { | 165 | if ((devp->hd_flags & (HPET_IE | HPET_PERIODIC)) == HPET_IE) { |
166 | unsigned long m, t; | 166 | unsigned long m, t, mc, base, k; |
167 | struct hpet __iomem *hpet = devp->hd_hpet; | ||
168 | struct hpets *hpetp = devp->hd_hpets; | ||
167 | 169 | ||
168 | t = devp->hd_ireqfreq; | 170 | t = devp->hd_ireqfreq; |
169 | m = read_counter(&devp->hd_timer->hpet_compare); | 171 | m = read_counter(&devp->hd_timer->hpet_compare); |
170 | write_counter(t + m, &devp->hd_timer->hpet_compare); | 172 | mc = read_counter(&hpet->hpet_mc); |
173 | /* The time for the next interrupt would logically be t + m, | ||
174 | * however, if we are very unlucky and the interrupt is delayed | ||
175 | * for longer than t then we will completely miss the next | ||
176 | * interrupt if we set t + m and an application will hang. | ||
177 | * Therefore we need to make a more complex computation assuming | ||
178 | * that there exists a k for which the following is true: | ||
179 | * k * t + base < mc + delta | ||
180 | * (k + 1) * t + base > mc + delta | ||
181 | * where t is the interval in hpet ticks for the given freq, | ||
182 | * base is the theoretical start value 0 < base < t, | ||
183 | * mc is the main counter value at the time of the interrupt, | ||
184 | * delta is the time it takes to write the a value to the | ||
185 | * comparator. | ||
186 | * k may then be computed as (mc - base + delta) / t . | ||
187 | */ | ||
188 | base = mc % t; | ||
189 | k = (mc - base + hpetp->hp_delta) / t; | ||
190 | write_counter(t * (k + 1) + base, | ||
191 | &devp->hd_timer->hpet_compare); | ||
171 | } | 192 | } |
172 | 193 | ||
173 | if (devp->hd_flags & HPET_SHARED_IRQ) | 194 | if (devp->hd_flags & HPET_SHARED_IRQ) |
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c index b60a4c263686..faf7c5217848 100644 --- a/drivers/cpufreq/cpufreq_stats.c +++ b/drivers/cpufreq/cpufreq_stats.c | |||
@@ -298,11 +298,13 @@ static int cpufreq_stat_notifier_trans(struct notifier_block *nb, | |||
298 | old_index = stat->last_index; | 298 | old_index = stat->last_index; |
299 | new_index = freq_table_get_index(stat, freq->new); | 299 | new_index = freq_table_get_index(stat, freq->new); |
300 | 300 | ||
301 | cpufreq_stats_update(freq->cpu); | 301 | /* We can't do stat->time_in_state[-1]= .. */ |
302 | if (old_index == new_index) | 302 | if (old_index == -1 || new_index == -1) |
303 | return 0; | 303 | return 0; |
304 | 304 | ||
305 | if (old_index == -1 || new_index == -1) | 305 | cpufreq_stats_update(freq->cpu); |
306 | |||
307 | if (old_index == new_index) | ||
306 | return 0; | 308 | return 0; |
307 | 309 | ||
308 | spin_lock(&cpufreq_stats_lock); | 310 | spin_lock(&cpufreq_stats_lock); |
@@ -387,6 +389,7 @@ static void __exit cpufreq_stats_exit(void) | |||
387 | unregister_hotcpu_notifier(&cpufreq_stat_cpu_notifier); | 389 | unregister_hotcpu_notifier(&cpufreq_stat_cpu_notifier); |
388 | for_each_online_cpu(cpu) { | 390 | for_each_online_cpu(cpu) { |
389 | cpufreq_stats_free_table(cpu); | 391 | cpufreq_stats_free_table(cpu); |
392 | cpufreq_stats_free_sysfs(cpu); | ||
390 | } | 393 | } |
391 | } | 394 | } |
392 | 395 | ||
diff --git a/drivers/cpufreq/powernow-k8.c b/drivers/cpufreq/powernow-k8.c index 83479b6fb9a1..bce576d7478e 100644 --- a/drivers/cpufreq/powernow-k8.c +++ b/drivers/cpufreq/powernow-k8.c | |||
@@ -1079,6 +1079,9 @@ static int transition_frequency_fidvid(struct powernow_k8_data *data, | |||
1079 | } | 1079 | } |
1080 | 1080 | ||
1081 | res = transition_fid_vid(data, fid, vid); | 1081 | res = transition_fid_vid(data, fid, vid); |
1082 | if (res) | ||
1083 | return res; | ||
1084 | |||
1082 | freqs.new = find_khz_freq_from_fid(data->currfid); | 1085 | freqs.new = find_khz_freq_from_fid(data->currfid); |
1083 | 1086 | ||
1084 | for_each_cpu(i, data->available_cores) { | 1087 | for_each_cpu(i, data->available_cores) { |
@@ -1101,7 +1104,8 @@ static int transition_frequency_pstate(struct powernow_k8_data *data, | |||
1101 | /* get MSR index for hardware pstate transition */ | 1104 | /* get MSR index for hardware pstate transition */ |
1102 | pstate = index & HW_PSTATE_MASK; | 1105 | pstate = index & HW_PSTATE_MASK; |
1103 | if (pstate > data->max_hw_pstate) | 1106 | if (pstate > data->max_hw_pstate) |
1104 | return 0; | 1107 | return -EINVAL; |
1108 | |||
1105 | freqs.old = find_khz_freq_from_pstate(data->powernow_table, | 1109 | freqs.old = find_khz_freq_from_pstate(data->powernow_table, |
1106 | data->currpstate); | 1110 | data->currpstate); |
1107 | freqs.new = find_khz_freq_from_pstate(data->powernow_table, pstate); | 1111 | freqs.new = find_khz_freq_from_pstate(data->powernow_table, pstate); |
diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c index 2a638f9f09a2..028330044201 100644 --- a/drivers/dma/shdma.c +++ b/drivers/dma/shdma.c | |||
@@ -1221,6 +1221,11 @@ static int __init sh_dmae_probe(struct platform_device *pdev) | |||
1221 | } else { | 1221 | } else { |
1222 | do { | 1222 | do { |
1223 | for (i = chanirq_res->start; i <= chanirq_res->end; i++) { | 1223 | for (i = chanirq_res->start; i <= chanirq_res->end; i++) { |
1224 | if (irq_cnt >= SH_DMAC_MAX_CHANNELS) { | ||
1225 | irq_cap = 1; | ||
1226 | break; | ||
1227 | } | ||
1228 | |||
1224 | if ((errirq_res->flags & IORESOURCE_BITS) == | 1229 | if ((errirq_res->flags & IORESOURCE_BITS) == |
1225 | IORESOURCE_IRQ_SHAREABLE) | 1230 | IORESOURCE_IRQ_SHAREABLE) |
1226 | chan_flag[irq_cnt] = IRQF_SHARED; | 1231 | chan_flag[irq_cnt] = IRQF_SHARED; |
@@ -1230,15 +1235,11 @@ static int __init sh_dmae_probe(struct platform_device *pdev) | |||
1230 | "Found IRQ %d for channel %d\n", | 1235 | "Found IRQ %d for channel %d\n", |
1231 | i, irq_cnt); | 1236 | i, irq_cnt); |
1232 | chan_irq[irq_cnt++] = i; | 1237 | chan_irq[irq_cnt++] = i; |
1233 | |||
1234 | if (irq_cnt >= SH_DMAC_MAX_CHANNELS) | ||
1235 | break; | ||
1236 | } | 1238 | } |
1237 | 1239 | ||
1238 | if (irq_cnt >= SH_DMAC_MAX_CHANNELS) { | 1240 | if (irq_cnt >= SH_DMAC_MAX_CHANNELS) |
1239 | irq_cap = 1; | ||
1240 | break; | 1241 | break; |
1241 | } | 1242 | |
1242 | chanirq_res = platform_get_resource(pdev, | 1243 | chanirq_res = platform_get_resource(pdev, |
1243 | IORESOURCE_IRQ, ++irqres); | 1244 | IORESOURCE_IRQ, ++irqres); |
1244 | } while (irq_cnt < pdata->channel_num && chanirq_res); | 1245 | } while (irq_cnt < pdata->channel_num && chanirq_res); |
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index 01f74a8459d9..35bebde23e83 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c | |||
@@ -469,8 +469,9 @@ static inline void set_24xx_gpio_triggering(struct gpio_bank *bank, int gpio, | |||
469 | + OMAP24XX_GPIO_CLEARWKUENA); | 469 | + OMAP24XX_GPIO_CLEARWKUENA); |
470 | } | 470 | } |
471 | } | 471 | } |
472 | /* This part needs to be executed always for OMAP34xx */ | 472 | /* This part needs to be executed always for OMAP{34xx, 44xx} */ |
473 | if (cpu_is_omap34xx() || (bank->non_wakeup_gpios & gpio_bit)) { | 473 | if (cpu_is_omap34xx() || cpu_is_omap44xx() || |
474 | (bank->non_wakeup_gpios & gpio_bit)) { | ||
474 | /* | 475 | /* |
475 | * Log the edge gpio and manually trigger the IRQ | 476 | * Log the edge gpio and manually trigger the IRQ |
476 | * after resume if the input level changes | 477 | * after resume if the input level changes |
diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c index 3e257a50bf56..61e1ef90d4e5 100644 --- a/drivers/gpu/drm/drm_bufs.c +++ b/drivers/gpu/drm/drm_bufs.c | |||
@@ -46,10 +46,11 @@ static struct drm_map_list *drm_find_matching_map(struct drm_device *dev, | |||
46 | list_for_each_entry(entry, &dev->maplist, head) { | 46 | list_for_each_entry(entry, &dev->maplist, head) { |
47 | /* | 47 | /* |
48 | * Because the kernel-userspace ABI is fixed at a 32-bit offset | 48 | * Because the kernel-userspace ABI is fixed at a 32-bit offset |
49 | * while PCI resources may live above that, we ignore the map | 49 | * while PCI resources may live above that, we only compare the |
50 | * offset for maps of type _DRM_FRAMEBUFFER or _DRM_REGISTERS. | 50 | * lower 32 bits of the map offset for maps of type |
51 | * It is assumed that each driver will have only one resource of | 51 | * _DRM_FRAMEBUFFER or _DRM_REGISTERS. |
52 | * each type. | 52 | * It is assumed that if a driver have more than one resource |
53 | * of each type, the lower 32 bits are different. | ||
53 | */ | 54 | */ |
54 | if (!entry->map || | 55 | if (!entry->map || |
55 | map->type != entry->map->type || | 56 | map->type != entry->map->type || |
@@ -59,9 +60,12 @@ static struct drm_map_list *drm_find_matching_map(struct drm_device *dev, | |||
59 | case _DRM_SHM: | 60 | case _DRM_SHM: |
60 | if (map->flags != _DRM_CONTAINS_LOCK) | 61 | if (map->flags != _DRM_CONTAINS_LOCK) |
61 | break; | 62 | break; |
63 | return entry; | ||
62 | case _DRM_REGISTERS: | 64 | case _DRM_REGISTERS: |
63 | case _DRM_FRAME_BUFFER: | 65 | case _DRM_FRAME_BUFFER: |
64 | return entry; | 66 | if ((entry->map->offset & 0xffffffff) == |
67 | (map->offset & 0xffffffff)) | ||
68 | return entry; | ||
65 | default: /* Make gcc happy */ | 69 | default: /* Make gcc happy */ |
66 | ; | 70 | ; |
67 | } | 71 | } |
@@ -183,9 +187,6 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, | |||
183 | return -EINVAL; | 187 | return -EINVAL; |
184 | } | 188 | } |
185 | #endif | 189 | #endif |
186 | #ifdef __alpha__ | ||
187 | map->offset += dev->hose->mem_space->start; | ||
188 | #endif | ||
189 | /* Some drivers preinitialize some maps, without the X Server | 190 | /* Some drivers preinitialize some maps, without the X Server |
190 | * needing to be aware of it. Therefore, we just return success | 191 | * needing to be aware of it. Therefore, we just return success |
191 | * when the server tries to create a duplicate map. | 192 | * when the server tries to create a duplicate map. |
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 872747c5a544..21058e6ad2b8 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c | |||
@@ -1113,7 +1113,7 @@ int drm_mode_getresources(struct drm_device *dev, void *data, | |||
1113 | if (card_res->count_fbs >= fb_count) { | 1113 | if (card_res->count_fbs >= fb_count) { |
1114 | copied = 0; | 1114 | copied = 0; |
1115 | fb_id = (uint32_t __user *)(unsigned long)card_res->fb_id_ptr; | 1115 | fb_id = (uint32_t __user *)(unsigned long)card_res->fb_id_ptr; |
1116 | list_for_each_entry(fb, &file_priv->fbs, head) { | 1116 | list_for_each_entry(fb, &file_priv->fbs, filp_head) { |
1117 | if (put_user(fb->base.id, fb_id + copied)) { | 1117 | if (put_user(fb->base.id, fb_id + copied)) { |
1118 | ret = -EFAULT; | 1118 | ret = -EFAULT; |
1119 | goto out; | 1119 | goto out; |
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 0a9357c66ff8..09292193dafe 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c | |||
@@ -184,9 +184,9 @@ drm_edid_block_valid(u8 *raw_edid) | |||
184 | 184 | ||
185 | bad: | 185 | bad: |
186 | if (raw_edid) { | 186 | if (raw_edid) { |
187 | DRM_ERROR("Raw EDID:\n"); | 187 | printk(KERN_ERR "Raw EDID:\n"); |
188 | print_hex_dump_bytes(KERN_ERR, DUMP_PREFIX_NONE, raw_edid, EDID_LENGTH); | 188 | print_hex_dump_bytes(KERN_ERR, DUMP_PREFIX_NONE, raw_edid, EDID_LENGTH); |
189 | printk("\n"); | 189 | printk(KERN_ERR "\n"); |
190 | } | 190 | } |
191 | return 0; | 191 | return 0; |
192 | } | 192 | } |
@@ -258,6 +258,17 @@ drm_do_probe_ddc_edid(struct i2c_adapter *adapter, unsigned char *buf, | |||
258 | return ret == 2 ? 0 : -1; | 258 | return ret == 2 ? 0 : -1; |
259 | } | 259 | } |
260 | 260 | ||
261 | static bool drm_edid_is_zero(u8 *in_edid, int length) | ||
262 | { | ||
263 | int i; | ||
264 | u32 *raw_edid = (u32 *)in_edid; | ||
265 | |||
266 | for (i = 0; i < length / 4; i++) | ||
267 | if (*(raw_edid + i) != 0) | ||
268 | return false; | ||
269 | return true; | ||
270 | } | ||
271 | |||
261 | static u8 * | 272 | static u8 * |
262 | drm_do_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter) | 273 | drm_do_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter) |
263 | { | 274 | { |
@@ -273,6 +284,10 @@ drm_do_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter) | |||
273 | goto out; | 284 | goto out; |
274 | if (drm_edid_block_valid(block)) | 285 | if (drm_edid_block_valid(block)) |
275 | break; | 286 | break; |
287 | if (i == 0 && drm_edid_is_zero(block, EDID_LENGTH)) { | ||
288 | connector->null_edid_counter++; | ||
289 | goto carp; | ||
290 | } | ||
276 | } | 291 | } |
277 | if (i == 4) | 292 | if (i == 4) |
278 | goto carp; | 293 | goto carp; |
diff --git a/drivers/gpu/drm/drm_ioc32.c b/drivers/gpu/drm/drm_ioc32.c index d61d185cf040..4a058c7af6c0 100644 --- a/drivers/gpu/drm/drm_ioc32.c +++ b/drivers/gpu/drm/drm_ioc32.c | |||
@@ -28,6 +28,7 @@ | |||
28 | * IN THE SOFTWARE. | 28 | * IN THE SOFTWARE. |
29 | */ | 29 | */ |
30 | #include <linux/compat.h> | 30 | #include <linux/compat.h> |
31 | #include <linux/ratelimit.h> | ||
31 | 32 | ||
32 | #include "drmP.h" | 33 | #include "drmP.h" |
33 | #include "drm_core.h" | 34 | #include "drm_core.h" |
@@ -253,10 +254,10 @@ static int compat_drm_addmap(struct file *file, unsigned int cmd, | |||
253 | return -EFAULT; | 254 | return -EFAULT; |
254 | 255 | ||
255 | m32.handle = (unsigned long)handle; | 256 | m32.handle = (unsigned long)handle; |
256 | if (m32.handle != (unsigned long)handle && printk_ratelimit()) | 257 | if (m32.handle != (unsigned long)handle) |
257 | printk(KERN_ERR "compat_drm_addmap truncated handle" | 258 | printk_ratelimited(KERN_ERR "compat_drm_addmap truncated handle" |
258 | " %p for type %d offset %x\n", | 259 | " %p for type %d offset %x\n", |
259 | handle, m32.type, m32.offset); | 260 | handle, m32.type, m32.offset); |
260 | 261 | ||
261 | if (copy_to_user(argp, &m32, sizeof(m32))) | 262 | if (copy_to_user(argp, &m32, sizeof(m32))) |
262 | return -EFAULT; | 263 | return -EFAULT; |
diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c index e1aee4f6a7c6..b6a19cb07caf 100644 --- a/drivers/gpu/drm/drm_pci.c +++ b/drivers/gpu/drm/drm_pci.c | |||
@@ -251,7 +251,7 @@ err: | |||
251 | } | 251 | } |
252 | 252 | ||
253 | 253 | ||
254 | int drm_pci_irq_by_busid(struct drm_device *dev, struct drm_irq_busid *p) | 254 | static int drm_pci_irq_by_busid(struct drm_device *dev, struct drm_irq_busid *p) |
255 | { | 255 | { |
256 | if ((p->busnum >> 8) != drm_get_pci_domain(dev) || | 256 | if ((p->busnum >> 8) != drm_get_pci_domain(dev) || |
257 | (p->busnum & 0xff) != dev->pdev->bus->number || | 257 | (p->busnum & 0xff) != dev->pdev->bus->number || |
@@ -292,6 +292,7 @@ static struct drm_bus drm_pci_bus = { | |||
292 | .get_name = drm_pci_get_name, | 292 | .get_name = drm_pci_get_name, |
293 | .set_busid = drm_pci_set_busid, | 293 | .set_busid = drm_pci_set_busid, |
294 | .set_unique = drm_pci_set_unique, | 294 | .set_unique = drm_pci_set_unique, |
295 | .irq_by_busid = drm_pci_irq_by_busid, | ||
295 | .agp_init = drm_pci_agp_init, | 296 | .agp_init = drm_pci_agp_init, |
296 | }; | 297 | }; |
297 | 298 | ||
diff --git a/drivers/gpu/drm/drm_vm.c b/drivers/gpu/drm/drm_vm.c index 2c3fcbdfd8ff..5db96d45fc71 100644 --- a/drivers/gpu/drm/drm_vm.c +++ b/drivers/gpu/drm/drm_vm.c | |||
@@ -526,7 +526,7 @@ static int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma) | |||
526 | static resource_size_t drm_core_get_reg_ofs(struct drm_device *dev) | 526 | static resource_size_t drm_core_get_reg_ofs(struct drm_device *dev) |
527 | { | 527 | { |
528 | #ifdef __alpha__ | 528 | #ifdef __alpha__ |
529 | return dev->hose->dense_mem_base - dev->hose->mem_space->start; | 529 | return dev->hose->dense_mem_base; |
530 | #else | 530 | #else |
531 | return 0; | 531 | return 0; |
532 | #endif | 532 | #endif |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 12d32579b951..94c84d744100 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -465,8 +465,10 @@ i915_gem_shmem_pread_slow(struct drm_device *dev, | |||
465 | 465 | ||
466 | page = read_cache_page_gfp(mapping, offset >> PAGE_SHIFT, | 466 | page = read_cache_page_gfp(mapping, offset >> PAGE_SHIFT, |
467 | GFP_HIGHUSER | __GFP_RECLAIMABLE); | 467 | GFP_HIGHUSER | __GFP_RECLAIMABLE); |
468 | if (IS_ERR(page)) | 468 | if (IS_ERR(page)) { |
469 | return PTR_ERR(page); | 469 | ret = PTR_ERR(page); |
470 | goto out; | ||
471 | } | ||
470 | 472 | ||
471 | if (do_bit17_swizzling) { | 473 | if (do_bit17_swizzling) { |
472 | slow_shmem_bit17_copy(page, | 474 | slow_shmem_bit17_copy(page, |
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index b9fafe3b045b..9e34a1abeb61 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c | |||
@@ -1740,6 +1740,16 @@ void ironlake_irq_preinstall(struct drm_device *dev) | |||
1740 | INIT_WORK(&dev_priv->rps_work, gen6_pm_rps_work); | 1740 | INIT_WORK(&dev_priv->rps_work, gen6_pm_rps_work); |
1741 | 1741 | ||
1742 | I915_WRITE(HWSTAM, 0xeffe); | 1742 | I915_WRITE(HWSTAM, 0xeffe); |
1743 | if (IS_GEN6(dev)) { | ||
1744 | /* Workaround stalls observed on Sandy Bridge GPUs by | ||
1745 | * making the blitter command streamer generate a | ||
1746 | * write to the Hardware Status Page for | ||
1747 | * MI_USER_INTERRUPT. This appears to serialize the | ||
1748 | * previous seqno write out before the interrupt | ||
1749 | * happens. | ||
1750 | */ | ||
1751 | I915_WRITE(GEN6_BLITTER_HWSTAM, ~GEN6_BLITTER_USER_INTERRUPT); | ||
1752 | } | ||
1743 | 1753 | ||
1744 | /* XXX hotplug from PCH */ | 1754 | /* XXX hotplug from PCH */ |
1745 | 1755 | ||
diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c index d3b903bce7c5..d98cee60b602 100644 --- a/drivers/gpu/drm/i915/intel_i2c.c +++ b/drivers/gpu/drm/i915/intel_i2c.c | |||
@@ -401,8 +401,7 @@ int intel_setup_gmbus(struct drm_device *dev) | |||
401 | bus->reg0 = i | GMBUS_RATE_100KHZ; | 401 | bus->reg0 = i | GMBUS_RATE_100KHZ; |
402 | 402 | ||
403 | /* XXX force bit banging until GMBUS is fully debugged */ | 403 | /* XXX force bit banging until GMBUS is fully debugged */ |
404 | if (IS_GEN2(dev)) | 404 | bus->force_bit = intel_gpio_create(dev_priv, i); |
405 | bus->force_bit = intel_gpio_create(dev_priv, i); | ||
406 | } | 405 | } |
407 | 406 | ||
408 | intel_i2c_reset(dev_priv->dev); | 407 | intel_i2c_reset(dev_priv->dev); |
diff --git a/drivers/gpu/drm/mga/mga_drv.h b/drivers/gpu/drm/mga/mga_drv.h index 1084fa4d261b..54558a01969a 100644 --- a/drivers/gpu/drm/mga/mga_drv.h +++ b/drivers/gpu/drm/mga/mga_drv.h | |||
@@ -195,29 +195,10 @@ extern long mga_compat_ioctl(struct file *filp, unsigned int cmd, | |||
195 | 195 | ||
196 | #define mga_flush_write_combine() DRM_WRITEMEMORYBARRIER() | 196 | #define mga_flush_write_combine() DRM_WRITEMEMORYBARRIER() |
197 | 197 | ||
198 | #if defined(__linux__) && defined(__alpha__) | ||
199 | #define MGA_BASE(reg) ((unsigned long)(dev_priv->mmio->handle)) | ||
200 | #define MGA_ADDR(reg) (MGA_BASE(reg) + reg) | ||
201 | |||
202 | #define MGA_DEREF(reg) (*(volatile u32 *)MGA_ADDR(reg)) | ||
203 | #define MGA_DEREF8(reg) (*(volatile u8 *)MGA_ADDR(reg)) | ||
204 | |||
205 | #define MGA_READ(reg) (_MGA_READ((u32 *)MGA_ADDR(reg))) | ||
206 | #define MGA_READ8(reg) (_MGA_READ((u8 *)MGA_ADDR(reg))) | ||
207 | #define MGA_WRITE(reg, val) do { DRM_WRITEMEMORYBARRIER(); MGA_DEREF(reg) = val; } while (0) | ||
208 | #define MGA_WRITE8(reg, val) do { DRM_WRITEMEMORYBARRIER(); MGA_DEREF8(reg) = val; } while (0) | ||
209 | |||
210 | static inline u32 _MGA_READ(u32 *addr) | ||
211 | { | ||
212 | DRM_MEMORYBARRIER(); | ||
213 | return *(volatile u32 *)addr; | ||
214 | } | ||
215 | #else | ||
216 | #define MGA_READ8(reg) DRM_READ8(dev_priv->mmio, (reg)) | 198 | #define MGA_READ8(reg) DRM_READ8(dev_priv->mmio, (reg)) |
217 | #define MGA_READ(reg) DRM_READ32(dev_priv->mmio, (reg)) | 199 | #define MGA_READ(reg) DRM_READ32(dev_priv->mmio, (reg)) |
218 | #define MGA_WRITE8(reg, val) DRM_WRITE8(dev_priv->mmio, (reg), (val)) | 200 | #define MGA_WRITE8(reg, val) DRM_WRITE8(dev_priv->mmio, (reg), (val)) |
219 | #define MGA_WRITE(reg, val) DRM_WRITE32(dev_priv->mmio, (reg), (val)) | 201 | #define MGA_WRITE(reg, val) DRM_WRITE32(dev_priv->mmio, (reg), (val)) |
220 | #endif | ||
221 | 202 | ||
222 | #define DWGREG0 0x1c00 | 203 | #define DWGREG0 0x1c00 |
223 | #define DWGREG0_END 0x1dff | 204 | #define DWGREG0_END 0x1dff |
diff --git a/drivers/gpu/drm/radeon/atombios.h b/drivers/gpu/drm/radeon/atombios.h index 49611e2365d9..1b50ad8919d5 100644 --- a/drivers/gpu/drm/radeon/atombios.h +++ b/drivers/gpu/drm/radeon/atombios.h | |||
@@ -1200,6 +1200,7 @@ typedef struct _EXTERNAL_ENCODER_CONTROL_PARAMETERS_V3 | |||
1200 | #define EXTERNAL_ENCODER_ACTION_V3_ENCODER_BLANKING_OFF 0x10 | 1200 | #define EXTERNAL_ENCODER_ACTION_V3_ENCODER_BLANKING_OFF 0x10 |
1201 | #define EXTERNAL_ENCODER_ACTION_V3_ENCODER_BLANKING 0x11 | 1201 | #define EXTERNAL_ENCODER_ACTION_V3_ENCODER_BLANKING 0x11 |
1202 | #define EXTERNAL_ENCODER_ACTION_V3_DACLOAD_DETECTION 0x12 | 1202 | #define EXTERNAL_ENCODER_ACTION_V3_DACLOAD_DETECTION 0x12 |
1203 | #define EXTERNAL_ENCODER_ACTION_V3_DDC_SETUP 0x14 | ||
1203 | 1204 | ||
1204 | // ucConfig | 1205 | // ucConfig |
1205 | #define EXTERNAL_ENCODER_CONFIG_V3_DPLINKRATE_MASK 0x03 | 1206 | #define EXTERNAL_ENCODER_CONFIG_V3_DPLINKRATE_MASK 0x03 |
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index 84a69e7fa11e..9541995e4b21 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | |||
@@ -671,6 +671,13 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, | |||
671 | DISPPLL_CONFIG_DUAL_LINK; | 671 | DISPPLL_CONFIG_DUAL_LINK; |
672 | } | 672 | } |
673 | } | 673 | } |
674 | if (radeon_encoder_is_dp_bridge(encoder)) { | ||
675 | struct drm_encoder *ext_encoder = radeon_atom_get_external_encoder(encoder); | ||
676 | struct radeon_encoder *ext_radeon_encoder = to_radeon_encoder(ext_encoder); | ||
677 | args.v3.sInput.ucExtTransmitterID = ext_radeon_encoder->encoder_id; | ||
678 | } else | ||
679 | args.v3.sInput.ucExtTransmitterID = 0; | ||
680 | |||
674 | atom_execute_table(rdev->mode_info.atom_context, | 681 | atom_execute_table(rdev->mode_info.atom_context, |
675 | index, (uint32_t *)&args); | 682 | index, (uint32_t *)&args); |
676 | adjusted_clock = le32_to_cpu(args.v3.sOutput.ulDispPllFreq) * 10; | 683 | adjusted_clock = le32_to_cpu(args.v3.sOutput.ulDispPllFreq) * 10; |
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 98ea597bc76d..7162b7bacac0 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -88,7 +88,8 @@ u32 evergreen_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base) | |||
88 | /* get temperature in millidegrees */ | 88 | /* get temperature in millidegrees */ |
89 | int evergreen_get_temp(struct radeon_device *rdev) | 89 | int evergreen_get_temp(struct radeon_device *rdev) |
90 | { | 90 | { |
91 | u32 temp, toffset, actual_temp = 0; | 91 | u32 temp, toffset; |
92 | int actual_temp = 0; | ||
92 | 93 | ||
93 | if (rdev->family == CHIP_JUNIPER) { | 94 | if (rdev->family == CHIP_JUNIPER) { |
94 | toffset = (RREG32(CG_THERMAL_CTRL) & TOFFSET_MASK) >> | 95 | toffset = (RREG32(CG_THERMAL_CTRL) & TOFFSET_MASK) >> |
@@ -2694,28 +2695,25 @@ static inline u32 evergreen_get_ih_wptr(struct radeon_device *rdev) | |||
2694 | 2695 | ||
2695 | int evergreen_irq_process(struct radeon_device *rdev) | 2696 | int evergreen_irq_process(struct radeon_device *rdev) |
2696 | { | 2697 | { |
2697 | u32 wptr = evergreen_get_ih_wptr(rdev); | 2698 | u32 wptr; |
2698 | u32 rptr = rdev->ih.rptr; | 2699 | u32 rptr; |
2699 | u32 src_id, src_data; | 2700 | u32 src_id, src_data; |
2700 | u32 ring_index; | 2701 | u32 ring_index; |
2701 | unsigned long flags; | 2702 | unsigned long flags; |
2702 | bool queue_hotplug = false; | 2703 | bool queue_hotplug = false; |
2703 | 2704 | ||
2704 | DRM_DEBUG("r600_irq_process start: rptr %d, wptr %d\n", rptr, wptr); | 2705 | if (!rdev->ih.enabled || rdev->shutdown) |
2705 | if (!rdev->ih.enabled) | ||
2706 | return IRQ_NONE; | 2706 | return IRQ_NONE; |
2707 | 2707 | ||
2708 | spin_lock_irqsave(&rdev->ih.lock, flags); | 2708 | wptr = evergreen_get_ih_wptr(rdev); |
2709 | rptr = rdev->ih.rptr; | ||
2710 | DRM_DEBUG("r600_irq_process start: rptr %d, wptr %d\n", rptr, wptr); | ||
2709 | 2711 | ||
2712 | spin_lock_irqsave(&rdev->ih.lock, flags); | ||
2710 | if (rptr == wptr) { | 2713 | if (rptr == wptr) { |
2711 | spin_unlock_irqrestore(&rdev->ih.lock, flags); | 2714 | spin_unlock_irqrestore(&rdev->ih.lock, flags); |
2712 | return IRQ_NONE; | 2715 | return IRQ_NONE; |
2713 | } | 2716 | } |
2714 | if (rdev->shutdown) { | ||
2715 | spin_unlock_irqrestore(&rdev->ih.lock, flags); | ||
2716 | return IRQ_NONE; | ||
2717 | } | ||
2718 | |||
2719 | restart_ih: | 2717 | restart_ih: |
2720 | /* display interrupts */ | 2718 | /* display interrupts */ |
2721 | evergreen_irq_ack(rdev); | 2719 | evergreen_irq_ack(rdev); |
@@ -2944,7 +2942,7 @@ restart_ih: | |||
2944 | radeon_fence_process(rdev); | 2942 | radeon_fence_process(rdev); |
2945 | break; | 2943 | break; |
2946 | case 233: /* GUI IDLE */ | 2944 | case 233: /* GUI IDLE */ |
2947 | DRM_DEBUG("IH: CP EOP\n"); | 2945 | DRM_DEBUG("IH: GUI idle\n"); |
2948 | rdev->pm.gui_idle = true; | 2946 | rdev->pm.gui_idle = true; |
2949 | wake_up(&rdev->irq.idle_queue); | 2947 | wake_up(&rdev->irq.idle_queue); |
2950 | break; | 2948 | break; |
diff --git a/drivers/gpu/drm/radeon/r100_track.h b/drivers/gpu/drm/radeon/r100_track.h index 2fef9de7f363..686f9dc5d4bd 100644 --- a/drivers/gpu/drm/radeon/r100_track.h +++ b/drivers/gpu/drm/radeon/r100_track.h | |||
@@ -63,7 +63,7 @@ struct r100_cs_track { | |||
63 | unsigned num_arrays; | 63 | unsigned num_arrays; |
64 | unsigned max_indx; | 64 | unsigned max_indx; |
65 | unsigned color_channel_mask; | 65 | unsigned color_channel_mask; |
66 | struct r100_cs_track_array arrays[11]; | 66 | struct r100_cs_track_array arrays[16]; |
67 | struct r100_cs_track_cb cb[R300_MAX_CB]; | 67 | struct r100_cs_track_cb cb[R300_MAX_CB]; |
68 | struct r100_cs_track_cb zb; | 68 | struct r100_cs_track_cb zb; |
69 | struct r100_cs_track_cb aa; | 69 | struct r100_cs_track_cb aa; |
@@ -146,6 +146,12 @@ static inline int r100_packet3_load_vbpntr(struct radeon_cs_parser *p, | |||
146 | ib = p->ib->ptr; | 146 | ib = p->ib->ptr; |
147 | track = (struct r100_cs_track *)p->track; | 147 | track = (struct r100_cs_track *)p->track; |
148 | c = radeon_get_ib_value(p, idx++) & 0x1F; | 148 | c = radeon_get_ib_value(p, idx++) & 0x1F; |
149 | if (c > 16) { | ||
150 | DRM_ERROR("Only 16 vertex buffers are allowed %d\n", | ||
151 | pkt->opcode); | ||
152 | r100_cs_dump_packet(p, pkt); | ||
153 | return -EINVAL; | ||
154 | } | ||
149 | track->num_arrays = c; | 155 | track->num_arrays = c; |
150 | for (i = 0; i < (c - 1); i+=2, idx+=3) { | 156 | for (i = 0; i < (c - 1); i+=2, idx+=3) { |
151 | r = r100_cs_packet_next_reloc(p, &reloc); | 157 | r = r100_cs_packet_next_reloc(p, &reloc); |
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index d74d4d71437f..dc9fde38ef49 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
@@ -3294,27 +3294,26 @@ static inline u32 r600_get_ih_wptr(struct radeon_device *rdev) | |||
3294 | 3294 | ||
3295 | int r600_irq_process(struct radeon_device *rdev) | 3295 | int r600_irq_process(struct radeon_device *rdev) |
3296 | { | 3296 | { |
3297 | u32 wptr = r600_get_ih_wptr(rdev); | 3297 | u32 wptr; |
3298 | u32 rptr = rdev->ih.rptr; | 3298 | u32 rptr; |
3299 | u32 src_id, src_data; | 3299 | u32 src_id, src_data; |
3300 | u32 ring_index; | 3300 | u32 ring_index; |
3301 | unsigned long flags; | 3301 | unsigned long flags; |
3302 | bool queue_hotplug = false; | 3302 | bool queue_hotplug = false; |
3303 | 3303 | ||
3304 | DRM_DEBUG("r600_irq_process start: rptr %d, wptr %d\n", rptr, wptr); | 3304 | if (!rdev->ih.enabled || rdev->shutdown) |
3305 | if (!rdev->ih.enabled) | ||
3306 | return IRQ_NONE; | 3305 | return IRQ_NONE; |
3307 | 3306 | ||
3307 | wptr = r600_get_ih_wptr(rdev); | ||
3308 | rptr = rdev->ih.rptr; | ||
3309 | DRM_DEBUG("r600_irq_process start: rptr %d, wptr %d\n", rptr, wptr); | ||
3310 | |||
3308 | spin_lock_irqsave(&rdev->ih.lock, flags); | 3311 | spin_lock_irqsave(&rdev->ih.lock, flags); |
3309 | 3312 | ||
3310 | if (rptr == wptr) { | 3313 | if (rptr == wptr) { |
3311 | spin_unlock_irqrestore(&rdev->ih.lock, flags); | 3314 | spin_unlock_irqrestore(&rdev->ih.lock, flags); |
3312 | return IRQ_NONE; | 3315 | return IRQ_NONE; |
3313 | } | 3316 | } |
3314 | if (rdev->shutdown) { | ||
3315 | spin_unlock_irqrestore(&rdev->ih.lock, flags); | ||
3316 | return IRQ_NONE; | ||
3317 | } | ||
3318 | 3317 | ||
3319 | restart_ih: | 3318 | restart_ih: |
3320 | /* display interrupts */ | 3319 | /* display interrupts */ |
@@ -3444,7 +3443,7 @@ restart_ih: | |||
3444 | radeon_fence_process(rdev); | 3443 | radeon_fence_process(rdev); |
3445 | break; | 3444 | break; |
3446 | case 233: /* GUI IDLE */ | 3445 | case 233: /* GUI IDLE */ |
3447 | DRM_DEBUG("IH: CP EOP\n"); | 3446 | DRM_DEBUG("IH: GUI idle\n"); |
3448 | rdev->pm.gui_idle = true; | 3447 | rdev->pm.gui_idle = true; |
3449 | wake_up(&rdev->irq.idle_queue); | 3448 | wake_up(&rdev->irq.idle_queue); |
3450 | break; | 3449 | break; |
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index ba643b576054..27f45579e64b 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -165,6 +165,7 @@ struct radeon_clock { | |||
165 | uint32_t default_sclk; | 165 | uint32_t default_sclk; |
166 | uint32_t default_dispclk; | 166 | uint32_t default_dispclk; |
167 | uint32_t dp_extclk; | 167 | uint32_t dp_extclk; |
168 | uint32_t max_pixel_clock; | ||
168 | }; | 169 | }; |
169 | 170 | ||
170 | /* | 171 | /* |
diff --git a/drivers/gpu/drm/radeon/radeon_asic.c b/drivers/gpu/drm/radeon/radeon_asic.c index 9bd162fc9b0c..b2449629537d 100644 --- a/drivers/gpu/drm/radeon/radeon_asic.c +++ b/drivers/gpu/drm/radeon/radeon_asic.c | |||
@@ -938,6 +938,13 @@ static struct radeon_asic cayman_asic = { | |||
938 | int radeon_asic_init(struct radeon_device *rdev) | 938 | int radeon_asic_init(struct radeon_device *rdev) |
939 | { | 939 | { |
940 | radeon_register_accessor_init(rdev); | 940 | radeon_register_accessor_init(rdev); |
941 | |||
942 | /* set the number of crtcs */ | ||
943 | if (rdev->flags & RADEON_SINGLE_CRTC) | ||
944 | rdev->num_crtc = 1; | ||
945 | else | ||
946 | rdev->num_crtc = 2; | ||
947 | |||
941 | switch (rdev->family) { | 948 | switch (rdev->family) { |
942 | case CHIP_R100: | 949 | case CHIP_R100: |
943 | case CHIP_RV100: | 950 | case CHIP_RV100: |
@@ -1017,6 +1024,11 @@ int radeon_asic_init(struct radeon_device *rdev) | |||
1017 | case CHIP_JUNIPER: | 1024 | case CHIP_JUNIPER: |
1018 | case CHIP_CYPRESS: | 1025 | case CHIP_CYPRESS: |
1019 | case CHIP_HEMLOCK: | 1026 | case CHIP_HEMLOCK: |
1027 | /* set num crtcs */ | ||
1028 | if (rdev->family == CHIP_CEDAR) | ||
1029 | rdev->num_crtc = 4; | ||
1030 | else | ||
1031 | rdev->num_crtc = 6; | ||
1020 | rdev->asic = &evergreen_asic; | 1032 | rdev->asic = &evergreen_asic; |
1021 | break; | 1033 | break; |
1022 | case CHIP_PALM: | 1034 | case CHIP_PALM: |
@@ -1027,10 +1039,17 @@ int radeon_asic_init(struct radeon_device *rdev) | |||
1027 | case CHIP_BARTS: | 1039 | case CHIP_BARTS: |
1028 | case CHIP_TURKS: | 1040 | case CHIP_TURKS: |
1029 | case CHIP_CAICOS: | 1041 | case CHIP_CAICOS: |
1042 | /* set num crtcs */ | ||
1043 | if (rdev->family == CHIP_CAICOS) | ||
1044 | rdev->num_crtc = 4; | ||
1045 | else | ||
1046 | rdev->num_crtc = 6; | ||
1030 | rdev->asic = &btc_asic; | 1047 | rdev->asic = &btc_asic; |
1031 | break; | 1048 | break; |
1032 | case CHIP_CAYMAN: | 1049 | case CHIP_CAYMAN: |
1033 | rdev->asic = &cayman_asic; | 1050 | rdev->asic = &cayman_asic; |
1051 | /* set num crtcs */ | ||
1052 | rdev->num_crtc = 6; | ||
1034 | break; | 1053 | break; |
1035 | default: | 1054 | default: |
1036 | /* FIXME: not supported yet */ | 1055 | /* FIXME: not supported yet */ |
@@ -1042,18 +1061,6 @@ int radeon_asic_init(struct radeon_device *rdev) | |||
1042 | rdev->asic->set_memory_clock = NULL; | 1061 | rdev->asic->set_memory_clock = NULL; |
1043 | } | 1062 | } |
1044 | 1063 | ||
1045 | /* set the number of crtcs */ | ||
1046 | if (rdev->flags & RADEON_SINGLE_CRTC) | ||
1047 | rdev->num_crtc = 1; | ||
1048 | else { | ||
1049 | if (ASIC_IS_DCE41(rdev)) | ||
1050 | rdev->num_crtc = 2; | ||
1051 | else if (ASIC_IS_DCE4(rdev)) | ||
1052 | rdev->num_crtc = 6; | ||
1053 | else | ||
1054 | rdev->num_crtc = 2; | ||
1055 | } | ||
1056 | |||
1057 | return 0; | 1064 | return 0; |
1058 | } | 1065 | } |
1059 | 1066 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c index 90dfb2b8cf03..fa62a503ae70 100644 --- a/drivers/gpu/drm/radeon/radeon_atombios.c +++ b/drivers/gpu/drm/radeon/radeon_atombios.c | |||
@@ -1246,6 +1246,10 @@ bool radeon_atom_get_clock_info(struct drm_device *dev) | |||
1246 | } | 1246 | } |
1247 | *dcpll = *p1pll; | 1247 | *dcpll = *p1pll; |
1248 | 1248 | ||
1249 | rdev->clock.max_pixel_clock = le16_to_cpu(firmware_info->info.usMaxPixelClock); | ||
1250 | if (rdev->clock.max_pixel_clock == 0) | ||
1251 | rdev->clock.max_pixel_clock = 40000; | ||
1252 | |||
1249 | return true; | 1253 | return true; |
1250 | } | 1254 | } |
1251 | 1255 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_clocks.c b/drivers/gpu/drm/radeon/radeon_clocks.c index 5249af8931e6..2d48e7a1474b 100644 --- a/drivers/gpu/drm/radeon/radeon_clocks.c +++ b/drivers/gpu/drm/radeon/radeon_clocks.c | |||
@@ -117,7 +117,7 @@ static bool __devinit radeon_read_clocks_OF(struct drm_device *dev) | |||
117 | p1pll->reference_div = RREG32_PLL(RADEON_PPLL_REF_DIV) & 0x3ff; | 117 | p1pll->reference_div = RREG32_PLL(RADEON_PPLL_REF_DIV) & 0x3ff; |
118 | if (p1pll->reference_div < 2) | 118 | if (p1pll->reference_div < 2) |
119 | p1pll->reference_div = 12; | 119 | p1pll->reference_div = 12; |
120 | p2pll->reference_div = p1pll->reference_div; | 120 | p2pll->reference_div = p1pll->reference_div; |
121 | 121 | ||
122 | /* These aren't in the device-tree */ | 122 | /* These aren't in the device-tree */ |
123 | if (rdev->family >= CHIP_R420) { | 123 | if (rdev->family >= CHIP_R420) { |
@@ -139,6 +139,8 @@ static bool __devinit radeon_read_clocks_OF(struct drm_device *dev) | |||
139 | p2pll->pll_out_min = 12500; | 139 | p2pll->pll_out_min = 12500; |
140 | p2pll->pll_out_max = 35000; | 140 | p2pll->pll_out_max = 35000; |
141 | } | 141 | } |
142 | /* not sure what the max should be in all cases */ | ||
143 | rdev->clock.max_pixel_clock = 35000; | ||
142 | 144 | ||
143 | spll->reference_freq = mpll->reference_freq = p1pll->reference_freq; | 145 | spll->reference_freq = mpll->reference_freq = p1pll->reference_freq; |
144 | spll->reference_div = mpll->reference_div = | 146 | spll->reference_div = mpll->reference_div = |
@@ -151,7 +153,7 @@ static bool __devinit radeon_read_clocks_OF(struct drm_device *dev) | |||
151 | else | 153 | else |
152 | rdev->clock.default_sclk = | 154 | rdev->clock.default_sclk = |
153 | radeon_legacy_get_engine_clock(rdev); | 155 | radeon_legacy_get_engine_clock(rdev); |
154 | 156 | ||
155 | val = of_get_property(dp, "ATY,MCLK", NULL); | 157 | val = of_get_property(dp, "ATY,MCLK", NULL); |
156 | if (val && *val) | 158 | if (val && *val) |
157 | rdev->clock.default_mclk = (*val) / 10; | 159 | rdev->clock.default_mclk = (*val) / 10; |
@@ -160,7 +162,7 @@ static bool __devinit radeon_read_clocks_OF(struct drm_device *dev) | |||
160 | radeon_legacy_get_memory_clock(rdev); | 162 | radeon_legacy_get_memory_clock(rdev); |
161 | 163 | ||
162 | DRM_INFO("Using device-tree clock info\n"); | 164 | DRM_INFO("Using device-tree clock info\n"); |
163 | 165 | ||
164 | return true; | 166 | return true; |
165 | } | 167 | } |
166 | #else | 168 | #else |
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c index 5b991f7c6e2a..e4594676a07c 100644 --- a/drivers/gpu/drm/radeon/radeon_combios.c +++ b/drivers/gpu/drm/radeon/radeon_combios.c | |||
@@ -866,6 +866,11 @@ bool radeon_combios_get_clock_info(struct drm_device *dev) | |||
866 | rdev->clock.default_sclk = sclk; | 866 | rdev->clock.default_sclk = sclk; |
867 | rdev->clock.default_mclk = mclk; | 867 | rdev->clock.default_mclk = mclk; |
868 | 868 | ||
869 | if (RBIOS32(pll_info + 0x16)) | ||
870 | rdev->clock.max_pixel_clock = RBIOS32(pll_info + 0x16); | ||
871 | else | ||
872 | rdev->clock.max_pixel_clock = 35000; /* might need something asic specific */ | ||
873 | |||
869 | return true; | 874 | return true; |
870 | } | 875 | } |
871 | return false; | 876 | return false; |
@@ -1548,10 +1553,12 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
1548 | (rdev->pdev->subsystem_device == 0x4a48)) { | 1553 | (rdev->pdev->subsystem_device == 0x4a48)) { |
1549 | /* Mac X800 */ | 1554 | /* Mac X800 */ |
1550 | rdev->mode_info.connector_table = CT_MAC_X800; | 1555 | rdev->mode_info.connector_table = CT_MAC_X800; |
1551 | } else if ((rdev->pdev->device == 0x4150) && | 1556 | } else if ((of_machine_is_compatible("PowerMac7,2") || |
1557 | of_machine_is_compatible("PowerMac7,3")) && | ||
1558 | (rdev->pdev->device == 0x4150) && | ||
1552 | (rdev->pdev->subsystem_vendor == 0x1002) && | 1559 | (rdev->pdev->subsystem_vendor == 0x1002) && |
1553 | (rdev->pdev->subsystem_device == 0x4150)) { | 1560 | (rdev->pdev->subsystem_device == 0x4150)) { |
1554 | /* Mac G5 9600 */ | 1561 | /* Mac G5 tower 9600 */ |
1555 | rdev->mode_info.connector_table = CT_MAC_G5_9600; | 1562 | rdev->mode_info.connector_table = CT_MAC_G5_9600; |
1556 | } else | 1563 | } else |
1557 | #endif /* CONFIG_PPC_PMAC */ | 1564 | #endif /* CONFIG_PPC_PMAC */ |
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c index ee1dccb3fec9..cbfca3a24fdf 100644 --- a/drivers/gpu/drm/radeon/radeon_connectors.c +++ b/drivers/gpu/drm/radeon/radeon_connectors.c | |||
@@ -44,6 +44,8 @@ extern void | |||
44 | radeon_legacy_backlight_init(struct radeon_encoder *radeon_encoder, | 44 | radeon_legacy_backlight_init(struct radeon_encoder *radeon_encoder, |
45 | struct drm_connector *drm_connector); | 45 | struct drm_connector *drm_connector); |
46 | 46 | ||
47 | bool radeon_connector_encoder_is_dp_bridge(struct drm_connector *connector); | ||
48 | |||
47 | void radeon_connector_hotplug(struct drm_connector *connector) | 49 | void radeon_connector_hotplug(struct drm_connector *connector) |
48 | { | 50 | { |
49 | struct drm_device *dev = connector->dev; | 51 | struct drm_device *dev = connector->dev; |
@@ -626,8 +628,14 @@ static int radeon_vga_get_modes(struct drm_connector *connector) | |||
626 | static int radeon_vga_mode_valid(struct drm_connector *connector, | 628 | static int radeon_vga_mode_valid(struct drm_connector *connector, |
627 | struct drm_display_mode *mode) | 629 | struct drm_display_mode *mode) |
628 | { | 630 | { |
631 | struct drm_device *dev = connector->dev; | ||
632 | struct radeon_device *rdev = dev->dev_private; | ||
633 | |||
629 | /* XXX check mode bandwidth */ | 634 | /* XXX check mode bandwidth */ |
630 | /* XXX verify against max DAC output frequency */ | 635 | |
636 | if ((mode->clock / 10) > rdev->clock.max_pixel_clock) | ||
637 | return MODE_CLOCK_HIGH; | ||
638 | |||
631 | return MODE_OK; | 639 | return MODE_OK; |
632 | } | 640 | } |
633 | 641 | ||
@@ -830,6 +838,13 @@ radeon_dvi_detect(struct drm_connector *connector, bool force) | |||
830 | if (!radeon_connector->edid) { | 838 | if (!radeon_connector->edid) { |
831 | DRM_ERROR("%s: probed a monitor but no|invalid EDID\n", | 839 | DRM_ERROR("%s: probed a monitor but no|invalid EDID\n", |
832 | drm_get_connector_name(connector)); | 840 | drm_get_connector_name(connector)); |
841 | /* rs690 seems to have a problem with connectors not existing and always | ||
842 | * return a block of 0's. If we see this just stop polling on this output */ | ||
843 | if ((rdev->family == CHIP_RS690 || rdev->family == CHIP_RS740) && radeon_connector->base.null_edid_counter) { | ||
844 | ret = connector_status_disconnected; | ||
845 | DRM_ERROR("%s: detected RS690 floating bus bug, stopping ddc detect\n", drm_get_connector_name(connector)); | ||
846 | radeon_connector->ddc_bus = NULL; | ||
847 | } | ||
833 | } else { | 848 | } else { |
834 | radeon_connector->use_digital = !!(radeon_connector->edid->input & DRM_EDID_INPUT_DIGITAL); | 849 | radeon_connector->use_digital = !!(radeon_connector->edid->input & DRM_EDID_INPUT_DIGITAL); |
835 | 850 | ||
@@ -1015,6 +1030,11 @@ static int radeon_dvi_mode_valid(struct drm_connector *connector, | |||
1015 | } else | 1030 | } else |
1016 | return MODE_CLOCK_HIGH; | 1031 | return MODE_CLOCK_HIGH; |
1017 | } | 1032 | } |
1033 | |||
1034 | /* check against the max pixel clock */ | ||
1035 | if ((mode->clock / 10) > rdev->clock.max_pixel_clock) | ||
1036 | return MODE_CLOCK_HIGH; | ||
1037 | |||
1018 | return MODE_OK; | 1038 | return MODE_OK; |
1019 | } | 1039 | } |
1020 | 1040 | ||
@@ -1052,10 +1072,11 @@ static int radeon_dp_get_modes(struct drm_connector *connector) | |||
1052 | { | 1072 | { |
1053 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | 1073 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
1054 | struct radeon_connector_atom_dig *radeon_dig_connector = radeon_connector->con_priv; | 1074 | struct radeon_connector_atom_dig *radeon_dig_connector = radeon_connector->con_priv; |
1075 | struct drm_encoder *encoder = radeon_best_single_encoder(connector); | ||
1055 | int ret; | 1076 | int ret; |
1056 | 1077 | ||
1057 | if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) { | 1078 | if ((connector->connector_type == DRM_MODE_CONNECTOR_eDP) || |
1058 | struct drm_encoder *encoder; | 1079 | (connector->connector_type == DRM_MODE_CONNECTOR_LVDS)) { |
1059 | struct drm_display_mode *mode; | 1080 | struct drm_display_mode *mode; |
1060 | 1081 | ||
1061 | if (!radeon_dig_connector->edp_on) | 1082 | if (!radeon_dig_connector->edp_on) |
@@ -1067,7 +1088,6 @@ static int radeon_dp_get_modes(struct drm_connector *connector) | |||
1067 | ATOM_TRANSMITTER_ACTION_POWER_OFF); | 1088 | ATOM_TRANSMITTER_ACTION_POWER_OFF); |
1068 | 1089 | ||
1069 | if (ret > 0) { | 1090 | if (ret > 0) { |
1070 | encoder = radeon_best_single_encoder(connector); | ||
1071 | if (encoder) { | 1091 | if (encoder) { |
1072 | radeon_fixup_lvds_native_mode(encoder, connector); | 1092 | radeon_fixup_lvds_native_mode(encoder, connector); |
1073 | /* add scaled modes */ | 1093 | /* add scaled modes */ |
@@ -1091,8 +1111,14 @@ static int radeon_dp_get_modes(struct drm_connector *connector) | |||
1091 | /* add scaled modes */ | 1111 | /* add scaled modes */ |
1092 | radeon_add_common_modes(encoder, connector); | 1112 | radeon_add_common_modes(encoder, connector); |
1093 | } | 1113 | } |
1094 | } else | 1114 | } else { |
1115 | /* need to setup ddc on the bridge */ | ||
1116 | if (radeon_connector_encoder_is_dp_bridge(connector)) { | ||
1117 | if (encoder) | ||
1118 | radeon_atom_ext_encoder_setup_ddc(encoder); | ||
1119 | } | ||
1095 | ret = radeon_ddc_get_modes(radeon_connector); | 1120 | ret = radeon_ddc_get_modes(radeon_connector); |
1121 | } | ||
1096 | 1122 | ||
1097 | return ret; | 1123 | return ret; |
1098 | } | 1124 | } |
@@ -1176,14 +1202,15 @@ radeon_dp_detect(struct drm_connector *connector, bool force) | |||
1176 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | 1202 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
1177 | enum drm_connector_status ret = connector_status_disconnected; | 1203 | enum drm_connector_status ret = connector_status_disconnected; |
1178 | struct radeon_connector_atom_dig *radeon_dig_connector = radeon_connector->con_priv; | 1204 | struct radeon_connector_atom_dig *radeon_dig_connector = radeon_connector->con_priv; |
1205 | struct drm_encoder *encoder = radeon_best_single_encoder(connector); | ||
1179 | 1206 | ||
1180 | if (radeon_connector->edid) { | 1207 | if (radeon_connector->edid) { |
1181 | kfree(radeon_connector->edid); | 1208 | kfree(radeon_connector->edid); |
1182 | radeon_connector->edid = NULL; | 1209 | radeon_connector->edid = NULL; |
1183 | } | 1210 | } |
1184 | 1211 | ||
1185 | if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) { | 1212 | if ((connector->connector_type == DRM_MODE_CONNECTOR_eDP) || |
1186 | struct drm_encoder *encoder = radeon_best_single_encoder(connector); | 1213 | (connector->connector_type == DRM_MODE_CONNECTOR_LVDS)) { |
1187 | if (encoder) { | 1214 | if (encoder) { |
1188 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 1215 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
1189 | struct drm_display_mode *native_mode = &radeon_encoder->native_mode; | 1216 | struct drm_display_mode *native_mode = &radeon_encoder->native_mode; |
@@ -1203,6 +1230,11 @@ radeon_dp_detect(struct drm_connector *connector, bool force) | |||
1203 | atombios_set_edp_panel_power(connector, | 1230 | atombios_set_edp_panel_power(connector, |
1204 | ATOM_TRANSMITTER_ACTION_POWER_OFF); | 1231 | ATOM_TRANSMITTER_ACTION_POWER_OFF); |
1205 | } else { | 1232 | } else { |
1233 | /* need to setup ddc on the bridge */ | ||
1234 | if (radeon_connector_encoder_is_dp_bridge(connector)) { | ||
1235 | if (encoder) | ||
1236 | radeon_atom_ext_encoder_setup_ddc(encoder); | ||
1237 | } | ||
1206 | radeon_dig_connector->dp_sink_type = radeon_dp_getsinktype(radeon_connector); | 1238 | radeon_dig_connector->dp_sink_type = radeon_dp_getsinktype(radeon_connector); |
1207 | if (radeon_hpd_sense(rdev, radeon_connector->hpd.hpd)) { | 1239 | if (radeon_hpd_sense(rdev, radeon_connector->hpd.hpd)) { |
1208 | ret = connector_status_connected; | 1240 | ret = connector_status_connected; |
@@ -1217,6 +1249,16 @@ radeon_dp_detect(struct drm_connector *connector, bool force) | |||
1217 | ret = connector_status_connected; | 1249 | ret = connector_status_connected; |
1218 | } | 1250 | } |
1219 | } | 1251 | } |
1252 | |||
1253 | if ((ret == connector_status_disconnected) && | ||
1254 | radeon_connector->dac_load_detect) { | ||
1255 | struct drm_encoder *encoder = radeon_best_single_encoder(connector); | ||
1256 | struct drm_encoder_helper_funcs *encoder_funcs; | ||
1257 | if (encoder) { | ||
1258 | encoder_funcs = encoder->helper_private; | ||
1259 | ret = encoder_funcs->detect(encoder, connector); | ||
1260 | } | ||
1261 | } | ||
1220 | } | 1262 | } |
1221 | 1263 | ||
1222 | radeon_connector_update_scratch_regs(connector, ret); | 1264 | radeon_connector_update_scratch_regs(connector, ret); |
@@ -1231,7 +1273,8 @@ static int radeon_dp_mode_valid(struct drm_connector *connector, | |||
1231 | 1273 | ||
1232 | /* XXX check mode bandwidth */ | 1274 | /* XXX check mode bandwidth */ |
1233 | 1275 | ||
1234 | if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) { | 1276 | if ((connector->connector_type == DRM_MODE_CONNECTOR_eDP) || |
1277 | (connector->connector_type == DRM_MODE_CONNECTOR_LVDS)) { | ||
1235 | struct drm_encoder *encoder = radeon_best_single_encoder(connector); | 1278 | struct drm_encoder *encoder = radeon_best_single_encoder(connector); |
1236 | 1279 | ||
1237 | if ((mode->hdisplay < 320) || (mode->vdisplay < 240)) | 1280 | if ((mode->hdisplay < 320) || (mode->vdisplay < 240)) |
@@ -1241,7 +1284,7 @@ static int radeon_dp_mode_valid(struct drm_connector *connector, | |||
1241 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 1284 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
1242 | struct drm_display_mode *native_mode = &radeon_encoder->native_mode; | 1285 | struct drm_display_mode *native_mode = &radeon_encoder->native_mode; |
1243 | 1286 | ||
1244 | /* AVIVO hardware supports downscaling modes larger than the panel | 1287 | /* AVIVO hardware supports downscaling modes larger than the panel |
1245 | * to the panel size, but I'm not sure this is desirable. | 1288 | * to the panel size, but I'm not sure this is desirable. |
1246 | */ | 1289 | */ |
1247 | if ((mode->hdisplay > native_mode->hdisplay) || | 1290 | if ((mode->hdisplay > native_mode->hdisplay) || |
@@ -1390,6 +1433,10 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
1390 | default: | 1433 | default: |
1391 | connector->interlace_allowed = true; | 1434 | connector->interlace_allowed = true; |
1392 | connector->doublescan_allowed = true; | 1435 | connector->doublescan_allowed = true; |
1436 | radeon_connector->dac_load_detect = true; | ||
1437 | drm_connector_attach_property(&radeon_connector->base, | ||
1438 | rdev->mode_info.load_detect_property, | ||
1439 | 1); | ||
1393 | break; | 1440 | break; |
1394 | case DRM_MODE_CONNECTOR_DVII: | 1441 | case DRM_MODE_CONNECTOR_DVII: |
1395 | case DRM_MODE_CONNECTOR_DVID: | 1442 | case DRM_MODE_CONNECTOR_DVID: |
@@ -1411,6 +1458,12 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
1411 | connector->doublescan_allowed = true; | 1458 | connector->doublescan_allowed = true; |
1412 | else | 1459 | else |
1413 | connector->doublescan_allowed = false; | 1460 | connector->doublescan_allowed = false; |
1461 | if (connector_type == DRM_MODE_CONNECTOR_DVII) { | ||
1462 | radeon_connector->dac_load_detect = true; | ||
1463 | drm_connector_attach_property(&radeon_connector->base, | ||
1464 | rdev->mode_info.load_detect_property, | ||
1465 | 1); | ||
1466 | } | ||
1414 | break; | 1467 | break; |
1415 | case DRM_MODE_CONNECTOR_LVDS: | 1468 | case DRM_MODE_CONNECTOR_LVDS: |
1416 | case DRM_MODE_CONNECTOR_eDP: | 1469 | case DRM_MODE_CONNECTOR_eDP: |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index e680501c78ea..7cfaa7e2f3b5 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -215,6 +215,8 @@ int radeon_wb_init(struct radeon_device *rdev) | |||
215 | return r; | 215 | return r; |
216 | } | 216 | } |
217 | 217 | ||
218 | /* clear wb memory */ | ||
219 | memset((char *)rdev->wb.wb, 0, RADEON_GPU_PAGE_SIZE); | ||
218 | /* disable event_write fences */ | 220 | /* disable event_write fences */ |
219 | rdev->wb.use_event = false; | 221 | rdev->wb.use_event = false; |
220 | /* disabled via module param */ | 222 | /* disabled via module param */ |
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c index 03f124d626c2..b293487e5aa3 100644 --- a/drivers/gpu/drm/radeon/radeon_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_encoders.c | |||
@@ -367,7 +367,8 @@ static bool radeon_atom_mode_fixup(struct drm_encoder *encoder, | |||
367 | } | 367 | } |
368 | 368 | ||
369 | if (ASIC_IS_DCE3(rdev) && | 369 | if (ASIC_IS_DCE3(rdev) && |
370 | (radeon_encoder->active_device & (ATOM_DEVICE_DFP_SUPPORT | ATOM_DEVICE_LCD_SUPPORT))) { | 370 | ((radeon_encoder->active_device & (ATOM_DEVICE_DFP_SUPPORT | ATOM_DEVICE_LCD_SUPPORT)) || |
371 | radeon_encoder_is_dp_bridge(encoder))) { | ||
371 | struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); | 372 | struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); |
372 | radeon_dp_set_link_config(connector, mode); | 373 | radeon_dp_set_link_config(connector, mode); |
373 | } | 374 | } |
@@ -660,21 +661,16 @@ atombios_get_encoder_mode(struct drm_encoder *encoder) | |||
660 | if (radeon_encoder_is_dp_bridge(encoder)) | 661 | if (radeon_encoder_is_dp_bridge(encoder)) |
661 | return ATOM_ENCODER_MODE_DP; | 662 | return ATOM_ENCODER_MODE_DP; |
662 | 663 | ||
664 | /* DVO is always DVO */ | ||
665 | if (radeon_encoder->encoder_id == ATOM_ENCODER_MODE_DVO) | ||
666 | return ATOM_ENCODER_MODE_DVO; | ||
667 | |||
663 | connector = radeon_get_connector_for_encoder(encoder); | 668 | connector = radeon_get_connector_for_encoder(encoder); |
664 | if (!connector) { | 669 | /* if we don't have an active device yet, just use one of |
665 | switch (radeon_encoder->encoder_id) { | 670 | * the connectors tied to the encoder. |
666 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY: | 671 | */ |
667 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1: | 672 | if (!connector) |
668 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2: | 673 | connector = radeon_get_connector_for_encoder_init(encoder); |
669 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA: | ||
670 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1: | ||
671 | return ATOM_ENCODER_MODE_DVI; | ||
672 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: | ||
673 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2: | ||
674 | default: | ||
675 | return ATOM_ENCODER_MODE_CRT; | ||
676 | } | ||
677 | } | ||
678 | radeon_connector = to_radeon_connector(connector); | 674 | radeon_connector = to_radeon_connector(connector); |
679 | 675 | ||
680 | switch (connector->connector_type) { | 676 | switch (connector->connector_type) { |
@@ -1094,9 +1090,10 @@ atombios_dig_transmitter_setup(struct drm_encoder *encoder, int action, uint8_t | |||
1094 | break; | 1090 | break; |
1095 | } | 1091 | } |
1096 | 1092 | ||
1097 | if (is_dp) | 1093 | if (is_dp) { |
1098 | args.v2.acConfig.fCoherentMode = 1; | 1094 | args.v2.acConfig.fCoherentMode = 1; |
1099 | else if (radeon_encoder->devices & (ATOM_DEVICE_DFP_SUPPORT)) { | 1095 | args.v2.acConfig.fDPConnector = 1; |
1096 | } else if (radeon_encoder->devices & (ATOM_DEVICE_DFP_SUPPORT)) { | ||
1100 | if (dig->coherent_mode) | 1097 | if (dig->coherent_mode) |
1101 | args.v2.acConfig.fCoherentMode = 1; | 1098 | args.v2.acConfig.fCoherentMode = 1; |
1102 | if (radeon_encoder->pixel_clock > 165000) | 1099 | if (radeon_encoder->pixel_clock > 165000) |
@@ -1435,7 +1432,11 @@ radeon_atom_encoder_dpms(struct drm_encoder *encoder, int mode) | |||
1435 | if (is_dig) { | 1432 | if (is_dig) { |
1436 | switch (mode) { | 1433 | switch (mode) { |
1437 | case DRM_MODE_DPMS_ON: | 1434 | case DRM_MODE_DPMS_ON: |
1438 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE_OUTPUT, 0, 0); | 1435 | /* some early dce3.2 boards have a bug in their transmitter control table */ |
1436 | if ((rdev->family == CHIP_RV710) || (rdev->family == CHIP_RV730)) | ||
1437 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE, 0, 0); | ||
1438 | else | ||
1439 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE_OUTPUT, 0, 0); | ||
1439 | if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_DP) { | 1440 | if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_DP) { |
1440 | struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); | 1441 | struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); |
1441 | 1442 | ||
@@ -1526,26 +1527,29 @@ radeon_atom_encoder_dpms(struct drm_encoder *encoder, int mode) | |||
1526 | } | 1527 | } |
1527 | 1528 | ||
1528 | if (ext_encoder) { | 1529 | if (ext_encoder) { |
1529 | int action; | ||
1530 | |||
1531 | switch (mode) { | 1530 | switch (mode) { |
1532 | case DRM_MODE_DPMS_ON: | 1531 | case DRM_MODE_DPMS_ON: |
1533 | default: | 1532 | default: |
1534 | if (ASIC_IS_DCE41(rdev)) | 1533 | if (ASIC_IS_DCE41(rdev)) { |
1535 | action = EXTERNAL_ENCODER_ACTION_V3_ENABLE_OUTPUT; | 1534 | atombios_external_encoder_setup(encoder, ext_encoder, |
1536 | else | 1535 | EXTERNAL_ENCODER_ACTION_V3_ENABLE_OUTPUT); |
1537 | action = ATOM_ENABLE; | 1536 | atombios_external_encoder_setup(encoder, ext_encoder, |
1537 | EXTERNAL_ENCODER_ACTION_V3_ENCODER_BLANKING_OFF); | ||
1538 | } else | ||
1539 | atombios_external_encoder_setup(encoder, ext_encoder, ATOM_ENABLE); | ||
1538 | break; | 1540 | break; |
1539 | case DRM_MODE_DPMS_STANDBY: | 1541 | case DRM_MODE_DPMS_STANDBY: |
1540 | case DRM_MODE_DPMS_SUSPEND: | 1542 | case DRM_MODE_DPMS_SUSPEND: |
1541 | case DRM_MODE_DPMS_OFF: | 1543 | case DRM_MODE_DPMS_OFF: |
1542 | if (ASIC_IS_DCE41(rdev)) | 1544 | if (ASIC_IS_DCE41(rdev)) { |
1543 | action = EXTERNAL_ENCODER_ACTION_V3_DISABLE_OUTPUT; | 1545 | atombios_external_encoder_setup(encoder, ext_encoder, |
1544 | else | 1546 | EXTERNAL_ENCODER_ACTION_V3_ENCODER_BLANKING); |
1545 | action = ATOM_DISABLE; | 1547 | atombios_external_encoder_setup(encoder, ext_encoder, |
1548 | EXTERNAL_ENCODER_ACTION_V3_DISABLE_OUTPUT); | ||
1549 | } else | ||
1550 | atombios_external_encoder_setup(encoder, ext_encoder, ATOM_DISABLE); | ||
1546 | break; | 1551 | break; |
1547 | } | 1552 | } |
1548 | atombios_external_encoder_setup(encoder, ext_encoder, action); | ||
1549 | } | 1553 | } |
1550 | 1554 | ||
1551 | radeon_atombios_encoder_dpms_scratch_regs(encoder, (mode == DRM_MODE_DPMS_ON) ? true : false); | 1555 | radeon_atombios_encoder_dpms_scratch_regs(encoder, (mode == DRM_MODE_DPMS_ON) ? true : false); |
@@ -2004,6 +2008,65 @@ radeon_atom_dac_detect(struct drm_encoder *encoder, struct drm_connector *connec | |||
2004 | return connector_status_disconnected; | 2008 | return connector_status_disconnected; |
2005 | } | 2009 | } |
2006 | 2010 | ||
2011 | static enum drm_connector_status | ||
2012 | radeon_atom_dig_detect(struct drm_encoder *encoder, struct drm_connector *connector) | ||
2013 | { | ||
2014 | struct drm_device *dev = encoder->dev; | ||
2015 | struct radeon_device *rdev = dev->dev_private; | ||
2016 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | ||
2017 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | ||
2018 | struct drm_encoder *ext_encoder = radeon_atom_get_external_encoder(encoder); | ||
2019 | u32 bios_0_scratch; | ||
2020 | |||
2021 | if (!ASIC_IS_DCE4(rdev)) | ||
2022 | return connector_status_unknown; | ||
2023 | |||
2024 | if (!ext_encoder) | ||
2025 | return connector_status_unknown; | ||
2026 | |||
2027 | if ((radeon_connector->devices & ATOM_DEVICE_CRT_SUPPORT) == 0) | ||
2028 | return connector_status_unknown; | ||
2029 | |||
2030 | /* load detect on the dp bridge */ | ||
2031 | atombios_external_encoder_setup(encoder, ext_encoder, | ||
2032 | EXTERNAL_ENCODER_ACTION_V3_DACLOAD_DETECTION); | ||
2033 | |||
2034 | bios_0_scratch = RREG32(R600_BIOS_0_SCRATCH); | ||
2035 | |||
2036 | DRM_DEBUG_KMS("Bios 0 scratch %x %08x\n", bios_0_scratch, radeon_encoder->devices); | ||
2037 | if (radeon_connector->devices & ATOM_DEVICE_CRT1_SUPPORT) { | ||
2038 | if (bios_0_scratch & ATOM_S0_CRT1_MASK) | ||
2039 | return connector_status_connected; | ||
2040 | } | ||
2041 | if (radeon_connector->devices & ATOM_DEVICE_CRT2_SUPPORT) { | ||
2042 | if (bios_0_scratch & ATOM_S0_CRT2_MASK) | ||
2043 | return connector_status_connected; | ||
2044 | } | ||
2045 | if (radeon_connector->devices & ATOM_DEVICE_CV_SUPPORT) { | ||
2046 | if (bios_0_scratch & (ATOM_S0_CV_MASK|ATOM_S0_CV_MASK_A)) | ||
2047 | return connector_status_connected; | ||
2048 | } | ||
2049 | if (radeon_connector->devices & ATOM_DEVICE_TV1_SUPPORT) { | ||
2050 | if (bios_0_scratch & (ATOM_S0_TV1_COMPOSITE | ATOM_S0_TV1_COMPOSITE_A)) | ||
2051 | return connector_status_connected; /* CTV */ | ||
2052 | else if (bios_0_scratch & (ATOM_S0_TV1_SVIDEO | ATOM_S0_TV1_SVIDEO_A)) | ||
2053 | return connector_status_connected; /* STV */ | ||
2054 | } | ||
2055 | return connector_status_disconnected; | ||
2056 | } | ||
2057 | |||
2058 | void | ||
2059 | radeon_atom_ext_encoder_setup_ddc(struct drm_encoder *encoder) | ||
2060 | { | ||
2061 | struct drm_encoder *ext_encoder = radeon_atom_get_external_encoder(encoder); | ||
2062 | |||
2063 | if (ext_encoder) | ||
2064 | /* ddc_setup on the dp bridge */ | ||
2065 | atombios_external_encoder_setup(encoder, ext_encoder, | ||
2066 | EXTERNAL_ENCODER_ACTION_V3_DDC_SETUP); | ||
2067 | |||
2068 | } | ||
2069 | |||
2007 | static void radeon_atom_encoder_prepare(struct drm_encoder *encoder) | 2070 | static void radeon_atom_encoder_prepare(struct drm_encoder *encoder) |
2008 | { | 2071 | { |
2009 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 2072 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
@@ -2167,7 +2230,7 @@ static const struct drm_encoder_helper_funcs radeon_atom_dig_helper_funcs = { | |||
2167 | .mode_set = radeon_atom_encoder_mode_set, | 2230 | .mode_set = radeon_atom_encoder_mode_set, |
2168 | .commit = radeon_atom_encoder_commit, | 2231 | .commit = radeon_atom_encoder_commit, |
2169 | .disable = radeon_atom_encoder_disable, | 2232 | .disable = radeon_atom_encoder_disable, |
2170 | /* no detect for TMDS/LVDS yet */ | 2233 | .detect = radeon_atom_dig_detect, |
2171 | }; | 2234 | }; |
2172 | 2235 | ||
2173 | static const struct drm_encoder_helper_funcs radeon_atom_dac_helper_funcs = { | 2236 | static const struct drm_encoder_helper_funcs radeon_atom_dac_helper_funcs = { |
diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c index 1f8229436570..021d2b6b556f 100644 --- a/drivers/gpu/drm/radeon/radeon_fence.c +++ b/drivers/gpu/drm/radeon/radeon_fence.c | |||
@@ -40,6 +40,35 @@ | |||
40 | #include "radeon.h" | 40 | #include "radeon.h" |
41 | #include "radeon_trace.h" | 41 | #include "radeon_trace.h" |
42 | 42 | ||
43 | static void radeon_fence_write(struct radeon_device *rdev, u32 seq) | ||
44 | { | ||
45 | if (rdev->wb.enabled) { | ||
46 | u32 scratch_index; | ||
47 | if (rdev->wb.use_event) | ||
48 | scratch_index = R600_WB_EVENT_OFFSET + rdev->fence_drv.scratch_reg - rdev->scratch.reg_base; | ||
49 | else | ||
50 | scratch_index = RADEON_WB_SCRATCH_OFFSET + rdev->fence_drv.scratch_reg - rdev->scratch.reg_base; | ||
51 | rdev->wb.wb[scratch_index/4] = cpu_to_le32(seq);; | ||
52 | } else | ||
53 | WREG32(rdev->fence_drv.scratch_reg, seq); | ||
54 | } | ||
55 | |||
56 | static u32 radeon_fence_read(struct radeon_device *rdev) | ||
57 | { | ||
58 | u32 seq; | ||
59 | |||
60 | if (rdev->wb.enabled) { | ||
61 | u32 scratch_index; | ||
62 | if (rdev->wb.use_event) | ||
63 | scratch_index = R600_WB_EVENT_OFFSET + rdev->fence_drv.scratch_reg - rdev->scratch.reg_base; | ||
64 | else | ||
65 | scratch_index = RADEON_WB_SCRATCH_OFFSET + rdev->fence_drv.scratch_reg - rdev->scratch.reg_base; | ||
66 | seq = le32_to_cpu(rdev->wb.wb[scratch_index/4]); | ||
67 | } else | ||
68 | seq = RREG32(rdev->fence_drv.scratch_reg); | ||
69 | return seq; | ||
70 | } | ||
71 | |||
43 | int radeon_fence_emit(struct radeon_device *rdev, struct radeon_fence *fence) | 72 | int radeon_fence_emit(struct radeon_device *rdev, struct radeon_fence *fence) |
44 | { | 73 | { |
45 | unsigned long irq_flags; | 74 | unsigned long irq_flags; |
@@ -50,12 +79,12 @@ int radeon_fence_emit(struct radeon_device *rdev, struct radeon_fence *fence) | |||
50 | return 0; | 79 | return 0; |
51 | } | 80 | } |
52 | fence->seq = atomic_add_return(1, &rdev->fence_drv.seq); | 81 | fence->seq = atomic_add_return(1, &rdev->fence_drv.seq); |
53 | if (!rdev->cp.ready) { | 82 | if (!rdev->cp.ready) |
54 | /* FIXME: cp is not running assume everythings is done right | 83 | /* FIXME: cp is not running assume everythings is done right |
55 | * away | 84 | * away |
56 | */ | 85 | */ |
57 | WREG32(rdev->fence_drv.scratch_reg, fence->seq); | 86 | radeon_fence_write(rdev, fence->seq); |
58 | } else | 87 | else |
59 | radeon_fence_ring_emit(rdev, fence); | 88 | radeon_fence_ring_emit(rdev, fence); |
60 | 89 | ||
61 | trace_radeon_fence_emit(rdev->ddev, fence->seq); | 90 | trace_radeon_fence_emit(rdev->ddev, fence->seq); |
@@ -73,15 +102,7 @@ static bool radeon_fence_poll_locked(struct radeon_device *rdev) | |||
73 | bool wake = false; | 102 | bool wake = false; |
74 | unsigned long cjiffies; | 103 | unsigned long cjiffies; |
75 | 104 | ||
76 | if (rdev->wb.enabled) { | 105 | seq = radeon_fence_read(rdev); |
77 | u32 scratch_index; | ||
78 | if (rdev->wb.use_event) | ||
79 | scratch_index = R600_WB_EVENT_OFFSET + rdev->fence_drv.scratch_reg - rdev->scratch.reg_base; | ||
80 | else | ||
81 | scratch_index = RADEON_WB_SCRATCH_OFFSET + rdev->fence_drv.scratch_reg - rdev->scratch.reg_base; | ||
82 | seq = le32_to_cpu(rdev->wb.wb[scratch_index/4]); | ||
83 | } else | ||
84 | seq = RREG32(rdev->fence_drv.scratch_reg); | ||
85 | if (seq != rdev->fence_drv.last_seq) { | 106 | if (seq != rdev->fence_drv.last_seq) { |
86 | rdev->fence_drv.last_seq = seq; | 107 | rdev->fence_drv.last_seq = seq; |
87 | rdev->fence_drv.last_jiffies = jiffies; | 108 | rdev->fence_drv.last_jiffies = jiffies; |
@@ -251,7 +272,7 @@ retry: | |||
251 | r = radeon_gpu_reset(rdev); | 272 | r = radeon_gpu_reset(rdev); |
252 | if (r) | 273 | if (r) |
253 | return r; | 274 | return r; |
254 | WREG32(rdev->fence_drv.scratch_reg, fence->seq); | 275 | radeon_fence_write(rdev, fence->seq); |
255 | rdev->gpu_lockup = false; | 276 | rdev->gpu_lockup = false; |
256 | } | 277 | } |
257 | timeout = RADEON_FENCE_JIFFIES_TIMEOUT; | 278 | timeout = RADEON_FENCE_JIFFIES_TIMEOUT; |
@@ -351,7 +372,7 @@ int radeon_fence_driver_init(struct radeon_device *rdev) | |||
351 | write_unlock_irqrestore(&rdev->fence_drv.lock, irq_flags); | 372 | write_unlock_irqrestore(&rdev->fence_drv.lock, irq_flags); |
352 | return r; | 373 | return r; |
353 | } | 374 | } |
354 | WREG32(rdev->fence_drv.scratch_reg, 0); | 375 | radeon_fence_write(rdev, 0); |
355 | atomic_set(&rdev->fence_drv.seq, 0); | 376 | atomic_set(&rdev->fence_drv.seq, 0); |
356 | INIT_LIST_HEAD(&rdev->fence_drv.created); | 377 | INIT_LIST_HEAD(&rdev->fence_drv.created); |
357 | INIT_LIST_HEAD(&rdev->fence_drv.emited); | 378 | INIT_LIST_HEAD(&rdev->fence_drv.emited); |
@@ -391,7 +412,7 @@ static int radeon_debugfs_fence_info(struct seq_file *m, void *data) | |||
391 | struct radeon_fence *fence; | 412 | struct radeon_fence *fence; |
392 | 413 | ||
393 | seq_printf(m, "Last signaled fence 0x%08X\n", | 414 | seq_printf(m, "Last signaled fence 0x%08X\n", |
394 | RREG32(rdev->fence_drv.scratch_reg)); | 415 | radeon_fence_read(rdev)); |
395 | if (!list_empty(&rdev->fence_drv.emited)) { | 416 | if (!list_empty(&rdev->fence_drv.emited)) { |
396 | fence = list_entry(rdev->fence_drv.emited.prev, | 417 | fence = list_entry(rdev->fence_drv.emited.prev, |
397 | struct radeon_fence, list); | 418 | struct radeon_fence, list); |
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h index 977a341266b6..6df4e3cec0c2 100644 --- a/drivers/gpu/drm/radeon/radeon_mode.h +++ b/drivers/gpu/drm/radeon/radeon_mode.h | |||
@@ -483,6 +483,8 @@ extern void radeon_atom_encoder_init(struct radeon_device *rdev); | |||
483 | extern void atombios_dig_transmitter_setup(struct drm_encoder *encoder, | 483 | extern void atombios_dig_transmitter_setup(struct drm_encoder *encoder, |
484 | int action, uint8_t lane_num, | 484 | int action, uint8_t lane_num, |
485 | uint8_t lane_set); | 485 | uint8_t lane_set); |
486 | extern void radeon_atom_ext_encoder_setup_ddc(struct drm_encoder *encoder); | ||
487 | extern struct drm_encoder *radeon_atom_get_external_encoder(struct drm_encoder *encoder); | ||
486 | extern int radeon_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode, | 488 | extern int radeon_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode, |
487 | u8 write_byte, u8 *read_byte); | 489 | u8 write_byte, u8 *read_byte); |
488 | 490 | ||
diff --git a/drivers/gpu/drm/savage/savage_bci.c b/drivers/gpu/drm/savage/savage_bci.c index bf5f83ea14fe..cb1ee4e0050a 100644 --- a/drivers/gpu/drm/savage/savage_bci.c +++ b/drivers/gpu/drm/savage/savage_bci.c | |||
@@ -647,9 +647,6 @@ int savage_driver_firstopen(struct drm_device *dev) | |||
647 | ret = drm_addmap(dev, aperture_base, SAVAGE_APERTURE_SIZE, | 647 | ret = drm_addmap(dev, aperture_base, SAVAGE_APERTURE_SIZE, |
648 | _DRM_FRAME_BUFFER, _DRM_WRITE_COMBINING, | 648 | _DRM_FRAME_BUFFER, _DRM_WRITE_COMBINING, |
649 | &dev_priv->aperture); | 649 | &dev_priv->aperture); |
650 | if (ret) | ||
651 | return ret; | ||
652 | |||
653 | return ret; | 650 | return ret; |
654 | } | 651 | } |
655 | 652 | ||
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index 67d2a7585934..36ca465c00ce 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig | |||
@@ -305,6 +305,7 @@ config HID_MULTITOUCH | |||
305 | - 3M PCT touch screens | 305 | - 3M PCT touch screens |
306 | - ActionStar dual touch panels | 306 | - ActionStar dual touch panels |
307 | - Cando dual touch panels | 307 | - Cando dual touch panels |
308 | - Chunghwa panels | ||
308 | - CVTouch panels | 309 | - CVTouch panels |
309 | - Cypress TrueTouch panels | 310 | - Cypress TrueTouch panels |
310 | - Elo TouchSystems IntelliTouch Plus panels | 311 | - Elo TouchSystems IntelliTouch Plus panels |
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index c957c4b4fe70..f7440e8ce3e7 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -1359,6 +1359,7 @@ static const struct hid_device_id hid_have_special_driver[] = { | |||
1359 | { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION_SOLAR) }, | 1359 | { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION_SOLAR) }, |
1360 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) }, | 1360 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) }, |
1361 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS) }, | 1361 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS) }, |
1362 | { HID_USB_DEVICE(USB_VENDOR_ID_CHUNGHWAT, USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH) }, | ||
1362 | { HID_USB_DEVICE(USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_PRODIKEYS_PCMIDI) }, | 1363 | { HID_USB_DEVICE(USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_PRODIKEYS_PCMIDI) }, |
1363 | { HID_USB_DEVICE(USB_VENDOR_ID_CVTOUCH, USB_DEVICE_ID_CVTOUCH_SCREEN) }, | 1364 | { HID_USB_DEVICE(USB_VENDOR_ID_CVTOUCH, USB_DEVICE_ID_CVTOUCH_SCREEN) }, |
1364 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) }, | 1365 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) }, |
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 0b374a6d6db0..aecb5a4b8d6d 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
@@ -173,6 +173,9 @@ | |||
173 | #define USB_DEVICE_ID_CHICONY_MULTI_TOUCH 0xb19d | 173 | #define USB_DEVICE_ID_CHICONY_MULTI_TOUCH 0xb19d |
174 | #define USB_DEVICE_ID_CHICONY_WIRELESS 0x0618 | 174 | #define USB_DEVICE_ID_CHICONY_WIRELESS 0x0618 |
175 | 175 | ||
176 | #define USB_VENDOR_ID_CHUNGHWAT 0x2247 | ||
177 | #define USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH 0x0001 | ||
178 | |||
176 | #define USB_VENDOR_ID_CIDC 0x1677 | 179 | #define USB_VENDOR_ID_CIDC 0x1677 |
177 | 180 | ||
178 | #define USB_VENDOR_ID_CMEDIA 0x0d8c | 181 | #define USB_VENDOR_ID_CMEDIA 0x0d8c |
@@ -622,6 +625,7 @@ | |||
622 | #define USB_VENDOR_ID_UCLOGIC 0x5543 | 625 | #define USB_VENDOR_ID_UCLOGIC 0x5543 |
623 | #define USB_DEVICE_ID_UCLOGIC_TABLET_PF1209 0x0042 | 626 | #define USB_DEVICE_ID_UCLOGIC_TABLET_PF1209 0x0042 |
624 | #define USB_DEVICE_ID_UCLOGIC_TABLET_KNA5 0x6001 | 627 | #define USB_DEVICE_ID_UCLOGIC_TABLET_KNA5 0x6001 |
628 | #define USB_DEVICE_ID_UCLOGIC_TABLET_TWA60 0x0064 | ||
625 | #define USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U 0x0003 | 629 | #define USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U 0x0003 |
626 | #define USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U 0x0004 | 630 | #define USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U 0x0004 |
627 | #define USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U 0x0005 | 631 | #define USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U 0x0005 |
diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c index a5eda4c8127a..0ec91c18a421 100644 --- a/drivers/hid/hid-magicmouse.c +++ b/drivers/hid/hid-magicmouse.c | |||
@@ -501,17 +501,9 @@ static int magicmouse_probe(struct hid_device *hdev, | |||
501 | } | 501 | } |
502 | report->size = 6; | 502 | report->size = 6; |
503 | 503 | ||
504 | /* | ||
505 | * The device reponds with 'invalid report id' when feature | ||
506 | * report switching it into multitouch mode is sent to it. | ||
507 | * | ||
508 | * This results in -EIO from the _raw low-level transport callback, | ||
509 | * but there seems to be no other way of switching the mode. | ||
510 | * Thus the super-ugly hacky success check below. | ||
511 | */ | ||
512 | ret = hdev->hid_output_raw_report(hdev, feature, sizeof(feature), | 504 | ret = hdev->hid_output_raw_report(hdev, feature, sizeof(feature), |
513 | HID_FEATURE_REPORT); | 505 | HID_FEATURE_REPORT); |
514 | if (ret != -EIO) { | 506 | if (ret != sizeof(feature)) { |
515 | hid_err(hdev, "unable to request touch data (%d)\n", ret); | 507 | hid_err(hdev, "unable to request touch data (%d)\n", ret); |
516 | goto err_stop_hw; | 508 | goto err_stop_hw; |
517 | } | 509 | } |
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index ecd4d2db9e80..0b2dcd0ee591 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c | |||
@@ -64,6 +64,7 @@ struct mt_device { | |||
64 | struct mt_class *mtclass; /* our mt device class */ | 64 | struct mt_class *mtclass; /* our mt device class */ |
65 | unsigned last_field_index; /* last field index of the report */ | 65 | unsigned last_field_index; /* last field index of the report */ |
66 | unsigned last_slot_field; /* the last field of a slot */ | 66 | unsigned last_slot_field; /* the last field of a slot */ |
67 | int last_mt_collection; /* last known mt-related collection */ | ||
67 | __s8 inputmode; /* InputMode HID feature, -1 if non-existent */ | 68 | __s8 inputmode; /* InputMode HID feature, -1 if non-existent */ |
68 | __u8 num_received; /* how many contacts we received */ | 69 | __u8 num_received; /* how many contacts we received */ |
69 | __u8 num_expected; /* expected last contact index */ | 70 | __u8 num_expected; /* expected last contact index */ |
@@ -225,8 +226,10 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi, | |||
225 | cls->sn_move); | 226 | cls->sn_move); |
226 | /* touchscreen emulation */ | 227 | /* touchscreen emulation */ |
227 | set_abs(hi->input, ABS_X, field, cls->sn_move); | 228 | set_abs(hi->input, ABS_X, field, cls->sn_move); |
228 | td->last_slot_field = usage->hid; | 229 | if (td->last_mt_collection == usage->collection_index) { |
229 | td->last_field_index = field->index; | 230 | td->last_slot_field = usage->hid; |
231 | td->last_field_index = field->index; | ||
232 | } | ||
230 | return 1; | 233 | return 1; |
231 | case HID_GD_Y: | 234 | case HID_GD_Y: |
232 | if (quirks & MT_QUIRK_EGALAX_XYZ_FIXUP) | 235 | if (quirks & MT_QUIRK_EGALAX_XYZ_FIXUP) |
@@ -237,8 +240,10 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi, | |||
237 | cls->sn_move); | 240 | cls->sn_move); |
238 | /* touchscreen emulation */ | 241 | /* touchscreen emulation */ |
239 | set_abs(hi->input, ABS_Y, field, cls->sn_move); | 242 | set_abs(hi->input, ABS_Y, field, cls->sn_move); |
240 | td->last_slot_field = usage->hid; | 243 | if (td->last_mt_collection == usage->collection_index) { |
241 | td->last_field_index = field->index; | 244 | td->last_slot_field = usage->hid; |
245 | td->last_field_index = field->index; | ||
246 | } | ||
242 | return 1; | 247 | return 1; |
243 | } | 248 | } |
244 | return 0; | 249 | return 0; |
@@ -246,31 +251,40 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi, | |||
246 | case HID_UP_DIGITIZER: | 251 | case HID_UP_DIGITIZER: |
247 | switch (usage->hid) { | 252 | switch (usage->hid) { |
248 | case HID_DG_INRANGE: | 253 | case HID_DG_INRANGE: |
249 | td->last_slot_field = usage->hid; | 254 | if (td->last_mt_collection == usage->collection_index) { |
250 | td->last_field_index = field->index; | 255 | td->last_slot_field = usage->hid; |
256 | td->last_field_index = field->index; | ||
257 | } | ||
251 | return 1; | 258 | return 1; |
252 | case HID_DG_CONFIDENCE: | 259 | case HID_DG_CONFIDENCE: |
253 | td->last_slot_field = usage->hid; | 260 | if (td->last_mt_collection == usage->collection_index) { |
254 | td->last_field_index = field->index; | 261 | td->last_slot_field = usage->hid; |
262 | td->last_field_index = field->index; | ||
263 | } | ||
255 | return 1; | 264 | return 1; |
256 | case HID_DG_TIPSWITCH: | 265 | case HID_DG_TIPSWITCH: |
257 | hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH); | 266 | hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH); |
258 | input_set_capability(hi->input, EV_KEY, BTN_TOUCH); | 267 | input_set_capability(hi->input, EV_KEY, BTN_TOUCH); |
259 | td->last_slot_field = usage->hid; | 268 | if (td->last_mt_collection == usage->collection_index) { |
260 | td->last_field_index = field->index; | 269 | td->last_slot_field = usage->hid; |
270 | td->last_field_index = field->index; | ||
271 | } | ||
261 | return 1; | 272 | return 1; |
262 | case HID_DG_CONTACTID: | 273 | case HID_DG_CONTACTID: |
263 | input_mt_init_slots(hi->input, td->maxcontacts); | 274 | input_mt_init_slots(hi->input, td->maxcontacts); |
264 | td->last_slot_field = usage->hid; | 275 | td->last_slot_field = usage->hid; |
265 | td->last_field_index = field->index; | 276 | td->last_field_index = field->index; |
277 | td->last_mt_collection = usage->collection_index; | ||
266 | return 1; | 278 | return 1; |
267 | case HID_DG_WIDTH: | 279 | case HID_DG_WIDTH: |
268 | hid_map_usage(hi, usage, bit, max, | 280 | hid_map_usage(hi, usage, bit, max, |
269 | EV_ABS, ABS_MT_TOUCH_MAJOR); | 281 | EV_ABS, ABS_MT_TOUCH_MAJOR); |
270 | set_abs(hi->input, ABS_MT_TOUCH_MAJOR, field, | 282 | set_abs(hi->input, ABS_MT_TOUCH_MAJOR, field, |
271 | cls->sn_width); | 283 | cls->sn_width); |
272 | td->last_slot_field = usage->hid; | 284 | if (td->last_mt_collection == usage->collection_index) { |
273 | td->last_field_index = field->index; | 285 | td->last_slot_field = usage->hid; |
286 | td->last_field_index = field->index; | ||
287 | } | ||
274 | return 1; | 288 | return 1; |
275 | case HID_DG_HEIGHT: | 289 | case HID_DG_HEIGHT: |
276 | hid_map_usage(hi, usage, bit, max, | 290 | hid_map_usage(hi, usage, bit, max, |
@@ -279,8 +293,10 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi, | |||
279 | cls->sn_height); | 293 | cls->sn_height); |
280 | input_set_abs_params(hi->input, | 294 | input_set_abs_params(hi->input, |
281 | ABS_MT_ORIENTATION, 0, 1, 0, 0); | 295 | ABS_MT_ORIENTATION, 0, 1, 0, 0); |
282 | td->last_slot_field = usage->hid; | 296 | if (td->last_mt_collection == usage->collection_index) { |
283 | td->last_field_index = field->index; | 297 | td->last_slot_field = usage->hid; |
298 | td->last_field_index = field->index; | ||
299 | } | ||
284 | return 1; | 300 | return 1; |
285 | case HID_DG_TIPPRESSURE: | 301 | case HID_DG_TIPPRESSURE: |
286 | if (quirks & MT_QUIRK_EGALAX_XYZ_FIXUP) | 302 | if (quirks & MT_QUIRK_EGALAX_XYZ_FIXUP) |
@@ -292,16 +308,20 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi, | |||
292 | /* touchscreen emulation */ | 308 | /* touchscreen emulation */ |
293 | set_abs(hi->input, ABS_PRESSURE, field, | 309 | set_abs(hi->input, ABS_PRESSURE, field, |
294 | cls->sn_pressure); | 310 | cls->sn_pressure); |
295 | td->last_slot_field = usage->hid; | 311 | if (td->last_mt_collection == usage->collection_index) { |
296 | td->last_field_index = field->index; | 312 | td->last_slot_field = usage->hid; |
313 | td->last_field_index = field->index; | ||
314 | } | ||
297 | return 1; | 315 | return 1; |
298 | case HID_DG_CONTACTCOUNT: | 316 | case HID_DG_CONTACTCOUNT: |
299 | td->last_field_index = field->index; | 317 | if (td->last_mt_collection == usage->collection_index) |
318 | td->last_field_index = field->index; | ||
300 | return 1; | 319 | return 1; |
301 | case HID_DG_CONTACTMAX: | 320 | case HID_DG_CONTACTMAX: |
302 | /* we don't set td->last_slot_field as contactcount and | 321 | /* we don't set td->last_slot_field as contactcount and |
303 | * contact max are global to the report */ | 322 | * contact max are global to the report */ |
304 | td->last_field_index = field->index; | 323 | if (td->last_mt_collection == usage->collection_index) |
324 | td->last_field_index = field->index; | ||
305 | return -1; | 325 | return -1; |
306 | } | 326 | } |
307 | /* let hid-input decide for the others */ | 327 | /* let hid-input decide for the others */ |
@@ -516,6 +536,7 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
516 | } | 536 | } |
517 | td->mtclass = mtclass; | 537 | td->mtclass = mtclass; |
518 | td->inputmode = -1; | 538 | td->inputmode = -1; |
539 | td->last_mt_collection = -1; | ||
519 | hid_set_drvdata(hdev, td); | 540 | hid_set_drvdata(hdev, td); |
520 | 541 | ||
521 | ret = hid_parse(hdev); | 542 | ret = hid_parse(hdev); |
@@ -593,6 +614,11 @@ static const struct hid_device_id mt_devices[] = { | |||
593 | HID_USB_DEVICE(USB_VENDOR_ID_CANDO, | 614 | HID_USB_DEVICE(USB_VENDOR_ID_CANDO, |
594 | USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6) }, | 615 | USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6) }, |
595 | 616 | ||
617 | /* Chunghwa Telecom touch panels */ | ||
618 | { .driver_data = MT_CLS_DEFAULT, | ||
619 | HID_USB_DEVICE(USB_VENDOR_ID_CHUNGHWAT, | ||
620 | USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH) }, | ||
621 | |||
596 | /* CVTouch panels */ | 622 | /* CVTouch panels */ |
597 | { .driver_data = MT_CLS_DEFAULT, | 623 | { .driver_data = MT_CLS_DEFAULT, |
598 | HID_USB_DEVICE(USB_VENDOR_ID_CVTOUCH, | 624 | HID_USB_DEVICE(USB_VENDOR_ID_CVTOUCH, |
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index 0e30b140edca..621959d5cc42 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
@@ -74,6 +74,7 @@ static const struct hid_blacklist { | |||
74 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_PF1209, HID_QUIRK_MULTI_INPUT }, | 74 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_PF1209, HID_QUIRK_MULTI_INPUT }, |
75 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U, HID_QUIRK_MULTI_INPUT }, | 75 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U, HID_QUIRK_MULTI_INPUT }, |
76 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_KNA5, HID_QUIRK_MULTI_INPUT }, | 76 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_KNA5, HID_QUIRK_MULTI_INPUT }, |
77 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_TWA60, HID_QUIRK_MULTI_INPUT }, | ||
77 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U, HID_QUIRK_MULTI_INPUT }, | 78 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U, HID_QUIRK_MULTI_INPUT }, |
78 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U, HID_QUIRK_MULTI_INPUT }, | 79 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U, HID_QUIRK_MULTI_INPUT }, |
79 | { USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH, HID_QUIRK_MULTI_INPUT }, | 80 | { USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH, HID_QUIRK_MULTI_INPUT }, |
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c index ff3c644888b1..7c1188b53c3e 100644 --- a/drivers/hid/usbhid/hiddev.c +++ b/drivers/hid/usbhid/hiddev.c | |||
@@ -248,12 +248,15 @@ static int hiddev_release(struct inode * inode, struct file * file) | |||
248 | usbhid_close(list->hiddev->hid); | 248 | usbhid_close(list->hiddev->hid); |
249 | usbhid_put_power(list->hiddev->hid); | 249 | usbhid_put_power(list->hiddev->hid); |
250 | } else { | 250 | } else { |
251 | mutex_unlock(&list->hiddev->existancelock); | ||
251 | kfree(list->hiddev); | 252 | kfree(list->hiddev); |
253 | kfree(list); | ||
254 | return 0; | ||
252 | } | 255 | } |
253 | } | 256 | } |
254 | 257 | ||
255 | kfree(list); | ||
256 | mutex_unlock(&list->hiddev->existancelock); | 258 | mutex_unlock(&list->hiddev->existancelock); |
259 | kfree(list); | ||
257 | 260 | ||
258 | return 0; | 261 | return 0; |
259 | } | 262 | } |
@@ -923,10 +926,11 @@ void hiddev_disconnect(struct hid_device *hid) | |||
923 | usb_deregister_dev(usbhid->intf, &hiddev_class); | 926 | usb_deregister_dev(usbhid->intf, &hiddev_class); |
924 | 927 | ||
925 | if (hiddev->open) { | 928 | if (hiddev->open) { |
929 | mutex_unlock(&hiddev->existancelock); | ||
926 | usbhid_close(hiddev->hid); | 930 | usbhid_close(hiddev->hid); |
927 | wake_up_interruptible(&hiddev->wait); | 931 | wake_up_interruptible(&hiddev->wait); |
928 | } else { | 932 | } else { |
933 | mutex_unlock(&hiddev->existancelock); | ||
929 | kfree(hiddev); | 934 | kfree(hiddev); |
930 | } | 935 | } |
931 | mutex_unlock(&hiddev->existancelock); | ||
932 | } | 936 | } |
diff --git a/drivers/hwmon/asus_atk0110.c b/drivers/hwmon/asus_atk0110.c index b5e892017e0c..dcb78a7a8047 100644 --- a/drivers/hwmon/asus_atk0110.c +++ b/drivers/hwmon/asus_atk0110.c | |||
@@ -268,6 +268,7 @@ static struct device_attribute atk_name_attr = | |||
268 | static void atk_init_attribute(struct device_attribute *attr, char *name, | 268 | static void atk_init_attribute(struct device_attribute *attr, char *name, |
269 | sysfs_show_func show) | 269 | sysfs_show_func show) |
270 | { | 270 | { |
271 | sysfs_attr_init(&attr->attr); | ||
271 | attr->attr.name = name; | 272 | attr->attr.name = name; |
272 | attr->attr.mode = 0444; | 273 | attr->attr.mode = 0444; |
273 | attr->show = show; | 274 | attr->show = show; |
@@ -1188,19 +1189,15 @@ static int atk_create_files(struct atk_data *data) | |||
1188 | int err; | 1189 | int err; |
1189 | 1190 | ||
1190 | list_for_each_entry(s, &data->sensor_list, list) { | 1191 | list_for_each_entry(s, &data->sensor_list, list) { |
1191 | sysfs_attr_init(&s->input_attr.attr); | ||
1192 | err = device_create_file(data->hwmon_dev, &s->input_attr); | 1192 | err = device_create_file(data->hwmon_dev, &s->input_attr); |
1193 | if (err) | 1193 | if (err) |
1194 | return err; | 1194 | return err; |
1195 | sysfs_attr_init(&s->label_attr.attr); | ||
1196 | err = device_create_file(data->hwmon_dev, &s->label_attr); | 1195 | err = device_create_file(data->hwmon_dev, &s->label_attr); |
1197 | if (err) | 1196 | if (err) |
1198 | return err; | 1197 | return err; |
1199 | sysfs_attr_init(&s->limit1_attr.attr); | ||
1200 | err = device_create_file(data->hwmon_dev, &s->limit1_attr); | 1198 | err = device_create_file(data->hwmon_dev, &s->limit1_attr); |
1201 | if (err) | 1199 | if (err) |
1202 | return err; | 1200 | return err; |
1203 | sysfs_attr_init(&s->limit2_attr.attr); | ||
1204 | err = device_create_file(data->hwmon_dev, &s->limit2_attr); | 1201 | err = device_create_file(data->hwmon_dev, &s->limit2_attr); |
1205 | if (err) | 1202 | if (err) |
1206 | return err; | 1203 | return err; |
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index 85e937984ff7..0070d5476dd0 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c | |||
@@ -97,9 +97,7 @@ struct platform_data { | |||
97 | struct pdev_entry { | 97 | struct pdev_entry { |
98 | struct list_head list; | 98 | struct list_head list; |
99 | struct platform_device *pdev; | 99 | struct platform_device *pdev; |
100 | unsigned int cpu; | ||
101 | u16 phys_proc_id; | 100 | u16 phys_proc_id; |
102 | u16 cpu_core_id; | ||
103 | }; | 101 | }; |
104 | 102 | ||
105 | static LIST_HEAD(pdev_list); | 103 | static LIST_HEAD(pdev_list); |
@@ -653,9 +651,7 @@ static int __cpuinit coretemp_device_add(unsigned int cpu) | |||
653 | } | 651 | } |
654 | 652 | ||
655 | pdev_entry->pdev = pdev; | 653 | pdev_entry->pdev = pdev; |
656 | pdev_entry->cpu = cpu; | ||
657 | pdev_entry->phys_proc_id = TO_PHYS_ID(cpu); | 654 | pdev_entry->phys_proc_id = TO_PHYS_ID(cpu); |
658 | pdev_entry->cpu_core_id = TO_CORE_ID(cpu); | ||
659 | 655 | ||
660 | list_add_tail(&pdev_entry->list, &pdev_list); | 656 | list_add_tail(&pdev_entry->list, &pdev_list); |
661 | mutex_unlock(&pdev_list_mutex); | 657 | mutex_unlock(&pdev_list_mutex); |
diff --git a/drivers/hwmon/ibmaem.c b/drivers/hwmon/ibmaem.c index 537409d07ee7..1a409c5bc9bc 100644 --- a/drivers/hwmon/ibmaem.c +++ b/drivers/hwmon/ibmaem.c | |||
@@ -947,6 +947,7 @@ static int aem_register_sensors(struct aem_data *data, | |||
947 | 947 | ||
948 | /* Set up read-only sensors */ | 948 | /* Set up read-only sensors */ |
949 | while (ro->label) { | 949 | while (ro->label) { |
950 | sysfs_attr_init(&sensors->dev_attr.attr); | ||
950 | sensors->dev_attr.attr.name = ro->label; | 951 | sensors->dev_attr.attr.name = ro->label; |
951 | sensors->dev_attr.attr.mode = S_IRUGO; | 952 | sensors->dev_attr.attr.mode = S_IRUGO; |
952 | sensors->dev_attr.show = ro->show; | 953 | sensors->dev_attr.show = ro->show; |
@@ -963,6 +964,7 @@ static int aem_register_sensors(struct aem_data *data, | |||
963 | 964 | ||
964 | /* Set up read-write sensors */ | 965 | /* Set up read-write sensors */ |
965 | while (rw->label) { | 966 | while (rw->label) { |
967 | sysfs_attr_init(&sensors->dev_attr.attr); | ||
966 | sensors->dev_attr.attr.name = rw->label; | 968 | sensors->dev_attr.attr.name = rw->label; |
967 | sensors->dev_attr.attr.mode = S_IRUGO | S_IWUSR; | 969 | sensors->dev_attr.attr.mode = S_IRUGO | S_IWUSR; |
968 | sensors->dev_attr.show = rw->show; | 970 | sensors->dev_attr.show = rw->show; |
diff --git a/drivers/hwmon/ibmpex.c b/drivers/hwmon/ibmpex.c index 06d4eafcf76b..41dbf8161ed7 100644 --- a/drivers/hwmon/ibmpex.c +++ b/drivers/hwmon/ibmpex.c | |||
@@ -358,6 +358,7 @@ static int create_sensor(struct ibmpex_bmc_data *data, int type, | |||
358 | else if (type == POWER_SENSOR) | 358 | else if (type == POWER_SENSOR) |
359 | sprintf(n, power_sensor_name_templates[func], "power", counter); | 359 | sprintf(n, power_sensor_name_templates[func], "power", counter); |
360 | 360 | ||
361 | sysfs_attr_init(&data->sensors[sensor].attr[func].dev_attr.attr); | ||
361 | data->sensors[sensor].attr[func].dev_attr.attr.name = n; | 362 | data->sensors[sensor].attr[func].dev_attr.attr.name = n; |
362 | data->sensors[sensor].attr[func].dev_attr.attr.mode = S_IRUGO; | 363 | data->sensors[sensor].attr[func].dev_attr.attr.mode = S_IRUGO; |
363 | data->sensors[sensor].attr[func].dev_attr.show = ibmpex_show_sensor; | 364 | data->sensors[sensor].attr[func].dev_attr.show = ibmpex_show_sensor; |
diff --git a/drivers/hwmon/s3c-hwmon.c b/drivers/hwmon/s3c-hwmon.c index 92b42db43bcf..b39f52e2752a 100644 --- a/drivers/hwmon/s3c-hwmon.c +++ b/drivers/hwmon/s3c-hwmon.c | |||
@@ -232,6 +232,7 @@ static int s3c_hwmon_create_attr(struct device *dev, | |||
232 | 232 | ||
233 | attr = &attrs->in; | 233 | attr = &attrs->in; |
234 | attr->index = channel; | 234 | attr->index = channel; |
235 | sysfs_attr_init(&attr->dev_attr.attr); | ||
235 | attr->dev_attr.attr.name = attrs->in_name; | 236 | attr->dev_attr.attr.name = attrs->in_name; |
236 | attr->dev_attr.attr.mode = S_IRUGO; | 237 | attr->dev_attr.attr.mode = S_IRUGO; |
237 | attr->dev_attr.show = s3c_hwmon_ch_show; | 238 | attr->dev_attr.show = s3c_hwmon_ch_show; |
@@ -249,6 +250,7 @@ static int s3c_hwmon_create_attr(struct device *dev, | |||
249 | 250 | ||
250 | attr = &attrs->label; | 251 | attr = &attrs->label; |
251 | attr->index = channel; | 252 | attr->index = channel; |
253 | sysfs_attr_init(&attr->dev_attr.attr); | ||
252 | attr->dev_attr.attr.name = attrs->label_name; | 254 | attr->dev_attr.attr.name = attrs->label_name; |
253 | attr->dev_attr.attr.mode = S_IRUGO; | 255 | attr->dev_attr.attr.mode = S_IRUGO; |
254 | attr->dev_attr.show = s3c_hwmon_label_show; | 256 | attr->dev_attr.show = s3c_hwmon_label_show; |
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index 23f0d5e99f35..713d43b4e563 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig | |||
@@ -1,3 +1,10 @@ | |||
1 | config LEDS_GPIO_REGISTER | ||
2 | bool | ||
3 | help | ||
4 | This option provides the function gpio_led_register_device. | ||
5 | As this function is used by arch code it must not be compiled as a | ||
6 | module. | ||
7 | |||
1 | menuconfig NEW_LEDS | 8 | menuconfig NEW_LEDS |
2 | bool "LED Support" | 9 | bool "LED Support" |
3 | help | 10 | help |
@@ -7,22 +14,14 @@ menuconfig NEW_LEDS | |||
7 | This is not related to standard keyboard LEDs which are controlled | 14 | This is not related to standard keyboard LEDs which are controlled |
8 | via the input system. | 15 | via the input system. |
9 | 16 | ||
17 | if NEW_LEDS | ||
18 | |||
10 | config LEDS_CLASS | 19 | config LEDS_CLASS |
11 | bool "LED Class Support" | 20 | bool "LED Class Support" |
12 | depends on NEW_LEDS | ||
13 | help | 21 | help |
14 | This option enables the led sysfs class in /sys/class/leds. You'll | 22 | This option enables the led sysfs class in /sys/class/leds. You'll |
15 | need this to do anything useful with LEDs. If unsure, say N. | 23 | need this to do anything useful with LEDs. If unsure, say N. |
16 | 24 | ||
17 | config LEDS_GPIO_REGISTER | ||
18 | bool | ||
19 | help | ||
20 | This option provides the function gpio_led_register_device. | ||
21 | As this function is used by arch code it must not be compiled as a | ||
22 | module. | ||
23 | |||
24 | if NEW_LEDS | ||
25 | |||
26 | comment "LED drivers" | 25 | comment "LED drivers" |
27 | 26 | ||
28 | config LEDS_88PM860X | 27 | config LEDS_88PM860X |
@@ -391,6 +390,7 @@ config LEDS_NETXBIG | |||
391 | 390 | ||
392 | config LEDS_ASIC3 | 391 | config LEDS_ASIC3 |
393 | bool "LED support for the HTC ASIC3" | 392 | bool "LED support for the HTC ASIC3" |
393 | depends on LEDS_CLASS | ||
394 | depends on MFD_ASIC3 | 394 | depends on MFD_ASIC3 |
395 | default y | 395 | default y |
396 | help | 396 | help |
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 70bd738b8b99..574b09afedd3 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
@@ -534,6 +534,82 @@ void bitmap_print_sb(struct bitmap *bitmap) | |||
534 | kunmap_atomic(sb, KM_USER0); | 534 | kunmap_atomic(sb, KM_USER0); |
535 | } | 535 | } |
536 | 536 | ||
537 | /* | ||
538 | * bitmap_new_disk_sb | ||
539 | * @bitmap | ||
540 | * | ||
541 | * This function is somewhat the reverse of bitmap_read_sb. bitmap_read_sb | ||
542 | * reads and verifies the on-disk bitmap superblock and populates bitmap_info. | ||
543 | * This function verifies 'bitmap_info' and populates the on-disk bitmap | ||
544 | * structure, which is to be written to disk. | ||
545 | * | ||
546 | * Returns: 0 on success, -Exxx on error | ||
547 | */ | ||
548 | static int bitmap_new_disk_sb(struct bitmap *bitmap) | ||
549 | { | ||
550 | bitmap_super_t *sb; | ||
551 | unsigned long chunksize, daemon_sleep, write_behind; | ||
552 | int err = -EINVAL; | ||
553 | |||
554 | bitmap->sb_page = alloc_page(GFP_KERNEL); | ||
555 | if (IS_ERR(bitmap->sb_page)) { | ||
556 | err = PTR_ERR(bitmap->sb_page); | ||
557 | bitmap->sb_page = NULL; | ||
558 | return err; | ||
559 | } | ||
560 | bitmap->sb_page->index = 0; | ||
561 | |||
562 | sb = kmap_atomic(bitmap->sb_page, KM_USER0); | ||
563 | |||
564 | sb->magic = cpu_to_le32(BITMAP_MAGIC); | ||
565 | sb->version = cpu_to_le32(BITMAP_MAJOR_HI); | ||
566 | |||
567 | chunksize = bitmap->mddev->bitmap_info.chunksize; | ||
568 | BUG_ON(!chunksize); | ||
569 | if (!is_power_of_2(chunksize)) { | ||
570 | kunmap_atomic(sb, KM_USER0); | ||
571 | printk(KERN_ERR "bitmap chunksize not a power of 2\n"); | ||
572 | return -EINVAL; | ||
573 | } | ||
574 | sb->chunksize = cpu_to_le32(chunksize); | ||
575 | |||
576 | daemon_sleep = bitmap->mddev->bitmap_info.daemon_sleep; | ||
577 | if (!daemon_sleep || | ||
578 | (daemon_sleep < 1) || (daemon_sleep > MAX_SCHEDULE_TIMEOUT)) { | ||
579 | printk(KERN_INFO "Choosing daemon_sleep default (5 sec)\n"); | ||
580 | daemon_sleep = 5 * HZ; | ||
581 | } | ||
582 | sb->daemon_sleep = cpu_to_le32(daemon_sleep); | ||
583 | bitmap->mddev->bitmap_info.daemon_sleep = daemon_sleep; | ||
584 | |||
585 | /* | ||
586 | * FIXME: write_behind for RAID1. If not specified, what | ||
587 | * is a good choice? We choose COUNTER_MAX / 2 arbitrarily. | ||
588 | */ | ||
589 | write_behind = bitmap->mddev->bitmap_info.max_write_behind; | ||
590 | if (write_behind > COUNTER_MAX) | ||
591 | write_behind = COUNTER_MAX / 2; | ||
592 | sb->write_behind = cpu_to_le32(write_behind); | ||
593 | bitmap->mddev->bitmap_info.max_write_behind = write_behind; | ||
594 | |||
595 | /* keep the array size field of the bitmap superblock up to date */ | ||
596 | sb->sync_size = cpu_to_le64(bitmap->mddev->resync_max_sectors); | ||
597 | |||
598 | memcpy(sb->uuid, bitmap->mddev->uuid, 16); | ||
599 | |||
600 | bitmap->flags |= BITMAP_STALE; | ||
601 | sb->state |= cpu_to_le32(BITMAP_STALE); | ||
602 | bitmap->events_cleared = bitmap->mddev->events; | ||
603 | sb->events_cleared = cpu_to_le64(bitmap->mddev->events); | ||
604 | |||
605 | bitmap->flags |= BITMAP_HOSTENDIAN; | ||
606 | sb->version = cpu_to_le32(BITMAP_MAJOR_HOSTENDIAN); | ||
607 | |||
608 | kunmap_atomic(sb, KM_USER0); | ||
609 | |||
610 | return 0; | ||
611 | } | ||
612 | |||
537 | /* read the superblock from the bitmap file and initialize some bitmap fields */ | 613 | /* read the superblock from the bitmap file and initialize some bitmap fields */ |
538 | static int bitmap_read_sb(struct bitmap *bitmap) | 614 | static int bitmap_read_sb(struct bitmap *bitmap) |
539 | { | 615 | { |
@@ -575,7 +651,7 @@ static int bitmap_read_sb(struct bitmap *bitmap) | |||
575 | reason = "unrecognized superblock version"; | 651 | reason = "unrecognized superblock version"; |
576 | else if (chunksize < 512) | 652 | else if (chunksize < 512) |
577 | reason = "bitmap chunksize too small"; | 653 | reason = "bitmap chunksize too small"; |
578 | else if ((1 << ffz(~chunksize)) != chunksize) | 654 | else if (!is_power_of_2(chunksize)) |
579 | reason = "bitmap chunksize not a power of 2"; | 655 | reason = "bitmap chunksize not a power of 2"; |
580 | else if (daemon_sleep < 1 || daemon_sleep > MAX_SCHEDULE_TIMEOUT) | 656 | else if (daemon_sleep < 1 || daemon_sleep > MAX_SCHEDULE_TIMEOUT) |
581 | reason = "daemon sleep period out of range"; | 657 | reason = "daemon sleep period out of range"; |
@@ -1076,8 +1152,8 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start) | |||
1076 | } | 1152 | } |
1077 | 1153 | ||
1078 | printk(KERN_INFO "%s: bitmap initialized from disk: " | 1154 | printk(KERN_INFO "%s: bitmap initialized from disk: " |
1079 | "read %lu/%lu pages, set %lu bits\n", | 1155 | "read %lu/%lu pages, set %lu of %lu bits\n", |
1080 | bmname(bitmap), bitmap->file_pages, num_pages, bit_cnt); | 1156 | bmname(bitmap), bitmap->file_pages, num_pages, bit_cnt, chunks); |
1081 | 1157 | ||
1082 | return 0; | 1158 | return 0; |
1083 | 1159 | ||
@@ -1332,7 +1408,7 @@ int bitmap_startwrite(struct bitmap *bitmap, sector_t offset, unsigned long sect | |||
1332 | return 0; | 1408 | return 0; |
1333 | } | 1409 | } |
1334 | 1410 | ||
1335 | if (unlikely((*bmc & COUNTER_MAX) == COUNTER_MAX)) { | 1411 | if (unlikely(COUNTER(*bmc) == COUNTER_MAX)) { |
1336 | DEFINE_WAIT(__wait); | 1412 | DEFINE_WAIT(__wait); |
1337 | /* note that it is safe to do the prepare_to_wait | 1413 | /* note that it is safe to do the prepare_to_wait |
1338 | * after the test as long as we do it before dropping | 1414 | * after the test as long as we do it before dropping |
@@ -1404,10 +1480,10 @@ void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, unsigned long secto | |||
1404 | sysfs_notify_dirent_safe(bitmap->sysfs_can_clear); | 1480 | sysfs_notify_dirent_safe(bitmap->sysfs_can_clear); |
1405 | } | 1481 | } |
1406 | 1482 | ||
1407 | if (!success && ! (*bmc & NEEDED_MASK)) | 1483 | if (!success && !NEEDED(*bmc)) |
1408 | *bmc |= NEEDED_MASK; | 1484 | *bmc |= NEEDED_MASK; |
1409 | 1485 | ||
1410 | if ((*bmc & COUNTER_MAX) == COUNTER_MAX) | 1486 | if (COUNTER(*bmc) == COUNTER_MAX) |
1411 | wake_up(&bitmap->overflow_wait); | 1487 | wake_up(&bitmap->overflow_wait); |
1412 | 1488 | ||
1413 | (*bmc)--; | 1489 | (*bmc)--; |
@@ -1728,9 +1804,16 @@ int bitmap_create(mddev_t *mddev) | |||
1728 | vfs_fsync(file, 1); | 1804 | vfs_fsync(file, 1); |
1729 | } | 1805 | } |
1730 | /* read superblock from bitmap file (this sets mddev->bitmap_info.chunksize) */ | 1806 | /* read superblock from bitmap file (this sets mddev->bitmap_info.chunksize) */ |
1731 | if (!mddev->bitmap_info.external) | 1807 | if (!mddev->bitmap_info.external) { |
1732 | err = bitmap_read_sb(bitmap); | 1808 | /* |
1733 | else { | 1809 | * If 'MD_ARRAY_FIRST_USE' is set, then device-mapper is |
1810 | * instructing us to create a new on-disk bitmap instance. | ||
1811 | */ | ||
1812 | if (test_and_clear_bit(MD_ARRAY_FIRST_USE, &mddev->flags)) | ||
1813 | err = bitmap_new_disk_sb(bitmap); | ||
1814 | else | ||
1815 | err = bitmap_read_sb(bitmap); | ||
1816 | } else { | ||
1734 | err = 0; | 1817 | err = 0; |
1735 | if (mddev->bitmap_info.chunksize == 0 || | 1818 | if (mddev->bitmap_info.chunksize == 0 || |
1736 | mddev->bitmap_info.daemon_sleep == 0) | 1819 | mddev->bitmap_info.daemon_sleep == 0) |
@@ -1754,9 +1837,6 @@ int bitmap_create(mddev_t *mddev) | |||
1754 | bitmap->chunks = chunks; | 1837 | bitmap->chunks = chunks; |
1755 | bitmap->pages = pages; | 1838 | bitmap->pages = pages; |
1756 | bitmap->missing_pages = pages; | 1839 | bitmap->missing_pages = pages; |
1757 | bitmap->counter_bits = COUNTER_BITS; | ||
1758 | |||
1759 | bitmap->syncchunk = ~0UL; | ||
1760 | 1840 | ||
1761 | #ifdef INJECT_FATAL_FAULT_1 | 1841 | #ifdef INJECT_FATAL_FAULT_1 |
1762 | bitmap->bp = NULL; | 1842 | bitmap->bp = NULL; |
diff --git a/drivers/md/bitmap.h b/drivers/md/bitmap.h index d0aeaf46d932..b2a127e891ac 100644 --- a/drivers/md/bitmap.h +++ b/drivers/md/bitmap.h | |||
@@ -85,7 +85,6 @@ | |||
85 | typedef __u16 bitmap_counter_t; | 85 | typedef __u16 bitmap_counter_t; |
86 | #define COUNTER_BITS 16 | 86 | #define COUNTER_BITS 16 |
87 | #define COUNTER_BIT_SHIFT 4 | 87 | #define COUNTER_BIT_SHIFT 4 |
88 | #define COUNTER_BYTE_RATIO (COUNTER_BITS / 8) | ||
89 | #define COUNTER_BYTE_SHIFT (COUNTER_BIT_SHIFT - 3) | 88 | #define COUNTER_BYTE_SHIFT (COUNTER_BIT_SHIFT - 3) |
90 | 89 | ||
91 | #define NEEDED_MASK ((bitmap_counter_t) (1 << (COUNTER_BITS - 1))) | 90 | #define NEEDED_MASK ((bitmap_counter_t) (1 << (COUNTER_BITS - 1))) |
@@ -196,19 +195,10 @@ struct bitmap { | |||
196 | 195 | ||
197 | mddev_t *mddev; /* the md device that the bitmap is for */ | 196 | mddev_t *mddev; /* the md device that the bitmap is for */ |
198 | 197 | ||
199 | int counter_bits; /* how many bits per block counter */ | ||
200 | |||
201 | /* bitmap chunksize -- how much data does each bit represent? */ | 198 | /* bitmap chunksize -- how much data does each bit represent? */ |
202 | unsigned long chunkshift; /* chunksize = 2^chunkshift (for bitops) */ | 199 | unsigned long chunkshift; /* chunksize = 2^chunkshift (for bitops) */ |
203 | unsigned long chunks; /* total number of data chunks for the array */ | 200 | unsigned long chunks; /* total number of data chunks for the array */ |
204 | 201 | ||
205 | /* We hold a count on the chunk currently being synced, and drop | ||
206 | * it when the last block is started. If the resync is aborted | ||
207 | * midway, we need to be able to drop that count, so we remember | ||
208 | * the counted chunk.. | ||
209 | */ | ||
210 | unsigned long syncchunk; | ||
211 | |||
212 | __u64 events_cleared; | 202 | __u64 events_cleared; |
213 | int need_sync; | 203 | int need_sync; |
214 | 204 | ||
diff --git a/drivers/md/md.c b/drivers/md/md.c index aa640a85bb21..4332fc2f25d4 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -351,6 +351,9 @@ void mddev_resume(mddev_t *mddev) | |||
351 | mddev->suspended = 0; | 351 | mddev->suspended = 0; |
352 | wake_up(&mddev->sb_wait); | 352 | wake_up(&mddev->sb_wait); |
353 | mddev->pers->quiesce(mddev, 0); | 353 | mddev->pers->quiesce(mddev, 0); |
354 | |||
355 | md_wakeup_thread(mddev->thread); | ||
356 | md_wakeup_thread(mddev->sync_thread); /* possibly kick off a reshape */ | ||
354 | } | 357 | } |
355 | EXPORT_SYMBOL_GPL(mddev_resume); | 358 | EXPORT_SYMBOL_GPL(mddev_resume); |
356 | 359 | ||
@@ -1750,6 +1753,18 @@ static struct super_type super_types[] = { | |||
1750 | }, | 1753 | }, |
1751 | }; | 1754 | }; |
1752 | 1755 | ||
1756 | static void sync_super(mddev_t *mddev, mdk_rdev_t *rdev) | ||
1757 | { | ||
1758 | if (mddev->sync_super) { | ||
1759 | mddev->sync_super(mddev, rdev); | ||
1760 | return; | ||
1761 | } | ||
1762 | |||
1763 | BUG_ON(mddev->major_version >= ARRAY_SIZE(super_types)); | ||
1764 | |||
1765 | super_types[mddev->major_version].sync_super(mddev, rdev); | ||
1766 | } | ||
1767 | |||
1753 | static int match_mddev_units(mddev_t *mddev1, mddev_t *mddev2) | 1768 | static int match_mddev_units(mddev_t *mddev1, mddev_t *mddev2) |
1754 | { | 1769 | { |
1755 | mdk_rdev_t *rdev, *rdev2; | 1770 | mdk_rdev_t *rdev, *rdev2; |
@@ -1781,8 +1796,8 @@ int md_integrity_register(mddev_t *mddev) | |||
1781 | 1796 | ||
1782 | if (list_empty(&mddev->disks)) | 1797 | if (list_empty(&mddev->disks)) |
1783 | return 0; /* nothing to do */ | 1798 | return 0; /* nothing to do */ |
1784 | if (blk_get_integrity(mddev->gendisk)) | 1799 | if (!mddev->gendisk || blk_get_integrity(mddev->gendisk)) |
1785 | return 0; /* already registered */ | 1800 | return 0; /* shouldn't register, or already is */ |
1786 | list_for_each_entry(rdev, &mddev->disks, same_set) { | 1801 | list_for_each_entry(rdev, &mddev->disks, same_set) { |
1787 | /* skip spares and non-functional disks */ | 1802 | /* skip spares and non-functional disks */ |
1788 | if (test_bit(Faulty, &rdev->flags)) | 1803 | if (test_bit(Faulty, &rdev->flags)) |
@@ -2168,8 +2183,7 @@ static void sync_sbs(mddev_t * mddev, int nospares) | |||
2168 | /* Don't update this superblock */ | 2183 | /* Don't update this superblock */ |
2169 | rdev->sb_loaded = 2; | 2184 | rdev->sb_loaded = 2; |
2170 | } else { | 2185 | } else { |
2171 | super_types[mddev->major_version]. | 2186 | sync_super(mddev, rdev); |
2172 | sync_super(mddev, rdev); | ||
2173 | rdev->sb_loaded = 1; | 2187 | rdev->sb_loaded = 1; |
2174 | } | 2188 | } |
2175 | } | 2189 | } |
@@ -2462,7 +2476,7 @@ slot_store(mdk_rdev_t *rdev, const char *buf, size_t len) | |||
2462 | if (rdev->raid_disk == -1) | 2476 | if (rdev->raid_disk == -1) |
2463 | return -EEXIST; | 2477 | return -EEXIST; |
2464 | /* personality does all needed checks */ | 2478 | /* personality does all needed checks */ |
2465 | if (rdev->mddev->pers->hot_add_disk == NULL) | 2479 | if (rdev->mddev->pers->hot_remove_disk == NULL) |
2466 | return -EINVAL; | 2480 | return -EINVAL; |
2467 | err = rdev->mddev->pers-> | 2481 | err = rdev->mddev->pers-> |
2468 | hot_remove_disk(rdev->mddev, rdev->raid_disk); | 2482 | hot_remove_disk(rdev->mddev, rdev->raid_disk); |
@@ -4619,9 +4633,6 @@ int md_run(mddev_t *mddev) | |||
4619 | if (mddev->flags) | 4633 | if (mddev->flags) |
4620 | md_update_sb(mddev, 0); | 4634 | md_update_sb(mddev, 0); |
4621 | 4635 | ||
4622 | md_wakeup_thread(mddev->thread); | ||
4623 | md_wakeup_thread(mddev->sync_thread); /* possibly kick off a reshape */ | ||
4624 | |||
4625 | md_new_event(mddev); | 4636 | md_new_event(mddev); |
4626 | sysfs_notify_dirent_safe(mddev->sysfs_state); | 4637 | sysfs_notify_dirent_safe(mddev->sysfs_state); |
4627 | sysfs_notify_dirent_safe(mddev->sysfs_action); | 4638 | sysfs_notify_dirent_safe(mddev->sysfs_action); |
@@ -4642,6 +4653,10 @@ static int do_md_run(mddev_t *mddev) | |||
4642 | bitmap_destroy(mddev); | 4653 | bitmap_destroy(mddev); |
4643 | goto out; | 4654 | goto out; |
4644 | } | 4655 | } |
4656 | |||
4657 | md_wakeup_thread(mddev->thread); | ||
4658 | md_wakeup_thread(mddev->sync_thread); /* possibly kick off a reshape */ | ||
4659 | |||
4645 | set_capacity(mddev->gendisk, mddev->array_sectors); | 4660 | set_capacity(mddev->gendisk, mddev->array_sectors); |
4646 | revalidate_disk(mddev->gendisk); | 4661 | revalidate_disk(mddev->gendisk); |
4647 | mddev->changed = 1; | 4662 | mddev->changed = 1; |
@@ -5259,6 +5274,8 @@ static int add_new_disk(mddev_t * mddev, mdu_disk_info_t *info) | |||
5259 | if (mddev->degraded) | 5274 | if (mddev->degraded) |
5260 | set_bit(MD_RECOVERY_RECOVER, &mddev->recovery); | 5275 | set_bit(MD_RECOVERY_RECOVER, &mddev->recovery); |
5261 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); | 5276 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); |
5277 | if (!err) | ||
5278 | md_new_event(mddev); | ||
5262 | md_wakeup_thread(mddev->thread); | 5279 | md_wakeup_thread(mddev->thread); |
5263 | return err; | 5280 | return err; |
5264 | } | 5281 | } |
@@ -6866,8 +6883,8 @@ void md_do_sync(mddev_t *mddev) | |||
6866 | * Tune reconstruction: | 6883 | * Tune reconstruction: |
6867 | */ | 6884 | */ |
6868 | window = 32*(PAGE_SIZE/512); | 6885 | window = 32*(PAGE_SIZE/512); |
6869 | printk(KERN_INFO "md: using %dk window, over a total of %llu blocks.\n", | 6886 | printk(KERN_INFO "md: using %dk window, over a total of %lluk.\n", |
6870 | window/2,(unsigned long long) max_sectors/2); | 6887 | window/2, (unsigned long long)max_sectors/2); |
6871 | 6888 | ||
6872 | atomic_set(&mddev->recovery_active, 0); | 6889 | atomic_set(&mddev->recovery_active, 0); |
6873 | last_check = 0; | 6890 | last_check = 0; |
@@ -7045,7 +7062,6 @@ void md_do_sync(mddev_t *mddev) | |||
7045 | } | 7062 | } |
7046 | EXPORT_SYMBOL_GPL(md_do_sync); | 7063 | EXPORT_SYMBOL_GPL(md_do_sync); |
7047 | 7064 | ||
7048 | |||
7049 | static int remove_and_add_spares(mddev_t *mddev) | 7065 | static int remove_and_add_spares(mddev_t *mddev) |
7050 | { | 7066 | { |
7051 | mdk_rdev_t *rdev; | 7067 | mdk_rdev_t *rdev; |
@@ -7157,6 +7173,9 @@ static void reap_sync_thread(mddev_t *mddev) | |||
7157 | */ | 7173 | */ |
7158 | void md_check_recovery(mddev_t *mddev) | 7174 | void md_check_recovery(mddev_t *mddev) |
7159 | { | 7175 | { |
7176 | if (mddev->suspended) | ||
7177 | return; | ||
7178 | |||
7160 | if (mddev->bitmap) | 7179 | if (mddev->bitmap) |
7161 | bitmap_daemon_work(mddev); | 7180 | bitmap_daemon_work(mddev); |
7162 | 7181 | ||
diff --git a/drivers/md/md.h b/drivers/md/md.h index 0b1fd3f1d85b..1c26c7a08ae6 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h | |||
@@ -124,6 +124,7 @@ struct mddev_s | |||
124 | #define MD_CHANGE_DEVS 0 /* Some device status has changed */ | 124 | #define MD_CHANGE_DEVS 0 /* Some device status has changed */ |
125 | #define MD_CHANGE_CLEAN 1 /* transition to or from 'clean' */ | 125 | #define MD_CHANGE_CLEAN 1 /* transition to or from 'clean' */ |
126 | #define MD_CHANGE_PENDING 2 /* switch from 'clean' to 'active' in progress */ | 126 | #define MD_CHANGE_PENDING 2 /* switch from 'clean' to 'active' in progress */ |
127 | #define MD_ARRAY_FIRST_USE 3 /* First use of array, needs initialization */ | ||
127 | 128 | ||
128 | int suspended; | 129 | int suspended; |
129 | atomic_t active_io; | 130 | atomic_t active_io; |
@@ -330,6 +331,7 @@ struct mddev_s | |||
330 | atomic_t flush_pending; | 331 | atomic_t flush_pending; |
331 | struct work_struct flush_work; | 332 | struct work_struct flush_work; |
332 | struct work_struct event_work; /* used by dm to report failure event */ | 333 | struct work_struct event_work; /* used by dm to report failure event */ |
334 | void (*sync_super)(mddev_t *mddev, mdk_rdev_t *rdev); | ||
333 | }; | 335 | }; |
334 | 336 | ||
335 | 337 | ||
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 5d096096f958..f7431b6d8447 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -497,21 +497,19 @@ static int read_balance(conf_t *conf, r1bio_t *r1_bio) | |||
497 | return best_disk; | 497 | return best_disk; |
498 | } | 498 | } |
499 | 499 | ||
500 | static int raid1_congested(void *data, int bits) | 500 | int md_raid1_congested(mddev_t *mddev, int bits) |
501 | { | 501 | { |
502 | mddev_t *mddev = data; | ||
503 | conf_t *conf = mddev->private; | 502 | conf_t *conf = mddev->private; |
504 | int i, ret = 0; | 503 | int i, ret = 0; |
505 | 504 | ||
506 | if (mddev_congested(mddev, bits)) | ||
507 | return 1; | ||
508 | |||
509 | rcu_read_lock(); | 505 | rcu_read_lock(); |
510 | for (i = 0; i < mddev->raid_disks; i++) { | 506 | for (i = 0; i < mddev->raid_disks; i++) { |
511 | mdk_rdev_t *rdev = rcu_dereference(conf->mirrors[i].rdev); | 507 | mdk_rdev_t *rdev = rcu_dereference(conf->mirrors[i].rdev); |
512 | if (rdev && !test_bit(Faulty, &rdev->flags)) { | 508 | if (rdev && !test_bit(Faulty, &rdev->flags)) { |
513 | struct request_queue *q = bdev_get_queue(rdev->bdev); | 509 | struct request_queue *q = bdev_get_queue(rdev->bdev); |
514 | 510 | ||
511 | BUG_ON(!q); | ||
512 | |||
515 | /* Note the '|| 1' - when read_balance prefers | 513 | /* Note the '|| 1' - when read_balance prefers |
516 | * non-congested targets, it can be removed | 514 | * non-congested targets, it can be removed |
517 | */ | 515 | */ |
@@ -524,7 +522,15 @@ static int raid1_congested(void *data, int bits) | |||
524 | rcu_read_unlock(); | 522 | rcu_read_unlock(); |
525 | return ret; | 523 | return ret; |
526 | } | 524 | } |
525 | EXPORT_SYMBOL_GPL(md_raid1_congested); | ||
527 | 526 | ||
527 | static int raid1_congested(void *data, int bits) | ||
528 | { | ||
529 | mddev_t *mddev = data; | ||
530 | |||
531 | return mddev_congested(mddev, bits) || | ||
532 | md_raid1_congested(mddev, bits); | ||
533 | } | ||
528 | 534 | ||
529 | static void flush_pending_writes(conf_t *conf) | 535 | static void flush_pending_writes(conf_t *conf) |
530 | { | 536 | { |
@@ -1972,6 +1978,8 @@ static int run(mddev_t *mddev) | |||
1972 | return PTR_ERR(conf); | 1978 | return PTR_ERR(conf); |
1973 | 1979 | ||
1974 | list_for_each_entry(rdev, &mddev->disks, same_set) { | 1980 | list_for_each_entry(rdev, &mddev->disks, same_set) { |
1981 | if (!mddev->gendisk) | ||
1982 | continue; | ||
1975 | disk_stack_limits(mddev->gendisk, rdev->bdev, | 1983 | disk_stack_limits(mddev->gendisk, rdev->bdev, |
1976 | rdev->data_offset << 9); | 1984 | rdev->data_offset << 9); |
1977 | /* as we don't honour merge_bvec_fn, we must never risk | 1985 | /* as we don't honour merge_bvec_fn, we must never risk |
@@ -2013,8 +2021,10 @@ static int run(mddev_t *mddev) | |||
2013 | 2021 | ||
2014 | md_set_array_sectors(mddev, raid1_size(mddev, 0, 0)); | 2022 | md_set_array_sectors(mddev, raid1_size(mddev, 0, 0)); |
2015 | 2023 | ||
2016 | mddev->queue->backing_dev_info.congested_fn = raid1_congested; | 2024 | if (mddev->queue) { |
2017 | mddev->queue->backing_dev_info.congested_data = mddev; | 2025 | mddev->queue->backing_dev_info.congested_fn = raid1_congested; |
2026 | mddev->queue->backing_dev_info.congested_data = mddev; | ||
2027 | } | ||
2018 | return md_integrity_register(mddev); | 2028 | return md_integrity_register(mddev); |
2019 | } | 2029 | } |
2020 | 2030 | ||
diff --git a/drivers/md/raid1.h b/drivers/md/raid1.h index 5fc4ca1af863..e743a64fac4f 100644 --- a/drivers/md/raid1.h +++ b/drivers/md/raid1.h | |||
@@ -126,4 +126,6 @@ struct r1bio_s { | |||
126 | */ | 126 | */ |
127 | #define R1BIO_Returned 6 | 127 | #define R1BIO_Returned 6 |
128 | 128 | ||
129 | extern int md_raid1_congested(mddev_t *mddev, int bits); | ||
130 | |||
129 | #endif | 131 | #endif |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 346e69bfdab3..b72edf35ec54 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -129,7 +129,7 @@ static inline int raid5_dec_bi_hw_segments(struct bio *bio) | |||
129 | 129 | ||
130 | static inline void raid5_set_bi_hw_segments(struct bio *bio, unsigned int cnt) | 130 | static inline void raid5_set_bi_hw_segments(struct bio *bio, unsigned int cnt) |
131 | { | 131 | { |
132 | bio->bi_phys_segments = raid5_bi_phys_segments(bio) || (cnt << 16); | 132 | bio->bi_phys_segments = raid5_bi_phys_segments(bio) | (cnt << 16); |
133 | } | 133 | } |
134 | 134 | ||
135 | /* Find first data disk in a raid6 stripe */ | 135 | /* Find first data disk in a raid6 stripe */ |
@@ -514,7 +514,7 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s) | |||
514 | bi = &sh->dev[i].req; | 514 | bi = &sh->dev[i].req; |
515 | 515 | ||
516 | bi->bi_rw = rw; | 516 | bi->bi_rw = rw; |
517 | if (rw == WRITE) | 517 | if (rw & WRITE) |
518 | bi->bi_end_io = raid5_end_write_request; | 518 | bi->bi_end_io = raid5_end_write_request; |
519 | else | 519 | else |
520 | bi->bi_end_io = raid5_end_read_request; | 520 | bi->bi_end_io = raid5_end_read_request; |
@@ -548,13 +548,13 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s) | |||
548 | bi->bi_io_vec[0].bv_offset = 0; | 548 | bi->bi_io_vec[0].bv_offset = 0; |
549 | bi->bi_size = STRIPE_SIZE; | 549 | bi->bi_size = STRIPE_SIZE; |
550 | bi->bi_next = NULL; | 550 | bi->bi_next = NULL; |
551 | if (rw == WRITE && | 551 | if ((rw & WRITE) && |
552 | test_bit(R5_ReWrite, &sh->dev[i].flags)) | 552 | test_bit(R5_ReWrite, &sh->dev[i].flags)) |
553 | atomic_add(STRIPE_SECTORS, | 553 | atomic_add(STRIPE_SECTORS, |
554 | &rdev->corrected_errors); | 554 | &rdev->corrected_errors); |
555 | generic_make_request(bi); | 555 | generic_make_request(bi); |
556 | } else { | 556 | } else { |
557 | if (rw == WRITE) | 557 | if (rw & WRITE) |
558 | set_bit(STRIPE_DEGRADED, &sh->state); | 558 | set_bit(STRIPE_DEGRADED, &sh->state); |
559 | pr_debug("skip op %ld on disc %d for sector %llu\n", | 559 | pr_debug("skip op %ld on disc %d for sector %llu\n", |
560 | bi->bi_rw, i, (unsigned long long)sh->sector); | 560 | bi->bi_rw, i, (unsigned long long)sh->sector); |
@@ -585,7 +585,7 @@ async_copy_data(int frombio, struct bio *bio, struct page *page, | |||
585 | init_async_submit(&submit, flags, tx, NULL, NULL, NULL); | 585 | init_async_submit(&submit, flags, tx, NULL, NULL, NULL); |
586 | 586 | ||
587 | bio_for_each_segment(bvl, bio, i) { | 587 | bio_for_each_segment(bvl, bio, i) { |
588 | int len = bio_iovec_idx(bio, i)->bv_len; | 588 | int len = bvl->bv_len; |
589 | int clen; | 589 | int clen; |
590 | int b_offset = 0; | 590 | int b_offset = 0; |
591 | 591 | ||
@@ -601,8 +601,8 @@ async_copy_data(int frombio, struct bio *bio, struct page *page, | |||
601 | clen = len; | 601 | clen = len; |
602 | 602 | ||
603 | if (clen > 0) { | 603 | if (clen > 0) { |
604 | b_offset += bio_iovec_idx(bio, i)->bv_offset; | 604 | b_offset += bvl->bv_offset; |
605 | bio_page = bio_iovec_idx(bio, i)->bv_page; | 605 | bio_page = bvl->bv_page; |
606 | if (frombio) | 606 | if (frombio) |
607 | tx = async_memcpy(page, bio_page, page_offset, | 607 | tx = async_memcpy(page, bio_page, page_offset, |
608 | b_offset, clen, &submit); | 608 | b_offset, clen, &submit); |
@@ -4858,7 +4858,7 @@ static raid5_conf_t *setup_conf(mddev_t *mddev) | |||
4858 | printk(KERN_INFO "md/raid:%s: device %s operational as raid" | 4858 | printk(KERN_INFO "md/raid:%s: device %s operational as raid" |
4859 | " disk %d\n", | 4859 | " disk %d\n", |
4860 | mdname(mddev), bdevname(rdev->bdev, b), raid_disk); | 4860 | mdname(mddev), bdevname(rdev->bdev, b), raid_disk); |
4861 | } else | 4861 | } else if (rdev->saved_raid_disk != raid_disk) |
4862 | /* Cannot rely on bitmap to complete recovery */ | 4862 | /* Cannot rely on bitmap to complete recovery */ |
4863 | conf->fullsync = 1; | 4863 | conf->fullsync = 1; |
4864 | } | 4864 | } |
diff --git a/drivers/misc/apds990x.c b/drivers/misc/apds990x.c index 200311fea369..e2a52e5cf449 100644 --- a/drivers/misc/apds990x.c +++ b/drivers/misc/apds990x.c | |||
@@ -609,6 +609,7 @@ static int apds990x_detect(struct apds990x_chip *chip) | |||
609 | return ret; | 609 | return ret; |
610 | } | 610 | } |
611 | 611 | ||
612 | #if defined(CONFIG_PM) || defined(CONFIG_PM_RUNTIME) | ||
612 | static int apds990x_chip_on(struct apds990x_chip *chip) | 613 | static int apds990x_chip_on(struct apds990x_chip *chip) |
613 | { | 614 | { |
614 | int err = regulator_bulk_enable(ARRAY_SIZE(chip->regs), | 615 | int err = regulator_bulk_enable(ARRAY_SIZE(chip->regs), |
@@ -624,6 +625,7 @@ static int apds990x_chip_on(struct apds990x_chip *chip) | |||
624 | apds990x_mode_on(chip); | 625 | apds990x_mode_on(chip); |
625 | return 0; | 626 | return 0; |
626 | } | 627 | } |
628 | #endif | ||
627 | 629 | ||
628 | static int apds990x_chip_off(struct apds990x_chip *chip) | 630 | static int apds990x_chip_off(struct apds990x_chip *chip) |
629 | { | 631 | { |
diff --git a/drivers/misc/cs5535-mfgpt.c b/drivers/misc/cs5535-mfgpt.c index e01e08c8c88b..bc685bfc4c33 100644 --- a/drivers/misc/cs5535-mfgpt.c +++ b/drivers/misc/cs5535-mfgpt.c | |||
@@ -174,7 +174,7 @@ struct cs5535_mfgpt_timer *cs5535_mfgpt_alloc_timer(int timer_nr, int domain) | |||
174 | timer_nr = t < max ? (int) t : -1; | 174 | timer_nr = t < max ? (int) t : -1; |
175 | } else { | 175 | } else { |
176 | /* check if the requested timer's available */ | 176 | /* check if the requested timer's available */ |
177 | if (test_bit(timer_nr, mfgpt->avail)) | 177 | if (!test_bit(timer_nr, mfgpt->avail)) |
178 | timer_nr = -1; | 178 | timer_nr = -1; |
179 | } | 179 | } |
180 | 180 | ||
diff --git a/drivers/misc/spear13xx_pcie_gadget.c b/drivers/misc/spear13xx_pcie_gadget.c index 7aded90f9daa..cfbddbef11de 100644 --- a/drivers/misc/spear13xx_pcie_gadget.c +++ b/drivers/misc/spear13xx_pcie_gadget.c | |||
@@ -845,7 +845,7 @@ err_iounmap: | |||
845 | err_iounmap_app: | 845 | err_iounmap_app: |
846 | iounmap(config->va_app_base); | 846 | iounmap(config->va_app_base); |
847 | err_kzalloc: | 847 | err_kzalloc: |
848 | kfree(config); | 848 | kfree(target); |
849 | err_rel_res: | 849 | err_rel_res: |
850 | release_mem_region(res1->start, resource_size(res1)); | 850 | release_mem_region(res1->start, resource_size(res1)); |
851 | err_rel_res0: | 851 | err_rel_res0: |
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 5da5bea0f9f0..7721de942c69 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c | |||
@@ -1144,9 +1144,17 @@ static int __devinit mmci_probe(struct amba_device *dev, | |||
1144 | else if (ret != -ENOSYS) | 1144 | else if (ret != -ENOSYS) |
1145 | goto err_gpio_cd; | 1145 | goto err_gpio_cd; |
1146 | 1146 | ||
1147 | /* | ||
1148 | * A gpio pin that will detect cards when inserted and removed | ||
1149 | * will most likely want to trigger on the edges if it is | ||
1150 | * 0 when ejected and 1 when inserted (or mutatis mutandis | ||
1151 | * for the inverted case) so we request triggers on both | ||
1152 | * edges. | ||
1153 | */ | ||
1147 | ret = request_any_context_irq(gpio_to_irq(plat->gpio_cd), | 1154 | ret = request_any_context_irq(gpio_to_irq(plat->gpio_cd), |
1148 | mmci_cd_irq, 0, | 1155 | mmci_cd_irq, |
1149 | DRIVER_NAME " (cd)", host); | 1156 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, |
1157 | DRIVER_NAME " (cd)", host); | ||
1150 | if (ret >= 0) | 1158 | if (ret >= 0) |
1151 | host->gpio_cd_irq = gpio_to_irq(plat->gpio_cd); | 1159 | host->gpio_cd_irq = gpio_to_irq(plat->gpio_cd); |
1152 | } | 1160 | } |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 56098b3e17c0..5f10c23dff94 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -3271,11 +3271,11 @@ void __init pci_register_set_vga_state(arch_set_vga_state_t func) | |||
3271 | } | 3271 | } |
3272 | 3272 | ||
3273 | static int pci_set_vga_state_arch(struct pci_dev *dev, bool decode, | 3273 | static int pci_set_vga_state_arch(struct pci_dev *dev, bool decode, |
3274 | unsigned int command_bits, bool change_bridge) | 3274 | unsigned int command_bits, u32 flags) |
3275 | { | 3275 | { |
3276 | if (arch_set_vga_state) | 3276 | if (arch_set_vga_state) |
3277 | return arch_set_vga_state(dev, decode, command_bits, | 3277 | return arch_set_vga_state(dev, decode, command_bits, |
3278 | change_bridge); | 3278 | flags); |
3279 | return 0; | 3279 | return 0; |
3280 | } | 3280 | } |
3281 | 3281 | ||
diff --git a/drivers/pcmcia/pxa2xx_vpac270.c b/drivers/pcmcia/pxa2xx_vpac270.c index 435002dfc3ca..712baab3c83d 100644 --- a/drivers/pcmcia/pxa2xx_vpac270.c +++ b/drivers/pcmcia/pxa2xx_vpac270.c | |||
@@ -11,6 +11,7 @@ | |||
11 | * | 11 | * |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/gpio.h> | ||
14 | #include <linux/module.h> | 15 | #include <linux/module.h> |
15 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
16 | 17 | ||
diff --git a/drivers/sh/clk/core.c b/drivers/sh/clk/core.c index 4f64183b27fa..7e9c39951ecb 100644 --- a/drivers/sh/clk/core.c +++ b/drivers/sh/clk/core.c | |||
@@ -635,7 +635,7 @@ static void clks_core_resume(void) | |||
635 | struct clk *clkp; | 635 | struct clk *clkp; |
636 | 636 | ||
637 | list_for_each_entry(clkp, &clock_list, node) { | 637 | list_for_each_entry(clkp, &clock_list, node) { |
638 | if (likely(clkp->ops)) { | 638 | if (likely(clkp->usecount && clkp->ops)) { |
639 | unsigned long rate = clkp->rate; | 639 | unsigned long rate = clkp->rate; |
640 | 640 | ||
641 | if (likely(clkp->ops->set_parent)) | 641 | if (likely(clkp->ops->set_parent)) |
diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c index f706dba165cf..cc880c95e7de 100644 --- a/drivers/spi/spi_bfin5xx.c +++ b/drivers/spi/spi_bfin5xx.c | |||
@@ -681,13 +681,14 @@ static void bfin_spi_pump_transfers(unsigned long data) | |||
681 | drv_data->cs_change = transfer->cs_change; | 681 | drv_data->cs_change = transfer->cs_change; |
682 | 682 | ||
683 | /* Bits per word setup */ | 683 | /* Bits per word setup */ |
684 | bits_per_word = transfer->bits_per_word ? : message->spi->bits_per_word; | 684 | bits_per_word = transfer->bits_per_word ? : |
685 | if ((bits_per_word > 0) && (bits_per_word % 16 == 0)) { | 685 | message->spi->bits_per_word ? : 8; |
686 | if (bits_per_word % 16 == 0) { | ||
686 | drv_data->n_bytes = bits_per_word/8; | 687 | drv_data->n_bytes = bits_per_word/8; |
687 | drv_data->len = (transfer->len) >> 1; | 688 | drv_data->len = (transfer->len) >> 1; |
688 | cr_width = BIT_CTL_WORDSIZE; | 689 | cr_width = BIT_CTL_WORDSIZE; |
689 | drv_data->ops = &bfin_bfin_spi_transfer_ops_u16; | 690 | drv_data->ops = &bfin_bfin_spi_transfer_ops_u16; |
690 | } else if ((bits_per_word > 0) && (bits_per_word % 8 == 0)) { | 691 | } else if (bits_per_word % 8 == 0) { |
691 | drv_data->n_bytes = bits_per_word/8; | 692 | drv_data->n_bytes = bits_per_word/8; |
692 | drv_data->len = transfer->len; | 693 | drv_data->len = transfer->len; |
693 | cr_width = 0; | 694 | cr_width = 0; |
diff --git a/drivers/staging/iio/accel/adis16201.h b/drivers/staging/iio/accel/adis16201.h index 0b9b85424dfa..4cc1a5bfab40 100644 --- a/drivers/staging/iio/accel/adis16201.h +++ b/drivers/staging/iio/accel/adis16201.h | |||
@@ -81,7 +81,6 @@ struct adis16201_state { | |||
81 | 81 | ||
82 | int adis16201_set_irq(struct iio_dev *indio_dev, bool enable); | 82 | int adis16201_set_irq(struct iio_dev *indio_dev, bool enable); |
83 | 83 | ||
84 | #ifdef CONFIG_IIO_RING_BUFFER | ||
85 | enum adis16201_scan { | 84 | enum adis16201_scan { |
86 | ADIS16201_SCAN_SUPPLY, | 85 | ADIS16201_SCAN_SUPPLY, |
87 | ADIS16201_SCAN_ACC_X, | 86 | ADIS16201_SCAN_ACC_X, |
@@ -92,6 +91,7 @@ enum adis16201_scan { | |||
92 | ADIS16201_SCAN_INCLI_Y, | 91 | ADIS16201_SCAN_INCLI_Y, |
93 | }; | 92 | }; |
94 | 93 | ||
94 | #ifdef CONFIG_IIO_RING_BUFFER | ||
95 | void adis16201_remove_trigger(struct iio_dev *indio_dev); | 95 | void adis16201_remove_trigger(struct iio_dev *indio_dev); |
96 | int adis16201_probe_trigger(struct iio_dev *indio_dev); | 96 | int adis16201_probe_trigger(struct iio_dev *indio_dev); |
97 | 97 | ||
diff --git a/drivers/staging/iio/accel/adis16203.h b/drivers/staging/iio/accel/adis16203.h index 8bb8ce50c248..175e21bb9b40 100644 --- a/drivers/staging/iio/accel/adis16203.h +++ b/drivers/staging/iio/accel/adis16203.h | |||
@@ -76,7 +76,6 @@ struct adis16203_state { | |||
76 | 76 | ||
77 | int adis16203_set_irq(struct iio_dev *indio_dev, bool enable); | 77 | int adis16203_set_irq(struct iio_dev *indio_dev, bool enable); |
78 | 78 | ||
79 | #ifdef CONFIG_IIO_RING_BUFFER | ||
80 | enum adis16203_scan { | 79 | enum adis16203_scan { |
81 | ADIS16203_SCAN_SUPPLY, | 80 | ADIS16203_SCAN_SUPPLY, |
82 | ADIS16203_SCAN_AUX_ADC, | 81 | ADIS16203_SCAN_AUX_ADC, |
@@ -85,6 +84,7 @@ enum adis16203_scan { | |||
85 | ADIS16203_SCAN_INCLI_Y, | 84 | ADIS16203_SCAN_INCLI_Y, |
86 | }; | 85 | }; |
87 | 86 | ||
87 | #ifdef CONFIG_IIO_RING_BUFFER | ||
88 | void adis16203_remove_trigger(struct iio_dev *indio_dev); | 88 | void adis16203_remove_trigger(struct iio_dev *indio_dev); |
89 | int adis16203_probe_trigger(struct iio_dev *indio_dev); | 89 | int adis16203_probe_trigger(struct iio_dev *indio_dev); |
90 | 90 | ||
diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c index f2cb7503fcb2..465210930890 100644 --- a/drivers/tty/serial/pch_uart.c +++ b/drivers/tty/serial/pch_uart.c | |||
@@ -1397,6 +1397,7 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev, | |||
1397 | int fifosize, base_baud; | 1397 | int fifosize, base_baud; |
1398 | int port_type; | 1398 | int port_type; |
1399 | struct pch_uart_driver_data *board; | 1399 | struct pch_uart_driver_data *board; |
1400 | const char *board_name; | ||
1400 | 1401 | ||
1401 | board = &drv_dat[id->driver_data]; | 1402 | board = &drv_dat[id->driver_data]; |
1402 | port_type = board->port_type; | 1403 | port_type = board->port_type; |
@@ -1412,7 +1413,8 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev, | |||
1412 | base_baud = 1843200; /* 1.8432MHz */ | 1413 | base_baud = 1843200; /* 1.8432MHz */ |
1413 | 1414 | ||
1414 | /* quirk for CM-iTC board */ | 1415 | /* quirk for CM-iTC board */ |
1415 | if (strstr(dmi_get_system_info(DMI_BOARD_NAME), "CM-iTC")) | 1416 | board_name = dmi_get_system_info(DMI_BOARD_NAME); |
1417 | if (board_name && strstr(board_name, "CM-iTC")) | ||
1416 | base_baud = 192000000; /* 192.0MHz */ | 1418 | base_baud = 192000000; /* 192.0MHz */ |
1417 | 1419 | ||
1418 | switch (port_type) { | 1420 | switch (port_type) { |
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c index ebb893c49e90..d7aaec5667bf 100644 --- a/drivers/video/aty/atyfb_base.c +++ b/drivers/video/aty/atyfb_base.c | |||
@@ -248,10 +248,6 @@ static int atyfb_sync(struct fb_info *info); | |||
248 | 248 | ||
249 | static int aty_init(struct fb_info *info); | 249 | static int aty_init(struct fb_info *info); |
250 | 250 | ||
251 | #ifdef CONFIG_ATARI | ||
252 | static int store_video_par(char *videopar, unsigned char m64_num); | ||
253 | #endif | ||
254 | |||
255 | static void aty_get_crtc(const struct atyfb_par *par, struct crtc *crtc); | 251 | static void aty_get_crtc(const struct atyfb_par *par, struct crtc *crtc); |
256 | 252 | ||
257 | static void aty_set_crtc(const struct atyfb_par *par, const struct crtc *crtc); | 253 | static void aty_set_crtc(const struct atyfb_par *par, const struct crtc *crtc); |
@@ -2268,11 +2264,13 @@ error: | |||
2268 | return; | 2264 | return; |
2269 | } | 2265 | } |
2270 | 2266 | ||
2267 | #ifdef CONFIG_PCI | ||
2271 | static void aty_bl_exit(struct backlight_device *bd) | 2268 | static void aty_bl_exit(struct backlight_device *bd) |
2272 | { | 2269 | { |
2273 | backlight_device_unregister(bd); | 2270 | backlight_device_unregister(bd); |
2274 | printk("aty: Backlight unloaded\n"); | 2271 | printk("aty: Backlight unloaded\n"); |
2275 | } | 2272 | } |
2273 | #endif /* CONFIG_PCI */ | ||
2276 | 2274 | ||
2277 | #endif /* CONFIG_FB_ATY_BACKLIGHT */ | 2275 | #endif /* CONFIG_FB_ATY_BACKLIGHT */ |
2278 | 2276 | ||
@@ -2789,7 +2787,7 @@ aty_init_exit: | |||
2789 | return ret; | 2787 | return ret; |
2790 | } | 2788 | } |
2791 | 2789 | ||
2792 | #ifdef CONFIG_ATARI | 2790 | #if defined(CONFIG_ATARI) && !defined(MODULE) |
2793 | static int __devinit store_video_par(char *video_str, unsigned char m64_num) | 2791 | static int __devinit store_video_par(char *video_str, unsigned char m64_num) |
2794 | { | 2792 | { |
2795 | char *p; | 2793 | char *p; |
@@ -2818,7 +2816,7 @@ static int __devinit store_video_par(char *video_str, unsigned char m64_num) | |||
2818 | phys_vmembase[m64_num] = 0; | 2816 | phys_vmembase[m64_num] = 0; |
2819 | return -1; | 2817 | return -1; |
2820 | } | 2818 | } |
2821 | #endif /* CONFIG_ATARI */ | 2819 | #endif /* CONFIG_ATARI && !MODULE */ |
2822 | 2820 | ||
2823 | /* | 2821 | /* |
2824 | * Blank the display. | 2822 | * Blank the display. |
diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig index 0c9373bedd1f..2d93c8d61ad5 100644 --- a/drivers/video/backlight/Kconfig +++ b/drivers/video/backlight/Kconfig | |||
@@ -302,6 +302,18 @@ config BACKLIGHT_ADP8860 | |||
302 | To compile this driver as a module, choose M here: the module will | 302 | To compile this driver as a module, choose M here: the module will |
303 | be called adp8860_bl. | 303 | be called adp8860_bl. |
304 | 304 | ||
305 | config BACKLIGHT_ADP8870 | ||
306 | tristate "Backlight Driver for ADP8870 using WLED" | ||
307 | depends on BACKLIGHT_CLASS_DEVICE && I2C | ||
308 | select NEW_LEDS | ||
309 | select LEDS_CLASS | ||
310 | help | ||
311 | If you have a LCD backlight connected to the ADP8870, | ||
312 | say Y here to enable this driver. | ||
313 | |||
314 | To compile this driver as a module, choose M here: the module will | ||
315 | be called adp8870_bl. | ||
316 | |||
305 | config BACKLIGHT_88PM860X | 317 | config BACKLIGHT_88PM860X |
306 | tristate "Backlight Driver for 88PM8606 using WLED" | 318 | tristate "Backlight Driver for 88PM8606 using WLED" |
307 | depends on MFD_88PM860X | 319 | depends on MFD_88PM860X |
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile index b9ca8490df87..ee72adb8786e 100644 --- a/drivers/video/backlight/Makefile +++ b/drivers/video/backlight/Makefile | |||
@@ -34,6 +34,7 @@ obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o | |||
34 | obj-$(CONFIG_BACKLIGHT_ADX) += adx_bl.o | 34 | obj-$(CONFIG_BACKLIGHT_ADX) += adx_bl.o |
35 | obj-$(CONFIG_BACKLIGHT_ADP5520) += adp5520_bl.o | 35 | obj-$(CONFIG_BACKLIGHT_ADP5520) += adp5520_bl.o |
36 | obj-$(CONFIG_BACKLIGHT_ADP8860) += adp8860_bl.o | 36 | obj-$(CONFIG_BACKLIGHT_ADP8860) += adp8860_bl.o |
37 | obj-$(CONFIG_BACKLIGHT_ADP8870) += adp8870_bl.o | ||
37 | obj-$(CONFIG_BACKLIGHT_88PM860X) += 88pm860x_bl.o | 38 | obj-$(CONFIG_BACKLIGHT_88PM860X) += 88pm860x_bl.o |
38 | obj-$(CONFIG_BACKLIGHT_PCF50633) += pcf50633-backlight.o | 39 | obj-$(CONFIG_BACKLIGHT_PCF50633) += pcf50633-backlight.o |
39 | 40 | ||
diff --git a/drivers/video/backlight/adp8870_bl.c b/drivers/video/backlight/adp8870_bl.c new file mode 100644 index 000000000000..05a8832bb3eb --- /dev/null +++ b/drivers/video/backlight/adp8870_bl.c | |||
@@ -0,0 +1,1012 @@ | |||
1 | /* | ||
2 | * Backlight driver for Analog Devices ADP8870 Backlight Devices | ||
3 | * | ||
4 | * Copyright 2009-2011 Analog Devices Inc. | ||
5 | * | ||
6 | * Licensed under the GPL-2 or later. | ||
7 | */ | ||
8 | |||
9 | #include <linux/module.h> | ||
10 | #include <linux/version.h> | ||
11 | #include <linux/init.h> | ||
12 | #include <linux/errno.h> | ||
13 | #include <linux/pm.h> | ||
14 | #include <linux/platform_device.h> | ||
15 | #include <linux/i2c.h> | ||
16 | #include <linux/fb.h> | ||
17 | #include <linux/backlight.h> | ||
18 | #include <linux/leds.h> | ||
19 | #include <linux/workqueue.h> | ||
20 | #include <linux/slab.h> | ||
21 | |||
22 | #include <linux/i2c/adp8870.h> | ||
23 | #define ADP8870_EXT_FEATURES | ||
24 | #define ADP8870_USE_LEDS | ||
25 | |||
26 | |||
27 | #define ADP8870_MFDVID 0x00 /* Manufacturer and device ID */ | ||
28 | #define ADP8870_MDCR 0x01 /* Device mode and status */ | ||
29 | #define ADP8870_INT_STAT 0x02 /* Interrupts status */ | ||
30 | #define ADP8870_INT_EN 0x03 /* Interrupts enable */ | ||
31 | #define ADP8870_CFGR 0x04 /* Configuration register */ | ||
32 | #define ADP8870_BLSEL 0x05 /* Sink enable backlight or independent */ | ||
33 | #define ADP8870_PWMLED 0x06 /* PWM Enable Selection Register */ | ||
34 | #define ADP8870_BLOFF 0x07 /* Backlight off timeout */ | ||
35 | #define ADP8870_BLDIM 0x08 /* Backlight dim timeout */ | ||
36 | #define ADP8870_BLFR 0x09 /* Backlight fade in and out rates */ | ||
37 | #define ADP8870_BLMX1 0x0A /* Backlight (Brightness Level 1-daylight) maximum current */ | ||
38 | #define ADP8870_BLDM1 0x0B /* Backlight (Brightness Level 1-daylight) dim current */ | ||
39 | #define ADP8870_BLMX2 0x0C /* Backlight (Brightness Level 2-bright) maximum current */ | ||
40 | #define ADP8870_BLDM2 0x0D /* Backlight (Brightness Level 2-bright) dim current */ | ||
41 | #define ADP8870_BLMX3 0x0E /* Backlight (Brightness Level 3-office) maximum current */ | ||
42 | #define ADP8870_BLDM3 0x0F /* Backlight (Brightness Level 3-office) dim current */ | ||
43 | #define ADP8870_BLMX4 0x10 /* Backlight (Brightness Level 4-indoor) maximum current */ | ||
44 | #define ADP8870_BLDM4 0x11 /* Backlight (Brightness Level 4-indoor) dim current */ | ||
45 | #define ADP8870_BLMX5 0x12 /* Backlight (Brightness Level 5-dark) maximum current */ | ||
46 | #define ADP8870_BLDM5 0x13 /* Backlight (Brightness Level 5-dark) dim current */ | ||
47 | #define ADP8870_ISCLAW 0x1A /* Independent sink current fade law register */ | ||
48 | #define ADP8870_ISCC 0x1B /* Independent sink current control register */ | ||
49 | #define ADP8870_ISCT1 0x1C /* Independent Sink Current Timer Register LED[7:5] */ | ||
50 | #define ADP8870_ISCT2 0x1D /* Independent Sink Current Timer Register LED[4:1] */ | ||
51 | #define ADP8870_ISCF 0x1E /* Independent sink current fade register */ | ||
52 | #define ADP8870_ISC1 0x1F /* Independent Sink Current LED1 */ | ||
53 | #define ADP8870_ISC2 0x20 /* Independent Sink Current LED2 */ | ||
54 | #define ADP8870_ISC3 0x21 /* Independent Sink Current LED3 */ | ||
55 | #define ADP8870_ISC4 0x22 /* Independent Sink Current LED4 */ | ||
56 | #define ADP8870_ISC5 0x23 /* Independent Sink Current LED5 */ | ||
57 | #define ADP8870_ISC6 0x24 /* Independent Sink Current LED6 */ | ||
58 | #define ADP8870_ISC7 0x25 /* Independent Sink Current LED7 (Brightness Level 1-daylight) */ | ||
59 | #define ADP8870_ISC7_L2 0x26 /* Independent Sink Current LED7 (Brightness Level 2-bright) */ | ||
60 | #define ADP8870_ISC7_L3 0x27 /* Independent Sink Current LED7 (Brightness Level 3-office) */ | ||
61 | #define ADP8870_ISC7_L4 0x28 /* Independent Sink Current LED7 (Brightness Level 4-indoor) */ | ||
62 | #define ADP8870_ISC7_L5 0x29 /* Independent Sink Current LED7 (Brightness Level 5-dark) */ | ||
63 | #define ADP8870_CMP_CTL 0x2D /* ALS Comparator Control Register */ | ||
64 | #define ADP8870_ALS1_EN 0x2E /* Main ALS comparator level enable */ | ||
65 | #define ADP8870_ALS2_EN 0x2F /* Second ALS comparator level enable */ | ||
66 | #define ADP8870_ALS1_STAT 0x30 /* Main ALS Comparator Status Register */ | ||
67 | #define ADP8870_ALS2_STAT 0x31 /* Second ALS Comparator Status Register */ | ||
68 | #define ADP8870_L2TRP 0x32 /* L2 comparator reference */ | ||
69 | #define ADP8870_L2HYS 0x33 /* L2 hysteresis */ | ||
70 | #define ADP8870_L3TRP 0x34 /* L3 comparator reference */ | ||
71 | #define ADP8870_L3HYS 0x35 /* L3 hysteresis */ | ||
72 | #define ADP8870_L4TRP 0x36 /* L4 comparator reference */ | ||
73 | #define ADP8870_L4HYS 0x37 /* L4 hysteresis */ | ||
74 | #define ADP8870_L5TRP 0x38 /* L5 comparator reference */ | ||
75 | #define ADP8870_L5HYS 0x39 /* L5 hysteresis */ | ||
76 | #define ADP8870_PH1LEVL 0x40 /* First phototransistor ambient light level-low byte register */ | ||
77 | #define ADP8870_PH1LEVH 0x41 /* First phototransistor ambient light level-high byte register */ | ||
78 | #define ADP8870_PH2LEVL 0x42 /* Second phototransistor ambient light level-low byte register */ | ||
79 | #define ADP8870_PH2LEVH 0x43 /* Second phototransistor ambient light level-high byte register */ | ||
80 | |||
81 | #define ADP8870_MANUFID 0x3 /* Analog Devices AD8870 Manufacturer and device ID */ | ||
82 | #define ADP8870_DEVID(x) ((x) & 0xF) | ||
83 | #define ADP8870_MANID(x) ((x) >> 4) | ||
84 | |||
85 | /* MDCR Device mode and status */ | ||
86 | #define D7ALSEN (1 << 7) | ||
87 | #define INT_CFG (1 << 6) | ||
88 | #define NSTBY (1 << 5) | ||
89 | #define DIM_EN (1 << 4) | ||
90 | #define GDWN_DIS (1 << 3) | ||
91 | #define SIS_EN (1 << 2) | ||
92 | #define CMP_AUTOEN (1 << 1) | ||
93 | #define BLEN (1 << 0) | ||
94 | |||
95 | /* ADP8870_ALS1_EN Main ALS comparator level enable */ | ||
96 | #define L5_EN (1 << 3) | ||
97 | #define L4_EN (1 << 2) | ||
98 | #define L3_EN (1 << 1) | ||
99 | #define L2_EN (1 << 0) | ||
100 | |||
101 | #define CFGR_BLV_SHIFT 3 | ||
102 | #define CFGR_BLV_MASK 0x7 | ||
103 | #define ADP8870_FLAG_LED_MASK 0xFF | ||
104 | |||
105 | #define FADE_VAL(in, out) ((0xF & (in)) | ((0xF & (out)) << 4)) | ||
106 | #define BL_CFGR_VAL(law, blv) ((((blv) & CFGR_BLV_MASK) << CFGR_BLV_SHIFT) | ((0x3 & (law)) << 1)) | ||
107 | #define ALS_CMPR_CFG_VAL(filt) ((0x7 & (filt)) << 1) | ||
108 | |||
109 | struct adp8870_bl { | ||
110 | struct i2c_client *client; | ||
111 | struct backlight_device *bl; | ||
112 | struct adp8870_led *led; | ||
113 | struct adp8870_backlight_platform_data *pdata; | ||
114 | struct mutex lock; | ||
115 | unsigned long cached_daylight_max; | ||
116 | int id; | ||
117 | int revid; | ||
118 | int current_brightness; | ||
119 | }; | ||
120 | |||
121 | struct adp8870_led { | ||
122 | struct led_classdev cdev; | ||
123 | struct work_struct work; | ||
124 | struct i2c_client *client; | ||
125 | enum led_brightness new_brightness; | ||
126 | int id; | ||
127 | int flags; | ||
128 | }; | ||
129 | |||
130 | static int adp8870_read(struct i2c_client *client, int reg, uint8_t *val) | ||
131 | { | ||
132 | int ret; | ||
133 | |||
134 | ret = i2c_smbus_read_byte_data(client, reg); | ||
135 | if (ret < 0) { | ||
136 | dev_err(&client->dev, "failed reading at 0x%02x\n", reg); | ||
137 | return ret; | ||
138 | } | ||
139 | |||
140 | *val = ret; | ||
141 | return 0; | ||
142 | } | ||
143 | |||
144 | |||
145 | static int adp8870_write(struct i2c_client *client, u8 reg, u8 val) | ||
146 | { | ||
147 | int ret = i2c_smbus_write_byte_data(client, reg, val); | ||
148 | if (ret) | ||
149 | dev_err(&client->dev, "failed to write\n"); | ||
150 | |||
151 | return ret; | ||
152 | } | ||
153 | |||
154 | static int adp8870_set_bits(struct i2c_client *client, int reg, uint8_t bit_mask) | ||
155 | { | ||
156 | struct adp8870_bl *data = i2c_get_clientdata(client); | ||
157 | uint8_t reg_val; | ||
158 | int ret; | ||
159 | |||
160 | mutex_lock(&data->lock); | ||
161 | |||
162 | ret = adp8870_read(client, reg, ®_val); | ||
163 | |||
164 | if (!ret && ((reg_val & bit_mask) == 0)) { | ||
165 | reg_val |= bit_mask; | ||
166 | ret = adp8870_write(client, reg, reg_val); | ||
167 | } | ||
168 | |||
169 | mutex_unlock(&data->lock); | ||
170 | return ret; | ||
171 | } | ||
172 | |||
173 | static int adp8870_clr_bits(struct i2c_client *client, int reg, uint8_t bit_mask) | ||
174 | { | ||
175 | struct adp8870_bl *data = i2c_get_clientdata(client); | ||
176 | uint8_t reg_val; | ||
177 | int ret; | ||
178 | |||
179 | mutex_lock(&data->lock); | ||
180 | |||
181 | ret = adp8870_read(client, reg, ®_val); | ||
182 | |||
183 | if (!ret && (reg_val & bit_mask)) { | ||
184 | reg_val &= ~bit_mask; | ||
185 | ret = adp8870_write(client, reg, reg_val); | ||
186 | } | ||
187 | |||
188 | mutex_unlock(&data->lock); | ||
189 | return ret; | ||
190 | } | ||
191 | |||
192 | /* | ||
193 | * Independent sink / LED | ||
194 | */ | ||
195 | #if defined(ADP8870_USE_LEDS) | ||
196 | static void adp8870_led_work(struct work_struct *work) | ||
197 | { | ||
198 | struct adp8870_led *led = container_of(work, struct adp8870_led, work); | ||
199 | adp8870_write(led->client, ADP8870_ISC1 + led->id - 1, | ||
200 | led->new_brightness >> 1); | ||
201 | } | ||
202 | |||
203 | static void adp8870_led_set(struct led_classdev *led_cdev, | ||
204 | enum led_brightness value) | ||
205 | { | ||
206 | struct adp8870_led *led; | ||
207 | |||
208 | led = container_of(led_cdev, struct adp8870_led, cdev); | ||
209 | led->new_brightness = value; | ||
210 | /* | ||
211 | * Use workqueue for IO since I2C operations can sleep. | ||
212 | */ | ||
213 | schedule_work(&led->work); | ||
214 | } | ||
215 | |||
216 | static int adp8870_led_setup(struct adp8870_led *led) | ||
217 | { | ||
218 | struct i2c_client *client = led->client; | ||
219 | int ret = 0; | ||
220 | |||
221 | ret = adp8870_write(client, ADP8870_ISC1 + led->id - 1, 0); | ||
222 | if (ret) | ||
223 | return ret; | ||
224 | |||
225 | ret = adp8870_set_bits(client, ADP8870_ISCC, 1 << (led->id - 1)); | ||
226 | if (ret) | ||
227 | return ret; | ||
228 | |||
229 | if (led->id > 4) | ||
230 | ret = adp8870_set_bits(client, ADP8870_ISCT1, | ||
231 | (led->flags & 0x3) << ((led->id - 5) * 2)); | ||
232 | else | ||
233 | ret = adp8870_set_bits(client, ADP8870_ISCT2, | ||
234 | (led->flags & 0x3) << ((led->id - 1) * 2)); | ||
235 | |||
236 | return ret; | ||
237 | } | ||
238 | |||
239 | static int __devinit adp8870_led_probe(struct i2c_client *client) | ||
240 | { | ||
241 | struct adp8870_backlight_platform_data *pdata = | ||
242 | client->dev.platform_data; | ||
243 | struct adp8870_bl *data = i2c_get_clientdata(client); | ||
244 | struct adp8870_led *led, *led_dat; | ||
245 | struct led_info *cur_led; | ||
246 | int ret, i; | ||
247 | |||
248 | |||
249 | led = kcalloc(pdata->num_leds, sizeof(*led), GFP_KERNEL); | ||
250 | if (led == NULL) { | ||
251 | dev_err(&client->dev, "failed to alloc memory\n"); | ||
252 | return -ENOMEM; | ||
253 | } | ||
254 | |||
255 | ret = adp8870_write(client, ADP8870_ISCLAW, pdata->led_fade_law); | ||
256 | if (ret) | ||
257 | goto err_free; | ||
258 | |||
259 | ret = adp8870_write(client, ADP8870_ISCT1, | ||
260 | (pdata->led_on_time & 0x3) << 6); | ||
261 | if (ret) | ||
262 | goto err_free; | ||
263 | |||
264 | ret = adp8870_write(client, ADP8870_ISCF, | ||
265 | FADE_VAL(pdata->led_fade_in, pdata->led_fade_out)); | ||
266 | if (ret) | ||
267 | goto err_free; | ||
268 | |||
269 | for (i = 0; i < pdata->num_leds; ++i) { | ||
270 | cur_led = &pdata->leds[i]; | ||
271 | led_dat = &led[i]; | ||
272 | |||
273 | led_dat->id = cur_led->flags & ADP8870_FLAG_LED_MASK; | ||
274 | |||
275 | if (led_dat->id > 7 || led_dat->id < 1) { | ||
276 | dev_err(&client->dev, "Invalid LED ID %d\n", | ||
277 | led_dat->id); | ||
278 | goto err; | ||
279 | } | ||
280 | |||
281 | if (pdata->bl_led_assign & (1 << (led_dat->id - 1))) { | ||
282 | dev_err(&client->dev, "LED %d used by Backlight\n", | ||
283 | led_dat->id); | ||
284 | goto err; | ||
285 | } | ||
286 | |||
287 | led_dat->cdev.name = cur_led->name; | ||
288 | led_dat->cdev.default_trigger = cur_led->default_trigger; | ||
289 | led_dat->cdev.brightness_set = adp8870_led_set; | ||
290 | led_dat->cdev.brightness = LED_OFF; | ||
291 | led_dat->flags = cur_led->flags >> FLAG_OFFT_SHIFT; | ||
292 | led_dat->client = client; | ||
293 | led_dat->new_brightness = LED_OFF; | ||
294 | INIT_WORK(&led_dat->work, adp8870_led_work); | ||
295 | |||
296 | ret = led_classdev_register(&client->dev, &led_dat->cdev); | ||
297 | if (ret) { | ||
298 | dev_err(&client->dev, "failed to register LED %d\n", | ||
299 | led_dat->id); | ||
300 | goto err; | ||
301 | } | ||
302 | |||
303 | ret = adp8870_led_setup(led_dat); | ||
304 | if (ret) { | ||
305 | dev_err(&client->dev, "failed to write\n"); | ||
306 | i++; | ||
307 | goto err; | ||
308 | } | ||
309 | } | ||
310 | |||
311 | data->led = led; | ||
312 | |||
313 | return 0; | ||
314 | |||
315 | err: | ||
316 | for (i = i - 1; i >= 0; --i) { | ||
317 | led_classdev_unregister(&led[i].cdev); | ||
318 | cancel_work_sync(&led[i].work); | ||
319 | } | ||
320 | |||
321 | err_free: | ||
322 | kfree(led); | ||
323 | |||
324 | return ret; | ||
325 | } | ||
326 | |||
327 | static int __devexit adp8870_led_remove(struct i2c_client *client) | ||
328 | { | ||
329 | struct adp8870_backlight_platform_data *pdata = | ||
330 | client->dev.platform_data; | ||
331 | struct adp8870_bl *data = i2c_get_clientdata(client); | ||
332 | int i; | ||
333 | |||
334 | for (i = 0; i < pdata->num_leds; i++) { | ||
335 | led_classdev_unregister(&data->led[i].cdev); | ||
336 | cancel_work_sync(&data->led[i].work); | ||
337 | } | ||
338 | |||
339 | kfree(data->led); | ||
340 | return 0; | ||
341 | } | ||
342 | #else | ||
343 | static int __devinit adp8870_led_probe(struct i2c_client *client) | ||
344 | { | ||
345 | return 0; | ||
346 | } | ||
347 | |||
348 | static int __devexit adp8870_led_remove(struct i2c_client *client) | ||
349 | { | ||
350 | return 0; | ||
351 | } | ||
352 | #endif | ||
353 | |||
354 | static int adp8870_bl_set(struct backlight_device *bl, int brightness) | ||
355 | { | ||
356 | struct adp8870_bl *data = bl_get_data(bl); | ||
357 | struct i2c_client *client = data->client; | ||
358 | int ret = 0; | ||
359 | |||
360 | if (data->pdata->en_ambl_sens) { | ||
361 | if ((brightness > 0) && (brightness < ADP8870_MAX_BRIGHTNESS)) { | ||
362 | /* Disable Ambient Light auto adjust */ | ||
363 | ret = adp8870_clr_bits(client, ADP8870_MDCR, | ||
364 | CMP_AUTOEN); | ||
365 | if (ret) | ||
366 | return ret; | ||
367 | ret = adp8870_write(client, ADP8870_BLMX1, brightness); | ||
368 | if (ret) | ||
369 | return ret; | ||
370 | } else { | ||
371 | /* | ||
372 | * MAX_BRIGHTNESS -> Enable Ambient Light auto adjust | ||
373 | * restore daylight l1 sysfs brightness | ||
374 | */ | ||
375 | ret = adp8870_write(client, ADP8870_BLMX1, | ||
376 | data->cached_daylight_max); | ||
377 | if (ret) | ||
378 | return ret; | ||
379 | |||
380 | ret = adp8870_set_bits(client, ADP8870_MDCR, | ||
381 | CMP_AUTOEN); | ||
382 | if (ret) | ||
383 | return ret; | ||
384 | } | ||
385 | } else { | ||
386 | ret = adp8870_write(client, ADP8870_BLMX1, brightness); | ||
387 | if (ret) | ||
388 | return ret; | ||
389 | } | ||
390 | |||
391 | if (data->current_brightness && brightness == 0) | ||
392 | ret = adp8870_set_bits(client, | ||
393 | ADP8870_MDCR, DIM_EN); | ||
394 | else if (data->current_brightness == 0 && brightness) | ||
395 | ret = adp8870_clr_bits(client, | ||
396 | ADP8870_MDCR, DIM_EN); | ||
397 | |||
398 | if (!ret) | ||
399 | data->current_brightness = brightness; | ||
400 | |||
401 | return ret; | ||
402 | } | ||
403 | |||
404 | static int adp8870_bl_update_status(struct backlight_device *bl) | ||
405 | { | ||
406 | int brightness = bl->props.brightness; | ||
407 | if (bl->props.power != FB_BLANK_UNBLANK) | ||
408 | brightness = 0; | ||
409 | |||
410 | if (bl->props.fb_blank != FB_BLANK_UNBLANK) | ||
411 | brightness = 0; | ||
412 | |||
413 | return adp8870_bl_set(bl, brightness); | ||
414 | } | ||
415 | |||
416 | static int adp8870_bl_get_brightness(struct backlight_device *bl) | ||
417 | { | ||
418 | struct adp8870_bl *data = bl_get_data(bl); | ||
419 | |||
420 | return data->current_brightness; | ||
421 | } | ||
422 | |||
423 | static const struct backlight_ops adp8870_bl_ops = { | ||
424 | .update_status = adp8870_bl_update_status, | ||
425 | .get_brightness = adp8870_bl_get_brightness, | ||
426 | }; | ||
427 | |||
428 | static int adp8870_bl_setup(struct backlight_device *bl) | ||
429 | { | ||
430 | struct adp8870_bl *data = bl_get_data(bl); | ||
431 | struct i2c_client *client = data->client; | ||
432 | struct adp8870_backlight_platform_data *pdata = data->pdata; | ||
433 | int ret = 0; | ||
434 | |||
435 | ret = adp8870_write(client, ADP8870_BLSEL, ~pdata->bl_led_assign); | ||
436 | if (ret) | ||
437 | return ret; | ||
438 | |||
439 | ret = adp8870_write(client, ADP8870_PWMLED, pdata->pwm_assign); | ||
440 | if (ret) | ||
441 | return ret; | ||
442 | |||
443 | ret = adp8870_write(client, ADP8870_BLMX1, pdata->l1_daylight_max); | ||
444 | if (ret) | ||
445 | return ret; | ||
446 | |||
447 | ret = adp8870_write(client, ADP8870_BLDM1, pdata->l1_daylight_dim); | ||
448 | if (ret) | ||
449 | return ret; | ||
450 | |||
451 | if (pdata->en_ambl_sens) { | ||
452 | data->cached_daylight_max = pdata->l1_daylight_max; | ||
453 | ret = adp8870_write(client, ADP8870_BLMX2, | ||
454 | pdata->l2_bright_max); | ||
455 | if (ret) | ||
456 | return ret; | ||
457 | ret = adp8870_write(client, ADP8870_BLDM2, | ||
458 | pdata->l2_bright_dim); | ||
459 | if (ret) | ||
460 | return ret; | ||
461 | |||
462 | ret = adp8870_write(client, ADP8870_BLMX3, | ||
463 | pdata->l3_office_max); | ||
464 | if (ret) | ||
465 | return ret; | ||
466 | ret = adp8870_write(client, ADP8870_BLDM3, | ||
467 | pdata->l3_office_dim); | ||
468 | if (ret) | ||
469 | return ret; | ||
470 | |||
471 | ret = adp8870_write(client, ADP8870_BLMX4, | ||
472 | pdata->l4_indoor_max); | ||
473 | if (ret) | ||
474 | return ret; | ||
475 | |||
476 | ret = adp8870_write(client, ADP8870_BLDM4, | ||
477 | pdata->l4_indor_dim); | ||
478 | if (ret) | ||
479 | return ret; | ||
480 | |||
481 | ret = adp8870_write(client, ADP8870_BLMX5, | ||
482 | pdata->l5_dark_max); | ||
483 | if (ret) | ||
484 | return ret; | ||
485 | |||
486 | ret = adp8870_write(client, ADP8870_BLDM5, | ||
487 | pdata->l5_dark_dim); | ||
488 | if (ret) | ||
489 | return ret; | ||
490 | |||
491 | ret = adp8870_write(client, ADP8870_L2TRP, pdata->l2_trip); | ||
492 | if (ret) | ||
493 | return ret; | ||
494 | |||
495 | ret = adp8870_write(client, ADP8870_L2HYS, pdata->l2_hyst); | ||
496 | if (ret) | ||
497 | return ret; | ||
498 | |||
499 | ret = adp8870_write(client, ADP8870_L3TRP, pdata->l3_trip); | ||
500 | if (ret) | ||
501 | return ret; | ||
502 | |||
503 | ret = adp8870_write(client, ADP8870_L3HYS, pdata->l3_hyst); | ||
504 | if (ret) | ||
505 | return ret; | ||
506 | |||
507 | ret = adp8870_write(client, ADP8870_L4TRP, pdata->l4_trip); | ||
508 | if (ret) | ||
509 | return ret; | ||
510 | |||
511 | ret = adp8870_write(client, ADP8870_L4HYS, pdata->l4_hyst); | ||
512 | if (ret) | ||
513 | return ret; | ||
514 | |||
515 | ret = adp8870_write(client, ADP8870_L5TRP, pdata->l5_trip); | ||
516 | if (ret) | ||
517 | return ret; | ||
518 | |||
519 | ret = adp8870_write(client, ADP8870_L5HYS, pdata->l5_hyst); | ||
520 | if (ret) | ||
521 | return ret; | ||
522 | |||
523 | ret = adp8870_write(client, ADP8870_ALS1_EN, L5_EN | L4_EN | | ||
524 | L3_EN | L2_EN); | ||
525 | if (ret) | ||
526 | return ret; | ||
527 | |||
528 | ret = adp8870_write(client, ADP8870_CMP_CTL, | ||
529 | ALS_CMPR_CFG_VAL(pdata->abml_filt)); | ||
530 | if (ret) | ||
531 | return ret; | ||
532 | } | ||
533 | |||
534 | ret = adp8870_write(client, ADP8870_CFGR, | ||
535 | BL_CFGR_VAL(pdata->bl_fade_law, 0)); | ||
536 | if (ret) | ||
537 | return ret; | ||
538 | |||
539 | ret = adp8870_write(client, ADP8870_BLFR, FADE_VAL(pdata->bl_fade_in, | ||
540 | pdata->bl_fade_out)); | ||
541 | if (ret) | ||
542 | return ret; | ||
543 | /* | ||
544 | * ADP8870 Rev0 requires GDWN_DIS bit set | ||
545 | */ | ||
546 | |||
547 | ret = adp8870_set_bits(client, ADP8870_MDCR, BLEN | DIM_EN | NSTBY | | ||
548 | (data->revid == 0 ? GDWN_DIS : 0)); | ||
549 | |||
550 | return ret; | ||
551 | } | ||
552 | |||
553 | static ssize_t adp8870_show(struct device *dev, char *buf, int reg) | ||
554 | { | ||
555 | struct adp8870_bl *data = dev_get_drvdata(dev); | ||
556 | int error; | ||
557 | uint8_t reg_val; | ||
558 | |||
559 | mutex_lock(&data->lock); | ||
560 | error = adp8870_read(data->client, reg, ®_val); | ||
561 | mutex_unlock(&data->lock); | ||
562 | |||
563 | if (error < 0) | ||
564 | return error; | ||
565 | |||
566 | return sprintf(buf, "%u\n", reg_val); | ||
567 | } | ||
568 | |||
569 | static ssize_t adp8870_store(struct device *dev, const char *buf, | ||
570 | size_t count, int reg) | ||
571 | { | ||
572 | struct adp8870_bl *data = dev_get_drvdata(dev); | ||
573 | unsigned long val; | ||
574 | int ret; | ||
575 | |||
576 | ret = strict_strtoul(buf, 10, &val); | ||
577 | if (ret) | ||
578 | return ret; | ||
579 | |||
580 | mutex_lock(&data->lock); | ||
581 | adp8870_write(data->client, reg, val); | ||
582 | mutex_unlock(&data->lock); | ||
583 | |||
584 | return count; | ||
585 | } | ||
586 | |||
587 | static ssize_t adp8870_bl_l5_dark_max_show(struct device *dev, | ||
588 | struct device_attribute *attr, char *buf) | ||
589 | { | ||
590 | return adp8870_show(dev, buf, ADP8870_BLMX5); | ||
591 | } | ||
592 | |||
593 | static ssize_t adp8870_bl_l5_dark_max_store(struct device *dev, | ||
594 | struct device_attribute *attr, const char *buf, size_t count) | ||
595 | { | ||
596 | return adp8870_store(dev, buf, count, ADP8870_BLMX5); | ||
597 | } | ||
598 | static DEVICE_ATTR(l5_dark_max, 0664, adp8870_bl_l5_dark_max_show, | ||
599 | adp8870_bl_l5_dark_max_store); | ||
600 | |||
601 | |||
602 | static ssize_t adp8870_bl_l4_indoor_max_show(struct device *dev, | ||
603 | struct device_attribute *attr, char *buf) | ||
604 | { | ||
605 | return adp8870_show(dev, buf, ADP8870_BLMX4); | ||
606 | } | ||
607 | |||
608 | static ssize_t adp8870_bl_l4_indoor_max_store(struct device *dev, | ||
609 | struct device_attribute *attr, const char *buf, size_t count) | ||
610 | { | ||
611 | return adp8870_store(dev, buf, count, ADP8870_BLMX4); | ||
612 | } | ||
613 | static DEVICE_ATTR(l4_indoor_max, 0664, adp8870_bl_l4_indoor_max_show, | ||
614 | adp8870_bl_l4_indoor_max_store); | ||
615 | |||
616 | |||
617 | static ssize_t adp8870_bl_l3_office_max_show(struct device *dev, | ||
618 | struct device_attribute *attr, char *buf) | ||
619 | { | ||
620 | return adp8870_show(dev, buf, ADP8870_BLMX3); | ||
621 | } | ||
622 | |||
623 | static ssize_t adp8870_bl_l3_office_max_store(struct device *dev, | ||
624 | struct device_attribute *attr, const char *buf, size_t count) | ||
625 | { | ||
626 | return adp8870_store(dev, buf, count, ADP8870_BLMX3); | ||
627 | } | ||
628 | |||
629 | static DEVICE_ATTR(l3_office_max, 0664, adp8870_bl_l3_office_max_show, | ||
630 | adp8870_bl_l3_office_max_store); | ||
631 | |||
632 | static ssize_t adp8870_bl_l2_bright_max_show(struct device *dev, | ||
633 | struct device_attribute *attr, char *buf) | ||
634 | { | ||
635 | return adp8870_show(dev, buf, ADP8870_BLMX2); | ||
636 | } | ||
637 | |||
638 | static ssize_t adp8870_bl_l2_bright_max_store(struct device *dev, | ||
639 | struct device_attribute *attr, const char *buf, size_t count) | ||
640 | { | ||
641 | return adp8870_store(dev, buf, count, ADP8870_BLMX2); | ||
642 | } | ||
643 | static DEVICE_ATTR(l2_bright_max, 0664, adp8870_bl_l2_bright_max_show, | ||
644 | adp8870_bl_l2_bright_max_store); | ||
645 | |||
646 | static ssize_t adp8870_bl_l1_daylight_max_show(struct device *dev, | ||
647 | struct device_attribute *attr, char *buf) | ||
648 | { | ||
649 | return adp8870_show(dev, buf, ADP8870_BLMX1); | ||
650 | } | ||
651 | |||
652 | static ssize_t adp8870_bl_l1_daylight_max_store(struct device *dev, | ||
653 | struct device_attribute *attr, const char *buf, size_t count) | ||
654 | { | ||
655 | struct adp8870_bl *data = dev_get_drvdata(dev); | ||
656 | int ret = strict_strtoul(buf, 10, &data->cached_daylight_max); | ||
657 | if (ret) | ||
658 | return ret; | ||
659 | |||
660 | return adp8870_store(dev, buf, count, ADP8870_BLMX1); | ||
661 | } | ||
662 | static DEVICE_ATTR(l1_daylight_max, 0664, adp8870_bl_l1_daylight_max_show, | ||
663 | adp8870_bl_l1_daylight_max_store); | ||
664 | |||
665 | static ssize_t adp8870_bl_l5_dark_dim_show(struct device *dev, | ||
666 | struct device_attribute *attr, char *buf) | ||
667 | { | ||
668 | return adp8870_show(dev, buf, ADP8870_BLDM5); | ||
669 | } | ||
670 | |||
671 | static ssize_t adp8870_bl_l5_dark_dim_store(struct device *dev, | ||
672 | struct device_attribute *attr, | ||
673 | const char *buf, size_t count) | ||
674 | { | ||
675 | return adp8870_store(dev, buf, count, ADP8870_BLDM5); | ||
676 | } | ||
677 | static DEVICE_ATTR(l5_dark_dim, 0664, adp8870_bl_l5_dark_dim_show, | ||
678 | adp8870_bl_l5_dark_dim_store); | ||
679 | |||
680 | static ssize_t adp8870_bl_l4_indoor_dim_show(struct device *dev, | ||
681 | struct device_attribute *attr, char *buf) | ||
682 | { | ||
683 | return adp8870_show(dev, buf, ADP8870_BLDM4); | ||
684 | } | ||
685 | |||
686 | static ssize_t adp8870_bl_l4_indoor_dim_store(struct device *dev, | ||
687 | struct device_attribute *attr, | ||
688 | const char *buf, size_t count) | ||
689 | { | ||
690 | return adp8870_store(dev, buf, count, ADP8870_BLDM4); | ||
691 | } | ||
692 | static DEVICE_ATTR(l4_indoor_dim, 0664, adp8870_bl_l4_indoor_dim_show, | ||
693 | adp8870_bl_l4_indoor_dim_store); | ||
694 | |||
695 | |||
696 | static ssize_t adp8870_bl_l3_office_dim_show(struct device *dev, | ||
697 | struct device_attribute *attr, char *buf) | ||
698 | { | ||
699 | return adp8870_show(dev, buf, ADP8870_BLDM3); | ||
700 | } | ||
701 | |||
702 | static ssize_t adp8870_bl_l3_office_dim_store(struct device *dev, | ||
703 | struct device_attribute *attr, | ||
704 | const char *buf, size_t count) | ||
705 | { | ||
706 | return adp8870_store(dev, buf, count, ADP8870_BLDM3); | ||
707 | } | ||
708 | static DEVICE_ATTR(l3_office_dim, 0664, adp8870_bl_l3_office_dim_show, | ||
709 | adp8870_bl_l3_office_dim_store); | ||
710 | |||
711 | static ssize_t adp8870_bl_l2_bright_dim_show(struct device *dev, | ||
712 | struct device_attribute *attr, char *buf) | ||
713 | { | ||
714 | return adp8870_show(dev, buf, ADP8870_BLDM2); | ||
715 | } | ||
716 | |||
717 | static ssize_t adp8870_bl_l2_bright_dim_store(struct device *dev, | ||
718 | struct device_attribute *attr, | ||
719 | const char *buf, size_t count) | ||
720 | { | ||
721 | return adp8870_store(dev, buf, count, ADP8870_BLDM2); | ||
722 | } | ||
723 | static DEVICE_ATTR(l2_bright_dim, 0664, adp8870_bl_l2_bright_dim_show, | ||
724 | adp8870_bl_l2_bright_dim_store); | ||
725 | |||
726 | static ssize_t adp8870_bl_l1_daylight_dim_show(struct device *dev, | ||
727 | struct device_attribute *attr, char *buf) | ||
728 | { | ||
729 | return adp8870_show(dev, buf, ADP8870_BLDM1); | ||
730 | } | ||
731 | |||
732 | static ssize_t adp8870_bl_l1_daylight_dim_store(struct device *dev, | ||
733 | struct device_attribute *attr, | ||
734 | const char *buf, size_t count) | ||
735 | { | ||
736 | return adp8870_store(dev, buf, count, ADP8870_BLDM1); | ||
737 | } | ||
738 | static DEVICE_ATTR(l1_daylight_dim, 0664, adp8870_bl_l1_daylight_dim_show, | ||
739 | adp8870_bl_l1_daylight_dim_store); | ||
740 | |||
741 | #ifdef ADP8870_EXT_FEATURES | ||
742 | static ssize_t adp8870_bl_ambient_light_level_show(struct device *dev, | ||
743 | struct device_attribute *attr, char *buf) | ||
744 | { | ||
745 | struct adp8870_bl *data = dev_get_drvdata(dev); | ||
746 | int error; | ||
747 | uint8_t reg_val; | ||
748 | uint16_t ret_val; | ||
749 | |||
750 | mutex_lock(&data->lock); | ||
751 | error = adp8870_read(data->client, ADP8870_PH1LEVL, ®_val); | ||
752 | if (error < 0) { | ||
753 | mutex_unlock(&data->lock); | ||
754 | return error; | ||
755 | } | ||
756 | ret_val = reg_val; | ||
757 | error = adp8870_read(data->client, ADP8870_PH1LEVH, ®_val); | ||
758 | mutex_unlock(&data->lock); | ||
759 | |||
760 | if (error < 0) | ||
761 | return error; | ||
762 | |||
763 | /* Return 13-bit conversion value for the first light sensor */ | ||
764 | ret_val += (reg_val & 0x1F) << 8; | ||
765 | |||
766 | return sprintf(buf, "%u\n", ret_val); | ||
767 | } | ||
768 | static DEVICE_ATTR(ambient_light_level, 0444, | ||
769 | adp8870_bl_ambient_light_level_show, NULL); | ||
770 | |||
771 | static ssize_t adp8870_bl_ambient_light_zone_show(struct device *dev, | ||
772 | struct device_attribute *attr, char *buf) | ||
773 | { | ||
774 | struct adp8870_bl *data = dev_get_drvdata(dev); | ||
775 | int error; | ||
776 | uint8_t reg_val; | ||
777 | |||
778 | mutex_lock(&data->lock); | ||
779 | error = adp8870_read(data->client, ADP8870_CFGR, ®_val); | ||
780 | mutex_unlock(&data->lock); | ||
781 | |||
782 | if (error < 0) | ||
783 | return error; | ||
784 | |||
785 | return sprintf(buf, "%u\n", | ||
786 | ((reg_val >> CFGR_BLV_SHIFT) & CFGR_BLV_MASK) + 1); | ||
787 | } | ||
788 | |||
789 | static ssize_t adp8870_bl_ambient_light_zone_store(struct device *dev, | ||
790 | struct device_attribute *attr, | ||
791 | const char *buf, size_t count) | ||
792 | { | ||
793 | struct adp8870_bl *data = dev_get_drvdata(dev); | ||
794 | unsigned long val; | ||
795 | uint8_t reg_val; | ||
796 | int ret; | ||
797 | |||
798 | ret = strict_strtoul(buf, 10, &val); | ||
799 | if (ret) | ||
800 | return ret; | ||
801 | |||
802 | if (val == 0) { | ||
803 | /* Enable automatic ambient light sensing */ | ||
804 | adp8870_set_bits(data->client, ADP8870_MDCR, CMP_AUTOEN); | ||
805 | } else if ((val > 0) && (val < 6)) { | ||
806 | /* Disable automatic ambient light sensing */ | ||
807 | adp8870_clr_bits(data->client, ADP8870_MDCR, CMP_AUTOEN); | ||
808 | |||
809 | /* Set user supplied ambient light zone */ | ||
810 | mutex_lock(&data->lock); | ||
811 | adp8870_read(data->client, ADP8870_CFGR, ®_val); | ||
812 | reg_val &= ~(CFGR_BLV_MASK << CFGR_BLV_SHIFT); | ||
813 | reg_val |= (val - 1) << CFGR_BLV_SHIFT; | ||
814 | adp8870_write(data->client, ADP8870_CFGR, reg_val); | ||
815 | mutex_unlock(&data->lock); | ||
816 | } | ||
817 | |||
818 | return count; | ||
819 | } | ||
820 | static DEVICE_ATTR(ambient_light_zone, 0664, | ||
821 | adp8870_bl_ambient_light_zone_show, | ||
822 | adp8870_bl_ambient_light_zone_store); | ||
823 | #endif | ||
824 | |||
825 | static struct attribute *adp8870_bl_attributes[] = { | ||
826 | &dev_attr_l5_dark_max.attr, | ||
827 | &dev_attr_l5_dark_dim.attr, | ||
828 | &dev_attr_l4_indoor_max.attr, | ||
829 | &dev_attr_l4_indoor_dim.attr, | ||
830 | &dev_attr_l3_office_max.attr, | ||
831 | &dev_attr_l3_office_dim.attr, | ||
832 | &dev_attr_l2_bright_max.attr, | ||
833 | &dev_attr_l2_bright_dim.attr, | ||
834 | &dev_attr_l1_daylight_max.attr, | ||
835 | &dev_attr_l1_daylight_dim.attr, | ||
836 | #ifdef ADP8870_EXT_FEATURES | ||
837 | &dev_attr_ambient_light_level.attr, | ||
838 | &dev_attr_ambient_light_zone.attr, | ||
839 | #endif | ||
840 | NULL | ||
841 | }; | ||
842 | |||
843 | static const struct attribute_group adp8870_bl_attr_group = { | ||
844 | .attrs = adp8870_bl_attributes, | ||
845 | }; | ||
846 | |||
847 | static int __devinit adp8870_probe(struct i2c_client *client, | ||
848 | const struct i2c_device_id *id) | ||
849 | { | ||
850 | struct backlight_properties props; | ||
851 | struct backlight_device *bl; | ||
852 | struct adp8870_bl *data; | ||
853 | struct adp8870_backlight_platform_data *pdata = | ||
854 | client->dev.platform_data; | ||
855 | uint8_t reg_val; | ||
856 | int ret; | ||
857 | |||
858 | if (!i2c_check_functionality(client->adapter, | ||
859 | I2C_FUNC_SMBUS_BYTE_DATA)) { | ||
860 | dev_err(&client->dev, "SMBUS Byte Data not Supported\n"); | ||
861 | return -EIO; | ||
862 | } | ||
863 | |||
864 | if (!pdata) { | ||
865 | dev_err(&client->dev, "no platform data?\n"); | ||
866 | return -EINVAL; | ||
867 | } | ||
868 | |||
869 | ret = adp8870_read(client, ADP8870_MFDVID, ®_val); | ||
870 | if (ret < 0) | ||
871 | return -EIO; | ||
872 | |||
873 | if (ADP8870_MANID(reg_val) != ADP8870_MANUFID) { | ||
874 | dev_err(&client->dev, "failed to probe\n"); | ||
875 | return -ENODEV; | ||
876 | } | ||
877 | |||
878 | data = kzalloc(sizeof(*data), GFP_KERNEL); | ||
879 | if (data == NULL) | ||
880 | return -ENOMEM; | ||
881 | |||
882 | data->revid = ADP8870_DEVID(reg_val); | ||
883 | data->client = client; | ||
884 | data->pdata = pdata; | ||
885 | data->id = id->driver_data; | ||
886 | data->current_brightness = 0; | ||
887 | i2c_set_clientdata(client, data); | ||
888 | |||
889 | mutex_init(&data->lock); | ||
890 | |||
891 | memset(&props, 0, sizeof(props)); | ||
892 | props.type = BACKLIGHT_RAW; | ||
893 | props.max_brightness = props.brightness = ADP8870_MAX_BRIGHTNESS; | ||
894 | bl = backlight_device_register(dev_driver_string(&client->dev), | ||
895 | &client->dev, data, &adp8870_bl_ops, &props); | ||
896 | if (IS_ERR(bl)) { | ||
897 | dev_err(&client->dev, "failed to register backlight\n"); | ||
898 | ret = PTR_ERR(bl); | ||
899 | goto out2; | ||
900 | } | ||
901 | |||
902 | data->bl = bl; | ||
903 | |||
904 | if (pdata->en_ambl_sens) | ||
905 | ret = sysfs_create_group(&bl->dev.kobj, | ||
906 | &adp8870_bl_attr_group); | ||
907 | |||
908 | if (ret) { | ||
909 | dev_err(&client->dev, "failed to register sysfs\n"); | ||
910 | goto out1; | ||
911 | } | ||
912 | |||
913 | ret = adp8870_bl_setup(bl); | ||
914 | if (ret) { | ||
915 | ret = -EIO; | ||
916 | goto out; | ||
917 | } | ||
918 | |||
919 | backlight_update_status(bl); | ||
920 | |||
921 | dev_info(&client->dev, "Rev.%d Backlight\n", data->revid); | ||
922 | |||
923 | if (pdata->num_leds) | ||
924 | adp8870_led_probe(client); | ||
925 | |||
926 | return 0; | ||
927 | |||
928 | out: | ||
929 | if (data->pdata->en_ambl_sens) | ||
930 | sysfs_remove_group(&data->bl->dev.kobj, | ||
931 | &adp8870_bl_attr_group); | ||
932 | out1: | ||
933 | backlight_device_unregister(bl); | ||
934 | out2: | ||
935 | i2c_set_clientdata(client, NULL); | ||
936 | kfree(data); | ||
937 | |||
938 | return ret; | ||
939 | } | ||
940 | |||
941 | static int __devexit adp8870_remove(struct i2c_client *client) | ||
942 | { | ||
943 | struct adp8870_bl *data = i2c_get_clientdata(client); | ||
944 | |||
945 | adp8870_clr_bits(client, ADP8870_MDCR, NSTBY); | ||
946 | |||
947 | if (data->led) | ||
948 | adp8870_led_remove(client); | ||
949 | |||
950 | if (data->pdata->en_ambl_sens) | ||
951 | sysfs_remove_group(&data->bl->dev.kobj, | ||
952 | &adp8870_bl_attr_group); | ||
953 | |||
954 | backlight_device_unregister(data->bl); | ||
955 | i2c_set_clientdata(client, NULL); | ||
956 | kfree(data); | ||
957 | |||
958 | return 0; | ||
959 | } | ||
960 | |||
961 | #ifdef CONFIG_PM | ||
962 | static int adp8870_i2c_suspend(struct i2c_client *client, pm_message_t message) | ||
963 | { | ||
964 | adp8870_clr_bits(client, ADP8870_MDCR, NSTBY); | ||
965 | |||
966 | return 0; | ||
967 | } | ||
968 | |||
969 | static int adp8870_i2c_resume(struct i2c_client *client) | ||
970 | { | ||
971 | adp8870_set_bits(client, ADP8870_MDCR, NSTBY); | ||
972 | |||
973 | return 0; | ||
974 | } | ||
975 | #else | ||
976 | #define adp8870_i2c_suspend NULL | ||
977 | #define adp8870_i2c_resume NULL | ||
978 | #endif | ||
979 | |||
980 | static const struct i2c_device_id adp8870_id[] = { | ||
981 | { "adp8870", 0 }, | ||
982 | { } | ||
983 | }; | ||
984 | MODULE_DEVICE_TABLE(i2c, adp8870_id); | ||
985 | |||
986 | static struct i2c_driver adp8870_driver = { | ||
987 | .driver = { | ||
988 | .name = KBUILD_MODNAME, | ||
989 | }, | ||
990 | .probe = adp8870_probe, | ||
991 | .remove = __devexit_p(adp8870_remove), | ||
992 | .suspend = adp8870_i2c_suspend, | ||
993 | .resume = adp8870_i2c_resume, | ||
994 | .id_table = adp8870_id, | ||
995 | }; | ||
996 | |||
997 | static int __init adp8870_init(void) | ||
998 | { | ||
999 | return i2c_add_driver(&adp8870_driver); | ||
1000 | } | ||
1001 | module_init(adp8870_init); | ||
1002 | |||
1003 | static void __exit adp8870_exit(void) | ||
1004 | { | ||
1005 | i2c_del_driver(&adp8870_driver); | ||
1006 | } | ||
1007 | module_exit(adp8870_exit); | ||
1008 | |||
1009 | MODULE_LICENSE("GPL v2"); | ||
1010 | MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); | ||
1011 | MODULE_DESCRIPTION("ADP8870 Backlight driver"); | ||
1012 | MODULE_ALIAS("platform:adp8870-backlight"); | ||
diff --git a/drivers/video/efifb.c b/drivers/video/efifb.c index 69c49dfce9cf..784139aed079 100644 --- a/drivers/video/efifb.c +++ b/drivers/video/efifb.c | |||
@@ -541,7 +541,7 @@ static int __init efifb_init(void) | |||
541 | */ | 541 | */ |
542 | ret = platform_driver_probe(&efifb_driver, efifb_probe); | 542 | ret = platform_driver_probe(&efifb_driver, efifb_probe); |
543 | if (ret) { | 543 | if (ret) { |
544 | platform_device_unregister(&efifb_driver); | 544 | platform_device_unregister(&efifb_device); |
545 | return ret; | 545 | return ret; |
546 | } | 546 | } |
547 | 547 | ||
diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c index 0352afa49a39..4aecf213c9be 100644 --- a/drivers/video/s3c-fb.c +++ b/drivers/video/s3c-fb.c | |||
@@ -235,13 +235,12 @@ static int s3c_fb_check_var(struct fb_var_screeninfo *var, | |||
235 | struct fb_info *info) | 235 | struct fb_info *info) |
236 | { | 236 | { |
237 | struct s3c_fb_win *win = info->par; | 237 | struct s3c_fb_win *win = info->par; |
238 | struct s3c_fb_pd_win *windata = win->windata; | ||
239 | struct s3c_fb *sfb = win->parent; | 238 | struct s3c_fb *sfb = win->parent; |
240 | 239 | ||
241 | dev_dbg(sfb->dev, "checking parameters\n"); | 240 | dev_dbg(sfb->dev, "checking parameters\n"); |
242 | 241 | ||
243 | var->xres_virtual = max((unsigned int)windata->virtual_x, var->xres); | 242 | var->xres_virtual = max(var->xres_virtual, var->xres); |
244 | var->yres_virtual = max((unsigned int)windata->virtual_y, var->yres); | 243 | var->yres_virtual = max(var->yres_virtual, var->yres); |
245 | 244 | ||
246 | if (!s3c_fb_validate_win_bpp(win, var->bits_per_pixel)) { | 245 | if (!s3c_fb_validate_win_bpp(win, var->bits_per_pixel)) { |
247 | dev_dbg(sfb->dev, "win %d: unsupported bpp %d\n", | 246 | dev_dbg(sfb->dev, "win %d: unsupported bpp %d\n", |
@@ -558,6 +557,13 @@ static int s3c_fb_set_par(struct fb_info *info) | |||
558 | vidosd_set_alpha(win, alpha); | 557 | vidosd_set_alpha(win, alpha); |
559 | vidosd_set_size(win, data); | 558 | vidosd_set_size(win, data); |
560 | 559 | ||
560 | /* Enable DMA channel for this window */ | ||
561 | if (sfb->variant.has_shadowcon) { | ||
562 | data = readl(sfb->regs + SHADOWCON); | ||
563 | data |= SHADOWCON_CHx_ENABLE(win_no); | ||
564 | writel(data, sfb->regs + SHADOWCON); | ||
565 | } | ||
566 | |||
561 | data = WINCONx_ENWIN; | 567 | data = WINCONx_ENWIN; |
562 | 568 | ||
563 | /* note, since we have to round up the bits-per-pixel, we end up | 569 | /* note, since we have to round up the bits-per-pixel, we end up |
@@ -637,13 +643,6 @@ static int s3c_fb_set_par(struct fb_info *info) | |||
637 | writel(data, regs + sfb->variant.wincon + (win_no * 4)); | 643 | writel(data, regs + sfb->variant.wincon + (win_no * 4)); |
638 | writel(0x0, regs + sfb->variant.winmap + (win_no * 4)); | 644 | writel(0x0, regs + sfb->variant.winmap + (win_no * 4)); |
639 | 645 | ||
640 | /* Enable DMA channel for this window */ | ||
641 | if (sfb->variant.has_shadowcon) { | ||
642 | data = readl(sfb->regs + SHADOWCON); | ||
643 | data |= SHADOWCON_CHx_ENABLE(win_no); | ||
644 | writel(data, sfb->regs + SHADOWCON); | ||
645 | } | ||
646 | |||
647 | shadow_protect_win(win, 0); | 646 | shadow_protect_win(win, 0); |
648 | 647 | ||
649 | return 0; | 648 | return 0; |
@@ -1487,11 +1486,10 @@ static int __devexit s3c_fb_remove(struct platform_device *pdev) | |||
1487 | 1486 | ||
1488 | release_mem_region(sfb->regs_res->start, resource_size(sfb->regs_res)); | 1487 | release_mem_region(sfb->regs_res->start, resource_size(sfb->regs_res)); |
1489 | 1488 | ||
1490 | kfree(sfb); | ||
1491 | |||
1492 | pm_runtime_put_sync(sfb->dev); | 1489 | pm_runtime_put_sync(sfb->dev); |
1493 | pm_runtime_disable(sfb->dev); | 1490 | pm_runtime_disable(sfb->dev); |
1494 | 1491 | ||
1492 | kfree(sfb); | ||
1495 | return 0; | 1493 | return 0; |
1496 | } | 1494 | } |
1497 | 1495 | ||
diff --git a/drivers/video/sh_mobile_hdmi.c b/drivers/video/sh_mobile_hdmi.c index 6ae40b630dc9..7d54e2c612f7 100644 --- a/drivers/video/sh_mobile_hdmi.c +++ b/drivers/video/sh_mobile_hdmi.c | |||
@@ -1127,23 +1127,16 @@ static void sh_hdmi_edid_work_fn(struct work_struct *work) | |||
1127 | struct fb_info *info = hdmi->info; | 1127 | struct fb_info *info = hdmi->info; |
1128 | unsigned long parent_rate = 0, hdmi_rate; | 1128 | unsigned long parent_rate = 0, hdmi_rate; |
1129 | 1129 | ||
1130 | /* A device has been plugged in */ | ||
1131 | pm_runtime_get_sync(hdmi->dev); | ||
1132 | |||
1133 | ret = sh_hdmi_read_edid(hdmi, &hdmi_rate, &parent_rate); | 1130 | ret = sh_hdmi_read_edid(hdmi, &hdmi_rate, &parent_rate); |
1134 | if (ret < 0) { | 1131 | if (ret < 0) |
1135 | pm_runtime_put(hdmi->dev); | ||
1136 | goto out; | 1132 | goto out; |
1137 | } | ||
1138 | 1133 | ||
1139 | hdmi->hp_state = HDMI_HOTPLUG_EDID_DONE; | 1134 | hdmi->hp_state = HDMI_HOTPLUG_EDID_DONE; |
1140 | 1135 | ||
1141 | /* Reconfigure the clock */ | 1136 | /* Reconfigure the clock */ |
1142 | ret = sh_hdmi_clk_configure(hdmi, hdmi_rate, parent_rate); | 1137 | ret = sh_hdmi_clk_configure(hdmi, hdmi_rate, parent_rate); |
1143 | if (ret < 0) { | 1138 | if (ret < 0) |
1144 | pm_runtime_put(hdmi->dev); | ||
1145 | goto out; | 1139 | goto out; |
1146 | } | ||
1147 | 1140 | ||
1148 | msleep(10); | 1141 | msleep(10); |
1149 | sh_hdmi_configure(hdmi); | 1142 | sh_hdmi_configure(hdmi); |
@@ -1191,7 +1184,6 @@ static void sh_hdmi_edid_work_fn(struct work_struct *work) | |||
1191 | fb_set_suspend(hdmi->info, 1); | 1184 | fb_set_suspend(hdmi->info, 1); |
1192 | 1185 | ||
1193 | console_unlock(); | 1186 | console_unlock(); |
1194 | pm_runtime_put(hdmi->dev); | ||
1195 | } | 1187 | } |
1196 | 1188 | ||
1197 | out: | 1189 | out: |
@@ -1312,7 +1304,7 @@ static int __init sh_hdmi_probe(struct platform_device *pdev) | |||
1312 | INIT_DELAYED_WORK(&hdmi->edid_work, sh_hdmi_edid_work_fn); | 1304 | INIT_DELAYED_WORK(&hdmi->edid_work, sh_hdmi_edid_work_fn); |
1313 | 1305 | ||
1314 | pm_runtime_enable(&pdev->dev); | 1306 | pm_runtime_enable(&pdev->dev); |
1315 | pm_runtime_resume(&pdev->dev); | 1307 | pm_runtime_get_sync(&pdev->dev); |
1316 | 1308 | ||
1317 | /* Product and revision IDs are 0 in sh-mobile version */ | 1309 | /* Product and revision IDs are 0 in sh-mobile version */ |
1318 | dev_info(&pdev->dev, "Detected HDMI controller 0x%x:0x%x\n", | 1310 | dev_info(&pdev->dev, "Detected HDMI controller 0x%x:0x%x\n", |
@@ -1340,7 +1332,7 @@ static int __init sh_hdmi_probe(struct platform_device *pdev) | |||
1340 | ecodec: | 1332 | ecodec: |
1341 | free_irq(irq, hdmi); | 1333 | free_irq(irq, hdmi); |
1342 | ereqirq: | 1334 | ereqirq: |
1343 | pm_runtime_suspend(&pdev->dev); | 1335 | pm_runtime_put(&pdev->dev); |
1344 | pm_runtime_disable(&pdev->dev); | 1336 | pm_runtime_disable(&pdev->dev); |
1345 | iounmap(hdmi->base); | 1337 | iounmap(hdmi->base); |
1346 | emap: | 1338 | emap: |
@@ -1377,7 +1369,7 @@ static int __exit sh_hdmi_remove(struct platform_device *pdev) | |||
1377 | free_irq(irq, hdmi); | 1369 | free_irq(irq, hdmi); |
1378 | /* Wait for already scheduled work */ | 1370 | /* Wait for already scheduled work */ |
1379 | cancel_delayed_work_sync(&hdmi->edid_work); | 1371 | cancel_delayed_work_sync(&hdmi->edid_work); |
1380 | pm_runtime_suspend(&pdev->dev); | 1372 | pm_runtime_put(&pdev->dev); |
1381 | pm_runtime_disable(&pdev->dev); | 1373 | pm_runtime_disable(&pdev->dev); |
1382 | clk_disable(hdmi->hdmi_clk); | 1374 | clk_disable(hdmi->hdmi_clk); |
1383 | clk_put(hdmi->hdmi_clk); | 1375 | clk_put(hdmi->hdmi_clk); |
diff --git a/drivers/w1/masters/Kconfig b/drivers/w1/masters/Kconfig index 00d615d7aa21..979d6eed9a0f 100644 --- a/drivers/w1/masters/Kconfig +++ b/drivers/w1/masters/Kconfig | |||
@@ -42,7 +42,7 @@ config W1_MASTER_MXC | |||
42 | 42 | ||
43 | config W1_MASTER_DS1WM | 43 | config W1_MASTER_DS1WM |
44 | tristate "Maxim DS1WM 1-wire busmaster" | 44 | tristate "Maxim DS1WM 1-wire busmaster" |
45 | depends on W1 | 45 | depends on W1 && GENERIC_HARDIRQS |
46 | help | 46 | help |
47 | Say Y here to enable the DS1WM 1-wire driver, such as that | 47 | Say Y here to enable the DS1WM 1-wire driver, such as that |
48 | in HP iPAQ devices like h5xxx, h2200, and ASIC3-based like | 48 | in HP iPAQ devices like h5xxx, h2200, and ASIC3-based like |