type
stringclasses
5 values
content
stringlengths
9
163k
includes
#include <linux/module.h>
includes
#include <linux/err.h>
includes
#include <linux/slab.h>
includes
#include <linux/leds.h>
includes
#include <linux/platform_device.h>
defines
#define to_nvec_led(led_cdev) \
defines
#define NVEC_LED_REQ {'\x0d', '\x10', '\x45', '\x10', '\x00'}
defines
#define NVEC_LED_MAX 8
structs
struct nvec_led { struct led_classdev cdev; struct nvec_chip *nvec; };
functions
void nvec_led_brightness_set(struct led_classdev *led_cdev, enum led_brightness value) { struct nvec_led *led = to_nvec_led(led_cdev); unsigned char buf[] = NVEC_LED_REQ; buf[4] = value; nvec_write_async(led->nvec, buf, sizeof(buf)); led->cdev.brightness = value; }
functions
int nvec_paz00_probe(struct platform_device *pdev) { struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent); struct nvec_led *led; int ret = 0; led = devm_kzalloc(&pdev->dev, sizeof(*led), GFP_KERNEL); if (!led) return -ENOMEM; led->cdev.max_brightness = NVEC_LED_MAX; led->cdev.brightness_set = nvec_led...
includes
#include <linux/backlight.h>
includes
#include <linux/delay.h>
includes
#include <linux/fb.h>
includes
#include <linux/gpio.h>
includes
#include <linux/lcd.h>
includes
#include <linux/module.h>
includes
#include <linux/spi/spi.h>
includes
#include <linux/wait.h>
defines
#define SLEEPMSEC 0x1000
defines
#define ENDDEF 0x2000
defines
#define DEFMASK 0xFF00
defines
#define COMMAND_ONLY 0xFE
defines
#define DATA_ONLY 0xFF
defines
#define MAX_GAMMA_LEVEL 5
defines
#define GAMMA_TABLE_COUNT 21
defines
#define MIN_BRIGHTNESS 0
defines
#define MAX_BRIGHTNESS 255
defines
#define DEFAULT_BRIGHTNESS 150
structs
struct ams369fg06 { struct device *dev; struct spi_device *spi; unsigned int power; struct lcd_device *ld; struct backlight_device *bd; struct lcd_platform_data *lcd_pd; };
structs
struct ams369fg06_gamma { unsigned int *gamma_22_table[MAX_GAMMA_LEVEL]; };
functions
int ams369fg06_spi_write_byte(struct ams369fg06 *lcd, int addr, int data) { u16 buf[1]; struct spi_message msg; struct spi_transfer xfer = { .len = 2, .tx_buf = buf, }
functions
int ams369fg06_spi_write(struct ams369fg06 *lcd, unsigned char address, unsigned char command) { int ret = 0; if (address != DATA_ONLY) ret = ams369fg06_spi_write_byte(lcd, 0x70, address); if (command != COMMAND_ONLY) ret = ams369fg06_spi_write_byte(lcd, 0x72, command); return ret; }
functions
int ams369fg06_panel_send_sequence(struct ams369fg06 *lcd, const unsigned short *wbuf) { int ret = 0, i = 0; while ((wbuf[i] & DEFMASK) != ENDDEF) { if ((wbuf[i] & DEFMASK) != SLEEPMSEC) { ret = ams369fg06_spi_write(lcd, wbuf[i], wbuf[i+1]); if (ret) break; }
functions
int _ams369fg06_gamma_ctl(struct ams369fg06 *lcd, const unsigned int *gamma) { unsigned int i = 0; int ret = 0; for (i = 0 ; i < GAMMA_TABLE_COUNT / 3; i++) { ret = ams369fg06_spi_write(lcd, 0x40 + i, gamma[i]); ret = ams369fg06_spi_write(lcd, 0x50 + i, gamma[i+7*1]); ret = ams369fg06_spi_write(lcd, 0x60 + i...
functions
int ams369fg06_gamma_ctl(struct ams369fg06 *lcd, int brightness) { int ret = 0; int gamma = 0; if ((brightness >= 0) && (brightness <= 50)) gamma = 0; else if ((brightness > 50) && (brightness <= 100)) gamma = 1; else if ((brightness > 100) && (brightness <= 150)) gamma = 2; else if ((brightness > 150) && ...
functions
int ams369fg06_ldi_init(struct ams369fg06 *lcd) { int ret, i; static const unsigned short *init_seq[] = { seq_setting, seq_stand_by_off, }
functions
int ams369fg06_ldi_enable(struct ams369fg06 *lcd) { int ret, i; static const unsigned short *init_seq[] = { seq_stand_by_off, seq_display_on, }
functions
int ams369fg06_ldi_disable(struct ams369fg06 *lcd) { int ret, i; static const unsigned short *init_seq[] = { seq_display_off, seq_stand_by_on, }
functions
int ams369fg06_power_is_on(int power) { return power <= FB_BLANK_NORMAL; }
functions
int ams369fg06_power_on(struct ams369fg06 *lcd) { int ret = 0; struct lcd_platform_data *pd; struct backlight_device *bd; pd = lcd->lcd_pd; bd = lcd->bd; if (pd->power_on) { pd->power_on(lcd->ld, 1); msleep(pd->power_on_delay); }
functions
int ams369fg06_power_off(struct ams369fg06 *lcd) { int ret; struct lcd_platform_data *pd; pd = lcd->lcd_pd; ret = ams369fg06_ldi_disable(lcd); if (ret) { dev_err(lcd->dev, "lcd setting failed.\n"); return -EIO; }
functions
int ams369fg06_power(struct ams369fg06 *lcd, int power) { int ret = 0; if (ams369fg06_power_is_on(power) && !ams369fg06_power_is_on(lcd->power)) ret = ams369fg06_power_on(lcd); else if (!ams369fg06_power_is_on(power) && ams369fg06_power_is_on(lcd->power)) ret = ams369fg06_power_off(lcd); if (!ret) lcd->...
functions
int ams369fg06_get_power(struct lcd_device *ld) { struct ams369fg06 *lcd = lcd_get_data(ld); return lcd->power; }
functions
int ams369fg06_set_power(struct lcd_device *ld, int power) { struct ams369fg06 *lcd = lcd_get_data(ld); if (power != FB_BLANK_UNBLANK && power != FB_BLANK_POWERDOWN && power != FB_BLANK_NORMAL) { dev_err(lcd->dev, "power value should be 0, 1 or 4.\n"); return -EINVAL; }
functions
int ams369fg06_set_brightness(struct backlight_device *bd) { int ret = 0; int brightness = bd->props.brightness; struct ams369fg06 *lcd = bl_get_data(bd); if (brightness < MIN_BRIGHTNESS || brightness > bd->props.max_brightness) { dev_err(&bd->dev, "lcd brightness should be %d to %d.\n", MIN_BRIGHTNESS, MAX...
functions
int ams369fg06_probe(struct spi_device *spi) { int ret = 0; struct ams369fg06 *lcd = NULL; struct lcd_device *ld = NULL; struct backlight_device *bd = NULL; struct backlight_properties props; lcd = devm_kzalloc(&spi->dev, sizeof(struct ams369fg06), GFP_KERNEL); if (!lcd) return -ENOMEM; /* ams369fg06 lcd pa...
functions
int ams369fg06_remove(struct spi_device *spi) { struct ams369fg06 *lcd = spi_get_drvdata(spi); ams369fg06_power(lcd, FB_BLANK_POWERDOWN); return 0; }
functions
int ams369fg06_suspend(struct device *dev) { struct ams369fg06 *lcd = dev_get_drvdata(dev); dev_dbg(dev, "lcd->power = %d\n", lcd->power); /* * when lcd panel is suspend, lcd panel becomes off * regardless of status. */ return ams369fg06_power(lcd, FB_BLANK_POWERDOWN); }
functions
int ams369fg06_resume(struct device *dev) { struct ams369fg06 *lcd = dev_get_drvdata(dev); lcd->power = FB_BLANK_POWERDOWN; return ams369fg06_power(lcd, FB_BLANK_UNBLANK); }
functions
void ams369fg06_shutdown(struct spi_device *spi) { struct ams369fg06 *lcd = spi_get_drvdata(spi); ams369fg06_power(lcd, FB_BLANK_POWERDOWN); }
includes
#include <common.h>
includes
#include <asm/timer.h>
includes
#include <asm/immap.h>
includes
#include <watchdog.h>
defines
#define CONFIG_SYS_WATCHDOG_FREQ (CONFIG_SYS_HZ / 2)
functions
void __udelay(unsigned long usec) { volatile dtmr_t *timerp = (dtmr_t *) (CONFIG_SYS_UDELAY_BASE); uint start, now, tmp; while (usec > 0) { if (usec > 65000) tmp = 65000; else tmp = usec; usec = usec - tmp; /* Set up TIMER 3 as timebase clock */ timerp->tmr = DTIM_DTMR_RST_RST; timerp->tcn = 0; ...
functions
void dtimer_interrupt(void *not_used) { volatile dtmr_t *timerp = (dtmr_t *) (CONFIG_SYS_TMR_BASE); /* check for timer interrupt asserted */ if ((CONFIG_SYS_TMRPND_REG & CONFIG_SYS_TMRINTR_MASK) == CONFIG_SYS_TMRINTR_PEND) { timerp->ter = (DTIM_DTER_CAP | DTIM_DTER_REF); timestamp++; #if defined(CONFIG_WATCH...
functions
int timer_init(void) { volatile dtmr_t *timerp = (dtmr_t *) (CONFIG_SYS_TMR_BASE); timestamp = 0; timerp->tcn = 0; timerp->trr = 0; /* Set up TIMER 4 as clock */ timerp->tmr = DTIM_DTMR_RST_RST; /* initialize and enable timer interrupt */ irq_install_handler(CONFIG_SYS_TMRINTR_NO, dtimer_interrupt, 0); ti...
functions
ulong get_timer(ulong base) { return (timestamp - base); }
functions
void __udelay(unsigned long usec) { volatile pit_t *timerp = (pit_t *) (CONFIG_SYS_UDELAY_BASE); uint tmp; while (usec > 0) { if (usec > 65000) tmp = 65000; else tmp = usec; usec = usec - tmp; /* Set up TIMER 3 as timebase clock */ timerp->pcsr = PIT_PCSR_OVW; timerp->pmr = 0; /* set period to ...
functions
void timer_init(void) { volatile pit_t *timerp = (pit_t *) (CONFIG_SYS_PIT_BASE); timestamp = 0; /* Set up TIMER 4 as poll clock */ timerp->pcsr = PIT_PCSR_OVW; timerp->pmr = lastinc = 0; timerp->pcsr |= PIT_PCSR_PRE(CONFIG_SYS_PIT_PRESCALE) | PIT_PCSR_EN; return 0; }
functions
ulong get_timer(ulong base) { unsigned short now, diff; volatile pit_t *timerp = (pit_t *) (CONFIG_SYS_PIT_BASE); now = timerp->pcntr; diff = -(now - lastinc); timestamp += diff; lastinc = now; return timestamp - base; }
functions
void wait_ticks(unsigned long ticks) { u32 start = get_timer(0); while (get_timer(start) < ticks) ; }
functions
long get_ticks(void) { return get_timer(0); }
functions
long usec2ticks(unsigned long usec) { return get_timer(usec); }
functions
ulong get_tbclk(void) { ulong tbclk; tbclk = CONFIG_SYS_HZ; return tbclk; }
includes
#include <linux/types.h>
includes
#include <linux/slab.h>
includes
#include <linux/device.h>
functions
void session_cleanup(struct session *session) { struct bulk_buffer_descriptor *bulk_buf_descr; struct list_head *pos, *q; /* Unmap still mapped buffers */ list_for_each_safe(pos, q, &session->bulk_buffer_descriptors) { bulk_buf_descr = list_entry(pos, struct bulk_buffer_descriptor, list); MCDRV_DBG_VERBOSE...
functions
void session_set_error_info(struct session *session, int32_t err) { session->session_info.last_error = err; }
functions
int32_t session_get_last_err(struct session *session) { return session->session_info.last_error; }
functions
bool session_remove_bulk_buf(struct session *session, void *virt_addr) { bool ret = true; struct bulk_buffer_descriptor *bulk_buf = NULL; struct bulk_buffer_descriptor *tmp; struct list_head *pos, *q; MCDRV_DBG_VERBOSE(mc_kapi, "Virtual Address = 0x%p", virt_addr); /* Search and remove bulk buffer descript...
functions
uint32_t session_find_bulk_buf(struct session *session, void *virt_addr) { struct bulk_buffer_descriptor *tmp; struct list_head *pos, *q; MCDRV_DBG_VERBOSE(mc_kapi, "Virtual Address = 0x%p", virt_addr); /* Search and return buffer descriptor handle */ list_for_each_safe(pos, q, &session->bulk_buffer_descrip...
includes
#include <acpi/button.h>
includes
#include <linux/dmi.h>
includes
#include <linux/i2c.h>
includes
#include <linux/slab.h>
includes
#include <linux/acpi.h>
defines
#define PANEL_RATIO_FACTOR 8192
structs
struct intel_lvds_priv { int fitting_mode; u32 pfit_control; u32 pfit_pgm_ratios; };
functions
void intel_lvds_set_backlight(struct drm_device *dev, int level) { struct drm_i915_private *dev_priv = dev->dev_private; u32 blc_pwm_ctl, reg; if (HAS_PCH_SPLIT(dev)) reg = BLC_PWM_CPU_CTL; else reg = BLC_PWM_CTL; blc_pwm_ctl = I915_READ(reg) & ~BACKLIGHT_DUTY_CYCLE_MASK; I915_WRITE(reg, (blc_pwm_ctl | ...
functions
u32 intel_lvds_get_max_backlight(struct drm_device *dev) { struct drm_i915_private *dev_priv = dev->dev_private; u32 reg; if (HAS_PCH_SPLIT(dev)) reg = BLC_PWM_PCH_CTL2; else reg = BLC_PWM_CTL; return ((I915_READ(reg) & BACKLIGHT_MODULATION_FREQ_MASK) >> BACKLIGHT_MODULATION_FREQ_SHIFT) * 2; }
functions
void intel_lvds_set_power(struct drm_device *dev, bool on) { struct drm_i915_private *dev_priv = dev->dev_private; u32 pp_status, ctl_reg, status_reg, lvds_reg; if (HAS_PCH_SPLIT(dev)) { ctl_reg = PCH_PP_CONTROL; status_reg = PCH_PP_STATUS; lvds_reg = PCH_LVDS; }
functions
void intel_lvds_dpms(struct drm_encoder *encoder, int mode) { struct drm_device *dev = encoder->dev; if (mode == DRM_MODE_DPMS_ON) intel_lvds_set_power(dev, true); else intel_lvds_set_power(dev, false); /* XXX: We never power down the LVDS pairs. */ }
functions
int intel_lvds_mode_valid(struct drm_connector *connector, struct drm_display_mode *mode) { struct drm_device *dev = connector->dev; struct drm_i915_private *dev_priv = dev->dev_private; struct drm_display_mode *fixed_mode = dev_priv->panel_fixed_mode; if (fixed_mode) { if (mode->hdisplay > fixed_mode->hdis...
functions
bool intel_lvds_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode) { /* * float point operation is not supported . So the PANEL_RATIO_FACTOR * is defined, which can avoid the float point computation when * calculating the panel ratio. */ ...
functions
else if (panel_ratio < desired_ratio) { /* letter */ u32 scaled_height = mode->vdisplay * horiz_scale / PANEL_RATIO_FACTOR; vert_ratio = horiz_ratio; pfit_control |= (HORIZ_AUTO_SCALE | VERT_INTERP_BILINEAR | HORIZ_INTERP_BILINEAR); /* Letterbox will have top/bottom border */ top_...
functions
void intel_lvds_prepare(struct drm_encoder *encoder) { struct drm_device *dev = encoder->dev; struct drm_i915_private *dev_priv = dev->dev_private; u32 reg; if (HAS_PCH_SPLIT(dev)) reg = BLC_PWM_CPU_CTL; else reg = BLC_PWM_CTL; dev_priv->saveBLC_PWM_CTL = I915_READ(reg); dev_priv->backlight_duty_cycle = (d...
functions
void intel_lvds_commit( struct drm_encoder *encoder) { struct drm_device *dev = encoder->dev; struct drm_i915_private *dev_priv = dev->dev_private; if (dev_priv->backlight_duty_cycle == 0) dev_priv->backlight_duty_cycle = intel_lvds_get_max_backlight(dev); intel_lvds_set_power(dev, true); }
functions
void intel_lvds_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode) { struct drm_device *dev = encoder->dev; struct drm_i915_private *dev_priv = dev->dev_private; struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder); struct intel_lvds_p...
functions
drm_connector_status intel_lvds_detect(struct drm_connector *connector) { struct drm_device *dev = connector->dev; enum drm_connector_status status = connector_status_connected; /* ACPI lid methods were generally unreliable in this generation, so * don't even bother. */ if (IS_GEN2(dev) || IS_GEN3(dev)) retu...
functions
int intel_lvds_get_modes(struct drm_connector *connector) { struct drm_device *dev = connector->dev; struct drm_encoder *encoder = intel_attached_encoder(connector); struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder); struct drm_i915_private *dev_priv = dev->dev_private; int ret = 0; if (dev_pri...
functions
int intel_no_modeset_on_lid_dmi_callback(const struct dmi_system_id *id) { DRM_DEBUG_KMS("Skipping forced modeset for %s\n", id->ident); return 1; }
functions
int intel_lid_notify(struct notifier_block *nb, unsigned long val, void *unused) { struct drm_i915_private *dev_priv = container_of(nb, struct drm_i915_private, lid_notifier); struct drm_device *dev = dev_priv->dev; struct drm_connector *connector = dev_priv->int_lvds_connector; /* * check and update th...
functions
void intel_lvds_destroy(struct drm_connector *connector) { struct drm_device *dev = connector->dev; struct drm_i915_private *dev_priv = dev->dev_private; if (dev_priv->lid_notifier.notifier_call) acpi_lid_notifier_unregister(&dev_priv->lid_notifier); drm_sysfs_connector_remove(connector); drm_connector_cleanup(...
functions
int intel_lvds_set_property(struct drm_connector *connector, struct drm_property *property, uint64_t value) { struct drm_device *dev = connector->dev; if (property == dev->mode_config.scaling_mode_property && connector->encoder) { struct drm_crtc *crtc = connector->encoder->crtc; struct drm_enc...
functions
void intel_lvds_enc_destroy(struct drm_encoder *encoder) { struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder); if (intel_encoder->ddc_bus) intel_i2c_destroy(intel_encoder->ddc_bus); drm_encoder_cleanup(encoder); kfree(intel_encoder); }
functions
__init intel_no_lvds_dmi_callback(const struct dmi_system_id *id) { DRM_DEBUG_KMS("Skipping LVDS initialization for %s\n", id->ident); return 1; }