From: Marcio Campos de Lima <marcio@netopen.com.br>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: <linux-media@vger.kernel.org>
Subject: Re: AT91SAM9M10: Problem porting driver for MT9P031 sensor
Date: Thu, 18 Apr 2013 20:03:30 -0200 [thread overview]
Message-ID: <CD95FB9B.AF55%marcio@netopen.com.br> (raw)
In-Reply-To: <Pine.LNX.4.64.1304182336510.28933@axis700.grange>
Hi Guennadi
Thanks a lot for your attention.
I think I cannot apply the patches. My Linux sources, downloaded from
www.at91.com, does not have the V4l2-async.h header and, I suppose, many
others headers. The MT9P031 sources have been modified and it is in a
different tree. Can you tell me where I can download an already patched
Kernel 3.6.9 which I can add theses functionality to the driver I am using?
By the way, our MT9P031 sensor board has 10-bit format. I have fixed
already.
Regards
MArcio
On 18/04/13 19:44, "Guennadi Liakhovetski" <g.liakhovetski@gmx.de> wrote:
>Hi Marcio
>
>On Thu, 18 Apr 2013, Marcio Campos de Lima wrote:
>
>> >Hi
>> >
>> >I am porting the MT9P031 sensor device driver for a custom designed
>>board
>> >based at the AT91SAM9M45-EK development board and Linux 3.6.9.
>> >The driver detects the sensor but does not create /dev/video1.
>> >
>> >Can anybody help me?
>
>Congratulations, today is your lucky day :-) I've just posted a
>patch-series
>
>http://thread.gmane.org/gmane.linux.drivers.video-input-infrastructure/635
>04
>
>to do exactly what you need. Well, 99% of what you need :) With at91
>you're using the atmel-isi soc-camera camera host driver. Shich isn't
>extended by this patch series to support the asynchronous subdevice
>registration, but it's rather easy to add, please, have a look at patch
>#15 for an example, based on the mx3_camera driver. Then there's a slight
>problem of mt9p031 only exporting 12-bit formats. You can "fix" it
>internally by substituting 8-bit formats (you are using 8 bits, right?)
>instead. We'll need a proper solution at some point. The last patch in
>the
>series shows how to add support for the mt9p031 sensor to a board.
>
>Anyway, give it a try, feel free to ask.
>
>Thanks
>Guennadi
>
>> >Thanks
>> >Marcio
>>
>> This is the probe code fo the driver if this can help:
>>
>> /*
>>
>>-------------------------------------------------------------------------
>>--
>> --
>> * Driver initialization and probing
>> */
>>
>> static int mt9p031_probe(struct i2c_client *client,
>> const struct i2c_device_id *did)
>> {
>> struct mt9p031_platform_data *pdata = client->dev.platform_data;
>> struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
>> struct mt9p031 *mt9p031;
>> unsigned int i;
>> int ret;
>>
>> if (pdata == NULL) {
>> dev_err(&client->dev, "No platform data\n");
>> return -EINVAL;
>> }
>>
>> if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WORD_DATA)) {
>> dev_warn(&client->dev,
>> "I2C-Adapter doesn't support I2C_FUNC_SMBUS_WORD\n");
>> return -EIO;
>> }
>>
>> mt9p031 = kzalloc(sizeof(*mt9p031), GFP_KERNEL);
>> if (mt9p031 == NULL)
>> return -ENOMEM;
>>
>> mt9p031->pdata = pdata;
>> mt9p031->output_control = MT9P031_OUTPUT_CONTROL_DEF;
>> mt9p031->mode2 = MT9P031_READ_MODE_2_ROW_BLC;
>>
>> v4l2_ctrl_handler_init(&mt9p031->ctrls, ARRAY_SIZE(mt9p031_ctrls) + 4);
>>
>> v4l2_ctrl_new_std(&mt9p031->ctrls, &mt9p031_ctrl_ops,
>> V4L2_CID_EXPOSURE, MT9P031_SHUTTER_WIDTH_MIN,
>> MT9P031_SHUTTER_WIDTH_MAX, 1,
>> MT9P031_SHUTTER_WIDTH_DEF);
>> v4l2_ctrl_new_std(&mt9p031->ctrls, &mt9p031_ctrl_ops,
>> V4L2_CID_GAIN, MT9P031_GLOBAL_GAIN_MIN,
>> MT9P031_GLOBAL_GAIN_MAX, 1, MT9P031_GLOBAL_GAIN_DEF);
>> v4l2_ctrl_new_std(&mt9p031->ctrls, &mt9p031_ctrl_ops,
>> V4L2_CID_HFLIP, 0, 1, 1, 0);
>> v4l2_ctrl_new_std(&mt9p031->ctrls, &mt9p031_ctrl_ops,
>> V4L2_CID_VFLIP, 0, 1, 1, 0);
>>
>> for (i = 0; i < ARRAY_SIZE(mt9p031_ctrls); ++i)
>> v4l2_ctrl_new_custom(&mt9p031->ctrls, &mt9p031_ctrls[i], NULL);
>>
>> mt9p031->subdev.ctrl_handler = &mt9p031->ctrls;
>>
>> if (mt9p031->ctrls.error)
>> printk(KERN_INFO "%s: control initialization error %d\n",
>> __func__, mt9p031->ctrls.error);
>>
>> mutex_init(&mt9p031->power_lock);
>> v4l2_i2c_subdev_init(&mt9p031->subdev, client, &mt9p031_subdev_ops);
>> mt9p031->subdev.internal_ops = &mt9p031_subdev_internal_ops;
>>
>> mt9p031->pad.flags = MEDIA_PAD_FL_SOURCE;
>> ret = media_entity_init(&mt9p031->subdev.entity, 1, &mt9p031->pad, 0);
>> if (ret < 0)
>> goto done;
>>
>> mt9p031->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
>>
>> mt9p031->crop.width = MT9P031_WINDOW_WIDTH_DEF;
>> mt9p031->crop.height = MT9P031_WINDOW_HEIGHT_DEF;
>> mt9p031->crop.left = MT9P031_COLUMN_START_DEF;
>> mt9p031->crop.top = MT9P031_ROW_START_DEF;
>>
>> if (mt9p031->pdata->version == MT9P031_MONOCHROME_VERSION)
>> mt9p031->format.code = V4L2_MBUS_FMT_Y12_1X12;
>> else
>> mt9p031->format.code = V4L2_MBUS_FMT_SGRBG12_1X12;
>>
>> mt9p031->format.width = MT9P031_WINDOW_WIDTH_DEF;
>> mt9p031->format.height = MT9P031_WINDOW_HEIGHT_DEF;
>> mt9p031->format.field = V4L2_FIELD_NONE;
>> mt9p031->format.colorspace = V4L2_COLORSPACE_SRGB;
>> isi_set_clk();
>> mt9p031->pdata->ext_freq=21000000;
>> mt9p031->pdata->target_freq=48000000;
>> ret = mt9p031_pll_get_divs(mt9p031);
>>
>> done:
>> if (ret < 0) {
>> v4l2_ctrl_handler_free(&mt9p031->ctrls);
>> media_entity_cleanup(&mt9p031->subdev.entity);
>> kfree(mt9p031);
>> }
>>
>> return ret;
>> }
>>
>>
>>
>> --
>> 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
>>
>
>---
>Guennadi Liakhovetski, Ph.D.
>Freelance Open-Source Software Developer
>http://www.open-technology.de/
next prev parent reply other threads:[~2013-04-18 23:03 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CD957E83.AF12%marcio@netopen.com.br>
2013-04-18 14:11 ` AT91SAM9M10: Problem porting driver for MT9P031 sensor Marcio Campos de Lima
2013-04-18 21:44 ` Guennadi Liakhovetski
2013-04-18 22:03 ` Marcio Campos de Lima [this message]
2013-04-19 12:42 ` Guennadi Liakhovetski
2013-04-19 13:47 ` Marcio Lima
2013-04-19 14:24 ` Guennadi Liakhovetski
2013-04-23 14:40 ` Marcio Campos de Lima
2013-04-23 16:08 ` Guennadi Liakhovetski
2013-04-23 21:35 ` Marcio Lima
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CD95FB9B.AF55%marcio@netopen.com.br \
--to=marcio@netopen.com.br \
--cc=g.liakhovetski@gmx.de \
--cc=linux-media@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).