From patchwork Fri Jul 30 14:53:32 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Grzeschik X-Patchwork-Id: 115508 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6UEsW73030959 for ; Fri, 30 Jul 2010 14:54:32 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932229Ab0G3Oy2 (ORCPT ); Fri, 30 Jul 2010 10:54:28 -0400 Received: from metis.ext.pengutronix.de ([92.198.50.35]:51764 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758700Ab0G3OyT (ORCPT ); Fri, 30 Jul 2010 10:54:19 -0400 Received: from octopus.hi.pengutronix.de ([2001:6f8:1178:2:215:17ff:fe12:23b0]) by metis.ext.pengutronix.de with esmtp (Exim 4.71) (envelope-from ) id 1OeqyX-0000bG-93; Fri, 30 Jul 2010 16:54:17 +0200 Received: from mgr by octopus.hi.pengutronix.de with local (Exim 4.69) (envelope-from ) id 1OeqyX-0004Nc-0X; Fri, 30 Jul 2010 16:54:17 +0200 From: Michael Grzeschik To: linux-media@vger.kernel.org Cc: robert.jarzmik@free.fr, g.liakhovetski@gmx.de, p.wiesner@phytec.de, Michael Grzeschik Subject: [PATCH 14/20] mt9m111: added reg_mask function Date: Fri, 30 Jul 2010 16:53:32 +0200 Message-Id: <1280501618-23634-15-git-send-email-m.grzeschik@pengutronix.de> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1280501618-23634-1-git-send-email-m.grzeschik@pengutronix.de> References: <1280501618-23634-1-git-send-email-m.grzeschik@pengutronix.de> X-SA-Exim-Connect-IP: 2001:6f8:1178:2:215:17ff:fe12:23b0 X-SA-Exim-Mail-From: mgr@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-media@vger.kernel.org Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Fri, 30 Jul 2010 14:54:32 +0000 (UTC) diff --git a/drivers/media/video/mt9m111.c b/drivers/media/video/mt9m111.c index 4dbaf31..161c751 100644 --- a/drivers/media/video/mt9m111.c +++ b/drivers/media/video/mt9m111.c @@ -128,6 +128,8 @@ #define reg_write(reg, val) mt9m111_reg_write(client, MT9M111_##reg, (val)) #define reg_set(reg, val) mt9m111_reg_set(client, MT9M111_##reg, (val)) #define reg_clear(reg, val) mt9m111_reg_clear(client, MT9M111_##reg, (val)) +#define reg_mask(reg, val, mask) mt9m111_reg_mask(client, MT9M111_##reg, \ + (val), (mask)) #define MT9M111_MIN_DARK_ROWS 8 #define MT9M111_MIN_DARK_COLS 26 @@ -265,6 +267,15 @@ static int mt9m111_reg_clear(struct i2c_client *client, const u16 reg, return mt9m111_reg_write(client, reg, ret & ~data); } +static int mt9m111_reg_mask(struct i2c_client *client, const u16 reg, + const u16 data, const u16 mask) +{ + int ret; + + ret = mt9m111_reg_read(client, reg); + return mt9m111_reg_write(client, reg, (ret & ~mask) | data); +} + static int mt9m111_set_context(struct i2c_client *client, enum mt9m111_context ctxt) {