Last active
December 28, 2015 16:08
-
-
Save Embedded-linux/7526349 to your computer and use it in GitHub Desktop.
Adding Touchscreen Support [Adding Backlight & 7'' LCD]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Enable Backlight Support: | |
| File Names changed : arch/arm/mach-omap2/board-am335xevm.c | |
| arch/arm/mach-omap2/mux33xx.c | |
| File Name: arch/arm/mach-omap2/board-am335xevm.c | |
| ------------------------------------------------------------------------------------------- | |
| +#include <linux/pwm/pwm.h> | |
| ------------------------------------------------------------------------------------------- | |
| Adding the PWM header file having declations of files such as | |
| "struct pwm_device_ops {", | |
| "struct pwm_config {", | |
| "struct pwm_device {" | |
| "struct pwm_device *pwm_request_byname(const char *name, const char *label);" | |
| ------------------------------------------------------------------------------------- | |
| +/* Setup pwm-backlight for bbtoys7lcd */ | |
| +static struct platform_device bbtoys7lcd_backlight = { | |
| + .name = "pwm-backlight", | |
| + .id = -1, | |
| + .dev = { | |
| + .platform_data = &bbcape7lcd_backlight_data, | |
| + } | |
| +}; | |
| + | |
| ------------------------------------------------------------------------------------------------- | |
| Adding platform device of type bbtoys7lcd_backlight to beagle bone | |
| platform with the structure static struct bbtoys7lcd_backlight and | |
| bbcape7lcd_backlight_data is defined | |
| in the following file | |
| ------------------------------------------------------------------------------------------------- | |
| +/* eHRPWM is used to enable LCD backlight */ | |
| +static int ehrpwm_backlight_enable; | |
| + | |
| +/* LCD backlight platform Data */ | |
| +#define AM335X_BACKLIGHT_MAX_BRIGHTNESS 100 | |
| +#define AM335X_BACKLIGHT_DEFAULT_BRIGHTNESS 50 | |
| +#define AM335X_PWM_PERIOD_NANO_SECONDS (1000000 * 5) | |
| + | |
| +#define BBCAPE7LCD_PWM_DEVICE_ID "ehrpwm.1:0" | |
| + | |
| +static struct platform_pwm_backlight_data bbcape7lcd_backlight_data = { | |
| + .pwm_id = BBCAPE7LCD_PWM_DEVICE_ID, | |
| + .ch = -1, | |
| + .max_brightness = AM335X_BACKLIGHT_MAX_BRIGHTNESS, | |
| + .dft_brightness = AM335X_BACKLIGHT_DEFAULT_BRIGHTNESS, | |
| + .pwm_period_ns = AM335X_PWM_PERIOD_NANO_SECONDS, | |
| +}; | |
| ------------------------------------------------------------------------------------------------- | |
| ehpwrm is device of type PWM using pwm.h declarations and device specifications are | |
| described in the above structure | |
| "static struct platform_pwm_backlight_data bbcape7lcd_backlight_data" | |
| ------------------------------------------------------------------------------------ | |
| +/* Enable ehrpwm for backlight control */ | |
| +static void enable_ehrpwm1(void) | |
| +{ | |
| + ehrpwm_backlight_enable = true; | |
| + setup_pin_mux(ehrpwm_pin_mux); | |
| +} | |
| + | |
| ------------------------------------------------------------------------------------- | |
| ehpwrm is device of type pwm providing back light capability to beagle bone cape and | |
| enabling function for pin muxing function | |
| ------------------------------------------------------------------------------ | |
| +/* Module pin mux for LCD backlight */ | |
| +static struct pinmux_config ehrpwm_pin_mux[] = { | |
| + {"gpmc_a2.ehrpwm1A", OMAP_MUX_MODE6 | AM33XX_PIN_OUTPUT}, | |
| + {NULL, 0}, | |
| +}; | |
| + | |
| --------------------------------------------------------------------------------- | |
| This function is to enable the pin muxing for the device ehpwrm | |
| ------------------------------------------------------------------------------------------------- | |
| +static struct pwmss_platform_data pwm_pdata[3] = { | |
| + { | |
| + .version = PWM_VERSION_1, | |
| + }, | |
| + { | |
| + .version = PWM_VERSION_1, | |
| + }, | |
| + { | |
| + .version = PWM_VERSION_1, | |
| + }, | |
| +}; | |
| + | |
| ------------------------------------------------------------------------------------------------- | |
| This is the data provided to mention version number and number of PWM supported | |
| devices by the platform [Beagle bone] | |
| ------------------------------------------------------------------------------------------------- | |
| +/* Initialize and enable ehrpwm */ | |
| +static int __init ehrpwm1_init(void) | |
| +{ | |
| + int status = 0; | |
| + if (ehrpwm_backlight_enable) { | |
| + am33xx_register_ehrpwm(1, &pwm_pdata[0]); | |
| + platform_device_register(&bbtoys7lcd_backlight); | |
| + } | |
| + return status; | |
| +} | |
| +late_initcall(ehrpwm1_init); | |
| + | |
| ------------------------------------------------------------------------------------------------- | |
| Initilization of device ehpwrm where ehpwrm_backlight_enable varible is | |
| defined as "true" value. | |
| ------------------------------------------------------------------------------------------------- | |
| + am33xx_cpuidle_init(); | |
| ------------------------------------------------------------------------------------------------- | |
| ------------------------------------------------------------------------------------------------- | |
| + omap_serial_init(); | |
| + am335x_rtc_init(); | |
| + clkout2_enable(); | |
| + omap_sdrc_init(NULL, NULL); | |
| + enable_ehrpwm1(); | |
| ------------------------------------------------------------------------------------------------- | |
| Intilizing all data transfer activities and necessary devices to transfer the | |
| data to other devices | |
| ------------------------------------------------------------------------------------------------- | |
| + /* Beagle Bone has Micro-SD slot which doesn't have Write Protect pin */ | |
| + am335x_mmc[0].gpio_wp = -EINVAL; | |
| ------------------------------------------------------------------------------------------------- | |
| Giving support of device to MMC [Correct me if I am wrong] | |
| ------------------------------------------------------------------------------------------------- | |
| + mii1_init(); | |
| + am33xx_cpsw_init_generic(MII_MODE_ENABLE,gigabit_enable); | |
| ------------------------------------------------------------------------------------------------- | |
| Adding the Mode enable function. | |
| File Name: arch/arm/mach-omap2/mux33xx.c | |
| ------------------------------------------------------------------------------------------------- | |
| static struct omap_mux am33xx_muxmodes[] = { | |
| NULL, NULL, NULL, "gpio1_17"), | |
| _AM33XX_MUXENTRY(GPMC_A2, 0, | |
| "gpmc_a2", "mii2_txd3", "rgmii2_td3", "mmc2_dat1", | |
| - NULL, NULL, NULL, "gpio1_18"), | |
| + NULL, NULL, "ehrpwm1A", "gpio1_18"), | |
| _AM33XX_MUXENTRY(GPMC_A3, 0, | |
| "gpmc_a3", "mii2_txd2", "rgmii2_td2", "mmc2_dat2", | |
| NULL, NULL, NULL, "gpio1_19"), | |
| ------------------------------------------------------------------------------------------------- | |
| Adding pin muxing modes for ehpwrm device | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment