From patchwork Wed Aug 12 23:21:44 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Gotthardt X-Patchwork-Id: 40956 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n7CNLmbk022826 for ; Wed, 12 Aug 2009 23:21:48 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751436AbZHLXVp (ORCPT ); Wed, 12 Aug 2009 19:21:45 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752117AbZHLXVp (ORCPT ); Wed, 12 Aug 2009 19:21:45 -0400 Received: from an-out-0708.google.com ([209.85.132.241]:7946 "EHLO an-out-0708.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751436AbZHLXVo (ORCPT ); Wed, 12 Aug 2009 19:21:44 -0400 Received: by an-out-0708.google.com with SMTP id d40so303932and.1 for ; Wed, 12 Aug 2009 16:21:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=G2uVztIxX4ooSdZ+sbo0GcsxSkCoAqM/wNUGyB1fVCg=; b=a+jVOZoJ0yusaulGKb5hjdcpnWnd6TSgYJy32fjQtOexvdbmlPsj7L4De0vugZdQY2 4XJd0Z4nztD0244KvWiQB1Xmx19WXY09HFAckelTQn63ZHayUzXwgbo+JtbEdgom0AZV sAlTMPlD6dN/JaeWpIOoxTY30LEl4sSxXRXEQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=PlGVEiUZ5fO2JfCsyKIcQ2FUv18Wixx96twxJ4r01g9pD3s4qMN48vVEMg7Iqpp3kp L2aZDT4HWay/J9yaOaQRB/lrIgz5CwQ1h+R/EL6hM1Kba0gH5/JDv9r0sgFaZNjBmHvG TzlZXEb6fonaEw0vzZQRaETzMF1p4vUrbx1mw= MIME-Version: 1.0 Received: by 10.101.165.2 with SMTP id s2mr531948ano.16.1250119304805; Wed, 12 Aug 2009 16:21:44 -0700 (PDT) Date: Wed, 12 Aug 2009 16:21:44 -0700 Message-ID: <3ca13d320908121621u725d7c7bl8d22d571bbfb1996@mail.gmail.com> Subject: [PATCH] adds webcam for Micron device MT9M111 0x143A to em28xx From: Steve Gotthardt To: linux-media@vger.kernel.org Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org diff -r d2843f5f8fde linux/drivers/media/video/em28xx/em28xx-cards.c --- a/linux/drivers/media/video/em28xx/em28xx-cards.c Tue Aug 11 13:58:54 2009 -0300 +++ b/linux/drivers/media/video/em28xx/em28xx-cards.c Wed Aug 12 15:32:41 2009 -0700 @@ -1797,16 +1797,35 @@ static inline void em28xx_set_model(stru dev->board.xclk = EM28XX_XCLK_IR_RC5_MODE | EM28XX_XCLK_FREQUENCY_12MHZ; if (!dev->board.i2c_speed) dev->board.i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE | EM28XX_I2C_FREQ_100_KHZ; } + +/* FIXME: Should be replaced by a proper mt9m111 driver */ +static int em28xx_initialize_mt9m111(struct em28xx *dev) +{ + int i; + unsigned char regs[][3] = { + { 0x0d, 0x00, 0x01, }, /* reset and use defaults */ + { 0x0d, 0x00, 0x00, }, + { 0x0a, 0x00, 0x21, }, + { 0x21, 0x04, 0x00, }, /* full readout speed, no row/col skipping */ + }; + + for (i = 0; i < ARRAY_SIZE(regs); i++) + i2c_master_send(&dev->i2c_client, ®s[i][0], 3); + + return 0; +} + + /* FIXME: Should be replaced by a proper mt9m001 driver */ static int em28xx_initialize_mt9m001(struct em28xx *dev) { int i; unsigned char regs[][3] = { { 0x0d, 0x00, 0x01, }, { 0x0d, 0x00, 0x00, }, { 0x04, 0x05, 0x00, }, /* hres = 1280 */ @@ -1825,17 +1844,17 @@ static int em28xx_initialize_mt9m001(str for (i = 0; i < ARRAY_SIZE(regs); i++) i2c_master_send(&dev->i2c_client, ®s[i][0], 3); return 0; } /* HINT method: webcam I2C chips * - * This method work for webcams with Micron sensors + * This method works for webcams with Micron sensors */ static int em28xx_hint_sensor(struct em28xx *dev) { int rc; char *sensor_name; unsigned char cmd; __be16 version_be; u16 version; @@ -1871,16 +1890,33 @@ static int em28xx_hint_sensor(struct em2 dev->board.xclk = EM28XX_XCLK_FREQUENCY_4_3MHZ; dev->sensor_xtal = 4300000; /* probably means GRGB 16 bit bayer */ dev->vinmode = 0x0d; dev->vinctl = 0x00; break; + + case 0x143A: /* MT9M111 as found in the ECS G200 */ + dev->model = EM2750_BOARD_UNKNOWN; + em28xx_set_model(dev); + + sensor_name = "mt9m111"; + dev->board.xclk = EM28XX_XCLK_FREQUENCY_48MHZ; + dev->em28xx_sensor = EM28XX_MT9M111; + em28xx_initialize_mt9m111(dev); + dev->sensor_xres = 640; + dev->sensor_yres = 512; + + dev->vinmode = 0x0A; + dev->vinctl = 0x00; + + break; + #if 0 case 0x8411: case 0x8421: #endif case 0x8431: dev->model = EM2750_BOARD_UNKNOWN; em28xx_set_model(dev); @@ -1891,17 +1927,17 @@ static int em28xx_hint_sensor(struct em2 dev->sensor_yres = 1024; /* probably means BGGR 16 bit bayer */ dev->vinmode = 0x0c; dev->vinctl = 0x00; break; default: - printk("Unknown Micron Sensor 0x%04x\n", be16_to_cpu(version)); + printk("Unknown Micron Sensor 0x%04x\n", version); return -EINVAL; } /* Setup webcam defaults */ em28xx_pre_card_setup(dev); em28xx_errdev("Sensor is %s, using model %s entry.\n", sensor_name, em28xx_boards[dev->model].name); signed off by: Steve Gotthardt --- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff -r d2843f5f8fde linux/drivers/media/video/em28xx/em28xx.h --- a/linux/drivers/media/video/em28xx/em28xx.h Tue Aug 11 13:58:54 2009 -0300 +++ b/linux/drivers/media/video/em28xx/em28xx.h Wed Aug 12 15:32:41 2009 -0700 @@ -363,16 +363,17 @@ enum em28xx_decoder { EM28XX_TVP5150, EM28XX_SAA711X, }; enum em28xx_sensor { EM28XX_NOSENSOR = 0, EM28XX_MT9V011, EM28XX_MT9M001, + EM28XX_MT9M111, }; enum em28xx_adecoder { EM28XX_NOADECODER = 0, EM28XX_TVAUDIO, }; struct em28xx_board {