From patchwork Wed May 15 11:57:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 2572191 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from arroyo.ext.ti.com (arroyo.ext.ti.com [192.94.94.40]) by patchwork2.kernel.org (Postfix) with ESMTP id 96CEBDF2A2 for ; Wed, 15 May 2013 12:05:19 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id r4FC3YFp028482; Wed, 15 May 2013 07:03:34 -0500 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id r4FC3XNv010164; Wed, 15 May 2013 07:03:33 -0500 Received: from dlelxv23.itg.ti.com (172.17.1.198) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.2.342.3; Wed, 15 May 2013 07:03:33 -0500 Received: from linux.omap.com (dlelxs01.itg.ti.com [157.170.227.31]) by dlelxv23.itg.ti.com (8.13.8/8.13.8) with ESMTP id r4FC3XXh021839; Wed, 15 May 2013 07:03:33 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 9CD3980628; Wed, 15 May 2013 07:03:33 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp53.itg.ti.com (dflp53.itg.ti.com [128.247.5.6]) by linux.omap.com (Postfix) with ESMTP id 2F3DB80631 for ; Wed, 15 May 2013 07:03:31 -0500 (CDT) Received: from red.ext.ti.com (red.ext.ti.com [192.94.93.37]) by dflp53.itg.ti.com (8.13.8/8.13.8) with ESMTP id r4FC3VOL004710 for ; Wed, 15 May 2013 07:03:31 -0500 (CDT) Received: from mail6.bemta7.messagelabs.com (mail6.bemta7.messagelabs.com [216.82.255.55]) by red.ext.ti.com (8.13.7/8.13.7) with ESMTP id r4FC3Ur9017699 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 15 May 2013 07:03:30 -0500 Received: from [216.82.253.147:64882] by server-15.bemta-7.messagelabs.com id FF/42-16944-29973915; Wed, 15 May 2013 12:03:30 +0000 X-Env-Sender: prabhakar.csengg@gmail.com X-Msg-Ref: server-10.tower-165.messagelabs.com!1368619409!10385424!1 X-Originating-IP: [209.85.160.43] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG, ML_RADAR_SPEW_LINKS_14,spamassassin: X-StarScan-Received: X-StarScan-Version: 6.9.6; banners=-,-,- X-VirusChecked: Checked Received: (qmail 6738 invoked from network); 15 May 2013 12:03:29 -0000 Received: from mail-pb0-f43.google.com (HELO mail-pb0-f43.google.com) (209.85.160.43) by server-10.tower-165.messagelabs.com with RC4-SHA encrypted SMTP; 15 May 2013 12:03:29 -0000 Received: by mail-pb0-f43.google.com with SMTP id md12so1321020pbc.2 for ; Wed, 15 May 2013 05:03:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=B8B8VsAJXHO9czJQShHnKwt3dI+/nxyCBv5fY+sp4XE=; b=wCq80yKe5N+QVCS7LS7fstFLHyN2a0AvqA/rX6qM2WC8SWLO38tJtAXP/ZVCTUEq96 jnyKRdH7cfifITJv6TO7ky5XS/UFlE2Uh+szwdZT8MsnI7wOrOIOY/Q8VZrPdlEsERPX wTIAkiJmIVhKCrW14cTyAlnnv2LzqJntBFJqxFZA5FnuSet+51xmSqwktxj7bXJmXOo1 mrLYt0gs8+yUT+PzhzyNZx2RBN2t4eO/eacbPBd7E+x1zqbXkZ7ysCchHOdpeyC2mHMp 0WFrVQgpSeq/5MWEXRy9pb11xIpy83vMPRZIRfNHB9Z9s41CqC7wiqd79uz7+eSg12AR lzVA== X-Received: by 10.68.197.195 with SMTP id iw3mr38046458pbc.177.1368619409040; Wed, 15 May 2013 05:03:29 -0700 (PDT) Received: from localhost.localdomain ([59.98.240.128]) by mx.google.com with ESMTPSA id az5sm2610731pbc.18.2013.05.15.05.03.20 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 15 May 2013 05:03:28 -0700 (PDT) From: Lad Prabhakar To: LMML Subject: [PATCH 6/6] media: i2c: ths7303: add OF support Date: Wed, 15 May 2013 17:27:22 +0530 Message-ID: <1368619042-28252-7-git-send-email-prabhakar.csengg@gmail.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1368619042-28252-1-git-send-email-prabhakar.csengg@gmail.com> References: <1368619042-28252-1-git-send-email-prabhakar.csengg@gmail.com> CC: Rob Landley , DLOS , Mauro Carvalho Chehab , , , LKML , Rob Herring , Grant Likely , Hans Verkuil , Laurent Pinchart , Sylwester Nawrocki , Sakari Ailus , Guennadi Liakhovetski X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com From: Lad, Prabhakar add OF support for the ths7303 driver. Signed-off-by: Lad, Prabhakar Cc: Hans Verkuil Cc: Laurent Pinchart Cc: Mauro Carvalho Chehab Cc: Guennadi Liakhovetski Cc: Sylwester Nawrocki Cc: Sakari Ailus Cc: Grant Likely Cc: Rob Herring Cc: Rob Landley Cc: devicetree-discuss@lists.ozlabs.org Cc: linux-doc@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: davinci-linux-open-source@linux.davincidsp.com --- .../devicetree/bindings/media/i2c/ths73x3.txt | 50 ++++++++++++++++++++ drivers/media/i2c/ths7303.c | 37 ++++++++++++++- 2 files changed, 86 insertions(+), 1 deletions(-) create mode 100644 Documentation/devicetree/bindings/media/i2c/ths73x3.txt diff --git a/Documentation/devicetree/bindings/media/i2c/ths73x3.txt b/Documentation/devicetree/bindings/media/i2c/ths73x3.txt new file mode 100644 index 0000000..62f63e8 --- /dev/null +++ b/Documentation/devicetree/bindings/media/i2c/ths73x3.txt @@ -0,0 +1,50 @@ +* Texas Instruments THS7303/THS7353 video amplifier + +The THS7303/THS7353 device is a low power 3-channel integrated video buffer +which can be configured individually via i2c for all the functions which makes +it flexible for any application. It incorporates a selectable fifth-order +Butterworth filter to eliminate data converter images. + +Required Properties : +- compatible : value should be either one among the following + (a) "ti,ths7303" for ths7303 video amplifier. + (b) "ti,ths7353" for ths7353 video amplifier. + +- ti,ths73x3-ch1-bias: Bias value for channel 1. + +- ti,ths73x3-ch2-bias: Bias value for channel 2. + +- ti,ths73x3-ch3-bias: Bias value for channel 3. + +Bias values for channel-1/2/3 can be following (values default to zero):- + - 0: Disable Channel - Conserves Power + - 1: Channel On - Mute Function - No Output + - 2: Channel On - DC Bias Select + - 3: Channel On - DC Bias + 250 mV Offset Select + - 4: Channel On - AC Bias Select + - 5: Channel On - Sync Tip Clam with low bias + - 6: Channel On - Sync Tip Clam with mid bias + - 7: Channel On - Sync Tip Clam with high bias + +For further reading of port node refer Documentation/devicetree/bindings/media/ +video-interfaces.txt. + +Example: + + i2c0@1c22000 { + ... + ... + ths7303@2c { + compatible = "ti,ths7303"; + reg = <0x2c>; + + port { + ths7303_1: endpoint { + ti,ths73x3-ch1-bias = <3>; + ti,ths73x3-ch2-bias = <3>; + ti,ths73x3-ch3-bias = <3>; + }; + }; + }; + ... + }; diff --git a/drivers/media/i2c/ths7303.c b/drivers/media/i2c/ths7303.c index 4f772a2..a648313 100644 --- a/drivers/media/i2c/ths7303.c +++ b/drivers/media/i2c/ths7303.c @@ -29,6 +29,7 @@ #include #include #include +#include #define THS7303_CHANNEL_1 1 #define THS7303_CHANNEL_2 2 @@ -350,10 +351,34 @@ static const struct v4l2_subdev_ops ths7303_ops = { .video = &ths7303_video_ops, }; +static struct ths7303_platform_data * +ths7303_get_pdata(struct i2c_client *client) +{ + struct ths7303_platform_data *pdata; + struct device_node *endpoint; + + if (!IS_ENABLED(CONFIG_OF) || !client->dev.of_node) + return client->dev.platform_data; + + endpoint = v4l2_of_get_next_endpoint(client->dev.of_node, NULL); + if (!endpoint) + return NULL; + + pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) + return NULL; + + of_property_read_u8(endpoint, "ti,ths73x3-ch1-bias", &pdata->ch_1); + of_property_read_u8(endpoint, "ti,ths73x3-ch2-bias", &pdata->ch_2); + of_property_read_u8(endpoint, "ti,ths73x3-ch3-bias", &pdata->ch_3); + + return pdata; +} + static int ths7303_probe(struct i2c_client *client, const struct i2c_device_id *id) { - struct ths7303_platform_data *pdata = client->dev.platform_data; + struct ths7303_platform_data *pdata = ths7303_get_pdata(client); struct ths7303_state *state; struct v4l2_subdev *sd; int ret; @@ -414,8 +439,18 @@ static const struct i2c_device_id ths7303_id[] = { MODULE_DEVICE_TABLE(i2c, ths7303_id); +#if IS_ENABLED(CONFIG_OF) +static const struct of_device_id ths73x3_of_match[] = { + { .compatible = "ti,ths7303", }, + { .compatible = "ti,ths7353", }, + { /* sentinel */ }, +}; +MODULE_DEVICE_TABLE(of, ths73x3_of_match); +#endif + static struct i2c_driver ths7303_driver = { .driver = { + .of_match_table = of_match_ptr(ths73x3_of_match), .owner = THIS_MODULE, .name = "ths73x3", },