3rdparty/licenseReport: Add seperate LGPL checks
[haiku.git] / src / add-ons / media / media-add-ons / usb_webcam / sensors / pas106b.cpp
blob87ad9ac46fb96a5a6aad9814b7b0be177d93a2c6
1 /*
2 * Copyright 2004-2008, François Revol, <revol@free.fr>.
3 * Distributed under the terms of the MIT License.
4 */
6 #include "CamDebug.h"
7 #include "CamSensor.h"
8 #include "addons/sonix/SonixCamDevice.h"
10 //XXX: unfinished!
12 static const uint8 sProbeAddressList[] = {
13 0x01,0x02,0x03,0x04,0x05,0x06,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x10
15 static const uint8 sProbeMatchList[] = {
16 0x70,0x02,0x12,0x05,0x05,0x06,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x06
19 class PAS106BSensor : public CamSensor {
20 public:
21 PAS106BSensor(CamDevice *_camera);
22 ~PAS106BSensor();
23 status_t Probe();
24 const char* Name();
26 virtual bool Use400kHz() const { return true; }; // supports both
27 virtual bool UseRealIIC() const { return true; };
29 private:
30 bool fIsSonix;
34 PAS106BSensor::PAS106BSensor(CamDevice *_camera)
35 : CamSensor(_camera)
37 fIsSonix = (dynamic_cast<SonixCamDevice *>(_camera) != NULL);
38 if (fIsSonix) {
39 fInitStatus = B_OK;
40 } else {
41 PRINT((CH ": unknown camera device!" CT));
42 fInitStatus = ENODEV;
47 PAS106BSensor::~PAS106BSensor()
52 status_t
53 PAS106BSensor::Probe()
55 Device()->PowerOnSensor(false);
56 Device()->PowerOnSensor(true);
57 if (fIsSonix) {
58 Device()->WriteReg8(SN9C102_CHIP_CTRL, 0x00); /* power on the sensor, Fsys_clk=12MHz */
59 Device()->WriteReg8(SN9C102_CLOCK_SEL, 0x17); /* enable sensor, force 24MHz */
62 return ProbeByIICSignature(sProbeAddressList, sProbeMatchList,
63 sizeof(sProbeMatchList));
67 const char *
68 PAS106BSensor::Name()
70 return "PixArt Imaging pas106b";
74 B_WEBCAM_DECLARE_SENSOR(PAS106BSensor, pas106b)