From patchwork Tue Aug 3 10:57:46 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Grzeschik X-Patchwork-Id: 116722 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 o73Aw21r031444 for ; Tue, 3 Aug 2010 10:58:02 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756027Ab0HCK56 (ORCPT ); Tue, 3 Aug 2010 06:57:58 -0400 Received: from metis.ext.pengutronix.de ([92.198.50.35]:51798 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755996Ab0HCK5y (ORCPT ); Tue, 3 Aug 2010 06:57:54 -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 1OgFBw-0006I8-SP; Tue, 03 Aug 2010 12:57:52 +0200 Received: from mgr by octopus.hi.pengutronix.de with local (Exim 4.69) (envelope-from ) id 1OgFBw-0002sh-MM; Tue, 03 Aug 2010 12:57:52 +0200 From: Michael Grzeschik To: linux-media@vger.kernel.org Cc: robert.jarzmik@free.fr, g.liakhovetski@gmx.de, Michael Grzeschik , Philipp Wiesner Subject: [PATCH 08/11] mt9m111: added reg_mask function Date: Tue, 3 Aug 2010 12:57:46 +0200 Message-Id: <1280833069-26993-9-git-send-email-m.grzeschik@pengutronix.de> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1280833069-26993-1-git-send-email-m.grzeschik@pengutronix.de> References: <1280833069-26993-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]); Tue, 03 Aug 2010 10:58:02 +0000 (UTC) diff --git a/drivers/media/video/mt9m111.c b/drivers/media/video/mt9m111.c index 48c63bc..e865938 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 @@ -257,6 +259,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) {