From patchwork Sat Jul 12 09:30:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 33519 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f198.google.com (mail-qc0-f198.google.com [209.85.216.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A033820672 for ; Sat, 12 Jul 2014 09:31:09 +0000 (UTC) Received: by mail-qc0-f198.google.com with SMTP id l6sf4903518qcy.9 for ; Sat, 12 Jul 2014 02:31:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=+jQgeFsGX/wFiWLJFOjJYqYxLmj1E/THeRbB+dQN0/c=; b=LFCI6EungTAWIoWIFscGPlW2wBIYW6QEbMqGeWteyS7DoWaqPDRZyrSrIxBZ0pHPoR RGyfRG0tYeSm+YFDsHrF8mtEnuV/uPJqnQEcxQCO+zgMKkVe+WxVB8aucgdUBiQGYAF4 n4latNTr7i81l79uHba7Ne0CuwD74PYRYUQDeBJj4kCp1PWc2G7VR5FaH3EFKG6PqX/7 Jn5P+7vENDpmzZUx55poUloGYi/nfMh+iefLLAxkDOV1UN1tpzLjdYYaN4+g+az9fDtx mO0RBQZyBzOtMLNx00gswsmkUS5hk2a0MRakD0P7ts9OLlQMHhwS5BqWxey51i0wXhRh /uUA== X-Gm-Message-State: ALoCoQmWYTd7Tx0X0je7Lv07qNP2rqO2DNs8EXd+255XLqDb4YQXRPRjDs3zA7FoZuI0rgrtC9es X-Received: by 10.236.99.8 with SMTP id w8mr1779281yhf.31.1405157468074; Sat, 12 Jul 2014 02:31:08 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.20.132 with SMTP id 4ls612368qgj.12.gmail; Sat, 12 Jul 2014 02:31:08 -0700 (PDT) X-Received: by 10.52.241.76 with SMTP id wg12mr3752136vdc.5.1405157467995; Sat, 12 Jul 2014 02:31:07 -0700 (PDT) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id g8si3446949vcu.26.2014.07.12.02.31.07 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 12 Jul 2014 02:31:07 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.174 as permitted sender) client-ip=209.85.220.174; Received: by mail-vc0-f174.google.com with SMTP id hy4so3951921vcb.5 for ; Sat, 12 Jul 2014 02:31:07 -0700 (PDT) X-Received: by 10.58.29.16 with SMTP id f16mr4689135veh.23.1405157467894; Sat, 12 Jul 2014 02:31:07 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp100972vcb; Sat, 12 Jul 2014 02:31:07 -0700 (PDT) X-Received: by 10.70.42.109 with SMTP id n13mr4390161pdl.36.1405157467099; Sat, 12 Jul 2014 02:31:07 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id no12si2450512pdb.199.2014.07.12.02.31.05; Sat, 12 Jul 2014 02:31:05 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752253AbaGLJaz (ORCPT + 28 others); Sat, 12 Jul 2014 05:30:55 -0400 Received: from mail-we0-f170.google.com ([74.125.82.170]:34029 "EHLO mail-we0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752037AbaGLJax (ORCPT ); Sat, 12 Jul 2014 05:30:53 -0400 Received: by mail-we0-f170.google.com with SMTP id w62so1810734wes.15 for ; Sat, 12 Jul 2014 02:30:51 -0700 (PDT) X-Received: by 10.180.81.234 with SMTP id d10mr11777740wiy.79.1405157451615; Sat, 12 Jul 2014 02:30:51 -0700 (PDT) Received: from localhost.localdomain.localdomain (smb-rsycl-02.wifihubtelecom.net. [213.174.124.178]) by mx.google.com with ESMTPSA id o2sm4786667wia.16.2014.07.12.02.30.49 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 12 Jul 2014 02:30:50 -0700 (PDT) From: Linus Walleij To: Jingoo Han , Bryan Wu , Lee Jones , linux-kernel@vger.kernel.org Cc: Linus Walleij Subject: [PATCH] fb: backlight: add driver for iPAQ micro backlight Date: Sat, 12 Jul 2014 11:30:40 +0200 Message-Id: <1405157440-10283-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.9.3 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linus.walleij@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.174 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This adds a driver for the backlight controlled by the microcontroller on the Compaq iPAQ series of handheld computers: h3100, h3600 and h3700. Signed-off-by: Linus Walleij --- drivers/video/backlight/Kconfig | 9 ++++ drivers/video/backlight/Makefile | 1 + drivers/video/backlight/ipaq_micro_bl.c | 89 +++++++++++++++++++++++++++++++++ 3 files changed, 99 insertions(+) create mode 100644 drivers/video/backlight/ipaq_micro_bl.c diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig index 5d449059a556..cc153f55d9f9 100644 --- a/drivers/video/backlight/Kconfig +++ b/drivers/video/backlight/Kconfig @@ -207,6 +207,15 @@ config BACKLIGHT_GENERIC known as the Corgi backlight driver. If you have a Sharp Zaurus SL-C7xx, SL-Cxx00 or SL-6000x say y. +config BACKLIGHT_IPAQ_MICRO + tristate "iPAQ microcontroller backlight driver" + depends on MFD_IPAQ_MICRO + default y + help + Say y to enable the backlight driver for Compaq iPAQ handheld + computers. Say yes if you have one of the h3100/h3600/h3700 + machines. + config BACKLIGHT_LM3533 tristate "Backlight Driver for LM3533" depends on BACKLIGHT_CLASS_DEVICE diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile index bb820024f346..a9ea34a39cad 100644 --- a/drivers/video/backlight/Makefile +++ b/drivers/video/backlight/Makefile @@ -36,6 +36,7 @@ obj-$(CONFIG_BACKLIGHT_GENERIC) += generic_bl.o obj-$(CONFIG_BACKLIGHT_GPIO) += gpio_backlight.o obj-$(CONFIG_BACKLIGHT_HP680) += hp680_bl.o obj-$(CONFIG_BACKLIGHT_HP700) += jornada720_bl.o +obj-$(CONFIG_BACKLIGHT_IPAQ_MICRO) += ipaq_micro_bl.o obj-$(CONFIG_BACKLIGHT_LM3533) += lm3533_bl.o obj-$(CONFIG_BACKLIGHT_LM3630A) += lm3630a_bl.o obj-$(CONFIG_BACKLIGHT_LM3639) += lm3639_bl.o diff --git a/drivers/video/backlight/ipaq_micro_bl.c b/drivers/video/backlight/ipaq_micro_bl.c new file mode 100644 index 000000000000..b7ec8c453b61 --- /dev/null +++ b/drivers/video/backlight/ipaq_micro_bl.c @@ -0,0 +1,89 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * iPAQ microcontroller backlight support + * Author : Linus Walleij + */ + +#include +#include +#include +#include +#include +#include +#include + +static int micro_bl_update_status(struct backlight_device *bd) +{ + struct ipaq_micro *micro = dev_get_drvdata(&bd->dev); + int intensity = bd->props.brightness; + struct ipaq_micro_msg msg = { + .id = MSG_BACKLIGHT, + .tx_len = 3, + }; + + if (bd->props.power != FB_BLANK_UNBLANK) + intensity = 0; + if (bd->props.state & BL_CORE_FBBLANK) + intensity = 0; + if (bd->props.state & BL_CORE_SUSPENDED) + intensity = 0; + + msg.tx_data[0] = 0x01; + msg.tx_data[1] = intensity > 0 ? 1 : 0; + msg.tx_data[2] = intensity; + return ipaq_micro_tx_msg_sync(micro, &msg); +} + +static const struct backlight_ops micro_bl_ops = { + .options = BL_CORE_SUSPENDRESUME, + .update_status = micro_bl_update_status, +}; + +static struct backlight_properties micro_bl_props = { + .type = BACKLIGHT_RAW, + .max_brightness = 255, + .power = FB_BLANK_UNBLANK, + .brightness = 64, +}; + +static int micro_backlight_probe(struct platform_device *pdev) +{ + struct backlight_device *bd; + struct ipaq_micro *micro = dev_get_drvdata(pdev->dev.parent); + + bd = devm_backlight_device_register( + &pdev->dev, + "ipaq-micro-backlight", + &pdev->dev, + micro, + µ_bl_ops, + µ_bl_props); + if (IS_ERR(bd)) + return PTR_ERR(bd); + platform_set_drvdata(pdev, bd); + backlight_update_status(bd); + dev_info(&pdev->dev, "iPAQ micro backlight driver\n"); + + return 0; +} + +static int micro_backlight_remove(struct platform_device *pdev) +{ + return 0; +} + +struct platform_driver micro_backlight_device_driver = { + .driver = { + .name = "ipaq-micro-backlight", + }, + .probe = micro_backlight_probe, + .remove = micro_backlight_remove, +}; +module_platform_driver(micro_backlight_device_driver); + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("driver for iPAQ Atmel micro backlight"); +MODULE_ALIAS("platform:ipaq-micro-backlight");