Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 154391
b: refs/heads/master
c: 3984114
h: refs/heads/master
i:
  154389: 7a5f987
  154387: ddb8ebd
  154383: ec7ee99
v: v3
  • Loading branch information
Sean MacLennan authored and Benjamin Herrenschmidt committed Jun 26, 2009
1 parent 528e1c2 commit 267edb3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 31 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b810c6ec5c659c80b3641580b112db877a0f1f45
refs/heads/master: 3984114f056203d833251af85501721f7b00fd18
44 changes: 14 additions & 30 deletions trunk/arch/powerpc/platforms/44x/warp.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/of_gpio.h>
#include <linux/of_i2c.h>

#include <asm/machdep.h>
#include <asm/prom.h>
Expand Down Expand Up @@ -65,7 +66,6 @@ define_machine(warp) {

static u32 post_info;

/* I am not sure this is the best place for this... */
static int __init warp_post_info(void)
{
struct device_node *np;
Expand Down Expand Up @@ -194,9 +194,9 @@ static int pika_setup_leds(void)
return 0;
}

static void pika_setup_critical_temp(struct i2c_client *client)
static void pika_setup_critical_temp(struct device_node *np,
struct i2c_client *client)
{
struct device_node *np;
int irq, rc;

/* Do this before enabling critical temp interrupt since we
Expand All @@ -208,14 +208,7 @@ static void pika_setup_critical_temp(struct i2c_client *client)
i2c_smbus_write_byte_data(client, 2, 65); /* Thigh */
i2c_smbus_write_byte_data(client, 3, 0); /* Tlow */

np = of_find_compatible_node(NULL, NULL, "adi,ad7414");
if (np == NULL) {
printk(KERN_ERR __FILE__ ": Unable to find ad7414\n");
return;
}

irq = irq_of_parse_and_map(np, 0);
of_node_put(np);
if (irq == NO_IRQ) {
printk(KERN_ERR __FILE__ ": Unable to get ad7414 irq\n");
return;
Expand Down Expand Up @@ -244,32 +237,24 @@ static inline void pika_dtm_check_fan(void __iomem *fpga)

static int pika_dtm_thread(void __iomem *fpga)
{
struct i2c_adapter *adap;
struct device_node *np;
struct i2c_client *client;

/* We loop in case either driver was compiled as a module and
* has not been insmoded yet.
*/
while (!(adap = i2c_get_adapter(0))) {
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(HZ);
}

while (1) {
list_for_each_entry(client, &adap->clients, list)
if (client->addr == 0x4a)
goto found_it;
np = of_find_compatible_node(NULL, NULL, "adi,ad7414");
if (np == NULL)
return -ENOENT;

set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(HZ);
client = of_find_i2c_device_by_node(np);
if (client == NULL) {
of_node_put(np);
return -ENOENT;
}

found_it:
pika_setup_critical_temp(client);
pika_setup_critical_temp(np, client);

i2c_put_adapter(adap);
of_node_put(np);

printk(KERN_INFO "PIKA DTM thread running.\n");
printk(KERN_INFO "Warp DTM thread running.\n");

while (!kthread_should_stop()) {
int val;
Expand All @@ -291,7 +276,6 @@ static int pika_dtm_thread(void __iomem *fpga)
return 0;
}


static int __init pika_dtm_start(void)
{
struct task_struct *dtm_thread;
Expand Down

0 comments on commit 267edb3

Please sign in to comment.