Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 56784
b: refs/heads/master
c: 7acf90c
h: refs/heads/master
v: v3
  • Loading branch information
Jonathan Corbet authored and Mauro Carvalho Chehab committed May 22, 2007
1 parent a73595d commit 3f45f98
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 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: 82c01d3d5a26f82aea1fb2e9a357dfb6404f44db
refs/heads/master: 7acf90c70c6ee063f7465b2f10e2083bc49f355b
6 changes: 6 additions & 0 deletions trunk/drivers/media/video/cafe_ccic-regs.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,12 @@
#define REG_GL_IMASK 0x300c /* Interrupt mask register */
#define GIMSK_CCIC_EN 0x00000004 /* CCIC Interrupt enable */

#define REG_GL_FCR 0x3038 /* GPIO functional control register */
#define GFCR_GPIO_ON 0x08 /* Camera GPIO enabled */
#define REG_GL_GPIOR 0x315c /* GPIO register */
#define GGPIO_OUT 0x80000 /* GPIO output */
#define GGPIO_VAL 0x00008 /* Output pin value */

#define REG_LEN REG_GL_IMASK + 4


Expand Down
18 changes: 17 additions & 1 deletion trunk/drivers/media/video/cafe_ccic.c
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,12 @@ static void cafe_ctlr_power_up(struct cafe_camera *cam)

spin_lock_irqsave(&cam->dev_lock, flags);
cafe_reg_clear_bit(cam, REG_CTRL1, C1_PWRDWN);
/*
* Part one of the sensor dance: turn the global
* GPIO signal on.
*/
cafe_reg_write(cam, REG_GL_FCR, GFCR_GPIO_ON);
cafe_reg_write(cam, REG_GL_GPIOR, GGPIO_OUT|GGPIO_VAL);
/*
* Put the sensor into operational mode (assumes OLPC-style
* wiring). Control 0 is reset - set to 1 to operate.
Expand All @@ -784,6 +790,7 @@ static void cafe_ctlr_power_up(struct cafe_camera *cam)
cafe_reg_write(cam, REG_GPR, GPR_C1EN|GPR_C0EN|GPR_C0);
// mdelay(1); /* Enough? */
spin_unlock_irqrestore(&cam->dev_lock, flags);
msleep(5); /* Just to be sure */
}

static void cafe_ctlr_power_down(struct cafe_camera *cam)
Expand All @@ -792,6 +799,8 @@ static void cafe_ctlr_power_down(struct cafe_camera *cam)

spin_lock_irqsave(&cam->dev_lock, flags);
cafe_reg_write(cam, REG_GPR, GPR_C1EN|GPR_C0EN|GPR_C1);
cafe_reg_write(cam, REG_GL_FCR, GFCR_GPIO_ON);
cafe_reg_write(cam, REG_GL_GPIOR, GGPIO_OUT);
cafe_reg_set_bit(cam, REG_CTRL1, C1_PWRDWN);
spin_unlock_irqrestore(&cam->dev_lock, flags);
}
Expand Down Expand Up @@ -851,6 +860,7 @@ static int cafe_cam_init(struct cafe_camera *cam)
ret = 0;
cam->state = S_IDLE;
out:
cafe_ctlr_power_down(cam);
mutex_unlock(&cam->s_mutex);
return ret;
}
Expand Down Expand Up @@ -2103,10 +2113,16 @@ static int cafe_pci_probe(struct pci_dev *pdev,
ret = request_irq(pdev->irq, cafe_irq, IRQF_SHARED, "cafe-ccic", cam);
if (ret)
goto out_iounmap;
/*
* Initialize the controller and leave it powered up. It will
* stay that way until the sensor driver shows up.
*/
cafe_ctlr_init(cam);
cafe_ctlr_power_up(cam);
/*
* Set up I2C/SMBUS communications
* Set up I2C/SMBUS communications. We have to drop the mutex here
* because the sensor could attach in this call chain, leading to
* unsightly deadlocks.
*/
mutex_unlock(&cam->s_mutex); /* attach can deadlock */
ret = cafe_smbus_setup(cam);
Expand Down

0 comments on commit 3f45f98

Please sign in to comment.