Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci-2.6.23
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci-2.6.23
Commits
ba45c6f2
Commit
ba45c6f2
authored
May 04, 2008
by
张青山(steven.zhang)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ARM: Davinci: SD Frame Buffer Support
parent
ccc2ae5f
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
379 additions
and
1 deletion
+379
-1
arch/arm/configs/ntosd_644xA_defconfig
arch/arm/configs/ntosd_644xA_defconfig
+1
-0
drivers/char/Kconfig
drivers/char/Kconfig
+6
-0
drivers/char/Makefile
drivers/char/Makefile
+2
-0
drivers/char/davinci-ths7313.c
drivers/char/davinci-ths7313.c
+259
-0
include/asm-arm/arch-davinci/davinci-ths7313.h
include/asm-arm/arch-davinci/davinci-ths7313.h
+110
-0
include/linux/i2c-id.h
include/linux/i2c-id.h
+1
-1
No files found.
arch/arm/configs/ntosd_644xA_defconfig
View file @
ba45c6f2
...
@@ -721,6 +721,7 @@ CONFIG_HW_RANDOM=y
...
@@ -721,6 +721,7 @@ CONFIG_HW_RANDOM=y
# CONFIG_R3964 is not set
# CONFIG_R3964 is not set
# CONFIG_RAW_DRIVER is not set
# CONFIG_RAW_DRIVER is not set
CONFIG_RESIZER=y
CONFIG_RESIZER=y
CONFIG_THS7313=y
# CONFIG_TCG_TPM is not set
# CONFIG_TCG_TPM is not set
CONFIG_I2C=y
CONFIG_I2C=y
CONFIG_I2C_BOARDINFO=y
CONFIG_I2C_BOARDINFO=y
...
...
drivers/char/Kconfig
View file @
ba45c6f2
...
@@ -1082,5 +1082,11 @@ config PREVIEWER
...
@@ -1082,5 +1082,11 @@ config PREVIEWER
help
help
DaVinci Previewer Driver
DaVinci Previewer Driver
config THS7313
tristate "Enable SDTV Video Amplifier Support"
default n
help
Say Yes to enable the SDTV Video Amplifier support.
endmenu
endmenu
drivers/char/Makefile
View file @
ba45c6f2
...
@@ -118,6 +118,8 @@ js-rtc-y = rtc.o
...
@@ -118,6 +118,8 @@ js-rtc-y = rtc.o
davinci_previewer_driver-objs
:=
davinci_previewer_hw.o davinci_previewer.o
davinci_previewer_driver-objs
:=
davinci_previewer_hw.o davinci_previewer.o
obj-$(CONFIG_PREVIEWER)
+=
davinci_previewer_driver.o
obj-$(CONFIG_PREVIEWER)
+=
davinci_previewer_driver.o
obj-$(CONFIG_THS7313)
+=
davinci-ths7313.o
# Files generated that shall be removed upon make clean
# Files generated that shall be removed upon make clean
clean-files
:=
consolemap_deftbl.c defkeymap.c
clean-files
:=
consolemap_deftbl.c defkeymap.c
...
...
drivers/char/davinci-ths7313.c
0 → 100644
View file @
ba45c6f2
/* *
* Copyright (C) 2008 Neuros Technology International LLC
*
* This program is free software you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not,write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* davinci-ths7313.c file */
/*Header files*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/i2c.h>
#include <asm/arch/davinci-ths7313.h>
/* #define DEBUG */
#ifdef DEBUG
#define DPRINTK(x...) do { \
printk(KERN_INFO, "<%s>: ", __FUNCTION__); printk(x); \
} while (0)
#define FN_IN printk(KERN_INFO, "<%s> start:\n", __FUNCTION__)
#else
#define DPRINTK(x...)
#define FN_IN
#endif
static
int
ths7313_attach_adapter
(
struct
i2c_adapter
*
adapter
);
static
int
ths7313_detach_client
(
struct
i2c_client
*
client
);
static
int
ths7313_detect_client
(
struct
i2c_adapter
*
adapter
,
int
address
,
int
kind
);
static
int
ths7313_write_value
(
u8
reg
,
u16
value
);
static
int
ths7313_read_value
(
u8
reg
);
static
void
ths7313_configure
(
void
);
static
__init
int
ths7313_init
(
void
);
static
__exit
void
ths7313_exit
(
void
);
static
struct
i2c_driver
ths7313_driver
=
{
.
driver
=
{
.
name
=
"THS7313"
,
},
.
id
=
I2C_DRIVERID_THS7313
,
.
attach_adapter
=
ths7313_attach_adapter
,
.
detach_client
=
ths7313_detach_client
,
};
/* I2C Addresses to scan */
static
unsigned
short
normal_i2c
[]
=
{
THS7313_I2C_ADDR
,
\
I2C_CLIENT_END
};
/* This makes all addr_data:s */
I2C_CLIENT_INSMOD
;
static
struct
i2c_client
*
ths7313_client
;
static
int
ths7313_read_value
(
u8
reg
)
{
return
i2c_smbus_read_byte_data
(
ths7313_client
,
reg
);
}
static
int
ths7313_write_value
(
u8
reg
,
u16
value
)
{
return
i2c_smbus_write_byte_data
(
ths7313_client
,
reg
,
value
);
}
int
ths7313_set_input_mode
(
int
channel
,
int
mode
)
{
int
origin
;
if
(
channel
>
3
||
channel
<
0
)
{
DPRINTK
(
"Invalidate channel %d
\n
"
,
channel
);
return
-
1
;
}
origin
=
ths7313_read_value
(
channel
);
origin
=
(
origin
&
~
0x07
)
|
(
mode
&
0x07
);
if
(
ths7313_write_value
(
channel
,
origin
))
{
DPRINTK
(
"ths7313_write_value failed
\n
"
);
return
-
1
;
}
DPRINTK
(
"Channel %d set input mode : %x
\n
"
,
channel
,
mode
&
0x07
);
return
0
;
}
int
ths7313_set_input_mux
(
int
channel
,
int
select
)
{
int
origin
;
if
(
channel
>
3
||
channel
<
0
)
{
DPRINTK
(
"Invalidate channel %d
\n
"
,
channel
);
return
-
1
;
}
origin
=
ths7313_read_value
(
channel
);
origin
=
(
origin
&
~
0x20
)
|
(
select
&
0x20
);
if
(
ths7313_write_value
(
channel
,
origin
))
{
DPRINTK
(
"ths7313_write_value failed
\n
"
);
return
-
1
;
}
DPRINTK
(
"Channel %d set input mux : %x
\n
"
,
channel
,
select
&
0x20
);
return
0
;
}
int
ths7313_set_pass_filter
(
int
channel
,
int
filter
)
{
int
origin
;
if
(
channel
>
3
||
channel
<
0
)
{
DPRINTK
(
"Invalidate channel %d
\n
"
,
channel
);
return
-
1
;
}
origin
=
ths7313_read_value
(
channel
);
origin
=
(
origin
&
~
0xC0
)
|
(
filter
&
0xC0
);
if
(
ths7313_write_value
(
channel
,
origin
))
{
DPRINTK
(
"ths7313_write_value failed
\n
"
);
return
-
1
;
}
DPRINTK
(
"Channel %d set input mux : %x
\n
"
,
channel
,
filter
&
0xC0
);
return
0
;
}
static
void
ths7313_configure
(
void
)
{
/* enable channel 1 and set mode as DC_BIAS_135MV*/
ths7313_set_input_mode
(
CHANNEL1_REG
,
DC_BIAS_135MV
);
/* disbale channel 2 */
ths7313_set_input_mode
(
CHANNEL2_REG
,
DISABLE_CHANNEL
);
/* disbale channel 3 */
ths7313_set_input_mode
(
CHANNEL3_REG
,
DISABLE_CHANNEL
);
/* set input mux :input A select */
ths7313_set_input_mux
(
CHANNEL1_REG
,
INPUT_A_SELECT
);
}
static
int
ths7313_attach_adapter
(
struct
i2c_adapter
*
adapter
)
{
int
res
;
FN_IN
;
res
=
i2c_probe
(
adapter
,
&
addr_data
,
&
ths7313_detect_client
);
return
res
;
}
static
int
ths7313_detach_client
(
struct
i2c_client
*
client
)
{
int
err
;
FN_IN
;
err
=
i2c_detach_client
(
client
);
if
(
err
)
{
DPRINTK
(
"Client deregistration failed, \
client not detached.
\n
"
);
return
err
;
}
kfree
(
client
);
return
0
;
}
static
int
ths7313_detect_client
(
struct
i2c_adapter
*
adapter
,
int
address
,
int
kind
)
{
int
err
=
0
;
const
char
*
client_name
=
"THS7313 Video Amplifier"
;
FN_IN
;
if
(
!
i2c_check_functionality
(
adapter
,
I2C_FUNC_SMBUS_WORD_DATA
|
I2C_FUNC_SMBUS_WRITE_BYTE
))
{
DPRINTK
(
"Functinality check failed for %s
\n
"
,
client_name
);
return
err
;
}
ths7313_client
=
kmalloc
(
sizeof
(
struct
i2c_client
),
GFP_KERNEL
);
if
(
ths7313_client
==
NULL
)
{
err
=
-
ENOMEM
;
DPRINTK
(
"Couldn't allocate memory for %s
\n
"
,
client_name
);
return
err
;
}
memset
(
ths7313_client
,
0x00
,
sizeof
(
struct
i2c_client
));
ths7313_client
->
addr
=
address
;
ths7313_client
->
adapter
=
adapter
;
ths7313_client
->
driver
=
&
ths7313_driver
;
ths7313_client
->
flags
=
0
;
strlcpy
(
ths7313_client
->
name
,
client_name
,
I2C_NAME_SIZE
);
err
=
i2c_attach_client
(
ths7313_client
);
if
(
err
)
{
DPRINTK
(
"Couldn't attach %s
\n
"
,
client_name
);
kfree
(
ths7313_client
);
return
err
;
}
return
0
;
}
static
__init
int
ths7313_init
(
void
)
{
FN_IN
;
if
(
i2c_add_driver
(
&
ths7313_driver
))
{
DPRINTK
(
"Driver registration failed, \
module not inserted.
\n
"
);
return
-
ENODEV
;
}
ths7313_configure
();
return
0
;
}
static
__exit
void
ths7313_exit
(
void
)
{
FN_IN
;
i2c_del_driver
(
&
ths7313_driver
);
}
module_init
(
ths7313_init
);
module_exit
(
ths7313_exit
);
EXPORT_SYMBOL
(
ths7313_set_input_mode
);
EXPORT_SYMBOL
(
ths7313_set_input_mux
);
EXPORT_SYMBOL
(
ths7313_set_pass_filter
);
MODULE_DESCRIPTION
(
"THS7313 SDTV Video Amplifier Driver"
);
MODULE_AUTHOR
(
"Neuros Technology International LLC"
);
MODULE_LICENSE
(
"GPL"
);
include/asm-arm/arch-davinci/davinci-ths7313.h
0 → 100644
View file @
ba45c6f2
/* *
* Copyright (C) 2008 Neuros Technology International LLC
*
* This program is free software you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not,write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* davinci-ths7313.h file */
#ifndef DAVINCI_THS7313
#define DAVINCI_THS7313
/* channel registers */
#define CHANNEL1_REG 1
/* channel 1 register */
#define CHANNEL2_REG 2
/* channel 2 register */
#define CHANNEL3_REG 3
/* channel 3 register */
/* STC Low Pass Filter Selection */
/* 500-kHz Filter---Useful for poor video sync signals */
#define LOW_PASS_FILTER1 0x00
/* 2.5-MHz Filter---Useful for reasonable sync signals */
#define LOW_PASS_FILTER2 0x40
/* 5-MHz Filter---Useful for good sync signals */
#define LOW_PASS_FILTER3 0x80
/* 5-MHz Filter---Useful for good sync signals */
#define LOW_PASS_FILTER4 0xC0
/* Input MUX Selection */
#define INPUT_A_SELECT 0x00
/* input A select */
#define INPUT_B_SELECT 0x20
/* input B select */
/* Input Bias Mode Selection and Disable Control */
#define DISABLE_CHANNEL 0x00
/* Disbale Channle-Conserves Power */
#define MUTE_CHANNEL 0x01
/* Mute Function-No Output */
#define DC_BIAS 0x02
/* DC Bias Select */
#define DC_BIAS_135MV 0x03
/* DC Bias + 135 mV Offset Select */
#define AC_BIAS 0x04
/* AC Bias Select */
#define SYNC_CLAMP_LOW_BIAS 0x05
/* Sync Tip Clamp with Low Bias */
#define SYNC_CLAMP_MID_BIAS 0x06
/* Sync Tip Clamp with Mid Bias */
#define SYNC_CLAMP_HIGH_BIAS 0x07
/* Sync Tip Clamp with High Bias */
#define THS7313_I2C_ADDR 0x2C
/**
* Selects the input biasing of the
* THS7313 and the power-savings function.
* When Sync-Tip Clamp is selected, the DC input sink bias
* current is also selectable.
* @param channel
* There are three channels to configure:
* Channel1, Channel2, Channel3.
* @param mode
* DISABLE_CHANNEL: Disbale Channle-Conserves Power
* MUTE_CHANNEL: Mute Function-No Output
* DC_BIAS: DC Bias Select
* DC_BIAS_135MV: DC Bias + 135 mV Offset Select
* AC_BIAS: AC Bias Select
* SYNC_CLAMP_LOW_BIAS: Sync Tip Clamp with Low Bias
* SYNC_CLAMP_MID_BIAS: Sync Tip Clamp with Mid Bias
* SYNC_CLAMP_HIGH_BIAS: Sync Tip Clamp with High Bias
* @return int
* 0: set successfully, -1: an error occurs.
*/
int
ths7313_set_input_mode
(
int
channel
,
int
mode
);
/**
* Controls the input MUX of the THS7313
* @param channel
* There are three channels to configure:
* Channel1, Channel2, Channel3.
* @param select
* INPUT_A_SELECT: Input A Select
* INPUT_B_SELECT: Input B Select
* @return int
* 0: set successfully, -1: an error occurs.
*/
int
ths7313_set_input_mux
(
int
channel
,
int
select
);
/**
* Controls the AC-Sync Tip Clamp Low Pass Filter function. If
* AC-STC mode is not used, this function is ignored.
* @param channel
* There are three channels to configure:
* Channel1, Channel2, Channel3.
* @param filter
* LOW_PASS_FILTER1: 500-kHz Filter---Useful for poor video
* sync signals.
* LOW_PASS_FILTER2: 2.5-MHz Filter---Useful for reasonable
* sync signals.
* LOW_PASS_FILTER3: 5-MHz Filter---Useful for good sync
* signals.
* LOW_PASS_FILTER4: 5-MHz Filter---Useful for good sync
* signals.
* @return int
* 0: set successfully, -1: an error occurs.
*/
int
ths7313_set_pass_filter
(
int
channel
,
int
filter
);
#endif
/* End of DAVINCI_THS7313 */
include/linux/i2c-id.h
View file @
ba45c6f2
...
@@ -122,7 +122,7 @@
...
@@ -122,7 +122,7 @@
#define I2C_DRIVERID_MISC 99
/* Whatever until sorted out */
#define I2C_DRIVERID_MISC 99
/* Whatever until sorted out */
#define I2C_DRIVERID_IRRTC 0xF9
/* Neuros IR & RTC */
#define I2C_DRIVERID_IRRTC 0xF9
/* Neuros IR & RTC */
#define I2C_DRIVERID_THS7313 100
/* Texas Instrument THS7313 */
#define I2C_DRIVERID_I2CDEV 900
#define I2C_DRIVERID_I2CDEV 900
#define I2C_DRIVERID_ARP 902
/* SMBus ARP Client */
#define I2C_DRIVERID_ARP 902
/* SMBus ARP Client */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment