Re: [PATCH] ADP1653 board code for Nokia RX-51
Hi! > +static int __init rx51_camera_hw_init(void) > +{ > + int rval; > + > + rval = rx51_adp1653_init(); > + if (rval) > + return rval; > + > + return 0; > +} "return rx51_adp1653_init()". Or better yet, rename rx51_adp1653_init to rx51_camera_hw_init. Thanks for all the n900 work, btw :-). > +static struct adp1653_platform_data rx51_adp1653_platform_data = { > + .power = rx51_adp1653_power, > + /* Must be limited to 500 ms in RX-51 */ > + .max_flash_timeout = 50, /* us */ > + /* Must be limited to 320 mA in RX-51 B3 and newer hardware */ > + .max_flash_intensity = ADP1653_FLASH_INTENSITY_REG_TO_mA(19), > + /* Must be limited to 50 mA in RX-51 */ > + .max_torch_intensity = > ADP1653_FLASH_INTENSITY_REG_TO_mA(1), So we do 1mA to be safe? Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] ADP1653 board code for Nokia RX-51
Hi! +static int __init rx51_camera_hw_init(void) +{ + int rval; + + rval = rx51_adp1653_init(); + if (rval) + return rval; + + return 0; +} return rx51_adp1653_init(). Or better yet, rename rx51_adp1653_init to rx51_camera_hw_init. Thanks for all the n900 work, btw :-). +static struct adp1653_platform_data rx51_adp1653_platform_data = { + .power = rx51_adp1653_power, + /* Must be limited to 500 ms in RX-51 */ + .max_flash_timeout = 50, /* us */ + /* Must be limited to 320 mA in RX-51 B3 and newer hardware */ + .max_flash_intensity = ADP1653_FLASH_INTENSITY_REG_TO_mA(19), + /* Must be limited to 50 mA in RX-51 */ + .max_torch_intensity = ADP1653_FLASH_INTENSITY_REG_TO_mA(1), So we do 1mA to be safe? Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] ADP1653 board code for Nokia RX-51
Hi, On Sun, Feb 17, 2013 at 04:16:49PM +0100, Pali Rohár wrote: > I'm sending ADP1653 flash torch board code for Nokia RX-51. Kernel > driver ADP1653 is already in upstream kernel. Board code was extracted > from this big camera meego patch: > > https://api.pub.meego.com/public/source/CE:Adaptation:N900/kernel-adaptation-n900/linux-2.6-Camera-for-Meego-N900-Adaptation-kernel-2.6.37-patch.patch You need to sign-off the patch. > --- /dev/null > +++ b/arch/arm/mach-omap2/board-rx51-camera.c I'm not sure if adding a new file is sensible. There are already 3 board files for RX-51, which I think is overkill. > @@ -0,0 +1,177 @@ > +/* > + * arch/arm/mach-omap2/board-rx51-camera.c > + * > + * Copyright (C) 2008 Nokia Corporation > + * > + * Contact: Sakari Ailus > + * Tuukka Toivonen You should put these people to CC... Just to see if the addresses are still valid (which I doubt). > +static int __init rx51_adp1653_init(void) > +{ > + int err; > + > + err = gpio_request(ADP1653_GPIO_ENABLE, "adp1653 enable"); > + if (err) { > + printk(KERN_ERR ADP1653_NAME > +" Failed to request EN gpio\n"); > + err = -ENODEV; > + goto err_omap_request_gpio; > + } > + > + err = gpio_request(ADP1653_GPIO_INT, "adp1653 interrupt"); > + if (err) { > + printk(KERN_ERR ADP1653_NAME " Failed to request IRQ gpio\n"); > + err = -ENODEV; > + goto err_omap_request_gpio_2; > + } > + > + err = gpio_request(ADP1653_GPIO_STROBE, "adp1653 strobe"); > + if (err) { > + printk(KERN_ERR ADP1653_NAME > +" Failed to request STROBE gpio\n"); > + err = -ENODEV; > + goto err_omap_request_gpio_3; > + } > + > + gpio_direction_output(ADP1653_GPIO_ENABLE, 0); > + gpio_direction_input(ADP1653_GPIO_INT); > + gpio_direction_output(ADP1653_GPIO_STROBE, 0); gpio_request_array() should be used. > +void __init rx51_camera_init(void) > +{ > + if (rx51_camera_hw_init()) { > + printk(KERN_WARNING "%s: Unable to initialize camera\n", > +__func__); > + return; > + } > + > + if (omap3_init_camera(_isp_platform_data) < 0) > + printk(KERN_WARNING "%s: Unable to register camera platform " > +"device\n", __func__); pr_warn() should be used. A. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] ADP1653 board code for Nokia RX-51
Hello, I'm sending ADP1653 flash torch board code for Nokia RX-51. Kernel driver ADP1653 is already in upstream kernel. Board code was extracted from this big camera meego patch: https://api.pub.meego.com/public/source/CE:Adaptation:N900/kernel-adaptation-n900/linux-2.6-Camera-for-Meego-N900-Adaptation-kernel-2.6.37-patch.patch diff --git a/arch/arm/mach-omap2/board-rx51.c b/arch/arm/mach-omap2/board-rx51.c index d0374ea..92117a13 100644 --- a/arch/arm/mach-omap2/board-rx51.c +++ b/arch/arm/mach-omap2/board-rx51.c @@ -75,6 +75,7 @@ static struct platform_device leds_gpio = { */ extern void __init rx51_peripherals_init(void); +extern void __init rx51_camera_init(void); #ifdef CONFIG_OMAP_MUX static struct omap_board_mux board_mux[] __initdata = { @@ -100,6 +101,7 @@ static void __init rx51_init(void) usb_musb_init(_board_data); rx51_peripherals_init(); + rx51_camera_init(); /* Ensure SDRC pins are mux'd for self-refresh */ omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); diff --git a/arch/arm/mach-omap2/board-rx51-camera.c b/arch/arm/mach-omap2/board-rx51-camera.c new file mode 100644 index 000..26b37ea --- /dev/null +++ b/arch/arm/mach-omap2/board-rx51-camera.c @@ -0,0 +1,177 @@ +/* + * arch/arm/mach-omap2/board-rx51-camera.c + * + * Copyright (C) 2008 Nokia Corporation + * + * Contact: Sakari Ailus + * Tuukka Toivonen + * + * 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. + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + */ + +#include +#include + +#include + +#include "../../../drivers/media/platform/omap3isp/isp.h" + +#include + +#include "devices.h" + +#define ADP1653_GPIO_ENABLE88 /* Used for resetting ADP1653 */ +#define ADP1653_GPIO_INT 167 /* Fault interrupt */ +#define ADP1653_GPIO_STROBE126 /* Pin used in cam_strobe mode -> +* control using ISP drivers */ + +static int __init rx51_adp1653_init(void) +{ + int err; + + err = gpio_request(ADP1653_GPIO_ENABLE, "adp1653 enable"); + if (err) { + printk(KERN_ERR ADP1653_NAME + " Failed to request EN gpio\n"); + err = -ENODEV; + goto err_omap_request_gpio; + } + + err = gpio_request(ADP1653_GPIO_INT, "adp1653 interrupt"); + if (err) { + printk(KERN_ERR ADP1653_NAME " Failed to request IRQ gpio\n"); + err = -ENODEV; + goto err_omap_request_gpio_2; + } + + err = gpio_request(ADP1653_GPIO_STROBE, "adp1653 strobe"); + if (err) { + printk(KERN_ERR ADP1653_NAME + " Failed to request STROBE gpio\n"); + err = -ENODEV; + goto err_omap_request_gpio_3; + } + + gpio_direction_output(ADP1653_GPIO_ENABLE, 0); + gpio_direction_input(ADP1653_GPIO_INT); + gpio_direction_output(ADP1653_GPIO_STROBE, 0); + + return 0; + +err_omap_request_gpio_3: + gpio_free(ADP1653_GPIO_INT); + +err_omap_request_gpio_2: + gpio_free(ADP1653_GPIO_ENABLE); + +err_omap_request_gpio: + return err; +} + +static int __init rx51_camera_hw_init(void) +{ + int rval; + + rval = rx51_adp1653_init(); + if (rval) + return rval; + + return 0; +} + +/* + * + * ADP1653 + * + */ + +static int rx51_adp1653_power(struct v4l2_subdev *subdev, int on) +{ + gpio_set_value(ADP1653_GPIO_ENABLE, on); + if (on) { + /* Some delay is apparently required. */ + udelay(20); + } + + return 0; +} + +static struct adp1653_platform_data rx51_adp1653_platform_data = { + .power = rx51_adp1653_power, + /* Must be limited to 500 ms in RX-51 */ + .max_flash_timeout = 50, /* us */ + /* Must be limited to 320 mA in RX-51 B3 and newer hardware */ + .max_flash_intensity = ADP1653_FLASH_INTENSITY_REG_TO_mA(19), + /* Must be limited to 50 mA in RX-51 */ + .max_torch_intensity = ADP1653_FLASH_INTENSITY_REG_TO_mA(1), + .max_indicator_intensity = ADP1653_INDICATOR_INTENSITY_REG_TO_uA( + ADP1653_REG_OUT_SEL_ILED_MAX), +}; + +/* + * + * Init it all + * + */ + +#define ADP1653_I2C_BUS_NUM2 + +static struct i2c_board_info rx51_camera_i2c_devices[] = { + { +
[PATCH] ADP1653 board code for Nokia RX-51
Hello, I'm sending ADP1653 flash torch board code for Nokia RX-51. Kernel driver ADP1653 is already in upstream kernel. Board code was extracted from this big camera meego patch: https://api.pub.meego.com/public/source/CE:Adaptation:N900/kernel-adaptation-n900/linux-2.6-Camera-for-Meego-N900-Adaptation-kernel-2.6.37-patch.patch diff --git a/arch/arm/mach-omap2/board-rx51.c b/arch/arm/mach-omap2/board-rx51.c index d0374ea..92117a13 100644 --- a/arch/arm/mach-omap2/board-rx51.c +++ b/arch/arm/mach-omap2/board-rx51.c @@ -75,6 +75,7 @@ static struct platform_device leds_gpio = { */ extern void __init rx51_peripherals_init(void); +extern void __init rx51_camera_init(void); #ifdef CONFIG_OMAP_MUX static struct omap_board_mux board_mux[] __initdata = { @@ -100,6 +101,7 @@ static void __init rx51_init(void) usb_musb_init(musb_board_data); rx51_peripherals_init(); + rx51_camera_init(); /* Ensure SDRC pins are mux'd for self-refresh */ omap_mux_init_signal(sdrc_cke0, OMAP_PIN_OUTPUT); diff --git a/arch/arm/mach-omap2/board-rx51-camera.c b/arch/arm/mach-omap2/board-rx51-camera.c new file mode 100644 index 000..26b37ea --- /dev/null +++ b/arch/arm/mach-omap2/board-rx51-camera.c @@ -0,0 +1,177 @@ +/* + * arch/arm/mach-omap2/board-rx51-camera.c + * + * Copyright (C) 2008 Nokia Corporation + * + * Contact: Sakari Ailus sakari.ai...@nokia.com + * Tuukka Toivonen tuukka.o.toivo...@nokia.com + * + * 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. + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + */ + +#include linux/i2c.h +#include linux/delay.h + +#include asm/gpio.h + +#include ../../../drivers/media/platform/omap3isp/isp.h + +#include media/adp1653.h + +#include devices.h + +#define ADP1653_GPIO_ENABLE88 /* Used for resetting ADP1653 */ +#define ADP1653_GPIO_INT 167 /* Fault interrupt */ +#define ADP1653_GPIO_STROBE126 /* Pin used in cam_strobe mode - +* control using ISP drivers */ + +static int __init rx51_adp1653_init(void) +{ + int err; + + err = gpio_request(ADP1653_GPIO_ENABLE, adp1653 enable); + if (err) { + printk(KERN_ERR ADP1653_NAME + Failed to request EN gpio\n); + err = -ENODEV; + goto err_omap_request_gpio; + } + + err = gpio_request(ADP1653_GPIO_INT, adp1653 interrupt); + if (err) { + printk(KERN_ERR ADP1653_NAME Failed to request IRQ gpio\n); + err = -ENODEV; + goto err_omap_request_gpio_2; + } + + err = gpio_request(ADP1653_GPIO_STROBE, adp1653 strobe); + if (err) { + printk(KERN_ERR ADP1653_NAME + Failed to request STROBE gpio\n); + err = -ENODEV; + goto err_omap_request_gpio_3; + } + + gpio_direction_output(ADP1653_GPIO_ENABLE, 0); + gpio_direction_input(ADP1653_GPIO_INT); + gpio_direction_output(ADP1653_GPIO_STROBE, 0); + + return 0; + +err_omap_request_gpio_3: + gpio_free(ADP1653_GPIO_INT); + +err_omap_request_gpio_2: + gpio_free(ADP1653_GPIO_ENABLE); + +err_omap_request_gpio: + return err; +} + +static int __init rx51_camera_hw_init(void) +{ + int rval; + + rval = rx51_adp1653_init(); + if (rval) + return rval; + + return 0; +} + +/* + * + * ADP1653 + * + */ + +static int rx51_adp1653_power(struct v4l2_subdev *subdev, int on) +{ + gpio_set_value(ADP1653_GPIO_ENABLE, on); + if (on) { + /* Some delay is apparently required. */ + udelay(20); + } + + return 0; +} + +static struct adp1653_platform_data rx51_adp1653_platform_data = { + .power = rx51_adp1653_power, + /* Must be limited to 500 ms in RX-51 */ + .max_flash_timeout = 50, /* us */ + /* Must be limited to 320 mA in RX-51 B3 and newer hardware */ + .max_flash_intensity = ADP1653_FLASH_INTENSITY_REG_TO_mA(19), + /* Must be limited to 50 mA in RX-51 */ + .max_torch_intensity = ADP1653_FLASH_INTENSITY_REG_TO_mA(1), + .max_indicator_intensity = ADP1653_INDICATOR_INTENSITY_REG_TO_uA( + ADP1653_REG_OUT_SEL_ILED_MAX), +}; + +/* + * + * Init it all + * + */ + +#define ADP1653_I2C_BUS_NUM2
Re: [PATCH] ADP1653 board code for Nokia RX-51
Hi, On Sun, Feb 17, 2013 at 04:16:49PM +0100, Pali Rohár wrote: I'm sending ADP1653 flash torch board code for Nokia RX-51. Kernel driver ADP1653 is already in upstream kernel. Board code was extracted from this big camera meego patch: https://api.pub.meego.com/public/source/CE:Adaptation:N900/kernel-adaptation-n900/linux-2.6-Camera-for-Meego-N900-Adaptation-kernel-2.6.37-patch.patch You need to sign-off the patch. --- /dev/null +++ b/arch/arm/mach-omap2/board-rx51-camera.c I'm not sure if adding a new file is sensible. There are already 3 board files for RX-51, which I think is overkill. @@ -0,0 +1,177 @@ +/* + * arch/arm/mach-omap2/board-rx51-camera.c + * + * Copyright (C) 2008 Nokia Corporation + * + * Contact: Sakari Ailus sakari.ai...@nokia.com + * Tuukka Toivonen tuukka.o.toivo...@nokia.com You should put these people to CC... Just to see if the addresses are still valid (which I doubt). +static int __init rx51_adp1653_init(void) +{ + int err; + + err = gpio_request(ADP1653_GPIO_ENABLE, adp1653 enable); + if (err) { + printk(KERN_ERR ADP1653_NAME + Failed to request EN gpio\n); + err = -ENODEV; + goto err_omap_request_gpio; + } + + err = gpio_request(ADP1653_GPIO_INT, adp1653 interrupt); + if (err) { + printk(KERN_ERR ADP1653_NAME Failed to request IRQ gpio\n); + err = -ENODEV; + goto err_omap_request_gpio_2; + } + + err = gpio_request(ADP1653_GPIO_STROBE, adp1653 strobe); + if (err) { + printk(KERN_ERR ADP1653_NAME + Failed to request STROBE gpio\n); + err = -ENODEV; + goto err_omap_request_gpio_3; + } + + gpio_direction_output(ADP1653_GPIO_ENABLE, 0); + gpio_direction_input(ADP1653_GPIO_INT); + gpio_direction_output(ADP1653_GPIO_STROBE, 0); gpio_request_array() should be used. +void __init rx51_camera_init(void) +{ + if (rx51_camera_hw_init()) { + printk(KERN_WARNING %s: Unable to initialize camera\n, +__func__); + return; + } + + if (omap3_init_camera(rx51_isp_platform_data) 0) + printk(KERN_WARNING %s: Unable to register camera platform +device\n, __func__); pr_warn() should be used. A. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/