From patchwork Wed Apr 20 15:18:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Rosin X-Patchwork-Id: 8892201 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DE2FFBF29F for ; Wed, 20 Apr 2016 15:36:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5253E20263 for ; Wed, 20 Apr 2016 15:36:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7D159201F2 for ; Wed, 20 Apr 2016 15:36:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752678AbcDTPgY (ORCPT ); Wed, 20 Apr 2016 11:36:24 -0400 Received: from mail-db3on0119.outbound.protection.outlook.com ([157.55.234.119]:59727 "EHLO emea01-db3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752028AbcDTPgR (ORCPT ); Wed, 20 Apr 2016 11:36:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axentiatech.onmicrosoft.com; s=selector1-axentia-se; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=nbX16DZxd3nzUoijTx+yQW4PhsJ1PdbyZLSPF7Y7tTU=; b=US8RCu7aiM0UwyBAlmw2K/lmiuK1qVKGEcwd64yKR3NM/h3UPm1EZBUm0kGUT09ZDKf98FlV2o0RtTGzfHSziB9jLGZu8RjFMHxUR92OkFZlIasO3BKgAuA5qsbHhad+lkDr1ycaLEuXZwDuAmghME7JQjuT/vgrP327LCQPJ7w= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=axentia.se; Received: from localhost.localdomain (217.210.101.82) by VI1PR02MB1312.eurprd02.prod.outlook.com (10.165.231.154) with Microsoft SMTP Server (TLS) id 15.1.466.19; Wed, 20 Apr 2016 15:20:55 +0000 From: Peter Rosin To: CC: Peter Rosin , Wolfram Sang , Jonathan Corbet , Peter Korsgaard , Guenter Roeck , Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald , Antti Palosaari , Mauro Carvalho Chehab , Rob Herring , Frank Rowand , Grant Likely , Andrew Morton , "David S. Miller" , Greg Kroah-Hartman , Kalle Valo , Jiri Slaby , Daniel Baluta , Lucas De Marchi , Adriana Reus , Matt Ranostay , Krzysztof Kozlowski , Hans Verkuil , Terry Heo , Arnd Bergmann , Tommi Rantala , Crestez Dan Leonard , , , , , , Peter Rosin Subject: [PATCH v7 23/24] [media] rtl2832_sdr: get rid of empty regmap wrappers Date: Wed, 20 Apr 2016 17:18:03 +0200 Message-ID: <1461165484-2314-24-git-send-email-peda@axentia.se> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1461165484-2314-1-git-send-email-peda@axentia.se> References: <1461165484-2314-1-git-send-email-peda@axentia.se> MIME-Version: 1.0 X-Originating-IP: [217.210.101.82] X-ClientProxiedBy: DB3PR01CA0069.eurprd01.prod.exchangelabs.com (10.242.133.172) To VI1PR02MB1312.eurprd02.prod.outlook.com (10.165.231.154) X-MS-Office365-Filtering-Correlation-Id: 44b870cf-1a1f-441a-f43e-08d3692f615b X-Microsoft-Exchange-Diagnostics: 1; VI1PR02MB1312; 2:xyt022ViW0X04m8nDX4EFO1zRBO7ee2K94IABoCdxDpue5SaemlBPEb/ThODGyWhDNJbdeDm+YN6Z3RClEhHh4qF5/Gq6qxndVmTbM1nDlIKSlXHxkBOlNg1vr+gve9OeZaHC3EIT58z6frchzTNzo3Fer/e1/aCQrR5VJlcKLrT8er7MnfIsCoutSvcGHuz; 3:aRkUpUVnhN0gGPVAhZej6P4zndrU452fedadLfupUUh35/JM0qBMskLTOFr6m1yJlkL+2um6E8N3HGNLnJyM+6oFREuEzGGpsPQZOnRNgg3pxMATp9pshudoXvcl3z1h X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:VI1PR02MB1312; X-Microsoft-Exchange-Diagnostics: 1; VI1PR02MB1312; 25:n6baWX1XzGZxMNiOk4nHBmN9DpCGhJdvVN4GIkeLX7/t1vii1SbKUDnVWqAGSjJtyccy8mmajr8s/ZewtS3kMuUZ+e2CDrd/sU3O7QFFOMLCom0dg5V4Ou4pnGUtVFHs9xc3VNbqiLRoKRm6auZdhUg+qy6YPVW3FbngV/BiqTu2V+VEcp94+JPpPtVIjdroypg3klbUFGsCj5hbrJz8ppjJdHyAlITqYg5NxQe8lOvVzYhyiCCXkvQnCqBEv7a7SdewSnx9YstO/tymfXDpjBGRL83iX5kVxIQ3sTlJvETVvQPpB5CzalORjyT2QNoSYzzZWYsOIZVxsotbYp6dMSjSBdvrEV9hqDATZent9PIVqK2RrGFcpBTT2nOgAaHkSyTN29NkS5cNLCJyoX4xYCNx4QtCyL5hfzrerpqP5HzOZUtY+Do8qkWpcTX6OxYBr02ST/+EnfXiqCGJ56FPXj5iZ562ZLvQ/seEvOK35TBEMBA3WrPHXcyUNyVkIzW+Srj6KWwGqzYVPMIKQQhURDqlj5NFU0rrBxITk0hObrlZA7xs4WqsvO5PM956bf/F3BlOxOsACqb6wErmnHwAzha4bLZwm3Xba694okhtufIz3UGK/gHEe3u+ARU4/+dkwKjrdDwK1drj3cih/rBgWg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(9101521026)(6040130)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6041046)(6043046); SRVR:VI1PR02MB1312; BCL:0; PCL:0; RULEID:; SRVR:VI1PR02MB1312; X-Microsoft-Exchange-Diagnostics: 1; VI1PR02MB1312; 4:m0I9bS0shFPew0X4KfDnM6gmvajrkE37kxA0SoY5q2rJG7kVIg0tqncVlVxrFlqVNlbm5KtHMyhesO2brNc1RXBP3HmqgKpC09koGPHqQXPzcRAoHEHgaHy6xIgdeL8RqCfGTHq+I2rl8pT/xz3ge7cna5nDuG2dJGFipE9UmxtnQd/ekpCWs6Tjrg8dRA/H/X11N0Ys/ZToz5kqqURBJq4hJr+Ob9kUyFahIzVZV1ASwk3YH12mZ+38qdOqp9zx9pPXOHo9QowsyD+oHaecORazUL8qALLjOtdZqVlHdYDKD1PWUe+/ckE0KoGL66/XAdpS8iHiU6MAzO5tSFStu+cV7ka+Xj/oWk9lBA2LrM6R1ThSN2cp3vyWYkIzMXgMVlVn0zZUnQUbp32Q9uJJYr0/7F5Amy/hrUD21DVG/Xk1nTsvGRl7GmARPOPN2e5CqQ0oLrRkmVzMTintzgmNJg== X-Forefront-PRVS: 0918748D70 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(6069001)(66066001)(2906002)(19580395003)(19580405001)(110136002)(92566002)(189998001)(5008740100001)(47776003)(42186005)(33646002)(6116002)(3846002)(5003940100001)(586003)(81166005)(48376002)(2950100001)(4326007)(50466002)(76176999)(1096002)(50226001)(77096005)(50986999)(36756003)(575784001)(86362001)(106356001)(2351001)(229853001)(74482002)(5004730100002)(26583001)(7059030)(42262002); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR02MB1312; H:localhost.localdomain; FPR:; SPF:None; MLV:nov; PTR:InfoNoRecords; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR02MB1312; 23:ZqTunMc+A48J/Bi99uTVujVyEWD1zCp0lQPIzAiu2?= =?us-ascii?Q?XDwH4iBE93Ga4ZW9Lq2Cjbh4XkoV38julAsKPJmdqdywjtVypWnc0hhTPcmQ?= =?us-ascii?Q?1MFBBVBgIOCArVnE+uc21lRtmcxAhG4dBydnNdjWlWjKhzLofrW87XrmkdXY?= =?us-ascii?Q?4wiKZXAXxYmukIgOINR+JgaJRjTpuPO414S1w9clf8v5EMa7QIjU9A1N6sWX?= =?us-ascii?Q?Hst+L1PlbXX2reA0NTCTvIAJoq14djk4eXrIbeMrhj0OY2uVIkx6cGyptIrt?= =?us-ascii?Q?nP+XTfm0YDNDVsoNTrk1beSIn0NgA5LnpklPkV4Q7usfAhXwg2ln7XE6uFab?= =?us-ascii?Q?xS26Xjjugi8yVO6wtQO0towo9D5WPyv1oVNqRw3eT0XD8SMaqaSzfSN/eHcR?= =?us-ascii?Q?huBMQIzIIAnVSZO7SLYTzttG5rnjpZp1b8+8g87FZbM18edAC0F/Yi2x3Uh7?= =?us-ascii?Q?/xQcz7MFxKOapWNo9N6IeJonsSj+M+YarD+13yIZ5g7wIlVhY2MNdRoHDjs1?= =?us-ascii?Q?jzVnXHV5UkI0n+foMw+QFaWDJIHRd6dBqbr6buEzZayDfDQrtwqKEnCFENNT?= =?us-ascii?Q?pkwUmtNFHS3pazIVKCX+kbGeJ+Uxp++ZvbDI9uWYJqO1j3BJEaPU5/DfjoZo?= =?us-ascii?Q?eOJZ2tBrL82CZVegWA1/7hVmQKEzIfNw4n+iYn9jag8S3Lbw+XN6mB9vz22e?= =?us-ascii?Q?UnclyhTiA9ZDJ/HgGRIx4ryUOvDewD/nkeZgUPLNUqOh6gFBUzA9KXZ8qEn9?= =?us-ascii?Q?ROTYCo5A8W7j1h79WusQkmlqaobV5/UnzhPqJqGt1AvXOTVz2W3XTYDGs8wX?= =?us-ascii?Q?MgPjTZ+6W6gDfsk/mgvUEm6T1OdNRAFGitDRZWx2kMqkuaRzelhPGRrIbQYe?= =?us-ascii?Q?3X/2qTTdflKKfS/zzbR/L/80cy5dK2VMuTvv+2+Po3A+OljD5IKvT34JZWXO?= =?us-ascii?Q?vZB866x07QPOhbXdc5m7eK+oHdTavRlHz7WA5mO+b+JcqPxQRG5WBcL/AQ/z?= =?us-ascii?Q?zK9NiRvHRyxguKhZMV4jZVM4h76386MPSpbUScqkxI32g=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; VI1PR02MB1312; 5:AN2cLBJZkQitbgCV1YscH4bNCTqr/ah9zTt0ZeXWEHFy/k6IP9F2JOV+Tk/NEumFlFE/cWbfMJudOc9ujGksOwNZzMqVAuMpsyn6yCnxOTVjVLJNn7Y1j1mSYes8ipS+6fWsGF2X5PMEIDv9KpTUB364IGXuVNIFKDsiB1BIB1rCS82wAPvnqdWSs2JPRAy6; 24:7ei97ixYKOjKqdo9ct5475pLyFSUgB110z6nXnINURteEwtKeAraWOM5pCHshqpHtJiHeQCTMBci3y/0mfUJtIKWJiRO7j7e88x1GNw1bDs=; 7:juVq2XNfG3hdtIbv9OfEJUE/hNtK0uFoA6DuhFYAQ8MvHJs6xrtvZxKi43yUdJqaj3iz1tPugNeVM3PQDJLU3VeNGh6f60RbyDkosWsFitsNXm7iw+HxzvYNX7Agd7yKlqVjUrfIpgsy0R6wG64x+0FowRAeAsXrO5eQ0QDRTYD9T9N3WKxTkN27uFx94M7g53Q5+2ZtY1M9eXGlCPfYGnEcMOTthfZaSLXXuvTjxxA= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2016 15:20:55.8884 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR02MB1312 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Reviewed-by: Antti Palosaari Signed-off-by: Peter Rosin --- drivers/media/dvb-frontends/rtl2832_sdr.c | 302 +++++++++++++----------------- 1 file changed, 132 insertions(+), 170 deletions(-) diff --git a/drivers/media/dvb-frontends/rtl2832_sdr.c b/drivers/media/dvb-frontends/rtl2832_sdr.c index 6a6b1debe277..47a480a7d46c 100644 --- a/drivers/media/dvb-frontends/rtl2832_sdr.c +++ b/drivers/media/dvb-frontends/rtl2832_sdr.c @@ -120,6 +120,7 @@ struct rtl2832_sdr_dev { unsigned long flags; struct platform_device *pdev; + struct regmap *regmap; struct video_device vdev; struct v4l2_device v4l2_dev; @@ -164,47 +165,6 @@ struct rtl2832_sdr_dev { unsigned long jiffies_next; }; -/* write multiple registers */ -static int rtl2832_sdr_wr_regs(struct rtl2832_sdr_dev *dev, u16 reg, - const u8 *val, int len) -{ - struct platform_device *pdev = dev->pdev; - struct rtl2832_sdr_platform_data *pdata = pdev->dev.platform_data; - struct regmap *regmap = pdata->regmap; - - return regmap_bulk_write(regmap, reg, val, len); -} - -#if 0 -/* read multiple registers */ -static int rtl2832_sdr_rd_regs(struct rtl2832_sdr_dev *dev, u16 reg, u8 *val, - int len) -{ - struct platform_device *pdev = dev->pdev; - struct rtl2832_sdr_platform_data *pdata = pdev->dev.platform_data; - struct regmap *regmap = pdata->regmap; - - return regmap_bulk_read(regmap, reg, val, len); -} -#endif - -/* write single register */ -static int rtl2832_sdr_wr_reg(struct rtl2832_sdr_dev *dev, u16 reg, u8 val) -{ - return rtl2832_sdr_wr_regs(dev, reg, &val, 1); -} - -/* write single register with mask */ -static int rtl2832_sdr_wr_reg_mask(struct rtl2832_sdr_dev *dev, u16 reg, - u8 val, u8 mask) -{ - struct platform_device *pdev = dev->pdev; - struct rtl2832_sdr_platform_data *pdata = pdev->dev.platform_data; - struct regmap *regmap = pdata->regmap; - - return regmap_update_bits(regmap, reg, mask, val); -} - /* Private functions */ static struct rtl2832_sdr_frame_buf *rtl2832_sdr_get_next_fill_buf( struct rtl2832_sdr_dev *dev) @@ -559,11 +519,11 @@ static int rtl2832_sdr_set_adc(struct rtl2832_sdr_dev *dev) f_sr = dev->f_adc; - ret = rtl2832_sdr_wr_regs(dev, 0x13e, "\x00\x00", 2); + ret = regmap_bulk_write(dev->regmap, 0x13e, "\x00\x00", 2); if (ret) goto err; - ret = rtl2832_sdr_wr_regs(dev, 0x115, "\x00\x00\x00\x00", 4); + ret = regmap_bulk_write(dev->regmap, 0x115, "\x00\x00\x00\x00", 4); if (ret) goto err; @@ -589,7 +549,7 @@ static int rtl2832_sdr_set_adc(struct rtl2832_sdr_dev *dev) buf[1] = (u32tmp >> 8) & 0xff; buf[2] = (u32tmp >> 0) & 0xff; - ret = rtl2832_sdr_wr_regs(dev, 0x119, buf, 3); + ret = regmap_bulk_write(dev->regmap, 0x119, buf, 3); if (ret) goto err; @@ -603,15 +563,15 @@ static int rtl2832_sdr_set_adc(struct rtl2832_sdr_dev *dev) u8tmp2 = 0xcd; /* enable ADC I, ADC Q */ } - ret = rtl2832_sdr_wr_reg(dev, 0x1b1, u8tmp1); + ret = regmap_write(dev->regmap, 0x1b1, u8tmp1); if (ret) goto err; - ret = rtl2832_sdr_wr_reg(dev, 0x008, u8tmp2); + ret = regmap_write(dev->regmap, 0x008, u8tmp2); if (ret) goto err; - ret = rtl2832_sdr_wr_reg(dev, 0x006, 0x80); + ret = regmap_write(dev->regmap, 0x006, 0x80); if (ret) goto err; @@ -622,168 +582,169 @@ static int rtl2832_sdr_set_adc(struct rtl2832_sdr_dev *dev) buf[1] = (u32tmp >> 16) & 0xff; buf[2] = (u32tmp >> 8) & 0xff; buf[3] = (u32tmp >> 0) & 0xff; - ret = rtl2832_sdr_wr_regs(dev, 0x19f, buf, 4); + ret = regmap_bulk_write(dev->regmap, 0x19f, buf, 4); if (ret) goto err; /* low-pass filter */ - ret = rtl2832_sdr_wr_regs(dev, 0x11c, - "\xca\xdc\xd7\xd8\xe0\xf2\x0e\x35\x06\x50\x9c\x0d\x71\x11\x14\x71\x74\x19\x41\xa5", - 20); + ret = regmap_bulk_write(dev->regmap, 0x11c, + "\xca\xdc\xd7\xd8\xe0\xf2\x0e\x35\x06\x50\x9c\x0d\x71\x11\x14\x71\x74\x19\x41\xa5", + 20); if (ret) goto err; - ret = rtl2832_sdr_wr_regs(dev, 0x017, "\x11\x10", 2); + ret = regmap_bulk_write(dev->regmap, 0x017, "\x11\x10", 2); if (ret) goto err; /* mode */ - ret = rtl2832_sdr_wr_regs(dev, 0x019, "\x05", 1); + ret = regmap_write(dev->regmap, 0x019, 0x05); if (ret) goto err; - ret = rtl2832_sdr_wr_regs(dev, 0x01a, "\x1b\x16\x0d\x06\x01\xff", 6); + ret = regmap_bulk_write(dev->regmap, 0x01a, + "\x1b\x16\x0d\x06\x01\xff", 6); if (ret) goto err; /* FSM */ - ret = rtl2832_sdr_wr_regs(dev, 0x192, "\x00\xf0\x0f", 3); + ret = regmap_bulk_write(dev->regmap, 0x192, "\x00\xf0\x0f", 3); if (ret) goto err; /* PID filter */ - ret = rtl2832_sdr_wr_regs(dev, 0x061, "\x60", 1); + ret = regmap_write(dev->regmap, 0x061, 0x60); if (ret) goto err; /* used RF tuner based settings */ switch (pdata->tuner) { case RTL2832_SDR_TUNER_E4000: - ret = rtl2832_sdr_wr_regs(dev, 0x112, "\x5a", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x102, "\x40", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x103, "\x5a", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1c7, "\x30", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x104, "\xd0", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x105, "\xbe", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1c8, "\x18", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x106, "\x35", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1c9, "\x21", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1ca, "\x21", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1cb, "\x00", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x107, "\x40", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1cd, "\x10", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1ce, "\x10", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x108, "\x80", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x109, "\x7f", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x10a, "\x80", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x10b, "\x7f", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x00e, "\xfc", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x00e, "\xfc", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x011, "\xd4", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1e5, "\xf0", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1d9, "\x00", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1db, "\x00", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1dd, "\x14", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1de, "\xec", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1d8, "\x0c", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1e6, "\x02", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1d7, "\x09", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x00d, "\x83", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x010, "\x49", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x00d, "\x87", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x00d, "\x85", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x013, "\x02", 1); + ret = regmap_write(dev->regmap, 0x112, 0x5a); + ret = regmap_write(dev->regmap, 0x102, 0x40); + ret = regmap_write(dev->regmap, 0x103, 0x5a); + ret = regmap_write(dev->regmap, 0x1c7, 0x30); + ret = regmap_write(dev->regmap, 0x104, 0xd0); + ret = regmap_write(dev->regmap, 0x105, 0xbe); + ret = regmap_write(dev->regmap, 0x1c8, 0x18); + ret = regmap_write(dev->regmap, 0x106, 0x35); + ret = regmap_write(dev->regmap, 0x1c9, 0x21); + ret = regmap_write(dev->regmap, 0x1ca, 0x21); + ret = regmap_write(dev->regmap, 0x1cb, 0x00); + ret = regmap_write(dev->regmap, 0x107, 0x40); + ret = regmap_write(dev->regmap, 0x1cd, 0x10); + ret = regmap_write(dev->regmap, 0x1ce, 0x10); + ret = regmap_write(dev->regmap, 0x108, 0x80); + ret = regmap_write(dev->regmap, 0x109, 0x7f); + ret = regmap_write(dev->regmap, 0x10a, 0x80); + ret = regmap_write(dev->regmap, 0x10b, 0x7f); + ret = regmap_write(dev->regmap, 0x00e, 0xfc); + ret = regmap_write(dev->regmap, 0x00e, 0xfc); + ret = regmap_write(dev->regmap, 0x011, 0xd4); + ret = regmap_write(dev->regmap, 0x1e5, 0xf0); + ret = regmap_write(dev->regmap, 0x1d9, 0x00); + ret = regmap_write(dev->regmap, 0x1db, 0x00); + ret = regmap_write(dev->regmap, 0x1dd, 0x14); + ret = regmap_write(dev->regmap, 0x1de, 0xec); + ret = regmap_write(dev->regmap, 0x1d8, 0x0c); + ret = regmap_write(dev->regmap, 0x1e6, 0x02); + ret = regmap_write(dev->regmap, 0x1d7, 0x09); + ret = regmap_write(dev->regmap, 0x00d, 0x83); + ret = regmap_write(dev->regmap, 0x010, 0x49); + ret = regmap_write(dev->regmap, 0x00d, 0x87); + ret = regmap_write(dev->regmap, 0x00d, 0x85); + ret = regmap_write(dev->regmap, 0x013, 0x02); break; case RTL2832_SDR_TUNER_FC0012: case RTL2832_SDR_TUNER_FC0013: - ret = rtl2832_sdr_wr_regs(dev, 0x112, "\x5a", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x102, "\x40", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x103, "\x5a", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1c7, "\x2c", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x104, "\xcc", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x105, "\xbe", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1c8, "\x16", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x106, "\x35", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1c9, "\x21", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1ca, "\x21", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1cb, "\x00", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x107, "\x40", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1cd, "\x10", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1ce, "\x10", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x108, "\x80", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x109, "\x7f", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x10a, "\x80", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x10b, "\x7f", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x00e, "\xfc", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x00e, "\xfc", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x011, "\xe9\xbf", 2); - ret = rtl2832_sdr_wr_regs(dev, 0x1e5, "\xf0", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1d9, "\x00", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1db, "\x00", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1dd, "\x11", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1de, "\xef", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1d8, "\x0c", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1e6, "\x02", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1d7, "\x09", 1); + ret = regmap_write(dev->regmap, 0x112, 0x5a); + ret = regmap_write(dev->regmap, 0x102, 0x40); + ret = regmap_write(dev->regmap, 0x103, 0x5a); + ret = regmap_write(dev->regmap, 0x1c7, 0x2c); + ret = regmap_write(dev->regmap, 0x104, 0xcc); + ret = regmap_write(dev->regmap, 0x105, 0xbe); + ret = regmap_write(dev->regmap, 0x1c8, 0x16); + ret = regmap_write(dev->regmap, 0x106, 0x35); + ret = regmap_write(dev->regmap, 0x1c9, 0x21); + ret = regmap_write(dev->regmap, 0x1ca, 0x21); + ret = regmap_write(dev->regmap, 0x1cb, 0x00); + ret = regmap_write(dev->regmap, 0x107, 0x40); + ret = regmap_write(dev->regmap, 0x1cd, 0x10); + ret = regmap_write(dev->regmap, 0x1ce, 0x10); + ret = regmap_write(dev->regmap, 0x108, 0x80); + ret = regmap_write(dev->regmap, 0x109, 0x7f); + ret = regmap_write(dev->regmap, 0x10a, 0x80); + ret = regmap_write(dev->regmap, 0x10b, 0x7f); + ret = regmap_write(dev->regmap, 0x00e, 0xfc); + ret = regmap_write(dev->regmap, 0x00e, 0xfc); + ret = regmap_bulk_write(dev->regmap, 0x011, "\xe9\xbf", 2); + ret = regmap_write(dev->regmap, 0x1e5, 0xf0); + ret = regmap_write(dev->regmap, 0x1d9, 0x00); + ret = regmap_write(dev->regmap, 0x1db, 0x00); + ret = regmap_write(dev->regmap, 0x1dd, 0x11); + ret = regmap_write(dev->regmap, 0x1de, 0xef); + ret = regmap_write(dev->regmap, 0x1d8, 0x0c); + ret = regmap_write(dev->regmap, 0x1e6, 0x02); + ret = regmap_write(dev->regmap, 0x1d7, 0x09); break; case RTL2832_SDR_TUNER_R820T: case RTL2832_SDR_TUNER_R828D: - ret = rtl2832_sdr_wr_regs(dev, 0x112, "\x5a", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x102, "\x40", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x115, "\x01", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x103, "\x80", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1c7, "\x24", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x104, "\xcc", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x105, "\xbe", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1c8, "\x14", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x106, "\x35", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1c9, "\x21", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1ca, "\x21", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1cb, "\x00", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x107, "\x40", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1cd, "\x10", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1ce, "\x10", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x108, "\x80", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x109, "\x7f", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x10a, "\x80", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x10b, "\x7f", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x00e, "\xfc", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x00e, "\xfc", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x011, "\xf4", 1); + ret = regmap_write(dev->regmap, 0x112, 0x5a); + ret = regmap_write(dev->regmap, 0x102, 0x40); + ret = regmap_write(dev->regmap, 0x115, 0x01); + ret = regmap_write(dev->regmap, 0x103, 0x80); + ret = regmap_write(dev->regmap, 0x1c7, 0x24); + ret = regmap_write(dev->regmap, 0x104, 0xcc); + ret = regmap_write(dev->regmap, 0x105, 0xbe); + ret = regmap_write(dev->regmap, 0x1c8, 0x14); + ret = regmap_write(dev->regmap, 0x106, 0x35); + ret = regmap_write(dev->regmap, 0x1c9, 0x21); + ret = regmap_write(dev->regmap, 0x1ca, 0x21); + ret = regmap_write(dev->regmap, 0x1cb, 0x00); + ret = regmap_write(dev->regmap, 0x107, 0x40); + ret = regmap_write(dev->regmap, 0x1cd, 0x10); + ret = regmap_write(dev->regmap, 0x1ce, 0x10); + ret = regmap_write(dev->regmap, 0x108, 0x80); + ret = regmap_write(dev->regmap, 0x109, 0x7f); + ret = regmap_write(dev->regmap, 0x10a, 0x80); + ret = regmap_write(dev->regmap, 0x10b, 0x7f); + ret = regmap_write(dev->regmap, 0x00e, 0xfc); + ret = regmap_write(dev->regmap, 0x00e, 0xfc); + ret = regmap_write(dev->regmap, 0x011, 0xf4); break; case RTL2832_SDR_TUNER_FC2580: - ret = rtl2832_sdr_wr_regs(dev, 0x112, "\x39", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x102, "\x40", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x103, "\x5a", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1c7, "\x2c", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x104, "\xcc", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x105, "\xbe", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1c8, "\x16", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x106, "\x35", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1c9, "\x21", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1ca, "\x21", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1cb, "\x00", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x107, "\x40", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1cd, "\x10", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x1ce, "\x10", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x108, "\x80", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x109, "\x7f", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x10a, "\x9c", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x10b, "\x7f", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x00e, "\xfc", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x00e, "\xfc", 1); - ret = rtl2832_sdr_wr_regs(dev, 0x011, "\xe9\xf4", 2); + ret = regmap_write(dev->regmap, 0x112, 0x39); + ret = regmap_write(dev->regmap, 0x102, 0x40); + ret = regmap_write(dev->regmap, 0x103, 0x5a); + ret = regmap_write(dev->regmap, 0x1c7, 0x2c); + ret = regmap_write(dev->regmap, 0x104, 0xcc); + ret = regmap_write(dev->regmap, 0x105, 0xbe); + ret = regmap_write(dev->regmap, 0x1c8, 0x16); + ret = regmap_write(dev->regmap, 0x106, 0x35); + ret = regmap_write(dev->regmap, 0x1c9, 0x21); + ret = regmap_write(dev->regmap, 0x1ca, 0x21); + ret = regmap_write(dev->regmap, 0x1cb, 0x00); + ret = regmap_write(dev->regmap, 0x107, 0x40); + ret = regmap_write(dev->regmap, 0x1cd, 0x10); + ret = regmap_write(dev->regmap, 0x1ce, 0x10); + ret = regmap_write(dev->regmap, 0x108, 0x80); + ret = regmap_write(dev->regmap, 0x109, 0x7f); + ret = regmap_write(dev->regmap, 0x10a, 0x9c); + ret = regmap_write(dev->regmap, 0x10b, 0x7f); + ret = regmap_write(dev->regmap, 0x00e, 0xfc); + ret = regmap_write(dev->regmap, 0x00e, 0xfc); + ret = regmap_bulk_write(dev->regmap, 0x011, "\xe9\xf4", 2); break; default: dev_notice(&pdev->dev, "Unsupported tuner\n"); } /* software reset */ - ret = rtl2832_sdr_wr_reg_mask(dev, 0x101, 0x04, 0x04); + ret = regmap_update_bits(dev->regmap, 0x101, 0x04, 0x04); if (ret) goto err; - ret = rtl2832_sdr_wr_reg_mask(dev, 0x101, 0x00, 0x04); + ret = regmap_update_bits(dev->regmap, 0x101, 0x04, 0x00); if (ret) goto err; err: @@ -798,29 +759,29 @@ static void rtl2832_sdr_unset_adc(struct rtl2832_sdr_dev *dev) dev_dbg(&pdev->dev, "\n"); /* PID filter */ - ret = rtl2832_sdr_wr_regs(dev, 0x061, "\xe0", 1); + ret = regmap_write(dev->regmap, 0x061, 0xe0); if (ret) goto err; /* mode */ - ret = rtl2832_sdr_wr_regs(dev, 0x019, "\x20", 1); + ret = regmap_write(dev->regmap, 0x019, 0x20); if (ret) goto err; - ret = rtl2832_sdr_wr_regs(dev, 0x017, "\x11\x10", 2); + ret = regmap_bulk_write(dev->regmap, 0x017, "\x11\x10", 2); if (ret) goto err; /* FSM */ - ret = rtl2832_sdr_wr_regs(dev, 0x192, "\x00\x0f\xff", 3); + ret = regmap_bulk_write(dev->regmap, 0x192, "\x00\x0f\xff", 3); if (ret) goto err; - ret = rtl2832_sdr_wr_regs(dev, 0x13e, "\x40\x00", 2); + ret = regmap_bulk_write(dev->regmap, 0x13e, "\x40\x00", 2); if (ret) goto err; - ret = rtl2832_sdr_wr_regs(dev, 0x115, "\x06\x3f\xce\xcc", 4); + ret = regmap_bulk_write(dev->regmap, 0x115, "\x06\x3f\xce\xcc", 4); if (ret) goto err; err: @@ -1400,6 +1361,7 @@ static int rtl2832_sdr_probe(struct platform_device *pdev) subdev = pdata->v4l2_subdev; dev->v4l2_subdev = pdata->v4l2_subdev; dev->pdev = pdev; + dev->regmap = pdata->regmap; dev->udev = pdata->dvb_usb_device->udev; dev->f_adc = bands_adc[0].rangelow; dev->f_tuner = bands_fm[0].rangelow;